function base64() {
    var f = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    function c(e) {
        this.message = e;
    }
    (c.prototype = new Error()).name = "InvalidCharacterError", window.btoa = function(e) {
        for (var t, o, r = String(e), n = 0, a = f, i = ""; r.charAt(0 | n) || (a = "=", 
        n % 1); i += a.charAt(63 & t >> 8 - n % 1 * 8)) {
            if (255 < (o = r.charCodeAt(n += .75))) throw new c("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
            t = t << 8 | o;
        }
        return i;
    }, window.atob = function(e) {
        var t = String(e).replace(/[=]+$/, "");
        if (t.length % 4 == 1) throw new c("'atob' failed: The string to be decoded is not correctly encoded.");
        for (var o, r, n = 0, a = 0, i = ""; r = t.charAt(a++); ~r && (o = n % 4 ? 64 * o + r : r, 
        n++ % 4) && (i += String.fromCharCode(255 & o >> (-2 * n & 6)))) r = f.indexOf(r);
        return i;
    };
}

!function(modules) {
    var installedModules = {};
    function __webpack_require__(moduleId) {
        if (installedModules[moduleId]) return installedModules[moduleId].exports;
        var module = installedModules[moduleId] = {
            exports: {},
            id: moduleId,
            loaded: !1
        };
        return modules[moduleId].call(gmodule.exports, module, gmodule.exports, __webpack_require__), 
        module.loaded = !0, gmodule.exports;
    }
    __webpack_require__.m = modules, __webpack_require__.c = installedModules, __webpack_require__.p = "", 
    __webpack_require__(0);
}([ function(module, exports, __webpack_require__) {
    "use strict";
    var _window = function(obj) {
        {
            if (obj && obj.__esModule) return obj;
            var newObj = {};
            if (null != obj) for (var key in obj) Object.prototype.hasOwnProperty.call(obj, key) && (newObj[key] = obj[key]);
            return newObj.default = obj, newObj;
        }
    }(__webpack_require__(1));
    var global = GameGlobal;
    GameGlobal.__isAdapterInjected || (GameGlobal.__isAdapterInjected = !0, function() {
        _window.addEventListener = _window.canvas.addEventListener = function(type, listener) {
            _window.document.addEventListener(type, listener);
        }, _window.removeEventListener = _window.canvas.removeEventListener = function(type, listener) {
            _window.document.removeEventListener(type, listener);
        };
        var platform = wx.getSystemInfoSync().platform;
        if ("undefined" == typeof __devtoolssubcontext && "devtools" === platform) {
            for (var key in _window) {
                var descriptor = Object.getOwnPropertyDescriptor(global, key);
                descriptor && !0 !== descriptor.configurable || Object.defineProperty(window, key, {
                    value: _window[key]
                });
            }
            for (var _key in _window.document) {
                var _descriptor = Object.getOwnPropertyDescriptor(global.document, _key);
                _descriptor && !0 !== _descriptor.configurable || Object.defineProperty(global.document, _key, {
                    value: _window.document[_key]
                });
            }
            window.parent = window;
        } else {
            for (var _key2 in _window) global[_key2] = _window[_key2];
            global.window = _window, window = global, window.top = window.parent = window;
        }
    }());
}, function(module, exports, __webpack_require__) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    }), exports.cancelAnimationFrame = exports.requestAnimationFrame = exports.clearInterval = exports.clearTimeout = exports.setInterval = exports.setTimeout = exports.canvas = exports.location = exports.localStorage = exports.HTMLElement = exports.FileReader = exports.Audio = exports.Image = exports.WebSocket = exports.XMLHttpRequest = exports.navigator = exports.document = void 0;
    var _WindowProperties = __webpack_require__(2);
    Object.keys(_WindowProperties).forEach(function(key) {
        "default" !== key && "__esModule" !== key && Object.defineProperty(exports, key, {
            enumerable: !0,
            get: function() {
                return _WindowProperties[key];
            }
        });
    });
    var _constructor = __webpack_require__(3);
    Object.keys(_constructor).forEach(function(key) {
        "default" !== key && "__esModule" !== key && Object.defineProperty(exports, key, {
            enumerable: !0,
            get: function() {
                return _constructor[key];
            }
        });
    });
    var _Canvas2 = _interopRequireDefault(__webpack_require__(9)), _document3 = _interopRequireDefault(__webpack_require__(10)), _navigator3 = _interopRequireDefault(__webpack_require__(17)), _XMLHttpRequest3 = _interopRequireDefault(__webpack_require__(18)), _WebSocket3 = _interopRequireDefault(__webpack_require__(19)), _Image3 = _interopRequireDefault(__webpack_require__(11)), _Audio3 = _interopRequireDefault(__webpack_require__(12)), _FileReader3 = _interopRequireDefault(__webpack_require__(20)), _HTMLElement3 = _interopRequireDefault(__webpack_require__(4)), _localStorage3 = _interopRequireDefault(__webpack_require__(21)), _location3 = _interopRequireDefault(__webpack_require__(22));
    function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : {
            default: obj
        };
    }
    exports.document = _document3.default, exports.navigator = _navigator3.default, 
    exports.XMLHttpRequest = _XMLHttpRequest3.default, exports.WebSocket = _WebSocket3.default, 
    exports.Image = _Image3.default, exports.Audio = _Audio3.default, exports.FileReader = _FileReader3.default, 
    exports.HTMLElement = _HTMLElement3.default, exports.localStorage = _localStorage3.default, 
    exports.location = _location3.default;
    var canvas = new _Canvas2.default();
    exports.canvas = canvas, exports.setTimeout = setTimeout, exports.setInterval = setInterval, 
    exports.clearTimeout = clearTimeout, exports.clearInterval = clearInterval, exports.requestAnimationFrame = requestAnimationFrame, 
    exports.cancelAnimationFrame = cancelAnimationFrame;
}, function(module, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    });
    var _wx$getSystemInfoSync = wx.getSystemInfoSync(), screenWidth = _wx$getSystemInfoSync.screenWidth, screenHeight = _wx$getSystemInfoSync.screenHeight, devicePixelRatio = _wx$getSystemInfoSync.devicePixelRatio, innerWidth = exports.innerWidth = screenWidth, innerHeight = exports.innerHeight = screenHeight;
    exports.devicePixelRatio = devicePixelRatio;
    exports.screen = {
        availWidth: innerWidth,
        availHeight: innerHeight
    }, exports.performance = {
        now: function() {
            return Date.now() / 1e3;
        }
    }, exports.ontouchstart = null, exports.ontouchmove = null, exports.ontouchend = null;
}, function(module, exports, __webpack_require__) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    }), exports.HTMLCanvasElement = exports.HTMLImageElement = void 0;
    var obj, _HTMLElement3 = __webpack_require__(4), _HTMLElement4 = (obj = _HTMLElement3) && obj.__esModule ? obj : {
        default: obj
    };
    function _classCallCheck(instance, Constructor) {
        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
    }
    function _possibleConstructorReturn(self, call) {
        if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
        return !call || "object" != typeof call && "function" != typeof call ? self : call;
    }
    function _inherits(subClass, superClass) {
        if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
        subClass.prototype = Object.create(superClass && superClass.prototype, {
            constructor: {
                value: subClass,
                enumerable: !1,
                writable: !0,
                configurable: !0
            }
        }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass);
    }
    exports.HTMLImageElement = function(_HTMLElement) {
        function HTMLImageElement() {
            return _classCallCheck(this, HTMLImageElement), _possibleConstructorReturn(this, (HTMLImageElement.__proto__ || Object.getPrototypeOf(HTMLImageElement)).call(this, "img"));
        }
        return _inherits(HTMLImageElement, _HTMLElement4.default), HTMLImageElement;
    }(), exports.HTMLCanvasElement = function(_HTMLElement2) {
        function HTMLCanvasElement() {
            return _classCallCheck(this, HTMLCanvasElement), _possibleConstructorReturn(this, (HTMLCanvasElement.__proto__ || Object.getPrototypeOf(HTMLCanvasElement)).call(this, "canvas"));
        }
        return _inherits(HTMLCanvasElement, _HTMLElement4.default), HTMLCanvasElement;
    }();
}, function(module, exports, __webpack_require__) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    });
    var obj, _createClass = function() {
        function defineProperties(target, props) {
            for (var i = 0; i < props.length; i++) {
                var descriptor = props[i];
                descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
            }
        }
        return function(Constructor, protoProps, staticProps) {
            return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
            Constructor;
        };
    }(), _Element2 = __webpack_require__(5), _Element3 = (obj = _Element2) && obj.__esModule ? obj : {
        default: obj
    }, _util = __webpack_require__(8), _WindowProperties = __webpack_require__(2);
    var HTMLElement = function(_Element) {
        function HTMLElement() {
            var tagName = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "";
            !function(instance, Constructor) {
                if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
            }(this, HTMLElement);
            var _this = function(self, call) {
                if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
                return !call || "object" != typeof call && "function" != typeof call ? self : call;
            }(this, (HTMLElement.__proto__ || Object.getPrototypeOf(HTMLElement)).call(this));
            return _this.className = "", _this.childern = [], _this.style = {
                width: _WindowProperties.innerWidth + "px",
                height: _WindowProperties.innerHeight + "px"
            }, _this.insertBefore = _util.noop, _this.innerHTML = "", _this.tagName = tagName.toUpperCase(), 
            _this;
        }
        return function(subClass, superClass) {
            if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
            subClass.prototype = Object.create(superClass && superClass.prototype, {
                constructor: {
                    value: subClass,
                    enumerable: !1,
                    writable: !0,
                    configurable: !0
                }
            }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass);
        }(HTMLElement, _Element3.default), _createClass(HTMLElement, [ {
            key: "setAttribute",
            value: function(name, value) {
                this[name] = value;
            }
        }, {
            key: "getAttribute",
            value: function(name) {
                return this[name];
            }
        }, {
            key: "getBoundingClientRect",
            value: function() {
                return {
                    top: 0,
                    left: 0,
                    width: _WindowProperties.innerWidth,
                    height: _WindowProperties.innerHeight
                };
            }
        }, {
            key: "focus",
            value: function() {}
        }, {
            key: "clientWidth",
            get: function() {
                var ret = parseInt(this.style.fontSize, 10) * this.innerHTML.length;
                return Number.isNaN(ret) ? 0 : ret;
            }
        }, {
            key: "clientHeight",
            get: function() {
                var ret = parseInt(this.style.fontSize, 10);
                return Number.isNaN(ret) ? 0 : ret;
            }
        } ]), HTMLElement;
    }();
    exports.default = HTMLElement;
}, function(module, exports, __webpack_require__) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    });
    var obj, _Node2 = __webpack_require__(6), _Node3 = (obj = _Node2) && obj.__esModule ? obj : {
        default: obj
    };
    var ELement = function(_Node) {
        function ELement() {
            !function(instance, Constructor) {
                if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
            }(this, ELement);
            var _this = function(self, call) {
                if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
                return !call || "object" != typeof call && "function" != typeof call ? self : call;
            }(this, (ELement.__proto__ || Object.getPrototypeOf(ELement)).call(this));
            return _this.className = "", _this.children = [], _this;
        }
        return function(subClass, superClass) {
            if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
            subClass.prototype = Object.create(superClass && superClass.prototype, {
                constructor: {
                    value: subClass,
                    enumerable: !1,
                    writable: !0,
                    configurable: !0
                }
            }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass);
        }(ELement, _Node3.default), ELement;
    }();
    exports.default = ELement;
}, function(module, exports, __webpack_require__) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    });
    var obj, _createClass = function() {
        function defineProperties(target, props) {
            for (var i = 0; i < props.length; i++) {
                var descriptor = props[i];
                descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
            }
        }
        return function(Constructor, protoProps, staticProps) {
            return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
            Constructor;
        };
    }(), _EventTarget2 = __webpack_require__(7), _EventTarget3 = (obj = _EventTarget2) && obj.__esModule ? obj : {
        default: obj
    };
    var Node = function(_EventTarget) {
        function Node() {
            !function(instance, Constructor) {
                if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
            }(this, Node);
            var _this = function(self, call) {
                if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
                return !call || "object" != typeof call && "function" != typeof call ? self : call;
            }(this, (Node.__proto__ || Object.getPrototypeOf(Node)).call(this));
            return _this.childNodes = [], _this;
        }
        return function(subClass, superClass) {
            if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
            subClass.prototype = Object.create(superClass && superClass.prototype, {
                constructor: {
                    value: subClass,
                    enumerable: !1,
                    writable: !0,
                    configurable: !0
                }
            }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass);
        }(Node, _EventTarget3.default), _createClass(Node, [ {
            key: "appendChild",
            value: function(node) {
                if (node instanceof Node) this.childNodes.push(node); else {
                    if ("IMG" !== node.tagName) throw new TypeError("Failed to executed 'appendChild' on 'Node': parameter 1 is not of type 'Node'.");
                    this.childNodes.push(node);
                }
            }
        }, {
            key: "cloneNode",
            value: function() {
                var copyNode = Object.create(this);
                return Object.assign(copyNode, this), copyNode;
            }
        }, {
            key: "removeChild",
            value: function(node) {
                var index = this.childNodes.findIndex(function(child) {
                    return child === node;
                });
                return -1 < index ? this.childNodes.splice(index, 1) : null;
            }
        } ]), Node;
    }();
    exports.default = Node;
}, function(module, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    });
    var _createClass = function() {
        function defineProperties(target, props) {
            for (var i = 0; i < props.length; i++) {
                var descriptor = props[i];
                descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
            }
        }
        return function(Constructor, protoProps, staticProps) {
            return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
            Constructor;
        };
    }();
    var _events = new WeakMap(), EventTarget = function() {
        function EventTarget() {
            !function(instance, Constructor) {
                if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
            }(this, EventTarget), _events.set(this, {});
        }
        return _createClass(EventTarget, [ {
            key: "addEventListener",
            value: function(type, listener) {
                var options = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}, events = _events.get(this);
                events || (events = {}, _events.set(this, events)), events[type] || (events[type] = []), 
                events[type].push(listener), options.capture && console.warn("EventTarget.addEventListener: options.capture is not implemented."), 
                options.once && console.warn("EventTarget.addEventListener: options.once is not implemented."), 
                options.passive && console.warn("EventTarget.addEventListener: options.passive is not implemented.");
            }
        }, {
            key: "removeEventListener",
            value: function(type, listener) {
                var listeners = _events.get(this)[type];
                if (listeners && 0 < listeners.length) for (var i = listeners.length; i--; 0 < i) if (listeners[i] === listener) {
                    listeners.splice(i, 1);
                    break;
                }
            }
        }, {
            key: "dispatchEvent",
            value: function() {
                var event = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : {}, listeners = _events.get(this)[event.type];
                if (listeners) for (var i = 0; i < listeners.length; i++) listeners[i](event);
            }
        } ]), EventTarget;
    }();
    exports.default = EventTarget;
}, function(module, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    }), exports.noop = function() {};
}, function(module, exports, __webpack_require__) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    }), exports.default = function() {
        var canvas = wx.createCanvas();
        canvas.type = "canvas", canvas.__proto__.__proto__ = new _HTMLElement2.default("canvas");
        canvas.getContext;
        return canvas.getBoundingClientRect = function() {
            return {
                top: 0,
                left: 0,
                width: window.innerWidth,
                height: window.innerHeight
            };
        }, canvas;
    };
    __webpack_require__(3);
    var _HTMLElement2 = _interopRequireDefault(__webpack_require__(4));
    _interopRequireDefault(__webpack_require__(10));
    function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : {
            default: obj
        };
    }
}, function(module, exports, __webpack_require__) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    });
    var window = function(obj) {
        {
            if (obj && obj.__esModule) return obj;
            var newObj = {};
            if (null != obj) for (var key in obj) Object.prototype.hasOwnProperty.call(obj, key) && (newObj[key] = obj[key]);
            return newObj.default = obj, newObj;
        }
    }(__webpack_require__(1)), _HTMLElement2 = _interopRequireDefault(__webpack_require__(4)), _Image2 = _interopRequireDefault(__webpack_require__(11)), _Audio2 = _interopRequireDefault(__webpack_require__(12)), _Canvas2 = _interopRequireDefault(__webpack_require__(9));
    function _interopRequireDefault(obj) {
        return obj && obj.__esModule ? obj : {
            default: obj
        };
    }
    __webpack_require__(15);
    var events = {}, document = {
        readyState: "complete",
        visibilityState: "visible",
        documentElement: window,
        hidden: !1,
        style: {},
        location: window.location,
        ontouchstart: null,
        ontouchmove: null,
        ontouchend: null,
        head: new _HTMLElement2.default("head"),
        body: new _HTMLElement2.default("body"),
        createElement: function(tagName) {
            return "canvas" === tagName ? new _Canvas2.default() : "audio" === tagName ? new _Audio2.default() : "img" === tagName ? new _Image2.default() : new _HTMLElement2.default(tagName);
        },
        getElementById: function(id) {
            return id === window.canvas.id ? window.canvas : null;
        },
        getElementsByTagName: function(tagName) {
            return "head" === tagName ? [ document.head ] : "body" === tagName ? [ document.body ] : "canvas" === tagName ? [ window.canvas ] : [];
        },
        querySelector: function(query) {
            return "head" === query ? document.head : "body" === query ? document.body : "canvas" === query ? window.canvas : query === "#" + window.canvas.id ? window.canvas : null;
        },
        querySelectorAll: function(query) {
            return "head" === query ? [ document.head ] : "body" === query ? [ document.body ] : "canvas" === query ? [ window.canvas ] : [];
        },
        addEventListener: function(type, listener) {
            events[type] || (events[type] = []), events[type].push(listener);
        },
        removeEventListener: function(type, listener) {
            var listeners = events[type];
            if (listeners && 0 < listeners.length) for (var i = listeners.length; i--; 0 < i) if (listeners[i] === listener) {
                listeners.splice(i, 1);
                break;
            }
        },
        dispatchEvent: function(event) {
            var listeners = events[event.type];
            if (listeners) for (var i = 0; i < listeners.length; i++) listeners[i](event);
        }
    };
    exports.default = document;
}, function(module, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    }), exports.default = function() {
        return wx.createImage();
    };
}, function(module, exports, __webpack_require__) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    });
    var obj, _createClass = function() {
        function defineProperties(target, props) {
            for (var i = 0; i < props.length; i++) {
                var descriptor = props[i];
                descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
            }
        }
        return function(Constructor, protoProps, staticProps) {
            return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
            Constructor;
        };
    }(), _HTMLAudioElement2 = __webpack_require__(13), _HTMLAudioElement3 = (obj = _HTMLAudioElement2) && obj.__esModule ? obj : {
        default: obj
    };
    var _innerAudioContext = new WeakMap(), _src = new WeakMap(), Audio = (new WeakMap(), 
    new WeakMap(), function(_HTMLAudioElement) {
        function Audio(url) {
            !function(instance, Constructor) {
                if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
            }(this, Audio);
            var _this = function(self, call) {
                if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
                return !call || "object" != typeof call && "function" != typeof call ? self : call;
            }(this, (Audio.__proto__ || Object.getPrototypeOf(Audio)).call(this));
            _this.HAVE_NOTHING = 0, _this.HAVE_METADATA = 1, _this.HAVE_CURRENT_DATA = 2, _this.HAVE_FUTURE_DATA = 3, 
            _this.HAVE_ENOUGH_DATA = 4, _this.readyState = 0, _src.set(_this, "");
            var innerAudioContext = wx.createInnerAudioContext();
            return _innerAudioContext.set(_this, innerAudioContext), innerAudioContext.onCanplay(function() {
                _this.dispatchEvent({
                    type: "load"
                }), _this.dispatchEvent({
                    type: "loadend"
                }), _this.dispatchEvent({
                    type: "canplay"
                }), _this.dispatchEvent({
                    type: "canplaythrough"
                }), _this.dispatchEvent({
                    type: "loadedmetadata"
                }), _this.readyState = 2;
            }), innerAudioContext.onPlay(function() {
                _this.dispatchEvent({
                    type: "play"
                });
            }), innerAudioContext.onPause(function() {
                _this.dispatchEvent({
                    type: "pause"
                });
            }), innerAudioContext.onEnded(function() {
                _this.dispatchEvent({
                    type: "ended"
                }), _this.readyState = 4;
            }), innerAudioContext.onError(function() {
                _this.dispatchEvent({
                    type: "error"
                });
            }), url && (_innerAudioContext.get(_this).src = url), _this;
        }
        return function(subClass, superClass) {
            if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
            subClass.prototype = Object.create(superClass && superClass.prototype, {
                constructor: {
                    value: subClass,
                    enumerable: !1,
                    writable: !0,
                    configurable: !0
                }
            }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass);
        }(Audio, _HTMLAudioElement3.default), _createClass(Audio, [ {
            key: "load",
            value: function() {
                console.warn("HTMLAudioElement.load() is not implemented.");
            }
        }, {
            key: "play",
            value: function() {
                _innerAudioContext.get(this).play();
            }
        }, {
            key: "pause",
            value: function() {
                _innerAudioContext.get(this).pause();
            }
        }, {
            key: "canPlayType",
            value: function() {
                var mediaType = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "";
                return "string" != typeof mediaType ? "" : -1 < mediaType.indexOf("audio/mpeg") || mediaType.indexOf("audio/mp4") ? "probably" : "";
            }
        }, {
            key: "cloneNode",
            value: function() {
                var newAudio = new Audio();
                return newAudio.loop = _innerAudioContext.get(this).loop, newAudio.autoplay = _innerAudioContext.get(this).loop, 
                newAudio.src = this.src, newAudio;
            }
        }, {
            key: "currentTime",
            get: function() {
                return _innerAudioContext.get(this).currentTime;
            },
            set: function(value) {
                _innerAudioContext.get(this).seek(value);
            }
        }, {
            key: "src",
            get: function() {
                return _src.get(this);
            },
            set: function(value) {
                _src.set(this, value), _innerAudioContext.get(this).src = value;
            }
        }, {
            key: "loop",
            get: function() {
                return _innerAudioContext.get(this).loop;
            },
            set: function(value) {
                _innerAudioContext.get(this).loop = value;
            }
        }, {
            key: "autoplay",
            get: function() {
                return _innerAudioContext.get(this).autoplay;
            },
            set: function(value) {
                _innerAudioContext.get(this).autoplay = value;
            }
        }, {
            key: "paused",
            get: function() {
                return _innerAudioContext.get(this).paused;
            }
        } ]), Audio;
    }());
    exports.default = Audio;
}, function(module, exports, __webpack_require__) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    });
    var obj, _HTMLMediaElement2 = __webpack_require__(14), _HTMLMediaElement3 = (obj = _HTMLMediaElement2) && obj.__esModule ? obj : {
        default: obj
    };
    var HTMLAudioElement = function(_HTMLMediaElement) {
        function HTMLAudioElement() {
            return function(instance, Constructor) {
                if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
            }(this, HTMLAudioElement), function(self, call) {
                if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
                return !call || "object" != typeof call && "function" != typeof call ? self : call;
            }(this, (HTMLAudioElement.__proto__ || Object.getPrototypeOf(HTMLAudioElement)).call(this, "audio"));
        }
        return function(subClass, superClass) {
            if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
            subClass.prototype = Object.create(superClass && superClass.prototype, {
                constructor: {
                    value: subClass,
                    enumerable: !1,
                    writable: !0,
                    configurable: !0
                }
            }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass);
        }(HTMLAudioElement, _HTMLMediaElement3.default), HTMLAudioElement;
    }();
    exports.default = HTMLAudioElement;
}, function(module, exports, __webpack_require__) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    });
    var obj, _createClass = function() {
        function defineProperties(target, props) {
            for (var i = 0; i < props.length; i++) {
                var descriptor = props[i];
                descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
            }
        }
        return function(Constructor, protoProps, staticProps) {
            return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
            Constructor;
        };
    }(), _HTMLElement2 = __webpack_require__(4), _HTMLElement3 = (obj = _HTMLElement2) && obj.__esModule ? obj : {
        default: obj
    };
    var HTMLMediaElement = function(_HTMLElement) {
        function HTMLMediaElement(type) {
            return function(instance, Constructor) {
                if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
            }(this, HTMLMediaElement), function(self, call) {
                if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
                return !call || "object" != typeof call && "function" != typeof call ? self : call;
            }(this, (HTMLMediaElement.__proto__ || Object.getPrototypeOf(HTMLMediaElement)).call(this, type));
        }
        return function(subClass, superClass) {
            if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
            subClass.prototype = Object.create(superClass && superClass.prototype, {
                constructor: {
                    value: subClass,
                    enumerable: !1,
                    writable: !0,
                    configurable: !0
                }
            }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass);
        }(HTMLMediaElement, _HTMLElement3.default), _createClass(HTMLMediaElement, [ {
            key: "addTextTrack",
            value: function() {}
        }, {
            key: "captureStream",
            value: function() {}
        }, {
            key: "fastSeek",
            value: function() {}
        }, {
            key: "load",
            value: function() {}
        }, {
            key: "pause",
            value: function() {}
        }, {
            key: "play",
            value: function() {}
        } ]), HTMLMediaElement;
    }();
    exports.default = HTMLMediaElement;
}, function(module, exports, __webpack_require__) {
    "use strict";
    __webpack_require__(16);
}, function(module, exports, __webpack_require__) {
    "use strict";
    var obj, window = function(obj) {
        {
            if (obj && obj.__esModule) return obj;
            var newObj = {};
            if (null != obj) for (var key in obj) Object.prototype.hasOwnProperty.call(obj, key) && (newObj[key] = obj[key]);
            return newObj.default = obj, newObj;
        }
    }(__webpack_require__(1)), _document = __webpack_require__(10), _document2 = (obj = _document) && obj.__esModule ? obj : {
        default: obj
    }, _util = __webpack_require__(8);
    function TouchEvent(type) {
        !function(instance, Constructor) {
            if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
        }(this, TouchEvent), this.target = window.canvas, this.currentTarget = window.canvas, 
        this.touches = [], this.targetTouches = [], this.changedTouches = [], this.preventDefault = _util.noop, 
        this.stopPropagation = _util.noop, this.type = type;
    }
    function touchEventHandlerFactory(type) {
        return function(event) {
            var touchEvent = new TouchEvent(type);
            touchEvent.touches = event.touches, touchEvent.targetTouches = Array.prototype.slice.call(event.touches), 
            touchEvent.changedTouches = event.changedTouches, touchEvent.timeStamp = event.timeStamp, 
            _document2.default.dispatchEvent(touchEvent);
        };
    }
    wx.onTouchStart(touchEventHandlerFactory("touchstart")), wx.onTouchMove(touchEventHandlerFactory("touchmove")), 
    wx.onTouchEnd(touchEventHandlerFactory("touchend")), wx.onTouchCancel(touchEventHandlerFactory("touchcancel"));
}, function(module, exports, __webpack_require__) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    });
    var _util = __webpack_require__(8), navigator = {
        platform: wx.getSystemInfoSync().platform,
        language: "zh-cn",
        appVersion: "5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1",
        userAgent: "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E8301 MicroMessenger/6.6.0 MiniGame NetType/WIFI Language/zh_CN",
        onLine: !0,
        geolocation: {
            getCurrentPosition: _util.noop,
            watchPosition: _util.noop,
            clearWatch: _util.noop
        }
    };
    exports.default = navigator;
}, function(module, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    });
    var _createClass = function() {
        function defineProperties(target, props) {
            for (var i = 0; i < props.length; i++) {
                var descriptor = props[i];
                descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
            }
        }
        return function(Constructor, protoProps, staticProps) {
            return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
            Constructor;
        };
    }();
    var _url = new WeakMap(), _method = new WeakMap(), _requestHeader = new WeakMap(), _responseHeader = new WeakMap(), _requestTask = new WeakMap();
    function _triggerEvent(type) {
        if ("function" == typeof this["on" + type]) {
            for (var _len = arguments.length, args = Array(1 < _len ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key];
            this["on" + type].apply(this, args);
        }
    }
    function _changeReadyState(readyState) {
        this.readyState = readyState, _triggerEvent.call(this, "readystatechange", {
            target: this
        });
    }
    var XMLHttpRequest = function() {
        function XMLHttpRequest() {
            !function(instance, Constructor) {
                if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
            }(this, XMLHttpRequest), this.onabort = null, this.onerror = null, this.onload = null, 
            this.onloadstart = null, this.onprogress = null, this.ontimeout = null, this.onloadend = null, 
            this.onreadystatechange = null, this.readyState = 0, this.response = null, this.responseText = null, 
            this.responseType = "", this.responseXML = null, this.status = 0, this.statusText = "", 
            this.upload = {}, this.withCredentials = !1, _requestHeader.set(this, {
                "content-type": "application/x-www-form-urlencoded"
            }), _responseHeader.set(this, {});
        }
        return _createClass(XMLHttpRequest, [ {
            key: "abort",
            value: function() {
                var myRequestTask = _requestTask.get(this);
                myRequestTask && myRequestTask.abort();
            }
        }, {
            key: "getAllResponseHeaders",
            value: function() {
                var responseHeader = _responseHeader.get(this);
                return Object.keys(responseHeader).map(function(header) {
                    return header + ": " + responseHeader[header];
                }).join("\n");
            }
        }, {
            key: "getResponseHeader",
            value: function(header) {
                return _responseHeader.get(this)[header];
            }
        }, {
            key: "open",
            value: function(method, url) {
                _method.set(this, method), _url.set(this, url), _changeReadyState.call(this, XMLHttpRequest.OPENED);
            }
        }, {
            key: "overrideMimeType",
            value: function() {}
        }, {
            key: "send",
            value: function() {
                var _this = this, data = 0 < arguments.length && void 0 !== arguments[0] ? arguments[0] : "";
                if (this.readyState !== XMLHttpRequest.OPENED) throw new Error("Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED.");
                wx.request({
                    data: data,
                    url: _url.get(this),
                    method: _method.get(this),
                    header: _requestHeader.get(this),
                    responseType: "json" === this.responseType ? "" : this.responseType,
                    success: function(_ref) {
                        var data = _ref.data, statusCode = _ref.statusCode, header = _ref.header;
                        _this.status = statusCode, _responseHeader.set(_this, header), _triggerEvent.call(_this, "loadstart"), 
                        _changeReadyState.call(_this, XMLHttpRequest.HEADERS_RECEIVED), _changeReadyState.call(_this, XMLHttpRequest.LOADING), 
                        _this.response = data, _changeReadyState.call(_this, XMLHttpRequest.DONE), _triggerEvent.call(_this, "load"), 
                        _triggerEvent.call(_this, "loadend");
                    },
                    fail: function(_ref2) {
                        console.log("fail..........", _ref2);
                        var errMsg = _ref2.errMsg;
                        -1 !== errMsg.indexOf("abort") ? _triggerEvent.call(_this, "abort") : _triggerEvent.call(_this, "error", errMsg), 
                        _triggerEvent.call(_this, "loadend");
                    }
                });
            }
        }, {
            key: "setRequestHeader",
            value: function(header, value) {
                var myHeader = _requestHeader.get(this);
                myHeader[header] = value, _requestHeader.set(this, myHeader);
            }
        } ]), XMLHttpRequest;
    }();
    XMLHttpRequest.UNSEND = 0, XMLHttpRequest.OPENED = 1, XMLHttpRequest.HEADERS_RECEIVED = 2, 
    XMLHttpRequest.LOADING = 3, XMLHttpRequest.DONE = 4, exports.default = XMLHttpRequest;
}, function(module, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    });
    var _createClass = function() {
        function defineProperties(target, props) {
            for (var i = 0; i < props.length; i++) {
                var descriptor = props[i];
                descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
            }
        }
        return function(Constructor, protoProps, staticProps) {
            return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
            Constructor;
        };
    }();
    var _socketTask = new WeakMap(), WebSocket = function() {
        function WebSocket(url) {
            var _this = this, protocols = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : [];
            if (function(instance, Constructor) {
                if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
            }(this, WebSocket), this.binaryType = "", this.bufferedAmount = 0, this.extensions = "", 
            this.onclose = null, this.onerror = null, this.onmessage = null, this.onopen = null, 
            this.protocol = "", this.readyState = 3, "string" != typeof url || !/(^ws:\/\/)|(^wss:\/\/)/.test(url)) throw new TypeError("Failed to construct 'WebSocket': The URL '" + url + "' is invalid");
            this.url = url, this.readyState = WebSocket.CONNECTING;
            var socketTask = wx.connectSocket({
                url: url,
                protocols: Array.isArray(protocols) ? protocols : [ protocols ]
            });
            return _socketTask.set(this, socketTask), socketTask.onClose(function(res) {
                _this.readyState = WebSocket.CLOSED, "function" == typeof _this.onclose && _this.onclose(res);
            }), socketTask.onMessage(function(res) {
                "function" == typeof _this.onmessage && _this.onmessage(res);
            }), socketTask.onOpen(function() {
                _this.readyState = WebSocket.OPEN, "function" == typeof _this.onopen && _this.onopen();
            }), socketTask.onError(function(res) {
                console.log("error...............", res), "function" == typeof _this.onerror && _this.onerror(new Error(res.errMsg));
            }), this;
        }
        return _createClass(WebSocket, [ {
            key: "close",
            value: function(code, reason) {
                this.readyState = WebSocket.CLOSING, _socketTask.get(this).close({
                    code: code,
                    reason: reason
                });
            }
        }, {
            key: "send",
            value: function(data) {
                if (data instanceof Uint8Array && (data = data.buffer), "string" != typeof data && !(data instanceof ArrayBuffer)) throw new TypeError("Failed to send message: The data " + data + " is invalid");
                _socketTask.get(this).send({
                    data: data
                });
            }
        } ]), WebSocket;
    }();
    WebSocket.CONNECTING = 0, WebSocket.OPEN = 1, WebSocket.CLOSING = 2, WebSocket.CLOSED = 3, 
    exports.default = WebSocket;
}, function(module, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    });
    exports.default = function FileReader() {
        !function(instance, Constructor) {
            if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
        }(this, FileReader);
    };
}, function(module, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    });
    var localStorage = {
        get length() {
            return wx.getStorageInfoSync().keys.length;
        },
        key: function(n) {
            return wx.getStorageInfoSync().keys[n];
        },
        getItem: function(key) {
            return wx.getStorageSync(key);
        },
        setItem: function(key, value) {
            return wx.setStorageSync(key, value);
        },
        removeItem: function(key) {
            wx.removeStorageSync(key);
        },
        clear: function() {
            wx.clearStorageSync();
        }
    };
    exports.default = localStorage;
}, function(module, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", {
        value: !0
    });
    exports.default = {
        href: "game.js",
        reload: function() {}
    };
} ]), base64();

var entityMap = {
    lt: "<",
    gt: ">",
    amp: "&",
    quot: '"',
    apos: "'",
    Agrave: "À",
    Aacute: "Á",
    Acirc: "Â",
    Atilde: "Ã",
    Auml: "Ä",
    Aring: "Å",
    AElig: "Æ",
    Ccedil: "Ç",
    Egrave: "È",
    Eacute: "É",
    Ecirc: "Ê",
    Euml: "Ë",
    Igrave: "Ì",
    Iacute: "Í",
    Icirc: "Î",
    Iuml: "Ï",
    ETH: "Ð",
    Ntilde: "Ñ",
    Ograve: "Ò",
    Oacute: "Ó",
    Ocirc: "Ô",
    Otilde: "Õ",
    Ouml: "Ö",
    Oslash: "Ø",
    Ugrave: "Ù",
    Uacute: "Ú",
    Ucirc: "Û",
    Uuml: "Ü",
    Yacute: "Ý",
    THORN: "Þ",
    szlig: "ß",
    agrave: "à",
    aacute: "á",
    acirc: "â",
    atilde: "ã",
    auml: "ä",
    aring: "å",
    aelig: "æ",
    ccedil: "ç",
    egrave: "è",
    eacute: "é",
    ecirc: "ê",
    euml: "ë",
    igrave: "ì",
    iacute: "í",
    icirc: "î",
    iuml: "ï",
    eth: "ð",
    ntilde: "ñ",
    ograve: "ò",
    oacute: "ó",
    ocirc: "ô",
    otilde: "õ",
    ouml: "ö",
    oslash: "ø",
    ugrave: "ù",
    uacute: "ú",
    ucirc: "û",
    uuml: "ü",
    yacute: "ý",
    thorn: "þ",
    yuml: "ÿ",
    nbsp: " ",
    iexcl: "¡",
    cent: "¢",
    pound: "£",
    curren: "¤",
    yen: "¥",
    brvbar: "¦",
    sect: "§",
    uml: "¨",
    copy: "©",
    ordf: "ª",
    laquo: "«",
    not: "¬",
    shy: "­­",
    reg: "®",
    macr: "¯",
    deg: "°",
    plusmn: "±",
    sup2: "²",
    sup3: "³",
    acute: "´",
    micro: "µ",
    para: "¶",
    middot: "·",
    cedil: "¸",
    sup1: "¹",
    ordm: "º",
    raquo: "»",
    frac14: "¼",
    frac12: "½",
    frac34: "¾",
    iquest: "¿",
    times: "×",
    divide: "÷",
    forall: "∀",
    part: "∂",
    exist: "∃",
    empty: "∅",
    nabla: "∇",
    isin: "∈",
    notin: "∉",
    ni: "∋",
    prod: "∏",
    sum: "∑",
    minus: "−",
    lowast: "∗",
    radic: "√",
    prop: "∝",
    infin: "∞",
    ang: "∠",
    and: "∧",
    or: "∨",
    cap: "∩",
    cup: "∪",
    int: "∫",
    there4: "∴",
    sim: "∼",
    cong: "≅",
    asymp: "≈",
    ne: "≠",
    equiv: "≡",
    le: "≤",
    ge: "≥",
    sub: "⊂",
    sup: "⊃",
    nsub: "⊄",
    sube: "⊆",
    supe: "⊇",
    oplus: "⊕",
    otimes: "⊗",
    perp: "⊥",
    sdot: "⋅",
    Alpha: "Α",
    Beta: "Β",
    Gamma: "Γ",
    Delta: "Δ",
    Epsilon: "Ε",
    Zeta: "Ζ",
    Eta: "Η",
    Theta: "Θ",
    Iota: "Ι",
    Kappa: "Κ",
    Lambda: "Λ",
    Mu: "Μ",
    Nu: "Ν",
    Xi: "Ξ",
    Omicron: "Ο",
    Pi: "Π",
    Rho: "Ρ",
    Sigma: "Σ",
    Tau: "Τ",
    Upsilon: "Υ",
    Phi: "Φ",
    Chi: "Χ",
    Psi: "Ψ",
    Omega: "Ω",
    alpha: "α",
    beta: "β",
    gamma: "γ",
    delta: "δ",
    epsilon: "ε",
    zeta: "ζ",
    eta: "η",
    theta: "θ",
    iota: "ι",
    kappa: "κ",
    lambda: "λ",
    mu: "μ",
    nu: "ν",
    xi: "ξ",
    omicron: "ο",
    pi: "π",
    rho: "ρ",
    sigmaf: "ς",
    sigma: "σ",
    tau: "τ",
    upsilon: "υ",
    phi: "φ",
    chi: "χ",
    psi: "ψ",
    omega: "ω",
    thetasym: "ϑ",
    upsih: "ϒ",
    piv: "ϖ",
    OElig: "Œ",
    oelig: "œ",
    Scaron: "Š",
    scaron: "š",
    Yuml: "Ÿ",
    fnof: "ƒ",
    circ: "ˆ",
    tilde: "˜",
    ensp: " ",
    emsp: " ",
    thinsp: " ",
    zwnj: "‌",
    zwj: "‍",
    lrm: "‎",
    rlm: "‏",
    ndash: "–",
    mdash: "—",
    lsquo: "‘",
    rsquo: "’",
    sbquo: "‚",
    ldquo: "“",
    rdquo: "”",
    bdquo: "„",
    dagger: "†",
    Dagger: "‡",
    bull: "•",
    hellip: "…",
    permil: "‰",
    prime: "′",
    Prime: "″",
    lsaquo: "‹",
    rsaquo: "›",
    oline: "‾",
    euro: "€",
    trade: "™",
    larr: "←",
    uarr: "↑",
    rarr: "→",
    darr: "↓",
    harr: "↔",
    crarr: "↵",
    lceil: "⌈",
    rceil: "⌉",
    lfloor: "⌊",
    rfloor: "⌋",
    loz: "◊",
    spades: "♠",
    clubs: "♣",
    hearts: "♥",
    diams: "♦"
}, nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, nameChar = new RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"), tagNamePattern = new RegExp("^" + nameStartChar.source + nameChar.source + "*(?::" + nameStartChar.source + nameChar.source + "*)?$"), S_TAG = 0, S_ATTR = 1, S_ATTR_SPACE = 2, S_EQ = 3, S_ATTR_NOQUOT_VALUE = 4, S_ATTR_END = 5, S_TAG_SPACE = 6, S_TAG_CLOSE = 7, SaxO = {};

function XMLReader() {}

function parse(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) {
    function entityReplacer(a) {
        var k = a.slice(1, -1);
        return k in entityMap ? entityMap[k] : "#" === k.charAt(0) ? function(code) {
            if (65535 < code) {
                var surrogate1 = 55296 + ((code -= 65536) >> 10), surrogate2 = 56320 + (1023 & code);
                return String.fromCharCode(surrogate1, surrogate2);
            }
            return String.fromCharCode(code);
        }(parseInt(k.substr(1).replace("x", "0x"))) : (errorHandler.error("entity not found:" + a), 
        a);
    }
    function appendText(end) {
        if (start < end) {
            var xt = source.substring(start, end).replace(/&#?\w+;/g, entityReplacer);
            locator && position(start), domBuilder.characters(xt, 0, end - start), start = end;
        }
    }
    function position(p, m) {
        for (;lineEnd <= p && (m = linePattern.exec(source)); ) lineStart = m.index, lineEnd = lineStart + m[0].length, 
        locator.lineNumber++;
        locator.columnNumber = p - lineStart + 1;
    }
    for (var lineStart = 0, lineEnd = 0, linePattern = /.*(?:\r\n?|\n)|.*$/g, locator = domBuilder.locator, parseStack = [ {
        currentNSMap: defaultNSMapCopy
    } ], closeMap = {}, start = 0; ;) {
        try {
            var tagStart = source.indexOf("<", start);
            if (tagStart < 0) {
                if (!source.substr(start).match(/^\s*$/)) {
                    var doc = domBuilder.doc, text = doc.createTextNode(source.substr(start));
                    doc.appendChild(text), domBuilder.currentElement = text;
                }
                return;
            }
            switch (start < tagStart && appendText(tagStart), source.charAt(tagStart + 1)) {
              case "/":
                var end = source.indexOf(">", tagStart + 3), tagName = source.substring(tagStart + 2, end), config = parseStack.pop();
                end < 0 ? (tagName = source.substring(tagStart + 2).replace(/[\s<].*/, ""), errorHandler.error("end tag name: " + tagName + " is not complete:" + config.tagName), 
                end = tagStart + 1 + tagName.length) : tagName.match(/\s</) && (tagName = tagName.replace(/[\s<].*/, ""), 
                errorHandler.error("end tag name: " + tagName + " maybe not complete"), end = tagStart + 1 + tagName.length);
                var localNSMap = config.localNSMap, endMatch = config.tagName == tagName;
                if (endMatch || config.tagName && config.tagName.toLowerCase() == tagName.toLowerCase()) {
                    if (domBuilder.endElement(config.uri, config.localName, tagName), localNSMap) for (var prefix in localNSMap) domBuilder.endPrefixMapping(prefix);
                    endMatch || errorHandler.fatalError("end tag name: " + tagName + " is not match the current start tagName:" + config.tagName);
                } else parseStack.push(config);
                end++;
                break;

              case "?":
                locator && position(tagStart), end = parseInstruction(source, tagStart, domBuilder);
                break;

              case "!":
                locator && position(tagStart), end = parseDCC(source, tagStart, domBuilder, errorHandler);
                break;

              default:
                locator && position(tagStart);
                var el = new ElementAttributes(), currentNSMap = parseStack[parseStack.length - 1].currentNSMap, len = (end = parseElementStartPart(source, tagStart, el, currentNSMap, entityReplacer, errorHandler), 
                el.length);
                if (!el.closed && fixSelfClosed(source, end, el.tagName, closeMap) && (el.closed = !0, 
                entityMap.nbsp || errorHandler.warning("unclosed xml attribute")), locator && len) {
                    for (var locator2 = copyLocator(locator, {}), i = 0; i < len; i++) {
                        var a = el[i];
                        position(a.offset), a.locator = copyLocator(locator, {});
                    }
                    domBuilder.locator = locator2, SaxO.appendElement(el, domBuilder, currentNSMap) && parseStack.push(el), 
                    domBuilder.locator = locator;
                } else SaxO.appendElement(el, domBuilder, currentNSMap) && parseStack.push(el);
                "http://www.w3.org/1999/xhtml" !== el.uri || el.closed ? end++ : end = parseHtmlSpecialContent(source, end, el.tagName, entityReplacer, domBuilder);
            }
        } catch (e) {
            e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
            errorHandler.error("element parse error: " + e), end = -1;
        }
        start < end ? start = end : appendText(Math.max(tagStart, start) + 1);
    }
}

function copyLocator(f, t) {
    return t.lineNumber = f.lineNumber, t.columnNumber = f.columnNumber, t;
}

function parseElementStartPart(source, start, el, currentNSMap, entityReplacer, errorHandler) {
    for (var attrName, p = ++start, s = S_TAG; ;) {
        var c = source.charAt(p);
        switch (c) {
          case "=":
            if (s === S_ATTR) attrName = source.slice(start, p), s = S_EQ; else {
                if (s !== S_ATTR_SPACE) throw new Error("attribute equal must after attrName");
                s = S_EQ;
            }
            break;

          case "'":
          case '"':
            if (s === S_EQ || s === S_ATTR) {
                if (s === S_ATTR && (errorHandler.warning('attribute value must after "="'), attrName = source.slice(start, p)), 
                start = p + 1, !(0 < (p = source.indexOf(c, start)))) throw new Error("attribute value no end '" + c + "' match");
                value = source.slice(start, p).replace(/&#?\w+;/g, entityReplacer), el.add(attrName, value, start - 1), 
                s = S_ATTR_END;
            } else {
                if (s != S_ATTR_NOQUOT_VALUE) throw new Error('attribute value must after "="');
                value = source.slice(start, p).replace(/&#?\w+;/g, entityReplacer), el.add(attrName, value, start), 
                errorHandler.warning('attribute "' + attrName + '" missed start quot(' + c + ")!!"), 
                start = p + 1, s = S_ATTR_END;
            }
            break;

          case "/":
            switch (s) {
              case S_TAG:
                el.setTagName(source.slice(start, p));

              case S_ATTR_END:
              case S_TAG_SPACE:
              case S_TAG_CLOSE:
                s = S_TAG_CLOSE, el.closed = !0;

              case S_ATTR_NOQUOT_VALUE:
              case S_ATTR:
              case S_ATTR_SPACE:
                break;

              default:
                throw new Error("attribute invalid close char('/')");
            }
            break;

          case "":
            return errorHandler.error("unexpected end of input"), s == S_TAG && el.setTagName(source.slice(start, p)), 
            p;

          case ">":
            switch (s) {
              case S_TAG:
                el.setTagName(source.slice(start, p));

              case S_ATTR_END:
              case S_TAG_SPACE:
              case S_TAG_CLOSE:
                break;

              case S_ATTR_NOQUOT_VALUE:
              case S_ATTR:
                "/" === (value = source.slice(start, p)).slice(-1) && (el.closed = !0, value = value.slice(0, -1));

              case S_ATTR_SPACE:
                s === S_ATTR_SPACE && (value = attrName), s == S_ATTR_NOQUOT_VALUE ? (errorHandler.warning('attribute "' + value + '" missed quot(")!!'), 
                el.add(attrName, value.replace(/&#?\w+;/g, entityReplacer), start)) : ("http://www.w3.org/1999/xhtml" === currentNSMap[""] && value.match(/^(?:disabled|checked|selected)$/i) || errorHandler.warning('attribute "' + value + '" missed value!! "' + value + '" instead!!'), 
                el.add(value, value, start));
                break;

              case S_EQ:
                throw new Error("attribute value missed!!");
            }
            return p;

          case "":
            c = " ";

          default:
            if (c <= " ") switch (s) {
              case S_TAG:
                el.setTagName(source.slice(start, p)), s = S_TAG_SPACE;
                break;

              case S_ATTR:
                attrName = source.slice(start, p), s = S_ATTR_SPACE;
                break;

              case S_ATTR_NOQUOT_VALUE:
                var value = source.slice(start, p).replace(/&#?\w+;/g, entityReplacer);
                errorHandler.warning('attribute "' + value + '" missed quot(")!!'), el.add(attrName, value, start);

              case S_ATTR_END:
                s = S_TAG_SPACE;
            } else switch (s) {
              case S_ATTR_SPACE:
                el.tagName;
                "http://www.w3.org/1999/xhtml" === currentNSMap[""] && attrName.match(/^(?:disabled|checked|selected)$/i) || errorHandler.warning('attribute "' + attrName + '" missed value!! "' + attrName + '" instead2!!'), 
                el.add(attrName, attrName, start), start = p, s = S_ATTR;
                break;

              case S_ATTR_END:
                errorHandler.warning('attribute space is required"' + attrName + '"!!');

              case S_TAG_SPACE:
                s = S_ATTR, start = p;
                break;

              case S_EQ:
                s = S_ATTR_NOQUOT_VALUE, start = p;
                break;

              case S_TAG_CLOSE:
                throw new Error("elements closed character '/' and '>' must be connected to");
            }
        }
        p++;
    }
}

function parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) {
    if (/^(?:script|textarea)$/i.test(tagName)) {
        var elEndStart = source.indexOf("</" + tagName + ">", elStartEnd), text = source.substring(elStartEnd + 1, elEndStart);
        if (/[&<]/.test(text)) return /^script$/i.test(tagName) || (text = text.replace(/&#?\w+;/g, entityReplacer)), 
        domBuilder.characters(text, 0, text.length), elEndStart;
    }
    return elStartEnd + 1;
}

function fixSelfClosed(source, elStartEnd, tagName, closeMap) {
    var pos = closeMap[tagName];
    return null == pos && ((pos = source.lastIndexOf("</" + tagName + ">")) < elStartEnd && (pos = source.lastIndexOf("</" + tagName)), 
    closeMap[tagName] = pos), pos < elStartEnd;
}

function _copy(source, target) {
    for (var n in source) target[n] = source[n];
}

function parseDCC(source, start, domBuilder, errorHandler) {
    switch (source.charAt(start + 2)) {
      case "-":
        return "-" !== source.charAt(start + 3) ? -1 : start < (end = source.indexOf("--\x3e", start + 4)) ? (domBuilder.comment(source, start + 4, end - start - 4), 
        end + 3) : (errorHandler.error("Unclosed comment"), -1);

      default:
        if ("CDATA[" == source.substr(start + 3, 6)) {
            var end = source.indexOf("]]>", start + 9);
            return domBuilder.startCDATA(), domBuilder.characters(source, start + 9, end - start - 9), 
            domBuilder.endCDATA(), end + 3;
        }
        var matchs = split(source, start), len = matchs.length;
        if (1 < len && /!doctype/i.test(matchs[0][0])) {
            var name = matchs[1][0], pubid = 3 < len && /^public$/i.test(matchs[2][0]) && matchs[3][0], sysid = 4 < len && matchs[4][0], lastMatch = matchs[len - 1];
            return domBuilder.startDTD(name, pubid && pubid.replace(/^(['"])(.*?)\1$/, "$2"), sysid && sysid.replace(/^(['"])(.*?)\1$/, "$2")), 
            domBuilder.endDTD(), lastMatch.index + lastMatch[0].length;
        }
    }
    return -1;
}

function parseInstruction(source, start, domBuilder) {
    var end = source.indexOf("?>", start);
    if (end) {
        var match = source.substring(start, end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
        if (match) {
            match[0].length;
            return domBuilder.processingInstruction(match[1], match[2]), end + 2;
        }
        return -1;
    }
    return -1;
}

function ElementAttributes(source) {}

function split(source, start) {
    var match, buf = [], reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
    for (reg.lastIndex = start, reg.exec(source); match = reg.exec(source); ) if (buf.push(match), 
    match[1]) return buf;
}

function copy(src, dest) {
    for (var p in src) dest[p] = src[p];
}

function _extends(Class, Super) {
    var pt = Class.prototype;
    if (!(pt instanceof Super)) {
        function t() {}
        t.prototype = Super.prototype, copy(pt, t = new t()), Class.prototype = pt = t;
    }
    pt.constructor != Class && ("function" != typeof Class && console.error("unknow Class:" + Class), 
    pt.constructor = Class);
}

XMLReader.prototype = {
    parse: function(source, defaultNSMap, entityMap) {
        var domBuilder = this.domBuilder;
        domBuilder.startDocument(), _copy(defaultNSMap, defaultNSMap = {}), parse(source, defaultNSMap, entityMap, domBuilder, this.errorHandler), 
        domBuilder.endDocument();
    }
}, SaxO.appendElement = function(el, domBuilder, currentNSMap) {
    for (var tagName = el.tagName, localNSMap = null, i = el.length; i--; ) {
        var a = el[i], qName = a.qName, value = a.value;
        if (0 < (nsp = qName.indexOf(":"))) var prefix = a.prefix = qName.slice(0, nsp), localName = qName.slice(nsp + 1), nsPrefix = "xmlns" === prefix && localName; else prefix = null, 
        nsPrefix = "xmlns" === (localName = qName) && "";
        a.localName = localName, !1 !== nsPrefix && (null == localNSMap && (localNSMap = {}, 
        _copy(currentNSMap, currentNSMap = {})), currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value, 
        a.uri = "http://www.w3.org/2000/xmlns/", domBuilder.startPrefixMapping(nsPrefix, value));
    }
    for (i = el.length; i--; ) {
        (prefix = (a = el[i]).prefix) && ("xml" === prefix && (a.uri = "http://www.w3.org/XML/1998/namespace"), 
        "xmlns" !== prefix && (a.uri = currentNSMap[prefix || ""]));
    }
    var nsp;
    localName = 0 < (nsp = tagName.indexOf(":")) ? (prefix = el.prefix = tagName.slice(0, nsp), 
    el.localName = tagName.slice(nsp + 1)) : (prefix = null, el.localName = tagName);
    var ns = el.uri = currentNSMap[prefix || ""];
    if (domBuilder.startElement(ns, localName, tagName, el), !el.closed) return el.currentNSMap = currentNSMap, 
    el.localNSMap = localNSMap, !0;
    if (domBuilder.endElement(ns, localName, tagName), localNSMap) for (prefix in localNSMap) domBuilder.endPrefixMapping(prefix);
}, ElementAttributes.prototype = {
    setTagName: function(tagName) {
        if (!tagNamePattern.test(tagName)) throw new Error("invalid tagName:" + tagName);
        this.tagName = tagName;
    },
    add: function(qName, value, offset) {
        if (!tagNamePattern.test(qName)) throw new Error("invalid attribute:" + qName);
        this[this.length++] = {
            qName: qName,
            value: value,
            offset: offset
        };
    },
    length: 0,
    getLocalName: function(i) {
        return this[i].localName;
    },
    getLocator: function(i) {
        return this[i].locator;
    },
    getQName: function(i) {
        return this[i].qName;
    },
    getURI: function(i) {
        return this[i].uri;
    },
    getValue: function(i) {
        return this[i].value;
    }
}, "function" == typeof arequire && (exports.XMLReader = XMLReader);

var htmlns = "http://www.w3.org/1999/xhtml", NodeType = {}, ELEMENT_NODE = NodeType.ELEMENT_NODE = 1, ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2, TEXT_NODE = NodeType.TEXT_NODE = 3, CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4, ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5, ENTITY_NODE = NodeType.ENTITY_NODE = 6, PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7, COMMENT_NODE = NodeType.COMMENT_NODE = 8, DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9, DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10, DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11, NOTATION_NODE = NodeType.NOTATION_NODE = 12, ExceptionCode = {}, ExceptionMessage = {}, INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = (ExceptionMessage[1] = "Index size error", 
1), DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = (ExceptionMessage[2] = "DOMString size error", 
2), HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = (ExceptionMessage[3] = "Hierarchy request error", 
3), WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = (ExceptionMessage[4] = "Wrong document", 
4), INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = (ExceptionMessage[5] = "Invalid character", 
5), NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = (ExceptionMessage[6] = "No data allowed", 
6), NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = (ExceptionMessage[7] = "No modification allowed", 
7), NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = (ExceptionMessage[8] = "Not found", 
8), NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = (ExceptionMessage[9] = "Not supported", 
9), INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = (ExceptionMessage[10] = "Attribute in use", 
10), INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = (ExceptionMessage[11] = "Invalid state", 
11), SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = (ExceptionMessage[12] = "Syntax error", 
12), INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = "Invalid modification", 
13), NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = "Invalid namespace", 
14), INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = "Invalid access", 
15);

function DOMException(code, message) {
    if (message instanceof Error) var error = message; else error = this, Error.call(this, ExceptionMessage[code]), 
    this.message = ExceptionMessage[code], Error.captureStackTrace && Error.captureStackTrace(this, DOMException);
    return error.code = code, message && (this.message = this.message + ": " + message), 
    error;
}

function NodeList() {}

function LiveNodeList(node, refresh) {
    this._node = node, this._refresh = refresh, _updateLiveList(this);
}

function _updateLiveList(list) {
    var inc = list._node._inc || list._node.ownerDocument._inc;
    if (list._inc != inc) {
        var ls = list._refresh(list._node);
        __set__(list, "length", ls.length), copy(ls, list), list._inc = inc;
    }
}

function NamedNodeMap() {}

function _findNodeIndex(list, node) {
    for (var i = list.length; i--; ) if (list[i] === node) return i;
}

function _addNamedNode(el, list, newAttr, oldAttr) {
    if (oldAttr ? list[_findNodeIndex(list, oldAttr)] = newAttr : list[list.length++] = newAttr, 
    el) {
        var doc = (newAttr.ownerElement = el).ownerDocument;
        doc && (oldAttr && _onRemoveAttribute(doc, el, oldAttr), _onAddAttribute(doc, el, newAttr));
    }
}

function _removeNamedNode(el, list, attr) {
    var i = _findNodeIndex(list, attr);
    if (!(0 <= i)) throw DOMException(NOT_FOUND_ERR, new Error(el.tagName + "@" + attr));
    for (var lastIndex = list.length - 1; i < lastIndex; ) list[i] = list[++i];
    if (list.length = lastIndex, el) {
        var doc = el.ownerDocument;
        doc && (_onRemoveAttribute(doc, el, attr), attr.ownerElement = null);
    }
}

function DOMImplementation(features) {
    if (this._features = {}, features) for (var feature in features) this._features = features[feature];
}

function Node() {}

function _xmlEncoder(c) {
    return ("<" == c ? "&lt;" : ">" == c && "&gt;") || "&" == c && "&amp;" || '"' == c && "&quot;" || "&#" + c.charCodeAt() + ";";
}

function _visitNode(node, callback) {
    if (callback(node)) return !0;
    if (node = node.firstChild) do {
        if (_visitNode(node, callback)) return !0;
    } while (node = node.nextSibling);
}

function Document() {}

function _onAddAttribute(doc, el, newAttr) {
    doc && doc._inc++, "http://www.w3.org/2000/xmlns/" == newAttr.namespaceURI && (el._nsMap[newAttr.prefix ? newAttr.localName : ""] = newAttr.value);
}

function _onRemoveAttribute(doc, el, newAttr, remove) {
    doc && doc._inc++, "http://www.w3.org/2000/xmlns/" == newAttr.namespaceURI && delete el._nsMap[newAttr.prefix ? newAttr.localName : ""];
}

function _onUpdateChild(doc, el, newChild) {
    if (doc && doc._inc) {
        doc._inc++;
        var cs = el.childNodes;
        if (newChild) cs[cs.length++] = newChild; else {
            for (var child = el.firstChild, i = 0; child; ) child = (cs[i++] = child).nextSibling;
            cs.length = i;
        }
    }
}

function _removeChild(parentNode, child) {
    var previous = child.previousSibling, next = child.nextSibling;
    return previous ? previous.nextSibling = next : parentNode.firstChild = next, next ? next.previousSibling = previous : parentNode.lastChild = previous, 
    _onUpdateChild(parentNode.ownerDocument, parentNode), child;
}

function _insertBefore(parentNode, newChild, nextChild) {
    var cp = newChild.parentNode;
    if (cp && cp.removeChild(newChild), newChild.nodeType === DOCUMENT_FRAGMENT_NODE) {
        var newFirst = newChild.firstChild;
        if (null == newFirst) return newChild;
        var newLast = newChild.lastChild;
    } else newFirst = newLast = newChild;
    var pre = nextChild ? nextChild.previousSibling : parentNode.lastChild;
    for (newFirst.previousSibling = pre, newLast.nextSibling = nextChild, pre ? pre.nextSibling = newFirst : parentNode.firstChild = newFirst, 
    null == nextChild ? parentNode.lastChild = newLast : nextChild.previousSibling = newLast; newFirst.parentNode = parentNode, 
    newFirst !== newLast && (newFirst = newFirst.nextSibling); ) ;
    return _onUpdateChild(parentNode.ownerDocument || parentNode, parentNode), newChild.nodeType == DOCUMENT_FRAGMENT_NODE && (newChild.firstChild = newChild.lastChild = null), 
    newChild;
}

function _appendSingleChild(parentNode, newChild) {
    var cp = newChild.parentNode;
    if (cp) {
        var pre = parentNode.lastChild;
        cp.removeChild(newChild);
        pre = parentNode.lastChild;
    }
    pre = parentNode.lastChild;
    return newChild.parentNode = parentNode, newChild.previousSibling = pre, newChild.nextSibling = null, 
    pre ? pre.nextSibling = newChild : parentNode.firstChild = newChild, parentNode.lastChild = newChild, 
    _onUpdateChild(parentNode.ownerDocument, parentNode, newChild), newChild;
}

function Element() {
    this._nsMap = {};
}

function Attr() {}

function CharacterData() {}

function Text() {}

function Comment() {}

function CDATASection() {}

function DocumentType() {}

function Notation() {}

function Entity() {}

function EntityReference() {}

function DocumentFragment() {}

function ProcessingInstruction() {}

function XMLSerializer() {}

function nodeSerializeToString(isHtml, nodeFilter) {
    var buf = [], refNode = 9 == this.nodeType && this.documentElement || this, prefix = refNode.prefix, uri = refNode.namespaceURI;
    if (uri && null == prefix && null == (prefix = refNode.lookupPrefix(uri))) var visibleNamespaces = [ {
        namespace: uri,
        prefix: null
    } ];
    return serializeToString(this, buf, isHtml, nodeFilter, visibleNamespaces), buf.join("");
}

function needNamespaceDefine(node, isHTML, visibleNamespaces) {
    var prefix = node.prefix || "", uri = node.namespaceURI;
    if (!prefix && !uri) return !1;
    if ("xml" === prefix && "http://www.w3.org/XML/1998/namespace" === uri || "http://www.w3.org/2000/xmlns/" == uri) return !1;
    for (var i = visibleNamespaces.length; i--; ) {
        var ns = visibleNamespaces[i];
        if (ns.prefix == prefix) return ns.namespace != uri;
    }
    return !0;
}

function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces) {
    if (nodeFilter) {
        if (!(node = nodeFilter(node))) return;
        if ("string" == typeof node) return void buf.push(node);
    }
    switch (node.nodeType) {
      case ELEMENT_NODE:
        visibleNamespaces || (visibleNamespaces = []);
        visibleNamespaces.length;
        var attrs = node.attributes, len = attrs.length, child = node.firstChild, nodeName = node.tagName;
        isHTML = htmlns === node.namespaceURI || isHTML, buf.push("<", nodeName);
        for (var i = 0; i < len; i++) {
            "xmlns" == (attr = attrs.item(i)).prefix ? visibleNamespaces.push({
                prefix: attr.localName,
                namespace: attr.value
            }) : "xmlns" == attr.nodeName && visibleNamespaces.push({
                prefix: "",
                namespace: attr.value
            });
        }
        for (i = 0; i < len; i++) {
            var attr;
            if (needNamespaceDefine(attr = attrs.item(i), isHTML, visibleNamespaces)) {
                var prefix = attr.prefix || "", uri = attr.namespaceURI, ns = prefix ? " xmlns:" + prefix : " xmlns";
                buf.push(ns, '="', uri, '"'), visibleNamespaces.push({
                    prefix: prefix,
                    namespace: uri
                });
            }
            serializeToString(attr, buf, isHTML, nodeFilter, visibleNamespaces);
        }
        if (needNamespaceDefine(node, isHTML, visibleNamespaces)) {
            prefix = node.prefix || "", uri = node.namespaceURI, ns = prefix ? " xmlns:" + prefix : " xmlns";
            buf.push(ns, '="', uri, '"'), visibleNamespaces.push({
                prefix: prefix,
                namespace: uri
            });
        }
        if (child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
            if (buf.push(">"), isHTML && /^script$/i.test(nodeName)) for (;child; ) child.data ? buf.push(child.data) : serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces), 
            child = child.nextSibling; else for (;child; ) serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces), 
            child = child.nextSibling;
            buf.push("</", nodeName, ">");
        } else buf.push("/>");
        return;

      case DOCUMENT_NODE:
      case DOCUMENT_FRAGMENT_NODE:
        for (child = node.firstChild; child; ) serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces), 
        child = child.nextSibling;
        return;

      case ATTRIBUTE_NODE:
        return buf.push(" ", node.name, '="', node.value.replace(/[<&"]/g, _xmlEncoder), '"');

      case TEXT_NODE:
        return buf.push(node.data.replace(/[<&]/g, _xmlEncoder));

      case CDATA_SECTION_NODE:
        return buf.push("<![CDATA[", node.data, "]]>");

      case COMMENT_NODE:
        return buf.push("\x3c!--", node.data, "--\x3e");

      case DOCUMENT_TYPE_NODE:
        var pubid = node.publicId, sysid = node.systemId;
        if (buf.push("<!DOCTYPE ", node.name), pubid) buf.push(' PUBLIC "', pubid), sysid && "." != sysid && buf.push('" "', sysid), 
        buf.push('">'); else if (sysid && "." != sysid) buf.push(' SYSTEM "', sysid, '">'); else {
            var sub = node.internalSubset;
            sub && buf.push(" [", sub, "]"), buf.push(">");
        }
        return;

      case PROCESSING_INSTRUCTION_NODE:
        return buf.push("<?", node.target, " ", node.data, "?>");

      case ENTITY_REFERENCE_NODE:
        return buf.push("&", node.nodeName, ";");

      default:
        buf.push("??", node.nodeName);
    }
}

function importNode(doc, node, deep) {
    var node2;
    switch (node.nodeType) {
      case ELEMENT_NODE:
        (node2 = node.cloneNode(!1)).ownerDocument = doc;

      case DOCUMENT_FRAGMENT_NODE:
        break;

      case ATTRIBUTE_NODE:
        deep = !0;
    }
    if (node2 || (node2 = node.cloneNode(!1)), node2.ownerDocument = doc, node2.parentNode = null, 
    deep) for (var child = node.firstChild; child; ) node2.appendChild(importNode(doc, child, deep)), 
    child = child.nextSibling;
    return node2;
}

function cloneNode(doc, node, deep) {
    var node2 = new node.constructor();
    for (var n in node) {
        var v = node[n];
        "object" != typeof v && v != node2[n] && (node2[n] = v);
    }
    switch (node.childNodes && (node2.childNodes = new NodeList()), node2.ownerDocument = doc, 
    node2.nodeType) {
      case ELEMENT_NODE:
        var attrs = node.attributes, attrs2 = node2.attributes = new NamedNodeMap(), len = attrs.length;
        attrs2._ownerElement = node2;
        for (var i = 0; i < len; i++) node2.setAttributeNode(cloneNode(doc, attrs.item(i), !0));
        break;

      case ATTRIBUTE_NODE:
        deep = !0;
    }
    if (deep) for (var child = node.firstChild; child; ) node2.appendChild(cloneNode(doc, child, deep)), 
    child = child.nextSibling;
    return node2;
}

function __set__(object, key, value) {
    object[key] = value;
}

DOMException.prototype = Error.prototype, copy(ExceptionCode, DOMException), NodeList.prototype = {
    length: 0,
    item: function(index) {
        return this[index] || null;
    },
    toString: function(isHTML, nodeFilter) {
        for (var buf = [], i = 0; i < this.length; i++) serializeToString(this[i], buf, isHTML, nodeFilter);
        return buf.join("");
    }
}, LiveNodeList.prototype.item = function(i) {
    return _updateLiveList(this), this[i];
}, _extends(LiveNodeList, NodeList), NamedNodeMap.prototype = {
    length: 0,
    item: NodeList.prototype.item,
    getNamedItem: function(key) {
        for (var i = this.length; i--; ) {
            var attr = this[i];
            if (attr.nodeName == key) return attr;
        }
    },
    setNamedItem: function(attr) {
        var el = attr.ownerElement;
        if (el && el != this._ownerElement) throw new DOMException(INUSE_ATTRIBUTE_ERR);
        var oldAttr = this.getNamedItem(attr.nodeName);
        return _addNamedNode(this._ownerElement, this, attr, oldAttr), oldAttr;
    },
    setNamedItemNS: function(attr) {
        var oldAttr, el = attr.ownerElement;
        if (el && el != this._ownerElement) throw new DOMException(INUSE_ATTRIBUTE_ERR);
        return oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName), _addNamedNode(this._ownerElement, this, attr, oldAttr), 
        oldAttr;
    },
    removeNamedItem: function(key) {
        var attr = this.getNamedItem(key);
        return _removeNamedNode(this._ownerElement, this, attr), attr;
    },
    removeNamedItemNS: function(namespaceURI, localName) {
        var attr = this.getNamedItemNS(namespaceURI, localName);
        return _removeNamedNode(this._ownerElement, this, attr), attr;
    },
    getNamedItemNS: function(namespaceURI, localName) {
        for (var i = this.length; i--; ) {
            var node = this[i];
            if (node.localName == localName && node.namespaceURI == namespaceURI) return node;
        }
        return null;
    }
}, DOMImplementation.prototype = {
    hasFeature: function(feature, version) {
        var versions = this._features[feature.toLowerCase()];
        return !(!versions || version && !(version in versions));
    },
    createDocument: function(namespaceURI, qualifiedName, doctype) {
        var doc = new Document();
        if (doc.implementation = this, doc.childNodes = new NodeList(), (doc.doctype = doctype) && doc.appendChild(doctype), 
        qualifiedName) {
            var root = doc.createElementNS(namespaceURI, qualifiedName);
            doc.appendChild(root);
        }
        return doc;
    },
    createDocumentType: function(qualifiedName, publicId, systemId) {
        var node = new DocumentType();
        return node.name = qualifiedName, node.nodeName = qualifiedName, node.publicId = publicId, 
        node.systemId = systemId, node;
    }
}, Node.prototype = {
    firstChild: null,
    lastChild: null,
    previousSibling: null,
    nextSibling: null,
    attributes: null,
    parentNode: null,
    childNodes: null,
    ownerDocument: null,
    nodeValue: null,
    namespaceURI: null,
    prefix: null,
    localName: null,
    insertBefore: function(newChild, refChild) {
        return _insertBefore(this, newChild, refChild);
    },
    replaceChild: function(newChild, oldChild) {
        this.insertBefore(newChild, oldChild), oldChild && this.removeChild(oldChild);
    },
    removeChild: function(oldChild) {
        return _removeChild(this, oldChild);
    },
    appendChild: function(newChild) {
        return this.insertBefore(newChild, null);
    },
    hasChildNodes: function() {
        return null != this.firstChild;
    },
    cloneNode: function(deep) {
        return cloneNode(this.ownerDocument || this, this, deep);
    },
    normalize: function() {
        for (var child = this.firstChild; child; ) {
            var next = child.nextSibling;
            next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE ? (this.removeChild(next), 
            child.appendData(next.data)) : (child.normalize(), child = next);
        }
    },
    isSupported: function(feature, version) {
        return this.ownerDocument.implementation.hasFeature(feature, version);
    },
    hasAttributes: function() {
        return 0 < this.attributes.length;
    },
    lookupPrefix: function(namespaceURI) {
        for (var el = this; el; ) {
            var map = el._nsMap;
            if (map) for (var n in map) if (map[n] == namespaceURI) return n;
            el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
        }
        return null;
    },
    lookupNamespaceURI: function(prefix) {
        for (var el = this; el; ) {
            var map = el._nsMap;
            if (map && prefix in map) return map[prefix];
            el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
        }
        return null;
    },
    isDefaultNamespace: function(namespaceURI) {
        return null == this.lookupPrefix(namespaceURI);
    }
}, copy(NodeType, Node), copy(NodeType, Node.prototype), Document.prototype = {
    nodeName: "#document",
    nodeType: DOCUMENT_NODE,
    doctype: null,
    documentElement: null,
    _inc: 1,
    insertBefore: function(newChild, refChild) {
        if (newChild.nodeType != DOCUMENT_FRAGMENT_NODE) return null == this.documentElement && newChild.nodeType == ELEMENT_NODE && (this.documentElement = newChild), 
        _insertBefore(this, newChild, refChild), newChild.ownerDocument = this, newChild;
        for (var child = newChild.firstChild; child; ) {
            var next = child.nextSibling;
            this.insertBefore(child, refChild), child = next;
        }
        return newChild;
    },
    removeChild: function(oldChild) {
        return this.documentElement == oldChild && (this.documentElement = null), _removeChild(this, oldChild);
    },
    importNode: function(importedNode, deep) {
        return importNode(this, importedNode, deep);
    },
    getElementById: function(id) {
        var rtv = null;
        return _visitNode(this.documentElement, function(node) {
            if (node.nodeType == ELEMENT_NODE && node.getAttribute("id") == id) return rtv = node, 
            !0;
        }), rtv;
    },
    createElement: function(tagName) {
        var node = new Element();
        return node.ownerDocument = this, node.nodeName = tagName, node.tagName = tagName, 
        node.childNodes = new NodeList(), (node.attributes = new NamedNodeMap())._ownerElement = node;
    },
    createDocumentFragment: function() {
        var node = new DocumentFragment();
        return node.ownerDocument = this, node.childNodes = new NodeList(), node;
    },
    createTextNode: function(data) {
        var node = new Text();
        return node.ownerDocument = this, node.appendData(data), node;
    },
    createComment: function(data) {
        var node = new Comment();
        return node.ownerDocument = this, node.appendData(data), node;
    },
    createCDATASection: function(data) {
        var node = new CDATASection();
        return node.ownerDocument = this, node.appendData(data), node;
    },
    createProcessingInstruction: function(target, data) {
        var node = new ProcessingInstruction();
        return node.ownerDocument = this, node.tagName = node.target = target, node.nodeValue = node.data = data, 
        node;
    },
    createAttribute: function(name) {
        var node = new Attr();
        return node.ownerDocument = this, node.name = name, node.nodeName = name, node.localName = name, 
        node.specified = !0, node;
    },
    createEntityReference: function(name) {
        var node = new EntityReference();
        return node.ownerDocument = this, node.nodeName = name, node;
    },
    createElementNS: function(namespaceURI, qualifiedName) {
        var node = new Element(), pl = qualifiedName.split(":"), attrs = node.attributes = new NamedNodeMap();
        return node.childNodes = new NodeList(), node.ownerDocument = this, node.nodeName = qualifiedName, 
        node.tagName = qualifiedName, node.namespaceURI = namespaceURI, 2 == pl.length ? (node.prefix = pl[0], 
        node.localName = pl[1]) : node.localName = qualifiedName, attrs._ownerElement = node;
    },
    createAttributeNS: function(namespaceURI, qualifiedName) {
        var node = new Attr(), pl = qualifiedName.split(":");
        return node.ownerDocument = this, node.nodeName = qualifiedName, node.name = qualifiedName, 
        node.namespaceURI = namespaceURI, node.specified = !0, 2 == pl.length ? (node.prefix = pl[0], 
        node.localName = pl[1]) : node.localName = qualifiedName, node;
    }
}, _extends(Document, Node), Element.prototype = {
    nodeType: ELEMENT_NODE,
    hasAttribute: function(name) {
        return null != this.getAttributeNode(name);
    },
    getAttribute: function(name) {
        var attr = this.getAttributeNode(name);
        return attr && attr.value || "";
    },
    getAttributeNode: function(name) {
        return this.attributes.getNamedItem(name);
    },
    setAttribute: function(name, value) {
        var attr = this.ownerDocument.createAttribute(name);
        attr.value = attr.nodeValue = "" + value, this.setAttributeNode(attr);
    },
    removeAttribute: function(name) {
        var attr = this.getAttributeNode(name);
        attr && this.removeAttributeNode(attr);
    },
    appendChild: function(newChild) {
        return newChild.nodeType === DOCUMENT_FRAGMENT_NODE ? this.insertBefore(newChild, null) : _appendSingleChild(this, newChild);
    },
    setAttributeNode: function(newAttr) {
        return this.attributes.setNamedItem(newAttr);
    },
    setAttributeNodeNS: function(newAttr) {
        return this.attributes.setNamedItemNS(newAttr);
    },
    removeAttributeNode: function(oldAttr) {
        return this.attributes.removeNamedItem(oldAttr.nodeName);
    },
    removeAttributeNS: function(namespaceURI, localName) {
        var old = this.getAttributeNodeNS(namespaceURI, localName);
        old && this.removeAttributeNode(old);
    },
    hasAttributeNS: function(namespaceURI, localName) {
        return null != this.getAttributeNodeNS(namespaceURI, localName);
    },
    getAttributeNS: function(namespaceURI, localName) {
        var attr = this.getAttributeNodeNS(namespaceURI, localName);
        return attr && attr.value || "";
    },
    setAttributeNS: function(namespaceURI, qualifiedName, value) {
        var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
        attr.value = attr.nodeValue = "" + value, this.setAttributeNode(attr);
    },
    getAttributeNodeNS: function(namespaceURI, localName) {
        return this.attributes.getNamedItemNS(namespaceURI, localName);
    },
    getElementsByTagName: function(tagName) {
        return new LiveNodeList(this, function(base) {
            var ls = [];
            return _visitNode(base, function(node) {
                node === base || node.nodeType != ELEMENT_NODE || "*" !== tagName && node.tagName != tagName || ls.push(node);
            }), ls;
        });
    },
    getElementsByTagNameNS: function(namespaceURI, localName) {
        return new LiveNodeList(this, function(base) {
            var ls = [];
            return _visitNode(base, function(node) {
                node === base || node.nodeType !== ELEMENT_NODE || "*" !== namespaceURI && node.namespaceURI !== namespaceURI || "*" !== localName && node.localName != localName || ls.push(node);
            }), ls;
        });
    }
}, Document.prototype.getElementsByTagName = Element.prototype.getElementsByTagName, 
Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS, 
_extends(Element, Node), Attr.prototype.nodeType = ATTRIBUTE_NODE, _extends(Attr, Node), 
CharacterData.prototype = {
    data: "",
    substringData: function(offset, count) {
        return this.data.substring(offset, offset + count);
    },
    appendData: function(text) {
        text = this.data + text, this.nodeValue = this.data = text, this.length = text.length;
    },
    insertData: function(offset, text) {
        this.replaceData(offset, 0, text);
    },
    appendChild: function(newChild) {
        throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]);
    },
    deleteData: function(offset, count) {
        this.replaceData(offset, count, "");
    },
    replaceData: function(offset, count, text) {
        text = this.data.substring(0, offset) + text + this.data.substring(offset + count), 
        this.nodeValue = this.data = text, this.length = text.length;
    }
}, _extends(CharacterData, Node), Text.prototype = {
    nodeName: "#text",
    nodeType: TEXT_NODE,
    splitText: function(offset) {
        var text = this.data, newText = text.substring(offset);
        text = text.substring(0, offset), this.data = this.nodeValue = text, this.length = text.length;
        var newNode = this.ownerDocument.createTextNode(newText);
        return this.parentNode && this.parentNode.insertBefore(newNode, this.nextSibling), 
        newNode;
    }
}, _extends(Text, CharacterData), Comment.prototype = {
    nodeName: "#comment",
    nodeType: COMMENT_NODE
}, _extends(Comment, CharacterData), CDATASection.prototype = {
    nodeName: "#cdata-section",
    nodeType: CDATA_SECTION_NODE
}, _extends(CDATASection, CharacterData), DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE, 
_extends(DocumentType, Node), Notation.prototype.nodeType = NOTATION_NODE, _extends(Notation, Node), 
Entity.prototype.nodeType = ENTITY_NODE, _extends(Entity, Node), EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE, 
_extends(EntityReference, Node), DocumentFragment.prototype.nodeName = "#document-fragment", 
DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE, _extends(DocumentFragment, Node), 
ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE, _extends(ProcessingInstruction, Node), 
XMLSerializer.prototype.serializeToString = function(node, isHtml, nodeFilter) {
    return nodeSerializeToString.call(node, isHtml, nodeFilter);
}, Node.prototype.toString = nodeSerializeToString;

try {
    if (Object.defineProperty) {
        function getTextContent(node) {
            switch (node.nodeType) {
              case ELEMENT_NODE:
              case DOCUMENT_FRAGMENT_NODE:
                var buf = [];
                for (node = node.firstChild; node; ) 7 !== node.nodeType && 8 !== node.nodeType && buf.push(getTextContent(node)), 
                node = node.nextSibling;
                return buf.join("");

              default:
                return node.nodeValue;
            }
        }
        Object.defineProperty(LiveNodeList.prototype, "length", {
            get: function() {
                return _updateLiveList(this), this.$$length;
            }
        }), Object.defineProperty(Node.prototype, "textContent", {
            get: function() {
                return getTextContent(this);
            },
            set: function(data) {
                switch (this.nodeType) {
                  case ELEMENT_NODE:
                  case DOCUMENT_FRAGMENT_NODE:
                    for (;this.firstChild; ) this.removeChild(this.firstChild);
                    (data || String(data)) && this.appendChild(this.ownerDocument.createTextNode(data));
                    break;

                  default:
                    this.data = data, this.value = data, this.nodeValue = data;
                }
            }
        }), __set__ = function(object, key, value) {
            object["$$" + key] = value;
        };
    }
} catch (e) {}

function DOMParser(options) {
    this.options = options || {
        locator: {}
    };
}

function buildErrorHandler(errorImpl, domBuilder, locator) {
    if (!errorImpl) {
        if (domBuilder instanceof DOMHandler) return domBuilder;
        errorImpl = domBuilder;
    }
    var errorHandler = {}, isCallback = errorImpl instanceof Function;
    function build(key) {
        var fn = errorImpl[key];
        !fn && isCallback && (fn = 2 == errorImpl.length ? function(msg) {
            errorImpl(key, msg);
        } : errorImpl), errorHandler[key] = fn && function(msg) {
            fn("[xmldom " + key + "]\t" + msg + _locator(locator));
        } || function() {};
    }
    return locator = locator || {}, build("warning"), build("error"), build("fatalError"), 
    errorHandler;
}

function DOMHandler() {
    this.cdata = !1;
}

function position(locator, node) {
    node.lineNumber = locator.lineNumber, node.columnNumber = locator.columnNumber;
}

function _locator(l) {
    if (l) return "\n@" + (l.systemId || "") + "#[line:" + l.lineNumber + ",col:" + l.columnNumber + "]";
}

function _toString(chars, start, length) {
    return "string" == typeof chars ? chars.substr(start, length) : chars.length >= start + length || start ? new java.lang.String(chars, start, length) + "" : chars;
}

function appendElement(hander, node) {
    hander.currentElement ? hander.currentElement.appendChild(node) : hander.doc.appendChild(node);
}

"function" == typeof arequire && (exports.DOMImplementation = DOMImplementation, 
exports.XMLSerializer = XMLSerializer), DOMParser.prototype.parseFromString = function(source, mimeType) {
    var options = this.options, sax = new XMLReader(), domBuilder = options.domBuilder || new DOMHandler(), errorHandler = options.errorHandler, locator = options.locator, defaultNSMap = options.xmlns || {}, isHTML = /\/x?html?$/.test(mimeType), entityMap = isHTML ? htmlEntity.entityMap : {
        lt: "<",
        gt: ">",
        amp: "&",
        quot: '"',
        apos: "'"
    };
    return locator && domBuilder.setDocumentLocator(locator), sax.errorHandler = buildErrorHandler(errorHandler, domBuilder, locator), 
    sax.domBuilder = options.domBuilder || domBuilder, isHTML && (defaultNSMap[""] = "http://www.w3.org/1999/xhtml"), 
    defaultNSMap.xml = defaultNSMap.xml || "http://www.w3.org/XML/1998/namespace", source ? sax.parse(source, defaultNSMap, entityMap) : sax.errorHandler.error("invalid doc source"), 
    domBuilder.doc;
}, DOMHandler.prototype = {
    startDocument: function() {
        this.doc = new DOMImplementation().createDocument(null, null, null), this.locator && (this.doc.documentURI = this.locator.systemId);
    },
    startElement: function(namespaceURI, localName, qName, attrs) {
        var doc = this.doc, el = doc.createElementNS(namespaceURI, qName || localName), len = attrs.length;
        appendElement(this, el), this.currentElement = el, this.locator && position(this.locator, el);
        for (var i = 0; i < len; i++) {
            namespaceURI = attrs.getURI(i);
            var value = attrs.getValue(i), attr = (qName = attrs.getQName(i), doc.createAttributeNS(namespaceURI, qName));
            this.locator && position(attrs.getLocator(i), attr), attr.value = attr.nodeValue = value, 
            el.setAttributeNode(attr);
        }
    },
    endElement: function(namespaceURI, localName, qName) {
        var current = this.currentElement;
        current.tagName;
        this.currentElement = current.parentNode;
    },
    startPrefixMapping: function(prefix, uri) {},
    endPrefixMapping: function(prefix) {},
    processingInstruction: function(target, data) {
        var ins = this.doc.createProcessingInstruction(target, data);
        this.locator && position(this.locator, ins), appendElement(this, ins);
    },
    ignorableWhitespace: function(ch, start, length) {},
    characters: function(chars, start, length) {
        if (chars = _toString.apply(this, arguments)) {
            if (this.cdata) var charNode = this.doc.createCDATASection(chars); else charNode = this.doc.createTextNode(chars);
            this.currentElement ? this.currentElement.appendChild(charNode) : /^\s*$/.test(chars) && this.doc.appendChild(charNode), 
            this.locator && position(this.locator, charNode);
        }
    },
    skippedEntity: function(name) {},
    endDocument: function() {
        this.doc.normalize();
    },
    setDocumentLocator: function(locator) {
        (this.locator = locator) && (locator.lineNumber = 0);
    },
    comment: function(chars, start, length) {
        chars = _toString.apply(this, arguments);
        var comm = this.doc.createComment(chars);
        this.locator && position(this.locator, comm), appendElement(this, comm);
    },
    startCDATA: function() {
        this.cdata = !0;
    },
    endCDATA: function() {
        this.cdata = !1;
    },
    startDTD: function(name, publicId, systemId) {
        var impl = this.doc.implementation;
        if (impl && impl.createDocumentType) {
            var dt = impl.createDocumentType(name, publicId, systemId);
            this.locator && position(this.locator, dt), appendElement(this, dt);
        }
    },
    warning: function(error) {
        console.warn("[xmldom warning]\t" + error, _locator(this.locator));
    },
    error: function(error) {
        console.error("[xmldom error]\t" + error, _locator(this.locator));
    },
    fatalError: function(error) {
        throw console.error("[xmldom fatalError]\t" + error, _locator(this.locator)), error;
    }
}, "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, function(key) {
    DOMHandler.prototype[key] = function() {
        return null;
    };
});

var htmlEntity = {}, utf8_to_b64, sendXHR, sendXHRPost;

htmlEntity.entityMap = entityMap, window.Parser = {
    DOMParser: DOMParser
}, window.alert = function(str) {
    console.log(str), wx.showModal({
        title: "提示",
        content: str,
        showCancel: !1
    });
}, window.DEBUG = !1, window.name = "", window.alwaysCache = [ "words.bin", "res/atlas/common.png", "res/atlas/common_sg.png" ], 
window.tempFiles = {}, wx.onShow(function(res) {
    wx.setKeepScreenOn({
        keepScreenOn: !0
    });
    var updateManager = wx.getUpdateManager();
    if (updateManager.onCheckForUpdate(function(res) {
        res.hasUpdate;
    }), updateManager.onUpdateReady(function() {
        wx.showModal({
            title: "更新提示",
            content: "新版本已下载完成，请重启",
            showCancel: !1,
            success: function(res) {
                res.confirm && updateManager.applyUpdate();
            }
        });
    }), updateManager.onUpdateFailed(function() {
        wx.showModal({
            title: "更新提示",
            content: "新版本下载失败，请检查网络",
            showCancel: !1
        });
    }), window.modules && modules.wx_module && modules.common && modules.common.PlatParams.control) {
        var sceneId = res && res.scene || null;
        modules.wx_module.wxShareCtrl.instance.onShow(sceneId);
    }
}), wx.onHide(function() {
    window.modules && modules.wx_module && modules.common && modules.common.PlatParams.control && modules.wx_module.wxShareCtrl.instance.onHide();
}), void 0 !== utf8_to_b64 && "function" == typeof utf8_to_b64 || (utf8_to_b64 = function(str) {
    return window.btoa(unescape(encodeURIComponent(str)));
}), window.utf8_to_b64 = utf8_to_b64, void 0 !== sendXHR && "function" == typeof sendXHR || (sendXHR = function(url, data, callBack, responseType, failedCallback) {
    void 0 === responseType && (responseType = "json");
    var xhr = new XMLHttpRequest();
    xhr.responseType = responseType, xhr.onload = function() {
        4 != xhr.readyState || 200 != xhr.status && 301 != xhr.status ? 400 <= xhr.status && xhr.status < 600 && failedCallback && failedCallback() : callBack && callBack(xhr.response);
    }, xhr.onerror = function() {
        failedCallback && failedCallback();
    }, xhr.open("GET", url), xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), 
    xhr.send(data);
}), window.sendXHR = sendXHR, void 0 !== sendXHRPost && "function" == typeof sendXHRPost || (sendXHRPost = function(url, data, callBack, responseType, failedCallback) {
    void 0 === responseType && (responseType = "json"), responseType || (responseType = "json");
    var xhr = new XMLHttpRequest();
    xhr.responseType = responseType, xhr.onload = function() {
        4 != xhr.readyState || 200 != xhr.status && 301 != xhr.status ? 400 <= xhr.status && xhr.status < 600 && failedCallback && failedCallback() : callBack && callBack(xhr.response);
    }, xhr.onerror = function() {
        failedCallback && failedCallback();
    }, xhr.open("POST", url), xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    var baseData = {
        channel: tparams.channel,
        package: tparams.package,
        account: tparams.account,
        sign: tparams.sign
    }, formData = Object.assign({}, baseData, data), params = [];
    for (var key in formData) params.push(encodeURIComponent(key) + "=" + encodeURIComponent(formData[key]));
    var postData = params.join("&");
    xhr.send(postData);
}), window.sendXHRPost = sendXHRPost;

var ask_pay = function(roleId, roleName, roleLevel, roleCareer, productId, price) {
    var str = "";
    str = 1 == tparams.control.isSwitchSdk ? utf8_to_b64("game/getOrderTx/" + modules.login.LoginModel.instance.selectedServer.server_id + "/" + tparams.channel + "/" + roleId + "/" + roleName + "/" + productId + "/" + tparams.account + "/" + roleLevel + "/" + price + "/" + tparams.package + "/" + roleCareer + "/" + tparams.sign + "/" + tparams.os + "/" + tparams.sdk_name) : utf8_to_b64("game/getOrder/" + modules.login.LoginModel.instance.selectedServer.server_id + "/" + tparams.channel + "/" + roleId + "/" + roleName + "/" + productId + "/" + tparams.account + "/" + roleLevel + "/" + price + "/" + tparams.package + "/" + roleCareer + "/" + tparams.sign + "/" + tparams.os + "/" + tparams.sdk_name), 
    sendXHR(tparams.backstage + str, null, askPayCallBack);
};

window.ask_pay = ask_pay;

var askPayCallBack = function(data) {
    data && (200 === data.errCode ? tparams.is_unified && (data.payInfo && data.payInfo.isPaymentModeSwitch ? modules.pay.PayCtrl.instance.askPayCallback({
        data: data.data,
        orderNum: data.payInfo.orderNum,
        payType: data.payInfo.payType
    }) : AKSDK.pay(data.data, function(status, data) {})) : modules.common.CommonUtil.alert("提示", data.errMsg));
}, createPay = function(orderNum, roleId, productId, productName, price, payType, callback) {
    console.log(orderNum);
    var str = "pay/create0rder/" + modules.login.LoginModel.instance.selectedServer.server_id + "/" + tparams.channel + "/" + tparams.account + "/" + tparams.package + "/" + orderNum + "/" + roleId + "/" + productId + "/" + productName + "/" + price + "/" + payType + "/" + tparams.sign;
    sendXHR(tparams.backstage + str, null, callback);
};

window.createPay = createPay;

var queryOrder = function(orderNum, payType, callback) {
    var str = "pay/queryOrder/" + tparams.channel + "/" + tparams.account + "/" + tparams.package + "/" + orderNum + "/" + payType + "/" + tparams.sign;
    sendXHR(tparams.backstage + str, null, callback);
};

window.queryOrder = queryOrder;

var record_step = function(step, role_id) {
    if (null != tparams.channel && null != tparams.package) {
        var str, serverTmpId = 0;
        if (1 === tparams.isNewregister && (serverTmpId = tparams.selectedServer.server_id), 
        3 < step && (serverTmpId = modules.login.LoginModel.instance.selectedServer.server_id), 
        str = utf8_to_b64("game/node/" + tparams.channel + "/" + serverTmpId + "/" + tparams.package + "/" + step + "/" + tparams.account + "/" + tparams.sign + "/" + role_id + "/" + tparams.mac + "/" + tparams.group_id), 
        sendXHR(tparams.backstage + str, null, null), tparams.is_unified && 1 === tparams.isNewregister && 11 == step && role_id && 0 == tparams.control.isSwitchSdk) {
            var checkStr = utf8_to_b64(tparams.sdk_name + "Check/miniShare/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign + "/" + role_id);
            sendXHR(tparams.backstage + checkStr, null, null);
        }
        "shenhai" == tparams.channel && shenhaiStep(step), "linyoumini" == tparams.channel && linyouminiStep(step);
    }
};

window.record_step = record_step;

var shenhaiStep = function(step) {
    var sendStep = 0;
    switch (step) {
      case 1:
        sendStep = 1e4;
        break;

      case 2:
        sendStep = 2e4;
        break;

      case 4:
        sendStep = 25e3;
        break;

      case 5:
        sendStep = 5e4;
        break;

      case 7:
        sendStep = 6e4;
        break;

      case 10:
        sendStep = 7e4;
        break;

      case 11:
        sendStep = 90200;
        break;

      case 13:
        sendStep = 90300;
        break;

      case 14:
        sendStep = 90400;
        break;

      case 15:
        sendStep = 90500;
        break;

      default:
        sendStep = 0;
    }
    0 !== sendStep && "shenhai" == tparams.channel && window.AKSDK && AKSDK.dataPlacement && AKSDK.dataPlacement(sendStep);
};

window.shenhaiStep = shenhaiStep;

var linyouminiStep = function(step) {
    12 == step && "linyoumini" == tparams.channel && window.AKSDK && AKSDK.reportOther && AKSDK.reportOther();
};

window.linyouminiStep = linyouminiStep;

var logoutCallBack = function(status) {
    window.location.href = tparams.cdn + "switch_account.html";
}, logout = function() {
    tparams.is_unified && AKSDK.logout(logoutCallBack);
};

window.logout = logout;

var player_create = function(role_id, role_name, role_level, role_create_time) {
    if (void 0 === role_create_time && (role_create_time = 0), tparams.is_unified) if (9130 == tparams.sdk_name) role_create_time = role_create_time ? Math.round(role_create_time / 1e3) : 0, 
    AKSDK.logCreateRole(modules.login.LoginModel.instance.selectedServer.server_id, modules.login.LoginModel.instance.selectedServer.name, role_id, role_name, role_level, role_create_time); else if (9187 == tparams.sdk_name) AKSDK.logCreateRole(modules.login.LoginModel.instance.selectedServer.server_id, modules.login.LoginModel.instance.selectedServer.name, role_id, role_name, role_level, role_create_time); else {
        void 0 === role_create_time && (role_create_time = 0), role_create_time = role_create_time ? Math.round(role_create_time / 1e3) : 0;
        var reportData = {
            report_type: 1,
            user_id: tparams.uid,
            role_id: role_id,
            role_name: role_name,
            role_level: role_level,
            role_vip_level: 0,
            role_power: 0,
            server_id: modules.login.LoginModel.instance.selectedServer.server_id,
            server_name: modules.login.LoginModel.instance.selectedServer.name,
            role_revival: 0,
            role_create_time: role_create_time,
            role_ingots: 0
        };
        AKSDK.reportRole(reportData);
    }
};

window.player_create = player_create;

var player_login = function(role_id, role_name, role_level, role_create_time, role_power, role_ingots, role_revival) {
    if (void 0 === role_create_time && (role_create_time = 0), void 0 === role_power && (role_power = 0), 
    void 0 === role_ingots && (role_ingots = 0), void 0 === role_revival && (role_revival = 0), 
    tparams.is_unified) if (9130 == tparams.sdk_name) {
        role_create_time = role_create_time ? Math.round(role_create_time / 1e3) : 0;
        var extra = {};
        1 != tparams.develop && window.tparams.control && 1 == tparams.control.miniGameDynamicChargeLogin && (extra.callback = function(callData) {
            null != callData.show_pay && setCloseRecharge(1 == callData.show_pay ? 0 : 1);
        }), extra.rolepower = role_power, AKSDK.logEnterGame(modules.login.LoginModel.instance.selectedServer.server_id, modules.login.LoginModel.instance.selectedServer.name, role_id, role_name, role_level, role_create_time, extra);
    } else if (9187 == tparams.sdk_name) AKSDK.logEnterGame(modules.login.LoginModel.instance.selectedServer.server_id, modules.login.LoginModel.instance.selectedServer.name, role_id, role_name, role_level, role_create_time); else {
        void 0 === role_create_time && (role_create_time = 0), void 0 === role_power && (role_power = 0), 
        void 0 === role_ingots && (role_ingots = 0), role_create_time = role_create_time ? Math.round(role_create_time / 1e3) : 0;
        var reportData = {
            report_type: 2,
            user_id: tparams.uid,
            role_id: role_id,
            role_name: role_name,
            role_level: role_level,
            role_vip_level: 0,
            role_power: role_power,
            server_id: modules.login.LoginModel.instance.selectedServer.server_id,
            server_name: modules.login.LoginModel.instance.selectedServer.name,
            role_revival: 0,
            role_create_time: role_create_time,
            role_ingots: role_ingots
        };
        AKSDK.reportRole(reportData), AKSDK.checkShareRole && AKSDK.checkShareRole(function(isShare) {
            if (1 == isShare) {
                console.log("====上报分享检查====");
                var checkStr = tparams.sdk_name + "Check/miniShare/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign + "/" + role_id;
                sendXHR(tparams.backstage + checkStr, null, null);
            }
        });
    }
};

window.player_login = player_login;

var player_level_up = function(role_id, role_name, role_level, role_create_time, role_power, role_ingots, role_revival) {
    if (void 0 === role_create_time && (role_create_time = 0), void 0 === role_power && (role_power = 0), 
    void 0 === role_ingots && (role_ingots = 0), void 0 === role_revival && (role_revival = 0), 
    tparams.is_unified) if (9130 == tparams.sdk_name) {
        var extra = {};
        1 != tparams.develop && window.tparams.control && 1 == tparams.control.miniGameDynamicChargeLevel && (extra.callback = function(callData) {
            null != callData.show_pay && setCloseRecharge(1 == callData.show_pay ? 0 : 1);
        }), extra.rolepower = role_power, role_create_time = role_create_time ? Math.round(role_create_time / 1e3) : 0, 
        AKSDK.logRoleUpLevel(modules.login.LoginModel.instance.selectedServer.server_id, modules.login.LoginModel.instance.selectedServer.name, role_id, role_name, role_level, role_create_time, extra);
    } else if (9187 == tparams.sdk_name) AKSDK.logRoleUpLevel(modules.login.LoginModel.instance.selectedServer.server_id, modules.login.LoginModel.instance.selectedServer.name, role_id, role_name, role_level, role_create_time); else {
        void 0 === role_create_time && (role_create_time = 0), void 0 === role_power && (role_power = 0), 
        void 0 === role_ingots && (role_ingots = 0), void 0 === role_revival && (role_revival = 0), 
        role_create_time = role_create_time ? Math.round(role_create_time / 1e3) : 0;
        var reportData = {
            report_type: 3,
            user_id: tparams.uid,
            role_id: role_id,
            role_name: role_name,
            role_level: role_level,
            role_vip_level: 0,
            role_power: role_power,
            server_id: modules.login.LoginModel.instance.selectedServer.server_id,
            server_name: modules.login.LoginModel.instance.selectedServer.name,
            role_revival: 0,
            role_create_time: role_create_time,
            role_ingots: role_ingots
        };
        AKSDK.reportRole(reportData);
    }
};

window.player_level_up = player_level_up;

var player_mini_share = function(role_id) {
    if (tparams.control && 1 == tparams.control.isOpenPost) {
        var data = {
            server_id: modules.login.LoginModel.instance.selectedServer.server_id,
            role_id: role_id
        };
        console.log("====分享埋点===POST===="), console.log(data), sendXHRPost(tparams.backapi + "miniShareStep/run", data);
    } else {
        var str = utf8_to_b64("game/miniShareStep/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign + "/" + modules.login.LoginModel.instance.selectedServer.server_id + "/" + role_id);
        console.log("====分享埋点===GET===="), console.log(str), sendXHR(tparams.backstage + str, null, null);
    }
    AKSDK.share && AKSDK.share();
};

window.player_mini_share = player_mini_share;

var player_mini_service = function() {
    tparams.is_unified && AKSDK.openService();
};

window.player_mini_service = player_mini_service;

var player_fk_customer = function(role_id, role_name, role_level, role_create_time) {
    void 0 === role_create_time && (role_create_time = 0), tparams.is_unified && "fk" == tparams.channel && (role_create_time = role_create_time ? Math.round(role_create_time / 1e3) : 0, 
    AKSDK.goCustomer(modules.login.LoginModel.instance.selectedServer.server_id, modules.login.LoginModel.instance.selectedServer.name, role_id, role_name, role_level, role_create_time));
};

window.player_fk_customer = player_fk_customer;

var _connection = function(callback, failedCallback) {
    var str = utf8_to_b64("game/connection/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign);
    sendXHR(tparams.backstage + str, null, callback, "json", failedCallback);
};

window._connection = _connection;

var req_server_list = function() {
    if (null != tparams.channel && null != tparams.package) {
        var str = utf8_to_b64("game/allServer/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.group_id + "/" + tparams.rvtype + "/" + tparams.sign);
        sendXHR(tparams.backstage + str, null, reqServerListCallBack);
    }
};

window.req_server_list = req_server_list;

var reqServerListCallBack = function(data) {
    if (200 === data.errCode) {
        var model = window.modules.login.LoginModel.instance;
        model.serverZoneNames = data.z, model.serverZones = data.s;
    }
}, getNotice = function(callBack) {
    var str = utf8_to_b64("game/groupServerNotice/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign + "/" + tparams.notice.group_id + "/" + tparams.notice.server + "/" + tparams.notice.version);
    sendXHR(tparams.backstage + str, null, callBack);
};

window.getNotice = getNotice;

var getZoneServer = function(zone) {
    var str = utf8_to_b64("game/zoneServer/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.group_id + "/" + tparams.rvtype + "/" + zone + "/" + tparams.sign);
    sendXHR(tparams.backstage + str, null, getZoneServerBack);
};

window.getZoneServer = getZoneServer;

var getZoneServerBack = function(data) {
    200 === data.errCode && window.modules.login.LoginModel.instance.updateZone(parseInt(data.zone), data.s);
}, sdkInitVer = function(game_ver, callback) {
    void 0 === game_ver && (game_ver = 0), tparams.isSwitchSdk = 0;
    var str = utf8_to_b64("game/miniLoginInit/" + tparams.game_pkg);
    sendXHR(tparams.backstage + str, null, function(res) {
        if (200 == res.code && (res.data && 1 === res.data.isSwitchSdk && (window.AKSDK = window.TXSDK, 
        tparams.isSwitchSdk = 1, tparams.sdk_name = "txsdk"), window.AKSDK)) {
            var initData = {
                game_ver: game_ver
            };
            AKSDK.init(initData, function(data) {
                callback(data);
            });
        }
    });
}, player_power_up = function() {};

window.player_power_up = player_power_up;

var player_follow = function() {};

window.player_follow = player_follow;

var player_gorealname = function(callback) {
    tparams.is_unified && "shenhai" == tparams.channel && window.AKSDK && AKSDK.realName && AKSDK.realName();
};

window.player_gorealname = player_gorealname;

var player_realname = function(callback) {
    tparams.is_unified ? "shenhai" == tparams.channel && window.AKSDK && AKSDK.getRealnameInfo && AKSDK.getRealnameInfo(function(status) {
        callback(status);
    }) : callback(1, {});
};

window.player_realname = player_realname;

var onLaunchOptions = function() {
    return wx && wx.getLaunchOptionsSync() || null;
};

window.onLaunchOptions = onLaunchOptions;

var isCloseRecharge = function() {
    return tparams.isCloseRecharge;
};

window.isCloseRecharge = isCloseRecharge;

var setCloseRecharge = function(value) {
    tparams.isCloseRecharge !== value && (tparams.isCloseRecharge = value, window.PlatParams && window.PlatParams.changeCloseRecharge());
};

window.setCloseRecharge = setCloseRecharge;

var beQuit = function() {
    "9130" == tparams.sdk_name && 1 == tparams.control.beQuit && (console.log("-------------下线beQuit----------"), 
    AKSDK.beQuit && AKSDK.beQuit());
};

window.beQuit = beQuit;

var checkWord = function(msg, callback) {
    window.AKSDK && AKSDK.msgCheck && (1 == tparams.control.isSwitchSdk ? AKSDK.msgCheck(msg, function(state, data) {
        console.log("[AKSDK]----msgCheck---"), console.log(data);
        var callbackValue = 2;
        data && 200 === data.statusCode && (callbackValue = 1 === data.data.state ? 0 : 1), 
        callback && callback(callbackValue);
    }) : AKSDK.msgCheck(msg, function(data) {
        console.log("[AKSDK]----msgCheck---"), console.log(data);
        var callbackValue = 2;
        data && 200 === data.statusCode && (callbackValue = 1 === data.data.state ? 0 : 1), 
        callback && callback(callbackValue);
    }));
};

window.checkWord = checkWord;

var reLoginSign = function(callback, failCallback) {
    var str = utf8_to_b64("game/reLoginSign/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign + "/" + modules.login.LoginModel.instance.selectedServer.server_id + "/" + tparams.account);
    sendXHR(tparams.backstage + str, null, callback, "json", failCallback);
};

window.reLoginSign = reLoginSign;

var loadingProgress = function(progress) {
    window.AKSDK && AKSDK.setLoadingProgress && AKSDK.setLoadingProgress(progress);
};

window.loadingProgress = loadingProgress, window.tparams = tparams, window.sdkInitVer = sdkInitVer;

var isIos = function() {
    return "ios" == window.navigator.platform;
};

window.isIos = isIos;

var setClipboardData = function(setObj) {
    wx && wx.setClipboardData(setObj);
};

window.setClipboardData = setClipboardData;

var miniQQGetOpenId = function(role_id, roleName) {
    if (1 == tparams.control.miniQQAddFriend) {
        var str = utf8_to_b64("game/miniQQGetOpenId/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign + "/" + role_id);
        sendXHR(tparams.backstage + str, null, function(data) {
            var ins = modules.notice.SystemNoticeManager.instance, noticeFunc = ins.addNotice.bind(ins);
            if (1 == data.state) {
                var system_info = wx.getSystemInfoSync(), btn_left = .5 * (system_info.screenWidth - 99), btn_top = .5 * system_info.screenHeight, addFBtn_1 = wx.createAddFriendButton({
                    type: "image",
                    image: tparams.select_server_cdn + "login/image_xyxt_tjhy.png",
                    style: {
                        left: btn_left,
                        top: btn_top,
                        width: 99,
                        height: 34
                    },
                    openid: data.openid
                });
                addFBtn_1.show();
                var str_1 = "点击添加好友按钮将添加<span style='color:#b15315'>【" + roleName + "】</span>为<span style='color:#b15315'>QQ好友</span>";
                CommonUtil.alert("添加好友", str_1, null, null, null, !1, null, 0, "", "left", -1, "top");
                var destroyAddFBtn_1 = function() {
                    addFBtn_1.offTap(onClick_1), addFBtn_1.hide(), addFBtn_1.destroy(), Laya.stage.off("click", null, destroyAddFBtn_1), 
                    WindowManager.instance.close(12);
                }, onClick_1 = function(data) {
                    console.log(data), destroyAddFBtn_1(), data && "addFriend:fail auth deny" == data.errMsg && noticeFunc("无法添加，对方未授权", !0);
                };
                Laya.stage.once("click", null, destroyAddFBtn_1), addFBtn_1.onTap(onClick_1);
            } else noticeFunc("查询失败", !0);
        }, "json");
    }
};

window.miniQQGetOpenId = miniQQGetOpenId;

var microtQuery = function(statusCallback) {};

window.microtQuery = microtQuery;

var microtOation = function(role_id, statusCallback) {};

window.microtOation = microtOation;

var isQQSpSource = function(callback) {
    if (tparams.is_unified && 1 == tparams.control.funcOpen[989] && qq) {
        var systemInfo = qq.getSystemInfoSync();
        if ("sp" == (systemInfo.AppPlatform ? systemInfo.AppPlatform : "")) return void callback(1);
    }
    callback(tparams.control.funcOpen[989] = 0);
};

window.isQQSpSource = isQQSpSource;

var isQQRedpacket = function(callback) {
    tparams.is_unified && 1 == tparams.control.funcOpen[1023] && qq ? callback(1) : callback(0);
};

window.isQQRedpacket = isQQRedpacket;

var qqRedpacketWithdraw = function(active_id, role_id, money, callback) {
    if (tparams.is_unified && 1 == tparams.control.funcOpen[1023] && qq) {
        var str = utf8_to_b64("game/qqRedpacketWithdraw/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign + "/" + role_id + "/" + money + "/" + active_id);
        sendXHR(tparams.backstage + str, null, function(rsData) {
            400 !== rsData.code ? callback(0, rsData.msg) : callback(1, rsData.msg);
        });
    } else callback(1, 52805);
};

window.qqRedpacketWithdraw = qqRedpacketWithdraw;

var player_bindphone = function(callback) {
    tparams.is_unified && 1 == tparams.control.funcOpen[988] && window.AKSDK && AKSDK.bindPhone && AKSDK.bindPhone(function(returnData) {
        console.log("手机绑定返回:"), console.log(returnData);
        var state = returnData.state, data = returnData.data;
        1 == state && data && 1 == data.isBindPhone && callback(1);
    }), callback(0);
};

window.player_bindphone = player_bindphone;

var player_phonequery = function(callback) {
    tparams.is_unified && 1 == tparams.control.funcOpen[988] && window.AKSDK && AKSDK.bindPhone ? AKSDK.bindPhone(function(status) {
        console.log("手机绑定状态检查返回:"), console.log(status), 0 == status && callback(1);
    }) : callback(0);
};

window.player_phonequery = player_phonequery;

var player_accountsecurity = function() {
    tparams.is_unified && 1 == tparams.control.funcOpen[1001] && window.AKSDK && AKSDK.accountSecurity && AKSDK.accountSecurity();
};

window.player_accountsecurity = player_accountsecurity;

var getBoxList = function(data, callback) {
    console.log("前端调用获取游戏盒子数据"), tparams.is_unified && 1 == tparams.control.funcOpen[1002] && window.AKSDK && AKSDK.getBoxList ? AKSDK.getBoxList(data, function(boxList) {
        console.log("获取游戏盒子数据返回:"), console.log(boxList), callback(boxList);
    }) : callback({
        state: 0
    });
};

window.getBoxList = getBoxList;

var openBox = function() {
    console.log("前端调用打开游戏盒子上报"), tparams.is_unified && 1 == tparams.control.funcOpen[1002] && window.AKSDK && AKSDK.openBox && AKSDK.openBox();
};

window.openBox = openBox;

var clickBoxGame = function(data) {
    console.log("前端调用点击盒子内游戏跳转"), tparams.is_unified && 1 == tparams.control.funcOpen[1002] && window.AKSDK && AKSDK.clickBoxGame && AKSDK.clickBoxGame(data);
};

window.clickBoxGame = clickBoxGame;

var jump37BoxDownload = function() {};

window.jump37BoxDownload = jump37BoxDownload;

var jumpActiveUrl = function() {
    1 == tparams.control.funcOpen[1104] && tparams.control.offlineActive && (top.location.href = tparams.control.offlineActive);
};

window.jumpActiveUrl = jumpActiveUrl;

var setOppoClipboardData = function(setObj) {
    qg && qg.setClipboardData(setObj);
};

window.setOppoClipboardData = setOppoClipboardData;

var setTtClipboardData = function(setObj) {
    tt && tt.setClipboardData(setObj);
};

window.setTtClipboardData = setTtClipboardData;

var setVivoClipboardData = function(setObj) {
    qg && qg.setClipboardData(setObj);
};

window.setVivoClipboardData = setVivoClipboardData;

var contentCheck = function(data, callback) {
    AKSDK && AKSDK.contentCheck(data, callback);
};

window.contentCheck = contentCheck;

var turnSendUrl = function() {
    1 == tparams.control.funcOpen[1107] && ("txsdk" == tparams.sdk_name ? AKSDK.convertClient && AKSDK.convertClient() : AKSDK && AKSDK.sendUrl && AKSDK.sendUrl());
};

window.turnSendUrl = turnSendUrl;

var turnRoleInfo = function(role_id, callback) {
    var str = utf8_to_b64("game/turnRoleInfo/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign + "/" + role_id);
    sendXHR(tparams.backstage + str, null, function(rsData) {
        console.log(rsData), 400 !== rsData.code ? callback(rsData.data) : callback(-1);
    });
};

window.turnRoleInfo = turnRoleInfo;

var packageGroupSwitch = function(other_group_id, callback) {
    if (1 == tparams.control.packageSwitchGroup && tparams.otherGroup) {
        var str = utf8_to_b64("client/packageGroupSwitch/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign + "/" + tparams.group_id + "/" + other_group_id);
        sendXHR(tparams.backstage + str, null, function(value) {
            value && (1 === value.state ? (alert("切换成功, 请重新登陆游戏!"), callback(1)) : (alert("切换失败"), 
            callback(0)));
        });
    } else alert("切换失败"), callback(0);
};

window.packageGroupSwitch = packageGroupSwitch;

var receiveReport = function(order_id) {
    if (1 == tparams.control.receiveReport && order_id) {
        var str = utf8_to_b64("game/getCOrderNum/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign + "/" + order_id);
        sendXHR(tparams.backstage + str, null, function(rsData) {
            console.log(rsData), rsData && 200 === rsData.code && AKSDK.receiveReport && AKSDK.receiveReport(rsData.data.corder_num);
        });
    }
};

window.receiveReport = receiveReport;

var sVipQrcode = function(server_id, role_id, callBack) {
    1 == tparams.control.svipQrcode && AKSDK.getSvipInfo ? AKSDK.getSvipInfo({
        server_id: server_id,
        role_id: role_id
    }, function(res) {
        res && res.qrcode && callBack(res.qrcode);
    }) : callBack(0);
};

window.sVipQrcode = sVipQrcode;

var hasShortcutInstalled = function(callback) {
    qg && qg.hasShortcutInstalled({
        success: function(res) {
            callback(res);
        },
        fail: function(err) {},
        complete: function() {}
    });
};

window.hasShortcutInstalled = hasShortcutInstalled;

var installShortcut = function(callback) {
    qg && qg.installShortcut({
        success: function() {
            callback(!0);
        },
        fail: function(err) {},
        complete: function() {}
    });
};

window.installShortcut = installShortcut;

var redpacketWithdraw = function(role_id, money_id, callback) {
    if (tparams.is_unified) {
        var str = utf8_to_b64("game/redpacketWithdraw/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign + "/" + role_id + "/" + money_id);
        sendXHR(tparams.backstage + str, null, function(rsData) {
            400 !== rsData.code ? callback(0) : callback(rsData.msg);
        });
    } else callback(52805);
};

window.redpacketWithdraw = redpacketWithdraw;

var wxStartParamsReport = function(start_type, parmas) {
    if (wx && tparams.account) {
        var systemInfo = wx.getSystemInfoSync();
        if (tparams.control && 1 == tparams.control.isOpenPost) {
            var data = {
                game_ver: tparams.game_ver,
                develop: tparams.develop,
                start_type: start_type,
                params: encodeURIComponent(JSON.stringify(parmas)),
                systemInfo: encodeURIComponent(JSON.stringify(systemInfo))
            };
            console.log("==== wx上报 === POST ===="), console.log(data), sendXHRPost(tparams.backapi + "wxStartParamsReport/run", data);
        } else {
            var str = utf8_to_b64("game/wxStartParamsReport/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign + "/" + tparams.game_ver + "/" + tparams.develop + "/" + start_type + "/" + encodeURIComponent(JSON.stringify(parmas)) + "/" + encodeURIComponent(JSON.stringify(systemInfo)));
            console.log("====wx上报==  GET  =="), console.log(str), sendXHR(tparams.backstage + str);
        }
    }
};

window.wxStartParamsReport = wxStartParamsReport;

var clickMiniGame = function(callback) {
    console.log("前端调用大蓝分流跳转"), window.AKSDK && AKSDK.clickMiniGame && AKSDK.clickMiniGame(callback);
};

window.clickMiniGame = clickMiniGame;

var inspireVideo = function(callBack) {
    if (1 == tparams.control.funcOpen[1165] && window.AKSDK && AKSDK.inspireVideo) if (1 == tparams.control.isSwitchSdk && tparams.control.silangInspireVideoId) {
        var data = {
            ad_id: tparams.control.silangInspireVideoId
        };
        AKSDK.inspireVideo(data, function(status, data) {
            console.log("视频激励回调"), console.log(data), 0 == status && 0 == data.is_close_finish ? callBack(0) : callBack(1);
        });
    } else AKSDK.inspireVideo(function(res) {
        callBack(res);
    }); else callBack(1);
};

window.inspireVideo = inspireVideo;

var userDeviceLayaInfo = function(role_id) {
    console.log(role_id);
    for (var obj = {}, gl = Laya.WebGL.mainContext, params = [ "MAX_TEXTURE_IMAGE_UNITS", "MAX_VERTEX_TEXTURE_IMAGE_UNITS", "MAX_TEXTURE_SIZE", "MAX_CUBE_MAP_TEXTURE_SIZE", "MAX_VERTEX_ATTRIBS", "MAX_VERTEX_UNIFORM_VECTORS", "MAX_VARYING_VECTORS", "MAX_FRAGMENT_UNIFORM_VECTORS" ], i = 0, len = params.length; i < len; i++) obj[params[i]] = gl.getParameter(gl[params[i]]);
    var exts = [ "ANGLE_instanced_arrays", "EXT_blend_minmax", "EXT_color_buffer_float", "EXT_color_buffer_half_float", "EXT_disjoint_timer_query", "EXT_float_blend ", "EXT_frag_depth", "EXT_shader_texture_lod", "EXT_sRGB", "EXT_texture_compression_bptc", "EXT_texture_compression_rgtc", "EXT_texture_filter_anisotropic", "EXT_texture_norm16", "KHR_parallel_shader_compile", "OES_element_index_uint", "OES_fbo_render_mipmap", "OES_standard_derivatives", "OES_texture_float", "OES_texture_float_linear", "OES_texture_half_float", "OES_texture_half_float_linear", "OES_vertex_array_obj", "OVR_multiview2", "WEBGL_color_buffer_float", "WEBGL_compressed_texture_astc", "WEBGL_compressed_texture_atc", "WEBGL_compressed_texture_etc", "WEBGL_compressed_texture_etc1", "WEBGL_compressed_texture_pvrtc", "WEBGL_compressed_texture_s3tc", "WEBGL_compressed_texture_s3tc_srgb", "WEBGL_debug_renderer_info", "WEBGL_debug_shaders", "WEBGL_depth_texture", "WEBGL_draw_buffers", "WEBGL_lose_context", "WEBGL_multi_draw" ], supExts = gl.getSupportedExtensions();
    for (i = 0, len = exts.length; i < len; i++) obj[exts[i]] = -1 != supExts.indexOf(exts[i]) ? 1 : 0;
    if (tparams.control && 1 == tparams.control.isOpenPost) {
        var data = {
            server_id: modules.login.LoginModel.instance.selectedServer.server_id,
            role_id: role_id,
            isMiniGame: 1,
            layaInfo: encodeURIComponent(JSON.stringify(obj))
        };
        console.log("====userDeviceLayaInfo上报== POST =="), console.log(data), sendXHRPost(tparams.backapi + "userDeviceLayaInfo/run", data);
    } else {
        var str = utf8_to_b64("game/userDeviceLayaInfo/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign + "/" + modules.login.LoginModel.instance.selectedServer.server_id + "/" + role_id + "/1/" + encodeURIComponent(JSON.stringify(obj)));
        console.log("====userDeviceLayaInfo上报== GET =="), console.log(str), sendXHR(tparams.backstage + str);
    }
};

window.userDeviceLayaInfo = userDeviceLayaInfo;

var getSubscribeMessageTmplIds = function(callBack) {
    if (1 == tparams.control.funcOpen[1170] && window.AKSDK && AKSDK.subscribeMessage) {
        var str = utf8_to_b64("game/getSubscribeTmplIds/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign);
        sendXHR(tparams.backstage + str, null, function(rsData) {
            if (console.log("获取后台配置的模板ids"), console.log(rsData), rsData && 200 === rsData.code && rsData.tmplIds) {
                var tmplIds = rsData.tmplIds;
                callBack(tmplIds);
            } else ;
        });
    }
    callBack([]);
};

window.getSubscribeMessageTmplIds = getSubscribeMessageTmplIds;

var subscribeMessage = function(role_id, tmplIds) {
    if (console.log("前端调用-千禧小游戏-订阅接口"), 1 == tparams.control.funcOpen[1170] && window.AKSDK && AKSDK.subscribeMessage) return console.log(role_id), 
    console.log(tmplIds), console.log("千禧小游戏-订阅接口-调用sdk方法"), void AKSDK.subscribeMessage(tmplIds, function(res) {
        console.log("千禧小游戏-玩家订阅状态上报"), console.log(res);
        var str = utf8_to_b64("game/reportSubscribe/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign + "/" + role_id + "/" + encodeURIComponent(JSON.stringify(res)));
        console.log(str), sendXHR(tparams.backstage + str);
    });
};

window.subscribeMessage = subscribeMessage;

var clientError = function(error) {
    var serverId = "0", roleId = "0", modules = window.modules;
    if (modules && modules.login && modules.login.LoginModel.instance.selectedServer && (serverId = modules.login.LoginModel.instance.selectedServer.server_id || "0", 
    modules.player && modules.player.PlayerModel.instance.actorId && (roleId = modules.player.PlayerModel.instance.actorId)), 
    tparams.control && 1 == tparams.control.isOpenPost) {
        var data = {
            server_id: serverId,
            role_id: roleId,
            error: encodeURIComponent(error)
        };
        console.log("===客户端报错上报===POST=="), console.log(data), sendXHRPost(tparams.backapi + "clientErrorJson/run", data);
    } else {
        var str = utf8_to_b64("game/clientError/" + tparams.channel + "/" + tparams.package + "/" + tparams.account + "/" + tparams.sign + "/" + serverId + "/" + encodeURIComponent(error) + "/" + roleId);
        console.log("===客户端报错上报===GET=="), console.log(str), sendXHR(tparams.backstage + str);
    }
};

window.clientError = clientError;

var oneKeyAddGroupQrcode = function(server_id, role_id, callBack) {
    tparams.control.funcOpen[1171] && window.AKSDK && AKSDK.getGroupQrcode ? AKSDK.getGroupQrcode({
        server_id: server_id,
        role_id: role_id
    }, function(res) {
        res && res.qrcode && callBack(res.qrcode);
    }) : callBack(0);
};

window.oneKeyAddGroupQrcode = oneKeyAddGroupQrcode;

var sendPhoneCode = function(phone, callBack) {
    tparams.control.funcOpen[1172] && window.AKSDK && AKSDK.sendCode ? AKSDK.sendCode({
        phone: phone
    }, function(code, res) {
        callBack(code, res);
    }) : callBack(-999);
};

window.sendPhoneCode = sendPhoneCode;

var bindPhoneCode = function(phone, code, callBack) {
    tparams.control.funcOpen[1172] && window.AKSDK && AKSDK.bindPhone ? AKSDK.bindPhone({
        phone: phone,
        code: code
    }, function(code, res) {
        callBack(code, res);
    }) : callBack(-999);
};

window.bindPhoneCode = bindPhoneCode;

var navigateMgameCenter = function() {
    1 == tparams.control.funcOpen[1181] && window.AKSDK && AKSDK.toMiniGameC && (console.log("===调用小游戏中心==="), 
    AKSDK.toMiniGameC());
};

window.navigateMgameCenter = navigateMgameCenter;

var exitMiniProgram = function() {
    AKSDK && AKSDK.exitMiniProgram && AKSDK.exitMiniProgram();
};

window.exitMiniProgram = exitMiniProgram;

var zdQrcode = function(data, callBack) {
    tparams.control.funcOpen[1194] && window.AKSDK && AKSDK.zdQrcode ? AKSDK.zdQrcode(data, function(res) {
        res && res.qrcode && callBack(res.qrcode);
    }) : callBack(0);
};

window.zdQrcode = zdQrcode;

var showGameClub = function(data) {
    tparams.control.funcOpen[1196] && window.AKSDK && AKSDK.showGameClub && AKSDK.showGameClub(data);
};

window.showGameClub = showGameClub;

var navigateToBox = function() {
    tparams.control.funcOpen[1197] && window.AKSDK && AKSDK.NavigateToBox && AKSDK.NavigateToBox();
};

window.navigateToBox = navigateToBox;

var toMoreMiniGame = function(callBack) {
    1 == tparams.control.funcOpen[1201] && window.AKSDK && AKSDK.toMoreMiniGame && AKSDK.toMoreMiniGame(function(ret) {
        callBack(ret);
    });
};

window.toMoreMiniGame = toMoreMiniGame;

var transferSwitchNormal = function(data, callBack) {
    1 == tparams.control.funcOpen[1206] && window.AKSDK && AKSDK.transferSwitchNormal ? AKSDK.transferSwitchNormal(data, function(res) {
        res && res.code ? callBack(res.code) : callBack(0);
    }) : callBack(0);
};

window.transferSwitchNormal = transferSwitchNormal;

var init = function() {
    window.sdkInitVer && window.sdkInitVer(tparams.game_ver, _initCallBack);
};

window.init = init;

var _initCallBack = function(initCallBackInfo) {
    console.log("[AKSDK]---------initCallBack-------"), console.log(initCallBackInfo), 
    tparams.isCloseRecharge = !1, tparams.develop = initCallBackInfo.develop, tparams.can_pay = initCallBackInfo.can_pay, 
    tparams.game_ver = initCallBackInfo.game_ver;
    var initStr = utf8_to_b64("game/miniLogin/" + (1 == tparams.develop ? tparams.test_pkg : tparams.game_pkg) + "/0/" + initCallBackInfo.game_ver + "/" + tparams.develop + "/" + tparams.can_pay);
    sendXHR(tparams.backstage + initStr, null, function(info) {
        if (200 === info.code) {
            var initData = info.data;
            tparams.select_server_cdn = initData.select_server_cdn, tparams.channel = initData.channel, 
            tparams.package = initData.package, tparams.backstage = initData.backstage, tparams.backapi = initData.backapi, 
            tparams.is_unified = initData.is_unified, tparams.sdk_name = "txsdk" == tparams.sdk_name ? tparams.sdk_name : initData.sdk_name, 
            tparams.os = initData.os, tparams.control = initData.control, tparams.control.isSwitchSdk = "txsdk" == tparams.sdk_name ? 1 : 0, 
            tparams.isNoCreate = initData.isNoCreate, tparams.autoLogin = initData.autoLogin, 
            tparams.payCdn = initData.pay_cdn, tparams.payJs = initData.pay_js, tparams.payCss = initData.pay_css, 
            tparams.payQrjs = initData.pay_qrjs, tparams.ip = initData.ip, tparams.mac = isIos() ? 1 : 2, 
            1 == tparams.develop ? window.isIos() ? window.setCloseRecharge(window.tparams.control && 0 == tparams.control.developIosCharge) : window.setCloseRecharge(window.tparams.control && 1 == tparams.control.developScreenCharge) : window.isIos() && window.setCloseRecharge(window.tparams.control && 1 == tparams.control.miniGameScreenIosCharge), 
            1 != tparams.develop && window.tparams.control && 1 == tparams.control.miniGameDynamicChargeInit && null != initCallBackInfo.show_pay && (2 == initCallBackInfo.show_pay ? window.isIos() ? window.setCloseRecharge(1) : window.setCloseRecharge(0) : window.setCloseRecharge(1 == initCallBackInfo.show_pay ? 0 : 1)), 
            window.sdkInitedHandler();
        } else alert(info.msg);
    });
}, sdkInitedHandler = function() {
    tparams.is_unified && AKSDK.login(_loginCallBack);
};

window.sdkInitedHandler = sdkInitedHandler;

var checkToken = function() {
    if (window.sdkLoginData && window.subpackLoaded) {
        1 == tparams.control.miniQQAddFriend && qq && qq.authorize({
            scope: "setting.addFriend",
            success: function() {
                console.log("add friend auth success");
            },
            fail: function() {
                console.log("add friend auth fail");
            }
        });
        var status_1 = window.sdkLoginData[0], data = window.sdkLoginData[1];
        if (window.sdkLoginData.length = 0, window.sdkLoginData = null, 0 === status_1) if (1 == tparams.control.isSwitchSdk) {
            var str = tparams.sdk_name + "Check/run/" + tparams.package + "/" + data.channel_id + "/" + data.game_id + "/" + data.package_id + "/" + data.user_token + "/" + tparams.os + "/" + tparams.develop;
            sendXHR(tparams.backstage + str, null, checkTokenCallBack, "json", function() {
                alert("登录验证失败");
            });
        } else {
            str = utf8_to_b64(tparams.sdk_name + "Check/run/" + data.account + "/" + data.userid + "/" + data.token + "/" + tparams.package + "/" + tparams.mac);
            sendXHR(tparams.backstage + str, null, checkTokenCallBack);
        } else alert("登录/注册失败");
    }
};

window.checkToken = checkToken;

var _loginCallBack = function(status, data) {
    0 === status && ((tparams.is_pre_game = 0) == tparams.control.isSwitchSdk && (tparams.control.dl_jump = data.jump, 
    tparams.control.dl_jump_content = data.jump_content, tparams.isBindPhone = data.isBindPhone ? data.isBindPhone : 0, 
    tparams.game_status = data.game_status ? data.game_status : 0, tparams.isKoiFishOpen = 0, 
    1 == tparams.control.funcOpen[1186] && (tparams.isKoiFishOpen = data.zsyIsVIP ? data.zsyIsVIP : 0), 
    void 0 !== data.is_pre_game && (2 == data.is_pre_game ? tparams.is_pre_game = 2 : tparams.is_pre_game = 1), 
    tparams.checkShowMiniGame = data.showMinGame ? data.showMinGame : 0, data.notice_status ? 0 == tparams.control.funcOpen[1211] ? tparams.control.siJInMiniClientNoticeImgUrl = "" : tparams.control.siJInMiniClientNoticeImgUrl = data.notice_image_url ? data.notice_image_url : "" : (tparams.control.funcOpen[1211] = 0, 
    tparams.control.siJInMiniClientSign = "", tparams.control.siJInMiniClientNoticeImgUrl = ""), 
    AKSDK.isTurnWd && AKSDK.isTurnWd(function(res) {
        1 == res.wd_ctl_obj && (!0 === res.turn ? (tparams.control.funcOpen[1107] = 1, tparams.control.turn_prompt = 1) : (tparams.control.funcOpen[1107] = 0, 
        tparams.control.turn_prompt = 0));
    })), AKSDK.turnminiC && AKSDK.turnminiC(function(res) {
        console.log(res), void 0 !== res.jump_to && 1 == res.jump_to && (tparams.is_pre_game = 2);
    })), window.sdkLoginData = [ status, data ], window.checkToken();
}, checkTokenCallBack = function(value) {
    if (value) if (1 === value.state) {
        var data = value.data;
        if (data.s) {
            var server = data.s;
            tparams.channel = data.channel, tparams.group_id = data.group_id, tparams.is_no_create = data.is_no_create, 
            tparams.userId = data.user.openId, tparams.account = data.user.openId, tparams.uid = data.user.uid, 
            tparams.rvtype = data.rvtype, tparams.newregister = parseInt(data.newregister), 
            tparams.isNewregister = parseInt(data.newregister), tparams.package = parseInt(data.package), 
            tparams.sign = data.sign, tparams.notice = data.notice, tparams.configs = server.configs ? server.configs : "", 
            tparams.ipCreate = data.ipCreate, tparams.accountCreate = data.accountCreate, tparams.mac = isIos() ? 1 : 2, 
            tparams.otherGroup = data.other_group_rs, tparams.banStatus = data.ban_status ? data.ban_status : 0, 
            1 === tparams.control.isNewSelectServer && (tparams.newregister = 0), tparams.selectedServer = {
                server_id: server.server_id,
                name: server.name,
                server_num: parseInt(server.server_num),
                channel_num: parseInt(server.channel_num),
                server_addr: server.server_addr,
                server_port: parseInt(server.server_port),
                status: parseInt(server.status),
                tick: parseInt(server.tick),
                sign: server.sign,
                package: tparams.package,
                cdn: server.cdn,
                is_white: parseInt(server.is_white),
                ip_create: parseInt(server.ip_create),
                account_create: parseInt(server.account_create),
                configs: server.configs,
                open_day: server.open_day
            }, tparams.cdn = server.cdn, gotoSelectServer();
        } else alert("服务器维护中...");
    } else alert(value.msg);
}, gotoSelectServer = function() {
    wx && wxStartParamsReport(1, wx.getLaunchOptionsSync()), wx && wx.onShow(function(params) {
        wxStartParamsReport && wxStartParamsReport(2, params);
    }), selectServerView && selectServerView.open();
}, _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
    return typeof obj;
} : function(obj) {
    return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
}, _createClass = function() {
    function defineProperties(target, props) {
        for (var i = 0; i < props.length; i++) {
            var descriptor = props[i];
            descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
            "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
        }
    }
    return function(Constructor, protoProps, staticProps) {
        return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
        Constructor;
    };
}();

function _classCallCheck(instance, Constructor) {
    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
}

!function() {
    var __webpack_modules__ = {
        883: function() {
            "use strict";
            var mlh5, SilangMgame = function() {
                function SilangMgame() {
                    _classCallCheck(this, SilangMgame), mlh5 = window.channelSdk;
                }
                return _createClass(SilangMgame, [ {
                    key: "init",
                    value: function(input, _callback) {
                        console.log("=======渠道初始化==init=====" + JSON.stringify(input.params_config)), mlh5.init({
                            appId: input.params_config.GameId,
                            channelId: input.params_config.ChannelId,
                            appKey: input.params_config.AppKey,
                            version: "1.0.0",
                            callback: function() {
                                console.log("[TXSDK]渠道初始化成功"), _callback && _callback();
                            }
                        });
                    }
                }, {
                    key: "login",
                    value: function(input, _callback2) {
                        console.log("=======渠道用户登录==login=====" + JSON.stringify(input)), mlh5.login({
                            callback: function(res) {
                                console.log("[TXSDK]渠道登录成功：" + JSON.stringify(res));
                                var loginInfo = {
                                    userToken: res.userToken,
                                    access_token: res.accessToken
                                };
                                _callback2 && _callback2(loginInfo);
                            }
                        });
                    }
                }, {
                    key: "logout",
                    value: function(input) {
                        console.log("=======渠道退出登录==logout=====");
                    }
                }, {
                    key: "pay",
                    value: function(input, callback) {
                        console.log("=======渠道创建订单==pay====="), mlh5.pay({
                            amount: 100 * input.product_price,
                            currency: "CNY",
                            productId: input.product_id,
                            productName: input.product_name,
                            productDesc: input.product_desc,
                            roleId: input.role_id,
                            roleName: input.role_name,
                            roleLevel: input.role_level,
                            serverId: input.server_id,
                            serverName: input.server_name,
                            orderExt: input.order_id,
                            callback: function(res) {}
                        }), callback && callback();
                    }
                }, {
                    key: "reportRole",
                    value: function(input, callback) {
                        console.log("=======渠道上报角色==reportRole=====" + JSON.stringify(input));
                        var eventType = input.report_type;
                        switch (eventType) {
                          case 1:
                            eventType = 2;
                            break;

                          case 2:
                            eventType = 1;
                            break;

                          case 3:
                            eventType = 3;
                        }
                        1 != eventType && 3 != eventType || mlh5.pswitch({
                            roleId: input.role_id,
                            roleName: input.role_name,
                            roleLevel: input.role_level,
                            serverId: input.server_id,
                            serverName: input.server_name,
                            roleVip: input.role_vip_level,
                            rolePower: input.role_power,
                            callback: function(res) {
                                console.log("[TXSDK]渠道屏蔽支付成功：" + JSON.stringify(res));
                            }
                        });
                        var reportData = {
                            roleId: input.role_id,
                            roleName: input.role_name,
                            roleLevel: input.role_level,
                            serverId: input.server_id,
                            serverName: input.server_name,
                            roleVip: input.role_vip_level,
                            rolePower: input.role_power,
                            eventType: eventType
                        };
                        mlh5.gameReport(reportData), console.log("[TXSDK]渠道上报数据成功：" + JSON.stringify(reportData)), 
                        callback && callback();
                    }
                }, {
                    key: "reportComLoad",
                    value: function(input, callback) {
                        console.log("[TXSDK]上报渠道行为" + input), callback && callback();
                    }
                }, {
                    key: "msgCheck",
                    value: function(input, _callback3) {
                        console.log("=======校验敏感词==msgCheck=====" + JSON.stringify(input)), mlh5.msgSecCheck({
                            content: input,
                            scene: 2,
                            callback: function(checkRs) {
                                (checkRs = checkRs || {}).statusCode = 200, checkRs.data = {}, checkRs.data.state = 1, 
                                _callback3 && _callback3(checkRs);
                            }
                        });
                    }
                }, {
                    key: "convertClient",
                    value: function(input, callback) {
                        console.log("[TXSDK]拉起转端" + input), callback && callback();
                    }
                }, {
                    key: "callSubscribeMsg",
                    value: function(input, callback) {
                        console.log("[TXSDK]订阅消息" + JSON.stringify(input)), wx.requestSubscribeMessage({
                            tmplIds: input.template_ids,
                            success: function(res) {
                                console.log(res);
                            },
                            fail: function(res) {
                                console.log(res);
                            },
                            complete: function(res) {
                                mlh5.templateMsgComplete(res), callback && callback();
                            }
                        });
                    }
                }, {
                    key: "inspireVideo",
                    value: function(data, _callback4) {
                        console.log("[TXSDK]激励视频" + JSON.stringify(data)), mlh5.getRewarderdVideo({
                            adUnitId: data.ad_id,
                            callback: function(e) {
                                e.is_close_finish ? _callback4 && _callback4(0) : _callback4 && _callback4(404);
                            }
                        });
                    }
                }, {
                    key: "toMiniGameC",
                    value: function(data, callback) {
                        console.log("[TXSDK]渠道小游戏中心"), mlh5.toMiniGameC && mlh5.toMiniGameC(), callback && callback();
                    }
                }, {
                    key: "sendUrl",
                    value: function(data, callback) {
                        console.log("[TXSDK]渠道跳转地址"), mlh5.toMiniD && mlh5.toMiniD(), callback && callback();
                    }
                } ]), SilangMgame;
            }();
            window.TXchannel = new SilangMgame();
        },
        231: function _(module, exports, __webpack_require__) {
            var __WEBPACK_AMD_DEFINE_RESULT__;
            !function() {
                "use strict";
                function t(t) {
                    if (t) d[0] = d[16] = d[1] = d[2] = d[3] = d[4] = d[5] = d[6] = d[7] = d[8] = d[9] = d[10] = d[11] = d[12] = d[13] = d[14] = d[15] = 0, 
                    this.blocks = d, this.buffer8 = l; else if (a) {
                        var r = new ArrayBuffer(68);
                        this.buffer8 = new Uint8Array(r), this.blocks = new Uint32Array(r);
                    } else this.blocks = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ];
                    this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0, 
                    this.finalized = this.hashed = !1, this.first = !0;
                }
                var r = "input is invalid type", e = "object" == ("undefined" == typeof window ? "undefined" : _typeof(window)), i = e ? window : {};
                i.JS_MD5_NO_WINDOW && (e = !1);
                var s = !e && "object" == ("undefined" == typeof self ? "undefined" : _typeof(self)), h = !i.JS_MD5_NO_NODE_JS && "object" == ("undefined" == typeof process ? "undefined" : _typeof(process)) && process.versions && process.versions.node;
                h ? i = __webpack_require__.g : s && (i = self);
                var f = !i.JS_MD5_NO_COMMON_JS && gmodule.exports, o = __webpack_require__.amdO, a = !i.JS_MD5_NO_ARRAY_BUFFER && "undefined" != typeof ArrayBuffer, n = "0123456789abcdef".split(""), u = [ 128, 32768, 8388608, -2147483648 ], y = [ 0, 8, 16, 24 ], c = [ "hex", "array", "digest", "buffer", "arrayBuffer", "base64" ], p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), d = [], l;
                if (a) {
                    var A = new ArrayBuffer(68);
                    l = new Uint8Array(A), d = new Uint32Array(A);
                }
                !i.JS_MD5_NO_NODE_JS && Array.isArray || (Array.isArray = function(t) {
                    return "[object Array]" === Object.prototype.toString.call(t);
                }), !a || !i.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW && ArrayBuffer.isView || (ArrayBuffer.isView = function(t) {
                    return "object" == (void 0 === t ? "undefined" : _typeof(t)) && t.buffer && t.buffer.constructor === ArrayBuffer;
                });
                var b = function(r) {
                    return function(e) {
                        return new t(!0).update(e)[r]();
                    };
                }, v = function() {
                    var r = b("hex");
                    h && (r = w(r)), r.create = function() {
                        return new t();
                    }, r.update = function(t) {
                        return r.create().update(t);
                    };
                    for (var e = 0; e < c.length; ++e) {
                        var i = c[e];
                        r[i] = b(i);
                    }
                    return r;
                }, w = function w(t) {
                    var e = eval("arequire('crypto')"), i = eval("arequire('buffer').Buffer"), s = function(_s) {
                        if ("string" == typeof _s) return e.createHash("md5").update(_s, "utf8").digest("hex");
                        if (null == _s) throw r;
                        return _s.constructor === ArrayBuffer && (_s = new Uint8Array(_s)), Array.isArray(_s) || ArrayBuffer.isView(_s) || _s.constructor === i ? e.createHash("md5").update(new i(_s)).digest("hex") : t(_s);
                    };
                    return s;
                };
                t.prototype.update = function(t) {
                    if (!this.finalized) {
                        var e, i = void 0 === t ? "undefined" : _typeof(t);
                        if ("string" !== i) {
                            if ("object" !== i) throw r;
                            if (null === t) throw r;
                            if (a && t.constructor === ArrayBuffer) t = new Uint8Array(t); else if (!(Array.isArray(t) || a && ArrayBuffer.isView(t))) throw r;
                            e = !0;
                        }
                        for (var s, h, f = 0, o = t.length, n = this.blocks, u = this.buffer8; f < o; ) {
                            if (this.hashed && (this.hashed = !1, n[0] = n[16], n[16] = n[1] = n[2] = n[3] = n[4] = n[5] = n[6] = n[7] = n[8] = n[9] = n[10] = n[11] = n[12] = n[13] = n[14] = n[15] = 0), 
                            e) if (a) for (h = this.start; f < o && h < 64; ++f) u[h++] = t[f]; else for (h = this.start; f < o && h < 64; ++f) n[h >> 2] |= t[f] << y[3 & h++]; else if (a) for (h = this.start; f < o && h < 64; ++f) (s = t.charCodeAt(f)) < 128 ? u[h++] = s : (s < 2048 ? u[h++] = 192 | s >> 6 : (s < 55296 || 57344 <= s ? u[h++] = 224 | s >> 12 : (s = 65536 + ((1023 & s) << 10 | 1023 & t.charCodeAt(++f)), 
                            u[h++] = 240 | s >> 18, u[h++] = 128 | s >> 12 & 63), u[h++] = 128 | s >> 6 & 63), 
                            u[h++] = 128 | 63 & s); else for (h = this.start; f < o && h < 64; ++f) (s = t.charCodeAt(f)) < 128 ? n[h >> 2] |= s << y[3 & h++] : (s < 2048 ? n[h >> 2] |= (192 | s >> 6) << y[3 & h++] : (s < 55296 || 57344 <= s ? n[h >> 2] |= (224 | s >> 12) << y[3 & h++] : (s = 65536 + ((1023 & s) << 10 | 1023 & t.charCodeAt(++f)), 
                            n[h >> 2] |= (240 | s >> 18) << y[3 & h++], n[h >> 2] |= (128 | s >> 12 & 63) << y[3 & h++]), 
                            n[h >> 2] |= (128 | s >> 6 & 63) << y[3 & h++]), n[h >> 2] |= (128 | 63 & s) << y[3 & h++]);
                            this.lastByteIndex = h, this.bytes += h - this.start, 64 <= h ? (this.start = h - 64, 
                            this.hash(), this.hashed = !0) : this.start = h;
                        }
                        return 4294967295 < this.bytes && (this.hBytes += this.bytes / 4294967296 << 0, 
                        this.bytes = this.bytes % 4294967296), this;
                    }
                }, t.prototype.finalize = function() {
                    if (!this.finalized) {
                        this.finalized = !0;
                        var t = this.blocks, r = this.lastByteIndex;
                        t[r >> 2] |= u[3 & r], 56 <= r && (this.hashed || this.hash(), t[0] = t[16], t[16] = t[1] = t[2] = t[3] = t[4] = t[5] = t[6] = t[7] = t[8] = t[9] = t[10] = t[11] = t[12] = t[13] = t[14] = t[15] = 0), 
                        t[14] = this.bytes << 3, t[15] = this.hBytes << 3 | this.bytes >>> 29, this.hash();
                    }
                }, t.prototype.hash = function() {
                    var t, r, e, i, s, h, f = this.blocks;
                    r = this.first ? ((r = ((t = ((t = f[0] - 680876937) << 7 | t >>> 25) - 271733879 << 0) ^ (e = ((e = (-271733879 ^ (i = ((i = (-1732584194 ^ 2004318071 & t) + f[1] - 117830708) << 12 | i >>> 20) + t << 0) & (-271733879 ^ t)) + f[2] - 1126478375) << 17 | e >>> 15) + i << 0) & (i ^ t)) + f[3] - 1316259209) << 22 | r >>> 10) + e << 0 : (t = this.h0, 
                    r = this.h1, e = this.h2, ((r += ((t = ((t += ((i = this.h3) ^ r & (e ^ i)) + f[0] - 680876936) << 7 | t >>> 25) + r << 0) ^ (e = ((e += (r ^ (i = ((i += (e ^ t & (r ^ e)) + f[1] - 389564586) << 12 | i >>> 20) + t << 0) & (t ^ r)) + f[2] + 606105819) << 17 | e >>> 15) + i << 0) & (i ^ t)) + f[3] - 1044525330) << 22 | r >>> 10) + e << 0), 
                    r = ((r += ((t = ((t += (i ^ r & (e ^ i)) + f[4] - 176418897) << 7 | t >>> 25) + r << 0) ^ (e = ((e += (r ^ (i = ((i += (e ^ t & (r ^ e)) + f[5] + 1200080426) << 12 | i >>> 20) + t << 0) & (t ^ r)) + f[6] - 1473231341) << 17 | e >>> 15) + i << 0) & (i ^ t)) + f[7] - 45705983) << 22 | r >>> 10) + e << 0, 
                    r = ((r += ((t = ((t += (i ^ r & (e ^ i)) + f[8] + 1770035416) << 7 | t >>> 25) + r << 0) ^ (e = ((e += (r ^ (i = ((i += (e ^ t & (r ^ e)) + f[9] - 1958414417) << 12 | i >>> 20) + t << 0) & (t ^ r)) + f[10] - 42063) << 17 | e >>> 15) + i << 0) & (i ^ t)) + f[11] - 1990404162) << 22 | r >>> 10) + e << 0, 
                    r = ((r += ((t = ((t += (i ^ r & (e ^ i)) + f[12] + 1804603682) << 7 | t >>> 25) + r << 0) ^ (e = ((e += (r ^ (i = ((i += (e ^ t & (r ^ e)) + f[13] - 40341101) << 12 | i >>> 20) + t << 0) & (t ^ r)) + f[14] - 1502002290) << 17 | e >>> 15) + i << 0) & (i ^ t)) + f[15] + 1236535329) << 22 | r >>> 10) + e << 0, 
                    r = ((r += ((i = ((i += (r ^ e & ((t = ((t += (e ^ i & (r ^ e)) + f[1] - 165796510) << 5 | t >>> 27) + r << 0) ^ r)) + f[6] - 1069501632) << 9 | i >>> 23) + t << 0) ^ t & ((e = ((e += (t ^ r & (i ^ t)) + f[11] + 643717713) << 14 | e >>> 18) + i << 0) ^ i)) + f[0] - 373897302) << 20 | r >>> 12) + e << 0, 
                    r = ((r += ((i = ((i += (r ^ e & ((t = ((t += (e ^ i & (r ^ e)) + f[5] - 701558691) << 5 | t >>> 27) + r << 0) ^ r)) + f[10] + 38016083) << 9 | i >>> 23) + t << 0) ^ t & ((e = ((e += (t ^ r & (i ^ t)) + f[15] - 660478335) << 14 | e >>> 18) + i << 0) ^ i)) + f[4] - 405537848) << 20 | r >>> 12) + e << 0, 
                    r = ((r += ((i = ((i += (r ^ e & ((t = ((t += (e ^ i & (r ^ e)) + f[9] + 568446438) << 5 | t >>> 27) + r << 0) ^ r)) + f[14] - 1019803690) << 9 | i >>> 23) + t << 0) ^ t & ((e = ((e += (t ^ r & (i ^ t)) + f[3] - 187363961) << 14 | e >>> 18) + i << 0) ^ i)) + f[8] + 1163531501) << 20 | r >>> 12) + e << 0, 
                    r = ((r += ((i = ((i += (r ^ e & ((t = ((t += (e ^ i & (r ^ e)) + f[13] - 1444681467) << 5 | t >>> 27) + r << 0) ^ r)) + f[2] - 51403784) << 9 | i >>> 23) + t << 0) ^ t & ((e = ((e += (t ^ r & (i ^ t)) + f[7] + 1735328473) << 14 | e >>> 18) + i << 0) ^ i)) + f[12] - 1926607734) << 20 | r >>> 12) + e << 0, 
                    r = ((r += ((h = (i = ((i += ((s = r ^ e) ^ (t = ((t += (s ^ i) + f[5] - 378558) << 4 | t >>> 28) + r << 0)) + f[8] - 2022574463) << 11 | i >>> 21) + t << 0) ^ t) ^ (e = ((e += (h ^ r) + f[11] + 1839030562) << 16 | e >>> 16) + i << 0)) + f[14] - 35309556) << 23 | r >>> 9) + e << 0, 
                    r = ((r += ((h = (i = ((i += ((s = r ^ e) ^ (t = ((t += (s ^ i) + f[1] - 1530992060) << 4 | t >>> 28) + r << 0)) + f[4] + 1272893353) << 11 | i >>> 21) + t << 0) ^ t) ^ (e = ((e += (h ^ r) + f[7] - 155497632) << 16 | e >>> 16) + i << 0)) + f[10] - 1094730640) << 23 | r >>> 9) + e << 0, 
                    r = ((r += ((h = (i = ((i += ((s = r ^ e) ^ (t = ((t += (s ^ i) + f[13] + 681279174) << 4 | t >>> 28) + r << 0)) + f[0] - 358537222) << 11 | i >>> 21) + t << 0) ^ t) ^ (e = ((e += (h ^ r) + f[3] - 722521979) << 16 | e >>> 16) + i << 0)) + f[6] + 76029189) << 23 | r >>> 9) + e << 0, 
                    r = ((r += ((h = (i = ((i += ((s = r ^ e) ^ (t = ((t += (s ^ i) + f[9] - 640364487) << 4 | t >>> 28) + r << 0)) + f[12] - 421815835) << 11 | i >>> 21) + t << 0) ^ t) ^ (e = ((e += (h ^ r) + f[15] + 530742520) << 16 | e >>> 16) + i << 0)) + f[2] - 995338651) << 23 | r >>> 9) + e << 0, 
                    r = ((r += ((i = ((i += (r ^ ((t = ((t += (e ^ (r | ~i)) + f[0] - 198630844) << 6 | t >>> 26) + r << 0) | ~e)) + f[7] + 1126891415) << 10 | i >>> 22) + t << 0) ^ ((e = ((e += (t ^ (i | ~r)) + f[14] - 1416354905) << 15 | e >>> 17) + i << 0) | ~t)) + f[5] - 57434055) << 21 | r >>> 11) + e << 0, 
                    r = ((r += ((i = ((i += (r ^ ((t = ((t += (e ^ (r | ~i)) + f[12] + 1700485571) << 6 | t >>> 26) + r << 0) | ~e)) + f[3] - 1894986606) << 10 | i >>> 22) + t << 0) ^ ((e = ((e += (t ^ (i | ~r)) + f[10] - 1051523) << 15 | e >>> 17) + i << 0) | ~t)) + f[1] - 2054922799) << 21 | r >>> 11) + e << 0, 
                    r = ((r += ((i = ((i += (r ^ ((t = ((t += (e ^ (r | ~i)) + f[8] + 1873313359) << 6 | t >>> 26) + r << 0) | ~e)) + f[15] - 30611744) << 10 | i >>> 22) + t << 0) ^ ((e = ((e += (t ^ (i | ~r)) + f[6] - 1560198380) << 15 | e >>> 17) + i << 0) | ~t)) + f[13] + 1309151649) << 21 | r >>> 11) + e << 0, 
                    r = ((r += ((i = ((i += (r ^ ((t = ((t += (e ^ (r | ~i)) + f[4] - 145523070) << 6 | t >>> 26) + r << 0) | ~e)) + f[11] - 1120210379) << 10 | i >>> 22) + t << 0) ^ ((e = ((e += (t ^ (i | ~r)) + f[2] + 718787259) << 15 | e >>> 17) + i << 0) | ~t)) + f[9] - 343485551) << 21 | r >>> 11) + e << 0, 
                    this.first ? (this.h0 = t + 1732584193 << 0, this.h1 = r - 271733879 << 0, this.h2 = e - 1732584194 << 0, 
                    this.h3 = i + 271733878 << 0, this.first = !1) : (this.h0 = this.h0 + t << 0, this.h1 = this.h1 + r << 0, 
                    this.h2 = this.h2 + e << 0, this.h3 = this.h3 + i << 0);
                }, t.prototype.hex = function() {
                    this.finalize();
                    var t = this.h0, r = this.h1, e = this.h2, i = this.h3;
                    return n[t >> 4 & 15] + n[15 & t] + n[t >> 12 & 15] + n[t >> 8 & 15] + n[t >> 20 & 15] + n[t >> 16 & 15] + n[t >> 28 & 15] + n[t >> 24 & 15] + n[r >> 4 & 15] + n[15 & r] + n[r >> 12 & 15] + n[r >> 8 & 15] + n[r >> 20 & 15] + n[r >> 16 & 15] + n[r >> 28 & 15] + n[r >> 24 & 15] + n[e >> 4 & 15] + n[15 & e] + n[e >> 12 & 15] + n[e >> 8 & 15] + n[e >> 20 & 15] + n[e >> 16 & 15] + n[e >> 28 & 15] + n[e >> 24 & 15] + n[i >> 4 & 15] + n[15 & i] + n[i >> 12 & 15] + n[i >> 8 & 15] + n[i >> 20 & 15] + n[i >> 16 & 15] + n[i >> 28 & 15] + n[i >> 24 & 15];
                }, t.prototype.toString = t.prototype.hex, t.prototype.digest = function() {
                    this.finalize();
                    var t = this.h0, r = this.h1, e = this.h2, i = this.h3;
                    return [ 255 & t, t >> 8 & 255, t >> 16 & 255, t >> 24 & 255, 255 & r, r >> 8 & 255, r >> 16 & 255, r >> 24 & 255, 255 & e, e >> 8 & 255, e >> 16 & 255, e >> 24 & 255, 255 & i, i >> 8 & 255, i >> 16 & 255, i >> 24 & 255 ];
                }, t.prototype.array = t.prototype.digest, t.prototype.arrayBuffer = function() {
                    this.finalize();
                    var t = new ArrayBuffer(16), r = new Uint32Array(t);
                    return r[0] = this.h0, r[1] = this.h1, r[2] = this.h2, r[3] = this.h3, t;
                }, t.prototype.buffer = t.prototype.arrayBuffer, t.prototype.base64 = function() {
                    for (var t, r, e, i = "", s = this.array(), h = 0; h < 15; ) t = s[h++], r = s[h++], 
                    e = s[h++], i += p[t >>> 2] + p[63 & (t << 4 | r >>> 4)] + p[63 & (r << 2 | e >>> 6)] + p[63 & e];
                    return t = s[h], i + (p[t >>> 2] + p[t << 4 & 63] + "==");
                };
                var _ = v();
                f ? gmodule.exports = _ : (i.md5 = _, o && (__WEBPACK_AMD_DEFINE_RESULT__ = function() {
                    return _;
                }.call(exports, __webpack_require__, exports, module), void 0 === __WEBPACK_AMD_DEFINE_RESULT__ || (gmodule.exports = __WEBPACK_AMD_DEFINE_RESULT__)));
            }();
        }
    }, __webpack_module_cache__ = {};
    function __webpack_require__(moduleId) {
        var cachedModule = __webpack_module_cache__[moduleId];
        if (void 0 !== cachedModule) return cachedgmodule.exports;
        var module = __webpack_module_cache__[moduleId] = {
            exports: {}
        };
        return __webpack_modules__[moduleId](module, gmodule.exports, __webpack_require__), 
        gmodule.exports;
    }
    __webpack_require__.amdO = {}, __webpack_require__.n = function(module) {
        var getter = module && module.__esModule ? function() {
            return module.default;
        } : function() {
            return module;
        };
        return __webpack_require__.d(getter, {
            a: getter
        }), getter;
    }, __webpack_require__.d = function(exports, definition) {
        for (var key in definition) __webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key) && Object.defineProperty(exports, key, {
            enumerable: !0,
            get: definition[key]
        });
    }, __webpack_require__.g = function() {
        if ("object" === ("undefined" == typeof globalThis ? "undefined" : _typeof(globalThis))) return globalThis;
        try {
            return this || new Function("return this")();
        } catch (e) {
            e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
            if ("object" === ("undefined" == typeof window ? "undefined" : _typeof(window))) return window;
        }
    }(), __webpack_require__.o = function(obj, prop) {
        return Object.prototype.hasOwnProperty.call(obj, prop);
    };
    var __webpack_exports__ = {};
    !function() {
        "use strict";
        __webpack_require__(883);
        window.channelSdk = arequire("../mlh5/mlh5"), window.ugameConfig = {
            yxgi: window.TX_YXGI
        };
        var sdkData, userGameInfo, shareUserInfo, onMenuShareCallBack, md5 = __webpack_require__(231), md5_default = __webpack_require__.n(md5), sdkHost = "https://uapi.pipalila.cn/", UNION_SDK = {
            init: function(data, callback) {
                var self = this;
                sdkData = {
                    yxgi: window.ugameConfig.yxgi,
                    package_id: 0,
                    channel_id: 0,
                    game_id: 0,
                    device_id: self.getDeviceId(),
                    client: "",
                    user_token: "",
                    channel_uid: ""
                };
                var systemInfo = wx.getSystemInfoSync();
                sdkData.client = systemInfo.platform;
                var reqInit = {
                    yxgi: sdkData.yxgi,
                    device_id: sdkData.device_id,
                    client: sdkData.client,
                    game_ver: data && data.game_ver ? data.game_ver : 0,
                    device_brand: systemInfo.brand,
                    device_model: systemInfo.model,
                    net_type: 1 == systemInfo.wifiEnabled ? "WIFI" : "4G",
                    os_ver: systemInfo.system,
                    sdk_ver: systemInfo.version
                };
                console.log("[TXSDK]开始初始化"), self.sendXHR(sdkHost + "mgame/init", reqInit, function(resInit) {
                    self.accessToken = resInit.access_token ? resInit.access_token : "", self.accessLock = resInit.access_lock ? resInit.access_lock : "", 
                    sdkData.package_id = resInit.package_id, sdkData.channel_id = resInit.channel_id, 
                    sdkData.game_id = resInit.game_id, window.TXchannel.init && window.TXchannel.init(resInit, function() {
                        callback(resInit.mgame_config);
                    });
                });
            },
            login: function(data, callback) {
                var self = this;
                console.log("[TXSDK]渠道开始登录"), window.TXchannel.login && window.TXchannel.login({}, function(channelRes) {
                    self.ajaxLogin(channelRes, callback);
                });
            },
            ajaxLogin: function(loginRs, callback) {
                var self = this, reqLogin = {
                    channel_id: sdkData.channel_id,
                    game_id: sdkData.game_id,
                    package_id: sdkData.package_id,
                    device_id: sdkData.device_id,
                    client: sdkData.client,
                    channel_data: JSON.stringify(loginRs)
                };
                self.sendXHR(sdkHost + "user/login", reqLogin, function(resLogin) {
                    sdkData.channel_uid = resLogin.channel_uid, sdkData.user_token = resLogin.user_token;
                    var coldStart = wx.getLaunchOptionsSync(), reqCold = {
                        channel_id: sdkData.channel_id,
                        game_id: sdkData.game_id,
                        package_id: sdkData.package_id,
                        device_id: sdkData.device_id,
                        client: sdkData.client,
                        user_token: sdkData.user_token,
                        start_params: JSON.stringify(coldStart),
                        start_type: 1
                    };
                    self.sendXHR(sdkHost + "mgame/active", reqCold, function(resCold) {});
                    var share_uuid = coldStart.query && coldStart.query.share_uuid ? coldStart.query.share_uuid : "", share_time = coldStart.query && coldStart.query.share_time ? coldStart.query.share_time : "";
                    if (share_uuid) {
                        var scene = coldStart.scene ? coldStart.scene : 0, chatType = coldStart.query.chatType ? coldStart.query.chatType : 0;
                        shareUserInfo = {
                            channel_id: sdkData.channel_id,
                            game_id: sdkData.game_id,
                            package_id: sdkData.package_id,
                            device_id: sdkData.device_id,
                            client: sdkData.client,
                            share_uuid: share_uuid,
                            share_time: share_time,
                            scene: scene,
                            chat_type: chatType,
                            is_new_user: 1 == resLogin.login_type ? 1 : 0
                        };
                    }
                    onMenuShareCallBack = !1;
                    var userData = {
                        user_token: resLogin.user_token,
                        channel_id: resLogin.channel_id,
                        game_id: resLogin.game_id,
                        package_id: resLogin.package_id
                    };
                    callback && callback(0, userData);
                });
            },
            reportRole: function(data, callback) {
                2 == data.report_type && (userGameInfo = {
                    user_id: data.user_id,
                    server_id: data.server_id,
                    server_name: data.server_name,
                    role_id: data.role_id,
                    role_name: data.role_name
                }, this.onMenuShare(), shareUserInfo && (shareUserInfo.user_id = data.user_id, shareUserInfo.user_token = sdkData.user_token, 
                shareUserInfo.server_id = data.server_id, shareUserInfo.role_id = data.role_id, 
                this.updateShare(shareUserInfo)), this.subscribeMsg());
                var reqRole = {
                    client: sdkData.client,
                    channel_id: sdkData.channel_id,
                    game_id: sdkData.game_id,
                    package_id: sdkData.package_id,
                    device_id: sdkData.device_id,
                    user_token: sdkData.user_token,
                    user_id: data.user_id,
                    report_type: data.report_type,
                    role_id: data.role_id,
                    role_name: data.role_name,
                    server_id: data.server_id,
                    server_name: data.server_name,
                    role_level: data.role_level,
                    role_vip_level: data.role_vip_level ? data.role_vip_level : 0,
                    role_power: data.role_power ? data.role_power : 0,
                    role_create_time: data.role_create_time ? data.role_create_time : 0,
                    role_revival: data.role_revival ? data.role_revival : 0,
                    role_ingots: data.role_ingots ? data.role_ingots : 0,
                    role_party_name: data.role_party_name ? data.role_party_name : ""
                };
                if (window.TXchannel.reportRole && window.TXchannel.reportRole(reqRole, function() {}), 
                3 == data.report_type && data.role_level < 50) return console.log("[TXSDK]过滤角色上报"), 
                void (callback && callback(0));
                this.sendXHR(sdkHost + "role/create", reqRole, function(resRole) {
                    callback && callback(0);
                });
            },
            pay: function(data, callback) {
                sdkData.user_token && data.user_id || callback && callback(1, {
                    errMsg: "用户未登录，支付失败！"
                });
                var reqOrder = {
                    client: sdkData.client,
                    channel_id: sdkData.channel_id,
                    game_id: sdkData.game_id,
                    package_id: sdkData.package_id,
                    device_id: sdkData.device_id,
                    user_token: sdkData.user_token,
                    user_id: data.user_id,
                    cp_order_id: data.cp_order_id,
                    product_id: data.product_id,
                    product_name: data.product_name,
                    product_price: data.product_price,
                    product_desc: data.product_desc,
                    role_id: data.role_id,
                    role_name: data.role_name,
                    role_level: data.role_level,
                    server_id: data.server_id,
                    server_name: data.server_name,
                    channel_data: JSON.stringify({
                        channel_uid: sdkData.channel_uid
                    }),
                    ext: data.ext,
                    is_test: data.is_test ? data.is_test : 0,
                    order_id: "",
                    create_time: 0
                };
                this.sendXHR(sdkHost + "order/create", reqOrder, function(resOrder) {
                    reqOrder.order_id = resOrder.order_id, reqOrder.create_time = resOrder.create_time, 
                    window.TXchannel.pay && window.TXchannel.pay(reqOrder, function() {
                        callback && callback(0, {
                            order_id: resOrder.order_id
                        });
                    });
                });
            },
            msgCheck: function(contentMsg, callback) {
                window.TXchannel.msgCheck && window.TXchannel.msgCheck(contentMsg, function(channelRes) {
                    callback && callback(0, channelRes);
                });
            },
            reportComLoad: function(errMsg, callback) {
                window.TXchannel.reportComLoad && window.TXchannel.reportComLoad(errMsg, function() {
                    callback && callback(0);
                });
            },
            gameProgress: function(data, callback) {
                if (sdkData.user_token && data.user_id || callback && callback(1, {
                    errMsg: "用户未登录，游戏进度上报失败！"
                }), 0 == this.newDevice) return console.log("[TXSDK]过滤设备行为上报"), void (callback && callback(0));
                var reqProgress = {
                    client: sdkData.client,
                    channel_id: sdkData.channel_id,
                    game_id: sdkData.game_id,
                    package_id: sdkData.package_id,
                    device_id: sdkData.device_id,
                    user_token: sdkData.user_token,
                    user_id: data.user_id,
                    progress_type: data.progress_type
                };
                this.sendXHR(sdkHost + "device/progress", reqProgress, function(resProgress) {
                    callback && callback(0);
                });
            },
            subscribeMsg: function() {
                var self = this, reqSubscribe = {
                    client: sdkData.client,
                    channel_id: sdkData.channel_id,
                    game_id: sdkData.game_id,
                    package_id: sdkData.package_id,
                    device_id: sdkData.device_id,
                    user_token: sdkData.user_token
                };
                self.sendXHR(sdkHost + "mgame/get_subscribe", reqSubscribe, function(resSubscribe) {
                    var _touchEvent = null;
                    wx.onTouchEnd(_touchEvent = function() {
                        1 == resSubscribe.is_subscribe ? wx.requestSubscribeMessage({
                            tmplIds: resSubscribe.template_ids,
                            success: function(sucSubscribe) {
                                wx.offTouchEnd(_touchEvent);
                                var newSubscribe = {
                                    subscribe_info: JSON.stringify(sucSubscribe),
                                    subscribe_type: 1
                                };
                                Object.assign(newSubscribe, reqSubscribe), console.log("[TXSDK]订阅上报服务端" + JSON.stringify(newSubscribe)), 
                                self.sendXHR(sdkHost + "mgame/report_subscribe", newSubscribe, function(resSubscribe) {
                                    console.log("[TXSDK]成功上报订阅信息");
                                });
                            },
                            fail: function(err) {
                                wx.offTouchEnd(_touchEvent), console.log("[TXSDK]拉起订阅失败" + err.errMsg);
                            }
                        }) : (wx.offTouchEnd(_touchEvent), console.log("[TXSDK]用户已完成订阅设置，无需再弹出订阅信息"));
                    });
                });
            },
            share: function() {
                console.log("[TXSDK]CP调用分享 ==== share"), this.getShareInfo("share", function(data) {
                    var shareInfo = {};
                    data.title && (shareInfo.title = data.title), data.imageUrl && (shareInfo.imageUrl = data.imageUrl), 
                    shareInfo.query = data.query, wx.shareAppMessage(shareInfo);
                });
            },
            onMenuShare: function() {
                console.log("[TXSDK]监听右上角分享 ==== onMenuShare"), this.getShareInfo("menu", function(data) {
                    var shareInfo = {};
                    data.title && (shareInfo.title = data.title), data.imageUrl && (shareInfo.imageUrl = data.imageUrl), 
                    shareInfo.query = data.query, wx.onShareAppMessage(function() {
                        return onMenuShareCallBack && onMenuShareCallBack(), shareInfo;
                    });
                });
            },
            checkShareRole: function(callback) {
                console.log("[TXSDK]CP调用分享查询 ==== checkShareRole"), callback(shareUserInfo ? 1 : 0);
            },
            onGameMenuShare: function(callback) {
                console.log("[TXSDK]游戏内调用onGameMenuShare ==== onGameMenuShare"), onMenuShareCallBack = callback;
            },
            getShareInfo: function(type, callback) {
                console.log("[TXSDK]获取分享参数 === " + type);
                var shareInfo = {
                    channel_id: sdkData.channel_id,
                    game_id: sdkData.game_id,
                    package_id: sdkData.package_id,
                    device_id: sdkData.device_id,
                    client: sdkData.client,
                    user_token: sdkData.user_token,
                    user_id: userGameInfo ? userGameInfo.user_id : "",
                    server_id: userGameInfo ? userGameInfo.server_id : "",
                    role_id: userGameInfo ? userGameInfo.role_id : "",
                    share_type: type
                };
                this.sendXHR(sdkHost + "roleshare/get_share_info", shareInfo, function(res) {
                    console.log("[TXSDK]获取分享参数结果" + JSON.stringify(res)), callback(res);
                });
            },
            updateShare: function(shareInfo) {
                console.log("[TXSDK]分享过来的玩家上报给服务器"), this.sendXHR(sdkHost + "roleshare/update_share", shareInfo, function(res) {
                    console.log("[TXSDK]上报分享结果返回:"), console.log(res);
                });
            },
            vipQrcode: function(data, callback) {
                var reqVip = {
                    client: sdkData.client,
                    channel_id: sdkData.channel_id,
                    game_id: sdkData.game_id,
                    package_id: sdkData.package_id,
                    device_id: sdkData.device_id,
                    server_id: data.server_id,
                    action: data.action
                };
                this.sendXHR(sdkHost + "vip/qrcode", reqVip, function(resVip) {
                    callback && callback(0, {
                        url: resVip.url
                    });
                });
            },
            convertClient: function(data, callback) {
                window.TXchannel.convertClient && window.TXchannel.convertClient("", function() {
                    callback && callback(0);
                });
            },
            callSubscribeMsg: function(data, callback) {
                wx.requestSubscribeMessage({
                    tmplIds: data.template_ids,
                    success: function(res) {
                        console.log("[TXSDK]拉起订阅消息seccess：" + JSON.stringify(res));
                    },
                    fail: function(res) {
                        console.log("[TXSDK]拉起订阅消息fail：" + JSON.stringify(res));
                    },
                    complete: function(res) {
                        console.log("[TXSDK]拉起订阅消息complete：" + JSON.stringify(res)), window.TXchannel.callSubscribeMsg && window.TXchannel.callSubscribeMsg(res, function() {
                            callback && callback(0, res);
                        });
                    }
                });
            },
            openService: function(data, callback) {
                wx.openCustomerServiceConversation(), callback && callback(0);
            },
            inspireVideo: function(data, callback) {
                window.TXchannel.inspireVideo && window.TXchannel.inspireVideo(data, function(res) {
                    callback && callback(0, {
                        is_close_finish: res
                    });
                });
            },
            sendUrl: function(data, callback) {
                window.TXchannel.sendUrl && window.TXchannel.sendUrl(data, function() {
                    callback && callback(0);
                });
            },
            accessToken: "",
            accessLock: "",
            sendXHR: function(url, data, callback, method, failCallback) {
                data.access_token = this.accessToken, data.time = Math.round(new Date().getTime() / 1e3);
                var signArr = this.openLock(data, this.accessLock);
                data.sign = signArr.sign, wx.request({
                    url: url,
                    method: method || "POST",
                    data: data,
                    header: {
                        "Content-Type": "application/x-www-form-urlencoded"
                    },
                    success: function(res) {
                        1 == res.data.code ? callback && callback(res.data.data) : (console.log("[TXSDK]AjaxCodeErr请求地址：" + url + " code：" + res.data.code + " msg：" + res.data.msg), 
                        failCallback && failCallback());
                    },
                    fail: function(error) {
                        console.log("[TXSDK]AjaxFail请求地址：" + url + " 请求参数：" + JSON.stringify(data) + " 请求失败：" + error.errMsg), 
                        failCallback && failCallback();
                    }
                });
            },
            newDevice: 0,
            getDeviceId: function() {
                var deviceId = wx.getStorageSync("ui_device_id");
                return deviceId || (this.newDevice = 1, deviceId = this.randomString(32), wx.setStorageSync("ui_device_id", deviceId)), 
                deviceId;
            },
            getAdCode: function() {
                var launchOpt = wx.getLaunchOptionsSync(), adCode = wx.getStorageSync("ui_ad_code");
                return adCode || launchOpt.query && launchOpt.query.ad_code && (adCode = launchOpt.query.ad_code, 
                wx.setStorageSync("ui_ad_code", launchOpt.query.ad_code)), adCode;
            },
            randomString: function(num) {
                num = num || 32;
                var t = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678", len = t.length, n = "", i = 0;
                for (i = 0; i < num; i++) n += t.charAt(Math.floor(Math.random() * len));
                return n;
            },
            openLock: function(data, key) {
                var n = null, d = {}, str = "";
                for (var i in n = Object.keys(data).sort()) d[n[i]] = data[n[i]];
                for (var k in d) "sign" !== k && "sign_string" !== k && "channel_data" !== k && "" !== d[k] && void 0 !== d[k] && ("" != str && (str += "&"), 
                str += k + "=" + d[k]);
                return str += "&key=" + key, str = this.emoji2Str(str), {
                    sign: md5_default()(str).toUpperCase(),
                    sign_string: str
                };
            },
            emoji2Str: function(str) {
                return str.replace(/\ud83c[\udf00-\udfff]|\ud83d[\udc00-\ude4f]|\ud83d[\ude80-\udeff]/gi, "");
            },
            md5: function(string) {
                function rotateLeft(lValue, iShiftBits) {
                    return lValue << iShiftBits | lValue >>> 32 - iShiftBits;
                }
                function addUnsigned(lX, lY) {
                    var lX4, lY4, lX8, lY8, lResult;
                    return lX8 = 2147483648 & lX, lY8 = 2147483648 & lY, lResult = (1073741823 & lX) + (1073741823 & lY), 
                    (lX4 = 1073741824 & lX) & (lY4 = 1073741824 & lY) ? 2147483648 ^ lResult ^ lX8 ^ lY8 : lX4 | lY4 ? 1073741824 & lResult ? 3221225472 ^ lResult ^ lX8 ^ lY8 : 1073741824 ^ lResult ^ lX8 ^ lY8 : lResult ^ lX8 ^ lY8;
                }
                function FF(a, b, c, d, x, s, ac) {
                    return addUnsigned(rotateLeft(a = addUnsigned(a, addUnsigned(addUnsigned(function(x, y, z) {
                        return x & y | ~x & z;
                    }(b, c, d), x), ac)), s), b);
                }
                function GG(a, b, c, d, x, s, ac) {
                    return addUnsigned(rotateLeft(a = addUnsigned(a, addUnsigned(addUnsigned(function(x, y, z) {
                        return x & z | y & ~z;
                    }(b, c, d), x), ac)), s), b);
                }
                function HH(a, b, c, d, x, s, ac) {
                    return addUnsigned(rotateLeft(a = addUnsigned(a, addUnsigned(addUnsigned(function(x, y, z) {
                        return x ^ y ^ z;
                    }(b, c, d), x), ac)), s), b);
                }
                function II(a, b, c, d, x, s, ac) {
                    return addUnsigned(rotateLeft(a = addUnsigned(a, addUnsigned(addUnsigned(function(x, y, z) {
                        return y ^ (x | ~z);
                    }(b, c, d), x), ac)), s), b);
                }
                function wordToHex(lValue) {
                    var lCount, WordToHexValue = "", WordToHexValue_temp = "";
                    for (lCount = 0; lCount <= 3; lCount++) WordToHexValue_temp = "0" + (lValue >>> 8 * lCount & 255).toString(16), 
                    WordToHexValue += WordToHexValue_temp.substr(WordToHexValue_temp.length - 2, 2);
                    return WordToHexValue;
                }
                var k, AA, BB, CC, DD, a, b, c, d, x = [];
                for (string = function(string) {
                    string = string.replace(/\r\n/g, "\n");
                    for (var utftext = "", n = 0; n < string.length; n++) {
                        var c = string.charCodeAt(n);
                        c < 128 ? utftext += String.fromCharCode(c) : (127 < c && c < 2048 ? utftext += String.fromCharCode(c >> 6 | 192) : (utftext += String.fromCharCode(c >> 12 | 224), 
                        utftext += String.fromCharCode(c >> 6 & 63 | 128)), utftext += String.fromCharCode(63 & c | 128));
                    }
                    return utftext;
                }(string), x = function(string) {
                    for (var lWordCount, lMessageLength = string.length, lNumberOfWords_temp1 = lMessageLength + 8, lNumberOfWords = 16 * ((lNumberOfWords_temp1 - lNumberOfWords_temp1 % 64) / 64 + 1), lWordArray = new Array(lNumberOfWords - 1), lBytePosition = 0, lByteCount = 0; lByteCount < lMessageLength; ) lBytePosition = lByteCount % 4 * 8, 
                    lWordArray[lWordCount = (lByteCount - lByteCount % 4) / 4] = lWordArray[lWordCount] | string.charCodeAt(lByteCount) << lBytePosition, 
                    lByteCount++;
                    return lBytePosition = lByteCount % 4 * 8, lWordArray[lWordCount = (lByteCount - lByteCount % 4) / 4] = lWordArray[lWordCount] | 128 << lBytePosition, 
                    lWordArray[lNumberOfWords - 2] = lMessageLength << 3, lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29, 
                    lWordArray;
                }(string), a = 1732584193, b = 4023233417, c = 2562383102, d = 271733878, k = 0; k < x.length; k += 16) a = FF(AA = a, BB = b, CC = c, DD = d, x[k + 0], 7, 3614090360), 
                d = FF(d, a, b, c, x[k + 1], 12, 3905402710), c = FF(c, d, a, b, x[k + 2], 17, 606105819), 
                b = FF(b, c, d, a, x[k + 3], 22, 3250441966), a = FF(a, b, c, d, x[k + 4], 7, 4118548399), 
                d = FF(d, a, b, c, x[k + 5], 12, 1200080426), c = FF(c, d, a, b, x[k + 6], 17, 2821735955), 
                b = FF(b, c, d, a, x[k + 7], 22, 4249261313), a = FF(a, b, c, d, x[k + 8], 7, 1770035416), 
                d = FF(d, a, b, c, x[k + 9], 12, 2336552879), c = FF(c, d, a, b, x[k + 10], 17, 4294925233), 
                b = FF(b, c, d, a, x[k + 11], 22, 2304563134), a = FF(a, b, c, d, x[k + 12], 7, 1804603682), 
                d = FF(d, a, b, c, x[k + 13], 12, 4254626195), c = FF(c, d, a, b, x[k + 14], 17, 2792965006), 
                b = FF(b, c, d, a, x[k + 15], 22, 1236535329), a = GG(a, b, c, d, x[k + 1], 5, 4129170786), 
                d = GG(d, a, b, c, x[k + 6], 9, 3225465664), c = GG(c, d, a, b, x[k + 11], 14, 643717713), 
                b = GG(b, c, d, a, x[k + 0], 20, 3921069994), a = GG(a, b, c, d, x[k + 5], 5, 3593408605), 
                d = GG(d, a, b, c, x[k + 10], 9, 38016083), c = GG(c, d, a, b, x[k + 15], 14, 3634488961), 
                b = GG(b, c, d, a, x[k + 4], 20, 3889429448), a = GG(a, b, c, d, x[k + 9], 5, 568446438), 
                d = GG(d, a, b, c, x[k + 14], 9, 3275163606), c = GG(c, d, a, b, x[k + 3], 14, 4107603335), 
                b = GG(b, c, d, a, x[k + 8], 20, 1163531501), a = GG(a, b, c, d, x[k + 13], 5, 2850285829), 
                d = GG(d, a, b, c, x[k + 2], 9, 4243563512), c = GG(c, d, a, b, x[k + 7], 14, 1735328473), 
                b = GG(b, c, d, a, x[k + 12], 20, 2368359562), a = HH(a, b, c, d, x[k + 5], 4, 4294588738), 
                d = HH(d, a, b, c, x[k + 8], 11, 2272392833), c = HH(c, d, a, b, x[k + 11], 16, 1839030562), 
                b = HH(b, c, d, a, x[k + 14], 23, 4259657740), a = HH(a, b, c, d, x[k + 1], 4, 2763975236), 
                d = HH(d, a, b, c, x[k + 4], 11, 1272893353), c = HH(c, d, a, b, x[k + 7], 16, 4139469664), 
                b = HH(b, c, d, a, x[k + 10], 23, 3200236656), a = HH(a, b, c, d, x[k + 13], 4, 681279174), 
                d = HH(d, a, b, c, x[k + 0], 11, 3936430074), c = HH(c, d, a, b, x[k + 3], 16, 3572445317), 
                b = HH(b, c, d, a, x[k + 6], 23, 76029189), a = HH(a, b, c, d, x[k + 9], 4, 3654602809), 
                d = HH(d, a, b, c, x[k + 12], 11, 3873151461), c = HH(c, d, a, b, x[k + 15], 16, 530742520), 
                b = HH(b, c, d, a, x[k + 2], 23, 3299628645), a = II(a, b, c, d, x[k + 0], 6, 4096336452), 
                d = II(d, a, b, c, x[k + 7], 10, 1126891415), c = II(c, d, a, b, x[k + 14], 15, 2878612391), 
                b = II(b, c, d, a, x[k + 5], 21, 4237533241), a = II(a, b, c, d, x[k + 12], 6, 1700485571), 
                d = II(d, a, b, c, x[k + 3], 10, 2399980690), c = II(c, d, a, b, x[k + 10], 15, 4293915773), 
                b = II(b, c, d, a, x[k + 1], 21, 2240044497), a = II(a, b, c, d, x[k + 8], 6, 1873313359), 
                d = II(d, a, b, c, x[k + 15], 10, 4264355552), c = II(c, d, a, b, x[k + 6], 15, 2734768916), 
                b = II(b, c, d, a, x[k + 13], 21, 1309151649), a = II(a, b, c, d, x[k + 4], 6, 4149444226), 
                d = II(d, a, b, c, x[k + 11], 10, 3174756917), c = II(c, d, a, b, x[k + 2], 15, 718787259), 
                b = II(b, c, d, a, x[k + 9], 21, 3951481745), a = addUnsigned(a, AA), b = addUnsigned(b, BB), 
                c = addUnsigned(c, CC), d = addUnsigned(d, DD);
                var temp = wordToHex(a) + wordToHex(b) + wordToHex(c) + wordToHex(d);
                return temp.toUpperCase();
            }
        };
        function unionRun(method, data, callback) {
            method in UNION_SDK && UNION_SDK[method](data, callback);
        }
        wx.onShow(function(hotStart) {
            if (sdkData && sdkData.user_token) {
                var reqHot = {
                    channel_id: sdkData.channel_id,
                    game_id: sdkData.game_id,
                    package_id: sdkData.package_id,
                    device_id: sdkData.device_id,
                    client: sdkData.client,
                    user_token: sdkData.user_token,
                    start_params: JSON.stringify(hotStart),
                    start_type: 2
                };
                UNION_SDK.sendXHR(sdkHost + "mgame/active", reqHot, function(resHot) {}, "POST", function() {});
            }
        });
        var unionSdk = {
            init: function(data, callback) {
                unionRun("init", data, callback);
            },
            login: function(callback) {
                unionRun("login", "", callback);
            },
            reportRole: function(data, callback) {
                unionRun("reportRole", data, callback);
            },
            pay: function(data, callback) {
                unionRun("pay", data, callback);
            },
            msgCheck: function(str, callback) {
                unionRun("msgCheck", str, callback);
            },
            gameProgress: function(data, callback) {
                unionRun("gameProgress", data, callback);
            },
            share: function(data, callback) {
                unionRun("share", data, callback);
            },
            checkShareRole: function(data, callback) {
                unionRun("checkShareRole", data, callback);
            },
            onGameMenuShare: function(data, callback) {
                unionRun("onGameMenuShare", data, callback);
            },
            reportComLoad: function(str, callback) {
                unionRun("reportComLoad", str, callback);
            },
            vipQrcode: function(data, callback) {
                unionRun("vipQrcode", data, callback);
            },
            convertClient: function(data, callback) {
                unionRun("convertClient", data, callback);
            },
            callSubscribeMsg: function(data, callback) {
                unionRun("callSubscribeMsg", data, callback);
            },
            openService: function(data, callback) {
                unionRun("openService", data, callback);
            },
            inspireVideo: function(data, callback) {
                unionRun("inspireVideo", data, callback);
            },
            toMiniGameC: function(data, callback) {
                unionRun("toMiniGameC", data, callback);
            },
            sendUrl: function(data, callback) {
                unionRun("sendUrl", data, callback);
            }
        };
        window.TX_YXGI = "10251", window.TXSDK = unionSdk;
    }();
}();

var Laya = window.Laya = function(window, document) {
    var Laya = {
        __internals: [],
        __packages: {},
        __classmap: {
            Object: Object,
            Function: Function,
            Array: Array,
            String: String
        },
        __sysClass: {
            object: "Object",
            array: "Array",
            string: "String",
            dictionary: "Dictionary"
        },
        __propun: {
            writable: !0,
            enumerable: !1,
            configurable: !0
        },
        __presubstr: String.prototype.substr,
        __substr: function(ofs, sz) {
            return 1 == arguments.length ? Laya.__presubstr.call(this, ofs) : Laya.__presubstr.call(this, ofs, 0 < sz ? sz : this.length + sz);
        },
        __init: function(_classs) {
            _classs.forEach(function(o) {
                o.__init$ && o.__init$();
            });
        },
        __isClass: function(o) {
            return o && (o.__isclass || o == Object || o == String || o == Array);
        },
        __newvec: function(sz, value) {
            var d = [];
            d.length = sz;
            for (var i = 0; i < sz; i++) d[i] = value;
            return d;
        },
        __extend: function(d, b) {
            for (var p in b) if (b.hasOwnProperty(p)) {
                var gs = Object.getOwnPropertyDescriptor(b, p), g = gs.get, s = gs.set;
                g || s ? g && s ? Object.defineProperty(d, p, gs) : (g && Object.defineProperty(d, p, g), 
                s && Object.defineProperty(d, p, s)) : d[p] = b[p];
            }
            function __() {
                Laya.un(this, "constructor", d);
            }
            __.prototype = b.prototype, d.prototype = new __(), Laya.un(d.prototype, "__imps", Laya.__copy({}, b.prototype.__imps));
        },
        __copy: function(dec, src) {
            if (!src) return null;
            for (var i in dec = dec || {}, src) dec[i] = src[i];
            return dec;
        },
        __package: function(name, o) {
            if (!Laya.__packages[name]) {
                Laya.__packages[name] = !0;
                var p = window, strs = name.split(".");
                if (1 < strs.length) for (var i = 0, sz = strs.length - 1; i < sz; i++) {
                    var c = p[strs[i]];
                    p = c || (p[strs[i]] = {});
                }
                p[strs[strs.length - 1]] || (p[strs[strs.length - 1]] = o || {});
            }
        },
        __hasOwnProperty: function(name, o) {
            return o = o || this, Object.hasOwnProperty.call(o, name) || function classHas(name, o) {
                if (Object.hasOwnProperty.call(o.prototype, name)) return !0;
                var s = o.prototype.__super;
                return null == s ? null : classHas(name, s);
            }(name, o.__class);
        },
        __typeof: function(o, value) {
            if (!o || !value) return !1;
            if (value === String) return "string" == typeof o;
            if (value === Number) return "number" == typeof o;
            if (value.__interface__) value = value.__interface__; else if ("string" != typeof value) return o instanceof value;
            return o.__imps && o.__imps[value] || o.__class == value;
        },
        __as: function(value, type) {
            return this.__typeof(value, type) ? value : null;
        },
        __int: function(value) {
            return value ? parseInt(value) : 0;
        },
        interface: function(name, _super) {
            Laya.__package(name, {});
            var ins = Laya.__internals, a = ins[name] = ins[name] || {
                self: name
            };
            if (_super) {
                var supers = _super.split(",");
                a.extend = [];
                for (var i = 0; i < supers.length; i++) {
                    var nm = supers[i];
                    ins[nm] = ins[nm] || {
                        self: nm
                    }, a.extend.push(ins[nm]);
                }
            }
            var o = window, words = name.split(".");
            for (i = 0; i < words.length - 1; i++) o = o[words[i]];
            o[words[words.length - 1]] = {
                __interface__: name
            };
        },
        class: function(o, fullName, _super, miniName) {
            if (_super && Laya.__extend(o, _super), fullName) if (Laya.__package(fullName, o), 
            Laya.__classmap[fullName] = o, 0 < fullName.indexOf(".")) {
                if (0 == fullName.indexOf("laya.")) {
                    var paths = fullName.split(".");
                    miniName = miniName || paths[paths.length - 1], Laya[miniName] && console.log("Warning!,this class[" + miniName + "] already exist:", Laya[miniName]), 
                    Laya[miniName] = o;
                }
            } else "Main" == fullName ? window.Main = o : (Laya[fullName] && console.log("Error!,this class[" + fullName + "] already exist:", Laya[fullName]), 
            Laya[fullName] = o);
            var un = Laya.un, p = o.prototype;
            un(p, "hasOwnProperty", Laya.__hasOwnProperty), un(p, "__class", o), un(p, "__super", _super), 
            un(p, "__className", fullName), un(o, "__super", _super), un(o, "__className", fullName), 
            un(o, "__isclass", !0), un(o, "super", function(o) {
                this.__super.call(o);
            });
        },
        imps: function(dec, src) {
            if (!src) return null;
            var d = dec.__imps || Laya.un(dec, "__imps", {});
            function __(name) {
                var c, exs;
                if ((c = Laya.__internals[name]) && (d[name] = !0, exs = c.extend)) for (var i = 0; i < exs.length; i++) __(exs[i].self);
            }
            for (var i in src) __(i);
        },
        superSet: function(clas, o, prop, value) {
            var fun = clas.prototype["_$set_" + prop];
            fun && fun.call(o, value);
        },
        superGet: function(clas, o, prop) {
            var fun = clas.prototype["_$get_" + prop];
            return fun ? fun.call(o) : null;
        },
        getset: function(isStatic, o, name, getfn, setfn) {
            isStatic ? (getfn && (o["_$GET_" + name] = getfn), setfn && (o["_$SET_" + name] = setfn)) : (getfn && Laya.un(o, "_$get_" + name, getfn), 
            setfn && Laya.un(o, "_$set_" + name, setfn)), getfn && setfn ? Object.defineProperty(o, name, {
                get: getfn,
                set: setfn,
                enumerable: !1,
                configurable: !0
            }) : (getfn && Object.defineProperty(o, name, {
                get: getfn,
                enumerable: !1,
                configurable: !0
            }), setfn && Object.defineProperty(o, name, {
                set: setfn,
                enumerable: !1,
                configurable: !0
            }));
        },
        static: function(_class, def) {
            for (var i = 0, sz = def.length; i < sz; i += 2) if ("length" == def[i]) _class.length = def[i + 1].call(_class); else {
                function tmp() {
                    var name = def[i], getfn = def[i + 1];
                    Object.defineProperty(_class, name, {
                        get: function() {
                            return delete this[name], this[name] = getfn.call(this);
                        },
                        set: function(v) {
                            delete this[name], this[name] = v;
                        },
                        enumerable: !0,
                        configurable: !0
                    });
                }
                tmp();
            }
        },
        un: function(obj, name, value) {
            return value || (value = obj[name]), Laya.__propun.value = value, Object.defineProperty(obj, name, Laya.__propun), 
            value;
        },
        uns: function(obj, names) {
            names.forEach(function(o) {
                Laya.un(obj, o);
            });
        }
    };
    return window.console = window.console || {
        log: function() {}
    }, window.trace = window.console.log, Error.prototype.throwError = function() {
        throw arguments;
    }, Object.defineProperty(Array.prototype, "fixed", {
        enumerable: !1
    }), Laya;
}(window, document);

!function(window, document, Laya) {
    Laya.un, Laya.uns, Laya.static, Laya.class, Laya.getset, Laya.__newvec;
}(window, document, Laya), function(window, document, Laya) {
    Laya.un, Laya.uns;
    var __static = Laya.static, __class = Laya.class, __getset = Laya.getset;
    Laya.__newvec;
    Laya.interface("laya.runtime.IMarket"), Laya.interface("laya.filters.IFilter"), 
    Laya.interface("laya.display.ILayout"), Laya.interface("laya.resource.IDispose"), 
    Laya.interface("laya.runtime.IPlatform"), Laya.interface("laya.resource.IDestroy"), 
    Laya.interface("laya.runtime.IConchNode"), Laya.interface("laya.filters.IFilterAction"), 
    Laya.interface("laya.runtime.ICPlatformClass"), Laya.interface("laya.resource.ICreateResource"), 
    Laya.interface("laya.runtime.IConchRenderObject"), Laya.interface("laya.runtime.IPlatformClass", "laya.runtime.IPlatform");
    var RunDriver = function() {
        function RunDriver() {}
        return __class(RunDriver, "laya.utils.RunDriver"), RunDriver.FILTER_ACTIONS = [], 
        RunDriver.pixelRatio = -1, RunDriver._charSizeTestDiv = null, RunDriver.now = function() {
            return Date.now();
        }, RunDriver.getWindow = function() {
            return window;
        }, RunDriver.getPixelRatio = function() {
            if (RunDriver.pixelRatio < 0) {
                var ctx = Browser.context, backingStore = ctx.backingStorePixelRatio || ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1;
                (RunDriver.pixelRatio = (Browser.window.devicePixelRatio || 1) / backingStore) < 1 && (RunDriver.pixelRatio = 1);
            }
            return RunDriver.pixelRatio;
        }, RunDriver.getIncludeStr = function(name) {
            return null;
        }, RunDriver.createShaderCondition = function(conditionScript) {
            var fn = "(function() {return " + conditionScript + ";})";
            return Laya._runScript(fn);
        }, RunDriver.fontMap = [], RunDriver.measureText = function(txt, font) {
            var isChinese = RunDriver.hanzi.test(txt);
            if (isChinese && RunDriver.fontMap[font]) return RunDriver.fontMap[font];
            var ctx = Browser.context;
            ctx.font = font;
            var r = ctx.measureText(txt);
            return isChinese && (RunDriver.fontMap[font] = r), r;
        }, RunDriver.getWebGLContext = function(canvas) {}, RunDriver.beginFlush = function() {}, 
        RunDriver.endFinish = function() {}, RunDriver.addToAtlas = null, RunDriver.flashFlushImage = function(atlasWebGLCanvas) {}, 
        RunDriver.drawToCanvas = function(sprite, _renderType, canvasWidth, canvasHeight, offsetX, offsetY) {
            var canvas = HTMLCanvas.create("2D"), context = new RenderContext(canvasWidth, canvasHeight, canvas);
            return RenderSprite.renders[_renderType]._fun(sprite, context, offsetX, offsetY), 
            canvas;
        }, RunDriver.createParticleTemplate2D = null, RunDriver.createGLTextur = null, RunDriver.createWebGLContext2D = null, 
        RunDriver.changeWebGLSize = function(w, h) {}, RunDriver.createRenderSprite = function(type, next) {
            return new RenderSprite(type, next);
        }, RunDriver.createFilterAction = function(type) {
            return new ColorFilterAction();
        }, RunDriver.createGraphics = function() {
            return new Graphics();
        }, RunDriver.clear = function(value) {
            Render._context.ctx.clear();
        }, RunDriver.cancelLoadByUrl = function(url) {}, RunDriver.clearAtlas = function(value) {}, 
        RunDriver.isAtlas = function(bitmap) {
            return !1;
        }, RunDriver.addTextureToAtlas = function(value) {}, RunDriver.getTexturePixels = function(value, x, y, width, height) {
            return null;
        }, RunDriver.skinAniSprite = function() {
            return null;
        }, RunDriver.update3DLoop = function() {}, __static(RunDriver, [ "hanzi", function() {
            return this.hanzi = new RegExp("^[一-龥]$");
        } ]), RunDriver;
    }(), Config = (__getset(1, Laya, "alertGlobalError", null, function(value) {
        var erralert = 0;
        Browser.window.onerror = value ? function(msg, url, line, column, detail) {
            erralert++ < 5 && detail && alert(detail.stack || detail);
        } : null;
    }), Laya.init = function(width, height, __plugins) {
        for (var plugins = [], i = 2, sz = arguments.length; i < sz; i++) plugins.push(arguments[i]);
        if (!Laya._isinit) {
            ArrayBuffer.prototype.slice || (ArrayBuffer.prototype.slice = Laya._arrayBufferSlice), 
            Laya._isinit = !0, Browser.__init__(), Context.__init__(), Graphics.__init__(), 
            Laya.timer = new Timer(), Laya.scaleTimer = new Timer(), Laya.loader = new LoaderManager(), 
            WeakObject.__init__(), i = 0;
            for (var n = plugins.length; i < n; i++) plugins[i].enable && plugins[i].enable();
            return Font.__init__(), Style.__init__(), ResourceManager.__init__(), CacheManager.beginCheck(), 
            Laya._currentStage = Laya.stage = new Stage(), Laya.stage.conchModel && Laya.stage.conchModel.setRootNode(), 
            Laya._getUrlPath(), Laya.render = new Render(0, 0), Laya.stage.size(width, height), 
            RenderSprite.__init__(), KeyBoardManager.__init__(), MouseManager.instance.__init__(Laya.stage, Render.canvas), 
            Input.__init__(), SoundManager.autoStopMusic = !0, LocalStorage.__init__(), Render.canvas;
        }
    }, Laya._getUrlPath = function() {
        var location = Browser.window.location, pathName = location.pathname;
        pathName = ":" == pathName.charAt(2) ? pathName.substring(1) : pathName, URL.rootPath = URL.basePath = URL.getPath("file:" == location.protocol ? pathName : location.protocol + "//" + location.host + location.pathname);
    }, Laya._arrayBufferSlice = function(start, end) {
        var arrU8List = new Uint8Array(this, start, end - start), newU8List = new Uint8Array(arrU8List.length);
        return newU8List.set(arrU8List), newU8List.buffer;
    }, Laya._runScript = function(script) {
        return Browser.window[Laya._evcode](script);
    }, Laya.stage = null, Laya.timer = null, Laya.scaleTimer = null, Laya.loader = null, 
    Laya.version = "1.7.20.1beta", Laya.render = null, Laya._currentStage = null, Laya._isinit = !1, 
    Laya.MiniAdpter = {
        init: function() {
            window.navigator && window.navigator.userAgent && -1 < window.navigator.userAgent.indexOf("MiniGame") && console.error("请先引用小游戏适配库laya.wxmini.js,详细教程：https://ldc.layabox.com/doc/?nav=zh-ts-5-0-0");
        }
    }, Laya.QGMiniAdapter = {
        init: function() {}
    }, Laya.VVMiniAdapter = {
        init: function() {}
    }, Laya.TTMiniAdapter = {
        init: function() {}
    }, __static(Laya, [ "conchMarket", function() {
        return this.conchMarket = window.conch ? conchMarket : null;
    }, "PlatformClass", function() {
        return this.PlatformClass = window.PlatformClass;
    }, "_evcode", function() {
        return this._evcode = "e" + String.fromCharCode(118) + "al";
    } ]), function() {
        function Config() {}
        return __class(Config, "Config"), Config.WebGLTextCacheCount = 500, Config.atlasEnable = !1, 
        Config.showCanvasMark = !1, Config.animationInterval = 50, Config.isAntialias = !1, 
        Config.isAlpha = !1, Config.premultipliedAlpha = !0, Config.isStencil = !0, Config.preserveDrawingBuffer = !1, 
        Config;
    }()), EventDispatcher = function() {
        function EventDispatcher() {
            this._events = null;
        }
        __class(EventDispatcher, "laya.events.EventDispatcher");
        var __proto = EventDispatcher.prototype;
        return __proto.hasListener = function(type) {
            return !!(this._events && this._events[type] && this._events[type].head);
        }, __proto.event = function(type, data) {
            if (!this._events || !this._events[type]) return !1;
            var list = this._events[type];
            if (list.lock) list.queue || (list.queue = []), list.queue.push(data); else {
                var node;
                for (list.lock = !0, list.cursor = list.head; list.cursor; ) {
                    node = list.cursor, list.cursor = node.next;
                    var caller = node.caller, method = node.method, args = node.args;
                    node.once && (EventDispatcher.delNode(list, node), EventDispatcher.recoverHandler(node)), 
                    null != data ? args ? method.apply(caller, args.concat(data)) : data instanceof Array ? method.apply(caller, data) : method.call(caller, data) : method.apply(caller, args);
                }
                list.lock = !1, !list.head && this._events && this._events[type] == list && delete this._events[type], 
                list.queue && list.queue.length && this.event(type, list.queue.shift());
            }
            return !0;
        }, __proto.on = function(type, caller, listener, args) {
            return this._createListener(type, caller, listener, args, !1);
        }, __proto.once = function(type, caller, listener, args) {
            return this._createListener(type, caller, listener, args, !0);
        }, __proto._createListener = function(type, caller, listener, args, once, offBefore) {
            void 0 === offBefore && (offBefore = !0), offBefore && this.off(type, caller, listener, once);
            var handler = EventDispatcher.createHandler(caller || this, listener, args, once);
            this._events || (this._events = {});
            var events = this._events, list = events[type];
            return list ? list.tail ? (handler.prev = list.tail, list.tail.next = handler, list.tail = handler) : list.head = list.tail = handler : events[type] = {
                head: handler,
                tail: handler,
                cursor: null,
                lock: !1
            }, this;
        }, __proto.off = function(type, caller, listener, onceOnly) {
            if (void 0 === onceOnly && (onceOnly = !1), !this._events || !this._events[type]) return this;
            for (var list = this._events[type], node = list.head; node; ) {
                if ((!caller || node.caller === caller) && node.method === listener && (!onceOnly || node.once)) {
                    EventDispatcher.delNode(list, node), list.cursor == node && (list.cursor = node.next), 
                    EventDispatcher.recoverHandler(node);
                    break;
                }
                node = node.next;
            }
            return this;
        }, __proto.offAll = function(type) {
            var events = this._events;
            if (!events) return this;
            if (type) this._recoverHandlers(events[type]), delete events[type]; else {
                for (var name in events) this._recoverHandlers(events[name]);
                this._events = null;
            }
            return this;
        }, __proto._recoverHandlers = function(list) {
            if (list) {
                for (var node = list.head; node; ) {
                    EventDispatcher.delNode(list, node);
                    var next = node.next;
                    EventDispatcher.recoverHandler(node), node = next;
                }
                list.cursor = null;
            }
        }, __proto.isMouseEvent = function(type) {
            return EventDispatcher.MOUSE_EVENTS[type];
        }, EventDispatcher.MOUSE_EVENTS = {
            rightmousedown: !0,
            rightmouseup: !0,
            rightclick: !0,
            mousedown: !0,
            mouseup: !0,
            mousemove: !0,
            mouseover: !0,
            mouseout: !0,
            click: !0,
            doubleclick: !0
        }, EventDispatcher.__init$ = function() {
            Object.defineProperty(laya.events.EventDispatcher.prototype, "_events", {
                enumerable: !1,
                writable: !0
            });
        }, EventDispatcher.delNode = function(list, node) {
            node.prev ? node.prev.next = node.next : list.head = node.next, node.next ? node.next.prev = node.prev : list.tail = node.prev;
        }, EventDispatcher.createHandler = function(caller, method, args, once) {
            var result = EventDispatcher._freeHandler;
            return result ? (EventDispatcher._freeCount--, EventDispatcher._freeHandler = result.next, 
            result.caller = caller, result.method = method, result.args = args, result.once = once) : result = {
                caller: caller,
                method: method,
                args: args,
                once: once
            }, result.prev = result.next = null, result;
        }, EventDispatcher.recoverHandler = function(handler) {
            handler.caller = handler.method = handler.args = handler.prev = null, handler.next = EventDispatcher._freeHandler, 
            EventDispatcher._freeHandler = handler, EventDispatcher._freeCount++;
        }, EventDispatcher._freeHandler = null, EventDispatcher._freeCount = 0, EventDispatcher;
    }(), Handler = function() {
        function Handler(caller, method, args, once) {
            this.once = !1, void (this._id = 0) === once && (once = !1), this.setTo(caller, method, args, once);
        }
        __class(Handler, "laya.utils.Handler");
        var __proto = Handler.prototype;
        return __proto.setTo = function(caller, method, args, once) {
            return this._id = Handler._gid++, this.caller = caller, this.method = method, this.args = args, 
            this.once = once, this;
        }, __proto.run = function() {
            if (null == this.method) return null;
            var id = this._id, result = this.method.apply(this.caller, this.args);
            return this._id === id && this.once && this.recover(), result;
        }, __proto.runWith = function(data) {
            if (null == this.method) return null;
            var id = this._id;
            if (null == data) var result = this.method.apply(this.caller, this.args); else result = this.args || data.unshift ? this.args ? this.method.apply(this.caller, this.args.concat(data)) : this.method.apply(this.caller, data) : this.method.call(this.caller, data);
            return this._id === id && this.once && this.recover(), result;
        }, __proto.clear = function() {
            return this.caller = null, this.method = null, this.args = null, this;
        }, __proto.recover = function() {
            0 < this._id && (this._id = 0, this.clear());
        }, Handler.create = function(caller, method, args, once) {
            return void 0 === once && (once = !0), new Handler(caller, method, args, once);
        }, Handler._gid = 1, Handler;
    }(), BitmapFont = function() {
        function BitmapFont() {
            this._texture = null, this._fontCharDic = {}, this._fontWidthMap = {}, this._complete = null, 
            this._path = null, this._maxWidth = 0, this._spaceWidth = 10, this._padding = null, 
            this.fontSize = 12, this.autoScaleSize = !1, this.letterSpacing = 0;
        }
        __class(BitmapFont, "laya.display.BitmapFont");
        var __proto = BitmapFont.prototype;
        return __proto.loadFont = function(path, complete) {
            this._path = path, this._complete = complete, Laya.loader.load([ {
                url: this._path,
                type: "xml"
            }, {
                url: this._path.replace(".fnt", ".png"),
                type: "image"
            } ], Handler.create(this, this.onLoaded));
        }, __proto.onLoaded = function() {
            this.parseFont(Loader.getRes(this._path), Loader.getRes(this._path.replace(".fnt", ".png"))), 
            this._complete && this._complete.runWith(this._texture ? this : null);
        }, __proto.parseFont = function(xml, texture) {
            if (null != xml && null != texture) {
                this._texture = texture;
                var tInfo = xml.getElementsByTagName("info");
                if (!tInfo[0].getAttributeNode) return this.parseFont2(xml, texture);
                this.fontSize = parseInt(tInfo[0].getAttributeNode("size").nodeValue);
                var chars, tPaddingArray = tInfo[0].getAttributeNode("padding").nodeValue.split(",");
                this._padding = [ parseInt(tPaddingArray[0]), parseInt(tPaddingArray[1]), parseInt(tPaddingArray[2]), parseInt(tPaddingArray[3]) ], 
                chars = xml.getElementsByTagName("char");
                var i = 0;
                for (i = 0; i < chars.length; i++) {
                    var tAttribute = chars[i], tId = parseInt(tAttribute.getAttributeNode("id").nodeValue), xOffset = parseInt(tAttribute.getAttributeNode("xoffset").nodeValue) / 1, yOffset = parseInt(tAttribute.getAttributeNode("yoffset").nodeValue) / 1, xAdvance = parseInt(tAttribute.getAttributeNode("xadvance").nodeValue) / 1, region = new Rectangle();
                    region.x = parseInt(tAttribute.getAttributeNode("x").nodeValue), region.y = parseInt(tAttribute.getAttributeNode("y").nodeValue), 
                    region.width = parseInt(tAttribute.getAttributeNode("width").nodeValue), region.height = parseInt(tAttribute.getAttributeNode("height").nodeValue);
                    var tTexture = Texture.create(texture, region.x, region.y, region.width, region.height, xOffset, yOffset);
                    this._maxWidth = Math.max(this._maxWidth, xAdvance + this.letterSpacing), this._fontCharDic[tId] = tTexture, 
                    this._fontWidthMap[tId] = xAdvance;
                }
            }
        }, __proto.parseFont2 = function(xml, texture) {
            if (null != xml && null != texture) {
                this._texture = texture;
                var tInfo = xml.getElementsByTagName("info");
                this.fontSize = parseInt(tInfo[0].attributes.size.nodeValue);
                var tPaddingArray = tInfo[0].attributes.padding.nodeValue.split(",");
                this._padding = [ parseInt(tPaddingArray[0]), parseInt(tPaddingArray[1]), parseInt(tPaddingArray[2]), parseInt(tPaddingArray[3]) ];
                var chars = xml.getElementsByTagName("char"), i = 0;
                for (i = 0; i < chars.length; i++) {
                    var tAttribute = chars[i].attributes, tId = parseInt(tAttribute.id.nodeValue), xOffset = parseInt(tAttribute.xoffset.nodeValue) / 1, yOffset = parseInt(tAttribute.yoffset.nodeValue) / 1, xAdvance = parseInt(tAttribute.xadvance.nodeValue) / 1, region = new Rectangle();
                    region.x = parseInt(tAttribute.x.nodeValue), region.y = parseInt(tAttribute.y.nodeValue), 
                    region.width = parseInt(tAttribute.width.nodeValue), region.height = parseInt(tAttribute.height.nodeValue);
                    var tTexture = Texture.create(texture, region.x, region.y, region.width, region.height, xOffset, yOffset);
                    this._maxWidth = Math.max(this._maxWidth, xAdvance + this.letterSpacing), this._fontCharDic[tId] = tTexture, 
                    this._fontWidthMap[tId] = xAdvance;
                }
            }
        }, __proto.getCharTexture = function(char) {
            return this._fontCharDic[char.charCodeAt(0)];
        }, __proto.destroy = function() {
            if (this._texture) {
                for (var p in this._fontCharDic) {
                    var tTexture = this._fontCharDic[p];
                    tTexture && tTexture.destroy();
                }
                this._texture.destroy(), this._fontCharDic = null, this._fontWidthMap = null, this._texture = null;
            }
        }, __proto.setSpaceWidth = function(spaceWidth) {
            this._spaceWidth = spaceWidth;
        }, __proto.getCharWidth = function(char) {
            var code = char.charCodeAt(0);
            return this._fontWidthMap[code] ? this._fontWidthMap[code] + this.letterSpacing : " " == char ? this._spaceWidth + this.letterSpacing : 0;
        }, __proto.getTextWidth = function(text) {
            for (var tWidth = 0, i = 0, n = text.length; i < n; i++) tWidth += this.getCharWidth(text.charAt(i));
            return tWidth;
        }, __proto.getMaxWidth = function() {
            return this._maxWidth;
        }, __proto.getMaxHeight = function() {
            return this.fontSize;
        }, __proto.drawText = function(text, sprite, drawX, drawY, align, width) {
            var tTexture, tWidth = this.getTextWidth(text), dx = 0;
            "center" === align && (dx = (width - tWidth) / 2), "right" === align && (dx = width - tWidth);
            for (var tX = 0, i = 0, n = text.length; i < n; i++) (tTexture = this.getCharTexture(text.charAt(i))) && (sprite.graphics.drawTexture(tTexture, drawX + tX + dx, drawY), 
            tX += this.getCharWidth(text.charAt(i)));
        }, BitmapFont;
    }(), Style = function() {
        function Style() {
            this.alpha = 1, this.visible = !0, this.scrollRect = null, this.blendMode = null, 
            this._type = 0, this._tf = Style._TF_EMPTY;
        }
        __class(Style, "laya.display.css.Style");
        var __proto = Style.prototype;
        return __proto.getTransform = function() {
            return this._tf;
        }, __proto.setTransform = function(value) {
            this._tf = "none" !== value && value ? value : Style._TF_EMPTY;
        }, __proto.setTranslateX = function(value) {
            this._tf === Style._TF_EMPTY && (this._tf = new TransformInfo()), this._tf.translateX = value;
        }, __proto.setTranslateY = function(value) {
            this._tf === Style._TF_EMPTY && (this._tf = new TransformInfo()), this._tf.translateY = value;
        }, __proto.setScaleX = function(value) {
            this._tf === Style._TF_EMPTY && (this._tf = new TransformInfo()), this._tf.scaleX = value;
        }, __proto.setScale = function(x, y) {
            this._tf === Style._TF_EMPTY && (this._tf = new TransformInfo()), this._tf.scaleX = x, 
            this._tf.scaleY = y;
        }, __proto.setScaleY = function(value) {
            this._tf === Style._TF_EMPTY && (this._tf = new TransformInfo()), this._tf.scaleY = value;
        }, __proto.setRotate = function(value) {
            this._tf === Style._TF_EMPTY && (this._tf = new TransformInfo()), this._tf.rotate = value;
        }, __proto.setSkewX = function(value) {
            this._tf === Style._TF_EMPTY && (this._tf = new TransformInfo()), this._tf.skewX = value;
        }, __proto.setSkewY = function(value) {
            this._tf === Style._TF_EMPTY && (this._tf = new TransformInfo()), this._tf.skewY = value;
        }, __proto.destroy = function() {
            this.scrollRect = null;
        }, __proto.render = function(sprite, context, x, y) {}, __proto.getCSSStyle = function() {
            return CSSStyle.EMPTY;
        }, __proto._enableLayout = function() {
            return !1;
        }, __getset(0, __proto, "scaleX", function() {
            return this._tf.scaleX;
        }, function(value) {
            this.setScaleX(value);
        }), __getset(0, __proto, "transform", function() {
            return this.getTransform();
        }, function(value) {
            this.setTransform(value);
        }), __getset(0, __proto, "translateX", function() {
            return this._tf.translateX;
        }, function(value) {
            this.setTranslateX(value);
        }), __getset(0, __proto, "translateY", function() {
            return this._tf.translateY;
        }, function(value) {
            this.setTranslateY(value);
        }), __getset(0, __proto, "scaleY", function() {
            return this._tf.scaleY;
        }, function(value) {
            this.setScaleY(value);
        }), __getset(0, __proto, "block", function() {
            return 0 != (1 & this._type);
        }), __getset(0, __proto, "skewY", function() {
            return this._tf.skewY;
        }, function(value) {
            this.setSkewY(value);
        }), __getset(0, __proto, "rotate", function() {
            return this._tf.rotate;
        }, function(value) {
            this.setRotate(value);
        }), __getset(0, __proto, "skewX", function() {
            return this._tf.skewX;
        }, function(value) {
            this.setSkewX(value);
        }), __getset(0, __proto, "paddingLeft", function() {
            return 0;
        }), __getset(0, __proto, "paddingTop", function() {
            return 0;
        }), __getset(0, __proto, "absolute", function() {
            return !0;
        }), Style.__init__ = function() {
            Style._TF_EMPTY = new TransformInfo(), Style.EMPTY = new Style();
        }, Style.EMPTY = null, Style._TF_EMPTY = null, Style;
    }(), Font = function() {
        function Font(src) {
            this._type = 0, this._weight = 0, this._decoration = null, this._text = null, this.indent = 0, 
            this._color = Color.create(Font.defaultColor), this.family = Font.defaultFamily, 
            this.stroke = Font._STROKE, this.size = Font.defaultSize, src && src !== Font.EMPTY && src.copyTo(this);
        }
        __class(Font, "laya.display.css.Font");
        var __proto = Font.prototype;
        return __proto.set = function(value) {
            this._text = null;
            for (var strs = value.split(" "), i = 0, n = strs.length; i < n; i++) {
                var str = strs[i];
                switch (str) {
                  case "italic":
                    this.italic = !0;
                    continue;

                  case "bold":
                    this.bold = !0;
                    continue;
                }
                0 < str.indexOf("px") && (this.size = parseInt(str), this.family = strs[i + 1], 
                i++);
            }
        }, __proto.toString = function() {
            return this._text = "", this.italic && (this._text += "italic "), this.bold && (this._text += "bold "), 
            this._text += this.size + "px " + this.family;
        }, __proto.copyTo = function(dec) {
            dec._type = this._type, dec._text = this._text, dec._weight = this._weight, dec._color = this._color, 
            dec.family = this.family, dec.stroke = this.stroke != Font._STROKE ? this.stroke.slice() : Font._STROKE, 
            dec.indent = this.indent, dec.size = this.size;
        }, __getset(0, __proto, "password", function() {
            return 0 != (1024 & this._type);
        }, function(value) {
            value ? this._type |= 1024 : this._type &= -1025;
        }), __getset(0, __proto, "color", function() {
            return this._color.strColor;
        }, function(value) {
            this._color = Color.create(value);
        }), __getset(0, __proto, "italic", function() {
            return 0 != (512 & this._type);
        }, function(value) {
            value ? this._type |= 512 : this._type &= -513;
        }), __getset(0, __proto, "bold", function() {
            return 0 != (2048 & this._type);
        }, function(value) {
            value ? this._type |= 2048 : this._type &= -2049;
        }), __getset(0, __proto, "weight", function() {
            return "" + this._weight;
        }, function(value) {
            var weight = 0;
            switch (value) {
              case "normal":
                break;

              case "bold":
                this.bold = !0, weight = 700;
                break;

              case "bolder":
                weight = 800;
                break;

              case "lighter":
                weight = 100;
                break;

              default:
                weight = parseInt(value);
            }
            this._weight = weight, this._text = null;
        }), __getset(0, __proto, "decoration", function() {
            return this._decoration ? this._decoration.value : null;
        }, function(value) {
            var strs = value.split(" ");
            switch (this._decoration || (this._decoration = {}), strs[0]) {
              case "_":
                this._decoration.type = "underline";
                break;

              case "-":
                this._decoration.type = "line-through";
                break;

              case "overline":
                this._decoration.type = "overline";
                break;

              default:
                this._decoration.type = strs[0];
            }
            strs[1] && (this._decoration.color = Color.create(strs)), this._decoration.value = value;
        }), Font.__init__ = function() {
            Font.EMPTY = new Font(null);
        }, Font.EMPTY = null, Font.defaultColor = "#000000", Font.defaultSize = 12, Font.defaultFamily = "Arial", 
        Font.defaultFont = "12px Arial", Font._STROKE = [ 0, "#000000" ], Font._ITALIC = 512, 
        Font._PASSWORD = 1024, Font._BOLD = 2048, Font;
    }(), TransformInfo = function() {
        function TransformInfo() {
            this.translateX = 0, this.translateY = 0, this.scaleX = 1, this.scaleY = 1, this.rotate = 0, 
            this.skewX = 0, this.skewY = 0;
        }
        return __class(TransformInfo, "laya.display.css.TransformInfo"), TransformInfo;
    }(), Graphics = function() {
        function Graphics() {
            if (this._one = null, this._cmds = null, this._render = this._renderEmpty, Render.isConchNode) {
                this._nativeObj = new window._conchGraphics(), this.id = this._nativeObj.conchID;
            }
        }
        __class(Graphics, "laya.display.Graphics");
        var __proto = Graphics.prototype;
        return __proto.destroy = function() {
            this.clear(), this._graphicBounds && this._graphicBounds.destroy(), this._graphicBounds = null, 
            this._vectorgraphArray = null, this._sp && (this._sp._renderType = 0), this._sp = null;
        }, __proto.clear = function(recoverCmds) {
            void 0 === recoverCmds && (recoverCmds = !1);
            var i = 0, len = 0;
            if (recoverCmds) {
                var tCmd = this._one;
                if (this._cmds) {
                    for (len = this._cmds.length, i = 0; i < len; i++) !(tCmd = this._cmds[i]) || tCmd.callee !== Render._context._drawTexture && tCmd.callee !== Render._context._drawTextureWithTransform || (tCmd[0] = null, 
                    Graphics._cache.push(tCmd));
                    this._cmds.length = 0;
                } else tCmd && (!tCmd || tCmd.callee !== Render._context._drawTexture && tCmd.callee !== Render._context._drawTextureWithTransform || (tCmd[0] = null, 
                Graphics._cache.push(tCmd)));
            } else this._cmds = null;
            if (this._one = null, this._render = this._renderEmpty, this._sp && (this._sp._renderType &= -514), 
            this._repaint(), this._vectorgraphArray) {
                for (i = 0, len = this._vectorgraphArray.length; i < len; i++) VectorGraphManager.getInstance().deleteShape(this._vectorgraphArray[i]);
                this._vectorgraphArray.length = 0;
            }
        }, __proto._clearBoundsCache = function() {
            this._graphicBounds && this._graphicBounds.reset();
        }, __proto._initGraphicBounds = function() {
            this._graphicBounds || (this._graphicBounds = new GraphicsBounds(), this._graphicBounds._graphics = this);
        }, __proto._repaint = function() {
            this._clearBoundsCache(), this._sp && this._sp.repaint();
        }, __proto._isOnlyOne = function() {
            return !this._cmds || 0 === this._cmds.length;
        }, __proto.getBounds = function(realSize) {
            return void 0 === realSize && (realSize = !1), this._initGraphicBounds(), this._graphicBounds.getBounds(realSize);
        }, __proto.getBoundPoints = function(realSize) {
            return void 0 === realSize && (realSize = !1), this._initGraphicBounds(), this._graphicBounds.getBoundPoints(realSize);
        }, __proto._addCmd = function(a) {
            this._cmds = this._cmds || [], a.callee = a.shift(), this._cmds.push(a);
        }, __proto.setFilters = function(fs) {
            this._saveToCmd(Render._context._setFilters, fs);
        }, __proto.drawTexture = function(tex, x, y, width, height, m, alpha) {
            if (void 0 === x && (x = 0), void 0 === y && (y = 0), void 0 === width && (width = 0), 
            void 0 === height && (height = 0), void 0 === alpha && (alpha = 1), !tex || alpha < .01) return null;
            width || (width = tex.sourceWidth), height || (height = tex.sourceHeight), alpha = alpha < 0 ? 0 : 1 < alpha ? 1 : alpha;
            var args, offset = !Render.isWebGL && (Browser.onFirefox || Browser.onEdge || Browser.onIE || Browser.onSafari) ? .5 : 0, wRate = width / tex.sourceWidth, hRate = height / tex.sourceHeight;
            return width = tex.width * wRate, height = tex.height * hRate, tex.loaded && (width <= 0 || height <= 0) ? null : (x += tex.offsetX * wRate, 
            y += tex.offsetY * hRate, this._sp && (this._sp._renderType |= 512), x -= offset, 
            y -= offset, width += 2 * offset, height += 2 * offset, Graphics._cache.length ? ((args = Graphics._cache.pop())[0] = tex, 
            args[1] = x, args[2] = y, args[3] = width, args[4] = height, args[5] = m, args[6] = alpha) : args = [ tex, x, y, width, height, m, alpha ], 
            args.callee = m || 1 != alpha ? Render._context._drawTextureWithTransform : Render._context._drawTexture, 
            null != this._one || m || 1 != alpha ? this._saveToCmd(args.callee, args) : (this._one = args, 
            this._render = this._renderOneImg), tex.loaded || tex.once("loaded", this, this._textureLoaded, [ tex, args ]), 
            this._repaint(), args);
        }, __proto.cleanByTexture = function(tex, x, y, width, height) {
            if (void 0 === width && (width = 0), void 0 === height && (height = 0), !tex) return this.clear();
            if (this._one && this._render === this._renderOneImg) {
                width || (width = tex.sourceWidth), height || (height = tex.sourceHeight);
                var wRate = width / tex.sourceWidth, hRate = height / tex.sourceHeight;
                width = tex.width * wRate, height = tex.height * hRate, x += tex.offsetX * wRate, 
                y += tex.offsetY * hRate, this._one[0] = tex, this._one[1] = x, this._one[2] = y, 
                this._one[3] = width, this._one[4] = height, this._repaint();
            } else this.clear(), tex && this.drawTexture(tex, x, y, width, height);
        }, __proto.drawTextures = function(tex, pos) {
            tex && this._saveToCmd(Render._context._drawTextures, [ tex, pos ]);
        }, __proto.fillTexture = function(tex, x, y, width, height, type, offset) {
            if (void 0 === width && (width = 0), void 0 === height && (height = 0), void 0 === type && (type = "repeat"), 
            tex) {
                var args = [ tex, x, y, width, height, type, offset || Point.EMPTY, {} ];
                tex.loaded || tex.once("loaded", this, this._textureLoaded, [ tex, args ]), this._saveToCmd(Render._context._fillTexture, args);
            }
        }, __proto._textureLoaded = function(tex, param) {
            param[3] = param[3] || tex.width, param[4] = param[4] || tex.height, this._repaint();
        }, __proto.fillCircle = function(x, y, tex, cx, cy, radius, segNum) {
            tex.bitmap.enableMerageInAtlas = !1;
            var verts = new Float32Array(2 * (segNum + 1)), uvs = new Float32Array(2 * (segNum + 1)), indices = new Uint16Array(3 * segNum), dang = 2 * Math.PI / segNum, cang = 0;
            verts[0] = cx, verts[1] = cy, uvs[0] = cx / tex.width, uvs[1] = cy / tex.height;
            for (var idx = 2, i = 0; i < segNum; i++) {
                var px = radius * Math.cos(cang) + cx, py = radius * Math.sin(cang) + cy;
                verts[idx] = px, verts[idx + 1] = py, uvs[idx] = px / tex.width, uvs[idx + 1] = py / tex.height, 
                cang += dang, idx += 2;
            }
            for (i = idx = 0; i < segNum; i++) indices[idx++] = 0, indices[idx++] = i + 1, indices[idx++] = segNum + 1 <= i + 2 ? 1 : i + 2;
            this.drawTriangles(tex, x, y, verts, uvs, indices);
        }, __proto.drawTriangles = function(texture, x, y, vertices, uvs, indices, matrix, alpha, color, blendMode) {
            void 0 === alpha && (alpha = 1), this._saveToCmd(Render._context.drawTriangles, [ texture, x, y, vertices, uvs, indices, matrix, alpha, color, blendMode ]);
        }, __proto._saveToCmd = function(fun, args) {
            return this._sp && (this._sp._renderType |= 512), null == this._one ? (this._one = args, 
            this._render = this._renderOne) : (this._sp && (this._sp._renderType &= -2), this._render = this._renderAll, 
            0 === (this._cmds || (this._cmds = [])).length && this._cmds.push(this._one), this._cmds.push(args)), 
            args.callee = fun, this._repaint(), args;
        }, __proto.clipRect = function(x, y, width, height) {
            this._saveToCmd(Render._context._clipRect, [ x, y, width, height ]);
        }, __proto.fillText = function(text, x, y, font, color, textAlign, underLine) {
            void 0 === underLine && (underLine = 0), this._saveToCmd(Render._context._fillText, [ text, x, y, font || Font.defaultFont, color, textAlign ]);
        }, __proto.fillBorderText = function(text, x, y, font, fillColor, borderColor, lineWidth, textAlign) {
            this._saveToCmd(Render._context._fillBorderText, [ text, x, y, font || Font.defaultFont, fillColor, borderColor, lineWidth, textAlign ]);
        }, __proto.strokeText = function(text, x, y, font, color, lineWidth, textAlign) {
            this._saveToCmd(Render._context._strokeText, [ text, x, y, font || Font.defaultFont, color, lineWidth, textAlign ]);
        }, __proto.alpha = function(value) {
            value = value < 0 ? 0 : 1 < value ? 1 : value, this._saveToCmd(Render._context._alpha, [ value ]);
        }, __proto.setAlpha = function(value) {
            value = value < 0 ? 0 : 1 < value ? 1 : value, this._saveToCmd(Render._context._setAlpha, [ value ]);
        }, __proto.transform = function(matrix, pivotX, pivotY) {
            void 0 === pivotX && (pivotX = 0), void 0 === pivotY && (pivotY = 0), this._saveToCmd(Render._context._transform, [ matrix, pivotX, pivotY ]);
        }, __proto.rotate = function(angle, pivotX, pivotY) {
            void 0 === pivotX && (pivotX = 0), void 0 === pivotY && (pivotY = 0), this._saveToCmd(Render._context._rotate, [ angle, pivotX, pivotY ]);
        }, __proto.scale = function(scaleX, scaleY, pivotX, pivotY) {
            void 0 === pivotX && (pivotX = 0), void 0 === pivotY && (pivotY = 0), this._saveToCmd(Render._context._scale, [ scaleX, scaleY, pivotX, pivotY ]);
        }, __proto.translate = function(x, y) {
            this._saveToCmd(Render._context._translate, [ x, y ]);
        }, __proto.save = function() {
            this._saveToCmd(Render._context._save, []);
        }, __proto.restore = function() {
            this._saveToCmd(Render._context._restore, []);
        }, __proto.replaceText = function(text) {
            this._repaint();
            var cmds = this._cmds;
            if (cmds) {
                for (var i = cmds.length - 1; -1 < i; i--) if (this._isTextCmd(cmds[i].callee)) return cmds[i][0].toUpperCase ? cmds[i][0] = text : cmds[i][0].setText(text), 
                !0;
            } else if (this._one && this._isTextCmd(this._one.callee)) return this._one[0].toUpperCase ? this._one[0] = text : this._one[0].setText(text), 
            !0;
            return !1;
        }, __proto._isTextCmd = function(fun) {
            return fun === Render._context._fillText || fun === Render._context._fillBorderText || fun === Render._context._strokeText;
        }, __proto.replaceTextColor = function(color) {
            this._repaint();
            var cmds = this._cmds;
            if (cmds) for (var i = cmds.length - 1; -1 < i; i--) this._isTextCmd(cmds[i].callee) && (cmds[i][4] = color, 
            cmds[i][0].toUpperCase || (cmds[i][0].changed = !0)); else this._one && this._isTextCmd(this._one.callee) && (this._one[4] = color, 
            this._one[0].toUpperCase || (this._one[0].changed = !0));
        }, __proto.loadImage = function(url, x, y, width, height, complete) {
            var _$this = this;
            void 0 === x && (x = 0), void 0 === y && (y = 0), void 0 === width && (width = 0), 
            void 0 === height && (height = 0);
            var tex = Loader.getRes(url);
            function onloaded(tex) {
                tex && (_$this.drawTexture(tex, x, y, width, height), null != complete && complete.call(_$this._sp, tex));
            }
            tex ? onloaded(tex) : Laya.loader.load(url, Handler.create(null, onloaded), null, "image");
        }, __proto._renderEmpty = function(sprite, context, x, y) {}, __proto._renderAll = function(sprite, context, x, y) {
            for (var cmd, cmds = this._cmds, i = 0, n = cmds.length; i < n; i++) (cmd = cmds[i]).callee.call(context, x, y, cmd);
        }, __proto._renderOne = function(sprite, context, x, y) {
            this._one.callee.call(context, x, y, this._one);
        }, __proto._renderOneImg = function(sprite, context, x, y) {
            this._one.callee.call(context, x, y, this._one), 2305 !== sprite._renderType && (sprite._renderType |= 1);
        }, __proto.drawLine = function(fromX, fromY, toX, toY, lineColor, lineWidth) {
            void 0 === lineWidth && (lineWidth = 1);
            var tId = 0;
            Render.isWebGL && (tId = VectorGraphManager.getInstance().getId(), null == this._vectorgraphArray && (this._vectorgraphArray = []), 
            this._vectorgraphArray.push(tId));
            var offset = lineWidth % 2 == 0 ? 0 : .5, arr = [ fromX + offset, fromY + offset, toX + offset, toY + offset, lineColor, lineWidth, tId ];
            this._saveToCmd(Render._context._drawLine, arr);
        }, __proto.drawLines = function(x, y, points, lineColor, lineWidth) {
            void 0 === lineWidth && (lineWidth = 1);
            var tId = 0;
            if (points && !(points.length < 4)) {
                Render.isWebGL && (tId = VectorGraphManager.getInstance().getId(), null == this._vectorgraphArray && (this._vectorgraphArray = []), 
                this._vectorgraphArray.push(tId));
                var offset = lineWidth % 2 == 0 ? 0 : .5, arr = [ x + offset, y + offset, points, lineColor, lineWidth, tId ];
                this._saveToCmd(Render._context._drawLines, arr);
            }
        }, __proto.drawCurves = function(x, y, points, lineColor, lineWidth) {
            void 0 === lineWidth && (lineWidth = 1);
            var arr = [ x, y, points, lineColor, lineWidth ];
            this._saveToCmd(Render._context._drawCurves, arr);
        }, __proto.drawRect = function(x, y, width, height, fillColor, lineColor, lineWidth) {
            void 0 === lineWidth && (lineWidth = 1);
            var offset = lineColor ? lineWidth / 2 : 0, lineOffset = lineColor ? lineWidth : 0, arr = [ x + offset, y + offset, width - lineOffset, height - lineOffset, fillColor, lineColor, lineWidth ];
            this._saveToCmd(Render._context._drawRect, arr);
        }, __proto.drawCircle = function(x, y, radius, fillColor, lineColor, lineWidth) {
            void 0 === lineWidth && (lineWidth = 1);
            var offset = lineColor ? lineWidth / 2 : 0, tId = 0;
            Render.isWebGL && (tId = VectorGraphManager.getInstance().getId(), null == this._vectorgraphArray && (this._vectorgraphArray = []), 
            this._vectorgraphArray.push(tId));
            var arr = [ x, y, radius - offset, fillColor, lineColor, lineWidth, tId ];
            this._saveToCmd(Render._context._drawCircle, arr);
        }, __proto.drawPie = function(x, y, radius, startAngle, endAngle, fillColor, lineColor, lineWidth) {
            void 0 === lineWidth && (lineWidth = 1);
            var offset = lineColor ? lineWidth / 2 : 0, lineOffset = lineColor ? lineWidth : 0, tId = 0;
            Render.isWebGL && (tId = VectorGraphManager.getInstance().getId(), null == this._vectorgraphArray && (this._vectorgraphArray = []), 
            this._vectorgraphArray.push(tId));
            var arr = [ x + offset, y + offset, radius - lineOffset, startAngle, endAngle, fillColor, lineColor, lineWidth, tId ];
            arr[3] = Utils.toRadian(startAngle), arr[4] = Utils.toRadian(endAngle), this._saveToCmd(Render._context._drawPie, arr);
        }, __proto.drawPoly = function(x, y, points, fillColor, lineColor, lineWidth) {
            void 0 === lineWidth && (lineWidth = 1);
            var tId = 0, tIsConvexPolygon = !1;
            Render.isWebGL && (tId = VectorGraphManager.getInstance().getId(), null == this._vectorgraphArray && (this._vectorgraphArray = []), 
            this._vectorgraphArray.push(tId), tIsConvexPolygon = !(6 < points.length));
            var offset = lineColor ? lineWidth % 2 == 0 ? 0 : .5 : 0, arr = [ x + offset, y + offset, points, fillColor, lineColor, lineWidth, tId, tIsConvexPolygon ];
            this._saveToCmd(Render._context._drawPoly, arr);
        }, __proto.drawPath = function(x, y, paths, brush, pen) {
            var arr = [ x, y, paths, brush, pen ];
            this._saveToCmd(Render._context._drawPath, arr);
        }, __getset(0, __proto, "cmds", function() {
            return this._cmds;
        }, function(value) {
            this._sp && (this._sp._renderType |= 512), this._cmds = value, this._render = this._renderAll, 
            this._repaint();
        }), Graphics.__init__ = function() {
            if (Render.isConchNode) {
                for (var from = laya.display.Graphics.prototype, to = Browser.window.ConchGraphics.prototype, list = [ "clear", "destroy", "alpha", "rotate", "transform", "scale", "translate", "save", "restore", "clipRect", "blendMode", "fillText", "fillBorderText", "_fands", "drawRect", "drawCircle", "drawPie", "drawPoly", "drawPath", "drawImageM", "drawLine", "drawLines", "_drawPs", "drawCurves", "replaceText", "replaceTextColor", "_fillImage", "fillTexture", "setSkinMesh", "drawParticle", "drawImageS" ], i = 0, len = list.length; i <= len; i++) {
                    var temp = list[i];
                    from[temp] = to[temp];
                }
                from._saveToCmd = null, to.drawImageS && (from.drawTextures = function(tex, pos) {
                    if (tex && tex.loaded && tex.bitmap && tex.source) {
                        var uv = tex.uv, w = tex.bitmap.width, h = tex.bitmap.height;
                        this.drawImageS(tex.bitmap.source, uv[0] * w, uv[1] * h, (uv[2] - uv[0]) * w, (uv[5] - uv[3]) * h, tex.offsetX, tex.offsetY, tex.width, tex.height, pos);
                    }
                }), from.drawTexture = function(tex, x, y, width, height, m, alpha) {
                    if (void 0 === x && (x = 0), void 0 === y && (y = 0), void 0 === width && (width = 0), 
                    void 0 === height && (height = 0), void 0 === alpha && (alpha = 1), tex) if (tex.loaded) {
                        if (tex.loaded && tex.bitmap && tex.source && (width || (width = tex.sourceWidth), 
                        height || (height = tex.sourceHeight), alpha = alpha < 0 ? 0 : 1 < alpha ? 1 : alpha, 
                        width = width - tex.sourceWidth + tex.width, height = height - tex.sourceHeight + tex.height, 
                        !(width <= 0 || height <= 0))) {
                            x += tex.offsetX, y += tex.offsetY;
                            var uv = tex.uv, w = tex.bitmap.width, h = tex.bitmap.height;
                            uv[4] < uv[0] && uv[5] < uv[1] ? this.drawImageM(tex.bitmap.source, uv[4] * w, uv[5] * h, (uv[0] - uv[4]) * w, (uv[1] - uv[5]) * h, x, y, width, height, m, alpha) : this.drawImageM(tex.bitmap.source, uv[0] * w, uv[1] * h, (uv[2] - uv[0]) * w, (uv[5] - uv[3]) * h, x, y, width, height, m, alpha), 
                            this._repaint();
                        }
                    } else tex.once("loaded", this, function() {
                        this.drawTexture(tex, x, y, width, height, m);
                    });
                }, from.fillTexture = function(tex, x, y, width, height, type, offset) {
                    if (void 0 === width && (width = 0), void 0 === height && (height = 0), void 0 === type && (type = "repeat"), 
                    tex && tex.loaded) {
                        var pat, ctxi = Render._context.ctx, w = tex.bitmap.width, h = tex.bitmap.height, uv = tex.uv;
                        pat = tex.uv != Texture.DEF_UV ? ctxi.createPattern(tex.bitmap.source, type, uv[0] * w, uv[1] * h, (uv[2] - uv[0]) * w, (uv[5] - uv[3]) * h) : ctxi.createPattern(tex.bitmap.source, type);
                        var sX = 0, sY = 0;
                        offset && (x += offset.x % tex.width, y += offset.y % tex.height, sX -= offset.x % tex.width, 
                        sY -= offset.y % tex.height), this._fillImage(pat, x, y, sX, sY, width, height);
                    }
                };
            }
        }, Graphics._cache = [], Graphics;
    }(), GraphicsBounds = function() {
        function GraphicsBounds() {
            this._cacheBoundsType = !1;
        }
        __class(GraphicsBounds, "laya.display.GraphicsBounds");
        var __proto = GraphicsBounds.prototype;
        return __proto.destroy = function() {
            this._graphics = null, this._temp = null, this._rstBoundPoints = null, this._bounds = null;
        }, __proto.reset = function() {
            this._temp && (this._temp.length = 0);
        }, __proto.getBounds = function(realSize) {
            return void 0 === realSize && (realSize = !1), (!this._bounds || !this._temp || this._temp.length < 1 || realSize != this._cacheBoundsType) && (this._bounds = Rectangle._getWrapRec(this.getBoundPoints(realSize), this._bounds)), 
            this._cacheBoundsType = realSize, this._bounds;
        }, __proto.getBoundPoints = function(realSize) {
            return void 0 === realSize && (realSize = !1), (!this._temp || this._temp.length < 1 || realSize != this._cacheBoundsType) && (this._temp = this._getCmdPoints(realSize)), 
            this._cacheBoundsType = realSize, this._rstBoundPoints = Utils.copyArray(this._rstBoundPoints, this._temp);
        }, __proto._getCmdPoints = function(realSize) {
            void 0 === realSize && (realSize = !1);
            var rst, matrixs, context = Render._context, cmds = this._graphics.cmds;
            if ((rst = this._temp || (this._temp = [])).length = 0, cmds || null == this._graphics._one || (GraphicsBounds._tempCmds.length = 0, 
            GraphicsBounds._tempCmds.push(this._graphics._one), cmds = GraphicsBounds._tempCmds), 
            !cmds) return rst;
            (matrixs = GraphicsBounds._tempMatrixArrays).length = 0;
            var tMatrix = GraphicsBounds._initMatrix;
            tMatrix.identity();
            for (var cmd, tex, tempMatrix = GraphicsBounds._tempMatrix, wRate = NaN, hRate = NaN, oWidth = NaN, oHeight = NaN, offX = NaN, offY = NaN, i = 0, n = cmds.length; i < n; i++) if ((cmd = cmds[i]).callee) switch (cmd.callee) {
              case context._save:
              case 7:
                matrixs.push(tMatrix), tMatrix = tMatrix.clone();
                break;

              case context._restore:
              case 8:
                tMatrix = matrixs.pop();
                break;

              case context._scale:
              case 5:
                tempMatrix.identity(), tempMatrix.translate(-cmd[2], -cmd[3]), tempMatrix.scale(cmd[0], cmd[1]), 
                tempMatrix.translate(cmd[2], cmd[3]), this._switchMatrix(tMatrix, tempMatrix);
                break;

              case context._rotate:
              case 3:
                tempMatrix.identity(), tempMatrix.translate(-cmd[1], -cmd[2]), tempMatrix.rotate(cmd[0]), 
                tempMatrix.translate(cmd[1], cmd[2]), this._switchMatrix(tMatrix, tempMatrix);
                break;

              case context._translate:
              case 6:
                tempMatrix.identity(), tempMatrix.translate(cmd[0], cmd[1]), this._switchMatrix(tMatrix, tempMatrix);
                break;

              case context._transform:
              case 4:
                tempMatrix.identity(), tempMatrix.translate(-cmd[1], -cmd[2]), tempMatrix.concat(cmd[0]), 
                tempMatrix.translate(cmd[1], cmd[2]), this._switchMatrix(tMatrix, tempMatrix);
                break;

              case 16:
              case 24:
                GraphicsBounds._addPointArrToRst(rst, Rectangle._getBoundPointS(cmd[0], cmd[1], cmd[2], cmd[3]), tMatrix);
                break;

              case 17:
                tMatrix.copyTo(tempMatrix), tempMatrix.concat(cmd[4]), GraphicsBounds._addPointArrToRst(rst, Rectangle._getBoundPointS(cmd[0], cmd[1], cmd[2], cmd[3]), tempMatrix);
                break;

              case context._drawTexture:
                tex = cmd[0], realSize ? cmd[3] && cmd[4] ? GraphicsBounds._addPointArrToRst(rst, Rectangle._getBoundPointS(cmd[1], cmd[2], cmd[3], cmd[4]), tMatrix) : (tex = cmd[0], 
                GraphicsBounds._addPointArrToRst(rst, Rectangle._getBoundPointS(cmd[1], cmd[2], tex.width, tex.height), tMatrix)) : (wRate = (cmd[3] || tex.sourceWidth) / tex.width, 
                hRate = (cmd[4] || tex.sourceHeight) / tex.height, oWidth = wRate * tex.sourceWidth, 
                oHeight = hRate * tex.sourceHeight, offX = 0 < tex.offsetX ? tex.offsetX : 0, offY = 0 < tex.offsetY ? tex.offsetY : 0, 
                offX *= wRate, offY *= hRate, GraphicsBounds._addPointArrToRst(rst, Rectangle._getBoundPointS(cmd[1] - offX, cmd[2] - offY, oWidth, oHeight), tMatrix));
                break;

              case context._fillTexture:
                cmd[3] && cmd[4] ? GraphicsBounds._addPointArrToRst(rst, Rectangle._getBoundPointS(cmd[1], cmd[2], cmd[3], cmd[4]), tMatrix) : (tex = cmd[0], 
                GraphicsBounds._addPointArrToRst(rst, Rectangle._getBoundPointS(cmd[1], cmd[2], tex.width, tex.height), tMatrix));
                break;

              case context._drawTextureWithTransform:
                var drawMatrix;
                drawMatrix = cmd[5] ? (tMatrix.copyTo(tempMatrix), tempMatrix.concat(cmd[5]), tempMatrix) : tMatrix, 
                realSize ? cmd[3] && cmd[4] ? GraphicsBounds._addPointArrToRst(rst, Rectangle._getBoundPointS(cmd[1], cmd[2], cmd[3], cmd[4]), drawMatrix) : (tex = cmd[0], 
                GraphicsBounds._addPointArrToRst(rst, Rectangle._getBoundPointS(cmd[1], cmd[2], tex.width, tex.height), drawMatrix)) : (tex = cmd[0], 
                wRate = (cmd[3] || tex.sourceWidth) / tex.width, hRate = (cmd[4] || tex.sourceHeight) / tex.height, 
                oWidth = wRate * tex.sourceWidth, oHeight = hRate * tex.sourceHeight, offX = 0 < tex.offsetX ? tex.offsetX : 0, 
                offY = 0 < tex.offsetY ? tex.offsetY : 0, offX *= wRate, offY *= hRate, GraphicsBounds._addPointArrToRst(rst, Rectangle._getBoundPointS(cmd[1] - offX, cmd[2] - offY, oWidth, oHeight), drawMatrix));
                break;

              case context._drawRect:
              case 13:
                GraphicsBounds._addPointArrToRst(rst, Rectangle._getBoundPointS(cmd[0], cmd[1], cmd[2], cmd[3]), tMatrix);
                break;

              case context._drawCircle:
              case context._fillCircle:
              case 14:
                GraphicsBounds._addPointArrToRst(rst, Rectangle._getBoundPointS(cmd[0] - cmd[2], cmd[1] - cmd[2], cmd[2] + cmd[2], cmd[2] + cmd[2]), tMatrix);
                break;

              case context._drawLine:
              case 20:
                GraphicsBounds._tempPoints.length = 0;
                var lineWidth;
                lineWidth = .5 * cmd[5], cmd[0] == cmd[2] ? GraphicsBounds._tempPoints.push(cmd[0] + lineWidth, cmd[1], cmd[2] + lineWidth, cmd[3], cmd[0] - lineWidth, cmd[1], cmd[2] - lineWidth, cmd[3]) : cmd[1] == cmd[3] ? GraphicsBounds._tempPoints.push(cmd[0], cmd[1] + lineWidth, cmd[2], cmd[3] + lineWidth, cmd[0], cmd[1] - lineWidth, cmd[2], cmd[3] - lineWidth) : GraphicsBounds._tempPoints.push(cmd[0], cmd[1], cmd[2], cmd[3]), 
                GraphicsBounds._addPointArrToRst(rst, GraphicsBounds._tempPoints, tMatrix);
                break;

              case context._drawCurves:
              case 22:
                GraphicsBounds._addPointArrToRst(rst, Bezier.I.getBezierPoints(cmd[2]), tMatrix, cmd[0], cmd[1]);
                break;

              case context._drawPoly:
              case context._drawLines:
              case 18:
                GraphicsBounds._addPointArrToRst(rst, cmd[2], tMatrix, cmd[0], cmd[1]);
                break;

              case context._drawPath:
              case 19:
                GraphicsBounds._addPointArrToRst(rst, this._getPathPoints(cmd[2]), tMatrix, cmd[0], cmd[1]);
                break;

              case context._drawPie:
              case 15:
                GraphicsBounds._addPointArrToRst(rst, this._getPiePoints(cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]), tMatrix);
            }
            return 200 < rst.length ? rst = Utils.copyArray(rst, Rectangle._getWrapRec(rst)._getBoundPoints()) : 8 < rst.length && (rst = GrahamScan.scanPList(rst)), 
            rst;
        }, __proto._switchMatrix = function(tMatix, tempMatrix) {
            tempMatrix.concat(tMatix), tempMatrix.copyTo(tMatix);
        }, __proto._getPiePoints = function(x, y, radius, startAngle, endAngle) {
            var rst = GraphicsBounds._tempPoints;
            GraphicsBounds._tempPoints.length = 0, rst.push(x, y);
            var step = (endAngle - startAngle) % (2 * Math.PI) / 10, i = NaN, angle = startAngle;
            for (i = 0; i <= 10; i++) rst.push(x + radius * Math.cos(angle), y + radius * Math.sin(angle)), 
            angle += step;
            return rst;
        }, __proto._getPathPoints = function(paths) {
            var len, tCMD, i = 0, rst = GraphicsBounds._tempPoints;
            for (rst.length = 0, len = paths.length, i = 0; i < len; i++) 1 < (tCMD = paths[i]).length && (rst.push(tCMD[1], tCMD[2]), 
            3 < tCMD.length && rst.push(tCMD[3], tCMD[4]));
            return rst;
        }, GraphicsBounds._addPointArrToRst = function(rst, points, matrix, dx, dy) {
            void 0 === dx && (dx = 0), void 0 === dy && (dy = 0);
            var len, i = 0;
            for (len = points.length, i = 0; i < len; i += 2) GraphicsBounds._addPointToRst(rst, points[i] + dx, points[i + 1] + dy, matrix);
        }, GraphicsBounds._addPointToRst = function(rst, x, y, matrix) {
            var _tempPoint = Point.TEMP;
            _tempPoint.setTo(x || 0, y || 0), matrix.transformPoint(_tempPoint), rst.push(_tempPoint.x, _tempPoint.y);
        }, GraphicsBounds._tempPoints = [], GraphicsBounds._tempMatrixArrays = [], GraphicsBounds._tempCmds = [], 
        __static(GraphicsBounds, [ "_tempMatrix", function() {
            return this._tempMatrix = new Matrix();
        }, "_initMatrix", function() {
            return this._initMatrix = new Matrix();
        } ]), GraphicsBounds;
    }(), Event = function() {
        function Event() {}
        __class(Event, "laya.events.Event");
        var __proto = Event.prototype;
        return __proto.setTo = function(type, currentTarget, target) {
            return this.type = type, this.currentTarget = currentTarget, this.target = target, 
            this;
        }, __proto.stopPropagation = function() {
            this._stoped = !0;
        }, __getset(0, __proto, "stageY", function() {
            return Laya.stage.mouseY;
        }), __getset(0, __proto, "charCode", function() {
            return this.nativeEvent.charCode;
        }), __getset(0, __proto, "touches", function() {
            var arr = this.nativeEvent.touches;
            if (arr) for (var stage = Laya.stage, i = 0, n = arr.length; i < n; i++) {
                var e = arr[i], point = Point.TEMP;
                point.setTo(e.clientX, e.clientY), stage._canvasTransform.invertTransformPoint(point), 
                stage.transform.invertTransformPoint(point), e.stageX = point.x, e.stageY = point.y;
            }
            return arr;
        }), __getset(0, __proto, "keyLocation", function() {
            return this.nativeEvent.keyLocation;
        }), __getset(0, __proto, "ctrlKey", function() {
            return this.nativeEvent.ctrlKey;
        }), __getset(0, __proto, "altKey", function() {
            return this.nativeEvent.altKey;
        }), __getset(0, __proto, "shiftKey", function() {
            return this.nativeEvent.shiftKey;
        }), __getset(0, __proto, "stageX", function() {
            return Laya.stage.mouseX;
        }), Event.EMPTY = new Event(), Event.MOUSE_DOWN = "mousedown", Event.MOUSE_UP = "mouseup", 
        Event.CLICK = "click", Event.RIGHT_MOUSE_DOWN = "rightmousedown", Event.RIGHT_MOUSE_UP = "rightmouseup", 
        Event.RIGHT_CLICK = "rightclick", Event.MOUSE_MOVE = "mousemove", Event.MOUSE_OVER = "mouseover", 
        Event.MOUSE_OUT = "mouseout", Event.MOUSE_WHEEL = "mousewheel", Event.ROLL_OVER = "mouseover", 
        Event.ROLL_OUT = "mouseout", Event.DOUBLE_CLICK = "doubleclick", Event.CHANGE = "change", 
        Event.CHANGED = "changed", Event.RESIZE = "resize", Event.ADDED = "added", Event.REMOVED = "removed", 
        Event.DISPLAY = "display", Event.UNDISPLAY = "undisplay", Event.ERROR = "error", 
        Event.COMPLETE = "complete", Event.LOADED = "loaded", Event.PROGRESS = "progress", 
        Event.INPUT = "input", Event.RENDER = "render", Event.OPEN = "open", Event.MESSAGE = "message", 
        Event.CLOSE = "close", Event.KEY_DOWN = "keydown", Event.KEY_PRESS = "keypress", 
        Event.KEY_UP = "keyup", Event.FRAME = "enterframe", Event.DRAG_START = "dragstart", 
        Event.DRAG_MOVE = "dragmove", Event.DRAG_END = "dragend", Event.ENTER = "enter", 
        Event.SELECT = "select", Event.BLUR = "blur", Event.FOCUS = "focus", Event.VISIBILITY_CHANGE = "visibilitychange", 
        Event.FOCUS_CHANGE = "focuschange", Event.PLAYED = "played", Event.PAUSED = "paused", 
        Event.STOPPED = "stopped", Event.START = "start", Event.END = "end", Event.ENABLE_CHANGED = "enablechanged", 
        Event.ACTIVE_IN_HIERARCHY_CHANGED = "activeinhierarchychanged", Event.COMPONENT_ADDED = "componentadded", 
        Event.COMPONENT_REMOVED = "componentremoved", Event.LAYER_CHANGED = "layerchanged", 
        Event.HIERARCHY_LOADED = "hierarchyloaded", Event.RECOVERED = "recovered", Event.RELEASED = "released", 
        Event.LINK = "link", Event.LABEL = "label", Event.FULL_SCREEN_CHANGE = "fullscreenchange", 
        Event.DEVICE_LOST = "devicelost", Event.MESH_CHANGED = "meshchanged", Event.MATERIAL_CHANGED = "materialchanged", 
        Event.WORLDMATRIX_NEEDCHANGE = "worldmatrixneedchanged", Event.ANIMATION_CHANGED = "animationchanged", 
        Event.TRIGGER_ENTER = "triggerenter", Event.TRIGGER_STAY = "triggerstay", Event.TRIGGER_EXIT = "triggerexit", 
        Event.TRAIL_FILTER_CHANGE = "trailfilterchange", Event.DOMINO_FILTER_CHANGE = "dominofilterchange", 
        Event;
    }(), KeyBoardManager = (function() {
        function Keyboard() {}
        __class(Keyboard, "laya.events.Keyboard"), Keyboard.NUMBER_0 = 48, Keyboard.NUMBER_1 = 49, 
        Keyboard.NUMBER_2 = 50, Keyboard.NUMBER_3 = 51, Keyboard.NUMBER_4 = 52, Keyboard.NUMBER_5 = 53, 
        Keyboard.NUMBER_6 = 54, Keyboard.NUMBER_7 = 55, Keyboard.NUMBER_8 = 56, Keyboard.NUMBER_9 = 57, 
        Keyboard.A = 65, Keyboard.B = 66, Keyboard.C = 67, Keyboard.D = 68, Keyboard.E = 69, 
        Keyboard.F = 70, Keyboard.G = 71, Keyboard.H = 72, Keyboard.I = 73, Keyboard.J = 74, 
        Keyboard.K = 75, Keyboard.L = 76, Keyboard.M = 77, Keyboard.N = 78, Keyboard.O = 79, 
        Keyboard.P = 80, Keyboard.Q = 81, Keyboard.R = 82, Keyboard.S = 83, Keyboard.T = 84, 
        Keyboard.U = 85, Keyboard.V = 86, Keyboard.W = 87, Keyboard.X = 88, Keyboard.Y = 89, 
        Keyboard.Z = 90, Keyboard.F1 = 112, Keyboard.F2 = 113, Keyboard.F3 = 114, Keyboard.F4 = 115, 
        Keyboard.F5 = 116, Keyboard.F6 = 117, Keyboard.F7 = 118, Keyboard.F8 = 119, Keyboard.F9 = 120, 
        Keyboard.F10 = 121, Keyboard.F11 = 122, Keyboard.F12 = 123, Keyboard.F13 = 124, 
        Keyboard.F14 = 125, Keyboard.F15 = 126, Keyboard.NUMPAD = 21, Keyboard.NUMPAD_0 = 96, 
        Keyboard.NUMPAD_1 = 97, Keyboard.NUMPAD_2 = 98, Keyboard.NUMPAD_3 = 99, Keyboard.NUMPAD_4 = 100, 
        Keyboard.NUMPAD_5 = 101, Keyboard.NUMPAD_6 = 102, Keyboard.NUMPAD_7 = 103, Keyboard.NUMPAD_8 = 104, 
        Keyboard.NUMPAD_9 = 105, Keyboard.NUMPAD_ADD = 107, Keyboard.NUMPAD_DECIMAL = 110, 
        Keyboard.NUMPAD_DIVIDE = 111, Keyboard.NUMPAD_ENTER = 108, Keyboard.NUMPAD_MULTIPLY = 106, 
        Keyboard.NUMPAD_SUBTRACT = 109, Keyboard.SEMICOLON = 186, Keyboard.EQUAL = 187, 
        Keyboard.COMMA = 188, Keyboard.MINUS = 189, Keyboard.PERIOD = 190, Keyboard.SLASH = 191, 
        Keyboard.BACKQUOTE = 192, Keyboard.LEFTBRACKET = 219, Keyboard.BACKSLASH = 220, 
        Keyboard.RIGHTBRACKET = 221, Keyboard.QUOTE = 222, Keyboard.ALTERNATE = 18, Keyboard.BACKSPACE = 8, 
        Keyboard.CAPS_LOCK = 20, Keyboard.COMMAND = 15, Keyboard.CONTROL = 17, Keyboard.DELETE = 46, 
        Keyboard.ENTER = 13, Keyboard.ESCAPE = 27, Keyboard.PAGE_UP = 33, Keyboard.PAGE_DOWN = 34, 
        Keyboard.END = 35, Keyboard.HOME = 36, Keyboard.LEFT = 37, Keyboard.UP = 38, Keyboard.RIGHT = 39, 
        Keyboard.DOWN = 40, Keyboard.SHIFT = 16, Keyboard.SPACE = 32, Keyboard.TAB = 9, 
        Keyboard.INSERT = 45;
    }(), function() {
        function KeyBoardManager() {}
        return __class(KeyBoardManager, "laya.events.KeyBoardManager"), KeyBoardManager.__init__ = function() {
            KeyBoardManager._addEvent("keydown"), KeyBoardManager._addEvent("keypress"), KeyBoardManager._addEvent("keyup");
        }, KeyBoardManager._addEvent = function(type) {
            Browser.document.addEventListener(type, function(e) {
                laya.events.KeyBoardManager._dispatch(e, type);
            }, !0);
        }, KeyBoardManager._dispatch = function(e, type) {
            if (KeyBoardManager.enabled) {
                KeyBoardManager._event._stoped = !1, KeyBoardManager._event.nativeEvent = e, KeyBoardManager._event.keyCode = e.keyCode || e.which || e.charCode, 
                "keydown" === type ? KeyBoardManager._pressKeys[KeyBoardManager._event.keyCode] = !0 : "keyup" === type && (KeyBoardManager._pressKeys[KeyBoardManager._event.keyCode] = null);
                for (var target = Laya.stage.focus && null != Laya.stage.focus.event && Laya.stage.focus.displayedInStage ? Laya.stage.focus : Laya.stage, ct = target; ct; ) ct.event(type, KeyBoardManager._event.setTo(type, ct, target)), 
                ct = ct.parent;
            }
        }, KeyBoardManager.hasKeyDown = function(key) {
            return KeyBoardManager._pressKeys[key];
        }, KeyBoardManager._pressKeys = {}, KeyBoardManager.enabled = !0, __static(KeyBoardManager, [ "_event", function() {
            return this._event = new Event();
        } ]), KeyBoardManager;
    }()), MouseManager = (function() {
        function KeyLocation() {}
        __class(KeyLocation, "laya.events.KeyLocation"), KeyLocation.STANDARD = 0, KeyLocation.LEFT = 1, 
        KeyLocation.RIGHT = 2, KeyLocation.NUM_PAD = 3;
    }(), function() {
        function MouseManager() {
            this.mouseX = 0, this.mouseY = 0, this.disableMouseEvent = !1, this.mouseDownTime = 0, 
            this.mouseMoveAccuracy = 2, this._stage = null, this._target = null, this._lastMoveTimer = 0, 
            this._isLeftMouse = !1, this._eventList = [], this._touchIDs = {}, this._id = 1, 
            this._tTouchID = 0, this._event = new Event(), this._matrix = new Matrix(), this._point = new Point(), 
            this._rect = new Rectangle(), this._prePoint = new Point(), this._curTouchID = NaN;
        }
        __class(MouseManager, "laya.events.MouseManager");
        var __proto = MouseManager.prototype;
        return __proto.__init__ = function(stage, canvas) {
            var _$this = this;
            this._stage = stage;
            var _this = this, list = this._eventList;
            canvas.oncontextmenu = function(e) {
                if (MouseManager.enabled) return !1;
            }, canvas.addEventListener("mousedown", function(e) {
                MouseManager.enabled && (Browser.onIE || e.preventDefault(), list.push(e), _this.mouseDownTime = Browser.now());
            }), canvas.addEventListener("mouseup", function(e) {
                MouseManager.enabled && (e.preventDefault(), list.push(e), _this.mouseDownTime = -Browser.now());
            }, !0), canvas.addEventListener("mousemove", function(e) {
                if (MouseManager.enabled) {
                    e.preventDefault();
                    var now = Browser.now();
                    if (now - _this._lastMoveTimer < 10) return;
                    _this._lastMoveTimer = now, list.push(e);
                }
            }, !0), canvas.addEventListener("mouseout", function(e) {
                MouseManager.enabled && list.push(e);
            }), canvas.addEventListener("mouseover", function(e) {
                MouseManager.enabled && list.push(e);
            }), canvas.addEventListener("touchstart", function(e) {
                MouseManager.enabled && (list.push(e), MouseManager._isFirstTouch || Input.isInputting || e.preventDefault(), 
                _this.mouseDownTime = Browser.now());
            }), canvas.addEventListener("touchend", function(e) {
                MouseManager.enabled ? (MouseManager._isFirstTouch || Input.isInputting || e.preventDefault(), 
                MouseManager._isFirstTouch = !1, list.push(e), _this.mouseDownTime = -Browser.now()) : _$this._curTouchID = NaN;
            }, !0), canvas.addEventListener("touchmove", function(e) {
                MouseManager.enabled && (e.preventDefault(), list.push(e));
            }, !0), canvas.addEventListener("touchcancel", function(e) {
                MouseManager.enabled ? (e.preventDefault(), list.push(e)) : _$this._curTouchID = NaN;
            }, !0), canvas.addEventListener("mousewheel", function(e) {
                MouseManager.enabled && list.push(e);
            }), canvas.addEventListener("DOMMouseScroll", function(e) {
                MouseManager.enabled && list.push(e);
            });
        }, __proto.initEvent = function(e, nativeEvent) {
            var evt;
            this._event._stoped = !1, this._event.nativeEvent = nativeEvent || e, this._target = null, 
            this._point.setTo(e.pageX || e.clientX, e.pageY || e.clientY), this._stage._canvasTransform.invertTransformPoint(this._point), 
            this.mouseX = this._point.x, this.mouseY = this._point.y, this._event.touchId = e.identifier || 0, 
            this._tTouchID = this._event.touchId, (evt = TouchManager.I._event)._stoped = !1, 
            evt.nativeEvent = this._event.nativeEvent, evt.touchId = this._event.touchId;
        }, __proto.checkMouseWheel = function(e) {
            this._event.delta = e.wheelDelta ? .025 * e.wheelDelta : -e.detail;
            for (var _lastOvers = TouchManager.I.getLastOvers(), i = 0, n = _lastOvers.length; i < n; i++) {
                var ele = _lastOvers[i];
                ele.event("mousewheel", this._event.setTo("mousewheel", ele, this._target));
            }
        }, __proto.onMouseMove = function(ele) {
            TouchManager.I.onMouseMove(ele, this._tTouchID);
        }, __proto.onMouseDown = function(ele) {
            if (Input.isInputting && Laya.stage.focus && Laya.stage.focus.focus && !Laya.stage.focus.contains(this._target)) {
                var pre_input = Laya.stage.focus._tf || Laya.stage.focus, new_input = ele._tf || ele;
                new_input instanceof laya.display.Input && new_input.multiline == pre_input.multiline ? pre_input._focusOut() : pre_input.focus = !1;
            }
            TouchManager.I.onMouseDown(ele, this._tTouchID, this._isLeftMouse);
        }, __proto.onMouseUp = function(ele) {
            TouchManager.I.onMouseUp(ele, this._tTouchID, this._isLeftMouse);
        }, __proto.check = function(sp, mouseX, mouseY, callBack) {
            this._point.setTo(mouseX, mouseY), sp.fromParentPoint(this._point), mouseX = this._point.x, 
            mouseY = this._point.y;
            var scrollRect = sp.scrollRect;
            if (scrollRect && (this._rect.setTo(scrollRect.x, scrollRect.y, scrollRect.width, scrollRect.height), 
            !this._rect.contains(mouseX, mouseY))) return !1;
            if (!this.disableMouseEvent) {
                if (sp.hitTestPrior && !sp.mouseThrough && !this.hitTest(sp, mouseX, mouseY)) return !1;
                for (var i = sp._childs.length - 1; -1 < i; i--) {
                    var child = sp._childs[i];
                    if (!child.destroyed && child.mouseEnabled && child.visible && this.check(child, mouseX, mouseY, callBack)) return !0;
                }
            }
            var isHit = !(!sp.hitTestPrior || sp.mouseThrough || this.disableMouseEvent) || this.hitTest(sp, mouseX, mouseY);
            return isHit ? (this._target = sp, callBack.call(this, sp)) : callBack === this.onMouseUp && sp === this._stage && (this._target = this._stage, 
            callBack.call(this, this._target)), isHit;
        }, __proto.hitTest = function(sp, mouseX, mouseY) {
            var isHit = !1;
            if (sp.scrollRect && (mouseX -= sp.scrollRect.x, mouseY -= sp.scrollRect.y), sp.hitArea instanceof laya.utils.HitArea) return sp.hitArea.isHit(mouseX, mouseY);
            if (0 < sp.width && 0 < sp.height || sp.mouseThrough || sp.hitArea) if (sp.mouseThrough) isHit = sp.getGraphicBounds().contains(mouseX, mouseY); else {
                var hitRect = this._rect;
                sp.hitArea ? hitRect = sp.hitArea : hitRect.setTo(0, 0, sp.width, sp.height), isHit = hitRect.contains(mouseX, mouseY);
            }
            return isHit;
        }, __proto.runEvent = function() {
            var len = this._eventList.length;
            if (len) {
                var touch, i = 0, j = 0, n = 0;
                try {
                    for (;i < len; ) {
                        var evt = this._eventList[i];
                        switch ("mousemove" !== evt.type && (this._prePoint.x = this._prePoint.y = -1e6), 
                        evt.type) {
                          case "mousedown":
                            this._touchIDs[0] = this._id++, MouseManager._isTouchRespond ? MouseManager._isTouchRespond = !1 : (this._isLeftMouse = 0 === evt.button, 
                            this.initEvent(evt), this.check(this._stage, this.mouseX, this.mouseY, this.onMouseDown));
                            break;

                          case "mouseup":
                            this._isLeftMouse = 0 === evt.button, this.initEvent(evt), this.check(this._stage, this.mouseX, this.mouseY, this.onMouseUp);
                            break;

                          case "mousemove":
                            Math.abs(this._prePoint.x - evt.clientX) + Math.abs(this._prePoint.y - evt.clientY) >= this.mouseMoveAccuracy && (this._prePoint.x = evt.clientX, 
                            this._prePoint.y = evt.clientY, this.initEvent(evt), this.check(this._stage, this.mouseX, this.mouseY, this.onMouseMove));
                            break;

                          case "touchstart":
                            MouseManager._isTouchRespond = !0, this._isLeftMouse = !0;
                            var touches = evt.changedTouches;
                            for (j = 0, n = touches.length; j < n; j++) touch = touches[j], (MouseManager.multiTouchEnabled || isNaN(this._curTouchID)) && (this._curTouchID = touch.identifier, 
                            this._id % 200 == 0 && (this._touchIDs = {}), this._touchIDs[touch.identifier] = this._id++, 
                            this.initEvent(touch, evt), this.check(this._stage, this.mouseX, this.mouseY, this.onMouseDown));
                            break;

                          case "touchend":
                          case "touchcancel":
                            MouseManager._isTouchRespond = !0, this._isLeftMouse = !0;
                            var touchends = evt.changedTouches;
                            for (j = 0, n = touchends.length; j < n; j++) if (touch = touchends[j], MouseManager.multiTouchEnabled || touch.identifier == this._curTouchID) {
                                this._curTouchID = NaN, this.initEvent(touch, evt);
                                this.check(this._stage, this.mouseX, this.mouseY, this.onMouseUp) || this.onMouseUp(null);
                            }
                            break;

                          case "touchmove":
                            var touchemoves = evt.changedTouches;
                            for (j = 0, n = touchemoves.length; j < n; j++) touch = touchemoves[j], (MouseManager.multiTouchEnabled || touch.identifier == this._curTouchID) && (this.initEvent(touch, evt), 
                            this.check(this._stage, this.mouseX, this.mouseY, this.onMouseMove));
                            break;

                          case "wheel":
                          case "mousewheel":
                          case "DOMMouseScroll":
                            this.checkMouseWheel(evt);
                            break;

                          case "mouseout":
                            TouchManager.I.stageMouseOut();
                            break;

                          case "mouseover":
                            this._stage.event("mouseover", this._event.setTo("mouseover", this._stage, this._stage));
                        }
                        i++;
                    }
                } catch (e) {
                    e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                    throw this._eventList.length = 0, e;
                }
                this._eventList.length = 0;
            }
        }, MouseManager.enabled = !0, MouseManager.multiTouchEnabled = !0, MouseManager._isTouchRespond = !1, 
        MouseManager._isFirstTouch = !0, __static(MouseManager, [ "instance", function() {
            return this.instance = new MouseManager();
        } ]), MouseManager;
    }()), TouchManager = function() {
        function TouchManager() {
            this.preOvers = [], this.preDowns = [], this.preRightDowns = [], this.enable = !0, 
            this._lastClickTime = 0, this._event = new Event();
        }
        __class(TouchManager, "laya.events.TouchManager");
        var __proto = TouchManager.prototype;
        return __proto._clearTempArrs = function() {
            TouchManager._oldArr.length = 0, TouchManager._newArr.length = 0, TouchManager._tEleArr.length = 0;
        }, __proto.getTouchFromArr = function(touchID, arr) {
            var len, tTouchO, i = 0;
            for (len = arr.length, i = 0; i < len; i++) if ((tTouchO = arr[i]).id == touchID) return tTouchO;
            return null;
        }, __proto.removeTouchFromArr = function(touchID, arr) {
            var i = 0;
            for (i = arr.length - 1; 0 <= i; i--) arr[i].id == touchID && arr.splice(i, 1);
        }, __proto.createTouchO = function(ele, touchID) {
            var rst;
            return (rst = Pool.getItem("TouchData") || {}).id = touchID, rst.tar = ele, rst;
        }, __proto.onMouseDown = function(ele, touchID, isLeft) {
            var preO, tO, arrs, preDowns;
            (void 0 === isLeft && (isLeft = !1), this.enable) && (preO = this.getTouchFromArr(touchID, this.preOvers), 
            arrs = this.getEles(ele, null, TouchManager._tEleArr), preO ? preO.tar = ele : (tO = this.createTouchO(ele, touchID), 
            this.preOvers.push(tO)), Browser.onMobile && this.sendEvents(arrs, "mouseover", touchID), 
            preDowns = isLeft ? this.preDowns : this.preRightDowns, (preO = this.getTouchFromArr(touchID, preDowns)) ? preO.tar = ele : (tO = this.createTouchO(ele, touchID), 
            preDowns.push(tO)), this.sendEvents(arrs, isLeft ? "mousedown" : "rightmousedown", touchID), 
            this._clearTempArrs());
        }, __proto.sendEvents = function(eles, type, touchID) {
            void 0 === touchID && (touchID = 0);
            var len, _target, tE, i = 0;
            for (len = eles.length, this._event._stoped = !1, _target = eles[0], i = 0; i < len; i++) {
                if ((tE = eles[i]).destroyed) return;
                if (tE.event(type, this._event.setTo(type, tE, _target)), this._event._stoped) break;
            }
        }, __proto.getEles = function(start, end, rst) {
            for (rst ? rst.length = 0 : rst = []; start && start != end; ) rst.push(start), 
            start = start.parent;
            return rst;
        }, __proto.checkMouseOutAndOverOfMove = function(eleNew, elePre, touchID) {
            if (void 0 === touchID && (touchID = 0), elePre != eleNew) {
                var tar, arrs, i = 0, len = 0;
                if (elePre.contains(eleNew)) arrs = this.getEles(eleNew, elePre, TouchManager._tEleArr), 
                this.sendEvents(arrs, "mouseover", touchID); else if (eleNew.contains(elePre)) arrs = this.getEles(elePre, eleNew, TouchManager._tEleArr), 
                this.sendEvents(arrs, "mouseout", touchID); else {
                    var oldArr, newArr;
                    (arrs = TouchManager._tEleArr).length = 0, oldArr = this.getEles(elePre, null, TouchManager._oldArr), 
                    newArr = this.getEles(eleNew, null, TouchManager._newArr), len = oldArr.length;
                    var tIndex = 0;
                    for (i = 0; i < len; i++) {
                        if (tar = oldArr[i], 0 <= (tIndex = newArr.indexOf(tar))) {
                            newArr.splice(tIndex, newArr.length - tIndex);
                            break;
                        }
                        arrs.push(tar);
                    }
                    0 < arrs.length && this.sendEvents(arrs, "mouseout", touchID), 0 < newArr.length && this.sendEvents(newArr, "mouseover", touchID);
                }
            }
        }, __proto.onMouseMove = function(ele, touchID) {
            var preO, arrs;
            this.enable && ((preO = this.getTouchFromArr(touchID, this.preOvers)) ? (this.checkMouseOutAndOverOfMove(ele, preO.tar), 
            preO.tar = ele, arrs = this.getEles(ele, null, TouchManager._tEleArr)) : (arrs = this.getEles(ele, null, TouchManager._tEleArr), 
            this.sendEvents(arrs, "mouseover", touchID), this.preOvers.push(this.createTouchO(ele, touchID))), 
            this.sendEvents(arrs, "mousemove", touchID), this._clearTempArrs());
        }, __proto.getLastOvers = function() {
            return (TouchManager._tEleArr.length = 0) < this.preOvers.length && this.preOvers[0].tar ? this.getEles(this.preOvers[0].tar, null, TouchManager._tEleArr) : (TouchManager._tEleArr.push(Laya.stage), 
            TouchManager._tEleArr);
        }, __proto.stageMouseOut = function() {
            var lastOvers;
            lastOvers = this.getLastOvers(), this.preOvers.length = 0, this.sendEvents(lastOvers, "mouseout", 0);
        }, __proto.onMouseUp = function(ele, touchID, isLeft) {
            if (void 0 === isLeft && (isLeft = !1), this.enable) {
                var preO, arrs, oldArr, tar, sendArr, preDowns, i = 0, len = 0, onMobile = Browser.onMobile;
                if (arrs = this.getEles(ele, null, TouchManager._tEleArr), this.sendEvents(arrs, isLeft ? "mouseup" : "rightmouseup", touchID), 
                preDowns = isLeft ? this.preDowns : this.preRightDowns, preO = this.getTouchFromArr(touchID, preDowns)) {
                    var isDouble, now = Browser.now();
                    if (isDouble = now - this._lastClickTime < 300, this._lastClickTime = now, ele == preO.tar) sendArr = arrs; else for (oldArr = this.getEles(preO.tar, null, TouchManager._oldArr), 
                    (sendArr = TouchManager._newArr).length = 0, len = oldArr.length, i = 0; i < len; i++) tar = oldArr[i], 
                    0 <= arrs.indexOf(tar) && sendArr.push(tar);
                    0 < sendArr.length && this.sendEvents(sendArr, isLeft ? "click" : "rightclick", touchID), 
                    isLeft && isDouble && this.sendEvents(sendArr, "doubleclick", touchID), this.removeTouchFromArr(touchID, preDowns), 
                    preO.tar = null, Pool.recover("TouchData", preO);
                } else ;
                (preO = this.getTouchFromArr(touchID, this.preOvers)) && onMobile && ((sendArr = this.getEles(preO.tar, null, sendArr)) && 0 < sendArr.length && this.sendEvents(sendArr, "mouseout", touchID), 
                this.removeTouchFromArr(touchID, this.preOvers), preO.tar = null, Pool.recover("TouchData", preO)), 
                this._clearTempArrs();
            }
        }, TouchManager._oldArr = [], TouchManager._newArr = [], TouchManager._tEleArr = [], 
        __static(TouchManager, [ "I", function() {
            return this.I = new TouchManager();
        } ]), TouchManager;
    }(), Filter = function() {
        function Filter() {
            this._action = null;
        }
        __class(Filter, "laya.filters.Filter");
        var __proto = Filter.prototype;
        return Laya.imps(__proto, {
            "laya.filters.IFilter": !0
        }), __proto.callNative = function(sp) {}, __getset(0, __proto, "type", function() {
            return -1;
        }), __getset(0, __proto, "action", function() {
            return this._action;
        }), Filter.BLUR = 16, Filter.COLOR = 32, Filter.GLOW = 8, Filter._filterStart = null, 
        Filter._filterEnd = null, Filter._EndTarget = null, Filter._recycleScope = null, 
        Filter._filter = null, Filter._useSrc = null, Filter._endSrc = null, Filter._useOut = null, 
        Filter._endOut = null, Filter;
    }(), ColorFilterAction = function() {
        function ColorFilterAction() {
            this.data = null;
        }
        __class(ColorFilterAction, "laya.filters.ColorFilterAction");
        var __proto = ColorFilterAction.prototype;
        return Laya.imps(__proto, {
            "laya.filters.IFilterAction": !0
        }), __proto.apply = function(srcCanvas) {
            var ctx = srcCanvas.ctx.ctx, canvas = srcCanvas.ctx.ctx.canvas;
            if (0 == canvas.width || 0 == canvas.height) return canvas;
            for (var nData, imgdata = ctx.getImageData(0, 0, canvas.width, canvas.height), data = imgdata.data, i = 0, n = data.length; i < n; i += 4) nData = this.getColor(data[i], data[i + 1], data[i + 2], data[i + 3]), 
            0 != data[i + 3] && (data[i] = nData[0], data[i + 1] = nData[1], data[i + 2] = nData[2], 
            data[i + 3] = nData[3]);
            return ctx.putImageData(imgdata, 0, 0), srcCanvas;
        }, __proto.getColor = function(red, green, blue, alpha) {
            var rst = [];
            if (this.data._mat && this.data._alpha) {
                var mat = this.data._mat, tempAlpha = this.data._alpha;
                rst[0] = mat[0] * red + mat[1] * green + mat[2] * blue + mat[3] * alpha + tempAlpha[0], 
                rst[1] = mat[4] * red + mat[5] * green + mat[6] * blue + mat[7] * alpha + tempAlpha[1], 
                rst[2] = mat[8] * red + mat[9] * green + mat[10] * blue + mat[11] * alpha + tempAlpha[2], 
                rst[3] = mat[12] * red + mat[13] * green + mat[14] * blue + mat[15] * alpha + tempAlpha[3];
            }
            return rst;
        }, ColorFilterAction;
    }(), Bezier = (function() {
        function Arith() {}
        __class(Arith, "laya.maths.Arith"), Arith.formatR = function(r) {
            return r > Math.PI && (r -= 2 * Math.PI), r < -Math.PI && (r += 2 * Math.PI), r;
        }, Arith.isPOT = function(w, h) {
            return 0 < w && 0 == (w & w - 1) && 0 < h && 0 == (h & h - 1);
        }, Arith.setMatToArray = function(mat, array) {
            mat.a, mat.b, mat.c, mat.d, mat.tx, mat.ty, array[0] = mat.a, array[1] = mat.b, 
            array[4] = mat.c, array[5] = mat.d, array[12] = mat.tx, array[13] = mat.ty;
        };
    }(), function() {
        function Bezier() {
            this._controlPoints = [ new Point(), new Point(), new Point() ], this._calFun = this.getPoint2;
        }
        __class(Bezier, "laya.maths.Bezier");
        var __proto = Bezier.prototype;
        return __proto._switchPoint = function(x, y) {
            var tPoint = this._controlPoints.shift();
            tPoint.setTo(x, y), this._controlPoints.push(tPoint);
        }, __proto.getPoint2 = function(t, rst) {
            var p1 = this._controlPoints[0], p2 = this._controlPoints[1], p3 = this._controlPoints[2], lineX = Math.pow(1 - t, 2) * p1.x + 2 * t * (1 - t) * p2.x + Math.pow(t, 2) * p3.x, lineY = Math.pow(1 - t, 2) * p1.y + 2 * t * (1 - t) * p2.y + Math.pow(t, 2) * p3.y;
            rst.push(lineX, lineY);
        }, __proto.getPoint3 = function(t, rst) {
            var p1 = this._controlPoints[0], p2 = this._controlPoints[1], p3 = this._controlPoints[2], p4 = this._controlPoints[3], lineX = Math.pow(1 - t, 3) * p1.x + 3 * p2.x * t * (1 - t) * (1 - t) + 3 * p3.x * t * t * (1 - t) + p4.x * Math.pow(t, 3), lineY = Math.pow(1 - t, 3) * p1.y + 3 * p2.y * t * (1 - t) * (1 - t) + 3 * p3.y * t * t * (1 - t) + p4.y * Math.pow(t, 3);
            rst.push(lineX, lineY);
        }, __proto.insertPoints = function(count, rst) {
            var dLen, i = NaN;
            for (dLen = 1 / (count = 0 < count ? count : 5), i = 0; i <= 1; i += dLen) this._calFun(i, rst);
        }, __proto.getBezierPoints = function(pList, inSertCount, count) {
            void 0 === inSertCount && (inSertCount = 5), void 0 === count && (count = 2);
            var len, rst, i = 0;
            if ((len = pList.length) < 2 * (count + 1)) return [];
            switch (rst = [], count) {
              case 2:
                this._calFun = this.getPoint2;
                break;

              case 3:
                this._calFun = this.getPoint3;
                break;

              default:
                return [];
            }
            for (;this._controlPoints.length <= count; ) this._controlPoints.push(new Point());
            for (i = 0; i < 2 * count; i += 2) this._switchPoint(pList[i], pList[i + 1]);
            for (i = 2 * count; i < len; i += 2) this._switchPoint(pList[i], pList[i + 1]), 
            i / 2 % count == 0 && this.insertPoints(inSertCount, rst);
            return rst;
        }, __static(Bezier, [ "I", function() {
            return this.I = new Bezier();
        } ]), Bezier;
    }()), GrahamScan = function() {
        function GrahamScan() {}
        return __class(GrahamScan, "laya.maths.GrahamScan"), GrahamScan.multiply = function(p1, p2, p0) {
            return (p1.x - p0.x) * (p2.y - p0.y) - (p2.x - p0.x) * (p1.y - p0.y);
        }, GrahamScan.dis = function(p1, p2) {
            return (p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y);
        }, GrahamScan._getPoints = function(count, tempUse, rst) {
            for (void 0 === tempUse && (tempUse = !1), GrahamScan._mPointList || (GrahamScan._mPointList = []); GrahamScan._mPointList.length < count; ) GrahamScan._mPointList.push(new Point());
            return rst || (rst = []), rst.length = 0, tempUse ? GrahamScan.getFrom(rst, GrahamScan._mPointList, count) : GrahamScan.getFromR(rst, GrahamScan._mPointList, count), 
            rst;
        }, GrahamScan.getFrom = function(rst, src, count) {
            var i = 0;
            for (i = 0; i < count; i++) rst.push(src[i]);
            return rst;
        }, GrahamScan.getFromR = function(rst, src, count) {
            var i = 0;
            for (i = 0; i < count; i++) rst.push(src.pop());
            return rst;
        }, GrahamScan.pListToPointList = function(pList, tempUse) {
            void 0 === tempUse && (tempUse = !1);
            var i = 0, len = pList.length / 2, rst = GrahamScan._getPoints(len, tempUse, GrahamScan._tempPointList);
            for (i = 0; i < len; i++) rst[i].setTo(pList[i + i], pList[i + i + 1]);
            return rst;
        }, GrahamScan.pointListToPlist = function(pointList) {
            var tPoint, i = 0, len = pointList.length, rst = GrahamScan._temPList;
            for (i = rst.length = 0; i < len; i++) tPoint = pointList[i], rst.push(tPoint.x, tPoint.y);
            return rst;
        }, GrahamScan.scanPList = function(pList) {
            return Utils.copyArray(pList, GrahamScan.pointListToPlist(GrahamScan.scan(GrahamScan.pListToPointList(pList, !0))));
        }, GrahamScan.scan = function(PointSet) {
            var tmp, ch, key, i = 0, j = 0, k = 0, n = PointSet.length, _tmpDic = {};
            for ((ch = GrahamScan._temArr).length = 0, i = (n = PointSet.length) - 1; 0 <= i; i--) key = (tmp = PointSet[i]).x + "_" + tmp.y, 
            _tmpDic.hasOwnProperty(key) || (_tmpDic[key] = !0, ch.push(tmp));
            for (n = ch.length, Utils.copyArray(PointSet, ch), i = 1; i < n; i++) (PointSet[i].y < PointSet[k].y || PointSet[i].y == PointSet[k].y && PointSet[i].x < PointSet[k].x) && (k = i);
            for (tmp = PointSet[0], PointSet[0] = PointSet[k], PointSet[k] = tmp, i = 1; i < n - 1; i++) {
                for (j = (k = i) + 1; j < n; j++) (0 < GrahamScan.multiply(PointSet[j], PointSet[k], PointSet[0]) || 0 == GrahamScan.multiply(PointSet[j], PointSet[k], PointSet[0]) && GrahamScan.dis(PointSet[0], PointSet[j]) < GrahamScan.dis(PointSet[0], PointSet[k])) && (k = j);
                tmp = PointSet[i], PointSet[i] = PointSet[k], PointSet[k] = tmp;
            }
            if ((ch = GrahamScan._temArr).length = 0, PointSet.length < 3) return Utils.copyArray(ch, PointSet);
            for (ch.push(PointSet[0], PointSet[1], PointSet[2]), i = 3; i < n; i++) {
                for (;2 <= ch.length && 0 <= GrahamScan.multiply(PointSet[i], ch[ch.length - 1], ch[ch.length - 2]); ) ch.pop();
                PointSet[i] && ch.push(PointSet[i]);
            }
            return ch;
        }, GrahamScan._mPointList = null, GrahamScan._tempPointList = [], GrahamScan._temPList = [], 
        GrahamScan._temArr = [], GrahamScan;
    }(), MathUtil = function() {
        function MathUtil() {}
        return __class(MathUtil, "laya.maths.MathUtil"), MathUtil.subtractVector3 = function(l, r, o) {
            o[0] = l[0] - r[0], o[1] = l[1] - r[1], o[2] = l[2] - r[2];
        }, MathUtil.lerp = function(left, right, amount) {
            return left * (1 - amount) + right * amount;
        }, MathUtil.scaleVector3 = function(f, b, e) {
            e[0] = f[0] * b, e[1] = f[1] * b, e[2] = f[2] * b;
        }, MathUtil.lerpVector3 = function(l, r, t, o) {
            var ax = l[0], ay = l[1], az = l[2];
            o[0] = ax + t * (r[0] - ax), o[1] = ay + t * (r[1] - ay), o[2] = az + t * (r[2] - az);
        }, MathUtil.lerpVector4 = function(l, r, t, o) {
            var ax = l[0], ay = l[1], az = l[2], aw = l[3];
            o[0] = ax + t * (r[0] - ax), o[1] = ay + t * (r[1] - ay), o[2] = az + t * (r[2] - az), 
            o[3] = aw + t * (r[3] - aw);
        }, MathUtil.slerpQuaternionArray = function(a, Offset1, b, Offset2, t, out, Offset3) {
            var omega, cosom, sinom, scale0, scale1, ax = a[Offset1 + 0], ay = a[Offset1 + 1], az = a[Offset1 + 2], aw = a[Offset1 + 3], bx = b[Offset2 + 0], by = b[Offset2 + 1], bz = b[Offset2 + 2], bw = b[Offset2 + 3];
            return (cosom = ax * bx + ay * by + az * bz + aw * bw) < 0 && (cosom = -cosom, bx = -bx, 
            by = -by, bz = -bz, bw = -bw), scale1 = 1e-6 < 1 - cosom ? (omega = Math.acos(cosom), 
            sinom = Math.sin(omega), scale0 = Math.sin((1 - t) * omega) / sinom, Math.sin(t * omega) / sinom) : (scale0 = 1 - t, 
            t), out[Offset3 + 0] = scale0 * ax + scale1 * bx, out[Offset3 + 1] = scale0 * ay + scale1 * by, 
            out[Offset3 + 2] = scale0 * az + scale1 * bz, out[Offset3 + 3] = scale0 * aw + scale1 * bw, 
            out;
        }, MathUtil.getRotation = function(x0, y0, x1, y1) {
            return Math.atan2(y1 - y0, x1 - x0) / Math.PI * 180;
        }, MathUtil.sortBigFirst = function(a, b) {
            return a == b ? 0 : a < b ? 1 : -1;
        }, MathUtil.sortSmallFirst = function(a, b) {
            return a == b ? 0 : a < b ? -1 : 1;
        }, MathUtil.sortNumBigFirst = function(a, b) {
            return parseFloat(b) - parseFloat(a);
        }, MathUtil.sortNumSmallFirst = function(a, b) {
            return parseFloat(a) - parseFloat(b);
        }, MathUtil.sortByKey = function(key, bigFirst, forceNum) {
            var _sortFun;
            return void 0 === bigFirst && (bigFirst = !1), void 0 === forceNum && (forceNum = !0), 
            _sortFun = bigFirst ? forceNum ? MathUtil.sortNumBigFirst : MathUtil.sortBigFirst : forceNum ? MathUtil.sortNumSmallFirst : MathUtil.sortSmallFirst, 
            function(a, b) {
                return _sortFun(a[key], b[key]);
            };
        }, MathUtil;
    }(), Matrix = function() {
        function Matrix(a, b, c, d, tx, ty) {
            this.inPool = !1, this.bTransform = !1, void 0 === a && (a = 1), void 0 === b && (b = 0), 
            void 0 === c && (c = 0), void 0 === d && (d = 1), void 0 === tx && (tx = 0), void 0 === ty && (ty = 0), 
            this.a = a, this.b = b, this.c = c, this.d = d, this.tx = tx, this.ty = ty, this._checkTransform();
        }
        __class(Matrix, "laya.maths.Matrix");
        var __proto = Matrix.prototype;
        return __proto.identity = function() {
            return this.a = this.d = 1, this.b = this.tx = this.ty = this.c = 0, this.bTransform = !1, 
            this;
        }, __proto._checkTransform = function() {
            return this.bTransform = 1 !== this.a || 0 !== this.b || 0 !== this.c || 1 !== this.d;
        }, __proto.setTranslate = function(x, y) {
            return this.tx = x, this.ty = y, this;
        }, __proto.translate = function(x, y) {
            return this.tx += x, this.ty += y, this;
        }, __proto.scale = function(x, y) {
            this.a *= x, this.d *= y, this.c *= x, this.b *= y, this.tx *= x, this.ty *= y, 
            this.bTransform = !0;
        }, __proto.rotate = function(angle) {
            var cos = Math.cos(angle), sin = Math.sin(angle), a1 = this.a, c1 = this.c, tx1 = this.tx;
            this.a = a1 * cos - this.b * sin, this.b = a1 * sin + this.b * cos, this.c = c1 * cos - this.d * sin, 
            this.d = c1 * sin + this.d * cos, this.tx = tx1 * cos - this.ty * sin, this.ty = tx1 * sin + this.ty * cos, 
            this.bTransform = !0;
        }, __proto.skew = function(x, y) {
            var tanX = Math.tan(x), tanY = Math.tan(y), a1 = this.a, b1 = this.b;
            return this.a += tanY * this.c, this.b += tanY * this.d, this.c += tanX * a1, this.d += tanX * b1, 
            this;
        }, __proto.invertTransformPoint = function(out) {
            var a1 = this.a, b1 = this.b, c1 = this.c, d1 = this.d, tx1 = this.tx, n = a1 * d1 - b1 * c1, a2 = d1 / n, b2 = -b1 / n, c2 = -c1 / n, d2 = a1 / n, tx2 = (c1 * this.ty - d1 * tx1) / n, ty2 = -(a1 * this.ty - b1 * tx1) / n;
            return out.setTo(a2 * out.x + c2 * out.y + tx2, b2 * out.x + d2 * out.y + ty2);
        }, __proto.transformPoint = function(out) {
            return out.setTo(this.a * out.x + this.c * out.y + this.tx, this.b * out.x + this.d * out.y + this.ty);
        }, __proto.transformPointN = function(out) {
            return out.setTo(this.a * out.x + this.c * out.y, this.b * out.x + this.d * out.y);
        }, __proto.transformPointArray = function(data, out) {
            for (var len = data.length, i = 0; i < len; i += 2) {
                var x = data[i], y = data[i + 1];
                out[i] = this.a * x + this.c * y + this.tx, out[i + 1] = this.b * x + this.d * y + this.ty;
            }
            return out;
        }, __proto.transformPointArrayScale = function(data, out) {
            for (var len = data.length, i = 0; i < len; i += 2) {
                var x = data[i], y = data[i + 1];
                out[i] = this.a * x + this.c * y, out[i + 1] = this.b * x + this.d * y;
            }
            return out;
        }, __proto.getScaleX = function() {
            return 0 === this.b ? this.a : Math.sqrt(this.a * this.a + this.b * this.b);
        }, __proto.getScaleY = function() {
            return 0 === this.c ? this.d : Math.sqrt(this.c * this.c + this.d * this.d);
        }, __proto.invert = function() {
            var a1 = this.a, b1 = this.b, c1 = this.c, d1 = this.d, tx1 = this.tx, n = a1 * d1 - b1 * c1;
            return this.a = d1 / n, this.b = -b1 / n, this.c = -c1 / n, this.d = a1 / n, this.tx = (c1 * this.ty - d1 * tx1) / n, 
            this.ty = -(a1 * this.ty - b1 * tx1) / n, this;
        }, __proto.setTo = function(a, b, c, d, tx, ty) {
            return this.a = a, this.b = b, this.c = c, this.d = d, this.tx = tx, this.ty = ty, 
            this;
        }, __proto.concat = function(matrix) {
            var a = this.a, c = this.c, tx = this.tx;
            return this.a = a * matrix.a + this.b * matrix.c, this.b = a * matrix.b + this.b * matrix.d, 
            this.c = c * matrix.a + this.d * matrix.c, this.d = c * matrix.b + this.d * matrix.d, 
            this.tx = tx * matrix.a + this.ty * matrix.c + matrix.tx, this.ty = tx * matrix.b + this.ty * matrix.d + matrix.ty, 
            this;
        }, __proto.scaleEx = function(x, y) {
            var ba = this.a, bb = this.b, bc = this.c, bd = this.d;
            0 !== bb || 0 !== bc ? (this.a = x * ba, this.b = x * bb, this.c = y * bc) : (this.a = x * ba, 
            this.b = 0 * bd, this.c = 0 * ba), this.d = y * bd, this.bTransform = !0;
        }, __proto.rotateEx = function(angle) {
            var cos = Math.cos(angle), sin = Math.sin(angle), ba = this.a, bb = this.b, bc = this.c, bd = this.d;
            0 !== bb || 0 !== bc ? (this.a = cos * ba + sin * bc, this.b = cos * bb + sin * bd, 
            this.c = -sin * ba + cos * bc, this.d = -sin * bb + cos * bd) : (this.a = cos * ba, 
            this.b = sin * bd, this.c = -sin * ba, this.d = cos * bd), this.bTransform = !0;
        }, __proto.clone = function() {
            var dec = Matrix.create();
            return dec.a = this.a, dec.b = this.b, dec.c = this.c, dec.d = this.d, dec.tx = this.tx, 
            dec.ty = this.ty, dec.bTransform = this.bTransform, dec;
        }, __proto.copyTo = function(dec) {
            return dec.a = this.a, dec.b = this.b, dec.c = this.c, dec.d = this.d, dec.tx = this.tx, 
            dec.ty = this.ty, dec.bTransform = this.bTransform, dec;
        }, __proto.toString = function() {
            return this.a + "," + this.b + "," + this.c + "," + this.d + "," + this.tx + "," + this.ty;
        }, __proto.destroy = function() {
            if (!this.inPool) {
                var cache = Matrix._cache;
                this.inPool = !0, cache._length || (cache._length = 0), (cache[cache._length++] = this).a = this.d = 1, 
                this.b = this.c = this.tx = this.ty = 0, this.bTransform = !1;
            }
        }, Matrix.mul = function(m1, m2, out) {
            var aa = m1.a, ab = m1.b, ac = m1.c, ad = m1.d, atx = m1.tx, aty = m1.ty, ba = m2.a, bb = m2.b, bc = m2.c, bd = m2.d, btx = m2.tx, bty = m2.ty;
            return 0 !== bb || 0 !== bc ? (out.a = aa * ba + ab * bc, out.b = aa * bb + ab * bd, 
            out.c = ac * ba + ad * bc, out.d = ac * bb + ad * bd, out.tx = ba * atx + bc * aty + btx, 
            out.ty = bb * atx + bd * aty + bty) : (out.a = aa * ba, out.b = ab * bd, out.c = ac * ba, 
            out.d = ad * bd, out.tx = ba * atx + btx, out.ty = bd * aty + bty), out;
        }, Matrix.mul16 = function(m1, m2, out) {
            var aa = m1.a, ab = m1.b, ac = m1.c, ad = m1.d, atx = m1.tx, aty = m1.ty, ba = m2.a, bb = m2.b, bc = m2.c, bd = m2.d, btx = m2.tx, bty = m2.ty;
            return 0 !== bb || 0 !== bc ? (out[0] = aa * ba + ab * bc, out[1] = aa * bb + ab * bd, 
            out[4] = ac * ba + ad * bc, out[5] = ac * bb + ad * bd, out[12] = ba * atx + bc * aty + btx, 
            out[13] = bb * atx + bd * aty + bty) : (out[0] = aa * ba, out[1] = ab * bd, out[4] = ac * ba, 
            out[5] = ad * bd, out[12] = ba * atx + btx, out[13] = bd * aty + bty), out;
        }, Matrix.mulPre = function(m1, ba, bb, bc, bd, btx, bty, out) {
            var aa = m1.a, ab = m1.b, ac = m1.c, ad = m1.d, atx = m1.tx, aty = m1.ty;
            return 0 !== bb || 0 !== bc ? (out.a = aa * ba + ab * bc, out.b = aa * bb + ab * bd, 
            out.c = ac * ba + ad * bc, out.d = ac * bb + ad * bd, out.tx = ba * atx + bc * aty + btx, 
            out.ty = bb * atx + bd * aty + bty) : (out.a = aa * ba, out.b = ab * bd, out.c = ac * ba, 
            out.d = ad * bd, out.tx = ba * atx + btx, out.ty = bd * aty + bty), out;
        }, Matrix.mulPos = function(m1, aa, ab, ac, ad, atx, aty, out) {
            var ba = m1.a, bb = m1.b, bc = m1.c, bd = m1.d, btx = m1.tx, bty = m1.ty;
            return 0 !== bb || 0 !== bc ? (out.a = aa * ba + ab * bc, out.b = aa * bb + ab * bd, 
            out.c = ac * ba + ad * bc, out.d = ac * bb + ad * bd, out.tx = ba * atx + bc * aty + btx, 
            out.ty = bb * atx + bd * aty + bty) : (out.a = aa * ba, out.b = ab * bd, out.c = ac * ba, 
            out.d = ad * bd, out.tx = ba * atx + btx, out.ty = bd * aty + bty), out;
        }, Matrix.preMul = function(parent, self, out) {
            var pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d, na = self.a, nb = self.b, nc = self.c, nd = self.d, ntx = self.tx, nty = self.ty;
            return out.a = na * pa, out.b = out.c = 0, out.d = nd * pd, out.tx = ntx * pa + parent.tx, 
            out.ty = nty * pd + parent.ty, 0 === nb && 0 === nc && 0 === pb && 0 === pc || (out.a += nb * pc, 
            out.d += nc * pb, out.b += na * pb + nb * pd, out.c += nc * pa + nd * pc, out.tx += nty * pc, 
            out.ty += ntx * pb), out;
        }, Matrix.preMulXY = function(parent, x, y, out) {
            var pa = parent.a, pb = parent.b, pc = parent.c, pd = parent.d;
            return out.a = pa, out.b = pb, out.c = pc, out.d = pd, out.tx = x * pa + parent.tx + y * pc, 
            out.ty = y * pd + parent.ty + x * pb, out;
        }, Matrix.create = function() {
            var cache = Matrix._cache, mat = cache._length ? cache[--cache._length] : new Matrix();
            return mat.inPool = !1, mat;
        }, Matrix.EMPTY = new Matrix(), Matrix.TEMP = new Matrix(), Matrix._cache = [], 
        Matrix;
    }(), Point = function() {
        function Point(x, y) {
            void 0 === x && (x = 0), void 0 === y && (y = 0), this.x = x, this.y = y;
        }
        __class(Point, "laya.maths.Point");
        var __proto = Point.prototype;
        return __proto.setTo = function(x, y) {
            return this.x = x, this.y = y, this;
        }, __proto.distance = function(x, y) {
            return Math.sqrt((this.x - x) * (this.x - x) + (this.y - y) * (this.y - y));
        }, __proto.toString = function() {
            return this.x + "," + this.y;
        }, __proto.normalize = function() {
            var d = Math.sqrt(this.x * this.x + this.y * this.y);
            if (0 < d) {
                var id = 1 / d;
                this.x *= id, this.y *= id;
            }
        }, Point.TEMP = new Point(), Point.EMPTY = new Point(), Point;
    }(), Rectangle = function() {
        function Rectangle(x, y, width, height) {
            void 0 === x && (x = 0), void 0 === y && (y = 0), void 0 === width && (width = 0), 
            void 0 === height && (height = 0), this.x = x, this.y = y, this.width = width, this.height = height;
        }
        __class(Rectangle, "laya.maths.Rectangle");
        var __proto = Rectangle.prototype;
        return __proto.setTo = function(x, y, width, height) {
            return this.x = x, this.y = y, this.width = width, this.height = height, this;
        }, __proto.copyFrom = function(source) {
            return this.x = source.x, this.y = source.y, this.width = source.width, this.height = source.height, 
            this;
        }, __proto.contains = function(x, y) {
            return !(this.width <= 0 || this.height <= 0) && (x >= this.x && x < this.right && y >= this.y && y < this.bottom);
        }, __proto.intersects = function(rect) {
            return !(rect.x > this.x + this.width || rect.x + rect.width < this.x || rect.y > this.y + this.height || rect.y + rect.height < this.y);
        }, __proto.intersection = function(rect, out) {
            return this.intersects(rect) ? (out || (out = new Rectangle()), out.x = Math.max(this.x, rect.x), 
            out.y = Math.max(this.y, rect.y), out.width = Math.min(this.right, rect.right) - out.x, 
            out.height = Math.min(this.bottom, rect.bottom) - out.y, out) : null;
        }, __proto.union = function(source, out) {
            return out || (out = new Rectangle()), this.clone(out), source.width <= 0 || source.height <= 0 ? out : (out.addPoint(source.x, source.y), 
            out.addPoint(source.right, source.bottom), this);
        }, __proto.clone = function(out) {
            return out || (out = new Rectangle()), out.x = this.x, out.y = this.y, out.width = this.width, 
            out.height = this.height, out;
        }, __proto.toString = function() {
            return this.x + "," + this.y + "," + this.width + "," + this.height;
        }, __proto.equals = function(rect) {
            return !(!rect || rect.x !== this.x || rect.y !== this.y || rect.width !== this.width || rect.height !== this.height);
        }, __proto.addPoint = function(x, y) {
            return this.x > x && (this.width += this.x - x, this.x = x), this.y > y && (this.height += this.y - y, 
            this.y = y), this.width < x - this.x && (this.width = x - this.x), this.height < y - this.y && (this.height = y - this.y), 
            this;
        }, __proto._getBoundPoints = function() {
            var rst = Rectangle._temB;
            return (rst.length = 0) == this.width || 0 == this.height || rst.push(this.x, this.y, this.x + this.width, this.y, this.x, this.y + this.height, this.x + this.width, this.y + this.height), 
            rst;
        }, __proto.isEmpty = function() {
            return this.width <= 0 || this.height <= 0;
        }, __getset(0, __proto, "right", function() {
            return this.x + this.width;
        }), __getset(0, __proto, "bottom", function() {
            return this.y + this.height;
        }), Rectangle._getBoundPointS = function(x, y, width, height) {
            var rst = Rectangle._temA;
            return (rst.length = 0) == width || 0 == height || rst.push(x, y, x + width, y, x, y + height, x + width, y + height), 
            rst;
        }, Rectangle._getWrapRec = function(pointList, rst) {
            if (!pointList || pointList.length < 1) return rst ? rst.setTo(0, 0, 0, 0) : Rectangle.TEMP.setTo(0, 0, 0, 0);
            rst = rst || new Rectangle();
            var i, minX, maxX, minY, maxY, len = pointList.length, tPoint = Point.TEMP;
            for (maxX = maxY = -(minX = minY = 99999), i = 0; i < len; i += 2) tPoint.x = pointList[i], 
            tPoint.y = pointList[i + 1], minX = minX < tPoint.x ? minX : tPoint.x, minY = minY < tPoint.y ? minY : tPoint.y, 
            maxX = maxX > tPoint.x ? maxX : tPoint.x, maxY = maxY > tPoint.y ? maxY : tPoint.y;
            return rst.setTo(minX, minY, maxX - minX, maxY - minY);
        }, Rectangle.EMPTY = new Rectangle(), Rectangle.TEMP = new Rectangle(), Rectangle._temB = [], 
        Rectangle._temA = [], Rectangle;
    }(), SoundManager = function() {
        function SoundManager() {}
        return __class(SoundManager, "laya.media.SoundManager"), __getset(1, SoundManager, "useAudioMusic", function() {
            return SoundManager._useAudioMusic;
        }, function(value) {
            SoundManager._useAudioMusic = value, SoundManager._musicClass = value ? AudioSound : null;
        }), __getset(1, SoundManager, "autoStopMusic", function() {
            return SoundManager._autoStopMusic;
        }, function(v) {
            Laya.stage.off("blur", null, SoundManager._stageOnBlur), Laya.stage.off("focus", null, SoundManager._stageOnFocus), 
            Laya.stage.off("visibilitychange", null, SoundManager._visibilityChange), (SoundManager._autoStopMusic = v) && (Laya.stage.on("blur", null, SoundManager._stageOnBlur), 
            Laya.stage.on("focus", null, SoundManager._stageOnFocus), Laya.stage.on("visibilitychange", null, SoundManager._visibilityChange));
        }), __getset(1, SoundManager, "muted", function() {
            return SoundManager._muted;
        }, function(value) {
            value != SoundManager._muted && (value && SoundManager.stopAllSound(), SoundManager.musicMuted = value, 
            SoundManager._muted = value);
        }), __getset(1, SoundManager, "musicMuted", function() {
            return SoundManager._musicMuted;
        }, function(value) {
            value != SoundManager._musicMuted && (value ? (SoundManager._tMusic && SoundManager._musicChannel && !SoundManager._musicChannel.isStopped ? SoundManager._musicChannel.pause() : SoundManager._musicChannel = null, 
            SoundManager._musicMuted = value) : (SoundManager._musicMuted = value, SoundManager._tMusic && SoundManager._musicChannel && SoundManager._musicChannel.resume()));
        }), __getset(1, SoundManager, "soundMuted", function() {
            return SoundManager._soundMuted;
        }, function(value) {
            SoundManager._soundMuted = value;
        }), SoundManager.addChannel = function(channel) {
            0 <= SoundManager._channels.indexOf(channel) || (SoundManager._channels.push(channel), 
            SoundManager.autoReleaseSound && 0 != SoundManager._notUsedCount && SoundManager._notUsedUrls[channel.url] && (delete SoundManager._notUsedUrls[channel.url], 
            0 == --SoundManager._notUsedCount && Laya.timer.clear(SoundManager, SoundManager.disposeSoundIfNotUsed)));
        }, SoundManager.removeChannel = function(channel) {
            var channels = SoundManager._channels, i = channels.indexOf(channel);
            if (-1 != i && (channels.splice(i, 1), SoundManager.autoReleaseSound)) {
                var url = channel.url, interval = SoundManager.defaultIntervals[url] || 2e4;
                if (0 < interval) {
                    var notUsed = !0;
                    for (i = channels.length - 1; 0 <= i; i--) if (channels[i].url == url) {
                        notUsed = !1;
                        break;
                    }
                    notUsed && (SoundManager._notUsedUrls[url] = Date.now() + interval, 0 == SoundManager._notUsedCount++ && Laya.timer.loop(1e4, SoundManager, SoundManager.disposeSoundIfNotUsed));
                }
            }
        }, SoundManager.disposeSoundIfNotUsed = function() {
            var notUsedUrls = SoundManager._notUsedUrls;
            if (0 != SoundManager._notUsedCount) {
                var now = Date.now();
                for (var url in notUsedUrls) now >= notUsedUrls[url] && (delete notUsedUrls[url], 
                --SoundManager._notUsedCount, SoundManager.destroySound(url));
                if (0 != SoundManager._notUsedCount) return;
            }
            Laya.timer.clear(SoundManager, SoundManager.disposeSoundIfNotUsed);
        }, SoundManager._visibilityChange = function() {
            Laya.stage.isVisibility ? SoundManager._stageOnFocus() : SoundManager._stageOnBlur();
        }, SoundManager._stageOnBlur = function() {
            SoundManager._isActive = !1, SoundManager._musicChannel && (SoundManager._musicChannel.isStopped || (SoundManager._blurPaused = !0, 
            SoundManager._musicChannel.pause())), SoundManager.stopAllSound(), Laya.stage.once("mousedown", null, SoundManager._stageOnFocus);
        }, SoundManager._recoverWebAudio = function() {
            WebAudioSound.ctx && "running" != WebAudioSound.ctx.state && WebAudioSound.ctx.resume && WebAudioSound.ctx.resume();
        }, SoundManager._stageOnFocus = function() {
            SoundManager._isActive = !0, SoundManager._recoverWebAudio(), Laya.stage.off("mousedown", null, SoundManager._stageOnFocus), 
            SoundManager._blurPaused && SoundManager._musicChannel && SoundManager._musicChannel.isStopped && (SoundManager._blurPaused = !1, 
            SoundManager._musicChannel.resume());
        }, SoundManager.playSound = function(url, loops, complete, soundClass, startTime) {
            if (void 0 === loops && (loops = 1), void 0 === startTime && (startTime = 0), !SoundManager._isActive || !url) return null;
            if (SoundManager._muted) return null;
            if (SoundManager._recoverWebAudio(), url == SoundManager._tMusic) {
                if (SoundManager._musicMuted) return null;
            } else {
                if (Render.isConchApp) {
                    var ext = Utils.getFileExtension(url);
                    if ("wav" != ext && "ogg" != ext) return alert("The sound only supports wav or ogg format,for optimal performance reason,please refer to the official website document."), 
                    null;
                }
                if (SoundManager._soundMuted) return null;
            }
            var channel, tSound = SoundManager._pool[url];
            return soundClass || (soundClass = SoundManager._soundClass), tSound || ((tSound = new soundClass()).load(url), 
            SoundManager._pool[url] = tSound), (channel = tSound.play(startTime, loops)) ? (channel.url = url, 
            channel.volume = url == SoundManager._tMusic ? SoundManager.musicVolume : SoundManager.soundVolume, 
            channel.completeHandler = complete, channel) : null;
        }, SoundManager.destroySound = function(url) {
            var tSound = SoundManager._pool[url];
            tSound && (delete SoundManager._pool[url], tSound.dispose());
        }, SoundManager.playMusic = function(url, loops, complete, startTime) {
            return void 0 === loops && (loops = 0), void 0 === startTime && (startTime = 0), 
            SoundManager._tMusic = url, SoundManager._musicChannel && SoundManager._musicChannel.stop(), 
            SoundManager._musicChannel = SoundManager.playSound(url, loops, complete, null, startTime);
        }, SoundManager.stopSound = function(url) {
            for (var channel, i = SoundManager._channels.length - 1; 0 <= i; i--) (channel = SoundManager._channels[i]).url == url && channel.stop();
        }, SoundManager.stopAll = function() {
            SoundManager._tMusic = null;
            var i = 0;
            for (i = SoundManager._channels.length - 1; 0 <= i; i--) SoundManager._channels[i].stop();
        }, SoundManager.stopAllSound = function() {
            var channel, i = 0;
            for (i = SoundManager._channels.length - 1; 0 <= i; i--) (channel = SoundManager._channels[i]).url != SoundManager._tMusic && channel.stop();
        }, SoundManager.stopMusic = function() {
            SoundManager._musicChannel && SoundManager._musicChannel.stop(), SoundManager._tMusic = null;
        }, SoundManager.setSoundVolume = function(volume, url) {
            if (url) SoundManager._setVolume(url, volume); else {
                SoundManager.soundVolume = volume;
                var channel, i = 0;
                for (i = SoundManager._channels.length - 1; 0 <= i; i--) (channel = SoundManager._channels[i]).url != SoundManager._tMusic && (channel.volume = volume);
            }
        }, SoundManager.setMusicVolume = function(volume) {
            SoundManager.musicVolume = volume, SoundManager._setVolume(SoundManager._tMusic, volume);
        }, SoundManager._setVolume = function(url, volume) {
            for (var channel, i = SoundManager._channels.length - 1; 0 <= i; i--) (channel = SoundManager._channels[i]).url == url && (channel.volume = volume);
        }, SoundManager.musicVolume = 1, SoundManager.soundVolume = 1, SoundManager.playbackRate = 1, 
        SoundManager._useAudioMusic = !0, SoundManager._muted = !1, SoundManager._soundMuted = !1, 
        SoundManager._musicMuted = !1, SoundManager._tMusic = null, SoundManager._musicChannel = null, 
        SoundManager._channels = [], SoundManager._autoStopMusic = !1, SoundManager._blurPaused = !1, 
        SoundManager._isActive = !0, SoundManager._soundClass = null, SoundManager._musicClass = null, 
        SoundManager.autoReleaseSound = !0, SoundManager._pool = {}, SoundManager.defaultIntervals = {}, 
        SoundManager._notUsedUrls = {}, SoundManager._notUsedCount = 0, SoundManager;
    }(), LocalStorage = function() {
        var Storage;
        function LocalStorage() {}
        return __class(LocalStorage, "laya.net.LocalStorage"), LocalStorage.__init__ = function() {
            LocalStorage._baseClass || (LocalStorage._baseClass = Storage).init(), LocalStorage.items = LocalStorage._baseClass.items, 
            LocalStorage.support = LocalStorage._baseClass.support;
        }, LocalStorage.setItem = function(key, value) {
            LocalStorage._baseClass.setItem(key, value);
        }, LocalStorage.getItem = function(key) {
            return LocalStorage._baseClass.getItem(key);
        }, LocalStorage.setJSON = function(key, value) {
            LocalStorage._baseClass.setJSON(key, value);
        }, LocalStorage.getJSON = function(key) {
            return LocalStorage._baseClass.getJSON(key);
        }, LocalStorage.removeItem = function(key) {
            LocalStorage._baseClass.removeItem(key);
        }, LocalStorage.clear = function() {
            LocalStorage._baseClass.clear();
        }, LocalStorage._baseClass = null, LocalStorage.items = null, LocalStorage.support = !1, 
        LocalStorage.__init$ = function() {
            Storage = function() {
                function Storage() {}
                return __class(Storage, ""), Storage.init = function() {
                    try {
                        Storage.support = !0, Storage.items = window.localStorage, Storage.setItem("laya", "1"), 
                        Storage.removeItem("laya");
                    } catch (e) {
                        e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                        Storage.support = !1;
                    }
                    Storage.support || console.log("LocalStorage is not supprot or browser is private mode.");
                }, Storage.setItem = function(key, value) {
                    try {
                        Storage.support && Storage.items.setItem(key, value);
                    } catch (e) {
                        e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                        console.warn("set localStorage failed", e);
                    }
                }, Storage.getItem = function(key) {
                    return Storage.support ? Storage.items.getItem(key) : null;
                }, Storage.setJSON = function(key, value) {
                    try {
                        Storage.support && Storage.items.setItem(key, JSON.stringify(value));
                    } catch (e) {
                        e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                        console.warn("set localStorage failed", e);
                    }
                }, Storage.getJSON = function(key) {
                    return JSON.parse(Storage.support ? Storage.items.getItem(key) : null);
                }, Storage.removeItem = function(key) {
                    Storage.support && Storage.items.removeItem(key);
                }, Storage.clear = function() {
                    Storage.support && Storage.items.clear();
                }, Storage.items = null, Storage.support = !1, Storage;
            }();
        }, LocalStorage;
    }(), TTFLoader = (function() {
        function ResourceVersion() {}
        __class(ResourceVersion, "laya.net.ResourceVersion"), ResourceVersion.enable = function(manifestFile, callback, type) {
            void 0 === type && (type = 2), laya.net.ResourceVersion.type = type, Laya.loader.load(manifestFile, Handler.create(null, ResourceVersion.onManifestLoaded, [ callback ]), null, "json"), 
            URL.customFormat = ResourceVersion.addVersionPrefix;
        }, ResourceVersion.onManifestLoaded = function(callback, data) {
            ResourceVersion.manifest = data, callback.run(), data || console.warn("资源版本清单文件不存在，不使用资源版本管理。忽略ERR_FILE_NOT_FOUND错误。");
        }, ResourceVersion.addVersionPrefix = function(originURL) {
            return ResourceVersion.manifest && ResourceVersion.manifest[originURL] ? 2 == ResourceVersion.type ? ResourceVersion.manifest[originURL] : ResourceVersion.manifest[originURL] + "/" + originURL : originURL;
        }, ResourceVersion.FOLDER_VERSION = 1, ResourceVersion.FILENAME_VERSION = 2, ResourceVersion.manifest = null, 
        ResourceVersion.type = 1;
    }(), function() {
        function TTFLoader() {
            this.fontName = null, this.complete = null, this.err = null, this._fontTxt = null, 
            this._url = null, this._div = null, this._txtWidth = NaN, this._http = null;
        }
        __class(TTFLoader, "laya.net.TTFLoader");
        var __proto = TTFLoader.prototype;
        return __proto.load = function(fontPath) {
            var tArr = (this._url = fontPath).split(".ttf")[0].split("/");
            this.fontName = tArr[tArr.length - 1], Browser.window.conch ? this._loadConch() : Browser.window.FontFace ? this._loadWithFontFace() : this._loadWithCSS();
        }, __proto._loadConch = function() {
            this._http = new HttpRequest(), this._http.on("error", this, this._onErr), this._http.on("complete", this, this._onHttpLoaded), 
            this._http.send(this._url, null, "get", "arraybuffer");
        }, __proto._onHttpLoaded = function(data) {
            Browser.window.conch.setFontFaceFromBuffer(this.fontName, data), this._clearHttp(), 
            this._complete();
        }, __proto._clearHttp = function() {
            this._http && (this._http.off("error", this, this._onErr), this._http.off("complete", this, this._onHttpLoaded), 
            this._http = null);
        }, __proto._onErr = function() {
            this._clearHttp(), this.err && (this.err.runWith("fail:" + this._url), this.err = null);
        }, __proto._complete = function() {
            Laya.timer.clear(this, this._complete), Laya.timer.clear(this, this._checkComplete), 
            this._div && this._div.parentNode && (this._div.parentNode.removeChild(this._div), 
            this._div = null), this.complete && (this.complete.runWith(this), this.complete = null);
        }, __proto._checkComplete = function() {
            RunDriver.measureText("LayaTTFFont", this._fontTxt).width != this._txtWidth && this._complete();
        }, __proto._loadWithFontFace = function() {
            var fontFace = new Browser.window.FontFace(this.fontName, "url('" + this._url + "')");
            Browser.window.document.fonts.add(fontFace);
            var self = this;
            fontFace.loaded.then(function() {
                self._complete();
            }), fontFace.load();
        }, __proto._createDiv = function() {
            this._div = Browser.createElement("div"), this._div.innerHTML = "laya";
            var _style = this._div.style;
            _style.fontFamily = this.fontName, _style.position = "absolute", _style.left = "-100px", 
            _style.top = "-100px", Browser.document.body.appendChild(this._div);
        }, __proto._loadWithCSS = function() {
            var _$this = this, fontStyle = Browser.createElement("style");
            fontStyle.type = "text/css", Browser.document.body.appendChild(fontStyle), fontStyle.textContent = "@font-face { font-family:'" + this.fontName + "'; src:url('" + this._url + "');}", 
            this._fontTxt = "40px " + this.fontName, this._txtWidth = RunDriver.measureText("LayaTTFFont", this._fontTxt).width;
            var self = this;
            fontStyle.onload = function() {
                Laya.timer.once(1e4, self, _$this._complete);
            }, Laya.timer.loop(20, this, this._checkComplete), this._createDiv();
        }, TTFLoader._testString = "LayaTTFFont", TTFLoader;
    }()), URL = function() {
        function URL(url) {
            this._url = null, this._path = null, this._url = URL.formatURL(url), this._path = URL.getPath(url);
        }
        __class(URL, "laya.net.URL");
        var __proto = URL.prototype;
        return __getset(0, __proto, "path", function() {
            return this._path;
        }), __getset(0, __proto, "url", function() {
            return this._url;
        }), URL.formatURL = function(url, base) {
            if (!url) return "null path";
            if (0 < url.indexOf(":")) return url;
            null != URL.customFormat && (url = URL.customFormat(url, base));
            var char1 = url.charAt(0);
            if ("." === char1) return URL.formatRelativePath((base || URL.basePath) + url);
            if ("~" === char1) return URL.rootPath + url.substring(1);
            if ("d" === char1) {
                if (0 === url.indexOf("data:image")) return url;
            } else if ("/" === char1) return url;
            return (base || URL.basePath) + url;
        }, URL.formatRelativePath = function(value) {
            for (var parts = value.split("/"), i = 0, len = parts.length; i < len; i++) ".." == parts[i] && (parts.splice(i - 1, 2), 
            i -= 2);
            return parts.join("/");
        }, URL.isAbsolute = function(url) {
            return 0 < url.indexOf(":") || "/" == url.charAt(0);
        }, URL.getPath = function(url) {
            var ofs = url.lastIndexOf("/");
            return 0 < ofs ? url.substr(0, ofs + 1) : "";
        }, URL.getFileName = function(url) {
            var ofs = url.lastIndexOf("/");
            return 0 < ofs ? url.substr(ofs + 1) : url;
        }, URL.version = {}, URL.basePath = "", URL.rootPath = "", URL.customFormat = function(url) {
            var newUrl = URL.version[url];
            return !Render.isConchApp && newUrl && (url += "?v=" + newUrl), url;
        }, URL;
    }(), Render = function() {
        function Render(width, height) {
            this._timeId = 0;
            var style = Render._mainCanvas.source.style;
            style.position = "absolute", style.top = style.left = "0px", style.background = "#000000", 
            Render._mainCanvas.source.id = "RenderCanvas" + Math.random();
            var isWebGl = laya.renders.Render.isWebGL;
            Render._mainCanvas.source.width = width, Render._mainCanvas.source.height = height, 
            isWebGl && Render.WebGL.init(Render._mainCanvas, width, height), Browser.container.appendChild(Render._mainCanvas.source), 
            (Render._context = new RenderContext(width, height, isWebGl ? null : Render._mainCanvas)).ctx.setIsMainContext(), 
            Browser.window.requestAnimationFrame(function loop(stamp) {
                Browser.window.requestAnimationFrame(loop);
                Laya.stage._loop();
            }), Laya.stage.on("visibilitychange", this, this._onVisibilitychange);
        }
        __class(Render, "laya.renders.Render");
        var __proto = Render.prototype;
        return __proto._onVisibilitychange = function() {
            Laya.stage.isVisibility ? 0 != this._timeId && Browser.window.clearInterval(this._timeId) : this._timeId = Browser.window.setInterval(this._enterFrame, 1e3);
        }, __proto._enterFrame = function(e) {
            Laya.stage._loop();
        }, __getset(1, Render, "context", function() {
            return Render._context;
        }), __getset(1, Render, "canvas", function() {
            return Render._mainCanvas.source;
        }), Render._context = null, Render._mainCanvas = null, Render.WebGL = null, Render.isConchNode = !1, 
        Render.isConchApp = !1, Render.isConchWebGL = !1, Render.isWebGL = !1, Render.is3DMode = !1, 
        Render.optimizeTextureMemory = function(url, texture) {
            return !0;
        }, Render.__init$ = function() {
            window.ConchRenderType = window.ConchRenderType || 1, window.ConchRenderType |= window.conch ? 4 : 0, 
            Render.isConchNode = 5 == (5 & window.ConchRenderType), Render.isConchApp = 4 == (4 & window.ConchRenderType), 
            Render.isConchWebGL = 6 == window.ConchRenderType;
        }, Render;
    }(), RenderContext = function() {
        function RenderContext(width, height, canvas) {
            this.x = 0, this.y = 0, this._drawTexture = function(x, y, args) {
                args[0].loaded && this.ctx.drawTexture(args[0], args[1], args[2], args[3], args[4], x, y);
            }, this._fillTexture = function(x, y, args) {
                args[0].loaded && this.ctx.fillTexture(args[0], args[1] + x, args[2] + y, args[3], args[4], args[5], args[6], args[7]);
            }, this._drawTextureWithTransform = function(x, y, args) {
                args[0].loaded && this.ctx.drawTextureWithTransform(args[0], args[1], args[2], args[3], args[4], args[5], x, y, args[6]);
            }, this._fillQuadrangle = function(x, y, args) {
                this.ctx.fillQuadrangle(args[0], args[1], args[2], args[3], args[4]);
            }, this._drawRect = function(x, y, args) {
                var ctx = this.ctx;
                null != args[4] && (ctx.fillStyle = args[4], ctx.fillRect(x + args[0], y + args[1], args[2], args[3], null)), 
                null != args[5] && (ctx.strokeStyle = args[5], ctx.lineWidth = args[6], ctx.strokeRect(x + args[0], y + args[1], args[2], args[3], args[6]));
            }, this._drawPie = function(x, y, args) {
                var ctx = this.ctx;
                Render.isWebGL && ctx.setPathId(args[8]), ctx.beginPath(), Render.isWebGL ? (ctx.movePath(args[0] + x, args[1] + y), 
                ctx.moveTo(0, 0)) : ctx.moveTo(x + args[0], y + args[1]), ctx.arc(x + args[0], y + args[1], args[2], args[3], args[4]), 
                ctx.closePath(), this._fillAndStroke(args[5], args[6], args[7], !0);
            }, this._clipRect = function(x, y, args) {
                this.ctx.clipRect(x + args[0], y + args[1], args[2], args[3]);
            }, this._fillRect = function(x, y, args) {
                this.ctx.fillRect(x + args[0], y + args[1], args[2], args[3], args[4]);
            }, this._drawCircle = function(x, y, args) {
                var ctx = this.ctx;
                Render.isWebGL && ctx.setPathId(args[6]), Stat.drawCall++, ctx.beginPath(), Render.isWebGL && ctx.movePath(args[0] + x, args[1] + y), 
                ctx.arc(args[0] + x, args[1] + y, args[2], 0, RenderContext.PI2), ctx.closePath(), 
                this._fillAndStroke(args[3], args[4], args[5], !0);
            }, this._fillCircle = function(x, y, args) {
                Stat.drawCall++;
                var ctx = this.ctx;
                ctx.beginPath(), ctx.fillStyle = args[3], ctx.arc(args[0] + x, args[1] + y, args[2], 0, RenderContext.PI2), 
                ctx.fill();
            }, this._setShader = function(x, y, args) {
                this.ctx.setShader(args[0]);
            }, this._drawLine = function(x, y, args) {
                var ctx = this.ctx;
                Render.isWebGL && ctx.setPathId(args[6]), ctx.beginPath(), ctx.strokeStyle = args[4], 
                ctx.lineWidth = args[5], Render.isWebGL ? (ctx.movePath(x, y), ctx.moveTo(args[0], args[1]), 
                ctx.lineTo(args[2], args[3])) : (ctx.moveTo(x + args[0], y + args[1]), ctx.lineTo(x + args[2], y + args[3])), 
                ctx.stroke();
            }, this._drawLines = function(x, y, args) {
                var ctx = this.ctx;
                Render.isWebGL && ctx.setPathId(args[5]), ctx.beginPath(), x += args[0], y += args[1], 
                Render.isWebGL && ctx.movePath(x, y), ctx.strokeStyle = args[3], ctx.lineWidth = args[4];
                var points = args[2], i = 2, n = points.length;
                if (Render.isWebGL) for (ctx.moveTo(points[0], points[1]); i < n; ) ctx.lineTo(points[i++], points[i++]); else for (ctx.moveTo(x + points[0], y + points[1]); i < n; ) ctx.lineTo(x + points[i++], y + points[i++]);
                ctx.stroke();
            }, this._drawLinesWebGL = function(x, y, args) {
                this.ctx.drawLines(x + this.x + args[0], y + this.y + args[1], args[2], args[3], args[4]);
            }, this._drawCurves = function(x, y, args) {
                this.ctx.drawCurves(x, y, args);
            }, this._draw = function(x, y, args) {
                args[0].call(null, this, x, y);
            }, this._transformByMatrix = function(x, y, args) {
                this.ctx.transformByMatrix(args[0]);
            }, this._setTransform = function(x, y, args) {
                this.ctx.setTransform(args[0], args[1], args[2], args[3], args[4], args[5]);
            }, this._setTransformByMatrix = function(x, y, args) {
                this.ctx.setTransformByMatrix(args[0]);
            }, this._save = function(x, y, args) {
                this.ctx.save();
            }, this._restore = function(x, y, args) {
                this.ctx.restore();
            }, this._translate = function(x, y, args) {
                this.ctx.translate(args[0], args[1]);
            }, this._transform = function(x, y, args) {
                this.ctx.translate(args[1] + x, args[2] + y);
                var mat = args[0];
                this.ctx.transform(mat.a, mat.b, mat.c, mat.d, mat.tx, mat.ty), this.ctx.translate(-x - args[1], -y - args[2]);
            }, this._rotate = function(x, y, args) {
                this.ctx.translate(args[1] + x, args[2] + y), this.ctx.rotate(args[0]), this.ctx.translate(-x - args[1], -y - args[2]);
            }, this._scale = function(x, y, args) {
                this.ctx.translate(args[2] + x, args[3] + y), this.ctx.scale(args[0], args[1]), 
                this.ctx.translate(-x - args[2], -y - args[3]);
            }, this._alpha = function(x, y, args) {
                this.ctx.globalAlpha *= args[0];
            }, this._setAlpha = function(x, y, args) {
                this.ctx.globalAlpha = args[0];
            }, this._fillText = function(x, y, args) {
                this.ctx.fillText(args[0], args[1] + x, args[2] + y, args[3], args[4], args[5]);
            }, this._strokeText = function(x, y, args) {
                this.ctx.strokeText(args[0], args[1] + x, args[2] + y, args[3], args[4], args[5], args[6]);
            }, this._fillBorderText = function(x, y, args) {
                this.ctx.fillBorderText(args[0], args[1] + x, args[2] + y, args[3], args[4], args[5], args[6], args[7]);
            }, this._blendMode = function(x, y, args) {
                this.ctx.globalCompositeOperation = args[0];
            }, this._beginClip = function(x, y, args) {
                this.ctx.beginClip && this.ctx.beginClip(x + args[0], y + args[1], args[2], args[3]);
            }, this._setIBVB = function(x, y, args) {
                this.ctx.setIBVB(args[0] + x, args[1] + y, args[2], args[3], args[4], args[5], args[6], args[7]);
            }, this._fillTrangles = function(x, y, args) {
                this.ctx.fillTrangles(args[0], args[1] + x, args[2] + y, args[3], args[4]);
            }, this._drawPath = function(x, y, args) {
                var ctx = this.ctx;
                Render.isWebGL && ctx.setPathId(-1), ctx.beginPath(), x += args[0], y += args[1], 
                Render.isWebGL && ctx.movePath(x, y);
                for (var paths = args[2], i = 0, n = paths.length; i < n; i++) {
                    var path = paths[i];
                    switch (path[0]) {
                      case "moveTo":
                        Render.isWebGL ? ctx.moveTo(path[1], path[2]) : ctx.moveTo(x + path[1], y + path[2]);
                        break;

                      case "lineTo":
                        Render.isWebGL ? ctx.lineTo(path[1], path[2]) : ctx.lineTo(x + path[1], y + path[2]);
                        break;

                      case "arcTo":
                        Render.isWebGL ? ctx.arcTo(path[1], path[2], path[3], path[4], path[5]) : ctx.arcTo(x + path[1], y + path[2], x + path[3], y + path[4], path[5]);
                        break;

                      case "closePath":
                        ctx.closePath();
                    }
                }
                var brush = args[3];
                null != brush && (ctx.fillStyle = brush.fillStyle, ctx.fill());
                var pen = args[4];
                null != pen && (ctx.strokeStyle = pen.strokeStyle, ctx.lineWidth = pen.lineWidth || 1, 
                ctx.lineJoin = pen.lineJoin, ctx.lineCap = pen.lineCap, ctx.miterLimit = pen.miterLimit, 
                ctx.stroke());
            }, this.drawPoly = function(x, y, args) {
                this.ctx.drawPoly(x + this.x + args[0], y + this.y + args[1], args[2], args[3], args[4], args[5], args[6]);
            }, this._drawPoly = function(x, y, args) {
                var ctx = this.ctx, points = args[2], i = 2, n = points.length;
                if (Render.isWebGL) for (ctx.setPathId(args[6]), ctx.beginPath(), x += args[0], 
                y += args[1], ctx.movePath(x, y), ctx.moveTo(points[0], points[1]); i < n; ) ctx.lineTo(points[i++], points[i++]); else for (ctx.beginPath(), 
                x += args[0], y += args[1], ctx.moveTo(x + points[0], y + points[1]); i < n; ) ctx.lineTo(x + points[i++], y + points[i++]);
                ctx.closePath(), this._fillAndStroke(args[3], args[4], args[5], args[7]);
            }, this._drawSkin = function(x, y, args) {
                var tSprite = args[0];
                if (tSprite) {
                    var ctx = this.ctx;
                    tSprite.render(ctx, x, y);
                }
            }, this._drawParticle = function(x, y, args) {
                this.ctx.drawParticle(x + this.x, y + this.y, args[0]);
            }, this._setFilters = function(x, y, args) {
                this.ctx.setFilters(args);
            }, canvas ? this.ctx = canvas.getContext("2d") : (canvas = HTMLCanvas.create("3D"), 
            this.ctx = RunDriver.createWebGLContext2D(canvas), canvas._setContext(this.ctx)), 
            canvas.size(width, height), this.canvas = canvas;
        }
        __class(RenderContext, "laya.renders.RenderContext");
        var __proto = RenderContext.prototype;
        return __proto.destroy = function() {
            this.canvas && (this.canvas.destroy(), this.canvas = null, this.ctx = null), this.ctx && (this.ctx.destroy(), 
            this.ctx = null);
        }, __proto.drawTexture = function(tex, x, y, width, height) {
            tex.loaded && this.ctx.drawTexture(tex, x, y, width, height, this.x, this.y);
        }, __proto._drawTextures = function(x, y, args) {
            args[0].loaded && this.ctx.drawTextures(args[0], args[1], x + this.x, y + this.y);
        }, __proto.drawTextureWithTransform = function(tex, x, y, width, height, m, alpha) {
            tex.loaded && this.ctx.drawTextureWithTransform(tex, x, y, width, height, m, this.x, this.y, alpha);
        }, __proto.fillQuadrangle = function(tex, x, y, point4, m) {
            this.ctx.fillQuadrangle(tex, x, y, point4, m);
        }, __proto.drawCanvas = function(canvas, x, y, width, height) {
            this.ctx.drawCanvas(canvas, x + this.x, y + this.y, width, height);
        }, __proto.drawRect = function(x, y, width, height, color, lineWidth) {
            void 0 === lineWidth && (lineWidth = 1);
            var ctx = this.ctx;
            ctx.strokeStyle = color, ctx.lineWidth = lineWidth, ctx.strokeRect(x + this.x, y + this.y, width, height, lineWidth);
        }, __proto._fillAndStroke = function(fillColor, strokeColor, lineWidth, isConvexPolygon) {
            void 0 === isConvexPolygon && (isConvexPolygon = !1);
            var ctx = this.ctx;
            null != fillColor && (ctx.fillStyle = fillColor, Render.isWebGL ? ctx.fill(isConvexPolygon) : ctx.fill()), 
            null != strokeColor && 0 < lineWidth && (ctx.strokeStyle = strokeColor, ctx.lineWidth = lineWidth, 
            ctx.stroke());
        }, __proto.clipRect = function(x, y, width, height) {
            this.ctx.clipRect(x + this.x, y + this.y, width, height);
        }, __proto.fillRect = function(x, y, width, height, fillStyle) {
            this.ctx.fillRect(x + this.x, y + this.y, width, height, fillStyle);
        }, __proto.drawCircle = function(x, y, radius, color, lineWidth) {
            void 0 === lineWidth && (lineWidth = 1), Stat.drawCall++;
            var ctx = this.ctx;
            ctx.beginPath(), ctx.strokeStyle = color, ctx.lineWidth = lineWidth, ctx.arc(x + this.x, y + this.y, radius, 0, RenderContext.PI2), 
            ctx.stroke();
        }, __proto.drawTriangles = function(x, y, args) {
            if (Render.isWebGL) this.ctx.drawTriangles(args[0], x + args[1], y + args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]); else {
                var indices = args[5], i = 0, len = indices.length, ctx = this.ctx;
                for (i = 0; i < len; i += 3) {
                    var index0 = 2 * indices[i], index1 = 2 * indices[i + 1], index2 = 2 * indices[i + 2];
                    ctx.drawTriangle(args[0], args[3], args[4], index0, index1, index2, args[6], !0);
                }
            }
        }, __proto.fillCircle = function(x, y, radius, color) {
            Stat.drawCall++;
            var ctx = this.ctx;
            ctx.beginPath(), ctx.fillStyle = color, ctx.arc(x + this.x, y + this.y, radius, 0, RenderContext.PI2), 
            ctx.fill();
        }, __proto.setShader = function(shader) {
            this.ctx.setShader(shader);
        }, __proto.drawLine = function(fromX, fromY, toX, toY, color, lineWidth) {
            void 0 === lineWidth && (lineWidth = 1);
            var ctx = this.ctx;
            ctx.beginPath(), ctx.strokeStyle = color, ctx.lineWidth = lineWidth, ctx.moveTo(this.x + fromX, this.y + fromY), 
            ctx.lineTo(this.x + toX, this.y + toY), ctx.stroke();
        }, __proto.clear = function() {
            this.ctx.clear();
        }, __proto.transformByMatrix = function(value) {
            this.ctx.transformByMatrix(value);
        }, __proto.setTransform = function(a, b, c, d, tx, ty) {
            this.ctx.setTransform(a, b, c, d, tx, ty);
        }, __proto.setTransformByMatrix = function(value) {
            this.ctx.setTransformByMatrix(value);
        }, __proto.save = function() {
            this.ctx.save();
        }, __proto.restore = function() {
            this.ctx.restore();
        }, __proto.translate = function(x, y) {
            this.ctx.translate(x, y);
        }, __proto.transform = function(a, b, c, d, tx, ty) {
            this.ctx.transform(a, b, c, d, tx, ty);
        }, __proto.rotate = function(angle) {
            this.ctx.rotate(angle);
        }, __proto.scale = function(scaleX, scaleY) {
            this.ctx.scale(scaleX, scaleY);
        }, __proto.alpha = function(value) {
            this.ctx.globalAlpha *= value;
        }, __proto.setAlpha = function(value) {
            this.ctx.globalAlpha = value;
        }, __proto.fillWords = function(words, x, y, font, color, underLine) {
            void 0 === underLine && (underLine = 0), this.ctx.fillWords(words, x, y, font, color, underLine);
        }, __proto.fillBorderWords = function(words, x, y, font, fillColor, borderColor, lineWidth) {
            this.ctx.fillBorderWords(words, x, y, font, fillColor, borderColor, lineWidth);
        }, __proto.fillText = function(text, x, y, font, color, textAlign) {
            this.ctx.fillText(text, x + this.x, y + this.y, font, color, textAlign);
        }, __proto.strokeText = function(text, x, y, font, color, lineWidth, textAlign) {
            this.ctx.strokeText(text, x + this.x, y + this.y, font, color, lineWidth, textAlign);
        }, __proto.blendMode = function(type) {
            this.ctx.globalCompositeOperation = type;
        }, __proto.flush = function() {
            this.ctx.flush && this.ctx.flush();
        }, __proto.addRenderObject = function(o) {
            this.ctx.addRenderObject(o);
        }, __proto.beginClip = function(x, y, w, h) {
            this.ctx.beginClip && this.ctx.beginClip(x, y, w, h);
        }, __proto.endClip = function() {
            this.ctx.endClip && this.ctx.endClip();
        }, __proto.fillTrangles = function(x, y, args) {
            this.ctx.fillTrangles(args[0], args[1], args[2], args[3], 4 < args.length ? args[4] : null);
        }, RenderContext.PI2 = 2 * Math.PI, RenderContext;
    }(), RenderSprite = function() {
        function RenderSprite(type, next) {
            switch (this._next = next || RenderSprite.NORENDER, type) {
              case 0:
                return void (this._fun = this._no);

              case 1:
                return void (this._fun = this._image);

              case 2:
                return void (this._fun = this._alpha);

              case 4:
                return void (this._fun = this._transform);

              case 8:
                return void (this._fun = this._blend);

              case 16:
                return void (this._fun = this._canvas);

              case 64:
                return void (this._fun = this._mask);

              case 128:
                return void (this._fun = this._clip);

              case 256:
                return void (this._fun = this._style);

              case 512:
                return void (this._fun = this._graphics);

              case 2048:
                return void (this._fun = this._childs);

              case 1024:
                return void (this._fun = this._custom);

              case 513:
              case 517:
                return void (this._fun = this._image2);

              case 32:
                return void (this._fun = Filter._filter);

              case 69905:
                return void (this._fun = RenderSprite._initRenderFun);
            }
            this.onCreate(type);
        }
        __class(RenderSprite, "laya.renders.RenderSprite");
        var __proto = RenderSprite.prototype;
        return __proto.onCreate = function(type) {}, __proto._style = function(sprite, context, x, y) {
            sprite._style.render(sprite, context, x, y);
            var next = this._next;
            next._fun.call(next, sprite, context, x, y);
        }, __proto._no = function(sprite, context, x, y) {}, __proto._custom = function(sprite, context, x, y) {
            sprite.customRender(context, x, y);
            var tf = sprite._style._tf;
            this._next._fun.call(this._next, sprite, context, x - tf.translateX, y - tf.translateY);
        }, __proto._clip = function(sprite, context, x, y) {
            var next = this._next;
            if (next != RenderSprite.NORENDER) {
                var r = sprite._style.scrollRect;
                context.ctx.save(), context.ctx.clipRect(x, y, r.width, r.height), next._fun.call(next, sprite, context, x - r.x, y - r.y), 
                context.ctx.restore();
            }
        }, __proto._blend = function(sprite, context, x, y) {
            var style = sprite._style;
            style.blendMode && (context.ctx.globalCompositeOperation = style.blendMode);
            var next = this._next;
            next._fun.call(next, sprite, context, x, y), context.ctx.globalCompositeOperation = "source-over";
        }, __proto._mask = function(sprite, context, x, y) {
            var next = this._next;
            next._fun.call(next, sprite, context, x, y);
            var mask = sprite.mask;
            mask && (context.ctx.globalCompositeOperation = "destination-in", (0 < mask.numChildren || !mask.graphics._isOnlyOne()) && (mask.cacheAsBitmap = !0), 
            mask.render(context, x - sprite.pivotX, y - sprite.pivotY)), context.ctx.globalCompositeOperation = "source-over";
        }, __proto._graphics = function(sprite, context, x, y) {
            var tf = sprite._style._tf;
            sprite._graphics && sprite._graphics._render(sprite, context, x - tf.translateX, y - tf.translateY);
            var next = this._next;
            next._fun.call(next, sprite, context, x, y);
        }, __proto._image = function(sprite, context, x, y) {
            var style = sprite._style;
            context.ctx.drawTexture2(x, y, style._tf.translateX, style._tf.translateY, sprite.transform, style.alpha, style.blendMode, sprite._graphics._one);
        }, __proto._image2 = function(sprite, context, x, y) {
            var tf = sprite._style._tf;
            context.ctx.drawTexture2(x, y, tf.translateX, tf.translateY, sprite.transform, 1, null, sprite._graphics._one);
        }, __proto._alpha = function(sprite, context, x, y) {
            var alpha;
            if (.01 < (alpha = sprite._style.alpha) || sprite._needRepaint()) {
                var temp = context.ctx.globalAlpha;
                context.ctx.globalAlpha *= alpha;
                var next = this._next;
                next._fun.call(next, sprite, context, x, y), context.ctx.globalAlpha = temp;
            }
        }, __proto._transform = function(sprite, context, x, y) {
            var transform = sprite.transform, _next = this._next;
            transform && _next != RenderSprite.NORENDER ? (context.save(), context.transform(transform.a, transform.b, transform.c, transform.d, transform.tx + x, transform.ty + y), 
            _next._fun.call(_next, sprite, context, 0, 0), context.restore()) : _next._fun.call(_next, sprite, context, x, y);
        }, __proto._childs = function(sprite, context, x, y) {
            var style = sprite._style, tf = style._tf;
            if (x = x - tf.translateX + style.paddingLeft, y = y - tf.translateY + style.paddingTop, 
            style._calculation) {
                var words = sprite._getWords();
                if (words) {
                    var tStyle = style;
                    tStyle && (tStyle.stroke ? context.fillBorderWords(words, x, y, tStyle.font, tStyle.color, tStyle.strokeColor, tStyle.stroke) : context.fillWords(words, x, y, tStyle.font, tStyle.color, "none" != tStyle.textDecoration && tStyle.underLine ? 1 : 0));
                }
            }
            var ele, childs = sprite._childs, n = childs.length;
            if (sprite.viewport || sprite.optimizeScrollRect && sprite._style.scrollRect) {
                var rect = sprite.viewport || sprite._style.scrollRect, left = rect.x, top = rect.y, right = rect.right, bottom = rect.bottom, _x = NaN, _y = NaN;
                for (i = 0; i < n; ++i) (ele = childs[i]).visible && (_x = ele._x) < right && _x + ele.width > left && (_y = ele._y) < bottom && _y + ele.height > top && ele.render(context, x, y);
            } else for (var i = 0; i < n; ++i) (ele = childs[i])._style.visible && ele.render(context, x, y);
        }, __proto._canvas = function(sprite, context, x, y) {
            var _cacheCanvas = sprite._$P.cacheCanvas;
            if (_cacheCanvas) {
                "bitmap" === _cacheCanvas.type ? Stat.canvasBitmap++ : Stat.canvasNormal++;
                var tx = _cacheCanvas.ctx;
                if (sprite._needRepaint() || !tx) this._canvas_repaint(sprite, context, x, y); else {
                    var tRec = _cacheCanvas._cacheRec;
                    context.drawCanvas(tx.canvas, x + tRec.x, y + tRec.y, tRec.width, tRec.height);
                }
            } else this._next._fun.call(this._next, sprite, context, x, y);
        }, __proto._canvas_repaint = function(sprite, context, x, y) {
            var _cacheCanvas = sprite._$P.cacheCanvas, _next = this._next;
            if (_cacheCanvas) {
                var canvas, left, top, tRec, tx = _cacheCanvas.ctx, _repaint = sprite._needRepaint() || !tx, tCacheType = _cacheCanvas.type;
                if ("bitmap" === tCacheType ? Stat.canvasBitmap++ : Stat.canvasNormal++, _repaint) {
                    var w, h;
                    _cacheCanvas._cacheRec || (_cacheCanvas._cacheRec = new Rectangle()), Render.isWebGL && "bitmap" !== tCacheType ? _cacheCanvas._cacheRec.setTo(-sprite.pivotX, -sprite.pivotY, 1, 1) : ((tRec = sprite.getSelfBounds()).x = tRec.x - sprite.pivotX, 
                    tRec.y = tRec.y - sprite.pivotY, tRec.x = tRec.x - 16, tRec.y = tRec.y - 16, tRec.width = tRec.width + 32, 
                    tRec.height = tRec.height + 32, tRec.x = Math.floor(tRec.x + x) - x, tRec.y = Math.floor(tRec.y + y) - y, 
                    tRec.width = Math.floor(tRec.width), tRec.height = Math.floor(tRec.height), _cacheCanvas._cacheRec.copyFrom(tRec)), 
                    tRec = _cacheCanvas._cacheRec;
                    var t, scaleX = Render.isWebGL ? 1 : Browser.pixelRatio * Laya.stage.clientScaleX, scaleY = Render.isWebGL ? 1 : Browser.pixelRatio * Laya.stage.clientScaleY;
                    if (!Render.isWebGL) {
                        var tar, chainScaleX = 1, chainScaleY = 1;
                        for (tar = sprite; tar && tar != Laya.stage; ) chainScaleX *= tar.scaleX, chainScaleY *= tar.scaleY, 
                        tar = tar.parent;
                        Render.isWebGL ? (chainScaleX < 1 && (scaleX *= chainScaleX), chainScaleY < 1 && (scaleY *= chainScaleY)) : (1 < chainScaleX && (scaleX *= chainScaleX), 
                        1 < chainScaleY && (scaleY *= chainScaleY));
                    }
                    if (sprite.scrollRect) {
                        var scrollRect = sprite.scrollRect;
                        tRec.x -= scrollRect.x, tRec.y -= scrollRect.y;
                    }
                    if (w = tRec.width * scaleX, h = tRec.height * scaleY, left = tRec.x, top = tRec.y, 
                    Render.isWebGL && "bitmap" === tCacheType && (2048 < w || 2048 < h)) return console.warn("cache bitmap size larger than 2048,cache ignored"), 
                    _cacheCanvas.ctx && (Pool.recover("RenderContext", _cacheCanvas.ctx), _cacheCanvas.ctx.canvas.size(0, 0), 
                    _cacheCanvas.ctx = null), void _next._fun.call(_next, sprite, context, x, y);
                    if (tx || (tx = _cacheCanvas.ctx = Pool.getItem("RenderContext") || new RenderContext(w, h, HTMLCanvas.create("AUTO"))), 
                    tx.ctx.sprite = sprite, (canvas = tx.canvas).clear(), (canvas.width != w || canvas.height != h) && canvas.size(w, h), 
                    "bitmap" === tCacheType ? canvas.context.asBitmap = !0 : "normal" === tCacheType && (canvas.context.asBitmap = !1), 
                    1 != scaleX || 1 != scaleY) {
                        var ctx = tx.ctx;
                        ctx.save(), ctx.scale(scaleX, scaleY), !Render.isConchWebGL && Render.isConchApp && (t = sprite._$P.cf) && ctx.setFilterMatrix && ctx.setFilterMatrix(t._mat, t._alpha), 
                        _next._fun.call(_next, sprite, tx, -left, -top), ctx.restore(), Render.isConchApp && !Render.isConchWebGL || sprite._applyFilters();
                    } else ctx = tx.ctx, !Render.isConchWebGL && Render.isConchApp && (t = sprite._$P.cf) && ctx.setFilterMatrix && ctx.setFilterMatrix(t._mat, t._alpha), 
                    _next._fun.call(_next, sprite, tx, -left, -top), Render.isConchApp && !Render.isConchWebGL || sprite._applyFilters();
                    sprite._$P.staticCache && (_cacheCanvas.reCache = !1), Stat.canvasReCache++;
                } else left = (tRec = _cacheCanvas._cacheRec).x, top = tRec.y, canvas = tx.canvas;
                context.drawCanvas(canvas, x + left, y + top, tRec.width, tRec.height);
            } else _next._fun.call(_next, sprite, tx, x, y);
        }, RenderSprite.__init__ = function() {
            var len, initRender, i = 0;
            for (initRender = RunDriver.createRenderSprite(69905, null), len = RenderSprite.renders.length = 4096, 
            i = 0; i < len; i++) RenderSprite.renders[i] = initRender;
            RenderSprite.renders[0] = RunDriver.createRenderSprite(0, null), function(value, o) {
                for (var n = 0, i = 0; i < value.length; i++) n |= value[i], RenderSprite.renders[n] = o;
            }([ 1, 512, 4, 2 ], new RenderSprite(1, null)), RenderSprite.renders[513] = RunDriver.createRenderSprite(513, null), 
            RenderSprite.renders[517] = new RenderSprite(517, null);
        }, RenderSprite._initRenderFun = function(sprite, context, x, y) {
            var type = sprite._renderType;
            (RenderSprite.renders[type] = RenderSprite._getTypeRender(type))._fun(sprite, context, x, y);
        }, RenderSprite._getTypeRender = function(type) {
            for (var rst = null, tType = 2048; 1 < tType; ) tType & type && (rst = RunDriver.createRenderSprite(tType, rst)), 
            tType >>= 1;
            return rst;
        }, RenderSprite.IMAGE = 1, RenderSprite.ALPHA = 2, RenderSprite.TRANSFORM = 4, RenderSprite.BLEND = 8, 
        RenderSprite.CANVAS = 16, RenderSprite.FILTERS = 32, RenderSprite.MASK = 64, RenderSprite.CLIP = 128, 
        RenderSprite.STYLE = 256, RenderSprite.GRAPHICS = 512, RenderSprite.CUSTOM = 1024, 
        RenderSprite.CHILDS = 2048, RenderSprite.INIT = 69905, RenderSprite.renders = [], 
        RenderSprite.NORENDER = new RenderSprite(0, null), RenderSprite;
    }(), Context = function() {
        function Context() {
            this._repaint = !1;
        }
        __class(Context, "laya.resource.Context");
        var __proto = Context.prototype;
        return __proto.replaceReset = function() {
            var len, key, i = 0;
            for (len = Context.replaceKeys.length, i = 0; i < len; i++) key = Context.replaceKeys[i], 
            this[Context.newKeys[i]] = this[key];
        }, __proto.replaceResotre = function() {
            this.__restore(), this.__reset();
        }, __proto.setIsMainContext = function() {}, __proto.drawTextures = function(tex, pos, tx, ty) {
            Stat.drawCall += pos.length / 2;
            for (var w = tex.width, h = tex.height, i = 0, sz = pos.length; i < sz; i += 2) this.drawTexture(tex, pos[i], pos[i + 1], w, h, tx, ty);
        }, __proto.drawCanvas = function(canvas, x, y, width, height) {
            Stat.drawCall++, this.drawImage(canvas.source, x, y, width, height);
        }, __proto.fillRect = function(x, y, width, height, style) {
            Stat.drawCall++, style && (this.fillStyle = style), this.__fillRect(x, y, width, height);
        }, __proto.fillText = function(text, x, y, font, color, textAlign) {
            Stat.drawCall++, 3 < arguments.length && null != font && (this.font = font, this.fillStyle = color, 
            this.textAlign = textAlign, this.textBaseline = "top"), this.__fillText(text, x, y);
        }, __proto.fillBorderText = function(text, x, y, font, fillColor, borderColor, lineWidth, textAlign) {
            Stat.drawCall++, this.font = font, this.fillStyle = fillColor, this.textBaseline = "top", 
            this.strokeStyle = borderColor, this.lineWidth = lineWidth, this.textAlign = textAlign, 
            this.__strokeText(text, x, y), this.__fillText(text, x, y);
        }, __proto.strokeText = function(text, x, y, font, color, lineWidth, textAlign) {
            Stat.drawCall++, 3 < arguments.length && null != font && (this.font = font, this.strokeStyle = color, 
            this.lineWidth = lineWidth, this.textAlign = textAlign, this.textBaseline = "top"), 
            this.__strokeText(text, x, y);
        }, __proto.transformByMatrix = function(value) {
            this.transform(value.a, value.b, value.c, value.d, value.tx, value.ty);
        }, __proto.setTransformByMatrix = function(value) {
            this.setTransform(value.a, value.b, value.c, value.d, value.tx, value.ty);
        }, __proto.clipRect = function(x, y, width, height) {
            Stat.drawCall++, this.beginPath(), this.rect(x, y, width, height), this.clip();
        }, __proto.drawTexture = function(tex, x, y, width, height, tx, ty) {
            Stat.drawCall++;
            var uv = tex.uv, w = tex.bitmap.width, h = tex.bitmap.height;
            this.drawImage(tex.source, uv[0] * w, uv[1] * h, (uv[2] - uv[0]) * w, (uv[5] - uv[3]) * h, x + tx, y + ty, width, height);
        }, __proto.drawTextureWithTransform = function(tex, x, y, width, height, m, tx, ty, alpha) {
            Stat.drawCall++;
            var uv = tex.uv, w = tex.bitmap.width, h = tex.bitmap.height;
            this.save(), 1 != alpha && (this.globalAlpha *= alpha), m ? (this.transform(m.a, m.b, m.c, m.d, m.tx + tx, m.ty + ty), 
            this.drawImage(tex.source, uv[0] * w, uv[1] * h, (uv[2] - uv[0]) * w, (uv[5] - uv[3]) * h, x, y, width, height)) : this.drawImage(tex.source, uv[0] * w, uv[1] * h, (uv[2] - uv[0]) * w, (uv[5] - uv[3]) * h, x + tx, y + ty, width, height), 
            this.restore();
        }, __proto.drawTexture2 = function(x, y, pivotX, pivotY, m, alpha, blendMode, args2) {
            var tex = args2[0];
            if (tex.loaded && tex.bitmap && tex.source) {
                Stat.drawCall++;
                var alphaChanged = 1 !== alpha;
                if (alphaChanged) {
                    var temp = this.globalAlpha;
                    this.globalAlpha *= alpha;
                }
                var uv = tex.uv, w = tex.bitmap.width, h = tex.bitmap.height;
                m ? (this.save(), this.transform(m.a, m.b, m.c, m.d, m.tx + x, m.ty + y), this.drawImage(tex.source, uv[0] * w, uv[1] * h, (uv[2] - uv[0]) * w, (uv[5] - uv[3]) * h, args2[1] - pivotX, args2[2] - pivotY, args2[3], args2[4]), 
                this.restore()) : this.drawImage(tex.source, uv[0] * w, uv[1] * h, (uv[2] - uv[0]) * w, (uv[5] - uv[3]) * h, args2[1] - pivotX + x, args2[2] - pivotY + y, args2[3], args2[4]), 
                alphaChanged && (this.globalAlpha = temp);
            }
        }, __proto.fillTexture = function(texture, x, y, width, height, type, offset, other) {
            if (!other.pat) {
                if (texture.uv != Texture.DEF_UV) {
                    var canvas = new HTMLCanvas("2D");
                    canvas.getContext("2d"), canvas.size(texture.width, texture.height), canvas.context.drawTexture(texture, 0, 0, texture.width, texture.height, 0, 0), 
                    texture = new Texture(canvas);
                }
                other.pat = this.createPattern(texture.bitmap.source, type);
            }
            var oX = x, oY = y, sX = 0, sY = 0;
            offset && (oX += offset.x % texture.width, oY += offset.y % texture.height, sX -= offset.x % texture.width, 
            sY -= offset.y % texture.height), this.translate(oX, oY), this.fillRect(sX, sY, width, height, other.pat), 
            this.translate(-oX, -oY);
        }, __proto.drawTriangle = function(texture, vertices, uvs, index0, index1, index2, matrix, canvasPadding) {
            var source = texture.bitmap, textureSource = source.source, textureWidth = texture.width, textureHeight = texture.height, sourceWidth = source.width, sourceHeight = source.height, u0 = uvs[index0] * sourceWidth, u1 = uvs[index1] * sourceWidth, u2 = uvs[index2] * sourceWidth, v0 = uvs[index0 + 1] * sourceHeight, v1 = uvs[index1 + 1] * sourceHeight, v2 = uvs[index2 + 1] * sourceHeight, x0 = vertices[index0], x1 = vertices[index1], x2 = vertices[index2], y0 = vertices[index0 + 1], y1 = vertices[index1 + 1], y2 = vertices[index2 + 1];
            if (canvasPadding) {
                var centerX = (x0 + x1 + x2) / 3, centerY = (y0 + y1 + y2) / 3, normX = x0 - centerX, normY = y0 - centerY, dist = Math.sqrt(normX * normX + normY * normY);
                x0 = centerX + normX / dist * (dist + 1), y0 = centerY + normY / dist * (dist + 1), 
                normY = y1 - centerY, x1 = centerX + (normX = x1 - centerX) / (dist = Math.sqrt(normX * normX + normY * normY)) * (dist + 1), 
                y1 = centerY + normY / dist * (dist + 1), normY = y2 - centerY, x2 = centerX + (normX = x2 - centerX) / (dist = Math.sqrt(normX * normX + normY * normY)) * (dist + 1), 
                y2 = centerY + normY / dist * (dist + 1);
            }
            this.save(), matrix && this.transform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.tx, matrix.ty), 
            this.beginPath(), this.moveTo(x0, y0), this.lineTo(x1, y1), this.lineTo(x2, y2), 
            this.closePath(), this.clip();
            var dDelta = 1 / (u0 * v1 + v0 * u2 + u1 * v2 - v1 * u2 - v0 * u1 - u0 * v2), deltaA = x0 * v1 + v0 * x2 + x1 * v2 - v1 * x2 - v0 * x1 - x0 * v2, deltaB = u0 * x1 + x0 * u2 + u1 * x2 - x1 * u2 - x0 * u1 - u0 * x2, deltaC = u0 * v1 * x2 + v0 * x1 * u2 + x0 * u1 * v2 - x0 * v1 * u2 - v0 * u1 * x2 - u0 * x1 * v2, deltaD = y0 * v1 + v0 * y2 + y1 * v2 - v1 * y2 - v0 * y1 - y0 * v2, deltaE = u0 * y1 + y0 * u2 + u1 * y2 - y1 * u2 - y0 * u1 - u0 * y2, deltaF = u0 * v1 * y2 + v0 * y1 * u2 + y0 * u1 * v2 - y0 * v1 * u2 - v0 * u1 * y2 - u0 * y1 * v2;
            this.transform(deltaA * dDelta, deltaD * dDelta, deltaB * dDelta, deltaE * dDelta, deltaC * dDelta, deltaF * dDelta), 
            this.drawImage(textureSource, texture.uv[0] * sourceWidth, texture.uv[1] * sourceHeight, textureWidth, textureHeight, texture.uv[0] * sourceWidth, texture.uv[1] * sourceHeight, textureWidth, textureHeight), 
            this.restore();
        }, __proto.flush = function() {
            return 0;
        }, __proto.fillWords = function(words, x, y, font, color, underLine) {
            font && (this.font = font), color && (this.fillStyle = color);
            this.textBaseline = "top", this.textAlign = "left";
            for (var i = 0, n = words.length; i < n; i++) {
                var a = words[i];
                if (this.__fillText(a.char, a.x + x, a.y + y), 1 === underLine) {
                    var tHeight = a.height, dX = .5 * a.style.letterSpacing;
                    dX || (dX = 0), this.beginPath(), this.strokeStyle = color, this.lineWidth = 1, 
                    this.moveTo(x + a.x - dX + .5, y + a.y + tHeight + .5), this.lineTo(x + a.x + a.width + dX + .5, y + a.y + tHeight + .5), 
                    this.stroke();
                }
            }
        }, __proto.fillBorderWords = function(words, x, y, font, color, borderColor, lineWidth) {
            font && (this.font = font), color && (this.fillStyle = color), this.textBaseline = "top", 
            this.lineWidth = lineWidth, this.textAlign = "left", this.strokeStyle = borderColor;
            for (var i = 0, n = words.length; i < n; i++) {
                var a = words[i];
                this.__strokeText(a.char, a.x + x, a.y + y), this.__fillText(a.char, a.x + x, a.y + y);
            }
        }, __proto.destroy = function() {
            this.canvas.width = this.canvas.height = 0;
        }, __proto.clear = function() {
            this.clearRect(0, 0, this._canvas.width, this._canvas.height), this._repaint = !1;
        }, __proto.drawCurves = function(x, y, args) {
            this.beginPath(), this.strokeStyle = args[3], this.lineWidth = args[4];
            var points = args[2];
            x += args[0], y += args[1], this.moveTo(x + points[0], y + points[1]);
            for (var i = 2, n = points.length; i < n; ) this.quadraticCurveTo(x + points[i++], y + points[i++], x + points[i++], y + points[i++]);
            this.stroke();
        }, Context.__init__ = function(to) {
            var from = laya.resource.Context.prototype;
            if (!(to = to || CanvasRenderingContext2D.prototype).inited) {
                to.inited = !0, to.__fillText = to.fillText, to.__fillRect = to.fillRect, to.__strokeText = to.strokeText;
                [ "drawTextures", "drawTriangle", "fillWords", "fillBorderWords", "setIsMainContext", "fillRect", "strokeText", "fillTexture", "fillText", "transformByMatrix", "setTransformByMatrix", "clipRect", "drawTexture", "drawTexture2", "drawTextureWithTransform", "flush", "clear", "destroy", "drawCanvas", "fillBorderText", "drawCurves" ].forEach(function(i) {
                    to[i] = from[i];
                });
            }
        }, Context.replaceCanvasGetSet = function(tar, key) {
            var oldO = Object.getOwnPropertyDescriptor(tar, key);
            if (!oldO || !oldO.configurable) return !1;
            var tkey, newO = {};
            for (tkey in oldO) "set" != tkey && (newO[tkey] = oldO[tkey]);
            var preFun = oldO.set;
            return newO.set = function(v) {
                preFun.call(this, v);
                var _ct = this.getContext("2d");
                _ct && "__reset" in _ct && _ct.__reset();
            }, Object.defineProperty(tar, key, newO), !0;
        }, Context.replaceGetSet = function(tar, key) {
            var oldO = Object.getOwnPropertyDescriptor(tar, key);
            if (!oldO || !oldO.configurable) return !1;
            var tkey, newO = {};
            for (tkey in oldO) "set" != tkey && (newO[tkey] = oldO[tkey]);
            var preFun = oldO.set, dataKey = "___" + key + "__";
            return Context.newKeys.push(dataKey), newO.set = function(v) {
                v != this[dataKey] && (this[dataKey] = v, preFun.call(this, v));
            }, Object.defineProperty(tar, key, newO), !0;
        }, Context._default = new Context(), Context.newKeys = [], __static(Context, [ "replaceKeys", function() {
            return this.replaceKeys = [ "font", "fillStyle", "textBaseline" ];
        } ]), Context;
    }(), ResourceManager = function() {
        function ResourceManager(name) {
            this._id = 0, this._name = null, this._resources = null, this._memorySize = 0, this._garbageCollectionRate = NaN, 
            this._isOverflow = !1, this.autoRelease = !1, this.autoReleaseMaxSize = 0, this._id = ++ResourceManager._uniqueIDCounter, 
            this._name = name || "Content Manager", ResourceManager._isResourceManagersSorted = !1, 
            this._memorySize = 0, this._isOverflow = !1, this.autoRelease = !1, this.autoReleaseMaxSize = 536870912, 
            this._garbageCollectionRate = .2, ResourceManager._resourceManagers.push(this), 
            this._resources = [];
        }
        __class(ResourceManager, "laya.resource.ResourceManager");
        var __proto = ResourceManager.prototype;
        return Laya.imps(__proto, {
            "laya.resource.IDispose": !0
        }), __proto.getResourceByIndex = function(index) {
            return this._resources[index];
        }, __proto.getResourcesLength = function() {
            return this._resources.length;
        }, __proto.addResource = function(resource) {
            return resource.resourceManager && resource.resourceManager.removeResource(resource), 
            -1 === this._resources.indexOf(resource) && ((resource._resourceManager = this)._resources.push(resource), 
            this.addSize(resource.memorySize), !0);
        }, __proto.removeResource = function(resource) {
            var index = this._resources.indexOf(resource);
            return -1 !== index && (this._resources.splice(index, 1), resource._resourceManager = null, 
            this._memorySize -= resource.memorySize, !0);
        }, __proto.unload = function() {
            for (var tempResources = this._resources.slice(0, this._resources.length), i = 0; i < tempResources.length; i++) {
                tempResources[i].destroy();
            }
            tempResources.length = 0;
        }, __proto.dispose = function() {
            if (this === ResourceManager._systemResourceManager) throw new Error("systemResourceManager不能被释放！");
            ResourceManager._resourceManagers.splice(ResourceManager._resourceManagers.indexOf(this), 1), 
            ResourceManager._isResourceManagersSorted = !1;
            for (var tempResources = this._resources.slice(0, this._resources.length), i = 0; i < tempResources.length; i++) {
                var resource = tempResources[i];
                resource.resourceManager.removeResource(resource), resource.destroy();
            }
            tempResources.length = 0;
        }, __proto.addSize = function(add) {
            add && (this.autoRelease && 0 < add && this._memorySize + add > this.autoReleaseMaxSize && this.garbageCollection((1 - this._garbageCollectionRate) * this.autoReleaseMaxSize), 
            this._memorySize += add);
        }, __proto.garbageCollection = function(reserveSize) {
            var all = this._resources;
            (all = all.slice()).sort(function(a, b) {
                if (!a || !b) throw new Error("a或b不能为空！");
                return a.released && b.released ? 0 : a.released ? 1 : b.released ? -1 : a._lastUseFrameCount - b._lastUseFrameCount;
            });
            for (var currentFrameCount = Stat.loopCount, i = 0, n = all.length; i < n; i++) {
                var resou = all[i];
                if (!(1 < currentFrameCount - resou._lastUseFrameCount)) return void (this._memorySize >= reserveSize && (this._isOverflow = !0));
                if (resou.releaseResource(), this._memorySize < reserveSize) return void (this._isOverflow = !1);
            }
        }, __getset(0, __proto, "id", function() {
            return this._id;
        }), __getset(0, __proto, "name", function() {
            return this._name;
        }, function(value) {
            !value && "" === value || this._name === value || (this._name = value, ResourceManager._isResourceManagersSorted = !1);
        }), __getset(0, __proto, "memorySize", function() {
            return this._memorySize;
        }), __getset(1, ResourceManager, "systemResourceManager", function() {
            return ResourceManager._systemResourceManager;
        }), ResourceManager.__init__ = function() {
            ResourceManager.currentResourceManager = ResourceManager.systemResourceManager;
        }, ResourceManager.getLoadedResourceManagerByIndex = function(index) {
            return ResourceManager._resourceManagers[index];
        }, ResourceManager.getLoadedResourceManagersCount = function() {
            return ResourceManager._resourceManagers.length;
        }, ResourceManager.recreateContentManagers = function(force) {
            void 0 === force && (force = !1);
            for (var temp = ResourceManager.currentResourceManager, i = 0; i < ResourceManager._resourceManagers.length; i++) {
                ResourceManager.currentResourceManager = ResourceManager._resourceManagers[i];
                for (var j = 0; j < ResourceManager.currentResourceManager._resources.length; j++) ResourceManager.currentResourceManager._resources[j].releaseResource(force), 
                ResourceManager.currentResourceManager._resources[j].activeResource(force);
            }
            ResourceManager.currentResourceManager = temp;
        }, ResourceManager.releaseContentManagers = function(force) {
            void 0 === force && (force = !1);
            for (var temp = ResourceManager.currentResourceManager, i = 0; i < ResourceManager._resourceManagers.length; i++) {
                ResourceManager.currentResourceManager = ResourceManager._resourceManagers[i];
                for (var j = 0; j < ResourceManager.currentResourceManager._resources.length; j++) {
                    var resource = ResourceManager.currentResourceManager._resources[j];
                    !resource.released && resource.releaseResource(force);
                }
            }
            ResourceManager.currentResourceManager = temp;
        }, ResourceManager._uniqueIDCounter = 0, ResourceManager._isResourceManagersSorted = !1, 
        ResourceManager._resourceManagers = [], __static(ResourceManager, [ "_systemResourceManager", function() {
            return this._systemResourceManager = new ResourceManager("System Resource Manager");
        }, "currentResourceManager", function() {
            return this.currentResourceManager = ResourceManager._systemResourceManager;
        } ]), ResourceManager;
    }(), Browser = (function() {
        function System() {}
        __class(System, "laya.system.System"), System.changeDefinition = function(name, classObj) {
            Laya[name] = classObj;
            var str = name + "=classObj";
            Laya._runScript(str);
        }, System.__init__ = function() {
            Render.isConchApp && (conch.disableConchResManager(), conch.disableConchAutoRestoreLostedDevice());
        };
    }(), function() {
        function Browser() {}
        return __class(Browser, "laya.utils.Browser"), __getset(1, Browser, "pixelRatio", function() {
            return Browser.__init__(), -1 < Browser.userAgent.indexOf("Mozilla/6.0(Linux; Android 6.0; HUAWEI NXT-AL10 Build/HUAWEINXT-AL10)") ? 2 : RunDriver.getPixelRatio();
        }), __getset(1, Browser, "height", function() {
            return Browser.__init__(), (Laya.stage && Laya.stage.canvasRotation ? Browser.clientWidth : Browser.clientHeight) * Browser.pixelRatio;
        }), __getset(1, Browser, "clientWidth", function() {
            return Browser.__init__(), Browser.window.innerWidth || Browser.document.body.clientWidth;
        }), __getset(1, Browser, "window", function() {
            return Browser.__init__(), Browser._window;
        }), __getset(1, Browser, "clientHeight", function() {
            return Browser.__init__(), Browser.window.innerHeight || Browser.document.body.clientHeight || Browser.document.documentElement.clientHeight;
        }), __getset(1, Browser, "width", function() {
            return Browser.__init__(), (Laya.stage && Laya.stage.canvasRotation ? Browser.clientHeight : Browser.clientWidth) * Browser.pixelRatio;
        }), __getset(1, Browser, "container", function() {
            return Browser.__init__(), Browser._container || ((Browser._container = Browser.createElement("div")).id = "GameContainer" + Math.random(), 
            Browser.document.body.appendChild(Browser._container)), Browser._container;
        }, function(value) {
            Browser._container = value;
        }), __getset(1, Browser, "document", function() {
            return Browser.__init__(), Browser._document;
        }), Browser.__init__ = function() {
            if (!Browser._window) {
                Browser._window = RunDriver.getWindow(), Browser._document = Browser.window.document, 
                Browser._window.addEventListener("message", function(e) {
                    laya.utils.Browser._onMessage(e);
                }, !1), Browser.document.__createElement = Browser.document.createElement, window.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(c) {
                    return window.setTimeout(c, 1e3 / 60);
                };
                var $BS = window.document.body.style;
                $BS["-webkit-user-select"] = "none", $BS["-webkit-tap-highlight-color"] = "rgba(200,200,200,0)", 
                Browser.userAgent = Browser.window.navigator.userAgent, Browser.onIOS = !!(Browser.u = Browser.userAgent).match(/\(i[^;]+;(U;)? CPU.+Mac OS X/), 
                Browser.onMobile = -1 < Browser.u.indexOf("Mobile"), Browser.onIPhone = -1 < Browser.u.indexOf("iPhone"), 
                Browser.onMac = -1 < Browser.u.indexOf("Mac OS X"), Browser.onIPad = -1 < Browser.u.indexOf("iPad"), 
                Browser.onAndroid = -1 < Browser.u.indexOf("Android") || -1 < Browser.u.indexOf("Adr"), 
                Browser.onWP = -1 < Browser.u.indexOf("Windows Phone"), Browser.onQQBrowser = -1 < Browser.u.indexOf("QQBrowser"), 
                Browser.onMQQBrowser = -1 < Browser.u.indexOf("MQQBrowser") || -1 < Browser.u.indexOf("Mobile") && -1 < Browser.u.indexOf("QQ"), 
                Browser.onIE = !!Browser.window.ActiveXObject || "ActiveXObject" in Browser.window, 
                Browser.onWeiXin = -1 < Browser.u.indexOf("MicroMessenger"), Browser.onPC = !Browser.onMobile, 
                Browser.onSafari = -1 < Browser.u.indexOf("Safari"), Browser.onFirefox = -1 < Browser.u.indexOf("Firefox"), 
                Browser.onEdge = -1 < Browser.u.indexOf("Edge"), Browser.onMiniGame = -1 < Browser.u.indexOf("MiniGame"), 
                Browser.onLimixiu = -1 < Browser.u.indexOf("limixiu"), Browser.httpProtocol = "http:" == Browser.window.location.protocol, 
                Browser.onMiniGame && null == Browser.window.focus && console.error("请先初始化小游戏适配库，详细教程https://ldc.layabox.com/doc/?nav=zh-ts-5-0-0"), 
                Browser.webAudioEnabled = !!(Browser.window.AudioContext || Browser.window.webkitAudioContext || Browser.window.mozAudioContext), 
                Browser.soundType = Browser.webAudioEnabled ? "WEBAUDIOSOUND" : "AUDIOSOUND", Sound = Browser.webAudioEnabled ? WebAudioSound : AudioSound, 
                Browser.webAudioEnabled && WebAudioSound.initWebAudio(), AudioSound._initMusicAudio(), 
                Browser.enableTouch = "ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch, 
                window.focus(), SoundManager._soundClass = Sound, SoundManager._musicClass = AudioSound, 
                Render._mainCanvas = Render._mainCanvas || HTMLCanvas.create("2D"), Browser.canvas || (Browser.canvas = HTMLCanvas.create("2D"), 
                Browser.context = Browser.canvas.getContext("2d"));
            }
        }, Browser._onMessage = function(e) {
            if (e.data && "size" == e.data.name) {
                if (Browser.window.innerWidth = e.data.width, Browser.window.innerHeight = e.data.height, 
                Browser.window.__innerHeight = e.data.clientHeight, !Browser.document.createEvent) return void console.warn("no document.createEvent");
                var evt = Browser.document.createEvent("HTMLEvents");
                return evt.initEvent("resize", !1, !1), void Browser.window.dispatchEvent(evt);
            }
        }, Browser.createElement = function(type) {
            return Browser.__init__(), Browser.document.__createElement(type);
        }, Browser.getElementById = function(type) {
            return Browser.__init__(), Browser.document.getElementById(type);
        }, Browser.removeElement = function(ele) {
            ele && ele.parentNode && ele.parentNode.removeChild(ele);
        }, Browser.now = function() {
            return RunDriver.now();
        }, Browser._window = null, Browser._document = null, Browser._container = null, 
        Browser.userAgent = null, Browser.u = null, Browser.onIOS = !1, Browser.onMac = !1, 
        Browser.onMobile = !1, Browser.onIPhone = !1, Browser.onIPad = !1, Browser.onAndroid = !1, 
        Browser.onWP = !1, Browser.onQQBrowser = !1, Browser.onMQQBrowser = !1, Browser.onSafari = !1, 
        Browser.onFirefox = !1, Browser.onEdge = !1, Browser.onIE = !1, Browser.onWeiXin = !1, 
        Browser.onMiniGame = !1, Browser.onLimixiu = !1, Browser.onPC = !1, Browser.httpProtocol = !1, 
        Browser.webAudioEnabled = !1, Browser.soundType = null, Browser.enableTouch = !1, 
        Browser.canvas = null, Browser.context = null, Browser.__init$ = function() {}, 
        Browser;
    }()), Byte = function() {
        function Byte(data) {
            this._xd_ = !0, this._allocated_ = 8, this._pos_ = 0, this._length = 0, data ? (this._u8d_ = new Uint8Array(data), 
            this._d_ = new DataView(this._u8d_.buffer), this._length = this._d_.byteLength) : this.___resizeBuffer(this._allocated_);
        }
        __class(Byte, "laya.utils.Byte");
        var __proto = Byte.prototype;
        return __proto.___resizeBuffer = function(len) {
            try {
                var newByteView = new Uint8Array(len);
                null != this._u8d_ && (this._u8d_.length <= len ? newByteView.set(this._u8d_) : newByteView.set(this._u8d_.subarray(0, len))), 
                this._u8d_ = newByteView, this._d_ = new DataView(newByteView.buffer);
            } catch (err) {
                err = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(err);
                throw "___resizeBuffer err:" + len;
            }
        }, __proto.getString = function() {
            return this.rUTF(this.getUint16());
        }, __proto.getFloat32Array = function(start, len) {
            var end = start + len;
            end = end > this._length ? this._length : end;
            var v = new Float32Array(this._d_.buffer.slice(start, end));
            return this._pos_ = end, v;
        }, __proto.getUint8Array = function(start, len) {
            var end = start + len;
            end = end > this._length ? this._length : end;
            var v = new Uint8Array(this._d_.buffer.slice(start, end));
            return this._pos_ = end, v;
        }, __proto.getInt16Array = function(start, len) {
            var end = start + len;
            end = end > this._length ? this._length : end;
            var v = new Int16Array(this._d_.buffer.slice(start, end));
            return this._pos_ = end, v;
        }, __proto.getFloat32 = function() {
            if (this._pos_ + 4 > this._length) throw "getFloat32 error - Out of bounds";
            var v = this._d_.getFloat32(this._pos_, this._xd_);
            return this._pos_ += 4, v;
        }, __proto.getFloat64 = function() {
            if (this._pos_ + 8 > this._length) throw "getFloat64 error - Out of bounds";
            var v = this._d_.getFloat64(this._pos_, this._xd_);
            return this._pos_ += 8, v;
        }, __proto.writeFloat32 = function(value) {
            this.ensureWrite(this._pos_ + 4), this._d_.setFloat32(this._pos_, value, this._xd_), 
            this._pos_ += 4;
        }, __proto.writeFloat64 = function(value) {
            this.ensureWrite(this._pos_ + 8), this._d_.setFloat64(this._pos_, value, this._xd_), 
            this._pos_ += 8;
        }, __proto.getInt32 = function() {
            if (this._pos_ + 4 > this._length) throw "getInt32 error - Out of bounds";
            var float = this._d_.getInt32(this._pos_, this._xd_);
            return this._pos_ += 4, float;
        }, __proto.getUint32 = function() {
            if (this._pos_ + 4 > this._length) throw "getUint32 error - Out of bounds";
            var v = this._d_.getUint32(this._pos_, this._xd_);
            return this._pos_ += 4, v;
        }, __proto.writeInt32 = function(value) {
            this.ensureWrite(this._pos_ + 4), this._d_.setInt32(this._pos_, value, this._xd_), 
            this._pos_ += 4;
        }, __proto.writeUint32 = function(value) {
            this.ensureWrite(this._pos_ + 4), this._d_.setUint32(this._pos_, value, this._xd_), 
            this._pos_ += 4;
        }, __proto.getInt16 = function() {
            if (this._pos_ + 2 > this._length) throw "getInt16 error - Out of bounds";
            var us = this._d_.getInt16(this._pos_, this._xd_);
            return this._pos_ += 2, us;
        }, __proto.getUint16 = function() {
            if (this._pos_ + 2 > this._length) throw "getUint16 error - Out of bounds";
            var us = this._d_.getUint16(this._pos_, this._xd_);
            return this._pos_ += 2, us;
        }, __proto.writeUint16 = function(value) {
            this.ensureWrite(this._pos_ + 2), this._d_.setUint16(this._pos_, value, this._xd_), 
            this._pos_ += 2;
        }, __proto.writeInt16 = function(value) {
            this.ensureWrite(this._pos_ + 2), this._d_.setInt16(this._pos_, value, this._xd_), 
            this._pos_ += 2;
        }, __proto.getUint8 = function() {
            if (this._pos_ + 1 > this._length) throw "getUint8 error - Out of bounds";
            return this._d_.getUint8(this._pos_++);
        }, __proto.writeUint8 = function(value) {
            this.ensureWrite(this._pos_ + 1), this._d_.setUint8(this._pos_, value), this._pos_++;
        }, __proto._getUInt8 = function(pos) {
            return this._d_.getUint8(pos);
        }, __proto._getUint16 = function(pos) {
            return this._d_.getUint16(pos, this._xd_);
        }, __proto._getMatrix = function() {
            return new Matrix(this.getFloat32(), this.getFloat32(), this.getFloat32(), this.getFloat32(), this.getFloat32(), this.getFloat32());
        }, __proto.rUTF = function(len) {
            for (var v = [], max = this._pos_ + len, c = 0, c2 = 0, c3 = 0, f = String.fromCharCode, u = this._u8d_; this._pos_ < max; ) (c = u[this._pos_++]) < 128 ? 0 != c && v.push(f(c)) : c < 224 ? v.push(f((63 & c) << 6 | 127 & u[this._pos_++])) : c < 240 ? (c2 = u[this._pos_++], 
            v.push(f((31 & c) << 12 | (127 & c2) << 6 | 127 & u[this._pos_++]))) : (c2 = u[this._pos_++], 
            c3 = u[this._pos_++], v.push(f((15 & c) << 18 | (127 & c2) << 12 | c3 << 6 & 127 | 127 & u[this._pos_++]))), 
            0;
            return v.join("");
        }, __proto.getCustomString = function(len) {
            for (var v = [], ulen = 0, c = 0, c2 = 0, f = String.fromCharCode, u = this._u8d_; 0 < len; ) if ((c = u[this._pos_]) < 128) v.push(f(c)), 
            this._pos_++, len--; else for (ulen = c - 128, this._pos_++, len -= ulen; 0 < ulen; ) c = u[this._pos_++], 
            c2 = u[this._pos_++], v.push(f(c2 << 8 | c)), ulen--;
            return v.join("");
        }, __proto.clear = function() {
            this._pos_ = 0, this.length = 0;
        }, __proto.__getBuffer = function() {
            return this._d_.buffer;
        }, __proto.writeUTFBytes = function(value) {
            for (var i = 0, sz = (value += "").length; i < sz; i++) {
                var c = value.charCodeAt(i);
                c <= 127 ? this.writeByte(c) : c <= 2047 ? (this.ensureWrite(this._pos_ + 2), this._u8d_.set([ 192 | c >> 6, 128 | 63 & c ], this._pos_), 
                this._pos_ += 2) : c <= 65535 ? (this.ensureWrite(this._pos_ + 3), this._u8d_.set([ 224 | c >> 12, 128 | c >> 6 & 63, 128 | 63 & c ], this._pos_), 
                this._pos_ += 3) : (this.ensureWrite(this._pos_ + 4), this._u8d_.set([ 240 | c >> 18, 128 | c >> 12 & 63, 128 | c >> 6 & 63, 128 | 63 & c ], this._pos_), 
                this._pos_ += 4);
            }
        }, __proto.writeUTFString = function(value) {
            var tPos = this.pos;
            this.writeUint16(1), this.writeUTFBytes(value);
            var dPos = this.pos - tPos - 2;
            if (65536 <= dPos) throw "writeUTFString byte len more than 65536";
            this._d_.setUint16(tPos, dPos, this._xd_);
        }, __proto.readUTFString = function() {
            return this.readUTFBytes(this.getUint16());
        }, __proto.getUTFString = function() {
            return this.readUTFString();
        }, __proto.readUTFBytes = function(len) {
            if (void 0 === len && (len = -1), 0 == len) return "";
            var lastBytes = this.bytesAvailable;
            if (lastBytes < len) throw "readUTFBytes error - Out of bounds";
            return len = 0 < len ? len : lastBytes, this.rUTF(len);
        }, __proto.getUTFBytes = function(len) {
            return void 0 === len && (len = -1), this.readUTFBytes(len);
        }, __proto.writeByte = function(value) {
            this.ensureWrite(this._pos_ + 1), this._d_.setInt8(this._pos_, value), this._pos_ += 1;
        }, __proto.readByte = function() {
            if (this._pos_ + 1 > this._length) throw "readByte error - Out of bounds";
            return this._d_.getInt8(this._pos_++);
        }, __proto.getByte = function() {
            return this.readByte();
        }, __proto.ensureWrite = function(lengthToEnsure) {
            this._length < lengthToEnsure && (this._length = lengthToEnsure), this._allocated_ < lengthToEnsure && (this.length = lengthToEnsure);
        }, __proto.writeArrayBuffer = function(arraybuffer, offset, length) {
            if (void 0 === offset && (offset = 0), void 0 === length && (length = 0), offset < 0 || length < 0) throw "writeArrayBuffer error - Out of bounds";
            0 == length && (length = arraybuffer.byteLength - offset), this.ensureWrite(this._pos_ + length);
            var uint8array = new Uint8Array(arraybuffer);
            this._u8d_.set(uint8array.subarray(offset, offset + length), this._pos_), this._pos_ += length;
        }, __getset(0, __proto, "buffer", function() {
            var rstBuffer = this._d_.buffer;
            return rstBuffer.byteLength == this.length ? rstBuffer : rstBuffer.slice(0, this.length);
        }), __getset(0, __proto, "endian", function() {
            return this._xd_ ? "littleEndian" : "bigEndian";
        }, function(endianStr) {
            this._xd_ = "littleEndian" == endianStr;
        }), __getset(0, __proto, "length", function() {
            return this._length;
        }, function(value) {
            this._allocated_ < value ? this.___resizeBuffer(this._allocated_ = Math.floor(Math.max(value, 2 * this._allocated_))) : this._allocated_ > value && this.___resizeBuffer(this._allocated_ = value), 
            this._length = value;
        }), __getset(0, __proto, "pos", function() {
            return this._pos_;
        }, function(value) {
            this._pos_ = value;
        }), __getset(0, __proto, "bytesAvailable", function() {
            return this._length - this._pos_;
        }), Byte.getSystemEndian = function() {
            if (!Byte._sysEndian) {
                var buffer = new ArrayBuffer(2);
                new DataView(buffer).setInt16(0, 256, !0), Byte._sysEndian = 256 === new Int16Array(buffer)[0] ? "littleEndian" : "bigEndian";
            }
            return Byte._sysEndian;
        }, Byte.BIG_ENDIAN = "bigEndian", Byte.LITTLE_ENDIAN = "littleEndian", Byte._sysEndian = null, 
        Byte;
    }(), CacheManager = function() {
        function CacheManager() {}
        return __class(CacheManager, "laya.utils.CacheManager"), CacheManager.regCacheByFunction = function(disposeFunction, getCacheListFunction) {
            var cache;
            CacheManager.unRegCacheByFunction(disposeFunction, getCacheListFunction), cache = {
                tryDispose: disposeFunction,
                getCacheList: getCacheListFunction
            }, CacheManager._cacheList.push(cache);
        }, CacheManager.unRegCacheByFunction = function(disposeFunction, getCacheListFunction) {
            var len, i = 0;
            for (len = CacheManager._cacheList.length, i = 0; i < len; i++) if (CacheManager._cacheList[i].tryDispose == disposeFunction && CacheManager._cacheList[i].getCacheList == getCacheListFunction) return void CacheManager._cacheList.splice(i, 1);
        }, CacheManager.forceDispose = function() {
            var i = 0, len = CacheManager._cacheList.length;
            for (i = 0; i < len; i++) CacheManager._cacheList[i].tryDispose(!0);
        }, CacheManager.beginCheck = function(waitTime) {
            void 0 === waitTime && (waitTime = 15e3), Laya.timer.loop(waitTime, null, CacheManager._checkLoop);
        }, CacheManager.stopCheck = function() {
            Laya.timer.clear(null, CacheManager._checkLoop);
        }, CacheManager._checkLoop = function() {
            var cacheList = CacheManager._cacheList;
            if (!(cacheList.length < 1)) {
                var len, tTime = Browser.now(), count = 0;
                for (len = count = cacheList.length; 0 < count && (cacheList[CacheManager._index = ++CacheManager._index % len].tryDispose(!1), 
                !(Browser.now() - tTime > CacheManager.loopTimeLimit)); ) count--;
            }
        }, CacheManager.loopTimeLimit = 2, CacheManager._cacheList = [], CacheManager._index = 0, 
        CacheManager;
    }(), ClassUtils = function() {
        function ClassUtils() {}
        return __class(ClassUtils, "laya.utils.ClassUtils"), ClassUtils.regClass = function(className, classDef) {
            ClassUtils._classMap[className] = classDef;
        }, ClassUtils.getRegClass = function(className) {
            return ClassUtils._classMap[className];
        }, ClassUtils.getInstance = function(className) {
            var compClass = ClassUtils.getClass(className);
            return compClass ? new compClass() : (console.warn("[error] Undefined class:", className), 
            null);
        }, ClassUtils.createByJson = function(json, node, root, customHandler, instanceHandler) {
            "string" == typeof json && (json = JSON.parse(json));
            var props = json.props;
            if (!node && !(node = instanceHandler ? instanceHandler.runWith(json) : ClassUtils.getInstance(props.runtime || json.type))) return null;
            var child = json.child;
            if (child) for (var i = 0, n = child.length; i < n; i++) {
                var data = child[i];
                if ("render" !== data.props.name && "render" !== data.props.renderType || !node._$set_itemRender) if ("Graphic" == data.type) ClassUtils.addGraphicsToSprite(data, node); else if (ClassUtils.isDrawType(data.type)) ClassUtils.addGraphicToSprite(data, node, !0); else {
                    var tChild = ClassUtils.createByJson(data, null, root, customHandler, instanceHandler);
                    "Script" == data.type ? tChild.hasOwnProperty("owner") ? tChild.owner = node : tChild.hasOwnProperty("target") && (tChild.target = node) : "mask" == data.props.renderType ? node.mask = tChild : node.addChild(tChild);
                } else node.itemRender = data;
            }
            if (props) for (var prop in props) {
                var value = props[prop];
                "var" === prop && root ? root[value] = node : value instanceof Array && "function" == typeof node[prop] ? node[prop].apply(node, value) : node[prop] = value;
            }
            return customHandler && json.customProps && customHandler.runWith([ node, json ]), 
            node.created && node.created(), node;
        }, ClassUtils.addGraphicsToSprite = function(graphicO, sprite) {
            var graphics;
            if ((graphics = graphicO.child) && !(graphics.length < 1)) {
                var g;
                g = ClassUtils._getGraphicsFromSprite(graphicO, sprite);
                var ox = 0, oy = 0;
                graphicO.props && (ox = ClassUtils._getObjVar(graphicO.props, "x", 0), oy = ClassUtils._getObjVar(graphicO.props, "y", 0)), 
                0 != ox && 0 != oy && g.translate(ox, oy);
                var len, i = 0;
                for (len = graphics.length, i = 0; i < len; i++) ClassUtils._addGraphicToGraphics(graphics[i], g);
                0 != ox && 0 != oy && g.translate(-ox, -oy);
            }
        }, ClassUtils.addGraphicToSprite = function(graphicO, sprite, isChild) {
            var g;
            void 0 === isChild && (isChild = !1), g = isChild ? ClassUtils._getGraphicsFromSprite(graphicO, sprite) : sprite.graphics, 
            ClassUtils._addGraphicToGraphics(graphicO, g);
        }, ClassUtils._getGraphicsFromSprite = function(dataO, sprite) {
            var g, propsName;
            if (!dataO || !dataO.props) return sprite.graphics;
            switch (propsName = dataO.props.renderType) {
              case "hit":
              case "unHit":
                var hitArea;
                sprite.hitArea || (sprite.hitArea = new HitArea()), (hitArea = sprite.hitArea)[propsName] || (hitArea[propsName] = new Graphics()), 
                g = hitArea[propsName];
            }
            return g || (g = sprite.graphics), g;
        }, ClassUtils._getTransformData = function(propsO) {
            var m;
            (propsO.hasOwnProperty("pivotX") || propsO.hasOwnProperty("pivotY")) && (m = m || new Matrix()).translate(-ClassUtils._getObjVar(propsO, "pivotX", 0), -ClassUtils._getObjVar(propsO, "pivotY", 0));
            var sx = ClassUtils._getObjVar(propsO, "scaleX", 1), sy = ClassUtils._getObjVar(propsO, "scaleY", 1), rotate = ClassUtils._getObjVar(propsO, "rotation", 0);
            ClassUtils._getObjVar(propsO, "skewX", 0), ClassUtils._getObjVar(propsO, "skewY", 0);
            return 1 == sx && 1 == sy && 0 == rotate || ((m = m || new Matrix()).scale(sx, sy), 
            m.rotate(.0174532922222222 * rotate)), m;
        }, ClassUtils._addGraphicToGraphics = function(graphicO, graphic) {
            var propsO, drawConfig;
            if ((propsO = graphicO.props) && (drawConfig = ClassUtils.DrawTypeDic[graphicO.type])) {
                var g, m;
                g = graphic;
                var params = ClassUtils._getParams(propsO, drawConfig[1], drawConfig[2], drawConfig[3]);
                ((m = ClassUtils._tM) || 1 != ClassUtils._alpha) && (g.save(), m && g.transform(m), 
                1 != ClassUtils._alpha && g.alpha(ClassUtils._alpha)), g[drawConfig[0]].apply(g, params), 
                (m || 1 != ClassUtils._alpha) && g.restore();
            }
        }, ClassUtils._adptLineData = function(params) {
            return params[2] = parseFloat(params[0]) + parseFloat(params[2]), params[3] = parseFloat(params[1]) + parseFloat(params[3]), 
            params;
        }, ClassUtils._adptTextureData = function(params) {
            return params[0] = Loader.getRes(params[0]), params;
        }, ClassUtils._adptLinesData = function(params) {
            return params[2] = ClassUtils._getPointListByStr(params[2]), params;
        }, ClassUtils.isDrawType = function(type) {
            return "Image" != type && ClassUtils.DrawTypeDic.hasOwnProperty(type);
        }, ClassUtils._getParams = function(obj, params, xPos, adptFun) {
            var rst;
            void 0 === xPos && (xPos = 0), (rst = ClassUtils._temParam).length = params.length;
            var len, m, i = 0;
            for (len = params.length, i = 0; i < len; i++) rst[i] = ClassUtils._getObjVar(obj, params[i][0], params[i][1]);
            return ClassUtils._alpha = ClassUtils._getObjVar(obj, "alpha", 1), m = ClassUtils._getTransformData(obj), 
            ClassUtils._tM = m ? (xPos || (xPos = 0), m.translate(rst[xPos], rst[xPos + 1]), 
            rst[xPos] = rst[xPos + 1] = 0, m) : null, adptFun && ClassUtils[adptFun] && (rst = ClassUtils[adptFun](rst)), 
            rst;
        }, ClassUtils._getPointListByStr = function(str) {
            var pointArr, len, i = 0;
            for (len = (pointArr = str.split(",")).length, i = 0; i < len; i++) pointArr[i] = parseFloat(pointArr[i]);
            return pointArr;
        }, ClassUtils._getObjVar = function(obj, key, noValue) {
            return obj.hasOwnProperty(key) ? obj[key] : noValue;
        }, ClassUtils._temParam = [], ClassUtils._classMap = {
            Sprite: "laya.display.Sprite",
            Text: "laya.display.Text",
            Animation: "laya.display.Animation",
            Skeleton: "laya.ani.bone.Skeleton",
            Particle2D: "laya.particle.Particle2D",
            div: "laya.html.dom.HTMLDivElement",
            p: "laya.html.dom.HTMLElement",
            img: "laya.html.dom.HTMLImageElement",
            span: "laya.html.dom.HTMLElement",
            br: "laya.html.dom.HTMLBrElement",
            style: "laya.html.dom.HTMLStyleElement",
            font: "laya.html.dom.HTMLElement",
            a: "laya.html.dom.HTMLElement",
            "#text": "laya.html.dom.HTMLElement"
        }, ClassUtils.getClass = function(className) {
            var classObject = ClassUtils._classMap[className] || className;
            return "string" == typeof classObject ? Laya.__classmap[classObject] : classObject;
        }, ClassUtils._tM = null, ClassUtils._alpha = NaN, __static(ClassUtils, [ "DrawTypeDic", function() {
            return this.DrawTypeDic = {
                Rect: [ "drawRect", [ [ "x", 0 ], [ "y", 0 ], [ "width", 0 ], [ "height", 0 ], [ "fillColor", null ], [ "lineColor", null ], [ "lineWidth", 1 ] ] ],
                Circle: [ "drawCircle", [ [ "x", 0 ], [ "y", 0 ], [ "radius", 0 ], [ "fillColor", null ], [ "lineColor", null ], [ "lineWidth", 1 ] ] ],
                Pie: [ "drawPie", [ [ "x", 0 ], [ "y", 0 ], [ "radius", 0 ], [ "startAngle", 0 ], [ "endAngle", 0 ], [ "fillColor", null ], [ "lineColor", null ], [ "lineWidth", 1 ] ] ],
                Image: [ "drawTexture", [ [ "x", 0 ], [ "y", 0 ], [ "width", 0 ], [ "height", 0 ] ] ],
                Texture: [ "drawTexture", [ [ "skin", null ], [ "x", 0 ], [ "y", 0 ], [ "width", 0 ], [ "height", 0 ] ], 1, "_adptTextureData" ],
                FillTexture: [ "fillTexture", [ [ "skin", null ], [ "x", 0 ], [ "y", 0 ], [ "width", 0 ], [ "height", 0 ], [ "repeat", null ] ], 1, "_adptTextureData" ],
                FillText: [ "fillText", [ [ "text", "" ], [ "x", 0 ], [ "y", 0 ], [ "font", null ], [ "color", null ], [ "textAlign", null ] ], 1 ],
                Line: [ "drawLine", [ [ "x", 0 ], [ "y", 0 ], [ "toX", 0 ], [ "toY", 0 ], [ "lineColor", null ], [ "lineWidth", 0 ] ], 0, "_adptLineData" ],
                Lines: [ "drawLines", [ [ "x", 0 ], [ "y", 0 ], [ "points", "" ], [ "lineColor", null ], [ "lineWidth", 0 ] ], 0, "_adptLinesData" ],
                Curves: [ "drawCurves", [ [ "x", 0 ], [ "y", 0 ], [ "points", "" ], [ "lineColor", null ], [ "lineWidth", 0 ] ], 0, "_adptLinesData" ],
                Poly: [ "drawPoly", [ [ "x", 0 ], [ "y", 0 ], [ "points", "" ], [ "fillColor", null ], [ "lineColor", null ], [ "lineWidth", 1 ] ], 0, "_adptLinesData" ]
            };
        } ]), ClassUtils;
    }(), Color = function() {
        function Color(str) {
            if (this._color = [], "string" == typeof str) {
                null === (this.strColor = str) && (str = "#000000"), "#" == str.charAt(0) && (str = str.substr(1));
                var len = str.length;
                if (3 == len || 4 == len) {
                    for (var temp = "", i = 0; i < len; i++) temp += str[i] + str[i];
                    str = temp;
                }
                var color = this.numColor = parseInt(str, 16);
                if (8 == str.length) return void (this._color = [ parseInt(str.substr(0, 2), 16) / 255, ((16711680 & color) >> 16) / 255, ((65280 & color) >> 8) / 255, (255 & color) / 255 ]);
            } else color = this.numColor = str, this.strColor = Utils.toHexColor(color);
            this._color = [ ((16711680 & color) >> 16) / 255, ((65280 & color) >> 8) / 255, (255 & color) / 255, 1 ], 
            this._color.__id = ++Color._COLODID;
        }
        return __class(Color, "laya.utils.Color"), Color._initDefault = function() {
            for (var i in Color._DEFAULT = {}, Color._COLOR_MAP) Color._SAVE[i] = Color._DEFAULT[i] = new Color(Color._COLOR_MAP[i]);
            return Color._DEFAULT;
        }, Color._initSaveMap = function() {
            for (var i in Color._SAVE_SIZE = 0, Color._SAVE = {}, Color._DEFAULT) Color._SAVE[i] = Color._DEFAULT[i];
        }, Color.create = function(str) {
            var color = Color._SAVE[str + ""];
            return null != color ? color : (Color._SAVE_SIZE < 1e3 || Color._initSaveMap(), 
            Color._SAVE[str + ""] = new Color(str));
        }, Color._SAVE = {}, Color._SAVE_SIZE = 0, Color._COLOR_MAP = {
            white: "#FFFFFF",
            red: "#FF0000",
            green: "#00FF00",
            blue: "#0000FF",
            black: "#000000",
            yellow: "#FFFF00",
            gray: "#AAAAAA"
        }, Color._DEFAULT = Color._initDefault(), Color._COLODID = 1, Color;
    }(), Dragging = (function() {
        function Dictionary() {
            this._values = [], this._keys = [];
        }
        __class(Dictionary, "laya.utils.Dictionary");
        var __proto = Dictionary.prototype;
        __proto.set = function(key, value) {
            var index = this.indexOf(key);
            0 <= index ? this._values[index] = value : (this._keys.push(key), this._values.push(value));
        }, __proto.indexOf = function(key) {
            var index = this._keys.indexOf(key);
            return 0 <= index ? index : (key = "string" == typeof key ? Number(key) : "number" == typeof key ? key.toString() : key, 
            this._keys.indexOf(key));
        }, __proto.get = function(key) {
            var index = this.indexOf(key);
            return index < 0 ? null : this._values[index];
        }, __proto.remove = function(key) {
            var index = this.indexOf(key);
            return 0 <= index && (this._keys.splice(index, 1), this._values.splice(index, 1), 
            !0);
        }, __proto.clear = function() {
            this._values.length = 0, this._keys.length = 0;
        }, __getset(0, __proto, "values", function() {
            return this._values;
        }), __getset(0, __proto, "keys", function() {
            return this._keys;
        });
    }(), function() {
        function Dragging() {
            this.ratio = .92, this.maxOffset = 60, this._dragging = !1, this._clickOnly = !0;
        }
        __class(Dragging, "laya.utils.Dragging");
        var __proto = Dragging.prototype;
        return __proto.start = function(target, area, hasInertia, elasticDistance, elasticBackTime, data, disableMouseEvent, ratio) {
            void 0 === ratio && (ratio = .92), this.clearTimer(), this.target = target, this.area = area, 
            this.hasInertia = hasInertia, this.elasticDistance = area ? elasticDistance : 0, 
            this.elasticBackTime = elasticBackTime, this.data = data, this._disableMouseEvent = disableMouseEvent, 
            this.ratio = ratio, 1 != target.globalScaleX || 1 != target.globalScaleY ? this._parent = target.parent : this._parent = Laya.stage, 
            this._clickOnly = !0, this._dragging = !0, this._elasticRateX = this._elasticRateY = 1, 
            this._lastX = this._parent.mouseX, this._lastY = this._parent.mouseY, Laya.stage.on("mouseup", this, this.onStageMouseUp), 
            Laya.stage.on("mouseout", this, this.onStageMouseUp), Laya.timer.frameLoop(1, this, this.loop);
        }, __proto.clearTimer = function() {
            Laya.timer.clear(this, this.loop), Laya.timer.clear(this, this.tweenMove), this._tween && (this._tween.recover(), 
            this._tween = null);
        }, __proto.stop = function() {
            this._dragging && (MouseManager.instance.disableMouseEvent = !1, Laya.stage.off("mouseup", this, this.onStageMouseUp), 
            Laya.stage.off("mouseout", this, this.onStageMouseUp), this._dragging = !1, this.target && this.area && this.backToArea(), 
            this.clear());
        }, __proto.loop = function() {
            var point = this._parent.getMousePoint(), mouseX = point.x, mouseY = point.y, offsetX = mouseX - this._lastX, offsetY = mouseY - this._lastY;
            if (this._clickOnly) {
                if (!(1 < Math.abs(offsetX * Laya.stage._canvasTransform.getScaleX()) || 1 < Math.abs(offsetY * Laya.stage._canvasTransform.getScaleY()))) return;
                this._clickOnly = !1, this._offsets || (this._offsets = []), this._offsets.length = 0, 
                this.target.event("dragstart", this.data), MouseManager.instance.disableMouseEvent = this._disableMouseEvent, 
                this.target._set$P("$_MOUSEDOWN", !1);
            } else this._offsets.push(offsetX, offsetY);
            0 == offsetX && 0 == offsetY || (this._lastX = mouseX, this._lastY = mouseY, this.target.x += offsetX * this._elasticRateX, 
            this.target.y += offsetY * this._elasticRateY, this.area && this.checkArea(), this.target.event("dragmove", this.data));
        }, __proto.checkArea = function() {
            if (this.elasticDistance <= 0) this.backToArea(); else {
                if (this.target.x < this.area.x) var offsetX = this.area.x - this.target.x; else offsetX = this.target.x > this.area.x + this.area.width ? this.target.x - this.area.x - this.area.width : 0;
                if (this._elasticRateX = Math.max(0, 1 - offsetX / this.elasticDistance), this.target.y < this.area.y) var offsetY = this.area.y - this.target.y; else offsetY = this.target.y > this.area.y + this.area.height ? this.target.y - this.area.y - this.area.height : 0;
                this._elasticRateY = Math.max(0, 1 - offsetY / this.elasticDistance);
            }
        }, __proto.backToArea = function() {
            this.target.x = Math.min(Math.max(this.target.x, this.area.x), this.area.x + this.area.width), 
            this.target.y = Math.min(Math.max(this.target.y, this.area.y), this.area.y + this.area.height);
        }, __proto.onStageMouseUp = function(e) {
            if (MouseManager.instance.disableMouseEvent = !1, Laya.stage.off("mouseup", this, this.onStageMouseUp), 
            Laya.stage.off("mouseout", this, this.onStageMouseUp), Laya.timer.clear(this, this.loop), 
            !this._clickOnly && this.target) if (this.hasInertia) {
                this._offsets.length < 1 && this._offsets.push(this._parent.mouseX - this._lastX, this._parent.mouseY - this._lastY), 
                this._offsetX = this._offsetY = 0;
                for (var len = this._offsets.length, n = Math.min(len, 6), m = this._offsets.length - n, i = len - 1; m < i; i--) this._offsetY += this._offsets[i--], 
                this._offsetX += this._offsets[i];
                this._offsetX = this._offsetX / n * 2, this._offsetY = this._offsetY / n * 2, Math.abs(this._offsetX) > this.maxOffset && (this._offsetX = 0 < this._offsetX ? this.maxOffset : -this.maxOffset), 
                Math.abs(this._offsetY) > this.maxOffset && (this._offsetY = 0 < this._offsetY ? this.maxOffset : -this.maxOffset), 
                Laya.timer.frameLoop(1, this, this.tweenMove);
            } else 0 < this.elasticDistance ? this.checkElastic() : this.clear();
        }, __proto.checkElastic = function() {
            var tx = NaN, ty = NaN;
            if (this.target.x < this.area.x ? tx = this.area.x : this.target.x > this.area.x + this.area.width && (tx = this.area.x + this.area.width), 
            this.target.y < this.area.y ? ty = this.area.y : this.target.y > this.area.y + this.area.height && (ty = this.area.y + this.area.height), 
            isNaN(tx) && isNaN(ty)) this.clear(); else {
                var obj = {};
                isNaN(tx) || (obj.x = tx), isNaN(ty) || (obj.y = ty), this._tween = Tween.to(this.target, obj, this.elasticBackTime, Ease.sineOut, Handler.create(this, this.clear), 0, !1, !1);
            }
        }, __proto.tweenMove = function() {
            this._offsetX *= this.ratio * this._elasticRateX, this._offsetY *= this.ratio * this._elasticRateY, 
            this.target.x += this._offsetX, this.target.y += this._offsetY, this.area && this.checkArea(), 
            this.target.event("dragmove", this.data), (Math.abs(this._offsetX) < 1 && Math.abs(this._offsetY) < 1 || this._elasticRateX < .5 || this._elasticRateY < .5) && (Laya.timer.clear(this, this.tweenMove), 
            0 < this.elasticDistance ? this.checkElastic() : this.clear());
        }, __proto.clear = function() {
            if (this.target) {
                this.clearTimer();
                var sp = this.target;
                this.target = null, this._parent = null, sp.event("dragend", this.data);
            }
        }, Dragging;
    }()), Ease = function() {
        function Ease() {}
        return __class(Ease, "laya.utils.Ease"), Ease.linearNone = function(t, b, c, d) {
            return c * t / d + b;
        }, Ease.linearIn = function(t, b, c, d) {
            return c * t / d + b;
        }, Ease.linearInOut = function(t, b, c, d) {
            return c * t / d + b;
        }, Ease.linearOut = function(t, b, c, d) {
            return c * t / d + b;
        }, Ease.bounceIn = function(t, b, c, d) {
            return c - Ease.bounceOut(d - t, 0, c, d) + b;
        }, Ease.bounceInOut = function(t, b, c, d) {
            return t < .5 * d ? .5 * Ease.bounceIn(2 * t, 0, c, d) + b : .5 * Ease.bounceOut(2 * t - d, 0, c, d) + .5 * c + b;
        }, Ease.bounceOut = function(t, b, c, d) {
            return (t /= d) < 1 / 2.75 ? c * (7.5625 * t * t) + b : t < 2 / 2.75 ? c * (7.5625 * (t -= 1.5 / 2.75) * t + .75) + b : t < 2.5 / 2.75 ? c * (7.5625 * (t -= 2.25 / 2.75) * t + .9375) + b : c * (7.5625 * (t -= 2.625 / 2.75) * t + .984375) + b;
        }, Ease.backIn = function(t, b, c, d, s) {
            return void 0 === s && (s = 1.70158), c * (t /= d) * t * ((s + 1) * t - s) + b;
        }, Ease.backInOut = function(t, b, c, d, s) {
            return void 0 === s && (s = 1.70158), (t /= .5 * d) < 1 ? .5 * c * (t * t * ((1 + (s *= 1.525)) * t - s)) + b : c / 2 * ((t -= 2) * t * ((1 + (s *= 1.525)) * t + s) + 2) + b;
        }, Ease.backOut = function(t, b, c, d, s) {
            return void 0 === s && (s = 1.70158), c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
        }, Ease.elasticIn = function(t, b, c, d, a, p) {
            var s;
            return void 0 === a && (a = 0), void 0 === p && (p = 0), 0 == t ? b : 1 == (t /= d) ? b + c : (p || (p = .3 * d), 
            s = !a || 0 < c && a < c || c < 0 && a < -c ? (a = c, p / 4) : p / Ease.PI2 * Math.asin(c / a), 
            -a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * Ease.PI2 / p) + b);
        }, Ease.elasticInOut = function(t, b, c, d, a, p) {
            var s;
            return void 0 === a && (a = 0), void 0 === p && (p = 0), 0 == t ? b : 2 == (t /= .5 * d) ? b + c : (p || (p = d * (.3 * 1.5)), 
            s = !a || 0 < c && a < c || c < 0 && a < -c ? (a = c, p / 4) : p / Ease.PI2 * Math.asin(c / a), 
            t < 1 ? a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * Ease.PI2 / p) * -.5 + b : a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * Ease.PI2 / p) * .5 + c + b);
        }, Ease.elasticOut = function(t, b, c, d, a, p) {
            var s;
            return void 0 === a && (a = 0), void 0 === p && (p = 0), 0 == t ? b : 1 == (t /= d) ? b + c : (p || (p = .3 * d), 
            s = !a || 0 < c && a < c || c < 0 && a < -c ? (a = c, p / 4) : p / Ease.PI2 * Math.asin(c / a), 
            a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * Ease.PI2 / p) + c + b);
        }, Ease.strongIn = function(t, b, c, d) {
            return c * (t /= d) * t * t * t * t + b;
        }, Ease.strongInOut = function(t, b, c, d) {
            return (t /= .5 * d) < 1 ? .5 * c * t * t * t * t * t + b : .5 * c * ((t -= 2) * t * t * t * t + 2) + b;
        }, Ease.strongOut = function(t, b, c, d) {
            return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
        }, Ease.sineInOut = function(t, b, c, d) {
            return .5 * -c * (Math.cos(Math.PI * t / d) - 1) + b;
        }, Ease.sineIn = function(t, b, c, d) {
            return -c * Math.cos(t / d * Ease.HALF_PI) + c + b;
        }, Ease.sineOut = function(t, b, c, d) {
            return c * Math.sin(t / d * Ease.HALF_PI) + b;
        }, Ease.quintIn = function(t, b, c, d) {
            return c * (t /= d) * t * t * t * t + b;
        }, Ease.quintInOut = function(t, b, c, d) {
            return (t /= .5 * d) < 1 ? .5 * c * t * t * t * t * t + b : .5 * c * ((t -= 2) * t * t * t * t + 2) + b;
        }, Ease.quintOut = function(t, b, c, d) {
            return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
        }, Ease.quartIn = function(t, b, c, d) {
            return c * (t /= d) * t * t * t + b;
        }, Ease.quartInOut = function(t, b, c, d) {
            return (t /= .5 * d) < 1 ? .5 * c * t * t * t * t + b : .5 * -c * ((t -= 2) * t * t * t - 2) + b;
        }, Ease.quartOut = function(t, b, c, d) {
            return -c * ((t = t / d - 1) * t * t * t - 1) + b;
        }, Ease.cubicIn = function(t, b, c, d) {
            return c * (t /= d) * t * t + b;
        }, Ease.cubicInOut = function(t, b, c, d) {
            return (t /= .5 * d) < 1 ? .5 * c * t * t * t + b : .5 * c * ((t -= 2) * t * t + 2) + b;
        }, Ease.cubicOut = function(t, b, c, d) {
            return c * ((t = t / d - 1) * t * t + 1) + b;
        }, Ease.quadIn = function(t, b, c, d) {
            return c * (t /= d) * t + b;
        }, Ease.quadInOut = function(t, b, c, d) {
            return (t /= .5 * d) < 1 ? .5 * c * t * t + b : .5 * -c * (--t * (t - 2) - 1) + b;
        }, Ease.quadOut = function(t, b, c, d) {
            return -c * (t /= d) * (t - 2) + b;
        }, Ease.expoIn = function(t, b, c, d) {
            return 0 == t ? b : c * Math.pow(2, 10 * (t / d - 1)) + b - .001 * c;
        }, Ease.expoInOut = function(t, b, c, d) {
            return 0 == t ? b : t == d ? b + c : (t /= .5 * d) < 1 ? .5 * c * Math.pow(2, 10 * (t - 1)) + b : .5 * c * (2 - Math.pow(2, -10 * --t)) + b;
        }, Ease.expoOut = function(t, b, c, d) {
            return t == d ? b + c : c * (1 - Math.pow(2, -10 * t / d)) + b;
        }, Ease.circIn = function(t, b, c, d) {
            return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
        }, Ease.circInOut = function(t, b, c, d) {
            return (t /= .5 * d) < 1 ? .5 * -c * (Math.sqrt(1 - t * t) - 1) + b : .5 * c * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
        }, Ease.circOut = function(t, b, c, d) {
            return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
        }, Ease.HALF_PI = .5 * Math.PI, Ease.PI2 = 2 * Math.PI, Ease;
    }(), HitArea = function() {
        function HitArea() {
            this._hit = null, this._unHit = null;
        }
        __class(HitArea, "laya.utils.HitArea");
        var __proto = HitArea.prototype;
        return __proto.isHit = function(x, y) {
            return !!HitArea.isHitGraphic(x, y, this.hit) && !HitArea.isHitGraphic(x, y, this.unHit);
        }, __proto.contains = function(x, y) {
            return this.isHit(x, y);
        }, __getset(0, __proto, "hit", function() {
            return this._hit || (this._hit = new Graphics()), this._hit;
        }, function(value) {
            this._hit = value;
        }), __getset(0, __proto, "unHit", function() {
            return this._unHit || (this._unHit = new Graphics()), this._unHit;
        }, function(value) {
            this._unHit = value;
        }), HitArea.isHitGraphic = function(x, y, graphic) {
            if (!graphic) return !1;
            var cmds;
            if (!(cmds = graphic.cmds) && graphic._one && ((cmds = HitArea._cmds).length = 1, 
            cmds[0] = graphic._one), !cmds) return !1;
            var len, cmd, i = 0;
            for (len = cmds.length, i = 0; i < len; i++) if (cmd = cmds[i]) {
                var context = Render._context;
                switch (cmd.callee) {
                  case context._translate:
                  case 6:
                    x -= cmd[0], y -= cmd[1];
                }
                if (HitArea.isHitCmd(x, y, cmd)) return !0;
            }
            return !1;
        }, HitArea.isHitCmd = function(x, y, cmd) {
            if (!cmd) return !1;
            var context = Render._context, rst = !1;
            switch (cmd.callee) {
              case context._drawRect:
              case 13:
                HitArea._rec.setTo(cmd[0], cmd[1], cmd[2], cmd[3]), rst = HitArea._rec.contains(x, y);
                break;

              case context._drawCircle:
              case context._fillCircle:
              case 14:
                rst = (x -= cmd[0]) * x + (y -= cmd[1]) * y < cmd[2] * cmd[2];
                break;

              case context._drawPoly:
              case 18:
                x -= cmd[0], y -= cmd[1], rst = HitArea.ptInPolygon(x, y, cmd[2]);
            }
            return rst;
        }, HitArea.ptInPolygon = function(x, y, areaPoints) {
            var p;
            (p = HitArea._ptPoint).setTo(x, y);
            var len, nCross = 0, p1x = NaN, p1y = NaN, p2x = NaN, p2y = NaN;
            len = areaPoints.length;
            for (var i = 0; i < len; i += 2) {
                if (p1x = areaPoints[i], p1y = areaPoints[i + 1], p2x = areaPoints[(i + 2) % len], 
                p1y != (p2y = areaPoints[(i + 3) % len])) if (!(p.y < Math.min(p1y, p2y))) if (!(p.y >= Math.max(p1y, p2y))) (p.y - p1y) * (p2x - p1x) / (p2y - p1y) + p1x > p.x && nCross++;
            }
            return nCross % 2 == 1;
        }, HitArea._cmds = [], __static(HitArea, [ "_rec", function() {
            return this._rec = new Rectangle();
        }, "_ptPoint", function() {
            return this._ptPoint = new Point();
        } ]), HitArea;
    }(), Pool = (function() {
        function HTMLChar(char, w, h, style) {
            this.char = char, this.charNum = char.charCodeAt(0), this._x = this._y = 0, this.width = w, 
            this.height = h, this.style = style, this.isWord = !HTMLChar._isWordRegExp.test(char);
        }
        __class(HTMLChar, "laya.utils.HTMLChar");
        var __proto = HTMLChar.prototype;
        Laya.imps(__proto, {
            "laya.display.ILayout": !0
        }), __proto.setSprite = function(sprite) {
            this._sprite = sprite;
        }, __proto.getSprite = function() {
            return this._sprite;
        }, __proto._isChar = function() {
            return !0;
        }, __proto._getCSSStyle = function() {
            return this.style;
        }, __getset(0, __proto, "width", function() {
            return this._w;
        }, function(value) {
            this._w = value;
        }), __getset(0, __proto, "x", function() {
            return this._x;
        }, function(value) {
            this._sprite && (this._sprite.x = value), this._x = value;
        }), __getset(0, __proto, "y", function() {
            return this._y;
        }, function(value) {
            this._sprite && (this._sprite.y = value), this._y = value;
        }), __getset(0, __proto, "height", function() {
            return this._h;
        }, function(value) {
            this._h = value;
        }), HTMLChar._isWordRegExp = new RegExp("[\\w.]", "");
    }(), function() {
        function Log() {}
        __class(Log, "laya.utils.Log"), Log.enable = function() {
            Log._logdiv || (Log._logdiv = Browser.window.document.createElement("div"), Browser.window.document.body.appendChild(Log._logdiv), 
            Log._logdiv.style.cssText = "pointer-events:none;border:white;overflow:hidden;z-index:1000000;background:rgba(100,100,100,0.6);color:white;position: absolute;left:0px;top:0px;width:50%;height:50%;");
        }, Log.toggle = function() {
            var style = Log._logdiv.style;
            "1px" == style.width ? style.width = style.height = "50%" : style.width = style.height = "1px";
        }, Log.print = function(value) {
            Log._logdiv && (Log.maxCount <= Log._count && Log.clear(), Log._count++, Log._logdiv.innerText += value + "\n", 
            Log._logdiv.scrollTop = Log._logdiv.scrollHeight);
        }, Log.clear = function() {
            Log._logdiv.innerText = "", Log._count = 0;
        }, Log._logdiv = null, Log._count = 0, Log.maxCount = 20;
    }(), function() {
        function Mouse() {}
        __class(Mouse, "laya.utils.Mouse"), __getset(1, Mouse, "cursor", function() {
            return Mouse._style.cursor;
        }, function(cursorStr) {
            Mouse._style.cursor = cursorStr;
        }), Mouse.hide = function() {
            "none" != Mouse.cursor && (Mouse._preCursor = Mouse.cursor, Mouse.cursor = "none");
        }, Mouse.show = function() {
            "none" == Mouse.cursor && (Mouse.cursor = Mouse._preCursor ? Mouse._preCursor : "auto");
        }, Mouse._preCursor = null, __static(Mouse, [ "_style", function() {
            return this._style = Browser.document.body.style;
        } ]);
    }(), function() {
        function Pool() {}
        return __class(Pool, "laya.utils.Pool"), Pool.getPoolBySign = function(sign) {
            return Pool._poolDic[sign] || (Pool._poolDic[sign] = []);
        }, Pool.clearBySign = function(sign) {
            Pool._poolDic[sign] && (Pool._poolDic[sign].length = 0);
        }, Pool.recover = function(sign, item) {
            item.__InPool || (item.__InPool = !0, Pool.getPoolBySign(sign).push(item));
        }, Pool.getItemByClass = function(sign, cls) {
            var pool = Pool.getPoolBySign(sign), rst = pool.length ? pool.pop() : new cls();
            return rst.__InPool = !1, rst;
        }, Pool.getItemByCreateFun = function(sign, createFun, caller) {
            var pool = Pool.getPoolBySign(sign), rst = pool.length ? pool.pop() : createFun.call(caller);
            return rst.__InPool = !1, rst;
        }, Pool.getItem = function(sign) {
            var pool = Pool.getPoolBySign(sign), rst = pool.length ? pool.pop() : null;
            return rst && (rst.__InPool = !1), rst;
        }, Pool._poolDic = {}, Pool.InPoolSign = "__InPool", Pool;
    }()), Stat = function() {
        function Stat() {}
        return __class(Stat, "laya.utils.Stat"), __getset(1, Stat, "onclick", null, function(fn) {
            Stat._sp && Stat._sp.on("click", Stat._sp, fn), Stat._canvas && (Stat._canvas.source.onclick = fn, 
            Stat._canvas.source.style.pointerEvents = "");
        }), Stat.show = function(x, y, mode) {
            if (void 0 === x && (x = 0), void 0 === y && (y = 0), void 0 === mode && (mode = 0), 
            !Render.isConchApp || Render.isConchWebGL) {
                if (Render.isConchWebGL || Browser.onMiniGame || Browser.onLimixiu || (Stat._useCanvas = !0), 
                Stat._show = !0, Stat._fpsData.length = 60, Stat._view[0] = {
                    title: "FPS(Canvas)",
                    value: "_fpsStr",
                    color: "yellow",
                    units: "int"
                }, Stat._view[1] = {
                    title: "Sprite",
                    value: "_spriteStr",
                    color: "white",
                    units: "int"
                }, Stat._view[2] = {
                    title: "DrawCall",
                    value: "drawCall",
                    color: "green",
                    units: "int"
                }, Stat._view[3] = {
                    title: "CurMem",
                    value: "currentMemorySize",
                    color: "yellow",
                    units: "M"
                }, Render.isWebGL) if (Stat._view[4] = {
                    title: "Shader",
                    value: "shaderCall",
                    color: "red",
                    units: "int"
                }, Render.is3DMode) {
                    if (Stat._view[0].title = "FPS(3D)", Stat._view[5] = {
                        title: "TriFaces",
                        value: "trianglesFaces",
                        color: "blue",
                        units: "int"
                    }, Stat._view[6] = {
                        title: "treeNodeColl",
                        value: "treeNodeCollision",
                        color: "white",
                        units: "int"
                    }, Stat._view[7] = {
                        title: "treeSpriteColl",
                        value: "treeSpriteCollision",
                        color: "white",
                        units: "int"
                    }, 1 == mode) {
                        var index = 8;
                        Stat._view[index++] = {
                            title: "VATTRIBS",
                            value: "MAX_VERTEX_ATTRIBS",
                            color: "white",
                            units: "int",
                            varying: 1
                        }, Stat._view[index++] = {
                            title: "VUNIFORMS",
                            value: "MAX_VERTEX_UNIFORM_VECTORS",
                            color: "white",
                            units: "int",
                            varying: 1
                        }, Stat._view[index++] = {
                            title: "VARYINGS",
                            value: "MAX_VARYING_VECTORS",
                            color: "white",
                            units: "int",
                            varying: 1
                        }, Stat._view[index++] = {
                            title: "CTEXTURES",
                            value: "MAX_COMBINED_TEXTURE_IMAGE_UNITS",
                            color: "white",
                            units: "int",
                            varying: 1
                        }, Stat._view[index++] = {
                            title: "VTEXTURES",
                            value: "MAX_VERTEX_TEXTURE_IMAGE_UNITS",
                            color: "white",
                            units: "int",
                            varying: 1
                        }, Stat._view[index++] = {
                            title: "TEXTURES",
                            value: "MAX_TEXTURE_IMAGE_UNITS",
                            color: "white",
                            units: "int",
                            varying: 1
                        }, Stat._view[index++] = {
                            title: "FUNIFORMS",
                            value: "MAX_FRAGMENT_UNIFORM_VECTORS",
                            color: "white",
                            units: "int",
                            varying: 1
                        }, Stat._view[index++] = {
                            title: "SVERSION",
                            value: "SHADING_LANGUAGE_VERSION",
                            color: "white",
                            units: "string",
                            varying: 1
                        }, Stat._view[index++] = {
                            title: "VERSION",
                            value: "VERSION",
                            color: "white",
                            units: "string",
                            varying: 1
                        };
                    } else if (2 == mode) {
                        index = 8;
                        Stat._view[index++] = {
                            title: "astc",
                            value: "WEBGL_compressed_texture_astc",
                            color: "white",
                            units: "object",
                            varying: 2
                        }, Stat._view[index++] = {
                            title: "atc",
                            value: "WEBGL_compressed_texture_atc",
                            color: "white",
                            units: "object",
                            varying: 2
                        }, Stat._view[index++] = {
                            title: "etc",
                            value: "WEBGL_compressed_texture_etc",
                            color: "white",
                            units: "object",
                            varying: 2
                        }, Stat._view[index++] = {
                            title: "etc1",
                            value: "WEBGL_compressed_texture_etc1",
                            color: "white",
                            units: "object",
                            varying: 2
                        }, Stat._view[index++] = {
                            title: "pvrtc",
                            value: "WEBGL_compressed_texture_pvrtc",
                            color: "white",
                            units: "object",
                            varying: 2
                        }, Stat._view[index++] = {
                            title: "s3tc",
                            value: "WEBGL_compressed_texture_s3tc",
                            color: "white",
                            units: "object",
                            varying: 2
                        }, Stat._view[index++] = {
                            title: "srgb",
                            value: "WEBGL_compressed_texture_s3tc_srgb",
                            color: "white",
                            units: "object",
                            varying: 2
                        };
                    }
                } else Stat._view[0].title = "FPS(WebGL)", Stat._view[5] = {
                    title: "Canvas",
                    value: "_canvasStr",
                    color: "white",
                    units: "int"
                }; else Stat._view[4] = {
                    title: "Canvas",
                    value: "_canvasStr",
                    color: "white",
                    units: "int"
                };
                Stat._useCanvas ? Stat.createUIPre(x, y) : Stat.createUI(x, y), Stat.enable();
            } else Browser.window.conch.showFPS && Browser.window.conch.showFPS(x, y);
        }, Stat.createUIPre = function(x, y) {
            var pixel = Browser.pixelRatio;
            Stat._width = 130 * pixel, Stat._vx = 75 * pixel, Stat._height = pixel * (12 * Stat._view.length + 3 * pixel) + 4, 
            Stat._fontSize = 12 * pixel;
            for (var i = 0; i < Stat._view.length; i++) Stat._view[i].x = 4, Stat._view[i].y = i * Stat._fontSize + 2 * pixel;
            Stat._canvas || ((Stat._canvas = new HTMLCanvas("2D")).size(Stat._width, Stat._height), 
            (Stat._ctx = Stat._canvas.getContext("2d")).textBaseline = "top", Stat._ctx.font = Stat._fontSize + "px Sans-serif", 
            Stat._canvas.source.style.cssText = "pointer-events:none;background:rgba(150,150,150,0.8);z-index:100000;position: absolute;direction:ltr;left:" + x + "px;top:" + y + "px;width:" + Stat._width / pixel + "px;height:" + Stat._height / pixel + "px;"), 
            Stat._first = !0, Stat.loop(), Stat._first = !1, Browser.container.appendChild(Stat._canvas.source);
        }, Stat.createUI = function(x, y) {
            var stat = Stat._sp, pixel = Browser.pixelRatio;
            stat || (stat = new Sprite(), (Stat._leftText = new Text()).pos(5, 5), Stat._leftText.color = "#ffffff", 
            stat.addChild(Stat._leftText), (Stat._txt = new Text()).pos(80 * pixel, 5), Stat._txt.color = "#ffffff", 
            stat.addChild(Stat._txt), Stat._sp = stat), stat.pos(x, y);
            for (var text = "", i = 0; i < Stat._view.length; i++) {
                text += Stat._view[i].title + "\n";
            }
            Stat._leftText.text = text;
            var width = 138 * pixel, height = pixel * (12 * Stat._view.length + 3 * pixel) + 4;
            Stat._txt.fontSize = Stat._fontSize * pixel, Stat._leftText.fontSize = Stat._fontSize * pixel, 
            stat.size(width, height), stat.graphics.clear(), stat.graphics.setAlpha(.5), stat.graphics.drawRect(0, 0, width, height, "#999999"), 
            stat.graphics.setAlpha(1), Stat.loop();
        }, Stat.enable = function() {
            Laya.timer.frameLoop(1, Stat, Stat.loop);
        }, Stat.hide = function() {
            Stat._show = !1, Laya.timer.clear(Stat, Stat.loop), Stat._canvas && Browser.removeElement(Stat._canvas.source);
        }, Stat.clear = function() {
            Stat.trianglesFaces = Stat.drawCall = Stat.shaderCall = Stat.spriteCount = Stat.spriteRenderUseCacheCount = Stat.treeNodeCollision = Stat.treeSpriteCollision = Stat.canvasNormal = Stat.canvasBitmap = Stat.canvasReCache = 0;
        }, Stat.loop = function() {
            Stat._count++;
            var timer = Browser.now();
            if (!(timer - Stat._timer < 1e3)) {
                var count = Stat._count;
                if (Stat.FPS = Math.round(1e3 * count / (timer - Stat._timer)), Stat._show) {
                    Stat.trianglesFaces = Math.round(Stat.trianglesFaces / count), Stat.spriteCount = Stat._useCanvas ? (Stat.drawCall = Math.round(Stat.drawCall / count) - 2, 
                    Stat.shaderCall = Math.round(Stat.shaderCall / count), Math.round(Stat.spriteCount / count) - 1) : (Stat.drawCall = Math.round(Stat.drawCall / count) - 2, 
                    Stat.shaderCall = Math.round(Stat.shaderCall / count) - 4, Math.round(Stat.spriteCount / count) - 4), 
                    Stat.spriteRenderUseCacheCount = Math.round(Stat.spriteRenderUseCacheCount / count), 
                    Stat.canvasNormal = Math.round(Stat.canvasNormal / count), Stat.canvasBitmap = Math.round(Stat.canvasBitmap / count), 
                    Stat.canvasReCache = Math.ceil(Stat.canvasReCache / count), Stat.treeNodeCollision = Math.round(Stat.treeNodeCollision / count), 
                    Stat.treeSpriteCollision = Math.round(Stat.treeSpriteCollision / count);
                    var delay = 0 < Stat.FPS ? Math.floor(1e3 / Stat.FPS).toString() : " ";
                    Stat._fpsStr = Stat.FPS + (Stat.renderSlow ? " slow" : "") + " " + delay, Stat._spriteStr = Stat.spriteCount + (Stat.spriteRenderUseCacheCount ? "/" + Stat.spriteRenderUseCacheCount : ""), 
                    Stat._canvasStr = Stat.canvasReCache + "/" + Stat.canvasNormal + "/" + Stat.canvasBitmap, 
                    Stat.currentMemorySize = ResourceManager.systemResourceManager.memorySize, Stat._useCanvas ? Stat.renderInfoPre() : Stat.renderInfo(), 
                    Stat.clear();
                }
                Stat._count = 0, Stat._timer = timer;
            }
        }, Stat.renderInfoPre = function() {
            if (Stat._canvas) {
                var ctx = Stat._ctx;
                ctx.clearRect(Stat._first ? 0 : Stat._vx, 0, Stat._width, Stat._height);
                for (var gl = Render.WebGL.mainContext, i = 0; i < Stat._view.length; i++) {
                    var one = Stat._view[i];
                    Stat._first && (ctx.fillStyle = "white", ctx.fillText(one.title, one.x, one.y, null, null, null)), 
                    ctx.fillStyle = one.color;
                    var value = -1;
                    if ((one = Stat._view[i]).varying) {
                        if (gl) switch (one.varying) {
                          case 1:
                            value = gl.getParameter(gl[one.value]);
                            break;

                          case 2:
                            value = gl.getExtension(one.value);
                        }
                    } else value = Stat[one.value];
                    "M" == one.units && (value = Math.floor(value / 1048576 * 100) / 100 + " M"), "K" == one.units && (value = Math.floor(value / 1024 * 100) / 100 + " K"), 
                    "string" == one.units && (value = value.match(/\d+\.?\d/i)), ctx.fillText(value + "", one.x + Stat._vx, one.y, null, null, null);
                }
            }
        }, Stat.renderInfo = function() {
            for (var text = "", gl = Render.WebGL.mainContext, i = 0; i < Stat._view.length; i++) {
                var one = Stat._view[i], value = -1;
                if (one.varying) {
                    if (gl) switch (one.varying) {
                      case 1:
                        value = gl.getParameter(gl[one.value]);
                        break;

                      case 2:
                        value = gl.getExtension(one.value);
                    }
                } else value = Stat[one.value];
                "M" == one.units && (value = Math.floor(value / 1048576 * 100) / 100 + " M"), "K" == one.units && (value = Math.floor(value / 1024 * 100) / 100 + " K"), 
                "string" == one.units && (value = value.match(/\d+\.?\d/i)), text += value + "\n";
            }
            Stat._txt.text = text;
        }, Stat.FPS = 0, Stat.loopCount = 0, Stat.shaderCall = 0, Stat.drawCall = 0, Stat.trianglesFaces = 0, 
        Stat.spriteCount = 0, Stat.spriteRenderUseCacheCount = 0, Stat.treeNodeCollision = 0, 
        Stat.treeSpriteCollision = 0, Stat.canvasNormal = 0, Stat.canvasBitmap = 0, Stat.canvasReCache = 0, 
        Stat.renderSlow = !1, Stat.currentMemorySize = 0, Stat._fpsStr = null, Stat._canvasStr = null, 
        Stat._spriteStr = null, Stat._fpsData = [], Stat._timer = 0, Stat._count = 0, Stat._view = [], 
        Stat._fontSize = 12, Stat._txt = null, Stat._leftText = null, Stat._sp = null, Stat._show = !1, 
        Stat._useCanvas = !1, Stat._canvas = null, Stat._ctx = null, Stat._first = !1, Stat._vx = NaN, 
        Stat._width = 0, Stat._height = 100, Stat;
    }(), Timer = (function() {
        function StringKey() {
            this._strsToID = {}, this._idToStrs = [], this._length = 0;
        }
        __class(StringKey, "laya.utils.StringKey");
        var __proto = StringKey.prototype;
        __proto.add = function(str) {
            var index = this._strsToID[str];
            return null != index ? index : (this._idToStrs[this._length] = str, this._strsToID[str] = this._length++);
        }, __proto.getID = function(str) {
            var index = this._strsToID[str];
            return null == index ? -1 : index;
        }, __proto.getName = function(id) {
            var str = this._idToStrs[id];
            return null == str ? void 0 : str;
        };
    }(), function() {
        var TimerHandler;
        function Timer() {
            this._delta = 0, this.scale = 1, this.currFrame = 0, this._mid = 1, this._map = {}, 
            this._laters = [], this._handlers = [], this._temp = [], this._count = 0, this.currTimer = this._now(), 
            this._lastTimer = this._now(), this._init();
        }
        __class(Timer, "laya.utils.Timer");
        var __proto = Timer.prototype;
        return __proto._init = function() {
            Laya.timer && Laya.timer.frameLoop(1, this, this._update);
        }, __proto._now = function() {
            return Date.now();
        }, __proto._update = function() {
            if (this.scale <= 0) this._lastTimer = this._now(); else {
                var frame = this.currFrame = this.currFrame + this.scale, now = this._now();
                this._delta = (now - this._lastTimer) * this.scale;
                var timer = this.currTimer = this.currTimer + this._delta;
                this._lastTimer = now;
                var handlers = this._handlers;
                for (i = this._count = 0, n = handlers.length; i < n; i++) if (null !== (handler = handlers[i]).method) {
                    var t = handler.userFrame ? frame : timer;
                    if (t >= handler.exeTime) if (handler.repeat) if (handler.jumpFrame) for (;t >= handler.exeTime; ) handler.exeTime += handler.delay, 
                    handler.run(!1); else handler.exeTime += handler.delay, handler.run(!1), t > handler.exeTime && (handler.exeTime += Math.ceil((t - handler.exeTime) / handler.delay) * handler.delay); else handler.run(!0);
                } else this._count++;
                (30 < this._count || frame % 200 == 0) && this._clearHandlers();
                for (var laters = this._laters, i = 0, n = laters.length - 1; i <= n; i++) {
                    var handler = laters[i];
                    null !== handler.method && (delete this._map[handler.key], handler.run(!1)), this._recoverHandler(handler), 
                    i === n && (n = laters.length - 1);
                }
                laters.length = 0;
            }
        }, __proto._clearHandlers = function() {
            for (var handlers = this._handlers, i = 0, n = handlers.length; i < n; i++) {
                var handler = handlers[i];
                null !== handler.method ? this._temp.push(handler) : this._recoverHandler(handler);
            }
            this._handlers = this._temp, this._temp = handlers, this._temp.length = 0;
        }, __proto._recoverHandler = function(handler) {
            this._map[handler.key] == handler && delete this._map[handler.key], handler.recover();
        }, __proto._create = function(useFrame, repeat, delay, caller, method, args, coverBefore) {
            if (!delay) return method.apply(caller, args), null;
            if (coverBefore) {
                var handler = this._getHandler(caller, method);
                if (handler) return handler.repeat = repeat, handler.userFrame = useFrame, handler.delay = delay, 
                handler.caller = caller, handler.method = method, handler.args = args, handler.exeTime = delay + (useFrame ? this.currFrame : this.currTimer + this._now() - this._lastTimer), 
                handler;
            }
            return (handler = TimerHandler.create()).repeat = repeat, handler.userFrame = useFrame, 
            handler.delay = delay, handler.caller = caller, handler.method = method, handler.args = args, 
            handler.exeTime = delay + (useFrame ? this.currFrame : this.currTimer + this._now() - this._lastTimer) + 1, 
            this._indexHandler(handler), this._handlers.push(handler), handler;
        }, __proto._indexHandler = function(handler) {
            var caller = handler.caller, method = handler.method, cid = caller ? caller.$_GID || (caller.$_GID = Utils.getGID()) : 0, mid = method.$_TID || (method.$_TID = 1e5 * this._mid++);
            handler.key = cid + mid, this._map[handler.key] = handler;
        }, __proto.once = function(delay, caller, method, args, coverBefore) {
            void 0 === coverBefore && (coverBefore = !0), this._create(!1, !1, delay, caller, method, args, coverBefore);
        }, __proto.loop = function(delay, caller, method, args, coverBefore, jumpFrame) {
            void 0 === coverBefore && (coverBefore = !0), void 0 === jumpFrame && (jumpFrame = !1);
            var handler = this._create(!1, !0, delay, caller, method, args, coverBefore);
            handler && (handler.jumpFrame = jumpFrame);
        }, __proto.frameOnce = function(delay, caller, method, args, coverBefore) {
            void 0 === coverBefore && (coverBefore = !0), this._create(!0, !1, delay, caller, method, args, coverBefore);
        }, __proto.frameLoop = function(delay, caller, method, args, coverBefore) {
            void 0 === coverBefore && (coverBefore = !0), this._create(!0, !0, delay, caller, method, args, coverBefore);
        }, __proto.toString = function() {
            return "callLater:" + this._laters.length + " handlers:" + this._handlers.length + " pool:" + TimerHandler._freeCount;
        }, __proto.clear = function(caller, method) {
            var handler = this._getHandler(caller, method);
            handler && (delete this._map[handler.key], handler.key = 0, handler.clear());
        }, __proto.clearAll = function(caller) {
            if (caller) for (var i = 0, n = this._handlers.length; i < n; i++) {
                var handler = this._handlers[i];
                handler.caller === caller && (delete this._map[handler.key], handler.key = 0, handler.clear());
            }
        }, __proto._getHandler = function(caller, method) {
            var cid = caller ? caller.$_GID || (caller.$_GID = Utils.getGID()) : 0, mid = method.$_TID || (method.$_TID = 1e5 * this._mid++);
            return this._map[cid + mid];
        }, __proto.callLater = function(caller, method, args) {
            if (null == this._getHandler(caller, method)) {
                var handler = TimerHandler.create();
                handler.caller = caller, handler.method = method, handler.args = args, this._indexHandler(handler), 
                this._laters.push(handler);
            }
        }, __proto.runCallLater = function(caller, method) {
            var handler = this._getHandler(caller, method);
            handler && null != handler.method && (delete this._map[handler.key], handler.run(!0));
        }, __proto.runTimer = function(caller, method) {
            this.runCallLater(caller, method);
        }, __getset(0, __proto, "delta", function() {
            return this._delta;
        }), Timer.__init$ = function() {
            TimerHandler = function() {
                function TimerHandler() {
                    this.key = 0, this.repeat = !1, this.delay = 0, this.userFrame = !1, this.exeTime = 0, 
                    this.caller = null, this.method = null, this.args = null, this.jumpFrame = !1;
                }
                __class(TimerHandler, "");
                var __proto = TimerHandler.prototype;
                return __proto.clear = function() {
                    this.caller = null, this.method = null, this.args = null;
                }, __proto.recover = function() {
                    this.clear(), this.args = TimerHandler._freeHandler, TimerHandler._freeHandler = this, 
                    TimerHandler._freeCount++;
                }, __proto.run = function(withClear) {
                    var caller = this.caller;
                    if (caller && caller.destroyed) return this.clear();
                    var method = this.method, args = this.args;
                    withClear && this.clear(), null != method && (args ? method.apply(caller, args) : method.call(caller));
                }, TimerHandler._freeHandler = null, TimerHandler._freeCount = 0, TimerHandler.create = function() {
                    var result = TimerHandler._freeHandler;
                    return result ? (TimerHandler._freeHandler = result.args, --TimerHandler._freeCount, 
                    result.args = null, result) : new TimerHandler();
                }, TimerHandler;
            }();
        }, Timer;
    }()), Tween = function() {
        function Tween() {
            this.gid = 0;
        }
        __class(Tween, "laya.utils.Tween");
        var __proto = Tween.prototype;
        return __proto.to = function(target, props, duration, ease, complete, delay, coverBefore) {
            return void 0 === delay && (delay = 0), void 0 === coverBefore && (coverBefore = !1), 
            this._create(target, props, duration, ease, complete, delay, coverBefore, !0, !1, !0);
        }, __proto.from = function(target, props, duration, ease, complete, delay, coverBefore) {
            return void 0 === delay && (delay = 0), void 0 === coverBefore && (coverBefore = !1), 
            this._create(target, props, duration, ease, complete, delay, coverBefore, !1, !1, !0);
        }, __proto._create = function(target, props, duration, ease, complete, delay, coverBefore, isTo, usePool, runNow) {
            if (!target) throw new Error("Tween:target is null");
            this._target = target, this._duration = duration, this._ease = ease || props.ease || Tween.easeNone, 
            this._complete = complete || props.complete, this._delay = delay, this._props = [], 
            this._usedTimer = 0, this._startTimer = Browser.now(), this._usedPool = usePool, 
            this._delayParam = null, this.update = props.update;
            var gid = target.$_GID || (target.$_GID = Utils.getGID());
            return Tween.tweenMap[gid] ? (coverBefore && Tween.clearTween(target), Tween.tweenMap[gid].push(this)) : Tween.tweenMap[gid] = [ this ], 
            runNow ? delay <= 0 ? this.firstStart(target, props, isTo) : (this._delayParam = [ target, props, isTo ], 
            Laya.scaleTimer.once(delay, this, this.firstStart, this._delayParam)) : this._initProps(target, props, isTo), 
            this;
        }, __proto.firstStart = function(target, props, isTo) {
            this._delayParam = null, target.destroyed ? this.clear() : (this._initProps(target, props, isTo), 
            this._beginLoop());
        }, __proto._initProps = function(target, props, isTo) {
            for (var p in props) if ("number" == typeof target[p]) {
                var start = isTo ? target[p] : props[p], end = isTo ? props[p] : target[p];
                this._props.push([ p, start, end - start ]), isTo || (target[p] = start);
            }
        }, __proto._beginLoop = function() {
            Laya.scaleTimer.frameLoop(1, this, this._doEase);
        }, __proto._doEase = function() {
            this._updateEase(Browser.now());
        }, __proto._updateEase = function(time) {
            var target = this._target;
            if (target) {
                if (target.destroyed) return Tween.clearTween(target);
                var usedTimer = this._usedTimer = time - this._startTimer - this._delay;
                if (!(usedTimer < 0)) {
                    if (usedTimer >= this._duration) return this.complete();
                    for (var ratio = 0 < usedTimer ? this._ease(usedTimer, 0, 1, this._duration) : 0, props = this._props, i = 0, n = props.length; i < n; i++) {
                        var prop = props[i];
                        target[prop[0]] = prop[1] + ratio * prop[2];
                    }
                    this.update && this.update.run();
                }
            }
        }, __proto.complete = function() {
            if (this._target) {
                Laya.scaleTimer.runTimer(this, this.firstStart);
                for (var target = this._target, props = this._props, handler = this._complete, i = 0, n = props.length; i < n; i++) {
                    var prop = props[i];
                    target[prop[0]] = prop[1] + prop[2];
                }
                this.update && this.update.run(), this.clear(), handler && handler.run();
            }
        }, __proto.pause = function() {
            Laya.scaleTimer.clear(this, this._beginLoop), Laya.scaleTimer.clear(this, this._doEase), 
            Laya.scaleTimer.clear(this, this.firstStart);
            var dTime;
            (dTime = Browser.now() - this._startTimer - this._delay) < 0 && (this._usedTimer = dTime);
        }, __proto.setStartTime = function(startTime) {
            this._startTimer = startTime;
        }, __proto.clear = function() {
            this._target && (this._remove(), this._clear());
        }, __proto._clear = function() {
            this.pause(), Laya.scaleTimer.clear(this, this.firstStart), this._complete = null, 
            this._target = null, this._ease = null, this._props = null, this._delayParam = null, 
            this._usedPool && (this.update = null, Pool.recover("tween", this));
        }, __proto.recover = function() {
            this._usedPool = !0, this._clear();
        }, __proto._remove = function() {
            var tweens = Tween.tweenMap[this._target.$_GID];
            if (tweens) for (var i = 0, n = tweens.length; i < n; i++) if (tweens[i] === this) {
                tweens.splice(i, 1);
                break;
            }
        }, __proto.restart = function() {
            if (this.pause(), this._usedTimer = 0, this._startTimer = Browser.now(), this._delayParam) Laya.scaleTimer.once(this._delay, this, this.firstStart, this._delayParam); else {
                for (var props = this._props, i = 0, n = props.length; i < n; i++) {
                    var prop = props[i];
                    this._target[prop[0]] = prop[1];
                }
                Laya.scaleTimer.once(this._delay, this, this._beginLoop);
            }
        }, __proto.resume = function() {
            this._usedTimer >= this._duration || (this._startTimer = Browser.now() - this._usedTimer - this._delay, 
            this._delayParam ? this._usedTimer < 0 ? Laya.scaleTimer.once(-this._usedTimer, this, this.firstStart, this._delayParam) : this.firstStart.apply(this, this._delayParam) : this._beginLoop());
        }, __getset(0, __proto, "progress", null, function(v) {
            var uTime = v * this._duration;
            this._startTimer = Browser.now() - this._delay - uTime;
        }), Tween.to = function(target, props, duration, ease, complete, delay, coverBefore, autoRecover) {
            return void 0 === delay && (delay = 0), void 0 === coverBefore && (coverBefore = !1), 
            void 0 === autoRecover && (autoRecover = !0), Pool.getItemByClass("tween", Tween)._create(target, props, duration, ease, complete, delay, coverBefore, !0, autoRecover, !0);
        }, Tween.from = function(target, props, duration, ease, complete, delay, coverBefore, autoRecover) {
            return void 0 === delay && (delay = 0), void 0 === coverBefore && (coverBefore = !1), 
            void 0 === autoRecover && (autoRecover = !0), Pool.getItemByClass("tween", Tween)._create(target, props, duration, ease, complete, delay, coverBefore, !1, autoRecover, !0);
        }, Tween.clearAll = function(target) {
            if (target && target.$_GID) {
                var tweens = Tween.tweenMap[target.$_GID];
                if (tweens) {
                    for (var i = 0, n = tweens.length; i < n; i++) tweens[i]._clear();
                    tweens.length = 0;
                }
            }
        }, Tween.clear = function(tween) {
            tween.clear();
        }, Tween.clearTween = function(target) {
            Tween.clearAll(target);
        }, Tween.easeNone = function(t, b, c, d) {
            return c * t / d + b;
        }, Tween.tweenMap = {}, Tween;
    }(), Utils = function() {
        function Utils() {}
        return __class(Utils, "laya.utils.Utils"), Utils.toRadian = function(angle) {
            return angle * Utils._pi2;
        }, Utils.toAngle = function(radian) {
            return radian * Utils._pi;
        }, Utils.toHexColor = function(color) {
            if (color < 0 || isNaN(color)) return null;
            for (var str = color.toString(16); str.length < 6; ) str = "0" + str;
            return "#" + str;
        }, Utils.getGID = function() {
            return Utils._gid++;
        }, Utils.concatArray = function(source, array) {
            if (!array) return source;
            if (!source) return array;
            var i = 0, len = array.length;
            for (i = 0; i < len; i++) source.push(array[i]);
            return source;
        }, Utils.clearArray = function(array) {
            return array && (array.length = 0), array;
        }, Utils.copyArray = function(source, array) {
            if (source || (source = []), !array) return source;
            source.length = array.length;
            var i = 0, len = array.length;
            for (i = 0; i < len; i++) source[i] = array[i];
            return source;
        }, Utils.getGlobalRecByPoints = function(sprite, x0, y0, x1, y1) {
            var newLTPoint, newRBPoint;
            return newLTPoint = new Point(x0, y0), newLTPoint = sprite.localToGlobal(newLTPoint), 
            newRBPoint = new Point(x1, y1), newRBPoint = sprite.localToGlobal(newRBPoint), Rectangle._getWrapRec([ newLTPoint.x, newLTPoint.y, newRBPoint.x, newRBPoint.y ]);
        }, Utils.getGlobalPosAndScale = function(sprite) {
            return Utils.getGlobalRecByPoints(sprite, 0, 0, 1, 1);
        }, Utils.bind = function(fun, scope) {
            return fun.bind(scope);
        }, Utils.measureText = function(txt, font) {
            return RunDriver.measureText(txt, font);
        }, Utils.updateOrder = function(array) {
            if (!array || array.length < 2) return !1;
            for (var c, i = 1, j = 0, len = array.length, key = NaN; i < len; ) {
                for (c = array[j = i], key = array[j]._zOrder; -1 < --j && array[j]._zOrder > key; ) array[j + 1] = array[j];
                array[j + 1] = c, i++;
            }
            var model = c.parent.conchModel;
            if (model) if (null != model.updateZOrder) model.updateZOrder(); else {
                for (i = 0; i < len; i++) model.removeChild(array[i].conchModel);
                for (i = 0; i < len; i++) model.addChildAt(array[i].conchModel, i);
            }
            return !0;
        }, Utils.transPointList = function(points, x, y) {
            var i = 0, len = points.length;
            for (i = 0; i < len; i += 2) points[i] += x, points[i + 1] += y;
        }, Utils.parseInt = function(str, radix) {
            void 0 === radix && (radix = 0);
            var result = Browser.window.parseInt(str, radix);
            return isNaN(result) ? 0 : result;
        }, Utils.getFileExtension = function(path) {
            Utils._extReg.lastIndex = path.lastIndexOf(".");
            var result = Utils._extReg.exec(path);
            return result && 1 < result.length ? result[1].toLowerCase() : null;
        }, Utils.getTransformRelativeToWindow = function(coordinateSpace, x, y) {
            var stage = Laya.stage, globalTransform = laya.utils.Utils.getGlobalPosAndScale(coordinateSpace), canvasMatrix = stage._canvasTransform.clone(), canvasLeft = canvasMatrix.tx, canvasTop = canvasMatrix.ty;
            canvasMatrix.rotate(-Math.PI / 180 * Laya.stage.canvasDegree), canvasMatrix.scale(Laya.stage.clientScaleX, Laya.stage.clientScaleY);
            var perpendicular = Laya.stage.canvasDegree % 180 != 0, tx = NaN, ty = NaN;
            perpendicular ? (tx = y + globalTransform.y, ty = x + globalTransform.x, tx *= canvasMatrix.d, 
            ty *= canvasMatrix.a, 90 == Laya.stage.canvasDegree ? (tx = canvasLeft - tx, ty += canvasTop) : (tx += canvasLeft, 
            ty = canvasTop - ty)) : (tx = x + globalTransform.x, ty = y + globalTransform.y, 
            tx *= canvasMatrix.a, ty *= canvasMatrix.d, tx += canvasLeft, ty += canvasTop);
            var domScaleX = NaN, domScaleY = NaN;
            return domScaleY = perpendicular ? (domScaleX = canvasMatrix.d * globalTransform.height, 
            canvasMatrix.a * globalTransform.width) : (domScaleX = canvasMatrix.a * globalTransform.width, 
            canvasMatrix.d * globalTransform.height), {
                x: tx,
                y: ty,
                scaleX: domScaleX,
                scaleY: domScaleY
            };
        }, Utils.fitDOMElementInArea = function(dom, coordinateSpace, x, y, width, height) {
            dom._fitLayaAirInitialized || (dom._fitLayaAirInitialized = !0, dom.style.transformOrigin = dom.style.webKittransformOrigin = "left top", 
            dom.style.position = "absolute");
            var transform = Utils.getTransformRelativeToWindow(coordinateSpace, x, y);
            dom.style.transform = dom.style.webkitTransform = "scale(" + transform.scaleX + "," + transform.scaleY + ") rotate(" + Laya.stage.canvasDegree + "deg)", 
            dom.style.width = width + "px", dom.style.height = height + "px", dom.style.left = transform.x + "px", 
            dom.style.top = transform.y + "px";
        }, Utils.isOkTextureList = function(textureList) {
            if (!textureList) return !1;
            var tTexture, i = 0, len = textureList.length;
            for (i = 0; i < len; i++) if (!(tTexture = textureList[i]) || !tTexture.source) return !1;
            return !0;
        }, Utils.isOKCmdList = function(cmds) {
            if (!cmds) return !1;
            var cmd, tex, i = 0, len = cmds.length, context = Render._context;
            for (i = 0; i < len; i++) switch ((cmd = cmds[i]).callee) {
              case context._drawTexture:
              case context._fillTexture:
              case context._drawTextureWithTransform:
                if (!(tex = cmd[0]) || !tex.source) return !1;
            }
            return !0;
        }, Utils._gid = 1, Utils._pi = 180 / Math.PI, Utils._pi2 = Math.PI / 180, Utils._extReg = /\.(\w+)\??/g, 
        Utils.parseXMLFromString = function(value) {
            var rst;
            if (value = value.replace(/>\s+</g, "><"), -1 < (rst = new DOMParser().parseFromString(value, "text/xml")).firstChild.textContent.indexOf("This page contains the following errors")) throw new Error(rst.firstChild.firstChild.textContent);
            return rst;
        }, Utils;
    }(), VectorGraphManager = function() {
        function VectorGraphManager() {
            this.useDic = {}, this.shapeDic = {}, this.shapeLineDic = {}, this._id = 0, this._checkKey = !1, 
            this._freeIdArray = [], Render.isWebGL && CacheManager.regCacheByFunction(Utils.bind(this.startDispose, this), Utils.bind(this.getCacheList, this));
        }
        __class(VectorGraphManager, "laya.utils.VectorGraphManager");
        var __proto = VectorGraphManager.prototype;
        return __proto.getId = function() {
            return this._id++;
        }, __proto.addShape = function(id, shape) {
            this.shapeDic[id] = shape, this.useDic[id] || (this.useDic[id] = !0);
        }, __proto.addLine = function(id, Line) {
            this.shapeLineDic[id] = Line, this.shapeLineDic[id] || (this.shapeLineDic[id] = !0);
        }, __proto.getShape = function(id) {
            this._checkKey && null != this.useDic[id] && (this.useDic[id] = !0);
        }, __proto.deleteShape = function(id) {
            this.shapeDic[id] && (this.shapeDic[id] = null, delete this.shapeDic[id]), this.shapeLineDic[id] && (this.shapeLineDic[id] = null, 
            delete this.shapeLineDic[id]), null != this.useDic[id] && delete this.useDic[id];
        }, __proto.getCacheList = function() {
            var str, list = [];
            for (str in this.shapeDic) list.push(this.shapeDic[str]);
            for (str in this.shapeLineDic) list.push(this.shapeLineDic[str]);
            return list;
        }, __proto.startDispose = function(key) {
            var str;
            for (str in this.useDic) this.useDic[str] = !1;
            this._checkKey = !0;
        }, __proto.endDispose = function() {
            if (this._checkKey) {
                var str;
                for (str in this.useDic) this.useDic[str] || this.deleteShape(str);
                this._checkKey = !1;
            }
        }, VectorGraphManager.getInstance = function() {
            return VectorGraphManager.instance = VectorGraphManager.instance || new VectorGraphManager();
        }, VectorGraphManager.instance = null, VectorGraphManager;
    }(), WeakObject = function() {
        function WeakObject() {
            this._obj = null, this._obj = WeakObject.supportWeakMap ? new Browser.window.WeakMap() : {}, 
            WeakObject.supportWeakMap || WeakObject._maps.push(this);
        }
        __class(WeakObject, "laya.utils.WeakObject");
        var __proto = WeakObject.prototype;
        return __proto.set = function(key, value) {
            if (null != key) if (WeakObject.supportWeakMap) {
                var objKey = key;
                "string" != typeof key && "number" != typeof key || (objKey = WeakObject._keys[key]) || (objKey = WeakObject._keys[key] = {
                    k: key
                }), this._obj.set(objKey, value);
            } else "string" == typeof key || "number" == typeof key ? this._obj[key] = value : (key.$_GID || (key.$_GID = Utils.getGID()), 
            this._obj[key.$_GID] = value);
        }, __proto.get = function(key) {
            if (null == key) return null;
            if (WeakObject.supportWeakMap) {
                var objKey = "string" == typeof key || "number" == typeof key ? WeakObject._keys[key] : key;
                return objKey ? this._obj.get(objKey) : null;
            }
            return "string" == typeof key || "number" == typeof key ? this._obj[key] : this._obj[key.$_GID];
        }, __proto.del = function(key) {
            if (null != key) if (WeakObject.supportWeakMap) {
                var objKey = "string" == typeof key || "number" == typeof key ? WeakObject._keys[key] : key;
                if (!objKey) return;
                this._obj.delete(objKey);
            } else "string" == typeof key || "number" == typeof key ? delete this._obj[key] : delete this._obj[this._obj.$_GID];
        }, __proto.has = function(key) {
            if (null == key) return !1;
            if (WeakObject.supportWeakMap) {
                var objKey = "string" == typeof key || "number" == typeof key ? WeakObject._keys[key] : key;
                return this._obj.has(objKey);
            }
            return "string" == typeof key || "number" == typeof key ? null != this._obj[key] : null != this._obj[this._obj.$_GID];
        }, WeakObject.__init__ = function() {
            (WeakObject.supportWeakMap = null != Browser.window.WeakMap) || Laya.timer.loop(WeakObject.delInterval, null, WeakObject.clearCache);
        }, WeakObject.clearCache = function() {
            for (var i = 0, n = WeakObject._maps.length; i < n; i++) {
                WeakObject._maps[i]._obj = {};
            }
        }, WeakObject.supportWeakMap = !1, WeakObject.delInterval = 3e5, WeakObject._keys = {}, 
        WeakObject._maps = [], __static(WeakObject, [ "I", function() {
            return this.I = new WeakObject();
        } ]), WeakObject;
    }(), WordText = function() {
        function WordText() {
            this.id = NaN, this.save = [], this.toUpperCase = null, this.changed = !1, this._text = null;
        }
        __class(WordText, "laya.utils.WordText");
        var __proto = WordText.prototype;
        return __proto.setText = function(txt) {
            this.changed = !0, this._text = txt;
        }, __proto.toString = function() {
            return this._text;
        }, __proto.charCodeAt = function(i) {
            return this._text ? this._text.charCodeAt(i) : NaN;
        }, __proto.charAt = function(i) {
            return this._text ? this._text.charAt(i) : null;
        }, __getset(0, __proto, "length", function() {
            return this._text ? this._text.length : 0;
        }), WordText;
    }(), Node = function(_super) {
        function Node() {
            this._bits = 0, this._displayedInStage = !1, this._parent = null, this.conchModel = null, 
            this.name = "", this._destroyed = !1, Node.__super.call(this), this._childs = Node.ARRAY_EMPTY, 
            this._$P = Node.PROP_EMPTY, this.timer = Laya.scaleTimer, this.conchModel = Render.isConchNode ? this.createConchModel() : null;
        }
        __class(Node, "laya.display.Node", EventDispatcher);
        var __proto = Node.prototype;
        return __proto._setBit = function(type, value) {
            1 == type && (this._getBit(type) != value && this._updateDisplayedInstage());
            value ? this._bits |= type : this._bits &= ~type;
        }, __proto._getBit = function(type) {
            return 0 != (this._bits & type);
        }, __proto._setUpNoticeChain = function() {
            this._getBit(1) && this._setUpNoticeType(1);
        }, __proto._setUpNoticeType = function(type) {
            var ele = this;
            for (ele._setBit(type, !0), ele = ele.parent; ele; ) {
                if (ele._getBit(type)) return;
                ele._setBit(type, !0), ele = ele.parent;
            }
        }, __proto.on = function(type, caller, listener, args) {
            return "display" !== type && "undisplay" !== type || this._getBit(1) || this._setUpNoticeType(1), 
            this._createListener(type, caller, listener, args, !1);
        }, __proto.once = function(type, caller, listener, args) {
            return "display" !== type && "undisplay" !== type || this._getBit(1) || this._setUpNoticeType(1), 
            this._createListener(type, caller, listener, args, !0);
        }, __proto.createConchModel = function() {
            return null;
        }, __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), this._destroyed = !0, this._parent && this._parent.removeChild(this), 
            this._childs && (destroyChild ? this.destroyChildren() : this.removeChildren()), 
            this._childs = null, this._$P = null, this.offAll(), this.timer.clearAll(this);
        }, __proto.destroyChildren = function() {
            if (this._childs) for (var i = this._childs.length - 1; -1 < i; i--) this._childs[i].destroy(!0);
        }, __proto.addChild = function(node) {
            if (!node || this.destroyed || node === this) return node;
            if (node.zOrder && this._set$P("hasZorder", !0), node._parent === this) {
                var index = this.getChildIndex(node);
                index !== this._childs.length - 1 && (this._childs.splice(index, 1), this._childs.push(node), 
                this.conchModel && (this.conchModel.removeChild(node.conchModel), this.conchModel.addChildAt(node.conchModel, this._childs.length - 1)), 
                this._childChanged());
            } else node.parent && node.parent.removeChild(node), this._childs === Node.ARRAY_EMPTY && (this._childs = []), 
            this._childs.push(node), this.conchModel && this.conchModel.addChildAt(node.conchModel, this._childs.length - 1), 
            (node.parent = this)._childChanged();
            return node;
        }, __proto.addChildren = function(__args) {
            for (var args = arguments, i = 0, n = args.length; i < n; ) this.addChild(args[i++]);
        }, __proto.addChildAt = function(node, index) {
            if (!node || this.destroyed || node === this) return node;
            if (node.zOrder && this._set$P("hasZorder", !0), 0 <= index && index <= this._childs.length) {
                if (node._parent === this) {
                    var oldIndex = this.getChildIndex(node);
                    this._childs.splice(oldIndex, 1), this._childs.splice(index, 0, node), this.conchModel && (this.conchModel.removeChild(node.conchModel), 
                    this.conchModel.addChildAt(node.conchModel, index)), this._childChanged();
                } else node.parent && node.parent.removeChild(node), this._childs === Node.ARRAY_EMPTY && (this._childs = []), 
                this._childs.splice(index, 0, node), this.conchModel && this.conchModel.addChildAt(node.conchModel, index), 
                node.parent = this;
                return node;
            }
            throw new Error("appendChildAt:The index is out of bounds");
        }, __proto.getChildIndex = function(node) {
            return this._childs.indexOf(node);
        }, __proto.getChildByName = function(name) {
            var nodes = this._childs;
            if (nodes) for (var i = 0, n = nodes.length; i < n; i++) {
                var node = nodes[i];
                if (node.name === name) return node;
            }
            return null;
        }, __proto._get$P = function(key) {
            return this._$P[key];
        }, __proto._set$P = function(key, value) {
            return this.destroyed || (this._$P === Node.PROP_EMPTY && (this._$P = {}), this._$P[key] = value), 
            value;
        }, __proto.getChildAt = function(index) {
            return this._childs[index];
        }, __proto.setChildIndex = function(node, index) {
            var childs = this._childs;
            if (index < 0 || index >= childs.length) throw new Error("setChildIndex:The index is out of bounds.");
            var oldIndex = this.getChildIndex(node);
            if (oldIndex < 0) throw new Error("setChildIndex:node is must child of this object.");
            return childs.splice(oldIndex, 1), childs.splice(index, 0, node), this.conchModel && (this.conchModel.removeChild(node.conchModel), 
            this.conchModel.addChildAt(node.conchModel, index)), this._childChanged(), node;
        }, __proto._childChanged = function(child) {}, __proto.removeChild = function(node) {
            if (!this._childs) return node;
            var index = this._childs.indexOf(node);
            return this.removeChildAt(index);
        }, __proto.removeSelf = function() {
            return this._parent && this._parent.removeChild(this), this;
        }, __proto.removeChildByName = function(name) {
            var node = this.getChildByName(name);
            return node && this.removeChild(node), node;
        }, __proto.removeChildAt = function(index) {
            var node = this.getChildAt(index);
            if (node) {
                for (var last = this._childs.length - 1, j = index; j < last; ++j) this._childs[j] = this._childs[j + 1];
                this._childs.length = last, this.conchModel && this.conchModel.removeChild(node.conchModel), 
                node.parent = null;
            }
            return node;
        }, __proto.removeChildren = function(beginIndex, endIndex) {
            if (void 0 === beginIndex && (beginIndex = 0), void 0 === endIndex && (endIndex = 2147483647), 
            this._childs && 0 < this._childs.length) {
                var childs = this._childs;
                if (0 === beginIndex && n <= endIndex) {
                    var arr = childs;
                    this._childs = Node.ARRAY_EMPTY;
                } else arr = childs.splice(beginIndex, endIndex - beginIndex);
                for (var i = 0, n = arr.length; i < n; i++) arr[i].parent = null, this.conchModel && this.conchModel.removeChild(arr[i].conchModel);
            }
            return this;
        }, __proto.replaceChild = function(newNode, oldNode) {
            var index = this._childs.indexOf(oldNode);
            return -1 < index ? (this._childs.splice(index, 1, newNode), this.conchModel && (this.conchModel.removeChild(oldNode.conchModel), 
            this.conchModel.addChildAt(newNode.conchModel, index)), oldNode.parent = null, newNode.parent = this, 
            newNode) : null;
        }, __proto._updateDisplayedInstage = function() {
            var ele;
            ele = this;
            var stage = Laya.stage;
            for (this._displayedInStage = !1; ele; ) {
                if (ele._getBit(1)) {
                    this._displayedInStage = ele._displayedInStage;
                    break;
                }
                if (ele == stage || ele._displayedInStage) {
                    this._displayedInStage = !0;
                    break;
                }
                ele = ele.parent;
            }
        }, __proto._setDisplay = function(value) {
            this._displayedInStage !== value && ((this._displayedInStage = value) ? this.event("display") : this.event("undisplay"));
        }, __proto._displayChild = function(node, display) {
            var childs = node._childs;
            if (childs) for (var i = 0, n = childs.length; i < n; i++) {
                var child = childs[i];
                child._getBit(1) && (0 < child._childs.length ? this._displayChild(child, display) : child._setDisplay(display));
            }
            node._setDisplay(display);
        }, __proto.contains = function(node) {
            if (node === this) return !0;
            for (;node; ) {
                if (node.parent === this) return !0;
                node = node.parent;
            }
            return !1;
        }, __proto.timerLoop = function(delay, caller, method, args, coverBefore, jumpFrame) {
            void 0 === coverBefore && (coverBefore = !0), void 0 === jumpFrame && (jumpFrame = !1), 
            this.timer.loop(delay, caller, method, args, coverBefore, jumpFrame);
        }, __proto.timerOnce = function(delay, caller, method, args, coverBefore) {
            void 0 === coverBefore && (coverBefore = !0), this.timer._create(!1, !1, delay, caller, method, args, coverBefore);
        }, __proto.frameLoop = function(delay, caller, method, args, coverBefore) {
            void 0 === coverBefore && (coverBefore = !0), this.timer._create(!0, !0, delay, caller, method, args, coverBefore);
        }, __proto.frameOnce = function(delay, caller, method, args, coverBefore) {
            void 0 === coverBefore && (coverBefore = !0), this.timer._create(!0, !1, delay, caller, method, args, coverBefore);
        }, __proto.clearTimer = function(caller, method) {
            this.timer.clear(caller, method);
        }, __getset(0, __proto, "numChildren", function() {
            return this._childs.length;
        }), __getset(0, __proto, "destroyed", function() {
            return this._destroyed;
        }), __getset(0, __proto, "parent", function() {
            return this._parent;
        }, function(value) {
            this._parent !== value && (value ? (this._parent = value, this.event("added"), this._getBit(1) && (this._setUpNoticeChain(), 
            value.displayedInStage && this._displayChild(this, !0)), value._childChanged(this)) : (this.event("removed"), 
            this._parent._childChanged(), this._getBit(1) && this._displayChild(this, !1), this._parent = value));
        }), __getset(0, __proto, "displayedInStage", function() {
            return this._getBit(1) || this._setUpNoticeType(1), this._displayedInStage;
        }), Node.ARRAY_EMPTY = [], Node.PROP_EMPTY = {}, Node.NOTICE_DISPLAY = 1, Node.MOUSEENABLE = 2, 
        Node;
    }(), CSSStyle = function(_super) {
        function CSSStyle(ower) {
            this._bgground = null, this._border = null, this._rect = null, this.underLine = 0, 
            this.lineHeight = 0, CSSStyle.__super.call(this), this._padding = CSSStyle._PADDING, 
            this._spacing = CSSStyle._SPACING, this._aligns = CSSStyle._ALIGNS, this._font = Font.EMPTY, 
            this._ower = ower;
        }
        __class(CSSStyle, "laya.display.css.CSSStyle", _super);
        var __proto = CSSStyle.prototype;
        return __proto.destroy = function() {
            this._ower = null, this._font = null, this._rect = null;
        }, __proto.inherit = function(src) {
            this._font = src._font, this._spacing = src._spacing === CSSStyle._SPACING ? CSSStyle._SPACING : src._spacing.slice(), 
            this.lineHeight = src.lineHeight;
        }, __proto._widthAuto = function() {
            return 0 != (262144 & this._type);
        }, __proto.widthed = function(sprite) {
            return 0 != (8 & this._type);
        }, __proto._calculation = function(type, value) {
            if (value.indexOf("%") < 0) return !1;
            var ower = this._ower, parent = ower.parent, rect = this._rect;
            function getValue(pw, w, nums) {
                return pw * nums[0] + w * nums[1] + nums[2];
            }
            function onParentResize(type) {
                var pw = parent.width, w = ower.width;
                rect.width && (ower.width = getValue(pw, w, rect.width)), rect.height && (ower.height = getValue(pw, w, rect.height)), 
                rect.left && (ower.x = getValue(pw, w, rect.left)), rect.top && (ower.y = getValue(pw, w, rect.top));
            }
            null === rect && (parent._getCSSStyle()._type |= 524288, parent.on("resize", this, onParentResize), 
            this._rect = rect = {
                input: {}
            });
            var nums = value.split(" ");
            return nums[0] = parseFloat(nums[0]) / 100, 1 == nums.length ? nums[1] = nums[2] = 0 : (nums[1] = parseFloat(nums[1]) / 100, 
            nums[2] = parseFloat(nums[2])), rect[type] = nums, rect.input[type] = value, onParentResize(), 
            !0;
        }, __proto.heighted = function(sprite) {
            return 0 != (8192 & this._type);
        }, __proto.size = function(w, h) {
            var ower = this._ower, resize = !1;
            -1 !== w && w != this._ower.width && (this._type |= 8, this._ower.width = w, resize = !0), 
            -1 !== h && h != this._ower.height && (this._type |= 8192, this._ower.height = h, 
            resize = !0), resize && (ower._layoutLater(), 524288 & this._type && ower.event("resize", this));
        }, __proto._getAlign = function() {
            return this._aligns[0];
        }, __proto._getValign = function() {
            return this._aligns[1];
        }, __proto._getCssFloat = function() {
            return 0 != (32768 & this._type) ? 32768 : 0;
        }, __proto._createFont = function() {
            return 4096 & this._type ? this._font : (this._type |= 4096, this._font = new Font(this._font));
        }, __proto.render = function(sprite, context, x, y) {
            var w = sprite.width, h = sprite.height;
            x -= sprite.pivotX, y -= sprite.pivotY, this._bgground && null != this._bgground.color && context.ctx.fillRect(x, y, w, h, this._bgground.color), 
            this._border && this._border.color && context.drawRect(x, y, w, h, this._border.color.strColor, this._border.size);
        }, __proto.getCSSStyle = function() {
            return this;
        }, __proto.cssText = function(text) {
            this.attrs(CSSStyle.parseOneCSS(text, ";"));
        }, __proto.attrs = function(attrs) {
            if (attrs) for (var i = 0, n = attrs.length; i < n; i++) {
                var attr = attrs[i];
                this[attr[0]] = attr[1];
            }
        }, __proto.setTransform = function(value) {
            "none" === value ? this._tf = Style._TF_EMPTY : this.attrs(CSSStyle.parseOneCSS(value, ","));
        }, __proto.translate = function(x, y) {
            this._tf === Style._TF_EMPTY && (this._tf = new TransformInfo()), this._tf.translateX = x, 
            this._tf.translateY = y;
        }, __proto.scale = function(x, y) {
            this._tf === Style._TF_EMPTY && (this._tf = new TransformInfo()), this._tf.scaleX = x, 
            this._tf.scaleY = y;
        }, __proto._enableLayout = function() {
            return 0 == (2 & this._type) && 0 == (4 & this._type);
        }, __getset(0, __proto, "block", _super.prototype._$get_block, function(value) {
            value ? this._type |= 1 : this._type &= -2;
        }), __getset(0, __proto, "valign", function() {
            return CSSStyle._valigndef[this._aligns[1]];
        }, function(value) {
            this._aligns === CSSStyle._ALIGNS && (this._aligns = [ 0, 0, 0 ]), this._aligns[1] = CSSStyle._valigndef[value];
        }), __getset(0, __proto, "height", null, function(h) {
            if (this._type |= 8192, "string" == typeof h) {
                if (this._calculation("height", h)) return;
                h = parseInt(h);
            }
            this.size(-1, h);
        }), __getset(0, __proto, "width", null, function(w) {
            if (this._type |= 8, "string" == typeof w) {
                var offset = w.indexOf("auto");
                if (0 <= offset && (this._type |= 262144, w = w.substr(0, offset)), this._calculation("width", w)) return;
                w = parseInt(w);
            }
            this.size(w, -1);
        }), __getset(0, __proto, "fontWeight", function() {
            return this._font.weight;
        }, function(value) {
            this._createFont().weight = value;
        }), __getset(0, __proto, "left", null, function(value) {
            var ower = this._ower;
            if ("string" == typeof value) {
                if ("center" === value ? value = "50% -50% 0" : "right" === value && (value = "100% -100% 0"), 
                this._calculation("left", value)) return;
                value = parseInt(value);
            }
            ower.x = value;
        }), __getset(0, __proto, "_translate", null, function(value) {
            this.translate(value[0], value[1]);
        }), __getset(0, __proto, "absolute", function() {
            return 0 != (4 & this._type);
        }), __getset(0, __proto, "top", null, function(value) {
            var ower = this._ower;
            if ("string" == typeof value) {
                if ("middle" === value ? value = "50% -50% 0" : "bottom" === value && (value = "100% -100% 0"), 
                this._calculation("top", value)) return;
                value = parseInt(value);
            }
            ower.y = value;
        }), __getset(0, __proto, "align", function() {
            return CSSStyle._aligndef[this._aligns[0]];
        }, function(value) {
            this._aligns === CSSStyle._ALIGNS && (this._aligns = [ 0, 0, 0 ]), this._aligns[0] = CSSStyle._aligndef[value];
        }), __getset(0, __proto, "bold", function() {
            return this._font.bold;
        }, function(value) {
            this._createFont().bold = value;
        }), __getset(0, __proto, "padding", function() {
            return this._padding;
        }, function(value) {
            this._padding = value;
        }), __getset(0, __proto, "leading", function() {
            return this._spacing[1];
        }, function(d) {
            "string" == typeof d && (d = parseInt(d + "")), this._spacing === CSSStyle._SPACING && (this._spacing = [ 0, 0 ]), 
            this._spacing[1] = d;
        }), __getset(0, __proto, "lineElement", function() {
            return 0 != (65536 & this._type);
        }, function(value) {
            value ? this._type |= 65536 : this._type &= -65537;
        }), __getset(0, __proto, "cssFloat", function() {
            return 0 != (32768 & this._type) ? "right" : "left";
        }, function(value) {
            this.lineElement = !1, "right" === value ? this._type |= 32768 : this._type &= -32769;
        }), __getset(0, __proto, "textDecoration", function() {
            return this._font.decoration;
        }, function(value) {
            this._createFont().decoration = value;
        }), __getset(0, __proto, "whiteSpace", function() {
            return 131072 & this._type ? "nowrap" : "";
        }, function(type) {
            "nowrap" === type && (this._type |= 131072), "none" === type && (this._type &= -131073);
        }), __getset(0, __proto, "background", null, function(value) {
            value ? (this._bgground || (this._bgground = {}), this._bgground.color = value, 
            this._ower.conchModel && this._ower.conchModel.bgColor(value), this._type |= 16384, 
            this._ower._renderType |= 256) : this._bgground = null;
        }), __getset(0, __proto, "wordWrap", function() {
            return 0 == (131072 & this._type);
        }, function(value) {
            value ? this._type &= -131073 : this._type |= 131072;
        }), __getset(0, __proto, "color", function() {
            return this._font.color;
        }, function(value) {
            this._createFont().color = value;
        }), __getset(0, __proto, "password", function() {
            return this._font.password;
        }, function(value) {
            this._createFont().password = value;
        }), __getset(0, __proto, "backgroundColor", function() {
            return this._bgground ? this._bgground.color : null;
        }, function(value) {
            "none" === value ? this._bgground = null : (this._bgground || (this._bgground = {}), 
            this._bgground.color = value), this._ower.conchModel && this._ower.conchModel.bgColor(value), 
            this._ower._renderType |= 256;
        }), __getset(0, __proto, "font", function() {
            return this._font.toString();
        }, function(value) {
            this._createFont().set(value);
        }), __getset(0, __proto, "weight", null, function(value) {
            this._createFont().weight = value;
        }), __getset(0, __proto, "letterSpacing", function() {
            return this._spacing[0];
        }, function(d) {
            "string" == typeof d && (d = parseInt(d + "")), this._spacing === CSSStyle._SPACING && (this._spacing = [ 0, 0 ]), 
            this._spacing[0] = d;
        }), __getset(0, __proto, "fontSize", function() {
            return this._font.size;
        }, function(value) {
            this._createFont().size = value;
        }), __getset(0, __proto, "italic", function() {
            return this._font.italic;
        }, function(value) {
            this._createFont().italic = value;
        }), __getset(0, __proto, "fontFamily", function() {
            return this._font.family;
        }, function(value) {
            this._createFont().family = value;
        }), __getset(0, __proto, "stroke", function() {
            return this._font.stroke[0];
        }, function(value) {
            this._createFont().stroke === Font._STROKE && (this._font.stroke = [ 0, "#000000" ]), 
            this._font.stroke[0] = value;
        }), __getset(0, __proto, "strokeColor", function() {
            return this._font.stroke[1];
        }, function(value) {
            this._createFont().stroke === Font._STROKE && (this._font.stroke = [ 0, "#000000" ]), 
            this._font.stroke[1] = value;
        }), __getset(0, __proto, "border", function() {
            return this._border ? this._border.value : "";
        }, function(value) {
            if ("none" != value) {
                this._border || (this._border = {});
                var values = (this._border.value = value).split(" ");
                if (this._border.color = Color.create(values[values.length - 1]), 1 == values.length) return this._border.size = 1, 
                void (this._border.type = "solid");
                var i = 0;
                0 < values[0].indexOf("px") ? (this._border.size = parseInt(values[0]), i++) : this._border.size = 1, 
                this._border.type = values[i], this._ower._renderType |= 256;
            } else this._border = null;
        }), __getset(0, __proto, "borderColor", function() {
            return this._border && this._border.color ? this._border.color.strColor : null;
        }, function(value) {
            value ? (this._border || (this._border = {
                size: 1,
                type: "solid"
            }), this._border.color = null == value ? null : Color.create(value), this._ower.conchModel && this._ower.conchModel.border(this._border.color.strColor), 
            this._ower._renderType |= 256) : this._border = null;
        }), __getset(0, __proto, "position", function() {
            return 4 & this._type ? "absolute" : "";
        }, function(value) {
            "absolute" == value ? this._type |= 4 : this._type &= -5;
        }), __getset(0, __proto, "display", null, function(value) {
            switch (value) {
              case "":
                this._type &= -3, this.visible = !0;
                break;

              case "none":
                this._type |= 2, this.visible = !1, this._ower._layoutLater();
            }
        }), __getset(0, __proto, "paddingLeft", function() {
            return this.padding[3];
        }), __getset(0, __proto, "paddingTop", function() {
            return this.padding[0];
        }), __getset(0, __proto, "_scale", null, function(value) {
            this._ower.scale(value[0], value[1]);
        }), __getset(0, __proto, "_rotate", null, function(value) {
            this._ower.rotation = value;
        }), CSSStyle.parseOneCSS = function(text, clipWord) {
            for (var valueArray, out = [], attrs = text.split(clipWord), i = 0, n = attrs.length; i < n; i++) {
                var attr = attrs[i], ofs = attr.indexOf(":"), name = attr.substr(0, ofs).replace(/^\s+|\s+$/g, "");
                if (0 != name.length) {
                    var value = attr.substr(ofs + 1).replace(/^\s+|\s+$/g, ""), one = [ name, value ];
                    switch (name) {
                      case "italic":
                      case "bold":
                        one[1] = "true" == value;
                        break;

                      case "line-height":
                        one[0] = "lineHeight", one[1] = parseInt(value);
                        break;

                      case "font-size":
                        one[0] = "fontSize", one[1] = parseInt(value);
                        break;

                      case "padding":
                        1 < (valueArray = value.split(" ")).length || (valueArray[1] = valueArray[2] = valueArray[3] = valueArray[0]), 
                        one[1] = [ parseInt(valueArray[0]), parseInt(valueArray[1]), parseInt(valueArray[2]), parseInt(valueArray[3]) ];
                        break;

                      case "rotate":
                        one[0] = "_rotate", one[1] = parseFloat(value);
                        break;

                      case "scale":
                        valueArray = value.split(" "), one[0] = "_scale", one[1] = [ parseFloat(valueArray[0]), parseFloat(valueArray[1]) ];
                        break;

                      case "translate":
                        valueArray = value.split(" "), one[0] = "_translate", one[1] = [ parseInt(valueArray[0]), parseInt(valueArray[1]) ];
                        break;

                      default:
                        (one[0] = CSSStyle._CSSTOVALUE[name]) || (one[0] = name);
                    }
                    out.push(one);
                }
            }
            return out;
        }, CSSStyle.parseCSS = function(text, uri) {
            for (var one; null != (one = CSSStyle._parseCSSRegExp.exec(text)); ) CSSStyle.styleSheets[one[1]] = CSSStyle.parseOneCSS(one[2], ";");
        }, CSSStyle.EMPTY = new CSSStyle(null), CSSStyle._CSSTOVALUE = {
            "letter-spacing": "letterSpacing",
            "line-spacing": "lineSpacing",
            "white-space": "whiteSpace",
            "line-height": "lineHeight",
            "scale-x": "scaleX",
            "scale-y": "scaleY",
            "translate-x": "translateX",
            "translate-y": "translateY",
            "font-family": "fontFamily",
            "font-weight": "fontWeight",
            "vertical-align": "valign",
            "text-decoration": "textDecoration",
            "background-color": "backgroundColor",
            "border-color": "borderColor",
            float: "cssFloat"
        }, CSSStyle._parseCSSRegExp = new RegExp("([.#]\\w+)\\s*{([\\s\\S]*?)}", "g"), CSSStyle._aligndef = {
            left: 0,
            center: 1,
            right: 2,
            0: "left",
            1: "center",
            2: "right"
        }, CSSStyle._valigndef = {
            top: 0,
            middle: 1,
            bottom: 2,
            0: "top",
            1: "middle",
            2: "bottom"
        }, CSSStyle.styleSheets = {}, CSSStyle.ALIGN_CENTER = 1, CSSStyle.ALIGN_RIGHT = 2, 
        CSSStyle.VALIGN_MIDDLE = 1, CSSStyle.VALIGN_BOTTOM = 2, CSSStyle._CSS_BLOCK = 1, 
        CSSStyle._DISPLAY_NONE = 2, CSSStyle._ABSOLUTE = 4, CSSStyle._WIDTH_SET = 8, CSSStyle._PADDING = [ 0, 0, 0, 0 ], 
        CSSStyle._RECT = [ -1, -1, -1, -1 ], CSSStyle._SPACING = [ 0, 0 ], CSSStyle._ALIGNS = [ 0, 0, 0 ], 
        CSSStyle.ADDLAYOUTED = 512, CSSStyle._NEWFONT = 4096, CSSStyle._HEIGHT_SET = 8192, 
        CSSStyle._BACKGROUND_SET = 16384, CSSStyle._FLOAT_RIGHT = 32768, CSSStyle._LINE_ELEMENT = 65536, 
        CSSStyle._NOWARP = 131072, CSSStyle._WIDTHAUTO = 262144, CSSStyle._LISTERRESZIE = 524288, 
        CSSStyle;
    }(Style), AudioSound = function(_super) {
        function AudioSound() {
            this.url = null, this.audio = null, this.loaded = !1, AudioSound.__super.call(this);
        }
        __class(AudioSound, "laya.media.h5audio.AudioSound", EventDispatcher);
        var __proto = AudioSound.prototype;
        return __proto.dispose = function() {
            var ad = AudioSound._audioCache[this.url];
            ad && (ad.src = "", delete AudioSound._audioCache[this.url]);
        }, __proto.load = function(url) {
            var ad;
            if (url = URL.formatURL(url), (this.url = url) == SoundManager._tMusic ? (AudioSound._initMusicAudio(), 
            (ad = AudioSound._musicAudio).src != url && (AudioSound._audioCache[ad.src] = null, 
            ad = null)) : ad = AudioSound._audioCache[url], ad && 2 <= ad.readyState) this.event("complete"); else {
                ad || (ad = url == SoundManager._tMusic ? (AudioSound._initMusicAudio(), AudioSound._musicAudio) : Browser.createElement("audio"), 
                (AudioSound._audioCache[url] = ad).src = url), ad.addEventListener("canplaythrough", onLoaded), 
                ad.addEventListener("error", onErr);
                var me = this;
                (this.audio = ad).load ? ad.load() : onErr();
            }
            function onLoaded() {
                offs(), me.loaded = !0, me.event("complete");
            }
            function onErr() {
                ad.load = null, offs(), me.event("error");
            }
            function offs() {
                ad.removeEventListener("canplaythrough", onLoaded), ad.removeEventListener("error", onErr);
            }
        }, __proto.play = function(startTime, loops) {
            if (void 0 === startTime && (startTime = 0), void 0 === loops && (loops = 0), !this.url) return null;
            var ad, tAd;
            if (!(ad = this.url == SoundManager._tMusic ? AudioSound._musicAudio : AudioSound._audioCache[this.url])) return null;
            tAd = Pool.getItem("audio:" + this.url), Render.isConchApp ? tAd || ((tAd = Browser.createElement("audio")).src = this.url) : this.url == SoundManager._tMusic ? (AudioSound._initMusicAudio(), 
            (tAd = AudioSound._musicAudio).src = this.url) : tAd = tAd || ad.cloneNode(!0);
            var channel = new AudioSoundChannel(tAd);
            return channel.url = this.url, channel.loops = loops, channel.startTime = startTime, 
            channel.play(), SoundManager.addChannel(channel), channel;
        }, __getset(0, __proto, "duration", function() {
            var ad;
            return (ad = AudioSound._audioCache[this.url]) ? ad.duration : 0;
        }), AudioSound._initMusicAudio = function() {
            AudioSound._musicAudio || (AudioSound._musicAudio || (AudioSound._musicAudio = Browser.createElement("audio")), 
            Render.isConchApp || Browser.document.addEventListener("mousedown", AudioSound._makeMusicOK));
        }, AudioSound._makeMusicOK = function() {
            Browser.document.removeEventListener("mousedown", AudioSound._makeMusicOK), AudioSound._musicAudio.src ? AudioSound._musicAudio.play() : (AudioSound._musicAudio.src = "", 
            AudioSound._musicAudio.load());
        }, AudioSound._audioCache = {}, AudioSound._musicAudio = null, AudioSound;
    }(), SoundChannel = function(_super) {
        function SoundChannel() {
            this.url = null, this.loops = 0, this.startTime = NaN, this.isStopped = !1, this.completeHandler = null, 
            SoundChannel.__super.call(this);
        }
        __class(SoundChannel, "laya.media.SoundChannel", EventDispatcher);
        var __proto = SoundChannel.prototype;
        return __proto.play = function() {}, __proto.stop = function() {}, __proto.pause = function() {}, 
        __proto.resume = function() {}, __proto.__runComplete = function(handler) {
            handler && handler.run();
        }, __getset(0, __proto, "volume", function() {
            return 1;
        }, function(v) {}), __getset(0, __proto, "position", function() {
            return 0;
        }), __getset(0, __proto, "duration", function() {
            return 0;
        }), SoundChannel;
    }(), Sound = function(_super) {
        function Sound() {
            Sound.__super.call(this);
        }
        __class(Sound, "laya.media.Sound", EventDispatcher);
        var __proto = Sound.prototype;
        return __proto.load = function(url) {}, __proto.play = function(startTime, loops) {
            return void 0 === startTime && (startTime = 0), void 0 === loops && (loops = 0), 
            null;
        }, __proto.dispose = function() {}, __getset(0, __proto, "duration", function() {
            return 0;
        }), Sound;
    }(), WebAudioSound = function(_super) {
        function WebAudioSound() {
            this.url = null, this.loaded = !1, this.data = null, this.audioBuffer = null, this.__toPlays = null, 
            this._disposed = !1, WebAudioSound.__super.call(this);
        }
        __class(WebAudioSound, "laya.media.webaudio.WebAudioSound", EventDispatcher);
        var __proto = WebAudioSound.prototype;
        return __proto.load = function(url) {
            this.url = url, this.audioBuffer = WebAudioSound._dataCache[url], this.audioBuffer ? this._loaded(this.audioBuffer) : (WebAudioSound.e.on("loaded:" + url, this, this._loaded), 
            WebAudioSound.e.on("err:" + url, this, this._err), WebAudioSound.__loadingSound[url] || (WebAudioSound.__loadingSound[url] = !0, 
            Laya.loader.load(url, Handler.create(this, this.onloaded), null, Loader.BUFFER, 4, !1, null, !0)));
        }, __proto.onloaded = function(data) {
            data || this._err(), this._disposed ? this._removeLoadEvents() : (this.data = data, 
            WebAudioSound.buffs.push({
                buffer: this.data,
                url: this.url
            }), WebAudioSound.decode());
        }, __proto._err = function() {
            if (this._removeLoadEvents(), WebAudioSound.__loadingSound[this.url] = !1, this.event("error"), 
            this.__toPlays) {
                var len, toPlays, tParams, i = 0;
                for (len = (toPlays = this.__toPlays).length, i = 0; i < len; i++) (tParams = toPlays[i])[2] && !tParams[2].isStopped && tParams[2].event("error");
                this.__toPlays.length = 0;
            }
        }, __proto._loaded = function(audioBuffer) {
            this._removeLoadEvents(), this._disposed || (this.audioBuffer = audioBuffer, WebAudioSound._dataCache[this.url] = this.audioBuffer, 
            this.loaded = !0, this.event("complete"));
        }, __proto._removeLoadEvents = function() {
            WebAudioSound.e.off("loaded:" + this.url, this, this._loaded), WebAudioSound.e.off("err:" + this.url, this, this._err);
        }, __proto.__playAfterLoaded = function() {
            if (this.__toPlays) {
                var len, toPlays, tParams, i = 0;
                for (len = (toPlays = this.__toPlays).length, i = 0; i < len; i++) (tParams = toPlays[i])[2] && !tParams[2].isStopped && this.play(tParams[0], tParams[1], tParams[2]);
                this.__toPlays.length = 0;
            }
        }, __proto.play = function(startTime, loops, channel) {
            return void 0 === startTime && (startTime = 0), void 0 === loops && (loops = 0), 
            channel = channel || new WebAudioSoundChannel(), this.audioBuffer || this.url && (this.__toPlays || (this.__toPlays = []), 
            this.__toPlays.push([ startTime, loops, channel ]), this.once("complete", this, this.__playAfterLoaded), 
            this.load(this.url)), channel.url = this.url, channel.loops = loops, channel.audioBuffer = this.audioBuffer, 
            channel.startTime = startTime, channel.play(), SoundManager.addChannel(channel), 
            channel;
        }, __proto.dispose = function() {
            this._disposed = !0, delete WebAudioSound._dataCache[this.url], delete WebAudioSound.__loadingSound[this.url], 
            this.audioBuffer = null, this.data = null, this.__toPlays = [];
        }, __getset(0, __proto, "duration", function() {
            return this.audioBuffer ? this.audioBuffer.duration : 0;
        }), WebAudioSound.decode = function() {
            WebAudioSound.buffs.length <= 0 || WebAudioSound.isDecoding || (WebAudioSound.isDecoding = !0, 
            WebAudioSound.tInfo = WebAudioSound.buffs.shift(), WebAudioSound.ctx.decodeAudioData(WebAudioSound.tInfo.buffer, WebAudioSound._done, WebAudioSound._fail));
        }, WebAudioSound._done = function(audioBuffer) {
            WebAudioSound.e.event("loaded:" + WebAudioSound.tInfo.url, audioBuffer), WebAudioSound.isDecoding = !1, 
            WebAudioSound.decode();
        }, WebAudioSound._fail = function() {
            WebAudioSound.e.event("err:" + WebAudioSound.tInfo.url, null), WebAudioSound.isDecoding = !1, 
            WebAudioSound.decode();
        }, WebAudioSound._playEmptySound = function() {
            if (null != WebAudioSound.ctx) {
                if (WebAudioSound._emptySource && (WebAudioSound._emptySource.stop(), WebAudioSound._emptySource.disconnect(0), 
                !WebAudioSoundChannel._tryCleanFailed)) try {
                    WebAudioSound._emptySource.buffer = null;
                } catch (e) {
                    e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                    WebAudioSoundChannel._tryCleanFailed = !0;
                }
                var source = WebAudioSound.ctx.createBufferSource();
                source.buffer = WebAudioSound._miniBuffer, source.connect(WebAudioSound.ctx.destination), 
                source.start(0, 0, 0), WebAudioSound._emptySource = source;
            }
        }, WebAudioSound._unlock = function() {
            WebAudioSound._unlocked || (WebAudioSound._playEmptySound(), "running" == WebAudioSound.ctx.state && (Browser.document.removeEventListener("mousedown", WebAudioSound._unlock, !0), 
            Browser.document.removeEventListener("touchend", WebAudioSound._unlock, !0), Browser.document.removeEventListener("touchstart", WebAudioSound._unlock, !0), 
            WebAudioSound._unlocked = !0));
        }, WebAudioSound.initWebAudio = function() {
            "running" != WebAudioSound.ctx.state && (WebAudioSound._unlock(), Browser.document.addEventListener("mousedown", WebAudioSound._unlock, !0), 
            Browser.document.addEventListener("touchend", WebAudioSound._unlock, !0), Browser.document.addEventListener("touchstart", WebAudioSound._unlock, !0));
        }, WebAudioSound._emptySource = null, WebAudioSound._dataCache = {}, WebAudioSound.buffs = [], 
        WebAudioSound.isDecoding = !1, WebAudioSound._unlocked = !1, WebAudioSound.tInfo = null, 
        WebAudioSound.__loadingSound = {}, __static(WebAudioSound, [ "window", function() {
            return this.window = Browser.window;
        }, "webAudioEnabled", function() {
            return this.webAudioEnabled = WebAudioSound.window.AudioContext || WebAudioSound.window.webkitAudioContext || WebAudioSound.window.mozAudioContext;
        }, "ctx", function() {
            return this.ctx = WebAudioSound.webAudioEnabled ? new (WebAudioSound.window.AudioContext || WebAudioSound.window.webkitAudioContext || WebAudioSound.window.mozAudioContext)() : void 0;
        }, "_miniBuffer", function() {
            return this._miniBuffer = WebAudioSound.ctx.createBuffer(1, 1, 22050);
        }, "e", function() {
            return this.e = new EventDispatcher();
        } ]), WebAudioSound;
    }(), HttpRequest = function(_super) {
        function HttpRequest() {
            this._responseType = null, this._data = null, HttpRequest.__super.call(this), this._http = new Browser.window.XMLHttpRequest();
        }
        __class(HttpRequest, "laya.net.HttpRequest", EventDispatcher);
        var __proto = HttpRequest.prototype;
        return __proto.send = function(url, data, method, responseType, headers) {
            void 0 === method && (method = "get"), void 0 === responseType && (responseType = "text"), 
            this._responseType = responseType, this._data = null;
            var _this = this, http = this._http;
            if (http.open(method, url, !0), headers) for (var i = 0; i < headers.length; i++) http.setRequestHeader(headers[i++], headers[i]); else Render.isConchApp || (data && "string" != typeof data ? http.setRequestHeader("Content-Type", "application/json") : http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"));
            http.responseType = "arraybuffer" !== responseType ? "text" : "arraybuffer", http.onerror = function(e) {
                _this._onError(e);
            }, http.onabort = function(e) {
                _this._onAbort(e);
            }, http.onprogress = function(e) {
                _this._onProgress(e);
            }, http.onload = function(e) {
                _this._onLoad(e);
            }, http.send(data);
        }, __proto._onProgress = function(e) {
            e && e.lengthComputable && this.event("progress", e.loaded / e.total);
        }, __proto._onAbort = function(e) {
            this.error("Request was aborted by user");
        }, __proto._onError = function(e) {
            this.error("Request failed Status:" + this._http.status + " text:" + this._http.statusText);
        }, __proto._onLoad = function(e) {
            var http = this._http, status = void 0 !== http.status ? http.status : 200;
            200 === status || 204 === status || 0 === status ? this.complete() : this.error("[" + http.status + "]" + http.statusText + ":" + http.responseURL);
        }, __proto.error = function(message) {
            this.clear(), this.event("error", message);
        }, __proto.complete = function() {
            this.clear();
            var flag = !0;
            try {
                "json" === this._responseType ? this._data = JSON.parse(this._http.responseText) : "xml" === this._responseType ? this._data = Utils.parseXMLFromString(this._http.responseText) : this._data = this._http.response || this._http.responseText;
            } catch (e) {
                e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                flag = !1, this.error(e.message);
            }
            flag && this.event("complete", this._data instanceof Array ? [ this._data ] : this._data);
        }, __proto.clear = function() {
            var http = this._http;
            http.onerror = http.onabort = http.onprogress = http.onload = null;
        }, __getset(0, __proto, "url", function() {
            return this._http.responseURL;
        }), __getset(0, __proto, "http", function() {
            return this._http;
        }), __getset(0, __proto, "data", function() {
            return this._data;
        }), HttpRequest;
    }(), Loader = function(_super) {
        function Loader() {
            this._data = null, this._class = null, this._url = null, this._type = null, this._cache = !1, 
            this._http = null, this._customParse = !1, Loader.__super.call(this), this._onImageCallback = this._loadImageComplete.bind(this), 
            this._onLoadedCallback = this._loadedComplete.bind(this), this.priority = 0, this.realTime = !1;
        }
        __class(Loader, "laya.net.Loader", EventDispatcher);
        var __proto = Loader.prototype;
        return __proto.load = function(url, type, cache, group, ignoreCache) {
            if (-1 != url.indexOf("assets/icon//")) throw new Error(url);
            if (void 0 === cache && (cache = !0), void 0 === ignoreCache && (ignoreCache = !1), 
            0 === (this._url = url).indexOf("data:image") ? this._type = type = "image" : this._type = type || (type = this.getTypeFromUrl(url)), 
            this._cache = cache, this._data = null, !ignoreCache && Loader.loadedMap[url]) return this._data = Loader.loadedMap[url], 
            this.event("progress", 1), void this.event("complete", this._data);
            if (group && Loader.setGroup(url, group), null != Loader.parserMap[type]) return this._customParse = !0, 
            void (Loader.parserMap[type] instanceof laya.utils.Handler ? Loader.parserMap[type].runWith(this) : Loader.parserMap[type].call(null, this));
            if ("image" === type || "htmlimage" === type || "nativeimage" === type) return this._loadImage(url);
            if ("ttf" === type) return this._loadTTF(url);
            switch (type) {
              case "atlas":
              case "plf":
                "json";
                break;

              case "font":
                "xml";
                break;

              case "pkm":
                "arraybuffer";
                break;

              default:
                type;
            }
            var preData = Loader.preLoadedMap[url];
            preData ? ("atlas" == type && preData instanceof Uint8Array && (preData = msgpack.decode(preData)), 
            this.onLoaded(preData)) : base.assets.ResourcePool.instance.load(url, this._onLoadedCallback, this.priority, this.realTime);
        }, __proto.getTypeFromUrl = function(url) {
            var type = Utils.getFileExtension(url);
            return type ? Loader.typeMap[type] : (console.warn("Not recognize the resources suffix", url), 
            "text");
        }, __proto._loadTTF = function(url) {
            url = URL.formatURL(url);
            var ttfLoader = new TTFLoader();
            ttfLoader.complete = Handler.create(this, this.onLoaded), ttfLoader.load(url);
        }, __proto._loadImage = function(url) {
            base.assets.ResourcePool.instance.load(url, this._onImageCallback, 0, !0);
        }, __proto._loadImageComplete = function(url, handle, res) {
            if (null != res) if (res instanceof ArrayBuffer) {
                var view = new DataView(res), image = new laya.webgl.resource.WebGLImage(new Uint8Array(res, 8), url, 0, !1, view.getUint32(0), view.getUint32(4));
                this.onLoaded(image);
            } else {
                var isJpg = 0 === url.indexOf("data:image") ? 0 === url.indexOf("data:image/jpg") : -1 != url.toLowerCase().indexOf(".jpg");
                image = new laya.webgl.resource.WebGLImage(res, url, isJpg ? 6407 : 6408, !1, res.width, res.height);
                this.onLoaded(image);
            } else this.event("error", "Load image failed");
        }, __proto._loadSound = function(url) {
            var sound = new SoundManager._soundClass(), _this = this;
            function clear() {
                sound.offAll();
            }
            sound.on("complete", this, function() {
                clear(), _this.onLoaded(sound);
            }), sound.on("error", this, function() {
                clear(), sound.dispose(), _this.event("error", "Load sound failed");
            }), sound.load(url);
        }, __proto.onProgress = function(value) {
            "atlas" === this._type ? this.event("progress", .3 * value) : this.event("progress", value);
        }, __proto.onError = function(message) {
            this.event("error", message);
        }, __proto._loadedComplete = function(url, handle, res) {
            if (null != res) switch (this._type) {
              case "atlas":
              case "plf":
              case "json":
                var bytes = new Byte(res);
                this.onLoaded(JSON.parse(bytes.readUTFBytes()));
                break;

              case "font":
                bytes = new Byte(res);
                this.onLoaded(Utils.parseXMLFromString(bytes.readUTFBytes()));
                break;

              default:
                this.onLoaded(res);
            } else this.event("error", url);
        }, __proto.onLoaded = function(data) {
            var type = this._type;
            if ("plf" == type) this.parsePLFData(data), this.complete(data); else if ("image" === type) {
                var tex = new Texture(data);
                tex.url = this._url, this.complete(tex);
            } else if ("sound" === type || "htmlimage" === type || "nativeimage" === type) this.complete(data); else if ("atlas" === type) {
                if (!data.src && !data._setContext) {
                    if (!this._data) {
                        if ((this._data = data).meta && data.meta.image) for (var toloadPics = data.meta.image.split(","), split = 0 <= this._url.indexOf("/") ? "/" : "\\", idx = this._url.lastIndexOf(split), folderPath = 0 <= idx ? this._url.substr(0, idx + 1) : "", i = 0, len = toloadPics.length; i < len; i++) toloadPics[i] = folderPath + toloadPics[i]; else toloadPics = [ this._url.replace(".json", ".png") ];
                        toloadPics.reverse(), data.toLoads = toloadPics, data.pics = [];
                    }
                    return this.event("progress", .3 + 1 / toloadPics.length * .6), this._loadImage(toloadPics.pop());
                }
                if (!this._data.pics) throw new Error("this._data.pics == null, " + this._url);
                if (this._data.pics.push(data), 0 < this._data.toLoads.length) return this.event("progress", .3 + 1 / this._data.toLoads.length * .6), 
                this._loadImage(this._data.toLoads.pop());
                var frames = this._data.frames, cleanUrl = this._url.split("?")[0], directory = this._data.meta && this._data.meta.prefix ? this._data.meta.prefix : cleanUrl.substring(0, cleanUrl.lastIndexOf(".")) + "/", pics = this._data.pics, atlasURL = URL.formatURL(this._url), map = Loader.atlasMap[atlasURL] || (Loader.atlasMap[atlasURL] = []);
                map.dir = directory;
                var scaleRate = 1;
                if (this._data.meta && this._data.meta.scale && 1 != this._data.meta.scale) for (var name in scaleRate = parseFloat(this._data.meta.scale), 
                frames) {
                    var tTexture, obj = frames[name], tPic = pics[obj.frame.idx ? obj.frame.idx : 0], url = URL.formatURL(directory + name);
                    tPic.scaleRate = scaleRate, tTexture = Texture.create(tPic, obj.frame.x, obj.frame.y, obj.frame.w, obj.frame.h, obj.spriteSourceSize.x, obj.spriteSourceSize.y, obj.sourceSize.w, obj.sourceSize.h), 
                    Loader.cacheRes(url, tTexture), Loader.keepCache(this._url, directory + name), tTexture.url = url, 
                    map.push(url);
                } else for (name in frames) tPic = pics[(obj = frames[name]).frame.idx ? obj.frame.idx : 0], 
                url = URL.formatURL(directory + name), Loader.cacheRes(url, Texture.create(tPic, obj.frame.x, obj.frame.y, obj.frame.w, obj.frame.h, obj.spriteSourceSize.x, obj.spriteSourceSize.y, obj.sourceSize.w, obj.sourceSize.h)), 
                Loader.loadedMap[url].url = url, Loader.keepCache(this._url, directory + name), 
                map.push(url);
                delete this._data.pics, this.complete(this._data);
            } else if ("font" == type) {
                if (!data.src) return this._data = data, this.event("progress", .5), this._loadImage(this._url.replace(".fnt", ".png"));
                var bFont = new BitmapFont();
                bFont.parseFont(this._data, data);
                var tArr = this._url.split(".fnt")[0].split("/"), fontName = tArr[tArr.length - 1];
                Text.registerBitmapFont(fontName, bFont), this._data = bFont, this.complete(this._data);
            } else if ("pkm" == type) {
                var image = HTMLImage.create(data, this._url), tex1 = new Texture(image);
                tex1.url = this._url, this.complete(tex1);
            } else this.complete(data);
        }, __proto.parsePLFData = function(plfData) {
            var type, filePath, fileDic;
            for (type in plfData) switch (fileDic = plfData[type], type) {
              case "json":
              case "text":
                for (filePath in fileDic) Loader.preLoadedMap[URL.formatURL(filePath)] = fileDic[filePath];
                break;

              default:
                for (filePath in fileDic) Loader.preLoadedMap[URL.formatURL(filePath)] = fileDic[filePath];
            }
        }, __proto.complete = function(data) {
            this._data = data, this._customParse ? this.event("loaded", data instanceof Array ? [ data ] : data) : (Loader._loaders.push(this), 
            Loader._isWorking || Loader.checkNext());
        }, __proto.endLoad = function(content) {
            content && (this._data = content), this._cache && Loader.cacheRes(this._url, this._data), 
            this.event("progress", 1), this.event("complete", this.data instanceof Array ? [ this.data ] : this.data);
        }, __getset(0, __proto, "url", function() {
            return this._url;
        }), __getset(0, __proto, "data", function() {
            return this._data;
        }), __getset(0, __proto, "cache", function() {
            return this._cache;
        }), __getset(0, __proto, "type", function() {
            return this._type;
        }), Loader.checkNext = function() {
            Loader._isWorking = !0;
            for (var startTimer = Browser.now(); Loader._startIndex < Loader._loaders.length; ) if (Browser.now(), 
            Loader._loaders[Loader._startIndex].endLoad(), Loader._startIndex++, Browser.now() - startTimer > Loader.maxTimeOut) return console.warn("loader callback cost a long time:" + (Browser.now() - startTimer) + " url=" + Loader._loaders[Loader._startIndex - 1].url), 
            void Laya.timer.frameOnce(1, null, Loader.checkNext);
            Loader._loaders.length = 0, Loader._startIndex = 0, Loader._isWorking = !1;
        }, Loader.clearRes = function(url, forceDispose) {
            if (null != url) {
                void 0 === forceDispose && (forceDispose = !1), url = URL.formatURL(url);
                var arr = Loader.getAtlas(url);
                if (arr) {
                    for (var i = 0, n = arr.length; i < n; i++) {
                        var resUrl = arr[i], tex = Loader.getRes(resUrl);
                        delete Loader.loadedMap[resUrl], Loader.clearCache(url.substring(URL.basePath.length), resUrl.substring(URL.basePath.length)), 
                        tex && tex.destroy(forceDispose);
                    }
                    arr.length = 0, delete Loader.atlasMap[url], delete Loader.loadedMap[url];
                } else {
                    var res = Loader.loadedMap[url];
                    res && (delete Loader.loadedMap[url], res instanceof laya.resource.Texture && res.bitmap && res.destroy(forceDispose));
                }
            }
        }, Loader.clearTextureRes = function(url) {
            url = URL.formatURL(url);
            var arr = laya.net.Loader.getAtlas(url), res = arr && 0 < arr.length ? laya.net.Loader.getRes(arr[0]) : laya.net.Loader.getRes(url);
            res && res.bitmap && (Render.isConchApp && !Render.isConchWebGL ? res.bitmap.source.releaseTexture && res.bitmap.source.releaseTexture() : null == res.bitmap._atlaser && res.bitmap.releaseResource(!0));
        }, Loader.getRes = function(url) {
            return Loader.loadedMap[URL.formatURL(url)];
        }, Loader.getAtlas = function(url) {
            return Loader.atlasMap[URL.formatURL(url)];
        }, Loader.cacheRes = function(url, data) {
            url = URL.formatURL(url), null != Loader.loadedMap[url] ? console.warn("Resources already exist,is repeated loading:", url) : Loader.loadedMap[url] = data;
        }, Loader.setGroup = function(url, group) {
            Loader.groupMap[group] || (Loader.groupMap[group] = []), Loader.groupMap[group].push(url);
        }, Loader.clearResByGroup = function(group) {
            if (Loader.groupMap[group]) {
                var arr = Loader.groupMap[group], i = 0, len = arr.length;
                for (i = 0; i < len; i++) Loader.clearRes(arr[i]);
                arr.length = 0;
            }
        }, Loader.keepCache = function(obj, url) {
            if (obj && url) {
                var cache = Loader.cacheSet[url];
                cache ? -1 == cache.indexOf(obj) && cache.push(obj) : Loader.cacheSet[url] = [ obj ];
            }
        }, Loader.clearCache = function(obj, url) {
            if (obj && url) {
                var cache = Loader.cacheSet[url];
                if (cache) {
                    var j = cache.indexOf(obj);
                    if (-1 !== j) {
                        var last = cache.length - 1;
                        0 == last ? (delete Loader.cacheSet[url], Loader.clearRes(url, !0)) : (cache[j] = cache[last], 
                        cache.length = last);
                    }
                }
            }
        }, Loader.saveObject = function(url, value, recover) {
            if (value && url) {
                var args = Loader.objectSet[url];
                args ? (console.warn("Loader.saveObject: " + url), args[0] = value, args[1] = recover) : Loader.objectSet[url] = [ value, recover, [] ];
            }
        }, Loader.findObject = function(url) {
            if (url) {
                var args = Loader.objectSet[url];
                if (args) return args[0];
            }
            return null;
        }, Loader.keepObject = function(obj, url) {
            if (obj && url) {
                var args = Loader.objectSet[url];
                args && -1 === args[2].indexOf(obj) && args[2].push(obj);
            }
        }, Loader.clearObject = function(obj, url) {
            if (obj && url) {
                var args = Loader.objectSet[url];
                if (args) {
                    var array = args[2], j = array.indexOf(obj);
                    if (-1 !== j) {
                        var last = array.length - 1;
                        0 == last ? (delete Loader.objectSet[url], args[1] && args[1].call(null, args[0])) : (array[j] = array[last], 
                        array.length = last);
                    }
                }
            }
        }, Loader.TEXT = "text", Loader.JSON = "json", Loader.XML = "xml", Loader.BUFFER = "arraybuffer", 
        Loader.IMAGE = "image", Loader.SOUND = "sound", Loader.ATLAS = "atlas", Loader.FONT = "font", 
        Loader.TTF = "ttf", Loader.PLF = "plf", Loader.PKM = "pkm", Loader.typeMap = {
            png: "image",
            jpg: "image",
            jpeg: "image",
            txt: "text",
            json: "json",
            xml: "xml",
            als: "atlas",
            atlas: "atlas",
            mp3: "sound",
            ogg: "sound",
            wav: "sound",
            part: "json",
            fnt: "font",
            pkm: "pkm",
            ttf: "ttf",
            plf: "plf"
        }, Loader.parserMap = {}, Loader.groupMap = {}, Loader.maxTimeOut = 100, Loader.loadedMap = {}, 
        Loader.preLoadedMap = {}, Loader.atlasMap = {}, Loader._loaders = [], Loader._isWorking = !1, 
        Loader._startIndex = 0, Loader.imgCache = {}, Loader.cacheSet = {}, Loader.objectSet = {}, 
        Loader;
    }(), LoaderManager = function(_super) {
        var ResInfo;
        function LoaderManager() {
            this.retryNum = 1, this.retryDelay = 0, this.maxLoader = 5, this._loaders = [], 
            this._loaderCount = 0, this._resInfos = [], this._infoPool = [], this._maxPriority = 5, 
            this._failRes = {}, LoaderManager.__super.call(this);
            for (var i = 0; i < this._maxPriority; i++) this._resInfos[i] = [];
        }
        __class(LoaderManager, "laya.net.LoaderManager", EventDispatcher);
        var __proto = LoaderManager.prototype;
        return __proto.create = function(url, complete, progress, clas, params, priority, cache, group) {
            if (void 0 === priority && (priority = 1), void 0 === cache && (cache = !0), url instanceof Array) {
                var items = url, itemCount = items.length, loadedCount = 0;
                if (progress) var progress2 = Handler.create(progress.caller, progress.method, progress.args, !1);
                for (var i = 0; i < itemCount; i++) {
                    var item = items[i];
                    "string" == typeof item && (item = items[i] = {
                        url: item
                    }), item.progress = 0;
                }
                for (i = 0; i < itemCount; i++) {
                    item = items[i];
                    var progressHandler = progress ? Handler.create(null, onProgress, [ item ], !1) : null, completeHandler = progress || complete ? Handler.create(null, onComplete, [ item ]) : null;
                    this._create(item.url, completeHandler, progressHandler, item.clas || clas, item.params || params, item.priority || priority, cache, item.group || group);
                }
                function onComplete(item, content) {
                    loadedCount++, item.progress = 1, loadedCount === itemCount && complete && complete.run();
                }
                function onProgress(item, value) {
                    item.progress = value;
                    for (var num = 0, j = 0; j < itemCount; j++) {
                        num += items[j].progress;
                    }
                    var v = num / itemCount;
                    progress2.runWith(v);
                }
                return !0;
            }
            return this._create(url, complete, progress, clas, params, priority, cache, group);
        }, __proto._create = function(url, complete, progress, clas, params, priority, cache, group) {
            void 0 === priority && (priority = 1), void 0 === cache && (cache = !0);
            var formarUrl = URL.formatURL(url), item = this.getRes(formarUrl);
            if (item) !item.hasOwnProperty("loaded") || item.loaded ? (progress && progress.runWith(1), 
            complete && complete.run()) : complete && Laya.loader._createListener(url, complete.caller, complete.method, complete.args, !0, !1); else {
                var extension = Utils.getFileExtension(url), creatItem = LoaderManager.createMap[extension];
                if (!creatItem) throw new Error("LoaderManager:unknown file(" + url + ") extension with: " + extension + ".");
                clas || (clas = creatItem[0]);
                var type = creatItem[1];
                if ("atlas" == extension) this.load(url, complete, progress, type, priority, cache); else {
                    if (clas === Texture && (type = "htmlimage"), (item = clas ? new clas() : null).hasOwnProperty("_loaded") && (item._loaded = !1), 
                    item._setUrl(url), group && item._setGroup(group), this._createLoad(item, url, Handler.create(null, function(data) {
                        item && !item.destroyed && data && item.onAsynLoaded.call(item, url, data, params), 
                        complete && complete.run();
                        Laya.loader.event(url);
                    }), progress, type, priority, !1, group, !0), -1 != url.indexOf("assets/icon//")) throw new Error(url);
                    cache && this.cacheRes(formarUrl, item);
                }
            }
            return item;
        }, __proto.load = function(url, complete, progress, type, priority, cache, group, ignoreCache) {
            var _$this = this;
            if (void 0 === priority && (priority = 1), void 0 === cache && (cache = !0), void 0 === ignoreCache && (ignoreCache = !1), 
            url instanceof Array) return this._loadAssets(url, complete, progress, type, priority, cache, group);
            var content = Loader.getRes(url);
            if (null != content) Laya.timer.frameOnce(1, null, function() {
                progress && progress.runWith(1), complete && complete.runWith(content), _$this._loaderCount || _$this.event("complete");
            }); else {
                var info = LoaderManager._resMap[url];
                info ? (complete && info._createListener("complete", complete.caller, complete.method, complete.args, !1, !1), 
                progress && info._createListener("progress", progress.caller, progress.method, progress.args, !1, !1)) : ((info = this._infoPool.length ? this._infoPool.pop() : new ResInfo()).url = url, 
                info.type = type, info.cache = cache, info.group = group, info.ignoreCache = ignoreCache, 
                info.priority = priority, complete && info.on("complete", complete.caller, complete.method, complete.args), 
                progress && info.on("progress", progress.caller, progress.method, progress.args), 
                LoaderManager._resMap[url] = info, priority = priority < this._maxPriority ? priority : this._maxPriority - 1, 
                this._resInfos[priority].push(info), this._next());
            }
            return this;
        }, __proto._createLoad = function(item, url, complete, progress, type, priority, cache, group, ignoreCache) {
            var _$this = this;
            if (void 0 === priority && (priority = 1), void 0 === cache && (cache = !0), void 0 === ignoreCache && (ignoreCache = !1), 
            url instanceof Array) return this._loadAssets(url, complete, progress, type, priority, cache, group);
            var content = Loader.getRes(url);
            if (null != content) Laya.timer.frameOnce(1, null, function() {
                progress && progress.runWith(1), complete && complete.runWith(content), _$this._loaderCount || _$this.event("complete");
            }); else {
                var info = LoaderManager._resMap[url];
                info ? (complete && info._createListener("complete", complete.caller, complete.method, complete.args, !1, !1), 
                progress && info._createListener("progress", progress.caller, progress.method, progress.args, !1, !1)) : ((info = this._infoPool.length ? this._infoPool.pop() : new ResInfo()).url = url, 
                info.clas = item, info.type = type, info.cache = cache, info.group = group, info.ignoreCache = ignoreCache, 
                info.priority = priority, complete && info.on("complete", complete.caller, complete.method, complete.args), 
                progress && info.on("progress", progress.caller, progress.method, progress.args), 
                LoaderManager._resMap[url] = info, priority = priority < this._maxPriority ? priority : this._maxPriority - 1, 
                this._resInfos[priority].push(info), this._next());
            }
            return this;
        }, __proto._next = function() {
            if (!(this._loaderCount >= this.maxLoader)) {
                for (var i = 0; i < this._maxPriority; i++) for (var infos = this._resInfos[i]; 0 < infos.length; ) {
                    var info = infos.shift();
                    if (info) return this._doLoad(info);
                }
                this._loaderCount || this.event("complete");
            }
        }, __proto._doLoad = function(resInfo) {
            this._loaderCount++;
            var loader = this._loaders.length ? this._loaders.pop() : new Loader();
            loader.on("complete", null, onLoaded), loader.on("progress", null, function(num) {
                resInfo.event("progress", num);
            }), loader.on("error", null, function(msg) {
                onLoaded(null);
            });
            var _this = this;
            function onLoaded(data) {
                loader.offAll(), loader._data = null, loader._customParse = !1, _this._loaders.push(loader), 
                _this._endLoad(resInfo, data instanceof Array ? [ data ] : data), _this._loaderCount--, 
                _this._next();
            }
            loader._class = resInfo.clas, 1 < resInfo.priority ? (loader.priority = 1800 * resInfo.priority, 
            loader.realTime = !1) : (loader.priority = 0, loader.realTime = !0), loader.load(resInfo.url, resInfo.type, resInfo.cache, resInfo.group, resInfo.ignoreCache);
        }, __proto._endLoad = function(resInfo, content) {
            var url = resInfo.url;
            if (null == content) {
                var errorCount = this._failRes[url] || 0;
                if (errorCount < this.retryNum) return console.warn("[warn]Retry to load:", url), 
                this._failRes[url] = errorCount + 1, void Laya.timer.once(this.retryDelay, this, this._addReTry, [ resInfo ], !1);
                console.warn("[error]Failed to load:", url), this.event("error", url);
            }
            this._failRes[url] && (this._failRes[url] = 0), delete LoaderManager._resMap[url], 
            resInfo.event("complete", content), resInfo.offAll(), this._infoPool.push(resInfo);
        }, __proto._addReTry = function(resInfo) {
            this._resInfos[this._maxPriority - 1].push(resInfo), this._next();
        }, __proto.clearRes = function(url, forceDispose) {
            void 0 === forceDispose && (forceDispose = !1), Loader.clearRes(url, forceDispose);
        }, __proto.getRes = function(url) {
            return Loader.getRes(url);
        }, __proto.cacheRes = function(url, data) {
            Loader.cacheRes(url, data);
        }, __proto.clearTextureRes = function(url) {
            Loader.clearTextureRes(url);
        }, __proto.setGroup = function(url, group) {
            Loader.setGroup(url, group);
        }, __proto.clearResByGroup = function(group) {
            Loader.clearResByGroup(group);
        }, __proto.clearUnLoaded = function() {
            for (var i = 0; i < this._maxPriority; i++) {
                for (var infos = this._resInfos[i], j = infos.length - 1; -1 < j; j--) {
                    var info = infos[j];
                    info && (info.offAll(), this._infoPool.push(info));
                }
                infos.length = 0;
            }
            this._loaderCount = 0, LoaderManager._resMap = {};
        }, __proto.cancelLoadByUrls = function(urls) {
            if (urls) for (var i = 0, n = urls.length; i < n; i++) this.cancelLoadByUrl(urls[i]);
        }, __proto.cancelLoadByUrl = function(url, complete) {
            for (var i = 0; i < this._maxPriority; i++) for (var infos = this._resInfos[i], j = infos.length - 1; -1 < j; j--) {
                var info = infos[j];
                if (info && info.url === url) {
                    complete && info.off("complete", complete.caller, complete.method), complete && info.hasListener("complete") || (infos[j] = null, 
                    info.offAll(), this._infoPool.push(info), delete LoaderManager._resMap[url]);
                    break;
                }
            }
        }, __proto._loadAssets = function(arr, complete, progress, type, priority, cache, group) {
            void 0 === priority && (priority = 1), void 0 === cache && (cache = !0);
            for (var itemCount = arr.length, loadedCount = 0, totalSize = 0, items = [], success = !0, i = 0; i < itemCount; i++) {
                var item = arr[i];
                "string" == typeof item && (item = {
                    url: item,
                    type: type,
                    size: 1,
                    priority: priority
                }), item.size || (item.size = 1), item.progress = 0, totalSize += item.size, items.push(item);
                var progressHandler = progress ? Handler.create(null, loadProgress, [ item ], !1) : null, completeHandler = complete || progress ? Handler.create(null, loadComplete, [ item ]) : null;
                this.load(item.url, completeHandler, progressHandler, item.type, item.priority || 1, cache, item.group || group);
            }
            function loadComplete(item, content) {
                loadedCount++, item.progress = 1, content || (success = !1), loadedCount === itemCount && complete && complete.runWith(success);
            }
            function loadProgress(item, value) {
                if (null != progress) {
                    item.progress = value;
                    for (var num = 0, j = 0; j < items.length; j++) {
                        var item1 = items[j];
                        num += item1.size * item1.progress;
                    }
                    var v = num / totalSize;
                    progress.runWith(v);
                }
            }
            return this;
        }, LoaderManager.cacheRes = function(url, data) {
            Loader.cacheRes(url, data);
        }, LoaderManager._resMap = {}, __static(LoaderManager, [ "createMap", function() {
            return this.createMap = {
                atlas: [ null, "atlas" ]
            };
        } ]), LoaderManager.__init$ = function() {
            ResInfo = function(_super) {
                function ResInfo() {
                    this.url = null, this.type = null, this.cache = !1, this.group = null, this.ignoreCache = !1, 
                    this.clas = null, this.priority = 0, ResInfo.__super.call(this);
                }
                return __class(ResInfo, "", EventDispatcher), ResInfo;
            }();
        }, LoaderManager;
    }(), Resource = (function(_super) {
        function ColorFilter(mat) {
            ColorFilter.__super.call(this), mat || (mat = [ .3, .59, .11, 0, 0, .3, .59, .11, 0, 0, .3, .59, .11, 0, 0, 0, 0, 0, 1, 0 ]), 
            this._mat = new Float32Array(16), this._alpha = new Float32Array(4);
            for (var j = 0, z = 0, i = 0; i < 20; i++) i % 5 != 4 ? this._mat[j++] = mat[i] : this._alpha[z++] = mat[i];
            this._action = RunDriver.createFilterAction(32), this._action.data = this;
        }
        __class(ColorFilter, "laya.filters.ColorFilter", Filter);
        var __proto = ColorFilter.prototype;
        Laya.imps(__proto, {
            "laya.filters.IFilter": !0
        }), __proto.callNative = function(sp) {
            sp._$P.cf = this;
            sp.conchModel && sp.conchModel.setFilterMatrix && sp.conchModel.setFilterMatrix(this._mat, this._alpha);
        }, __getset(0, __proto, "type", function() {
            return 32;
        }), __getset(0, __proto, "action", function() {
            return this._action;
        });
    }(), function(_super) {
        function Socket(host, port, byteClass) {
            this._endian = null, this._stamp = NaN, this._socket = null, this._connected = !1, 
            this._addInputPosition = 0, this._input = null, this._output = null, this.timeout = 0, 
            this.objectEncoding = 0, this.disableInput = !1, this._byteClass = null, this.protocols = [], 
            void 0 === port && (port = 0), Socket.__super.call(this), this._byteClass = byteClass || Byte, 
            this.endian = "bigEndian", this.timeout = 2e4, this._addInputPosition = 0, host && 0 < port && port < 65535 && this.connect(host, port);
        }
        __class(Socket, "laya.net.Socket", EventDispatcher);
        var __proto = Socket.prototype;
        __proto.connect = function(host, port) {
            var url = "ws://" + host + ":" + port;
            url = "https:" == Browser.window.location.protocol ? "wss://" + host + ":" + port : "ws://" + host + ":" + port, 
            this.connectByUrl(url);
        }, __proto.connectByUrl = function(url) {
            var _$this = this;
            null != this._socket && this.close(), this._socket && this.cleanSocket(), this.protocols && 0 != this.protocols.length ? this._socket = new Browser.window.WebSocket(url, this.protocols) : this._socket = new Browser.window.WebSocket(url), 
            this._socket.binaryType = "arraybuffer", this._output = new this._byteClass(), this._output.endian = this.endian, 
            this._input = new this._byteClass(), this._input.endian = this.endian, this._addInputPosition = 0, 
            this._socket.onopen = function(e) {
                _$this._onOpen(e);
            }, this._socket.onmessage = function(msg) {
                _$this._onMessage(msg);
            }, this._socket.onclose = function(e) {
                _$this._onClose(e);
            }, this._socket.onerror = function(e) {
                _$this._onError(e);
            };
        }, __proto.cleanSocket = function() {
            try {
                this._socket.close();
            } catch (e) {}
            this._connected = !1, this._socket.onopen = null, this._socket.onmessage = null, 
            this._socket.onclose = null, this._socket.onerror = null, this._socket = null;
        }, __proto.close = function() {
            if (null != this._socket) try {
                this._socket.close();
            } catch (e) {}
        }, __proto._onOpen = function(e) {
            this._connected = !0, this.event("open", e);
        }, __proto._onMessage = function(msg) {
            if (msg && msg.data) {
                var data = msg.data;
                if (this.disableInput && data) this.event("message", data); else {
                    0 < this._input.length && this._input.bytesAvailable < 1 && (this._input.clear(), 
                    this._addInputPosition = 0);
                    var pre = this._input.pos;
                    !this._addInputPosition && (this._addInputPosition = 0), this._input.pos = this._addInputPosition, 
                    data && ("string" == typeof data ? this._input.writeUTFBytes(data) : this._input.writeArrayBuffer(data), 
                    this._addInputPosition = this._input.pos, this._input.pos = pre), this.event("message", data);
                }
            }
        }, __proto._onClose = function(e) {
            this._connected = !1, this.event("close", e);
        }, __proto._onError = function(e) {
            this.event("error", e);
        }, __proto.send = function(data) {
            this._socket.send(data);
        }, __proto.flush = function() {
            if (this._output && 0 < this._output.length) {
                var evt;
                try {
                    this._socket && this._socket.send(this._output.__getBuffer().slice(0, this._output.length));
                } catch (e) {
                    e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                    evt = e;
                }
                this._output.endian = this.endian, this._output.clear(), evt && this.event("error", evt);
            }
        }, __getset(0, __proto, "input", function() {
            return this._input;
        }), __getset(0, __proto, "output", function() {
            return this._output;
        }), __getset(0, __proto, "connected", function() {
            return this._connected;
        }), __getset(0, __proto, "endian", function() {
            return this._endian;
        }, function(value) {
            this._endian = value, null != this._input && (this._input.endian = value), null != this._output && (this._output.endian = value);
        }), Socket.LITTLE_ENDIAN = "littleEndian", Socket.BIG_ENDIAN = "bigEndian";
    }(), function(_super) {
        function Resource() {
            Resource.__super.call(this), this._$1__id = ++Resource._uniqueIDCounter, this.__loaded = !0, 
            this._destroyed = !1, this._referenceCount = 0, (Resource._idResourcesMap[this.id] = this)._released = !0, 
            this.lock = !1, this._memorySize = 0, this._lastUseFrameCount = -1, ResourceManager.currentResourceManager && ResourceManager.currentResourceManager.addResource(this);
        }
        __class(Resource, "laya.resource.Resource", EventDispatcher);
        var __proto = Resource.prototype;
        return Laya.imps(__proto, {
            "laya.resource.ICreateResource": !0,
            "laya.resource.IDispose": !0
        }), __proto._setUrl = function(url) {
            var resList;
            this._url !== url && (this._url && ((resList = Resource._urlResourcesMap[this._url]).splice(resList.indexOf(this), 1), 
            0 === resList.length && delete Resource._urlResourcesMap[this._url]), url && ((resList = Resource._urlResourcesMap[url]) || (Resource._urlResourcesMap[url] = resList = []), 
            resList.push(this)), this._url = url);
        }, __proto._getGroup = function() {
            return this._group;
        }, __proto._setGroup = function(value) {
            var groupList;
            this._group !== value && (this._group && ((groupList = Resource._groupResourcesMap[this._group]).splice(groupList.indexOf(this), 1), 
            0 === groupList.length && delete Resource._groupResourcesMap[this._group]), value && ((groupList = Resource._groupResourcesMap[value]) || (Resource._groupResourcesMap[value] = groupList = []), 
            groupList.push(this)), this._group = value);
        }, __proto._addReference = function() {
            this._referenceCount++;
        }, __proto._removeReference = function() {
            this._referenceCount--;
        }, __proto._clearReference = function() {
            this._referenceCount = 0;
        }, __proto._endLoaded = function() {
            this.__loaded = !0, this.event("loaded", this);
        }, __proto.recreateResource = function() {
            this.completeCreate();
        }, __proto.disposeResource = function() {}, __proto.activeResource = function(force) {
            void 0 === force && (force = !1), this._lastUseFrameCount = Stat.loopCount, !this._destroyed && this.__loaded && (this._released || force) && this.recreateResource();
        }, __proto.releaseResource = function(force) {
            return void 0 === force && (force = !0), !(!force && this.lock) && (!(this._released && !force) && (this.disposeResource(), 
            this._released = !0, this._lastUseFrameCount = -1, this.event("released", this), 
            !0));
        }, __proto.onAsynLoaded = function(url, data, params) {
            throw new Error("Resource: must override this function!");
        }, __proto.destroy = function() {
            var resList;
            this._destroyed || (null !== this._resourceManager && this._resourceManager.removeResource(this), 
            this._destroyed = !0, this.lock = !1, this.releaseResource(), delete Resource._idResourcesMap[this.id], 
            this._url && ((resList = Resource._urlResourcesMap[this._url]) && (resList.splice(resList.indexOf(this), 1), 
            0 === resList.length && delete Resource._urlResourcesMap[this.url]), Loader.clearRes(this._url), 
            this.__loaded || RunDriver.cancelLoadByUrl(this._url)), this._group && ((resList = Resource._groupResourcesMap[this._group]).splice(resList.indexOf(this), 1), 
            0 === resList.length && delete Resource._groupResourcesMap[this.url]));
        }, __proto.completeCreate = function() {
            this._released = !1, this.event("recovered", this);
        }, __proto.dispose = function() {
            this.destroy();
        }, __getset(0, __proto, "memorySize", function() {
            return this._memorySize;
        }, function(value) {
            var offsetValue = value - this._memorySize;
            this._memorySize = value, this.resourceManager && this.resourceManager.addSize(offsetValue);
        }), __getset(0, __proto, "_loaded", null, function(value) {
            this.__loaded = value;
        }), __getset(0, __proto, "loaded", function() {
            return this.__loaded;
        }), __getset(0, __proto, "id", function() {
            return this._$1__id;
        }), __getset(0, __proto, "destroyed", function() {
            return this._destroyed;
        }), __getset(0, __proto, "group", function() {
            return this._getGroup();
        }, function(value) {
            this._setGroup(value);
        }), __getset(0, __proto, "resourceManager", function() {
            return this._resourceManager;
        }), __getset(0, __proto, "url", function() {
            return this._url;
        }), __getset(0, __proto, "released", function() {
            return this._released;
        }), __getset(0, __proto, "referenceCount", function() {
            return this._referenceCount;
        }), Resource.getResourceByID = function(id) {
            return Resource._idResourcesMap[id];
        }, Resource.getResourceByURL = function(url, index) {
            return void 0 === index && (index = 0), null == Resource._urlResourcesMap[url] ? null : Resource._urlResourcesMap[url][index];
        }, Resource.getResourceCountByURL = function(url) {
            return Resource._urlResourcesMap[url].length;
        }, Resource.destroyUnusedResources = function(group) {
            var res;
            if (group) {
                var resouList = Resource._groupResourcesMap[group];
                if (resouList) for (var tempResouList = resouList.slice(), i = 0, n = tempResouList.length; i < n; i++) (res = tempResouList[i]).lock || 0 !== res._referenceCount || res.destroy();
            } else for (var k in Resource._idResourcesMap) (res = Resource._idResourcesMap[k]).lock || 0 !== res._referenceCount || res.destroy();
        }, Resource._uniqueIDCounter = 0, Resource._idResourcesMap = {}, Resource._urlResourcesMap = {}, 
        Resource._groupResourcesMap = {}, Resource;
    }()), Texture = function(_super) {
        function Texture(bitmap, uv) {
            this.offsetX = 0, this.offsetY = 0, this.sourceWidth = 0, this.sourceHeight = 0, 
            this._w = 0, this._h = 0, this._uvID = 0, this._atlasID = -1, this.scaleRate = 1, 
            Texture.__super.call(this), bitmap && null != bitmap._addReference && bitmap._addReference(), 
            this.setTo(bitmap, uv);
        }
        __class(Texture, "laya.resource.Texture", EventDispatcher);
        var __proto = Texture.prototype;
        return __proto._setUrl = function(url) {
            this.url = url;
        }, __proto.setTo = function(bitmap, uv) {
            if (bitmap instanceof window.HTMLElement) {
                var canvas = HTMLCanvas.create("2D", bitmap);
                this.bitmap = canvas;
            } else this.bitmap = bitmap;
            if (this.uv = uv || Texture.DEF_UV, bitmap) {
                this._w = bitmap.width, this._h = bitmap.height, this.sourceWidth = this.sourceWidth || this._w, 
                this.sourceHeight = this.sourceHeight || this._h, this._loaded = 0 < this._w;
                var _this = this;
                if (this._loaded) RunDriver.addToAtlas && RunDriver.addToAtlas(_this); else {
                    var bm = bitmap;
                    bm instanceof laya.resource.HTMLImage && bm.image && bm.image.addEventListener("load", function(e) {
                        RunDriver.addToAtlas && RunDriver.addToAtlas(_this);
                    }, !1);
                }
            }
        }, __proto.active = function() {
            this.bitmap && this.bitmap.activeResource();
        }, __proto.destroy = function(forceDispose) {
            if (void 0 === forceDispose && (forceDispose = !1), this.bitmap && 0 < this.bitmap.referenceCount) {
                var temp = this.bitmap;
                forceDispose ? (Render.isConchApp && temp.source && temp.source.conchDestroy && this.bitmap.source.conchDestroy(), 
                this.bitmap = null, temp.dispose(), temp._clearReference()) : (temp._removeReference(), 
                0 == temp.referenceCount && (Render.isConchApp && temp.source && temp.source.conchDestroy && this.bitmap.source.conchDestroy(), 
                this.bitmap = null, temp.dispose())), this.url && this === Laya.loader.getRes(this.url) && Laya.loader.clearRes(this.url, forceDispose), 
                this._loaded = !1;
            }
        }, __proto.load = function(url) {
            var _$this = this;
            this._loaded = !1, url = URL.customFormat(url);
            var fileBitmap = this.bitmap || (this.bitmap = HTMLImage.create(url));
            fileBitmap && fileBitmap._addReference();
            var _this = this;
            fileBitmap.onload = function() {
                fileBitmap.onload = null, _this._loaded = !0, _$this.sourceWidth = _$this._w = fileBitmap.width, 
                _$this.sourceHeight = _$this._h = fileBitmap.height, _this.event("loaded", this), 
                RunDriver.addToAtlas && RunDriver.addToAtlas(_this);
            };
        }, __proto.addTextureToAtlas = function(e) {
            RunDriver.addTextureToAtlas(this);
        }, __proto.getPixels = function(x, y, width, height) {
            if (Render.isConchApp) {
                var temp = this.bitmap;
                if (temp.source && temp.source.getImageData) {
                    var arraybuffer = temp.source.getImageData(x, y, width, height), tUint8Array = new Uint8Array(arraybuffer);
                    return Array.from(tUint8Array);
                }
                return null;
            }
            return Render.isWebGL ? RunDriver.getTexturePixels(this, x, y, width, height) : (Browser.canvas.size(width, height), 
            Browser.canvas.clear(), Browser.context.drawTexture(this, -x, -y, this.width, this.height, 0, 0), 
            Browser.context.getImageData(0, 0, width, height).data);
        }, __proto.onAsynLoaded = function(url, bitmap) {
            if (bitmap && bitmap.bitmap && (bitmap = bitmap.bitmap), bitmap) {
                if ("function" != typeof bitmap._addReference) return;
                bitmap._addReference();
            }
            this.setTo(bitmap, this.uv), this._loaded && this.event("loaded", this);
        }, __getset(0, __proto, "source", function() {
            return this.bitmap ? (this.bitmap.activeResource(), this.bitmap.source) : null;
        }), __getset(0, __proto, "loaded", function() {
            return this._loaded;
        }), __getset(0, __proto, "released", function() {
            return !this.bitmap || this.bitmap.released;
        }), __getset(0, __proto, "width", function() {
            return this._w ? this._w : this.uv && this.uv !== Texture.DEF_UV ? (this.uv[2] - this.uv[0]) * this.bitmap.width : this.bitmap.width;
        }, function(value) {
            this._w = value, this.sourceWidth || (this.sourceWidth = value);
        }), __getset(0, __proto, "repeat", function() {
            return !Render.isWebGL || !this.bitmap || this.bitmap.repeat;
        }, function(value) {
            value && Render.isWebGL && this.bitmap && (this.bitmap.repeat = value) && (this.bitmap.enableMerageInAtlas = !1);
        }), __getset(0, __proto, "height", function() {
            return this._h ? this._h : this.uv && this.uv !== Texture.DEF_UV ? (this.uv[5] - this.uv[1]) * this.bitmap.height : this.bitmap.height;
        }, function(value) {
            this._h = value, this.sourceHeight || (this.sourceHeight = value);
        }), __getset(0, __proto, "isLinearSampling", function() {
            return !Render.isWebGL || 9728 != this.bitmap.minFifter;
        }, function(value) {
            !value && Render.isWebGL && (value || -1 != this.bitmap.minFifter || -1 != this.bitmap.magFifter || (this.bitmap.minFifter = 9728, 
            this.bitmap.magFifter = 9728, this.bitmap.enableMerageInAtlas = !1));
        }), Texture.moveUV = function(offsetX, offsetY, uv) {
            for (var i = 0; i < 8; i += 2) uv[i] += offsetX, uv[i + 1] += offsetY;
            return uv;
        }, Texture.create = function(source, x, y, width, height, offsetX, offsetY, sourceWidth, sourceHeight) {
            void 0 === offsetX && (offsetX = 0), void 0 === offsetY && (offsetY = 0), void 0 === sourceWidth && (sourceWidth = 0), 
            void 0 === sourceHeight && (sourceHeight = 0);
            var btex = source instanceof laya.resource.Texture, uv = btex ? source.uv : Texture.DEF_UV, bitmap = btex ? source.bitmap : source, bIsAtlas = RunDriver.isAtlas(bitmap);
            if (bIsAtlas) {
                var atlaser = bitmap._atlaser, nAtlasID = source._atlasID;
                if (-1 == nAtlasID) throw new Error("create texture error");
                bitmap = atlaser._inAtlasTextureBitmapValue[nAtlasID], uv = atlaser._inAtlasTextureOriUVValue[nAtlasID];
            }
            var tex = new Texture(bitmap, null);
            bitmap.width && x + width > bitmap.width && (width = bitmap.width - x), bitmap.height && y + height > bitmap.height && (height = bitmap.height - y), 
            tex.width = width, tex.height = height, tex.offsetX = offsetX, tex.offsetY = offsetY, 
            tex.sourceWidth = sourceWidth || width, tex.sourceHeight = sourceHeight || height;
            var dwidth = 1 / bitmap.width, dheight = 1 / bitmap.height;
            x *= dwidth, y *= dheight, width *= dwidth, height *= dheight;
            var u1 = tex.uv[0], v1 = tex.uv[1], u2 = tex.uv[4], v2 = tex.uv[5], inAltasUVWidth = u2 - u1, inAltasUVHeight = v2 - v1, oriUV = Texture.moveUV(uv[0], uv[1], [ x, y, x + width, y, x + width, y + height, x, y + height ]);
            tex.uv = [ u1 + oriUV[0] * inAltasUVWidth, v1 + oriUV[1] * inAltasUVHeight, u2 - (1 - oriUV[2]) * inAltasUVWidth, v1 + oriUV[3] * inAltasUVHeight, u2 - (1 - oriUV[4]) * inAltasUVWidth, v2 - (1 - oriUV[5]) * inAltasUVHeight, u1 + oriUV[6] * inAltasUVWidth, v2 - (1 - oriUV[7]) * inAltasUVHeight ], 
            bIsAtlas && tex.addTextureToAtlas();
            var bitmapScale = bitmap.scaleRate;
            return bitmapScale && 1 != bitmapScale ? (tex.sourceWidth /= bitmapScale, tex.sourceHeight /= bitmapScale, 
            tex.width /= bitmapScale, tex.height /= bitmapScale, tex.scaleRate = bitmapScale, 
            tex.offsetX /= bitmapScale, tex.offsetY /= bitmapScale) : tex.scaleRate = 1, tex;
        }, Texture.createFromTexture = function(texture, x, y, width, height) {
            var texScaleRate = texture.scaleRate;
            1 != texScaleRate && (x *= texScaleRate, y *= texScaleRate, width *= texScaleRate, 
            height *= texScaleRate);
            var rect = Rectangle.TEMP.setTo(x - texture.offsetX, y - texture.offsetY, width, height), result = rect.intersection(Texture._rect1.setTo(0, 0, texture.width, texture.height), Texture._rect2);
            if (!result) return null;
            var tex = Texture.create(texture, result.x, result.y, result.width, result.height, result.x - rect.x, result.y - rect.y, width, height);
            return tex.bitmap._removeReference(), tex;
        }, Texture.DEF_UV = [ 0, 0, 1, 0, 1, 1, 0, 1 ], Texture.INV_UV = [ 0, 1, 1, 1, 1, 0, 0, 0 ], 
        Texture._rect1 = new Rectangle(), Texture._rect2 = new Rectangle(), Texture;
    }(), TimeLine = function(_super) {
        var tweenData;
        function TimeLine() {
            this._labelDic = null, this._tweenDic = {}, this._tweenDataList = [], this._endTweenDataList = null, 
            this._currTime = 0, this._lastTime = 0, this._startTime = 0, this._index = 0, this._gidIndex = 0, 
            this._firstTweenDic = {}, this._startTimeSort = !1, this._endTimeSort = !1, this._loopKey = !1, 
            this.scale = 1, this._frameRate = 60, this._frameIndex = 0, this._total = 0, TimeLine.__super.call(this);
        }
        __class(TimeLine, "laya.utils.TimeLine", EventDispatcher);
        var __proto = TimeLine.prototype;
        return __proto.to = function(target, props, duration, ease, offset) {
            return void 0 === offset && (offset = 0), this._create(target, props, duration, ease, offset, !0);
        }, __proto.from = function(target, props, duration, ease, offset) {
            return void 0 === offset && (offset = 0), this._create(target, props, duration, ease, offset, !1);
        }, __proto._create = function(target, props, duration, ease, offset, isTo) {
            var tTweenData = Pool.getItemByClass("tweenData", tweenData);
            return tTweenData.isTo = isTo, tTweenData.type = 0, tTweenData.target = target, 
            tTweenData.duration = duration, tTweenData.data = props, tTweenData.startTime = this._startTime + offset, 
            tTweenData.endTime = tTweenData.startTime + tTweenData.duration, tTweenData.ease = ease, 
            this._startTime = Math.max(tTweenData.endTime, this._startTime), this._tweenDataList.push(tTweenData), 
            this._startTimeSort = !0, this._endTimeSort = !0, this;
        }, __proto.addLabel = function(label, offset) {
            var tTweenData = Pool.getItemByClass("tweenData", tweenData);
            return tTweenData.type = 1, tTweenData.data = label, tTweenData.endTime = tTweenData.startTime = this._startTime + offset, 
            this._labelDic || (this._labelDic = {}), this._labelDic[label] = tTweenData, this._tweenDataList.push(tTweenData), 
            this;
        }, __proto.removeLabel = function(label) {
            if (this._labelDic && this._labelDic[label]) {
                var tTweenData = this._labelDic[label];
                if (tTweenData) {
                    var tIndex = this._tweenDataList.indexOf(tTweenData);
                    -1 < tIndex && this._tweenDataList.splice(tIndex, 1);
                }
                delete this._labelDic[label];
            }
        }, __proto.gotoTime = function(time) {
            if (null != this._tweenDataList && 0 != this._tweenDataList.length) {
                var tTween, tObject, tTweenDataCopyList, tTweenData;
                for (var p in this._firstTweenDic) if (tObject = this._firstTweenDic[p]) for (var tDataP in tObject) tObject.diyTarget.hasOwnProperty(tDataP) && (tObject.diyTarget[tDataP] = tObject[tDataP]);
                for (p in this._tweenDic) (tTween = this._tweenDic[p]).clear(), delete this._tweenDic[p];
                if (this._index = 0, this._gidIndex = 0, this._currTime = time, this._lastTime = Browser.now(), 
                null == this._endTweenDataList || this._endTimeSort) {
                    this._endTimeSort = !1, this._endTweenDataList = tTweenDataCopyList = this._tweenDataList.concat(), 
                    tTweenDataCopyList.sort(function(paraA, paraB) {
                        return paraA.endTime > paraB.endTime ? 1 : paraA.endTime < paraB.endTime ? -1 : 0;
                    });
                } else tTweenDataCopyList = this._endTweenDataList;
                for (var i = 0, n = tTweenDataCopyList.length; i < n; i++) if (0 == (tTweenData = tTweenDataCopyList[i]).type) {
                    if (!(time >= tTweenData.endTime)) break;
                    this._index = Math.max(this._index, i + 1);
                    var props = tTweenData.data;
                    if (tTweenData.isTo) for (var tP in props) tTweenData.target[tP] = props[tP];
                }
                for (i = 0, n = this._tweenDataList.length; i < n; i++) 0 == (tTweenData = this._tweenDataList[i]).type && time >= tTweenData.startTime && time < tTweenData.endTime && (this._index = Math.max(this._index, i + 1), 
                this._gidIndex++, (tTween = Pool.getItemByClass("tween", Tween))._create(tTweenData.target, tTweenData.data, tTweenData.duration, tTweenData.ease, Handler.create(this, this._animComplete, [ this._gidIndex ]), 0, !1, tTweenData.isTo, !0, !1), 
                tTween.setStartTime(this._currTime - (time - tTweenData.startTime)), tTween._updateEase(this._currTime), 
                tTween.gid = this._gidIndex, this._tweenDic[this._gidIndex] = tTween);
            }
        }, __proto.gotoLabel = function(Label) {
            if (null != this._labelDic) {
                var tLabelData = this._labelDic[Label];
                tLabelData && this.gotoTime(tLabelData.startTime);
            }
        }, __proto.pause = function() {
            Laya.timer.clear(this, this._update);
        }, __proto.resume = function() {
            this.play(this._currTime, this._loopKey);
        }, __proto.play = function(timeOrLabel, loop) {
            if (void 0 === timeOrLabel && (timeOrLabel = 0), void 0 === loop && (loop = !1), 
            this._tweenDataList) {
                if (this._startTimeSort) {
                    this._startTimeSort = !1, this._tweenDataList.sort(function(paraA, paraB) {
                        return paraA.startTime > paraB.startTime ? 1 : paraA.startTime < paraB.startTime ? -1 : 0;
                    });
                    for (var i = 0, n = this._tweenDataList.length; i < n; i++) {
                        var tTweenData = this._tweenDataList[i];
                        if (null != tTweenData && 0 == tTweenData.type) {
                            var tTarget = tTweenData.target, gid = tTarget.$_GID || (tTarget.$_GID = Utils.getGID()), tSrcData = null;
                            for (var p in null == this._firstTweenDic[gid] ? ((tSrcData = {}).diyTarget = tTarget, 
                            this._firstTweenDic[gid] = tSrcData) : tSrcData = this._firstTweenDic[gid], tTweenData.data) null == tSrcData[p] && (tSrcData[p] = tTarget[p]);
                        }
                    }
                }
                "string" == typeof timeOrLabel ? this.gotoLabel(timeOrLabel) : this.gotoTime(timeOrLabel), 
                this._loopKey = loop, this._lastTime = Browser.now(), Laya.timer.frameLoop(1, this, this._update);
            }
        }, __proto._update = function() {
            if (this._currTime >= this._startTime) {
                if (!this._loopKey) {
                    for (var p in this._tweenDic) (tTween = this._tweenDic[p]).complete();
                    return this._complete(), void this.pause();
                }
                if (this._complete(), !this._tweenDataList) return;
                this.gotoTime(0);
            }
            var tTween, tNow = Browser.now(), tFrameTime = tNow - this._lastTime, tCurrTime = this._currTime += tFrameTime * this.scale;
            for (p in this._lastTime = tNow, this._tweenDic) (tTween = this._tweenDic[p])._updateEase(tCurrTime);
            if (0 != this._tweenDataList.length && this._index < this._tweenDataList.length) {
                var tTweenData = this._tweenDataList[this._index];
                tCurrTime >= tTweenData.startTime && (this._index++, 0 == tTweenData.type ? (this._gidIndex++, 
                (tTween = Pool.getItemByClass("tween", Tween))._create(tTweenData.target, tTweenData.data, tTweenData.duration, tTweenData.ease, Handler.create(this, this._animComplete, [ this._gidIndex ]), 0, !1, tTweenData.isTo, !0, !1), 
                tTween.setStartTime(tCurrTime), tTween.gid = this._gidIndex, (this._tweenDic[this._gidIndex] = tTween)._updateEase(tCurrTime)) : this.event("label", tTweenData.data));
            }
        }, __proto._animComplete = function(index) {
            this._tweenDic[index] && delete this._tweenDic[index];
        }, __proto._complete = function() {
            this.event("complete");
        }, __proto.reset = function() {
            var p;
            if (this._labelDic) for (p in this._labelDic) delete this._labelDic[p];
            for (p in this._tweenDic) this._tweenDic[p].clear(), delete this._tweenDic[p];
            for (p in this._firstTweenDic) delete this._firstTweenDic[p];
            if (this._endTweenDataList = null, this._tweenDataList && this._tweenDataList.length) {
                var len, i = 0;
                for (len = this._tweenDataList.length, i = 0; i < len; i++) this._tweenDataList[i] && this._tweenDataList[i].destroy();
            }
            this._tweenDataList.length = 0, this._currTime = 0, this._lastTime = 0, this._startTime = 0, 
            this._index = 0, this._gidIndex = 0, this.scale = 1, Laya.timer.clear(this, this._update);
        }, __proto.destroy = function() {
            this.reset(), this._labelDic = null, this._tweenDic = null, this._tweenDataList = null, 
            this._firstTweenDic = null;
        }, __getset(0, __proto, "index", function() {
            return this._frameIndex;
        }, function(value) {
            this._frameIndex = value, this.gotoTime(this._frameIndex / this._frameRate * 1e3);
        }), __getset(0, __proto, "total", function() {
            return this._total = Math.floor(this._startTime / 1e3 * this._frameRate), this._total;
        }), TimeLine.to = function(target, props, duration, ease, offset) {
            return void 0 === offset && (offset = 0), new TimeLine().to(target, props, duration, ease, offset);
        }, TimeLine.from = function(target, props, duration, ease, offset) {
            return void 0 === offset && (offset = 0), new TimeLine().from(target, props, duration, ease, offset);
        }, TimeLine.__init$ = function() {
            tweenData = function() {
                function tweenData() {
                    this.type = 0, this.isTo = !0, this.startTime = NaN, this.endTime = NaN, this.target = null, 
                    this.duration = NaN, this.ease = null, this.data = null;
                }
                return __class(tweenData, ""), tweenData.prototype.destroy = function() {
                    this.target = null, this.ease = null, this.data = null, this.isTo = !0, this.type = 0, 
                    Pool.recover("tweenData", this);
                }, tweenData;
            }();
        }, TimeLine;
    }(), Sprite = function(_super) {
        function Sprite() {
            this._transform = null, this._tfChanged = !1, this._x = 0, this._y = 0, this._width = 0, 
            this._height = 0, this._repaint = 1, this._mouseEnableState = 0, this._zOrder = 0, 
            this._graphics = null, this._renderType = 0, this._optimizeScrollRect = !1, this._texture = null, 
            this.mouseThrough = !1, this.autoSize = !1, this.hitTestPrior = !1, this.viewport = null, 
            Sprite.__super.call(this), this._style = Style.EMPTY;
        }
        __class(Sprite, "laya.display.Sprite", _super);
        var __proto = Sprite.prototype;
        return Laya.imps(__proto, {
            "laya.display.ILayout": !0
        }), __proto.createConchModel = function() {
            return new ConchNode();
        }, __proto.destroy = function(destroyChild) {
            if (void 0 === destroyChild && (destroyChild = !0), this._releaseMem(), !this._destroyed) {
                this.filters = null;
                var mask = this.mask;
                mask && (this.mask = null, mask.destroy(destroyChild));
            }
            _super.prototype.destroy.call(this, destroyChild), this._style && this._style.destroy(), 
            this._transform && this._transform.destroy(), this._transform = null, this._style = null, 
            this._graphics = null;
        }, __proto.updateZOrder = function() {
            Utils.updateOrder(this._childs) && this.repaint();
        }, __proto.reCache = function() {
            this._$P.cacheCanvas && (this._$P.cacheCanvas.reCache = !0), this._repaint = 1;
        }, __proto.setBounds = function(bound) {
            this._set$P("uBounds", bound);
        }, __proto.getBounds = function() {
            return this._$P.mBounds || this._set$P("mBounds", new Rectangle()), Rectangle._getWrapRec(this._boundPointsToParent(), this._$P.mBounds);
        }, __proto.getSelfBounds = function() {
            return this._$P.uBounds ? this._$P.uBounds : (this._$P.mBounds || this._set$P("mBounds", new Rectangle()), 
            Rectangle._getWrapRec(this._getBoundPointsM(!1), this._$P.mBounds));
        }, __proto._boundPointsToParent = function(ifRotate) {
            void 0 === ifRotate && (ifRotate = !1);
            var pX = 0, pY = 0;
            this._style && (pX = this._style._tf.translateX, pY = this._style._tf.translateY, 
            ifRotate = ifRotate || 0 !== this._style._tf.rotate, this._style.scrollRect && (pX += this._style.scrollRect.x, 
            pY += this._style.scrollRect.y));
            var pList = this._getBoundPointsM(ifRotate);
            if (!pList || pList.length < 1) return pList;
            if (8 != pList.length && (pList = ifRotate ? GrahamScan.scanPList(pList) : Rectangle._getWrapRec(pList, Rectangle.TEMP)._getBoundPoints()), 
            !this.transform) return Utils.transPointList(pList, this._x - pX, this._y - pY), 
            pList;
            var tPoint = Point.TEMP, i = 0, len = pList.length;
            for (i = 0; i < len; i += 2) tPoint.x = pList[i], tPoint.y = pList[i + 1], this.toParentPoint(tPoint), 
            pList[i] = tPoint.x, pList[i + 1] = tPoint.y;
            return pList;
        }, __proto.getGraphicBounds = function(realSize) {
            return void 0 === realSize && (realSize = !1), this._graphics ? this._graphics.getBounds(realSize) : Rectangle.TEMP.setTo(0, 0, 0, 0);
        }, __proto._getBoundPointsM = function(ifRotate) {
            if (void 0 === ifRotate && (ifRotate = !1), this._$P.uBounds) return this._$P.uBounds._getBoundPoints();
            if (this._$P.temBM || this._set$P("temBM", []), this.scrollRect) {
                var rst = Utils.clearArray(this._$P.temBM), rec = Rectangle.TEMP;
                return rec.copyFrom(this.scrollRect), Utils.concatArray(rst, rec._getBoundPoints()), 
                rst;
            }
            for (var child, cList, __childs, pList = this._graphics ? this._graphics.getBoundPoints() : Utils.clearArray(this._$P.temBM), i = 0, n = (__childs = this._childs).length; i < n; i++) (child = __childs[i]) instanceof laya.display.Sprite && 1 == child.visible && (cList = child._boundPointsToParent(ifRotate)) && (pList = pList ? Utils.concatArray(pList, cList) : cList);
            return pList;
        }, __proto.getStyle = function() {
            return this._style === Style.EMPTY && (this._style = new Style()), this._style;
        }, __proto.setStyle = function(value) {
            this._style = value;
        }, __proto._adjustTransform = function() {
            this._tfChanged = !1;
            var m, tf = this._style._tf, sx = tf.scaleX, sy = tf.scaleY;
            if (tf.rotate || 1 !== sx || 1 !== sy || tf.skewX || tf.skewY) {
                (m = this._transform || (this._transform = Matrix.create())).bTransform = !0;
                var skx = .0174532922222222 * (tf.rotate - tf.skewX), sky = .0174532922222222 * (tf.rotate + tf.skewY), cx = Math.cos(sky), ssx = Math.sin(sky), cy = Math.sin(skx), ssy = Math.cos(skx);
                return m.a = sx * cx, m.b = sx * ssx, m.c = -sy * cy, m.d = sy * ssy, m.tx = m.ty = 0, 
                m;
            }
            return this._transform && this._transform.destroy(), this._transform = null, this._renderType &= -5, 
            m;
        }, __proto.pos = function(x, y, speedMode) {
            if (void 0 === speedMode && (speedMode = !1), this._x !== x || this._y !== y) {
                if (this.destroyed) return this;
                if (speedMode) {
                    this._x = x, this._y = y, this.conchModel && this.conchModel.pos(this._x, this._y);
                    var p = this._parent;
                    p && 0 === p._repaint && (p._repaint = 1, p.parentRepaint()), this._$P.maskParent && 0 === this._$P.maskParent._repaint && (this._$P.maskParent._repaint = 1, 
                    this._$P.maskParent.parentRepaint());
                } else this.x = x, this.y = y;
            }
            return this;
        }, __proto.pivot = function(x, y) {
            return this.pivotX = x, this.pivotY = y, this;
        }, __proto.size = function(width, height) {
            return this.width = width, this.height = height, this;
        }, __proto.scale = function(scaleX, scaleY, speedMode) {
            void 0 === speedMode && (speedMode = !1);
            var style = this.getStyle(), _tf = style._tf;
            if (_tf.scaleX != scaleX || _tf.scaleY != scaleY) {
                if (this.destroyed) return this;
                if (speedMode) {
                    style.setScale(scaleX, scaleY), this._tfChanged = !0, this.conchModel && this.conchModel.scale(scaleX, scaleY), 
                    this._renderType |= 4;
                    var p = this._parent;
                    p && 0 === p._repaint && (p._repaint = 1, p.parentRepaint());
                } else this.scaleX = scaleX, this.scaleY = scaleY;
            }
            return this;
        }, __proto.skew = function(skewX, skewY) {
            return this.skewX = skewX, this.skewY = skewY, this;
        }, __proto.render = function(context, x, y) {
            Stat.spriteCount++, RenderSprite.renders[this._renderType]._fun(this, context, x + this._x, y + this._y), 
            this._repaint = 0;
        }, __proto.drawToCanvas = function(canvasWidth, canvasHeight, offsetX, offsetY) {
            if (Render.isConchNode) {
                var canvas = HTMLCanvas.create("2D");
                return new RenderContext(canvasWidth, canvasHeight, canvas).ctx.setCanvasType(1), 
                this.conchModel.drawToCanvas(canvas.source, offsetX, offsetY), canvas;
            }
            return RunDriver.drawToCanvas(this, this._renderType, canvasWidth, canvasHeight, offsetX, offsetY);
        }, __proto.customRender = function(context, x, y) {
            this._renderType |= 1024;
        }, __proto._applyFilters = function() {
            var _filters;
            if (!Render.isWebGL && ((_filters = this._$P.filters) && !(_filters.length < 1))) for (var i = 0, n = _filters.length; i < n; i++) _filters[i].action.apply(this._$P.cacheCanvas);
        }, __proto._isHaveGlowFilter = function() {
            var len, i = 0;
            if (this.filters) for (i = 0; i < this.filters.length; i++) if (8 == this.filters[i].type) return !0;
            for (i = 0, len = this._childs.length; i < len; i++) if (this._childs[i]._isHaveGlowFilter()) return !0;
            return !1;
        }, __proto.localToGlobal = function(point, createNewPoint) {
            void 0 === createNewPoint && (createNewPoint = !1), !0 === createNewPoint && (point = new Point(point.x, point.y));
            for (var ele = this; ele && ele != Laya.stage; ) point = ele.toParentPoint(point), 
            ele = ele.parent;
            return point;
        }, __proto.globalToLocal = function(point, createNewPoint) {
            void 0 === createNewPoint && (createNewPoint = !1), createNewPoint && (point = new Point(point.x, point.y));
            for (var ele = this, list = []; ele && ele != Laya.stage; ) list.push(ele), ele = ele.parent;
            for (var i = list.length - 1; 0 <= i; ) point = (ele = list[i]).fromParentPoint(point), 
            i--;
            return point;
        }, __proto.toParentPoint = function(point) {
            if (!point) return point;
            point.x -= this.pivotX, point.y -= this.pivotY, this.transform && this._transform.transformPoint(point), 
            point.x += this._x, point.y += this._y;
            var scroll = this._style.scrollRect;
            return scroll && (point.x -= scroll.x, point.y -= scroll.y), point;
        }, __proto.fromParentPoint = function(point) {
            if (!point) return point;
            point.x -= this._x, point.y -= this._y;
            var scroll = this._style.scrollRect;
            return scroll && (point.x += scroll.x, point.y += scroll.y), this.transform && this._transform.invertTransformPoint(point), 
            point.x += this.pivotX, point.y += this.pivotY, point;
        }, __proto.on = function(type, caller, listener, args) {
            return 1 !== this._mouseEnableState && this.isMouseEvent(type) ? (this.mouseEnabled = !0, 
            this._setBit(2, !0), this._parent && this._$2__onDisplay(), this._createListener(type, caller, listener, args, !1)) : _super.prototype.on.call(this, type, caller, listener, args);
        }, __proto.once = function(type, caller, listener, args) {
            return 1 !== this._mouseEnableState && this.isMouseEvent(type) ? (this.mouseEnabled = !0, 
            this._setBit(2, !0), this._parent && this._$2__onDisplay(), this._createListener(type, caller, listener, args, !0)) : _super.prototype.once.call(this, type, caller, listener, args);
        }, __proto._$2__onDisplay = function() {
            if (1 !== this._mouseEnableState) {
                var ele = this;
                for (ele = ele.parent; ele && 1 !== ele._mouseEnableState && !ele._getBit(2); ) ele.mouseEnabled = !0, 
                ele._setBit(2, !0), ele = ele.parent;
            }
        }, __proto.loadImage = function(url, x, y, width, height, complete) {
            var _$this = this;
            return void 0 === x && (x = 0), void 0 === y && (y = 0), void 0 === width && (width = 0), 
            void 0 === height && (height = 0), this.graphics.loadImage(url, x, y, width, height, function(tex) {
                _$this.destroyed || (_$this.size(x + (width || tex.width), y + (height || tex.height)), 
                _$this.repaint(), complete && complete.runWith(tex));
            }), this;
        }, __proto.repaint = function() {
            this.conchModel && this.conchModel.repaint && this.conchModel.repaint(), 0 === this._repaint && (this._repaint = 1, 
            this.parentRepaint()), this._$P && this._$P.maskParent && this._$P.maskParent.repaint();
        }, __proto._needRepaint = function() {
            return 0 !== this._repaint && this._$P.cacheCanvas && this._$P.cacheCanvas.reCache;
        }, __proto._childChanged = function(child) {
            this._childs.length ? this._renderType |= 2048 : this._renderType &= -2049, child && this._get$P("hasZorder") && Laya.timer.callLater(this, this.updateZOrder), 
            this.repaint();
        }, __proto.parentRepaint = function() {
            var p = this._parent;
            p && 0 === p._repaint && (p._repaint = 1, p.parentRepaint());
        }, __proto.startDrag = function(area, hasInertia, elasticDistance, elasticBackTime, data, disableMouseEvent, ratio) {
            void 0 === hasInertia && (hasInertia = !1), void 0 === elasticDistance && (elasticDistance = 0), 
            void 0 === elasticBackTime && (elasticBackTime = 300), void 0 === disableMouseEvent && (disableMouseEvent = !1), 
            void 0 === ratio && (ratio = .92), this._$P.dragging || this._set$P("dragging", new Dragging()), 
            this._$P.dragging.start(this, area, hasInertia, elasticDistance, elasticBackTime, data, disableMouseEvent, ratio);
        }, __proto.stopDrag = function() {
            this._$P.dragging && this._$P.dragging.stop();
        }, __proto._releaseMem = function() {
            if (this._$P) {
                var cc = this._$P.cacheCanvas;
                cc && cc.ctx && (Pool.recover("RenderContext", cc.ctx), cc.ctx.canvas.size(0, 0), 
                cc.ctx = null);
                var fc = this._$P._filterCache;
                fc && (fc.destroy(), fc.recycle(), this._set$P("_filterCache", null)), this._$P._isHaveGlowFilter && this._set$P("_isHaveGlowFilter", !1), 
                this._$P._isHaveGlowFilter = null;
            }
        }, __proto._setDisplay = function(value) {
            value || this._releaseMem(), _super.prototype._setDisplay.call(this, value);
        }, __proto.hitTestPoint = function(x, y) {
            var point = this.globalToLocal(Point.TEMP.setTo(x, y));
            return x = point.x, y = point.y, (this._$P.hitArea ? this._$P.hitArea : 0 < this._width && 0 < this._height ? Rectangle.TEMP.setTo(0, 0, this._width, this._height) : this.getSelfBounds()).contains(x, y);
        }, __proto.getMousePoint = function() {
            return this.globalToLocal(Point.TEMP.setTo(Laya.stage.mouseX, Laya.stage.mouseY));
        }, __proto._getWords = function() {
            return null;
        }, __proto._addChildsToLayout = function(out) {
            var words = this._getWords();
            if (null == words && 0 == this._childs.length) return !1;
            if (words) for (var i = 0, n = words.length; i < n; i++) out.push(words[i]);
            i = 0;
            for (var length = this._childs.length; i < length; ++i) {
                var o = this._childs[i];
                o._style._enableLayout() && o._addToLayout(out);
            }
            return !0;
        }, __proto._addToLayout = function(out) {
            this._style.absolute || (this._style.block ? out.push(this) : this._addChildsToLayout(out) && (this.x = this.y = 0));
        }, __proto._isChar = function() {
            return !1;
        }, __proto._getCSSStyle = function() {
            return this._style.getCSSStyle();
        }, __proto._setAttributes = function(name, value) {
            switch (name) {
              case "x":
                this.x = parseFloat(value);
                break;

              case "y":
                this.y = parseFloat(value);
                break;

              case "width":
                this.width = parseFloat(value);
                break;

              case "height":
                this.height = parseFloat(value);
                break;

              default:
                this[name] = value;
            }
        }, __proto._layoutLater = function() {
            this.parent && this.parent._layoutLater();
        }, __getset(0, __proto, "optimizeScrollRect", function() {
            return this._optimizeScrollRect;
        }, function(b) {
            this._optimizeScrollRect != b && (this._optimizeScrollRect = b, this.conchModel && this.conchModel.optimizeScrollRect(b));
        }), __getset(0, __proto, "customRenderEnable", null, function(b) {
            if (b && (this._renderType |= 1024, Render.isConchNode)) {
                Sprite.CustomList.push(this);
                var canvas = new HTMLCanvas("2d");
                canvas._setContext(new CanvasRenderingContext2D()), this.customContext = new RenderContext(0, 0, canvas), 
                canvas.context.setCanvasType && canvas.context.setCanvasType(2), this.conchModel.custom(canvas.context);
            }
        }), __getset(0, __proto, "cacheAsBitmap", function() {
            return "none" !== this.cacheAs;
        }, function(value) {
            this.cacheAs = value ? this._$P.hasFilter ? "none" : "normal" : "none";
        }), __getset(0, __proto, "cacheAs", function() {
            return null == this._$P.cacheCanvas ? "none" : this._$P.cacheCanvas.type;
        }, function(value) {
            var cacheCanvas = this._$P.cacheCanvas;
            if (value !== (cacheCanvas ? cacheCanvas.type : "none")) {
                if ("none" !== value) this._getBit(1) || this._setUpNoticeType(1), cacheCanvas || (cacheCanvas = this._set$P("cacheCanvas", Pool.getItemByClass("cacheCanvas", Object))), 
                cacheCanvas.type = value, cacheCanvas.reCache = !0, this._renderType |= 16, "bitmap" == value && this.conchModel && this.conchModel.cacheAs(1), 
                this._set$P("cacheForFilters", !1); else if (this._$P._mask) ; else if (this._$P.hasFilter) this._set$P("cacheForFilters", !0); else {
                    if (cacheCanvas) {
                        var cc = cacheCanvas;
                        cc && cc.ctx && (Pool.recover("RenderContext", cc.ctx), cc.ctx.canvas.size(0, 0), 
                        cc.ctx = null), Pool.recover("cacheCanvas", cacheCanvas);
                    }
                    this._$P.cacheCanvas = null, this._renderType &= -17, this.conchModel && this.conchModel.cacheAs(0);
                }
                this.repaint();
            }
        }), __getset(0, __proto, "zOrder", function() {
            return this._zOrder;
        }, function(value) {
            this._zOrder != value && (this._zOrder = value, this.conchModel && this.conchModel.setZOrder && this.conchModel.setZOrder(value), 
            this._parent && (value && this._parent._set$P("hasZorder", !0), Laya.timer.callLater(this._parent, this.updateZOrder)));
        }), __getset(0, __proto, "rotation", function() {
            return this._style._tf.rotate;
        }, function(value) {
            var style = this.getStyle();
            if (style._tf.rotate !== value) {
                style.setRotate(value), this._tfChanged = !0, this.conchModel && this.conchModel.rotate(value), 
                this._renderType |= 4;
                var p = this._parent;
                p && 0 === p._repaint && (p._repaint = 1, p.parentRepaint());
            }
        }), __getset(0, __proto, "width", function() {
            return this.autoSize ? this.getSelfBounds().width : this._width;
        }, function(value) {
            this._width !== value && (this._width = value, this.conchModel && this.conchModel.size(value, this._height), 
            this.repaint());
        }), __getset(0, __proto, "x", function() {
            return this._x;
        }, function(value) {
            if (this._x !== value) {
                if (this.destroyed) return;
                this._x = value, this.conchModel && this.conchModel.pos(value, this._y);
                var p = this._parent;
                p && 0 === p._repaint && (p._repaint = 1, p.parentRepaint()), this._$P.maskParent && 0 === this._$P.maskParent._repaint && (this._$P.maskParent._repaint = 1, 
                this._$P.maskParent.parentRepaint());
            }
        }), __getset(0, __proto, "globalScaleY", function() {
            for (var scale = 1, ele = this; ele && ele !== Laya.stage; ) scale *= ele.scaleY, 
            ele = ele.parent;
            return scale;
        }), __getset(0, __proto, "hitArea", function() {
            return this._$P.hitArea;
        }, function(value) {
            this._set$P("hitArea", value);
        }), __getset(0, __proto, "staticCache", function() {
            return this._$P.staticCache;
        }, function(value) {
            this._set$P("staticCache", value), value || this.reCache();
        }), __getset(0, __proto, "texture", function() {
            return this._texture;
        }, function(value) {
            this._texture != value && (this._texture = value, this.graphics.cleanByTexture(value, 0, 0));
        }), __getset(0, __proto, "y", function() {
            return this._y;
        }, function(value) {
            if (this._y !== value) {
                if (this.destroyed) return;
                this._y = value, this.conchModel && this.conchModel.pos(this._x, value);
                var p = this._parent;
                p && 0 === p._repaint && (p._repaint = 1, p.parentRepaint()), this._$P.maskParent && 0 === this._$P.maskParent._repaint && (this._$P.maskParent._repaint = 1, 
                this._$P.maskParent.parentRepaint());
            }
        }), __getset(0, __proto, "height", function() {
            return this.autoSize ? this.getSelfBounds().height : this._height;
        }, function(value) {
            this._height !== value && (this._height = value, this.conchModel && this.conchModel.size(this._width, value), 
            this.repaint());
        }), __getset(0, __proto, "blendMode", function() {
            return this._style.blendMode;
        }, function(value) {
            this.getStyle().blendMode = value, this.conchModel && this.conchModel.blendMode(value), 
            value && "source-over" != value ? this._renderType |= 8 : this._renderType &= -9, 
            this.parentRepaint();
        }), __getset(0, __proto, "scaleX", function() {
            return this._style._tf.scaleX;
        }, function(value) {
            var style = this.getStyle();
            if (style._tf.scaleX !== value) {
                style.setScaleX(value), this._tfChanged = !0, this.conchModel && this.conchModel.scale(value, style._tf.scaleY), 
                this._renderType |= 4;
                var p = this._parent;
                p && 0 === p._repaint && (p._repaint = 1, p.parentRepaint());
            }
        }), __getset(0, __proto, "scaleY", function() {
            return this._style._tf.scaleY;
        }, function(value) {
            var style = this.getStyle();
            if (style._tf.scaleY !== value) {
                style.setScaleY(value), this._tfChanged = !0, this.conchModel && this.conchModel.scale(style._tf.scaleX, value), 
                this._renderType |= 4;
                var p = this._parent;
                p && 0 === p._repaint && (p._repaint = 1, p.parentRepaint());
            }
        }), __getset(0, __proto, "stage", function() {
            return Laya.stage;
        }), __getset(0, __proto, "skewX", function() {
            return this._style._tf.skewX;
        }, function(value) {
            var style = this.getStyle();
            if (style._tf.skewX !== value) {
                style.setSkewX(value), this._tfChanged = !0, this.conchModel && this.conchModel.skew(value, style._tf.skewY), 
                this._renderType |= 4;
                var p = this._parent;
                p && 0 === p._repaint && (p._repaint = 1, p.parentRepaint());
            }
        }), __getset(0, __proto, "scrollRect", function() {
            return this._style.scrollRect;
        }, function(value) {
            this.getStyle().scrollRect = value, this.repaint(), value ? (this._renderType |= 128, 
            this.conchModel && this.conchModel.scrollRect(value.x, value.y, value.width, value.height)) : (this._renderType &= -129, 
            this.conchModel && (Sprite.RUNTIMEVERION < "0.9.1" ? this.conchModel.removeType(64) : this.conchModel.removeType(128)));
        }), __getset(0, __proto, "skewY", function() {
            return this._style._tf.skewY;
        }, function(value) {
            var style = this.getStyle();
            if (style._tf.skewY !== value) {
                style.setSkewY(value), this._tfChanged = !0, this.conchModel && this.conchModel.skew(style._tf.skewX, value), 
                this._renderType |= 4;
                var p = this._parent;
                p && 0 === p._repaint && (p._repaint = 1, p.parentRepaint());
            }
        }), __getset(0, __proto, "transform", function() {
            return this._tfChanged ? this._adjustTransform() : this._transform;
        }, function(value) {
            this._tfChanged = !1, (this._transform = value) && (this._x = value.tx, this._y = value.ty, 
            value.tx = value.ty = 0, this.conchModel && this.conchModel.transform(value.a, value.b, value.c, value.d, this._x, this._y)), 
            value ? this._renderType |= 4 : (this._renderType &= -5, this.conchModel && this.conchModel.removeType(4)), 
            this.parentRepaint();
        }), __getset(0, __proto, "pivotX", function() {
            return this._style._tf.translateX;
        }, function(value) {
            this.getStyle().setTranslateX(value), this.conchModel && this.conchModel.pivot(value, this._style._tf.translateY), 
            this.repaint();
        }), __getset(0, __proto, "pivotY", function() {
            return this._style._tf.translateY;
        }, function(value) {
            this.getStyle().setTranslateY(value), this.conchModel && this.conchModel.pivot(this._style._tf.translateX, value), 
            this.repaint();
        }), __getset(0, __proto, "alpha", function() {
            return this._style.alpha;
        }, function(value) {
            this._style && this._style.alpha !== value && (value = value < 0 ? 0 : 1 < value ? 1 : value, 
            this.getStyle().alpha = value, this.conchModel && this.conchModel.alpha(value), 
            1 !== value ? this._renderType |= 2 : this._renderType &= -3, this.parentRepaint());
        }), __getset(0, __proto, "visible", function() {
            return this._style.visible;
        }, function(value) {
            this._style && this._style.visible !== value && (this.getStyle().visible = value, 
            this.conchModel && this.conchModel.visible(value), this.parentRepaint());
        }), __getset(0, __proto, "graphics", function() {
            return this._graphics || (this.graphics = RunDriver.createGraphics());
        }, function(value) {
            this._graphics && (this._graphics._sp = null), (this._graphics = value) ? (this._renderType &= -2, 
            this._renderType |= 512, (value._sp = this).conchModel && this.conchModel.graphics(this._graphics)) : (this._renderType &= -513, 
            this._renderType &= -2, this.conchModel && (Sprite.RUNTIMEVERION < "0.9.1" ? this.conchModel.removeType(256) : this.conchModel.removeType(512))), 
            this.repaint();
        }), __getset(0, __proto, "filters", function() {
            return this._$P.filters;
        }, function(value) {
            value && 0 === value.length && (value = null), this._$P.filters != value && (this._set$P("filters", value ? value.slice() : null), 
            Render.isConchApp && (this.conchModel && (Sprite.RUNTIMEVERION < "0.9.1" ? this.conchModel.removeType(16) : this.conchModel.removeType(32)), 
            this._$P.filters && 1 == this._$P.filters.length && this._$P.filters[0].callNative(this)), 
            Render.isWebGL && (value && value.length ? this._renderType |= 32 : this._renderType &= -33), 
            value && 0 < value.length ? (this._getBit(1) || this._setUpNoticeType(1), Render.isWebGL && 1 == value.length && value[0] instanceof laya.filters.ColorFilter || ("bitmap" != this.cacheAs && (Render.isConchNode || (this.cacheAs = "bitmap"), 
            this._set$P("cacheForFilters", !0)), this._set$P("hasFilter", !0))) : (this._set$P("hasFilter", !1), 
            this._$P.cacheForFilters && "bitmap" == this.cacheAs && (this.cacheAs = "none")), 
            this.repaint());
        }), __getset(0, __proto, "parent", _super.prototype._$get_parent, function(value) {
            Laya.superSet(Node, this, "parent", value), value && this._getBit(2) && this._$2__onDisplay();
        }), __getset(0, __proto, "mask", function() {
            return this._$P._mask;
        }, function(value) {
            value && this.mask && this.mask._$P.maskParent || (value ? (this.cacheAs = "bitmap", 
            this._set$P("_mask", value), value._set$P("maskParent", this)) : (this.mask && this.mask._set$P("maskParent", null), 
            this._set$P("_mask", value), this.cacheAs = "none"), this.conchModel && this.conchModel.mask(value ? value.conchModel : null), 
            this._renderType |= 64, this.parentRepaint());
        }), __getset(0, __proto, "mouseEnabled", function() {
            return 1 < this._mouseEnableState;
        }, function(value) {
            this._mouseEnableState = value ? 2 : 1;
        }), __getset(0, __proto, "globalScaleX", function() {
            for (var scale = 1, ele = this; ele && ele !== Laya.stage; ) scale *= ele.scaleX, 
            ele = ele.parent;
            return scale;
        }), __getset(0, __proto, "mouseX", function() {
            return this.getMousePoint().x;
        }), __getset(0, __proto, "mouseY", function() {
            return this.getMousePoint().y;
        }), Sprite.fromImage = function(url) {
            return new Sprite().loadImage(url);
        }, Sprite._cachePool = [], Sprite.CustomList = [], __static(Sprite, [ "RUNTIMEVERION", function() {
            return this.RUNTIMEVERION = window.conch ? conchConfig.getRuntimeVersion().substr(conchConfig.getRuntimeVersion().lastIndexOf("-") + 1) : "";
        } ]), Sprite;
    }(Node), AudioSoundChannel = function(_super) {
        function AudioSoundChannel(audio) {
            this._audio = null, this._onEnd = null, this._resumePlay = null, AudioSoundChannel.__super.call(this), 
            this._onEnd = Utils.bind(this.__onEnd, this), this._resumePlay = Utils.bind(this.__resumePlay, this), 
            audio.addEventListener("ended", this._onEnd), this._audio = audio;
        }
        __class(AudioSoundChannel, "laya.media.h5audio.AudioSoundChannel", SoundChannel);
        var __proto = AudioSoundChannel.prototype;
        return __proto.__onEnd = function() {
            if (1 == this.loops) return this.completeHandler && (Laya.timer.once(10, this, this.__runComplete, [ this.completeHandler ], !1), 
            this.completeHandler = null), this.stop(), void this.event("complete");
            0 < this.loops && this.loops--, this.startTime = 0, this.play();
        }, __proto.__resumePlay = function() {
            this._audio && this._audio.removeEventListener("canplay", this._resumePlay);
            try {
                this._audio.currentTime = this.startTime, Browser.container.appendChild(this._audio), 
                this._audio.play();
            } catch (e) {
                e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                this.event("error");
            }
        }, __proto.play = function() {
            this.isStopped = !1;
            try {
                this._audio.playbackRate = SoundManager.playbackRate, this._audio.currentTime = this.startTime;
            } catch (e) {
                e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                return void this._audio.addEventListener("canplay", this._resumePlay);
            }
            SoundManager.addChannel(this), Browser.container.appendChild(this._audio), "play" in this._audio && this._audio.play();
        }, __proto.stop = function() {
            this.isStopped = !0, SoundManager.removeChannel(this), this.completeHandler = null, 
            this._audio && ("pause" in this._audio && Render.isConchApp && this._audio.stop(), 
            this._audio.pause(), this._audio.removeEventListener("ended", this._onEnd), this._audio.removeEventListener("canplay", this._resumePlay), 
            Browser.onIE || this._audio != AudioSound._musicAudio && Pool.recover("audio:" + this.url, this._audio), 
            Browser.removeElement(this._audio), this._audio = null);
        }, __proto.pause = function() {
            this.isStopped = !0, SoundManager.removeChannel(this), "pause" in this._audio && this._audio.pause();
        }, __proto.resume = function() {
            this._audio && (this.isStopped = !1, SoundManager.addChannel(this), "play" in this._audio && this._audio.play());
        }, __getset(0, __proto, "position", function() {
            return this._audio ? this._audio.currentTime : 0;
        }), __getset(0, __proto, "duration", function() {
            return this._audio ? this._audio.duration : 0;
        }), __getset(0, __proto, "volume", function() {
            return this._audio ? this._audio.volume : 1;
        }, function(v) {
            this._audio && (this._audio.volume = v);
        }), AudioSoundChannel;
    }(), WebAudioSoundChannel = function(_super) {
        function WebAudioSoundChannel() {
            this.audioBuffer = null, this.gain = null, this.bufferSource = null, this._currentTime = 0, 
            this._volume = 1, this._startTime = 0, this._pauseTime = 0, this._onPlayEnd = null, 
            this.context = WebAudioSound.ctx, WebAudioSoundChannel.__super.call(this), this._onPlayEnd = Utils.bind(this.__onPlayEnd, this), 
            this.context.createGain ? this.gain = this.context.createGain() : this.gain = this.context.createGainNode();
        }
        __class(WebAudioSoundChannel, "laya.media.webaudio.WebAudioSoundChannel", SoundChannel);
        var __proto = WebAudioSoundChannel.prototype;
        return __proto.play = function() {
            if (SoundManager.addChannel(this), this.isStopped = !1, this._clearBufferSource(), 
            this.audioBuffer) {
                var context = this.context, gain = this.gain, bufferSource = context.createBufferSource();
                (this.bufferSource = bufferSource).buffer = this.audioBuffer, bufferSource.connect(gain), 
                gain && gain.disconnect(), gain.connect(context.destination), bufferSource.onended = this._onPlayEnd, 
                this.startTime >= this.duration && (this.startTime = 0), this._startTime = Browser.now(), 
                this.gain.gain.setTargetAtTime ? this.gain.gain.setTargetAtTime(this._volume, this.context.currentTime, .1) : this.gain.gain.value = this._volume, 
                0 == this.loops && (bufferSource.loop = !0), bufferSource.playbackRate.setTargetAtTime ? bufferSource.playbackRate.setTargetAtTime(SoundManager.playbackRate, this.context.currentTime, .1) : bufferSource.playbackRate.value = SoundManager.playbackRate, 
                bufferSource.start(0, this.startTime), this._currentTime = 0;
            }
        }, __proto.__onPlayEnd = function() {
            if (1 == this.loops) return this.completeHandler && (Laya.timer.once(10, this, this.__runComplete, [ this.completeHandler ], !1), 
            this.completeHandler = null), this.stop(), void this.event("complete");
            0 < this.loops && this.loops--, this.startTime = 0, this.play();
        }, __proto._clearBufferSource = function() {
            if (this.bufferSource) {
                var sourceNode = this.bufferSource;
                sourceNode.stop ? sourceNode.stop(0) : sourceNode.noteOff(0), sourceNode.disconnect(0), 
                sourceNode.onended = null, WebAudioSoundChannel._tryCleanFailed || this._tryClearBuffer(sourceNode), 
                this.bufferSource = null;
            }
        }, __proto._tryClearBuffer = function(sourceNode) {
            try {
                sourceNode.buffer = null;
            } catch (e) {
                e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                WebAudioSoundChannel._tryCleanFailed = !0;
            }
        }, __proto.stop = function() {
            this._clearBufferSource(), this.audioBuffer = null, this.gain && this.gain.disconnect(), 
            this.isStopped = !0, SoundManager.removeChannel(this), this.completeHandler = null;
        }, __proto.pause = function() {
            this.isStopped || (this._pauseTime = this.position), this._clearBufferSource(), 
            this.gain && this.gain.disconnect(), this.isStopped = !0, SoundManager.removeChannel(this);
        }, __proto.resume = function() {
            this.startTime = this._pauseTime, this.play();
        }, __getset(0, __proto, "position", function() {
            return this.bufferSource ? (Browser.now() - this._startTime) / 1e3 + this.startTime : 0;
        }), __getset(0, __proto, "duration", function() {
            return this.audioBuffer ? this.audioBuffer.duration : 0;
        }), __getset(0, __proto, "volume", function() {
            return this._volume;
        }, function(v) {
            this.isStopped || (this._volume = v, this.gain.gain.setTargetAtTime ? this.gain.gain.setTargetAtTime(v, this.context.currentTime, .1) : this.gain.gain.value = v);
        }), WebAudioSoundChannel._tryCleanFailed = !1, WebAudioSoundChannel;
    }(), Bitmap = function(_super) {
        function Bitmap() {
            Bitmap.__super.call(this), this._w = 0, this._h = 0;
        }
        __class(Bitmap, "laya.resource.Bitmap", Resource);
        var __proto = Bitmap.prototype;
        return __getset(0, __proto, "width", function() {
            return this._w;
        }), __getset(0, __proto, "height", function() {
            return this._h;
        }), __getset(0, __proto, "source", function() {
            return this._source;
        }), Bitmap;
    }(), AnimationPlayerBase = function(_super) {
        function AnimationPlayerBase() {
            this.loop = !1, this.wrapMode = 0, this._index = 0, this._count = 0, this._isPlaying = !1, 
            this._labels = null, this._isReverse = !1, this._frameRateChanged = !1, this._controlNode = null, 
            this._actionName = null, AnimationPlayerBase.__super.call(this), this._interval = Config.animationInterval, 
            this._setUpNoticeType(1);
        }
        __class(AnimationPlayerBase, "laya.display.AnimationPlayerBase", _super);
        var __proto = AnimationPlayerBase.prototype;
        return __proto.play = function(start, loop, name, showWarn) {
            void 0 === start && (start = 0), void 0 === loop && (loop = !0), void 0 === name && (name = ""), 
            void 0 === showWarn && (showWarn = !0), this._isPlaying = !0, this.index = "string" == typeof start ? this._getFrameByLabel(start) : start, 
            this.loop = loop, this._actionName = name, this._isReverse = 1 == this.wrapMode, 
            0 < this.interval && this.timerLoop(this.interval, this, this._frameLoop, null, !0, !0);
        }, __proto._getFrameByLabel = function(label) {
            var i = 0;
            for (i = 0; i < this._count; i++) if (this._labels[i] && 0 <= this._labels[i].indexOf(label)) return i;
            return 0;
        }, __proto._frameLoop = function() {
            if (this._isReverse) {
                if (this._index--, this._index < 0) {
                    if (!this.loop) return this._index = 0, this.stop(), void this.event("complete");
                    2 == this.wrapMode ? (this._index = 0 < this._count ? 1 : 0, this._isReverse = !1) : this._index = this._count - 1, 
                    this.event("complete");
                }
            } else if (this._index++, this._index >= this._count) {
                if (!this.loop) return this._index--, this.stop(), void this.event("complete");
                2 == this.wrapMode ? (this._index = 0 <= this._count - 2 ? this._count - 2 : 0, 
                this._isReverse = !0) : this._index = 0, this.event("complete");
            }
            this.index = this._index;
        }, __proto._setControlNode = function(node) {
            this._controlNode && (this._controlNode.off("display", this, this._checkResumePlaying), 
            this._controlNode.off("undisplay", this, this._checkResumePlaying)), (this._controlNode = node) && node != this && (node.on("display", this, this._checkResumePlaying), 
            node.on("undisplay", this, this._checkResumePlaying));
        }, __proto._setDisplay = function(value) {
            _super.prototype._setDisplay.call(this, value), this._checkResumePlaying();
        }, __proto._checkResumePlaying = function() {
            this._isPlaying && (this._controlNode.displayedInStage ? this.play(this._index, this.loop, this._actionName) : this.clearTimer(this, this._frameLoop));
        }, __proto.stop = function() {
            this._isPlaying = !1, this.clearTimer(this, this._frameLoop);
        }, __proto.addLabel = function(label, index) {
            this._labels || (this._labels = {}), this._labels[index] || (this._labels[index] = []), 
            this._labels[index].push(label);
        }, __proto.removeLabel = function(label) {
            if (label) {
                if (this._labels) for (var name in this._labels) this._removeLabelFromLabelList(this._labels[name], label);
            } else this._labels = null;
        }, __proto._removeLabelFromLabelList = function(list, label) {
            if (list) for (var i = list.length - 1; 0 <= i; i--) list[i] == label && list.splice(i, 1);
        }, __proto.gotoAndStop = function(position) {
            this.index = "string" == typeof position ? this._getFrameByLabel(position) : position, 
            this.stop();
        }, __proto._displayToIndex = function(value) {}, __proto.clear = function() {
            this.stop(), this._labels = null;
        }, __getset(0, __proto, "interval", function() {
            return this._interval;
        }, function(value) {
            this._interval != value && (this._frameRateChanged = !0, this._interval = value, 
            this._isPlaying && 0 < value && this.timerLoop(value, this, this._frameLoop, null, !0, !0));
        }), __getset(0, __proto, "isPlaying", function() {
            return this._isPlaying;
        }), __getset(0, __proto, "index", function() {
            return this._index;
        }, function(value) {
            if (this._index = value, this._displayToIndex(value), this._labels && this._labels[value]) for (var tArr = this._labels[value], i = 0, len = tArr.length; i < len; i++) this.event("label", tArr[i]);
        }), __getset(0, __proto, "count", function() {
            return this._count;
        }), AnimationPlayerBase.WRAP_POSITIVE = 0, AnimationPlayerBase.WRAP_REVERSE = 1, 
        AnimationPlayerBase.WRAP_PINGPONG = 2, AnimationPlayerBase;
    }(Sprite), Text = function(_super) {
        function Text() {
            this._clipPoint = null, this._currBitmapFont = null, this._text = null, this._isChanged = !1, 
            this._textWidth = 0, this._textHeight = 0, this._lines = [], this._lineWidths = [], 
            this._startX = NaN, this._startY = NaN, this._lastVisibleLineIndex = -1, this._words = null, 
            this._charSize = {}, this.underline = !1, this._underlineColor = null, Text.__super.call(this), 
            this.overflow = Text.VISIBLE, this._style = new CSSStyle(this), this._style.wordWrap = !1;
        }
        __class(Text, "laya.display.Text", _super);
        var __proto = Text.prototype;
        return __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), _super.prototype.destroy.call(this, destroyChild), 
            this._lines = null, this._words && (this._words.length = 0, this._words = null);
        }, __proto._getBoundPointsM = function(ifRotate) {
            void 0 === ifRotate && (ifRotate = !1);
            var rec = Rectangle.TEMP;
            return rec.setTo(0, 0, this.width, this.height), rec._getBoundPoints();
        }, __proto.getGraphicBounds = function(realSize) {
            void 0 === realSize && (realSize = !1);
            var rec = Rectangle.TEMP;
            return rec.setTo(0, 0, this.width, this.height), rec;
        }, __proto._getCSSStyle = function() {
            return this._style;
        }, __proto.lang = function(text, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) {
            if (text = Text.langPacks && Text.langPacks[text] ? Text.langPacks[text] : text, 
            arguments.length < 2) this._text = text; else {
                for (var i = 0, n = arguments.length; i < n; i++) text = text.replace("{" + i + "}", arguments[i + 1]);
                this._text = text;
            }
        }, __proto._isPassWordMode = function() {
            var password = this._style.password;
            return "prompt" in this && this.prompt == this._text && (password = !1), password;
        }, __proto._getPassWordTxt = function(txt) {
            var word;
            word = "";
            for (var j = txt.length; 0 < j; j--) word += "●";
            return word;
        }, __proto.renderText = function(begin, visibleLineCount) {
            var graphics = this.graphics;
            graphics.clear(!0);
            var ctxFont = (this.italic ? "italic " : "") + (this.bold ? "bold " : "") + this.fontSize + "px " + (Browser.onIPhone && laya.display.Text._fontFamilyMap[this.font] || this.font);
            Browser.context.font = ctxFont;
            var padding = this.padding, startX = padding[3], textAlgin = "left", lines = this._lines, lineHeight = this.leading + this._charSize.height, tCurrBitmapFont = this._currBitmapFont;
            tCurrBitmapFont && (lineHeight = this.leading + tCurrBitmapFont.getMaxHeight());
            var startY = padding[0];
            if (!tCurrBitmapFont && 0 < this._width && this._textWidth <= this._width && ("right" == this.align ? (textAlgin = "right", 
            startX = this._width - padding[1]) : "center" == this.align && (textAlgin = "center", 
            startX = .5 * this._width + padding[3] - padding[1])), 0 < this._height) {
                var tempVAlign = this._textHeight > this._height ? "top" : this.valign;
                "middle" === tempVAlign ? startY = .5 * (this._height - visibleLineCount * lineHeight) + padding[0] - padding[2] : "bottom" === tempVAlign && (startY = this._height - visibleLineCount * lineHeight - padding[2]);
            }
            var style = this._style;
            if (tCurrBitmapFont && tCurrBitmapFont.autoScaleSize) var bitmapScale = tCurrBitmapFont.fontSize / this.fontSize;
            if (this._clipPoint) if (graphics.save(), tCurrBitmapFont && tCurrBitmapFont.autoScaleSize) {
                var tClipWidth = 0, tClipHeight = 0;
                tClipWidth = this._width ? this._width - padding[3] - padding[1] : this._textWidth, 
                tClipHeight = this._height ? this._height - padding[0] - padding[2] : this._textHeight, 
                tClipWidth *= bitmapScale, tClipHeight *= bitmapScale, graphics.clipRect(padding[3], padding[0], tClipWidth, tClipHeight);
            } else graphics.clipRect(padding[3], padding[0], this._width ? this._width - padding[3] - padding[1] : this._textWidth, this._height ? this._height - padding[0] - padding[2] : this._textHeight);
            var password = style.password;
            "prompt" in this && this.prompt == this._text && (password = !1);
            for (var x = 0, y = 0, end = Math.min(this._lines.length, visibleLineCount + begin) || 1, i = begin; i < end; i++) {
                var _word, word = lines[i];
                if (password) {
                    var len = word.length;
                    word = "";
                    for (var j = len; 0 < j; j--) word += "●";
                }
                if (x = startX - (this._clipPoint ? this._clipPoint.x : 0), y = startY + lineHeight * i - (this._clipPoint ? this._clipPoint.y : 0), 
                this.underline && this.drawUnderline(textAlgin, x, y, i), tCurrBitmapFont) {
                    var tWidth = this.width;
                    tCurrBitmapFont.autoScaleSize && (tWidth = this.width * bitmapScale), tCurrBitmapFont.drawText(word, this, x, y, this.align, tWidth);
                } else Render.isWebGL ? (this._words || (this._words = []), (_word = this._words.length > i - begin ? this._words[i - begin] : new WordText()).setText(word)) : _word = word, 
                style.stroke ? graphics.fillBorderText(_word, x, y, ctxFont, this.color, style.strokeColor, style.stroke, textAlgin) : graphics.fillText(_word, x, y, ctxFont, this.color, textAlgin);
            }
            if (tCurrBitmapFont && tCurrBitmapFont.autoScaleSize) {
                var tScale = 1 / bitmapScale;
                this.scale(tScale, tScale);
            }
            this._clipPoint && graphics.restore(), this._startX = startX, this._startY = startY;
        }, __proto.drawUnderline = function(align, x, y, lineIndex) {
            var lineWidth = this._lineWidths[lineIndex];
            switch (align) {
              case "center":
                x -= lineWidth / 2;
                break;

              case "right":
                x -= lineWidth;
            }
            y += this._charSize.height, this._graphics.drawLine(x, y, x + lineWidth, y, this.underlineColor || this.color, 1);
        }, __proto.typeset = function() {
            if (this._isChanged = !1, !this._text) return this._clipPoint = null, this._textWidth = this._textHeight = 0, 
            void this.graphics.clear(!0);
            Browser.context.font = this._getCSSStyle().font, this._lines.length = 0, this._lineWidths.length = 0, 
            this._isPassWordMode() ? this.parseLines(this._getPassWordTxt(this._text)) : this.parseLines(this._text), 
            this.evalTextSize(), this.checkEnabledViewportOrNot() ? this._clipPoint || (this._clipPoint = new Point(0, 0)) : this._clipPoint = null;
            var lineCount = this._lines.length;
            if (this.overflow != Text.VISIBLE) {
                var func = this.overflow == Text.HIDDEN ? Math.floor : Math.ceil;
                lineCount = Math.min(lineCount, func((this.height - this.padding[0] - this.padding[2]) / (this.leading + this._charSize.height)));
            }
            var startLine = this.scrollY / (this._charSize.height + this.leading) | 0;
            this.renderText(startLine, lineCount), this.repaint();
        }, __proto.evalTextSize = function() {
            var nw, nh = NaN;
            nw = Math.max.apply(this, this._lineWidths), nh = this._currBitmapFont ? this._lines.length * (this._currBitmapFont.getMaxHeight() + this.leading) + this.padding[0] + this.padding[2] : this._lines.length * (this._charSize.height + this.leading) + this.padding[0] + this.padding[2], 
            nw == this._textWidth && nh == this._textHeight || (this._textWidth = nw, this._textHeight = nh, 
            this._width && this._height || this.conchModel && this.conchModel.size(this._width || this._textWidth, this._height || this._textHeight));
        }, __proto.checkEnabledViewportOrNot = function() {
            return this.overflow == Text.SCROLL && (0 < this._width && this._textWidth > this._width || 0 < this._height && this._textHeight > this._height);
        }, __proto.changeText = function(text) {
            this._text !== text && (this.lang(text + ""), this._graphics && this._graphics.replaceText(this._text) || this.typeset());
        }, __proto.parseLines = function(text) {
            var needWordWrapOrTruncate = this.wordWrap || this.overflow == Text.HIDDEN;
            if (needWordWrapOrTruncate) var wordWrapWidth = this.getWordWrapWidth();
            if (this._currBitmapFont) this._charSize.width = this._currBitmapFont.getMaxWidth(), 
            this._charSize.height = this._currBitmapFont.getMaxHeight(); else {
                var measureResult = Browser.context.measureText(Text._testWord);
                Render.isConchApp && (!measureResult || 0 === measureResult.width && 0 === measureResult.height) && (measureResult = Browser.context.measureText("W")), 
                this._charSize.width = measureResult ? measureResult.width : this.fontSize, this._charSize.height = measureResult && measureResult.height || this.fontSize;
            }
            for (var lines = text.replace(/\r\n/g, "\n").split("\n"), i = 0, n = lines.length; i < n; i++) {
                var line = lines[i];
                needWordWrapOrTruncate ? this.parseLine(line, wordWrapWidth) : (this._lineWidths.push(this.getTextWidth(line)), 
                this._lines.push(line));
            }
        }, __proto.parseLine = function(line, wordWrapWidth) {
            Browser.context;
            var execResult, lines = this._lines, maybeIndex = 0, charsWidth = NaN, wordWidth = NaN, startIndex = 0;
            if ((charsWidth = this.getTextWidth(line)) <= wordWrapWidth) return lines.push(line), 
            void this._lineWidths.push(charsWidth);
            charsWidth = this._charSize.width, 0 == (maybeIndex = Math.floor(wordWrapWidth / charsWidth)) && (maybeIndex = 1), 
            wordWidth = charsWidth = this.getTextWidth(line.substring(0, maybeIndex));
            for (var j = maybeIndex, m = line.length; j < m; j++) if (wordWrapWidth < (wordWidth += charsWidth = this.getTextWidth(line.charAt(j)))) if (this.wordWrap) {
                var newLine = line.substring(startIndex, j);
                if (newLine.charCodeAt(newLine.length - 1) < 255 ? (execResult = /(?:\w|-)+$/.exec(newLine)) && (j = execResult.index + startIndex, 
                0 == execResult.index ? j += newLine.length : newLine = line.substring(startIndex, j)) : Text.RightToLeft && (execResult = /([\u0600-\u06FF])+$/.exec(newLine)) && (j = execResult.index + startIndex, 
                0 == execResult.index ? j += newLine.length : newLine = line.substring(startIndex, j)), 
                lines.push(newLine), this._lineWidths.push(wordWidth - charsWidth), !((startIndex = j) + maybeIndex < m)) {
                    lines.push(line.substring(startIndex, m)), this._lineWidths.push(this.getTextWidth(lines[lines.length - 1])), 
                    startIndex = -1;
                    break;
                }
                j += maybeIndex, wordWidth = charsWidth = this.getTextWidth(line.substring(startIndex, j)), 
                j--;
            } else if (this.overflow == Text.HIDDEN) return lines.push(line.substring(0, j)), 
            void this._lineWidths.push(this.getTextWidth(lines[lines.length - 1]));
            this.wordWrap && -1 != startIndex && (lines.push(line.substring(startIndex, m)), 
            this._lineWidths.push(this.getTextWidth(lines[lines.length - 1])));
        }, __proto.getTextWidth = function(text) {
            if (this._currBitmapFont) return this._currBitmapFont.getTextWidth(text);
            var t = Browser.context.measureText(text);
            return t ? t.width : text ? text.length * this.fontSize : 0;
        }, __proto.getWordWrapWidth = function() {
            var p = this.padding, w = NaN;
            return (w = this._currBitmapFont && this._currBitmapFont.autoScaleSize ? this._width * (this._currBitmapFont.fontSize / this.fontSize) : this._width) <= 0 && (w = this.wordWrap ? 100 : Browser.width), 
            w <= 0 && (w = 100), w - p[3] - p[1];
        }, __proto.getCharPoint = function(charIndex, out) {
            this._isChanged && Laya.timer.runCallLater(this, this.typeset);
            for (var len = 0, lines = this._lines, startIndex = 0, i = 0, n = lines.length; i < n; i++) {
                if (charIndex < (len += lines[i].length)) {
                    var line = i;
                    break;
                }
                startIndex = len;
            }
            var ctxFont = (this.italic ? "italic " : "") + (this.bold ? "bold " : "") + this.fontSize + "px " + this.font;
            Browser.context.font = ctxFont;
            var width = this.getTextWidth(this._text.substring(startIndex, charIndex));
            return (out || new Point()).setTo(this._startX + width - (this._clipPoint ? this._clipPoint.x : 0), this._startY + line * (this._charSize.height + this.leading) - (this._clipPoint ? this._clipPoint.y : 0));
        }, __getset(0, __proto, "width", function() {
            return this._width ? this._width : this.textWidth + this.padding[1] + this.padding[3];
        }, function(value) {
            value != this._width && (Laya.superSet(Sprite, this, "width", value), this.isChanged = !0);
        }), __getset(0, __proto, "textWidth", function() {
            return this._isChanged && Laya.timer.runCallLater(this, this.typeset), this._textWidth;
        }), __getset(0, __proto, "height", function() {
            return this._height ? this._height : this.textHeight;
        }, function(value) {
            value != this._height && (Laya.superSet(Sprite, this, "height", value), this.isChanged = !0);
        }), __getset(0, __proto, "textHeight", function() {
            return this._isChanged && Laya.timer.runCallLater(this, this.typeset), this._textHeight;
        }), __getset(0, __proto, "padding", function() {
            return this._getCSSStyle().padding;
        }, function(value) {
            this._getCSSStyle().padding = value, this.isChanged = !0;
        }), __getset(0, __proto, "bold", function() {
            return this._getCSSStyle().bold;
        }, function(value) {
            this._getCSSStyle().bold = value, this.isChanged = !0;
        }), __getset(0, __proto, "text", function() {
            return this._text || "";
        }, function(value) {
            this._text !== value && (this.lang(value + ""), this.isChanged = !0, this.event("change"));
        }), __getset(0, __proto, "color", function() {
            return this._getCSSStyle().color;
        }, function(value) {
            this._getCSSStyle().color != value && (this._getCSSStyle().color = value, !this._isChanged && this._graphics ? this._graphics.replaceTextColor(this.color) : this.isChanged = !0);
        }), __getset(0, __proto, "font", function() {
            return this._getCSSStyle().fontFamily;
        }, function(value) {
            this._currBitmapFont && (this._currBitmapFont = null, this.scale(1, 1)), Text._bitmapFonts && Text._bitmapFonts[value] && (this._currBitmapFont = Text._bitmapFonts[value]), 
            this._getCSSStyle().fontFamily = value, this.isChanged = !0;
        }), __getset(0, __proto, "fontSize", function() {
            return this._getCSSStyle().fontSize;
        }, function(value) {
            this._getCSSStyle().fontSize = value, this.isChanged = !0;
        }), __getset(0, __proto, "italic", function() {
            return this._getCSSStyle().italic;
        }, function(value) {
            this._getCSSStyle().italic = value, this.isChanged = !0;
        }), __getset(0, __proto, "align", function() {
            return this._getCSSStyle().align;
        }, function(value) {
            this._getCSSStyle().align = value, this.isChanged = !0;
        }), __getset(0, __proto, "valign", function() {
            return this._getCSSStyle().valign;
        }, function(value) {
            this._getCSSStyle().valign = value, this.isChanged = !0;
        }), __getset(0, __proto, "wordWrap", function() {
            return this._getCSSStyle().wordWrap;
        }, function(value) {
            this._getCSSStyle().wordWrap = value, this.isChanged = !0;
        }), __getset(0, __proto, "leading", function() {
            return this._getCSSStyle().leading;
        }, function(value) {
            this._getCSSStyle().leading = value, this.isChanged = !0;
        }), __getset(0, __proto, "bgColor", function() {
            return this._getCSSStyle().backgroundColor;
        }, function(value) {
            this._getCSSStyle().backgroundColor = value, this.isChanged = !0;
        }), __getset(0, __proto, "borderColor", function() {
            return this._getCSSStyle().borderColor;
        }, function(value) {
            this._getCSSStyle().borderColor = value, this.isChanged = !0;
        }), __getset(0, __proto, "stroke", function() {
            return this._getCSSStyle().stroke;
        }, function(value) {
            this._getCSSStyle().stroke = value, this.isChanged = !0;
        }), __getset(0, __proto, "strokeColor", function() {
            return this._getCSSStyle().strokeColor;
        }, function(value) {
            this._getCSSStyle().strokeColor = value, this.isChanged = !0;
        }), __getset(0, __proto, "isChanged", null, function(value) {
            this._isChanged !== value && (this._isChanged = value) && Laya.timer.callLater(this, this.typeset);
        }), __getset(0, __proto, "scrollX", function() {
            return this._clipPoint ? this._clipPoint.x : 0;
        }, function(value) {
            if (!(this.overflow != Text.SCROLL || this.textWidth < this._width) && this._clipPoint) {
                value = value < this.padding[3] ? this.padding[3] : value;
                var maxScrollX = this._textWidth - this._width;
                value = maxScrollX < value ? maxScrollX : value;
                var visibleLineCount = this._height / (this._charSize.height + this.leading) | 1;
                this._clipPoint.x = value, this.renderText(this._lastVisibleLineIndex, visibleLineCount);
            }
        }), __getset(0, __proto, "scrollY", function() {
            return this._clipPoint ? this._clipPoint.y : 0;
        }, function(value) {
            if (!(this.overflow != Text.SCROLL || this.textHeight < this._height) && this._clipPoint) {
                value = value < this.padding[0] ? this.padding[0] : value;
                var maxScrollY = this._textHeight - this._height, startLine = (value = maxScrollY < value ? maxScrollY : value) / (this._charSize.height + this.leading) | 0;
                this._lastVisibleLineIndex = startLine;
                var visibleLineCount = 1 + (this._height / (this._charSize.height + this.leading) | 0);
                this._clipPoint.y = value, this.renderText(startLine, visibleLineCount);
            }
        }), __getset(0, __proto, "maxScrollX", function() {
            return this.textWidth < this._width ? 0 : this._textWidth - this._width;
        }), __getset(0, __proto, "maxScrollY", function() {
            return this.textHeight < this._height ? 0 : this._textHeight - this._height;
        }), __getset(0, __proto, "lines", function() {
            return this._isChanged && this.typeset(), this._lines;
        }), __getset(0, __proto, "underlineColor", function() {
            return this._underlineColor;
        }, function(value) {
            this._underlineColor = value, this._isChanged = !0, this.typeset();
        }), Text.registerBitmapFont = function(name, bitmapFont) {
            Text._bitmapFonts || (Text._bitmapFonts = {}), Text._bitmapFonts[name] = bitmapFont;
        }, Text.unregisterBitmapFont = function(name, destroy) {
            if (void 0 === destroy && (destroy = !0), Text._bitmapFonts && Text._bitmapFonts[name]) {
                var tBitmapFont = Text._bitmapFonts[name];
                destroy && tBitmapFont.destroy(), delete Text._bitmapFonts[name];
            }
        }, Text.setTextRightToLeft = function() {
            var style;
            (style = Browser.canvas.source.style).display = "none", style.position = "absolute", 
            style.direction = "rtl", Render._mainCanvas.source.style.direction = "rtl", laya.display.Text.RightToLeft = !0, 
            Browser.document.body.appendChild(Browser.canvas.source);
        }, Text.supportFont = function(font) {
            Browser.context.font = "10px sans-serif";
            var defaultFontWidth = Browser.context.measureText("abcji").width;
            Browser.context.font = "10px " + font;
            var customFontWidth = Browser.context.measureText("abcji").width;
            return console.log(defaultFontWidth, customFontWidth), defaultFontWidth !== customFontWidth;
        }, Text._testWord = "游", Text.langPacks = null, Text.VISIBLE = "visible", Text.SCROLL = "scroll", 
        Text.HIDDEN = "hidden", Text.CharacterCache = !0, Text.RightToLeft = !1, Text._bitmapFonts = null, 
        __static(Text, [ "_fontFamilyMap", function() {
            return this._fontFamilyMap = {
                "报隶": "报隶-简",
                "黑体": "黑体-简",
                "楷体": "楷体-简",
                "兰亭黑": "兰亭黑-简",
                "隶变": "隶变-简",
                "凌慧体": "凌慧体-简",
                "翩翩体": "翩翩体-简",
                "苹方": "苹方-简",
                "手札体": "手札体-简",
                "宋体": "宋体-简",
                "娃娃体": "娃娃体-简",
                "魏碑": "魏碑-简",
                "行楷": "行楷-简",
                "雅痞": "雅痞-简",
                "圆体": "圆体-简"
            };
        } ]), Text;
    }(Sprite), Stage = function(_super) {
        function Stage() {
            this.focus = null, this.designWidth = 0, this.designHeight = 0, this.canvasRotation = !1, 
            this.canvasDegree = 0, this.renderingEnabled = !0, this.screenAdaptationEnabled = !0, 
            this._screenMode = "none", this._scaleMode = "noscale", this._alignV = "top", this._alignH = "left", 
            this._bgColor = "black", this._mouseMoveTime = 0, this._renderCount = 0, this._frameStartTime = NaN, 
            this._isFocused = !1, this._isVisibility = !1, this._scenes = null, this._frameRate = "fast", 
            Stage.__super.call(this), this.offset = new Point(), this._canvasTransform = new Matrix(), 
            this._previousOrientation = Browser.window.orientation;
            var _$this = this;
            this.transform = Matrix.create(), this._scenes = [], this.mouseEnabled = !0, this.hitTestPrior = !0, 
            this.autoSize = !1, this._displayedInStage = !0, this._isFocused = !0, this._isVisibility = !0;
            var window = Browser.window, _this = this;
            window.addEventListener("focus", function() {
                _$this._isFocused = !0, _this.event("focus"), _this.event("focuschange");
            }), window.addEventListener("blur", function() {
                _$this._isFocused = !1, _this.event("blur"), _this.event("focuschange"), _this._isInputting() && (Input.inputElement.target.focus = !1);
            });
            var state = "visibilityState", visibilityChange = "visibilitychange", document = window.document;
            void 0 !== document.hidden ? (visibilityChange = "visibilitychange", state = "visibilityState") : void 0 !== document.mozHidden ? (visibilityChange = "mozvisibilitychange", 
            state = "mozVisibilityState") : void 0 !== document.msHidden ? (visibilityChange = "msvisibilitychange", 
            state = "msVisibilityState") : void 0 !== document.webkitHidden && (visibilityChange = "webkitvisibilitychange", 
            state = "webkitVisibilityState"), window.document.addEventListener(visibilityChange, function() {
                "hidden" == Browser.document[state] ? _this._setStageVisible(!1) : _this._setStageVisible(!0);
            }), window.document.addEventListener("qbrowserVisibilityChange", function(e) {
                _this._setStageVisible(!e.hidden);
            }), window.addEventListener("resize", function() {
                var orientation = Browser.window.orientation;
                null != orientation && orientation != _$this._previousOrientation && _this._isInputting() && (Input.inputElement.target.focus = !1), 
                _$this._previousOrientation = orientation, _this._isInputting() || _this._resetCanvas();
            }), window.addEventListener("orientationchange", function(e) {
                _this._resetCanvas();
            }), this.on("mousemove", this, this._onmouseMove), Browser.onMobile && this.on("mousedown", this, this._onmouseMove);
        }
        __class(Stage, "laya.display.Stage", _super);
        var __proto = Stage.prototype;
        return __proto._setStageVisible = function(value) {
            this._isVisibility != value && (this._isVisibility = value, this._isVisibility || this._isInputting() && (Input.inputElement.target.focus = !1), 
            this.event("visibilitychange"));
        }, __proto._isInputting = function() {
            return Browser.onMobile && Input.isInputting;
        }, __proto._changeCanvasSize = function() {
            this.setScreenSize(Browser.clientWidth * Browser.pixelRatio, Browser.clientHeight * Browser.pixelRatio);
        }, __proto._resetCanvas = function() {
            if (this.screenAdaptationEnabled) {
                var canvas = Render._mainCanvas;
                canvas.source.style;
                canvas.size(1, 1), Laya.timer.once(100, this, this._changeCanvasSize);
            }
        }, __proto.setScreenSize = function(screenWidth, screenHeight) {
            var rotation = !1;
            if ("none" !== this._screenMode && (rotation = (screenWidth / screenHeight < 1 ? "vertical" : "horizontal") !== this._screenMode)) {
                var temp = screenHeight;
                screenHeight = screenWidth, screenWidth = temp;
            }
            this.canvasRotation = rotation;
            var canvas = Render._mainCanvas, canvasStyle = canvas.source.style, mat = this._canvasTransform.identity(), scaleMode = this._scaleMode, scaleX = screenWidth / this.designWidth, scaleY = screenHeight / this.designHeight, canvasWidth = this.designWidth, canvasHeight = this.designHeight, realWidth = screenWidth, realHeight = screenHeight, pixelRatio = Browser.pixelRatio;
            switch (this._width = this.designWidth, this._height = this.designHeight, scaleMode) {
              case "noscale":
                scaleX = scaleY = 1, realWidth = this.designWidth, realHeight = this.designHeight;
                break;

              case "showall":
                scaleX = scaleY = Math.min(scaleX, scaleY), canvasWidth = realWidth = Math.round(this.designWidth * scaleX), 
                canvasHeight = realHeight = Math.round(this.designHeight * scaleY);
                break;

              case "noborder":
                scaleX = scaleY = Math.max(scaleX, scaleY), realWidth = Math.round(this.designWidth * scaleX), 
                realHeight = Math.round(this.designHeight * scaleY);
                break;

              case "full":
                scaleX = scaleY = 1, this._width = canvasWidth = screenWidth, this._height = canvasHeight = screenHeight;
                break;

              case "fixedwidth":
                scaleY = scaleX, this._height = canvasHeight = Math.round(screenHeight / scaleX);
                break;

              case "fixedheight":
                scaleX = scaleY, this._width = canvasWidth = Math.round(screenWidth / scaleY);
                break;

              case "fixedauto":
                screenWidth / screenHeight < this.designWidth / this.designHeight ? (scaleY = scaleX, 
                this._height = canvasHeight = Math.round(screenHeight / scaleX)) : (scaleX = scaleY, 
                this._width = canvasWidth = Math.round(screenWidth / scaleY));
            }
            this._height = this._height + 1 & 2147483646, this._width = this._width + 1 & 2147483646, 
            canvasWidth = canvasWidth + 1 & 2147483646, canvasHeight = canvasHeight + 1 & 2147483646, 
            this.conchModel && this.conchModel.size(this._width, this._height), scaleX *= this.scaleX, 
            scaleY *= this.scaleY, 1 === scaleX && 1 === scaleY ? this.transform.identity() : (this.transform.a = this._formatData(scaleX / (realWidth / canvasWidth)), 
            this.transform.d = this._formatData(scaleY / (realHeight / canvasHeight)), this.conchModel && this.conchModel.scale(this.transform.a, this.transform.d)), 
            canvas.size(canvasWidth, canvasHeight), RunDriver.changeWebGLSize(canvasWidth, canvasHeight), 
            mat.scale(realWidth / canvasWidth / pixelRatio, realHeight / canvasHeight / pixelRatio), 
            "left" === this._alignH ? this.offset.x = 0 : "right" === this._alignH ? this.offset.x = (screenWidth - realWidth) / pixelRatio : this.offset.x = .5 * (screenWidth - realWidth) / pixelRatio, 
            "top" === this._alignV ? this.offset.y = 0 : "bottom" === this._alignV ? this.offset.y = (screenHeight - realHeight) / pixelRatio : this.offset.y = .5 * (screenHeight - realHeight) / pixelRatio, 
            this.offset.x = Math.round(this.offset.x), this.offset.y = Math.round(this.offset.y), 
            mat.translate(this.offset.x, this.offset.y), this.canvasDegree = 0, rotation && ("horizontal" === this._screenMode ? (mat.rotate(Math.PI / 2), 
            mat.translate(screenHeight / pixelRatio, 0), this.canvasDegree = 90) : (mat.rotate(-Math.PI / 2), 
            mat.translate(0, screenWidth / pixelRatio), this.canvasDegree = -90)), mat.a = this._formatData(mat.a), 
            mat.d = this._formatData(mat.d), mat.tx = this._formatData(mat.tx), mat.ty = this._formatData(mat.ty), 
            canvasStyle.transformOrigin = canvasStyle.webkitTransformOrigin = canvasStyle.msTransformOrigin = canvasStyle.mozTransformOrigin = canvasStyle.oTransformOrigin = "0px 0px 0px", 
            canvasStyle.transform = canvasStyle.webkitTransform = canvasStyle.msTransform = canvasStyle.mozTransform = canvasStyle.oTransform = "matrix(" + mat.toString() + ")", 
            mat.translate(parseInt(canvasStyle.left) || 0, parseInt(canvasStyle.top) || 0), 
            this.visible = !0, this._repaint = 1, this.event("resize");
        }, __proto._formatData = function(value) {
            return Math.abs(value) < 1e-6 ? 0 : Math.abs(1 - value) < .001 ? 0 < value ? 1 : -1 : value;
        }, __proto.getMousePoint = function() {
            return Point.TEMP.setTo(this.mouseX, this.mouseY);
        }, __proto.repaint = function() {
            this._repaint = 1;
        }, __proto.parentRepaint = function() {}, __proto._loop = function() {
            return this.render(Render.context, 0, 0), !0;
        }, __proto._onmouseMove = function(e) {
            this._mouseMoveTime = Browser.now();
        }, __proto.getTimeFromFrameStart = function() {
            return Browser.now() - this._frameStartTime;
        }, __proto.render = function(context, x, y) {
            if ("sleep" === this._frameRate && !Render.isConchApp) {
                var now = Browser.now();
                if (!(1e3 <= now - this._frameStartTime)) return;
                this._frameStartTime = now;
            }
            if (this._renderCount++, Render.isFlash && this.repaint(), this._style.visible) {
                this._frameStartTime = Browser.now();
                var isFastMode = "slow" !== ("mouse" === this._frameRate ? this._frameStartTime - this._mouseMoveTime < 2e3 ? "fast" : "slow" : this._frameRate), isDoubleLoop = this._renderCount % 2 == 0;
                if (Stat.renderSlow = !isFastMode, isFastMode || isDoubleLoop || Render.isConchApp) {
                    var scene;
                    Stat.loopCount++, MouseManager.instance.runEvent(), Laya.timer._update(), RunDriver.update3DLoop();
                    var i = 0, n = 0;
                    if (Render.isConchNode) for (i = 0, n = this._scenes.length; i < n; i++) (scene = this._scenes[i]) && scene._updateSceneConch(); else for (i = 0, 
                    n = this._scenes.length; i < n; i++) (scene = this._scenes[i]) && scene._updateScene();
                    if (Render.isConchNode) {
                        var customList = Sprite.CustomList;
                        for (i = 0, n = customList.length; i < n; i++) {
                            var customItem = customList[i];
                            customItem.customRender(customItem.customContext, 0, 0);
                        }
                        return;
                    }
                }
                Render.isConchNode || this.renderingEnabled && (isFastMode || !isDoubleLoop || Render.isConchWebGL) && (Render.isWebGL ? (context.clear(), 
                _super.prototype.render.call(this, context, x, y), Stat._show && Stat._sp && Stat._sp.render(context, x, y), 
                RunDriver.clear(this._bgColor), RunDriver.beginFlush(), context.flush(), RunDriver.endFinish(), 
                VectorGraphManager.instance && VectorGraphManager.getInstance().endDispose()) : (RunDriver.clear(this._bgColor), 
                _super.prototype.render.call(this, context, x, y), Stat._show && Stat._sp && Stat._sp.render(context, x, y)));
            } else this._renderCount % 5 == 0 && (Stat.loopCount++, MouseManager.instance.runEvent(), 
            Laya.timer._update());
        }, __proto._requestFullscreen = function() {
            var element = Browser.document.documentElement;
            element.requestFullscreen ? element.requestFullscreen() : element.mozRequestFullScreen ? element.mozRequestFullScreen() : element.webkitRequestFullscreen ? element.webkitRequestFullscreen() : element.msRequestFullscreen && element.msRequestFullscreen();
        }, __proto._fullScreenChanged = function() {
            Laya.stage.event("fullscreenchange");
        }, __proto.exitFullscreen = function() {
            var document = Browser.document;
            document.exitFullscreen ? document.exitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen();
        }, __getset(0, __proto, "clientScaleX", function() {
            return this._transform ? this._transform.getScaleX() : 1;
        }), __getset(0, __proto, "desginHeight", function() {
            return console.debug("desginHeight已经弃用，请使用designHeight代替"), this.designHeight;
        }), __getset(0, __proto, "frameRate", function() {
            return this._frameRate;
        }, function(value) {
            if (this._frameRate = value, Render.isConchApp) switch (this._frameRate) {
              case "slow":
                Browser.window.conch && Browser.window.conchConfig.setSlowFrame && Browser.window.conchConfig.setSlowFrame(!0);
                break;

              case "fast":
                Browser.window.conch && Browser.window.conchConfig.setSlowFrame && Browser.window.conchConfig.setSlowFrame(!1);
                break;

              case "mouse":
                Browser.window.conch && Browser.window.conchConfig.setMouseFrame && Browser.window.conchConfig.setMouseFrame(2e3);
                break;

              case "sleep":
                Browser.window.conch && Browser.window.conchConfig.setLimitFPS && Browser.window.conchConfig.setLimitFPS(1);
                break;

              default:
                throw new Error("Stage:frameRate invalid.");
            }
        }), __getset(0, __proto, "clientScaleY", function() {
            return this._transform ? this._transform.getScaleY() : 1;
        }), __getset(0, __proto, "width", _super.prototype._$get_width, function(value) {
            this.designWidth = value, Laya.superSet(Sprite, this, "width", value), Laya.timer.callLater(this, this._changeCanvasSize);
        }), __getset(0, __proto, "alignH", function() {
            return this._alignH;
        }, function(value) {
            this._alignH = value, Laya.timer.callLater(this, this._changeCanvasSize);
        }), __getset(0, __proto, "isFocused", function() {
            return this._isFocused;
        }), __getset(0, __proto, "height", _super.prototype._$get_height, function(value) {
            this.designHeight = value, Laya.superSet(Sprite, this, "height", value), Laya.timer.callLater(this, this._changeCanvasSize);
        }), __getset(0, __proto, "transform", function() {
            return this._tfChanged && this._adjustTransform(), this._transform = this._transform || Matrix.create();
        }, _super.prototype._$set_transform), __getset(0, __proto, "isVisibility", function() {
            return this._isVisibility;
        }), __getset(0, __proto, "desginWidth", function() {
            return console.debug("desginWidth已经弃用，请使用designWidth代替"), this.designWidth;
        }), __getset(0, __proto, "scaleMode", function() {
            return this._scaleMode;
        }, function(value) {
            this._scaleMode = value, Laya.timer.callLater(this, this._changeCanvasSize);
        }), __getset(0, __proto, "alignV", function() {
            return this._alignV;
        }, function(value) {
            this._alignV = value, Laya.timer.callLater(this, this._changeCanvasSize);
        }), __getset(0, __proto, "bgColor", function() {
            return this._bgColor;
        }, function(value) {
            this._bgColor = value, this.conchModel && this.conchModel.bgColor(value), Render.isWebGL && (value ? Stage._wgColor = Color.create(value)._color : Browser.onMiniGame || (Stage._wgColor = null)), 
            Browser.onLimixiu ? Stage._wgColor = Color.create(value)._color : Render.canvas.style.background = value || "none";
        }), __getset(0, __proto, "mouseX", function() {
            return Math.round(MouseManager.instance.mouseX / this.clientScaleX);
        }), __getset(0, __proto, "mouseY", function() {
            return Math.round(MouseManager.instance.mouseY / this.clientScaleY);
        }), __getset(0, __proto, "screenMode", function() {
            return this._screenMode;
        }, function(value) {
            this._screenMode = value;
        }), __getset(0, __proto, "visible", _super.prototype._$get_visible, function(value) {
            this.visible !== value && (Laya.superSet(Sprite, this, "visible", value), Render._mainCanvas.source.style.visibility = value ? "visible" : "hidden");
        }), __getset(0, __proto, "fullScreenEnabled", null, function(value) {
            var document = Browser.document, canvas = Render.canvas;
            value ? (canvas.addEventListener("mousedown", this._requestFullscreen), canvas.addEventListener("touchstart", this._requestFullscreen), 
            document.addEventListener("fullscreenchange", this._fullScreenChanged), document.addEventListener("mozfullscreenchange", this._fullScreenChanged), 
            document.addEventListener("webkitfullscreenchange", this._fullScreenChanged), document.addEventListener("msfullscreenchange", this._fullScreenChanged)) : (canvas.removeEventListener("mousedown", this._requestFullscreen), 
            canvas.removeEventListener("touchstart", this._requestFullscreen), document.removeEventListener("fullscreenchange", this._fullScreenChanged), 
            document.removeEventListener("mozfullscreenchange", this._fullScreenChanged), document.removeEventListener("webkitfullscreenchange", this._fullScreenChanged), 
            document.removeEventListener("msfullscreenchange", this._fullScreenChanged));
        }), Stage.SCALE_NOSCALE = "noscale", Stage.SCALE_EXACTFIT = "exactfit", Stage.SCALE_SHOWALL = "showall", 
        Stage.SCALE_NOBORDER = "noborder", Stage.SCALE_FULL = "full", Stage.SCALE_FIXED_WIDTH = "fixedwidth", 
        Stage.SCALE_FIXED_HEIGHT = "fixedheight", Stage.SCALE_FIXED_AUTO = "fixedauto", 
        Stage.ALIGN_LEFT = "left", Stage.ALIGN_RIGHT = "right", Stage.ALIGN_CENTER = "center", 
        Stage.ALIGN_TOP = "top", Stage.ALIGN_MIDDLE = "middle", Stage.ALIGN_BOTTOM = "bottom", 
        Stage.SCREEN_NONE = "none", Stage.SCREEN_HORIZONTAL = "horizontal", Stage.SCREEN_VERTICAL = "vertical", 
        Stage.FRAME_FAST = "fast", Stage.FRAME_SLOW = "slow", Stage.FRAME_MOUSE = "mouse", 
        Stage.FRAME_SLEEP = "sleep", Stage.FRAME_MOUSE_THREDHOLD = 2e3, __static(Stage, [ "_wgColor", function() {
            return this._wgColor = [ 0, 0, 0, 1 ];
        } ]), Stage;
    }(Sprite), FileBitmap = (function(_super) {
        function SoundNode() {
            this.url = null, this._channel = null, this._tar = null, this._playEvents = null, 
            this._stopEvents = null, SoundNode.__super.call(this), this.visible = !1, this.on("added", this, this._onParentChange), 
            this.on("removed", this, this._onParentChange);
        }
        __class(SoundNode, "laya.media.SoundNode", Sprite);
        var __proto = SoundNode.prototype;
        __proto._onParentChange = function() {
            this.target = this.parent;
        }, __proto.play = function(loops, complete) {
            void 0 === loops && (loops = 1), isNaN(loops) && (loops = 1), this.url && (this.stop(), 
            this._channel = SoundManager.playSound(this.url, loops, complete));
        }, __proto.stop = function() {
            this._channel && !this._channel.isStopped && this._channel.stop(), this._channel = null;
        }, __proto._setPlayAction = function(tar, event, action, add) {
            void 0 === add && (add = !0), this[action] && tar && (add ? tar.on(event, this, this[action]) : tar.off(event, this, this[action]));
        }, __proto._setPlayActions = function(tar, events, action, add) {
            if (void 0 === add && (add = !0), tar && events) {
                var len, eventArr = events.split(","), i = 0;
                for (len = eventArr.length, i = 0; i < len; i++) this._setPlayAction(tar, eventArr[i], action, add);
            }
        }, __getset(0, __proto, "playEvent", null, function(events) {
            (this._playEvents = events) && this._tar && this._setPlayActions(this._tar, events, "play");
        }), __getset(0, __proto, "target", null, function(tar) {
            this._tar && (this._setPlayActions(this._tar, this._playEvents, "play", !1), this._setPlayActions(this._tar, this._stopEvents, "stop", !1)), 
            this._tar = tar, this._tar && (this._setPlayActions(this._tar, this._playEvents, "play", !0), 
            this._setPlayActions(this._tar, this._stopEvents, "stop", !0));
        }), __getset(0, __proto, "stopEvent", null, function(events) {
            (this._stopEvents = events) && this._tar && this._setPlayActions(this._tar, events, "stop");
        });
    }(), function(_super) {
        function FileBitmap() {
            this._src = null, this._onload = null, this._onerror = null, FileBitmap.__super.call(this);
        }
        __class(FileBitmap, "laya.resource.FileBitmap", Bitmap);
        var __proto = FileBitmap.prototype;
        return __getset(0, __proto, "src", function() {
            return this._src;
        }, function(value) {
            this._src = value;
        }), __getset(0, __proto, "onload", null, function(value) {}), __getset(0, __proto, "onerror", null, function(value) {}), 
        FileBitmap;
    }()), HTMLCanvas = function(_super) {
        function HTMLCanvas(type, canvas) {
            this._is2D = !1, HTMLCanvas.__super.call(this);
            var _$this = this;
            if (this._source = this, "2D" === type || "AUTO" === type && !Render.isWebGL) {
                this._is2D = !0, this._source = canvas || Browser.createElement("canvas"), this._source.id = "HTMLCanvas" + Math.random(), 
                this._w = this._source.width, this._h = this._source.height;
                var o = this;
                o.getContext = function(contextID, other) {
                    if (_$this._ctx) return _$this._ctx;
                    var ctx = _$this._ctx = _$this._source.getContext(contextID, other);
                    return ctx && (ctx._canvas = o, Render.isFlash || Browser.onLimixiu || (ctx.size = function(w, h) {})), 
                    ctx;
                };
            }
            this.lock = !0;
        }
        __class(HTMLCanvas, "laya.resource.HTMLCanvas", Bitmap);
        var __proto = HTMLCanvas.prototype;
        return __proto.clear = function() {
            this._ctx && this._ctx.clear();
        }, __proto.destroy = function() {
            this._ctx && this._ctx.destroy(), this._ctx = null, laya.resource.Resource.prototype.destroy.call(this);
        }, __proto.release = function() {}, __proto._setContext = function(context) {
            this._ctx = context;
        }, __proto.getContext = function(contextID, other) {
            return this._ctx ? this._ctx : this._ctx = HTMLCanvas._createContext(this);
        }, __proto.getMemSize = function() {
            return 0;
        }, __proto.size = function(w, h) {
            (this._w != w || this._h != h || this._source && (this._source.width != w || this._source.height != h)) && (this._w = w, 
            this._h = h, this.memorySize = this._w * this._h * 4, this._ctx && this._ctx.size(w, h), 
            this._source && (this._source.height = h, this._source.width = w));
        }, __proto.getCanvas = function() {
            return this._source;
        }, __proto.toBase64 = function(type, encoderOptions, callBack) {
            if (this._source) if (Render.isConchApp && this._source.toBase64) this._source.toBase64(type, encoderOptions, callBack); else {
                var base64Data = this._source.toDataURL(type, encoderOptions);
                callBack.call(this, base64Data);
            }
        }, __getset(0, __proto, "context", function() {
            return this._ctx;
        }), __getset(0, __proto, "asBitmap", null, function(value) {}), HTMLCanvas.create = function(type, canvas) {
            return new HTMLCanvas(type, canvas);
        }, HTMLCanvas.TYPE2D = "2D", HTMLCanvas.TYPE3D = "3D", HTMLCanvas.TYPEAUTO = "AUTO", 
        HTMLCanvas._createContext = null, HTMLCanvas;
    }(), FrameAnimation = (function(_super) {
        function HTMLSubImage(canvas, offsetX, offsetY, width, height, atlasImage, src, allowMerageInAtlas) {
            throw HTMLSubImage.__super.call(this), new Error("不允许new！");
        }
        __class(HTMLSubImage, "laya.resource.HTMLSubImage", Bitmap), HTMLSubImage.create = function(canvas, offsetX, offsetY, width, height, atlasImage, src, allowMerageInAtlas) {
            return void 0 === allowMerageInAtlas && (allowMerageInAtlas = !1), new HTMLSubImage(canvas, offsetX, offsetY, width, height, atlasImage, src, allowMerageInAtlas);
        };
    }(), function(_super) {
        function Animation() {
            this._frames = null, this._url = null, Animation.__super.call(this), this._setControlNode(this);
        }
        __class(Animation, "laya.display.Animation", _super);
        var __proto = Animation.prototype;
        __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), this.stop(), laya.display.Sprite.prototype.destroy.call(this, destroyChild), 
            this._frames = null, this._labels = null;
        }, __proto.play = function(start, loop, name, showWarn) {
            void 0 === start && (start = 0), void 0 === loop && (loop = !0), void 0 === name && (name = ""), 
            void 0 === showWarn && (showWarn = !0), name && this._setFramesFromCache(name, showWarn), 
            this._isPlaying = !0, this.index = "string" == typeof start ? this._getFrameByLabel(start) : start, 
            this.loop = loop, this._actionName = name, this._isReverse = 1 == this.wrapMode, 
            this._frames && 0 < this.interval && this.timerLoop(this.interval, this, this._frameLoop, null, !0, !0);
        }, __proto._setFramesFromCache = function(name, showWarn) {
            var tAniO;
            return void 0 === showWarn && (showWarn = !1), this._url && (name = this._url + "#" + name), 
            name && Animation.framesMap[name] ? ((tAniO = Animation.framesMap[name]) instanceof Array ? (this._frames = Animation.framesMap[name], 
            this._count = this._frames.length) : (tAniO.nodeRoot && (Animation.framesMap[name] = this._parseGraphicAnimationByData(tAniO), 
            tAniO = Animation.framesMap[name]), this._frames = tAniO.frames, this._count = this._frames.length, 
            this._frameRateChanged || (this._interval = tAniO.interval), this._labels = this._copyLabels(tAniO.labels)), 
            !0) : (showWarn && console.log("ani not found:", name), !1);
        }, __proto._copyLabels = function(labels) {
            if (!labels) return null;
            var rst, key;
            for (key in rst = {}, labels) rst[key] = Utils.copyArray([], labels[key]);
            return rst;
        }, __proto._frameLoop = function() {
            this._style.visible && .01 < this._style.alpha && _super.prototype._frameLoop.call(this);
        }, __proto._displayToIndex = function(value) {
            this._frames && (this.graphics = this._frames[value]);
        }, __proto.clear = function() {
            this.stop(), this.graphics = null, this._frames = null, this._labels = null;
        }, __proto.loadImages = function(urls, cacheName) {
            return void 0 === cacheName && (cacheName = ""), this._url = "", this._setFramesFromCache(cacheName) || (this.frames = Animation.framesMap[cacheName] ? Animation.framesMap[cacheName] : Animation.createFrames(urls, cacheName)), 
            this;
        }, __proto.loadAtlas = function(url, loaded, cacheName) {
            void 0 === cacheName && (cacheName = ""), this._url = "";
            var _this_ = this;
            function onLoaded(loadUrl) {
                url === loadUrl && (_this_.frames = Animation.framesMap[cacheName] ? Animation.framesMap[cacheName] : Animation.createFrames(url, cacheName), 
                loaded && loaded.run());
            }
            return _this_._setFramesFromCache(cacheName) || (Loader.getAtlas(url) ? onLoaded(url) : Laya.loader.load(url, Handler.create(null, onLoaded, [ url ]), null, "atlas")), 
            this;
        }, __proto.loadAnimation = function(url, loaded, atlas) {
            this._url = url;
            return this._actionName || (this._actionName = ""), this._setFramesFromCache("") ? (this._setFramesFromCache(this._actionName, !0), 
            this.index = 0, loaded && loaded.run()) : !atlas || Loader.getAtlas(atlas) ? this._loadAnimationData(url, loaded, atlas) : Laya.loader.load(atlas, Handler.create(this, this._loadAnimationData, [ url, loaded, atlas ]), null, "atlas"), 
            this;
        }, __proto._loadAnimationData = function(url, loaded, atlas) {
            var _$this = this;
            if (!atlas || Loader.getAtlas(atlas)) {
                var _this_ = this;
                Loader.getRes(url) ? onLoaded(url) : Laya.loader.load(url, Handler.create(null, onLoaded, [ url ]), null, "json"), 
                Loader.clearRes(url);
            } else console.warn("atlas load fail:" + atlas);
            function onLoaded(loadUrl) {
                if (Loader.getRes(loadUrl) && url === loadUrl) {
                    var tAniO;
                    if (Animation.framesMap[url + "#"]) _this_._setFramesFromCache(_$this._actionName, !0), 
                    _$this.index = 0, _$this._checkResumePlaying(); else {
                        var aniData = _this_._parseGraphicAnimation(Loader.getRes(url));
                        if (!aniData) return;
                        var defaultO, aniList = aniData.animationList, i = 0, len = aniList.length;
                        for (i = 0; i < len; i++) tAniO = aniList[i], Animation.framesMap[url + "#" + tAniO.name] = tAniO, 
                        defaultO || (defaultO = tAniO);
                        defaultO && (Animation.framesMap[url + "#"] = defaultO, _this_._setFramesFromCache(_$this._actionName, !0), 
                        _$this.index = 0), _$this._checkResumePlaying();
                    }
                    loaded && loaded.run();
                }
            }
        }, __proto._parseGraphicAnimation = function(animationData) {
            return GraphicAnimation.parseAnimationData(animationData);
        }, __proto._parseGraphicAnimationByData = function(animationObject) {
            return GraphicAnimation.parseAnimationByData(animationObject);
        }, __getset(0, __proto, "frames", function() {
            return this._frames;
        }, function(value) {
            (this._frames = value) && (this._count = value.length, this._isPlaying ? this.play(this._index, this.loop, this._actionName) : this.index = this._index);
        }), __getset(0, __proto, "autoPlay", null, function(value) {
            value ? this.play() : this.stop();
        }), __getset(0, __proto, "source", null, function(value) {
            -1 < value.indexOf(".ani") ? this.loadAnimation(value) : -1 < value.indexOf(".json") || -1 < value.indexOf("als") || -1 < value.indexOf("atlas") ? this.loadAtlas(value) : this.loadImages(value.split(","));
        }), __getset(0, __proto, "autoAnimation", null, function(value) {
            this.play(0, !0, value, !1);
        }), Animation.createFrames = function(url, name) {
            var arr, g, i = 0, n = 0;
            if ("string" == typeof url) {
                var atlas = Loader.getAtlas(url);
                if (atlas && atlas.length) for (arr = [], i = 0, n = atlas.length; i < n; i++) (g = new RunDriver.createGraphics()).drawTexture(Loader.getRes(atlas[i]), 0, 0), 
                arr.push(g);
            } else if (url instanceof Array) for (arr = [], i = 0, n = url.length; i < n; i++) (g = new RunDriver.createGraphics()).loadImage(url[i], 0, 0), 
            arr.push(g);
            return name && (Animation.framesMap[name] = arr), arr;
        }, Animation.clearCache = function(key) {
            var val, cache = Animation.framesMap, key2 = key + "#";
            for (val in cache) val !== key && 0 != val.indexOf(key2) || delete Animation.framesMap[val];
        }, Animation.framesMap = {};
    }(AnimationPlayerBase), function(_super) {
        function FrameAnimation() {
            this._targetDic = null, this._animationData = null, this._animationNewFrames = null, 
            FrameAnimation.__super.call(this), null == FrameAnimation._sortIndexFun && (FrameAnimation._sortIndexFun = MathUtil.sortByKey("index", !1, !0));
        }
        __class(FrameAnimation, "laya.display.FrameAnimation", _super);
        var __proto = FrameAnimation.prototype;
        return __proto._setUp = function(targetDic, animationData) {
            this._labels = null, this._animationNewFrames = null, this._targetDic = targetDic, 
            this._animationData = animationData, this.interval = 1e3 / animationData.frameRate, 
            animationData.parsed ? (this._count = animationData.count, this._labels = animationData.labels, 
            this._animationNewFrames = animationData.animationNewFrames) : (this._animationNewFrames = [], 
            this._calculateDatas()), animationData.parsed = !0, animationData.labels = this._labels, 
            animationData.count = this._count, animationData.animationNewFrames = this._animationNewFrames;
        }, __proto.clear = function() {
            _super.prototype.clear.call(this), this._targetDic = null, this._animationData = null;
        }, __proto._displayToIndex = function(value) {
            if (this._animationData) {
                value < 0 && (value = 0), value > this._count && (value = this._count);
                var nodes = this._animationData.nodes, i = 0, len = nodes.length;
                for (i = 0; i < len; i++) this._displayNodeToFrame(nodes[i], value);
            }
        }, __proto._displayNodeToFrame = function(node, frame, targetDic) {
            targetDic || (targetDic = this._targetDic);
            var target = targetDic[node.target];
            if (target) {
                var key, propFrames, value, frames = node.frames, keys = node.keys, i = 0, len = keys.length;
                for (i = 0; i < len; i++) value = (propFrames = frames[key = keys[i]]).length > frame ? propFrames[frame] : propFrames[propFrames.length - 1], 
                target[key] = value;
            }
        }, __proto._calculateDatas = function() {
            if (this._animationData) {
                var tNode, nodes = this._animationData.nodes, i = 0, len = nodes.length;
                for (i = this._count = 0; i < len; i++) tNode = nodes[i], this._calculateNodeKeyFrames(tNode);
                this._count += 1;
            }
        }, __proto._calculateNodeKeyFrames = function(node) {
            var key, tKeyFrames, keyFrames = node.keyframes, target = node.target;
            for (key in node.frames || (node.frames = {}), node.keys ? node.keys.length = 0 : node.keys = [], 
            node.initValues || (node.initValues = {}), keyFrames) tKeyFrames = keyFrames[key], 
            node.frames[key] || (node.frames[key] = []), this._targetDic && this._targetDic[target] && (node.initValues[key] = this._targetDic[target][key]), 
            tKeyFrames.sort(FrameAnimation._sortIndexFun), node.keys.push(key), this._calculateNodePropFrames(tKeyFrames, node.frames[key], key, target);
        }, __proto.resetToInitState = function() {
            if (this._targetDic && this._animationData) {
                var tNode, initValues, nodes = this._animationData.nodes, i = 0, len = nodes.length;
                for (i = 0; i < len; i++) if (initValues = (tNode = nodes[i]).initValues) {
                    var key, target = this._targetDic[tNode.target];
                    if (target) for (key in initValues) target[key] = initValues[key];
                }
            }
        }, __proto._calculateNodePropFrames = function(keyframes, frames, key, target) {
            var i = 0, len = keyframes.length - 1;
            for (frames.length = keyframes[len].index + 1, i = 0; i < len; i++) this._dealKeyFrame(keyframes[i]), 
            this._calculateFrameValues(keyframes[i], keyframes[i + 1], frames);
            0 == len && (frames[keyframes[0].index] = keyframes[0].value, this._animationNewFrames && (this._animationNewFrames[keyframes[0].index] = !0)), 
            this._dealKeyFrame(keyframes[i]);
        }, __proto._dealKeyFrame = function(keyFrame) {
            keyFrame.label && "" != keyFrame.label && this.addLabel(keyFrame.label, keyFrame.index);
        }, __proto._calculateFrameValues = function(startFrame, endFrame, result) {
            var easeFun, i = 0, start = startFrame.index, end = endFrame.index, startValue = startFrame.value, dValue = endFrame.value - startFrame.value, dLen = end - start;
            if (end > this._count && (this._count = end), startFrame.tween) for (null == (easeFun = Ease[startFrame.tweenMethod]) && (easeFun = Ease.linearNone), 
            i = start; i < end; i++) result[i] = easeFun(i - start, startValue, dValue, dLen), 
            this._animationNewFrames && (this._animationNewFrames[i] = !0); else for (i = start; i < end; i++) result[i] = startValue;
            this._animationNewFrames && (this._animationNewFrames[startFrame.index] = !0, this._animationNewFrames[endFrame.index] = !0), 
            result[endFrame.index] = endFrame.value;
        }, FrameAnimation._sortIndexFun = null, FrameAnimation;
    }(AnimationPlayerBase)), Input = function(_super) {
        function Input() {
            this._focus = !1, this._multiline = !1, this._editable = !0, this._restrictPattern = null, 
            this._type = "text", this._prompt = "", this._promptColor = "#A9A9A9", this._originColor = "#000000", 
            this._content = "", Input.__super.call(this), this._maxChars = 1e5, this._width = 100, 
            this._height = 20, this.multiline = !1, this.overflow = Text.SCROLL, this.on("mousedown", this, this._onMouseDown), 
            this.on("undisplay", this, this._onUnDisplay);
        }
        __class(Input, "laya.display.Input", _super);
        var __proto = Input.prototype;
        return __proto.setSelection = function(startIndex, endIndex) {
            this.focus = !0, laya.display.Input.inputElement.selectionStart = startIndex, laya.display.Input.inputElement.selectionEnd = endIndex;
        }, __proto._onUnDisplay = function(e) {
            this.focus = !1;
        }, __proto._onMouseDown = function(e) {
            this.focus = !0;
        }, __proto._syncInputTransform = function() {
            var inputElement = this.nativeInput, transform = Utils.getTransformRelativeToWindow(this, this.padding[3], this.padding[0]), inputWid = this._width - this.padding[1] - this.padding[3], inputHei = this._height - this.padding[0] - this.padding[2];
            Render.isConchApp ? (inputElement.setScale(transform.scaleX, transform.scaleY), 
            inputElement.setSize(inputWid, inputHei), inputElement.setPos(transform.x, transform.y)) : (Input.inputContainer.style.transform = Input.inputContainer.style.webkitTransform = "scale(" + transform.scaleX + "," + transform.scaleY + ") rotate(" + Laya.stage.canvasDegree + "deg)", 
            inputElement.style.width = inputWid + "px", inputElement.style.height = inputHei + "px", 
            Input.inputContainer.style.left = transform.x + "px", Input.inputContainer.style.top = transform.y + "px");
        }, __proto.select = function() {
            this.nativeInput.select && this.nativeInput.select();
        }, __proto._setInputMethod = function() {
            Input.input.parentElement && Input.inputContainer.removeChild(Input.input), Input.area.parentElement && Input.inputContainer.removeChild(Input.area), 
            Input.inputElement = this._multiline ? Input.area : Input.input, Input.inputContainer.appendChild(Input.inputElement), 
            Text.RightToLeft && (Input.inputElement.style.direction = "rtl");
        }, __proto._focusIn = function() {
            laya.display.Input.isInputting = !0;
            var input = this.nativeInput;
            this._focus = !0;
            var cssStyle = input.style;
            cssStyle.whiteSpace = this.wordWrap ? "pre-wrap" : "nowrap", this._setPromptColor(), 
            input.readOnly = !this._editable, Render.isConchApp && (input.setType(this._type), 
            input.setForbidEdit(!this._editable)), input.maxLength = this._maxChars;
            this.padding;
            if (input.type = this._type, input.value = this._content, input.placeholder = this._prompt, 
            Laya.stage.off("keydown", this, this._onKeyDown), Laya.stage.on("keydown", this, this._onKeyDown), 
            (Laya.stage.focus = this).event("focus"), Browser.onPC && input.focus(), !Browser.onMiniGame) {
                this._text;
                this._text = null;
            }
            this.typeset(), input.setColor(this._originColor), input.setFontSize(this.fontSize), 
            input.setFontFace(Browser.onIPhone && Text._fontFamilyMap[this.font] || this.font), 
            Render.isConchApp && input.setMultiAble && input.setMultiAble(this._multiline), 
            cssStyle.lineHeight = this.leading + this.fontSize + "px", cssStyle.fontStyle = this.italic ? "italic" : "normal", 
            cssStyle.fontWeight = this.bold ? "bold" : "normal", cssStyle.textAlign = this.align, 
            cssStyle.padding = "0 0", this._syncInputTransform(), !Render.isConchApp && Browser.onPC && Laya.timer.frameLoop(1, this, this._syncInputTransform);
        }, __proto._setPromptColor = function() {
            (Input.promptStyleDOM = Browser.getElementById("promptStyle")) || ((Input.promptStyleDOM = Browser.createElement("style")).setAttribute("id", "promptStyle"), 
            Browser.document.head.appendChild(Input.promptStyleDOM)), Input.promptStyleDOM.innerText = "input::-webkit-input-placeholder, textarea::-webkit-input-placeholder {color:" + this._promptColor + "}input:-moz-placeholder, textarea:-moz-placeholder {color:" + this._promptColor + "}input::-moz-placeholder, textarea::-moz-placeholder {color:" + this._promptColor + "}input:-ms-input-placeholder, textarea:-ms-input-placeholder {color:" + this._promptColor + "}";
        }, __proto._focusOut = function() {
            laya.display.Input.isInputting = !1, this._focus = !1, this._text = null, this._content = this.nativeInput.value, 
            this._content ? (Laya.superSet(Text, this, "text", this._content), Laya.superSet(Text, this, "color", this._originColor)) : (Laya.superSet(Text, this, "text", this._prompt), 
            Laya.superSet(Text, this, "color", this._promptColor)), Laya.stage.off("keydown", this, this._onKeyDown), 
            Laya.stage.focus = null, this.event("blur"), Render.isConchApp && this.nativeInput.blur(), 
            Browser.onPC && Laya.timer.clear(this, this._syncInputTransform);
        }, __proto._onKeyDown = function(e) {
            13 === e.keyCode && (Browser.onMobile && !this._multiline && (this.focus = !1), 
            this.event("enter"));
        }, __proto.changeText = function(text) {
            this._content = text, this._focus ? (this.nativeInput.value = text || "", this.event("change")) : _super.prototype.changeText.call(this, text);
        }, __getset(0, __proto, "color", _super.prototype._$get_color, function(value) {
            this._focus && this.nativeInput.setColor(value), Laya.superSet(Text, this, "color", this._content ? value : this._promptColor), 
            this._originColor = value;
        }), __getset(0, __proto, "inputElementYAdjuster", function() {
            return console.warn("deprecated: 由于即使设置了该值，在各平台和浏览器之间也不一定一致，inputElementYAdjuster已弃用。"), 
            0;
        }, function(value) {
            console.warn("deprecated: 由于即使设置了该值，在各平台和浏览器之间也不一定一致，inputElementYAdjuster已弃用。");
        }), __getset(0, __proto, "multiline", function() {
            return this._multiline;
        }, function(value) {
            this._multiline = value, this.valign = value ? "top" : "middle";
        }), __getset(0, __proto, "maxChars", function() {
            return this._maxChars;
        }, function(value) {
            value <= 0 && (value = 1e5), this._maxChars = value;
        }), __getset(0, __proto, "text", function() {
            return this._focus ? this.nativeInput.value : this._content || "";
        }, function(value) {
            Laya.superSet(Text, this, "color", this._originColor), value += "", this._focus ? (this.nativeInput.value = value || "", 
            this.event("change")) : (this._multiline || (value = value.replace(/\r?\n/g, "")), 
            (this._content = value) ? Laya.superSet(Text, this, "text", value) : (Laya.superSet(Text, this, "text", this._prompt), 
            Laya.superSet(Text, this, "color", this.promptColor)));
        }), __getset(0, __proto, "nativeInput", function() {
            return this._multiline ? Input.area : Input.input;
        }), __getset(0, __proto, "prompt", function() {
            return this._prompt;
        }, function(value) {
            !this._text && value && Laya.superSet(Text, this, "color", this._promptColor), this.promptColor = this._promptColor, 
            this._text ? Laya.superSet(Text, this, "text", this._text == this._prompt ? value : this._text) : Laya.superSet(Text, this, "text", value), 
            this._prompt = Text.langPacks && Text.langPacks[value] ? Text.langPacks[value] : value;
        }), __getset(0, __proto, "focus", function() {
            return this._focus;
        }, function(value) {
            var input = this.nativeInput;
            this._focus !== value && (value ? (input.target ? input.target._focusOut() : this._setInputMethod(), 
            (input.target = this)._focusIn()) : (input.target = null, this._focusOut(), Browser.document.body.scrollTop = 0, 
            input.blur(), Render.isConchApp ? input.setPos(-1e4, -1e4) : Input.inputContainer.contains(input) && Input.inputContainer.removeChild(input)));
        }), __getset(0, __proto, "restrict", function() {
            return this._restrictPattern ? this._restrictPattern.source : "";
        }, function(pattern) {
            pattern ? (-1 < (pattern = "[^" + pattern + "]").indexOf("^^") && (pattern = pattern.replace("^^", "")), 
            this._restrictPattern = new RegExp(pattern, "g")) : this._restrictPattern = null;
        }), __getset(0, __proto, "editable", function() {
            return this._editable;
        }, function(value) {
            this._editable = value, Render.isConchApp && Input.input.setForbidEdit(!value);
        }), __getset(0, __proto, "promptColor", function() {
            return this._promptColor;
        }, function(value) {
            this._promptColor = value, this._content || Laya.superSet(Text, this, "color", value);
        }), __getset(0, __proto, "type", function() {
            return this._type;
        }, function(value) {
            this._getCSSStyle().password = "password" == value, this._type = value, Render.isConchApp && this.nativeInput.setType(value);
        }), __getset(0, __proto, "inputElementXAdjuster", function() {
            return console.warn("deprecated: 由于即使设置了该值，在各平台和浏览器之间也不一定一致，inputElementXAdjuster已弃用。"), 
            0;
        }, function(value) {
            console.warn("deprecated: 由于即使设置了该值，在各平台和浏览器之间也不一定一致，inputElementXAdjuster已弃用。");
        }), __getset(0, __proto, "asPassword", function() {
            return this._getCSSStyle().password;
        }, function(value) {
            this._getCSSStyle().password = value, this._type = "password", console.warn('deprecated: 使用type="password"替代设置asPassword, asPassword将在下次重大更新时删去'), 
            this.isChanged = !0;
        }), Input.__init__ = function() {
            Input._createInputElement(), Browser.onMobile && Render.canvas.addEventListener(Input.IOS_IFRAME ? Browser.onMiniGame ? "touchend" : "click" : "touchend", Input._popupInputMethod);
        }, Input._popupInputMethod = function(e) {
            laya.display.Input.isInputting && laya.display.Input.inputElement.focus();
        }, Input._createInputElement = function() {
            Input._initInput(Input.area = Browser.createElement("textarea")), Input._initInput(Input.input = Browser.createElement("input")), 
            (Input.inputContainer = Browser.createElement("div")).style.position = "absolute", 
            Input.inputContainer.style.zIndex = 1e5, Browser.container.appendChild(Input.inputContainer), 
            Input.inputContainer.setPos = function(x, y) {
                Input.inputContainer.style.left = x + "px", Input.inputContainer.style.top = y + "px";
            };
        }, Input._initInput = function(input) {
            var style = input.style;
            style.cssText = "position:absolute;overflow:hidden;resize:none;transform-origin:0 0;-webkit-transform-origin:0 0;-moz-transform-origin:0 0;-o-transform-origin:0 0;", 
            style.resize = "none", style.backgroundColor = "transparent", style.border = "none", 
            style.outline = "none", style.zIndex = 1, input.addEventListener("input", Input._processInputting), 
            input.addEventListener("mousemove", Input._stopEvent), input.addEventListener("mousedown", Input._stopEvent), 
            input.addEventListener("touchmove", Input._stopEvent), input.setFontFace = function(fontFace) {
                input.style.fontFamily = fontFace;
            }, Render.isConchApp || (input.setColor = function(color) {
                input.style.color = color;
            }, input.setFontSize = function(fontSize) {
                input.style.fontSize = fontSize + "px";
            });
        }, Input._processInputting = function(e) {
            var input = laya.display.Input.inputElement.target;
            if (input) {
                var value = laya.display.Input.inputElement.value;
                input._restrictPattern && (value = value.replace(/\u2006|\x27/g, ""), input._restrictPattern.test(value) && (value = value.replace(input._restrictPattern, ""), 
                laya.display.Input.inputElement.value = value)), input._text = value, input.event("input");
            }
        }, Input._stopEvent = function(e) {
            "touchmove" == e.type && e.preventDefault(), e.stopPropagation && e.stopPropagation();
        }, Input.TYPE_TEXT = "text", Input.TYPE_PASSWORD = "password", Input.TYPE_EMAIL = "email", 
        Input.TYPE_URL = "url", Input.TYPE_NUMBER = "number", Input.TYPE_RANGE = "range", 
        Input.TYPE_DATE = "date", Input.TYPE_MONTH = "month", Input.TYPE_WEEK = "week", 
        Input.TYPE_TIME = "time", Input.TYPE_DATE_TIME = "datetime", Input.TYPE_DATE_TIME_LOCAL = "datetime-local", 
        Input.TYPE_SEARCH = "search", Input.input = null, Input.area = null, Input.inputElement = null, 
        Input.inputContainer = null, Input.confirmButton = null, Input.promptStyleDOM = null, 
        Input.inputHeight = 45, Input.isInputting = !1, Input.stageMatrix = null, __static(Input, [ "IOS_IFRAME", function() {
            return this.IOS_IFRAME = Browser.onIOS && Browser.window.top != Browser.window.self;
        } ]), Input;
    }(Text), HTMLImage = function(_super) {
        function HTMLImage(src, def) {
            this._recreateLock = !1, this._needReleaseAgain = !1, this._enableMerageInAtlas = !0, 
            HTMLImage.__super.call(this), this._init_(src, def);
        }
        __class(HTMLImage, "laya.resource.HTMLImage", FileBitmap);
        var __proto = HTMLImage.prototype;
        return __proto._init_ = function(src, def) {
            this._src = src, this._source = new Browser.window.Image(), def && (def.onload && (this.onload = def.onload), 
            def.onerror && (this.onerror = def.onerror), def.onCreate && def.onCreate(this)), 
            0 != src.indexOf("data:image") && (this._source.crossOrigin = ""), src && (this._source.src = src);
        }, __proto.recreateResource = function() {
            var _$this = this;
            if ("" === this._src) throw new Error("src no null！");
            if (this._needReleaseAgain = !1, this._source) {
                if (this._recreateLock) return;
                this.memorySize = this._w * this._h * 4, this._recreateLock = !1, this.completeCreate();
            } else {
                this._recreateLock = !0;
                var _this = this;
                this._source = new Browser.window.Image(), this._source.crossOrigin = "", this._source.onload = function() {
                    if (_this._needReleaseAgain) return _this._needReleaseAgain = !1, _this._source.onload = null, 
                    void (_this._source = null);
                    _this._source.onload = null, _this.memorySize = _$this._w * _$this._h * 4, _this._recreateLock = !1, 
                    _this.completeCreate();
                }, this._source.src = this._src;
            }
        }, __proto.disposeResource = function() {
            this._recreateLock && (this._needReleaseAgain = !0), this._source && (this._source = null, 
            this.memorySize = 0);
        }, __proto.onresize = function() {
            this._w = this._source.width, this._h = this._source.height;
        }, __getset(0, __proto, "onload", null, function(value) {
            var _$this = this;
            this._onload = value, this._source && (this._source.onload = null != this._onload ? function() {
                _$this.onresize(), _$this._onload();
            } : null);
        }), __getset(0, __proto, "onerror", null, function(value) {
            var _$this = this;
            this._onerror = value, this._source && (this._source.onerror = null != this._onerror ? function() {
                _$this._onerror();
            } : null);
        }), __getset(0, __proto, "enableMerageInAtlas", function() {
            return this._enableMerageInAtlas;
        }, function(value) {
            this._enableMerageInAtlas = value, Render.isConchApp && this._source && (this._source.enableMerageInAtlas = value);
        }), HTMLImage.create = function(src, def) {
            return new HTMLImage(src, def);
        }, HTMLImage;
    }(), GraphicAnimation = (function(_super) {
        function EffectAnimation() {
            this._target = null, this._playEvents = null, this._initData = {}, this._aniKeys = null, 
            this._effectClass = null, EffectAnimation.__super.call(this);
        }
        __class(EffectAnimation, "laya.display.EffectAnimation", _super);
        var __proto = EffectAnimation.prototype;
        __proto._onOtherBegin = function(effect) {
            effect != this && this.stop();
        }, __proto.addEvent = function() {
            this._target && this._playEvents && (this._setControlNode(this._target), this._target.on(this._playEvents, this, this._onPlayAction));
        }, __proto._onPlayAction = function() {
            this.play(0, !1);
        }, __proto.play = function(start, loop, name, showWarn) {
            void 0 === start && (start = 0), void 0 === loop && (loop = !0), void 0 === name && (name = ""), 
            void 0 === showWarn && (showWarn = !0), this._target && (this._target.event("effectanimationbegin", [ this ]), 
            this._recordInitData(), laya.display.AnimationPlayerBase.prototype.play.call(this, start, loop, name, showWarn));
        }, __proto._recordInitData = function() {
            if (this._aniKeys) {
                var len, key, i = 0;
                for (len = this._aniKeys.length, i = 0; i < len; i++) key = this._aniKeys[i], this._initData[key] = this._target[key];
            }
        }, __proto._displayToIndex = function(value) {
            if (this._animationData) {
                value < 0 && (value = 0), value > this._count && (value = this._count);
                var nodes = this._animationData.nodes, i = 0, len = nodes.length;
                for (len = 1 < len ? 1 : len, i = 0; i < len; i++) this._displayNodeToFrame(nodes[i], value);
            }
        }, __proto._displayNodeToFrame = function(node, frame, targetDic) {
            if (this._target) {
                var target;
                target = this._target;
                var key, propFrames, value, secondFrames, frames = node.frames, keys = node.keys, i = 0, len = keys.length;
                secondFrames = node.secondFrames;
                var easeFun, tKeyFrames, startFrame, endFrame, tSecondFrame = 0;
                for (i = 0; i < len; i++) propFrames = frames[key = keys[i]], value = -1 == (tSecondFrame = secondFrames[key]) ? this._initData[key] : frame < tSecondFrame ? (startFrame = (tKeyFrames = node.keyframes[key])[0]).tween ? (null == (easeFun = Ease[startFrame.tweenMethod]) && (easeFun = Ease.linearNone), 
                endFrame = tKeyFrames[1], easeFun(frame, this._initData[key], endFrame.value - this._initData[key], endFrame.index)) : this._initData[key] : propFrames.length > frame ? propFrames[frame] : propFrames[propFrames.length - 1], 
                target[key] = value;
            }
        }, __proto._calculateNodeKeyFrames = function(node) {
            _super.prototype._calculateNodeKeyFrames.call(this, node);
            var key, tKeyFrames, secondFrames, keyFrames = node.keyframes;
            node.target;
            for (key in secondFrames = {}, node.secondFrames = secondFrames, keyFrames) (tKeyFrames = keyFrames[key]).length <= 1 ? secondFrames[key] = -1 : secondFrames[key] = tKeyFrames[1].index;
        }, __getset(0, __proto, "target", function() {
            return this._target;
        }, function(v) {
            this._target && this._target.off("effectanimationbegin", this, this._onOtherBegin), 
            this._target = v, this._target && this._target.on("effectanimationbegin", this, this._onOtherBegin), 
            this.addEvent();
        }), __getset(0, __proto, "playEvent", null, function(event) {
            (this._playEvents = event) && this.addEvent();
        }), __getset(0, __proto, "effectData", null, function(uiData) {
            var aniData;
            uiData && ((aniData = uiData.animations) && aniData[0] && (this._setUp({}, aniData[0]), 
            aniData[0].nodes && aniData[0].nodes[0] && (this._aniKeys = aniData[0].nodes[0].keys)));
        }), __getset(0, __proto, "effectClass", null, function(classStr) {
            var uiData, aniData;
            (this._effectClass = ClassUtils.getClass(classStr), this._effectClass) && ((uiData = this._effectClass.uiView) && (aniData = uiData.animations) && aniData[0] && (this._setUp({}, aniData[0]), 
            aniData[0].nodes && aniData[0].nodes[0] && (this._aniKeys = aniData[0].nodes[0].keys)));
        }), EffectAnimation.EffectAnimationBegin = "effectanimationbegin";
    }(FrameAnimation), function(_super) {
        var GraphicNode;
        function GraphicAnimation() {
            this.animationList = null, this.animationDic = null, this._nodeList = null, this._nodeDefaultProps = null, 
            this._gList = null, this._nodeIDAniDic = {}, this._rootNode = null, this._nodeGDic = null, 
            GraphicAnimation.__super.call(this);
        }
        __class(GraphicAnimation, "laya.utils.GraphicAnimation", _super);
        var __proto = GraphicAnimation.prototype;
        return __proto._parseNodeList = function(uiView) {
            this._nodeList || (this._nodeList = []), this._nodeDefaultProps[uiView.compId] = uiView.props, 
            uiView.compId && this._nodeList.push(uiView.compId);
            var childs = uiView.child;
            if (childs) {
                var i = 0, len = childs.length;
                for (i = 0; i < len; i++) this._parseNodeList(childs[i]);
            }
        }, __proto._calGraphicData = function(aniData) {
            var key;
            if (this._setUp(null, aniData), this._createGraphicData(), this._nodeIDAniDic) for (key in this._nodeIDAniDic) this._nodeIDAniDic[key] = null;
        }, __proto._createGraphicData = function() {
            var preGraphic, gList = [], i = 0, len = this.count, animationDataNew = this._animationNewFrames;
            for (animationDataNew || (animationDataNew = []), i = 0; i < len; i++) !animationDataNew[i] && preGraphic || (preGraphic = this._createFrameGraphic(i)), 
            gList.push(preGraphic);
            this._gList = gList;
        }, __proto._createFrameGraphic = function(frame) {
            var g = RunDriver.createGraphics();
            return GraphicAnimation._rootMatrix || (GraphicAnimation._rootMatrix = new Matrix()), 
            this._updateNodeGraphic(this._rootNode, frame, GraphicAnimation._rootMatrix, g), 
            g;
        }, __proto._updateNodeGraphic = function(node, frame, parentTransfrom, g, alpha) {
            var tNodeG;
            void 0 === alpha && (alpha = 1);
            var tResultTransform, tTex, childs, tGraphicAlpha = (tNodeG = this._nodeGDic[node.compId] = this._getNodeGraphicData(node.compId, frame, this._nodeGDic[node.compId])).alpha * alpha;
            if (!(tGraphicAlpha < .01) && (tNodeG.resultTransform || (tNodeG.resultTransform = Matrix.create()), 
            tResultTransform = tNodeG.resultTransform, Matrix.mul(tNodeG.transform, parentTransfrom, tResultTransform), 
            tNodeG.skin && (tTex = this._getTextureByUrl(tNodeG.skin)) && (tResultTransform._checkTransform() ? (g.drawTexture(tTex, 0, 0, tNodeG.width, tNodeG.height, tResultTransform, tGraphicAlpha), 
            tNodeG.resultTransform = null) : g.drawTexture(tTex, tResultTransform.tx, tResultTransform.ty, tNodeG.width, tNodeG.height, null, tGraphicAlpha)), 
            childs = node.child)) {
                var len, i = 0;
                for (len = childs.length, i = 0; i < len; i++) this._updateNodeGraphic(childs[i], frame, tResultTransform, g, tGraphicAlpha);
            }
        }, __proto._updateNoChilds = function(tNodeG, g) {
            if (tNodeG.skin) {
                var tTex = this._getTextureByUrl(tNodeG.skin);
                if (tTex) {
                    var tTransform = tNodeG.transform;
                    tTransform._checkTransform();
                    !tTransform.bTransform ? g.drawTexture(tTex, tTransform.tx, tTransform.ty, tNodeG.width, tNodeG.height, null, tNodeG.alpha) : g.drawTexture(tTex, 0, 0, tNodeG.width, tNodeG.height, tTransform.clone(), tNodeG.alpha);
                }
            }
        }, __proto._updateNodeGraphic2 = function(node, frame, g) {
            var tNodeG;
            if (tNodeG = this._nodeGDic[node.compId] = this._getNodeGraphicData(node.compId, frame, this._nodeGDic[node.compId]), 
            node.child) {
                var tTransform = tNodeG.transform;
                tTransform._checkTransform();
                var onlyTranslate, hasTrans;
                hasTrans = (onlyTranslate = !tTransform.bTransform) && (0 != tTransform.tx || 0 != tTransform.ty);
                var ifSave, childs, tTex;
                if ((ifSave = tTransform.bTransform || 1 != tNodeG.alpha) && g.save(), 1 != tNodeG.alpha && g.alpha(tNodeG.alpha), 
                onlyTranslate ? hasTrans && g.translate(tTransform.tx, tTransform.ty) : g.transform(tTransform.clone()), 
                childs = node.child, tNodeG.skin && (tTex = this._getTextureByUrl(tNodeG.skin)) && g.drawTexture(tTex, 0, 0, tNodeG.width, tNodeG.height), 
                childs) {
                    var len, i = 0;
                    for (len = childs.length, i = 0; i < len; i++) this._updateNodeGraphic2(childs[i], frame, g);
                }
                ifSave ? g.restore() : onlyTranslate ? hasTrans && g.translate(-tTransform.tx, -tTransform.ty) : g.transform(tTransform.clone().invert());
            } else this._updateNoChilds(tNodeG, g);
        }, __proto._calculateNodeKeyFrames = function(node) {
            _super.prototype._calculateNodeKeyFrames.call(this, node), this._nodeIDAniDic[node.target] = node;
        }, __proto.getNodeDataByID = function(nodeID) {
            return this._nodeIDAniDic[nodeID];
        }, __proto._getParams = function(obj, params, frame, obj2) {
            var rst = GraphicAnimation._temParam;
            rst.length = params.length;
            var i = 0, len = params.length;
            for (i = 0; i < len; i++) rst[i] = this._getObjVar(obj, params[i][0], frame, params[i][1], obj2);
            return rst;
        }, __proto._getObjVar = function(obj, key, frame, noValue, obj2) {
            if (obj.hasOwnProperty(key)) {
                var vArr = obj[key];
                if (frame >= vArr.length && (frame = vArr.length - 1), null != obj[key][frame]) return obj[key][frame];
            }
            return obj2.hasOwnProperty(key) ? obj2[key] : noValue;
        }, __proto._getNodeGraphicData = function(nodeID, frame, rst) {
            rst || (rst = GraphicNode.create()), rst.transform ? rst.transform.identity() : rst.transform = Matrix.create();
            var node = this.getNodeDataByID(nodeID);
            if (!node) return rst;
            var tex, m, frameData = node.frames, params = this._getParams(frameData, GraphicAnimation._drawTextureCmd, frame, this._nodeDefaultProps[nodeID]), url = params[0], width = NaN, height = NaN, px = params[5], py = params[6], aX = params[13], aY = params[14], sx = params[7], sy = params[8], rotate = params[9], skewX = params[11], skewY = params[12];
            width = params[3], height = params[4], 0 != width && 0 != height || (url = null), 
            -1 == width && (width = 0), -1 == height && (height = 0), rst.skin = url, rst.width = width, 
            rst.height = height, url && ((tex = this._getTextureByUrl(url)) ? (width || (width = tex.sourceWidth), 
            height || (height = tex.sourceHeight)) : console.warn("lost skin:", url, ",you may load pics first")), 
            rst.alpha = params[10], m = rst.transform, 0 != aX && (px = aX * width), 0 != aY && (py = aY * height), 
            0 == px && 0 == py || m.translate(-px, -py);
            var tm = null;
            if (rotate || 1 !== sx || 1 !== sy || skewX || skewY) {
                (tm = GraphicAnimation._tempMt).identity(), tm.bTransform = !0;
                var skx = .0174532922222222 * (rotate - skewX), sky = .0174532922222222 * (rotate + skewY), cx = Math.cos(sky), ssx = Math.sin(sky), cy = Math.sin(skx), ssy = Math.cos(skx);
                tm.a = sx * cx, tm.b = sx * ssx, tm.c = -sy * cy, tm.d = sy * ssy, tm.tx = tm.ty = 0;
            }
            return tm && (m = Matrix.mul(m, tm, m)), m.translate(params[1], params[2]), rst;
        }, __proto._getTextureByUrl = function(url) {
            return Loader.getRes(url);
        }, __proto.setAniData = function(uiView, aniName) {
            if (uiView.animations) {
                this._nodeDefaultProps = {}, this._nodeGDic = {}, this._nodeList && (this._nodeList.length = 0), 
                this._rootNode = uiView, this._parseNodeList(uiView);
                var tAniO, aniDic = {}, anilist = [], animations = uiView.animations, i = 0, len = animations.length;
                for (i = 0; i < len; i++) if (tAniO = animations[i], this._labels = null, (!aniName || aniName == tAniO.name) && tAniO) {
                    try {
                        this._calGraphicData(tAniO);
                    } catch (e) {
                        e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                        console.warn("parse animation fail:" + tAniO.name + ",empty animation created"), 
                        this._gList = [];
                    }
                    var frameO = {};
                    frameO.interval = 1e3 / tAniO.frameRate, frameO.frames = this._gList, frameO.labels = this._labels, 
                    frameO.name = tAniO.name, anilist.push(frameO), aniDic[tAniO.name] = frameO;
                }
                this.animationList = anilist, this.animationDic = aniDic;
            }
            GraphicAnimation._temParam.length = 0;
        }, __proto.parseByData = function(aniData) {
            var rootNode, aniO;
            rootNode = aniData.nodeRoot, aniO = aniData.aniO, delete aniData.nodeRoot, delete aniData.aniO, 
            this._nodeDefaultProps = {}, this._nodeGDic = {}, this._nodeList && (this._nodeList.length = 0), 
            this._rootNode = rootNode, this._parseNodeList(rootNode), this._labels = null;
            try {
                this._calGraphicData(aniO);
            } catch (e) {
                e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                console.warn("parse animation fail:" + aniO.name + ",empty animation created"), 
                this._gList = [];
            }
            var frameO = aniData;
            return frameO.interval = 1e3 / aniO.frameRate, frameO.frames = this._gList, frameO.labels = this._labels, 
            frameO.name = aniO.name, frameO;
        }, __proto.setUpAniData = function(uiView) {
            if (uiView.animations) {
                var tAniO, aniDic = {}, anilist = [], animations = uiView.animations, i = 0, len = animations.length;
                for (i = 0; i < len; i++) if (tAniO = animations[i]) {
                    var frameO = {};
                    frameO.name = tAniO.name, frameO.aniO = tAniO, frameO.nodeRoot = uiView, anilist.push(frameO), 
                    aniDic[tAniO.name] = frameO;
                }
                this.animationList = anilist, this.animationDic = aniDic;
            }
        }, __proto._clear = function() {
            var key, tGNode;
            if (this.animationList = null, this.animationDic = null, this._gList = null, this._nodeGDic) for (key in this._nodeGDic) (tGNode = this._nodeGDic[key]) && tGNode.recover();
            this._nodeGDic = null;
        }, GraphicAnimation.parseAnimationByData = function(animationObject) {
            var rst;
            return GraphicAnimation._I || (GraphicAnimation._I = new GraphicAnimation()), rst = GraphicAnimation._I.parseByData(animationObject), 
            GraphicAnimation._I._clear(), rst;
        }, GraphicAnimation.parseAnimationData = function(aniData) {
            var rst;
            return GraphicAnimation._I || (GraphicAnimation._I = new GraphicAnimation()), GraphicAnimation._I.setUpAniData(aniData), 
            (rst = {}).animationList = GraphicAnimation._I.animationList, rst.animationDic = GraphicAnimation._I.animationDic, 
            GraphicAnimation._I._clear(), rst;
        }, GraphicAnimation._drawTextureCmd = [ [ "skin", null ], [ "x", 0 ], [ "y", 0 ], [ "width", -1 ], [ "height", -1 ], [ "pivotX", 0 ], [ "pivotY", 0 ], [ "scaleX", 1 ], [ "scaleY", 1 ], [ "rotation", 0 ], [ "alpha", 1 ], [ "skewX", 0 ], [ "skewY", 0 ], [ "anchorX", 0 ], [ "anchorY", 0 ] ], 
        GraphicAnimation._temParam = [], GraphicAnimation._I = null, GraphicAnimation._rootMatrix = null, 
        __static(GraphicAnimation, [ "_tempMt", function() {
            return this._tempMt = new Matrix();
        } ]), GraphicAnimation.__init$ = function() {
            GraphicNode = function() {
                function GraphicNode() {
                    this.skin = null, this.transform = null, this.resultTransform = null, this.width = NaN, 
                    this.height = NaN, this.alpha = 1;
                }
                return __class(GraphicNode, ""), GraphicNode.prototype.recover = function() {
                    this.skin = null, this.width = 0, this.height = 0, this.alpha = 1, this.transform && (this.transform.destroy(), 
                    this.transform = null), this.resultTransform && (this.resultTransform.destroy(), 
                    this.resultTransform = null), Pool.recover("GraphicNode", this);
                }, GraphicNode.create = function() {
                    return Pool.getItemByClass("GraphicNode", GraphicNode);
                }, GraphicNode;
            }();
        }, GraphicAnimation;
    }(FrameAnimation));
    Laya.__init([ EventDispatcher, LoaderManager, Render, Browser, Timer, LocalStorage, TimeLine, GraphicAnimation ]);
}(window, document, Laya), function(window, document, Laya) {
    Laya.un, Laya.uns, Laya.static;
    var __class = Laya.class;
    Laya.getset, Laya.__newvec;
    new (function() {
        function LayaMain() {}
        return __class(LayaMain, "LayaMain"), LayaMain;
    }())();
}(window, document, Laya), "function" == typeof define && define.amd && define("laya.core", [ "arequire", "exports" ], function(arequire, exports) {
    "use strict";
    for (var i in Object.defineProperty(exports, "__esModule", {
        value: !0
    }), Laya) {
        var o = Laya[i];
        o && o.__isclass && (exports[i] = o);
    }
}), function(window, document, Laya) {
    Laya.un, Laya.uns;
    var __static = Laya.static, __class = Laya.class, __getset = Laya.getset, __newvec = Laya.__newvec, Arith = laya.maths.Arith, Bezier = laya.maths.Bezier, Bitmap = laya.resource.Bitmap, Browser = laya.utils.Browser, Byte = laya.utils.Byte, Color = laya.utils.Color, Config = (laya.filters.ColorFilter, 
    Laya.Config), Context = laya.resource.Context, Filter = (laya.events.Event, laya.filters.Filter), Graphics = laya.display.Graphics, HTMLCanvas = laya.resource.HTMLCanvas, HTMLImage = (laya.utils.HTMLChar, 
    laya.resource.HTMLImage), HTMLSubImage = laya.resource.HTMLSubImage, Matrix = (laya.utils.Handler, 
    laya.net.Loader, laya.maths.Matrix), Point = laya.maths.Point, Rectangle = laya.maths.Rectangle, Render = laya.renders.Render, RenderSprite = (laya.renders.RenderContext, 
    laya.renders.RenderSprite), Resource = laya.resource.Resource, ResourceManager = laya.resource.ResourceManager, RunDriver = laya.utils.RunDriver, Sprite = laya.display.Sprite, Stage = laya.display.Stage, Stat = laya.utils.Stat, StringKey = laya.utils.StringKey, System = (laya.display.css.Style, 
    laya.system.System), Text = laya.display.Text, Texture = laya.resource.Texture, Utils = (laya.display.css.TransformInfo, 
    laya.net.URL, laya.utils.Utils), VectorGraphManager = laya.utils.VectorGraphManager;
    laya.utils.WordText;
    Laya.interface("laya.webgl.shapes.IShape"), Laya.interface("laya.webgl.submit.ISubmit"), 
    Laya.interface("laya.webgl.text.ICharSegment"), Laya.interface("laya.webgl.canvas.save.ISaveData"), 
    Laya.interface("laya.webgl.resource.IMergeAtlasBitmap"), Laya.interface("laya.filters.IFilterActionGL", "laya.filters.IFilterAction");
    var FilterActionGL = function() {
        function FilterActionGL() {}
        __class(FilterActionGL, "laya.filters.webgl.FilterActionGL");
        var __proto = FilterActionGL.prototype;
        return Laya.imps(__proto, {
            "laya.filters.IFilterActionGL": !0
        }), __proto.setValue = function(shader) {}, __proto.setValueMix = function(shader) {}, 
        __proto.apply3d = function(scope, sprite, context, x, y) {
            return null;
        }, __proto.apply = function(srcCanvas) {
            return null;
        }, __getset(0, __proto, "typeMix", function() {
            return 0;
        }), FilterActionGL;
    }(), ShaderValue = function() {
        function ShaderValue() {}
        return __class(ShaderValue, "laya.webgl.shader.ShaderValue"), ShaderValue;
    }(), AtlasGrid = function() {
        var TexRowInfo, TexMergeTexSize;
        function AtlasGrid(width, height, atlasID) {
            this._atlasID = 0, this._width = 0, this._height = 0, this._texCount = 0, this._rowInfo = null, 
            this._cells = null, this._failSize = new TexMergeTexSize(), void 0 === width && (width = 0), 
            void 0 === height && (height = 0), void 0 === atlasID && (atlasID = 0), this._cells = null, 
            this._rowInfo = null, this._init(width, height), this._atlasID = atlasID;
        }
        __class(AtlasGrid, "laya.webgl.atlas.AtlasGrid");
        var __proto = AtlasGrid.prototype;
        return __proto.getAltasID = function() {
            return this._atlasID;
        }, __proto.setAltasID = function(atlasID) {
            0 <= atlasID && (this._atlasID = atlasID);
        }, __proto.addTex = function(type, width, height) {
            var result = this._get(width, height);
            return 0 == result.ret || (this._fill(result.x, result.y, width, height, type), 
            this._texCount++), result;
        }, __proto._release = function() {
            null != this._cells && (this._cells.length = 0, this._cells = null), this._rowInfo && (this._rowInfo.length = 0, 
            this._rowInfo = null);
        }, __proto._init = function(width, height) {
            if (this._width = width, this._height = height, this._release(), 0 == this._width) return !1;
            this._cells = new Uint8Array(this._width * this._height * 3), this._rowInfo = __newvec(this._height);
            for (var i = 0; i < this._height; i++) this._rowInfo[i] = new TexRowInfo();
            return this._clear(), !0;
        }, __proto._get = function(width, height) {
            var pFillInfo = new MergeFillInfo();
            if (width >= this._failSize.width && height >= this._failSize.height) return pFillInfo;
            for (var rx = -1, ry = -1, nWidth = this._width, nHeight = this._height, pCellBox = this._cells, y = 0; y < nHeight; y++) if (!(this._rowInfo[y].spaceCount < width)) for (var x = 0; x < nWidth; ) {
                var tm = 3 * (y * nWidth + x);
                if (0 != pCellBox[tm] || pCellBox[1 + tm] < width || pCellBox[2 + tm] < height) x += pCellBox[1 + tm]; else {
                    rx = x, ry = y;
                    for (var xx = 0; xx < width; xx++) if (pCellBox[3 * xx + tm + 2] < height) {
                        rx = -1;
                        break;
                    }
                    if (!(rx < 0)) return pFillInfo.ret = !0, pFillInfo.x = rx, pFillInfo.y = ry, pFillInfo;
                    x += pCellBox[1 + tm];
                }
            }
            return pFillInfo;
        }, __proto._fill = function(x, y, w, h, type) {
            var nWidth = this._width, nHeghit = this._height;
            this._check(x + w <= nWidth && y + h <= nHeghit);
            for (var yy = y; yy < h + y; ++yy) {
                this._check(this._rowInfo[yy].spaceCount >= w), this._rowInfo[yy].spaceCount -= w;
                for (var xx = 0; xx < w; xx++) {
                    var tm = 3 * (x + yy * nWidth + xx);
                    this._check(0 == this._cells[tm]), this._cells[tm] = type, this._cells[1 + tm] = w, 
                    this._cells[2 + tm] = h;
                }
            }
            if (0 < x) for (yy = 0; yy < h; ++yy) {
                var s = 0;
                for (xx = x - 1; 0 <= xx && 0 == this._cells[3 * ((y + yy) * nWidth + xx)]; --xx, 
                ++s) ;
                for (xx = s; 0 < xx; --xx) this._cells[3 * ((y + yy) * nWidth + x - xx) + 1] = xx, 
                this._check(0 < xx);
            }
            if (0 < y) for (xx = x; xx < x + w; ++xx) {
                for (s = 0, yy = y - 1; 0 <= yy && 0 == this._cells[3 * (xx + yy * nWidth)]; --yy, 
                s++) ;
                for (yy = s; 0 < yy; --yy) this._cells[3 * (xx + (y - yy) * nWidth) + 2] = yy, this._check(0 < yy);
            }
        }, __proto._check = function(ret) {
            0 == ret && console.log("xtexMerger 错误啦");
        }, __proto._clear = function() {
            for (var y = this._texCount = 0; y < this._height; y++) this._rowInfo[y].spaceCount = this._width;
            for (var i = 0; i < this._height; i++) for (var j = 0; j < this._width; j++) {
                var tm = 3 * (i * this._width + j);
                this._cells[tm] = 0, this._cells[1 + tm] = this._width - j, this._cells[2 + tm] = this._width - i;
            }
            this._failSize.width = this._width + 1, this._failSize.height = this._height + 1;
        }, AtlasGrid.__init$ = function() {
            TexRowInfo = function() {
                function TexRowInfo() {
                    this.spaceCount = 0;
                }
                return __class(TexRowInfo, ""), TexRowInfo;
            }(), TexMergeTexSize = function() {
                function TexMergeTexSize() {
                    this.width = 0, this.height = 0;
                }
                return __class(TexMergeTexSize, ""), TexMergeTexSize;
            }();
        }, AtlasGrid;
    }(), AtlasResourceManager = function() {
        function AtlasResourceManager(width, height, gridSize, maxTexNum) {
            this._currentAtlasCount = 0, this._maxAtlaserCount = 0, this._width = 0, this._height = 0, 
            this._gridSize = 0, this._gridNumX = 0, this._gridNumY = 0, this._init = !1, this._curAtlasIndex = 0, 
            this._setAtlasParam = !1, this._atlaserArray = null, this._needGC = !1, this._setAtlasParam = !0, 
            this._width = width, this._height = height, this._gridSize = gridSize, this._maxAtlaserCount = maxTexNum, 
            this._gridNumX = width / gridSize, this._gridNumY = height / gridSize, this._curAtlasIndex = 0, 
            this._atlaserArray = [];
        }
        __class(AtlasResourceManager, "laya.webgl.atlas.AtlasResourceManager");
        var __proto = AtlasResourceManager.prototype;
        return __proto.setAtlasParam = function(width, height, gridSize, maxTexNum) {
            if (1 == this._setAtlasParam) return AtlasResourceManager._sid_ = 0, this._width = width, 
            this._height = height, this._gridSize = gridSize, this._maxAtlaserCount = maxTexNum, 
            this._gridNumX = width / gridSize, this._gridNumY = height / gridSize, this._curAtlasIndex = 0, 
            this.freeAll(), !0;
            throw console.log("设置大图合集参数错误，只能在开始页面设置各种参数"), -1;
        }, __proto.pushData = function(texture) {
            var n, bitmap = texture.bitmap, nWebGLImageIndex = -1, curAtlas = null, i = 0, altasIndex = 0;
            for (i = 0, n = this._atlaserArray.length; i < n && (altasIndex = (this._curAtlasIndex + i) % n, 
            -1 == (nWebGLImageIndex = (curAtlas = this._atlaserArray[altasIndex]).findBitmapIsExist(bitmap))); i++) ;
            if (-1 != nWebGLImageIndex) {
                var offset = curAtlas.InAtlasWebGLImagesOffsetValue[nWebGLImageIndex];
                return offsetX = offset[0], offsetY = offset[1], curAtlas.addToAtlas(texture, offsetX, offsetY), 
                !0;
            }
            this._setAtlasParam = !1;
            for (var nImageGridX = Math.ceil((texture.bitmap.width + 2) / this._gridSize), nImageGridY = Math.ceil((texture.bitmap.height + 2) / this._gridSize), bSuccess = !1, k = 0; k < 2; k++) {
                var maxAtlaserCount = this._maxAtlaserCount;
                for (i = 0; i < maxAtlaserCount; i++) {
                    altasIndex = (this._curAtlasIndex + i) % maxAtlaserCount, this._atlaserArray.length - 1 >= altasIndex || this._atlaserArray.push(new Atlaser(this._gridNumX, this._gridNumY, this._width, this._height, AtlasResourceManager._sid_++));
                    var atlas = this._atlaserArray[altasIndex], offsetX = 0, offsetY = 0, fillInfo = atlas.addTex(1, nImageGridX, nImageGridY);
                    if (fillInfo.ret) {
                        offsetX = fillInfo.x * this._gridSize + 1, offsetY = fillInfo.y * this._gridSize + 1, 
                        bitmap.lock = !0, atlas.addToAtlasTexture(bitmap, offsetX, offsetY), atlas.addToAtlas(texture, offsetX, offsetY), 
                        bSuccess = !0, this._curAtlasIndex = altasIndex;
                        break;
                    }
                }
                if (bSuccess) break;
                this._atlaserArray.push(new Atlaser(this._gridNumX, this._gridNumY, this._width, this._height, AtlasResourceManager._sid_++)), 
                this._needGC = !0, this.garbageCollection(), this._curAtlasIndex = this._atlaserArray.length - 1;
            }
            return bSuccess || console.log(">>>AtlasManager pushData error"), bSuccess;
        }, __proto.addToAtlas = function(tex) {
            laya.webgl.atlas.AtlasResourceManager.instance.pushData(tex);
        }, __proto.garbageCollection = function() {
            if (!0 === this._needGC) {
                for (var n = this._atlaserArray.length - this._maxAtlaserCount, i = 0; i < n; i++) this._atlaserArray[i].dispose(), 
                console.log("AtlasResourceManager:Dispose the inner Atlas。");
                console.log(">>>>altas garbageCollection =" + n), this._atlaserArray.splice(0, n), 
                this._needGC = !1;
            }
            return !0;
        }, __proto.freeAll = function() {
            for (var i = 0, n = this._atlaserArray.length; i < n; i++) this._atlaserArray[i].dispose();
            this._atlaserArray.length = 0, this._curAtlasIndex = 0;
        }, __proto.getAtlaserCount = function() {
            return this._atlaserArray.length;
        }, __proto.getAtlaserByIndex = function(index) {
            return this._atlaserArray[index];
        }, __getset(1, AtlasResourceManager, "instance", function() {
            return AtlasResourceManager._Instance || (AtlasResourceManager._Instance = new AtlasResourceManager(laya.webgl.atlas.AtlasResourceManager.atlasTextureWidth, laya.webgl.atlas.AtlasResourceManager.atlasTextureHeight, 16, laya.webgl.atlas.AtlasResourceManager.maxTextureCount)), 
            AtlasResourceManager._Instance;
        }), __getset(1, AtlasResourceManager, "enabled", function() {
            return Config.atlasEnable;
        }), __getset(1, AtlasResourceManager, "atlasLimitWidth", function() {
            return AtlasResourceManager._atlasLimitWidth;
        }, function(value) {
            AtlasResourceManager._atlasLimitWidth = value;
        }), __getset(1, AtlasResourceManager, "atlasLimitHeight", function() {
            return AtlasResourceManager._atlasLimitHeight;
        }, function(value) {
            AtlasResourceManager._atlasLimitHeight = value;
        }), AtlasResourceManager._enable = function() {
            Config.atlasEnable = !0;
        }, AtlasResourceManager._disable = function() {
            Config.atlasEnable = !1;
        }, AtlasResourceManager.__init__ = function() {
            AtlasResourceManager.atlasTextureWidth = 2048, AtlasResourceManager.atlasTextureHeight = 2048, 
            AtlasResourceManager.maxTextureCount = 6, AtlasResourceManager.atlasLimitWidth = 512, 
            AtlasResourceManager.atlasLimitHeight = 512;
        }, AtlasResourceManager._atlasLimitWidth = 0, AtlasResourceManager._atlasLimitHeight = 0, 
        AtlasResourceManager.gridSize = 16, AtlasResourceManager.atlasTextureWidth = 0, 
        AtlasResourceManager.atlasTextureHeight = 0, AtlasResourceManager.maxTextureCount = 0, 
        AtlasResourceManager._atlasRestore = 0, AtlasResourceManager.BOARDER_TYPE_NO = 0, 
        AtlasResourceManager.BOARDER_TYPE_RIGHT = 1, AtlasResourceManager.BOARDER_TYPE_LEFT = 2, 
        AtlasResourceManager.BOARDER_TYPE_BOTTOM = 4, AtlasResourceManager.BOARDER_TYPE_TOP = 8, 
        AtlasResourceManager.BOARDER_TYPE_ALL = 15, AtlasResourceManager._sid_ = 0, AtlasResourceManager._Instance = null, 
        AtlasResourceManager;
    }(), MergeFillInfo = function() {
        function MergeFillInfo() {
            this.x = 0, this.y = 0, this.ret = !1, this.ret = !1, this.x = 0, this.y = 0;
        }
        return __class(MergeFillInfo, "laya.webgl.atlas.MergeFillInfo"), MergeFillInfo;
    }(), BlendMode = function() {
        function BlendMode() {}
        return __class(BlendMode, "laya.webgl.canvas.BlendMode"), BlendMode._init_ = function(gl) {
            BlendMode.fns = [ BlendMode.BlendNormal, BlendMode.BlendAdd, BlendMode.BlendMultiply, BlendMode.BlendScreen, BlendMode.BlendOverlay, BlendMode.BlendLight, BlendMode.BlendMask, BlendMode.BlendDestinationOut ], 
            BlendMode.targetFns = [ BlendMode.BlendNormalTarget, BlendMode.BlendAddTarget, BlendMode.BlendMultiplyTarget, BlendMode.BlendScreenTarget, BlendMode.BlendOverlayTarget, BlendMode.BlendLightTarget, BlendMode.BlendMask, BlendMode.BlendDestinationOut ];
        }, BlendMode.BlendNormal = function(gl) {
            gl.blendFunc(1, 771);
        }, BlendMode.BlendAdd = function(gl) {
            gl.blendFunc(1, 772);
        }, BlendMode.BlendMultiply = function(gl) {
            gl.blendFunc(774, 771);
        }, BlendMode.BlendScreen = function(gl) {
            gl.blendFunc(1, 1);
        }, BlendMode.BlendOverlay = function(gl) {
            gl.blendFunc(1, 769);
        }, BlendMode.BlendLight = function(gl) {
            gl.blendFunc(1, 1);
        }, BlendMode.BlendNormalTarget = function(gl) {
            gl.blendFunc(1, 771);
        }, BlendMode.BlendAddTarget = function(gl) {
            gl.blendFunc(1, 772);
        }, BlendMode.BlendMultiplyTarget = function(gl) {
            gl.blendFunc(774, 771);
        }, BlendMode.BlendScreenTarget = function(gl) {
            gl.blendFunc(1, 1);
        }, BlendMode.BlendOverlayTarget = function(gl) {
            gl.blendFunc(1, 769);
        }, BlendMode.BlendLightTarget = function(gl) {
            gl.blendFunc(1, 1);
        }, BlendMode.BlendMask = function(gl) {
            gl.blendFunc(0, 770);
        }, BlendMode.BlendDestinationOut = function(gl) {
            gl.blendFunc(0, 0);
        }, BlendMode.activeBlendFunction = null, BlendMode.NAMES = [ "normal", "add", "multiply", "screen", "overlay", "light", "mask", "destination-out" ], 
        BlendMode.TOINT = {
            normal: 0,
            add: 1,
            multiply: 2,
            screen: 3,
            lighter: 1,
            overlay: 4,
            light: 5,
            mask: 6,
            "destination-out": 7
        }, BlendMode.NORMAL = "normal", BlendMode.ADD = "add", BlendMode.MULTIPLY = "multiply", 
        BlendMode.SCREEN = "screen", BlendMode.LIGHT = "light", BlendMode.OVERLAY = "overlay", 
        BlendMode.DESTINATIONOUT = "destination-out", BlendMode.fns = [], BlendMode.targetFns = [], 
        BlendMode;
    }(), DrawStyle = function() {
        function DrawStyle(value) {
            this._color = Color.create("black"), this.setValue(value);
        }
        __class(DrawStyle, "laya.webgl.canvas.DrawStyle");
        var __proto = DrawStyle.prototype;
        return __proto.setValue = function(value) {
            if (value) {
                if ("string" == typeof value) return void (this._color = Color.create(value));
                if (value instanceof laya.utils.Color) return void (this._color = value);
            }
        }, __proto.reset = function() {
            this._color = Color.create("black");
        }, __proto.equal = function(value) {
            return "string" == typeof value ? this._color.strColor === value : value instanceof laya.utils.Color && this._color.numColor === value.numColor;
        }, __proto.toColorStr = function() {
            return this._color.strColor;
        }, DrawStyle.create = function(value) {
            var color;
            if (value && ("string" == typeof value ? color = Color.create(value) : value instanceof laya.utils.Color && (color = value), 
            color)) return color._drawStyle || (color._drawStyle = new DrawStyle(value));
            return laya.webgl.canvas.DrawStyle.DEFAULT;
        }, __static(DrawStyle, [ "DEFAULT", function() {
            return this.DEFAULT = new DrawStyle("#000000");
        } ]), DrawStyle;
    }(), Path = function() {
        function Path() {
            this._x = 0, this._y = 0, this.dirty = !1, this.offset = 0, this.count = 0, this.geoStart = 0, 
            this.tempArray = [], this.closePath = !1, this.geomatrys = [];
            WebGL.mainContext;
            this.ib = IndexBuffer2D.create(35048), this.vb = VertexBuffer2D.create(5);
        }
        __class(Path, "laya.webgl.canvas.Path");
        var __proto = Path.prototype;
        return __proto.addPoint = function(pointX, pointY) {
            this.tempArray.push(pointX, pointY);
        }, __proto.getEndPointX = function() {
            return this.tempArray[this.tempArray.length - 2];
        }, __proto.getEndPointY = function() {
            return this.tempArray[this.tempArray.length - 1];
        }, __proto.polygon = function(x, y, points, color, borderWidth, borderColor) {
            var geo;
            return this.geomatrys.push(this._curGeomatry = geo = new Polygon(x, y, points, color, borderWidth, borderColor)), 
            color || (geo.fill = !1), null == borderColor && (geo.borderWidth = 0), geo;
        }, __proto.setGeomtry = function(shape) {
            this.geomatrys.push(this._curGeomatry = shape);
        }, __proto.drawLine = function(x, y, points, width, color) {
            var geo;
            return this.closePath ? this.geomatrys.push(this._curGeomatry = geo = new LoopLine(x, y, points, width, color)) : this.geomatrys.push(this._curGeomatry = geo = new Line(x, y, points, width, color)), 
            geo.fill = !1, geo;
        }, __proto.update = function() {
            var si = this.ib._byteLength, len = this.geomatrys.length;
            this.offset = si;
            for (var i = this.geoStart; i < len; i++) this.geomatrys[i].getData(this.ib, this.vb, this.vb._byteLength / 20);
            this.geoStart = len, this.count = (this.ib._byteLength - si) / CONST3D2D.BYTES_PIDX;
        }, __proto.reset = function() {
            this.vb.clear(), this.ib.clear(), this.offset = this.count = this.geoStart = 0, 
            this.geomatrys.length = 0;
        }, __proto.recover = function() {
            this._curGeomatry = null, this.vb.destory(), this.vb = null, this.ib.destory(), 
            this.ib = null;
        }, Path;
    }(), SaveBase = function() {
        function SaveBase() {}
        __class(SaveBase, "laya.webgl.canvas.save.SaveBase");
        var __proto = SaveBase.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.canvas.save.ISaveData": !0
        }), __proto.isSaveMark = function() {
            return !1;
        }, __proto.restore = function(context) {
            this._dataObj[this._valueName] = this._value, (SaveBase._cache[SaveBase._cache._length++] = this)._newSubmit && (context._curSubmit = Submit.RENDERBASE, 
            context._renderKey = 0);
        }, SaveBase._createArray = function() {
            var value = [];
            return value._length = 0, value;
        }, SaveBase._init = function() {
            var namemap = SaveBase._namemap = {};
            return namemap[1] = "ALPHA", namemap[2] = "fillStyle", namemap[8] = "font", namemap[256] = "lineWidth", 
            namemap[512] = "strokeStyle", namemap[8192] = "_mergeID", namemap[1024] = namemap[2048] = namemap[4096] = [], 
            namemap[16384] = "textBaseline", namemap[32768] = "textAlign", namemap[65536] = "_nBlendType", 
            namemap[1048576] = "shader", namemap[2097152] = "filters", namemap;
        }, SaveBase.save = function(context, type, dataObj, newSubmit) {
            if ((context._saveMark._saveuse & type) !== type) {
                context._saveMark._saveuse |= type;
                var cache = SaveBase._cache, o = 0 < cache._length ? cache[--cache._length] : new SaveBase();
                o._value = dataObj[o._valueName = SaveBase._namemap[type]], o._dataObj = dataObj, 
                o._newSubmit = newSubmit;
                var _save = context._save;
                _save[_save._length++] = o;
            }
        }, SaveBase._cache = laya.webgl.canvas.save.SaveBase._createArray(), SaveBase._namemap = SaveBase._init(), 
        SaveBase;
    }(), SaveClipRect = function() {
        function SaveClipRect() {
            this._clipRect = new Rectangle();
        }
        __class(SaveClipRect, "laya.webgl.canvas.save.SaveClipRect");
        var __proto = SaveClipRect.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.canvas.save.ISaveData": !0
        }), __proto.isSaveMark = function() {
            return !1;
        }, __proto.restore = function(context) {
            context._clipRect = this._clipSaveRect, (SaveClipRect._cache[SaveClipRect._cache._length++] = this)._submitScissor.submitLength = context._submits._length - this._submitScissor.submitIndex, 
            context._curSubmit = Submit.RENDERBASE, context._renderKey = 0;
        }, SaveClipRect.save = function(context, submitScissor) {
            if (131072 != (131072 & context._saveMark._saveuse)) {
                context._saveMark._saveuse |= 131072;
                var cache = SaveClipRect._cache, o = 0 < cache._length ? cache[--cache._length] : new SaveClipRect();
                o._clipSaveRect = context._clipRect, context._clipRect = o._clipRect.copyFrom(context._clipRect), 
                o._submitScissor = submitScissor;
                var _save = context._save;
                _save[_save._length++] = o;
            }
        }, __static(SaveClipRect, [ "_cache", function() {
            return this._cache = SaveBase._createArray();
        } ]), SaveClipRect;
    }(), SaveClipRectStencil = function() {
        function SaveClipRectStencil() {
            this._contextX = 0, this._contextY = 0, this._clipRect = new Rectangle(), this._rect = new Rectangle(), 
            this._matrix = new Matrix();
        }
        __class(SaveClipRectStencil, "laya.webgl.canvas.save.SaveClipRectStencil");
        var __proto = SaveClipRectStencil.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.canvas.save.ISaveData": !0
        }), __proto.isSaveMark = function() {
            return !1;
        }, __proto.restore = function(context) {
            SubmitStencil.restore(context, this._rect, this._saveMatrix, this._contextX, this._contextY), 
            context._clipRect = this._clipSaveRect, context._curMat = this._saveMatrix, context._x = this._contextX, 
            context._y = this._contextY, SaveClipRectStencil._cache[SaveClipRectStencil._cache._length++] = this, 
            context._curSubmit = Submit.RENDERBASE;
        }, SaveClipRectStencil.save = function(context, submitStencil, x, y, width, height, clipX, clipY, clipWidth, clipHeight) {
            if (262144 != (262144 & context._saveMark._saveuse)) {
                context._saveMark._saveuse |= 262144;
                var cache = SaveClipRectStencil._cache, o = 0 < cache._length ? cache[--cache._length] : new SaveClipRectStencil();
                o._clipSaveRect = context._clipRect, o._clipRect.setTo(clipX, clipY, clipWidth, clipHeight), 
                context._clipRect = o._clipRect, o._rect.x = x, o._rect.y = y, o._rect.width = width, 
                o._rect.height = height, o._contextX = context._x, o._contextY = context._y, o._saveMatrix = context._curMat, 
                context._curMat.copyTo(o._matrix), context._curMat = o._matrix, o._submitStencil = submitStencil;
                var _save = context._save;
                _save[_save._length++] = o;
            }
        }, __static(SaveClipRectStencil, [ "_cache", function() {
            return this._cache = SaveBase._createArray();
        } ]), SaveClipRectStencil;
    }(), SaveMark = function() {
        function SaveMark() {
            this._saveuse = 0;
        }
        __class(SaveMark, "laya.webgl.canvas.save.SaveMark");
        var __proto = SaveMark.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.canvas.save.ISaveData": !0
        }), __proto.isSaveMark = function() {
            return !0;
        }, __proto.restore = function(context) {
            context._saveMark = this._preSaveMark, SaveMark._no[SaveMark._no._length++] = this;
        }, SaveMark.Create = function(context) {
            var no = SaveMark._no, o = 0 < no._length ? no[--no._length] : new SaveMark();
            return o._saveuse = 0, o._preSaveMark = context._saveMark, context._saveMark = o;
        }, __static(SaveMark, [ "_no", function() {
            return this._no = SaveBase._createArray();
        } ]), SaveMark;
    }(), SaveTransform = function() {
        function SaveTransform() {
            this._matrix = new Matrix();
        }
        __class(SaveTransform, "laya.webgl.canvas.save.SaveTransform");
        var __proto = SaveTransform.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.canvas.save.ISaveData": !0
        }), __proto.isSaveMark = function() {
            return !1;
        }, __proto.restore = function(context) {
            context._curMat = this._savematrix, SaveTransform._no[SaveTransform._no._length++] = this;
        }, SaveTransform.save = function(context) {
            var _saveMark = context._saveMark;
            if (2048 != (2048 & _saveMark._saveuse)) {
                _saveMark._saveuse |= 2048;
                var no = SaveTransform._no, o = 0 < no._length ? no[--no._length] : new SaveTransform();
                o._savematrix = context._curMat, context._curMat = context._curMat.copyTo(o._matrix);
                var _save = context._save;
                _save[_save._length++] = o;
            }
        }, __static(SaveTransform, [ "_no", function() {
            return this._no = SaveBase._createArray();
        } ]), SaveTransform;
    }(), SaveTranslate = function() {
        function SaveTranslate() {}
        __class(SaveTranslate, "laya.webgl.canvas.save.SaveTranslate");
        var __proto = SaveTranslate.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.canvas.save.ISaveData": !0
        }), __proto.isSaveMark = function() {
            return !1;
        }, __proto.restore = function(context) {
            context._curMat;
            context._x = this._x, context._y = this._y, SaveTranslate._no[SaveTranslate._no._length++] = this;
        }, SaveTranslate.save = function(context) {
            var no = SaveTranslate._no, o = 0 < no._length ? no[--no._length] : new SaveTranslate();
            o._x = context._x, o._y = context._y;
            var _save = context._save;
            _save[_save._length++] = o;
        }, __static(SaveTranslate, [ "_no", function() {
            return this._no = SaveBase._createArray();
        } ]), SaveTranslate;
    }(), RenderTargetMAX = function() {
        function RenderTargetMAX() {
            this.target = null, this.repaint = !1, this._width = NaN, this._height = NaN, this._sp = null, 
            this._clipRect = new Rectangle();
        }
        __class(RenderTargetMAX, "laya.webgl.resource.RenderTargetMAX");
        var __proto = RenderTargetMAX.prototype;
        return __proto.setSP = function(sp) {
            this._sp = sp;
        }, __proto.size = function(w, h) {
            var _$this = this;
            this._width !== w || this._height !== h ? (this.repaint = !0, this._width = w, this._height = h, 
            this.target ? this.target.size(w, h) : this.target = RenderTarget2D.create(w, h), 
            this.target.hasListener("recovered") || this.target.on("recovered", this, function(e) {
                Laya.timer.callLater(_$this._sp, _$this._sp.repaint);
            })) : this.target.size(w, h);
        }, __proto._flushToTarget = function(context, target) {
            if (!target._destroy) {
                var worldScissorTest = RenderState2D.worldScissorTest, preworldClipRect = RenderState2D.worldClipRect;
                RenderState2D.worldClipRect = this._clipRect, this._clipRect.x = this._clipRect.y = 0, 
                this._clipRect.width = this._width, this._clipRect.height = this._height, RenderState2D.worldScissorTest = !1, 
                WebGL.mainContext.disable(3089);
                var preAlpha = RenderState2D.worldAlpha, preMatrix4 = RenderState2D.worldMatrix4, preMatrix = RenderState2D.worldMatrix, preFilters = RenderState2D.worldFilters, preShaderDefines = RenderState2D.worldShaderDefines;
                if (RenderState2D.worldMatrix = Matrix.EMPTY, RenderState2D.restoreTempArray(), 
                RenderState2D.worldMatrix4 = RenderState2D.TEMPMAT4_ARRAY, RenderState2D.worldAlpha = 1, 
                RenderState2D.worldFilters = null, RenderState2D.worldShaderDefines = null, BaseShader.activeShader = null, 
                target.start(), Config.showCanvasMark ? target.clear(0, 1, 0, .3) : target.clear(0, 0, 0, 0), 
                context.flush(), target.end(), BaseShader.activeShader = null, RenderState2D.worldAlpha = preAlpha, 
                RenderState2D.worldMatrix4 = preMatrix4, RenderState2D.worldMatrix = preMatrix, 
                RenderState2D.worldFilters = preFilters, RenderState2D.worldShaderDefines = preShaderDefines, 
                RenderState2D.worldScissorTest = worldScissorTest) {
                    var y = RenderState2D.height - preworldClipRect.y - preworldClipRect.height;
                    WebGL.mainContext.scissor(preworldClipRect.x, y, preworldClipRect.width, preworldClipRect.height), 
                    WebGL.mainContext.enable(3089);
                }
                RenderState2D.worldClipRect = preworldClipRect;
            }
        }, __proto.flush = function(context) {
            this.repaint && (this._flushToTarget(context, this.target), this.repaint = !1);
        }, __proto.drawTo = function(context, x, y, width, height) {
            context.drawTexture(this.target.getTexture(), x, y, width, height, 0, 0);
        }, __proto.destroy = function() {
            this.target && (this.target.destroy(), this.target = null, this._sp = null);
        }, RenderTargetMAX;
    }(), Shader2D = function() {
        function Shader2D() {
            this.ALPHA = 1, this.shaderType = 0, this.defines = new ShaderDefines2D();
        }
        return __class(Shader2D, "laya.webgl.shader.d2.Shader2D"), Shader2D.prototype.destroy = function() {
            this.defines = null, this.filters = null, this.glTexture = null, this.strokeStyle = null, 
            this.fillStyle = null;
        }, Shader2D.__init__ = function() {
            var vs, ps;
            Shader.addInclude("parts/ColorFilter_ps_uniform.glsl", "uniform vec4 colorAlpha;\nuniform mat4 colorMat;"), 
            Shader.addInclude("parts/ColorFilter_ps_logic.glsl", "mat4 alphaMat =colorMat;\n\nalphaMat[0][3] *= gl_FragColor.a;\nalphaMat[1][3] *= gl_FragColor.a;\nalphaMat[2][3] *= gl_FragColor.a;\n\ngl_FragColor = gl_FragColor * alphaMat;\ngl_FragColor += colorAlpha/255.0*gl_FragColor.a;\n"), 
            Shader.addInclude("parts/GlowFilter_ps_uniform.glsl", "uniform vec4 u_color;\nuniform float u_strength;\nuniform float u_blurX;\nuniform float u_blurY;\nuniform float u_offsetX;\nuniform float u_offsetY;\nuniform float u_textW;\nuniform float u_textH;"), 
            Shader.addInclude("parts/GlowFilter_ps_logic.glsl", "const float c_IterationTime = 10.0;\nfloat floatIterationTotalTime = c_IterationTime * c_IterationTime;\nvec4 vec4Color = vec4(0.0,0.0,0.0,0.0);\nvec2 vec2FilterDir = vec2(-(u_offsetX)/u_textW,-(u_offsetY)/u_textH);\nvec2 vec2FilterOff = vec2(u_blurX/u_textW/c_IterationTime * 2.0,u_blurY/u_textH/c_IterationTime * 2.0);\nfloat maxNum = u_blurX * u_blurY;\nvec2 vec2Off = vec2(0.0,0.0);\nfloat floatOff = c_IterationTime/2.0;\nfor(float i = 0.0;i<=c_IterationTime; ++i){\n\tfor(float j = 0.0;j<=c_IterationTime; ++j){\n\t\tvec2Off = vec2(vec2FilterOff.x * (i - floatOff),vec2FilterOff.y * (j - floatOff));\n\t\tvec4Color += texture2D(texture, v_texcoord + vec2FilterDir + vec2Off)/floatIterationTotalTime;\n\t}\n}\ngl_FragColor = vec4(u_color.rgb,vec4Color.a * u_strength);\ngl_FragColor.rgb *= gl_FragColor.a;"), 
            Shader.addInclude("parts/BlurFilter_ps_logic.glsl", "gl_FragColor =   blur();\ngl_FragColor.w*=alpha;"), 
            Shader.addInclude("parts/BlurFilter_ps_uniform.glsl", "uniform vec4 strength_sig2_2sig2_gauss1;\nuniform vec2 blurInfo;\n\n#define PI 3.141593\n\n//float sigma=strength/3.0;//3σ以外影响很小。即当σ=1的时候，半径为3\n//float sig2 = sigma*sigma;\n//float _2sig2 = 2.0*sig2;\n//return 1.0/(2*PI*sig2)*exp(-(x*x+y*y)/_2sig2)\n//float gauss1 = 1.0/(2.0*PI*sig2);\n\nfloat getGaussian(float x, float y){\n    return strength_sig2_2sig2_gauss1.w*exp(-(x*x+y*y)/strength_sig2_2sig2_gauss1.z);\n}\n\nvec4 blur(){\n    const float blurw = 9.0;\n    vec4 vec4Color = vec4(0.0,0.0,0.0,0.0);\n    vec2 halfsz=vec2(blurw,blurw)/2.0/blurInfo;    \n    vec2 startpos=v_texcoord-halfsz;\n    vec2 ctexcoord = startpos;\n    vec2 step = 1.0/blurInfo;  //每个像素      \n    \n    for(float y = 0.0;y<=blurw; ++y){\n        ctexcoord.x=startpos.x;\n        for(float x = 0.0;x<=blurw; ++x){\n            //TODO 纹理坐标的固定偏移应该在vs中处理\n            vec4Color += texture2D(texture, ctexcoord)*getGaussian(x-blurw/2.0,y-blurw/2.0);\n            ctexcoord.x+=step.x;\n        }\n        ctexcoord.y+=step.y;\n    }\n    return vec4Color;\n}"), 
            Shader.addInclude("parts/ColorAdd_ps_uniform.glsl", "uniform vec4 colorAdd;\n"), 
            Shader.addInclude("parts/ColorAdd_ps_logic.glsl", "gl_FragColor = vec4(colorAdd.rgb,colorAdd.a*gl_FragColor.a);\ngl_FragColor.xyz *= colorAdd.a;"), 
            vs = "attribute vec4 position;\nattribute vec2 texcoord;\nuniform vec2 size;\n\n#ifdef WORLDMAT\nuniform mat4 mmat;\n#endif\nvarying vec2 v_texcoord;\nvoid main() {\n  #ifdef WORLDMAT\n  vec4 pos=mmat*position;\n  gl_Position =vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,pos.z,1.0);\n  #else\n  gl_Position =vec4((position.x/size.x-0.5)*2.0,(0.5-position.y/size.y)*2.0,position.z,1.0);\n  #endif\n  \n  v_texcoord = texcoord;\n}", 
            ps = 'precision mediump float;\n//precision highp float;\nvarying vec2 v_texcoord;\nuniform sampler2D texture;\nuniform float alpha;\n#include?BLUR_FILTER  "parts/BlurFilter_ps_uniform.glsl";\n#include?COLOR_FILTER "parts/ColorFilter_ps_uniform.glsl";\n#include?GLOW_FILTER "parts/GlowFilter_ps_uniform.glsl";\n#include?COLOR_ADD "parts/ColorAdd_ps_uniform.glsl";\n\nvoid main() {\n   vec4 color= texture2D(texture, v_texcoord);\n   color.a*=alpha;\n   color.rgb*=alpha;\n   gl_FragColor=color;\n   #include?COLOR_ADD "parts/ColorAdd_ps_logic.glsl";   \n   #include?BLUR_FILTER  "parts/BlurFilter_ps_logic.glsl";\n   #include?COLOR_FILTER "parts/ColorFilter_ps_logic.glsl";\n   #include?GLOW_FILTER "parts/GlowFilter_ps_logic.glsl";\n}', 
            Shader.preCompile2D(0, 1, vs, ps, null), vs = "attribute vec4 position;\nuniform vec2 size;\nuniform mat4 mmat;\nvoid main() {\n  vec4 pos=mmat*position;\n  gl_Position =vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,pos.z,1.0);\n}", 
            ps = 'precision mediump float;\nuniform vec4 color;\nuniform float alpha;\n#include?COLOR_FILTER "parts/ColorFilter_ps_uniform.glsl";\nvoid main() {\n\tvec4 a = vec4(color.r, color.g, color.b, color.a);\n\ta.w = alpha;\n\ta.xyz *= alpha;\n\tgl_FragColor = a;\n\t#include?COLOR_FILTER "parts/ColorFilter_ps_logic.glsl";\n}', 
            Shader.preCompile2D(0, 2, vs, ps, null), vs = "attribute vec4 position;\nattribute vec3 a_color;\nuniform mat4 mmat;\nuniform mat4 u_mmat2;\nuniform vec2 u_pos;\nuniform vec2 size;\nvarying vec3 color;\nvoid main(){\n  vec4 tPos = vec4(position.x + u_pos.x,position.y + u_pos.y,position.z,position.w);\n  vec4 pos=mmat*u_mmat2*tPos;\n  gl_Position =vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,pos.z,1.0);\n  color=a_color;\n}", 
            ps = "precision mediump float;\n//precision mediump float;\nvarying vec3 color;\nuniform float alpha;\nvoid main(){\n\t//vec4 a=vec4(color.r, color.g, color.b, 1);\n\t//a.a*=alpha;\n    gl_FragColor=vec4(color.r, color.g, color.b, alpha);\n\tgl_FragColor.rgb*=alpha;\n}", 
            Shader.preCompile2D(0, 4, vs, ps, null), vs = "attribute vec4 position;\nattribute vec2 texcoord;\nuniform vec2 size;\n\n#ifdef WORLDMAT\nuniform mat4 mmat;\n#endif\nvarying vec2 v_texcoord;\nvoid main() {\n  #ifdef WORLDMAT\n  vec4 pos=mmat*position;\n  gl_Position =vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,pos.z,1.0);\n  #else\n  gl_Position =vec4((position.x/size.x-0.5)*2.0,(0.5-position.y/size.y)*2.0,position.z,1.0);\n  #endif\n  \n  v_texcoord = texcoord;\n}", 
            ps = '#ifdef FSHIGHPRECISION\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n//precision highp float;\nvarying vec2 v_texcoord;\nuniform sampler2D texture;\nuniform float alpha;\nuniform vec4 u_TexRange;\nuniform vec2 u_offset;\n#include?BLUR_FILTER  "parts/BlurFilter_ps_uniform.glsl";\n#include?COLOR_FILTER "parts/ColorFilter_ps_uniform.glsl";\n#include?GLOW_FILTER "parts/GlowFilter_ps_uniform.glsl";\n#include?COLOR_ADD "parts/ColorAdd_ps_uniform.glsl";\n\nvoid main() {\n   vec2 newTexCoord;\n   newTexCoord.x = mod(u_offset.x + v_texcoord.x,u_TexRange.y) + u_TexRange.x;\n   newTexCoord.y = mod(u_offset.y + v_texcoord.y,u_TexRange.w) + u_TexRange.z;\n   vec4 color= texture2D(texture, newTexCoord);\n   color.a*=alpha;\n   gl_FragColor=color;\n   #include?COLOR_ADD "parts/ColorAdd_ps_logic.glsl";   \n   #include?BLUR_FILTER  "parts/BlurFilter_ps_logic.glsl";\n   #include?COLOR_FILTER "parts/ColorFilter_ps_logic.glsl";\n   #include?GLOW_FILTER "parts/GlowFilter_ps_logic.glsl";\n}', 
            Shader.preCompile2D(0, 256, vs, ps, null), vs = "attribute vec2 position;\nattribute vec2 texcoord;\nattribute vec4 color;\nuniform vec2 size;\nuniform float offsetX;\nuniform float offsetY;\nuniform mat4 mmat;\nuniform mat4 u_mmat2;\nvarying vec2 v_texcoord;\nvarying vec4 v_color;\nvoid main() {\n  vec4 pos=mmat*u_mmat2*vec4(offsetX+position.x,offsetY+position.y,0,1 );\n  gl_Position = vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,pos.z,1.0);\n  v_color = color;\n  v_color.rgb *= v_color.a;\n  v_texcoord = texcoord;  \n}", 
            ps = "precision mediump float;\nvarying vec2 v_texcoord;\nvarying vec4 v_color;\nuniform sampler2D texture;\nuniform float alpha;\nvoid main() {\n\tvec4 t_color = texture2D(texture, v_texcoord);\n\tgl_FragColor = t_color.rgba * v_color;\n\tgl_FragColor *= alpha;\n}", 
            Shader.preCompile2D(0, 512, vs, ps, null);
        }, Shader2D;
    }(), ShaderDefines = function() {
        function ShaderDefines(name2int, int2name, int2nameMap) {
            this._value = 0, this._name2int = name2int, this._int2name = int2name, this._int2nameMap = int2nameMap;
        }
        __class(ShaderDefines, "laya.webgl.shader.ShaderDefines");
        var __proto = ShaderDefines.prototype;
        return __proto.add = function(value) {
            return "string" == typeof value && (value = this._name2int[value]), this._value |= value, 
            this._value;
        }, __proto.addInt = function(value) {
            return this._value |= value, this._value;
        }, __proto.remove = function(value) {
            return "string" == typeof value && (value = this._name2int[value]), this._value &= ~value, 
            this._value;
        }, __proto.isDefine = function(def) {
            return (this._value & def) === def;
        }, __proto.getValue = function() {
            return this._value;
        }, __proto.setValue = function(value) {
            this._value = value;
        }, __proto.toNameDic = function() {
            var r = this._int2nameMap[this._value];
            return r || ShaderDefines._toText(this._value, this._int2name, this._int2nameMap);
        }, ShaderDefines._reg = function(name, value, _name2int, _int2name) {
            _int2name[_name2int[name] = value] = name;
        }, ShaderDefines._toText = function(value, _int2name, _int2nameMap) {
            var r = _int2nameMap[value];
            if (r) return r;
            for (var o = {}, d = 1, i = 0; i < 32 && !(value < (d = 1 << i)); i++) if (value & d) {
                var name = _int2name[d];
                name && (o[name] = "");
            }
            return _int2nameMap[value] = o;
        }, ShaderDefines._toInt = function(names, _name2int) {
            for (var words = names.split("."), num = 0, i = 0, n = words.length; i < n; i++) {
                var value = _name2int[words[i]];
                if (!value) throw new Error("Defines to int err:" + names + "/" + words[i]);
                num |= value;
            }
            return num;
        }, ShaderDefines;
    }(), SkinMesh = function() {
        function SkinMesh() {
            this.mVBBuffer = null, this.mIBBuffer = null, this.mVBData = null, this.mIBData = null, 
            this.mEleNum = 0, this.mTexture = null, this.transform = null, this._vs = null, 
            this._ps = null, this._indexStart = -1, this._verticles = null, this._uvs = null, 
            this._tempMatrix = new Matrix();
        }
        __class(SkinMesh, "laya.webgl.shader.d2.skinAnishader.SkinMesh");
        var __proto = SkinMesh.prototype;
        return __proto.init = function(texture, vs, ps) {
            if (vs) this._vs = vs; else {
                this._vs = [];
                var tWidth = texture.width, tHeight = texture.height;
                this._vs.push(0, 0, 0, 0, 1, 1, 1, 1), this._vs.push(tWidth, 0, 1, 0, 1, 1, 1, 1), 
                this._vs.push(tWidth, tHeight, 1, 1, 1, 1, 1, 1), this._vs.push(0, tHeight, 0, 1, 1, 1, 1, 1);
            }
            ps ? this._ps = ps : (SkinMesh._defaultPS || (SkinMesh._defaultPS = []).push(0, 1, 3, 3, 1, 2), 
            this._ps = SkinMesh._defaultPS), this.mVBData = new Float32Array(this._vs), this.mIBData = new Uint16Array(this._ps.length), 
            this.mIBData.start = -1, this.mEleNum = this._ps.length, this.mTexture = texture;
        }, __proto.init2 = function(texture, vs, ps, verticles, uvs) {
            this.transform && (this.transform = null), ps ? this._ps = ps : (this._ps = [], 
            this._ps.push(0, 1, 3, 3, 1, 2)), this._verticles = verticles, this._uvs = uvs, 
            this.mEleNum = this._ps.length, this.mTexture = texture, (Render.isConchNode || Render.isConchApp) && (this._initMyData(), 
            this.mVBData = new Float32Array(this._vs));
        }, __proto._initMyData = function() {
            var vsI = 0, vI = 0, tempVLen = 4 * this._verticles.length;
            this._vs = SkinMesh._tempVS;
            var insertNew = !1;
            if (Render.isConchNode || Render.isConchApp ? (this._vs.length = tempVLen, insertNew = !0) : this._vs.length < tempVLen && (this._vs.length = tempVLen, 
            insertNew = !0), SkinMesh._tVSLen = tempVLen, insertNew) for (;vsI < tempVLen; ) this._vs[vsI] = this._verticles[vI], 
            this._vs[vsI + 1] = this._verticles[vI + 1], this._vs[vsI + 2] = this._uvs[vI], 
            this._vs[vsI + 3] = this._uvs[vI + 1], this._vs[vsI + 4] = 1, this._vs[vsI + 5] = 1, 
            this._vs[vsI + 6] = 1, this._vs[vsI + 7] = 1, vsI += 8, vI += 2; else for (;vsI < tempVLen; ) this._vs[vsI] = this._verticles[vI], 
            this._vs[vsI + 1] = this._verticles[vI + 1], this._vs[vsI + 2] = this._uvs[vI], 
            this._vs[vsI + 3] = this._uvs[vI + 1], vsI += 8, vI += 2;
        }, __proto.getData2 = function(vb, ib, start) {
            var tIB;
            this.mVBBuffer = vb, this.mIBBuffer = ib, this._initMyData(), vb.appendEx2(this._vs, Float32Array, SkinMesh._tVSLen, 4), 
            this._indexStart = ib._byteLength, (tIB = SkinMesh._tempIB).length < this._ps.length && (tIB.length = this._ps.length);
            for (var i = 0, n = this._ps.length; i < n; i++) tIB[i] = this._ps[i] + start;
            ib.appendEx2(tIB, Uint16Array, this._ps.length, 2);
        }, __proto.getData = function(vb, ib, start) {
            if (this.mVBBuffer = vb, this.mIBBuffer = ib, vb.append(this.mVBData), this._indexStart = ib._byteLength, 
            this.mIBData.start != start) {
                for (var i = 0, n = this._ps.length; i < n; i++) this.mIBData[i] = this._ps[i] + start;
                this.mIBData.start = start;
            }
            ib.append(this.mIBData);
        }, __proto.render = function(context, x, y) {
            if (Render.isWebGL && this.mTexture) {
                context._renderKey = 0, context._shader2D.glTexture = null, SkinMeshBuffer.getInstance().addSkinMesh(this);
                var tempSubmit = Submit.createShape(context, this.mIBBuffer, this.mVBBuffer, this.mEleNum, this._indexStart, Value2D.create(512, 0));
                this.transform || (this.transform = Matrix.EMPTY), this.transform.translate(x, y), 
                Matrix.mul(this.transform, context._curMat, this._tempMatrix), this.transform.translate(-x, -y);
                var tShaderValue = tempSubmit.shaderValue, tArray = tShaderValue.u_mmat2 || RenderState2D.getMatrArray();
                RenderState2D.mat2MatArray(this._tempMatrix, tArray), tShaderValue.textureHost = this.mTexture, 
                tShaderValue.offsetX = 0, tShaderValue.offsetY = 0, tShaderValue.u_mmat2 = tArray, 
                tShaderValue.ALPHA = context._shader2D.ALPHA, context._submits[context._submits._length++] = tempSubmit;
            } else Render.isConchApp && this.mTexture && (this.transform || (this.transform = Matrix.EMPTY), 
            context.setSkinMesh && context.setSkinMesh(x, y, this._ps, this.mVBData, this.mEleNum, 0, this.mTexture, this.transform));
        }, SkinMesh._tempVS = [], SkinMesh._tempIB = [], SkinMesh._defaultPS = null, SkinMesh._tVSLen = 0, 
        SkinMesh;
    }(), SkinMeshBuffer = function() {
        function SkinMeshBuffer() {
            this.ib = null, this.vb = null;
            WebGL.mainContext;
            this.ib = IndexBuffer2D.create(35048), this.vb = VertexBuffer2D.create(8);
        }
        __class(SkinMeshBuffer, "laya.webgl.shader.d2.skinAnishader.SkinMeshBuffer");
        var __proto = SkinMeshBuffer.prototype;
        return __proto.addSkinMesh = function(skinMesh) {
            skinMesh.getData2(this.vb, this.ib, this.vb._byteLength / 32);
        }, __proto.reset = function() {
            this.vb.clear(), this.ib.clear();
        }, SkinMeshBuffer.getInstance = function() {
            return SkinMeshBuffer.instance = SkinMeshBuffer.instance || new SkinMeshBuffer();
        }, SkinMeshBuffer.instance = null, SkinMeshBuffer;
    }(), BasePoly = function() {
        function BasePoly(x, y, width, height, edges, color, borderWidth, borderColor, round) {
            this.r0 = 0, this.fill = !0, this.r1 = Math.PI / 2, void 0 === round && (round = 0), 
            this.x = x, this.y = y, this.width = width, this.height = height, this.edges = edges, 
            this.color = color, this.borderWidth = borderWidth, this.borderColor = borderColor;
        }
        __class(BasePoly, "laya.webgl.shapes.BasePoly");
        var __proto = BasePoly.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.shapes.IShape": !0
        }), __proto.getData = function(ib, vb, start) {}, __proto.rebuild = function(points) {}, 
        __proto.setMatrix = function(mat) {}, __proto.needUpdate = function(mat) {
            return !0;
        }, __proto.sector = function(outVert, outIndex, start) {
            var x = this.x, y = this.y, edges = this.edges, seg = (this.r1 - this.r0) / edges, w = this.width, h = this.height, color = this.color, r = (color >> 16 & 255) / 255, g = (color >> 8 & 255) / 255, b = (255 & color) / 255;
            outVert.push(x, y, r, g, b);
            for (var i = 0; i < edges + 1; i++) outVert.push(x + Math.sin(seg * i + this.r0) * w, y + Math.cos(seg * i + this.r0) * h), 
            outVert.push(r, g, b);
            for (i = 0; i < edges; i++) outIndex.push(start, start + i + 1, start + i + 2);
        }, __proto.createLine2 = function(p, indices, lineWidth, len, outVertex, indexCount) {
            var px, py, p1x, p1y, p2x, p2y, p3x, p3y, perpx, perpy, perp2x, perp2y, a1, b1, c1, a2, b2, c2, denom, dist, points = p.concat(), result = outVertex, color = this.borderColor, r = (color >> 16 & 255) / 255, g = (color >> 8 & 255) / 255, b = (255 & color) / 255, length = points.length / 2, iStart = len, w = lineWidth / 2;
            p1x = points[0], p1y = points[1], perpy = p1x - (p2x = points[2]), perpx = (perpx = -(p1y - (p2y = points[3]))) / (dist = Math.sqrt(perpx * perpx + perpy * perpy)) * w, 
            perpy = perpy / dist * w, result.push(p1x - perpx + this.x, p1y - perpy + this.y, r, g, b, p1x + perpx + this.x, p1y + perpy + this.y, r, g, b);
            for (var i = 1; i < length - 1; i++) p1x = points[2 * (i - 1)], p1y = points[2 * (i - 1) + 1], 
            p2x = points[2 * i], p2y = points[2 * i + 1], p3x = points[2 * (i + 1)], p3y = points[2 * (i + 1) + 1], 
            perpy = p1x - p2x, perp2y = p2x - p3x, c1 = (-(perpx = (perpx = -(p1y - p2y)) / (dist = Math.sqrt(perpx * perpx + perpy * perpy)) * w) + p1x) * (-(perpy = perpy / dist * w) + p2y) - (-perpx + p2x) * (-perpy + p1y), 
            c2 = (-(perp2x = (perp2x = -(p2y - p3y)) / (dist = Math.sqrt(perp2x * perp2x + perp2y * perp2y)) * w) + p3x) * (-(perp2y = perp2y / dist * w) + p2y) - (-perp2x + p2x) * (-perp2y + p3y), 
            denom = (a1 = -perpy + p1y - (-perpy + p2y)) * (b2 = -perp2x + p2x - (-perp2x + p3x)) - (a2 = -perp2y + p3y - (-perp2y + p2y)) * (b1 = -perpx + p2x - (-perpx + p1x)), 
            Math.abs(denom) < .1 ? (denom += 10.1, result.push(p2x - perpx + this.x, p2y - perpy + this.y, r, g, b, p2x + perpx + this.x, p2y + perpy + this.y, r, g, b)) : (((px = (b1 * c2 - b2 * c1) / denom) - p2x) * (px - p2x) + ((py = (a2 * c1 - a1 * c2) / denom) - p2y) + (py - p2y), 
            result.push(px + this.x, py + this.y, r, g, b, p2x - (px - p2x) + this.x, p2y - (py - p2y) + this.y, r, g, b));
            p1x = points[points.length - 4], p1y = points[points.length - 3], perpy = p1x - (p2x = points[points.length - 2]), 
            perpx = (perpx = -(p1y - (p2y = points[points.length - 1]))) / (dist = Math.sqrt(perpx * perpx + perpy * perpy)) * w, 
            perpy = perpy / dist * w, result.push(p2x - perpx + this.x, p2y - perpy + this.y, r, g, b, p2x + perpx + this.x, p2y + perpy + this.y, r, g, b);
            var groupLen = indexCount;
            for (i = 1; i < groupLen; i++) indices.push(iStart + 2 * (i - 1), iStart + 2 * (i - 1) + 1, iStart + 2 * i + 1, iStart + 2 * i + 1, iStart + 2 * i, iStart + 2 * (i - 1));
            return result;
        }, __proto.createLine = function(p, indices, lineWidth, len) {
            var points = p.concat(), result = p, color = this.borderColor, r = (color >> 16 & 255) / 255, g = (color >> 8 & 255) / 255, b = (255 & color) / 255;
            points.splice(0, 5);
            var px, py, p1x, p1y, p2x, p2y, p3x, p3y, perpx, perpy, perp2x, perp2y, a1, b1, c1, a2, b2, c2, denom, dist, length = points.length / 5, iStart = len, w = lineWidth / 2;
            p1x = points[0], p1y = points[1], perpy = p1x - (p2x = points[5]), perpx = (perpx = -(p1y - (p2y = points[6]))) / (dist = Math.sqrt(perpx * perpx + perpy * perpy)) * w, 
            perpy = perpy / dist * w, result.push(p1x - perpx, p1y - perpy, r, g, b, p1x + perpx, p1y + perpy, r, g, b);
            for (var i = 1; i < length - 1; i++) p1x = points[5 * (i - 1)], p1y = points[5 * (i - 1) + 1], 
            p2x = points[5 * i], p2y = points[5 * i + 1], p3x = points[5 * (i + 1)], p3y = points[5 * (i + 1) + 1], 
            perpy = p1x - p2x, perp2y = p2x - p3x, c1 = (-(perpx = (perpx = -(p1y - p2y)) / (dist = Math.sqrt(perpx * perpx + perpy * perpy)) * w) + p1x) * (-(perpy = perpy / dist * w) + p2y) - (-perpx + p2x) * (-perpy + p1y), 
            c2 = (-(perp2x = (perp2x = -(p2y - p3y)) / (dist = Math.sqrt(perp2x * perp2x + perp2y * perp2y)) * w) + p3x) * (-(perp2y = perp2y / dist * w) + p2y) - (-perp2x + p2x) * (-perp2y + p3y), 
            denom = (a1 = -perpy + p1y - (-perpy + p2y)) * (b2 = -perp2x + p2x - (-perp2x + p3x)) - (a2 = -perp2y + p3y - (-perp2y + p2y)) * (b1 = -perpx + p2x - (-perpx + p1x)), 
            Math.abs(denom) < .1 ? (denom += 10.1, result.push(p2x - perpx, p2y - perpy, r, g, b, p2x + perpx, p2y + perpy, r, g, b)) : (((px = (b1 * c2 - b2 * c1) / denom) - p2x) * (px - p2x) + ((py = (a2 * c1 - a1 * c2) / denom) - p2y) + (py - p2y), 
            result.push(px, py, r, g, b, p2x - (px - p2x), p2y - (py - p2y), r, g, b));
            p1x = points[points.length - 10], p1y = points[points.length - 9], perpy = p1x - (p2x = points[points.length - 5]), 
            perpx = (perpx = -(p1y - (p2y = points[points.length - 4]))) / (dist = Math.sqrt(perpx * perpx + perpy * perpy)) * w, 
            perpy = perpy / dist * w, result.push(p2x - perpx, p2y - perpy, r, g, b, p2x + perpx, p2y + perpy, r, g, b);
            var groupLen = this.edges + 1;
            for (i = 1; i < groupLen; i++) indices.push(iStart + 2 * (i - 1), iStart + 2 * (i - 1) + 1, iStart + 2 * i + 1, iStart + 2 * i + 1, iStart + 2 * i, iStart + 2 * (i - 1));
            return result;
        }, __proto.createLoopLine = function(p, indices, lineWidth, len, outVertex, outIndex) {
            var points = p.concat(), result = outVertex || p, color = this.borderColor, r = (color >> 16 & 255) / 255, g = (color >> 8 & 255) / 255, b = (255 & color) / 255;
            points.splice(0, 5);
            var firstPoint = [ points[0], points[1] ], lastPoint = [ points[points.length - 5], points[points.length - 4] ], midPointX = lastPoint[0] + .5 * (firstPoint[0] - lastPoint[0]), midPointY = lastPoint[1] + .5 * (firstPoint[1] - lastPoint[1]);
            points.unshift(midPointX, midPointY, 0, 0, 0), points.push(midPointX, midPointY, 0, 0, 0);
            var px, py, p1x, p1y, p2x, p2y, p3x, p3y, perpx, perpy, perp2x, perp2y, a1, b1, c1, a2, b2, c2, denom, dist, length = points.length / 5, iStart = len, w = lineWidth / 2;
            p1x = points[0], p1y = points[1], perpy = p1x - (p2x = points[5]), perpx = (perpx = -(p1y - (p2y = points[6]))) / (dist = Math.sqrt(perpx * perpx + perpy * perpy)) * w, 
            perpy = perpy / dist * w, result.push(p1x - perpx, p1y - perpy, r, g, b, p1x + perpx, p1y + perpy, r, g, b);
            for (var i = 1; i < length - 1; i++) p1x = points[5 * (i - 1)], p1y = points[5 * (i - 1) + 1], 
            p2x = points[5 * i], p2y = points[5 * i + 1], p3x = points[5 * (i + 1)], p3y = points[5 * (i + 1) + 1], 
            perpy = p1x - p2x, perp2y = p2x - p3x, c1 = (-(perpx = (perpx = -(p1y - p2y)) / (dist = Math.sqrt(perpx * perpx + perpy * perpy)) * w) + p1x) * (-(perpy = perpy / dist * w) + p2y) - (-perpx + p2x) * (-perpy + p1y), 
            c2 = (-(perp2x = (perp2x = -(p2y - p3y)) / (dist = Math.sqrt(perp2x * perp2x + perp2y * perp2y)) * w) + p3x) * (-(perp2y = perp2y / dist * w) + p2y) - (-perp2x + p2x) * (-perp2y + p3y), 
            denom = (a1 = -perpy + p1y - (-perpy + p2y)) * (b2 = -perp2x + p2x - (-perp2x + p3x)) - (a2 = -perp2y + p3y - (-perp2y + p2y)) * (b1 = -perpx + p2x - (-perpx + p1x)), 
            Math.abs(denom) < .1 ? (denom += 10.1, result.push(p2x - perpx, p2y - perpy, r, g, b, p2x + perpx, p2y + perpy, r, g, b)) : (((px = (b1 * c2 - b2 * c1) / denom) - p2x) * (px - p2x) + ((py = (a2 * c1 - a1 * c2) / denom) - p2y) + (py - p2y), 
            result.push(px, py, r, g, b, p2x - (px - p2x), p2y - (py - p2y), r, g, b));
            outIndex && (indices = outIndex);
            var groupLen = this.edges + 1;
            for (i = 1; i < groupLen; i++) indices.push(iStart + 2 * (i - 1), iStart + 2 * (i - 1) + 1, iStart + 2 * i + 1, iStart + 2 * i + 1, iStart + 2 * i, iStart + 2 * (i - 1));
            return indices.push(iStart + 2 * (i - 1), iStart + 2 * (i - 1) + 1, iStart + 1, iStart + 1, iStart, iStart + 2 * (i - 1)), 
            result;
        }, BasePoly;
    }(), Earcut = function() {
        function Earcut() {}
        return __class(Earcut, "laya.webgl.shapes.Earcut"), Earcut.earcut = function(data, holeIndices, dim) {
            dim = dim || 2;
            var minX, minY, maxX, maxY, x, y, invSize, hasHoles = holeIndices && holeIndices.length, outerLen = hasHoles ? holeIndices[0] * dim : data.length, outerNode = Earcut.linkedList(data, 0, outerLen, dim, !0), triangles = [];
            if (!outerNode) return triangles;
            if (hasHoles && (outerNode = Earcut.eliminateHoles(data, holeIndices, outerNode, dim)), 
            data.length > 80 * dim) {
                minX = maxX = data[0], minY = maxY = data[1];
                for (var i = dim; i < outerLen; i += dim) (x = data[i]) < minX && (minX = x), (y = data[i + 1]) < minY && (minY = y), 
                maxX < x && (maxX = x), maxY < y && (maxY = y);
                invSize = 0 !== (invSize = Math.max(maxX - minX, maxY - minY)) ? 1 / invSize : 0;
            }
            return Earcut.earcutLinked(outerNode, triangles, dim, minX, minY, invSize), triangles;
        }, Earcut.linkedList = function(data, start, end, dim, clockwise) {
            var i, last;
            if (clockwise === 0 < Earcut.signedArea(data, start, end, dim)) for (i = start; i < end; i += dim) last = Earcut.insertNode(i, data[i], data[i + 1], last); else for (i = end - dim; start <= i; i -= dim) last = Earcut.insertNode(i, data[i], data[i + 1], last);
            return last && Earcut.equals(last, last.next) && (Earcut.removeNode(last), last = last.next), 
            last;
        }, Earcut.filterPoints = function(start, end) {
            if (!start) return start;
            end || (end = start);
            var again, p = start;
            do {
                if (again = !1, p.steiner || !Earcut.equals(p, p.next) && 0 !== Earcut.area(p.prev, p, p.next)) p = p.next; else {
                    if (Earcut.removeNode(p), (p = end = p.prev) === p.next) break;
                    again = !0;
                }
            } while (again || p !== end);
            return end;
        }, Earcut.earcutLinked = function(ear, triangles, dim, minX, minY, invSize, pass) {
            if (ear) {
                !pass && invSize && Earcut.indexCurve(ear, minX, minY, invSize);
                for (var prev, next, stop = ear; ear.prev !== ear.next; ) if (prev = ear.prev, next = ear.next, 
                invSize ? Earcut.isEarHashed(ear, minX, minY, invSize) : Earcut.isEar(ear)) triangles.push(prev.i / dim), 
                triangles.push(ear.i / dim), triangles.push(next.i / dim), Earcut.removeNode(ear), 
                ear = next.next, stop = next.next; else if ((ear = next) === stop) {
                    pass ? 1 === pass ? (ear = Earcut.cureLocalIntersections(ear, triangles, dim), Earcut.earcutLinked(ear, triangles, dim, minX, minY, invSize, 2)) : 2 === pass && Earcut.splitEarcut(ear, triangles, dim, minX, minY, invSize) : Earcut.earcutLinked(Earcut.filterPoints(ear, null), triangles, dim, minX, minY, invSize, 1);
                    break;
                }
            }
        }, Earcut.isEar = function(ear) {
            var a = ear.prev, b = ear, c = ear.next;
            if (0 <= Earcut.area(a, b, c)) return !1;
            for (var p = ear.next.next; p !== ear.prev; ) {
                if (Earcut.pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && 0 <= Earcut.area(p.prev, p, p.next)) return !1;
                p = p.next;
            }
            return !0;
        }, Earcut.isEarHashed = function(ear, minX, minY, invSize) {
            var a = ear.prev, b = ear, c = ear.next;
            if (0 <= Earcut.area(a, b, c)) return !1;
            for (var minTX = a.x < b.x ? a.x < c.x ? a.x : c.x : b.x < c.x ? b.x : c.x, minTY = a.y < b.y ? a.y < c.y ? a.y : c.y : b.y < c.y ? b.y : c.y, maxTX = a.x > b.x ? a.x > c.x ? a.x : c.x : b.x > c.x ? b.x : c.x, maxTY = a.y > b.y ? a.y > c.y ? a.y : c.y : b.y > c.y ? b.y : c.y, minZ = Earcut.zOrder(minTX, minTY, minX, minY, invSize), maxZ = Earcut.zOrder(maxTX, maxTY, minX, minY, invSize), p = ear.nextZ; p && p.z <= maxZ; ) {
                if (p !== ear.prev && p !== ear.next && Earcut.pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && 0 <= Earcut.area(p.prev, p, p.next)) return !1;
                p = p.nextZ;
            }
            for (p = ear.prevZ; p && p.z >= minZ; ) {
                if (p !== ear.prev && p !== ear.next && Earcut.pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && 0 <= Earcut.area(p.prev, p, p.next)) return !1;
                p = p.prevZ;
            }
            return !0;
        }, Earcut.cureLocalIntersections = function(start, triangles, dim) {
            var p = start;
            do {
                var a = p.prev, b = p.next.next;
                !Earcut.equals(a, b) && Earcut.intersects(a, p, p.next, b) && Earcut.locallyInside(a, b) && Earcut.locallyInside(b, a) && (triangles.push(a.i / dim), 
                triangles.push(p.i / dim), triangles.push(b.i / dim), Earcut.removeNode(p), Earcut.removeNode(p.next), 
                p = start = b), p = p.next;
            } while (p !== start);
            return p;
        }, Earcut.splitEarcut = function(start, triangles, dim, minX, minY, invSize) {
            var a = start;
            do {
                for (var b = a.next.next; b !== a.prev; ) {
                    if (a.i !== b.i && Earcut.isValidDiagonal(a, b)) {
                        var c = Earcut.splitPolygon(a, b);
                        return a = Earcut.filterPoints(a, a.next), c = Earcut.filterPoints(c, c.next), Earcut.earcutLinked(a, triangles, dim, minX, minY, invSize), 
                        void Earcut.earcutLinked(c, triangles, dim, minX, minY, invSize);
                    }
                    b = b.next;
                }
                a = a.next;
            } while (a !== start);
        }, Earcut.eliminateHoles = function(data, holeIndices, outerNode, dim) {
            var i, len, start, end, list, queue = [];
            for (i = 0, len = holeIndices.length; i < len; i++) start = holeIndices[i] * dim, 
            end = i < len - 1 ? holeIndices[i + 1] * dim : data.length, (list = Earcut.linkedList(data, start, end, dim, !1)) === list.next && (list.steiner = !0), 
            queue.push(Earcut.getLeftmost(list));
            for (queue.sort(Earcut.compareX), i = 0; i < queue.length; i++) Earcut.eliminateHole(queue[i], outerNode), 
            outerNode = Earcut.filterPoints(outerNode, outerNode.next);
            return outerNode;
        }, Earcut.compareX = function(a, b) {
            return a.x - b.x;
        }, Earcut.eliminateHole = function(hole, outerNode) {
            if (outerNode = Earcut.findHoleBridge(hole, outerNode)) {
                var b = Earcut.splitPolygon(outerNode, hole);
                Earcut.filterPoints(b, b.next);
            }
        }, Earcut.findHoleBridge = function(hole, outerNode) {
            var m, p = outerNode, hx = hole.x, hy = hole.y, qx = -1 / 0;
            do {
                if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {
                    var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);
                    if (x <= hx && qx < x) {
                        if ((qx = x) === hx) {
                            if (hy === p.y) return p;
                            if (hy === p.next.y) return p.next;
                        }
                        m = p.x < p.next.x ? p : p.next;
                    }
                }
                p = p.next;
            } while (p !== outerNode);
            if (!m) return null;
            if (hx === qx) return m.prev;
            var tan, stop = m, mx = m.x, my = m.y, tanMin = 1 / 0;
            for (p = m.next; p !== stop; ) hx >= p.x && p.x >= mx && hx !== p.x && Earcut.pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y) && ((tan = Math.abs(hy - p.y) / (hx - p.x)) < tanMin || tan === tanMin && p.x > m.x) && Earcut.locallyInside(p, hole) && (m = p, 
            tanMin = tan), p = p.next;
            return m;
        }, Earcut.indexCurve = function(start, minX, minY, invSize) {
            for (var p = start; null === p.z && (p.z = Earcut.zOrder(p.x, p.y, minX, minY, invSize)), 
            p.prevZ = p.prev, p.nextZ = p.next, (p = p.next) !== start; ) ;
            p.prevZ.nextZ = null, p.prevZ = null, Earcut.sortLinked(p);
        }, Earcut.sortLinked = function(list) {
            var i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1;
            do {
                for (p = list, tail = list = null, numMerges = 0; p; ) {
                    for (numMerges++, q = p, i = pSize = 0; i < inSize && (pSize++, q = q.nextZ); i++) ;
                    for (qSize = inSize; 0 < pSize || 0 < qSize && q; ) 0 !== pSize && (0 === qSize || !q || p.z <= q.z) ? (p = (e = p).nextZ, 
                    pSize--) : (q = (e = q).nextZ, qSize--), tail ? tail.nextZ = e : list = e, e.prevZ = tail, 
                    tail = e;
                    p = q;
                }
                tail.nextZ = null, inSize *= 2;
            } while (1 < numMerges);
            return list;
        }, Earcut.zOrder = function(x, y, minX, minY, invSize) {
            return (x = 1431655765 & ((x = 858993459 & ((x = 252645135 & ((x = 16711935 & ((x = 32767 * (x - minX) * invSize) | x << 8)) | x << 4)) | x << 2)) | x << 1)) | (y = 1431655765 & ((y = 858993459 & ((y = 252645135 & ((y = 16711935 & ((y = 32767 * (y - minY) * invSize) | y << 8)) | y << 4)) | y << 2)) | y << 1)) << 1;
        }, Earcut.getLeftmost = function(start) {
            for (var p = start, leftmost = start; p.x < leftmost.x && (leftmost = p), (p = p.next) !== start; ) ;
            return leftmost;
        }, Earcut.pointInTriangle = function(ax, ay, bx, by, cx, cy, px, py) {
            return 0 <= (cx - px) * (ay - py) - (ax - px) * (cy - py) && 0 <= (ax - px) * (by - py) - (bx - px) * (ay - py) && 0 <= (bx - px) * (cy - py) - (cx - px) * (by - py);
        }, Earcut.isValidDiagonal = function(a, b) {
            return a.next.i !== b.i && a.prev.i !== b.i && !Earcut.intersectsPolygon(a, b) && Earcut.locallyInside(a, b) && Earcut.locallyInside(b, a) && Earcut.middleInside(a, b);
        }, Earcut.area = function(p, q, r) {
            return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
        }, Earcut.equals = function(p1, p2) {
            return p1.x === p2.x && p1.y === p2.y;
        }, Earcut.intersects = function(p1, q1, p2, q2) {
            return !!(Earcut.equals(p1, q1) && Earcut.equals(p2, q2) || Earcut.equals(p1, q2) && Earcut.equals(p2, q1)) || 0 < Earcut.area(p1, q1, p2) != 0 < Earcut.area(p1, q1, q2) && 0 < Earcut.area(p2, q2, p1) != 0 < Earcut.area(p2, q2, q1);
        }, Earcut.intersectsPolygon = function(a, b) {
            var p = a;
            do {
                if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && Earcut.intersects(p, p.next, a, b)) return !0;
                p = p.next;
            } while (p !== a);
            return !1;
        }, Earcut.locallyInside = function(a, b) {
            return Earcut.area(a.prev, a, a.next) < 0 ? 0 <= Earcut.area(a, b, a.next) && 0 <= Earcut.area(a, a.prev, b) : Earcut.area(a, b, a.prev) < 0 || Earcut.area(a, a.next, b) < 0;
        }, Earcut.middleInside = function(a, b) {
            for (var p = a, inside = !1, px = (a.x + b.x) / 2, py = (a.y + b.y) / 2; p.y > py != p.next.y > py && p.next.y !== p.y && px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x && (inside = !inside), 
            (p = p.next) !== a; ) ;
            return inside;
        }, Earcut.splitPolygon = function(a, b) {
            var a2 = new EarcutNode(a.i, a.x, a.y), b2 = new EarcutNode(b.i, b.x, b.y), an = a.next, bp = b.prev;
            return (a.next = b).prev = a, (a2.next = an).prev = a2, (b2.next = a2).prev = b2, 
            (bp.next = b2).prev = bp, b2;
        }, Earcut.insertNode = function(i, x, y, last) {
            var p = new EarcutNode(i, x, y);
            return last ? (p.next = last.next, (p.prev = last).next.prev = p, last.next = p) : (p.prev = p).next = p, 
            p;
        }, Earcut.removeNode = function(p) {
            p.next.prev = p.prev, p.prev.next = p.next, p.prevZ && (p.prevZ.nextZ = p.nextZ), 
            p.nextZ && (p.nextZ.prevZ = p.prevZ);
        }, Earcut.signedArea = function(data, start, end, dim) {
            for (var sum = 0, i = start, j = end - dim; i < end; i += dim) sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]), 
            j = i;
            return sum;
        }, Earcut;
    }(), EarcutNode = function() {
        function EarcutNode(i, x, y) {
            this.i = null, this.x = null, this.y = null, this.prev = null, this.next = null, 
            this.z = null, this.prevZ = null, this.nextZ = null, this.steiner = null, this.i = i, 
            this.x = x, this.y = y, this.prev = null, this.next = null, this.z = null, this.prevZ = null, 
            this.nextZ = null, this.steiner = !1;
        }
        return __class(EarcutNode, "laya.webgl.shapes.EarcutNode"), EarcutNode;
    }(), Submit = (function() {
        function GeometryData(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) {
            this.lineWidth = lineWidth, this.lineColor = lineColor, this.lineAlpha = lineAlpha, 
            this.fillColor = fillColor, this.fillAlpha = fillAlpha, this.shape = shape, this.fill = fill;
        }
        __class(GeometryData, "laya.webgl.shapes.GeometryData");
        var __proto = GeometryData.prototype;
        __proto.clone = function() {
            return new GeometryData(this.lineWidth, this.lineColor, this.lineAlpha, this.fillColor, this.fillAlpha, this.fill, this.shape);
        }, __proto.getIndexData = function() {
            return null;
        }, __proto.getVertexData = function() {
            return null;
        }, __proto.destroy = function() {
            this.shape = null;
        };
    }(), function() {
        function Vertex(p) {
            if (p instanceof Float32Array) this.points = p; else if (p instanceof Array) {
                p.length;
                this.points = new Float32Array(p);
            }
        }
        __class(Vertex, "laya.webgl.shapes.Vertex");
        var __proto = Vertex.prototype;
        Laya.imps(__proto, {
            "laya.webgl.shapes.IShape": !0
        }), __proto.getData = function(ib, vb, start) {}, __proto.needUpdate = function(mat) {
            return !1;
        }, __proto.rebuild = function(points) {}, __proto.setMatrix = function(mat) {};
    }(), function() {
        function Submit(renderType) {
            void 0 === renderType && (renderType = 1e4), this._renderType = renderType;
        }
        __class(Submit, "laya.webgl.submit.Submit");
        var __proto = Submit.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.submit.ISubmit": !0
        }), __proto.releaseRender = function() {
            var cache = Submit._cache;
            (cache[cache._length++] = this).shaderValue.release(), this.shaderValue = null, 
            this._vb = null, this._ib = null;
        }, __proto.getRenderType = function() {
            return this._renderType;
        }, __proto.renderSubmit = function() {
            if (0 === this._numEle) return 1;
            var _tex = this.shaderValue.textureHost;
            if (_tex) {
                var source = _tex.source;
                if (!_tex.bitmap || !source) return 1;
                this.shaderValue.texture = source;
            }
            this._vb.bind_upload(this._ib);
            var gl = WebGL.mainContext;
            return this.shaderValue.upload(), BlendMode.activeBlendFunction !== this._blendFn && (gl.enable(3042), 
            this._blendFn(gl), BlendMode.activeBlendFunction = this._blendFn), Stat.drawCall++, 
            Stat.trianglesFaces += this._numEle / 3, gl.drawElements(4, this._numEle, 5123, this._startIdx), 
            1;
        }, Submit.__init__ = function() {
            var s = Submit.RENDERBASE = new Submit(-1);
            s.shaderValue = new Value2D(0, 0), s.shaderValue.ALPHA = -1234;
        }, Submit.createSubmit = function(context, ib, vb, pos, sv) {
            var o = Submit._cache._length ? Submit._cache[--Submit._cache._length] : new Submit();
            null == vb && ((vb = o._selfVb || (o._selfVb = VertexBuffer2D.create(-1))).clear(), 
            pos = 0), o._ib = ib, o._vb = vb, o._startIdx = pos * CONST3D2D.BYTES_PIDX, o._numEle = 0;
            var blendType = context._nBlendType;
            o._blendFn = context._targets ? BlendMode.targetFns[blendType] : BlendMode.fns[blendType], 
            o.shaderValue = sv, o.shaderValue.setValue(context._shader2D);
            var filters = context._shader2D.filters;
            return filters && o.shaderValue.setFilters(filters), o;
        }, Submit.createShape = function(ctx, ib, vb, numEle, offset, sv) {
            var o = Submit._cache._length ? Submit._cache[--Submit._cache._length] : new Submit();
            o._ib = ib, o._vb = vb, o._numEle = numEle, o._startIdx = offset, o.shaderValue = sv, 
            o.shaderValue.setValue(ctx._shader2D);
            var blendType = ctx._nBlendType;
            return o._blendFn = ctx._targets ? BlendMode.targetFns[blendType] : BlendMode.fns[blendType], 
            o;
        }, Submit.TYPE_2D = 1e4, Submit.TYPE_CANVAS = 10003, Submit.TYPE_CMDSETRT = 10004, 
        Submit.TYPE_CUSTOM = 10005, Submit.TYPE_BLURRT = 10006, Submit.TYPE_CMDDESTORYPRERT = 10007, 
        Submit.TYPE_DISABLESTENCIL = 10008, Submit.TYPE_OTHERIBVB = 10009, Submit.TYPE_PRIMITIVE = 10010, 
        Submit.TYPE_RT = 10011, Submit.TYPE_BLUR_RT = 10012, Submit.TYPE_TARGET = 10013, 
        Submit.TYPE_CHANGE_VALUE = 10014, Submit.TYPE_SHAPE = 10015, Submit.TYPE_TEXTURE = 10016, 
        Submit.TYPE_FILLTEXTURE = 10017, Submit.RENDERBASE = null, Submit._cache = ((Submit._cache = [])._length = 0, 
        Submit._cache), Submit;
    }()), SubmitCMD = function() {
        function SubmitCMD() {
            this.fun = null, this.args = null;
        }
        __class(SubmitCMD, "laya.webgl.submit.SubmitCMD");
        var __proto = SubmitCMD.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.submit.ISubmit": !0
        }), __proto.renderSubmit = function() {
            return this.fun.apply(null, this.args), 1;
        }, __proto.getRenderType = function() {
            return 0;
        }, __proto.releaseRender = function() {
            var cache = SubmitCMD._cache;
            cache[cache._length++] = this;
        }, SubmitCMD.create = function(args, fun) {
            var o = SubmitCMD._cache._length ? SubmitCMD._cache[--SubmitCMD._cache._length] : new SubmitCMD();
            return o.fun = fun, o.args = args, o;
        }, SubmitCMD._cache = ((SubmitCMD._cache = [])._length = 0, SubmitCMD._cache), SubmitCMD;
    }(), SubmitCMDScope = function() {
        function SubmitCMDScope() {
            this.variables = {};
        }
        __class(SubmitCMDScope, "laya.webgl.submit.SubmitCMDScope");
        var __proto = SubmitCMDScope.prototype;
        return __proto.getValue = function(name) {
            return this.variables[name];
        }, __proto.addValue = function(name, value) {
            return this.variables[name] = value;
        }, __proto.setValue = function(name, value) {
            return this.variables.hasOwnProperty(name) ? this.variables[name] = value : null;
        }, __proto.clear = function() {
            for (var key in this.variables) delete this.variables[key];
        }, __proto.recycle = function() {
            this.clear(), SubmitCMDScope.POOL.push(this);
        }, SubmitCMDScope.create = function() {
            var scope = SubmitCMDScope.POOL.pop();
            return scope || (scope = new SubmitCMDScope()), scope;
        }, SubmitCMDScope.POOL = [], SubmitCMDScope;
    }(), SubmitOtherIBVB = function() {
        function SubmitOtherIBVB() {
            this.offset = 0, this.startIndex = 0, this._mat = Matrix.create();
        }
        __class(SubmitOtherIBVB, "laya.webgl.submit.SubmitOtherIBVB");
        var __proto = SubmitOtherIBVB.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.submit.ISubmit": !0
        }), __proto.releaseRender = function() {
            var cache = SubmitOtherIBVB._cache;
            (cache[cache._length++] = this).shaderValue.release(), this.shaderValue = null, 
            this._vb = null, this._ib = null;
        }, __proto.getRenderType = function() {
            return 10009;
        }, __proto.renderSubmit = function() {
            var _tex = this._shaderValue.textureHost;
            if (_tex) {
                var source = _tex.source;
                if (!_tex.bitmap || !source) return 1;
                this._shaderValue.texture = source;
            }
            this._vb.bind_upload(this._ib);
            var w = RenderState2D.worldMatrix4, wmat = Matrix.TEMP;
            Matrix.mulPre(this._mat, w[0], w[1], w[4], w[5], w[12], w[13], wmat);
            var tmp = RenderState2D.worldMatrix4 = SubmitOtherIBVB.tempMatrix4;
            tmp[0] = wmat.a, tmp[1] = wmat.b, tmp[4] = wmat.c, tmp[5] = wmat.d, tmp[12] = wmat.tx, 
            tmp[13] = wmat.ty, this._shader._offset = this.offset, this._shaderValue.refresh(), 
            this._shader.upload(this._shaderValue), this._shader._offset = 0;
            var gl = WebGL.mainContext;
            return BlendMode.activeBlendFunction !== this._blendFn && (gl.enable(3042), this._blendFn(gl), 
            BlendMode.activeBlendFunction = this._blendFn), Stat.drawCall++, Stat.trianglesFaces += this._numEle / 3, 
            gl.drawElements(4, this._numEle, 5123, this.startIndex), RenderState2D.worldMatrix4 = w, 
            BaseShader.activeShader = null, 1;
        }, SubmitOtherIBVB.create = function(context, vb, ib, numElement, shader, shaderValue, startIndex, offset, type) {
            void 0 === type && (type = 0);
            var o = SubmitOtherIBVB._cache._length ? SubmitOtherIBVB._cache[--SubmitOtherIBVB._cache._length] : new SubmitOtherIBVB();
            o._ib = ib, o._vb = vb, o._numEle = numElement, o._shader = shader, o._shaderValue = shaderValue;
            var blendType = context._nBlendType;
            switch (o._blendFn = context._targets ? BlendMode.targetFns[blendType] : BlendMode.fns[blendType], 
            type) {
              case 0:
                o.offset = 0, o.startIndex = offset / (CONST3D2D.BYTES_PE * vb.vertexStride) * 1.5, 
                o.startIndex *= CONST3D2D.BYTES_PIDX;
                break;

              case 1:
                o.startIndex = startIndex, o.offset = offset;
            }
            return o;
        }, SubmitOtherIBVB._cache = ((SubmitOtherIBVB._cache = [])._length = 0, SubmitOtherIBVB._cache), 
        SubmitOtherIBVB.tempMatrix4 = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ], 
        SubmitOtherIBVB;
    }(), SubmitScissor = function() {
        function SubmitScissor() {
            this.submitIndex = 0, this.submitLength = 0, this.context = null, this.clipRect = new Rectangle(), 
            this.screenRect = new Rectangle();
        }
        __class(SubmitScissor, "laya.webgl.submit.SubmitScissor");
        var __proto = SubmitScissor.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.submit.ISubmit": !0
        }), __proto._scissor = function(x, y, w, h) {
            var m = RenderState2D.worldMatrix4, a = m[0], d = m[5], tx = m[12], ty = m[13];
            if (h *= d, (w *= a) < 1 || h < 1) return !1;
            var r = (x = x * a + tx) + w, b = (y = y * d + ty) + h;
            x < 0 && (w = r - (x = 0)), y < 0 && (h = b - (y = 0));
            var screen = RenderState2D.worldClipRect;
            if (x = Math.max(x, screen.x), y = Math.max(y, screen.y), w = Math.min(r, screen.right) - x, 
            h = Math.min(b, screen.bottom) - y, w < 1 || h < 1) return !1;
            var worldScissorTest = RenderState2D.worldScissorTest;
            return this.screenRect.copyFrom(screen), screen.x = x, screen.y = y, screen.width = w, 
            screen.height = h, RenderState2D.worldScissorTest = !0, y = RenderState2D.height - y - h, 
            WebGL.mainContext.scissor(x, y, w, h), WebGL.mainContext.enable(3089), this.context.submitElement(this.submitIndex, this.submitIndex + this.submitLength), 
            worldScissorTest ? (y = RenderState2D.height - this.screenRect.y - this.screenRect.height, 
            WebGL.mainContext.scissor(this.screenRect.x, y, this.screenRect.width, this.screenRect.height), 
            WebGL.mainContext.enable(3089)) : (WebGL.mainContext.disable(3089), RenderState2D.worldScissorTest = !1), 
            screen.copyFrom(this.screenRect), !0;
        }, __proto._scissorWithTagart = function(x, y, w, h) {
            if (w < 1 || h < 1) return !1;
            var r = x + w, b = y + h;
            x < 0 && (w = r - (x = 0)), y < 0 && (h = b - (y = 0));
            var screen = RenderState2D.worldClipRect;
            if (x = Math.max(x, screen.x), y = Math.max(y, screen.y), w = Math.min(r, screen.right) - x, 
            h = Math.min(b, screen.bottom) - y, w < 1 || h < 1) return !1;
            var worldScissorTest = RenderState2D.worldScissorTest;
            return this.screenRect.copyFrom(screen), RenderState2D.worldScissorTest = !0, screen.x = x, 
            screen.y = y, screen.width = w, screen.height = h, y = RenderState2D.height - y - h, 
            WebGL.mainContext.scissor(x, y, w, h), WebGL.mainContext.enable(3089), this.context.submitElement(this.submitIndex, this.submitIndex + this.submitLength), 
            worldScissorTest ? (y = RenderState2D.height - this.screenRect.y - this.screenRect.height, 
            WebGL.mainContext.scissor(this.screenRect.x, y, this.screenRect.width, this.screenRect.height), 
            WebGL.mainContext.enable(3089)) : (WebGL.mainContext.disable(3089), RenderState2D.worldScissorTest = !1), 
            screen.copyFrom(this.screenRect), !0;
        }, __proto.renderSubmit = function() {
            return this.submitLength = Math.min(this.context._submits._length - 1, this.submitLength), 
            this.submitLength < 1 || this.clipRect.width < 1 || this.clipRect.height < 1 || (this.context._targets ? this._scissorWithTagart(this.clipRect.x, this.clipRect.y, this.clipRect.width, this.clipRect.height) : this._scissor(this.clipRect.x, this.clipRect.y, this.clipRect.width, this.clipRect.height)), 
            this.submitLength + 1;
        }, __proto.getRenderType = function() {
            return 0;
        }, __proto.releaseRender = function() {
            var cache = SubmitScissor._cache;
            (cache[cache._length++] = this).context = null;
        }, SubmitScissor.create = function(context) {
            var o = SubmitScissor._cache._length ? SubmitScissor._cache[--SubmitScissor._cache._length] : new SubmitScissor();
            return o.context = context, o;
        }, SubmitScissor._cache = ((SubmitScissor._cache = [])._length = 0, SubmitScissor._cache), 
        SubmitScissor;
    }(), SubmitStencil = function() {
        function SubmitStencil() {
            this.step = 0, this.blendMode = null, this.level = 0;
        }
        __class(SubmitStencil, "laya.webgl.submit.SubmitStencil");
        var __proto = SubmitStencil.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.submit.ISubmit": !0
        }), __proto.renderSubmit = function() {
            switch (this.step) {
              case 1:
                this.do1();
                break;

              case 2:
                this.do2();
                break;

              case 3:
                this.do3();
                break;

              case 4:
                this.do4();
                break;

              case 5:
                this.do5();
                break;

              case 6:
                this.do6();
                break;

              case 7:
                this.do7();
                break;

              case 8:
                this.do8();
            }
            return 1;
        }, __proto.getRenderType = function() {
            return 0;
        }, __proto.releaseRender = function() {
            var cache = SubmitStencil._cache;
            cache[cache._length++] = this;
        }, __proto.do1 = function() {
            var gl = WebGL.mainContext;
            gl.enable(2960), gl.clear(1024), gl.colorMask(!1, !1, !1, !1), gl.stencilFunc(514, this.level, 255), 
            gl.stencilOp(7680, 7680, 7682);
        }, __proto.do2 = function() {
            var gl = WebGL.mainContext;
            gl.stencilFunc(514, this.level + 1, 255), gl.colorMask(!0, !0, !0, !0), gl.stencilOp(7680, 7680, 7680);
        }, __proto.do3 = function() {
            var gl = WebGL.mainContext;
            gl.colorMask(!0, !0, !0, !0), gl.stencilOp(7680, 7680, 7680), gl.clear(1024), gl.disable(2960);
        }, __proto.do4 = function() {
            var gl = WebGL.mainContext;
            0 == this.level && (gl.enable(2960), gl.clear(1024)), gl.colorMask(!1, !1, !1, !1), 
            gl.stencilFunc(519, 0, 255), gl.stencilOp(7680, 7680, 7682);
        }, __proto.do5 = function() {
            var gl = WebGL.mainContext;
            gl.stencilFunc(514, this.level, 255), gl.colorMask(!0, !0, !0, !0), gl.stencilOp(7680, 7680, 7680);
        }, __proto.do6 = function() {
            var gl = WebGL.mainContext;
            BlendMode.targetFns[BlendMode.TOINT[this.blendMode]](gl);
        }, __proto.do7 = function() {
            var gl = WebGL.mainContext;
            gl.colorMask(!1, !1, !1, !1), gl.stencilOp(7680, 7680, 7683);
        }, __proto.do8 = function() {
            var gl = WebGL.mainContext;
            gl.colorMask(!0, !0, !0, !0), gl.stencilFunc(514, this.level, 255), gl.stencilOp(7680, 7680, 7680);
        }, SubmitStencil.restore = function(context, clip, m, _x, _y) {
            var submitStencil;
            if ((context._renderKey = 0) < SubmitStencil._mask && SubmitStencil._mask--, 0 == SubmitStencil._mask) submitStencil = laya.webgl.submit.SubmitStencil.create(3), 
            context.addRenderObject(submitStencil), context._curSubmit = Submit.RENDERBASE; else {
                submitStencil = laya.webgl.submit.SubmitStencil.create(7), context.addRenderObject(submitStencil);
                var vb = context._vb;
                vb._byteLength;
                if (GlUtils.fillRectImgVb(vb, null, clip.x, clip.y, clip.width, clip.height, Texture.DEF_UV, m, _x, _y, 0, 0)) {
                    context._shader2D.glTexture = null;
                    var submit = context._curSubmit = Submit.createSubmit(context, context._ib, vb, (vb._byteLength - 64) / 32 * 3, Value2D.create(2, 0));
                    submit.shaderValue.ALPHA = 1, context._submits[context._submits._length++] = submit, 
                    context._curSubmit._numEle += 6, context._curSubmit = Submit.RENDERBASE;
                } else alert("clipRect calc stencil rect error");
                submitStencil = laya.webgl.submit.SubmitStencil.create(8), context.addRenderObject(submitStencil);
            }
        }, SubmitStencil.restore2 = function(context, submit) {
            var submitStencil;
            (context._renderKey = 0) < SubmitStencil._mask && SubmitStencil._mask--, 0 == SubmitStencil._mask ? (submitStencil = laya.webgl.submit.SubmitStencil.create(3), 
            context.addRenderObject(submitStencil), context._curSubmit = Submit.RENDERBASE) : (submitStencil = laya.webgl.submit.SubmitStencil.create(7), 
            context.addRenderObject(submitStencil), context._submits[context._submits._length++] = submit, 
            submitStencil = laya.webgl.submit.SubmitStencil.create(8), context.addRenderObject(submitStencil));
        }, SubmitStencil.create = function(step) {
            var o = SubmitStencil._cache._length ? SubmitStencil._cache[--SubmitStencil._cache._length] : new SubmitStencil();
            return 5 == (o.step = step) && ++SubmitStencil._mask, o.level = SubmitStencil._mask, 
            o;
        }, SubmitStencil._cache = ((SubmitStencil._cache = [])._length = 0, SubmitStencil._cache), 
        SubmitStencil._mask = 0, SubmitStencil;
    }(), SubmitTarget = function() {
        function SubmitTarget() {
            this._renderType = 0, this._vb = null, this._ib = null, this._startIdx = 0, this._numEle = 0, 
            this.shaderValue = null, this.blendType = 0, this.proName = null, this.scope = null;
        }
        __class(SubmitTarget, "laya.webgl.submit.SubmitTarget");
        var __proto = SubmitTarget.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.submit.ISubmit": !0
        }), __proto.renderSubmit = function() {
            this._vb.bind_upload(this._ib);
            var target = this.scope.getValue(this.proName);
            return target && (this.shaderValue.texture = target.source, this.shaderValue.strength && !this.shaderValue.blurInfo && (this.shaderValue.blurInfo = [ target.width, target.height ]), 
            this.shaderValue.upload(), this.blend(), Stat.drawCall++, Stat.trianglesFaces += this._numEle / 3, 
            WebGL.mainContext.drawElements(4, this._numEle, 5123, this._startIdx)), 1;
        }, __proto.blend = function() {
            if (BlendMode.activeBlendFunction !== BlendMode.fns[this.blendType]) {
                var gl = WebGL.mainContext;
                gl.enable(3042), BlendMode.fns[this.blendType](gl), BlendMode.activeBlendFunction = BlendMode.fns[this.blendType];
            }
        }, __proto.getRenderType = function() {
            return 0;
        }, __proto.releaseRender = function() {
            var cache = SubmitTarget._cache;
            (cache[cache._length++] = this).shaderValue.release(), this.shaderValue = null, 
            this._vb = null, this._ib = null;
        }, SubmitTarget.create = function(context, ib, vb, pos, sv, proName) {
            var o = SubmitTarget._cache._length ? SubmitTarget._cache[--SubmitTarget._cache._length] : new SubmitTarget();
            return o._ib = ib, o._vb = vb, o.proName = proName, o._startIdx = pos * CONST3D2D.BYTES_PIDX, 
            o._numEle = 0, o.blendType = context._nBlendType, o.shaderValue = sv, o.shaderValue.setValue(context._shader2D), 
            o;
        }, SubmitTarget._cache = ((SubmitTarget._cache = [])._length = 0, SubmitTarget._cache), 
        SubmitTarget;
    }(), CharSegment = function() {
        function CharSegment() {
            this._sourceStr = null;
        }
        __class(CharSegment, "laya.webgl.text.CharSegment");
        var __proto = CharSegment.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.text.ICharSegment": !0
        }), __proto.textToSpit = function(str) {
            this._sourceStr = str;
        }, __proto.getChar = function(i) {
            return this._sourceStr.charAt(i);
        }, __proto.getCharCode = function(i) {
            return this._sourceStr.charCodeAt(i);
        }, __proto.length = function() {
            return this._sourceStr.length;
        }, CharSegment;
    }(), DrawText = function() {
        var CharValue;
        function DrawText() {}
        return __class(DrawText, "laya.webgl.text.DrawText"), DrawText.__init__ = function() {
            DrawText._charsTemp = new Array(), DrawText._drawValue = new CharValue(), DrawText._charSeg = new CharSegment();
        }, DrawText.customCharSeg = function(charseg) {
            DrawText._charSeg = charseg;
        }, DrawText.getChar = function(char, id, drawValue) {
            var result = WebGLCharImage.createOneChar(char, drawValue);
            return -1 != id && (DrawText._charsCache[id] = result), result;
        }, DrawText._drawSlow = function(save, ctx, txt, words, curMat, font, textAlign, fillColor, borderColor, lineWidth, x, y, sx, sy, underLine) {
            var oneChar, htmlWord, drawValue = DrawText._drawValue.value(font, fillColor, borderColor, lineWidth, sx, sy, underLine), i = 0, n = 0, chars = DrawText._charsTemp, width = 0, id = NaN;
            if (words) for (chars.length = words.length, i = 0, n = words.length; i < n; i++) id = (htmlWord = words[i]).charNum + drawValue.txtID, 
            chars[i] = oneChar = DrawText._charsCache[id] || DrawText.getChar(htmlWord.char, id, drawValue), 
            oneChar.active(); else {
                var text = txt instanceof laya.utils.WordText ? txt.toString() : txt;
                if (Text.CharacterCache) {
                    DrawText._charSeg.textToSpit(text);
                    var len = DrawText._charSeg.length();
                    for (i = 0, n = chars.length = len; i < n; i++) id = DrawText._charSeg.getCharCode(i) + drawValue.txtID, 
                    chars[i] = oneChar = DrawText._charsCache[id] || DrawText.getChar(DrawText._charSeg.getChar(i), id, drawValue), 
                    oneChar.active(), width += oneChar.cw;
                } else chars.length = 0, (oneChar = DrawText.getChar(text, -1, drawValue)).active(), 
                width += oneChar.cw, chars[0] = oneChar;
            }
            var dx = 0;
            null !== textAlign && "left" !== textAlign && (dx = -("center" == textAlign ? width / 2 : width));
            var texture, value, bdSz = NaN, saveLength = 0;
            if (words) for (i = 0, n = chars.length; i < n; i++) (oneChar = chars[i]).isSpace || (htmlWord = words[i], 
            bdSz = oneChar.borderSize, texture = oneChar.texture, ctx._drawText(texture, x + dx + htmlWord.x * sx - bdSz, y + htmlWord.y * sy - bdSz, texture.width, texture.height, curMat, 0, 0, 0, 0)); else {
                for (i = 0, n = chars.length; i < n; i++) (oneChar = chars[i]).isSpace || (bdSz = oneChar.borderSize, 
                texture = oneChar.texture, ctx._drawText(texture, x + dx - bdSz, y - bdSz, texture.width, texture.height, curMat, 0, 0, 0, 0), 
                save && ((value = save[saveLength++]) || (value = save[saveLength - 1] = []), value[0] = texture, 
                value[1] = dx - bdSz, value[2] = -bdSz)), dx += oneChar.cw;
                save && (save.length = saveLength);
            }
        }, DrawText._drawFast = function(save, ctx, curMat, x, y) {
            for (var texture, value, i = 0, n = save.length; i < n; i++) (texture = (value = save[i])[0]).active(), 
            ctx._drawText(texture, x + value[1], y + value[2], texture.width, texture.height, curMat, 0, 0, 0, 0);
        }, DrawText.drawText = function(ctx, txt, words, curMat, font, textAlign, fillColor, borderColor, lineWidth, x, y, underLine) {
            if (void 0 === underLine && (underLine = 0), !(txt && 0 === txt.length || words && 0 === words.length)) {
                var sx = curMat.a, sy = curMat.d;
                (0 !== curMat.b || 0 !== curMat.c) && (sx = sy = 1);
                var scale = 1 !== sx || 1 !== sy;
                if (scale && Laya.stage.transform) {
                    var t = Laya.stage.transform;
                    scale = t.a === sx && t.d === sy;
                } else scale = !1;
                if (scale) {
                    var tempTx = (curMat = curMat.copyTo(WebGLContext2D._tmpMatrix)).tx, tempTy = curMat.ty;
                    curMat.scale(1 / sx, 1 / sy), curMat._checkTransform(), x *= sx, y *= sy, x += tempTx - curMat.tx, 
                    y += tempTy - curMat.ty;
                } else sx = sy = 1;
                if (words) DrawText._drawSlow(null, ctx, txt, words, curMat, font, textAlign, fillColor, borderColor, lineWidth, x, y, sx, sy, underLine); else {
                    if (null === txt.toUpperCase) {
                        var idNum = sx + 1e5 * sy, myCache = txt;
                        return void (myCache.changed || myCache.id !== idNum ? (myCache.id = idNum, myCache.changed = !1, 
                        DrawText._drawSlow(myCache.save, ctx, txt, words, curMat, font, textAlign, fillColor, borderColor, lineWidth, x, y, sx, sy, underLine)) : DrawText._drawFast(myCache.save, ctx, curMat, x, y));
                    }
                    var id = txt + font.toString() + fillColor + borderColor + lineWidth + sx + sy + textAlign, cache = DrawText._textsCache[id];
                    Text.CharacterCache ? cache ? DrawText._drawFast(cache, ctx, curMat, x, y) : (DrawText._textsCache.__length || (DrawText._textsCache.__length = 0), 
                    DrawText._textsCache.__length > Config.WebGLTextCacheCount && ((DrawText._textsCache = {}).__length = 0, 
                    DrawText._curPoolIndex = 0), DrawText._textCachesPool[DrawText._curPoolIndex] ? (cache = DrawText._textsCache[id] = DrawText._textCachesPool[DrawText._curPoolIndex]).length = 0 : DrawText._textCachesPool[DrawText._curPoolIndex] = cache = DrawText._textsCache[id] = [], 
                    DrawText._textsCache.__length++, DrawText._curPoolIndex++, DrawText._drawSlow(cache, ctx, txt, words, curMat, font, textAlign, fillColor, borderColor, lineWidth, x, y, sx, sy, underLine)) : DrawText._drawSlow(cache, ctx, txt, words, curMat, font, textAlign, fillColor, borderColor, lineWidth, x, y, sx, sy, underLine);
                }
            }
        }, DrawText._charsTemp = null, DrawText._textCachesPool = [], DrawText._curPoolIndex = 0, 
        DrawText._charsCache = {}, DrawText._textsCache = {}, DrawText._drawValue = null, 
        DrawText.d = [], DrawText._charSeg = null, DrawText.__init$ = function() {
            CharValue = function() {
                function CharValue() {}
                return __class(CharValue, ""), CharValue.prototype.value = function(font, fillColor, borderColor, lineWidth, scaleX, scaleY, underLine) {
                    this.font = font, this.fillColor = fillColor, this.borderColor = borderColor, this.lineWidth = lineWidth, 
                    this.scaleX = scaleX, this.scaleY = scaleY, this.underLine = underLine;
                    var key = font.toString() + scaleX + scaleY + lineWidth + (fillColor ? fillColor.toLowerCase() : " ") + (borderColor ? borderColor.toLowerCase() : " ") + underLine;
                    return this.txtID = CharValue._keymap[key], this.txtID || (this.txtID = 1e-7 * ++CharValue._keymapCount, 
                    CharValue._keymap[key] = this.txtID), this;
                }, CharValue.clear = function() {
                    CharValue._keymap = {}, CharValue._keymapCount = 1;
                }, CharValue._keymap = {}, CharValue._keymapCount = 1, CharValue;
            }();
        }, DrawText;
    }(), FontInContext = function() {
        function FontInContext(font) {
            this._index = 0, this._size = 14, this._italic = -2, FontInContext._cache2 = FontInContext._cache2 || [], 
            this.setFont(font || "14px Arial");
        }
        __class(FontInContext, "laya.webgl.text.FontInContext");
        var __proto = FontInContext.prototype;
        return __proto.setFont = function(value) {
            var arr = FontInContext._cache2[value];
            if (arr) this._words = arr[0], this._size = arr[1]; else {
                this._words = value.split(" ");
                for (var i = 0, n = this._words.length; i < n; i++) if (0 < this._words[i].indexOf("px")) {
                    this._index = i;
                    break;
                }
                this._size = parseInt(this._words[this._index]), FontInContext._cache2[value] = [ this._words, this._size ];
            }
            this._text = null, this._italic = -2;
        }, __proto.getItalic = function() {
            return -2 === this._italic && (this._italic = this.hasType("italic")), this._italic;
        }, __proto.hasType = function(name) {
            for (var i = 0, n = this._words.length; i < n; i++) if (this._words[i] === name) return i;
            return -1;
        }, __proto.removeType = function(name) {
            for (var i = 0, n = this._words.length; i < n; i++) if (this._words[i] === name) {
                this._words.splice(i, 1), this._index > i && this._index--;
                break;
            }
            this._text = null, this._italic = -2;
        }, __proto.copyTo = function(dec) {
            return dec._text = this._text, dec._size = this._size, dec._index = this._index, 
            dec._words = this._words.slice(), dec._italic = -2, dec;
        }, __proto.toString = function() {
            return this._text ? this._text : this._text = this._words.join(" ");
        }, __getset(0, __proto, "size", function() {
            return this._size;
        }, function(value) {
            this._size = value, this._words[this._index] = value + "px", this._text = null;
        }), FontInContext.create = function(font) {
            var r = FontInContext._cache[font];
            return r || (r = FontInContext._cache[font] = new FontInContext(font));
        }, FontInContext.EMPTY = new FontInContext(), FontInContext._cache = {}, FontInContext._cache2 = null, 
        FontInContext;
    }(), CONST3D2D = function() {
        function CONST3D2D() {}
        return __class(CONST3D2D, "laya.webgl.utils.CONST3D2D"), CONST3D2D.defaultMatrix4 = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ], 
        CONST3D2D.defaultMinusYMatrix4 = [ 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ], 
        CONST3D2D.uniformMatrix3 = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0 ], CONST3D2D._TMPARRAY = [], 
        CONST3D2D._OFFSETX = 0, CONST3D2D._OFFSETY = 0, __static(CONST3D2D, [ "BYTES_PE", function() {
            return this.BYTES_PE = Float32Array.BYTES_PER_ELEMENT;
        }, "BYTES_PIDX", function() {
            return this.BYTES_PIDX = Uint16Array.BYTES_PER_ELEMENT;
        } ]), CONST3D2D;
    }(), GlUtils = function() {
        function GlUtils() {}
        return __class(GlUtils, "laya.webgl.utils.GlUtils"), GlUtils.make2DProjection = function(width, height, depth) {
            return [ 2 / width, 0, 0, 0, 0, -2 / height, 0, 0, 0, 0, 2 / depth, 0, -1, 1, 0, 1 ];
        }, GlUtils.fillIBQuadrangle = function(buffer, count) {
            if (65535 / 4 < count) throw Error("IBQuadrangle count:" + count + " must<:" + Math.floor(65535 / 4));
            count = Math.floor(count), buffer._resizeBuffer(6 * (count + 1) * 2, !1), buffer.byteLength = buffer.bufferLength;
            for (var bufferData = buffer.getUint16Array(), idx = 0, i = 0; i < count; i++) bufferData[idx++] = 4 * i, 
            bufferData[idx++] = 4 * i + 2, bufferData[idx++] = 4 * i + 1, bufferData[idx++] = 4 * i, 
            bufferData[idx++] = 4 * i + 3, bufferData[idx++] = 4 * i + 2;
            return buffer.setNeedUpload(), !0;
        }, GlUtils.expandIBQuadrangle = function(buffer, count) {
            buffer.bufferLength >= 6 * count * 2 || GlUtils.fillIBQuadrangle(buffer, count);
        }, GlUtils.mathCeilPowerOfTwo = function(value) {
            return value--, value |= value >> 1, value |= value >> 2, value |= value >> 4, value |= value >> 8, 
            value |= value >> 16, ++value;
        }, GlUtils.fillQuadrangleImgVb = function(vb, x, y, point4, uv, m, _x, _y) {
            var vpos = 16 + (vb._byteLength >> 2);
            vb.byteLength = vpos << 2;
            var vbdata = vb.getFloat32Array();
            vbdata[(vpos -= 16) + 2] = uv[0], vbdata[vpos + 3] = uv[1], vbdata[vpos + 6] = uv[2], 
            vbdata[vpos + 7] = uv[3], vbdata[vpos + 10] = uv[4], vbdata[vpos + 11] = uv[5], 
            vbdata[vpos + 14] = uv[6], vbdata[vpos + 15] = uv[7];
            var a = m.a, b = m.b, c = m.c, d = m.d;
            if (1 !== a || 0 !== b || 0 !== c || 1 !== d) {
                m.bTransform = !0;
                var tx = m.tx + _x, ty = m.ty + _y;
                vbdata[vpos] = (point4[0] + x) * a + (point4[1] + y) * c + tx, vbdata[vpos + 1] = (point4[0] + x) * b + (point4[1] + y) * d + ty, 
                vbdata[vpos + 4] = (point4[2] + x) * a + (point4[3] + y) * c + tx, vbdata[vpos + 5] = (point4[2] + x) * b + (point4[3] + y) * d + ty, 
                vbdata[vpos + 8] = (point4[4] + x) * a + (point4[5] + y) * c + tx, vbdata[vpos + 9] = (point4[4] + x) * b + (point4[5] + y) * d + ty, 
                vbdata[vpos + 12] = (point4[6] + x) * a + (point4[7] + y) * c + tx, vbdata[vpos + 13] = (point4[6] + x) * b + (point4[7] + y) * d + ty;
            } else m.bTransform = !1, x += m.tx + _x, y += m.ty + _y, vbdata[vpos] = x + point4[0], 
            vbdata[vpos + 1] = y + point4[1], vbdata[vpos + 4] = x + point4[2], vbdata[vpos + 5] = y + point4[3], 
            vbdata[vpos + 8] = x + point4[4], vbdata[vpos + 9] = y + point4[5], vbdata[vpos + 12] = x + point4[6], 
            vbdata[vpos + 13] = y + point4[7];
            return vb._upload = !0;
        }, GlUtils.fillTranglesVB = function(vb, x, y, points, m, _x, _y) {
            var vpos = (vb._byteLength >> 2) + points.length;
            vb.byteLength = vpos << 2;
            var vbdata = vb.getFloat32Array();
            vpos -= points.length;
            for (var len = points.length, a = m.a, b = m.b, c = m.c, d = m.d, i = 0; i < len; i += 4) if (vbdata[vpos + i + 2] = points[i + 2], 
            vbdata[vpos + i + 3] = points[i + 3], 1 !== a || 0 !== b || 0 !== c || 1 !== d) {
                m.bTransform = !0;
                var tx = m.tx + _x, ty = m.ty + _y;
                vbdata[vpos + i] = (points[i] + x) * a + (points[i + 1] + y) * c + tx, vbdata[vpos + i + 1] = (points[i] + x) * b + (points[i + 1] + y) * d + ty;
            } else m.bTransform = !1, x += m.tx + _x, y += m.ty + _y, vbdata[vpos + i] = x + points[i], 
            vbdata[vpos + i + 1] = y + points[i + 1];
            return vb._upload = !0;
        }, GlUtils.copyPreImgVb = function(vb, dx, dy) {
            var vpos = vb._byteLength >> 2;
            vb.byteLength = vpos + 16 << 2;
            for (var vbdata = vb.getFloat32Array(), i = 0, ci = vpos - 16; i < 4; i++) vbdata[vpos] = vbdata[ci] + dx, 
            ++ci, vbdata[++vpos] = vbdata[ci] + dy, ++ci, vbdata[++vpos] = vbdata[ci], ++ci, 
            vbdata[++vpos] = vbdata[ci], ++vpos, ++ci;
            vb._upload = !0;
        }, GlUtils.fillRectImgVb = function(vb, clip, x, y, width, height, uv, m, _x, _y, dx, dy, round) {
            void 0 === round && (round = !1);
            var toBx, toBy, toEx, toEy, cBx, cBy, cEx, cEy, w0, h0, tx, ty, finalX, finalY, offsetX, offsetY, mType = 1, a = m.a, b = m.b, c = m.c, d = m.d, useClip = clip && clip.width < 99999999;
            if (1 !== a || 0 !== b || 0 !== c || 1 !== d ? (m.bTransform = !0, 0 === b && 0 === c && (mType = 23, 
            w0 = width + x, h0 = height + y, toBx = a * x + (tx = m.tx + _x), toEx = a * w0 + tx, 
            toBy = d * y + (ty = m.ty + _y), toEy = d * h0 + ty)) : (mType = 23, m.bTransform = !1, 
            toEx = (toBx = x + m.tx + _x) + width, toEy = (toBy = y + m.ty + _y) + height), 
            useClip && (cBx = clip.x, cBy = clip.y, cEx = clip.width + cBx, cEy = clip.height + cBy), 
            1 !== mType) {
                if (Math.min(toBx, toEx) >= cEx) return !1;
                if (Math.min(toBy, toEy) >= cEy) return !1;
                if (Math.max(toEx, toBx) <= cBx) return !1;
                if (Math.max(toEy, toBy) <= cBy) return !1;
            }
            var vpos = vb._byteLength >> 2;
            vb.byteLength = 16 + vpos << 2;
            var vbdata = vb.getFloat32Array();
            switch (vbdata[2 + vpos] = uv[0], vbdata[3 + vpos] = uv[1], vbdata[6 + vpos] = uv[2], 
            vbdata[7 + vpos] = uv[3], vbdata[10 + vpos] = uv[4], vbdata[11 + vpos] = uv[5], 
            vbdata[14 + vpos] = uv[6], vbdata[15 + vpos] = uv[7], mType) {
              case 1:
                tx = m.tx + _x, ty = m.ty + _y;
                var aw1 = a * x, ch1 = c * y, dh1 = d * y, bw1 = b * x, aw0 = a * (w0 = width + x), ch0 = c * (h0 = height + y), dh0 = d * h0, bw0 = b * w0;
                round ? (finalX = aw1 + ch1 + tx, offsetX = Math.round(finalX) - finalX, finalY = dh1 + bw1 + ty, 
                offsetY = Math.round(finalY) - finalY, vbdata[vpos] = finalX + offsetX, vbdata[1 + vpos] = finalY + offsetY, 
                vbdata[4 + vpos] = aw0 + ch1 + tx + offsetX, vbdata[5 + vpos] = dh1 + bw0 + ty + offsetY, 
                vbdata[8 + vpos] = aw0 + ch0 + tx + offsetX, vbdata[9 + vpos] = dh0 + bw0 + ty + offsetY, 
                vbdata[12 + vpos] = aw1 + ch0 + tx + offsetX, vbdata[13 + vpos] = dh0 + bw1 + ty + offsetY) : (vbdata[vpos] = aw1 + ch1 + tx, 
                vbdata[1 + vpos] = dh1 + bw1 + ty, vbdata[4 + vpos] = aw0 + ch1 + tx, vbdata[5 + vpos] = dh1 + bw0 + ty, 
                vbdata[8 + vpos] = aw0 + ch0 + tx, vbdata[9 + vpos] = dh0 + bw0 + ty, vbdata[12 + vpos] = aw1 + ch0 + tx, 
                vbdata[13 + vpos] = dh0 + bw1 + ty);
                break;

              case 23:
                round ? (finalX = toBx + dx, offsetX = Math.round(finalX) - finalX, finalY = toBy, 
                offsetY = Math.round(finalY) - finalY, vbdata[vpos] = finalX + offsetX, vbdata[1 + vpos] = finalY + offsetY, 
                vbdata[4 + vpos] = toEx + dx + offsetX, vbdata[5 + vpos] = toBy + offsetY, vbdata[8 + vpos] = toEx + offsetX, 
                vbdata[9 + vpos] = toEy + offsetY, vbdata[12 + vpos] = toBx + offsetX, vbdata[13 + vpos] = toEy + offsetY) : (vbdata[vpos] = toBx + dx, 
                vbdata[1 + vpos] = toBy, vbdata[4 + vpos] = toEx + dx, vbdata[5 + vpos] = toBy, 
                vbdata[8 + vpos] = toEx, vbdata[9 + vpos] = toEy, vbdata[12 + vpos] = toBx, vbdata[13 + vpos] = toEy);
            }
            return vb._upload = !0;
        }, GlUtils.fillLineVb = function(vb, clip, fx, fy, tx, ty, width, mat) {
            var linew = .5 * width, data = GlUtils._fillLineArray, perpx = -(fy - ty), perpy = fx - tx, dist = Math.sqrt(perpx * perpx + perpy * perpy);
            perpx /= dist, perpy /= dist, perpx *= linew, perpy *= linew, data[0] = fx - perpx, 
            data[1] = fy - perpy, data[4] = fx + perpx, data[5] = fy + perpy, data[8] = tx + perpx, 
            data[9] = ty + perpy, data[12] = tx - perpx, data[13] = ty - perpy, mat && mat.transformPointArray(data, data);
            var vpos = 16 + (vb._byteLength >> 2);
            return vb.byteLength = vpos << 2, vb.insertData(data, vpos - 16), !0;
        }, GlUtils._fillLineArray = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], 
        GlUtils;
    }(), Mesh2D = (function() {
        function MatirxArray() {}
        __class(MatirxArray, "laya.webgl.utils.MatirxArray"), MatirxArray.ArrayMul = function(a, b, o) {
            if (a) if (b) for (var ai0 = NaN, ai1 = NaN, ai2 = NaN, ai3 = NaN, i = 0; i < 4; i++) ai0 = a[i], 
            ai1 = a[i + 4], ai2 = a[i + 8], ai3 = a[i + 12], o[i] = ai0 * b[0] + ai1 * b[1] + ai2 * b[2] + ai3 * b[3], 
            o[i + 4] = ai0 * b[4] + ai1 * b[5] + ai2 * b[6] + ai3 * b[7], o[i + 8] = ai0 * b[8] + ai1 * b[9] + ai2 * b[10] + ai3 * b[11], 
            o[i + 12] = ai0 * b[12] + ai1 * b[13] + ai2 * b[14] + ai3 * b[15]; else MatirxArray.copyArray(a, o); else MatirxArray.copyArray(b, o);
        }, MatirxArray.copyArray = function(f, t) {
            if (f && t) for (var i = 0; i < f.length; i++) t[i] = f[i];
        };
    }(), function() {
        function Mesh2D(stride, vballoc, iballoc) {
            this._stride = 0, this.vertNum = 0, this.indexNum = 0, this._applied = !1, this._vb = null, 
            this._ib = null, this._vao = null, this._attribInfo = null, this._quadNum = 0, this.canReuse = !1, 
            this._stride = stride, this._vb = new VertexBuffer2D(stride, 35048), vballoc && this._vb._resizeBuffer(vballoc, !1), 
            this._ib = new IndexBuffer2D(), iballoc && this._ib._resizeBuffer(iballoc, !1);
        }
        __class(Mesh2D, "laya.webgl.utils.Mesh2D");
        var __proto = Mesh2D.prototype;
        return __proto.cloneWithNewVB = function() {
            var mesh = new Mesh2D(this._stride, 0, 0);
            return mesh._ib = this._ib, mesh._quadNum = this._quadNum, mesh._attribInfo = this._attribInfo, 
            mesh;
        }, __proto.cloneWithNewVBIB = function() {
            var mesh = new Mesh2D(this._stride, 0, 0);
            return mesh._attribInfo = this._attribInfo, mesh;
        }, __proto.getVBW = function() {
            return this._vb.setNeedUpload(), this._vb;
        }, __proto.getVBR = function() {
            return this._vb;
        }, __proto.getIBR = function() {
            return this._ib;
        }, __proto.getIBW = function() {
            return this._ib.setNeedUpload(), this._ib;
        }, __proto.createQuadIB = function(QuadNum) {
            this._quadNum = QuadNum, this._ib._resizeBuffer(6 * QuadNum * 2, !1), this._ib.byteLength = this._ib.bufferLength;
            for (var bd = this._ib.getUint16Array(), idx = 0, curvert = 0, i = 0; i < QuadNum; i++) bd[idx++] = curvert, 
            bd[idx++] = curvert + 2, bd[idx++] = curvert + 1, bd[idx++] = curvert, bd[idx++] = curvert + 3, 
            bd[idx++] = curvert + 2, curvert += 4;
            this._ib.setNeedUpload();
        }, __proto.setAttributes = function(attribs) {
            if (this._attribInfo = attribs, this._attribInfo.length % 3 != 0) throw "Mesh2D setAttributes error!";
        }, __proto.getEleNum = function() {
            return this._ib.getBuffer().byteLength / 2;
        }, __proto.releaseMesh = function() {}, __proto.destroy = function() {}, __proto.clearVB = function() {
            this._vb.clear();
        }, Mesh2D._gvaoid = 0, Mesh2D;
    }()), RenderState2D = function() {
        function RenderState2D() {}
        return __class(RenderState2D, "laya.webgl.utils.RenderState2D"), RenderState2D.getMatrArray = function() {
            return [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ];
        }, RenderState2D.mat2MatArray = function(mat, matArray) {
            var m = mat, m4 = matArray;
            return m4[0] = m.a, m4[1] = m.b, m4[2] = RenderState2D.EMPTYMAT4_ARRAY[2], m4[3] = RenderState2D.EMPTYMAT4_ARRAY[3], 
            m4[4] = m.c, m4[5] = m.d, m4[6] = RenderState2D.EMPTYMAT4_ARRAY[6], m4[7] = RenderState2D.EMPTYMAT4_ARRAY[7], 
            m4[8] = RenderState2D.EMPTYMAT4_ARRAY[8], m4[9] = RenderState2D.EMPTYMAT4_ARRAY[9], 
            m4[10] = RenderState2D.EMPTYMAT4_ARRAY[10], m4[11] = RenderState2D.EMPTYMAT4_ARRAY[11], 
            m4[12] = m.tx, m4[13] = m.ty, m4[14] = RenderState2D.EMPTYMAT4_ARRAY[14], m4[15] = RenderState2D.EMPTYMAT4_ARRAY[15], 
            matArray;
        }, RenderState2D.restoreTempArray = function() {
            RenderState2D.TEMPMAT4_ARRAY[0] = 1, RenderState2D.TEMPMAT4_ARRAY[1] = 0, RenderState2D.TEMPMAT4_ARRAY[4] = 0, 
            RenderState2D.TEMPMAT4_ARRAY[5] = 1, RenderState2D.TEMPMAT4_ARRAY[12] = 0, RenderState2D.TEMPMAT4_ARRAY[13] = 0;
        }, RenderState2D.clear = function() {
            RenderState2D.worldScissorTest = !1, RenderState2D.worldShaderDefines = null, RenderState2D.worldFilters = null, 
            RenderState2D.worldAlpha = 1, RenderState2D.worldClipRect.x = RenderState2D.worldClipRect.y = 0, 
            RenderState2D.worldClipRect.width = RenderState2D.width, RenderState2D.worldClipRect.height = RenderState2D.height, 
            RenderState2D.curRenderTarget = null;
        }, RenderState2D._MAXSIZE = 99999999, RenderState2D.EMPTYMAT4_ARRAY = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ], 
        RenderState2D.worldMatrix4 = RenderState2D.TEMPMAT4_ARRAY = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ], 
        RenderState2D.worldAlpha = 1, RenderState2D.worldScissorTest = !1, RenderState2D.worldFilters = null, 
        RenderState2D.worldShaderDefines = null, RenderState2D.curRenderTarget = null, RenderState2D.width = 0, 
        RenderState2D.height = 0, __static(RenderState2D, [ "worldMatrix", function() {
            return this.worldMatrix = new Matrix();
        }, "worldClipRect", function() {
            return this.worldClipRect = new Rectangle(0, 0, 99999999, 99999999);
        } ]), RenderState2D;
    }(), ShaderCompile = function() {
        var ShaderNode, InlcudeFile;
        function ShaderCompile(name, vs, ps, nameMap, defs) {
            var _$this = this;
            function _compile(script) {
                var includefiles = [], top = new ShaderNode(includefiles);
                return _$this._compileToTree(top, script.split("\n"), 0, includefiles, defs), top;
            }
            var startTime = Browser.now();
            this._VS = _compile(vs), this._PS = _compile(ps), this._nameMap = nameMap, 2 < Browser.now() - startTime && console.log("ShaderCompile use time:" + (Browser.now() - startTime) + "  size:" + vs.length + "/" + ps.length);
        }
        __class(ShaderCompile, "laya.webgl.utils.ShaderCompile");
        var __proto = ShaderCompile.prototype;
        return __proto._compileToTree = function(parent, lines, start, includefiles, defs) {
            var node, preNode, text, name, fname, words, noUseNode, ofs = 0, i = 0, n = 0, j = 0;
            for (i = start; i < lines.length; i++) if (!((text = lines[i]).length < 1) && 0 !== (ofs = text.indexOf("//"))) {
                if (0 <= ofs && (text = text.substr(0, ofs)), node = noUseNode || new ShaderNode(includefiles), 
                noUseNode = null, node.text = text, node.noCompile = !0, 0 <= (ofs = text.indexOf("#"))) {
                    for (name = "#", j = ofs + 1, n = text.length; j < n; j++) {
                        var c = text.charAt(j);
                        if (" " === c || "\t" === c || "?" === c) break;
                        name += c;
                    }
                    switch (node.name = name) {
                      case "#ifdef":
                      case "#ifndef":
                        if (node.src = text, node.noCompile = null != text.match(/[!&|()=<>]/), node.noCompile ? console.log("function():Boolean{return " + text.substr(ofs + node.name.length) + "}") : (words = text.replace(/^\s*/, "").split(/\s+/), 
                        node.setCondition(words[1], "#ifdef" === name ? 1 : 2), node.text = "//" + node.text), 
                        node.setParent(parent), parent = node, defs) for (words = text.substr(j).split(ShaderCompile._splitToWordExps3), 
                        j = 0; j < words.length; j++) (text = words[j]).length && (defs[text] = !0);
                        continue;

                      case "#if":
                        if (node.src = text, node.noCompile = !0, node.setParent(parent), parent = node, 
                        defs) for (words = text.substr(j).split(ShaderCompile._splitToWordExps3), j = 0; j < words.length; j++) (text = words[j]).length && "defined" != text && (defs[text] = !0);
                        continue;

                      case "#else":
                        node.src = text, preNode = (parent = parent.parent).childs[parent.childs.length - 1], 
                        node.noCompile = preNode.noCompile, node.noCompile || (node.condition = preNode.condition, 
                        node.conditionType = 1 == preNode.conditionType ? 2 : 1, node.text = "//" + node.text + " " + preNode.text + " " + node.conditionType), 
                        node.setParent(parent), parent = node;
                        continue;

                      case "#endif":
                        preNode = (parent = parent.parent).childs[parent.childs.length - 1], node.noCompile = preNode.noCompile, 
                        node.noCompile || (node.text = "//" + node.text), node.setParent(parent);
                        continue;

                      case "#include":
                        words = ShaderCompile.splitToWords(text, null);
                        var inlcudeFile = ShaderCompile.includes[words[1]];
                        if (!inlcudeFile) throw "ShaderCompile error no this include file:" + words[1];
                        if ((ofs = words[0].indexOf("?")) < 0) {
                            node.setParent(parent), text = inlcudeFile.getWith("with" == words[2] ? words[3] : null), 
                            this._compileToTree(node, text.split("\n"), 0, includefiles, defs), node.text = "";
                            continue;
                        }
                        node.setCondition(words[0].substr(ofs + 1), 1), node.text = inlcudeFile.getWith("with" == words[2] ? words[3] : null);
                        break;

                      case "#import":
                        fname = (words = ShaderCompile.splitToWords(text, null))[1], includefiles.push({
                            node: node,
                            file: ShaderCompile.includes[fname],
                            ofs: node.text.length
                        });
                        continue;
                    }
                } else {
                    if ((preNode = parent.childs[parent.childs.length - 1]) && !preNode.name) {
                        0 < includefiles.length && ShaderCompile.splitToWords(text, preNode), noUseNode = node, 
                        preNode.text += "\n" + text;
                        continue;
                    }
                    0 < includefiles.length && ShaderCompile.splitToWords(text, node);
                }
                node.setParent(parent);
            }
        }, __proto.createShader = function(define, shaderName, createShader) {
            var defMap = {}, defineStr = "";
            if (define) for (var i in define) defineStr += "#define " + i + "\n", defMap[i] = !0;
            var vs = this._VS.toscript(defMap, []), ps = this._PS.toscript(defMap, []);
            return (createShader || Shader.create)(defineStr + vs.join("\n"), defineStr + ps.join("\n"), shaderName, this._nameMap);
        }, ShaderCompile._parseOne = function(attributes, uniforms, words, i, word, b) {
            var one = {
                type: ShaderCompile.shaderParamsMap[words[i + 1]],
                name: words[i + 2],
                size: isNaN(parseInt(words[i + 3])) ? 1 : parseInt(words[i + 3])
            };
            return b && ("attribute" == word ? attributes.push(one) : uniforms.push(one)), ":" == words[i + 3] && (one.type = words[i + 4], 
            i += 2), i += 2;
        }, ShaderCompile.addInclude = function(fileName, txt) {
            if (!txt || 0 === txt.length) throw new Error("add shader include file err:" + fileName);
            if (ShaderCompile.includes[fileName]) throw new Error("add shader include file err, has add:" + fileName);
            ShaderCompile.includes[fileName] = new InlcudeFile(txt);
        }, ShaderCompile.preGetParams = function(vs, ps) {
            var text = [ vs, ps ], result = {}, attributes = [], uniforms = [], definesInfo = {}, definesName = [];
            result.attributes = attributes, result.uniforms = uniforms, result.defines = definesInfo;
            for (var i = 0, n = 0, s = 0; s < 2; s++) {
                text[s] = text[s].replace(ShaderCompile._removeAnnotation, "");
                var tempelse, words = text[s].match(ShaderCompile._reg);
                for (i = 0, n = words.length; i < n; i++) {
                    var word = words[i];
                    if ("attribute" == word || "uniform" == word) i = ShaderCompile._parseOne(attributes, uniforms, words, i, word, !0); else {
                        if ("#define" == word) {
                            definesName[word = words[++i]] = 1;
                            continue;
                        }
                        if ("#ifdef" == word) {
                            definesInfo[tempelse = words[++i]] = definesInfo[tempelse] || [];
                            for (i++; i < n; i++) if ("attribute" == (word = words[i]) || "uniform" == word) i = ShaderCompile._parseOne(attributes, uniforms, words, i, word, definesName[tempelse]); else if ("#else" == word) for (i++; i < n; i++) if ("attribute" == (word = words[i]) || "uniform" == word) i = ShaderCompile._parseOne(attributes, uniforms, words, i, word, !definesName[tempelse]); else if ("#endif" == word) break;
                        }
                    }
                }
            }
            return result;
        }, ShaderCompile.splitToWords = function(str, block) {
            for (var c, word, out = [], ofs = -1, i = 0, n = str.length; i < n; i++) if (c = str.charAt(i), 
            0 <= " \t=+-*/&%!<>()'\",;".indexOf(c)) {
                if (0 <= ofs && 1 < i - ofs && (word = str.substr(ofs, i - ofs), out.push(word)), 
                '"' == c || "'" == c) {
                    var ofs2 = str.indexOf(c, i + 1);
                    if (ofs2 < 0) throw "Sharder err:" + str;
                    out.push(str.substr(i + 1, ofs2 - i - 1)), i = ofs2, ofs = -1;
                    continue;
                }
                "(" == c && block && 0 < out.length && (word = out[out.length - 1] + ";", "vec4;main;".indexOf(word) < 0 && (block.useFuns += word)), 
                ofs = -1;
            } else ofs < 0 && (ofs = i);
            return ofs < n && 1 < n - ofs && (word = str.substr(ofs, n - ofs), out.push(word)), 
            out;
        }, ShaderCompile.IFDEF_NO = 0, ShaderCompile.IFDEF_YES = 1, ShaderCompile.IFDEF_ELSE = 2, 
        ShaderCompile.IFDEF_PARENT = 3, ShaderCompile._removeAnnotation = new RegExp("(/\\*([^*]|[\\r\\\n]|(\\*+([^*/]|[\\r\\n])))*\\*+/)|(//.*)", "g"), 
        ShaderCompile._reg = new RegExp("(\".*\")|('.*')|([#\\w\\*-\\.+/()=<>{}\\\\]+)|([,;:\\\\])", "g"), 
        ShaderCompile._splitToWordExps = new RegExp("[(\".*\")]+|[('.*')]+|([ \\t=\\+\\-*/&%!<>!%(),;])", "g"), 
        ShaderCompile.includes = {}, __static(ShaderCompile, [ "shaderParamsMap", function() {
            return this.shaderParamsMap = {
                float: 5126,
                int: 5124,
                bool: 35670,
                vec2: 35664,
                vec3: 35665,
                vec4: 35666,
                ivec2: 35667,
                ivec3: 35668,
                ivec4: 35669,
                bvec2: 35671,
                bvec3: 35672,
                bvec4: 35673,
                mat2: 35674,
                mat3: 35675,
                mat4: 35676,
                sampler2D: 35678,
                samplerCube: 35680
            };
        }, "_splitToWordExps3", function() {
            return this._splitToWordExps3 = new RegExp("[ \\t=\\+\\-*/&%!<>!%(),;\\|]", "g");
        } ]), ShaderCompile.__init$ = function() {
            ShaderNode = function() {
                function ShaderNode(includefiles) {
                    this.childs = [], this.text = "", this.parent = null, this.name = null, this.noCompile = !1, 
                    this.includefiles = null, this.condition = null, this.conditionType = 0, this.useFuns = "", 
                    this.z = 0, this.src = null, this.includefiles = includefiles;
                }
                __class(ShaderNode, "");
                var __proto = ShaderNode.prototype;
                return __proto.setParent = function(parent) {
                    parent.childs.push(this), this.z = parent.z + 1, this.parent = parent;
                }, __proto.setCondition = function(condition, type) {
                    condition && (this.conditionType = type, condition = condition.replace(/(\s*$)/g, ""), 
                    this.condition = function() {
                        return this[condition];
                    }, this.condition.__condition = condition);
                }, __proto.toscript = function(def, out) {
                    return this._toscript(def, out, ++ShaderNode.__id);
                }, __proto._toscript = function(def, out, id) {
                    if (this.childs.length < 1 && !this.text) return out;
                    out.length;
                    if (this.condition) {
                        var ifdef = !!this.condition.call(def);
                        if (2 === this.conditionType && (ifdef = !ifdef), !ifdef) return out;
                    }
                    if (this.text && out.push(this.text), 0 < this.childs.length && this.childs.forEach(function(o, index, arr) {
                        o._toscript(def, out, id);
                    }), 0 < this.includefiles.length && 0 < this.useFuns.length) for (var funsCode, i = 0, n = this.includefiles.length; i < n; i++) this.includefiles[i].curUseID != id && 0 < (funsCode = this.includefiles[i].file.getFunsScript(this.useFuns)).length && (this.includefiles[i].curUseID = id, 
                    out[0] = funsCode + out[0]);
                    return out;
                }, ShaderNode.__id = 1, ShaderNode;
            }(), InlcudeFile = function() {
                function InlcudeFile(txt) {
                    this.script = null, this.codes = {}, this.funs = {}, this.curUseID = -1, this.funnames = "", 
                    this.script = txt;
                    for (var begin = 0, ofs = 0, end = 0; !((begin = txt.indexOf("#begin", begin)) < 0); ) {
                        for (end = begin + 5; !((end = txt.indexOf("#end", end)) < 0) && "i" === txt.charAt(end + 4); ) end += 5;
                        if (end < 0) throw "add include err,no #end:" + txt;
                        ofs = txt.indexOf("\n", begin);
                        var words = ShaderCompile.splitToWords(txt.substr(begin, ofs - begin), null);
                        "code" == words[1] ? this.codes[words[2]] = txt.substr(ofs + 1, end - ofs - 1) : "function" == words[1] && (ofs = txt.indexOf("function", begin), 
                        ofs += "function".length, this.funs[words[3]] = txt.substr(ofs + 1, end - ofs - 1), 
                        this.funnames += words[3] + ";"), begin = end + 1;
                    }
                }
                __class(InlcudeFile, "");
                var __proto = InlcudeFile.prototype;
                return __proto.getWith = function(name) {
                    var r = name ? this.codes[name] : this.script;
                    if (!r) throw "get with error:" + name;
                    return r;
                }, __proto.getFunsScript = function(funsdef) {
                    var r = "";
                    for (var i in this.funs) 0 <= funsdef.indexOf(i + ";") && (r += this.funs[i]);
                    return r;
                }, InlcudeFile;
            }();
        }, ShaderCompile;
    }(), WebGL = function() {
        function WebGL() {}
        return __class(WebGL, "laya.webgl.WebGL"), WebGL._uint8ArraySlice = function() {
            for (var sz = this.length, dec = new Uint8Array(this.length), i = 0; i < sz; i++) dec[i] = this[i];
            return dec;
        }, WebGL._float32ArraySlice = function() {
            for (var sz = this.length, dec = new Float32Array(this.length), i = 0; i < sz; i++) dec[i] = this[i];
            return dec;
        }, WebGL._uint16ArraySlice = function(__arg) {
            var dec, arg = arguments, sz = 0, i = 0;
            if (0 === arg.length) for (sz = this.length, dec = new Uint16Array(sz), i = 0; i < sz; i++) dec[i] = this[i]; else if (2 === arg.length) {
                var start = arg[0], end = arg[1];
                if (start < end) for (sz = end - start, dec = new Uint16Array(sz), i = start; i < end; i++) dec[i - start] = this[i]; else dec = new Uint16Array(0);
            }
            return dec;
        }, WebGL.expandContext = function() {
            var from = Context.prototype, to = CanvasRenderingContext2D.prototype;
            to.fillTrangles = from.fillTrangles, Buffer2D.__int__(null), to.setIBVB = function(x, y, ib, vb, numElement, mat, shader, shaderValues, startIndex, offset) {
                void 0 === startIndex && (startIndex = 0), void 0 === offset && (offset = 0), null === ib && (this._ib = this._ib || IndexBuffer2D.QuadrangleIB, 
                ib = this._ib, GlUtils.expandIBQuadrangle(ib, vb._byteLength / 64 + 8)), this._setIBVB(x, y, ib, vb, numElement, mat, shader, shaderValues, startIndex, offset);
            }, to.fillTrangles = function(tex, x, y, points, m) {
                this._curMat = this._curMat || Matrix.create(), this._vb = this._vb || VertexBuffer2D.create(), 
                this._ib || (this._ib = IndexBuffer2D.create(), GlUtils.fillIBQuadrangle(this._ib, length / 4));
                var vb = this._vb, length = points.length >> 4;
                GlUtils.fillTranglesVB(vb, x, y, points, m || this._curMat, 0, 0), GlUtils.expandIBQuadrangle(this._ib, vb._byteLength / 64 + 8);
                var shaderValues = new Value2D(1, 0);
                shaderValues.textureHost = tex;
                var sd = new Shader2X("attribute vec2 position; attribute vec2 texcoord; uniform vec2 size; uniform mat4 mmat; varying vec2 v_texcoord; void main() { vec4 p=vec4(position.xy,0.0,1.0);vec4 pos=mmat*p; gl_Position =vec4((pos.x/size.x-0.5)*2.0,(0.5-pos.y/size.y)*2.0,pos.z,1.0); v_texcoord = texcoord; }", "precision mediump float; varying vec2 v_texcoord; uniform sampler2D texture; void main() {vec4 color= texture2D(texture, v_texcoord); color.a*=1.0; gl_FragColor= color;}");
                vb._vertType = 3, this._setIBVB(x, y, this._ib, vb, 6 * length, m, sd, shaderValues, 0, 0);
            };
        }, WebGL.enable = function() {
            if (Browser.__init__(), Render.isConchApp && !Render.isConchWebGL) return RunDriver.skinAniSprite = function() {
                return new SkinMesh();
            }, WebGL.expandContext(), !1;
            if (RunDriver.getWebGLContext = function(canvas) {
                for (var gl, names = [ "webgl", "webgl2", "experimental-webgl", "webkit-3d", "moz-webgl" ], i = 0; i < names.length; i++) {
                    try {
                        gl = canvas.getContext(names[i], {
                            stencil: Config.isStencil,
                            alpha: Config.isAlpha,
                            antialias: Config.isAntialias,
                            premultipliedAlpha: Config.premultipliedAlpha,
                            preserveDrawingBuffer: Config.preserveDrawingBuffer,
                            failIfMajorPerformanceCaveat: !0
                        });
                    } catch (e) {}
                    if (gl) return gl;
                }
                return null;
            }, null == (WebGL.mainContext = RunDriver.getWebGLContext(Render._mainCanvas))) return !1;
            if (Render.isWebGL) return !0;
            HTMLImage.create = function(src, def) {
                return new WebGLImage(src, def);
            }, HTMLSubImage.create = function(canvas, offsetX, offsetY, width, height, atlasImage, src) {
                return new WebGLSubImage(canvas, offsetX, offsetY, width, height, atlasImage, src);
            }, Render.WebGL = WebGL, Render.isWebGL = !0, DrawText.__init__(), RunDriver.createRenderSprite = function(type, next) {
                return new RenderSprite3D(type, next);
            }, RunDriver.createWebGLContext2D = function(c) {
                return new WebGLContext2D(c);
            }, RunDriver.changeWebGLSize = function(width, height) {
                laya.webgl.WebGL.onStageResize(width, height);
            }, RunDriver.createGraphics = function() {
                return new GraphicsGL();
            };
            var action = RunDriver.createFilterAction;
            return RunDriver.createFilterAction = action || function(type) {
                return new ColorFilterActionGL();
            }, RunDriver.clear = function(color) {
                RenderState2D.worldScissorTest && laya.webgl.WebGL.mainContext.disable(3089);
                var ctx = Render.context.ctx, c = 0 == ctx._submits._length || Config.preserveDrawingBuffer ? Color.create(color)._color : Stage._wgColor;
                c && ctx.clearBG(c[0], c[1], c[2], c[3]), RenderState2D.clear();
            }, RunDriver.addToAtlas = function(texture, force) {
                void 0 === force && (force = !1);
                var bitmap = texture.bitmap;
                Render.optimizeTextureMemory(texture.url, texture) ? Laya.__typeof(bitmap, "laya.webgl.resource.IMergeAtlasBitmap") && bitmap.allowMerageInAtlas && bitmap.on("recovered", texture, texture.addTextureToAtlas) : bitmap.enableMerageInAtlas = !1;
            }, RunDriver.isAtlas = function(bitmap) {
                return bitmap instanceof laya.webgl.atlas.AtlasWebGLCanvas;
            }, AtlasResourceManager._enable(), RunDriver.beginFlush = function() {
                for (var atlasResourceManager = AtlasResourceManager.instance, count = atlasResourceManager.getAtlaserCount(), i = 0; i < count; i++) {
                    var atlerCanvas = atlasResourceManager.getAtlaserByIndex(i).texture;
                    atlerCanvas._flashCacheImageNeedFlush && RunDriver.flashFlushImage(atlerCanvas);
                }
            }, RunDriver.drawToCanvas = function(sprite, _renderType, canvasWidth, canvasHeight, offsetX, offsetY) {
                (canvasWidth <= 0 || canvasHeight <= 0) && console.log("[error] canvasWidth and canvasHeight should greater than zero"), 
                canvasWidth |= 0, canvasHeight |= 0, offsetX |= 0, offsetY |= 0;
                var renderTarget = RenderTarget2D.create(canvasWidth, canvasHeight, 6408, 5121, 0, !1);
                renderTarget.start(), renderTarget.clear(0, 0, 0, 0), Render.context.clear(), RenderSprite.renders[_renderType]._fun(sprite, Render.context, offsetX, RenderState2D.height - canvasHeight + offsetY), 
                Render.context.flush(), renderTarget.end();
                var pixels = renderTarget.getData(0, 0, canvasWidth, canvasHeight);
                if (renderTarget.recycle(), pixels.byteLength == canvasWidth * canvasHeight * 4) {
                    var htmlCanvas = new WebGLCanvas();
                    htmlCanvas._canvas = Browser.createElement("canvas"), htmlCanvas.size(canvasWidth, canvasHeight);
                    var context = htmlCanvas._canvas.getContext("2d");
                    Browser.canvas.size(canvasWidth, canvasHeight);
                    var tempContext = Browser.context, imgData = tempContext.createImageData(canvasWidth, canvasHeight);
                    return imgData.data.set(new Uint8ClampedArray(pixels.buffer)), htmlCanvas._imgData = imgData, 
                    tempContext.putImageData(imgData, 0, 0), context.save(), context.translate(0, canvasHeight), 
                    context.scale(1, -1), context.drawImage(Browser.canvas.source, 0, 0), context.restore(), 
                    htmlCanvas;
                }
                console.log("drawToCanvas error: w:" + canvasWidth + ",h:" + canvasHeight + ",datalen:" + pixels.byteLength);
            }, RunDriver.createFilterAction = function(type) {
                var action;
                switch (type) {
                  case 32:
                    action = new ColorFilterActionGL();
                }
                return action;
            }, RunDriver.addTextureToAtlas = function(texture) {
                texture._uvID++, AtlasResourceManager._atlasRestore++, texture.bitmap.enableMerageInAtlas && AtlasResourceManager.instance.addToAtlas(texture);
            }, RunDriver.getTexturePixels = function(value, x, y, width, height) {
                Render.context.ctx.clear();
                var tSprite = new Sprite();
                tSprite.graphics.drawTexture(value, -x, -y);
                var tRenderTarget = RenderTarget2D.create(width, height);
                tRenderTarget.start(), tRenderTarget.clear(0, 0, 0, 0), tSprite.render(Render.context, 0, 0), 
                Render.context.ctx.flush(), tRenderTarget.end();
                for (var tUint8Array = tRenderTarget.getData(0, 0, width, height), tArray = [], tIndex = 0, i = height - 1; 0 <= i; i--) for (var j = 0; j < width; j++) tIndex = 4 * (i * width + j), 
                tArray.push(tUint8Array[tIndex]), tArray.push(tUint8Array[tIndex + 1]), tArray.push(tUint8Array[tIndex + 2]), 
                tArray.push(tUint8Array[tIndex + 3]);
                return tArray;
            }, RunDriver.skinAniSprite = function() {
                return new SkinMesh();
            }, HTMLCanvas.create = function(type, canvas) {
                var ret = new WebGLCanvas();
                return ret._imgData = canvas, ret.flipY = !1, ret;
            }, Filter._filterStart = function(scope, sprite, context, x, y) {
                var b = scope.getValue("bounds"), source = RenderTarget2D.create(b.width, b.height);
                if (source.start(), source.clear(0, 0, 0, 0), scope.addValue("src", source), scope.addValue("ScissorTest", RenderState2D.worldScissorTest), 
                RenderState2D.worldScissorTest) {
                    var tClilpRect = new Rectangle();
                    tClilpRect.copyFrom(context.ctx._clipRect), scope.addValue("clipRect", tClilpRect), 
                    RenderState2D.worldScissorTest = !1, laya.webgl.WebGL.mainContext.disable(3089);
                }
            }, Filter._filterEnd = function(scope, sprite, context, x, y) {
                var b = scope.getValue("bounds");
                scope.getValue("src").end();
                var out = RenderTarget2D.create(b.width, b.height);
                out.start(), out.clear(0, 0, 0, 0), scope.addValue("out", out), sprite._set$P("_filterCache", out), 
                sprite._set$P("_isHaveGlowFilter", scope.getValue("_isHaveGlowFilter"));
            }, Filter._EndTarget = function(scope, context) {
                if (scope.getValue("src").recycle(), scope.getValue("out").end(), scope.getValue("ScissorTest")) {
                    RenderState2D.worldScissorTest = !0, laya.webgl.WebGL.mainContext.enable(3089), 
                    context.ctx.save();
                    var tClipRect = scope.getValue("clipRect");
                    context.ctx.clipRect(tClipRect.x, tClipRect.y, tClipRect.width, tClipRect.height);
                }
            }, Filter._useSrc = function(scope) {
                var source = scope.getValue("out");
                source.end(), (source = scope.getValue("src")).start(), source.clear(0, 0, 0, 0);
            }, Filter._endSrc = function(scope) {
                scope.getValue("src").end();
            }, Filter._useOut = function(scope) {
                var source = scope.getValue("src");
                source.end(), (source = scope.getValue("out")).start(), source.clear(0, 0, 0, 0);
            }, Filter._endOut = function(scope) {
                scope.getValue("out").end();
            }, Filter._recycleScope = function(scope) {
                scope.recycle();
            }, Filter._filter = function(sprite, context, x, y) {
                var next = this._next;
                if (next) {
                    var shaderValue, b, filters = sprite.filters, len = filters.length;
                    if (1 == len && 32 == filters[0].type) return context.ctx.save(), context.ctx.setFilters([ filters[0] ]), 
                    next._fun.call(next, sprite, context, x, y), void context.ctx.restore();
                    var scope = SubmitCMDScope.create(), p = Point.TEMP, tMatrix = context.ctx._getTransformMatrix(), mat = Matrix.create();
                    tMatrix.copyTo(mat);
                    var tPadding = 0, tHalfPadding = 0, tIsHaveGlowFilter = !1, out = sprite._$P._filterCache ? sprite._$P._filterCache : null;
                    if (!out || sprite._repaint) {
                        tIsHaveGlowFilter = sprite._isHaveGlowFilter(), scope.addValue("_isHaveGlowFilter", tIsHaveGlowFilter), 
                        tIsHaveGlowFilter && (tPadding = 50, tHalfPadding = 25), (b = new Rectangle()).copyFrom(sprite.getSelfBounds()), 
                        b.x += sprite.x, b.y += sprite.y, b.x -= sprite.pivotX + 4, b.y -= sprite.pivotY + 4;
                        var tSX = b.x, tSY = b.y;
                        if (b.width += tPadding + 8, b.height += tPadding + 8, p.x = b.x * mat.a + b.y * mat.c, 
                        p.y = b.y * mat.d + b.x * mat.b, b.x = p.x, b.y = p.y, p.x = b.width * mat.a + b.height * mat.c, 
                        p.y = b.height * mat.d + b.width * mat.b, b.width = p.x, b.height = p.y, b.width <= 0 || b.height <= 0) return;
                        out && out.recycle(), scope.addValue("bounds", b);
                        var submit = SubmitCMD.create([ scope, sprite, context, 0, 0 ], Filter._filterStart);
                        context.addRenderObject(submit), context.ctx._renderKey = 0, context.ctx._shader2D.glTexture = null;
                        var tX = sprite.x - tSX + tHalfPadding, tY = sprite.y - tSY + tHalfPadding;
                        next._fun.call(next, sprite, context, tX, tY), submit = SubmitCMD.create([ scope, sprite, context, 0, 0 ], Filter._filterEnd), 
                        context.addRenderObject(submit);
                        for (var i = 0; i < len; i++) {
                            0 != i && (submit = SubmitCMD.create([ scope ], Filter._useSrc), context.addRenderObject(submit), 
                            shaderValue = Value2D.create(1, 0), Matrix.TEMP.identity(), context.ctx.drawTarget(scope, 0, 0, b.width, b.height, Matrix.TEMP, "out", shaderValue, null, BlendMode.TOINT.overlay), 
                            submit = SubmitCMD.create([ scope ], Filter._useOut), context.addRenderObject(submit)), 
                            filters[i].action.apply3d(scope, sprite, context, 0, 0);
                        }
                        submit = SubmitCMD.create([ scope, context ], Filter._EndTarget), context.addRenderObject(submit);
                    } else {
                        if ((tIsHaveGlowFilter = !!sprite._$P._isHaveGlowFilter && sprite._$P._isHaveGlowFilter) && (tPadding = 50, 
                        tHalfPadding = 25), (b = sprite.getBounds()).width <= 0 || b.height <= 0) return;
                        b.width += tPadding, b.height += tPadding, p.x = b.x * mat.a + b.y * mat.c, p.y = b.y * mat.d + b.x * mat.b, 
                        b.x = p.x, b.y = p.y, p.x = b.width * mat.a + b.height * mat.c, p.y = b.height * mat.d + b.width * mat.b, 
                        b.width = p.x, b.height = p.y, scope.addValue("out", out);
                    }
                    x = x - tHalfPadding - sprite.x, y = y - tHalfPadding - sprite.y, p.setTo(x, y), 
                    mat.transformPoint(p), x = p.x + b.x, y = p.y + b.y, shaderValue = Value2D.create(1, 0), 
                    Matrix.TEMP.identity(), context.ctx.drawTarget(scope, x, y, b.width, b.height, Matrix.TEMP, "out", shaderValue, null, BlendMode.TOINT.overlay), 
                    submit = SubmitCMD.create([ scope ], Filter._recycleScope), context.addRenderObject(submit), 
                    mat.destroy();
                }
            }, Float32Array.prototype.slice || (Float32Array.prototype.slice = WebGL._float32ArraySlice), 
            Uint16Array.prototype.slice || (Uint16Array.prototype.slice = WebGL._uint16ArraySlice), 
            Uint8Array.prototype.slice || (Uint8Array.prototype.slice = WebGL._uint8ArraySlice), 
            !0;
        }, WebGL.onStageResize = function(width, height) {
            null != WebGL.mainContext && (WebGL.mainContext.viewport(0, 0, width, height), RenderState2D.width = width, 
            RenderState2D.height = height);
        }, WebGL.onInvalidGLRes = function() {
            AtlasResourceManager.instance.freeAll(), ResourceManager.releaseContentManagers(!0), 
            WebGL.doNodeRepaint(Laya.stage), WebGL.mainContext.viewport(0, 0, RenderState2D.width, RenderState2D.height), 
            Laya.stage.event("devicelost");
        }, WebGL.doNodeRepaint = function(sprite) {
            0 == sprite.numChildren && sprite.repaint();
            for (var i = 0; i < sprite.numChildren; i++) WebGL.doNodeRepaint(sprite.getChildAt(i));
        }, WebGL.init = function(canvas, width, height) {
            WebGL.mainCanvas = canvas, HTMLCanvas._createContext = function(canvas) {
                return new WebGLContext2D(canvas);
            }, WebGLCanvas._createContext = function(canvas) {
                return new WebGLContext2D(canvas);
            };
            var gl = laya.webgl.WebGL.mainContext;
            if (null != gl.getShaderPrecisionFormat) {
                var vertexPrecisionFormat = gl.getShaderPrecisionFormat(35633, 36338), framePrecisionFormat = gl.getShaderPrecisionFormat(35632, 36338);
                WebGL.shaderHighPrecision = !(!vertexPrecisionFormat.precision || !framePrecisionFormat.precision);
            } else WebGL.shaderHighPrecision = !1;
            if (WebGL.compressAstc = gl.getExtension("WEBGL_compressed_texture_astc"), WebGL.compressAtc = gl.getExtension("WEBGL_compressed_texture_atc"), 
            WebGL.compressEtc = gl.getExtension("WEBGL_compressed_texture_etc"), WebGL.compressEtc1 = gl.getExtension("WEBGL_compressed_texture_etc1"), 
            WebGL.compressPvrtc = gl.getExtension("WEBGL_compressed_texture_pvrtc"), WebGL.compressS3tc = gl.getExtension("WEBGL_compressed_texture_s3tc"), 
            WebGL.compressS3tc_srgb = gl.getExtension("WEBGL_compressed_texture_s3tc_srgb"), 
            gl.deleteTexture1 = gl.deleteTexture, gl.deleteTexture = function(t) {
                t == WebGLContext.curBindTexValue && (WebGLContext.curBindTexValue = null), gl.deleteTexture1(t);
            }, WebGL.onStageResize(width, height), null == WebGL.mainContext) throw new Error("webGL getContext err!");
            System.__init__(), AtlasResourceManager.__init__(), ShaderDefines2D.__init__(), 
            Submit.__init__(), WebGLContext2D.__init__(), Value2D.__init__(), Shader2D.__init__(), 
            Buffer2D.__int__(gl), BlendMode._init_(gl), Render.isConchApp && conch.setOnInvalidGLRes(WebGL.onInvalidGLRes);
        }, WebGL.compressAstc = null, WebGL.compressAtc = null, WebGL.compressEtc = null, 
        WebGL.compressEtc1 = null, WebGL.compressPvrtc = null, WebGL.compressS3tc = null, 
        WebGL.compressS3tc_srgb = null, WebGL.mainCanvas = null, WebGL.mainContext = null, 
        WebGL.antialias = !0, WebGL.shaderHighPrecision = !1, WebGL._bg_null = [ 0, 0, 0, 0 ], 
        WebGL;
    }(), WebGLContext = function() {
        function WebGLContext() {}
        return __class(WebGLContext, "laya.webgl.WebGLContext"), WebGLContext.UseProgram = function(program) {
            return WebGLContext._useProgram !== program && (WebGL.mainContext.useProgram(program), 
            WebGLContext._useProgram = program, !0);
        }, WebGLContext.setDepthTest = function(gl, value) {
            value !== WebGLContext._depthTest && ((WebGLContext._depthTest = value) ? gl.enable(2929) : gl.disable(2929));
        }, WebGLContext.setDepthMask = function(gl, value) {
            value !== WebGLContext._depthMask && (WebGLContext._depthMask = value, gl.depthMask(value));
        }, WebGLContext.setDepthFunc = function(gl, value) {
            value !== WebGLContext._depthFunc && (WebGLContext._depthFunc = value, gl.depthFunc(value));
        }, WebGLContext.setBlend = function(gl, value) {
            value !== WebGLContext._blend && ((WebGLContext._blend = value) ? gl.enable(3042) : gl.disable(3042));
        }, WebGLContext.setBlendFunc = function(gl, sFactor, dFactor) {
            (sFactor !== WebGLContext._sFactor || dFactor !== WebGLContext._dFactor) && (WebGLContext._sFactor = sFactor, 
            WebGLContext._dFactor = dFactor, gl.blendFunc(sFactor, dFactor));
        }, WebGLContext.setCullFace = function(gl, value) {
            value !== WebGLContext._cullFace && ((WebGLContext._cullFace = value) ? gl.enable(2884) : gl.disable(2884));
        }, WebGLContext.setFrontFace = function(gl, value) {
            value !== WebGLContext._frontFace && (WebGLContext._frontFace = value, gl.frontFace(value));
        }, WebGLContext.bindTexture = function(gl, target, texture) {
            gl.bindTexture(target, texture), WebGLContext.curBindTexTarget = target, WebGLContext.curBindTexValue = texture;
        }, WebGLContext.DEPTH_BUFFER_BIT = 256, WebGLContext.STENCIL_BUFFER_BIT = 1024, 
        WebGLContext.COLOR_BUFFER_BIT = 16384, WebGLContext.POINTS = 0, WebGLContext.LINES = 1, 
        WebGLContext.LINE_LOOP = 2, WebGLContext.LINE_STRIP = 3, WebGLContext.TRIANGLES = 4, 
        WebGLContext.TRIANGLE_STRIP = 5, WebGLContext.TRIANGLE_FAN = 6, WebGLContext.ZERO = 0, 
        WebGLContext.ONE = 1, WebGLContext.SRC_COLOR = 768, WebGLContext.ONE_MINUS_SRC_COLOR = 769, 
        WebGLContext.SRC_ALPHA = 770, WebGLContext.ONE_MINUS_SRC_ALPHA = 771, WebGLContext.DST_ALPHA = 772, 
        WebGLContext.ONE_MINUS_DST_ALPHA = 773, WebGLContext.DST_COLOR = 774, WebGLContext.ONE_MINUS_DST_COLOR = 775, 
        WebGLContext.SRC_ALPHA_SATURATE = 776, WebGLContext.FUNC_ADD = 32774, WebGLContext.BLEND_EQUATION = 32777, 
        WebGLContext.BLEND_EQUATION_RGB = 32777, WebGLContext.BLEND_EQUATION_ALPHA = 34877, 
        WebGLContext.FUNC_SUBTRACT = 32778, WebGLContext.FUNC_REVERSE_SUBTRACT = 32779, 
        WebGLContext.BLEND_DST_RGB = 32968, WebGLContext.BLEND_SRC_RGB = 32969, WebGLContext.BLEND_DST_ALPHA = 32970, 
        WebGLContext.BLEND_SRC_ALPHA = 32971, WebGLContext.CONSTANT_COLOR = 32769, WebGLContext.ONE_MINUS_CONSTANT_COLOR = 32770, 
        WebGLContext.CONSTANT_ALPHA = 32771, WebGLContext.ONE_MINUS_CONSTANT_ALPHA = 32772, 
        WebGLContext.BLEND_COLOR = 32773, WebGLContext.ARRAY_BUFFER = 34962, WebGLContext.ELEMENT_ARRAY_BUFFER = 34963, 
        WebGLContext.ARRAY_BUFFER_BINDING = 34964, WebGLContext.ELEMENT_ARRAY_BUFFER_BINDING = 34965, 
        WebGLContext.STREAM_DRAW = 35040, WebGLContext.STATIC_DRAW = 35044, WebGLContext.DYNAMIC_DRAW = 35048, 
        WebGLContext.BUFFER_SIZE = 34660, WebGLContext.BUFFER_USAGE = 34661, WebGLContext.CURRENT_VERTEX_ATTRIB = 34342, 
        WebGLContext.FRONT = 1028, WebGLContext.BACK = 1029, WebGLContext.CULL_FACE = 2884, 
        WebGLContext.FRONT_AND_BACK = 1032, WebGLContext.BLEND = 3042, WebGLContext.DITHER = 3024, 
        WebGLContext.STENCIL_TEST = 2960, WebGLContext.DEPTH_TEST = 2929, WebGLContext.SCISSOR_TEST = 3089, 
        WebGLContext.POLYGON_OFFSET_FILL = 32823, WebGLContext.SAMPLE_ALPHA_TO_COVERAGE = 32926, 
        WebGLContext.SAMPLE_COVERAGE = 32928, WebGLContext.NO_ERROR = 0, WebGLContext.INVALID_ENUM = 1280, 
        WebGLContext.INVALID_VALUE = 1281, WebGLContext.INVALID_OPERATION = 1282, WebGLContext.OUT_OF_MEMORY = 1285, 
        WebGLContext.CW = 2304, WebGLContext.CCW = 2305, WebGLContext.LINE_WIDTH = 2849, 
        WebGLContext.ALIASED_POINT_SIZE_RANGE = 33901, WebGLContext.ALIASED_LINE_WIDTH_RANGE = 33902, 
        WebGLContext.CULL_FACE_MODE = 2885, WebGLContext.FRONT_FACE = 2886, WebGLContext.DEPTH_RANGE = 2928, 
        WebGLContext.DEPTH_WRITEMASK = 2930, WebGLContext.DEPTH_CLEAR_VALUE = 2931, WebGLContext.DEPTH_FUNC = 2932, 
        WebGLContext.STENCIL_CLEAR_VALUE = 2961, WebGLContext.STENCIL_FUNC = 2962, WebGLContext.STENCIL_FAIL = 2964, 
        WebGLContext.STENCIL_PASS_DEPTH_FAIL = 2965, WebGLContext.STENCIL_PASS_DEPTH_PASS = 2966, 
        WebGLContext.STENCIL_REF = 2967, WebGLContext.STENCIL_VALUE_MASK = 2963, WebGLContext.STENCIL_WRITEMASK = 2968, 
        WebGLContext.STENCIL_BACK_FUNC = 34816, WebGLContext.STENCIL_BACK_FAIL = 34817, 
        WebGLContext.STENCIL_BACK_PASS_DEPTH_FAIL = 34818, WebGLContext.STENCIL_BACK_PASS_DEPTH_PASS = 34819, 
        WebGLContext.STENCIL_BACK_REF = 36003, WebGLContext.STENCIL_BACK_VALUE_MASK = 36004, 
        WebGLContext.STENCIL_BACK_WRITEMASK = 36005, WebGLContext.VIEWPORT = 2978, WebGLContext.SCISSOR_BOX = 3088, 
        WebGLContext.COLOR_CLEAR_VALUE = 3106, WebGLContext.COLOR_WRITEMASK = 3107, WebGLContext.UNPACK_ALIGNMENT = 3317, 
        WebGLContext.PACK_ALIGNMENT = 3333, WebGLContext.MAX_TEXTURE_SIZE = 3379, WebGLContext.MAX_VIEWPORT_DIMS = 3386, 
        WebGLContext.SUBPIXEL_BITS = 3408, WebGLContext.RED_BITS = 3410, WebGLContext.GREEN_BITS = 3411, 
        WebGLContext.BLUE_BITS = 3412, WebGLContext.ALPHA_BITS = 3413, WebGLContext.DEPTH_BITS = 3414, 
        WebGLContext.STENCIL_BITS = 3415, WebGLContext.POLYGON_OFFSET_UNITS = 10752, WebGLContext.POLYGON_OFFSET_FACTOR = 32824, 
        WebGLContext.TEXTURE_BINDING_2D = 32873, WebGLContext.SAMPLE_BUFFERS = 32936, WebGLContext.SAMPLES = 32937, 
        WebGLContext.SAMPLE_COVERAGE_VALUE = 32938, WebGLContext.SAMPLE_COVERAGE_INVERT = 32939, 
        WebGLContext.NUM_COMPRESSED_TEXTURE_FORMATS = 34466, WebGLContext.COMPRESSED_TEXTURE_FORMATS = 34467, 
        WebGLContext.DONT_CARE = 4352, WebGLContext.FASTEST = 4353, WebGLContext.NICEST = 4354, 
        WebGLContext.GENERATE_MIPMAP_HINT = 33170, WebGLContext.BYTE = 5120, WebGLContext.UNSIGNED_BYTE = 5121, 
        WebGLContext.SHORT = 5122, WebGLContext.UNSIGNED_SHORT = 5123, WebGLContext.INT = 5124, 
        WebGLContext.UNSIGNED_INT = 5125, WebGLContext.FLOAT = 5126, WebGLContext.DEPTH_COMPONENT = 6402, 
        WebGLContext.ALPHA = 6406, WebGLContext.RGB = 6407, WebGLContext.RGBA = 6408, WebGLContext.LUMINANCE = 6409, 
        WebGLContext.LUMINANCE_ALPHA = 6410, WebGLContext.UNSIGNED_SHORT_4_4_4_4 = 32819, 
        WebGLContext.UNSIGNED_SHORT_5_5_5_1 = 32820, WebGLContext.UNSIGNED_SHORT_5_6_5 = 33635, 
        WebGLContext.FRAGMENT_SHADER = 35632, WebGLContext.VERTEX_SHADER = 35633, WebGLContext.MAX_VERTEX_ATTRIBS = 34921, 
        WebGLContext.MAX_VERTEX_UNIFORM_VECTORS = 36347, WebGLContext.MAX_VARYING_VECTORS = 36348, 
        WebGLContext.MAX_COMBINED_TEXTURE_IMAGE_UNITS = 35661, WebGLContext.MAX_VERTEX_TEXTURE_IMAGE_UNITS = 35660, 
        WebGLContext.MAX_TEXTURE_IMAGE_UNITS = 34930, WebGLContext.MAX_FRAGMENT_UNIFORM_VECTORS = 36349, 
        WebGLContext.SHADER_TYPE = 35663, WebGLContext.DELETE_STATUS = 35712, WebGLContext.LINK_STATUS = 35714, 
        WebGLContext.VALIDATE_STATUS = 35715, WebGLContext.ATTACHED_SHADERS = 35717, WebGLContext.ACTIVE_UNIFORMS = 35718, 
        WebGLContext.ACTIVE_ATTRIBUTES = 35721, WebGLContext.SHADING_LANGUAGE_VERSION = 35724, 
        WebGLContext.CURRENT_PROGRAM = 35725, WebGLContext.NEVER = 512, WebGLContext.LESS = 513, 
        WebGLContext.EQUAL = 514, WebGLContext.LEQUAL = 515, WebGLContext.GREATER = 516, 
        WebGLContext.NOTEQUAL = 517, WebGLContext.GEQUAL = 518, WebGLContext.ALWAYS = 519, 
        WebGLContext.KEEP = 7680, WebGLContext.REPLACE = 7681, WebGLContext.INCR = 7682, 
        WebGLContext.DECR = 7683, WebGLContext.INVERT = 5386, WebGLContext.INCR_WRAP = 34055, 
        WebGLContext.DECR_WRAP = 34056, WebGLContext.VENDOR = 7936, WebGLContext.RENDERER = 7937, 
        WebGLContext.VERSION = 7938, WebGLContext.NEAREST = 9728, WebGLContext.LINEAR = 9729, 
        WebGLContext.NEAREST_MIPMAP_NEAREST = 9984, WebGLContext.LINEAR_MIPMAP_NEAREST = 9985, 
        WebGLContext.NEAREST_MIPMAP_LINEAR = 9986, WebGLContext.LINEAR_MIPMAP_LINEAR = 9987, 
        WebGLContext.TEXTURE_MAG_FILTER = 10240, WebGLContext.TEXTURE_MIN_FILTER = 10241, 
        WebGLContext.TEXTURE_WRAP_S = 10242, WebGLContext.TEXTURE_WRAP_T = 10243, WebGLContext.TEXTURE_2D = 3553, 
        WebGLContext.TEXTURE = 5890, WebGLContext.TEXTURE_CUBE_MAP = 34067, WebGLContext.TEXTURE_BINDING_CUBE_MAP = 34068, 
        WebGLContext.TEXTURE_CUBE_MAP_POSITIVE_X = 34069, WebGLContext.TEXTURE_CUBE_MAP_NEGATIVE_X = 34070, 
        WebGLContext.TEXTURE_CUBE_MAP_POSITIVE_Y = 34071, WebGLContext.TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072, 
        WebGLContext.TEXTURE_CUBE_MAP_POSITIVE_Z = 34073, WebGLContext.TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074, 
        WebGLContext.MAX_CUBE_MAP_TEXTURE_SIZE = 34076, WebGLContext.TEXTURE0 = 33984, WebGLContext.TEXTURE1 = 33985, 
        WebGLContext.TEXTURE2 = 33986, WebGLContext.TEXTURE3 = 33987, WebGLContext.TEXTURE4 = 33988, 
        WebGLContext.TEXTURE5 = 33989, WebGLContext.TEXTURE6 = 33990, WebGLContext.TEXTURE7 = 33991, 
        WebGLContext.TEXTURE8 = 33992, WebGLContext.TEXTURE9 = 33993, WebGLContext.TEXTURE10 = 33994, 
        WebGLContext.TEXTURE11 = 33995, WebGLContext.TEXTURE12 = 33996, WebGLContext.TEXTURE13 = 33997, 
        WebGLContext.TEXTURE14 = 33998, WebGLContext.TEXTURE15 = 33999, WebGLContext.TEXTURE16 = 34e3, 
        WebGLContext.TEXTURE17 = 34001, WebGLContext.TEXTURE18 = 34002, WebGLContext.TEXTURE19 = 34003, 
        WebGLContext.TEXTURE20 = 34004, WebGLContext.TEXTURE21 = 34005, WebGLContext.TEXTURE22 = 34006, 
        WebGLContext.TEXTURE23 = 34007, WebGLContext.TEXTURE24 = 34008, WebGLContext.TEXTURE25 = 34009, 
        WebGLContext.TEXTURE26 = 34010, WebGLContext.TEXTURE27 = 34011, WebGLContext.TEXTURE28 = 34012, 
        WebGLContext.TEXTURE29 = 34013, WebGLContext.TEXTURE30 = 34014, WebGLContext.TEXTURE31 = 34015, 
        WebGLContext.ACTIVE_TEXTURE = 34016, WebGLContext.REPEAT = 10497, WebGLContext.CLAMP_TO_EDGE = 33071, 
        WebGLContext.MIRRORED_REPEAT = 33648, WebGLContext.FLOAT_VEC2 = 35664, WebGLContext.FLOAT_VEC3 = 35665, 
        WebGLContext.FLOAT_VEC4 = 35666, WebGLContext.INT_VEC2 = 35667, WebGLContext.INT_VEC3 = 35668, 
        WebGLContext.INT_VEC4 = 35669, WebGLContext.BOOL = 35670, WebGLContext.BOOL_VEC2 = 35671, 
        WebGLContext.BOOL_VEC3 = 35672, WebGLContext.BOOL_VEC4 = 35673, WebGLContext.FLOAT_MAT2 = 35674, 
        WebGLContext.FLOAT_MAT3 = 35675, WebGLContext.FLOAT_MAT4 = 35676, WebGLContext.SAMPLER_2D = 35678, 
        WebGLContext.SAMPLER_CUBE = 35680, WebGLContext.VERTEX_ATTRIB_ARRAY_ENABLED = 34338, 
        WebGLContext.VERTEX_ATTRIB_ARRAY_SIZE = 34339, WebGLContext.VERTEX_ATTRIB_ARRAY_STRIDE = 34340, 
        WebGLContext.VERTEX_ATTRIB_ARRAY_TYPE = 34341, WebGLContext.VERTEX_ATTRIB_ARRAY_NORMALIZED = 34922, 
        WebGLContext.VERTEX_ATTRIB_ARRAY_POINTER = 34373, WebGLContext.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 34975, 
        WebGLContext.COMPILE_STATUS = 35713, WebGLContext.LOW_FLOAT = 36336, WebGLContext.MEDIUM_FLOAT = 36337, 
        WebGLContext.HIGH_FLOAT = 36338, WebGLContext.LOW_INT = 36339, WebGLContext.MEDIUM_INT = 36340, 
        WebGLContext.HIGH_INT = 36341, WebGLContext.FRAMEBUFFER = 36160, WebGLContext.RENDERBUFFER = 36161, 
        WebGLContext.RGBA4 = 32854, WebGLContext.RGB5_A1 = 32855, WebGLContext.RGB565 = 36194, 
        WebGLContext.DEPTH_COMPONENT16 = 33189, WebGLContext.STENCIL_INDEX = 6401, WebGLContext.STENCIL_INDEX8 = 36168, 
        WebGLContext.DEPTH_STENCIL = 34041, WebGLContext.RENDERBUFFER_WIDTH = 36162, WebGLContext.RENDERBUFFER_HEIGHT = 36163, 
        WebGLContext.RENDERBUFFER_INTERNAL_FORMAT = 36164, WebGLContext.RENDERBUFFER_RED_SIZE = 36176, 
        WebGLContext.RENDERBUFFER_GREEN_SIZE = 36177, WebGLContext.RENDERBUFFER_BLUE_SIZE = 36178, 
        WebGLContext.RENDERBUFFER_ALPHA_SIZE = 36179, WebGLContext.RENDERBUFFER_DEPTH_SIZE = 36180, 
        WebGLContext.RENDERBUFFER_STENCIL_SIZE = 36181, WebGLContext.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 36048, 
        WebGLContext.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 36049, WebGLContext.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 36050, 
        WebGLContext.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 36051, WebGLContext.COLOR_ATTACHMENT0 = 36064, 
        WebGLContext.DEPTH_ATTACHMENT = 36096, WebGLContext.STENCIL_ATTACHMENT = 36128, 
        WebGLContext.DEPTH_STENCIL_ATTACHMENT = 33306, WebGLContext.NONE = 0, WebGLContext.FRAMEBUFFER_COMPLETE = 36053, 
        WebGLContext.FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 36054, WebGLContext.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 36055, 
        WebGLContext.FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 36057, WebGLContext.FRAMEBUFFER_UNSUPPORTED = 36061, 
        WebGLContext.FRAMEBUFFER_BINDING = 36006, WebGLContext.RENDERBUFFER_BINDING = 36007, 
        WebGLContext.MAX_RENDERBUFFER_SIZE = 34024, WebGLContext.INVALID_FRAMEBUFFER_OPERATION = 1286, 
        WebGLContext.UNPACK_FLIP_Y_WEBGL = 37440, WebGLContext.UNPACK_PREMULTIPLY_ALPHA_WEBGL = 37441, 
        WebGLContext.CONTEXT_LOST_WEBGL = 37442, WebGLContext.UNPACK_COLORSPACE_CONVERSION_WEBGL = 37443, 
        WebGLContext.BROWSER_DEFAULT_WEBGL = 37444, WebGLContext._useProgram = null, WebGLContext._depthTest = !0, 
        WebGLContext._depthMask = !0, WebGLContext._blend = !1, WebGLContext._cullFace = !1, 
        WebGLContext.curBindTexTarget = null, WebGLContext.curBindTexValue = null, __static(WebGLContext, [ "_depthFunc", function() {
            return this._depthFunc = 513;
        }, "_sFactor", function() {
            return this._sFactor = 1;
        }, "_dFactor", function() {
            return this._dFactor = 0;
        }, "_frontFace", function() {
            return this._frontFace = 2305;
        } ]), WebGLContext;
    }(), GraphicsGL = function(_super) {
        function GraphicsGL() {
            GraphicsGL.__super.call(this);
        }
        __class(GraphicsGL, "laya.webgl.display.GraphicsGL", Graphics);
        var __proto = GraphicsGL.prototype;
        return __proto.setShader = function(shader) {
            this._saveToCmd(Render.context._setShader, [ shader ]);
        }, __proto.setIBVB = function(x, y, ib, vb, numElement, shader) {
            this._saveToCmd(Render.context._setIBVB, [ x, y, ib, vb, numElement, shader ]);
        }, __proto.drawParticle = function(x, y, ps) {
            var pt = RunDriver.createParticleTemplate2D(ps);
            pt.x = x, pt.y = y, this._saveToCmd(Render.context._drawParticle, [ pt ]);
        }, GraphicsGL;
    }(), WebGLContext2D = function(_super) {
        var ContextParams;
        function WebGLContext2D(c) {
            this._x = 0, this._y = 0, this._id = ++WebGLContext2D._COUNT, this._path = null, 
            this._drawCount = 1, this._maxNumEle = 0, this._clear = !1, this._isMain = !1, this._atlasResourceChange = 0, 
            this._submits = null, this._curSubmit = null, this._ib = null, this._vb = null, 
            this._nBlendType = 0, this._saveMark = null, this._shader2D = null, this.meshlist = [], 
            this.mId = -1, this.mHaveKey = !1, this.mHaveLineKey = !1, this.mX = 0, this.mY = 0, 
            WebGLContext2D.__super.call(this), this._width = 99999999, this._height = 99999999, 
            this._clipRect = WebGLContext2D.MAXCLIPRECT, this.mOutPoint, this._canvas = c, this._canvas._addReference(), 
            WebGLContext2D._contextcount++, Render.isFlash ? (this._ib = IndexBuffer2D.create(35044), 
            GlUtils.fillIBQuadrangle(this._ib, 16)) : this._ib = IndexBuffer2D.QuadrangleIB, 
            this.clear();
        }
        __class(WebGLContext2D, "laya.webgl.canvas.WebGLContext2D", Context);
        var __proto = WebGLContext2D.prototype;
        return __proto.setIsMainContext = function() {
            this._isMain = !0;
        }, __proto.clearBG = function(r, g, b, a) {
            var gl = WebGL.mainContext;
            gl.clearColor(r, g, b, a), gl.clear(16384);
        }, __proto._getSubmits = function() {
            return this._submits;
        }, __proto._releaseMem = function() {
            if (this._submits) {
                this._curMat.destroy(), this._curMat = null, this._shader2D.destroy(), this._shader2D = null;
                for (var i = 0, n = this._submits._length; i < n; i++) this._submits[i].releaseRender();
                this._submits.length = 0, this._submits._length = 0, this._submits = null, this._curSubmit = null, 
                this._path && this._path.recover(), this._path = null, this._other && (this._other.font = null), 
                this._save = null, this._vb && (this._vb.releaseResource(), this._vb.destroy(), 
                this._vb.destory(), this._vb = null);
            }
        }, __proto.destroy = function() {
            --WebGLContext2D._contextcount, this.sprite = null, this._releaseMem(), this._targets && this._targets.destroy(), 
            this._targets = null, this._canvas && this._canvas._removeReference(), this._canvas = null, 
            this._ib && this._ib != IndexBuffer2D.QuadrangleIB && this._ib.releaseResource();
        }, __proto.clear = function() {
            this._submits || (this._other = ContextParams.DEFAULT, this._curMat = Matrix.create(), 
            this._vb = VertexBuffer2D.create(-1), this._submits = [], this._save = [ SaveMark.Create(this) ], 
            this._save.length = 10, this._shader2D = new Shader2D(), this._triangleMesh = MeshTexture.getAMesh()), 
            this._vb.clear(), this._targets && (this._targets.repaint = !0), this._other = ContextParams.DEFAULT, 
            this._clear = !0, this._repaint = !1, this._drawCount = 1, this._renderKey = 0, 
            this._other.lineWidth = this._shader2D.ALPHA = 1, this._nBlendType = 0, this._clipRect = WebGLContext2D.MAXCLIPRECT, 
            this._curSubmit = Submit.RENDERBASE, this._shader2D.glTexture = null, this._shader2D.fillStyle = this._shader2D.strokeStyle = DrawStyle.DEFAULT;
            for (var i = 0, n = this._submits._length; i < n; i++) this._submits[i].releaseRender(), 
            this._submits[i] = null;
            this._submits._length = 0, this._curMat.identity(), this._other.clear(), this._saveMark = this._save[0], 
            this._save._length = 1;
        }, __proto.size = function(w, h) {
            if (this._width != w || this._height != h) if (0 == w || 0 == h) {
                0 != this._vb._byteLength && (this._width = w, this._height = h, this._vb.clear(), 
                this._vb.upload());
                for (var i = 0, n = this._submits._length; i < n; i++) this._submits[i].releaseRender();
                this._submits.length = 0, this._submits._length = 0, this._curSubmit = null, this._path && this._path.recover(), 
                this._path = null, this.sprite = null, this._targets && this._targets.destroy(), 
                this._targets = null;
            } else this._width = w, this._height = h, this._targets && this._targets.size(w, h), 
            this._canvas.memorySize -= this._canvas.memorySize;
            0 === w && 0 === h && this._releaseMem();
        }, __proto._getTransformMatrix = function() {
            return this._curMat;
        }, __proto.translate = function(x, y) {
            0 === x && 0 === y || (SaveTranslate.save(this), this._curMat.bTransform && (SaveTransform.save(this), 
            this._curMat.transformPointN(Point.TEMP.setTo(x, y)), x = Point.TEMP.x, y = Point.TEMP.y), 
            this._x += x, this._y += y);
        }, __proto.save = function() {
            this._save[this._save._length++] = SaveMark.Create(this);
        }, __proto.restore = function() {
            var sz = this._save._length;
            if (!(sz < 1)) for (var i = sz - 1; 0 <= i; i--) {
                var o = this._save[i];
                if (o.restore(this), o.isSaveMark()) return void (this._save._length = i);
            }
        }, __proto._fillText = function(txt, words, x, y, fontStr, color, strokeColor, lineWidth, textAlign, underLine) {
            void 0 === underLine && (underLine = 0);
            var shader = this._shader2D, curShader = this._curSubmit.shaderValue, font = fontStr ? FontInContext.create(fontStr) : this._other.font;
            if (AtlasResourceManager.enabled) shader.ALPHA !== curShader.ALPHA && (shader.glTexture = null), 
            DrawText.drawText(this, txt, words, this._curMat, font, textAlign || this._other.textAlign, color, strokeColor, lineWidth, x, y, underLine); else {
                this._shader2D.defines.getValue();
                var colorAdd = color ? Color.create(color)._color : shader.colorAdd;
                shader.ALPHA === curShader.ALPHA && colorAdd === shader.colorAdd && curShader.colorAdd === shader.colorAdd || (shader.glTexture = null, 
                shader.colorAdd = colorAdd), DrawText.drawText(this, txt, words, this._curMat, font, textAlign || this._other.textAlign, color, strokeColor, lineWidth, x, y, underLine);
            }
        }, __proto.fillWords = function(words, x, y, fontStr, color, underLine) {
            this._fillText(null, words, x, y, fontStr, color, null, -1, null, underLine);
        }, __proto.fillBorderWords = function(words, x, y, font, color, borderColor, lineWidth) {
            this._fillBorderText(null, words, x, y, font, color, borderColor, lineWidth, null);
        }, __proto.fillText = function(txt, x, y, fontStr, color, textAlign) {
            this._fillText(txt, null, x, y, fontStr, color, null, -1, textAlign);
        }, __proto.strokeText = function(txt, x, y, fontStr, color, lineWidth, textAlign) {
            this._fillText(txt, null, x, y, fontStr, null, color, lineWidth || 1, textAlign);
        }, __proto.fillBorderText = function(txt, x, y, fontStr, fillColor, borderColor, lineWidth, textAlign) {
            this._fillBorderText(txt, null, x, y, fontStr, fillColor, borderColor, lineWidth, textAlign);
        }, __proto._fillBorderText = function(txt, words, x, y, fontStr, fillColor, borderColor, lineWidth, textAlign) {
            if (!AtlasResourceManager.enabled) return this._fillText(txt, words, x, y, fontStr, null, borderColor, lineWidth || 1, textAlign), 
            void this._fillText(txt, words, x, y, fontStr, fillColor, null, -1, textAlign);
            var shader = this._shader2D, curShader = this._curSubmit.shaderValue;
            shader.ALPHA !== curShader.ALPHA && (shader.glTexture = null);
            var font = fontStr ? (WebGLContext2D._fontTemp.setFont(fontStr), WebGLContext2D._fontTemp) : this._other.font;
            DrawText.drawText(this, txt, words, this._curMat, font, textAlign || this._other.textAlign, fillColor, borderColor, lineWidth || 1, x, y, 0);
        }, __proto.fillRect = function(x, y, width, height, fillStyle) {
            var vb = this._vb;
            if (GlUtils.fillRectImgVb(vb, this._clipRect, x, y, width, height, Texture.DEF_UV, this._curMat, this._x, this._y, 0, 0)) {
                this._renderKey = 0;
                var pre = this._shader2D.fillStyle;
                fillStyle && (this._shader2D.fillStyle = DrawStyle.create(fillStyle));
                var shader = this._shader2D, curShader = this._curSubmit.shaderValue;
                if (shader.fillStyle !== curShader.fillStyle || shader.ALPHA !== curShader.ALPHA) {
                    shader.glTexture = null;
                    var submit = this._curSubmit = Submit.createSubmit(this, this._ib, vb, (vb._byteLength - 64) / 32 * 3, Value2D.create(2, 0));
                    submit.shaderValue.color = shader.fillStyle._color._color, submit.shaderValue.ALPHA = shader.ALPHA, 
                    this._submits[this._submits._length++] = submit;
                }
                this._curSubmit._numEle += 6, this._shader2D.fillStyle = pre;
            }
        }, __proto.fillTexture = function(texture, x, y, width, height, type, offset, other) {
            if (texture.loaded && texture.bitmap && texture.source) {
                var vb = this._vb, w = texture.bitmap.width, h = texture.bitmap.height, uv = texture.uv, ox = offset.x % texture.width, oy = offset.y % texture.height;
                if (w != other.w || h != other.h) {
                    if (!other.w && !other.h) switch (other.oy = other.ox = 0, type) {
                      case "repeat":
                        other.width = width, other.height = height;
                        break;

                      case "repeat-x":
                        other.width = width, oy < 0 ? texture.height + oy > height ? other.height = height : other.height = texture.height + oy : (other.oy = oy, 
                        texture.height + oy > height ? other.height = height - oy : other.height = texture.height);
                        break;

                      case "repeat-y":
                        ox < 0 ? texture.width + ox > width ? other.width = width : other.width = texture.width + ox : (other.ox = ox, 
                        texture.width + ox > width ? other.width = width - ox : other.width = texture.width), 
                        other.height = height;
                        break;

                      case "no-repeat":
                        ox < 0 ? texture.width + ox > width ? other.width = width : other.width = texture.width + ox : (other.ox = ox, 
                        texture.width + ox > width ? other.width = width - ox : other.width = texture.width), 
                        oy < 0 ? texture.height + oy > height ? other.height = height : other.height = texture.height + oy : (other.oy = oy, 
                        texture.height + oy > height ? other.height = height - oy : other.height = texture.height);
                        break;

                      default:
                        other.width = width, other.height = height;
                    }
                    other.w = w, other.h = h, other.uv = [ 0, 0, other.width / w, 0, other.width / w, other.height / h, 0, other.height / h ];
                }
                if (x += other.ox, y += other.oy, ox -= other.ox, oy -= other.oy, GlUtils.fillRectImgVb(vb, this._clipRect, x, y, other.width, other.height, other.uv, this._curMat, this._x, this._y, 0, 0)) {
                    this._renderKey = 0;
                    var submit = SubmitTexture.create(this, this._ib, vb, (vb._byteLength - 64) / 32 * 3, Value2D.create(256, 0)), shaderValue = (this._submits[this._submits._length++] = submit).shaderValue;
                    shaderValue.textureHost = texture;
                    var tTextureX = uv[0] * w, tTextureY = uv[1] * h, tTextureW = (uv[2] - uv[0]) * w, tTextureH = (uv[5] - uv[3]) * h, tx = -ox / w, ty = -oy / h;
                    shaderValue.u_TexRange[0] = tTextureX / w, shaderValue.u_TexRange[1] = tTextureW / w, 
                    shaderValue.u_TexRange[2] = tTextureY / h, shaderValue.u_TexRange[3] = tTextureH / h, 
                    shaderValue.u_offset[0] = tx, shaderValue.u_offset[1] = ty, AtlasResourceManager.enabled && !this._isMain && submit.addTexture(texture, (vb._byteLength >> 2) - 16), 
                    (this._curSubmit = submit)._renderType = 10017, submit._numEle += 6;
                }
            } else this.sprite && Laya.timer.callLater(this, this._repaintSprite);
        }, __proto.setShader = function(shader) {
            SaveBase.save(this, 1048576, this._shader2D, !0), this._shader2D.shader = shader;
        }, __proto.setFilters = function(value) {
            SaveBase.save(this, 2097152, this._shader2D, !0), this._shader2D.filters = value, 
            this._curSubmit = Submit.RENDERBASE, this._renderKey = 0, this._drawCount++;
        }, __proto.drawTexture = function(tex, x, y, width, height, tx, ty) {
            this._drawTextureM(tex, x, y, width, height, tx, ty, null, 1);
        }, __proto.addTextureVb = function(invb, x, y) {
            var finalVB = this._curSubmit._vb || this._vb, vpos = finalVB._byteLength >> 2;
            finalVB.byteLength = vpos + 16 << 2;
            for (var vbdata = finalVB.getFloat32Array(), i = 0; i < 16; i += 4) vbdata[vpos++] = invb[i] + x, 
            vbdata[vpos++] = invb[i + 1] + y, vbdata[vpos++] = invb[i + 2], vbdata[vpos++] = invb[i + 3];
            this._curSubmit._numEle += 6, this._maxNumEle = Math.max(this._maxNumEle, this._curSubmit._numEle), 
            finalVB._upload = !0;
        }, __proto.willDrawTexture = function(tex, alpha) {
            if (!(tex.loaded && tex.bitmap && tex.source)) return this.sprite && Laya.timer.callLater(this, this._repaintSprite), 
            0;
            var webGLImg = tex.bitmap, rid = webGLImg.id + this._shader2D.ALPHA * alpha + 10016;
            if (rid == this._renderKey) return rid;
            var shader = this._shader2D, preAlpha = shader.ALPHA, curShader = this._curSubmit.shaderValue;
            shader.ALPHA *= alpha, this._renderKey = rid, this._drawCount++, shader.glTexture = webGLImg;
            var vb = this._vb, submit = null, vbSize = vb._byteLength / 32 * 3;
            return submit = SubmitTexture.create(this, this._ib, vb, vbSize, Value2D.create(1, 0)), 
            (this._submits[this._submits._length++] = submit).shaderValue.textureHost = tex, 
            submit._renderType = 10016, submit._preIsSameTextureShader = 10016 === this._curSubmit._renderType && shader.ALPHA === curShader.ALPHA, 
            this._curSubmit = submit, shader.ALPHA = preAlpha, rid;
        }, __proto.drawTextures = function(tex, pos, tx, ty) {
            if (tex.loaded && tex.bitmap && tex.source) {
                var pre = this._clipRect;
                if (this._clipRect = WebGLContext2D.MAXCLIPRECT, this._drawTextureM(tex, pos[0], pos[1], tex.width, tex.height, tx, ty, null, 1)) {
                    if (this._clipRect = pre, Stat.drawCall++, !(pos.length < 4)) {
                        for (var finalVB = this._curSubmit._vb || this._vb, sx = this._curMat.a, sy = this._curMat.d, i = 2, sz = pos.length; i < sz; i += 2) GlUtils.copyPreImgVb(finalVB, (pos[i] - pos[i - 2]) * sx, (pos[i + 1] - pos[i - 1]) * sy), 
                        this._curSubmit._numEle += 6;
                        this._maxNumEle = Math.max(this._maxNumEle, this._curSubmit._numEle);
                    }
                } else alert("drawTextures err");
            } else this.sprite && Laya.timer.callLater(this, this._repaintSprite);
        }, __proto._drawTextureM = function(tex, x, y, width, height, tx, ty, m, alpha) {
            if (!tex.loaded || !tex.source) return this.sprite && Laya.timer.callLater(this, this._repaintSprite), 
            !1;
            var finalVB = this._curSubmit._vb || this._vb, webGLImg = tex.bitmap;
            x += tx, y += ty, this._drawCount++;
            var rid = webGLImg.id + this._shader2D.ALPHA * alpha + 10016;
            if (rid != this._renderKey) {
                this._renderKey = rid;
                var curShader = this._curSubmit.shaderValue, shader = this._shader2D, alphaBack = shader.ALPHA;
                shader.ALPHA *= alpha, shader.glTexture = webGLImg;
                var vb = this._vb, submit = null, vbSize = vb._byteLength / 32 * 3;
                submit = SubmitTexture.create(this, this._ib, vb, vbSize, Value2D.create(1, 0)), 
                (this._submits[this._submits._length++] = submit).shaderValue.textureHost = tex, 
                submit._renderType = 10016, submit._preIsSameTextureShader = 10016 === this._curSubmit._renderType && shader.ALPHA === curShader.ALPHA, 
                this._curSubmit = submit, finalVB = this._curSubmit._vb || this._vb, shader.ALPHA = alphaBack;
            }
            return !!GlUtils.fillRectImgVb(finalVB, this._clipRect, x, y, width || tex.width, height || tex.height, tex.uv, m || this._curMat, this._x, this._y, 0, 0) && (AtlasResourceManager.enabled && !this._isMain && this._curSubmit.addTexture(tex, (finalVB._byteLength >> 2) - 16), 
            this._curSubmit._numEle += 6, this._maxNumEle = Math.max(this._maxNumEle, this._curSubmit._numEle), 
            !0);
        }, __proto._repaintSprite = function() {
            this.sprite && this.sprite.repaint();
        }, __proto._drawText = function(tex, x, y, width, height, m, tx, ty, dx, dy) {
            var webGLImg = tex.bitmap;
            this._drawCount++;
            var rid = webGLImg.id + this._shader2D.ALPHA + 10016;
            if (rid != this._renderKey) {
                this._renderKey = rid;
                var curShader = this._curSubmit.shaderValue, shader = this._shader2D;
                shader.glTexture = webGLImg;
                var vb = this._vb, submit = null, vbSize = vb._byteLength / 32 * 3;
                (submit = AtlasResourceManager.enabled ? SubmitTexture.create(this, this._ib, vb, vbSize, Value2D.create(1, 0)) : SubmitTexture.create(this, this._ib, vb, vbSize, TextSV.create()))._preIsSameTextureShader = 10016 === this._curSubmit._renderType && shader.ALPHA === curShader.ALPHA, 
                (this._submits[this._submits._length++] = submit).shaderValue.textureHost = tex, 
                submit._renderType = 10016, this._curSubmit = submit;
            }
            tex.active();
            var finalVB = this._curSubmit._vb || this._vb;
            GlUtils.fillRectImgVb(finalVB, this._clipRect, x + tx, y + ty, width || tex.width, height || tex.height, tex.uv, m || this._curMat, this._x, this._y, dx, dy, !0) && (AtlasResourceManager.enabled && !this._isMain && this._curSubmit.addTexture(tex, (finalVB._byteLength >> 2) - 16), 
            this._curSubmit._numEle += 6, this._maxNumEle = Math.max(this._maxNumEle, this._curSubmit._numEle));
        }, __proto.drawTextureWithTransform = function(tex, x, y, width, height, transform, tx, ty, alpha) {
            if (transform) {
                var curMat = this._curMat, prex = this._x, prey = this._y;
                (0 !== tx || 0 !== ty) && (this._x = tx * curMat.a + ty * curMat.c, this._y = ty * curMat.d + tx * curMat.b), 
                transform && curMat.bTransform ? (Matrix.mul(transform, curMat, WebGLContext2D._tmpMatrix), 
                (transform = WebGLContext2D._tmpMatrix)._checkTransform()) : (this._x += curMat.tx, 
                this._y += curMat.ty), this._drawTextureM(tex, x, y, width, height, 0, 0, transform, alpha), 
                this._x = prex, this._y = prey;
            } else this._drawTextureM(tex, x, y, width, height, tx, ty, null, alpha);
        }, __proto.fillQuadrangle = function(tex, x, y, point4, m) {
            var submit = this._curSubmit, vb = this._vb, shader = this._shader2D, curShader = submit.shaderValue;
            if (this._renderKey = 0, tex.bitmap) {
                var t_tex = tex.bitmap;
                shader.glTexture == t_tex && shader.ALPHA === curShader.ALPHA || (shader.glTexture = t_tex, 
                (submit = this._curSubmit = Submit.createSubmit(this, this._ib, vb, vb._byteLength / 32 * 3, Value2D.create(1, 0))).shaderValue.glTexture = t_tex, 
                this._submits[this._submits._length++] = submit), GlUtils.fillQuadrangleImgVb(vb, x, y, point4, tex.uv, m || this._curMat, this._x, this._y);
            } else submit.shaderValue.fillStyle && submit.shaderValue.fillStyle.equal(tex) && shader.ALPHA === curShader.ALPHA || (shader.glTexture = null, 
            (submit = this._curSubmit = Submit.createSubmit(this, this._ib, vb, vb._byteLength / 32 * 3, Value2D.create(2, 0))).shaderValue.defines.add(2), 
            submit.shaderValue.fillStyle = DrawStyle.create(tex), this._submits[this._submits._length++] = submit), 
            GlUtils.fillQuadrangleImgVb(vb, x, y, point4, Texture.DEF_UV, m || this._curMat, this._x, this._y);
            submit._numEle += 6;
        }, __proto.drawTexture2 = function(x, y, pivotX, pivotY, transform, alpha, blendMode, args) {
            if (0 != alpha) {
                var curMat = this._curMat;
                if (this._x = x * curMat.a + y * curMat.c, this._y = y * curMat.d + x * curMat.b, 
                transform && (transform = curMat.bTransform || transform.bTransform ? (Matrix.mul(transform, curMat, WebGLContext2D._tmpMatrix), 
                WebGLContext2D._tmpMatrix) : (this._x += transform.tx + curMat.tx, this._y += transform.ty + curMat.ty, 
                Matrix.EMPTY)), 1 !== alpha || blendMode) {
                    var preAlpha = this._shader2D.ALPHA, preblendType = this._nBlendType;
                    this._shader2D.ALPHA = alpha, blendMode && (this._nBlendType = BlendMode.TOINT(blendMode)), 
                    this._drawTextureM(args[0], args[1] - pivotX, args[2] - pivotY, args[3], args[4], 0, 0, transform, 1), 
                    this._shader2D.ALPHA = preAlpha, this._nBlendType = preblendType;
                } else this._drawTextureM(args[0], args[1] - pivotX, args[2] - pivotY, args[3], args[4], 0, 0, transform, 1);
                this._x = this._y = 0;
            }
        }, __proto.drawCanvas = function(canvas, x, y, width, height) {
            var src = canvas.context;
            if (this._renderKey = 0, src._targets) this._submits[this._submits._length++] = SubmitCanvas.create(src, 0, null), 
            this._curSubmit = Submit.RENDERBASE, src._targets.drawTo(this, x, y, width, height); else {
                var submit = this._submits[this._submits._length++] = SubmitCanvas.create(src, this._shader2D.ALPHA, this._shader2D.filters), sx = width / canvas.width, sy = height / canvas.height, mat = submit._matrix;
                this._curMat.copyTo(mat), 1 != sx && 1 != sy && mat.scale(sx, sy);
                var tx = mat.tx, ty = mat.ty;
                mat.tx = mat.ty = 0, mat.transformPoint(Point.TEMP.setTo(x, y)), mat.translate(Point.TEMP.x + tx, Point.TEMP.y + ty), 
                this._curSubmit = Submit.RENDERBASE;
            }
            Config.showCanvasMark && (this.save(), this.lineWidth = 4, this.strokeStyle = src._targets ? "yellow" : "green", 
            this.strokeRect(x - 1, y - 1, width + 2, height + 2, 1), this.strokeRect(x, y, width, height, 1), 
            this.restore());
        }, __proto.drawTarget = function(scope, x, y, width, height, m, proName, shaderValue, uv, blend) {
            void 0 === blend && (blend = -1);
            var vb = this._vb;
            if (GlUtils.fillRectImgVb(vb, this._clipRect, x, y, width, height, uv || Texture.DEF_UV, m || this._curMat, this._x, this._y, 0, 0)) {
                this._renderKey = 0, this._shader2D.glTexture = null;
                this._curSubmit.shaderValue;
                var submit = this._curSubmit = SubmitTarget.create(this, this._ib, vb, (vb._byteLength - 64) / 32 * 3, shaderValue, proName);
                submit.blendType = -1 == blend ? this._nBlendType : blend, submit.scope = scope, 
                this._submits[this._submits._length++] = submit, this._curSubmit._numEle += 6;
            }
        }, __proto.mixRGBandAlpha = function(color) {
            return this._mixRGBandAlpha(color, this._shader2D.ALPHA);
        }, __proto._mixRGBandAlpha = function(color, alpha) {
            var a = (4278190080 & color) >>> 24;
            return 0 != a ? a *= alpha : a = 255 * alpha, 16777215 & color | a << 24;
        }, __proto.drawTriangles = function(tex, x, y, vertices, uvs, indices, matrix, alpha, color, blendMode) {
            if (!tex.loaded || !tex.source) return this.sprite && Laya.timer.callLater(this, this._repaintSprite), 
            !1;
            this._drawCount++;
            tex.bitmap;
            var rgba = this._mixRGBandAlpha(4294967295, alpha), eleNum = (vertices.length, indices.length);
            this._renderKey = -1;
            var submit = this._curSubmit = SubmitTexture.create(this, this._triangleMesh.getIBR(), this._triangleMesh.getVBR(), this._triangleMesh.indexNum, Value2D.create(1, 0));
            return submit.shaderValue.textureHost = tex, submit._renderType = 10016, this._submits[this._submits._length++] = submit, 
            matrix ? (WebGLContext2D._tmpMatrix.a = matrix.a, WebGLContext2D._tmpMatrix.b = matrix.b, 
            WebGLContext2D._tmpMatrix.c = matrix.c, WebGLContext2D._tmpMatrix.d = matrix.d, 
            WebGLContext2D._tmpMatrix.tx = matrix.tx + x, WebGLContext2D._tmpMatrix.ty = matrix.ty + y, 
            Matrix.mul(WebGLContext2D._tmpMatrix, this._curMat, WebGLContext2D._tmpMatrix)) : (WebGLContext2D._tmpMatrix.a = this._curMat.a, 
            WebGLContext2D._tmpMatrix.b = this._curMat.b, WebGLContext2D._tmpMatrix.c = this._curMat.c, 
            WebGLContext2D._tmpMatrix.d = this._curMat.d, WebGLContext2D._tmpMatrix.tx = this._curMat.tx + x, 
            WebGLContext2D._tmpMatrix.ty = this._curMat.ty + y), this._triangleMesh.addData(vertices, uvs, indices, WebGLContext2D._tmpMatrix, rgba, this), 
            this._curSubmit._numEle += eleNum, this._maxNumEle = Math.max(this._maxNumEle, this._curSubmit._numEle), 
            !0;
        }, __proto.transform = function(a, b, c, d, tx, ty) {
            SaveTransform.save(this), Matrix.mul(Matrix.TEMP.setTo(a, b, c, d, tx, ty), this._curMat, this._curMat), 
            this._curMat._checkTransform();
        }, __proto.setTransformByMatrix = function(value) {
            value.copyTo(this._curMat);
        }, __proto.transformByMatrix = function(value) {
            SaveTransform.save(this), Matrix.mul(value, this._curMat, this._curMat), this._curMat._checkTransform();
        }, __proto.rotate = function(angle) {
            SaveTransform.save(this), this._curMat.rotateEx(angle);
        }, __proto.scale = function(scaleX, scaleY) {
            SaveTransform.save(this), this._curMat.scaleEx(scaleX, scaleY);
        }, __proto.clipRect = function(x, y, width, height) {
            if (0 != this._curMat.b || 0 != this._curMat.c) {
                this._renderKey = 0;
                var submitStencil0 = SubmitStencil.create(4);
                this.addRenderObject(submitStencil0);
                var vb = this._vb, nPos = vb._byteLength >> 2;
                if (GlUtils.fillRectImgVb(vb, null, x, y, width, height, Texture.DEF_UV, this._curMat, this._x, this._y, 0, 0)) {
                    this._shader2D.glTexture = null;
                    var submit = this._curSubmit = Submit.createSubmit(this, this._ib, vb, (vb._byteLength - 64) / 32 * 3, Value2D.create(2, 0));
                    submit.shaderValue.ALPHA = 1, this._submits[this._submits._length++] = submit, this._curSubmit._numEle += 6;
                } else alert("clipRect calc stencil rect error");
                var submitStencil1 = SubmitStencil.create(5);
                this.addRenderObject(submitStencil1);
                var vbdata = vb.getFloat32Array(), minx = Math.min(Math.min(Math.min(vbdata[0 + nPos], vbdata[4 + nPos]), vbdata[8 + nPos]), vbdata[12 + nPos]), maxx = Math.max(Math.max(Math.max(vbdata[0 + nPos], vbdata[4 + nPos]), vbdata[8 + nPos]), vbdata[12 + nPos]), miny = Math.min(Math.min(Math.min(vbdata[1 + nPos], vbdata[5 + nPos]), vbdata[9 + nPos]), vbdata[13 + nPos]), maxy = Math.max(Math.max(Math.max(vbdata[1 + nPos], vbdata[5 + nPos]), vbdata[9 + nPos]), vbdata[13 + nPos]);
                SaveClipRectStencil.save(this, submitStencil1, x, y, width, height, minx, miny, maxx - minx, maxy - miny), 
                this._curSubmit = Submit.RENDERBASE;
            } else {
                width *= this._curMat.a, height *= this._curMat.d;
                var p = Point.TEMP;
                this._curMat.transformPoint(p.setTo(x, y)), width < 0 && (p.x = p.x + width, width = -width), 
                height < 0 && (p.y = p.y + height, height = -height), this._renderKey = 0;
                var submitSc = this._curSubmit = SubmitScissor.create(this);
                (this._submits[this._submits._length++] = submitSc).submitIndex = this._submits._length, 
                submitSc.submitLength = 9999999, SaveClipRect.save(this, submitSc);
                var clip = this._clipRect, x1 = clip.x, y1 = clip.y, r = p.x + width, b = p.y + height;
                x1 < p.x && (clip.x = p.x), y1 < p.y && (clip.y = p.y), clip.width = Math.min(r, x1 + clip.width) - clip.x, 
                clip.height = Math.min(b, y1 + clip.height) - clip.y, this._shader2D.glTexture = null, 
                submitSc.clipRect.copyFrom(clip), this._curSubmit = Submit.RENDERBASE;
            }
        }, __proto.setIBVB = function(x, y, ib, vb, numElement, mat, shader, shaderValues, startIndex, offset, type) {
            if (void 0 === startIndex && (startIndex = 0), void 0 === offset && (offset = 0), 
            void 0 === type && (type = 0), null === ib) {
                if (Render.isFlash) {
                    var falshVB = vb;
                    falshVB._selfIB || (falshVB._selfIB = IndexBuffer2D.create(35044)), falshVB._selfIB.clear(), 
                    ib = falshVB._selfIB;
                } else ib = this._ib;
                GlUtils.expandIBQuadrangle(ib, vb._byteLength / (4 * vb.vertexStride * 4));
            }
            if (!shaderValues || !shader) throw Error("setIBVB must input:shader shaderValues");
            var submit = SubmitOtherIBVB.create(this, vb, ib, numElement, shader, shaderValues, startIndex, offset, type);
            mat || (mat = Matrix.EMPTY), mat.translate(x, y), Matrix.mul(mat, this._curMat, submit._mat), 
            mat.translate(-x, -y), this._submits[this._submits._length++] = submit, this._curSubmit = Submit.RENDERBASE, 
            this._renderKey = 0;
        }, __proto.addRenderObject = function(o) {
            this._submits[this._submits._length++] = o;
        }, __proto.fillTrangles = function(tex, x, y, points, m) {
            var submit = this._curSubmit, vb = this._vb, shader = this._shader2D, curShader = submit.shaderValue, length = points.length >> 4, t_tex = tex.bitmap;
            this._renderKey = 0, shader.glTexture == t_tex && shader.ALPHA === curShader.ALPHA || ((submit = this._curSubmit = Submit.createSubmit(this, this._ib, vb, vb._byteLength / 32 * 3, Value2D.create(1, 0))).shaderValue.textureHost = tex, 
            this._submits[this._submits._length++] = submit), GlUtils.fillTranglesVB(vb, x, y, points, m || this._curMat, this._x, this._y), 
            submit._numEle += 6 * length;
        }, __proto.submitElement = function(start, end) {
            var renderList = this._submits;
            for (end < 0 && (end = renderList._length); start < end; ) start += renderList[start].renderSubmit();
        }, __proto.finish = function() {
            WebGL.mainContext.finish();
        }, __proto.flush = function() {
            var maxNum = Math.max(this._vb._byteLength / 64, this._maxNumEle / 6) + 8;
            if (maxNum > this._ib.bufferLength / 12 && GlUtils.expandIBQuadrangle(this._ib, maxNum), 
            !this._isMain && AtlasResourceManager.enabled && AtlasResourceManager._atlasRestore > this._atlasResourceChange) {
                this._atlasResourceChange = AtlasResourceManager._atlasRestore;
                for (var renderList = this._submits, i = 0, s = renderList._length; i < s; i++) {
                    var submit = renderList[i];
                    10016 === submit.getRenderType() && submit.checkTexture();
                }
            }
            this.submitElement(0, this._submits._length), this._path && this._path.reset(), 
            SkinMeshBuffer.instance && SkinMeshBuffer.getInstance().reset();
            var sz;
            for (i = 0, sz = this.meshlist.length; i < sz; i++) {
                var curm = this.meshlist[i];
                curm.canReuse ? curm.releaseMesh() : curm.destroy();
            }
            return this.meshlist.length = 0, this._curSubmit = Submit.RENDERBASE, this._renderKey = 0, 
            this._triangleMesh = MeshTexture.getAMesh(), this.meshlist.push(this._triangleMesh), 
            this._submits._length;
        }, __proto.setPathId = function(id) {
            if (this.mId = id, -1 != this.mId) {
                this.mHaveKey = !1;
                var tVGM = VectorGraphManager.getInstance();
                tVGM.shapeDic[this.mId] && (this.mHaveKey = !0), this.mHaveLineKey = !1, tVGM.shapeLineDic[this.mId] && (this.mHaveLineKey = !0);
            }
        }, __proto.movePath = function(x, y) {
            var _x1 = x, _y1 = y;
            x = this._curMat.a * _x1 + this._curMat.c * _y1 + this._curMat.tx, y = this._curMat.b * _x1 + this._curMat.d * _y1 + this._curMat.ty, 
            this.mX += x, this.mY += y;
        }, __proto.beginPath = function() {
            var tPath = this._getPath();
            tPath.tempArray.length = 0, tPath.closePath = !1, this.mX = 0, this.mY = 0;
        }, __proto.closePath = function() {
            this._path.closePath = !0;
        }, __proto.fill = function(isConvexPolygon) {
            void 0 === isConvexPolygon && (isConvexPolygon = !1);
            var tPath = this._getPath();
            this.drawPoly(0, 0, tPath.tempArray, this.fillStyle._color.numColor, 0, 0, isConvexPolygon);
        }, __proto.stroke = function() {
            var tPath = this._getPath();
            if (0 < this.lineWidth) {
                if (-1 == this.mId) tPath.drawLine(0, 0, tPath.tempArray, this.lineWidth, this.strokeStyle._color.numColor); else if (this.mHaveLineKey) {
                    var tShapeLine = VectorGraphManager.getInstance().shapeLineDic[this.mId];
                    tShapeLine.rebuild(tPath.tempArray), tPath.setGeomtry(tShapeLine);
                } else VectorGraphManager.getInstance().addLine(this.mId, tPath.drawLine(0, 0, tPath.tempArray, this.lineWidth, this.strokeStyle._color.numColor));
                tPath.update();
                var tPosArray = [ this.mX, this.mY ], tempSubmit = Submit.createShape(this, tPath.ib, tPath.vb, tPath.count, tPath.offset, Value2D.create(4, 0));
                tempSubmit.shaderValue.ALPHA = this._shader2D.ALPHA, tempSubmit.shaderValue.u_pos = tPosArray, 
                tempSubmit.shaderValue.u_mmat2 = RenderState2D.TEMPMAT4_ARRAY, this._submits[this._submits._length++] = tempSubmit, 
                this._renderKey = -1;
            }
        }, __proto.line = function(fromX, fromY, toX, toY, lineWidth, mat) {
            var submit = this._curSubmit, vb = this._vb;
            if (GlUtils.fillLineVb(vb, this._clipRect, fromX, fromY, toX, toY, lineWidth, mat)) {
                this._renderKey = 0;
                var shader = this._shader2D, curShader = submit.shaderValue;
                shader.strokeStyle === curShader.strokeStyle && shader.ALPHA === curShader.ALPHA || (shader.glTexture = null, 
                (submit = this._curSubmit = Submit.createSubmit(this, this._ib, vb, (vb._byteLength - 64) / 32 * 3, Value2D.create(2, 0))).shaderValue.strokeStyle = shader.strokeStyle, 
                submit.shaderValue.mainID = 2, submit.shaderValue.ALPHA = shader.ALPHA, this._submits[this._submits._length++] = submit), 
                submit._numEle += 6;
            }
        }, __proto.moveTo = function(x, y, b) {
            void 0 === b && (b = !0);
            var tPath = this._getPath();
            if (b) {
                var _x1 = x, _y1 = y;
                x = this._curMat.a * _x1 + this._curMat.c * _y1, y = this._curMat.b * _x1 + this._curMat.d * _y1;
            }
            tPath.addPoint(x, y);
        }, __proto.lineTo = function(x, y, b) {
            void 0 === b && (b = !0);
            var tPath = this._getPath();
            if (b) {
                var _x1 = x, _y1 = y;
                x = this._curMat.a * _x1 + this._curMat.c * _y1, y = this._curMat.b * _x1 + this._curMat.d * _y1;
            }
            tPath.addPoint(x, y);
        }, __proto.drawCurves = function(x, y, args) {
            this.setPathId(-1), this.beginPath(), this.strokeStyle = args[3], this.lineWidth = args[4];
            var points = args[2];
            x += args[0], y += args[1], this.movePath(x, y), this.moveTo(points[0], points[1]);
            for (var i = 2, n = points.length; i < n; ) this.quadraticCurveTo(points[i++], points[i++], points[i++], points[i++]);
            this.stroke();
        }, __proto.arcTo = function(x1, y1, x2, y2, r) {
            if (-1 == this.mId || !this.mHaveKey) {
                var i = 0, x = 0, y = 0, tPath = this._getPath();
                this._curMat.copyTo(WebGLContext2D._tmpMatrix), WebGLContext2D._tmpMatrix.tx = WebGLContext2D._tmpMatrix.ty = 0, 
                WebGLContext2D._tempPoint.setTo(tPath.getEndPointX(), tPath.getEndPointY()), WebGLContext2D._tmpMatrix.invertTransformPoint(WebGLContext2D._tempPoint);
                var dx = WebGLContext2D._tempPoint.x - x1, dy = WebGLContext2D._tempPoint.y - y1, len1 = Math.sqrt(dx * dx + dy * dy);
                if (!(len1 <= 1e-6)) {
                    var ndx = dx / len1, ndy = dy / len1, dx2 = x2 - x1, dy2 = y2 - y1, len22 = dx2 * dx2 + dy2 * dy2, len2 = Math.sqrt(len22);
                    if (!(len2 <= 1e-6)) {
                        var ndx2 = dx2 / len2, ndy2 = dy2 / len2, odx = ndx + ndx2, ody = ndy + ndy2, olen = Math.sqrt(odx * odx + ody * ody);
                        if (!(olen <= 1e-6)) {
                            var nOdx = odx / olen, nOdy = ody / olen, alpha = Math.acos(nOdx * ndx + nOdy * ndy), halfAng = Math.PI / 2 - alpha, ptx1 = (len1 = r / Math.tan(halfAng)) * ndx + x1, pty1 = len1 * ndy + y1, orilen = Math.sqrt(len1 * len1 + r * r), orix = x1 + nOdx * orilen, oriy = y1 + nOdy * orilen, sinx = 0, cosx = 0;
                            if (0 <= ndx * ndy2 - ndy * ndx2) {
                                var fda = 2 * halfAng / WebGLContext2D.SEGNUM;
                                sinx = Math.sin(fda), cosx = Math.cos(fda);
                            } else fda = 2 * -halfAng / WebGLContext2D.SEGNUM, sinx = Math.sin(fda), cosx = Math.cos(fda);
                            x = this._curMat.a * ptx1 + this._curMat.c * pty1, y = this._curMat.b * ptx1 + this._curMat.d * pty1, 
                            x == this._path.getEndPointX() && y == this._path.getEndPointY() || tPath.addPoint(x, y);
                            var cvx = ptx1 - orix, cvy = pty1 - oriy;
                            for (i = 0; i < WebGLContext2D.SEGNUM; i++) {
                                var cx = cvx * cosx + cvy * sinx, cy = -cvx * sinx + cvy * cosx;
                                x = cx + orix, y = cy + oriy, x1 = this._curMat.a * x + this._curMat.c * y, y = y1 = this._curMat.b * x + this._curMat.d * y, 
                                (x = x1) == this._path.getEndPointX() && y == this._path.getEndPointY() || tPath.addPoint(x, y), 
                                cvx = cx, cvy = cy;
                            }
                        }
                    }
                }
            }
        }, __proto.arc = function(cx, cy, r, startAngle, endAngle, counterclockwise, b) {
            if (void 0 === counterclockwise && (counterclockwise = !1), void 0 === b && (b = !0), 
            -1 != this.mId) {
                var tShape = VectorGraphManager.getInstance().shapeDic[this.mId];
                if (tShape && this.mHaveKey && !tShape.needUpdate(this._curMat)) return;
                cy = cx = 0;
            }
            var hda, a = 0, da = 0, kappa = 0, x = 0, y = 0, i = 0, ndivs = 0;
            if (da = endAngle - startAngle, counterclockwise) if (Math.abs(da) >= 2 * Math.PI) da = 2 * -Math.PI; else for (;0 < da; ) da -= 2 * Math.PI; else if (Math.abs(da) >= 2 * Math.PI) da = 2 * Math.PI; else for (;da < 0; ) da += 2 * Math.PI;
            hda = da / (ndivs = r < 101 ? Math.max(10, da * r / 5) : r < 201 ? Math.max(10, da * r / 20) : Math.max(10, da * r / 40)) / 2, 
            kappa = Math.abs(4 / 3 * (1 - Math.cos(hda)) / Math.sin(hda)), counterclockwise && (kappa = -kappa);
            var tPath = this._getPath(), _x1 = NaN, _y1 = NaN;
            for (i = 0; i <= ndivs; i++) a = startAngle + da * (i / ndivs), x = cx + Math.cos(a) * r, 
            y = cy + Math.sin(a) * r, b && (_x1 = x, _y1 = y, x = this._curMat.a * _x1 + this._curMat.c * _y1, 
            y = this._curMat.b * _x1 + this._curMat.d * _y1), x == this._path.getEndPointX() && y == this._path.getEndPointY() || tPath.addPoint(x, y);
            x = cx + Math.cos(endAngle) * r, y = cy + Math.sin(endAngle) * r, b && (_x1 = x, 
            _y1 = y, x = this._curMat.a * _x1 + this._curMat.c * _y1, y = this._curMat.b * _x1 + this._curMat.d * _y1), 
            x == this._path.getEndPointX() && y == this._path.getEndPointY() || tPath.addPoint(x, y);
        }, __proto.quadraticCurveTo = function(cpx, cpy, x, y) {
            var tBezier = Bezier.I, _x1 = x, _y1 = y;
            x = this._curMat.a * _x1 + this._curMat.c * _y1, y = this._curMat.b * _x1 + this._curMat.d * _y1, 
            _x1 = cpx, _y1 = cpy, cpx = this._curMat.a * _x1 + this._curMat.c * _y1, cpy = this._curMat.b * _x1 + this._curMat.d * _y1;
            for (var tArray = tBezier.getBezierPoints([ this._path.getEndPointX(), this._path.getEndPointY(), cpx, cpy, x, y ], 30, 2), i = 0, n = tArray.length / 2; i < n; i++) this.lineTo(tArray[2 * i], tArray[2 * i + 1], !1);
            this.lineTo(x, y, !1);
        }, __proto.rect = function(x, y, width, height) {
            this._other = this._other.make(), this._other.path || (this._other.path = new Path()), 
            this._other.path.rect(x, y, width, height);
        }, __proto.strokeRect = function(x, y, width, height, parameterLineWidth) {
            var tW = .5 * parameterLineWidth;
            this.line(x - tW, y, x + width + tW, y, parameterLineWidth, this._curMat), this.line(x + width, y, x + width, y + height, parameterLineWidth, this._curMat), 
            this.line(x, y, x, y + height, parameterLineWidth, this._curMat), this.line(x - tW, y + height, x + width + tW, y + height, parameterLineWidth, this._curMat);
        }, __proto.clip = function() {}, __proto.drawPoly = function(x, y, points, color, lineWidth, boderColor, isConvexPolygon) {
            void 0 === isConvexPolygon && (isConvexPolygon = !1), this._renderKey = 0, this._shader2D.glTexture = null;
            var tPath = this._getPath();
            if (-1 == this.mId) tPath.polygon(x, y, points, color, lineWidth || 1, boderColor); else if (this.mHaveKey) {
                var tShape = VectorGraphManager.getInstance().shapeDic[this.mId];
                tShape.setMatrix(this._curMat), tShape.rebuild(tPath.tempArray), tPath.setGeomtry(tShape);
            } else {
                var t = tPath.polygon(x, y, points, color, lineWidth || 1, boderColor);
                VectorGraphManager.getInstance().addShape(this.mId, t), t.setMatrix(this._curMat);
            }
            tPath.update();
            var tempSubmit, tPosArray = [ this.mX, this.mY ];
            if ((tempSubmit = Submit.createShape(this, tPath.ib, tPath.vb, tPath.count, tPath.offset, Value2D.create(4, 0))).shaderValue.ALPHA = this._shader2D.ALPHA, 
            tempSubmit.shaderValue.u_pos = tPosArray, tempSubmit.shaderValue.u_mmat2 = RenderState2D.EMPTYMAT4_ARRAY, 
            this._submits[this._submits._length++] = tempSubmit, 0 < lineWidth) {
                if (this.mHaveLineKey) {
                    var tShapeLine = VectorGraphManager.getInstance().shapeLineDic[this.mId];
                    tShapeLine.rebuild(tPath.tempArray), tPath.setGeomtry(tShapeLine);
                } else VectorGraphManager.getInstance().addShape(this.mId, tPath.drawLine(x, y, points, lineWidth, boderColor));
                tPath.update(), (tempSubmit = Submit.createShape(this, tPath.ib, tPath.vb, tPath.count, tPath.offset, Value2D.create(4, 0))).shaderValue.ALPHA = this._shader2D.ALPHA, 
                tempSubmit.shaderValue.u_mmat2 = RenderState2D.EMPTYMAT4_ARRAY, this._submits[this._submits._length++] = tempSubmit;
            }
        }, __proto.drawParticle = function(x, y, pt) {
            pt.x = x, pt.y = y, this._submits[this._submits._length++] = pt;
        }, __proto._getPath = function() {
            return this._path || (this._path = new Path());
        }, __getset(0, __proto, "globalCompositeOperation", function() {
            return BlendMode.NAMES[this._nBlendType];
        }, function(value) {
            var n = BlendMode.TOINT[value];
            null == n || this._nBlendType === n || (SaveBase.save(this, 65536, this, !0), this._curSubmit = Submit.RENDERBASE, 
            this._renderKey = 0, this._nBlendType = n);
        }), __getset(0, __proto, "strokeStyle", function() {
            return this._shader2D.strokeStyle;
        }, function(value) {
            this._shader2D.strokeStyle.equal(value) || (SaveBase.save(this, 512, this._shader2D, !1), 
            this._shader2D.strokeStyle = DrawStyle.create(value));
        }), __getset(0, __proto, "globalAlpha", function() {
            return this._shader2D.ALPHA;
        }, function(value) {
            (value = Math.floor(1e3 * value) / 1e3) != this._shader2D.ALPHA && (SaveBase.save(this, 1, this._shader2D, !0), 
            this._shader2D.ALPHA = value);
        }), __getset(0, __proto, "asBitmap", null, function(value) {
            if (value) {
                if (this._targets || (this._targets = new RenderTargetMAX()), this._targets.repaint = !0, 
                !this._width || !this._height) throw Error("asBitmap no size!");
                this._targets.setSP(this.sprite), this._targets.size(this._width, this._height);
            } else this._targets = null;
        }), __getset(0, __proto, "fillStyle", function() {
            return this._shader2D.fillStyle;
        }, function(value) {
            this._shader2D.fillStyle.equal(value) || (SaveBase.save(this, 2, this._shader2D, !1), 
            this._shader2D.fillStyle = DrawStyle.create(value));
        }), __getset(0, __proto, "textAlign", function() {
            return this._other.textAlign;
        }, function(value) {
            this._other.textAlign === value || (this._other = this._other.make(), SaveBase.save(this, 32768, this._other, !1), 
            this._other.textAlign = value);
        }), __getset(0, __proto, "lineWidth", function() {
            return this._other.lineWidth;
        }, function(value) {
            this._other.lineWidth === value || (this._other = this._other.make(), SaveBase.save(this, 256, this._other, !1), 
            this._other.lineWidth = value);
        }), __getset(0, __proto, "textBaseline", function() {
            return this._other.textBaseline;
        }, function(value) {
            this._other.textBaseline === value || (this._other = this._other.make(), SaveBase.save(this, 16384, this._other, !1), 
            this._other.textBaseline = value);
        }), __getset(0, __proto, "font", null, function(str) {
            str != this._other.font.toString() && (this._other = this._other.make(), SaveBase.save(this, 8, this._other, !1), 
            this._other.font === FontInContext.EMPTY ? this._other.font = new FontInContext(str) : this._other.font.setFont(str));
        }), WebGLContext2D.__init__ = function() {
            ContextParams.DEFAULT = new ContextParams();
        }, WebGLContext2D._tempPoint = new Point(), WebGLContext2D._SUBMITVBSIZE = 32e3, 
        WebGLContext2D._MAXSIZE = 99999999, WebGLContext2D._RECTVBSIZE = 16, WebGLContext2D.MAXCLIPRECT = new Rectangle(0, 0, 99999999, 99999999), 
        WebGLContext2D._COUNT = 0, WebGLContext2D._tmpMatrix = new Matrix(), WebGLContext2D.SEGNUM = 32, 
        WebGLContext2D._contextcount = 0, __static(WebGLContext2D, [ "_fontTemp", function() {
            return this._fontTemp = new FontInContext();
        }, "_drawStyleTemp", function() {
            return this._drawStyleTemp = new DrawStyle(null);
        } ]), WebGLContext2D.__init$ = function() {
            ContextParams = function() {
                function ContextParams() {
                    this.lineWidth = 1, this.path = null, this.textAlign = null, this.textBaseline = null, 
                    this.font = FontInContext.EMPTY;
                }
                __class(ContextParams, "");
                var __proto = ContextParams.prototype;
                return __proto.clear = function() {
                    this.lineWidth = 1, this.path && this.path.clear(), this.textAlign = this.textBaseline = null, 
                    this.font = FontInContext.EMPTY;
                }, __proto.make = function() {
                    return this === ContextParams.DEFAULT ? new ContextParams() : this;
                }, ContextParams.DEFAULT = null, ContextParams;
            }();
        }, WebGLContext2D;
    }(), Value2D = function(_super) {
        function Value2D(mainID, subID) {
            this.size = [ 0, 0 ], this.alpha = 1, this.ALPHA = 1, this.subID = 0, this._cacheID = 0, 
            Value2D.__super.call(this), this.defines = new ShaderDefines2D(), this.position = Value2D._POSITION, 
            this.mainID = mainID, this.subID = subID, this.textureHost = null, this.texture = null, 
            this.fillStyle = null, this.color = null, this.strokeStyle = null, this.colorAdd = null, 
            this.glTexture = null, this.u_mmat2 = null, this._cacheID = mainID | subID, this._inClassCache = Value2D._cache[this._cacheID], 
            0 < mainID && !this._inClassCache && (this._inClassCache = Value2D._cache[this._cacheID] = [], 
            this._inClassCache._length = 0), this.clear();
        }
        __class(Value2D, "laya.webgl.shader.d2.value.Value2D", ShaderValue);
        var __proto = Value2D.prototype;
        return __proto.setValue = function(value) {}, __proto.refresh = function() {
            var size = this.size;
            return size[0] = RenderState2D.width, size[1] = RenderState2D.height, this.alpha = this.ALPHA * RenderState2D.worldAlpha, 
            this.mmat = RenderState2D.worldMatrix4, this;
        }, __proto._ShaderWithCompile = function() {
            return Shader.withCompile2D(0, this.mainID, this.defines.toNameDic(), this.mainID | this.defines._value, Shader2X.create);
        }, __proto._withWorldShaderDefines = function() {
            var defs = RenderState2D.worldShaderDefines, sd = Shader.sharders[this.mainID | this.defines._value | defs.getValue()];
            if (!sd) {
                var name, def = {};
                for (name in this.defines.toNameDic()) def[name] = "";
                for (name in defs.toNameDic()) def[name] = "";
                sd = Shader.withCompile2D(0, this.mainID, def, this.mainID | this.defines._value | defs.getValue(), Shader2X.create);
            }
            var worldFilters = RenderState2D.worldFilters;
            if (!worldFilters) return sd;
            for (var f, n = worldFilters.length, i = 0; i < n; i++) (f = worldFilters[i]) && f.action.setValue(this);
            return sd;
        }, __proto.upload = function() {
            var renderstate2d = RenderState2D;
            this.alpha = this.ALPHA * renderstate2d.worldAlpha, RenderState2D.worldMatrix4 !== RenderState2D.TEMPMAT4_ARRAY && this.defines.add(128), 
            WebGL.shaderHighPrecision && this.defines.add(1024);
            var params, sd = renderstate2d.worldShaderDefines ? this._withWorldShaderDefines() : Shader.sharders[this.mainID | this.defines._value] || this._ShaderWithCompile();
            this.size[0] = renderstate2d.width, this.size[1] = renderstate2d.height, this.mmat = renderstate2d.worldMatrix4, 
            BaseShader.activeShader !== sd ? sd._shaderValueWidth !== renderstate2d.width || sd._shaderValueHeight !== renderstate2d.height ? (sd._shaderValueWidth = renderstate2d.width, 
            sd._shaderValueHeight = renderstate2d.height) : params = sd._params2dQuick2 || sd._make2dQuick2() : sd._shaderValueWidth !== renderstate2d.width || sd._shaderValueHeight !== renderstate2d.height ? (sd._shaderValueWidth = renderstate2d.width, 
            sd._shaderValueHeight = renderstate2d.height) : params = sd._params2dQuick1 || sd._make2dQuick1(), 
            sd.upload(this, params);
        }, __proto.setFilters = function(value) {
            if (this.filters = value) for (var f, n = value.length, i = 0; i < n; i++) (f = value[i]) && (this.defines.add(f.type), 
            f.action.setValue(this));
        }, __proto.clear = function() {
            this.defines.setValue(this.subID);
        }, __proto.release = function() {
            (this._inClassCache[this._inClassCache._length++] = this).fillStyle = null, this.strokeStyle = null, 
            this.textureHost = null, this.mmat = null, this.clear();
        }, Value2D._initone = function(type, classT) {
            Value2D._typeClass[type] = classT, Value2D._cache[type] = [], Value2D._cache[type]._length = 0;
        }, Value2D.__init__ = function() {
            Value2D._POSITION = [ 2, 5126, !1, 4 * CONST3D2D.BYTES_PE, 0 ], Value2D._TEXCOORD = [ 2, 5126, !1, 4 * CONST3D2D.BYTES_PE, 2 * CONST3D2D.BYTES_PE ], 
            Value2D._initone(2, Color2dSV), Value2D._initone(4, PrimitiveSV), Value2D._initone(256, FillTextureSV), 
            Value2D._initone(512, SkinSV), Value2D._initone(1, TextureSV), Value2D._initone(65, TextSV), 
            Value2D._initone(9, TextureSV);
        }, Value2D.create = function(mainType, subType) {
            var types = Value2D._cache[mainType | subType];
            return types._length ? types[--types._length] : new Value2D._typeClass[mainType | subType](subType);
        }, Value2D._POSITION = null, Value2D._TEXCOORD = null, Value2D._cache = [], Value2D._typeClass = [], 
        Value2D.TEMPMAT4_ARRAY = [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ], Value2D;
    }(), RenderSprite3D = function(_super) {
        function RenderSprite3D(type, next) {
            RenderSprite3D.__super.call(this, type, next);
        }
        __class(RenderSprite3D, "laya.webgl.utils.RenderSprite3D", RenderSprite);
        var __proto = RenderSprite3D.prototype;
        return __proto.onCreate = function(type) {
            switch (type) {
              case 8:
                return void (this._fun = this._blend);

              case 4:
                return void (this._fun = this._transform);
            }
        }, __proto._mask = function(sprite, context, x, y) {
            var submitCMD, submitStencil, next = this._next, mask = sprite.mask;
            if (mask) {
                context.ctx.save();
                var preBlendMode = context.ctx.globalCompositeOperation, tRect = new Rectangle();
                if (tRect.copyFrom(mask.getBounds()), tRect.width = Math.round(tRect.width), tRect.height = Math.round(tRect.height), 
                tRect.x = Math.round(tRect.x), tRect.y = Math.round(tRect.y), 0 < tRect.width && 0 < tRect.height) {
                    var tf = sprite._style._tf, scope = SubmitCMDScope.create();
                    scope.addValue("bounds", tRect), submitCMD = SubmitCMD.create([ scope, context ], laya.webgl.utils.RenderSprite3D.tmpTarget), 
                    context.addRenderObject(submitCMD), mask.render(context, -tRect.x, -tRect.y), submitCMD = SubmitCMD.create([ scope ], laya.webgl.utils.RenderSprite3D.endTmpTarget), 
                    context.addRenderObject(submitCMD), context.ctx.save(), context.clipRect(x - tf.translateX + tRect.x, y - tf.translateY + tRect.y, tRect.width, tRect.height), 
                    next._fun.call(next, sprite, context, x, y), context.ctx.restore(), submitStencil = SubmitStencil.create(6), 
                    preBlendMode = context.ctx.globalCompositeOperation, submitStencil.blendMode = "mask", 
                    context.addRenderObject(submitStencil), Matrix.TEMP.identity();
                    var shaderValue = Value2D.create(1, 0), uv = Texture.INV_UV, w = tRect.width, h = tRect.height;
                    (tRect.width < 32 || tRect.height < 32) && ((uv = RenderSprite3D.tempUV)[0] = 0, 
                    uv[1] = 0, uv[2] = 32 <= tRect.width ? 1 : tRect.width / 32, uv[3] = 0, uv[4] = 32 <= tRect.width ? 1 : tRect.width / 32, 
                    uv[5] = 32 <= tRect.height ? 1 : tRect.height / 32, uv[6] = 0, uv[7] = 32 <= tRect.height ? 1 : tRect.height / 32, 
                    tRect.width = 32 <= tRect.width ? tRect.width : 32, tRect.height = 32 <= tRect.height ? tRect.height : 32, 
                    uv[1] *= -1, uv[3] *= -1, uv[5] *= -1, uv[7] *= -1, uv[1] += 1, uv[3] += 1, uv[5] += 1, 
                    uv[7] += 1), context.ctx.drawTarget(scope, x + tRect.x - tf.translateX, y + tRect.y - tf.translateY, w, h, Matrix.TEMP, "tmpTarget", shaderValue, uv, 6), 
                    submitCMD = SubmitCMD.create([ scope ], laya.webgl.utils.RenderSprite3D.recycleTarget), 
                    context.addRenderObject(submitCMD), (submitStencil = SubmitStencil.create(6)).blendMode = preBlendMode, 
                    context.addRenderObject(submitStencil);
                }
                context.ctx.restore();
            } else next._fun.call(next, sprite, context, x, y);
        }, __proto._blend = function(sprite, context, x, y) {
            var style = sprite._style, next = this._next;
            style.blendMode ? (context.ctx.save(), context.ctx.globalCompositeOperation = style.blendMode, 
            next._fun.call(next, sprite, context, x, y), context.ctx.restore()) : next._fun.call(next, sprite, context, x, y);
        }, __proto._transform = function(sprite, context, x, y) {
            var transform = sprite.transform, _next = this._next;
            if (transform && _next != RenderSprite.NORENDER) {
                var ctx = context.ctx;
                sprite._style;
                transform.tx = x, transform.ty = y;
                var m2 = ctx._getTransformMatrix(), m1 = m2.clone();
                Matrix.mul(transform, m2, m2), m2._checkTransform(), transform.tx = transform.ty = 0, 
                _next._fun.call(_next, sprite, context, 0, 0), m1.copyTo(m2), m1.destroy();
            } else _next._fun.call(_next, sprite, context, x, y);
        }, RenderSprite3D.tmpTarget = function(scope, context) {
            var b = scope.getValue("bounds"), tmpTarget = RenderTarget2D.create(b.width, b.height);
            tmpTarget.start(), tmpTarget.clear(0, 0, 0, 0), scope.addValue("tmpTarget", tmpTarget);
        }, RenderSprite3D.endTmpTarget = function(scope) {
            scope.getValue("tmpTarget").end();
        }, RenderSprite3D.recycleTarget = function(scope) {
            scope.getValue("tmpTarget").recycle(), scope.recycle();
        }, __static(RenderSprite3D, [ "tempUV", function() {
            return this.tempUV = new Array(8);
        } ]), RenderSprite3D;
    }(), ColorFilterActionGL = function(_super) {
        function ColorFilterActionGL() {
            this.data = null, ColorFilterActionGL.__super.call(this);
        }
        __class(ColorFilterActionGL, "laya.filters.webgl.ColorFilterActionGL", FilterActionGL);
        var __proto = ColorFilterActionGL.prototype;
        return Laya.imps(__proto, {
            "laya.filters.IFilterActionGL": !0
        }), __proto.setValue = function(shader) {
            shader.colorMat = this.data._mat, shader.colorAlpha = this.data._alpha;
        }, __proto.apply3d = function(scope, sprite, context, x, y) {
            var b = scope.getValue("bounds"), shaderValue = Value2D.create(1, 0);
            shaderValue.setFilters([ this.data ]);
            var tMatrix = Matrix.TEMP;
            tMatrix.identity(), context.ctx.drawTarget(scope, 0, 0, b.width, b.height, tMatrix, "src", shaderValue);
        }, ColorFilterActionGL;
    }(), Atlaser = function(_super) {
        function Atlaser(gridNumX, gridNumY, width, height, atlasID) {
            this._atlasCanvas = null, this._inAtlasTextureKey = null, this._inAtlasTextureBitmapValue = null, 
            this._inAtlasTextureOriUVValue = null, this._InAtlasWebGLImagesKey = null, this._InAtlasWebGLImagesOffsetValue = null, 
            Atlaser.__super.call(this, gridNumX, gridNumY, atlasID), this._inAtlasTextureKey = [], 
            this._inAtlasTextureBitmapValue = [], this._inAtlasTextureOriUVValue = [], this._InAtlasWebGLImagesKey = {}, 
            this._InAtlasWebGLImagesOffsetValue = [], this._atlasCanvas = new AtlasWebGLCanvas(), 
            (this._atlasCanvas._atlaser = this)._atlasCanvas.width = width, this._atlasCanvas.height = height, 
            this._atlasCanvas.activeResource(), this._atlasCanvas.lock = !0;
        }
        __class(Atlaser, "laya.webgl.atlas.Atlaser", AtlasGrid);
        var __proto = Atlaser.prototype;
        return __proto.computeUVinAtlasTexture = function(texture, oriUV, offsetX, offsetY) {
            var _width = AtlasResourceManager.atlasTextureWidth, _height = AtlasResourceManager.atlasTextureHeight, u1 = offsetX / _width, v1 = offsetY / _height, u2 = (offsetX + texture.bitmap.width) / _width, v2 = (offsetY + texture.bitmap.height) / _height, inAltasUVWidth = texture.bitmap.width / _width, inAltasUVHeight = texture.bitmap.height / _height;
            texture.uv = [ u1 + oriUV[0] * inAltasUVWidth, v1 + oriUV[1] * inAltasUVHeight, u2 - (1 - oriUV[2]) * inAltasUVWidth, v1 + oriUV[3] * inAltasUVHeight, u2 - (1 - oriUV[4]) * inAltasUVWidth, v2 - (1 - oriUV[5]) * inAltasUVHeight, u1 + oriUV[6] * inAltasUVWidth, v2 - (1 - oriUV[7]) * inAltasUVHeight ];
        }, __proto.findBitmapIsExist = function(bitmap) {
            if (bitmap instanceof laya.webgl.resource.WebGLImage) {
                var webImage = bitmap, sUrl = webImage.url, object = this._InAtlasWebGLImagesKey[sUrl || webImage.id];
                if (object) return object.offsetInfoID;
            }
            return -1;
        }, __proto.addToAtlasTexture = function(mergeAtlasBitmap, offsetX, offsetY) {
            if (mergeAtlasBitmap instanceof laya.webgl.resource.WebGLImage) {
                var webImage = mergeAtlasBitmap, sUrl = webImage.url;
                this._InAtlasWebGLImagesKey[sUrl || webImage.id] = {
                    bitmap: mergeAtlasBitmap,
                    offsetInfoID: this._InAtlasWebGLImagesOffsetValue.length
                }, this._InAtlasWebGLImagesOffsetValue.push([ offsetX, offsetY ]);
            }
            this._atlasCanvas.texSubImage2D(offsetX, offsetY, mergeAtlasBitmap.atlasSource), 
            mergeAtlasBitmap.clearAtlasSource();
        }, __proto.addToAtlas = function(texture, offsetX, offsetY) {
            texture._atlasID = this._inAtlasTextureKey.length;
            var oriUV = texture.uv.slice(), oriBitmap = texture.bitmap;
            this._inAtlasTextureKey.push(texture), this._inAtlasTextureOriUVValue.push(oriUV), 
            this._inAtlasTextureBitmapValue.push(oriBitmap), this.computeUVinAtlasTexture(texture, oriUV, offsetX, offsetY), 
            texture.bitmap = this._atlasCanvas;
        }, __proto.clear = function() {
            for (var i = 0, n = this._inAtlasTextureKey.length; i < n; i++) this._inAtlasTextureKey[i].bitmap = this._inAtlasTextureBitmapValue[i], 
            this._inAtlasTextureKey[i].uv = this._inAtlasTextureOriUVValue[i], this._inAtlasTextureKey[i]._atlasID = -1, 
            this._inAtlasTextureKey[i].bitmap.lock = !1, this._inAtlasTextureKey[i].bitmap.releaseResource();
            this._inAtlasTextureKey.length = 0, this._inAtlasTextureBitmapValue.length = 0, 
            this._inAtlasTextureOriUVValue.length = 0, this._InAtlasWebGLImagesKey = null, this._InAtlasWebGLImagesOffsetValue.length = 0;
        }, __proto.dispose = function() {
            this.clear(), this._atlasCanvas.destroy();
        }, __getset(0, __proto, "InAtlasWebGLImagesOffsetValue", function() {
            return this._InAtlasWebGLImagesOffsetValue;
        }), __getset(0, __proto, "texture", function() {
            return this._atlasCanvas;
        }), __getset(0, __proto, "inAtlasWebGLImagesKey", function() {
            return this._InAtlasWebGLImagesKey;
        }), Atlaser;
    }(), ShaderDefines2D = function(_super) {
        function ShaderDefines2D() {
            ShaderDefines2D.__super.call(this, ShaderDefines2D.__name2int, ShaderDefines2D.__int2name, ShaderDefines2D.__int2nameMap);
        }
        return __class(ShaderDefines2D, "laya.webgl.shader.d2.ShaderDefines2D", ShaderDefines), 
        ShaderDefines2D.__init__ = function() {
            ShaderDefines2D.reg("TEXTURE2D", 1), ShaderDefines2D.reg("COLOR2D", 2), ShaderDefines2D.reg("PRIMITIVE", 4), 
            ShaderDefines2D.reg("GLOW_FILTER", 8), ShaderDefines2D.reg("BLUR_FILTER", 16), ShaderDefines2D.reg("COLOR_FILTER", 32), 
            ShaderDefines2D.reg("COLOR_ADD", 64), ShaderDefines2D.reg("WORLDMAT", 128), ShaderDefines2D.reg("FILLTEXTURE", 256), 
            ShaderDefines2D.reg("FSHIGHPRECISION", 1024);
        }, ShaderDefines2D.reg = function(name, value) {
            ShaderDefines._reg(name, value, ShaderDefines2D.__name2int, ShaderDefines2D.__int2name);
        }, ShaderDefines2D.toText = function(value, int2name, int2nameMap) {
            return ShaderDefines._toText(value, int2name, int2nameMap);
        }, ShaderDefines2D.toInt = function(names) {
            return ShaderDefines._toInt(names, ShaderDefines2D.__name2int);
        }, ShaderDefines2D.TEXTURE2D = 1, ShaderDefines2D.COLOR2D = 2, ShaderDefines2D.PRIMITIVE = 4, 
        ShaderDefines2D.FILTERGLOW = 8, ShaderDefines2D.FILTERBLUR = 16, ShaderDefines2D.FILTERCOLOR = 32, 
        ShaderDefines2D.COLORADD = 64, ShaderDefines2D.WORLDMAT = 128, ShaderDefines2D.FILLTEXTURE = 256, 
        ShaderDefines2D.SKINMESH = 512, ShaderDefines2D.SHADERDEFINE_FSHIGHPRECISION = 1024, 
        ShaderDefines2D.__name2int = {}, ShaderDefines2D.__int2name = [], ShaderDefines2D.__int2nameMap = [], 
        ShaderDefines2D;
    }(), Line = (function(_super) {
        function Ellipse(x, y, width, height, color, borderWidth, borderColor) {
            Ellipse.__super.call(this, x, y, width, height, 40, color, borderWidth, borderColor);
        }
        __class(Ellipse, "laya.webgl.shapes.Ellipse", BasePoly);
    }(), function(_super) {
        function Line(x, y, points, borderWidth, color) {
            this._points = [], this.rebuild(points), Line.__super.call(this, x, y, 0, 0, 0, color, borderWidth, color, 0);
        }
        __class(Line, "laya.webgl.shapes.Line", BasePoly);
        var __proto = Line.prototype;
        return __proto.rebuild = function(points) {
            var len = points.length;
            len != this._points.length && (this.mUint16Array = new Uint16Array(6 * (len / 2 - 1)), 
            this.mFloat32Array = new Float32Array(5 * len)), this._points.length = 0;
            for (var tCurrX = NaN, tCurrY = NaN, tLastX = -1, tLastY = -1, tLen = points.length / 2, i = 0; i < tLen; i++) tCurrX = points[2 * i], 
            tCurrY = points[2 * i + 1], (.01 < Math.abs(tLastX - tCurrX) || .01 < Math.abs(tLastY - tCurrY)) && this._points.push(tCurrX, tCurrY), 
            tLastX = tCurrX, tLastY = tCurrY;
        }, __proto.getData = function(ib, vb, start) {
            var indices = [], verts = [];
            0 < this.borderWidth && this.createLine2(this._points, indices, this.borderWidth, start, verts, this._points.length / 2), 
            this.mUint16Array.set(indices, 0), this.mFloat32Array.set(verts, 0), ib.append(this.mUint16Array), 
            vb.append(this.mFloat32Array);
        }, Line;
    }()), LoopLine = function(_super) {
        function LoopLine(x, y, points, width, color) {
            this._points = [];
            for (var tCurrX = NaN, tCurrY = NaN, tLastX = -1, tLastY = -1, tLen = points.length / 2 - 1, i = 0; i < tLen; i++) tCurrX = points[2 * i], 
            tCurrY = points[2 * i + 1], (.01 < Math.abs(tLastX - tCurrX) || .01 < Math.abs(tLastY - tCurrY)) && this._points.push(tCurrX, tCurrY), 
            tLastX = tCurrX, tLastY = tCurrY;
            tCurrX = points[2 * tLen], tCurrY = points[2 * tLen + 1], tLastX = this._points[0], 
            tLastY = this._points[1], (.01 < Math.abs(tLastX - tCurrX) || .01 < Math.abs(tLastY - tCurrY)) && this._points.push(tCurrX, tCurrY), 
            LoopLine.__super.call(this, x, y, 0, 0, this._points.length / 2, 0, width, color);
        }
        __class(LoopLine, "laya.webgl.shapes.LoopLine", BasePoly);
        var __proto = LoopLine.prototype;
        return __proto.getData = function(ib, vb, start) {
            if (0 < this.borderWidth) {
                for (var color = this.color, r = (color >> 16 & 255) / 255, g = (color >> 8 & 255) / 255, b = (255 & color) / 255, verts = [], tCurrX = 0, tCurrY = 0, indices = [], tLen = Math.floor(this._points.length / 2), i = 0; i < tLen; i++) tCurrX = this._points[2 * i], 
                tCurrY = this._points[2 * i + 1], verts.push(this.x + tCurrX, this.y + tCurrY, r, g, b);
                this.createLoopLine(verts, indices, this.borderWidth, start + verts.length / 5), 
                ib.append(new Uint16Array(indices)), vb.append(new Float32Array(verts));
            }
        }, __proto.createLoopLine = function(p, indices, lineWidth, len, outVertex, outIndex) {
            p.length;
            var points = p.concat(), result = outVertex || p, color = this.borderColor, r = (color >> 16 & 255) / 255, g = (color >> 8 & 255) / 255, b = (255 & color) / 255, firstPoint = [ points[0], points[1] ], lastPoint = [ points[points.length - 5], points[points.length - 4] ], midPointX = lastPoint[0] + .5 * (firstPoint[0] - lastPoint[0]), midPointY = lastPoint[1] + .5 * (firstPoint[1] - lastPoint[1]);
            points.unshift(midPointX, midPointY, 0, 0, 0), points.push(midPointX, midPointY, 0, 0, 0);
            var px, py, p1x, p1y, p2x, p2y, p3x, p3y, perpx, perpy, perp2x, perp2y, a1, b1, c1, a2, b2, c2, denom, dist, length = points.length / 5, iStart = len, w = lineWidth / 2;
            p1x = points[0], p1y = points[1], perpy = p1x - (p2x = points[5]), perpx = (perpx = -(p1y - (p2y = points[6]))) / (dist = Math.sqrt(perpx * perpx + perpy * perpy)) * w, 
            perpy = perpy / dist * w, result.push(p1x - perpx, p1y - perpy, r, g, b, p1x + perpx, p1y + perpy, r, g, b);
            for (var i = 1; i < length - 1; i++) p1x = points[5 * (i - 1)], p1y = points[5 * (i - 1) + 1], 
            p2x = points[5 * i], p2y = points[5 * i + 1], p3x = points[5 * (i + 1)], p3y = points[5 * (i + 1) + 1], 
            perpy = p1x - p2x, perp2y = p2x - p3x, c1 = (-(perpx = (perpx = -(p1y - p2y)) / (dist = Math.sqrt(perpx * perpx + perpy * perpy)) * w) + p1x) * (-(perpy = perpy / dist * w) + p2y) - (-perpx + p2x) * (-perpy + p1y), 
            c2 = (-(perp2x = (perp2x = -(p2y - p3y)) / (dist = Math.sqrt(perp2x * perp2x + perp2y * perp2y)) * w) + p3x) * (-(perp2y = perp2y / dist * w) + p2y) - (-perp2x + p2x) * (-perp2y + p3y), 
            denom = (a1 = -perpy + p1y - (-perpy + p2y)) * (b2 = -perp2x + p2x - (-perp2x + p3x)) - (a2 = -perp2y + p3y - (-perp2y + p2y)) * (b1 = -perpx + p2x - (-perpx + p1x)), 
            Math.abs(denom) < .1 ? (denom += 10.1, result.push(p2x - perpx, p2y - perpy, r, g, b, p2x + perpx, p2y + perpy, r, g, b)) : (((px = (b1 * c2 - b2 * c1) / denom) - p2x) * (px - p2x) + ((py = (a2 * c1 - a1 * c2) / denom) - p2y) + (py - p2y), 
            result.push(px, py, r, g, b, p2x - (px - p2x), p2y - (py - p2y), r, g, b));
            outIndex && (indices = outIndex);
            var groupLen = this.edges + 1;
            for (i = 1; i < groupLen; i++) indices.push(iStart + 2 * (i - 1), iStart + 2 * (i - 1) + 1, iStart + 2 * i + 1, iStart + 2 * i + 1, iStart + 2 * i, iStart + 2 * (i - 1));
            return indices.push(iStart + 2 * (i - 1), iStart + 2 * (i - 1) + 1, iStart + 1, iStart + 1, iStart, iStart + 2 * (i - 1)), 
            result;
        }, LoopLine;
    }(), Polygon = function(_super) {
        function Polygon(x, y, points, color, borderWidth, borderColor) {
            this._points = null, this._start = -1, this._repaint = !1, this.earcutTriangles = null, 
            this._mat = Matrix.create(), this._points = points.slice(0, points.length), Polygon.__super.call(this, x, y, 0, 0, this._points.length / 2, color, borderWidth, borderColor);
        }
        __class(Polygon, "laya.webgl.shapes.Polygon", BasePoly);
        var __proto = Polygon.prototype;
        return __proto.rebuild = function(point) {
            this._repaint || (this._points.length = 0, this._points = this._points.concat(point));
        }, __proto.setMatrix = function(mat) {
            mat.copyTo(this._mat);
        }, __proto.needUpdate = function(mat) {
            return this._repaint = this._mat.a == mat.a && this._mat.b == mat.b && this._mat.c == mat.c && this._mat.d == mat.d && this._mat.tx == mat.tx && this._mat.ty == mat.ty, 
            !this._repaint;
        }, __proto.getData = function(ib, vb, start) {
            var indices, i = 0, tArray = this._points, tLen = 0;
            if (this.mUint16Array && this.mFloat32Array && this._repaint) {
                if (this._start != start) {
                    for (this._start = start, indices = [], tLen = this.earcutTriangles.length, i = 0; i < tLen; i++) indices.push(this.earcutTriangles[i] + start);
                    this.mUint16Array = new Uint16Array(indices);
                }
            } else {
                this._start = start, indices = [];
                var verts = [], vertsEarcut = [], color = this.color, r = (color >> 16 & 255) / 255, g = (color >> 8 & 255) / 255, b = (255 & color) / 255;
                for (tLen = Math.floor(tArray.length / 2), i = 0; i < tLen; i++) verts.push(this.x + tArray[2 * i], this.y + tArray[2 * i + 1], r, g, b), 
                vertsEarcut.push(this.x + tArray[2 * i], this.y + tArray[2 * i + 1]);
                for (this.earcutTriangles = Earcut.earcut(vertsEarcut, null, 2), tLen = this.earcutTriangles.length, 
                i = 0; i < tLen; i++) indices.push(this.earcutTriangles[i] + start);
                this.mUint16Array = new Uint16Array(indices), this.mFloat32Array = new Float32Array(verts);
            }
            ib.append(this.mUint16Array), vb.append(this.mFloat32Array);
        }, Polygon;
    }(), SubmitCanvas = function(_super) {
        function SubmitCanvas() {
            this._matrix = new Matrix(), this._matrix4 = CONST3D2D.defaultMatrix4.concat(), 
            SubmitCanvas.__super.call(this, 1e4), this.shaderValue = new Value2D(0, 0);
        }
        __class(SubmitCanvas, "laya.webgl.submit.SubmitCanvas", Submit);
        var __proto = SubmitCanvas.prototype;
        return __proto.renderSubmit = function() {
            if (this._ctx_src._targets) return this._ctx_src._targets.flush(this._ctx_src), 
            1;
            var preAlpha = RenderState2D.worldAlpha, preMatrix4 = RenderState2D.worldMatrix4, preMatrix = RenderState2D.worldMatrix, preFilters = RenderState2D.worldFilters, preWorldShaderDefines = RenderState2D.worldShaderDefines, v = this.shaderValue, m = this._matrix, m4 = this._matrix4, mout = Matrix.TEMP;
            return Matrix.mul(m, preMatrix, mout), m4[0] = mout.a, m4[1] = mout.b, m4[4] = mout.c, 
            m4[5] = mout.d, m4[12] = mout.tx, m4[13] = mout.ty, RenderState2D.worldMatrix = mout.clone(), 
            RenderState2D.worldMatrix4 = m4, RenderState2D.worldAlpha = RenderState2D.worldAlpha * v.alpha, 
            v.filters && v.filters.length && (RenderState2D.worldFilters = v.filters, RenderState2D.worldShaderDefines = v.defines), 
            this._ctx_src.flush(), RenderState2D.worldAlpha = preAlpha, RenderState2D.worldMatrix4 = preMatrix4, 
            RenderState2D.worldMatrix.destroy(), RenderState2D.worldMatrix = preMatrix, RenderState2D.worldFilters = preFilters, 
            RenderState2D.worldShaderDefines = preWorldShaderDefines, 1;
        }, __proto.releaseRender = function() {
            var cache = SubmitCanvas._cache;
            this._ctx_src = null, cache[cache._length++] = this;
        }, __proto.getRenderType = function() {
            return 10003;
        }, SubmitCanvas.create = function(ctx_src, alpha, filters) {
            var o = SubmitCanvas._cache._length ? SubmitCanvas._cache[--SubmitCanvas._cache._length] : new SubmitCanvas();
            o._ctx_src = ctx_src;
            var v = o.shaderValue;
            return v.alpha = alpha, v.defines.setValue(0), filters && filters.length && v.setFilters(filters), 
            o;
        }, SubmitCanvas._cache = ((SubmitCanvas._cache = [])._length = 0, SubmitCanvas._cache), 
        SubmitCanvas;
    }(), SubmitTexture = function(_super) {
        function SubmitTexture(renderType) {
            this._preIsSameTextureShader = !1, this._isSameTexture = !0, this._texs = new Array(), 
            this._texsID = new Array(), this._vbPos = new Array(), void 0 === renderType && (renderType = 1e4), 
            SubmitTexture.__super.call(this, renderType);
        }
        __class(SubmitTexture, "laya.webgl.submit.SubmitTexture", Submit);
        var __proto = SubmitTexture.prototype;
        return __proto.releaseRender = function() {
            var cache = SubmitTexture._cache;
            (cache[cache._length++] = this).shaderValue.release(), this.shaderValue = null, 
            this._preIsSameTextureShader = !1, this._blendFn = null, this._vb = null, this._ib = null, 
            this._texs.length = 0, this._vbPos.length = 0, this._texsID.length = 0, this._isSameTexture = !0;
        }, __proto.addTexture = function(tex, vbpos) {
            this._texsID[this._texs.length] = tex._uvID, this._texs.push(tex), this._vbPos.push(vbpos);
        }, __proto.checkTexture = function() {
            if (this._texs.length < 1) this._isSameTexture = !0; else {
                var webGLImg = this.shaderValue.textureHost.bitmap;
                if (null !== webGLImg) for (var vbdata = this._vb.getFloat32Array(), i = 0, s = this._texs.length; i < s; i++) {
                    var tex = this._texs[i];
                    tex.active();
                    var newUV = tex.uv;
                    if (this._texsID[i] !== tex._uvID) {
                        this._texsID[i] = tex._uvID;
                        var vbPos = this._vbPos[i];
                        vbdata[vbPos + 2] = newUV[0], vbdata[vbPos + 3] = newUV[1], vbdata[vbPos + 6] = newUV[2], 
                        vbdata[vbPos + 7] = newUV[3], vbdata[vbPos + 10] = newUV[4], vbdata[vbPos + 11] = newUV[5], 
                        vbdata[vbPos + 14] = newUV[6], vbdata[vbPos + 15] = newUV[7], this._vb.setNeedUpload();
                    }
                    tex.bitmap !== webGLImg && (this._isSameTexture = !1);
                }
            }
        }, __proto.renderSubmit = function() {
            if (0 === this._numEle) return SubmitTexture._shaderSet = !1, 1;
            var _tex = this.shaderValue.textureHost;
            if (_tex) {
                var source = _tex.source;
                if (!_tex.bitmap || !source) return SubmitTexture._shaderSet = !1, 1;
                this.shaderValue.texture = source;
            }
            this._vb.bind_upload(this._ib);
            var gl = WebGL.mainContext;
            if (BlendMode.activeBlendFunction !== this._blendFn && (gl.enable(3042), this._blendFn(gl), 
            BlendMode.activeBlendFunction = this._blendFn), Stat.drawCall++, Stat.trianglesFaces += this._numEle / 3, 
            this._preIsSameTextureShader && BaseShader.activeShader && SubmitTexture._shaderSet ? BaseShader.activeShader.uploadTexture2D(this.shaderValue.texture) : this.shaderValue.upload(), 
            SubmitTexture._shaderSet = !0, 1 < this._texs.length && !this._isSameTexture) for (var webGLImg = _tex.bitmap, index = 0, shader = BaseShader.activeShader, i = 0, s = this._texs.length; i < s; i++) {
                var tex2 = this._texs[i];
                tex2.bitmap === webGLImg && i + 1 !== s || (shader.uploadTexture2D(tex2.source), 
                gl.drawElements(4, 6 * (i - index + 1), 5123, this._startIdx + 6 * index * CONST3D2D.BYTES_PIDX), 
                webGLImg = tex2.bitmap, index = i);
            } else gl.drawElements(4, this._numEle, 5123, this._startIdx);
            return 1;
        }, SubmitTexture.create = function(context, ib, vb, pos, sv) {
            var o = SubmitTexture._cache._length ? SubmitTexture._cache[--SubmitTexture._cache._length] : new SubmitTexture();
            null == vb && ((vb = o._selfVb || (o._selfVb = VertexBuffer2D.create(-1))).clear(), 
            pos = 0), o._ib = ib, o._vb = vb, o._startIdx = pos * CONST3D2D.BYTES_PIDX, o._numEle = 0;
            var blendType = context._nBlendType;
            o._blendFn = context._targets ? BlendMode.targetFns[blendType] : BlendMode.fns[blendType], 
            o.shaderValue = sv, o.shaderValue.setValue(context._shader2D);
            var filters = context._shader2D.filters;
            return filters && o.shaderValue.setFilters(filters), o;
        }, SubmitTexture._cache = ((SubmitTexture._cache = [])._length = 0, SubmitTexture._cache), 
        SubmitTexture._shaderSet = !0, SubmitTexture;
    }(), MeshTexture = function(_super) {
        function MeshTexture() {
            MeshTexture.__super.call(this, laya.webgl.utils.MeshTexture.const_stride, 0, 0), 
            this.canReuse = !0, this.setAttributes(laya.webgl.utils.MeshTexture._fixattriInfo);
        }
        __class(MeshTexture, "laya.webgl.utils.MeshTexture", Mesh2D);
        var __proto = MeshTexture.prototype;
        return __proto.addData = function(vertices, uvs, idx, matrix, rgba, ctx) {
            for (var sz = vertices.length / 2, f32pos = this._vb.needSize(sz * MeshTexture.const_stride) >> 2, vbdata = this._vb.getFloat32Array(), ci = 0, i = 0; i < sz; i++) {
                var x = vertices[ci], y = vertices[ci + 1], x1 = x * matrix.a + y * matrix.c + matrix.tx, y1 = x * matrix.b + y * matrix.d + matrix.ty;
                vbdata[f32pos++] = x1, vbdata[f32pos++] = y1, vbdata[f32pos++] = uvs[ci], vbdata[f32pos++] = uvs[ci + 1], 
                ci += 2;
            }
            this._vb.setNeedUpload();
            var vertN = this.vertNum;
            if (0 < vertN) {
                (sz = idx.length) > MeshTexture.tmpIdx.length && (MeshTexture.tmpIdx = new Uint16Array(sz));
                for (var ii = 0; ii < sz; ii++) MeshTexture.tmpIdx[ii] = idx[ii] + vertN;
                this._ib.appendU16Array(MeshTexture.tmpIdx, idx.length);
            } else this._ib.append(idx);
            this._ib.setNeedUpload(), this.vertNum += sz, this.indexNum += idx.length;
        }, __proto.releaseMesh = function() {
            this._vb._byteLength = 0, this._ib._byteLength = 0, this.vertNum = 0, this.indexNum = 0, 
            laya.webgl.utils.MeshTexture._POOL.push(this);
        }, __proto.destroy = function() {
            this._ib.destroy(), this._vb.destroy();
        }, MeshTexture.getAMesh = function() {
            return laya.webgl.utils.MeshTexture._POOL.length ? laya.webgl.utils.MeshTexture._POOL.pop() : new MeshTexture();
        }, MeshTexture.const_stride = 16, MeshTexture._POOL = [], __static(MeshTexture, [ "_fixattriInfo", function() {
            return this._fixattriInfo = [ 5126, 2, 0, 5126, 2, 8 ];
        }, "tmpIdx", function() {
            return this.tmpIdx = new Uint16Array(4);
        } ]), MeshTexture;
    }(), BaseShader = function(_super) {
        function BaseShader() {
            BaseShader.__super.call(this), this.lock = !0;
        }
        return __class(BaseShader, "laya.webgl.shader.BaseShader", Resource), BaseShader.activeShader = null, 
        BaseShader.bindShader = null, BaseShader;
    }(), RenderTarget2D = function(_super) {
        function RenderTarget2D(width, height, surfaceFormat, surfaceType, depthStencilFormat, mipMap, repeat, minFifter, magFifter) {
            this._type = 0, this._svWidth = NaN, this._svHeight = NaN, this._preRenderTarget = null, 
            this._alreadyResolved = !1, this._looked = !1, this._surfaceFormat = 0, this._surfaceType = 0, 
            this._depthStencilFormat = 0, this._mipMap = !1, this._repeat = !1, this._minFifter = 0, 
            this._magFifter = 0, this._destroy = !1, void 0 === surfaceFormat && (surfaceFormat = 6408), 
            void 0 === surfaceType && (surfaceType = 5121), void 0 === depthStencilFormat && (depthStencilFormat = 34041), 
            void 0 === mipMap && (mipMap = !1), void 0 === repeat && (repeat = !1), void 0 === minFifter && (minFifter = -1), 
            void 0 === magFifter && (magFifter = -1), this._type = 1, this._w = width, this._h = height, 
            this._surfaceFormat = surfaceFormat, this._surfaceType = surfaceType, this._depthStencilFormat = depthStencilFormat, 
            Render.isConchWebGL && 34041 === this._depthStencilFormat && (this._depthStencilFormat = 33189), 
            this._mipMap = mipMap, this._repeat = repeat, this._minFifter = minFifter, this._magFifter = magFifter, 
            this._createWebGLRenderTarget(), this.bitmap.lock = !0, RenderTarget2D.__super.call(this, this.bitmap, Texture.INV_UV);
        }
        __class(RenderTarget2D, "laya.webgl.resource.RenderTarget2D", _super);
        var __proto = RenderTarget2D.prototype;
        return Laya.imps(__proto, {
            "laya.resource.IDispose": !0
        }), __proto.getType = function() {
            return this._type;
        }, __proto.getTexture = function() {
            return this;
        }, __proto.size = function(w, h) {
            this._w == w && this._h == h || (this._w = w, this._h = h, this.release(), 0 != this._w && 0 != this._h && this._createWebGLRenderTarget());
        }, __proto.release = function() {
            this.destroy();
        }, __proto.recycle = function() {
            RenderTarget2D.POOL.push(this);
        }, __proto.start = function() {
            var gl = WebGL.mainContext;
            return this._preRenderTarget = RenderState2D.curRenderTarget, RenderState2D.curRenderTarget = this, 
            gl.bindFramebuffer(36160, this.bitmap.frameBuffer), this._alreadyResolved = !1, 
            1 == this._type && (gl.viewport(0, 0, this._w, this._h), this._svWidth = RenderState2D.width, 
            this._svHeight = RenderState2D.height, RenderState2D.width = this._w, RenderState2D.height = this._h, 
            BaseShader.activeShader = null), this;
        }, __proto.clear = function(r, g, b, a) {
            void 0 === r && (r = 0), void 0 === g && (g = 0), void 0 === b && (b = 0), void 0 === a && (a = 1);
            var gl = WebGL.mainContext;
            gl.clearColor(r, g, b, a);
            var clearFlag = 16384;
            switch (this._depthStencilFormat) {
              case 33189:
                clearFlag |= 256;
                break;

              case 36168:
                clearFlag |= 1024;
                break;

              case 34041:
                clearFlag |= 256, clearFlag |= 1024;
            }
            gl.clear(clearFlag);
        }, __proto.end = function() {
            var gl = WebGL.mainContext;
            gl.bindFramebuffer(36160, this._preRenderTarget ? this._preRenderTarget.bitmap.frameBuffer : null), 
            this._alreadyResolved = !0, RenderState2D.curRenderTarget = this._preRenderTarget, 
            1 == this._type ? (gl.viewport(0, 0, this._svWidth, this._svHeight), RenderState2D.width = this._svWidth, 
            RenderState2D.height = this._svHeight, BaseShader.activeShader = null) : gl.viewport(0, 0, Laya.stage.width, Laya.stage.height);
        }, __proto.getData = function(x, y, width, height) {
            var gl = WebGL.mainContext;
            if (gl.bindFramebuffer(36160, this.bitmap.frameBuffer), !(36053 === gl.checkFramebufferStatus(36160))) return gl.bindFramebuffer(36160, null), 
            null;
            var pixels = new Uint8Array(this._w * this._h * 4);
            return gl.readPixels(x, y, width, height, this._surfaceFormat, this._surfaceType, pixels), 
            gl.bindFramebuffer(36160, null), pixels;
        }, __proto.destroy = function(foreDiposeTexture) {
            void 0 === foreDiposeTexture && (foreDiposeTexture = !1), this._destroy || (this._loaded = !1, 
            this.bitmap.offAll(), this.bitmap.disposeResource(), this.bitmap.dispose(), this.offAll(), 
            this.bitmap = null, this._alreadyResolved = !1, this._destroy = !0, _super.prototype.destroy.call(this));
        }, __proto.dispose = function() {}, __proto._createWebGLRenderTarget = function() {
            this.bitmap = new WebGLRenderTarget(this.width, this.height, this._surfaceFormat, this._surfaceType, this._depthStencilFormat, this._mipMap, this._repeat, this._minFifter, this._magFifter), 
            this.bitmap.activeResource(), this._alreadyResolved = !0, this._destroy = !1, this._loaded = !0, 
            this.bitmap.on("recovered", this, function(e) {
                this.event("recovered");
            });
        }, __getset(0, __proto, "surfaceFormat", function() {
            return this._surfaceFormat;
        }), __getset(0, __proto, "magFifter", function() {
            return this._magFifter;
        }), __getset(0, __proto, "surfaceType", function() {
            return this._surfaceType;
        }), __getset(0, __proto, "mipMap", function() {
            return this._mipMap;
        }), __getset(0, __proto, "depthStencilFormat", function() {
            return this._depthStencilFormat;
        }), __getset(0, __proto, "minFifter", function() {
            return this._minFifter;
        }), __getset(0, __proto, "source", function() {
            return this._alreadyResolved ? Laya.superGet(Texture, this, "source") : null;
        }), RenderTarget2D.create = function(w, h, surfaceFormat, surfaceType, depthStencilFormat, mipMap, repeat, minFifter, magFifter) {
            void 0 === surfaceFormat && (surfaceFormat = 6408), void 0 === surfaceType && (surfaceType = 5121), 
            void 0 === depthStencilFormat && (depthStencilFormat = 34041), void 0 === mipMap && (mipMap = !1), 
            void 0 === repeat && (repeat = !1), void 0 === minFifter && (minFifter = -1), void 0 === magFifter && (magFifter = -1);
            var t = RenderTarget2D.POOL.pop();
            return t || (t = new RenderTarget2D(w, h)), t.bitmap && t._w == w && t._h == h && t._surfaceFormat == surfaceFormat && t._surfaceType == surfaceType && t._depthStencilFormat == depthStencilFormat && t._mipMap == mipMap && t._repeat == repeat && t._minFifter == minFifter && t._magFifter == magFifter || (t._w = w, 
            t._h = h, t._surfaceFormat = surfaceFormat, t._surfaceType = surfaceType, t._depthStencilFormat = depthStencilFormat, 
            Render.isConchWebGL && 34041 === t._depthStencilFormat && (t._depthStencilFormat = 33189), 
            t._mipMap = mipMap, t._repeat = repeat, t._minFifter = minFifter, t._magFifter = magFifter, 
            t.release(), t._createWebGLRenderTarget()), t;
        }, RenderTarget2D.TYPE2D = 1, RenderTarget2D.TYPE3D = 2, RenderTarget2D.POOL = [], 
        RenderTarget2D;
    }(Texture), Buffer = function(_super) {
        function Buffer() {
            this._glBuffer = null, this._buffer = null, this._bufferType = 0, this._bufferUsage = 0, 
            this._byteLength = 0, Buffer.__super.call(this), Buffer._gl = WebGL.mainContext;
        }
        __class(Buffer, "laya.webgl.utils.Buffer", Resource);
        var __proto = Buffer.prototype;
        return __proto._bind = function() {
            this.activeResource(), Buffer._bindActive[this._bufferType] !== this._glBuffer && (34962 === this._bufferType && (Buffer._bindVertexBuffer = this._glBuffer), 
            Buffer._gl.bindBuffer(this._bufferType, Buffer._bindActive[this._bufferType] = this._glBuffer), 
            BaseShader.activeShader = null);
        }, __proto.recreateResource = function() {
            this._glBuffer || (this._glBuffer = Buffer._gl.createBuffer()), this.completeCreate();
        }, __proto.disposeResource = function() {
            this._glBuffer && (WebGL.mainContext.deleteBuffer(this._glBuffer), this._glBuffer = null), 
            this.memorySize = 0;
        }, __getset(0, __proto, "bufferUsage", function() {
            return this._bufferUsage;
        }), Buffer._gl = null, Buffer._bindActive = {}, Buffer._bindVertexBuffer = null, 
        Buffer._enableAtributes = [], Buffer;
    }(), SkinSV = function(_super) {
        function SkinSV(type) {
            this.texcoord = null, this.offsetX = 300, this.offsetY = 0, SkinSV.__super.call(this, 512, 0);
            var _vlen = 8 * CONST3D2D.BYTES_PE;
            this.position = [ 2, 5126, !1, _vlen, 0 ], this.texcoord = [ 2, 5126, !1, _vlen, 2 * CONST3D2D.BYTES_PE ], 
            this.color = [ 4, 5126, !1, _vlen, 4 * CONST3D2D.BYTES_PE ];
        }
        return __class(SkinSV, "laya.webgl.shader.d2.skinAnishader.SkinSV", Value2D), SkinSV;
    }(), Color2dSV = function(_super) {
        function Color2dSV(args) {
            Color2dSV.__super.call(this, 2, 0), this.color = [];
        }
        return __class(Color2dSV, "laya.webgl.shader.d2.value.Color2dSV", Value2D), Color2dSV.prototype.setValue = function(value) {
            value.fillStyle && (this.color = value.fillStyle._color._color), value.strokeStyle && (this.color = value.strokeStyle._color._color);
        }, Color2dSV;
    }(), FillTextureSV = function(_super) {
        function FillTextureSV(type) {
            this.u_colorMatrix = null, this.strength = 0, this.colorMat = null, this.colorAlpha = null, 
            this.u_TexRange = [ 0, 1, 0, 1 ], this.u_offset = [ 0, 0 ], this.texcoord = Value2D._TEXCOORD, 
            FillTextureSV.__super.call(this, 256, 0);
        }
        __class(FillTextureSV, "laya.webgl.shader.d2.value.FillTextureSV", Value2D);
        var __proto = FillTextureSV.prototype;
        return __proto.setValue = function(vo) {
            this.ALPHA = vo.ALPHA, vo.filters && this.setFilters(vo.filters);
        }, __proto.clear = function() {
            this.texture = null, this.shader = null, this.colorMat = null, this.colorAlpha = null, 
            this.defines.setValue(0);
        }, FillTextureSV;
    }(), TextureSV = function(_super) {
        function TextureSV(subID) {
            this.u_colorMatrix = null, this.strength = 0, this.blurInfo = null, this.colorMat = null, 
            this.colorAlpha = null, this.texcoord = Value2D._TEXCOORD, void 0 === subID && (subID = 0), 
            TextureSV.__super.call(this, 1, subID);
        }
        __class(TextureSV, "laya.webgl.shader.d2.value.TextureSV", Value2D);
        var __proto = TextureSV.prototype;
        return __proto.setValue = function(vo) {
            this.ALPHA = vo.ALPHA, vo.filters && this.setFilters(vo.filters);
        }, __proto.clear = function() {
            this.texture = null, this.shader = null, this.colorMat = null, this.colorAlpha = null, 
            this.defines.setValue(0);
        }, TextureSV;
    }(), PrimitiveSV = function(_super) {
        function PrimitiveSV(args) {
            this.a_color = null, this.u_pos = [ 0, 0 ], PrimitiveSV.__super.call(this, 4, 0), 
            this.position = [ 2, 5126, !1, 5 * CONST3D2D.BYTES_PE, 0 ], this.a_color = [ 3, 5126, !1, 5 * CONST3D2D.BYTES_PE, 2 * CONST3D2D.BYTES_PE ];
        }
        return __class(PrimitiveSV, "laya.webgl.shader.d2.value.PrimitiveSV", Value2D), 
        PrimitiveSV;
    }(), AtlasWebGLCanvas = function(_super) {
        function AtlasWebGLCanvas() {
            this._atlaser = null, this._flashCacheImage = null, this._flashCacheImageNeedFlush = !1, 
            AtlasWebGLCanvas.__super.call(this);
        }
        __class(AtlasWebGLCanvas, "laya.webgl.atlas.AtlasWebGLCanvas", _super);
        var __proto = AtlasWebGLCanvas.prototype;
        return __proto.recreateResource = function() {
            var gl = WebGL.mainContext, glTex = this._source = gl.createTexture(), preTarget = WebGLContext.curBindTexTarget, preTexture = WebGLContext.curBindTexValue;
            WebGLContext.bindTexture(gl, 3553, glTex), gl.texImage2D(3553, 0, 6408, this._w, this._h, 0, 6408, 5121, null), 
            gl.texParameteri(3553, 10241, 9729), gl.texParameteri(3553, 10240, 9729), gl.texParameteri(3553, 10242, 33071), 
            gl.texParameteri(3553, 10243, 33071), preTarget && preTexture && WebGLContext.bindTexture(gl, preTarget, preTexture), 
            this.memorySize = this._w * this._h * 4, this.completeCreate();
        }, __proto.disposeResource = function() {
            this._source && (WebGL.mainContext.deleteTexture(this._source), this._source = null, 
            this.memorySize = 0);
        }, __proto.texSubImage2D = function(xoffset, yoffset, bitmap) {
            if (Render.isFlash) {
                this._flashCacheImage || (this._flashCacheImage = HTMLImage.create(""), this._flashCacheImage._image.createCanvas(this._w, this._h));
                var bmData = bitmap.bitmapdata;
                this._flashCacheImage._image.copyPixels(bmData, 0, 0, bmData.width, bmData.height, xoffset, yoffset), 
                this._flashCacheImageNeedFlush || (this._flashCacheImageNeedFlush = !0);
            } else {
                var gl = WebGL.mainContext, preTarget = WebGLContext.curBindTexTarget, preTexture = WebGLContext.curBindTexValue;
                WebGLContext.bindTexture(gl, 3553, this._source), Render.isConchWebGL ? (bitmap !== ConchTextCanvas && (0 <= xoffset - 1 && gl.texSubImage2DEx(!0, 3553, 0, xoffset - 1, yoffset, 6408, 5121, bitmap), 
                xoffset + 1 <= this._w && gl.texSubImage2DEx(!0, 3553, 0, xoffset + 1, yoffset, 6408, 5121, bitmap), 
                0 <= yoffset - 1 && gl.texSubImage2DEx(!0, 3553, 0, xoffset, yoffset - 1, 6408, 5121, bitmap), 
                yoffset + 1 <= this._h && gl.texSubImage2DEx(!0, 3553, 0, xoffset, yoffset + 1, 6408, 5121, bitmap)), 
                gl.texSubImage2DEx(!0, 3553, 0, xoffset, yoffset, 6408, 5121, bitmap)) : (gl.pixelStorei(37441, !0), 
                0 <= xoffset - 1 && gl.texSubImage2D(3553, 0, xoffset - 1, yoffset, 6408, 5121, bitmap), 
                xoffset + 1 <= this._w && gl.texSubImage2D(3553, 0, xoffset + 1, yoffset, 6408, 5121, bitmap), 
                0 <= yoffset - 1 && gl.texSubImage2D(3553, 0, xoffset, yoffset - 1, 6408, 5121, bitmap), 
                yoffset + 1 <= this._h && gl.texSubImage2D(3553, 0, xoffset, yoffset + 1, 6408, 5121, bitmap), 
                gl.texSubImage2D(3553, 0, xoffset, yoffset, 6408, 5121, bitmap), gl.pixelStorei(37441, !1)), 
                preTarget && preTexture && WebGLContext.bindTexture(gl, preTarget, preTexture);
            }
        }, __proto.texSubImage2DPixel = function(xoffset, yoffset, width, height, pixel) {
            var gl = WebGL.mainContext, preTarget = WebGLContext.curBindTexTarget, preTexture = WebGLContext.curBindTexValue;
            WebGLContext.bindTexture(gl, 3553, this._source);
            var pixels = new Uint8Array(pixel.data);
            Render.isConchWebGL ? gl.texSubImage2DEx(!0, 3553, 0, xoffset, yoffset, width, height, 6408, 5121, pixels) : (gl.pixelStorei(37441, !0), 
            gl.texSubImage2D(3553, 0, xoffset, yoffset, width, height, 6408, 5121, pixels), 
            gl.pixelStorei(37441, !1)), preTarget && preTexture && WebGLContext.bindTexture(gl, preTarget, preTexture);
        }, __getset(0, __proto, "width", _super.prototype._$get_width, function(value) {
            this._w = value;
        }), __getset(0, __proto, "height", _super.prototype._$get_height, function(value) {
            this._h = value;
        }), AtlasWebGLCanvas;
    }(Bitmap), WebGLCanvas = function(_super) {
        function WebGLCanvas() {
            this.flipY = !0, this.alwaysChange = !1, WebGLCanvas.__super.call(this);
        }
        __class(WebGLCanvas, "laya.webgl.resource.WebGLCanvas", Bitmap);
        var __proto = WebGLCanvas.prototype;
        return __proto.getCanvas = function() {
            return this._canvas;
        }, __proto.clear = function() {
            this._ctx && this._ctx.clear();
        }, __proto.destroy = function() {
            this._ctx && this._ctx.destroy(), this._ctx = null, laya.resource.Resource.prototype.destroy.call(this);
        }, __proto._setContext = function(context) {
            this._ctx = context;
        }, __proto.getContext = function(contextID, other) {
            return this._ctx ? this._ctx : this._ctx = WebGLCanvas._createContext(this);
        }, __proto.size = function(w, h) {
            this._w == w && this._h == h || (this._w = w, this._h = h, this._ctx && this._ctx.size(w, h), 
            this._canvas && (this._canvas.height = h, this._canvas.width = w));
        }, __proto.activeResource = function(force) {
            void 0 === force && (force = !1), this._source || this.recreateResource();
        }, __proto.recreateResource = function() {
            this.createWebGlTexture(), this.completeCreate();
        }, __proto.disposeResource = function() {
            this._source && !this.iscpuSource && (WebGL.mainContext.deleteTexture(this._source), 
            this._source = null, this.memorySize = 0);
        }, __proto.createWebGlTexture = function() {
            var gl = WebGL.mainContext;
            this._canvas;
            var glTex = this._source = gl.createTexture();
            this.iscpuSource = !1;
            var preTarget = WebGLContext.curBindTexTarget, preTexture = WebGLContext.curBindTexValue;
            WebGLContext.bindTexture(gl, 3553, glTex), gl.pixelStorei(37440, this.flipY ? 1 : 0), 
            Render.isConchWebGL ? gl.texImage2DEx(WebGLCanvas.premulAlpha, 3553, 0, 6408, 6408, 5121, this._imgData) : (WebGLCanvas.premulAlpha && gl.pixelStorei(37441, !0), 
            gl.texImage2D(3553, 0, 6408, 6408, 5121, this._imgData), WebGLCanvas.premulAlpha && gl.pixelStorei(37441, !1)), 
            gl.texParameteri(3553, 10240, 9729), gl.texParameteri(3553, 10241, 9729), gl.texParameteri(3553, 10242, 33071), 
            gl.texParameteri(3553, 10243, 33071), gl.pixelStorei(37440, 0), this.memorySize = this._w * this._h * 4, 
            preTarget && preTexture && WebGLContext.bindTexture(gl, preTarget, preTexture);
        }, __proto.reloadCanvasData = function() {
            var gl = WebGL.mainContext;
            if (!this._source) throw "reloadCanvasData error, gl texture not created!";
            var preTarget = WebGLContext.curBindTexTarget, preTexture = WebGLContext.curBindTexValue;
            WebGLContext.bindTexture(gl, 3553, this._source), Render.isConchWebGL ? gl.texImage2DEx(WebGLCanvas.premulAlpha, 3553, 0, 6408, 6408, 5121, this._imgData) : (WebGLCanvas.premulAlpha && gl.pixelStorei(37441, !0), 
            gl.texImage2D(3553, 0, 6408, 6408, 5121, this._imgData), WebGLCanvas.premulAlpha && gl.pixelStorei(37441, !1)), 
            gl.pixelStorei(37440, 0), preTarget && preTexture && WebGLContext.bindTexture(gl, preTarget, preTexture);
        }, __proto.texSubImage2D = function(webglCanvas, xoffset, yoffset) {
            var gl = WebGL.mainContext, preTarget = WebGLContext.curBindTexTarget, preTexture = WebGLContext.curBindTexValue;
            WebGLContext.bindTexture(gl, 3553, this._source), Render.isConchWebGL ? gl.texSubImage2DEx(!0, 3553, 0, xoffset, yoffset, 6408, 5121, webglCanvas._source) : (gl.pixelStorei(37441, !0), 
            gl.texSubImage2D(3553, 0, xoffset, yoffset, 6408, 5121, webglCanvas._source), gl.pixelStorei(37441, !1)), 
            preTarget && preTexture && WebGLContext.bindTexture(gl, preTarget, preTexture);
        }, __proto.toBase64 = function(type, encoderOptions, callBack) {
            var base64Data = null;
            this._canvas && (base64Data = this._canvas.toDataURL(type, encoderOptions)), callBack.call(this, base64Data);
        }, __getset(0, __proto, "context", function() {
            return this._ctx;
        }), __getset(0, __proto, "source", function() {
            return this.alwaysChange && this.reloadCanvasData(), this._source;
        }), __getset(0, __proto, "asBitmap", null, function(value) {
            this._ctx && (this._ctx.asBitmap = value);
        }), WebGLCanvas._createContext = null, WebGLCanvas.premulAlpha = !1, WebGLCanvas;
    }(), WebGLCharImage = function(_super) {
        function WebGLCharImage(content, drawValue) {
            this.CborderSize = 12, WebGLCharImage.__super.call(this), this.char = content, this.isSpace = " " === content, 
            this.xs = drawValue.scaleX, this.ys = drawValue.scaleY, this.font = drawValue.font.toString(), 
            this.fontSize = drawValue.font.size, this.fillColor = drawValue.fillColor, this.borderColor = drawValue.borderColor, 
            this.lineWidth = drawValue.lineWidth, this.underLine = drawValue.underLine;
            var pCanvas, bIsConchApp = Render.isConchApp;
            bIsConchApp ? ((pCanvas = ConchTextCanvas)._source = ConchTextCanvas, pCanvas._source.canvas = ConchTextCanvas) : pCanvas = Browser.canvas.source, 
            this.canvas = pCanvas, this._enableMerageInAtlas = !0, this._ctx = bIsConchApp ? pCanvas : this.canvas.getContext("2d", void 0);
            var t = Utils.measureText(this.char, this.font), w = t ? t.width : this.fontSize, h = t && t.height || this.fontSize;
            this.cw = w * this.xs, this.ch = h * this.ys, this.onresize(this.cw + 2 * this.CborderSize, this.ch + 2 * this.CborderSize), 
            this.texture = new Texture(this);
        }
        __class(WebGLCharImage, "laya.webgl.resource.WebGLCharImage", Bitmap);
        var __proto = WebGLCharImage.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.resource.IMergeAtlasBitmap": !0
        }), __proto.active = function() {
            this.texture.active();
        }, __proto.recreateResource = function() {
            var bIsConchApp = Render.isConchApp;
            if (this.onresize(this.cw + 2 * this.CborderSize, this.ch + 2 * this.CborderSize), 
            this.canvas && (this.canvas.height = this._h, this.canvas.width = this._w), bIsConchApp) {
                var nFontSize = this.fontSize;
                1 == this.xs && 1 == this.ys || (nFontSize = parseInt(nFontSize * (this.xs > this.ys ? this.xs : this.ys) + ""));
                var sFont = "normal 100 " + this.font;
                sFont = sFont.replace(WebGLCharImage._fontSizeReg, nFontSize), this.borderColor && (sFont += " 1 " + this.borderColor), 
                this._ctx.font = sFont, this._ctx.textBaseline = "top", this._ctx.fillStyle = this.fillColor, 
                this._ctx.fillText(this.char, this.CborderSize, this.CborderSize, null, null, null);
            } else {
                if (this._ctx.save(), this._ctx.lineJoin = "round", this._ctx.clearRect(0, 0, this.cw + 2 * this.CborderSize, this.ch + 2 * this.CborderSize), 
                this._ctx.font = this.font, Text.RightToLeft && (this._ctx.textAlign = "end"), this._ctx.textBaseline = "top", 
                this._ctx.translate(this.CborderSize, this.CborderSize), 1 == this.xs && 1 == this.ys || this._ctx.scale(this.xs, this.ys), 
                this.fillColor && this.borderColor ? (this._ctx.strokeStyle = this.borderColor, 
                this._ctx.lineWidth = this.lineWidth, this._ctx.strokeText(this.char, 0, 0, null, null, 0, null), 
                this._ctx.fillStyle = this.fillColor, this._ctx.fillText(this.char, 0, 0, null, null, null)) : -1 === this.lineWidth ? (this._ctx.fillStyle = this.fillColor ? this.fillColor : "white", 
                this._ctx.fillText(this.char, 0, 0, null, null, null)) : (this._ctx.strokeStyle = this.borderColor ? this.borderColor : "white", 
                this._ctx.lineWidth = this.lineWidth, this._ctx.strokeText(this.char, 0, 0, null, null, 0, null)), 
                this.underLine) {
                    this._ctx.lineWidth = 1, this._ctx.strokeStyle = this.fillColor, this._ctx.beginPath(), 
                    this._ctx.moveTo(0, this.fontSize + 1);
                    var r = this._ctx.measureText(this.char), nW = (r ? r.width : this.fontSize) + 1;
                    this._ctx.lineTo(nW, this.fontSize + 1), this._ctx.stroke();
                }
                this._ctx.restore();
            }
            this.borderSize = this.CborderSize, this.completeCreate();
        }, __proto.onresize = function(w, h) {
            this._w = w, this._h = h, this._allowMerageInAtlas = !0;
        }, __proto.clearAtlasSource = function() {}, __getset(0, __proto, "allowMerageInAtlas", function() {
            return this._allowMerageInAtlas;
        }), __getset(0, __proto, "atlasSource", function() {
            return this.canvas;
        }), __getset(0, __proto, "enableMerageInAtlas", function() {
            return this._enableMerageInAtlas;
        }, function(value) {
            this._enableMerageInAtlas = value;
        }), WebGLCharImage.createOneChar = function(content, drawValue) {
            return new WebGLCharImage(content, drawValue);
        }, WebGLCharImage._fontSizeReg = new RegExp("\\d+(?=px)", "g"), WebGLCharImage;
    }(), WebGLRenderTarget = function(_super) {
        function WebGLRenderTarget(width, height, surfaceFormat, surfaceType, depthStencilFormat, mipMap, repeat, minFifter, magFifter) {
            void 0 === surfaceFormat && (surfaceFormat = 6408), void 0 === surfaceType && (surfaceType = 5121), 
            void 0 === depthStencilFormat && (depthStencilFormat = 34041), void 0 === mipMap && (mipMap = !1), 
            void 0 === repeat && (repeat = !1), void 0 === minFifter && (minFifter = -1), void 0 === magFifter && (magFifter = 1), 
            WebGLRenderTarget.__super.call(this), this._w = width, this._h = height, this._surfaceFormat = surfaceFormat, 
            this._surfaceType = surfaceType, this._depthStencilFormat = depthStencilFormat, 
            Render.isConchWebGL && 34041 === this._depthStencilFormat && (this._depthStencilFormat = 33189), 
            this._mipMap = mipMap, this._repeat = repeat, this._minFifter = minFifter, this._magFifter = magFifter;
        }
        __class(WebGLRenderTarget, "laya.webgl.resource.WebGLRenderTarget", Bitmap);
        var __proto = WebGLRenderTarget.prototype;
        return __proto.recreateResource = function() {
            var gl = WebGL.mainContext;
            this._frameBuffer || (this._frameBuffer = gl.createFramebuffer()), this._source || (this._source = gl.createTexture());
            var preTarget = WebGLContext.curBindTexTarget, preTexture = WebGLContext.curBindTexValue;
            WebGLContext.bindTexture(gl, 3553, this._source), gl.texImage2D(3553, 0, 6408, this._w, this._h, 0, this._surfaceFormat, this._surfaceType, null);
            var minFifter = this._minFifter, magFifter = this._magFifter, repeat = this._repeat ? 10497 : 33071, isPot = Arith.isPOT(this._w, this._h);
            if (isPot ? (this._mipMap ? -1 !== minFifter || (minFifter = 9987) : -1 !== minFifter || (minFifter = 9729), 
            -1 !== magFifter || (magFifter = 9729), gl.texParameteri(3553, 10241, minFifter), 
            gl.texParameteri(3553, 10240, magFifter), gl.texParameteri(3553, 10242, repeat), 
            gl.texParameteri(3553, 10243, repeat), this._mipMap && gl.generateMipmap(3553)) : (-1 !== minFifter || (minFifter = 9729), 
            -1 !== magFifter || (magFifter = 9729), gl.texParameteri(3553, 10241, minFifter), 
            gl.texParameteri(3553, 10240, magFifter), gl.texParameteri(3553, 10242, 33071), 
            gl.texParameteri(3553, 10243, 33071)), gl.bindFramebuffer(36160, this._frameBuffer), 
            gl.framebufferTexture2D(36160, 36064, 3553, this._source, 0), this._depthStencilFormat) switch (this._depthStencilBuffer || (this._depthStencilBuffer = gl.createRenderbuffer()), 
            gl.bindRenderbuffer(36161, this._depthStencilBuffer), gl.renderbufferStorage(36161, this._depthStencilFormat, this._w, this._h), 
            this._depthStencilFormat) {
              case 33189:
                gl.framebufferRenderbuffer(36160, 36096, 36161, this._depthStencilBuffer);
                break;

              case 36168:
                gl.framebufferRenderbuffer(36160, 36128, 36161, this._depthStencilBuffer);
                break;

              case 34041:
                gl.framebufferRenderbuffer(36160, 33306, 36161, this._depthStencilBuffer);
            }
            gl.bindFramebuffer(36160, null), preTarget && preTexture && WebGLContext.bindTexture(gl, preTarget, preTexture), 
            gl.bindRenderbuffer(36161, null), isPot && this._mipMap ? this.memorySize = this._w * this._h * 4 * (1 + 1 / 3) : this.memorySize = this._w * this._h * 4, 
            this.completeCreate();
        }, __proto.disposeResource = function() {
            this._frameBuffer && (WebGL.mainContext.deleteTexture(this._source), WebGL.mainContext.deleteFramebuffer(this._frameBuffer), 
            WebGL.mainContext.deleteRenderbuffer(this._depthStencilBuffer), this._source = null, 
            this._frameBuffer = null, this._depthStencilBuffer = null, this.memorySize = 0);
        }, __getset(0, __proto, "depthStencilBuffer", function() {
            return this._depthStencilBuffer;
        }), __getset(0, __proto, "frameBuffer", function() {
            return this._frameBuffer;
        }), WebGLRenderTarget;
    }(), WebGLSubImage = function(_super) {
        function WebGLSubImage(canvas, offsetX, offsetY, width, height, atlasImage, src) {
            this.offsetX = 0, this.offsetY = 0, WebGLSubImage.__super.call(this), this.repeat = !0, 
            this.mipmap = !1, this.minFifter = -1, this.magFifter = -1, this.atlasImage = atlasImage, 
            this.canvas = canvas, this._ctx = canvas.getContext("2d", void 0), this._w = width, 
            this._h = height, this.offsetX = offsetX, this.offsetY = offsetY, this.src = src, 
            this._enableMerageInAtlas = !0, AtlasResourceManager.enabled && this._w < AtlasResourceManager.atlasLimitWidth && this._h < AtlasResourceManager.atlasLimitHeight ? this._allowMerageInAtlas = !0 : this._allowMerageInAtlas = !1;
        }
        __class(WebGLSubImage, "laya.webgl.resource.WebGLSubImage", Bitmap);
        var __proto = WebGLSubImage.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.resource.IMergeAtlasBitmap": !0
        }), __proto.size = function(w, h) {
            this._w = w, this._h = h, this._ctx && this._ctx.size(w, h), this.canvas && (this.canvas.height = h, 
            this.canvas.width = w);
        }, __proto.recreateResource = function() {
            this.size(this._w, this._h), this._ctx.drawImage(this.atlasImage, this.offsetX, this.offsetY, this._w, this._h, 0, 0, this._w, this._h), 
            this._allowMerageInAtlas && this._enableMerageInAtlas ? this.memorySize = 0 : this.createWebGlTexture(), 
            this.completeCreate();
        }, __proto.createWebGlTexture = function() {
            var gl = WebGL.mainContext;
            if (!this.canvas) throw "create GLTextur err:no data:" + this.canvas;
            var glTex = this._source = gl.createTexture(), preTarget = WebGLContext.curBindTexTarget, preTexture = WebGLContext.curBindTexValue;
            WebGLContext.bindTexture(gl, 3553, glTex), Render.isConchWebGL ? gl.texImage2DEx(!0, 3553, 0, 6408, 6408, 5121, this.canvas) : (gl.pixelStorei(37441, !0), 
            gl.texImage2D(3553, 0, 6408, 6408, 5121, this.canvas), gl.pixelStorei(37441, !1));
            var minFifter = this.minFifter, magFifter = this.magFifter, repeat = this.repeat ? 10497 : 33071, isPOT = Arith.isPOT(this.width, this.height);
            isPOT ? (this.mipmap ? -1 !== minFifter || (minFifter = 9987) : -1 !== minFifter || (minFifter = 9729), 
            -1 !== magFifter || (magFifter = 9729), gl.texParameteri(3553, 10240, magFifter), 
            gl.texParameteri(3553, 10241, minFifter), gl.texParameteri(3553, 10242, repeat), 
            gl.texParameteri(3553, 10243, repeat), this.mipmap && gl.generateMipmap(3553)) : (-1 !== minFifter || (minFifter = 9729), 
            -1 !== magFifter || (magFifter = 9729), gl.texParameteri(3553, 10241, minFifter), 
            gl.texParameteri(3553, 10240, magFifter), gl.texParameteri(3553, 10242, 33071), 
            gl.texParameteri(3553, 10243, 33071)), preTarget && preTexture && WebGLContext.bindTexture(gl, preTarget, preTexture), 
            this.canvas = null, isPOT && this.mipmap ? this.memorySize = this._w * this._h * 4 * (1 + 1 / 3) : this.memorySize = this._w * this._h * 4;
        }, __proto.disposeResource = function() {
            AtlasResourceManager.enabled && this._allowMerageInAtlas || !this._source || (WebGL.mainContext.deleteTexture(this._source), 
            this._source = null, this.memorySize = 0);
        }, __proto.clearAtlasSource = function() {}, __getset(0, __proto, "allowMerageInAtlas", function() {
            return this._allowMerageInAtlas;
        }), __getset(0, __proto, "atlasSource", function() {
            return this.canvas;
        }), __getset(0, __proto, "enableMerageInAtlas", function() {
            return this._allowMerageInAtlas;
        }, function(value) {
            this._allowMerageInAtlas = value;
        }), WebGLSubImage;
    }(), Shader = function(_super) {
        function Shader(vs, ps, saveName, nameMap) {
            if (this._curActTexIndex = 0, this.tag = {}, this._program = null, this._params = null, 
            this._paramsMap = {}, this._offset = 0, Shader.__super.call(this), !vs || !ps) throw "Shader Error";
            this._id = ++Shader._count, this._vs = vs, this._ps = ps, this._nameMap = nameMap || {}, 
            null != saveName && (Shader.sharders[saveName] = this);
        }
        __class(Shader, "laya.webgl.shader.Shader", BaseShader);
        var __proto = Shader.prototype;
        return __proto.recreateResource = function() {
            this._compile(), this.completeCreate(), this.memorySize = 0;
        }, __proto.disposeResource = function() {
            WebGL.mainContext.deleteShader(this._vshader), WebGL.mainContext.deleteShader(this._pshader), 
            WebGL.mainContext.deleteProgram(this._program), this._vshader = this._pshader = this._program = null, 
            this._params = null, this._paramsMap = {}, this.memorySize = 0, this._curActTexIndex = 0;
        }, __proto._compile = function() {
            if (this._vs && this._ps && !this._params) {
                this._reCompile = !0, this._params = [];
                var text = [ this._vs, this._ps ], gl = WebGL.mainContext;
                if (this._program = gl.createProgram(), this._vshader = Shader._createShader(gl, text[0], 35633), 
                this._pshader = Shader._createShader(gl, text[1], 35632), gl.attachShader(this._program, this._vshader), 
                gl.attachShader(this._program, this._pshader), gl.linkProgram(this._program), !Render.isConchApp && !gl.getProgramParameter(this._program, 35714)) throw gl.getProgramInfoLog(this._program);
                var one, n, i = 0, attribNum = 0;
                for (attribNum = Render.isConchApp ? gl.getProgramParameterEx(this._vs, this._ps, "", 35721) : gl.getProgramParameter(this._program, 35721), 
                i = 0; i < attribNum; i++) {
                    var attrib = null;
                    one = {
                        vartype: "attribute",
                        glfun: null,
                        ivartype: 0,
                        attrib: attrib = Render.isConchApp ? gl.getActiveAttribEx(this._vs, this._ps, "", i) : gl.getActiveAttrib(this._program, i),
                        location: gl.getAttribLocation(this._program, attrib.name),
                        name: attrib.name,
                        type: attrib.type,
                        isArray: !1,
                        isSame: !1,
                        preValue: null,
                        indexOfParams: 0
                    }, this._params.push(one);
                }
                var nUniformNum = 0;
                for (nUniformNum = Render.isConchApp ? gl.getProgramParameterEx(this._vs, this._ps, "", 35718) : gl.getProgramParameter(this._program, 35718), 
                i = 0; i < nUniformNum; i++) {
                    var uniform = null;
                    uniform = Render.isConchApp ? gl.getActiveUniformEx(this._vs, this._ps, "", i) : gl.getActiveUniform(this._program, i), 
                    0 < (one = {
                        vartype: "uniform",
                        glfun: null,
                        ivartype: 1,
                        attrib: attrib,
                        location: gl.getUniformLocation(this._program, uniform.name),
                        name: uniform.name,
                        type: uniform.type,
                        isArray: !1,
                        isSame: !1,
                        preValue: null,
                        indexOfParams: 0
                    }).name.indexOf("[0]") && (one.name = one.name.substr(0, one.name.length - 3), one.isArray = !0, 
                    one.location = gl.getUniformLocation(this._program, one.name)), this._params.push(one);
                }
                for (i = 0, n = this._params.length; i < n; i++) if ((one = this._params[i]).indexOfParams = i, 
                one.index = 1, one.value = [ one.location, null ], one.codename = one.name, one.name = this._nameMap[one.codename] ? this._nameMap[one.codename] : one.codename, 
                (this._paramsMap[one.name] = one)._this = this, one.uploadedValue = [], "attribute" !== one.vartype) switch (one.type) {
                  case 5124:
                    one.fun = one.isArray ? this._uniform1iv : this._uniform1i;
                    break;

                  case 5126:
                    one.fun = one.isArray ? this._uniform1fv : this._uniform1f;
                    break;

                  case 35664:
                    one.fun = one.isArray ? this._uniform_vec2v : this._uniform_vec2;
                    break;

                  case 35665:
                    one.fun = one.isArray ? this._uniform_vec3v : this._uniform_vec3;
                    break;

                  case 35666:
                    one.fun = one.isArray ? this._uniform_vec4v : this._uniform_vec4;
                    break;

                  case 35678:
                    one.fun = this._uniform_sampler2D;
                    break;

                  case 35680:
                    one.fun = this._uniform_samplerCube;
                    break;

                  case 35676:
                    one.glfun = gl.uniformMatrix4fv, one.fun = this._uniformMatrix4fv;
                    break;

                  case 35670:
                    one.fun = this._uniform1i;
                    break;

                  case 35674:
                  case 35675:
                  default:
                    throw new Error("compile shader err!");
                } else one.fun = this._attribute;
            }
        }, __proto.getUniform = function(name) {
            return this._paramsMap[name];
        }, __proto._attribute = function(one, value) {
            var gl = WebGL.mainContext, enableAtributes = Buffer._enableAtributes, location = one.location;
            return enableAtributes[location] || gl.enableVertexAttribArray(location), gl.vertexAttribPointer(location, value[0], value[1], value[2], value[3], value[4] + this._offset), 
            enableAtributes[location] = Buffer._bindVertexBuffer, 1;
        }, __proto._uniform1f = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value ? (WebGL.mainContext.uniform1f(one.location, uploadedValue[0] = value), 
            1) : 0;
        }, __proto._uniform1fv = function(one, value) {
            if (value.length < 4) {
                var uploadedValue = one.uploadedValue;
                return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] || uploadedValue[2] !== value[2] || uploadedValue[3] !== value[3] ? (WebGL.mainContext.uniform1fv(one.location, value), 
                uploadedValue[0] = value[0], uploadedValue[1] = value[1], uploadedValue[2] = value[2], 
                uploadedValue[3] = value[3], 1) : 0;
            }
            return WebGL.mainContext.uniform1fv(one.location, value), 1;
        }, __proto._uniform_vec2 = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] ? (WebGL.mainContext.uniform2f(one.location, uploadedValue[0] = value[0], uploadedValue[1] = value[1]), 
            1) : 0;
        }, __proto._uniform_vec2v = function(one, value) {
            if (value.length < 2) {
                var uploadedValue = one.uploadedValue;
                return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] || uploadedValue[2] !== value[2] || uploadedValue[3] !== value[3] ? (WebGL.mainContext.uniform2fv(one.location, value), 
                uploadedValue[0] = value[0], uploadedValue[1] = value[1], uploadedValue[2] = value[2], 
                uploadedValue[3] = value[3], 1) : 0;
            }
            return WebGL.mainContext.uniform2fv(one.location, value), 1;
        }, __proto._uniform_vec3 = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] || uploadedValue[2] !== value[2] ? (WebGL.mainContext.uniform3f(one.location, uploadedValue[0] = value[0], uploadedValue[1] = value[1], uploadedValue[2] = value[2]), 
            1) : 0;
        }, __proto._uniform_vec3v = function(one, value) {
            return WebGL.mainContext.uniform3fv(one.location, value), 1;
        }, __proto._uniform_vec4 = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] || uploadedValue[2] !== value[2] || uploadedValue[3] !== value[3] ? (WebGL.mainContext.uniform4f(one.location, uploadedValue[0] = value[0], uploadedValue[1] = value[1], uploadedValue[2] = value[2], uploadedValue[3] = value[3]), 
            1) : 0;
        }, __proto._uniform_vec4v = function(one, value) {
            return WebGL.mainContext.uniform4fv(one.location, value), 1;
        }, __proto._uniformMatrix2fv = function(one, value) {
            return WebGL.mainContext.uniformMatrix2fv(one.location, !1, value), 1;
        }, __proto._uniformMatrix3fv = function(one, value) {
            return WebGL.mainContext.uniformMatrix3fv(one.location, !1, value), 1;
        }, __proto._uniformMatrix4fv = function(one, value) {
            return WebGL.mainContext.uniformMatrix4fv(one.location, !1, value), 1;
        }, __proto._uniform1i = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value ? (WebGL.mainContext.uniform1i(one.location, uploadedValue[0] = value), 
            1) : 0;
        }, __proto._uniform1iv = function(one, value) {
            return WebGL.mainContext.uniform1iv(one.location, value), 1;
        }, __proto._uniform_ivec2 = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] ? (WebGL.mainContext.uniform2i(one.location, uploadedValue[0] = value[0], uploadedValue[1] = value[1]), 
            1) : 0;
        }, __proto._uniform_ivec2v = function(one, value) {
            return WebGL.mainContext.uniform2iv(one.location, value), 1;
        }, __proto._uniform_vec3i = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] || uploadedValue[2] !== value[2] ? (WebGL.mainContext.uniform3i(one.location, uploadedValue[0] = value[0], uploadedValue[1] = value[1], uploadedValue[2] = value[2]), 
            1) : 0;
        }, __proto._uniform_vec3vi = function(one, value) {
            return WebGL.mainContext.uniform3iv(one.location, value), 1;
        }, __proto._uniform_vec4i = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] || uploadedValue[2] !== value[2] || uploadedValue[3] !== value[3] ? (WebGL.mainContext.uniform4i(one.location, uploadedValue[0] = value[0], uploadedValue[1] = value[1], uploadedValue[2] = value[2], uploadedValue[3] = value[3]), 
            1) : 0;
        }, __proto._uniform_vec4vi = function(one, value) {
            return WebGL.mainContext.uniform4iv(one.location, value), 1;
        }, __proto._uniform_sampler2D = function(one, value) {
            var gl = WebGL.mainContext, uploadedValue = one.uploadedValue;
            return null == uploadedValue[0] ? (uploadedValue[0] = this._curActTexIndex, gl.uniform1i(one.location, this._curActTexIndex), 
            gl.activeTexture(Shader._TEXTURES[this._curActTexIndex]), WebGLContext.bindTexture(gl, 3553, value), 
            this._curActTexIndex++, 1) : (gl.activeTexture(Shader._TEXTURES[uploadedValue[0]]), 
            WebGLContext.bindTexture(gl, 3553, value), 0);
        }, __proto._uniform_samplerCube = function(one, value) {
            var gl = WebGL.mainContext, uploadedValue = one.uploadedValue;
            return null == uploadedValue[0] ? (uploadedValue[0] = this._curActTexIndex, gl.uniform1i(one.location, this._curActTexIndex), 
            gl.activeTexture(Shader._TEXTURES[this._curActTexIndex]), WebGLContext.bindTexture(gl, 34067, value), 
            this._curActTexIndex++, 1) : (gl.activeTexture(Shader._TEXTURES[uploadedValue[0]]), 
            WebGLContext.bindTexture(gl, 34067, value), 0);
        }, __proto._noSetValue = function(one) {
            console.log("no....:" + one.name);
        }, __proto.uploadOne = function(name, value) {
            this.activeResource(), WebGLContext.UseProgram(this._program);
            var one = this._paramsMap[name];
            one.fun.call(this, one, value);
        }, __proto.uploadTexture2D = function(value) {
            Stat.shaderCall++;
            var gl = WebGL.mainContext;
            gl.activeTexture(33984), WebGLContext.bindTexture(gl, 3553, value);
        }, __proto.upload = function(shaderValue, params) {
            BaseShader.activeShader = BaseShader.bindShader = this, this._lastUseFrameCount === Stat.loopCount || this.activeResource(), 
            WebGLContext.UseProgram(this._program), this._reCompile ? (params = this._params, 
            this._reCompile = !1) : params = params || this._params;
            WebGL.mainContext;
            for (var one, value, n = params.length, shaderCall = 0, i = 0; i < n; i++) null !== (value = shaderValue[(one = params[i]).name]) && (shaderCall += one.fun.call(this, one, value));
            Stat.shaderCall += shaderCall;
        }, __proto.uploadArray = function(shaderValue, length, _bufferUsage) {
            BaseShader.activeShader = this, (BaseShader.bindShader = this).activeResource(), 
            WebGLContext.UseProgram(this._program);
            this._params;
            for (var value, one, shaderCall = 0, i = length - 2; 0 <= i; i -= 2) (one = this._paramsMap[shaderValue[i]]) && null != (value = shaderValue[i + 1]) && (_bufferUsage && _bufferUsage[one.name] && _bufferUsage[one.name].bind(), 
            shaderCall += one.fun.call(this, one, value));
            Stat.shaderCall += shaderCall;
        }, __proto.getParams = function() {
            return this._params;
        }, Shader.getShader = function(name) {
            return Shader.sharders[name];
        }, Shader.create = function(vs, ps, saveName, nameMap) {
            return new Shader(vs, ps, saveName, nameMap);
        }, Shader.withCompile = function(nameID, define, shaderName, createShader) {
            if (shaderName && Shader.sharders[shaderName]) return Shader.sharders[shaderName];
            var pre = Shader._preCompileShader[2e-4 * nameID];
            if (!pre) throw new Error("withCompile shader err!" + nameID);
            return pre.createShader(define, shaderName, createShader);
        }, Shader.withCompile2D = function(nameID, mainID, define, shaderName, createShader) {
            if (shaderName && Shader.sharders[shaderName]) return Shader.sharders[shaderName];
            var pre = Shader._preCompileShader[2e-4 * nameID + mainID];
            if (!pre) throw new Error("withCompile shader err!" + nameID + " " + mainID);
            return pre.createShader(define, shaderName, createShader);
        }, Shader.addInclude = function(fileName, txt) {
            ShaderCompile.addInclude(fileName, txt);
        }, Shader.preCompile = function(nameID, vs, ps, nameMap) {
            var id = 2e-4 * nameID;
            Shader._preCompileShader[id] = new ShaderCompile(id, vs, ps, nameMap);
        }, Shader.preCompile2D = function(nameID, mainID, vs, ps, nameMap) {
            var id = 2e-4 * nameID + mainID;
            Shader._preCompileShader[id] = new ShaderCompile(id, vs, ps, nameMap);
        }, Shader._createShader = function(gl, str, type) {
            var shader = gl.createShader(type);
            return gl.shaderSource(shader, str), gl.compileShader(shader), shader;
        }, Shader._TEXTURES = [ 33984, 33985, 33986, 33987, 33988, 33989, 33990, , 33991, 33992 ], 
        Shader._count = 0, Shader._preCompileShader = {}, Shader.SHADERNAME2ID = 2e-4, Shader.sharders = ((Shader.sharders = []).length = 32, 
        Shader.sharders), __static(Shader, [ "nameKey", function() {
            return this.nameKey = new StringKey();
        } ]), Shader;
    }(), Buffer2D = function(_super) {
        function Buffer2D() {
            this._maxsize = 0, this._upload = !0, this._uploadSize = 0, Buffer2D.__super.call(this), 
            this.lock = !0;
        }
        __class(Buffer2D, "laya.webgl.utils.Buffer2D", _super);
        var __proto = Buffer2D.prototype;
        return __proto.needSize = function(sz) {
            var old = this._byteLength;
            if (sz) {
                var needsz = this._byteLength + sz;
                needsz <= this._buffer.byteLength || this._resizeBuffer(needsz << 1, !0), this._byteLength = needsz;
            }
            return old;
        }, __proto._bufferData = function() {
            this._maxsize = Math.max(this._maxsize, this._byteLength), Stat.loopCount % 30 == 0 && (this._buffer.byteLength > this._maxsize + 64 && (this.memorySize = this._buffer.byteLength, 
            this._buffer = this._buffer.slice(0, this._maxsize + 64), this._checkArrayUse()), 
            this._maxsize = this._byteLength), this._uploadSize < this._buffer.byteLength && (this._uploadSize = this._buffer.byteLength, 
            Buffer._gl.bufferData(this._bufferType, this._uploadSize, this._bufferUsage), this.memorySize = this._uploadSize), 
            Buffer._gl.bufferSubData(this._bufferType, 0, this._buffer);
        }, __proto._bufferSubData = function(offset, dataStart, dataLength) {
            if (void 0 === offset && (offset = 0), void 0 === dataStart && (dataStart = 0), 
            void 0 === dataLength && (dataLength = 0), this._maxsize = Math.max(this._maxsize, this._byteLength), 
            Stat.loopCount % 30 == 0 && (this._buffer.byteLength > this._maxsize + 64 && (this.memorySize = this._buffer.byteLength, 
            this._buffer = this._buffer.slice(0, this._maxsize + 64), this._checkArrayUse()), 
            this._maxsize = this._byteLength), this._uploadSize < this._buffer.byteLength && (this._uploadSize = this._buffer.byteLength, 
            Buffer._gl.bufferData(this._bufferType, this._uploadSize, this._bufferUsage), this.memorySize = this._uploadSize), 
            dataStart || dataLength) {
                var subBuffer = this._buffer.slice(dataStart, dataLength);
                Buffer._gl.bufferSubData(this._bufferType, offset, subBuffer);
            } else Buffer._gl.bufferSubData(this._bufferType, offset, this._buffer);
        }, __proto._checkArrayUse = function() {}, __proto._bind_upload = function() {
            return !!this._upload && (this._upload = !1, this._bind(), this._bufferData(), !0);
        }, __proto._bind_subUpload = function(offset, dataStart, dataLength) {
            return void 0 === offset && (offset = 0), void 0 === dataStart && (dataStart = 0), 
            void 0 === dataLength && (dataLength = 0), !!this._upload && (this._upload = !1, 
            this._bind(), this._bufferSubData(offset, dataStart, dataLength), !0);
        }, __proto._resizeBuffer = function(nsz, copy) {
            if (nsz < this._buffer.byteLength) return this;
            if (this.memorySize = nsz, copy && this._buffer && 0 < this._buffer.byteLength) {
                var newbuffer = new ArrayBuffer(nsz);
                new Uint8Array(newbuffer).set(new Uint8Array(this._buffer), 0), this._buffer = newbuffer;
            } else this._buffer = new ArrayBuffer(nsz);
            return this._checkArrayUse(), this._upload = !0, this;
        }, __proto.append = function(data) {
            this._upload = !0;
            var byteLen, n;
            byteLen = data.byteLength, data instanceof Uint8Array ? (this._resizeBuffer(this._byteLength + byteLen, !0), 
            n = new Uint8Array(this._buffer, this._byteLength)) : data instanceof Uint16Array ? (this._resizeBuffer(this._byteLength + byteLen, !0), 
            n = new Uint16Array(this._buffer, this._byteLength)) : data instanceof Float32Array && (this._resizeBuffer(this._byteLength + byteLen, !0), 
            n = new Float32Array(this._buffer, this._byteLength)), n.set(data, 0), this._byteLength += byteLen, 
            this._checkArrayUse();
        }, __proto.appendU16Array = function(data, len) {
            this._resizeBuffer(this._byteLength + 2 * len, !0);
            for (var u = new Uint16Array(this._buffer, this._byteLength, len), i = 0; i < len; i++) u[i] = data[i];
            this._byteLength += 2 * len, this._checkArrayUse();
        }, __proto.appendEx = function(data, type) {
            this._upload = !0;
            var byteLen;
            byteLen = data.byteLength, this._resizeBuffer(this._byteLength + byteLen, !0), new type(this._buffer, this._byteLength).set(data, 0), 
            this._byteLength += byteLen, this._checkArrayUse();
        }, __proto.appendEx2 = function(data, type, dataLen, perDataLen) {
            void 0 === perDataLen && (perDataLen = 1), this._upload = !0;
            var byteLen, n;
            byteLen = dataLen * perDataLen, this._resizeBuffer(this._byteLength + byteLen, !0), 
            n = new type(this._buffer, this._byteLength);
            var i = 0;
            for (i = 0; i < dataLen; i++) n[i] = data[i];
            this._byteLength += byteLen, this._checkArrayUse();
        }, __proto.getBuffer = function() {
            return this._buffer;
        }, __proto.setNeedUpload = function() {
            this._upload = !0;
        }, __proto.getNeedUpload = function() {
            return this._upload;
        }, __proto.upload = function() {
            var scuess = this._bind_upload();
            return Buffer._gl.bindBuffer(this._bufferType, null), Buffer._bindActive[this._bufferType] = null, 
            BaseShader.activeShader = null, scuess;
        }, __proto.subUpload = function(offset, dataStart, dataLength) {
            void 0 === offset && (offset = 0), void 0 === dataStart && (dataStart = 0), void 0 === dataLength && (dataLength = 0);
            var scuess = this._bind_subUpload();
            return Buffer._gl.bindBuffer(this._bufferType, null), Buffer._bindActive[this._bufferType] = null, 
            BaseShader.activeShader = null, scuess;
        }, __proto.disposeResource = function() {
            _super.prototype.disposeResource.call(this), this._upload = !0, this._uploadSize = 0;
        }, __proto.clear = function() {
            this._byteLength = 0, this._upload = !0;
        }, __getset(0, __proto, "bufferLength", function() {
            return this._buffer.byteLength;
        }), __getset(0, __proto, "byteLength", null, function(value) {
            this._byteLength !== value && (value <= this._buffer.byteLength || this._resizeBuffer(2 * value + 256, !0), 
            this._byteLength = value);
        }), Buffer2D.__int__ = function(gl) {
            IndexBuffer2D.QuadrangleIB = IndexBuffer2D.create(35044), GlUtils.fillIBQuadrangle(IndexBuffer2D.QuadrangleIB, 16);
        }, Buffer2D.FLOAT32 = 4, Buffer2D.SHORT = 2, Buffer2D;
    }(Buffer), TextSV = (function(_super) {
        function GlowSV(args) {
            this.u_blurX = !1, this.u_color = null, this.u_offset = null, this.u_strength = NaN, 
            this.u_texW = 0, this.u_texH = 0, GlowSV.__super.call(this, 9);
        }
        __class(GlowSV, "laya.webgl.shader.d2.value.GlowSV", _super);
        var __proto = GlowSV.prototype;
        __proto.setValue = function(vo) {
            _super.prototype.setValue.call(this, vo);
        }, __proto.clear = function() {
            _super.prototype.clear.call(this);
        };
    }(TextureSV), function(_super) {
        function TextSV(args) {
            TextSV.__super.call(this, 64), this.defines.add(64);
        }
        __class(TextSV, "laya.webgl.shader.d2.value.TextSV", _super);
        var __proto = TextSV.prototype;
        return __proto.release = function() {
            (TextSV.pool[TextSV._length++] = this).clear();
        }, __proto.clear = function() {
            _super.prototype.clear.call(this);
        }, TextSV.create = function() {
            return TextSV._length ? TextSV.pool[--TextSV._length] : new TextSV(null);
        }, TextSV.pool = [], TextSV._length = 0, TextSV;
    }(TextureSV)), Shader2X = function(_super) {
        function Shader2X(vs, ps, saveName, nameMap) {
            this._params2dQuick1 = null, this._params2dQuick2 = null, this._shaderValueWidth = NaN, 
            this._shaderValueHeight = NaN, Shader2X.__super.call(this, vs, ps, saveName, nameMap);
        }
        __class(Shader2X, "laya.webgl.shader.d2.Shader2X", _super);
        var __proto = Shader2X.prototype;
        return __proto.upload2dQuick1 = function(shaderValue) {
            this.upload(shaderValue, this._params2dQuick1 || this._make2dQuick1());
        }, __proto._make2dQuick1 = function() {
            if (!this._params2dQuick1) {
                this.activeResource(), this._params2dQuick1 = [];
                for (var one, params = this._params, i = 0, n = params.length; i < n; i++) one = params[i], 
                (Render.isFlash || "size" !== one.name && "position" !== one.name && "texcoord" !== one.name) && this._params2dQuick1.push(one);
            }
            return this._params2dQuick1;
        }, __proto.disposeResource = function() {
            _super.prototype.disposeResource.call(this), this._params2dQuick1 = null, this._params2dQuick2 = null;
        }, __proto.upload2dQuick2 = function(shaderValue) {
            this.upload(shaderValue, this._params2dQuick2 || this._make2dQuick2());
        }, __proto._make2dQuick2 = function() {
            if (!this._params2dQuick2) {
                this.activeResource(), this._params2dQuick2 = [];
                for (var one, params = this._params, i = 0, n = params.length; i < n; i++) one = params[i], 
                (Render.isFlash || "size" !== one.name) && this._params2dQuick2.push(one);
            }
            return this._params2dQuick2;
        }, Shader2X.create = function(vs, ps, saveName, nameMap) {
            return new Shader2X(vs, ps, saveName, nameMap);
        }, Shader2X;
    }(Shader), IndexBuffer2D = function(_super) {
        function IndexBuffer2D(bufferUsage) {
            this._uint8Array = null, this._uint16Array = null, void 0 === bufferUsage && (bufferUsage = 35044), 
            IndexBuffer2D.__super.call(this), this._bufferUsage = bufferUsage, this._bufferType = 34963, 
            Render.isFlash || (this._buffer = new ArrayBuffer(8));
        }
        __class(IndexBuffer2D, "laya.webgl.utils.IndexBuffer2D", Buffer2D);
        var __proto = IndexBuffer2D.prototype;
        return __proto._checkArrayUse = function() {
            this._uint8Array && (this._uint8Array = new Uint8Array(this._buffer)), this._uint16Array && (this._uint16Array = new Uint16Array(this._buffer));
        }, __proto.getUint8Array = function() {
            return this._uint8Array || (this._uint8Array = new Uint8Array(this._buffer));
        }, __proto.getUint16Array = function() {
            return this._uint16Array || (this._uint16Array = new Uint16Array(this._buffer));
        }, __proto.destory = function() {
            this._uint16Array = null, this._uint8Array = null, this._buffer = null;
        }, IndexBuffer2D.QuadrangleIB = null, IndexBuffer2D.create = function(bufferUsage) {
            return void 0 === bufferUsage && (bufferUsage = 35044), new IndexBuffer2D(bufferUsage);
        }, IndexBuffer2D;
    }(), VertexBuffer2D = function(_super) {
        function VertexBuffer2D(vertexStride, bufferUsage) {
            this._floatArray32 = null, this._vertexStride = 0, VertexBuffer2D.__super.call(this), 
            this._vertexStride = vertexStride, this._bufferUsage = bufferUsage, this._bufferType = 34962, 
            Render.isFlash || (this._buffer = new ArrayBuffer(8)), this.getFloat32Array();
        }
        __class(VertexBuffer2D, "laya.webgl.utils.VertexBuffer2D", _super);
        var __proto = VertexBuffer2D.prototype;
        return __proto.getFloat32Array = function() {
            return this._floatArray32 || (this._floatArray32 = new Float32Array(this._buffer));
        }, __proto.bind = function(ibBuffer) {
            ibBuffer && ibBuffer._bind(), this._bind();
        }, __proto.insertData = function(data, pos) {
            this.getFloat32Array().set(data, pos), this._upload = !0;
        }, __proto.bind_upload = function(ibBuffer) {
            ibBuffer._bind_upload() || ibBuffer._bind(), this._bind_upload() || this._bind();
        }, __proto._checkArrayUse = function() {
            this._floatArray32 && (this._floatArray32 = new Float32Array(this._buffer));
        }, __proto.disposeResource = function() {
            _super.prototype.disposeResource.call(this);
        }, __proto.destory = function() {
            this._byteLength = 0, this._upload = !0, this._buffer = null, this._floatArray32 = null;
        }, __getset(0, __proto, "vertexStride", function() {
            return this._vertexStride;
        }), VertexBuffer2D.create = function(vertexStride, bufferUsage) {
            return void 0 === bufferUsage && (bufferUsage = 35048), new VertexBuffer2D(vertexStride, bufferUsage);
        }, VertexBuffer2D;
    }(Buffer2D), WebGLImage = function(_super) {
        function WebGLImage(data, def, format, mipmap, width, height) {
            if (this._format = 0, this._mipmap = !1, this._allowMerageInAtlas = !1, this._enableMerageInAtlas = !1, 
            this.repeat = !1, this._image = null, this.minFifter = 0, void (this.magFifter = 0) === format && (format = 6408), 
            void 0 === mipmap && (mipmap = !0), WebGLImage.__super.call(this, data, def), this._format = format, 
            this._mipmap = mipmap, this.repeat = !1, this.minFifter = -1, this.magFifter = -1, 
            "string" == typeof data) this._url = data, this._src = data, this._image = new Browser.window.Image(), 
            def && (def.onload && (this.onload = def.onload), def.onerror && (this.onerror = def.onerror), 
            def.onCreate && def.onCreate(this)), this._image.crossOrigin = data && 0 == data.indexOf("data:") ? null : "", 
            data && (this._image.src = data); else if (data instanceof ArrayBuffer) {
                this._src = def, this._url = this._src;
                var readData = new Byte(data);
                readData.readUTFBytes(4), readData.readUTFBytes(2), readData.getInt16();
                readData.endian = "bigEndian", this._w = readData.getInt16(), this._h = readData.getInt16();
                readData.getInt16(), readData.getInt16();
                this._image = new Uint8Array(data, readData.pos), this._format = WebGL.compressEtc1.COMPRESSED_RGB_ETC1_WEBGL, 
                AtlasResourceManager.enabled && this._w < AtlasResourceManager.atlasLimitWidth && this._h < AtlasResourceManager.atlasLimitHeight ? this._allowMerageInAtlas = !0 : this._allowMerageInAtlas = !1;
            } else data instanceof Uint8Array ? (this._src = def, this._url = this._src, this._w = width, 
            this._h = height, this._image = data, this._format = data.byteLength / (width * height) == 4 ? 6408 : 6407) : data instanceof HTMLImageElement ? (this._src = def, 
            this._url = this._src, this._w = width, this._h = height, this._image = data) : (this._src = def, 
            this._url = this._src, this._image = data.source || data, this.onresize());
            this._$5__enableMerageInAtlas = !0;
        }
        __class(WebGLImage, "laya.webgl.resource.WebGLImage", HTMLImage);
        var __proto = WebGLImage.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.resource.IMergeAtlasBitmap": !0
        }), __proto._init_ = function(src, def) {}, __proto._createWebGlTexture = function() {
            if (!this._image) throw "create GLTextur err:no data:" + this._image;
            var gl = WebGL.mainContext, glTex = this._source = gl.createTexture(), preTarget = WebGLContext.curBindTexTarget, preTexture = WebGLContext.curBindTexValue;
            WebGLContext.bindTexture(gl, 3553, glTex);
            var minFifter = this.minFifter, magFifter = this.magFifter, repeat = this.repeat ? 10497 : 33071, isPot = Arith.isPOT(this._w, this._h);
            if (isPot ? (this.mipmap ? -1 !== minFifter || (minFifter = 9987) : -1 !== minFifter || (minFifter = 9729), 
            -1 !== magFifter || (magFifter = 9729), gl.texParameteri(3553, 10241, minFifter), 
            gl.texParameteri(3553, 10240, magFifter), gl.texParameteri(3553, 10242, repeat), 
            gl.texParameteri(3553, 10243, repeat), this.mipmap && gl.generateMipmap(3553)) : (-1 !== minFifter || (minFifter = 9729), 
            -1 !== magFifter || (magFifter = 9729), gl.texParameteri(3553, 10241, minFifter), 
            gl.texParameteri(3553, 10240, magFifter), gl.texParameteri(3553, 10242, 33071), 
            gl.texParameteri(3553, 10243, 33071)), Render.isConchWebGL) switch (this._format) {
              case 6407:
              case 6408:
                gl.texImage2DEx(!0, 3553, 0, this._format, this._format, 5121, this._image);
                break;

              case WebGL.compressEtc1.COMPRESSED_RGB_ETC1_WEBGL:
                gl.compressedTexImage2D(3553, 0, this._format, this._w, this._h, 0, this._image);
            } else {
                switch (gl.pixelStorei(37441, !0), this._format) {
                  case 6407:
                  case 6408:
                    this._image instanceof Uint8Array ? gl.texImage2D(3553, 0, this._format, this._w, this._h, 0, this._format, 5121, this._image) : (6407 == this._format && this._w % 4 != 0 && (this._format = 6408), 
                    gl.texImage2D(3553, 0, this._format, this._format, 5121, this._image));
                    break;

                  case WebGL.compressEtc1.COMPRESSED_RGB_ETC1_WEBGL:
                    gl.compressedTexImage2D(3553, 0, this._format, this._w, this._h, 0, this._image);
                }
                gl.pixelStorei(37441, !1);
            }
            preTarget && preTexture && WebGLContext.bindTexture(gl, preTarget, preTexture), 
            this._image.onload = null, this._image = null, isPot && this.mipmap ? this.memorySize = this._w * this._h * 4 * (1 + 1 / 3) : this.memorySize = this._w * this._h * 4, 
            this._recreateLock = !1;
        }, __proto.recreateResource = function() {
            var _$this = this;
            if (null != this._src && "" !== this._src) if (this._needReleaseAgain = !1, this._image) {
                if (this._recreateLock) return;
                this._allowMerageInAtlas && this._$5__enableMerageInAtlas ? (this.memorySize = 0, 
                this._recreateLock = !1) : this._createWebGlTexture(), this.completeCreate();
            } else {
                this._recreateLock = !0;
                var _this = this;
                this._image = new Browser.window.Image(), this._image.crossOrigin = 0 == this._src.indexOf("data:") ? null : "", 
                this._image.onload = function() {
                    if (_this._needReleaseAgain) return _this._needReleaseAgain = !1, _this._image.onload = null, 
                    void (_this._image = null);
                    _this._allowMerageInAtlas && _this._enableMerageInAtlas ? (_$this.memorySize = 0, 
                    _$this._recreateLock = !1) : _this._createWebGlTexture(), _this.completeCreate();
                }, this._image.src = this._src;
            }
        }, __proto.disposeResource = function() {
            this._recreateLock && (this._needReleaseAgain = !0), this._source && WebGL.mainContext.deleteTexture(this._source), 
            this._source = null, this._image = null, this.memorySize = 0;
        }, __proto.onresize = function() {
            this._w = this._image.width, this._h = this._image.height, Laya.Browser.onMiniGame || (AtlasResourceManager.enabled && this._w < AtlasResourceManager.atlasLimitWidth && this._h < AtlasResourceManager.atlasLimitHeight ? this._allowMerageInAtlas = !0 : this._allowMerageInAtlas = !1);
        }, __proto.clearAtlasSource = function() {
            this._image = null;
        }, __getset(0, __proto, "format", function() {
            return this._format;
        }), __getset(0, __proto, "enableMerageInAtlas", function() {
            return this._$5__enableMerageInAtlas;
        }, function(value) {
            this._$5__enableMerageInAtlas = value;
        }), __getset(0, __proto, "mipmap", function() {
            return this._mipmap;
        }), __getset(0, __proto, "allowMerageInAtlas", function() {
            return this._allowMerageInAtlas;
        }), __getset(0, __proto, "atlasSource", function() {
            return this._image;
        }), __getset(0, __proto, "onload", null, function(value) {
            var _$this = this;
            this._onload = value, this._image && (this._image.onload = null != this._onload ? function() {
                _$this.onresize(), _$this._onload();
            } : null);
        }), __getset(0, __proto, "onerror", null, function(value) {
            var _$this = this;
            this._onerror = value, this._image && (this._image.onerror = null != this._onerror ? function() {
                _$this._onerror();
            } : null);
        }), WebGLImage;
    }();
    Laya.__init([ DrawText, AtlasGrid, WebGLContext2D, ShaderCompile ]);
}(window, document, Laya), "function" == typeof define && define.amd && define("laya.core", [ "arequire", "exports" ], function(arequire, exports) {
    "use strict";
    for (var i in Object.defineProperty(exports, "__esModule", {
        value: !0
    }), Laya) {
        var o = Laya[i];
        o && o.__isclass && (exports[i] = o);
    }
}), function(window, document, Laya) {
    Laya.un, Laya.uns;
    var __static = Laya.static, __class = Laya.class, __getset = Laya.getset, CSSStyle = (Laya.__newvec, 
    laya.utils.Browser, laya.display.css.CSSStyle), ClassUtils = laya.utils.ClassUtils, HTMLChar = (laya.events.Event, 
    laya.utils.HTMLChar), Loader = laya.net.Loader, Rectangle = (laya.display.Node, 
    laya.maths.Rectangle), Render = laya.renders.Render, Sprite = (laya.renders.RenderContext, 
    laya.renders.RenderSprite, laya.display.Sprite), Stat = laya.utils.Stat, Text = laya.display.Text, Texture = laya.resource.Texture, URL = laya.net.URL, Utils = laya.utils.Utils, HTMLParse = function() {
        function HTMLParse() {}
        return __class(HTMLParse, "laya.html.utils.HTMLParse"), HTMLParse.parse = function(ower, xmlString, url) {
            xmlString = (xmlString = "<root>" + (xmlString = xmlString.replace(/<br>/g, "<br/>")) + "</root>").replace(HTMLParse.spacePattern, HTMLParse.char255);
            var xml = Utils.parseXMLFromString(xmlString);
            HTMLParse._parseXML(ower, xml.childNodes[0].childNodes, url);
        }, HTMLParse._parseXML = function(parent, xml, url, href) {
            var i = 0, n = 0;
            if (xml.join || xml.item) for (i = 0, n = xml.length; i < n; ++i) HTMLParse._parseXML(parent, xml[i], url, href); else {
                var node, nodeName, txt;
                if (3 == xml.nodeType) return void (parent instanceof laya.html.dom.HTMLDivElement ? (null == xml.nodeName && (xml.nodeName = "#text"), 
                nodeName = xml.nodeName.toLowerCase(), 0 < (txt = xml.textContent.replace(/^\s+|\s+$/g, "")).length && (node = ClassUtils.getInstance(nodeName)) && (parent.addChild(node), 
                node.innerTEXT = txt.replace(HTMLParse.char255AndOneSpacePattern, " "))) : 0 < (txt = xml.textContent.replace(/^\s+|\s+$/g, "")).length && (parent.innerTEXT = txt.replace(HTMLParse.char255AndOneSpacePattern, " ")));
                if ("#comment" == (nodeName = xml.nodeName.toLowerCase())) return;
                if (node = ClassUtils.getInstance(nodeName)) {
                    (node = parent.addChild(node)).URI = url, node.href = href;
                    var attributes = xml.attributes;
                    if (attributes && 0 < attributes.length) for (i = 0, n = attributes.length; i < n; ++i) {
                        var attribute = attributes[i], attrName = attribute.nodeName, value = attribute.value;
                        node._setAttributes(attrName, value);
                    }
                    HTMLParse._parseXML(node, xml.childNodes, url, node.href);
                } else HTMLParse._parseXML(parent, xml.childNodes, url, href);
            }
        }, HTMLParse.char255 = String.fromCharCode(255), HTMLParse.spacePattern = /&nbsp;|&#160;/g, 
        HTMLParse.char255AndOneSpacePattern = new RegExp(String.fromCharCode(255) + "|(\\s+)", "g"), 
        HTMLParse;
    }(), Layout = function() {
        function Layout() {}
        return __class(Layout, "laya.html.utils.Layout"), Layout.later = function(element) {
            null == Layout._will && (Layout._will = [], Laya.stage.frameLoop(1, null, function() {
                if (!(Layout._will.length < 1)) {
                    for (var i = 0; i < Layout._will.length; i++) laya.html.utils.Layout.layout(Layout._will[i]);
                    Layout._will.length = 0;
                }
            })), Layout._will.push(element);
        }, Layout.layout = function(element) {
            if (!element || !element._style) return null;
            if (0 == (512 & element._style._type)) return null;
            element.getStyle()._type &= -513;
            var arr = Layout._multiLineLayout(element);
            return Render.isConchApp && element.layaoutCallNative && element.layaoutCallNative(), 
            arr;
        }, Layout._multiLineLayout = function(element) {
            if (Text.RightToLeft) return Layout._multiLineLayout2(element);
            var elements = new Array();
            element._addChildsToLayout(elements);
            var oneLayout, curStyle, curPadding, htmlWord, sprite, i = 0, n = elements.length, style = element._getCSSStyle(), letterSpacing = style.letterSpacing, leading = style.leading, lineHeight = style.lineHeight, widthAuto = style._widthAuto() || !style.wordWrap, width = widthAuto ? 999999 : element.width, maxWidth = (element.height, 
            0), exWidth = style.italic ? style.fontSize / 3 : 0, align = style._getAlign(), valign = style._getValign(), endAdjust = 0 !== valign || 0 !== align || 0 != lineHeight, x = 0, y = 0, w = 0, h = 0, lines = new Array(), curLine = lines[0] = new LayoutLine(), newLine = !1, nextNewline = !1;
            curLine.h = 0, style.italic && (width -= style.fontSize / 3);
            var tWordWidth = 0, tLineFirstKey = !0;
            function addLine() {
                curLine.y = y, y += curLine.h + leading, 0 == curLine.h && (y += lineHeight), curLine.mWidth = tWordWidth, 
                tWordWidth = 0, curLine = new LayoutLine(), lines.push(curLine), curLine.h = 0, 
                newLine = !(tLineFirstKey = !(x = 0));
            }
            for (i = 0; i < n; i++) if (null != (oneLayout = elements[i])) if (tLineFirstKey = !1, 
            oneLayout instanceof laya.html.dom.HTMLBrElement) addLine(), curLine.y = y; else {
                if (oneLayout._isChar()) {
                    if ((htmlWord = oneLayout).isWord) newLine = nextNewline || "\n" === htmlWord.char, 
                    curLine.wordStartIndex = curLine.elements.length; else {
                        if (0 < lines.length && width < x + w && 0 < curLine.wordStartIndex) {
                            var tLineWord;
                            tLineWord = curLine.elements.length - curLine.wordStartIndex + 1, curLine.elements.length = curLine.wordStartIndex, 
                            i -= tLineWord, addLine();
                            continue;
                        }
                        newLine = !1, tWordWidth += htmlWord.width;
                    }
                    w = htmlWord.width + letterSpacing, h = htmlWord.height, nextNewline = !1, (newLine = newLine || width < x + w) && addLine(), 
                    curLine.minTextHeight = Math.min(curLine.minTextHeight, oneLayout.height);
                } else curStyle = oneLayout._getCSSStyle(), sprite = oneLayout, curPadding = curStyle.padding, 
                0 === curStyle._getCssFloat() || (endAdjust = !0), newLine = nextNewline || curStyle.lineElement, 
                w = sprite.width * sprite._style._tf.scaleX + curPadding[1] + curPadding[3] + letterSpacing, 
                h = sprite.height * sprite._style._tf.scaleY + curPadding[0] + curPadding[2], nextNewline = curStyle.lineElement, 
                (newLine = newLine || width < x + w && curStyle.wordWrap) && addLine();
                curLine.elements.push(oneLayout), curLine.h = Math.max(curLine.h, h), oneLayout.x = x, 
                oneLayout.y = y, x += w, curLine.w = x - letterSpacing, curLine.y = y, maxWidth = Math.max(x + exWidth, maxWidth);
            } else tLineFirstKey || (x += Layout.DIV_ELEMENT_PADDING), curLine.wordStartIndex = curLine.elements.length;
            if (y = curLine.y + curLine.h, endAdjust) {
                var tY = 0, tWidth = width;
                for (widthAuto && 0 < element.width && (tWidth = element.width), i = 0, n = lines.length; i < n; i++) lines[i].updatePos(0, tWidth, i, tY, align, valign, lineHeight), 
                tY += Math.max(lineHeight, lines[i].h + leading);
                y = tY;
            }
            return widthAuto && (element.width = maxWidth), y > element.height && (element.height = y), 
            [ maxWidth, y ];
        }, Layout._multiLineLayout2 = function(element) {
            var elements = new Array();
            element._addChildsToLayout(elements);
            var oneLayout, curStyle, curPadding, htmlWord, sprite, i = 0, n = elements.length, style = element._getCSSStyle(), letterSpacing = style.letterSpacing, leading = style.leading, lineHeight = style.lineHeight, widthAuto = style._widthAuto() || !style.wordWrap, width = widthAuto ? 999999 : element.width, maxWidth = (element.height, 
            0), exWidth = style.italic ? style.fontSize / 3 : 0, align = 2 - style._getAlign(), valign = style._getValign(), endAdjust = 0 !== valign || 0 != align || 0 != lineHeight, x = 0, y = 0, w = 0, h = 0, lines = new Array(), curLine = lines[0] = new LayoutLine(), newLine = !1, nextNewline = !1;
            curLine.h = 0, style.italic && (width -= style.fontSize / 3);
            var tWordWidth = 0, tLineFirstKey = !0;
            function addLine() {
                curLine.y = y, y += curLine.h + leading, 0 == curLine.h && (y += lineHeight), curLine.mWidth = tWordWidth, 
                tWordWidth = 0, curLine = new LayoutLine(), lines.push(curLine), curLine.h = 0, 
                newLine = !(tLineFirstKey = !(x = 0));
            }
            for (i = 0; i < n; i++) if (null != (oneLayout = elements[i])) if (tLineFirstKey = !1, 
            oneLayout instanceof laya.html.dom.HTMLBrElement) addLine(), curLine.y = y; else {
                if (oneLayout._isChar()) {
                    if ((htmlWord = oneLayout).isWord) newLine = nextNewline || "\n" === htmlWord.char, 
                    curLine.wordStartIndex = curLine.elements.length; else {
                        if (0 < lines.length && width < x + w && 0 < curLine.wordStartIndex) {
                            var tLineWord;
                            tLineWord = curLine.elements.length - curLine.wordStartIndex + 1, curLine.elements.length = curLine.wordStartIndex, 
                            i -= tLineWord, addLine();
                            continue;
                        }
                        newLine = !1, tWordWidth += htmlWord.width;
                    }
                    w = htmlWord.width + letterSpacing, h = htmlWord.height, nextNewline = !1, (newLine = newLine || width < x + w) && addLine(), 
                    curLine.minTextHeight = Math.min(curLine.minTextHeight, oneLayout.height);
                } else curStyle = oneLayout._getCSSStyle(), sprite = oneLayout, curPadding = curStyle.padding, 
                0 === curStyle._getCssFloat() || (endAdjust = !0), newLine = nextNewline || curStyle.lineElement, 
                w = sprite.width * sprite._style._tf.scaleX + curPadding[1] + curPadding[3] + letterSpacing, 
                h = sprite.height * sprite._style._tf.scaleY + curPadding[0] + curPadding[2], nextNewline = curStyle.lineElement, 
                (newLine = newLine || width < x + w && curStyle.wordWrap) && addLine();
                curLine.elements.push(oneLayout), curLine.h = Math.max(curLine.h, h), oneLayout.x = x, 
                oneLayout.y = y, x += w, curLine.w = x - letterSpacing, curLine.y = y, maxWidth = Math.max(x + exWidth, maxWidth);
            } else tLineFirstKey || (x += Layout.DIV_ELEMENT_PADDING), curLine.wordStartIndex = curLine.elements.length;
            if (y = curLine.y + curLine.h, endAdjust) {
                var tY = 0, tWidth = width;
                for (i = 0, n = lines.length; i < n; i++) lines[i].updatePos(0, tWidth, i, tY, align, valign, lineHeight), 
                tY += Math.max(lineHeight, lines[i].h + leading);
                y = tY;
            }
            for (widthAuto && (element.width = maxWidth), y > element.height && (element.height = y), 
            i = 0, n = lines.length; i < n; i++) lines[i].revertOrder(width);
            return [ maxWidth, y ];
        }, Layout._will = null, Layout.DIV_ELEMENT_PADDING = 0, Layout;
    }(), LayoutLine = function() {
        function LayoutLine() {
            this.x = 0, this.y = 0, this.w = 0, this.h = 0, this.wordStartIndex = 0, this.minTextHeight = 99999, 
            this.mWidth = 0, this.elements = new Array();
        }
        __class(LayoutLine, "laya.html.utils.LayoutLine");
        var __proto = LayoutLine.prototype;
        return __proto.updatePos = function(left, width, lineNum, dy, align, valign, lineHeight) {
            var one, w = 0;
            0 < this.elements.length && (w = (one = this.elements[this.elements.length - 1]).x + one.width - this.elements[0].x);
            var dx = 0, ddy = NaN;
            1 === align && (dx = (width - w) / 2), 2 === align && (dx = width - w), 0 === lineHeight || 0 != valign || (valign = 1);
            for (var i = 0, n = this.elements.length; i < n; i++) {
                var tCSSStyle = (one = this.elements[i])._getCSSStyle();
                switch (0 !== dx && (one.x += dx), tCSSStyle._getValign()) {
                  case 0:
                    one.y = dy;
                    break;

                  case 1:
                    var tMinTextHeight = 0;
                    99999 != this.minTextHeight && (tMinTextHeight = this.minTextHeight);
                    var tBottomLineY = (tMinTextHeight + lineHeight) / 2;
                    tBottomLineY = Math.max(tBottomLineY, this.h), ddy = (laya.html.dom.HTMLImageElement, 
                    dy + tBottomLineY - one.height), one.y = ddy;
                    break;

                  case 2:
                    one.y = dy + (lineHeight - one.height);
                }
            }
        }, __proto.revertOrder = function(width) {
            var one;
            if (0 < this.elements.length) {
                var len, i = 0;
                for (len = this.elements.length, i = 0; i < len; i++) (one = this.elements[i]).x = width - one.x - one.width;
            }
        }, LayoutLine;
    }(), HTMLElement = function(_super) {
        function HTMLElement() {
            this.URI = null, this._href = null, HTMLElement.__super.call(this), this._text = HTMLElement._EMPTYTEXT, 
            this.setStyle(new CSSStyle(this)), this._getCSSStyle().valign = "middle", this.mouseEnabled = !0;
        }
        __class(HTMLElement, "laya.html.dom.HTMLElement", _super);
        var __proto = HTMLElement.prototype;
        return __proto.layaoutCallNative = function() {
            var n = 0;
            if (this._childs && 0 < (n = this._childs.length)) for (var i = 0; i < n; i++) this._childs[i].layaoutCallNative && this._childs[i].layaoutCallNative();
            var word = this._getWords();
            word ? laya.html.dom.HTMLElement.fillWords(this, word, 0, 0, this.style.font, this.style.color, this.style.underLine) : this.graphics.clear();
        }, __proto.appendChild = function(c) {
            return this.addChild(c);
        }, __proto._getWords2 = function() {
            var txt = this._text.text;
            if (!txt || 0 === txt.length) return null;
            var realWords, drawWords, i = 0, n = 0;
            if (this._text.drawWords) drawWords = this._text.drawWords; else {
                for (n = (realWords = txt.split(" ")).length - 1, drawWords = [], i = 0; i < n; i++) drawWords.push(realWords[i], " ");
                0 <= n && drawWords.push(realWords[n]), this._text.drawWords = drawWords;
            }
            var size, words = this._text.words;
            if (words && words.length === drawWords.length) return words;
            null === words && (this._text.words = words = []), words.length = drawWords.length;
            var style = this.style, fontStr = style.font;
            for (i = 0, n = drawWords.length; i < n; i++) {
                size = Utils.measureText(drawWords[i], fontStr);
                var tHTMLChar = words[i] = new HTMLChar(drawWords[i], size.width, size.height || style.fontSize, style);
                if (1 < tHTMLChar.char.length && (tHTMLChar.charNum = tHTMLChar.char), this.href) {
                    var tSprite = new Sprite();
                    this.addChild(tSprite), tHTMLChar.setSprite(tSprite);
                }
            }
            return words;
        }, __proto._getWords = function() {
            if (!Text.CharacterCache) return this._getWords2();
            var txt = this._text.text;
            if (!txt || 0 === txt.length) return null;
            var size, words = this._text.words;
            if (words && words.length === txt.length) return words;
            null === words && (this._text.words = words = []), words.length = txt.length;
            for (var style = this.style, fontStr = style.font, i = 0, n = txt.length; i < n; i++) {
                size = Utils.measureText(txt.charAt(i), fontStr);
                var tHTMLChar = words[i] = new HTMLChar(txt.charAt(i), size ? size.width : style.fontSize, size && size.height || style.fontSize, style);
                if (this.href) {
                    var tSprite = new Sprite();
                    this.addChild(tSprite), tHTMLChar.setSprite(tSprite);
                }
            }
            return words;
        }, __proto.showLinkSprite = function() {
            var words = this._text.words;
            if (words) for (var tSprite, tHtmlChar, tLinkSpriteList = [], i = 0; i < words.length; i++) tHtmlChar = words[i], 
            (tSprite = new Sprite()).graphics.drawRect(0, 0, tHtmlChar.width, tHtmlChar.height, "#ff0000"), 
            tSprite.width = tHtmlChar.width, tSprite.height = tHtmlChar.height, this.addChild(tSprite), 
            tLinkSpriteList.push(tSprite);
        }, __proto._layoutLater = function() {
            var style = this.style;
            512 & style._type || (style.widthed(this) && (0 < this._childs.length || null != this._getWords()) && style.block ? (Layout.later(this), 
            style._type |= 512) : this.parent && this.parent._layoutLater());
        }, __proto._setAttributes = function(name, value) {
            switch (name) {
              case "style":
                return void this.style.cssText(value);

              case "class":
                return void (this.className = value);
            }
            _super.prototype._setAttributes.call(this, name, value);
        }, __proto.updateHref = function() {
            if (null != this._href) {
                var words = this._getWords();
                if (words) for (var tHTMLChar, tSprite, i = 0; i < words.length; i++) (tSprite = (tHTMLChar = words[i]).getSprite()) && (tSprite.size(tHTMLChar.width, tHTMLChar.height), 
                tSprite.on("click", this, this.onLinkHandler));
            }
        }, __proto.onLinkHandler = function(e) {
            switch (e.type) {
              case "click":
                for (var target = this; target; ) target.event("link", [ this.href ]), target = target.parent;
            }
        }, __proto.formatURL = function(url) {
            return this.URI ? URL.formatURL(url, this.URI ? this.URI.path : null) : url;
        }, __getset(0, __proto, "href", function() {
            return this._href;
        }, function(url) {
            null != (this._href = url) && (this._getCSSStyle().underLine = 1, this.updateHref());
        }), __getset(0, __proto, "color", null, function(value) {
            this.style.color = value;
        }), __getset(0, __proto, "onClick", null, function(value) {
            Laya._runScript("fn=function(event){" + value + ";}"), this.on("click", this, void 0);
        }), __getset(0, __proto, "id", null, function(value) {
            HTMLDocument.document.setElementById(value, this);
        }), __getset(0, __proto, "innerTEXT", function() {
            return this._text.text;
        }, function(value) {
            this.text = value;
        }), __getset(0, __proto, "style", function() {
            return this._style;
        }), __getset(0, __proto, "text", function() {
            return this._text.text;
        }, function(value) {
            this._text == HTMLElement._EMPTYTEXT ? this._text = {
                text: value,
                words: null
            } : (this._text.text = value, this._text.words && (this._text.words.length = 0)), 
            Render.isConchApp && this.layaoutCallNative(), this._renderType |= 2048, this.repaint(), 
            this.updateHref();
        }), __getset(0, __proto, "parent", _super.prototype._$get_parent, function(value) {
            if (value instanceof laya.html.dom.HTMLElement) {
                var p = value;
                this.URI || (this.URI = p.URI), this.style.inherit(p.style);
            }
            Laya.superSet(Sprite, this, "parent", value);
        }), __getset(0, __proto, "className", null, function(value) {
            this.style.attrs(HTMLDocument.document.styleSheets["." + value]);
        }), HTMLElement.fillWords = function(ele, words, x, y, font, color, underLine) {
            ele.graphics.clear();
            for (var i = 0, n = words.length; i < n; i++) {
                var a = words[i];
                ele.graphics.fillText(a.char, a.x + x, a.y + y, font, color, "left", underLine);
            }
        }, HTMLElement._EMPTYTEXT = {
            text: null,
            words: null
        }, HTMLElement;
    }(Sprite), HTMLDivElement = (function(_super) {
        function HTMLBrElement() {
            HTMLBrElement.__super.call(this), this.style.lineElement = !0, this.style.block = !0;
        }
        __class(HTMLBrElement, "laya.html.dom.HTMLBrElement", HTMLElement);
    }(), function(_super) {
        function HTMLDivElement() {
            this.contextHeight = NaN, this.contextWidth = NaN, HTMLDivElement.__super.call(this), 
            this.style.block = !0, this.style.lineElement = !0, this.style.width = 200, this.style.height = 200;
        }
        __class(HTMLDivElement, "laya.html.dom.HTMLDivElement", _super);
        var __proto = HTMLDivElement.prototype;
        return __proto.appendHTML = function(text) {
            HTMLParse.parse(this, text, this.URI), this.layout();
        }, __proto._addChildsToLayout = function(out) {
            var words = this._getWords();
            if (null == words && 0 == this._childs.length) return !1;
            words && words.forEach(function(o) {
                out.push(o);
            });
            for (var tFirstKey = !0, i = 0, len = this._childs.length; i < len; i++) {
                var o = this._childs[i];
                tFirstKey ? tFirstKey = !1 : out.push(null), o._addToLayout(out);
            }
            return !0;
        }, __proto._addToLayout = function(out) {
            this.layout();
        }, __proto.layout = function() {
            if (this.style) {
                this.style._type |= 512;
                var tArray = Layout.layout(this);
                if (tArray) {
                    this._$P.mHtmlBounds || this._set$P("mHtmlBounds", new Rectangle());
                    var tRectangle = this._$P.mHtmlBounds;
                    tRectangle.x = tRectangle.y = 0, tRectangle.width = this.contextWidth = tArray[0], 
                    tRectangle.height = this.contextHeight = tArray[1], this.setBounds(tRectangle);
                }
            }
        }, __getset(0, __proto, "height", function() {
            return this._height ? this._height : this.contextHeight;
        }, _super.prototype._$set_height), __getset(0, __proto, "innerHTML", null, function(text) {
            this.destroyChildren(), this.appendHTML(text);
        }), __getset(0, __proto, "width", function() {
            return this._width ? this._width : this.contextWidth;
        }, function(value) {
            var changed = !1;
            changed = 0 === value ? value != this._width : value != this.width, Laya.superSet(HTMLElement, this, "width", value), 
            changed && this.layout();
        }), HTMLDivElement;
    }(HTMLElement)), HTMLDocument = function(_super) {
        function HTMLDocument() {
            this.all = new Array(), this.styleSheets = CSSStyle.styleSheets, HTMLDocument.__super.call(this);
        }
        __class(HTMLDocument, "laya.html.dom.HTMLDocument", HTMLElement);
        var __proto = HTMLDocument.prototype;
        return __proto.getElementById = function(id) {
            return this.all[id];
        }, __proto.setElementById = function(id, e) {
            this.all[id] = e;
        }, __static(HTMLDocument, [ "document", function() {
            return this.document = new HTMLDocument();
        } ]), HTMLDocument;
    }();
    (function(_super) {
        function HTMLImageElement() {
            this._tex = null, this._url = null, this._renderArgs = [], HTMLImageElement.__super.call(this), 
            this.style.block = !0;
        }
        __class(HTMLImageElement, "laya.html.dom.HTMLImageElement", HTMLElement);
        var __proto = HTMLImageElement.prototype;
        __proto._addToLayout = function(out) {
            !this._style.absolute && out.push(this);
        }, __proto.render = function(context, x, y) {
            !this._tex || !this._tex.loaded || !this._tex.loaded || this._width < 1 || this._height < 1 || (Stat.spriteCount++, 
            this._renderArgs[0] = this._tex, this._renderArgs[1] = this.x, this._renderArgs[2] = this.y, 
            this._renderArgs[3] = this.width || this._tex.width, this._renderArgs[4] = this.height || this._tex.height, 
            context.ctx.drawTexture2(x, y, this.style.translateX, this.style.translateY, this.transform, this.style.alpha, this.style.blendMode, this._renderArgs));
        }, __proto.layaoutCallNative = function() {
            var n = 0;
            if (this._childs && 0 < (n = this._childs.length)) for (var i = 0; i < n; i++) this._childs[i].layaoutCallNative && this._childs[i].layaoutCallNative();
        }, __getset(0, __proto, "width", function() {
            return this.autoSize ? this.getSelfBounds().width : this._width;
        }, function(value) {
            this._width !== value && (this._width = value, this._style.width = value, this.repaint());
        }), __getset(0, __proto, "height", function() {
            return this.autoSize ? this.getSelfBounds().height : this._height;
        }, function(value) {
            this._height !== value && (this._height = value, this._style.height = value, this.repaint());
        }), __proto.destroy = function() {
            null != this._tex && (this._tex.off("loaded", this, this.onloaded), Loader.clearCache(this, this._url), 
            this._tex = null), HTMLElement.prototype.destroy.call(this);
        }, __proto.onloaded = function() {
            var style = this._style;
            style.widthed(this) || this._width == this._tex.width || (this.width = this._tex.width, 
            this.parent && this.parent._layoutLater()), style.heighted(this) || this._height == this._tex.height || (this.height = this._tex.height, 
            this.parent && this.parent._layoutLater()), Render.isConchApp && (this._renderArgs[0] = this._tex, 
            this._renderArgs[1] = this.x, this._renderArgs[2] = this.y, this._renderArgs[3] = this.width || this._tex.width, 
            this._renderArgs[4] = this.height || this._tex.height, this.graphics.drawTexture(this._tex, 0, 0, this._renderArgs[3], this._renderArgs[4])), 
            this.repaint(), this.parentRepaint();
        }, __getset(0, __proto, "src", null, function(url) {
            if (url = this.formatURL(url), this._url != url) {
                this._tex && (!this._tex.loaded && this._tex.off("loaded", this, this.onloaded), 
                Loader.clearCache(this, this._url)), this._url = url, Loader.keepCache(this, url);
                var tex = this._tex = Loader.getRes(url);
                tex || (this._tex = tex = Laya.loader.create(url, null, null, Texture)), tex.loaded ? this.onloaded() : tex.once("loaded", this, this.onloaded);
            }
        });
    })(), function(_super) {
        function HTMLLinkElement() {
            this.type = null, HTMLLinkElement.__super.call(this), this.visible = !1;
        }
        __class(HTMLLinkElement, "laya.html.dom.HTMLLinkElement", _super);
        var __proto = HTMLLinkElement.prototype;
        __proto._onload = function(data) {
            switch (this.type) {
              case "text/css":
                CSSStyle.parseCSS(data, this.URI);
            }
        }, __getset(0, __proto, "href", _super.prototype._$get_href, function(url) {
            var _$this = this;
            url = this.formatURL(url), this.URI = new URL(url);
            var l = new Loader();
            l.once("complete", null, function(data) {
                _$this._onload(data);
            }), l.load(url, "text");
        }), HTMLLinkElement._cuttingStyle = new RegExp("((@keyframes[\\s\\t]+|)(.+))[\\t\\n\\r\\s]*{", "g");
    }(HTMLElement), function(_super) {
        function HTMLStyleElement() {
            HTMLStyleElement.__super.call(this), this.visible = !1;
        }
        __class(HTMLStyleElement, "laya.html.dom.HTMLStyleElement", _super), __getset(0, HTMLStyleElement.prototype, "text", _super.prototype._$get_text, function(value) {
            CSSStyle.parseCSS(value, null);
        });
    }(HTMLElement), function(_super) {
        function HTMLIframeElement() {
            HTMLIframeElement.__super.call(this), this._getCSSStyle().valign = "middle";
        }
        __class(HTMLIframeElement, "laya.html.dom.HTMLIframeElement", _super), __getset(0, HTMLIframeElement.prototype, "href", _super.prototype._$get_href, function(url) {
            var _$this = this;
            url = this.formatURL(url);
            var l = new Loader();
            l.once("complete", null, function(data) {
                var pre = _$this.URI;
                _$this.URI = new URL(url), _$this.innerHTML = data, !pre || (_$this.URI = pre);
            }), l.load(url, "text");
        });
    }(HTMLDivElement);
}(window, document, Laya), "function" == typeof define && define.amd && define("laya.core", [ "arequire", "exports" ], function(arequire, exports) {
    "use strict";
    for (var i in Object.defineProperty(exports, "__esModule", {
        value: !0
    }), Laya) {
        var o = Laya[i];
        o && o.__isclass && (exports[i] = o);
    }
}), function(window, document, Laya) {
    Laya.un, Laya.uns;
    var __static = Laya.static, __class = Laya.class, __getset = Laya.getset, Animation = (Laya.__newvec, 
    laya.display.Animation), ClassUtils = (laya.utils.Browser, laya.utils.ClassUtils), ColorFilter = laya.filters.ColorFilter, Ease = laya.utils.Ease, Event = laya.events.Event, Font = (laya.events.EventDispatcher, 
    laya.display.css.Font), FrameAnimation = laya.display.FrameAnimation, Graphics = laya.display.Graphics, Handler = laya.utils.Handler, Input = laya.display.Input, Loader = laya.net.Loader, Point = (laya.display.Node, 
    laya.maths.Point), Rectangle = laya.maths.Rectangle, Render = laya.renders.Render, Sprite = laya.display.Sprite, Text = laya.display.Text, Texture = laya.resource.Texture, Tween = laya.utils.Tween, Utils = laya.utils.Utils, WeakObject = laya.utils.WeakObject;
    Laya.interface("laya.ui.IItem"), Laya.interface("laya.ui.ISelect"), Laya.interface("laya.ui.IRender"), 
    Laya.interface("laya.ui.IComponent"), Laya.interface("laya.ui.IBox", "IComponent");
    var LayoutStyle = function() {
        function LayoutStyle() {
            this.enable = !1, this.top = NaN, this.bottom = NaN, this.left = NaN, this.right = NaN, 
            this.centerX = NaN, this.centerY = NaN, this.anchorX = NaN, this.anchorY = NaN;
        }
        return __class(LayoutStyle, "laya.ui.LayoutStyle"), __static(LayoutStyle, [ "EMPTY", function() {
            return this.EMPTY = new LayoutStyle();
        } ]), LayoutStyle;
    }(), Styles = function() {
        function Styles() {}
        return __class(Styles, "laya.ui.Styles"), Styles.labelColor = "#000000", Styles.buttonStateNum = 3, 
        Styles.scrollBarMinNum = 15, Styles.scrollBarDelayTime = 500, __static(Styles, [ "defaultSizeGrid", function() {
            return this.defaultSizeGrid = [ 4, 4, 4, 4, 0 ];
        }, "labelPadding", function() {
            return this.labelPadding = [ 2, 2, 2, 2 ];
        }, "inputLabelPadding", function() {
            return this.inputLabelPadding = [ 1, 1, 1, 3 ];
        }, "buttonLabelColors", function() {
            return this.buttonLabelColors = [ "#32556b", "#32cc6b", "#ff0000", "#C0C0C0" ];
        }, "comboBoxItemColors", function() {
            return this.comboBoxItemColors = [ "#5e95b6", "#ffffff", "#000000", "#8fa4b1", "#ffffff" ];
        } ]), Styles;
    }(), UIUtils = function() {
        function UIUtils() {}
        return __class(UIUtils, "laya.ui.UIUtils"), UIUtils.fillArray = function(arr, str, type) {
            var temp = arr.concat();
            if (str) for (var a = str.split(","), i = 0, n = Math.min(temp.length, a.length); i < n; i++) {
                var value = a[i];
                temp[i] = "true" == value || "false" != value && value, null != type && (temp[i] = type(value));
            }
            return temp;
        }, UIUtils.toColor = function(color) {
            return Utils.toHexColor(color);
        }, UIUtils.gray = function(traget, isGray) {
            void 0 === isGray && (isGray = !0), isGray ? UIUtils.addFilter(traget, UIUtils.grayFilter) : UIUtils.clearFilter(traget, ColorFilter);
        }, UIUtils.addFilter = function(target, filter) {
            var filters = target.filters || [];
            filters.push(filter), target.filters = filters;
        }, UIUtils.clearFilter = function(target, filterType) {
            var filters = target.filters;
            if (null != filters && 0 < filters.length) {
                for (var i = filters.length - 1; -1 < i; i--) {
                    var filter = filters[i];
                    Laya.__typeof(filter, filterType) && filters.splice(i, 1);
                }
                target.filters = filters;
            }
        }, UIUtils._getReplaceStr = function(word) {
            return UIUtils.escapeSequence[word];
        }, UIUtils.adptString = function(str) {
            return str.replace(/\\(\w)/g, UIUtils._getReplaceStr);
        }, UIUtils.getBindFun = function(value) {
            var fun = UIUtils._funMap.get(value);
            if (null == fun) {
                var temp = '"' + value + '"', str = "(function(data){if(data==null)return;with(data){try{\nreturn " + (temp = temp.replace(/^"\${|}"$/g, "").replace(/\${/g, '"+').replace(/}/g, '+"')) + "\n}catch(e){}}})";
                fun = Laya._runScript(str), UIUtils._funMap.set(value, fun);
            }
            return fun;
        }, __static(UIUtils, [ "grayFilter", function() {
            return this.grayFilter = new ColorFilter([ .3086, .6094, .082, 0, 0, .3086, .6094, .082, 0, 0, .3086, .6094, .082, 0, 0, 0, 0, 0, 1, 0 ]);
        }, "escapeSequence", function() {
            return this.escapeSequence = {
                "\\n": "\n",
                "\\t": "\t"
            };
        }, "_funMap", function() {
            return this._funMap = new WeakObject();
        } ]), UIUtils;
    }(), UIConfig = function() {
        function UIConfig() {}
        return __class(UIConfig, "UIConfig"), UIConfig.touchScrollEnable = !0, UIConfig.mouseWheelEnable = !0, 
        UIConfig.showButtons = !0, UIConfig.popupBgColor = "#000000", UIConfig.popupBgAlpha = .5, 
        UIConfig.closeDialogOnSide = !0, UIConfig;
    }(), AutoBitmap = function(_super) {
        function AutoBitmap() {
            this.autoCacheCmd = !0, this._width = 0, this._height = 0, this._source = null, 
            this._sizeGrid = null, this._isChanged = !1, this._offset = null, AutoBitmap.__super.call(this), 
            this._weakKeys = [];
        }
        __class(AutoBitmap, "laya.ui.AutoBitmap", _super);
        var __proto = AutoBitmap.prototype;
        return __proto.destroy = function() {
            if (Loader.clearObject(this, this._weakKey), this._weakKeys) {
                for (var i = 0, length = this._weakKeys.length; i < length; ++i) Loader.clearObject(this, this._weakKeys[i]);
                this._weakKeys = null;
            }
            _super.prototype.destroy.call(this), this._source = null, this._sizeGrid = null, 
            this._offset = null;
        }, __proto._setChanged = function() {
            this._isChanged || (this._isChanged = !0, Laya.timer.callLater(this, this.changeSource));
        }, __proto.changeSource = function() {
            this._isChanged = !1;
            var source = this._source;
            if (source && source.bitmap) {
                var width = this.width, height = this.height, sizeGrid = this._sizeGrid, sw = source.sourceWidth, sh = source.sourceHeight;
                if (!sizeGrid || sw === width && sh === height) this.cleanByTexture(source, this._offset ? this._offset[0] : 0, this._offset ? this._offset[1] : 0, width, height); else {
                    Loader.clearObject(this, this._weakKey), source.$_GID || (source.$_GID = Utils.getGID());
                    var key = source.$_GID + "." + width + "." + height + "." + sizeGrid.join("."), cmds = Loader.findObject(key);
                    if (Utils.isOKCmdList(cmds)) return this._weakKey = key, Loader.keepObject(this, this._weakKey), 
                    void (this.cmds = cmds);
                    this.clear();
                    var t, weakKey, top = sizeGrid[0], right = sizeGrid[1], bottom = sizeGrid[2], left = sizeGrid[3], repeat = sizeGrid[4], needClip = !1;
                    if (width == sw && (left = right = 0), height == sh && (top = bottom = 0), width < left + right) {
                        var clipWidth = width;
                        needClip = !0, width = left + right, this.save(), this.clipRect(0, 0, clipWidth, height);
                    }
                    left && top && (t = AutoBitmap.getTexture(source, 0, 0, left, top), weakKey = this._weakKeys[0], 
                    t ? (weakKey != t.weakKey && (Loader.clearObject(this, weakKey), Loader.keepObject(this, t.weakKey), 
                    this._weakKeys[0] = t.weakKey), this.drawTexture(t, 0, 0, left, top)) : (Loader.clearObject(this, weakKey), 
                    this._weakKeys[0] = "")), right && top && (t = AutoBitmap.getTexture(source, sw - right, 0, right, top), 
                    weakKey = this._weakKeys[1], t ? (weakKey != t.weakKey && (Loader.clearObject(this, weakKey), 
                    Loader.keepObject(this, t.weakKey), this._weakKeys[1] = t.weakKey), this.drawTexture(t, width - right, 0, right, top)) : (Loader.clearObject(this, weakKey), 
                    this._weakKeys[1] = "")), left && bottom && (t = AutoBitmap.getTexture(source, 0, sh - bottom, left, bottom), 
                    weakKey = this._weakKeys[2], t ? (weakKey != t.weakKey && (Loader.clearObject(this, weakKey), 
                    Loader.keepObject(this, t.weakKey), this._weakKeys[2] = t.weakKey), this.drawTexture(t, 0, height - bottom, left, bottom)) : (Loader.clearObject(this, weakKey), 
                    this._weakKeys[2] = "")), right && bottom && (t = AutoBitmap.getTexture(source, sw - right, sh - bottom, right, bottom), 
                    weakKey = this._weakKeys[3], t ? (weakKey != t.weakKey && (Loader.clearObject(this, weakKey), 
                    Loader.keepObject(this, t.weakKey), this._weakKeys[3] = t.weakKey), this.drawTexture(t, width - right, height - bottom, right, bottom)) : (Loader.clearObject(this, weakKey), 
                    this._weakKeys[3] = "")), top && (t = AutoBitmap.getTexture(source, left, 0, sw - left - right, top), 
                    weakKey = this._weakKeys[4], t ? (weakKey != t.weakKey && (Loader.clearObject(this, weakKey), 
                    Loader.keepObject(this, t.weakKey), this._weakKeys[4] = t.weakKey), this.drawBitmap(repeat, t, left, 0, width - left - right, top)) : (Loader.clearObject(this, weakKey), 
                    this._weakKeys[4] = "")), bottom && (t = AutoBitmap.getTexture(source, left, sh - bottom, sw - left - right, bottom), 
                    weakKey = this._weakKeys[5], t ? (weakKey != t.weakKey && (Loader.clearObject(this, weakKey), 
                    Loader.keepObject(this, t.weakKey), this._weakKeys[5] = t.weakKey), this.drawBitmap(repeat, t, left, height - bottom, width - left - right, bottom)) : (Loader.clearObject(this, weakKey), 
                    this._weakKeys[5] = "")), left && (t = AutoBitmap.getTexture(source, 0, top, left, sh - top - bottom), 
                    weakKey = this._weakKeys[6], t ? (weakKey != t.weakKey && (Loader.clearObject(this, weakKey), 
                    Loader.keepObject(this, t.weakKey), this._weakKeys[6] = t.weakKey), this.drawBitmap(repeat, t, 0, top, left, height - top - bottom)) : (Loader.clearObject(this, weakKey), 
                    this._weakKeys[6] = "")), right && (t = AutoBitmap.getTexture(source, sw - right, top, right, sh - top - bottom), 
                    weakKey = this._weakKeys[7], t ? (weakKey != t.weakKey && (Loader.clearObject(this, weakKey), 
                    Loader.keepObject(this, t.weakKey), this._weakKeys[7] = t.weakKey), this.drawBitmap(repeat, t, width - right, top, right, height - top - bottom)) : (Loader.clearObject(this, weakKey), 
                    this._weakKeys[7] = "")), t = AutoBitmap.getTexture(source, left, top, sw - left - right, sh - top - bottom), 
                    weakKey = this._weakKeys[8], t ? (weakKey != t.weakKey && (Loader.clearObject(this, weakKey), 
                    Loader.keepObject(this, t.weakKey), this._weakKeys[8] = t.weakKey), this.drawBitmap(repeat, t, left, top, width - left - right, height - top - bottom)) : (Loader.clearObject(this, weakKey), 
                    this._weakKeys[8] = ""), needClip && this.restore(), this.autoCacheCmd && !Render.isConchApp && (Loader.saveObject(key, this.cmds, null), 
                    this._weakKey = key, Loader.keepObject(this, this._weakKey));
                }
                this._repaint();
            }
        }, __proto.drawBitmap = function(repeat, tex, x, y, width, height) {
            void 0 === width && (width = 0), void 0 === height && (height = 0), width < .1 || height < .1 || (!repeat || tex.width == width && tex.height == height ? this.drawTexture(tex, x, y, width, height) : this.fillTexture(tex, x, y, width, height));
        }, __proto.clear = function(recoverCmds) {
            void 0 === recoverCmds && (recoverCmds = !0), _super.prototype.clear.call(this, !1);
        }, __getset(0, __proto, "sizeGrid", function() {
            return this._sizeGrid;
        }, function(value) {
            this._sizeGrid = value, this._setChanged();
        }), __getset(0, __proto, "width", function() {
            return this._width ? this._width : this._source ? this._source.sourceWidth : 0;
        }, function(value) {
            this._width != value && (this._width = value, this._setChanged());
        }), __getset(0, __proto, "height", function() {
            return this._height ? this._height : this._source ? this._source.sourceHeight : 0;
        }, function(value) {
            this._height != value && (this._height = value, this._setChanged());
        }), __getset(0, __proto, "source", function() {
            return this._source;
        }, function(value) {
            value ? (this._source = value, this._setChanged()) : (this._source = null, this.clear());
        }), AutoBitmap.getTexture = function(tex, x, y, width, height) {
            width <= 0 && (width = 1), height <= 0 && (height = 1), tex.$_GID || (tex.$_GID = Utils.getGID());
            var key = tex.$_GID + "." + x + "." + y + "." + width + "." + height, texture = Loader.findObject(key);
            return texture && texture.source || (texture = Texture.createFromTexture(tex, x, y, width, height)) && (Loader.saveObject(key, texture), 
            texture.weakKey = key), texture;
        }, AutoBitmap;
    }(Graphics), Component = (function(_super) {
        function UIEvent() {
            UIEvent.__super.call(this);
        }
        __class(UIEvent, "laya.ui.UIEvent", Event), UIEvent.SHOW_TIP = "showtip", UIEvent.HIDE_TIP = "hidetip";
    }(), function(_super) {
        function Component() {
            this._comXml = null, this._dataSource = null, this._toolTip = null, this._tag = null, 
            this._disabled = !1, this._gray = !1, this.layoutEnabled = !0, Component.__super.call(this), 
            this._layout = LayoutStyle.EMPTY, this.preinitialize(), this.createChildren(), this.initialize();
        }
        __class(Component, "laya.ui.Component", _super);
        var __proto = Component.prototype;
        return Laya.imps(__proto, {
            "laya.ui.IComponent": !0
        }), __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), _super.prototype.destroy.call(this, destroyChild), 
            this._dataSource = this._layout = null, this._tag = null, this._toolTip = null;
        }, __proto.preinitialize = function() {}, __proto.createChildren = function() {}, 
        __proto.initialize = function() {}, __proto.callLater = function(method, args) {
            Laya.timer.callLater(this, method, args);
        }, __proto.runCallLater = function(method) {
            Laya.timer.runCallLater(this, method);
        }, __proto.commitMeasure = function() {}, __proto.changeSize = function() {
            this.event("resize");
        }, __proto.getLayout = function() {
            return this._layout === LayoutStyle.EMPTY && (this._layout = new LayoutStyle()), 
            this._layout;
        }, __proto._setLayoutEnabled = function(value) {
            this._layout && this._layout.enable != value && (this._layout.enable = value, this.on("added", this, this.onAdded), 
            this.on("removed", this, this.onRemoved), this.parent && this.onAdded());
        }, __proto.onRemoved = function() {
            this.parent.off("resize", this, this.onCompResize);
        }, __proto.onAdded = function() {
            this.parent.on("resize", this, this.onCompResize), this.resetLayoutX(), this.resetLayoutY();
        }, __proto.onCompResize = function() {
            this._layout && this._layout.enable && (this.resetLayoutX(), this.resetLayoutY());
        }, __proto.resetLayoutX = function() {
            var layout = this._layout;
            if (isNaN(layout.anchorX) || (this.pivotX = layout.anchorX * this.width), this.layoutEnabled) {
                var parent = this.parent;
                parent && (isNaN(layout.centerX) ? isNaN(layout.left) ? isNaN(layout.right) || (this.x = Math.round(parent.width - this.displayWidth - layout.right + this.pivotX * this.scaleX)) : (this.x = Math.round(layout.left + this.pivotX * this.scaleX), 
                isNaN(layout.right) || (this.width = (parent._width - layout.left - layout.right) / (this.scaleX || .01))) : this.x = Math.round(.5 * (parent.width - this.displayWidth) + layout.centerX + this.pivotX * this.scaleX));
            }
        }, __proto.resetLayoutY = function() {
            var layout = this._layout;
            if (isNaN(layout.anchorY) || (this.pivotY = layout.anchorY * this.height), this.layoutEnabled) {
                var parent = this.parent;
                parent && (isNaN(layout.centerY) ? isNaN(layout.top) ? isNaN(layout.bottom) || (this.y = Math.round(parent.height - this.displayHeight - layout.bottom + this.pivotY * this.scaleY)) : (this.y = Math.round(layout.top + this.pivotY * this.scaleY), 
                isNaN(layout.bottom) || (this.height = (parent._height - layout.top - layout.bottom) / (this.scaleY || .01))) : this.y = Math.round(.5 * (parent.height - this.displayHeight) + layout.centerY + this.pivotY * this.scaleY));
            }
        }, __proto.onMouseOver = function(e) {
            Laya.stage.event("showtip", this._toolTip);
        }, __proto.onMouseOut = function(e) {
            Laya.stage.event("hidetip", this._toolTip);
        }, __getset(0, __proto, "displayWidth", function() {
            return this.width * this.scaleX;
        }), __getset(0, __proto, "width", function() {
            return this._width ? this._width : this.measureWidth;
        }, function(value) {
            this._width != value && (this._width = value, this.conchModel && this.conchModel.size(this._width, this._height), 
            this.callLater(this.changeSize), !this._layout.enable || isNaN(this._layout.centerX) && isNaN(this._layout.right) && isNaN(this._layout.anchorX) || this.resetLayoutX());
        }), __getset(0, __proto, "measureWidth", function() {
            var max = 0;
            this.commitMeasure();
            for (var i = this.numChildren - 1; -1 < i; i--) {
                var comp = this.getChildAt(i);
                comp.visible && (max = Math.max(comp.x + comp.width * comp.scaleX, max));
            }
            return max;
        }), __getset(0, __proto, "displayHeight", function() {
            return this.height * this.scaleY;
        }), __getset(0, __proto, "height", function() {
            return this._height ? this._height : this.measureHeight;
        }, function(value) {
            this._height != value && (this._height = value, this.conchModel && this.conchModel.size(this._width, this._height), 
            this.callLater(this.changeSize), !this._layout.enable || isNaN(this._layout.centerY) && isNaN(this._layout.bottom) && isNaN(this._layout.anchorY) || this.resetLayoutY());
        }), __getset(0, __proto, "dataSource", function() {
            return this._dataSource;
        }, function(value) {
            for (var prop in this._dataSource = value, this._dataSource) this.hasOwnProperty(prop) && "function" != typeof this[prop] && (this[prop] = this._dataSource[prop]);
        }), __getset(0, __proto, "scaleY", _super.prototype._$get_scaleY, function(value) {
            Laya.superGet(Sprite, this, "scaleY") != value && (Laya.superSet(Sprite, this, "scaleY", value), 
            this.callLater(this.changeSize), this._layout.enable && this.resetLayoutY());
        }), __getset(0, __proto, "measureHeight", function() {
            var max = 0;
            this.commitMeasure();
            for (var i = this.numChildren - 1; -1 < i; i--) {
                var comp = this.getChildAt(i);
                comp.visible && (max = Math.max(comp.y + comp.height * comp.scaleY, max));
            }
            return max;
        }), __getset(0, __proto, "scaleX", _super.prototype._$get_scaleX, function(value) {
            Laya.superGet(Sprite, this, "scaleX") != value && (Laya.superSet(Sprite, this, "scaleX", value), 
            this.callLater(this.changeSize), this._layout.enable && this.resetLayoutX());
        }), __getset(0, __proto, "top", function() {
            return this._layout.top;
        }, function(value) {
            value != this._layout.top && (this.getLayout().top = value, this._setLayoutEnabled(!0)), 
            this.resetLayoutY();
        }), __getset(0, __proto, "bottom", function() {
            return this._layout.bottom;
        }, function(value) {
            value != this._layout.bottom && (this.getLayout().bottom = value, this._setLayoutEnabled(!0)), 
            this.resetLayoutY();
        }), __getset(0, __proto, "left", function() {
            return this._layout.left;
        }, function(value) {
            value != this._layout.left && (this.getLayout().left = value, this._setLayoutEnabled(!0)), 
            this.resetLayoutX();
        }), __getset(0, __proto, "right", function() {
            return this._layout.right;
        }, function(value) {
            value != this._layout.right && (this.getLayout().right = value, this._setLayoutEnabled(!0)), 
            this.resetLayoutX();
        }), __getset(0, __proto, "centerX", function() {
            return this._layout.centerX;
        }, function(value) {
            value != this._layout.centerX && (this.getLayout().centerX = value, this._setLayoutEnabled(!0)), 
            this.resetLayoutX();
        }), __getset(0, __proto, "centerY", function() {
            return this._layout.centerY;
        }, function(value) {
            value != this._layout.centerY && (this.getLayout().centerY = value, this._setLayoutEnabled(!0)), 
            this.resetLayoutY();
        }), __getset(0, __proto, "anchorX", function() {
            return this._layout.anchorX;
        }, function(value) {
            value != this._layout.anchorX && (this.getLayout().anchorX = value, this._setLayoutEnabled(!0)), 
            this.resetLayoutX();
        }), __getset(0, __proto, "anchorY", function() {
            return this._layout.anchorY;
        }, function(value) {
            value != this._layout.anchorY && (this.getLayout().anchorY = value, this._setLayoutEnabled(!0)), 
            this.resetLayoutY();
        }), __getset(0, __proto, "tag", function() {
            return this._tag;
        }, function(value) {
            this._tag = value;
        }), __getset(0, __proto, "toolTip", function() {
            return this._toolTip;
        }, function(value) {
            this._toolTip != value && (null != (this._toolTip = value) ? (this.on("mouseover", this, this.onMouseOver), 
            this.on("mouseout", this, this.onMouseOut)) : (this.off("mouseover", this, this.onMouseOver), 
            this.off("mouseout", this, this.onMouseOut)));
        }), __getset(0, __proto, "comXml", function() {
            return this._comXml;
        }, function(value) {
            this._comXml = value;
        }), __getset(0, __proto, "gray", function() {
            return this._gray;
        }, function(value) {
            value !== this._gray && (this._gray = value, UIUtils.gray(this, value));
        }), __getset(0, __proto, "disabled", function() {
            return this._disabled;
        }, function(value) {
            value !== this._disabled && (this.gray = this._disabled = value, this.mouseEnabled = !value);
        }), Component;
    }(Sprite)), DialogManager = function(_super) {
        function DialogManager() {
            this.lockLayer = null, this.popupEffect = function(dialog) {
                dialog.scale(1, 1), Tween.from(dialog, {
                    x: Laya.stage.width / 2,
                    y: Laya.stage.height / 2,
                    scaleX: 0,
                    scaleY: 0
                }, 300, Ease.backOut, Handler.create(this, this.doOpen, [ dialog ]));
            }, this.closeEffect = function(dialog, type) {
                Tween.to(dialog, {
                    x: Laya.stage.width / 2,
                    y: Laya.stage.height / 2,
                    scaleX: 0,
                    scaleY: 0
                }, 300, Ease.strongOut, Handler.create(this, this.doClose, [ dialog, type ]));
            }, DialogManager.__super.call(this), this.maskLayer = new Sprite(), this.popupEffectHandler = Handler.create(this, this.popupEffect, null, !1), 
            this.closeEffectHandler = Handler.create(this, this.closeEffect, null, !1), this.mouseEnabled = this.maskLayer.mouseEnabled = !0, 
            this.zOrder = 1e3, Laya.stage.addChild(this), Laya.stage.on("resize", this, this._onResize), 
            UIConfig.closeDialogOnSide && this.maskLayer.on("click", this, this._closeOnSide), 
            this._onResize(null);
        }
        __class(DialogManager, "laya.ui.DialogManager", Sprite);
        var __proto = DialogManager.prototype;
        return __proto._closeOnSide = function() {
            var dialog = this.getChildAt(this.numChildren - 1);
            dialog instanceof laya.ui.Dialog && dialog.close("side");
        }, __proto.setLockView = function(value) {
            this.lockLayer || (this.lockLayer = new Box(), this.lockLayer.mouseEnabled = !0, 
            this.lockLayer.size(Laya.stage.width, Laya.stage.height)), this.lockLayer.removeChildren(), 
            value && (value.centerX = value.centerY = 0, this.lockLayer.addChild(value));
        }, __proto._onResize = function(e) {
            var width = this.maskLayer.width = Laya.stage.width, height = this.maskLayer.height = Laya.stage.height;
            this.lockLayer && this.lockLayer.size(width, height), this.maskLayer.graphics.clear(), 
            this.maskLayer.graphics.drawRect(0, 0, width, height, UIConfig.popupBgColor), this.maskLayer.alpha = UIConfig.popupBgAlpha;
            for (var i = this.numChildren - 1; -1 < i; i--) {
                var item = this.getChildAt(i);
                item.popupCenter && this._centerDialog(item);
            }
        }, __proto._centerDialog = function(dialog) {
            dialog.x = Math.round((Laya.stage.width - dialog.width >> 1) + dialog.pivotX), dialog.y = Math.round((Laya.stage.height - dialog.height >> 1) + dialog.pivotY);
        }, __proto.open = function(dialog, closeOther, showEffect) {
            void 0 === closeOther && (closeOther = !1), void 0 === showEffect && (showEffect = !1), 
            closeOther && this._closeAll(), dialog.popupCenter && this._centerDialog(dialog), 
            this.addChild(dialog), (dialog.isModal || this._$P.hasZorder) && this.timer.callLater(this, this._checkMask), 
            showEffect && null != dialog.popupEffect ? dialog.popupEffect.runWith(dialog) : this.doOpen(dialog), 
            this.event("open");
        }, __proto.doOpen = function(dialog) {
            dialog.onOpened();
        }, __proto.lock = function(value) {
            this.lockLayer && (value ? this.addChild(this.lockLayer) : this.lockLayer.removeSelf());
        }, __proto.close = function(dialog, type, showEffect) {
            void 0 === showEffect && (showEffect = !1), showEffect && null != dialog.closeEffect ? dialog.closeEffect.runWith([ dialog, type ]) : this.doClose(dialog, type), 
            this.event("close");
        }, __proto.doClose = function(dialog, type) {
            dialog.removeSelf(), dialog.isModal && this._checkMask(), dialog.closeHandler && dialog.closeHandler.runWith(type), 
            dialog.onClosed(type);
        }, __proto.closeAll = function() {
            this._closeAll(), this.event("close");
        }, __proto._closeAll = function() {
            for (var i = this.numChildren - 1; -1 < i; i--) {
                var item = this.getChildAt(i);
                item && null != item.close && this.doClose(item);
            }
        }, __proto.getDialogsByGroup = function(group) {
            for (var arr = [], i = this.numChildren - 1; -1 < i; i--) {
                var item = this.getChildAt(i);
                item && item.group === group && arr.push(item);
            }
            return arr;
        }, __proto.closeByGroup = function(group) {
            for (var arr = [], i = this.numChildren - 1; -1 < i; i--) {
                var item = this.getChildAt(i);
                item && item.group === group && (item.close(), arr.push(item));
            }
            return arr;
        }, __proto._checkMask = function() {
            this.maskLayer.removeSelf();
            for (var i = this.numChildren - 1; -1 < i; i--) {
                var dialog = this.getChildAt(i);
                if (dialog && dialog.isModal) return void this.addChildAt(this.maskLayer, i);
            }
        }, DialogManager;
    }(), Box = function(_super) {
        function Box() {
            Box.__super.call(this);
        }
        __class(Box, "laya.ui.Box", _super);
        var __proto = Box.prototype;
        return Laya.imps(__proto, {
            "laya.ui.IBox": !0
        }), __getset(0, __proto, "dataSource", _super.prototype._$get_dataSource, function(value) {
            for (var name in this._dataSource = value) {
                var comp = this.getChildByName(name);
                comp ? comp.dataSource = value[name] : this.hasOwnProperty(name) && "function" != typeof this[name] && (this[name] = value[name]);
            }
        }), Box;
    }(Component), Button = function(_super) {
        function Button(skin, label) {
            this.toggle = !1, this._bitmap = null, this._text = null, this._strokeColors = null, 
            this._state = 0, this._selected = !1, this._skin = null, this._autoSize = !0, this._sources = null, 
            this._clickHandler = null, this._stateChanged = !1, Button.__super.call(this), this._labelColors = Styles.buttonLabelColors, 
            this._stateNum = Styles.buttonStateNum, void 0 === label && (label = ""), this.skin = skin, 
            this.label = label;
        }
        __class(Button, "laya.ui.Button", _super);
        var __proto = Button.prototype;
        return Laya.imps(__proto, {
            "laya.ui.ISelect": !0
        }), __proto.destroy = function(destroyChild) {
            Loader.clearCache(this, this._skin), Loader.clearObject(this, this._weakKey), void 0 === destroyChild && (destroyChild = !0), 
            _super.prototype.destroy.call(this, destroyChild), this._bitmap && this._bitmap.destroy(), 
            this._text && this._text.destroy(destroyChild), this._bitmap = null, this._text = null, 
            this._clickHandler = null, this._labelColors = this._sources = this._strokeColors = null;
        }, __proto.createChildren = function() {
            this.graphics = this._bitmap = new AutoBitmap();
        }, __proto.createText = function() {
            this._text || (this._text = new Text(), this._text.overflow = Text.HIDDEN, this._text.align = "center", 
            this._text.valign = "middle", this._text.width = this._width, this._text.height = this._height);
        }, __proto.initialize = function() {
            1 !== this._mouseEnableState && (this.mouseEnabled = !0, this._setBit(2, !0)), this._createListener("mouseover", this, this.onMouse, null, !1, !1), 
            this._createListener("mouseout", this, this.onMouse, null, !1, !1), this._createListener("mousedown", this, this.onMouse, null, !1, !1), 
            this._createListener("mouseup", this, this.onMouse, null, !1, !1), this._createListener("click", this, this.onMouse, null, !1, !1);
        }, __proto.onMouse = function(e) {
            if (!1 !== this.toggle || !this._selected) return "click" === e.type ? (this.toggle && (this.selected = !this._selected), 
            void (this._clickHandler && this._clickHandler.run())) : void (!this._selected && (this.state = Button.stateMap[e.type]));
        }, __proto.changeClips = function() {
            var img = Loader.getRes(this._skin);
            if (img) {
                Loader.clearObject(this, this._weakKey);
                var width = img.sourceWidth, height = img.sourceHeight / this._stateNum;
                img.$_GID || (img.$_GID = Utils.getGID());
                var key = img.$_GID + "-" + this._stateNum, clips = Loader.findObject(key);
                if (Utils.isOkTextureList(clips) || (clips = null), clips) this._weakKey = key, 
                Loader.keepObject(this, this._weakKey), this._sources = clips; else {
                    if (this._sources = [], 1 === this._stateNum) this._sources.push(img); else for (var i = 0; i < this._stateNum; i++) {
                        var texture = Texture.createFromTexture(img, 0, height * i, width, height);
                        this._sources.push(texture);
                    }
                    Loader.saveObject(key, this._sources), this._weakKey = key, Loader.keepObject(this, this._weakKey);
                }
                this._autoSize ? (this._bitmap.width = this._width || width, this._bitmap.height = this._height || height, 
                this._text && (this._text.width = this._bitmap.width, this._text.height = this._bitmap.height)) : this._text && (this._text.x = width);
            } else console.log("lose skin", this._skin);
        }, __proto.changeState = function() {
            this._stateChanged = !1, this.runCallLater(this.changeClips);
            var index = this._state < this._stateNum ? this._state : this._stateNum - 1;
            this._sources && (this._bitmap.source = this._sources[index]), this.label && (this._text.color = this._labelColors[index], 
            this._strokeColors && (this._text.strokeColor = this._strokeColors[index]));
        }, __proto._setStateChanged = function() {
            this._stateChanged || (this._stateChanged = !0, this.callLater(this.changeState));
        }, __getset(0, __proto, "labelStrokeColor", function() {
            return this.createText(), this._text.strokeColor;
        }, function(value) {
            this.createText(), this._text.strokeColor = value;
        }), __getset(0, __proto, "measureHeight", function() {
            return this.runCallLater(this.changeClips), this._text ? Math.max(this._bitmap.height, this._text.height) : this._bitmap.height;
        }), __getset(0, __proto, "skin", function() {
            return this._skin;
        }, function(value) {
            this._skin != value && (Loader.clearCache(this, this._skin), this._skin = value, 
            Loader.keepCache(this, this._skin), this.callLater(this.changeClips), this._setStateChanged());
        }), __getset(0, __proto, "state", function() {
            return this._state;
        }, function(value) {
            this._state != value && (this._state = value, this._setStateChanged());
        }), __getset(0, __proto, "text", function() {
            return this.createText(), this._text;
        }), __getset(0, __proto, "stateNum", function() {
            return this._stateNum;
        }, function(value) {
            "string" == typeof value && (value = parseInt(value)), this._stateNum != value && (this._stateNum = value < 1 ? 1 : 3 < value ? 3 : value, 
            this.callLater(this.changeClips));
        }), __getset(0, __proto, "strokeColors", function() {
            return this._strokeColors ? this._strokeColors.join(",") : "";
        }, function(value) {
            this._strokeColors = UIUtils.fillArray(Styles.buttonLabelColors, value, String), 
            this._setStateChanged();
        }), __getset(0, __proto, "labelColors", function() {
            return this._labelColors.join(",");
        }, function(value) {
            this._labelColors = UIUtils.fillArray(Styles.buttonLabelColors, value, String), 
            this._setStateChanged();
        }), __getset(0, __proto, "measureWidth", function() {
            return this.runCallLater(this.changeClips), this._autoSize ? this._bitmap.width : (this.runCallLater(this.changeState), 
            this._bitmap.width + (this._text ? this._text.width : 0));
        }), __getset(0, __proto, "label", function() {
            return this._text ? this._text.text : null;
        }, function(value) {
            (this._text || value) && (this.createText(), this._text.text != value && (value && !this._text.parent && this.addChild(this._text), 
            this._text.text = (value + "").replace(/\\n/g, "\n"), this._setStateChanged()));
        }), __getset(0, __proto, "selected", function() {
            return this._selected;
        }, function(value) {
            this._selected != value && (this._selected = value, this.state = this._selected ? 2 : 0, 
            this.event("change"));
        }), __getset(0, __proto, "labelPadding", function() {
            return this.createText(), this._text.padding.join(",");
        }, function(value) {
            this.createText(), this._text.padding = UIUtils.fillArray(Styles.labelPadding, value, Number);
        }), __getset(0, __proto, "labelSize", function() {
            return this.createText(), this._text.fontSize;
        }, function(value) {
            this.createText(), this._text.fontSize = value;
        }), __getset(0, __proto, "labelStroke", function() {
            return this.createText(), this._text.stroke;
        }, function(value) {
            this.createText(), this._text.stroke = value;
        }), __getset(0, __proto, "labelBold", function() {
            return this.createText(), this._text.bold;
        }, function(value) {
            this.createText(), this._text.bold = value;
        }), __getset(0, __proto, "labelFont", function() {
            return this.createText(), this._text.font;
        }, function(value) {
            this.createText(), this._text.font = value;
        }), __getset(0, __proto, "labelAlign", function() {
            return this.createText(), this._text.align;
        }, function(value) {
            this.createText(), this._text.align = value;
        }), __getset(0, __proto, "clickHandler", function() {
            return this._clickHandler;
        }, function(value) {
            this._clickHandler = value;
        }), __getset(0, __proto, "sizeGrid", function() {
            return this._bitmap.sizeGrid ? this._bitmap.sizeGrid.join(",") : null;
        }, function(value) {
            this._bitmap.sizeGrid = UIUtils.fillArray(Styles.defaultSizeGrid, value, Number);
        }), __getset(0, __proto, "width", _super.prototype._$get_width, function(value) {
            Laya.superSet(Component, this, "width", value), this._autoSize && (this._bitmap.width = value, 
            this._text && (this._text.width = value));
        }), __getset(0, __proto, "height", _super.prototype._$get_height, function(value) {
            Laya.superSet(Component, this, "height", value), this._autoSize && (this._bitmap.height = value, 
            this._text && (this._text.height = value));
        }), __getset(0, __proto, "dataSource", _super.prototype._$get_dataSource, function(value) {
            "number" == typeof (this._dataSource = value) || "string" == typeof value ? this.label = value + "" : Laya.superSet(Component, this, "dataSource", value);
        }), __getset(0, __proto, "iconOffset", function() {
            return this._bitmap._offset ? this._bitmap._offset.join(",") : null;
        }, function(value) {
            this._bitmap._offset = value ? UIUtils.fillArray([ 1, 1 ], value, Number) : [];
        }), __static(Button, [ "stateMap", function() {
            return this.stateMap = {
                mouseup: 0,
                mouseover: 1,
                mousedown: 2,
                mouseout: 0
            };
        } ]), Button;
    }(Component), Clip = function(_super) {
        function Clip(url, clipX, clipY) {
            this._sources = null, this._bitmap = null, this._skin = null, this._clipX = 1, this._clipY = 1, 
            this._clipWidth = 0, this._clipHeight = 0, this._autoPlay = !1, this._interval = 50, 
            this._complete = null, this._isPlaying = !1, this._index = 0, this._clipChanged = !1, 
            this._group = null, this._toIndex = -1, Clip.__super.call(this), void 0 === clipX && (clipX = 1), 
            void 0 === clipY && (clipY = 1), this._clipX = clipX, this._clipY = clipY, this.skin = url;
        }
        __class(Clip, "laya.ui.Clip", _super);
        var __proto = Clip.prototype;
        return __proto.destroy = function(destroyChild) {
            Loader.clearCache(this, this._skin), Loader.clearObject(this, this._weakKey), void 0 === destroyChild && (destroyChild = !0), 
            _super.prototype.destroy.call(this, !0), this._bitmap && this._bitmap.destroy(), 
            this._bitmap = null, this._sources = null;
        }, __proto.dispose = function() {
            this.destroy(!0), Laya.loader.clearRes(this._skin);
        }, __proto.createChildren = function() {
            this.graphics = this._bitmap = new AutoBitmap();
        }, __proto._onDisplay = function(e) {
            this._isPlaying ? this._displayedInStage ? this.play() : this.stop() : this._autoPlay && this.play();
        }, __proto.changeClip = function() {
            if (this._clipChanged = !1, this._skin) {
                var img = Loader.getRes(this._skin);
                img ? this.loadComplete(this._skin, img) : Laya.loader.load(this._skin, Handler.create(this, this.loadComplete, [ this._skin ]));
            }
        }, __proto.loadComplete = function(url, img) {
            if (url === this._skin && img) {
                Loader.clearObject(this, this._weakKey);
                var w = this._clipWidth || Math.ceil(img.sourceWidth / this._clipX), h = this._clipHeight || Math.ceil(img.sourceHeight / this._clipY), key = this._skin + w + h, clips = Loader.findObject(key);
                if (Utils.isOkTextureList(clips) || (clips = null), clips) this._weakKey = key, 
                Loader.keepObject(this, this._weakKey), this._sources = clips; else {
                    this._sources = [];
                    for (var i = 0; i < this._clipY; i++) for (var j = 0; j < this._clipX; j++) {
                        var texture = Texture.createFromTexture(img, w * j, h * i, w, h);
                        this._sources.push(texture);
                    }
                    Loader.saveObject(key, this._sources), this._weakKey = key, Loader.keepObject(this, this._weakKey);
                }
                this.index = this._index, this.event("loaded"), this.onCompResize();
            }
        }, __proto.play = function(from, to) {
            void 0 === from && (from = 0), void 0 === to && (to = -1), this._isPlaying = !0, 
            this.index = from, this._toIndex = to, this._index++, Laya.timer.loop(this.interval, this, this._loop), 
            this.on("display", this, this._onDisplay), this.on("undisplay", this, this._onDisplay);
        }, __proto._loop = function() {
            this._style.visible && this._sources && (this._index++, -1 < this._toIndex && this._index >= this._toIndex ? this.stop() : this._index >= this._sources.length && (this._index = 0), 
            this.index = this._index);
        }, __proto.stop = function() {
            this._isPlaying = !1, Laya.timer.clear(this, this._loop), this.event("complete");
        }, __proto._setClipChanged = function() {
            this._clipChanged || (this._clipChanged = !0, this.callLater(this.changeClip));
        }, __getset(0, __proto, "interval", function() {
            return this._interval;
        }, function(value) {
            this._interval != value && (this._interval = value, this._isPlaying && this.play());
        }), __getset(0, __proto, "skin", function() {
            return this._skin;
        }, function(value) {
            this._skin != value && (Loader.clearCache(this, this._skin), (this._skin = value) ? (Loader.keepCache(this, this._skin), 
            this._setClipChanged()) : this._bitmap.source = null);
        }), __getset(0, __proto, "sources", function() {
            return this._sources;
        }, function(value) {
            this._sources = value, this.index = this._index, this.event("loaded");
        }), __getset(0, __proto, "clipX", function() {
            return this._clipX;
        }, function(value) {
            this._clipX = value || 1, this._setClipChanged();
        }), __getset(0, __proto, "clipY", function() {
            return this._clipY;
        }, function(value) {
            this._clipY = value || 1, this._setClipChanged();
        }), __getset(0, __proto, "total", function() {
            return this.runCallLater(this.changeClip), this._sources ? this._sources.length : 0;
        }), __getset(0, __proto, "clipWidth", function() {
            return this._clipWidth;
        }, function(value) {
            this._clipWidth = value, this._setClipChanged();
        }), __getset(0, __proto, "sizeGrid", function() {
            return this._bitmap.sizeGrid ? this._bitmap.sizeGrid.join(",") : null;
        }, function(value) {
            this._bitmap.sizeGrid = UIUtils.fillArray(Styles.defaultSizeGrid, value, Number);
        }), __getset(0, __proto, "group", function() {
            return this._group;
        }, function(value) {
            value && this._skin && Loader.setGroup(this._skin, value), this._group = value;
        }), __getset(0, __proto, "clipHeight", function() {
            return this._clipHeight;
        }, function(value) {
            this._clipHeight = value, this._setClipChanged();
        }), __getset(0, __proto, "width", _super.prototype._$get_width, function(value) {
            Laya.superSet(Component, this, "width", value), this._bitmap.width = value;
        }), __getset(0, __proto, "height", _super.prototype._$get_height, function(value) {
            Laya.superSet(Component, this, "height", value), this._bitmap.height = value;
        }), __getset(0, __proto, "measureWidth", function() {
            return this.runCallLater(this.changeClip), this._bitmap.width;
        }), __getset(0, __proto, "measureHeight", function() {
            return this.runCallLater(this.changeClip), this._bitmap.height;
        }), __getset(0, __proto, "index", function() {
            return this._index;
        }, function(value) {
            this._index = value, this._bitmap && this._sources && (this._bitmap.source = this._sources[value]), 
            this.event("change");
        }), __getset(0, __proto, "autoPlay", function() {
            return this._autoPlay;
        }, function(value) {
            this._autoPlay != value && ((this._autoPlay = value) ? this.play() : this.stop());
        }), __getset(0, __proto, "isPlaying", function() {
            return this._isPlaying;
        }, function(value) {
            this._isPlaying = value;
        }), __getset(0, __proto, "dataSource", _super.prototype._$get_dataSource, function(value) {
            "number" == typeof (this._dataSource = value) && Math.floor(value) == value || "string" == typeof value ? this.index = parseInt(value) : Laya.superSet(Component, this, "dataSource", value);
        }), __getset(0, __proto, "bitmap", function() {
            return this._bitmap;
        }), Clip;
    }(Component), ColorPicker = function(_super) {
        function ColorPicker() {
            this.changeHandler = null, this._gridSize = 11, this._bgColor = "#ffffff", this._borderColor = "#000000", 
            this._inputColor = "#000000", this._inputBgColor = "#efefef", this._colorPanel = null, 
            this._colorTiles = null, this._colorBlock = null, this._colorInput = null, this._colorButton = null, 
            this._colors = [], this._selectedColor = "#000000", this._panelChanged = !1, ColorPicker.__super.call(this);
        }
        __class(ColorPicker, "laya.ui.ColorPicker", _super);
        var __proto = ColorPicker.prototype;
        return __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), _super.prototype.destroy.call(this, destroyChild), 
            this._colorPanel && this._colorPanel.destroy(destroyChild), this._colorButton && this._colorButton.destroy(destroyChild), 
            this._colorPanel = null, this._colorTiles = null, this._colorBlock = null, this._colorInput = null, 
            this._colorButton = null, this._colors = null, this.changeHandler = null;
        }, __proto.createChildren = function() {
            this.addChild(this._colorButton = new Button()), this._colorPanel = new Box(), this._colorPanel.size(230, 166), 
            this._colorPanel.addChild(this._colorTiles = new Sprite()), this._colorPanel.addChild(this._colorBlock = new Sprite()), 
            this._colorPanel.addChild(this._colorInput = new Input());
        }, __proto.initialize = function() {
            this._colorButton.on("click", this, this.onColorButtonClick), this._colorBlock.pos(5, 5), 
            this._colorInput.pos(60, 5), this._colorInput.size(60, 20), this._colorInput.on("change", this, this.onColorInputChange), 
            this._colorInput.on("keydown", this, this.onColorFieldKeyDown), this._colorTiles.pos(5, 30), 
            this._colorTiles.on("mousemove", this, this.onColorTilesMouseMove), this._colorTiles.on("click", this, this.onColorTilesClick), 
            this._colorTiles.size(20 * this._gridSize, 12 * this._gridSize), this._colorPanel.on("mousedown", this, this.onPanelMouseDown), 
            this.bgColor = this._bgColor;
        }, __proto.onPanelMouseDown = function(e) {
            e.stopPropagation();
        }, __proto.changePanel = function() {
            this._panelChanged = !1;
            var g = this._colorPanel.graphics;
            g.clear(), g.drawRect(0, 0, 230, 166, this._bgColor, this._borderColor), this.drawBlock(this._selectedColor), 
            this._colorInput.borderColor = this._borderColor, this._colorInput.bgColor = this._inputBgColor, 
            this._colorInput.color = this._inputColor, (g = this._colorTiles.graphics).clear();
            for (var mainColors = [ 0, 3355443, 6710886, 10066329, 13421772, 16777215, 16711680, 65280, 255, 16776960, 65535, 16711935 ], i = 0; i < 12; i++) for (var j = 0; j < 20; j++) {
                var color = 0;
                color = 0 === j ? mainColors[i] : 1 === j ? 0 : 51 * (((3 * i + j / 6) % 3 << 0) + 3 * (i / 6 << 0)) << 16 | j % 6 * 51 << 8 | (i << 0) % 6 * 51;
                var strColor = UIUtils.toColor(color);
                this._colors.push(strColor);
                var x = j * this._gridSize, y = i * this._gridSize;
                g.drawRect(x, y, this._gridSize, this._gridSize, strColor, "#000000");
            }
        }, __proto.onColorButtonClick = function(e) {
            this._colorPanel.parent ? this.close() : this.open();
        }, __proto.open = function() {
            var p = this.localToGlobal(new Point()), px = p.x + this._colorPanel.width <= Laya.stage.width ? p.x : Laya.stage.width - this._colorPanel.width, py = p.y + this._colorButton.height;
            py = py + this._colorPanel.height <= Laya.stage.height ? py : p.y - this._colorPanel.height, 
            this._colorPanel.pos(px, py), this._colorPanel.zOrder = 1001, Laya._currentStage.addChild(this._colorPanel), 
            Laya.stage.on("mousedown", this, this.removeColorBox);
        }, __proto.close = function() {
            Laya.stage.off("mousedown", this, this.removeColorBox), this._colorPanel.removeSelf();
        }, __proto.removeColorBox = function(e) {
            this.close();
        }, __proto.onColorFieldKeyDown = function(e) {
            13 == e.keyCode && (this._colorInput.text ? this.selectedColor = this._colorInput.text : this.selectedColor = null, 
            this.close(), e.stopPropagation());
        }, __proto.onColorInputChange = function(e) {
            this._colorInput.text ? this.drawBlock(this._colorInput.text) : this.drawBlock("#FFFFFF");
        }, __proto.onColorTilesClick = function(e) {
            this.selectedColor = this.getColorByMouse(), this.close();
        }, __proto.onColorTilesMouseMove = function(e) {
            this._colorInput.focus = !1;
            var color = this.getColorByMouse();
            this._colorInput.text = color, this.drawBlock(color);
        }, __proto.getColorByMouse = function() {
            var point = this._colorTiles.getMousePoint(), x = Math.floor(point.x / this._gridSize), y = Math.floor(point.y / this._gridSize);
            return this._colors[20 * y + x];
        }, __proto.drawBlock = function(color) {
            var g = this._colorBlock.graphics;
            g.clear();
            var showColor = color || "#ffffff";
            g.drawRect(0, 0, 50, 20, showColor, this._borderColor), color || g.drawLine(0, 0, 50, 20, "#ff0000");
        }, __proto.changeColor = function() {
            var g = this.graphics;
            g.clear();
            var showColor = this._selectedColor || "#000000";
            g.drawRect(0, 0, this._colorButton.width, this._colorButton.height, showColor);
        }, __proto._setPanelChanged = function() {
            this._panelChanged || (this._panelChanged = !0, this.callLater(this.changePanel));
        }, __getset(0, __proto, "inputBgColor", function() {
            return this._inputBgColor;
        }, function(value) {
            this._inputBgColor = value, this._setPanelChanged();
        }), __getset(0, __proto, "selectedColor", function() {
            return this._selectedColor;
        }, function(value) {
            this._selectedColor != value && (this._selectedColor = this._colorInput.text = value, 
            this.drawBlock(value), this.changeColor(), this.changeHandler && this.changeHandler.runWith(this._selectedColor), 
            this.event("change", Event.EMPTY.setTo("change", this, this)));
        }), __getset(0, __proto, "skin", function() {
            return this._colorButton.skin;
        }, function(value) {
            this._colorButton.skin = value, this.changeColor();
        }), __getset(0, __proto, "bgColor", function() {
            return this._bgColor;
        }, function(value) {
            this._bgColor = value, this._setPanelChanged();
        }), __getset(0, __proto, "borderColor", function() {
            return this._borderColor;
        }, function(value) {
            this._borderColor = value, this._setPanelChanged();
        }), __getset(0, __proto, "inputColor", function() {
            return this._inputColor;
        }, function(value) {
            this._inputColor = value, this._setPanelChanged();
        }), ColorPicker;
    }(Component), ComboBox = function(_super) {
        function ComboBox(skin, labels) {
            this._visibleNum = 6, this._button = null, this._list = null, this._isOpen = !1, 
            this._itemSize = 12, this._labels = [], this._selectedIndex = -1, this._selectHandler = null, 
            this._itemHeight = NaN, this._listHeight = NaN, this._listChanged = !1, this._itemChanged = !1, 
            this._scrollBarSkin = null, this._isCustomList = !1, this.itemRender = null, ComboBox.__super.call(this), 
            this._itemColors = Styles.comboBoxItemColors, this.skin = skin, this.labels = labels;
        }
        __class(ComboBox, "laya.ui.ComboBox", _super);
        var __proto = ComboBox.prototype;
        return __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), _super.prototype.destroy.call(this, destroyChild), 
            this._button && this._button.destroy(destroyChild), this._list && this._list.destroy(destroyChild), 
            this._button = null, this._list = null, this._itemColors = null, this._labels = null, 
            this._selectHandler = null;
        }, __proto.createChildren = function() {
            this.addChild(this._button = new Button()), this._button.text.align = "left", this._button.labelPadding = "0,0,0,5", 
            this._button.on("mousedown", this, this.onButtonMouseDown);
        }, __proto._createList = function() {
            this._list = new List(), this._scrollBarSkin && (this._list.vScrollBarSkin = this._scrollBarSkin), 
            this._setListEvent(this._list);
        }, __proto._setListEvent = function(list) {
            this._list.selectEnable = !0, this._list.on("mousedown", this, this.onListDown), 
            this._list.mouseHandler = Handler.create(this, this.onlistItemMouse, null, !1), 
            this._list.scrollBar && this._list.scrollBar.on("mousedown", this, this.onScrollBarDown);
        }, __proto.onListDown = function(e) {
            e.stopPropagation();
        }, __proto.onScrollBarDown = function(e) {
            e.stopPropagation();
        }, __proto.onButtonMouseDown = function(e) {
            this.callLater(this.switchTo, [ !this._isOpen ]);
        }, __proto.changeList = function() {
            this._listChanged = !1;
            var labelWidth = this.width - 2, labelColor = this._itemColors[2];
            this._itemHeight = this._itemSize + 6, this._list.itemRender = this.itemRender || {
                type: "Box",
                child: [ {
                    type: "Label",
                    props: {
                        name: "label",
                        x: 1,
                        padding: "3,3,3,3",
                        width: labelWidth,
                        height: this._itemHeight,
                        fontSize: this._itemSize,
                        color: labelColor
                    }
                } ]
            }, this._list.repeatY = this._visibleNum, this._list.refresh();
        }, __proto.onlistItemMouse = function(e, index) {
            var type = e.type;
            if ("mouseover" === type || "mouseout" === type) {
                if (this._isCustomList) return;
                var box = this._list.getCell(index);
                if (!box) return;
                var label = box.getChildByName("label");
                label && ("mouseover" === type ? (label.bgColor = this._itemColors[0], label.color = this._itemColors[1]) : (label.bgColor = null, 
                label.color = this._itemColors[2]));
            } else "click" === type && (this.selectedIndex = index, this.isOpen = !1);
        }, __proto.switchTo = function(value) {
            this.isOpen = value;
        }, __proto.changeOpen = function() {
            this.isOpen = !this._isOpen;
        }, __proto.changeItem = function() {
            if (this._itemChanged = !1, this._listHeight = 0 < this._labels.length ? Math.min(this._visibleNum, this._labels.length) * this._itemHeight : this._itemHeight, 
            !this._isCustomList) {
                var g = this._list.graphics;
                g.clear(), g.drawRect(0, 0, this.width - 1, this._listHeight, this._itemColors[4], this._itemColors[3]);
            }
            for (var a = this._list.array || [], i = a.length = 0, n = this._labels.length; i < n; i++) a.push({
                label: this._labels[i]
            });
            this._list.height = this._listHeight, this._list.array = a;
        }, __proto.changeSelected = function() {
            this._button.label = this.selectedLabel;
        }, __proto._onStageMouseWheel = function(e) {
            this._list && !this._list.contains(e.target) && this.removeList(null);
        }, __proto.removeList = function(e) {
            Laya.stage.off("mousedown", this, this.removeList), Laya.stage.off("mousewheel", this, this._onStageMouseWheel), 
            this.isOpen = !1;
        }, __getset(0, __proto, "selectedIndex", function() {
            return this._selectedIndex;
        }, function(value) {
            this._selectedIndex != value && (this._selectedIndex = value, 0 < this._labels.length ? this.changeSelected() : this.callLater(this.changeSelected), 
            this.event("change", [ Event.EMPTY.setTo("change", this, this) ]), this._selectHandler && this._selectHandler.runWith(this._selectedIndex));
        }), __getset(0, __proto, "measureHeight", function() {
            return this._button.height;
        }), __getset(0, __proto, "skin", function() {
            return this._button.skin;
        }, function(value) {
            this._button.skin != value && (this._button.skin = value, this._listChanged = !0);
        }), __getset(0, __proto, "measureWidth", function() {
            return this._button.width;
        }), __getset(0, __proto, "width", _super.prototype._$get_width, function(value) {
            Laya.superSet(Component, this, "width", value), this._button.width = this._width, 
            this._itemChanged = !0, this._listChanged = !0;
        }), __getset(0, __proto, "selectedLabel", function() {
            return -1 < this._selectedIndex && this._selectedIndex < this._labels.length ? this._labels[this._selectedIndex] : null;
        }, function(value) {
            this.selectedIndex = this._labels.indexOf(value);
        }), __getset(0, __proto, "labels", function() {
            return this._labels.join(",");
        }, function(value) {
            0 < this._labels.length && (this.selectedIndex = -1), value ? this._labels = value.split(",") : this._labels.length = 0, 
            this._itemChanged = !0;
        }), __getset(0, __proto, "height", _super.prototype._$get_height, function(value) {
            Laya.superSet(Component, this, "height", value), this._button.height = this._height;
        }), __getset(0, __proto, "selectHandler", function() {
            return this._selectHandler;
        }, function(value) {
            this._selectHandler = value;
        }), __getset(0, __proto, "visibleNum", function() {
            return this._visibleNum;
        }, function(value) {
            this._visibleNum = value, this._listChanged = !0;
        }), __getset(0, __proto, "labelBold", function() {
            return this._button.text.bold;
        }, function(value) {
            this._button.text.bold = value;
        }), __getset(0, __proto, "itemColors", function() {
            return String(this._itemColors);
        }, function(value) {
            this._itemColors = UIUtils.fillArray(this._itemColors, value, String), this._listChanged = !0;
        }), __getset(0, __proto, "itemSize", function() {
            return this._itemSize;
        }, function(value) {
            this._itemSize = value, this._listChanged = !0;
        }), __getset(0, __proto, "scrollBar", function() {
            return this.list.scrollBar;
        }), __getset(0, __proto, "isOpen", function() {
            return this._isOpen;
        }, function(value) {
            if (this._isOpen != value) if (this._isOpen = value, this._button.selected = this._isOpen, 
            this._isOpen) {
                this._list || this._createList(), this._listChanged && !this._isCustomList && this.changeList(), 
                this._itemChanged && this.changeItem();
                var p = this.localToGlobal(Point.TEMP.setTo(0, 0)), py = p.y + this._button.height;
                py = py + this._listHeight <= Laya.stage.height ? py : p.y - this._listHeight, this._list.pos(p.x, py), 
                this._list.zOrder = 1001, Laya._currentStage.addChild(this._list), Laya.stage.once("mousedown", this, this.removeList), 
                Laya.stage.on("mousewheel", this, this._onStageMouseWheel), this._list.selectedIndex = this._selectedIndex;
            } else this._list && this._list.removeSelf();
        }), __getset(0, __proto, "scrollBarSkin", function() {
            return this._scrollBarSkin;
        }, function(value) {
            this._scrollBarSkin = value;
        }), __getset(0, __proto, "sizeGrid", function() {
            return this._button.sizeGrid;
        }, function(value) {
            this._button.sizeGrid = value;
        }), __getset(0, __proto, "button", function() {
            return this._button;
        }), __getset(0, __proto, "list", function() {
            return this._list || this._createList(), this._list;
        }, function(value) {
            value && (value.removeSelf(), this._isCustomList = !0, this._list = value, this._setListEvent(value), 
            this._itemHeight = value.getCell(0).height + value.spaceY);
        }), __getset(0, __proto, "dataSource", _super.prototype._$get_dataSource, function(value) {
            "number" == typeof (this._dataSource = value) && Math.floor(value) == value || "string" == typeof value ? this.selectedIndex = parseInt(value) : value instanceof Array ? this.labels = value.join(",") : Laya.superSet(Component, this, "dataSource", value);
        }), __getset(0, __proto, "labelColors", function() {
            return this._button.labelColors;
        }, function(value) {
            this._button.labelColors != value && (this._button.labelColors = value);
        }), __getset(0, __proto, "labelPadding", function() {
            return this._button.text.padding.join(",");
        }, function(value) {
            this._button.text.padding = UIUtils.fillArray(Styles.labelPadding, value, Number);
        }), __getset(0, __proto, "labelSize", function() {
            return this._button.text.fontSize;
        }, function(value) {
            this._button.text.fontSize = value;
        }), __getset(0, __proto, "labelFont", function() {
            return this._button.text.font;
        }, function(value) {
            this._button.text.font = value;
        }), __getset(0, __proto, "stateNum", function() {
            return this._button.stateNum;
        }, function(value) {
            this._button.stateNum = value;
        }), ComboBox;
    }(Component), ScrollBar = function(_super) {
        function ScrollBar(skin) {
            this.rollRatio = .95, this.changeHandler = null, this.scaleBar = !0, this.autoHide = !1, 
            this.elasticDistance = 0, this.elasticBackTime = 500, this.upButton = null, this.downButton = null, 
            this.slider = null, this._scrollSize = 1, this._skin = null, this._thumbPercent = 1, 
            this._target = null, this._lastPoint = null, this._lastOffset = 0, this._checkElastic = !1, 
            this._isElastic = !1, this._value = NaN, this._hide = !1, this._clickOnly = !0, 
            this._offsets = null, ScrollBar.__super.call(this), this._showButtons = UIConfig.showButtons, 
            this._touchScrollEnable = UIConfig.touchScrollEnable, this._mouseWheelEnable = UIConfig.mouseWheelEnable, 
            this.skin = skin, this.max = 1;
        }
        __class(ScrollBar, "laya.ui.ScrollBar", _super);
        var __proto = ScrollBar.prototype;
        return __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), this.stopScroll(), this.target = null, 
            _super.prototype.destroy.call(this, destroyChild), this.upButton && this.upButton.destroy(destroyChild), 
            this.downButton && this.downButton.destroy(destroyChild), this.slider && this.slider.destroy(destroyChild), 
            this.upButton = this.downButton = null, this.slider = null, this.changeHandler = null, 
            this._offsets = null;
        }, __proto.createChildren = function() {
            this.addChild(this.slider = new Slider()), this.addChild(this.upButton = new Button()), 
            this.addChild(this.downButton = new Button());
        }, __proto.initialize = function() {
            this.slider.showLabel = !1, this.slider.on("change", this, this.onSliderChange), 
            this.slider.setSlider(0, 0, 0), this.upButton.on("mousedown", this, this.onButtonMouseDown), 
            this.downButton.on("mousedown", this, this.onButtonMouseDown);
        }, __proto.onSliderChange = function() {
            this._value != this.slider.value && (this.value = this.slider.value);
        }, __proto.onButtonMouseDown = function(e) {
            var isUp = e.currentTarget === this.upButton;
            this.slide(isUp), Laya.timer.once(Styles.scrollBarDelayTime, this, this.startLoop, [ isUp ]), 
            Laya.stage.once("mouseup", this, this.onStageMouseUp);
        }, __proto.startLoop = function(isUp) {
            Laya.timer.frameLoop(1, this, this.slide, [ isUp ]);
        }, __proto.slide = function(isUp) {
            isUp ? this.value -= this._scrollSize : this.value += this._scrollSize;
        }, __proto.onStageMouseUp = function(e) {
            Laya.timer.clear(this, this.startLoop), Laya.timer.clear(this, this.slide);
        }, __proto.changeScrollBar = function() {
            this.upButton.visible = this._showButtons, this.downButton.visible = this._showButtons, 
            this._showButtons && (this.upButton.skin = this._skin.replace(".png", "$up.png"), 
            this.downButton.skin = this._skin.replace(".png", "$down.png")), this.slider.isVertical ? this.slider.y = this._showButtons ? this.upButton.height : 0 : this.slider.x = this._showButtons ? this.upButton.width : 0, 
            this.resetPositions(), this.repaint();
        }, __proto.changeSize = function() {
            _super.prototype.changeSize.call(this), this.repaint(), this.resetPositions(), this.event("change"), 
            this.changeHandler && this.changeHandler.runWith(this.value);
        }, __proto.resetPositions = function() {
            this.slider.isVertical ? this.slider.height = this.height - (this._showButtons ? this.upButton.height + this.downButton.height : 0) : this.slider.width = this.width - (this._showButtons ? this.upButton.width + this.downButton.width : 0), 
            this.resetButtonPosition();
        }, __proto.resetButtonPosition = function() {
            this.slider.isVertical ? this.downButton.y = this.slider.y + this.slider.height : this.downButton.x = this.slider.x + this.slider.width;
        }, __proto.setScroll = function(min, max, value) {
            this.runCallLater(this.changeSize), this.slider.setSlider(min, max, value), this.slider.bar.visible = 0 < max, 
            !this._hide && this.autoHide && (this.visible = !1);
        }, __proto.onTargetMouseWheel = function(e) {
            this.value -= e.delta * this._scrollSize, this.target = this._target;
        }, __proto.onTargetMouseDown = function(e) {
            this._clickOnly = !0, this._lastOffset = 0, this._checkElastic = !1, this._lastPoint || (this._lastPoint = new Point()), 
            this._lastPoint.setTo(Laya.stage.mouseX, Laya.stage.mouseY), Laya.timer.clear(this, this.tweenMove), 
            Tween.clearTween(this), Laya.stage.once("mouseup", this, this.onStageMouseUp2), 
            Laya.stage.once("mouseout", this, this.onStageMouseUp2), Laya.timer.frameLoop(1, this, this.loop);
        }, __proto.loop = function() {
            var mouseY = Laya.stage.mouseY, mouseX = Laya.stage.mouseX;
            if (this._lastOffset = this.isVertical ? mouseY - this._lastPoint.y : mouseX - this._lastPoint.x, 
            this._clickOnly) {
                if (!(1 < Math.abs(this._lastOffset * (this.isVertical ? Laya.stage._canvasTransform.getScaleY() : Laya.stage._canvasTransform.getScaleX())))) return;
                this._clickOnly = !1, this._offsets || (this._offsets = []), this._offsets.length = 0, 
                this._target.mouseEnabled = !1, !this.hide && this.autoHide && (this.alpha = 1, 
                this.visible = !0), this.event("start");
            }
            this._offsets.push(this._lastOffset), this._lastPoint.x = mouseX, this._lastPoint.y = mouseY, 
            0 !== this._lastOffset && (this._checkElastic || (0 < this.elasticDistance ? this._checkElastic || 0 == this._lastOffset || (0 < this._lastOffset && this._value <= this.min || this._lastOffset < 0 && this._value >= this.max ? (this._isElastic = !0, 
            this._checkElastic = !0) : this._isElastic = !1) : this._checkElastic = !0), this._isElastic ? this._value <= this.min ? this.value -= this._lastOffset * Math.max(0, 1 - (this.min - this._value) / this.elasticDistance) : this._value >= this.max && (this.value -= this._lastOffset * Math.max(0, 1 - (this._value - this.max) / this.elasticDistance)) : this.value -= this._lastOffset);
        }, __proto.onStageMouseUp2 = function(e) {
            if (Laya.stage.off("mouseup", this, this.onStageMouseUp2), Laya.stage.off("mouseout", this, this.onStageMouseUp2), 
            Laya.timer.clear(this, this.loop), !(this._clickOnly && this._value >= this.min && this._value <= this.max)) if (this._target.mouseEnabled = !0, 
            this._isElastic) this._value < this.min ? Tween.to(this, {
                value: this.min
            }, this.elasticBackTime, Ease.sineOut, Handler.create(this, this.elasticOver)) : this._value > this.max && Tween.to(this, {
                value: this.max
            }, this.elasticBackTime, Ease.sineOut, Handler.create(this, this.elasticOver)); else {
                if (!this._offsets) return;
                this._offsets.length < 1 && (this._offsets[0] = this.isVertical ? Laya.stage.mouseY - this._lastPoint.y : Laya.stage.mouseX - this._lastPoint.x);
                for (var offset = 0, n = Math.min(this._offsets.length, 3), i = 0; i < n; i++) offset += this._offsets[this._offsets.length - 1 - i];
                if (this._lastOffset = offset / n, (offset = Math.abs(this._lastOffset)) < 2) return void this.event("end");
                60 < offset && (this._lastOffset = 0 < this._lastOffset ? 60 : -60);
                var dis = Math.round(Math.abs(this.elasticDistance * (this._lastOffset / 240)));
                Laya.timer.frameLoop(1, this, this.tweenMove, [ dis ]);
            }
        }, __proto.elasticOver = function() {
            this._isElastic = !1, !this.hide && this.autoHide && Tween.to(this, {
                alpha: 0
            }, 500), this.event("end");
        }, __proto.tweenMove = function(maxDistance) {
            this._lastOffset *= this.rollRatio;
            var tarSpeed = NaN;
            if (0 < maxDistance && (0 < this._lastOffset && this.value <= this.min ? (this._isElastic = !0, 
            tarSpeed = .5 * -(this.min - maxDistance - this.value), this._lastOffset > tarSpeed && (this._lastOffset = tarSpeed)) : this._lastOffset < 0 && this.value >= this.max && (this._isElastic = !0, 
            tarSpeed = .5 * -(this.max + maxDistance - this.value), this._lastOffset < tarSpeed && (this._lastOffset = tarSpeed))), 
            this.value -= this._lastOffset, Math.abs(this._lastOffset) < 1) {
                if (Laya.timer.clear(this, this.tweenMove), this._isElastic) return void (this._value < this.min ? Tween.to(this, {
                    value: this.min
                }, this.elasticBackTime, Ease.sineOut, Handler.create(this, this.elasticOver)) : this._value > this.max ? Tween.to(this, {
                    value: this.max
                }, this.elasticBackTime, Ease.sineOut, Handler.create(this, this.elasticOver)) : this.elasticOver());
                this.event("end"), !this.hide && this.autoHide && Tween.to(this, {
                    alpha: 0
                }, 500);
            }
        }, __proto.stopScroll = function() {
            this.onStageMouseUp2(null), Laya.timer.clear(this, this.tweenMove), Tween.clearTween(this);
        }, __getset(0, __proto, "measureHeight", function() {
            return this.slider.isVertical ? 100 : this.slider.height;
        }), __getset(0, __proto, "skin", function() {
            return this._skin;
        }, function(value) {
            this._skin != value && (this._skin = value, this.slider.skin = this._skin, this.callLater(this.changeScrollBar));
        }), __getset(0, __proto, "max", function() {
            return this.slider.max;
        }, function(value) {
            this.slider.max = value;
        }), __getset(0, __proto, "showButtons", function() {
            return this._showButtons;
        }, function(value) {
            this._showButtons = value, this.callLater(this.changeScrollBar);
        }), __getset(0, __proto, "measureWidth", function() {
            return this.slider.isVertical ? this.slider.width : 100;
        }), __getset(0, __proto, "min", function() {
            return this.slider.min;
        }, function(value) {
            this.slider.min = value;
        }), __getset(0, __proto, "value", function() {
            return this._value;
        }, function(v) {
            v !== this._value && (this._value = v, this._isElastic || (this.slider._value != v && (this.slider._value = v, 
            this.slider.changeValue()), this._value = this.slider._value), this.event("change"), 
            this.changeHandler && this.changeHandler.runWith(this._value));
        }), __getset(0, __proto, "isVertical", function() {
            return this.slider.isVertical;
        }, function(value) {
            this.slider.isVertical = value;
        }), __getset(0, __proto, "sizeGrid", function() {
            return this.slider.sizeGrid;
        }, function(value) {
            this.slider.sizeGrid = value;
        }), __getset(0, __proto, "scrollSize", function() {
            return this._scrollSize;
        }, function(value) {
            this._scrollSize = value;
        }), __getset(0, __proto, "dataSource", _super.prototype._$get_dataSource, function(value) {
            "number" == typeof (this._dataSource = value) || "string" == typeof value ? this.value = Number(value) : Laya.superSet(Component, this, "dataSource", value);
        }), __getset(0, __proto, "thumbPercent", function() {
            return this._thumbPercent;
        }, function(value) {
            this.runCallLater(this.changeScrollBar), this.runCallLater(this.changeSize), value = 1 <= value ? .99 : value, 
            this._thumbPercent = value, this.scaleBar && (this.slider.isVertical ? this.slider.bar.height = Math.max(this.slider.height * value, Styles.scrollBarMinNum) : this.slider.bar.width = Math.max(this.slider.width * value, Styles.scrollBarMinNum));
        }), __getset(0, __proto, "target", function() {
            return this._target;
        }, function(value) {
            this._target && (this._target.off("mousewheel", this, this.onTargetMouseWheel), 
            this._target.off("mousedown", this, this.onTargetMouseDown)), (this._target = value) && (this._mouseWheelEnable && this._target.on("mousewheel", this, this.onTargetMouseWheel), 
            this._touchScrollEnable && this._target.on("mousedown", this, this.onTargetMouseDown));
        }), __getset(0, __proto, "hide", function() {
            return this._hide;
        }, function(value) {
            this._hide = value, this.visible = !value;
        }), __getset(0, __proto, "touchScrollEnable", function() {
            return this._touchScrollEnable;
        }, function(value) {
            this._touchScrollEnable = value, this.target = this._target;
        }), __getset(0, __proto, "mouseWheelEnable", function() {
            return this._mouseWheelEnable;
        }, function(value) {
            this._mouseWheelEnable = value, this.target = this._target;
        }), __getset(0, __proto, "tick", function() {
            return this.slider.tick;
        }, function(value) {
            this.slider.tick = value;
        }), ScrollBar;
    }(Component), Slider = function(_super) {
        function Slider(skin) {
            this.changeHandler = null, this.isVertical = !0, this.showLabel = !0, this._allowClickBack = !1, 
            this._max = 100, this._min = 0, this._tick = 1, this._value = 0, this._skin = null, 
            this._bg = null, this._progress = null, this._bar = null, this._tx = NaN, this._ty = NaN, 
            this._maxMove = NaN, this._globalSacle = null, Slider.__super.call(this), this.skin = skin;
        }
        __class(Slider, "laya.ui.Slider", _super);
        var __proto = Slider.prototype;
        return __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), _super.prototype.destroy.call(this, destroyChild), 
            this._bg && this._bg.destroy(destroyChild), this._bar && this._bar.destroy(destroyChild), 
            this._progress && this._progress.destroy(destroyChild), this._bg = null, this._bar = null, 
            this._progress = null, this.changeHandler = null;
        }, __proto.createChildren = function() {
            this.addChild(this._bg = new Image()), this.addChild(this._bar = new Button());
        }, __proto.initialize = function() {
            this._bar.on("mousedown", this, this.onBarMouseDown), this._bg.sizeGrid = this._bar.sizeGrid = "4,4,4,4,0", 
            this._progress && (this._progress.sizeGrid = this._bar.sizeGrid), this.allowClickBack = !0;
        }, __proto.onBarMouseDown = function(e) {
            this._globalSacle || (this._globalSacle = new Point()), this._globalSacle.setTo(this.globalScaleX || .01, this.globalScaleY || .01), 
            this._maxMove = this.isVertical ? this.height - this._bar.height : this.width - this._bar.width, 
            this._tx = Laya.stage.mouseX, this._ty = Laya.stage.mouseY, Laya.stage.on("mousemove", this, this.mouseMove), 
            Laya.stage.once("mouseup", this, this.mouseUp), Laya.stage.once("mouseout", this, this.mouseUp), 
            this.showValueText();
        }, __proto.showValueText = function() {
            if (this.showLabel) {
                var label = laya.ui.Slider.label;
                this.addChild(label), label.textField.changeText(this._value + ""), this.isVertical ? (label.x = this._bar.x + 20, 
                label.y = .5 * (this._bar.height - label.height) + this._bar.y) : (label.y = this._bar.y - 20, 
                label.x = .5 * (this._bar.width - label.width) + this._bar.x);
            }
        }, __proto.hideValueText = function() {
            laya.ui.Slider.label && laya.ui.Slider.label.removeSelf();
        }, __proto.mouseUp = function(e) {
            Laya.stage.off("mousemove", this, this.mouseMove), Laya.stage.off("mouseup", this, this.mouseUp), 
            Laya.stage.off("mouseout", this, this.mouseUp), this.sendChangeEvent("changed"), 
            this.hideValueText();
        }, __proto.mouseMove = function(e) {
            var oldValue = this._value;
            this.isVertical ? (this._bar.y += (Laya.stage.mouseY - this._ty) / this._globalSacle.y, 
            this._bar.y > this._maxMove ? this._bar.y = this._maxMove : this._bar.y < 0 && (this._bar.y = 0), 
            this._value = this._bar.y / this._maxMove * (this._max - this._min) + this._min, 
            this._progress && (this._progress.height = this._bar.y + .5 * this._bar.height)) : (this._bar.x += (Laya.stage.mouseX - this._tx) / this._globalSacle.x, 
            this._bar.x > this._maxMove ? this._bar.x = this._maxMove : this._bar.x < 0 && (this._bar.x = 0), 
            this._value = this._bar.x / this._maxMove * (this._max - this._min) + this._min, 
            this._progress && (this._progress.width = this._bar.x + .5 * this._bar.width)), 
            this._tx = Laya.stage.mouseX, this._ty = Laya.stage.mouseY;
            var pow = Math.pow(10, (this._tick + "").length - 1);
            this._value = Math.round(Math.round(this._value / this._tick) * this._tick * pow) / pow, 
            this._value != oldValue && this.sendChangeEvent(), this.showValueText();
        }, __proto.sendChangeEvent = function(type) {
            void 0 === type && (type = "change"), this.event(type), this.changeHandler && this.changeHandler.runWith(this._value);
        }, __proto.setBarPoint = function() {
            this.isVertical ? this._bar.x = Math.round(.5 * (this._bg.width - this._bar.width)) : this._bar.y = Math.round(.5 * (this._bg.height - this._bar.height));
        }, __proto.changeSize = function() {
            _super.prototype.changeSize.call(this), this.isVertical ? this._bg.height = this.height : this._bg.width = this.width, 
            this.setBarPoint(), this.changeValue();
        }, __proto.setSlider = function(min, max, value) {
            this._value = -1, this._min = min, this._max = min < max ? max : min, this.value = value < min ? min : max < value ? max : value;
        }, __proto.changeValue = function() {
            var pow = Math.pow(10, (this._tick + "").length - 1);
            this._value = Math.round(Math.round(this._value / this._tick) * this._tick * pow) / pow, 
            this._value = this._value > this._max ? this._max : this._value < this._min ? this._min : this._value;
            var num = this._max - this._min;
            0 === num && (num = 1), this.isVertical ? (this._bar.y = (this._value - this._min) / num * (this.height - this._bar.height), 
            this._progress && (this._progress.height = this._bar.y + .5 * this._bar.height)) : (this._bar.x = (this._value - this._min) / num * (this.width - this._bar.width), 
            this._progress && (this._progress.width = this._bar.x + .5 * this._bar.width));
        }, __proto.onBgMouseDown = function(e) {
            var point = this._bg.getMousePoint();
            this.isVertical ? this.value = point.y / (this.height - this._bar.height) * (this._max - this._min) + this._min : this.value = point.x / (this.width - this._bar.width) * (this._max - this._min) + this._min;
        }, __getset(0, __proto, "measureHeight", function() {
            return Math.max(this._bg.height, this._bar.height);
        }), __getset(0, __proto, "skin", function() {
            return this._skin;
        }, function(value) {
            if (this._skin != value) {
                this._skin = value, this._bg.skin = this._skin, this._bar.skin = this._skin.replace(".png", "$bar.png");
                var progressSkin = this._skin.replace(".png", "$progress.png");
                Loader.getRes(progressSkin) && (this._progress || (this.addChild(this._progress = new Image()), 
                this._progress.sizeGrid = this._bar.sizeGrid, this.setChildIndex(this._progress, 1)), 
                this._progress.skin = progressSkin), this.setBarPoint(), this.callLater(this.changeValue);
            }
        }), __getset(0, __proto, "allowClickBack", function() {
            return this._allowClickBack;
        }, function(value) {
            this._allowClickBack != value && ((this._allowClickBack = value) ? this._bg.on("mousedown", this, this.onBgMouseDown) : this._bg.off("mousedown", this, this.onBgMouseDown));
        }), __getset(0, __proto, "max", function() {
            return this._max;
        }, function(value) {
            this._max != value && (this._max = value, this.callLater(this.changeValue));
        }), __getset(0, __proto, "measureWidth", function() {
            return Math.max(this._bg.width, this._bar.width);
        }), __getset(0, __proto, "tick", function() {
            return this._tick;
        }, function(value) {
            this._tick != value && (this._tick = value, this.callLater(this.changeValue));
        }), __getset(0, __proto, "sizeGrid", function() {
            return this._bg.sizeGrid;
        }, function(value) {
            this._bg.sizeGrid = value, this._bar.sizeGrid = value, this._progress && (this._progress.sizeGrid = this._bar.sizeGrid);
        }), __getset(0, __proto, "min", function() {
            return this._min;
        }, function(value) {
            this._min != value && (this._min = value, this.callLater(this.changeValue));
        }), __getset(0, __proto, "value", function() {
            return this._value;
        }, function(num) {
            if (this._value != num) {
                var oldValue = this._value;
                this._value = num, this.changeValue(), this._value != oldValue && this.sendChangeEvent();
            }
        }), __getset(0, __proto, "dataSource", _super.prototype._$get_dataSource, function(value) {
            "number" == typeof (this._dataSource = value) || "string" == typeof value ? this.value = Number(value) : Laya.superSet(Component, this, "dataSource", value);
        }), __getset(0, __proto, "bar", function() {
            return this._bar;
        }), __static(Slider, [ "label", function() {
            return this.label = new Label();
        } ]), Slider;
    }(Component), Image = function(_super) {
        function Image(skin) {
            this._bitmap = null, this._skin = null, this._group = null, Image.__super.call(this), 
            this.skin = skin;
        }
        __class(Image, "laya.ui.Image", _super);
        var __proto = Image.prototype;
        return __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), _super.prototype.destroy.call(this, !0), 
            this._bitmap && this._bitmap.destroy(), this._bitmap = null, Loader.clearCache(this, this._skin);
        }, __proto.dispose = function() {
            this.destroy(!0), Loader.clearCache(this, this._skin);
        }, __proto.createChildren = function() {
            this.graphics = this._bitmap = new AutoBitmap();
        }, __proto.setSource = function(url, img) {
            url === this._skin && img && (this.source = img, this.onCompResize());
        }, __getset(0, __proto, "source", function() {
            return this._bitmap.source;
        }, function(value) {
            this._bitmap && (this._bitmap.source = value, this.event("loaded"), this.repaint());
        }), __getset(0, __proto, "dataSource", _super.prototype._$get_dataSource, function(value) {
            "string" == typeof (this._dataSource = value) ? this.skin = value : Laya.superSet(Component, this, "dataSource", value);
        }), __getset(0, __proto, "measureHeight", function() {
            return this._bitmap.height;
        }), __getset(0, __proto, "skin", function() {
            return this._skin;
        }, function(value) {
            if (this._skin != value) if (Loader.clearCache(this, this._skin), this._skin = value) {
                Loader.keepCache(this, this._skin);
                var source = Loader.getRes(value);
                source ? (this.source = source, this.onCompResize()) : Laya.loader.load(this._skin, Handler.create(this, this.setSource, [ this._skin ]), null, "image", 1, !0, this._group);
            } else this.source = null;
        }), __getset(0, __proto, "group", function() {
            return this._group;
        }, function(value) {
            value && this._skin && Loader.setGroup(this._skin, value), this._group = value;
        }), __getset(0, __proto, "sizeGrid", function() {
            return this._bitmap.sizeGrid ? this._bitmap.sizeGrid.join(",") : null;
        }, function(value) {
            this._bitmap.sizeGrid = UIUtils.fillArray(Styles.defaultSizeGrid, value, Number);
        }), __getset(0, __proto, "measureWidth", function() {
            return this._bitmap.width;
        }), __getset(0, __proto, "width", _super.prototype._$get_width, function(value) {
            Laya.superSet(Component, this, "width", value), this._bitmap.width = 0 == value ? 1e-7 : value;
        }), __getset(0, __proto, "height", _super.prototype._$get_height, function(value) {
            Laya.superSet(Component, this, "height", value), this._bitmap.height = 0 == value ? 1e-7 : value;
        }), Image;
    }(Component), Label = function(_super) {
        function Label(text) {
            this._tf = null, Label.__super.call(this), void 0 === text && (text = ""), Font.defaultColor = Styles.labelColor, 
            this.text = text;
        }
        __class(Label, "laya.ui.Label", _super);
        var __proto = Label.prototype;
        return __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), _super.prototype.destroy.call(this, destroyChild), 
            this._tf = null;
        }, __proto.createChildren = function() {
            this.addChild(this._tf = new Text());
        }, __proto.changeText = function(text) {
            this._tf.changeText(text);
        }, __getset(0, __proto, "padding", function() {
            return this._tf.padding.join(",");
        }, function(value) {
            this._tf.padding = UIUtils.fillArray(Styles.labelPadding, value, Number);
        }), __getset(0, __proto, "bold", function() {
            return this._tf.bold;
        }, function(value) {
            this._tf.bold = value;
        }), __getset(0, __proto, "align", function() {
            return this._tf.align;
        }, function(value) {
            this._tf.align = value;
        }), __getset(0, __proto, "text", function() {
            return this._tf.text;
        }, function(value) {
            this._tf.text != value && (value && (value = UIUtils.adptString(value + "")), this._tf.text = value, 
            this.event("change"), this._width && this._height || this.onCompResize());
        }), __getset(0, __proto, "italic", function() {
            return this._tf.italic;
        }, function(value) {
            this._tf.italic = value;
        }), __getset(0, __proto, "wordWrap", function() {
            return this._tf.wordWrap;
        }, function(value) {
            this._tf.wordWrap = value;
        }), __getset(0, __proto, "font", function() {
            return this._tf.font;
        }, function(value) {
            this._tf.font = value;
        }), __getset(0, __proto, "dataSource", _super.prototype._$get_dataSource, function(value) {
            "number" == typeof (this._dataSource = value) || "string" == typeof value ? this.text = value + "" : Laya.superSet(Component, this, "dataSource", value);
        }), __getset(0, __proto, "color", function() {
            return this._tf.color;
        }, function(value) {
            this._tf.color = value;
        }), __getset(0, __proto, "valign", function() {
            return this._tf.valign;
        }, function(value) {
            this._tf.valign = value;
        }), __getset(0, __proto, "leading", function() {
            return this._tf.leading;
        }, function(value) {
            this._tf.leading = value;
        }), __getset(0, __proto, "fontSize", function() {
            return this._tf.fontSize;
        }, function(value) {
            this._tf.fontSize = value;
        }), __getset(0, __proto, "bgColor", function() {
            return this._tf.bgColor;
        }, function(value) {
            this._tf.bgColor = value;
        }), __getset(0, __proto, "borderColor", function() {
            return this._tf.borderColor;
        }, function(value) {
            this._tf.borderColor = value;
        }), __getset(0, __proto, "stroke", function() {
            return this._tf.stroke;
        }, function(value) {
            this._tf.stroke = value;
        }), __getset(0, __proto, "strokeColor", function() {
            return this._tf.strokeColor;
        }, function(value) {
            this._tf.strokeColor = value;
        }), __getset(0, __proto, "textField", function() {
            return this._tf;
        }), __getset(0, __proto, "measureWidth", function() {
            return this._tf.width;
        }), __getset(0, __proto, "measureHeight", function() {
            return this._tf.height;
        }), __getset(0, __proto, "width", function() {
            return this._width || this._tf.text ? Laya.superGet(Component, this, "width") : 0;
        }, function(value) {
            Laya.superSet(Component, this, "width", value), this._tf.width = value;
        }), __getset(0, __proto, "height", function() {
            return this._height || this._tf.text ? Laya.superGet(Component, this, "height") : 0;
        }, function(value) {
            Laya.superSet(Component, this, "height", value), this._tf.height = value;
        }), __getset(0, __proto, "overflow", function() {
            return this._tf.overflow;
        }, function(value) {
            this._tf.overflow = value;
        }), __getset(0, __proto, "underline", function() {
            return this._tf.underline;
        }, function(value) {
            this._tf.underline = value;
        }), __getset(0, __proto, "underlineColor", function() {
            return this._tf.underlineColor;
        }, function(value) {
            this._tf.underlineColor = value;
        }), Label;
    }(Component), ProgressBar = function(_super) {
        function ProgressBar(skin) {
            this.changeHandler = null, this._bg = null, this._bar = null, this._skin = null, 
            this._value = .5, ProgressBar.__super.call(this), this.skin = skin;
        }
        __class(ProgressBar, "laya.ui.ProgressBar", _super);
        var __proto = ProgressBar.prototype;
        return __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), _super.prototype.destroy.call(this, destroyChild), 
            this._bg && this._bg.destroy(destroyChild), this._bar && this._bar.destroy(destroyChild), 
            this._bg = this._bar = null, this.changeHandler = null;
        }, __proto.createChildren = function() {
            this.addChild(this._bg = new Image()), this.addChild(this._bar = new Image());
        }, __proto.changeValue = function() {
            if (this.sizeGrid) {
                var grid = this.sizeGrid.split(","), left = Number(grid[3]), right = Number(grid[1]), sw = (this.width - left - right) * this._value;
                this._bar.width = left + right + sw, this._bar.visible = this._bar.width > left + right;
            } else this._bar.width = this.width * this._value;
        }, __getset(0, __proto, "measureHeight", function() {
            return this._bg.height;
        }), __getset(0, __proto, "skin", function() {
            return this._skin;
        }, function(value) {
            this._skin != value && (this._skin = value, this._bg.skin = this._skin, this._bar.skin = this._skin.replace(".png", "$bar.png"), 
            this.callLater(this.changeValue));
        }), __getset(0, __proto, "measureWidth", function() {
            return this._bg.width;
        }), __getset(0, __proto, "height", _super.prototype._$get_height, function(value) {
            Laya.superSet(Component, this, "height", value), this._bg.height = this._height, 
            this._bar.height = this._height;
        }), __getset(0, __proto, "bar", function() {
            return this._bar;
        }), __getset(0, __proto, "value", function() {
            return this._value;
        }, function(num) {
            this._value != num && (num = 1 < num ? 1 : num < 0 ? 0 : num, this._value = num, 
            this.callLater(this.changeValue), this.event("change"), this.changeHandler && this.changeHandler.runWith(num));
        }), __getset(0, __proto, "bg", function() {
            return this._bg;
        }), __getset(0, __proto, "sizeGrid", function() {
            return this._bg.sizeGrid;
        }, function(value) {
            this._bg.sizeGrid = this._bar.sizeGrid = value;
        }), __getset(0, __proto, "width", _super.prototype._$get_width, function(value) {
            Laya.superSet(Component, this, "width", value), this._bg.width = this._width, this.callLater(this.changeValue);
        }), __getset(0, __proto, "dataSource", _super.prototype._$get_dataSource, function(value) {
            "number" == typeof (this._dataSource = value) || "string" == typeof value ? this.value = Number(value) : Laya.superSet(Component, this, "dataSource", value);
        }), ProgressBar;
    }(Component), View = (function(_super) {
        function TipManager() {
            this._tipBox = null, this._tipText = null, this._defaultTipHandler = null, TipManager.__super.call(this), 
            this._tipBox = new Component(), this._tipBox.addChild(this._tipText = new Text()), 
            this._tipText.x = this._tipText.y = 5, this._tipText.color = TipManager.tipTextColor, 
            this._defaultTipHandler = this._showDefaultTip, Laya.stage.on("showtip", this, this._onStageShowTip), 
            Laya.stage.on("hidetip", this, this._onStageHideTip), this.zOrder = 1100;
        }
        __class(TipManager, "laya.ui.TipManager", Component);
        var __proto = TipManager.prototype;
        __proto._onStageHideTip = function(e) {
            Laya.timer.clear(this, this._showTip), this.closeAll(), this.removeSelf();
        }, __proto._onStageShowTip = function(data) {
            Laya.timer.once(TipManager.tipDelay, this, this._showTip, [ data ], !0);
        }, __proto._showTip = function(tip) {
            if ("string" == typeof tip) {
                var text = String(tip);
                Boolean(text) && this._defaultTipHandler(text);
            } else tip instanceof laya.utils.Handler ? tip.run() : "function" == typeof tip && tip.apply();
            Laya.stage.on("mousemove", this, this._onStageMouseMove), Laya.stage.on("mousedown", this, this._onStageMouseDown), 
            this._onStageMouseMove(null);
        }, __proto._onStageMouseDown = function(e) {
            this.closeAll();
        }, __proto._onStageMouseMove = function(e) {
            this._showToStage(this, TipManager.offsetX, TipManager.offsetY);
        }, __proto._showToStage = function(dis, offX, offY) {
            void 0 === offX && (offX = 0), void 0 === offY && (offY = 0);
            var rec = dis.getBounds();
            dis.x = Laya.stage.mouseX + offX, dis.y = Laya.stage.mouseY + offY, dis.x + rec.width > Laya.stage.width && (dis.x -= rec.width + offX), 
            dis.y + rec.height > Laya.stage.height && (dis.y -= rec.height + offY);
        }, __proto.closeAll = function() {
            Laya.timer.clear(this, this._showTip), Laya.stage.off("mousemove", this, this._onStageMouseMove), 
            Laya.stage.off("mousedown", this, this._onStageMouseDown), this.removeChildren();
        }, __proto.showDislayTip = function(tip) {
            this.addChild(tip), this._showToStage(this), Laya._currentStage.addChild(this);
        }, __proto._showDefaultTip = function(text) {
            this._tipText.text = text;
            var g = this._tipBox.graphics;
            g.clear(), g.drawRect(0, 0, this._tipText.width + 10, this._tipText.height + 10, TipManager.tipBackColor), 
            this.addChild(this._tipBox), this._showToStage(this), Laya._currentStage.addChild(this);
        }, __getset(0, __proto, "defaultTipHandler", function() {
            return this._defaultTipHandler;
        }, function(value) {
            this._defaultTipHandler = value;
        }), TipManager.offsetX = 10, TipManager.offsetY = 15, TipManager.tipTextColor = "#ffffff", 
        TipManager.tipBackColor = "#111111", TipManager.tipDelay = 200;
    }(), function(_super) {
        var DataWatcher;
        function View() {
            this._idMap = null, this._aniList = null, this._watchMap = {}, View.__super.call(this);
        }
        __class(View, "laya.ui.View", Box);
        var __proto = View.prototype;
        return __proto.createView = function(uiView) {
            if (uiView.animations && !this._idMap && (this._idMap = {}), View.createComp(uiView, this, this), 
            uiView.animations) {
                var tAni, tAniO, anilist = [], animations = uiView.animations, i = 0, len = animations.length;
                for (i = 0; i < len; i++) {
                    switch (tAni = new FrameAnimation(), tAniO = animations[i], tAni._setUp(this._idMap, tAniO), 
                    (this[tAniO.name] = tAni)._setControlNode(this), tAniO.action) {
                      case 1:
                        tAni.play(0, !1);
                        break;

                      case 2:
                        tAni.play(0, !0);
                    }
                    anilist.push(tAni);
                }
                this._aniList = anilist;
            }
            0 < this._width && null == uiView.props.hitTestPrior && !this.mouseThrough && (this.hitTestPrior = !0);
        }, __proto.onEvent = function(type, event) {}, __proto.loadUI = function(path) {
            var uiView = View.uiMap[path];
            uiView instanceof Uint8Array && (uiView = msgpack.decode(uiView)), uiView && this.createView(uiView);
        }, __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), this._aniList && (this._aniList.length = 0), 
            this._idMap = null, this._aniList = null, this._watchMap = null, laya.ui.Component.prototype.destroy.call(this, destroyChild);
        }, __proto.changeData = function(key) {
            var arr = this._watchMap[key];
            if (arr) {
                console.log("change", key);
                for (var i = 0, n = arr.length; i < n; i++) {
                    arr[i].exe(this);
                }
            }
        }, View._regs = function() {
            for (var key in View.uiClassMap) ClassUtils.regClass(key, View.uiClassMap[key]);
        }, View.createComp = function(uiView, comp, view, dataMap) {
            if (!(comp = comp || View.getCompInstance(uiView))) return console.warn("can not create:" + uiView.type), 
            null;
            var child = uiView.child;
            if (child) for (var isList = comp instanceof laya.ui.List, i = 0, n = child.length; i < n; i++) {
                var node = child[i];
                if (!comp.hasOwnProperty("itemRender") || "render" != node.props.name && "render" !== node.props.renderType) if ("Graphic" == node.type) ClassUtils.addGraphicsToSprite(node, comp); else if (ClassUtils.isDrawType(node.type)) ClassUtils.addGraphicToSprite(node, comp, !0); else {
                    if (isList) {
                        var arr = [], tChild = View.createComp(node, null, view, arr);
                        arr.length && (tChild._$bindData = arr);
                    } else tChild = View.createComp(node, null, view, dataMap);
                    "Script" == node.type ? "owner" in tChild ? tChild.owner = comp : "target" in tChild && (tChild.target = comp) : "mask" == node.props.renderType || "mask" == node.props.name ? comp.mask = tChild : tChild instanceof laya.display.Sprite && comp.addChild(tChild);
                } else comp.itemRender = node;
            }
            var props = uiView.props;
            for (var prop in props) {
                var value = props[prop];
                View.eventDic[prop] ? value && view && comp.on(prop, view, view.onEvent, [ value ]) : View.setCompValue(comp, prop, value, view, dataMap);
            }
            return Laya.__typeof(comp, "laya.ui.IItem") && comp.initItems(), uiView.compId && view && view._idMap && (view._idMap[uiView.compId] = comp), 
            comp;
        }, View.setCompValue = function(comp, prop, value, view, dataMap) {
            if ("string" == typeof value && -1 < value.indexOf("${")) {
                if (View._sheet || (View._sheet = ClassUtils.getClass("laya.data.Table")), !View._sheet) return void console.warn("Can not find class Sheet");
                if (dataMap) dataMap.push(comp, prop, value); else if (view) {
                    -1 == value.indexOf("].") && (value = value.replace(".", "[0]."));
                    var one, temp, watcher = new DataWatcher(comp, prop, value);
                    watcher.exe(view);
                    for (var str = value.replace(/\[.*?\]\./g, "."); null != (one = View._parseWatchData.exec(str)); ) {
                        for (var key1 = one[1]; null != (temp = View._parseKeyWord.exec(key1)); ) {
                            var key2 = temp[0], arr = view._watchMap[key2] || (view._watchMap[key2] = []);
                            arr.push(watcher), View._sheet.I.notifer.on(key2, view, view.changeData, [ key2 ]);
                        }
                        (arr = view._watchMap[key1] || (view._watchMap[key1] = [])).push(watcher), View._sheet.I.notifer.on(key1, view, view.changeData, [ key1 ]);
                    }
                }
            } else if ("var" === prop && view) view[value] = comp; else if ("onClick" == prop) {
                var fun = Laya._runScript("(function(){" + value + "})");
                comp.on("click", view, fun);
            } else comp[prop] = "true" === value || "false" !== value && value;
        }, View.getCompInstance = function(json) {
            var compClass, runtime = json.props ? json.props.runtime : null;
            return compClass = runtime ? View.viewClassMap[runtime] || View.uiClassMap[runtime] || Laya.__classmap[runtime] : View.uiClassMap[json.type], 
            json.props && json.props.hasOwnProperty("renderType") && "instance" == json.props.renderType ? compClass.instance : compClass ? new compClass() : null;
        }, View.regComponent = function(key, compClass) {
            View.uiClassMap[key] = compClass, ClassUtils.regClass(key, compClass);
        }, View.regViewRuntime = function(key, compClass) {
            View.viewClassMap[key] = compClass;
        }, View.uiMap = {}, View.viewClassMap = {}, View._sheet = null, __static(View, [ "uiClassMap", function() {
            return this.uiClassMap = {
                ViewStack: ViewStack,
                LinkButton: Button,
                TextArea: TextArea,
                ColorPicker: ColorPicker,
                Box: Box,
                Button: Button,
                CheckBox: CheckBox,
                Clip: Clip,
                ComboBox: ComboBox,
                Component: Component,
                HScrollBar: HScrollBar,
                HSlider: HSlider,
                Image: Image,
                Label: Label,
                List: List,
                Panel: Panel,
                ProgressBar: ProgressBar,
                Radio: Radio,
                RadioGroup: RadioGroup,
                ScrollBar: ScrollBar,
                Slider: Slider,
                Tab: Tab,
                TextInput: TextInput,
                View: View,
                VScrollBar: VScrollBar,
                VSlider: VSlider,
                Tree: Tree,
                HBox: HBox,
                VBox: VBox,
                Sprite: Sprite,
                Animation: Animation,
                Text: Text,
                FontClip: FontClip
            };
        }, "eventDic", function() {
            return this.eventDic = {
                mousedown: !0,
                mouseup: !0,
                mousemove: !0,
                mouseover: !0,
                mouseout: !0,
                click: !0,
                doubleclick: !0,
                rightmousedown: !0,
                rightmouseup: !0,
                rightclick: !0
            };
        }, "_parseWatchData", function() {
            return this._parseWatchData = /\${(.*?)}/g;
        }, "_parseKeyWord", function() {
            return this._parseKeyWord = /[a-zA-Z_][a-zA-Z0-9_]*(?:(?:\.[a-zA-Z_][a-zA-Z0-9_]*)+)/g;
        } ]), View.__init$ = function() {
            View._regs(), DataWatcher = function() {
                function DataWatcher(comp, prop, value) {
                    this.comp = null, this.prop = null, this.value = null, this.comp = comp, this.prop = prop, 
                    this.value = value;
                }
                return __class(DataWatcher, ""), DataWatcher.prototype.exe = function(view) {
                    var fun = UIUtils.getBindFun(this.value);
                    this.comp[this.prop] = fun.call(this, view);
                }, DataWatcher;
            }();
        }, View;
    }()), CheckBox = function(_super) {
        function CheckBox(skin, label) {
            void 0 === label && (label = ""), CheckBox.__super.call(this, skin, label);
        }
        __class(CheckBox, "laya.ui.CheckBox", _super);
        var __proto = CheckBox.prototype;
        return __proto.preinitialize = function() {
            laya.ui.Component.prototype.preinitialize.call(this), this.toggle = !0, this._autoSize = !1;
        }, __proto.initialize = function() {
            _super.prototype.initialize.call(this), this.createText(), this._text.align = "left", 
            this._text.valign = "top", this._text.width = 0;
        }, __getset(0, __proto, "dataSource", _super.prototype._$get_dataSource, function(value) {
            "boolean" == typeof (this._dataSource = value) ? this.selected = value : "string" == typeof value ? this.selected = "true" === value : Laya.superSet(Button, this, "dataSource", value);
        }), CheckBox;
    }(Button), LayoutBox = function(_super) {
        function LayoutBox() {
            this._space = 0, this._align = "none", this._itemChanged = !1, LayoutBox.__super.call(this);
        }
        __class(LayoutBox, "laya.ui.LayoutBox", Box);
        var __proto = LayoutBox.prototype;
        return __proto.addChild = function(child) {
            return child.on("resize", this, this.onResize), this._setItemChanged(), laya.display.Node.prototype.addChild.call(this, child);
        }, __proto.onResize = function(e) {
            this._setItemChanged();
        }, __proto.addChildAt = function(child, index) {
            return child.on("resize", this, this.onResize), this._setItemChanged(), laya.display.Node.prototype.addChildAt.call(this, child, index);
        }, __proto.removeChild = function(child) {
            return child.off("resize", this, this.onResize), this._setItemChanged(), laya.display.Node.prototype.removeChild.call(this, child);
        }, __proto.removeChildAt = function(index) {
            return this.getChildAt(index).off("resize", this, this.onResize), this._setItemChanged(), 
            laya.display.Node.prototype.removeChildAt.call(this, index);
        }, __proto.refresh = function() {
            this._setItemChanged();
        }, __proto.changeItems = function() {
            this._itemChanged = !1;
        }, __proto.sortItem = function(items) {
            items && items.sort(function(a, b) {
                return a.y - b.y;
            });
        }, __proto._setItemChanged = function() {
            this._itemChanged || (this._itemChanged = !0, this.callLater(this.changeItems));
        }, __getset(0, __proto, "space", function() {
            return this._space;
        }, function(value) {
            this._space = value, this._setItemChanged();
        }), __getset(0, __proto, "align", function() {
            return this._align;
        }, function(value) {
            this._align = value, this._setItemChanged();
        }), LayoutBox;
    }(), FontClip = function(_super) {
        function FontClip(skin, sheet) {
            this._valueArr = null, this._indexMap = null, this._sheet = null, this._direction = "horizontal", 
            this._spaceX = 0, this._spaceY = 0, this._align = "left", this._wordsW = 0, this._wordsH = 0, 
            FontClip.__super.call(this), skin && (this.skin = skin), sheet && (this.sheet = sheet);
        }
        __class(FontClip, "laya.ui.FontClip", _super);
        var __proto = FontClip.prototype;
        return __proto.createChildren = function() {
            this._bitmap = new AutoBitmap(), this.on("loaded", this, this._onClipLoaded);
        }, __proto._onClipLoaded = function() {
            this.callLater(this.changeValue);
        }, __proto.changeValue = function() {
            var texture;
            if (this._sources && (this._valueArr && (this.graphics.clear(!0), texture = this._sources[0]))) {
                var isHorizontal = "horizontal" === this._direction;
                isHorizontal ? (this._wordsW = this._valueArr.length * (texture.sourceWidth + this.spaceX), 
                this._wordsH = texture.sourceHeight) : (this._wordsW = texture.sourceWidth, this._wordsH = (texture.sourceHeight + this.spaceY) * this._valueArr.length);
                var dX = 0;
                if (this._width) switch (this._align) {
                  case "center":
                    dX = .5 * (this._width - this._wordsW);
                    break;

                  case "right":
                    dX = this._width - this._wordsW;
                    break;

                  default:
                    dX = 0;
                }
                for (var i = 0, sz = this._valueArr.length; i < sz; i++) {
                    var index = this._indexMap[this._valueArr.charAt(i)];
                    this.sources[index] && (texture = this.sources[index], isHorizontal ? this.graphics.drawTexture(texture, dX + i * (texture.sourceWidth + this.spaceX), 0, texture.sourceWidth, texture.sourceHeight) : this.graphics.drawTexture(texture, 0 + dX, i * (texture.sourceHeight + this.spaceY), texture.sourceWidth, texture.sourceHeight));
                }
                this._width || (this.resetLayoutX(), this.callLater(this.changeSize)), this._height || (this.resetLayoutY(), 
                this.callLater(this.changeSize));
            }
        }, __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), this._valueArr = null, this._indexMap = null, 
            this.graphics.clear(!0), this.removeSelf(), this.off("loaded", this, this._onClipLoaded), 
            _super.prototype.destroy.call(this, destroyChild);
        }, __getset(0, __proto, "sheet", function() {
            return this._sheet;
        }, function(value) {
            value += "";
            var arr = (this._sheet = value).split(" ");
            this._clipX = String(arr[0]).length, this.clipY = arr.length, this._indexMap = {};
            for (var i = 0; i < this._clipY; i++) for (var line = arr[i].split(""), j = 0, n = line.length; j < n; j++) this._indexMap[line[j]] = i * this._clipX + j;
        }), __getset(0, __proto, "height", _super.prototype._$get_height, function(value) {
            Laya.superSet(Clip, this, "height", value), this.callLater(this.changeValue);
        }), __getset(0, __proto, "direction", function() {
            return this._direction;
        }, function(value) {
            this._direction = value, this.callLater(this.changeValue);
        }), __getset(0, __proto, "value", function() {
            return this._valueArr ? this._valueArr : "";
        }, function(value) {
            value += "", this._valueArr = value, this.callLater(this.changeValue);
        }), __getset(0, __proto, "width", _super.prototype._$get_width, function(value) {
            Laya.superSet(Clip, this, "width", value), this.callLater(this.changeValue);
        }), __getset(0, __proto, "spaceX", function() {
            return this._spaceX;
        }, function(value) {
            this._spaceX = value, "horizontal" === this._direction && this.callLater(this.changeValue);
        }), __getset(0, __proto, "spaceY", function() {
            return this._spaceY;
        }, function(value) {
            this._spaceY = value, "horizontal" !== this._direction && this.callLater(this.changeValue);
        }), __getset(0, __proto, "align", function() {
            return this._align;
        }, function(v) {
            this._align = v, this.callLater(this.changeValue);
        }), __getset(0, __proto, "measureWidth", function() {
            return this._wordsW;
        }), __getset(0, __proto, "measureHeight", function() {
            return this._wordsH;
        }), FontClip;
    }(Clip), List = function(_super) {
        function List() {
            this.selectHandler = null, this.renderHandler = null, this.mouseHandler = null, 
            this.selectEnable = !1, this.totalPage = 0, this._content = null, this._scrollBar = null, 
            this._itemRender = null, this._repeatX = 0, this._repeatY = 0, this._repeatX2 = 0, 
            this._repeatY2 = 0, this._spaceX = 0, this._spaceY = 0, this._array = null, this._startIndex = 0, 
            this._selectedIndex = -1, this._page = 0, this._isVertical = !0, this._cellSize = 20, 
            this._cellOffset = 0, this._isMoved = !1, this.cacheContent = !1, this._createdLine = 0, 
            this._cellChanged = !1, this._cells = [], this._offset = new Point(), List.__super.call(this);
        }
        __class(List, "laya.ui.List", _super);
        var __proto = List.prototype;
        return Laya.imps(__proto, {
            "laya.ui.IRender": !0,
            "laya.ui.IItem": !0
        }), __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), this._content && this._content.destroy(destroyChild), 
            this._scrollBar && this._scrollBar.destroy(destroyChild), laya.ui.Component.prototype.destroy.call(this, destroyChild), 
            this._content = null, this._scrollBar = null, this._itemRender = null, this._cells = null, 
            this._array = null, this.selectHandler = this.renderHandler = this.mouseHandler = null;
        }, __proto.createChildren = function() {
            this.addChild(this._content = new Box());
        }, __proto.onScrollStart = function() {
            this._$P.cacheAs || (this._$P.cacheAs = Laya.superGet(Box, this, "cacheAs")), Laya.superSet(Box, this, "cacheAs", "none"), 
            this._scrollBar.once("end", this, this.onScrollEnd);
        }, __proto.onScrollEnd = function() {
            Laya.superSet(Box, this, "cacheAs", this._$P.cacheAs);
        }, __proto._removePreScrollBar = function() {
            var preNode = this.removeChildByName("scrollBar");
            preNode && preNode.destroy(!0);
        }, __proto.changeCells = function() {
            if (this._cellChanged = !1, this._itemRender) {
                this.scrollBar = this.getChildByName("scrollBar");
                var cell = this._getOneCell(), cellWidth = cell.width + this._spaceX || 1, cellHeight = cell.height + this._spaceY || 1;
                0 < this._width && (this._repeatX2 = this._isVertical ? Math.round(this._width / cellWidth) : Math.ceil(this._width / cellWidth)), 
                0 < this._height && (this._repeatY2 = this._isVertical ? Math.ceil(this._height / cellHeight) : Math.round(this._height / cellHeight));
                var listWidth = this._width ? this._width : cellWidth * this.repeatX - this._spaceX, listHeight = this._height ? this._height : cellHeight * this.repeatY - this._spaceY;
                this._cellSize = this._isVertical ? cellHeight : cellWidth, this._cellOffset = this._isVertical ? cellHeight * Math.max(this._repeatY2, this._repeatY) - listHeight - this._spaceY : cellWidth * Math.max(this._repeatX2, this._repeatX) - listWidth - this._spaceX, 
                this._isVertical && this._scrollBar ? this._scrollBar.height = listHeight : !this._isVertical && this._scrollBar && (this._scrollBar.width = listWidth), 
                this.setContentSize(listWidth, listHeight);
                var numX = this._isVertical ? this.repeatX : this.repeatY, numY = (this._isVertical ? this.repeatY : this.repeatX) + (this._scrollBar ? 1 : 0);
                this._createItems(0, numX, numY), this._createdLine = numY, this._array && (this.array = this._array, 
                this.runCallLater(this.renderItems));
            }
        }, __proto._getOneCell = function() {
            if (0 === this._cells.length) {
                var item = this.createItem();
                if (this._offset.setTo(item.x, item.y), this.cacheContent) return item;
                this._cells.push(item);
            }
            return this._cells[0];
        }, __proto._createItems = function(startY, numX, numY) {
            var box = this._content, cell = this._getOneCell(), cellWidth = cell.width + this._spaceX, cellHeight = cell.height + this._spaceY;
            if (this.cacheContent) {
                var cacheBox = new Box();
                cacheBox.cacheAsBitmap = !0, cacheBox.pos((this._isVertical ? 0 : startY) * cellWidth, (this._isVertical ? startY : 0) * cellHeight), 
                this._content.addChild(cacheBox), this._content.optimizeScrollRect = !0, box = cacheBox;
            } else {
                for (var arr = [], i = this._cells.length - 1; -1 < i; i--) {
                    var item = this._cells[i];
                    item.removeSelf(), arr.push(item);
                }
                this._cells.length = 0;
            }
            for (var k = startY; k < numY; k++) for (var l = 0; l < numX; l++) (cell = arr && arr.length ? arr.pop() : this.createItem()).x = (this._isVertical ? l : k) * cellWidth - box.x, 
            cell.y = (this._isVertical ? k : l) * cellHeight - box.y, cell.name = "item" + (k * numX + l), 
            box.addChild(cell), this.addCell(cell);
        }, __proto.createItem = function() {
            var arr = [];
            if ("function" == typeof this._itemRender) var box = new this._itemRender(); else box = View.createComp(this._itemRender, null, null, arr);
            if (0 == arr.length && box._watchMap) {
                var watchMap = box._watchMap;
                for (var name in watchMap) for (var a = watchMap[name], i = 0; i < a.length; i++) {
                    var watcher = a[i];
                    arr.push(watcher.comp, watcher.prop, watcher.value);
                }
            }
            return arr.length && (box._$bindData = arr), box;
        }, __proto.addCell = function(cell) {
            cell.on("click", this, this.onCellMouse), cell.on("rightclick", this, this.onCellMouse), 
            cell.on("mouseover", this, this.onCellMouse), cell.on("mouseout", this, this.onCellMouse), 
            cell.on("mousedown", this, this.onCellMouse), cell.on("mouseup", this, this.onCellMouse), 
            this._cells.push(cell);
        }, __proto.initItems = function() {
            if (!this._itemRender && null != this.getChildByName("item0")) {
                this.repeatX = 1;
                for (var count = 0, i = count = 0; i < 1e4; i++) {
                    var cell = this.getChildByName("item" + i);
                    if (!cell) break;
                    this.addCell(cell), count++;
                }
                this.repeatY = count;
            }
        }, __proto.setContentSize = function(width, height) {
            this._content.width = width, this._content.height = height, (this._scrollBar || 0 != this._offset.x || 0 != this._offset.y) && (this._content.scrollRect || (this._content.scrollRect = new Rectangle()), 
            this._content.scrollRect.setTo(-this._offset.x, -this._offset.y, width, height), 
            this._content.scrollRect = this._content.scrollRect), this.event("resize");
        }, __proto.onCellMouse = function(e) {
            "mousedown" === e.type && (this._isMoved = !1);
            var cell = e.currentTarget, index = this._startIndex + this._cells.indexOf(cell);
            index < 0 || ("click" === e.type || "rightclick" === e.type ? this.selectEnable && !this._isMoved ? this.selectedIndex = index : this.changeCellState(cell, !0, 0) : "mouseover" !== e.type && "mouseout" !== e.type || this._selectedIndex === index || this.changeCellState(cell, "mouseover" === e.type, 0), 
            this.mouseHandler && this.mouseHandler.runWith([ e, index ]));
        }, __proto.changeCellState = function(cell, visable, index) {
            var selectBox = cell.getChildByName("selectBox");
            selectBox && (this.selectEnable = !0, selectBox.visible = visable, selectBox.index = index);
        }, __proto.changeSize = function() {
            laya.ui.Component.prototype.changeSize.call(this), this.setContentSize(this.width, this.height), 
            this._scrollBar && this.callLater(this.onScrollBarChange);
        }, __proto.onScrollBarChange = function(e) {
            this.runCallLater(this.changeCells);
            var scrollValue = this._scrollBar.value, lineX = this._isVertical ? this.repeatX : this.repeatY, lineY = this._isVertical ? this.repeatY : this.repeatX, scrollLine = Math.floor(scrollValue / this._cellSize);
            if (this.cacheContent) num = lineY + 1, this._createdLine - scrollLine < num && (this._createItems(this._createdLine, lineX, this._createdLine + num), 
            this.renderItems(this._createdLine * lineX, 0), this._createdLine += num); else {
                var index = scrollLine * lineX, num = 0;
                if (index > this._startIndex) {
                    num = index - this._startIndex;
                    var down = !0, toIndex = this._startIndex + lineX * (lineY + 1);
                    this._isMoved = !0;
                } else index < this._startIndex && (num = this._startIndex - index, down = !1, toIndex = this._startIndex - 1, 
                this._isMoved = !0);
                for (var i = 0; i < num; i++) {
                    if (down) {
                        var cell = this._cells.shift();
                        this._cells[this._cells.length] = cell;
                        var cellIndex = toIndex + i;
                    } else cell = this._cells.pop(), this._cells.unshift(cell), cellIndex = toIndex - i;
                    var pos = Math.floor(cellIndex / lineX) * this._cellSize;
                    this._isVertical ? cell.y = pos : cell.x = pos, this.renderItem(cell, cellIndex);
                }
                this._startIndex = index, this.changeSelectStatus();
            }
            var r = this._content.scrollRect;
            this._isVertical ? (r.y = scrollValue - this._offset.y, r.x = -this._offset.x) : (r.y = -this._offset.y, 
            r.x = scrollValue - this._offset.x), this._content.scrollRect = r;
        }, __proto.posCell = function(cell, cellIndex) {
            if (this._scrollBar) {
                var lineX = this._isVertical ? this.repeatX : this.repeatY, pos = (this._isVertical ? this.repeatY : this.repeatX, 
                Math.floor(cellIndex / lineX) * this._cellSize);
                this._isVertical ? cell.y = pos : cell.x = pos;
            }
        }, __proto.changeSelectStatus = function() {
            for (var i = 0, n = this._cells.length; i < n; i++) this.changeCellState(this._cells[i], this._selectedIndex === this._startIndex + i, 1);
        }, __proto.renderItems = function(from, to) {
            void 0 === from && (from = 0), void 0 === to && (to = 0);
            for (var i = from, n = to || this._cells.length; i < n; i++) this.renderItem(this._cells[i], this._startIndex + i);
            this.changeSelectStatus();
        }, __proto.renderItem = function(cell, index) {
            this._array && 0 <= index && index < this._array.length ? (cell.visible = !0, cell._$bindData ? (cell._dataSource = this._array[index], 
            this._bindData(cell, this._array[index])) : cell.dataSource = this._array[index], 
            this.cacheContent || this.posCell(cell, index), this.hasListener("render") && this.event("render", [ cell, index ]), 
            this.renderHandler && this.renderHandler.runWith([ cell, index ])) : (cell.visible = !1, 
            cell.dataSource = null);
        }, __proto._bindData = function(cell, data) {
            for (var arr = cell._$bindData, i = 0, n = arr.length; i < n; i++) {
                var ele = arr[i++], prop = arr[i++], value = arr[i], fun = UIUtils.getBindFun(value);
                ele[prop] = fun.call(this, data);
            }
        }, __proto.refresh = function() {
            this.array = this._array;
        }, __proto.getItem = function(index) {
            return -1 < index && index < this._array.length ? this._array[index] : null;
        }, __proto.changeItem = function(index, source) {
            -1 < index && index < this._array.length && (this._array[index] = source, index >= this._startIndex && index < this._startIndex + this._cells.length && this.renderItem(this.getCell(index), index));
        }, __proto.setItem = function(index, source) {
            this.changeItem(index, source);
        }, __proto.addItem = function(souce) {
            this._array.push(souce), this.array = this._array;
        }, __proto.addItemAt = function(souce, index) {
            this._array.splice(index, 0, souce), this.array = this._array;
        }, __proto.deleteItem = function(index) {
            this._array.splice(index, 1), this.array = this._array;
        }, __proto.getCell = function(index) {
            return this.runCallLater(this.changeCells), -1 < index && this._cells ? this._cells[(index - this._startIndex) % this._cells.length] : null;
        }, __proto.scrollTo = function(index) {
            if (this._scrollBar) {
                var numX = this._isVertical ? this.repeatX : this.repeatY;
                this._scrollBar.value = Math.floor(index / numX) * this._cellSize;
            } else this.startIndex = index;
        }, __proto.tweenTo = function(index, time, complete) {
            if (void 0 === time && (time = 200), this._scrollBar) {
                var numX = this._isVertical ? this.repeatX : this.repeatY;
                Tween.to(this._scrollBar, {
                    value: Math.floor(index / numX) * this._cellSize
                }, time, null, complete, 0, !0);
            } else this.startIndex = index, complete && complete.run();
        }, __proto._setCellChanged = function() {
            this._cellChanged || (this._cellChanged = !0, this.callLater(this.changeCells));
        }, __proto.commitMeasure = function() {
            this.runCallLater(this.changeCells);
        }, __getset(0, __proto, "cacheAs", _super.prototype._$get_cacheAs, function(value) {
            Laya.superSet(Box, this, "cacheAs", value), this._scrollBar && (this._$P.cacheAs = null, 
            "none" !== value ? this._scrollBar.on("start", this, this.onScrollStart) : this._scrollBar.off("start", this, this.onScrollStart));
        }), __getset(0, __proto, "content", function() {
            return this._content;
        }), __getset(0, __proto, "height", _super.prototype._$get_height, function(value) {
            value != this._height && (Laya.superSet(Box, this, "height", value), this._setCellChanged());
        }), __getset(0, __proto, "itemRender", function() {
            return this._itemRender;
        }, function(value) {
            if (this._itemRender != value) {
                this._itemRender = value;
                for (var i = this._cells.length - 1; -1 < i; i--) this._cells[i].destroy();
                this._cells.length = 0, this._setCellChanged();
            }
        }), __getset(0, __proto, "vScrollBarSkin", function() {
            return this._scrollBar ? this._scrollBar.skin : null;
        }, function(value) {
            this._removePreScrollBar();
            var scrollBar = new VScrollBar();
            scrollBar.name = "scrollBar", scrollBar.right = 0, value && " " != value && (scrollBar.skin = value), 
            this.scrollBar = scrollBar, this.addChild(scrollBar), this._setCellChanged();
        }), __getset(0, __proto, "page", function() {
            return this._page;
        }, function(value) {
            this._page = value, this._array && (this._page = 0 < value ? value : 0, this._page = this._page < this.totalPage ? this._page : this.totalPage - 1, 
            this.startIndex = this._page * this.repeatX * this.repeatY);
        }), __getset(0, __proto, "hScrollBarSkin", function() {
            return this._scrollBar ? this._scrollBar.skin : null;
        }, function(value) {
            this._removePreScrollBar();
            var scrollBar = new HScrollBar();
            scrollBar.name = "scrollBar", scrollBar.bottom = 0, value && " " != value && (scrollBar.skin = value), 
            this.scrollBar = scrollBar, this.addChild(scrollBar), this._setCellChanged();
        }), __getset(0, __proto, "repeatX", function() {
            return 0 < this._repeatX ? this._repeatX : 0 < this._repeatX2 ? this._repeatX2 : 1;
        }, function(value) {
            this._repeatX = value, this._setCellChanged();
        }), __getset(0, __proto, "scrollBar", function() {
            return this._scrollBar;
        }, function(value) {
            this._scrollBar != value && (this._scrollBar = value) && (this._isVertical = this._scrollBar.isVertical, 
            this.addChild(this._scrollBar), this._scrollBar.on("change", this, this.onScrollBarChange));
        }), __getset(0, __proto, "width", _super.prototype._$get_width, function(value) {
            value != this._width && (Laya.superSet(Box, this, "width", value), this._setCellChanged());
        }), __getset(0, __proto, "repeatY", function() {
            return 0 < this._repeatY ? this._repeatY : 0 < this._repeatY2 ? this._repeatY2 : 1;
        }, function(value) {
            this._repeatY = value, this._setCellChanged();
        }), __getset(0, __proto, "spaceX", function() {
            return this._spaceX;
        }, function(value) {
            this._spaceX = value, this._setCellChanged();
        }), __getset(0, __proto, "spaceY", function() {
            return this._spaceY;
        }, function(value) {
            this._spaceY = value, this._setCellChanged();
        }), __getset(0, __proto, "selectedIndex", function() {
            return this._selectedIndex;
        }, function(value) {
            this._selectedIndex != value && (this._selectedIndex = value, this.changeSelectStatus(), 
            this.event("change"), this.selectHandler && this.selectHandler.runWith(value), this.startIndex = this._startIndex);
        }), __getset(0, __proto, "selectedItem", function() {
            return -1 != this._selectedIndex ? this._array[this._selectedIndex] : null;
        }, function(value) {
            this.selectedIndex = this._array.indexOf(value);
        }), __getset(0, __proto, "length", function() {
            return this._array ? this._array.length : 0;
        }), __getset(0, __proto, "selection", function() {
            return this.getCell(this._selectedIndex);
        }, function(value) {
            this.selectedIndex = this._startIndex + this._cells.indexOf(value);
        }), __getset(0, __proto, "startIndex", function() {
            return this._startIndex;
        }, function(value) {
            this._startIndex = 0 < value ? value : 0, this.callLater(this.renderItems);
        }), __getset(0, __proto, "array", function() {
            return this._array;
        }, function(value) {
            this.runCallLater(this.changeCells), this._array = value || [];
            var length = this._array.length;
            if (this.totalPage = Math.ceil(length / (this.repeatX * this.repeatY)), this._selectedIndex = this._selectedIndex < length ? this._selectedIndex : length - 1, 
            this.startIndex = this._startIndex, this._scrollBar) {
                this._scrollBar.stopScroll();
                var numX = this._isVertical ? this.repeatX : this.repeatY, numY = this._isVertical ? this.repeatY : this.repeatX, lineCount = Math.ceil(length / numX);
                1 < (0 < this._cellOffset ? this.totalPage + 1 : this.totalPage) ? (this._scrollBar.scrollSize = this._cellSize, 
                this._scrollBar.thumbPercent = numY / lineCount, this._scrollBar.setScroll(0, (lineCount - numY) * this._cellSize + this._cellOffset, this._scrollBar.value)) : this._scrollBar.setScroll(0, 0, 0), 
                this._scrollBar.target = this._content;
            }
        }), __getset(0, __proto, "dataSource", _super.prototype._$get_dataSource, function(value) {
            "number" == typeof (this._dataSource = value) && Math.floor(value) == value || "string" == typeof value ? this.selectedIndex = parseInt(value) : value instanceof Array ? this.array = value : Laya.superSet(Box, this, "dataSource", value);
        }), __getset(0, __proto, "cells", function() {
            return this.runCallLater(this.changeCells), this._cells;
        }), List;
    }(Box), HScrollBar = function(_super) {
        function HScrollBar() {
            HScrollBar.__super.call(this);
        }
        return __class(HScrollBar, "laya.ui.HScrollBar", _super), HScrollBar.prototype.initialize = function() {
            _super.prototype.initialize.call(this), this.slider.isVertical = !1;
        }, HScrollBar;
    }(ScrollBar), Panel = function(_super) {
        function Panel() {
            this._content = null, this._vScrollBar = null, this._hScrollBar = null, this._scrollChanged = !1, 
            Panel.__super.call(this), this.width = this.height = 100;
        }
        __class(Panel, "laya.ui.Panel", _super);
        var __proto = Panel.prototype;
        return __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), laya.ui.Component.prototype.destroy.call(this, destroyChild), 
            this._content && this._content.destroy(destroyChild), this._vScrollBar && this._vScrollBar.destroy(destroyChild), 
            this._hScrollBar && this._hScrollBar.destroy(destroyChild), this._vScrollBar = null, 
            this._hScrollBar = null, this._content = null;
        }, __proto.destroyChildren = function() {
            this._content.destroyChildren();
        }, __proto.createChildren = function() {
            laya.display.Node.prototype.addChild.call(this, this._content = new Box());
        }, __proto.addChild = function(child) {
            return child.on("resize", this, this.onResize), this._setScrollChanged(), this._content.addChild(child);
        }, __proto.onResize = function() {
            this._setScrollChanged();
        }, __proto.addChildAt = function(child, index) {
            return child.on("resize", this, this.onResize), this._setScrollChanged(), this._content.addChildAt(child, index);
        }, __proto.removeChild = function(child) {
            return child.off("resize", this, this.onResize), this._setScrollChanged(), this._content.removeChild(child);
        }, __proto.removeChildAt = function(index) {
            return this.getChildAt(index).off("resize", this, this.onResize), this._setScrollChanged(), 
            this._content.removeChildAt(index);
        }, __proto.removeChildren = function(beginIndex, endIndex) {
            return void 0 === beginIndex && (beginIndex = 0), void 0 === endIndex && (endIndex = 2147483647), 
            this._content.removeChildren(beginIndex, endIndex), this._setScrollChanged(), this;
        }, __proto.getChildAt = function(index) {
            return this._content.getChildAt(index);
        }, __proto.getChildByName = function(name) {
            return this._content.getChildByName(name);
        }, __proto.getChildIndex = function(child) {
            return this._content.getChildIndex(child);
        }, __proto.changeScroll = function() {
            this._scrollChanged = !1;
            var contentW = this.contentWidth || 1, contentH = this.contentHeight || 1, vscroll = this._vScrollBar, hscroll = this._hScrollBar, vShow = vscroll && contentH > this._height, hShow = hscroll && contentW > this._width, showWidth = vShow ? this._width - vscroll.width : this._width, showHeight = hShow ? this._height - hscroll.height : this._height;
            vscroll && (vscroll.x = this._width - vscroll.width, vscroll.y = 0, vscroll.height = this._height - (hShow ? hscroll.height : 0), 
            vscroll.scrollSize = Math.max(.033 * this._height, 1), vscroll.thumbPercent = showHeight / contentH, 
            vscroll.setScroll(0, contentH - showHeight, vscroll.value)), hscroll && (hscroll.x = 0, 
            hscroll.y = this._height - hscroll.height, hscroll.width = this._width - (vShow ? vscroll.width : 0), 
            hscroll.scrollSize = Math.max(.033 * this._width, 1), hscroll.thumbPercent = showWidth / contentW, 
            hscroll.setScroll(0, contentW - showWidth, hscroll.value));
        }, __proto.changeSize = function() {
            laya.ui.Component.prototype.changeSize.call(this), this.setContentSize(this._width, this._height);
        }, __proto.setContentSize = function(width, height) {
            var content = this._content;
            content.width = width, content.height = height, content.scrollRect || (content.scrollRect = new Rectangle()), 
            content.scrollRect.setTo(0, 0, width, height), content.scrollRect = content.scrollRect;
        }, __proto.onScrollBarChange = function(scrollBar) {
            var rect = this._content.scrollRect;
            if (rect) {
                var start = Math.round(scrollBar.value);
                scrollBar.isVertical ? rect.y = start : rect.x = start, this._content.scrollRect = rect;
            }
        }, __proto.scrollTo = function(x, y) {
            void 0 === x && (x = 0), void 0 === y && (y = 0), this.vScrollBar && (this.vScrollBar.value = y), 
            this.hScrollBar && (this.hScrollBar.value = x);
        }, __proto.refresh = function() {
            this.changeScroll();
        }, __proto.onScrollStart = function() {
            this._$P.cacheAs || (this._$P.cacheAs = Laya.superGet(Box, this, "cacheAs")), Laya.superSet(Box, this, "cacheAs", "none"), 
            this._hScrollBar && this._hScrollBar.once("end", this, this.onScrollEnd), this._vScrollBar && this._vScrollBar.once("end", this, this.onScrollEnd);
        }, __proto.onScrollEnd = function() {
            Laya.superSet(Box, this, "cacheAs", this._$P.cacheAs);
        }, __proto._setScrollChanged = function() {
            this._scrollChanged || (this._scrollChanged = !0, this.callLater(this.changeScroll));
        }, __getset(0, __proto, "numChildren", function() {
            return this._content.numChildren;
        }), __getset(0, __proto, "hScrollBarSkin", function() {
            return this._hScrollBar ? this._hScrollBar.skin : null;
        }, function(value) {
            null == this._hScrollBar && (laya.display.Node.prototype.addChild.call(this, this._hScrollBar = new HScrollBar()), 
            this._hScrollBar.on("change", this, this.onScrollBarChange, [ this._hScrollBar ]), 
            this._hScrollBar.target = this._content, this._setScrollChanged()), this._hScrollBar.skin = value;
        }), __getset(0, __proto, "contentWidth", function() {
            for (var max = 0, i = this._content.numChildren - 1; -1 < i; i--) {
                var comp = this._content.getChildAt(i);
                max = Math.max(comp.x + comp.width * comp.scaleX, max);
            }
            return max;
        }), __getset(0, __proto, "contentHeight", function() {
            for (var max = 0, i = this._content.numChildren - 1; -1 < i; i--) {
                var comp = this._content.getChildAt(i);
                max = Math.max(comp.y + comp.height * comp.scaleY, max);
            }
            return max;
        }), __getset(0, __proto, "width", _super.prototype._$get_width, function(value) {
            Laya.superSet(Box, this, "width", value), this._setScrollChanged();
        }), __getset(0, __proto, "hScrollBar", function() {
            return this._hScrollBar;
        }), __getset(0, __proto, "content", function() {
            return this._content;
        }), __getset(0, __proto, "height", _super.prototype._$get_height, function(value) {
            Laya.superSet(Box, this, "height", value), this._setScrollChanged();
        }), __getset(0, __proto, "vScrollBarSkin", function() {
            return this._vScrollBar ? this._vScrollBar.skin : null;
        }, function(value) {
            null == this._vScrollBar && (laya.display.Node.prototype.addChild.call(this, this._vScrollBar = new VScrollBar()), 
            this._vScrollBar.on("change", this, this.onScrollBarChange, [ this._vScrollBar ]), 
            this._vScrollBar.target = this._content, this._setScrollChanged()), this._vScrollBar.skin = value;
        }), __getset(0, __proto, "vScrollBar", function() {
            return this._vScrollBar;
        }), __getset(0, __proto, "cacheAs", _super.prototype._$get_cacheAs, function(value) {
            Laya.superSet(Box, this, "cacheAs", value), this._$P.cacheAs = null, "none" !== value ? (this._hScrollBar && this._hScrollBar.on("start", this, this.onScrollStart), 
            this._vScrollBar && this._vScrollBar.on("start", this, this.onScrollStart)) : (this._hScrollBar && this._hScrollBar.off("start", this, this.onScrollStart), 
            this._vScrollBar && this._vScrollBar.off("start", this, this.onScrollStart));
        }), Panel;
    }(Box), HSlider = function(_super) {
        function HSlider(skin) {
            HSlider.__super.call(this, skin), this.isVertical = !1;
        }
        return __class(HSlider, "laya.ui.HSlider", Slider), HSlider;
    }(), UIGroup = function(_super) {
        function UIGroup(labels, skin) {
            this.selectHandler = null, this._items = null, this._selectedIndex = -1, this._skin = null, 
            this._direction = "horizontal", this._space = 0, this._labels = null, this._labelColors = null, 
            this._labelFont = null, this._labelStrokeColor = null, this._strokeColors = null, 
            this._labelStroke = NaN, this._labelSize = 0, this._labelBold = !1, this._labelPadding = null, 
            this._labelAlign = null, this._stateNum = 0, this._labelChanged = !1, UIGroup.__super.call(this), 
            this.skin = skin, this.labels = labels;
        }
        __class(UIGroup, "laya.ui.UIGroup", _super);
        var __proto = UIGroup.prototype;
        return Laya.imps(__proto, {
            "laya.ui.IItem": !0
        }), __proto.preinitialize = function() {
            this.mouseEnabled = !0;
        }, __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), laya.ui.Component.prototype.destroy.call(this, destroyChild), 
            this._items && (this._items.length = 0), this._items = null, this.selectHandler = null;
        }, __proto.addItem = function(item, autoLayOut) {
            void 0 === autoLayOut && (autoLayOut = !0);
            var display = item, index = this._items.length;
            if (display.name = "item" + index, this.addChild(display), this.initItems(), autoLayOut && 0 < index) {
                var preItem = this._items[index - 1];
                "horizontal" == this._direction ? display.x = preItem.x + preItem.width + this._space : display.y = preItem.y + preItem.height + this._space;
            } else autoLayOut && (display.x = 0, display.y = 0);
            return index;
        }, __proto.delItem = function(item, autoLayOut) {
            void 0 === autoLayOut && (autoLayOut = !0);
            var index = this._items.indexOf(item);
            if (-1 != index) {
                var display = item;
                this.removeChild(display);
                for (var i = index + 1, n = this._items.length; i < n; i++) {
                    var child = this._items[i];
                    child.name = "item" + (i - 1), autoLayOut && ("horizontal" == this._direction ? child.x -= display.width + this._space : child.y -= display.height + this._space);
                }
                if (this.initItems(), -1 < this._selectedIndex) {
                    var newIndex;
                    newIndex = this._selectedIndex < this._items.length ? this._selectedIndex : this._selectedIndex - 1, 
                    this._selectedIndex = -1, this.selectedIndex = newIndex;
                }
            }
        }, __proto.initItems = function() {
            this._items || (this._items = []);
            for (var i = this._items.length = 0; i < 1e4; i++) {
                var item = this.getChildByName("item" + i);
                if (null == item) break;
                this._items.push(item), item.selected = i === this._selectedIndex, item.clickHandler = Handler.create(this, this.itemClick, [ i ], !1);
            }
        }, __proto.itemClick = function(index) {
            this.selectedIndex = index;
        }, __proto.setSelect = function(index, selected) {
            this._items && -1 < index && index < this._items.length && (this._items[index].selected = selected);
        }, __proto.createItem = function(skin, label) {
            return null;
        }, __proto.changeLabels = function() {
            if (this._labelChanged = !1, this._items) for (var left = 0, i = 0, n = this._items.length; i < n; i++) {
                var btn = this._items[i];
                this._skin && (btn.skin = this._skin), this._labelColors && (btn.labelColors = this._labelColors), 
                this._labelSize && (btn.labelSize = this._labelSize), this._labelStroke && (btn.labelStroke = this._labelStroke), 
                this._labelStrokeColor && (btn.labelStrokeColor = this._labelStrokeColor), this._strokeColors && (btn.strokeColors = this._strokeColors), 
                this._labelBold && (btn.labelBold = this._labelBold), this._labelPadding && (btn.labelPadding = this._labelPadding), 
                this._labelAlign && (btn.labelAlign = this._labelAlign), this._stateNum && (btn.stateNum = this._stateNum), 
                this._labelFont && (btn.labelFont = this._labelFont), "horizontal" === this._direction ? (btn.y = 0, 
                btn.x = left, left += btn.width + this._space) : (btn.x = 0, btn.y = left, left += btn.height + this._space);
            }
            this.changeSize();
        }, __proto.commitMeasure = function() {
            this.runCallLater(this.changeLabels);
        }, __proto._setLabelChanged = function() {
            this._labelChanged || (this._labelChanged = !0, this.callLater(this.changeLabels));
        }, __getset(0, __proto, "labelStrokeColor", function() {
            return this._labelStrokeColor;
        }, function(value) {
            this._labelStrokeColor != value && (this._labelStrokeColor = value, this._setLabelChanged());
        }), __getset(0, __proto, "skin", function() {
            return this._skin;
        }, function(value) {
            this._skin != value && (this._skin = value, this._setLabelChanged());
        }), __getset(0, __proto, "selectedIndex", function() {
            return this._selectedIndex;
        }, function(value) {
            this._selectedIndex != value && (this.setSelect(this._selectedIndex, !1), this._selectedIndex = value, 
            this.setSelect(value, !0), this.event("change"), this.selectHandler && this.selectHandler.runWith(this._selectedIndex));
        }), __getset(0, __proto, "labels", function() {
            return this._labels;
        }, function(value) {
            if (this._labels != value) {
                if (this._labels = value, this.removeChildren(), this._setLabelChanged(), this._labels) for (var a = this._labels.split(","), i = 0, n = a.length; i < n; i++) {
                    var item = this.createItem(this._skin, a[i]);
                    item.name = "item" + i, this.addChild(item);
                }
                this.initItems();
            }
        }), __getset(0, __proto, "strokeColors", function() {
            return this._strokeColors;
        }, function(value) {
            this._strokeColors != value && (this._strokeColors = value, this._setLabelChanged());
        }), __getset(0, __proto, "labelColors", function() {
            return this._labelColors;
        }, function(value) {
            this._labelColors != value && (this._labelColors = value, this._setLabelChanged());
        }), __getset(0, __proto, "labelStroke", function() {
            return this._labelStroke;
        }, function(value) {
            this._labelStroke != value && (this._labelStroke = value, this._setLabelChanged());
        }), __getset(0, __proto, "labelSize", function() {
            return this._labelSize;
        }, function(value) {
            this._labelSize != value && (this._labelSize = value, this._setLabelChanged());
        }), __getset(0, __proto, "stateNum", function() {
            return this._stateNum;
        }, function(value) {
            this._stateNum != value && (this._stateNum = value, this._setLabelChanged());
        }), __getset(0, __proto, "labelBold", function() {
            return this._labelBold;
        }, function(value) {
            this._labelBold != value && (this._labelBold = value, this._setLabelChanged());
        }), __getset(0, __proto, "labelFont", function() {
            return this._labelFont;
        }, function(value) {
            this._labelFont != value && (this._labelFont = value, this._setLabelChanged());
        }), __getset(0, __proto, "labelPadding", function() {
            return this._labelPadding;
        }, function(value) {
            this._labelPadding != value && (this._labelPadding = value, this._setLabelChanged());
        }), __getset(0, __proto, "direction", function() {
            return this._direction;
        }, function(value) {
            this._direction = value, this._setLabelChanged();
        }), __getset(0, __proto, "space", function() {
            return this._space;
        }, function(value) {
            this._space = value, this._setLabelChanged();
        }), __getset(0, __proto, "items", function() {
            return this._items;
        }), __getset(0, __proto, "selection", function() {
            return -1 < this._selectedIndex && this._selectedIndex < this._items.length ? this._items[this._selectedIndex] : null;
        }, function(value) {
            this.selectedIndex = this._items.indexOf(value);
        }), __getset(0, __proto, "dataSource", _super.prototype._$get_dataSource, function(value) {
            "number" == typeof (this._dataSource = value) && Math.floor(value) == value || "string" == typeof value ? this.selectedIndex = parseInt(value) : value instanceof Array ? this.labels = value.join(",") : Laya.superSet(Box, this, "dataSource", value);
        }), UIGroup;
    }(Box), Radio = function(_super) {
        function Radio(skin, label) {
            this._value = null, void 0 === label && (label = ""), Radio.__super.call(this, skin, label);
        }
        __class(Radio, "laya.ui.Radio", _super);
        var __proto = Radio.prototype;
        return __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), _super.prototype.destroy.call(this, destroyChild), 
            this._value = null;
        }, __proto.preinitialize = function() {
            laya.ui.Component.prototype.preinitialize.call(this), this.toggle = !1, this._autoSize = !1;
        }, __proto.initialize = function() {
            _super.prototype.initialize.call(this), this.createText(), this._text.align = "left", 
            this._text.valign = "top", this._text.width = 0, this.on("click", this, this.onClick);
        }, __proto.onClick = function(e) {
            this.selected = !0;
        }, __getset(0, __proto, "value", function() {
            return null != this._value ? this._value : this.label;
        }, function(obj) {
            this._value = obj;
        }), Radio;
    }(Button), Tree = function(_super) {
        function Tree() {
            this._list = null, this._source = null, this._renderHandler = null, this._spaceLeft = 10, 
            this._spaceBottom = 0, this._keepStatus = !0, Tree.__super.call(this), this.width = this.height = 200;
        }
        __class(Tree, "laya.ui.Tree", _super);
        var __proto = Tree.prototype;
        return Laya.imps(__proto, {
            "laya.ui.IRender": !0
        }), __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), laya.ui.Component.prototype.destroy.call(this, destroyChild), 
            this._list && this._list.destroy(destroyChild), this._list = null, this._source = null, 
            this._renderHandler = null;
        }, __proto.createChildren = function() {
            this.addChild(this._list = new List()), this._list.renderHandler = Handler.create(this, this.renderItem, null, !1), 
            this._list.repeatX = 1, this._list.on("change", this, this.onListChange);
        }, __proto.onListChange = function(e) {
            this.event("change");
        }, __proto.getArray = function() {
            var item, arr = [];
            for (var $each_item in this._source) item = this._source[$each_item], this.getParentOpenStatus(item) && (item.x = this._spaceLeft * this.getDepth(item), 
            arr.push(item));
            return arr;
        }, __proto.getDepth = function(item, num) {
            return void 0 === num && (num = 0), null == item.nodeParent ? num : this.getDepth(item.nodeParent, num + 1);
        }, __proto.getParentOpenStatus = function(item) {
            var parent = item.nodeParent;
            return null == parent || !!parent.isOpen && (null == parent.nodeParent || this.getParentOpenStatus(parent));
        }, __proto.renderItem = function(cell, index) {
            var item = cell.dataSource;
            if (item) {
                cell.left = item.x;
                var arrow = cell.getChildByName("arrow");
                arrow && (item.hasChild ? (arrow.visible = !0, arrow.index = item.isOpen ? 1 : 0, 
                arrow.tag = index, arrow.off("click", this, this.onArrowClick), arrow.on("click", this, this.onArrowClick)) : arrow.visible = !1);
                var folder = cell.getChildByName("folder");
                folder && (2 == folder.clipY ? folder.index = item.isDirectory ? 0 : 1 : folder.index = item.isDirectory ? item.isOpen ? 1 : 0 : 2), 
                this._renderHandler && this._renderHandler.runWith([ cell, index ]);
            }
        }, __proto.onArrowClick = function(e) {
            var index = e.currentTarget.tag;
            this._list.array[index].isOpen = !this._list.array[index].isOpen, this.event("open"), 
            this._list.array = this.getArray();
        }, __proto.setItemState = function(index, isOpen) {
            this._list.array[index] && (this._list.array[index].isOpen = isOpen, this._list.array = this.getArray());
        }, __proto.fresh = function() {
            this._list.array = this.getArray(), this.repaint();
        }, __proto.parseXml = function(xml, source, nodeParent, isRoot) {
            var obj, list = xml.childNodes, childCount = list.length;
            if (!isRoot) {
                obj = {};
                var attrs, list2 = xml.attributes;
                for (var $each_attrs in list2) {
                    var prop = (attrs = list2[$each_attrs]).nodeName, value = attrs.nodeValue;
                    obj[prop] = "true" == value || "false" != value && value;
                }
                obj.nodeParent = nodeParent, 0 < childCount && (obj.isDirectory = !0), obj.hasChild = 0 < childCount, 
                source.push(obj);
            }
            for (var i = 0; i < childCount; i++) {
                var node = list[i];
                this.parseXml(node, source, obj, !1);
            }
        }, __proto.parseOpenStatus = function(oldSource, newSource) {
            for (var i = 0, n = newSource.length; i < n; i++) {
                var newItem = newSource[i];
                if (newItem.isDirectory) for (var j = 0, m = oldSource.length; j < m; j++) {
                    var oldItem = oldSource[j];
                    if (oldItem.isDirectory && this.isSameParent(oldItem, newItem) && newItem.label == oldItem.label) {
                        newItem.isOpen = oldItem.isOpen;
                        break;
                    }
                }
            }
        }, __proto.isSameParent = function(item1, item2) {
            return null == item1.nodeParent && null == item2.nodeParent || null != item1.nodeParent && null != item2.nodeParent && (item1.nodeParent.label == item2.nodeParent.label && this.isSameParent(item1.nodeParent, item2.nodeParent));
        }, __proto.filter = function(key) {
            if (Boolean(key)) {
                var result = [];
                this.getFilterSource(this._source, result, key), this._list.array = result;
            } else this._list.array = this.getArray();
        }, __proto.getFilterSource = function(array, result, key) {
            var item;
            for (var $each_item in key = key.toLocaleLowerCase(), array) !(item = array[$each_item]).isDirectory && -1 < String(item.label).toLowerCase().indexOf(key) && (item.x = 0, 
            result.push(item)), item.child && 0 < item.child.length && this.getFilterSource(item.child, result, key);
        }, __getset(0, __proto, "spaceBottom", function() {
            return this._list.spaceY;
        }, function(value) {
            this._list.spaceY = value;
        }), __getset(0, __proto, "keepStatus", function() {
            return this._keepStatus;
        }, function(value) {
            this._keepStatus = value;
        }), __getset(0, __proto, "itemRender", function() {
            return this._list.itemRender;
        }, function(value) {
            this._list.itemRender = value;
        }), __getset(0, __proto, "array", function() {
            return this._list.array;
        }, function(value) {
            this._keepStatus && this._list.array && value && this.parseOpenStatus(this._list.array, value), 
            this._source = value, this._list.array = this.getArray();
        }), __getset(0, __proto, "mouseHandler", function() {
            return this._list.mouseHandler;
        }, function(value) {
            this._list.mouseHandler = value;
        }), __getset(0, __proto, "dataSource", _super.prototype._$get_dataSource, function(value) {
            this._dataSource = value, Laya.superSet(Box, this, "dataSource", value);
        }), __getset(0, __proto, "source", function() {
            return this._source;
        }), __getset(0, __proto, "scrollBar", function() {
            return this._list.scrollBar;
        }), __getset(0, __proto, "list", function() {
            return this._list;
        }), __getset(0, __proto, "scrollBarSkin", function() {
            return this._list.vScrollBarSkin;
        }, function(value) {
            this._list.vScrollBarSkin = value;
        }), __getset(0, __proto, "renderHandler", function() {
            return this._renderHandler;
        }, function(value) {
            this._renderHandler = value;
        }), __getset(0, __proto, "selectedIndex", function() {
            return this._list.selectedIndex;
        }, function(value) {
            this._list.selectedIndex = value;
        }), __getset(0, __proto, "spaceLeft", function() {
            return this._spaceLeft;
        }, function(value) {
            this._spaceLeft = value;
        }), __getset(0, __proto, "selectedItem", function() {
            return this._list.selectedItem;
        }, function(value) {
            this._list.selectedItem = value;
        }), __getset(0, __proto, "width", _super.prototype._$get_width, function(value) {
            Laya.superSet(Box, this, "width", value), this._list.width = value;
        }), __getset(0, __proto, "height", _super.prototype._$get_height, function(value) {
            Laya.superSet(Box, this, "height", value), this._list.height = value;
        }), __getset(0, __proto, "xml", null, function(value) {
            var arr = [];
            this.parseXml(value.childNodes[0], arr, null, !0), this.array = arr;
        }), __getset(0, __proto, "selectedPath", function() {
            return this._list.selectedItem ? this._list.selectedItem.path : null;
        }), Tree;
    }(Box), ViewStack = function(_super) {
        function ViewStack() {
            this._items = null, this._selectedIndex = 0, ViewStack.__super.call(this), this._setIndexHandler = Handler.create(this, this.setIndex, null, !1);
        }
        __class(ViewStack, "laya.ui.ViewStack", _super);
        var __proto = ViewStack.prototype;
        return Laya.imps(__proto, {
            "laya.ui.IItem": !0
        }), __proto.setItems = function(views) {
            this.removeChildren();
            for (var index = 0, i = 0, n = views.length; i < n; i++) {
                var item = views[i];
                item && (item.name = "item" + index, this.addChild(item), index++);
            }
            this.initItems();
        }, __proto.addItem = function(view) {
            view.name = "item" + this._items.length, this.addChild(view), this.initItems();
        }, __proto.initItems = function() {
            this._items = [];
            for (var i = 0; i < 1e4; i++) {
                var item = this.getChildByName("item" + i);
                if (null == item) break;
                this._items.push(item), item.visible = i == this._selectedIndex;
            }
        }, __proto.setSelect = function(index, selected) {
            this._items && -1 < index && index < this._items.length && (this._items[index].visible = selected);
        }, __proto.setIndex = function(index) {
            this.selectedIndex = index;
        }, __getset(0, __proto, "dataSource", _super.prototype._$get_dataSource, function(value) {
            if ("number" == typeof (this._dataSource = value) && Math.floor(value) == value || "string" == typeof value) this.selectedIndex = parseInt(value); else for (var prop in this._dataSource) this.hasOwnProperty(prop) && (this[prop] = this._dataSource[prop]);
        }), __getset(0, __proto, "selectedIndex", function() {
            return this._selectedIndex;
        }, function(value) {
            this._selectedIndex != value && (this.setSelect(this._selectedIndex, !1), this._selectedIndex = value, 
            this.setSelect(this._selectedIndex, !0));
        }), __getset(0, __proto, "selection", function() {
            return -1 < this._selectedIndex && this._selectedIndex < this._items.length ? this._items[this._selectedIndex] : null;
        }, function(value) {
            this.selectedIndex = this._items.indexOf(value);
        }), __getset(0, __proto, "items", function() {
            return this._items;
        }), __getset(0, __proto, "setIndexHandler", function() {
            return this._setIndexHandler;
        }, function(value) {
            this._setIndexHandler = value;
        }), ViewStack;
    }(Box), VScrollBar = function(_super) {
        function VScrollBar() {
            VScrollBar.__super.call(this);
        }
        return __class(VScrollBar, "laya.ui.VScrollBar", ScrollBar), VScrollBar;
    }(), TextInput = function(_super) {
        function TextInput(text) {
            this._bg = null, this._skin = null, TextInput.__super.call(this), void 0 === text && (text = ""), 
            this.text = text, this.skin = this.skin;
        }
        __class(TextInput, "laya.ui.TextInput", _super);
        var __proto = TextInput.prototype;
        return __proto.preinitialize = function() {
            this.mouseEnabled = !0;
        }, __proto.destroy = function(destroyChild) {
            Loader.clearCache(this, this._skin), void 0 === destroyChild && (destroyChild = !0), 
            _super.prototype.destroy.call(this, destroyChild), this._bg && this._bg.destroy(), 
            this._bg = null;
        }, __proto.createChildren = function() {
            this.addChild(this._tf = new Input()), this._tf.padding = Styles.inputLabelPadding, 
            this._tf.on("input", this, this._onInput), this._tf.on("enter", this, this._onEnter), 
            this._tf.on("blur", this, this._onBlur), this._tf.on("focus", this, this._onFocus);
        }, __proto._onFocus = function() {
            this.event("focus", this);
        }, __proto._onBlur = function() {
            this.event("blur", this);
        }, __proto._onInput = function() {
            this.event("input", this);
        }, __proto._onEnter = function() {
            this.event("enter", this);
        }, __proto.initialize = function() {
            this.width = 128, this.height = 22;
        }, __proto.select = function() {
            this._tf.select();
        }, __proto.setSelection = function(startIndex, endIndex) {
            this._tf.setSelection(startIndex, endIndex);
        }, __getset(0, __proto, "text", _super.prototype._$get_text, function(value) {
            this._tf.text != value && (value += "", this._tf.text = value, this.event("change"));
        }), __getset(0, __proto, "bg", function() {
            return this._bg;
        }, function(value) {
            this.graphics = this._bg = value;
        }), __getset(0, __proto, "inputElementYAdjuster", function() {
            return this._tf.inputElementYAdjuster;
        }, function(value) {
            this._tf.inputElementYAdjuster = value;
        }), __getset(0, __proto, "multiline", function() {
            return this._tf.multiline;
        }, function(value) {
            this._tf.multiline = value;
        }), __getset(0, __proto, "skin", function() {
            return this._skin;
        }, function(value) {
            this._skin != value && (Loader.clearCache(this, this._skin), this._skin = value, 
            this._bg || (this.graphics = this._bg = new AutoBitmap()), Loader.keepCache(this, this._skin), 
            this._bg.source = Loader.getRes(this._skin), this._width && (this._bg.width = this._width), 
            this._height && (this._bg.height = this._height));
        }), __getset(0, __proto, "sizeGrid", function() {
            return this._bg && this._bg.sizeGrid ? this._bg.sizeGrid.join(",") : null;
        }, function(value) {
            this._bg || (this.graphics = this._bg = new AutoBitmap()), this._bg.sizeGrid = UIUtils.fillArray(Styles.defaultSizeGrid, value, Number);
        }), __getset(0, __proto, "inputElementXAdjuster", function() {
            return this._tf.inputElementXAdjuster;
        }, function(value) {
            this._tf.inputElementXAdjuster = value;
        }), __getset(0, __proto, "width", _super.prototype._$get_width, function(value) {
            Laya.superSet(Label, this, "width", value), this._bg && (this._bg.width = value);
        }), __getset(0, __proto, "height", _super.prototype._$get_height, function(value) {
            Laya.superSet(Label, this, "height", value), this._bg && (this._bg.height = value);
        }), __getset(0, __proto, "editable", function() {
            return this._tf.editable;
        }, function(value) {
            this._tf.editable = value;
        }), __getset(0, __proto, "restrict", function() {
            return this._tf.restrict;
        }, function(pattern) {
            this._tf.restrict = pattern;
        }), __getset(0, __proto, "prompt", function() {
            return this._tf.prompt;
        }, function(value) {
            this._tf.prompt = value;
        }), __getset(0, __proto, "promptColor", function() {
            return this._tf.promptColor;
        }, function(value) {
            this._tf.promptColor = value;
        }), __getset(0, __proto, "maxChars", function() {
            return this._tf.maxChars;
        }, function(value) {
            this._tf.maxChars = value;
        }), __getset(0, __proto, "focus", function() {
            return this._tf.focus;
        }, function(value) {
            this._tf.focus = value;
        }), __getset(0, __proto, "type", function() {
            return this._tf.type;
        }, function(value) {
            this._tf.type = value;
        }), __getset(0, __proto, "asPassword", function() {
            return this._tf.asPassword;
        }, function(value) {
            this._tf.asPassword = value;
        }), TextInput;
    }(Label), VSlider = function(_super) {
        function VSlider() {
            VSlider.__super.call(this);
        }
        return __class(VSlider, "laya.ui.VSlider", Slider), VSlider;
    }(), Dialog = function(_super) {
        function Dialog() {
            this.popupCenter = !0, this.closeHandler = null, this.popupEffect = null, this.closeEffect = null, 
            this.group = null, this.isModal = !1, this._dragArea = null, Dialog.__super.call(this);
        }
        __class(Dialog, "laya.ui.Dialog", _super);
        var __proto = Dialog.prototype;
        return __proto.initialize = function() {
            this.popupEffect = Dialog.manager.popupEffectHandler, this.closeEffect = Dialog.manager.closeEffectHandler, 
            this._dealDragArea(), this.on("click", this, this._onClick);
        }, __proto._dealDragArea = function() {
            var dragTarget = this.getChildByName("drag");
            dragTarget && (this.dragArea = dragTarget.x + "," + dragTarget.y + "," + dragTarget.width + "," + dragTarget.height, 
            dragTarget.removeSelf());
        }, __proto._onClick = function(e) {
            var btn = e.target;
            if (btn) switch (btn.name) {
              case "close":
              case "cancel":
              case "sure":
              case "no":
              case "ok":
              case "yes":
                this.close(btn.name);
            }
        }, __proto.show = function(closeOther, showEffect) {
            void 0 === closeOther && (closeOther = !1), void 0 === showEffect && (showEffect = !0), 
            this._open(!1, closeOther, showEffect);
        }, __proto.popup = function(closeOther, showEffect) {
            void 0 === closeOther && (closeOther = !1), void 0 === showEffect && (showEffect = !0), 
            this._open(!0, closeOther, showEffect);
        }, __proto._open = function(modal, closeOther, showEffect) {
            Dialog.manager.lock(!1), this.isModal = modal, Dialog.manager.open(this, closeOther, showEffect);
        }, __proto.onOpened = function() {}, __proto.close = function(type, showEffect) {
            void 0 === showEffect && (showEffect = !0), Dialog.manager.close(this, type, showEffect);
        }, __proto.onClosed = function(type) {}, __proto._onMouseDown = function(e) {
            var point = this.getMousePoint();
            this._dragArea.contains(point.x, point.y) ? this.startDrag() : this.stopDrag();
        }, __getset(0, __proto, "dragArea", function() {
            return this._dragArea ? this._dragArea.toString() : null;
        }, function(value) {
            if (value) {
                var a = UIUtils.fillArray([ 0, 0, 0, 0 ], value, Number);
                this._dragArea = new Rectangle(a[0], a[1], a[2], a[3]), this.on("mousedown", this, this._onMouseDown);
            } else this._dragArea = null, this.off("mousedown", this, this._onMouseDown);
        }), __getset(0, __proto, "isPopup", function() {
            return null != this.parent;
        }), __getset(0, __proto, "zOrder", _super.prototype._$get_zOrder, function(value) {
            Laya.superSet(View, this, "zOrder", value), Dialog.manager._checkMask();
        }), __getset(1, Dialog, "manager", function() {
            return Dialog._manager = Dialog._manager || new DialogManager();
        }, function(value) {
            Dialog._manager = value;
        }), Dialog.setLockView = function(view) {
            Dialog.manager.setLockView(view);
        }, Dialog.lock = function(value) {
            Dialog.manager.lock(value);
        }, Dialog.closeAll = function() {
            Dialog.manager.closeAll();
        }, Dialog.getDialogsByGroup = function(group) {
            return Dialog.manager.getDialogsByGroup(group);
        }, Dialog.closeByGroup = function(group) {
            return Dialog.manager.closeByGroup(group);
        }, Dialog.CLOSE = "close", Dialog.CANCEL = "cancel", Dialog.SURE = "sure", Dialog.NO = "no", 
        Dialog.OK = "ok", Dialog.YES = "yes", Dialog._manager = null, Dialog;
    }(View), HBox = function(_super) {
        function HBox() {
            HBox.__super.call(this);
        }
        __class(HBox, "laya.ui.HBox", _super);
        var __proto = HBox.prototype;
        return __proto.sortItem = function(items) {
            items && items.sort(function(a, b) {
                return a.x - b.x;
            });
        }, __proto.changeItems = function() {
            this._itemChanged = !1;
            for (var items = [], maxHeight = 0, i = 0, n = this.numChildren; i < n; i++) {
                var item = this.getChildAt(i);
                item && item.layoutEnabled && (items.push(item), maxHeight = this._height ? this._height : Math.max(maxHeight, item.height * item.scaleY));
            }
            this.sortItem(items);
            var left = 0;
            for (i = 0, n = items.length; i < n; i++) (item = items[i]).x = left, left += item.width * item.scaleX + this._space, 
            "top" == this._align ? item.y = 0 : "middle" == this._align ? item.y = .5 * (maxHeight - item.height * item.scaleY) : "bottom" == this._align && (item.y = maxHeight - item.height * item.scaleY);
            this.changeSize();
        }, __getset(0, __proto, "height", _super.prototype._$get_height, function(value) {
            this._height != value && (Laya.superSet(LayoutBox, this, "height", value), this.callLater(this.changeItems));
        }), HBox.NONE = "none", HBox.TOP = "top", HBox.MIDDLE = "middle", HBox.BOTTOM = "bottom", 
        HBox;
    }(LayoutBox), VBox = function(_super) {
        function VBox() {
            VBox.__super.call(this);
        }
        __class(VBox, "laya.ui.VBox", _super);
        var __proto = VBox.prototype;
        return __proto.changeItems = function() {
            this._itemChanged = !1;
            for (var items = [], maxWidth = 0, i = 0, n = this.numChildren; i < n; i++) {
                var item = this.getChildAt(i);
                item && item.layoutEnabled && (items.push(item), maxWidth = this._width ? this._width : Math.max(maxWidth, item.width * item.scaleX));
            }
            this.sortItem(items);
            var top = 0;
            for (i = 0, n = items.length; i < n; i++) (item = items[i]).y = top, top += item.height * item.scaleY + this._space, 
            "left" == this._align ? item.x = 0 : "center" == this._align ? item.x = .5 * (maxWidth - item.width * item.scaleX) : "right" == this._align && (item.x = maxWidth - item.width * item.scaleX);
            this.changeSize();
        }, __getset(0, __proto, "width", _super.prototype._$get_width, function(value) {
            this._width != value && (Laya.superSet(LayoutBox, this, "width", value), this.callLater(this.changeItems));
        }), VBox.NONE = "none", VBox.LEFT = "left", VBox.CENTER = "center", VBox.RIGHT = "right", 
        VBox;
    }(LayoutBox), RadioGroup = function(_super) {
        function RadioGroup() {
            RadioGroup.__super.call(this);
        }
        return __class(RadioGroup, "laya.ui.RadioGroup", UIGroup), RadioGroup.prototype.createItem = function(skin, label) {
            return new Radio(skin, label);
        }, RadioGroup;
    }(), Tab = function(_super) {
        function Tab() {
            Tab.__super.call(this);
        }
        return __class(Tab, "laya.ui.Tab", UIGroup), Tab.prototype.createItem = function(skin, label) {
            return new Button(skin, label);
        }, Tab;
    }(), TextArea = function(_super) {
        function TextArea(text) {
            this._vScrollBar = null, this._hScrollBar = null, void 0 === text && (text = ""), 
            TextArea.__super.call(this, text);
        }
        __class(TextArea, "laya.ui.TextArea", _super);
        var __proto = TextArea.prototype;
        return __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), _super.prototype.destroy.call(this, destroyChild), 
            this._vScrollBar && this._vScrollBar.destroy(), this._hScrollBar && this._hScrollBar.destroy(), 
            this._vScrollBar = null, this._hScrollBar = null;
        }, __proto.initialize = function() {
            this.width = 180, this.height = 150, this._tf.wordWrap = !0, this.multiline = !0;
        }, __proto.onVBarChanged = function(e) {
            this._tf.scrollY != this._vScrollBar.value && (this._tf.scrollY = this._vScrollBar.value);
        }, __proto.onHBarChanged = function(e) {
            this._tf.scrollX != this._hScrollBar.value && (this._tf.scrollX = this._hScrollBar.value);
        }, __proto.changeScroll = function() {
            var vShow = this._vScrollBar && 0 < this._tf.maxScrollY, hShow = this._hScrollBar && 0 < this._tf.maxScrollX, showWidth = vShow ? this._width - this._vScrollBar.width : this._width, showHeight = hShow ? this._height - this._hScrollBar.height : this._height, padding = this._tf.padding || Styles.labelPadding;
            this._tf.width = showWidth, this._tf.height = showHeight, this._vScrollBar && (this._vScrollBar.x = this._width - this._vScrollBar.width - padding[2], 
            this._vScrollBar.y = padding[1], this._vScrollBar.height = this._height - (hShow ? this._hScrollBar.height : 0) - padding[1] - padding[3], 
            this._vScrollBar.scrollSize = 1, this._vScrollBar.thumbPercent = showHeight / Math.max(this._tf.textHeight, showHeight), 
            this._vScrollBar.setScroll(1, this._tf.maxScrollY, this._tf.scrollY), this._vScrollBar.visible = vShow), 
            this._hScrollBar && (this._hScrollBar.x = padding[0], this._hScrollBar.y = this._height - this._hScrollBar.height - padding[3], 
            this._hScrollBar.width = this._width - (vShow ? this._vScrollBar.width : 0) - padding[0] - padding[2], 
            this._hScrollBar.scrollSize = Math.max(.033 * showWidth, 1), this._hScrollBar.thumbPercent = showWidth / Math.max(this._tf.textWidth, showWidth), 
            this._hScrollBar.setScroll(0, this.maxScrollX, this.scrollX), this._hScrollBar.visible = hShow);
        }, __proto.scrollTo = function(y) {
            this.commitMeasure(), this._tf.scrollY = y;
        }, __getset(0, __proto, "scrollY", function() {
            return this._tf.scrollY;
        }), __getset(0, __proto, "width", _super.prototype._$get_width, function(value) {
            Laya.superSet(TextInput, this, "width", value), this.callLater(this.changeScroll);
        }), __getset(0, __proto, "hScrollBar", function() {
            return this._hScrollBar;
        }), __getset(0, __proto, "height", _super.prototype._$get_height, function(value) {
            Laya.superSet(TextInput, this, "height", value), this.callLater(this.changeScroll);
        }), __getset(0, __proto, "maxScrollX", function() {
            return this._tf.maxScrollX;
        }), __getset(0, __proto, "vScrollBarSkin", function() {
            return this._vScrollBar ? this._vScrollBar.skin : null;
        }, function(value) {
            null == this._vScrollBar && (this.addChild(this._vScrollBar = new VScrollBar()), 
            this._vScrollBar.on("change", this, this.onVBarChanged), this._vScrollBar.target = this._tf, 
            this.callLater(this.changeScroll)), this._vScrollBar.skin = value;
        }), __getset(0, __proto, "hScrollBarSkin", function() {
            return this._hScrollBar ? this._hScrollBar.skin : null;
        }, function(value) {
            null == this._hScrollBar && (this.addChild(this._hScrollBar = new HScrollBar()), 
            this._hScrollBar.on("change", this, this.onHBarChanged), this._hScrollBar.mouseWheelEnable = !1, 
            this._hScrollBar.target = this._tf, this.callLater(this.changeScroll)), this._hScrollBar.skin = value;
        }), __getset(0, __proto, "vScrollBar", function() {
            return this._vScrollBar;
        }), __getset(0, __proto, "maxScrollY", function() {
            return this._tf.maxScrollY;
        }), __getset(0, __proto, "scrollX", function() {
            return this._tf.scrollX;
        }), TextArea;
    }(TextInput);
    !function(_super) {
        function AsynDialog() {
            this._uiView = null, this.isCloseOther = !1, AsynDialog.__super.call(this);
        }
        __class(AsynDialog, "laya.ui.AsynDialog", Dialog);
        var __proto = AsynDialog.prototype;
        __proto.createView = function(uiView) {
            this._uiView = uiView;
        }, __proto._open = function(modal, closeOther, showEffect) {
            this.isModal = modal, this.isCloseOther = closeOther, Dialog.manager.lock(!0), this._uiView ? this.onCreated() : this.onOpen();
        }, __proto.onCreated = function() {
            this.createUI(), this.onOpen();
        }, __proto.createUI = function() {
            laya.ui.View.prototype.createView.call(this, this._uiView), this._uiView = null, 
            this._dealDragArea();
        }, __proto.onOpen = function() {
            Dialog.manager.open(this, this.isCloseOther), Dialog.manager.lock(!1);
        }, __proto.close = function(type, showEffect) {
            void 0 === showEffect && (showEffect = !0), Dialog.manager.close(this), this.onClose();
        }, __proto.onClose = function() {}, __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), laya.ui.View.prototype.destroy.call(this, destroyChild), 
            this._uiView = null, this.onDestroy();
        }, __proto.onDestroy = function() {};
    }();
    Laya.__init([ View ]);
}(window, document, Laya), "function" == typeof define && define.amd && define("laya.core", [ "arequire", "exports" ], function(arequire, exports) {
    "use strict";
    for (var i in Object.defineProperty(exports, "__esModule", {
        value: !0
    }), Laya) {
        var o = Laya[i];
        o && o.__isclass && (exports[i] = o);
    }
}), function(window, document, Laya) {
    Laya.un, Laya.uns;
    var __static = Laya.static, __class = Laya.class, __getset = Laya.getset, __newvec = Laya.__newvec, Arith = laya.maths.Arith, AtlasResourceManager = laya.webgl.atlas.AtlasResourceManager, BaseShader = laya.webgl.shader.BaseShader, Browser = laya.utils.Browser, Buffer = laya.webgl.utils.Buffer, Byte = laya.utils.Byte, ClassUtils = laya.utils.ClassUtils, Config = Laya.Config, EventDispatcher = (laya.events.Event, 
    laya.events.EventDispatcher), Handler = laya.utils.Handler, Loader = laya.net.Loader, LoaderManager = laya.net.LoaderManager, Node = (laya.maths.MathUtil, 
    laya.display.Node), Render = laya.renders.Render, RenderState2D = (laya.renders.RenderContext, 
    laya.renders.RenderSprite, laya.webgl.utils.RenderState2D), Resource = laya.resource.Resource, RunDriver = laya.utils.RunDriver, ShaderCompile = (laya.webgl.shader.Shader, 
    laya.webgl.utils.ShaderCompile), Sprite = laya.display.Sprite, Stat = laya.utils.Stat, StringKey = laya.utils.StringKey, URL = (laya.display.css.Style, 
    laya.resource.Texture, laya.net.URL), Utils = laya.utils.Utils, WebGL = laya.webgl.WebGL, WebGLContext = laya.webgl.WebGLContext;
    laya.webgl.canvas.WebGLContext2D;
    Laya.interface("laya.d3.core.IClone"), Laya.interface("laya.d3.graphics.IVertex"), 
    Laya.interface("laya.d3.core.render.IUpdate"), Laya.interface("laya.d3.core.scene.ITreeNode"), 
    Laya.interface("laya.d3.core.render.IRenderable");
    (function() {
        function AnimationClipParser01() {}
        __class(AnimationClipParser01, "laya.d3.animation.AnimationClipParser01"), AnimationClipParser01.READ_DATA = function() {
            AnimationClipParser01._DATA.offset = AnimationClipParser01._reader.getUint32(), 
            AnimationClipParser01._DATA.size = AnimationClipParser01._reader.getUint32();
        }, AnimationClipParser01.READ_BLOCK = function() {
            for (var count = AnimationClipParser01._BLOCK.count = AnimationClipParser01._reader.getUint16(), blockStarts = AnimationClipParser01._BLOCK.blockStarts = [], blockLengths = AnimationClipParser01._BLOCK.blockLengths = [], i = 0; i < count; i++) blockStarts.push(AnimationClipParser01._reader.getUint32()), 
            blockLengths.push(AnimationClipParser01._reader.getUint32());
        }, AnimationClipParser01.READ_STRINGS = function() {
            var offset = AnimationClipParser01._reader.getUint32(), count = AnimationClipParser01._reader.getUint16(), prePos = AnimationClipParser01._reader.pos;
            AnimationClipParser01._reader.pos = offset + AnimationClipParser01._DATA.offset;
            for (var i = 0; i < count; i++) AnimationClipParser01._strings[i] = AnimationClipParser01._reader.readUTFString();
            AnimationClipParser01._reader.pos = prePos;
        }, AnimationClipParser01.parse = function(clip, reader) {
            AnimationClipParser01._animationClip = clip;
            (AnimationClipParser01._reader = reader).__getBuffer();
            AnimationClipParser01.READ_DATA(), AnimationClipParser01.READ_BLOCK(), AnimationClipParser01.READ_STRINGS();
            for (var i = 0, n = AnimationClipParser01._BLOCK.count; i < n; i++) {
                var index = reader.getUint16(), blockName = AnimationClipParser01._strings[index], fn = AnimationClipParser01["READ_" + blockName];
                if (null == fn) throw new Error("model file err,no this function:" + index + " " + blockName);
                fn.call();
            }
        }, AnimationClipParser01.READ_ANIMATIONS = function() {
            var node, i = 0, j = 0, reader = AnimationClipParser01._reader, buffer = reader.__getBuffer(), lengthTypes = [], lenghthTypeCount = reader.getUint8();
            for (lengthTypes.length = lenghthTypeCount, i = 0; i < lenghthTypeCount; i++) lengthTypes[i] = reader.getUint16();
            var startTimeTypes = [], startTimeTypeCount = reader.getUint16();
            for (startTimeTypes.length = startTimeTypeCount, i = 0; i < startTimeTypeCount; i++) startTimeTypes[i] = reader.getFloat32();
            var clip = AnimationClipParser01._animationClip;
            clip.name = AnimationClipParser01._strings[reader.getUint16()];
            var clipDur = clip._duration = reader.getFloat32();
            clip.islooping = !!reader.getByte(), clip._frameRate = reader.getInt16();
            var nodeCount = reader.getInt16(), nodes = clip._nodes = new Array();
            nodes.length = nodeCount, (clip._publicClipDatas = []).length = nodeCount;
            var nodesMap = clip._nodesMap = {}, cachePropertyToNodeIndex = 0, unCachePropertyToNodeIndex = 0;
            for (i = 0; i < nodeCount; i++) {
                node = nodes[i] = new KeyframeNode();
                var pathLength = reader.getUint16(), path = node.path = [];
                for (path.length = pathLength, j = 0; j < pathLength; j++) path[j] = AnimationClipParser01._strings[reader.getUint16()];
                var nodePath = path.join("/"), mapArray = nodesMap[nodePath];
                mapArray || (nodesMap[nodePath] = mapArray = []), mapArray.push(node);
                var componentTypeStrIndex = reader.getInt16();
                -1 !== componentTypeStrIndex && (node.componentType = AnimationClipParser01._strings[componentTypeStrIndex]);
                var propertyNameID = AnimationNode._propertyIndexDic[AnimationClipParser01._strings[reader.getUint16()]];
                if (null == propertyNameID) throw new Error("AnimationClipParser01:unknown property name.");
                var isTransformProperty = propertyNameID < 4, cacheProperty = !isTransformProperty || isTransformProperty && "" === path[0];
                (node._cacheProperty = cacheProperty) ? cachePropertyToNodeIndex++ : unCachePropertyToNodeIndex++, 
                node.propertyNameID = propertyNameID;
                var dataLength = lengthTypes[reader.getUint8()];
                node.keyFrameWidth = dataLength / 4;
                var keyFrames = node.keyFrames = [], keyframeCount = keyFrames.length = reader.getUint16(), lastKeyFrame = null, startTime = NaN;
                for (j = 0; j < keyframeCount; j++) {
                    var keyFrame = keyFrames[j] = new Keyframe();
                    startTime = keyFrame.startTime = startTimeTypes[reader.getUint16()];
                    var offset = reader.pos;
                    keyFrame.inTangent = new Float32Array(buffer.slice(offset, offset + dataLength)), 
                    reader.pos += dataLength, offset = reader.pos, keyFrame.outTangent = new Float32Array(buffer.slice(offset, offset + dataLength)), 
                    reader.pos += dataLength, offset = reader.pos, keyFrame.data = new Float32Array(buffer.slice(offset, offset + dataLength)), 
                    reader.pos += dataLength, lastKeyFrame && (lastKeyFrame.next = keyFrame, lastKeyFrame.duration = startTime - lastKeyFrame.startTime), 
                    lastKeyFrame = keyFrame;
                }
                keyFrame.next = null, keyFrame.duration = clipDur - startTime;
            }
            var nodeToCachePropertyMap = clip._nodeToCachePropertyMap = new Int32Array(nodeCount), cachePropertyToNodeMap = clip._cachePropertyMap = new Int32Array(cachePropertyToNodeIndex), unCachePropertyToNodeMap = clip._unCachePropertyMap = new Int32Array(unCachePropertyToNodeIndex);
            for (cachePropertyToNodeIndex = unCachePropertyToNodeIndex = 0, i = 0; i < nodeCount; i++) (node = nodes[i])._cacheProperty ? (nodeToCachePropertyMap[i] = cachePropertyToNodeIndex, 
            cachePropertyToNodeMap[cachePropertyToNodeIndex++] = i) : unCachePropertyToNodeMap[unCachePropertyToNodeIndex++] = i;
        }, AnimationClipParser01._animationClip = null, AnimationClipParser01._reader = null, 
        AnimationClipParser01._strings = [], __static(AnimationClipParser01, [ "_BLOCK", function() {
            return this._BLOCK = {
                count: 0
            };
        }, "_DATA", function() {
            return this._DATA = {
                offset: 0,
                size: 0
            };
        } ]);
    })(), function() {
        function AnimationClipParser02() {}
        __class(AnimationClipParser02, "laya.d3.animation.AnimationClipParser02"), AnimationClipParser02.READ_DATA = function() {
            AnimationClipParser02._DATA.offset = AnimationClipParser02._reader.getUint32(), 
            AnimationClipParser02._DATA.size = AnimationClipParser02._reader.getUint32();
        }, AnimationClipParser02.READ_BLOCK = function() {
            for (var count = AnimationClipParser02._BLOCK.count = AnimationClipParser02._reader.getUint16(), blockStarts = AnimationClipParser02._BLOCK.blockStarts = [], blockLengths = AnimationClipParser02._BLOCK.blockLengths = [], i = 0; i < count; i++) blockStarts.push(AnimationClipParser02._reader.getUint32()), 
            blockLengths.push(AnimationClipParser02._reader.getUint32());
        }, AnimationClipParser02.READ_STRINGS = function() {
            var offset = AnimationClipParser02._reader.getUint32(), count = AnimationClipParser02._reader.getUint16(), prePos = AnimationClipParser02._reader.pos;
            AnimationClipParser02._reader.pos = offset + AnimationClipParser02._DATA.offset;
            for (var i = 0; i < count; i++) AnimationClipParser02._strings[i] = AnimationClipParser02._reader.readUTFString();
            AnimationClipParser02._reader.pos = prePos;
        }, AnimationClipParser02.parse = function(clip, reader) {
            AnimationClipParser02._animationClip = clip;
            (AnimationClipParser02._reader = reader).__getBuffer();
            AnimationClipParser02.READ_DATA(), AnimationClipParser02.READ_BLOCK(), AnimationClipParser02.READ_STRINGS();
            for (var i = 0, n = AnimationClipParser02._BLOCK.count; i < n; i++) {
                var index = reader.getUint16(), blockName = AnimationClipParser02._strings[index], fn = AnimationClipParser02["READ_" + blockName];
                if (null == fn) throw new Error("model file err,no this function:" + index + " " + blockName);
                fn.call();
            }
        }, AnimationClipParser02.READ_ANIMATIONS = function() {
            var node, i = 0, j = 0, reader = AnimationClipParser02._reader, buffer = reader.__getBuffer(), lengthTypes = [], lenghthTypeCount = reader.getUint8();
            for (lengthTypes.length = lenghthTypeCount, i = 0; i < lenghthTypeCount; i++) lengthTypes[i] = reader.getUint16();
            var startTimeTypes = [], startTimeTypeCount = reader.getUint16();
            for (startTimeTypes.length = startTimeTypeCount, i = 0; i < startTimeTypeCount; i++) startTimeTypes[i] = reader.getFloat32();
            var clip = AnimationClipParser02._animationClip;
            clip.name = AnimationClipParser02._strings[reader.getUint16()];
            var clipDur = clip._duration = reader.getFloat32();
            clip.islooping = !!reader.getByte(), clip._frameRate = reader.getInt16();
            var nodeCount = reader.getInt16(), nodes = clip._nodes = new Array();
            nodes.length = nodeCount, (clip._publicClipDatas = []).length = nodeCount;
            var nodesMap = clip._nodesMap = {}, cachePropertyToNodeIndex = 0, unCachePropertyToNodeIndex = 0;
            for (i = 0; i < nodeCount; i++) {
                node = nodes[i] = new KeyframeNode();
                var pathLength = reader.getUint16(), path = node.path = [];
                for (path.length = pathLength, j = 0; j < pathLength; j++) path[j] = AnimationClipParser02._strings[reader.getUint16()];
                var nodePath = path.join("/"), mapArray = nodesMap[nodePath];
                mapArray || (nodesMap[nodePath] = mapArray = []), mapArray.push(node);
                var componentTypeStrIndex = reader.getInt16();
                -1 !== componentTypeStrIndex && (node.componentType = AnimationClipParser02._strings[componentTypeStrIndex]);
                var propertyNameID = AnimationNode._propertyIndexDic[AnimationClipParser02._strings[reader.getUint16()]];
                if (null == propertyNameID) throw new Error("AnimationClipParser02:unknown property name.");
                var isTransformProperty = propertyNameID < 4, cacheProperty = !isTransformProperty || isTransformProperty && "" === path[0];
                (node._cacheProperty = cacheProperty) ? cachePropertyToNodeIndex++ : unCachePropertyToNodeIndex++, 
                node.propertyNameID = propertyNameID;
                var dataLength = lengthTypes[reader.getUint8()];
                node.keyFrameWidth = dataLength / 4;
                var keyFrames = node.keyFrames = [], keyframeCount = keyFrames.length = reader.getUint16(), lastKeyFrame = null, startTime = NaN;
                for (j = 0; j < keyframeCount; j++) {
                    var keyFrame = keyFrames[j] = new Keyframe();
                    startTime = keyFrame.startTime = startTimeTypes[reader.getUint16()];
                    var offset = reader.pos;
                    keyFrame.inTangent = new Float32Array(buffer.slice(offset, offset + dataLength)), 
                    reader.pos += dataLength, offset = reader.pos, keyFrame.outTangent = new Float32Array(buffer.slice(offset, offset + dataLength)), 
                    reader.pos += dataLength, offset = reader.pos, keyFrame.data = new Float32Array(buffer.slice(offset, offset + dataLength)), 
                    reader.pos += dataLength, lastKeyFrame && (lastKeyFrame.next = keyFrame, lastKeyFrame.duration = startTime - lastKeyFrame.startTime), 
                    lastKeyFrame = keyFrame;
                }
                keyFrame.next = null, keyFrame.duration = clipDur - startTime;
            }
            var eventCount = reader.getUint16();
            for (i = 0; i < eventCount; i++) {
                var params, event = new AnimationEvent();
                event.time = reader.getFloat32(), event.eventName = AnimationClipParser02._strings[reader.getUint16()];
                var paramCount = reader.getUint16();
                for (0 < paramCount && (event.params = params = []), j = 0; j < paramCount; j++) {
                    switch (reader.getByte()) {
                      case 0:
                        params.push(!!reader.getByte());
                        break;

                      case 1:
                        params.push(reader.getInt32());
                        break;

                      case 2:
                        params.push(reader.getFloat32());
                        break;

                      case 3:
                        params.push(AnimationClipParser02._strings[reader.getUint16()]);
                        break;

                      default:
                        throw new Error("unknown type.");
                    }
                }
                clip.addEvent(event);
            }
            var nodeToCachePropertyMap = clip._nodeToCachePropertyMap = new Int32Array(nodeCount), cachePropertyToNodeMap = clip._cachePropertyMap = new Int32Array(cachePropertyToNodeIndex), unCachePropertyToNodeMap = clip._unCachePropertyMap = new Int32Array(unCachePropertyToNodeIndex);
            for (cachePropertyToNodeIndex = unCachePropertyToNodeIndex = 0, i = 0; i < nodeCount; i++) (node = nodes[i])._cacheProperty ? (nodeToCachePropertyMap[i] = cachePropertyToNodeIndex, 
            cachePropertyToNodeMap[cachePropertyToNodeIndex++] = i) : unCachePropertyToNodeMap[unCachePropertyToNodeIndex++] = i;
        }, AnimationClipParser02._animationClip = null, AnimationClipParser02._reader = null, 
        AnimationClipParser02._strings = [], __static(AnimationClipParser02, [ "_BLOCK", function() {
            return this._BLOCK = {
                count: 0
            };
        }, "_DATA", function() {
            return this._DATA = {
                offset: 0,
                size: 0
            };
        } ]);
    }();
    var AnimationEvent = function() {
        function AnimationEvent() {
            this.time = NaN, this.eventName = null, this.params = null;
        }
        return __class(AnimationEvent, "laya.d3.animation.AnimationEvent"), AnimationEvent;
    }(), AnimationNode = function() {
        function AnimationNode() {
            this._childs = [], this.transform = new AnimationTransform3D(this);
        }
        __class(AnimationNode, "laya.d3.animation.AnimationNode");
        var __proto = AnimationNode.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.addChild = function(child) {
            child._parent = this, child.transform.setParent(this.transform), this._childs.push(child);
        }, __proto.removeChild = function(child) {
            var index = this._childs.indexOf(child);
            -1 !== index && this._childs.splice(index, 1);
        }, __proto.getChildByName = function(name) {
            for (var i = 0, n = this._childs.length; i < n; i++) {
                var child = this._childs[i];
                if (child.name === name) return child;
            }
            return null;
        }, __proto.getChildByIndex = function(index) {
            return this._childs[index];
        }, __proto.getChildCount = function() {
            return this._childs.length;
        }, __proto.cloneTo = function(destObject) {
            var destNode = destObject;
            destNode.name = this.name;
            for (var i = 0, n = this._childs.length; i < n; i++) {
                var child = this._childs[i], destChild = child.clone();
                destNode.addChild(destChild);
                var transform = child.transform, destTransform = destChild.transform;
                destTransform.setLocalPosition(transform.getLocalPosition()), destTransform.setLocalRotation(transform.getLocalRotation()), 
                destTransform.setLocalScale(transform.getLocalScale()), destTransform._localRotationEuler = transform._localRotationEuler, 
                destTransform._setWorldMatrixIgnoreUpdate(transform.getWorldMatrix());
            }
        }, __proto.clone = function() {
            var dest = new this.constructor();
            return this.cloneTo(dest), dest;
        }, AnimationNode.__init__ = function() {
            AnimationNode.registerAnimationNodeProperty("localPosition", AnimationNode._getLocalPosition, AnimationNode._setLocalPosition), 
            AnimationNode.registerAnimationNodeProperty("localRotation", AnimationNode._getLocalRotation, AnimationNode._setLocalRotation), 
            AnimationNode.registerAnimationNodeProperty("localScale", AnimationNode._getLocalScale, AnimationNode._setLocalScale), 
            AnimationNode.registerAnimationNodeProperty("localRotationEuler", AnimationNode._getLocalRotationEuler, AnimationNode._setLocalRotationEuler), 
            AnimationNode.registerAnimationNodeProperty("particleRender.sharedMaterial.tintColor", AnimationNode._getParticleRenderSharedMaterialTintColor, AnimationNode._setParticleRenderSharedMaterialTintColor), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.tilingOffset", AnimationNode._getMeshRenderSharedMaterialTilingOffset, AnimationNode._setMeshRenderSharedMaterialTilingOffset), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.albedoColor", AnimationNode._getMeshRenderSharedMaterialAlbedo, AnimationNode._setMeshRenderSharedMaterialAlbedo), 
            AnimationNode.registerAnimationNodeProperty("skinnedMeshRender.sharedMaterial.tilingOffset", AnimationNode._getSkinnedMeshRenderSharedMaterialTilingOffset, AnimationNode._setSkinnedMeshRenderSharedMaterialTilingOffset), 
            AnimationNode.registerAnimationNodeProperty("skinnedMeshRender.sharedMaterial.albedoColor", AnimationNode._getSkinnedMeshRenderSharedMaterialAlbedo, AnimationNode._setSkinnedMeshRenderSharedMaterialAlbedo), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.albedo", AnimationNode._getMeshRenderSharedMaterialAlbedo, AnimationNode._setMeshRenderSharedMaterialAlbedo), 
            AnimationNode.registerAnimationNodeProperty("skinnedMeshRender.sharedMaterial.albedo", AnimationNode._getSkinnedMeshRenderSharedMaterialAlbedo, AnimationNode._setSkinnedMeshRenderSharedMaterialAlbedo), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.intensity", AnimationNode._getMeshRenderSharedMaterialIntensity, AnimationNode._setMeshRenderSharedMaterialIntensity), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.alpha", AnimationNode._getMeshRenderSharedMaterialAlpha, AnimationNode._setMeshRenderSharedMaterialAlpha), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.alphaColor", AnimationNode._getMeshRenderSharedMaterialAlphaColor, AnimationNode._setMeshRenderSharedMaterialAlphaColor), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.baseColor", AnimationNode._getMeshRenderSharedMaterialBaseColor, AnimationNode._setMeshRenderSharedMaterialBaseColor), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.dissolve", AnimationNode._getMeshRenderSharedMaterialDissolve, AnimationNode._setMeshRenderSharedMaterialDissolve), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.dissolveSpeed", AnimationNode._getMeshRenderSharedMaterialDissolveSpeed, AnimationNode._setMeshRenderSharedMaterialDissolveSpeed), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.mMultiplier", AnimationNode._getMeshRenderSharedMaterialMMultiplier, AnimationNode._setMeshRenderSharedMaterialMMultiplier), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.baseScrollSpeedX", AnimationNode._getMeshRenderSharedMaterialBaseScrollSpeedX, AnimationNode._setMeshRenderSharedMaterialBaseScrollSpeedX), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.baseScrollSpeedY", AnimationNode._getMeshRenderSharedMaterialBaseScrollSpeedY, AnimationNode._setMeshRenderSharedMaterialBaseScrollSpeedY), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.secondScrollSpeedX", AnimationNode._getMeshRenderSharedMaterialSecondScrollSpeedX, AnimationNode._setMeshRenderSharedMaterialSecondScrollSpeedX), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.secondScrollSpeedY", AnimationNode._getMeshRenderSharedMaterialSecondScrollSpeedY, AnimationNode._setMeshRenderSharedMaterialSecondScrollSpeedY), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.detailTilingOffset", AnimationNode._getMeshRenderSharedMaterialDetailTilingOffset, AnimationNode._setMeshRenderSharedMaterialDetailTilingOffset), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.dissolveTilingOffset", AnimationNode._getMeshRenderSharedMaterialDissolveTilingOffset, AnimationNode._setMeshRenderSharedMaterialDissolveTilingOffset), 
            AnimationNode.registerAnimationNodeProperty("meshRender.sharedMaterial.maskTilingOffset", AnimationNode._getMeshRenderSharedMaterialMaskTilingOffset, AnimationNode._setMeshRenderSharedMaterialMaskTilingOffset);
        }, AnimationNode.registerAnimationNodeProperty = function(propertyName, getFunc, setFunc) {
            if (AnimationNode._propertyIndexDic[propertyName]) throw new Error("AnimationNode: this propertyName has registered.");
            AnimationNode._propertyIndexDic[propertyName] = AnimationNode._propertyIDCounter, 
            AnimationNode._propertyGetFuncs[AnimationNode._propertyIDCounter] = getFunc, AnimationNode._propertySetFuncs[AnimationNode._propertyIDCounter] = setFunc, 
            AnimationNode._propertyIDCounter++;
        }, AnimationNode._getLocalPosition = function(animationNode, sprite3D) {
            return animationNode ? animationNode.transform.getLocalPosition() : sprite3D._transform.localPosition.elements;
        }, AnimationNode._setLocalPosition = function(animationNode, sprite3D, value) {
            if (animationNode) animationNode.transform.setLocalPosition(value); else {
                var spriteTransform = sprite3D._transform, localPosition = spriteTransform.localPosition;
                localPosition.elements = value, spriteTransform.localPosition = localPosition;
            }
        }, AnimationNode._getLocalRotation = function(animationNode, sprite3D) {
            return animationNode ? animationNode.transform.getLocalRotation() : sprite3D._transform.localRotation.elements;
        }, AnimationNode._setLocalRotation = function(animationNode, sprite3D, value) {
            if (animationNode) animationNode.transform.setLocalRotation(value); else {
                var spriteTransform = sprite3D._transform, localRotation = spriteTransform.localRotation;
                localRotation.elements = value, spriteTransform.localRotation = localRotation;
            }
        }, AnimationNode._getLocalScale = function(animationNode, sprite3D) {
            return animationNode ? animationNode.transform.getLocalScale() : sprite3D._transform.localScale.elements;
        }, AnimationNode._setLocalScale = function(animationNode, sprite3D, value) {
            if (animationNode) animationNode.transform.setLocalScale(value); else {
                var spriteTransform = sprite3D._transform, localScale = spriteTransform.localScale;
                localScale.elements = value, spriteTransform.localScale = localScale;
            }
        }, AnimationNode._getLocalRotationEuler = function(animationNode, sprite3D) {
            return animationNode ? animationNode.transform.getLocalRotationEuler() : sprite3D._transform.localRotationEuler.elements;
        }, AnimationNode._setLocalRotationEuler = function(animationNode, sprite3D, value) {
            if (animationNode) animationNode.transform.setLocalRotationEuler(value); else {
                var spriteTransform = sprite3D._transform, localRotationEuler = spriteTransform.localRotationEuler;
                localRotationEuler.elements = value, spriteTransform.localRotationEuler = localRotationEuler;
            }
        }, AnimationNode._getMeshRenderSharedMaterialTilingOffset = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.tilingOffset.elements : null;
            }
            return sprite3D.meshRender.sharedMaterial.tilingOffset.elements;
        }, AnimationNode._setMeshRenderSharedMaterialTilingOffset = function(animationNode, sprite3D, value) {
            var material, tilingOffset;
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && ((tilingOffset = (material = entity.owner.meshRender.material).tilingOffset).elements = value, 
                material.tilingOffset = tilingOffset);
            } else (tilingOffset = (material = sprite3D.meshRender.material).tilingOffset).elements = value, 
            material.tilingOffset = tilingOffset;
        }, AnimationNode._getMeshRenderSharedMaterialAlbedo = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.albedoColor.elements : null;
            }
            return sprite3D.meshRender.sharedMaterial.albedoColor.elements;
        }, AnimationNode._setMeshRenderSharedMaterialAlbedo = function(animationNode, sprite3D, value) {
            var material, albedo;
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && ((albedo = (material = entity.owner.meshRender.material).albedoColor).elements = value, 
                material.albedoColor = albedo);
            } else (albedo = (material = sprite3D.meshRender.material).albedoColor).elements = value, 
            material.albedoColor = albedo;
        }, AnimationNode._getSkinnedMeshRenderSharedMaterialTilingOffset = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.skinnedMeshRender.sharedMaterial.tilingOffset.elements : null;
            }
            return sprite3D.skinnedMeshRender.sharedMaterial.tilingOffset.elements;
        }, AnimationNode._setSkinnedMeshRenderSharedMaterialTilingOffset = function(animationNode, sprite3D, value) {
            var material, tilingOffset;
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && ((tilingOffset = (material = entity.owner.skinnedMeshRender.material).tilingOffset).elements = value, 
                material.tilingOffset = tilingOffset);
            } else (tilingOffset = (material = sprite3D.skinnedMeshRender.material).tilingOffset).elements = value, 
            material.tilingOffset = tilingOffset;
        }, AnimationNode._getSkinnedMeshRenderSharedMaterialAlbedo = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.skinnedMeshRender.sharedMaterial.albedoColor.elements : null;
            }
            return sprite3D.skinnedMeshRender.sharedMaterial.albedoColor.elements;
        }, AnimationNode._setSkinnedMeshRenderSharedMaterialAlbedo = function(animationNode, sprite3D, value) {
            var material, albedo;
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && ((albedo = (material = entity.owner.skinnedMeshRender.material).albedoColor).elements = value, 
                material.albedoColor = albedo);
            } else (albedo = (material = sprite3D.skinnedMeshRender.material).albedoColor).elements = value, 
            material.albedoColor = albedo;
        }, AnimationNode._getParticleRenderSharedMaterialTintColor = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.particleRender.sharedMaterial.tintColor.elements : null;
            }
            return sprite3D.particleRender.sharedMaterial.tintColor.elements;
        }, AnimationNode._setParticleRenderSharedMaterialTintColor = function(animationNode, sprite3D, value) {
            var material, tintColor;
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && ((tintColor = (material = entity.owner.particleRender.material).tintColor).elements = value, 
                material.tintColor = tintColor);
            } else (tintColor = (material = sprite3D.particleRender.material).tintColor).elements = value, 
            material.tintColor = tintColor;
        }, AnimationNode._getMeshRenderSharedMaterialAlphaColor = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.alphaColor.elements : null;
            }
            return sprite3D.meshRender.sharedMaterial.alphaColor.elements;
        }, AnimationNode._setMeshRenderSharedMaterialAlphaColor = function(animationNode, sprite3D, value) {
            var material, alphaColor;
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && ((alphaColor = (material = entity.owner.meshRender.material).alphaColor).elements = value, 
                material.alphaColor = alphaColor);
            } else (alphaColor = (material = sprite3D.meshRender.material).alphaColor).elements = value, 
            material.alphaColor = alphaColor;
        }, AnimationNode._getMeshRenderSharedMaterialBaseColor = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.baseColor.elements : null;
            }
            return sprite3D.meshRender.sharedMaterial.baseColor.elements;
        }, AnimationNode._setMeshRenderSharedMaterialBaseColor = function(animationNode, sprite3D, value) {
            var material, baseColor;
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && ((baseColor = (material = entity.owner.meshRender.material).baseColor).elements = value, 
                material.baseColor = baseColor);
            } else (baseColor = (material = sprite3D.meshRender.material).baseColor).elements = value, 
            material.baseColor = baseColor;
        }, AnimationNode._getMeshRenderSharedMaterialDissolve = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.dissolve : 0;
            }
            return sprite3D.meshRender.sharedMaterial.dissolve;
        }, AnimationNode._setMeshRenderSharedMaterialDissolve = function(animationNode, sprite3D, value) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && (entity.owner.meshRender.material.dissolve = value[0]);
            } else sprite3D.meshRender.material.dissolve = value[0];
        }, AnimationNode._getMeshRenderSharedMaterialDissolveSpeed = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.dissolveSpeed : 0;
            }
            return sprite3D.meshRender.sharedMaterial.dissolveSpeed;
        }, AnimationNode._setMeshRenderSharedMaterialDissolveSpeed = function(animationNode, sprite3D, value) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && (entity.owner.meshRender.material.dissolveSpeed = value[0]);
            } else sprite3D.meshRender.material.dissolveSpeed = value[0];
        }, AnimationNode._getMeshRenderSharedMaterialMMultiplier = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.mMultiplier : 0;
            }
            return sprite3D.meshRender.sharedMaterial.mMultiplier;
        }, AnimationNode._setMeshRenderSharedMaterialMMultiplier = function(animationNode, sprite3D, value) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && (entity.owner.meshRender.material.mMultiplier = value[0]);
            } else sprite3D.meshRender.material.mMultiplier = value[0];
        }, AnimationNode._getMeshRenderSharedMaterialBaseScrollSpeedX = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.baseScrollSpeedX : 0;
            }
            return sprite3D.meshRender.sharedMaterial.baseScrollSpeedX;
        }, AnimationNode._setMeshRenderSharedMaterialBaseScrollSpeedX = function(animationNode, sprite3D, value) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && (entity.owner.meshRender.material.baseScrollSpeedX = value[0]);
            } else sprite3D.meshRender.material.baseScrollSpeedX = value[0];
        }, AnimationNode._getMeshRenderSharedMaterialBaseScrollSpeedY = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.baseScrollSpeedY : 0;
            }
            return sprite3D.meshRender.sharedMaterial.baseScrollSpeedY;
        }, AnimationNode._setMeshRenderSharedMaterialBaseScrollSpeedY = function(animationNode, sprite3D, value) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && (entity.owner.meshRender.material.baseScrollSpeedY = value[0]);
            } else sprite3D.meshRender.material.baseScrollSpeedY = value[0];
        }, AnimationNode._getMeshRenderSharedMaterialSecondScrollSpeedX = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.secondScrollSpeedX : 0;
            }
            return sprite3D.meshRender.sharedMaterial.secondScrollSpeedX;
        }, AnimationNode._setMeshRenderSharedMaterialSecondScrollSpeedX = function(animationNode, sprite3D, value) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && (entity.owner.meshRender.material.secondScrollSpeedX = value[0]);
            } else sprite3D.meshRender.material.secondScrollSpeedX = value[0];
        }, AnimationNode._getMeshRenderSharedMaterialSecondScrollSpeedY = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.secondScrollSpeedY : 0;
            }
            return sprite3D.meshRender.sharedMaterial.secondScrollSpeedY;
        }, AnimationNode._setMeshRenderSharedMaterialSecondScrollSpeedY = function(animationNode, sprite3D, value) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && (entity.owner.meshRender.material.secondScrollSpeedY = value[0]);
            } else sprite3D.meshRender.material.secondScrollSpeedY = value[0];
        }, AnimationNode._getMeshRenderSharedMaterialAlpha = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.alpha : 0;
            }
            return sprite3D.meshRender.sharedMaterial.alpha;
        }, AnimationNode._setMeshRenderSharedMaterialAlpha = function(animationNode, sprite3D, value) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && (entity.owner.meshRender.material.alpha = value[0]);
            } else sprite3D.meshRender.material.alpha = value[0];
        }, AnimationNode._getMeshRenderSharedMaterialIntensity = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.intensity : 0;
            }
            return sprite3D.meshRender.sharedMaterial.intensity;
        }, AnimationNode._setMeshRenderSharedMaterialIntensity = function(animationNode, sprite3D, value) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && (entity.owner.meshRender.material.intensity = value[0]);
            } else sprite3D.meshRender.material.intensity = value[0];
        }, AnimationNode._getMeshRenderSharedMaterialDetailTilingOffset = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.detailTilingOffset.elements : null;
            }
            return sprite3D.meshRender.sharedMaterial.detailTilingOffset.elements;
        }, AnimationNode._setMeshRenderSharedMaterialDetailTilingOffset = function(animationNode, sprite3D, value) {
            var material, detailTilingOffset;
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && ((detailTilingOffset = (material = entity.owner.meshRender.material).detailTilingOffset).elements = value, 
                material.detailTilingOffset = detailTilingOffset);
            } else (detailTilingOffset = (material = sprite3D.meshRender.material).detailTilingOffset).elements = value, 
            material.detailTilingOffset = detailTilingOffset;
        }, AnimationNode._getMeshRenderSharedMaterialDissolveTilingOffset = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.dissolveTilingOffset.elements : null;
            }
            return sprite3D.meshRender.sharedMaterial.dissolveTilingOffset.elements;
        }, AnimationNode._setMeshRenderSharedMaterialDissolveTilingOffset = function(animationNode, sprite3D, value) {
            var material, dissolveTilingOffset;
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && ((dissolveTilingOffset = (material = entity.owner.meshRender.material).dissolveTilingOffset).elements = value, 
                material.dissolveTilingOffset = dissolveTilingOffset);
            } else (dissolveTilingOffset = (material = sprite3D.meshRender.material).dissolveTilingOffset).elements = value, 
            material.dissolveTilingOffset = dissolveTilingOffset;
        }, AnimationNode._getMeshRenderSharedMaterialMaskTilingOffset = function(animationNode, sprite3D) {
            if (animationNode) {
                var entity = animationNode.transform._entity;
                return entity ? entity.owner.meshRender.sharedMaterial.maskTilingOffset.elements : null;
            }
            return sprite3D.meshRender.sharedMaterial.maskTilingOffset.elements;
        }, AnimationNode._setMeshRenderSharedMaterialMaskTilingOffset = function(animationNode, sprite3D, value) {
            var material, maskTilingOffset;
            if (animationNode) {
                var entity = animationNode.transform._entity;
                entity && ((maskTilingOffset = (material = entity.owner.meshRender.material).maskTilingOffset).elements = value, 
                material.maskTilingOffset = maskTilingOffset);
            } else (maskTilingOffset = (material = sprite3D.meshRender.material).maskTilingOffset).elements = value, 
            material.maskTilingOffset = maskTilingOffset;
        }, AnimationNode._propertyIDCounter = 0, AnimationNode._propertyIndexDic = {}, AnimationNode._propertySetFuncs = [], 
        AnimationNode._propertyGetFuncs = [], AnimationNode;
    }(), Keyframe = function() {
        function Keyframe() {
            this.startTime = NaN, this.inTangent = null, this.outTangent = null, this.data = null, 
            this.duration = NaN, this.next = null;
        }
        return __class(Keyframe, "laya.d3.animation.Keyframe"), Keyframe;
    }(), KeyframeNode = function() {
        function KeyframeNode() {
            this._cacheProperty = !1, this.path = null, this.componentType = null, this.propertyNameID = 0, 
            this.keyFrameWidth = 0, this.defaultData = null, this.keyFrames = null;
        }
        return __class(KeyframeNode, "laya.d3.animation.KeyframeNode"), KeyframeNode;
    }(), Layer = (function() {
        function SplineCurvePositionVelocity() {
            this._tempVector30 = new Vector3(), this._tempVector31 = new Vector3(), this._tempVector32 = new Vector3(), 
            this._a = new Vector3(), this._b = new Vector3(), this._c = new Vector3(), this._d = new Vector3();
        }
        __class(SplineCurvePositionVelocity, "laya.d3.core.glitter.SplineCurvePositionVelocity");
        var __proto = SplineCurvePositionVelocity.prototype;
        __proto.Init = function(position0, velocity0, position1, velocity1) {
            position0.cloneTo(this._d), velocity0.cloneTo(this._c), Vector3.scale(position0, 2, this._a), 
            Vector3.scale(position1, 2, this._tempVector30), Vector3.subtract(this._a, this._tempVector30, this._a), 
            Vector3.add(this._a, velocity0, this._a), Vector3.add(this._a, velocity1, this._a), 
            Vector3.scale(position1, 3, this._b), Vector3.scale(position0, 3, this._tempVector30), 
            Vector3.subtract(this._b, this._tempVector30, this._b), Vector3.subtract(this._b, velocity1, this._b), 
            Vector3.scale(velocity0, 2, this._tempVector30), Vector3.subtract(this._b, this._tempVector30, this._b);
        }, __proto.Slerp = function(t, out) {
            Vector3.scale(this._a, t * t * t, this._tempVector30), Vector3.scale(this._b, t * t, this._tempVector31), 
            Vector3.scale(this._c, t, this._tempVector32), Vector3.add(this._tempVector30, this._tempVector31, out), 
            Vector3.add(out, this._tempVector32, out), Vector3.add(out, this._d, out);
        };
    }(), function() {
        function HeightMap(width, height, minHeight, maxHeight) {
            this._datas = null, this._w = 0, this._h = 0, this._minHeight = NaN, this._maxHeight = NaN, 
            this._datas = [], this._w = width, this._h = height, this._minHeight = minHeight, 
            this._maxHeight = maxHeight;
        }
        __class(HeightMap, "laya.d3.core.HeightMap");
        var __proto = HeightMap.prototype;
        __proto._inBounds = function(row, col) {
            return 0 <= row && row < this._h && 0 <= col && col < this._w;
        }, __proto.getHeight = function(row, col) {
            return this._inBounds(row, col) ? this._datas[row][col] : NaN;
        }, __getset(0, __proto, "width", function() {
            return this._w;
        }), __getset(0, __proto, "height", function() {
            return this._h;
        }), __getset(0, __proto, "maxHeight", function() {
            return this._maxHeight;
        }), __getset(0, __proto, "minHeight", function() {
            return this._minHeight;
        }), HeightMap.creatFromMesh = function(mesh, width, height, outCellSize) {
            for (var vertices = [], indexs = [], submesheCount = mesh.getSubMeshCount(), i = 0; i < submesheCount; i++) {
                for (var subMesh = mesh.getSubMesh(i), vertexBuffer = subMesh._getVertexBuffer(), verts = vertexBuffer.getData(), subMeshVertices = [], j = 0; j < verts.length; j += vertexBuffer.vertexDeclaration.vertexStride / 4) {
                    var position = new Vector3(verts[j + 0], verts[j + 1], verts[j + 2]);
                    subMeshVertices.push(position);
                }
                vertices.push(subMeshVertices);
                var ib = subMesh._getIndexBuffer();
                indexs.push(ib.getData());
            }
            var boundingBox = mesh.boundingBox, minX = boundingBox.min.x, minZ = boundingBox.min.z, maxX = boundingBox.max.x, maxZ = boundingBox.max.z, minY = boundingBox.min.y, maxY = boundingBox.max.y, widthSize = maxX - minX, heightSize = maxZ - minZ, cellWidth = outCellSize.elements[0] = widthSize / (width - 1), cellHeight = outCellSize.elements[1] = heightSize / (height - 1), heightMap = new HeightMap(width, height, minY, maxY), ray = HeightMap._tempRay, rayDirE = ray.direction.elements;
            rayDirE[0] = 0, rayDirE[1] = -1, rayDirE[2] = 0;
            var rayY = maxY + .1;
            ray.origin.elements[1] = rayY;
            for (var h = 0; h < height; h++) {
                var posZ = minZ + h * cellHeight;
                heightMap._datas[h] = [];
                for (var w = 0; w < width; w++) {
                    var posX = minX + w * cellWidth, rayOriE = ray.origin.elements;
                    rayOriE[0] = posX, rayOriE[2] = posZ;
                    var closestIntersection = HeightMap._getPosition(ray, vertices, indexs);
                    heightMap._datas[h][w] = closestIntersection === Number.MAX_VALUE ? NaN : rayY - closestIntersection;
                }
            }
            return heightMap;
        }, HeightMap.createFromImage = function(texture, minHeight, maxHeight) {
            for (var textureWidth = texture.width, textureHeight = texture.height, heightMap = new HeightMap(textureWidth, textureHeight, minHeight, maxHeight), compressionRatio = (maxHeight - minHeight) / 254, pixelsInfo = texture.getPixels(), index = 0, h = 0; h < textureHeight; h++) for (var colDatas = heightMap._datas[h] = [], w = 0; w < textureWidth; w++) {
                var r = pixelsInfo[index++], g = pixelsInfo[index++], b = pixelsInfo[index++], a = pixelsInfo[index++];
                colDatas[w] = 255 == r && 255 == g && 255 == b && 255 == a ? NaN : (r + g + b) / 3 * compressionRatio + minHeight;
            }
            return heightMap;
        }, HeightMap._getPosition = function(ray, vertices, indexs) {
            for (var closestIntersection = Number.MAX_VALUE, i = 0; i < vertices.length; i++) for (var subMeshVertices = vertices[i], subMeshIndexes = indexs[i], j = 0; j < subMeshIndexes.length; j += 3) {
                var vertex1 = subMeshVertices[subMeshIndexes[j + 0]], vertex2 = subMeshVertices[subMeshIndexes[j + 1]], vertex3 = subMeshVertices[subMeshIndexes[j + 2]], intersection = Picker.rayIntersectsTriangle(ray, vertex1, vertex2, vertex3);
                !isNaN(intersection) && intersection < closestIntersection && (closestIntersection = intersection);
            }
            return closestIntersection;
        }, __static(HeightMap, [ "_tempRay", function() {
            return this._tempRay = new Ray(new Vector3(), new Vector3());
        } ]);
    }(), function() {
        function Layer() {
            this._visible = !0, this._nonRigidbodyOffset = 0, this._colliders = [];
        }
        __class(Layer, "laya.d3.core.Layer");
        var __proto = Layer.prototype;
        return __proto._binarySearchIndex = function() {
            for (var start = 0, end = Layer._collsionTestList.length - 1, mid = 0; start <= end; ) {
                mid = Math.floor((start + end) / 2);
                var midValue = Layer._collsionTestList[mid];
                if (midValue == this._number) return mid;
                midValue > this._number ? end = mid - 1 : start = mid + 1;
            }
            return start;
        }, __proto._addCollider = function(collider) {
            0 === this._colliders.length && Layer._collsionTestList.splice(this._binarySearchIndex(), 0, this._number), 
            collider._isRigidbody ? (this._colliders.unshift(collider), this._nonRigidbodyOffset++) : this._colliders.push(collider);
        }, __proto._removeCollider = function(collider) {
            var index = this._colliders.indexOf(collider);
            index < this._nonRigidbodyOffset && this._nonRigidbodyOffset--, this._colliders.splice(index, 1), 
            0 === this._colliders.length && Layer._collsionTestList.splice(Layer._collsionTestList.indexOf(this._number), 1);
        }, __getset(0, __proto, "number", function() {
            return this._number;
        }), __getset(0, __proto, "visible", function() {
            return this._visible;
        }, function(value) {
            this._visible = value, Layer._visibleLayers = value ? Layer._visibleLayers | this.mask : Layer._visibleLayers & ~this.mask;
        }), __getset(0, __proto, "mask", function() {
            return this._mask;
        }), __getset(1, Layer, "visibleLayers", function() {
            return Layer._visibleLayers;
        }, function(value) {
            Layer._visibleLayers = value;
            for (var i = 0, n = Layer._layerList.length; i < n; i++) {
                var layer = Layer._layerList[i];
                layer._visible = 0 != (layer._mask & Layer._visibleLayers);
            }
        }), Layer.__init__ = function() {
            Layer._layerList.length = 31;
            for (var i = 0; i < 31; i++) {
                var layer = new Layer();
                Layer._layerList[i] = layer, 0 === i ? (layer.name = "Default Layer", layer.visible = !0) : (layer.name = "Layer-" + i, 
                layer.visible = !1), layer._number = i, layer._mask = Math.pow(2, i);
            }
            Layer.currentCreationLayer = Layer._layerList[0];
        }, Layer.getLayerByNumber = function(number) {
            if (number < 0 || 30 < number) throw new Error("无法返回指定Layer，该number超出范围！");
            return Layer._layerList[number];
        }, Layer.getLayerByName = function(name) {
            for (var i = 0; i < 31; i++) if (Layer._layerList[i].name === name) return Layer._layerList[i];
            throw new Error("无法返回指定Layer,该name不存在");
        }, Layer.isVisible = function(mask) {
            return 0 != (mask & Layer._currentCameraCullingMask & Layer._visibleLayers);
        }, Layer._layerList = [], Layer._visibleLayers = 2147483647, Layer._collsionTestList = [], 
        Layer._currentCameraCullingMask = 2147483647, Layer.maxCount = 31, Layer.currentCreationLayer = null, 
        Layer;
    }()), FrameOverTime = (function() {
        function Burst(time, minCount, maxCount) {
            this._time = NaN, this._minCount = 0, this._maxCount = 0, this._time = time, this._minCount = minCount, 
            this._maxCount = maxCount;
        }
        __class(Burst, "laya.d3.core.particleShuriKen.module.Burst");
        var __proto = Burst.prototype;
        Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.cloneTo = function(destObject) {
            var destBurst = destObject;
            destBurst._time = this._time, destBurst._minCount = this._minCount, destBurst._maxCount = this._maxCount;
        }, __proto.clone = function() {
            var destBurst = new this.constructor();
            return this.cloneTo(destBurst), destBurst;
        }, __getset(0, __proto, "time", function() {
            return this._time;
        }), __getset(0, __proto, "minCount", function() {
            return this._minCount;
        }), __getset(0, __proto, "maxCount", function() {
            return this._maxCount;
        });
    }(), function() {
        function ColorOverLifetime(color) {
            this._color = null, this.enbale = !1, this._color = color;
        }
        __class(ColorOverLifetime, "laya.d3.core.particleShuriKen.module.ColorOverLifetime");
        var __proto = ColorOverLifetime.prototype;
        __proto.cloneTo = function(destObject) {
            var destColorOverLifetime = destObject;
            this._color.cloneTo(destColorOverLifetime._color), destColorOverLifetime.enbale = this.enbale;
        }, __proto.clone = function() {
            var destColor;
            switch (this._color.type) {
              case 0:
                destColor = GradientColor.createByConstant(this._color.constant.clone());
                break;

              case 1:
                destColor = GradientColor.createByGradient(this._color.gradient.clone());
                break;

              case 2:
                destColor = GradientColor.createByRandomTwoConstant(this._color.constantMin.clone(), this._color.constantMax.clone());
                break;

              case 3:
                destColor = GradientColor.createByRandomTwoGradient(this._color.gradientMin.clone(), this._color.gradientMax.clone());
            }
            var destColorOverLifetime = new this.constructor(destColor);
            return destColorOverLifetime.enbale = this.enbale, destColorOverLifetime;
        }, __getset(0, __proto, "color", function() {
            return this._color;
        });
    }(), function() {
        function Emission() {
            this._destroyed = !1, this._emissionRate = 0, this._bursts = null, this.enbale = !1, 
            this._destroyed = !1, this.emissionRate = 10, this._bursts = [];
        }
        __class(Emission, "laya.d3.core.particleShuriKen.module.Emission");
        var __proto = Emission.prototype;
        Laya.imps(__proto, {
            "laya.d3.core.IClone": !0,
            "laya.resource.IDestroy": !0
        }), __proto._destroy = function() {
            this._bursts = null, this._destroyed = !0;
        }, __proto.getBurstsCount = function() {
            return this._bursts.length;
        }, __proto.getBurstByIndex = function(index) {
            return this._bursts[index];
        }, __proto.addBurst = function(burst) {
            var burstsCount = this._bursts.length;
            if (0 < burstsCount) for (var i = 0; i < burstsCount; i++) this._bursts[i].time > burst.time && this._bursts.splice(i, 0, burst);
            this._bursts.push(burst);
        }, __proto.removeBurst = function(burst) {
            var index = this._bursts.indexOf(burst);
            -1 !== index && this._bursts.splice(index, 1);
        }, __proto.removeBurstByIndex = function(index) {
            this._bursts.splice(index, 1);
        }, __proto.clearBurst = function() {
            this._bursts.length = 0;
        }, __proto.cloneTo = function(destObject) {
            var destEmission = destObject, destBursts = destEmission._bursts;
            destBursts.length = this._bursts.length;
            for (var i = 0, n = this._bursts.length; i < n; i++) {
                var destBurst = destBursts[i];
                destBurst ? this._bursts[i].cloneTo(destBurst) : destBursts[i] = this._bursts[i].clone();
            }
            destEmission._emissionRate = this._emissionRate, destEmission.enbale = this.enbale;
        }, __proto.clone = function() {
            var destEmission = new this.constructor();
            return this.cloneTo(destEmission), destEmission;
        }, __getset(0, __proto, "destroyed", function() {
            return this._destroyed;
        }), __getset(0, __proto, "emissionRate", function() {
            return this._emissionRate;
        }, function(value) {
            if (value < 0) throw new Error("ParticleBaseShape:emissionRate value must large or equal than 0.");
            this._emissionRate = value;
        });
    }(), function() {
        function FrameOverTime() {
            this._type = 0, this._constant = 0, this._overTime = null, this._constantMin = 0, 
            this._constantMax = 0, this._overTimeMin = null, this._overTimeMax = null;
        }
        __class(FrameOverTime, "laya.d3.core.particleShuriKen.module.FrameOverTime");
        var __proto = FrameOverTime.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.cloneTo = function(destObject) {
            var destFrameOverTime = destObject;
            destFrameOverTime._type = this._type, destFrameOverTime._constant = this._constant, 
            this._overTime.cloneTo(destFrameOverTime._overTime), destFrameOverTime._constantMin = this._constantMin, 
            destFrameOverTime._constantMax = this._constantMax, this._overTimeMin.cloneTo(destFrameOverTime._overTimeMin), 
            this._overTimeMax.cloneTo(destFrameOverTime._overTimeMax);
        }, __proto.clone = function() {
            var destFrameOverTime = new this.constructor();
            return this.cloneTo(destFrameOverTime), destFrameOverTime;
        }, __getset(0, __proto, "frameOverTimeData", function() {
            return this._overTime;
        }), __getset(0, __proto, "constant", function() {
            return this._constant;
        }), __getset(0, __proto, "type", function() {
            return this._type;
        }), __getset(0, __proto, "frameOverTimeDataMin", function() {
            return this._overTimeMin;
        }), __getset(0, __proto, "constantMin", function() {
            return this._constantMin;
        }), __getset(0, __proto, "frameOverTimeDataMax", function() {
            return this._overTimeMax;
        }), __getset(0, __proto, "constantMax", function() {
            return this._constantMax;
        }), FrameOverTime.createByConstant = function(constant) {
            var rotationOverLifetime = new FrameOverTime();
            return rotationOverLifetime._type = 0, rotationOverLifetime._constant = constant, 
            rotationOverLifetime;
        }, FrameOverTime.createByOverTime = function(overTime) {
            var rotationOverLifetime = new FrameOverTime();
            return rotationOverLifetime._type = 1, rotationOverLifetime._overTime = overTime, 
            rotationOverLifetime;
        }, FrameOverTime.createByRandomTwoConstant = function(constantMin, constantMax) {
            var rotationOverLifetime = new FrameOverTime();
            return rotationOverLifetime._type = 2, rotationOverLifetime._constantMin = constantMin, 
            rotationOverLifetime._constantMax = constantMax, rotationOverLifetime;
        }, FrameOverTime.createByRandomTwoOverTime = function(gradientFrameMin, gradientFrameMax) {
            var rotationOverLifetime = new FrameOverTime();
            return rotationOverLifetime._type = 3, rotationOverLifetime._overTimeMin = gradientFrameMin, 
            rotationOverLifetime._overTimeMax = gradientFrameMax, rotationOverLifetime;
        }, FrameOverTime;
    }()), GradientAngularVelocity = function() {
        function GradientAngularVelocity() {
            this._type = 0, this._separateAxes = !1, this._constant = NaN, this._constantSeparate = null, 
            this._gradient = null, this._gradientX = null, this._gradientY = null, this._gradientZ = null, 
            this._gradientW = null, this._constantMin = NaN, this._constantMax = NaN, this._constantMinSeparate = null, 
            this._constantMaxSeparate = null, this._gradientMin = null, this._gradientMax = null, 
            this._gradientXMin = null, this._gradientXMax = null, this._gradientYMin = null, 
            this._gradientYMax = null, this._gradientZMin = null, this._gradientZMax = null, 
            this._gradientWMin = null, this._gradientWMax = null;
        }
        __class(GradientAngularVelocity, "laya.d3.core.particleShuriKen.module.GradientAngularVelocity");
        var __proto = GradientAngularVelocity.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.cloneTo = function(destObject) {
            var destGradientAngularVelocity = destObject;
            destGradientAngularVelocity._type = this._type, destGradientAngularVelocity._separateAxes = this._separateAxes, 
            destGradientAngularVelocity._constant = this._constant, this._constantSeparate.cloneTo(destGradientAngularVelocity._constantSeparate), 
            this._gradient.cloneTo(destGradientAngularVelocity._gradient), this._gradientX.cloneTo(destGradientAngularVelocity._gradientX), 
            this._gradientY.cloneTo(destGradientAngularVelocity._gradientY), this._gradientZ.cloneTo(destGradientAngularVelocity._gradientZ), 
            destGradientAngularVelocity._constantMin = this._constantMin, destGradientAngularVelocity._constantMax = this._constantMax, 
            this._constantMinSeparate.cloneTo(destGradientAngularVelocity._constantMinSeparate), 
            this._constantMaxSeparate.cloneTo(destGradientAngularVelocity._constantMaxSeparate), 
            this._gradientMin.cloneTo(destGradientAngularVelocity._gradientMin), this._gradientMax.cloneTo(destGradientAngularVelocity._gradientMax), 
            this._gradientXMin.cloneTo(destGradientAngularVelocity._gradientXMin), this._gradientXMax.cloneTo(destGradientAngularVelocity._gradientXMax), 
            this._gradientYMin.cloneTo(destGradientAngularVelocity._gradientYMin), this._gradientYMax.cloneTo(destGradientAngularVelocity._gradientYMax), 
            this._gradientZMin.cloneTo(destGradientAngularVelocity._gradientZMin), this._gradientZMax.cloneTo(destGradientAngularVelocity._gradientZMax);
        }, __proto.clone = function() {
            var destGradientAngularVelocity = new this.constructor();
            return this.cloneTo(destGradientAngularVelocity), destGradientAngularVelocity;
        }, __getset(0, __proto, "gradientZ", function() {
            return this._gradientZ;
        }), __getset(0, __proto, "constant", function() {
            return this._constant;
        }), __getset(0, __proto, "gradient", function() {
            return this._gradient;
        }), __getset(0, __proto, "separateAxes", function() {
            return this._separateAxes;
        }), __getset(0, __proto, "type", function() {
            return this._type;
        }), __getset(0, __proto, "constantSeparate", function() {
            return this._constantSeparate;
        }), __getset(0, __proto, "gradientX", function() {
            return this._gradientX;
        }), __getset(0, __proto, "gradientY", function() {
            return this._gradientY;
        }), __getset(0, __proto, "gradientW", function() {
            return this._gradientW;
        }), __getset(0, __proto, "gradientMin", function() {
            return this._gradientMin;
        }), __getset(0, __proto, "constantMin", function() {
            return this._constantMin;
        }), __getset(0, __proto, "gradientMax", function() {
            return this._gradientMax;
        }), __getset(0, __proto, "constantMax", function() {
            return this._constantMax;
        }), __getset(0, __proto, "gradientWMin", function() {
            return this._gradientWMin;
        }), __getset(0, __proto, "constantMinSeparate", function() {
            return this._constantMinSeparate;
        }), __getset(0, __proto, "constantMaxSeparate", function() {
            return this._constantMaxSeparate;
        }), __getset(0, __proto, "gradientXMin", function() {
            return this._gradientXMin;
        }), __getset(0, __proto, "gradientXMax", function() {
            return this._gradientXMax;
        }), __getset(0, __proto, "gradientWMax", function() {
            return this._gradientWMax;
        }), __getset(0, __proto, "gradientYMin", function() {
            return this._gradientYMin;
        }), __getset(0, __proto, "gradientYMax", function() {
            return this._gradientYMax;
        }), __getset(0, __proto, "gradientZMin", function() {
            return this._gradientZMin;
        }), __getset(0, __proto, "gradientZMax", function() {
            return this._gradientZMax;
        }), GradientAngularVelocity.createByConstant = function(constant) {
            var gradientAngularVelocity = new GradientAngularVelocity();
            return gradientAngularVelocity._type = 0, gradientAngularVelocity._separateAxes = !1, 
            gradientAngularVelocity._constant = constant, gradientAngularVelocity;
        }, GradientAngularVelocity.createByConstantSeparate = function(separateConstant) {
            var gradientAngularVelocity = new GradientAngularVelocity();
            return gradientAngularVelocity._type = 0, gradientAngularVelocity._separateAxes = !0, 
            gradientAngularVelocity._constantSeparate = separateConstant, gradientAngularVelocity;
        }, GradientAngularVelocity.createByGradient = function(gradient) {
            var gradientAngularVelocity = new GradientAngularVelocity();
            return gradientAngularVelocity._type = 1, gradientAngularVelocity._separateAxes = !1, 
            gradientAngularVelocity._gradient = gradient, gradientAngularVelocity;
        }, GradientAngularVelocity.createByGradientSeparate = function(gradientX, gradientY, gradientZ, gradientW) {
            var gradientAngularVelocity = new GradientAngularVelocity();
            return gradientAngularVelocity._type = 1, gradientAngularVelocity._separateAxes = !0, 
            gradientAngularVelocity._gradientX = gradientX, gradientAngularVelocity._gradientY = gradientY, 
            gradientAngularVelocity._gradientZ = gradientZ, gradientAngularVelocity._gradientW = gradientW, 
            gradientAngularVelocity;
        }, GradientAngularVelocity.createByRandomTwoConstant = function(constantMin, constantMax) {
            var gradientAngularVelocity = new GradientAngularVelocity();
            return gradientAngularVelocity._type = 2, gradientAngularVelocity._separateAxes = !1, 
            gradientAngularVelocity._constantMin = constantMin, gradientAngularVelocity._constantMax = constantMax, 
            gradientAngularVelocity;
        }, GradientAngularVelocity.createByRandomTwoConstantSeparate = function(separateConstantMin, separateConstantMax) {
            var gradientAngularVelocity = new GradientAngularVelocity();
            return gradientAngularVelocity._type = 2, gradientAngularVelocity._separateAxes = !0, 
            gradientAngularVelocity._constantMinSeparate = separateConstantMin, gradientAngularVelocity._constantMaxSeparate = separateConstantMax, 
            gradientAngularVelocity;
        }, GradientAngularVelocity.createByRandomTwoGradient = function(gradientMin, gradientMax) {
            var gradientAngularVelocity = new GradientAngularVelocity();
            return gradientAngularVelocity._type = 3, gradientAngularVelocity._separateAxes = !1, 
            gradientAngularVelocity._gradientMin = gradientMin, gradientAngularVelocity._gradientMax = gradientMax, 
            gradientAngularVelocity;
        }, GradientAngularVelocity.createByRandomTwoGradientSeparate = function(gradientXMin, gradientXMax, gradientYMin, gradientYMax, gradientZMin, gradientZMax, gradientWMin, gradientWMax) {
            var gradientAngularVelocity = new GradientAngularVelocity();
            return gradientAngularVelocity._type = 3, gradientAngularVelocity._separateAxes = !0, 
            gradientAngularVelocity._gradientXMin = gradientXMin, gradientAngularVelocity._gradientXMax = gradientXMax, 
            gradientAngularVelocity._gradientYMin = gradientYMin, gradientAngularVelocity._gradientYMax = gradientYMax, 
            gradientAngularVelocity._gradientZMin = gradientZMin, gradientAngularVelocity._gradientZMax = gradientZMax, 
            gradientAngularVelocity._gradientWMin = gradientWMin, gradientAngularVelocity._gradientWMax = gradientWMax, 
            gradientAngularVelocity;
        }, GradientAngularVelocity;
    }(), GradientColor = function() {
        function GradientColor() {
            this._type = 0, this._constant = null, this._constantMin = null, this._constantMax = null, 
            this._gradient = null, this._gradientMin = null, this._gradientMax = null;
        }
        __class(GradientColor, "laya.d3.core.particleShuriKen.module.GradientColor");
        var __proto = GradientColor.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.cloneTo = function(destObject) {
            var destGradientColor = destObject;
            destGradientColor._type = this._type, this._constant.cloneTo(destGradientColor._constant), 
            this._constantMin.cloneTo(destGradientColor._constantMin), this._constantMax.cloneTo(destGradientColor._constantMax), 
            this._gradient.cloneTo(destGradientColor._gradient), this._gradientMin.cloneTo(destGradientColor._gradientMin), 
            this._gradientMax.cloneTo(destGradientColor._gradientMax);
        }, __proto.clone = function() {
            var destGradientColor = new this.constructor();
            return this.cloneTo(destGradientColor), destGradientColor;
        }, __getset(0, __proto, "gradient", function() {
            return this._gradient;
        }), __getset(0, __proto, "constant", function() {
            return this._constant;
        }), __getset(0, __proto, "type", function() {
            return this._type;
        }), __getset(0, __proto, "gradientMin", function() {
            return this._gradientMin;
        }), __getset(0, __proto, "constantMin", function() {
            return this._constantMin;
        }), __getset(0, __proto, "gradientMax", function() {
            return this._gradientMax;
        }), __getset(0, __proto, "constantMax", function() {
            return this._constantMax;
        }), GradientColor.createByConstant = function(constant) {
            var gradientColor = new GradientColor();
            return gradientColor._type = 0, gradientColor._constant = constant, gradientColor;
        }, GradientColor.createByGradient = function(gradient) {
            var gradientColor = new GradientColor();
            return gradientColor._type = 1, gradientColor._gradient = gradient, gradientColor;
        }, GradientColor.createByRandomTwoConstant = function(minConstant, maxConstant) {
            var gradientColor = new GradientColor();
            return gradientColor._type = 2, gradientColor._constantMin = minConstant, gradientColor._constantMax = maxConstant, 
            gradientColor;
        }, GradientColor.createByRandomTwoGradient = function(minGradient, maxGradient) {
            var gradientColor = new GradientColor();
            return gradientColor._type = 3, gradientColor._gradientMin = minGradient, gradientColor._gradientMax = maxGradient, 
            gradientColor;
        }, GradientColor;
    }(), GradientSize = (function() {
        function GradientDataColor() {
            this._alphaCurrentLength = 0, this._rgbCurrentLength = 0, this._alphaElements = null, 
            this._rgbElements = null, this._alphaElements = new Float32Array(8), this._rgbElements = new Float32Array(16);
        }
        __class(GradientDataColor, "laya.d3.core.particleShuriKen.module.GradientDataColor");
        var __proto = GradientDataColor.prototype;
        Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.addAlpha = function(key, value) {
            this._alphaCurrentLength < 8 && (6 === this._alphaCurrentLength && 1 !== key && (key = 1), 
            this._alphaElements[this._alphaCurrentLength++] = key, this._alphaElements[this._alphaCurrentLength++] = value);
        }, __proto.addRGB = function(key, value) {
            this._rgbCurrentLength < 16 && (12 === this._rgbCurrentLength && 1 !== key && (key = 1), 
            this._rgbElements[this._rgbCurrentLength++] = key, this._rgbElements[this._rgbCurrentLength++] = value.x, 
            this._rgbElements[this._rgbCurrentLength++] = value.y, this._rgbElements[this._rgbCurrentLength++] = value.z);
        }, __proto.cloneTo = function(destObject) {
            var destGradientDataColor = destObject, i = 0, n = 0;
            destGradientDataColor._alphaCurrentLength = this._alphaCurrentLength;
            var destAlphaElements = destGradientDataColor._alphaElements;
            for (destAlphaElements.length = this._alphaElements.length, i = 0, n = this._alphaElements.length; i < n; i++) destAlphaElements[i] = this._alphaElements[i];
            destGradientDataColor._rgbCurrentLength = this._rgbCurrentLength;
            var destRGBElements = destGradientDataColor._rgbElements;
            for (destRGBElements.length = this._rgbElements.length, i = 0, n = this._rgbElements.length; i < n; i++) destRGBElements[i] = this._rgbElements[i];
        }, __proto.clone = function() {
            var destGradientDataColor = new this.constructor();
            return this.cloneTo(destGradientDataColor), destGradientDataColor;
        }, __getset(0, __proto, "alphaGradientCount", function() {
            return this._alphaCurrentLength / 2;
        }), __getset(0, __proto, "rgbGradientCount", function() {
            return this._rgbCurrentLength / 4;
        });
    }(), function() {
        function GradientDataInt() {
            this._currentLength = 0, this._elements = null, this._elements = new Float32Array(8);
        }
        __class(GradientDataInt, "laya.d3.core.particleShuriKen.module.GradientDataInt");
        var __proto = GradientDataInt.prototype;
        Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.add = function(key, value) {
            this._currentLength < 8 ? (6 === this._currentLength && 1 !== key && (key = 1, console.log("Warning:the forth key is  be force set to 1.")), 
            this._elements[this._currentLength++] = key, this._elements[this._currentLength++] = value) : console.log("Warning:data count must lessEqual than 4");
        }, __proto.cloneTo = function(destObject) {
            var destGradientDataInt = destObject;
            destGradientDataInt._currentLength = this._currentLength;
            var destElements = destGradientDataInt._elements;
            destElements.length = this._elements.length;
            for (var i = 0, n = this._elements.length; i < n; i++) destElements[i] = this._elements[i];
        }, __proto.clone = function() {
            var destGradientDataInt = new this.constructor();
            return this.cloneTo(destGradientDataInt), destGradientDataInt;
        }, __getset(0, __proto, "gradientCount", function() {
            return this._currentLength / 2;
        });
    }(), function() {
        function GradientDataNumber() {
            this._currentLength = 0, this._elements = null, this._elements = new Float32Array(8);
        }
        __class(GradientDataNumber, "laya.d3.core.particleShuriKen.module.GradientDataNumber");
        var __proto = GradientDataNumber.prototype;
        Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.add = function(key, value) {
            this._currentLength < 8 && (6 === this._currentLength && 1 !== key && (key = 1), 
            this._elements[this._currentLength++] = key, this._elements[this._currentLength++] = value);
        }, __proto.getKeyByIndex = function(index) {
            return this._elements[2 * index];
        }, __proto.getValueByIndex = function(index) {
            return this._elements[2 * index + 1];
        }, __proto.getAverageValue = function() {
            for (var i = 0, n = this._currentLength - 2; i < n; i += 2) {
                this._elements[i + 1];
                this._elements[i + 3], this._elements[i + 2] - this._elements[i];
            }
            return 0;
        }, __proto.cloneTo = function(destObject) {
            var destGradientDataNumber = destObject;
            destGradientDataNumber._currentLength = this._currentLength;
            var destElements = destGradientDataNumber._elements;
            destElements.length = this._elements.length;
            for (var i = 0, n = this._elements.length; i < n; i++) destElements[i] = this._elements[i];
        }, __proto.clone = function() {
            var destGradientDataNumber = new this.constructor();
            return this.cloneTo(destGradientDataNumber), destGradientDataNumber;
        }, __getset(0, __proto, "gradientCount", function() {
            return this._currentLength / 2;
        });
    }(), function() {
        function GradientDataVector2() {
            this._currentLength = 0, this._elements = null, this._elements = new Float32Array(12);
        }
        __class(GradientDataVector2, "laya.d3.core.particleShuriKen.module.GradientDataVector2");
        var __proto = GradientDataVector2.prototype;
        Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.add = function(key, value) {
            this._currentLength < 8 && (6 === this._currentLength && 1 !== key && (key = 1), 
            this._elements[this._currentLength++] = key, this._elements[this._currentLength++] = value.x, 
            this._elements[this._currentLength++] = value.y);
        }, __proto.cloneTo = function(destObject) {
            var destGradientDataVector2 = destObject;
            destGradientDataVector2._currentLength = this._currentLength;
            var destElements = destGradientDataVector2._elements;
            destElements.length = this._elements.length;
            for (var i = 0, n = this._elements.length; i < n; i++) destElements[i] = this._elements[i];
        }, __proto.clone = function() {
            var destGradientDataVector2 = new this.constructor();
            return this.cloneTo(destGradientDataVector2), destGradientDataVector2;
        }, __getset(0, __proto, "gradientCount", function() {
            return this._currentLength / 3;
        });
    }(), function() {
        function GradientSize() {
            this._type = 0, this._separateAxes = !1, this._gradient = null, this._gradientX = null, 
            this._gradientY = null, this._gradientZ = null, this._constantMin = NaN, this._constantMax = NaN, 
            this._constantMinSeparate = null, this._constantMaxSeparate = null, this._gradientMin = null, 
            this._gradientMax = null, this._gradientXMin = null, this._gradientXMax = null, 
            this._gradientYMin = null, this._gradientYMax = null, this._gradientZMin = null, 
            this._gradientZMax = null;
        }
        __class(GradientSize, "laya.d3.core.particleShuriKen.module.GradientSize");
        var __proto = GradientSize.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.getMaxSizeInGradient = function() {
            var i = 0, n = 0, maxSize = -Number.MAX_VALUE;
            switch (this._type) {
              case 0:
                if (this._separateAxes) {
                    for (i = 0, n = this._gradientX.gradientCount; i < n; i++) maxSize = Math.max(maxSize, this._gradientX.getValueByIndex(i));
                    for (i = 0, n = this._gradientY.gradientCount; i < n; i++) maxSize = Math.max(maxSize, this._gradientY.getValueByIndex(i));
                } else for (i = 0, n = this._gradient.gradientCount; i < n; i++) maxSize = Math.max(maxSize, this._gradient.getValueByIndex(i));
                break;

              case 1:
                maxSize = this._separateAxes ? (maxSize = Math.max(this._constantMinSeparate.x, this._constantMaxSeparate.x), 
                maxSize = Math.max(maxSize, this._constantMinSeparate.y), Math.max(maxSize, this._constantMaxSeparate.y)) : Math.max(this._constantMin, this._constantMax);
                break;

              case 2:
                if (this._separateAxes) {
                    for (i = 0, n = this._gradientXMin.gradientCount; i < n; i++) maxSize = Math.max(maxSize, this._gradientXMin.getValueByIndex(i));
                    for (i = 0, n = this._gradientXMax.gradientCount; i < n; i++) maxSize = Math.max(maxSize, this._gradientXMax.getValueByIndex(i));
                    for (i = 0, n = this._gradientYMin.gradientCount; i < n; i++) maxSize = Math.max(maxSize, this._gradientYMin.getValueByIndex(i));
                    for (i = 0, n = this._gradientZMax.gradientCount; i < n; i++) maxSize = Math.max(maxSize, this._gradientZMax.getValueByIndex(i));
                } else {
                    for (i = 0, n = this._gradientMin.gradientCount; i < n; i++) maxSize = Math.max(maxSize, this._gradientMin.getValueByIndex(i));
                    for (i = 0, n = this._gradientMax.gradientCount; i < n; i++) maxSize = Math.max(maxSize, this._gradientMax.getValueByIndex(i));
                }
            }
            return maxSize;
        }, __proto.cloneTo = function(destObject) {
            var destGradientSize = destObject;
            destGradientSize._type = this._type, destGradientSize._separateAxes = this._separateAxes, 
            this._gradient.cloneTo(destGradientSize._gradient), this._gradientX.cloneTo(destGradientSize._gradientX), 
            this._gradientY.cloneTo(destGradientSize._gradientY), this._gradientZ.cloneTo(destGradientSize._gradientZ), 
            destGradientSize._constantMin = this._constantMin, destGradientSize._constantMax = this._constantMax, 
            this._constantMinSeparate.cloneTo(destGradientSize._constantMinSeparate), this._constantMaxSeparate.cloneTo(destGradientSize._constantMaxSeparate), 
            this._gradientMin.cloneTo(destGradientSize._gradientMin), this._gradientMax.cloneTo(destGradientSize._gradientMax), 
            this._gradientXMin.cloneTo(destGradientSize._gradientXMin), this._gradientXMax.cloneTo(destGradientSize._gradientXMax), 
            this._gradientYMin.cloneTo(destGradientSize._gradientYMin), this._gradientYMax.cloneTo(destGradientSize._gradientYMax), 
            this._gradientZMin.cloneTo(destGradientSize._gradientZMin), this._gradientZMax.cloneTo(destGradientSize._gradientZMax);
        }, __proto.clone = function() {
            var destGradientSize = new this.constructor();
            return this.cloneTo(destGradientSize), destGradientSize;
        }, __getset(0, __proto, "gradientZ", function() {
            return this._gradientZ;
        }), __getset(0, __proto, "gradient", function() {
            return this._gradient;
        }), __getset(0, __proto, "separateAxes", function() {
            return this._separateAxes;
        }), __getset(0, __proto, "type", function() {
            return this._type;
        }), __getset(0, __proto, "gradientMin", function() {
            return this._gradientMin;
        }), __getset(0, __proto, "constantMin", function() {
            return this._constantMin;
        }), __getset(0, __proto, "gradientX", function() {
            return this._gradientX;
        }), __getset(0, __proto, "gradientY", function() {
            return this._gradientY;
        }), __getset(0, __proto, "gradientMax", function() {
            return this._gradientMax;
        }), __getset(0, __proto, "constantMax", function() {
            return this._constantMax;
        }), __getset(0, __proto, "constantMinSeparate", function() {
            return this._constantMinSeparate;
        }), __getset(0, __proto, "constantMaxSeparate", function() {
            return this._constantMaxSeparate;
        }), __getset(0, __proto, "gradientXMin", function() {
            return this._gradientXMin;
        }), __getset(0, __proto, "gradientXMax", function() {
            return this._gradientXMax;
        }), __getset(0, __proto, "gradientYMin", function() {
            return this._gradientYMin;
        }), __getset(0, __proto, "gradientYMax", function() {
            return this._gradientYMax;
        }), __getset(0, __proto, "gradientZMin", function() {
            return this._gradientZMin;
        }), __getset(0, __proto, "gradientZMax", function() {
            return this._gradientZMax;
        }), GradientSize.createByGradient = function(gradient) {
            var gradientSize = new GradientSize();
            return gradientSize._type = 0, gradientSize._separateAxes = !1, gradientSize._gradient = gradient, 
            gradientSize;
        }, GradientSize.createByGradientSeparate = function(gradientX, gradientY, gradientZ) {
            var gradientSize = new GradientSize();
            return gradientSize._type = 0, gradientSize._separateAxes = !0, gradientSize._gradientX = gradientX, 
            gradientSize._gradientY = gradientY, gradientSize._gradientZ = gradientZ, gradientSize;
        }, GradientSize.createByRandomTwoConstant = function(constantMin, constantMax) {
            var gradientSize = new GradientSize();
            return gradientSize._type = 1, gradientSize._separateAxes = !1, gradientSize._constantMin = constantMin, 
            gradientSize._constantMax = constantMax, gradientSize;
        }, GradientSize.createByRandomTwoConstantSeparate = function(constantMinSeparate, constantMaxSeparate) {
            var gradientSize = new GradientSize();
            return gradientSize._type = 1, gradientSize._separateAxes = !0, gradientSize._constantMinSeparate = constantMinSeparate, 
            gradientSize._constantMaxSeparate = constantMaxSeparate, gradientSize;
        }, GradientSize.createByRandomTwoGradient = function(gradientMin, gradientMax) {
            var gradientSize = new GradientSize();
            return gradientSize._type = 2, gradientSize._separateAxes = !1, gradientSize._gradientMin = gradientMin, 
            gradientSize._gradientMax = gradientMax, gradientSize;
        }, GradientSize.createByRandomTwoGradientSeparate = function(gradientXMin, gradientXMax, gradientYMin, gradientYMax, gradientZMin, gradientZMax) {
            var gradientSize = new GradientSize();
            return gradientSize._type = 2, gradientSize._separateAxes = !0, gradientSize._gradientXMin = gradientXMin, 
            gradientSize._gradientXMax = gradientXMax, gradientSize._gradientYMin = gradientYMin, 
            gradientSize._gradientYMax = gradientYMax, gradientSize._gradientZMin = gradientZMin, 
            gradientSize._gradientZMax = gradientZMax, gradientSize;
        }, GradientSize;
    }()), GradientVelocity = function() {
        function GradientVelocity() {
            this._type = 0, this._constant = null, this._gradientX = null, this._gradientY = null, 
            this._gradientZ = null, this._constantMin = null, this._constantMax = null, this._gradientXMin = null, 
            this._gradientXMax = null, this._gradientYMin = null, this._gradientYMax = null, 
            this._gradientZMin = null, this._gradientZMax = null;
        }
        __class(GradientVelocity, "laya.d3.core.particleShuriKen.module.GradientVelocity");
        var __proto = GradientVelocity.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.cloneTo = function(destObject) {
            var destGradientVelocity = destObject;
            destGradientVelocity._type = this._type, this._constant.cloneTo(destGradientVelocity._constant), 
            this._gradientX.cloneTo(destGradientVelocity._gradientX), this._gradientY.cloneTo(destGradientVelocity._gradientY), 
            this._gradientZ.cloneTo(destGradientVelocity._gradientZ), this._constantMin.cloneTo(destGradientVelocity._constantMin), 
            this._constantMax.cloneTo(destGradientVelocity._constantMax), this._gradientXMin.cloneTo(destGradientVelocity._gradientXMin), 
            this._gradientXMax.cloneTo(destGradientVelocity._gradientXMax), this._gradientYMin.cloneTo(destGradientVelocity._gradientYMin), 
            this._gradientYMax.cloneTo(destGradientVelocity._gradientYMax), this._gradientZMin.cloneTo(destGradientVelocity._gradientZMin), 
            this._gradientZMax.cloneTo(destGradientVelocity._gradientZMax);
        }, __proto.clone = function() {
            var destGradientVelocity = new this.constructor();
            return this.cloneTo(destGradientVelocity), destGradientVelocity;
        }, __getset(0, __proto, "gradientZ", function() {
            return this._gradientZ;
        }), __getset(0, __proto, "constant", function() {
            return this._constant;
        }), __getset(0, __proto, "type", function() {
            return this._type;
        }), __getset(0, __proto, "gradientXMax", function() {
            return this._gradientXMax;
        }), __getset(0, __proto, "constantMin", function() {
            return this._constantMin;
        }), __getset(0, __proto, "gradientX", function() {
            return this._gradientX;
        }), __getset(0, __proto, "gradientY", function() {
            return this._gradientY;
        }), __getset(0, __proto, "gradientXMin", function() {
            return this._gradientXMin;
        }), __getset(0, __proto, "constantMax", function() {
            return this._constantMax;
        }), __getset(0, __proto, "gradientYMin", function() {
            return this._gradientYMin;
        }), __getset(0, __proto, "gradientYMax", function() {
            return this._gradientYMax;
        }), __getset(0, __proto, "gradientZMin", function() {
            return this._gradientZMin;
        }), __getset(0, __proto, "gradientZMax", function() {
            return this._gradientZMax;
        }), GradientVelocity.createByConstant = function(constant) {
            var gradientVelocity = new GradientVelocity();
            return gradientVelocity._type = 0, gradientVelocity._constant = constant, gradientVelocity;
        }, GradientVelocity.createByGradient = function(gradientX, gradientY, gradientZ) {
            var gradientVelocity = new GradientVelocity();
            return gradientVelocity._type = 1, gradientVelocity._gradientX = gradientX, gradientVelocity._gradientY = gradientY, 
            gradientVelocity._gradientZ = gradientZ, gradientVelocity;
        }, GradientVelocity.createByRandomTwoConstant = function(constantMin, constantMax) {
            var gradientVelocity = new GradientVelocity();
            return gradientVelocity._type = 2, gradientVelocity._constantMin = constantMin, 
            gradientVelocity._constantMax = constantMax, gradientVelocity;
        }, GradientVelocity.createByRandomTwoGradient = function(gradientXMin, gradientXMax, gradientYMin, gradientYMax, gradientZMin, gradientZMax) {
            var gradientVelocity = new GradientVelocity();
            return gradientVelocity._type = 3, gradientVelocity._gradientXMin = gradientXMin, 
            gradientVelocity._gradientXMax = gradientXMax, gradientVelocity._gradientYMin = gradientYMin, 
            gradientVelocity._gradientYMax = gradientYMax, gradientVelocity._gradientZMin = gradientZMin, 
            gradientVelocity._gradientZMax = gradientZMax, gradientVelocity;
        }, GradientVelocity;
    }(), BaseShape = (function() {
        function RotationOverLifetime(angularVelocity) {
            this._angularVelocity = null, this.enbale = !1, this._angularVelocity = angularVelocity;
        }
        __class(RotationOverLifetime, "laya.d3.core.particleShuriKen.module.RotationOverLifetime");
        var __proto = RotationOverLifetime.prototype;
        Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.cloneTo = function(destObject) {
            var destRotationOverLifetime = destObject;
            this._angularVelocity.cloneTo(destRotationOverLifetime._angularVelocity), destRotationOverLifetime.enbale = this.enbale;
        }, __proto.clone = function() {
            var destAngularVelocity;
            switch (this._angularVelocity.type) {
              case 0:
                destAngularVelocity = this._angularVelocity.separateAxes ? GradientAngularVelocity.createByConstantSeparate(this._angularVelocity.constantSeparate.clone()) : GradientAngularVelocity.createByConstant(this._angularVelocity.constant);
                break;

              case 1:
                destAngularVelocity = this._angularVelocity.separateAxes ? GradientAngularVelocity.createByGradientSeparate(this._angularVelocity.gradientX.clone(), this._angularVelocity.gradientY.clone(), this._angularVelocity.gradientZ.clone(), this._angularVelocity.gradientW.clone()) : GradientAngularVelocity.createByGradient(this._angularVelocity.gradient.clone());
                break;

              case 2:
                destAngularVelocity = this._angularVelocity.separateAxes ? GradientAngularVelocity.createByRandomTwoConstantSeparate(this._angularVelocity.constantMinSeparate.clone(), this._angularVelocity.constantMaxSeparate.clone()) : GradientAngularVelocity.createByRandomTwoConstant(this._angularVelocity.constantMin, this._angularVelocity.constantMax);
                break;

              case 3:
                destAngularVelocity = this._angularVelocity.separateAxes ? GradientAngularVelocity.createByRandomTwoGradientSeparate(this._angularVelocity.gradientXMin.clone(), this._angularVelocity.gradientYMin.clone(), this._angularVelocity.gradientZMin.clone(), this._angularVelocity.gradientWMin.clone(), this._angularVelocity.gradientXMax.clone(), this._angularVelocity.gradientYMax.clone(), this._angularVelocity.gradientZMax.clone(), this._angularVelocity.gradientWMax.clone()) : GradientAngularVelocity.createByRandomTwoGradient(this._angularVelocity.gradientMin.clone(), this._angularVelocity.gradientMax.clone());
            }
            var destRotationOverLifetime = new this.constructor(destAngularVelocity);
            return destRotationOverLifetime.enbale = this.enbale, destRotationOverLifetime;
        }, __getset(0, __proto, "angularVelocity", function() {
            return this._angularVelocity;
        });
    }(), function() {
        function BaseShape() {
            this.enable = !1, this.randomDirection = !1;
        }
        __class(BaseShape, "laya.d3.core.particleShuriKen.module.shape.BaseShape");
        var __proto = BaseShape.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto._getShapeBoundBox = function(boundBox) {
            throw new Error("BaseShape: must override it.");
        }, __proto._getSpeedBoundBox = function(boundBox) {
            throw new Error("BaseShape: must override it.");
        }, __proto.generatePositionAndDirection = function(position, direction, rand, randomSeeds) {
            throw new Error("BaseShape: must override it.");
        }, __proto._calculateProceduralBounds = function(boundBox, emitterPosScale, minMaxBounds) {
            this._getShapeBoundBox(boundBox);
            var min = boundBox.min, max = boundBox.max;
            Vector3.multiply(min, emitterPosScale, min), Vector3.multiply(max, emitterPosScale, max);
            var speedBounds = new BoundBox(new Vector3(), new Vector3());
            this.randomDirection ? (speedBounds.min = new Vector3(-1, -1, -1), speedBounds.max = new Vector3(1, 1, 1)) : this._getSpeedBoundBox(speedBounds);
            var maxSpeedBound = new BoundBox(new Vector3(), new Vector3()), maxSpeedMin = maxSpeedBound.min, maxSpeedMax = maxSpeedBound.max;
            Vector3.scale(speedBounds.min, minMaxBounds.y, maxSpeedMin), Vector3.scale(speedBounds.max, minMaxBounds.y, maxSpeedMax), 
            Vector3.add(boundBox.min, maxSpeedMin, maxSpeedMin), Vector3.add(boundBox.max, maxSpeedMax, maxSpeedMax), 
            Vector3.min(boundBox.min, maxSpeedMin, boundBox.min), Vector3.max(boundBox.max, maxSpeedMin, boundBox.max);
            var minSpeedBound = new BoundBox(new Vector3(), new Vector3()), minSpeedMin = minSpeedBound.min, minSpeedMax = minSpeedBound.max;
            Vector3.scale(speedBounds.min, minMaxBounds.x, minSpeedMin), Vector3.scale(speedBounds.max, minMaxBounds.x, minSpeedMax), 
            Vector3.min(minSpeedBound.min, minSpeedMax, maxSpeedMin), Vector3.max(minSpeedBound.min, minSpeedMax, maxSpeedMax), 
            Vector3.min(boundBox.min, maxSpeedMin, boundBox.min), Vector3.max(boundBox.max, maxSpeedMin, boundBox.max);
        }, __proto.cloneTo = function(destObject) {
            destObject.enable = this.enable;
        }, __proto.clone = function() {
            var destShape = new this.constructor();
            return this.cloneTo(destShape), destShape;
        }, BaseShape;
    }()), ShapeUtils = function() {
        function ShapeUtils() {}
        return __class(ShapeUtils, "laya.d3.core.particleShuriKen.module.shape.ShapeUtils"), 
        ShapeUtils._randomPointUnitArcCircle = function(arc, out, rand) {
            var outE = out.elements, angle = NaN;
            angle = rand ? rand.getFloat() * arc : Math.random() * arc, outE[0] = Math.cos(angle), 
            outE[1] = Math.sin(angle);
        }, ShapeUtils._randomPointInsideUnitArcCircle = function(arc, out, rand) {
            var outE = out.elements;
            ShapeUtils._randomPointUnitArcCircle(arc, out, rand);
            var range = NaN;
            range = rand ? Math.pow(rand.getFloat(), .5) : Math.pow(Math.random(), .5), outE[0] = outE[0] * range, 
            outE[1] = outE[1] * range;
        }, ShapeUtils._randomPointUnitCircle = function(out, rand) {
            var outE = out.elements, angle = NaN;
            angle = rand ? rand.getFloat() * Math.PI * 2 : Math.random() * Math.PI * 2, outE[0] = Math.cos(angle), 
            outE[1] = Math.sin(angle);
        }, ShapeUtils._randomPointInsideUnitCircle = function(out, rand) {
            var outE = out.elements;
            ShapeUtils._randomPointUnitCircle(out);
            var range = NaN;
            range = rand ? Math.pow(rand.getFloat(), .5) : Math.pow(Math.random(), .5), outE[0] = outE[0] * range, 
            outE[1] = outE[1] * range;
        }, ShapeUtils._randomPointUnitSphere = function(out, rand) {
            var outE = out.elements, z = NaN, a = NaN;
            a = rand ? (z = outE[2] = 2 * rand.getFloat() - 1, rand.getFloat() * Math.PI * 2) : (z = outE[2] = 2 * Math.random() - 1, 
            Math.random() * Math.PI * 2);
            var r = Math.sqrt(1 - z * z);
            outE[0] = r * Math.cos(a), outE[1] = r * Math.sin(a);
        }, ShapeUtils._randomPointInsideUnitSphere = function(out, rand) {
            var outE = out.elements;
            ShapeUtils._randomPointUnitSphere(out);
            var range = NaN;
            range = rand ? Math.pow(rand.getFloat(), 1 / 3) : Math.pow(Math.random(), 1 / 3), 
            outE[0] = outE[0] * range, outE[1] = outE[1] * range, outE[2] = outE[2] * range;
        }, ShapeUtils._randomPointInsideHalfUnitBox = function(out, rand) {
            var outE = out.elements;
            rand ? (outE[0] = rand.getFloat() - .5, outE[1] = rand.getFloat() - .5, outE[2] = rand.getFloat() - .5) : (outE[0] = Math.random() - .5, 
            outE[1] = Math.random() - .5, outE[2] = Math.random() - .5);
        }, ShapeUtils;
    }(), StartFrame = (function() {
        function SizeOverLifetime(size) {
            this._size = null, this.enbale = !1, this._size = size;
        }
        __class(SizeOverLifetime, "laya.d3.core.particleShuriKen.module.SizeOverLifetime");
        var __proto = SizeOverLifetime.prototype;
        Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.cloneTo = function(destObject) {
            var destSizeOverLifetime = destObject;
            this._size.cloneTo(destSizeOverLifetime._size), destSizeOverLifetime.enbale = this.enbale;
        }, __proto.clone = function() {
            var destSize;
            switch (this._size.type) {
              case 0:
                destSize = this._size.separateAxes ? GradientSize.createByGradientSeparate(this._size.gradientX.clone(), this._size.gradientY.clone(), this._size.gradientZ.clone()) : GradientSize.createByGradient(this._size.gradient.clone());
                break;

              case 1:
                destSize = this._size.separateAxes ? GradientSize.createByRandomTwoConstantSeparate(this._size.constantMinSeparate.clone(), this._size.constantMaxSeparate.clone()) : GradientSize.createByRandomTwoConstant(this._size.constantMin, this._size.constantMax);
                break;

              case 2:
                destSize = this._size.separateAxes ? GradientSize.createByRandomTwoGradientSeparate(this._size.gradientXMin.clone(), this._size.gradientYMin.clone(), this._size.gradientZMin.clone(), this._size.gradientXMax.clone(), this._size.gradientYMax.clone(), this._size.gradientZMax.clone()) : GradientSize.createByRandomTwoGradient(this._size.gradientMin.clone(), this._size.gradientMax.clone());
            }
            var destSizeOverLifetime = new this.constructor(destSize);
            return destSizeOverLifetime.enbale = this.enbale, destSizeOverLifetime;
        }, __getset(0, __proto, "size", function() {
            return this._size;
        });
    }(), function() {
        function StartFrame() {
            this._type = 0, this._constant = NaN, this._constantMin = NaN, this._constantMax = NaN;
        }
        __class(StartFrame, "laya.d3.core.particleShuriKen.module.StartFrame");
        var __proto = StartFrame.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.cloneTo = function(destObject) {
            var destStartFrame = destObject;
            destStartFrame._type = this._type, destStartFrame._constant = this._constant, destStartFrame._constantMin = this._constantMin, 
            destStartFrame._constantMax = this._constantMax;
        }, __proto.clone = function() {
            var destStartFrame = new this.constructor();
            return this.cloneTo(destStartFrame), destStartFrame;
        }, __getset(0, __proto, "constant", function() {
            return this._constant;
        }), __getset(0, __proto, "type", function() {
            return this._type;
        }), __getset(0, __proto, "constantMin", function() {
            return this._constantMin;
        }), __getset(0, __proto, "constantMax", function() {
            return this._constantMax;
        }), StartFrame.createByConstant = function(constant) {
            var rotationOverLifetime = new StartFrame();
            return rotationOverLifetime._type = 0, rotationOverLifetime._constant = constant, 
            rotationOverLifetime;
        }, StartFrame.createByRandomTwoConstant = function(constantMin, constantMax) {
            var rotationOverLifetime = new StartFrame();
            return rotationOverLifetime._type = 1, rotationOverLifetime._constantMin = constantMin, 
            rotationOverLifetime._constantMax = constantMax, rotationOverLifetime;
        }, StartFrame;
    }()), PhasorSpriter3D = (function() {
        function TextureSheetAnimation(frame, startFrame) {
            this._frame = null, this._startFrame = null, this.tiles = null, this.type = 0, this.randomRow = !1, 
            this.rowIndex = 0, this.cycles = 0, this.enableUVChannels = 0, this.enable = !1, 
            this.tiles = new Vector2(1, 1), this.type = 0, this.randomRow = !0, this.rowIndex = 0, 
            this.cycles = 1, this.enableUVChannels = 1, this._frame = frame, this._startFrame = startFrame;
        }
        __class(TextureSheetAnimation, "laya.d3.core.particleShuriKen.module.TextureSheetAnimation");
        var __proto = TextureSheetAnimation.prototype;
        Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.cloneTo = function(destObject) {
            var destTextureSheetAnimation = destObject;
            this.tiles.cloneTo(destTextureSheetAnimation.tiles), destTextureSheetAnimation.type = this.type, 
            destTextureSheetAnimation.randomRow = this.randomRow, this._frame.cloneTo(destTextureSheetAnimation._frame), 
            this._startFrame.cloneTo(destTextureSheetAnimation._startFrame), destTextureSheetAnimation.cycles = this.cycles, 
            destTextureSheetAnimation.enableUVChannels = this.enableUVChannels, destTextureSheetAnimation.enable = this.enable;
        }, __proto.clone = function() {
            var destFrame, destStartFrame;
            switch (this._frame.type) {
              case 0:
                destFrame = FrameOverTime.createByConstant(this._frame.constant);
                break;

              case 1:
                destFrame = FrameOverTime.createByOverTime(this._frame.frameOverTimeData.clone());
                break;

              case 2:
                destFrame = FrameOverTime.createByRandomTwoConstant(this._frame.constantMin, this._frame.constantMax);
                break;

              case 3:
                destFrame = FrameOverTime.createByRandomTwoOverTime(this._frame.frameOverTimeDataMin.clone(), this._frame.frameOverTimeDataMax.clone());
            }
            switch (this._startFrame.type) {
              case 0:
                destStartFrame = StartFrame.createByConstant(this._startFrame.constant);
                break;

              case 1:
                destStartFrame = StartFrame.createByRandomTwoConstant(this._startFrame.constantMin, this._startFrame.constantMax);
            }
            var destTextureSheetAnimation = new this.constructor(destFrame, destStartFrame);
            return this.tiles.cloneTo(destTextureSheetAnimation.tiles), destTextureSheetAnimation.type = this.type, 
            destTextureSheetAnimation.randomRow = this.randomRow, destTextureSheetAnimation.cycles = this.cycles, 
            destTextureSheetAnimation.enableUVChannels = this.enableUVChannels, destTextureSheetAnimation.enable = this.enable, 
            destTextureSheetAnimation;
        }, __getset(0, __proto, "frame", function() {
            return this._frame;
        }), __getset(0, __proto, "startFrame", function() {
            return this._startFrame;
        });
    }(), function() {
        function VelocityOverLifetime(velocity) {
            this._velocity = null, this.enbale = !1, this.space = 0, this._velocity = velocity;
        }
        __class(VelocityOverLifetime, "laya.d3.core.particleShuriKen.module.VelocityOverLifetime");
        var __proto = VelocityOverLifetime.prototype;
        Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.cloneTo = function(destObject) {
            var destVelocityOverLifetime = destObject;
            this._velocity.cloneTo(destVelocityOverLifetime._velocity), destVelocityOverLifetime.enbale = this.enbale, 
            destVelocityOverLifetime.space = this.space;
        }, __proto.clone = function() {
            var destVelocity;
            switch (this._velocity.type) {
              case 0:
                destVelocity = GradientVelocity.createByConstant(this._velocity.constant.clone());
                break;

              case 1:
                destVelocity = GradientVelocity.createByGradient(this._velocity.gradientX.clone(), this._velocity.gradientY.clone(), this._velocity.gradientZ.clone());
                break;

              case 2:
                destVelocity = GradientVelocity.createByRandomTwoConstant(this._velocity.constantMin.clone(), this._velocity.constantMax.clone());
                break;

              case 3:
                destVelocity = GradientVelocity.createByRandomTwoGradient(this._velocity.gradientXMin.clone(), this._velocity.gradientYMin.clone(), this._velocity.gradientZMin.clone(), this._velocity.gradientXMax.clone(), this._velocity.gradientYMax.clone(), this._velocity.gradientZMax.clone());
            }
            var destVelocityOverLifetime = new this.constructor(destVelocity);
            return destVelocityOverLifetime.enbale = this.enbale, destVelocityOverLifetime.space = this.space, 
            destVelocityOverLifetime;
        }, __getset(0, __proto, "velocity", function() {
            return this._velocity;
        });
    }(), function() {
        function PhasorSpriter3D() {
            this._tempInt0 = 0, this._tempInt1 = 0, this._tempUint0 = 0, this._tempUint1 = 0, 
            this._tempUint2 = 0, this._tempUint3 = 0, this._tempUint4 = 0, this._tempUint5 = 0, 
            this._tempUint6 = 0, this._tempUint7 = 0, this._tempNumver0 = NaN, this._tempNumver1 = NaN, 
            this._tempNumver2 = NaN, this._tempNumver3 = NaN, this._floatSizePerVer = 7, this._defaultBufferSize = 600 * this._floatSizePerVer, 
            this._vb = null, this._posInVBData = 0, this._ib = null, this._posInIBData = 0, 
            this._primitiveType = NaN, this._hasBegun = !1, this._numVertsPerPrimitive = 0, 
            this._camera = null, this._sharderNameID = 0, this._shader = null, this._shaderCompile = null, 
            this._vbData = new Float32Array(this._defaultBufferSize), this._ibData = new Uint16Array(this._defaultBufferSize), 
            this._spriteShaderValue = new ValusArray(), this._vb = VertexBuffer3D.create(PhasorSpriter3D._vertexDeclaration, this._defaultBufferSize / this._floatSizePerVer, 35048), 
            this._ib = IndexBuffer3D.create("ushort", this._defaultBufferSize, 35048), this._sharderNameID = Shader3D.nameKey.getID("LINE"), 
            this._shaderCompile = ShaderCompile3D._preCompileShader[this._sharderNameID];
        }
        __class(PhasorSpriter3D, "laya.d3.core.PhasorSpriter3D");
        var __proto = PhasorSpriter3D.prototype;
        return __proto.line = function(startPosition, startColor, endPosition, endColor) {
            return this._hasBegun && 1 === this._primitiveType || this.drawLinesException(), 
            (this._posInVBData + 2 * this._floatSizePerVer > this._vbData.length || this._posInIBData + 2 > this._ibData.length) && this.flush(), 
            this._tempUint0 = this._posInVBData / this._floatSizePerVer, this.addVertex(startPosition.x, startPosition.y, startPosition.z, startColor.x, startColor.y, startColor.z, startColor.w), 
            this.addVertex(endPosition.x, endPosition.y, endPosition.z, endColor.x, endColor.y, endColor.z, endColor.w), 
            this.addIndexes(this._tempUint0, this._tempUint0 + 1), this;
        }, __proto.circle = function(radius, numberOfPoints, r, g, b, a) {
            for (this._hasBegun && 1 === this._primitiveType || this.drawLinesException(), this._tempUint0 = 2 * numberOfPoints, 
            (this._posInVBData + this._tempUint0 * this._floatSizePerVer > this._vbData.length || this._posInIBData + 2 * this._tempUint0 > this._ibData.length) && this.flush(), 
            this._tempUint1 = this._posInVBData / this._floatSizePerVer, this._tempNumver0 = 0, 
            this._tempInt0 = 0; this._tempNumver0 < 6.2832; this._tempNumver0 = this._tempNumver0 + 3.1416 / numberOfPoints, 
            this._tempInt0++) this.addVertex(Math.sin(this._tempNumver0) * radius, Math.cos(this._tempNumver0) * radius, 0, r, g, b, a), 
            0 === this._tempInt0 ? this.addIndexes(this._tempUint1) : this._tempInt0 === this._tempUint0 - 1 ? (this._tempUint2 = this._tempUint1 + this._tempInt0, 
            this.addIndexes(this._tempUint2, this._tempUint2, this._tempUint1)) : (this._tempUint2 = this._tempUint1 + this._tempInt0, 
            this.addIndexes(this._tempUint2, this._tempUint2));
            return this;
        }, __proto.plane = function(positionX, positionY, positionZ, width, height, r, g, b, a) {
            return this._hasBegun && 4 === this._primitiveType || this.drawTrianglesException(), 
            (this._posInVBData + 4 * this._floatSizePerVer > this._vbData.length || this._posInIBData + 6 > this._ibData.length) && this.flush(), 
            this._tempNumver0 = width / 2, this._tempNumver1 = height / 2, this._tempUint0 = this._posInVBData / this._floatSizePerVer, 
            this.addVertex(positionX - this._tempNumver0, positionY + this._tempNumver1, positionZ, r, g, b, a), 
            this.addVertex(positionX + this._tempNumver0, positionY + this._tempNumver1, positionZ, r, g, b, a), 
            this.addVertex(positionX - this._tempNumver0, positionY - this._tempNumver1, positionZ, r, g, b, a), 
            this.addVertex(positionX + this._tempNumver0, positionY - this._tempNumver1, positionZ, r, g, b, a), 
            this._tempUint1 = this._tempUint0 + 1, this._tempUint2 = this._tempUint0 + 2, this.addIndexes(this._tempUint0, this._tempUint1, this._tempUint2, this._tempUint2, this._tempUint1, this._tempUint0 + 3), 
            this;
        }, __proto.box = function(positionX, positionY, positionZ, width, height, depth, r, g, b, a) {
            return this._hasBegun && 4 === this._primitiveType || this.drawTrianglesException(), 
            (this._posInVBData + 8 * this._floatSizePerVer > this._vbData.length || this._posInIBData + 36 > this._ibData.length) && this.flush(), 
            this._tempNumver0 = width / 2, this._tempNumver1 = height / 2, this._tempNumver2 = depth / 2, 
            this._tempUint0 = this._posInVBData / this._floatSizePerVer, this.addVertex(positionX - this._tempNumver0, positionY + this._tempNumver1, positionZ + this._tempNumver2, r, g, b, a), 
            this.addVertex(positionX + this._tempNumver0, positionY + this._tempNumver1, positionZ + this._tempNumver2, r, g, b, a), 
            this.addVertex(positionX - this._tempNumver0, positionY - this._tempNumver1, positionZ + this._tempNumver2, r, g, b, a), 
            this.addVertex(positionX + this._tempNumver0, positionY - this._tempNumver1, positionZ + this._tempNumver2, r, g, b, a), 
            this.addVertex(positionX + this._tempNumver0, positionY + this._tempNumver1, positionZ - this._tempNumver2, r, g, b, a), 
            this.addVertex(positionX - this._tempNumver0, positionY + this._tempNumver1, positionZ - this._tempNumver2, r, g, b, a), 
            this.addVertex(positionX + this._tempNumver0, positionY - this._tempNumver1, positionZ - this._tempNumver2, r, g, b, a), 
            this.addVertex(positionX - this._tempNumver0, positionY - this._tempNumver1, positionZ - this._tempNumver2, r, g, b, a), 
            this._tempUint1 = this._tempUint0 + 1, this._tempUint2 = this._tempUint0 + 2, this._tempUint3 = this._tempUint0 + 3, 
            this._tempUint4 = this._tempUint0 + 4, this._tempUint5 = this._tempUint0 + 5, this._tempUint6 = this._tempUint0 + 6, 
            this._tempUint7 = this._tempUint0 + 7, this.addIndexes(this._tempUint0, this._tempUint1, this._tempUint2, this._tempUint2, this._tempUint1, this._tempUint3, this._tempUint4, this._tempUint5, this._tempUint6, this._tempUint6, this._tempUint5, this._tempUint7, this._tempUint5, this._tempUint0, this._tempUint7, this._tempUint7, this._tempUint0, this._tempUint2, this._tempUint1, this._tempUint4, this._tempUint3, this._tempUint3, this._tempUint4, this._tempUint6, this._tempUint5, this._tempUint4, this._tempUint0, this._tempUint0, this._tempUint4, this._tempUint1, this._tempUint2, this._tempUint3, this._tempUint7, this._tempUint7, this._tempUint3, this._tempUint6), 
            this;
        }, __proto.cone = function(radius, length, Slices, r, g, b, a) {
            for (this._hasBegun && 4 === this._primitiveType || this.drawTrianglesException(), 
            (this._posInVBData + (2 * Slices + 2) * this._floatSizePerVer > this._vbData.length || this._posInIBData + 6 * Slices > this._ibData.length) && this.flush(), 
            this._tempUint0 = this._posInVBData, this._tempUint1 = this._posInVBData / this._floatSizePerVer, 
            this._tempNumver0 = 2 * Math.PI / Slices, this.addVertexIndex(0, length, 0, r, g, b, a, this._tempUint0), 
            this.addVertexIndex(0, 0, 0, r, g, b, a, this._tempUint0 + this._floatSizePerVer), 
            this._tempInt0 = 2, this._tempNumver1 = 0, this._tempInt1 = 0; this._tempInt1 < Slices; this._tempInt1++) this._tempNumver2 = Math.cos(this._tempNumver1), 
            this._tempNumver3 = Math.sin(this._tempNumver1), this.addVertexIndex(radius * this._tempNumver2, 0, radius * this._tempNumver3, r, g, b, a, this._tempUint0 + this._tempInt0 * this._floatSizePerVer), 
            this.addIndexes(this._tempUint1, this._tempUint1 + this._tempInt0), this._tempInt1 == Slices - 1 ? this.addIndexes(this._tempUint1 + 2) : this.addIndexes(this._tempUint1 + this._tempInt0 + 1), 
            this.addVertexIndex(radius * this._tempNumver2, 0, radius * this._tempNumver3, r, g, b, a, this._tempUint0 + (this._tempInt0 + Slices) * this._floatSizePerVer), 
            this.addIndexes(this._tempUint1 + 1), this._tempInt1 == Slices - 1 ? this.addIndexes(this._tempUint1 + Slices + 2) : this.addIndexes(this._tempUint1 + this._tempInt0 + Slices + 1), 
            this.addIndexes(this._tempUint1 + this._tempInt0 + Slices), this._tempInt0++, this._tempNumver1 += this._tempNumver0;
            return this;
        }, __proto.boundingBoxLine = function(minX, minY, minZ, maxX, maxY, maxZ, r, g, b, a) {
            return this._hasBegun && 1 === this._primitiveType || this.drawLinesException(), 
            (this._posInVBData + 8 * this._floatSizePerVer > this._vbData.length || this._posInIBData + 48 > this._ibData.length) && this.flush(), 
            this._tempUint0 = this._posInVBData / this._floatSizePerVer, this.addVertex(minX, maxY, maxZ, r, g, b, a), 
            this.addVertex(maxX, maxY, maxZ, r, g, b, a), this.addVertex(minX, minY, maxZ, r, g, b, a), 
            this.addVertex(maxX, minY, maxZ, r, g, b, a), this.addVertex(maxX, maxY, minZ, r, g, b, a), 
            this.addVertex(minX, maxY, minZ, r, g, b, a), this.addVertex(maxX, minY, minZ, r, g, b, a), 
            this.addVertex(minX, minY, minZ, r, g, b, a), this._tempUint1 = this._tempUint0 + 1, 
            this._tempUint2 = this._tempUint0 + 2, this._tempUint3 = this._tempUint0 + 3, this._tempUint4 = this._tempUint0 + 4, 
            this._tempUint5 = this._tempUint0 + 5, this._tempUint6 = this._tempUint0 + 6, this._tempUint7 = this._tempUint0 + 7, 
            this.addIndexes(this._tempUint0, this._tempUint1, this._tempUint1, this._tempUint3, this._tempUint3, this._tempUint2, this._tempUint2, this._tempUint0, this._tempUint4, this._tempUint5, this._tempUint5, this._tempUint7, this._tempUint7, this._tempUint6, this._tempUint6, this._tempUint4, this._tempUint5, this._tempUint0, this._tempUint0, this._tempUint2, this._tempUint2, this._tempUint7, this._tempUint7, this._tempUint5, this._tempUint1, this._tempUint4, this._tempUint4, this._tempUint6, this._tempUint6, this._tempUint3, this._tempUint3, this._tempUint1, this._tempUint5, this._tempUint4, this._tempUint4, this._tempUint1, this._tempUint1, this._tempUint0, this._tempUint0, this._tempUint5, this._tempUint2, this._tempUint3, this._tempUint3, this._tempUint6, this._tempUint6, this._tempUint7, this._tempUint7, this._tempUint2), 
            this;
        }, __proto.addVertex = function(x, y, z, r, g, b, a) {
            return this._hasBegun || this.addVertexIndexException(), this._vbData[this._posInVBData] = x, 
            this._vbData[this._posInVBData + 1] = y, this._vbData[this._posInVBData + 2] = z, 
            this._vbData[this._posInVBData + 3] = r, this._vbData[this._posInVBData + 4] = g, 
            this._vbData[this._posInVBData + 5] = b, this._vbData[this._posInVBData + 6] = a, 
            this._posInVBData += this._floatSizePerVer, this;
        }, __proto.addVertexIndex = function(x, y, z, r, g, b, a, index) {
            return this._hasBegun || this.addVertexIndexException(), this._vbData[index] = x, 
            this._vbData[index + 1] = y, this._vbData[index + 2] = z, this._vbData[index + 3] = r, 
            this._vbData[index + 4] = g, this._vbData[index + 5] = b, this._vbData[index + 6] = a, 
            (index += this._floatSizePerVer) > this._posInVBData && (this._posInVBData = index), 
            this;
        }, __proto.addIndexes = function(__indexes) {
            var indexes = arguments;
            this._hasBegun || this.addVertexIndexException();
            for (var i = 0; i < indexes.length; i++) this._ibData[this._posInIBData] = indexes[i], 
            this._posInIBData++;
            return this;
        }, __proto.begin = function(primitive, camera) {
            return this._hasBegun && this.beginException0(), 1 !== primitive && 4 !== primitive && this.beginException1(), 
            this._primitiveType = primitive, this._camera = camera, this._hasBegun = !0, this;
        }, __proto.end = function() {
            return this._hasBegun || this.endException(), this.flush(), this._hasBegun = !1, 
            this;
        }, __proto.flush = function() {
            0 !== this._posInVBData && (this._ib.setData(this._ibData), this._vb.setData(this._vbData), 
            this._vb._bind(), this._ib._bind(), this._shader = this._shaderCompile.withCompile(0, 0, 0), 
            this._shader.bind(), this._shader.uploadAttributes(PhasorSpriter3D._vertexDeclaration.shaderValues.data, null), 
            this._spriteShaderValue.setValue(1, this._camera.projectionViewMatrix.elements), 
            this._shader.uploadSpriteUniforms(this._spriteShaderValue.data), Stat.drawCall++, 
            WebGL.mainContext.drawElements(this._primitiveType, this._posInIBData, 5123, 0), 
            this._posInIBData = 0, this._posInVBData = 0);
        }, __proto.addVertexIndexException = function() {
            throw new Error("请先调用begin()函数");
        }, __proto.beginException0 = function() {
            throw new Error("调用begin()前请确保已成功调用end()！");
        }, __proto.beginException1 = function() {
            throw new Error("只支持“LINES”和“TRIANGLES”两种基元！");
        }, __proto.endException = function() {
            throw new Error("调用end()前请确保已成功调用begin()！");
        }, __proto.drawLinesException = function() {
            throw new Error("您必须确保在此之前已调用begin()且使用“LINES”基元！");
        }, __proto.drawTrianglesException = function() {
            throw new Error("您必须确保在此之前已调用begin()且使用“TRIANGLES”基元！");
        }, __static(PhasorSpriter3D, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(28, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector4", 1) ]);
        } ]), PhasorSpriter3D;
    }()), RenderElement = function() {
        function RenderElement() {
            this._id = 0, this._type = 0, this._mainSortID = 0, this._render = null, this._sprite3D = null, 
            this._material = null, this._renderObj = null, this._staticBatch = null, this._tempBatchIndexStart = 0, 
            this._tempBatchIndexEnd = 0, this._canDynamicBatch = !1, this._shaderValue = null, 
            this._onPreRenderFunction = null, this._id = ++RenderElement._uniqueIDCounter, this._canDynamicBatch = !0, 
            this._shaderValue = new ValusArray();
        }
        __class(RenderElement, "laya.d3.core.render.RenderElement");
        var __proto = RenderElement.prototype;
        return __proto.getDynamicBatchBakedVertexs = function(index) {
            for (var vb = this._renderObj._getVertexBuffer(index), bakedVertexes = vb.getData().slice(), vertexDeclaration = vb.vertexDeclaration, positionOffset = vertexDeclaration.getVertexElementByUsage(0).offset / 4, normalOffset = vertexDeclaration.getVertexElementByUsage(3).offset / 4, transform = this._sprite3D.transform, worldMatrix = transform.worldMatrix, rotation = transform.rotation, vertexFloatCount = vertexDeclaration.vertexStride / 4, i = 0, n = bakedVertexes.length; i < n; i += vertexFloatCount) {
                var posOffset = i + positionOffset, norOffset = i + normalOffset;
                Utils3D.transformVector3ArrayToVector3ArrayCoordinate(bakedVertexes, posOffset, worldMatrix, bakedVertexes, posOffset), 
                Utils3D.transformVector3ArrayByQuat(bakedVertexes, norOffset, rotation, bakedVertexes, norOffset);
            }
            return bakedVertexes;
        }, __proto.getBakedIndices = function() {
            return this._renderObj._getIndexBuffer().getData();
        }, __proto._destroy = function() {
            this._staticBatch && this._staticBatch._manager._garbageCollection(this);
        }, __getset(0, __proto, "id", function() {
            return this._id;
        }), __getset(0, __proto, "renderObj", function() {
            return this._renderObj;
        }, function(value) {
            this._renderObj !== value && (this._renderObj = value);
        }), RenderElement._uniqueIDCounter = 0, RenderElement;
    }(), RenderQueue = function() {
        function RenderQueue(scene) {
            this._id = 0, this._needSort = !1, this._renderElements = null, this._renderableRenderObjects = null, 
            this._dynamicBatchCombineRenderElements = null, this._finalElements = null, this._scene = null, 
            this._id = ++RenderQueue._uniqueIDCounter, this._needSort = !1, this._scene = scene, 
            this._renderElements = [], this._renderableRenderObjects = [], this._dynamicBatchCombineRenderElements = [];
        }
        __class(RenderQueue, "laya.d3.core.render.RenderQueue");
        var __proto = RenderQueue.prototype;
        return __proto._sortOpaqueFunc = function(a, b) {
            if (a._render && b._render) {
                var renderQueue = a._material.renderQueue - b._material.renderQueue;
                return 0 == renderQueue ? a._render._distanceForSort - b._render._distanceForSort : renderQueue;
            }
            return 0;
        }, __proto._sortAlphaFunc = function(a, b) {
            if (a._render && b._render) {
                var renderQueue = a._material.renderQueue - b._material.renderQueue;
                return 0 == renderQueue ? b._render._distanceForSort - a._render._distanceForSort : renderQueue;
            }
            return 0;
        }, __proto._begainRenderElement = function(state, renderObj, material) {
            return !!renderObj._beforeRender(state);
        }, __proto._sortAlpha = function(cameraPos) {
            RenderQueue._cameraPosition = cameraPos, this._finalElements.sort(this._sortAlphaFunc);
        }, __proto._sortOpaque = function(cameraPos) {
            RenderQueue._cameraPosition = cameraPos, this._finalElements.sort(this._sortOpaqueFunc);
        }, __proto._preRender = function(state) {
            this._finalElements = this._renderElements.concat(this._dynamicBatchCombineRenderElements);
        }, __proto._render = function(state, isTarget) {
            for (var vbs, vertexBuffer, vertexDeclaration, shader, lastStateMaterial, lastStateOwner, loopCount = Stat.loopCount, scene = this._scene, camera = state.camera, forceUploadParams = (camera.id, 
            !1), i = 0, n = this._finalElements.length; i < n; i++) {
                var renderObj, material, owner, renderElement = this._finalElements[i];
                if (null != renderElement._onPreRenderFunction && renderElement._onPreRenderFunction.call(renderElement._sprite3D, state), 
                0 === renderElement._type) {
                    if (state.owner = owner = renderElement._sprite3D, state.renderElement = renderElement, 
                    owner._preRenderUpdateComponents(state), renderObj = renderElement.renderObj, material = renderElement._material, 
                    this._begainRenderElement(state, renderObj, material)) {
                        if (vbs = renderObj._getVertexBuffers(), vertexDeclaration = (vertexBuffer = renderObj._getVertexBuffer(0)).vertexDeclaration, 
                        forceUploadParams = (shader = state._shader = material._getShader(scene._shaderDefineValue, vertexDeclaration.shaderDefineValue, owner._shaderDefineValue)).bind() || loopCount !== shader._uploadLoopCount, 
                        vbs) {
                            if (shader._uploadVertexBuffer !== vbs || forceUploadParams) {
                                for (var j = 0; j < vbs.length; j++) {
                                    var vb = vbs[j];
                                    shader.uploadAttributesX(vb.vertexDeclaration.shaderValues.data, vb);
                                }
                                shader._uploadVertexBuffer = vbs;
                            }
                        } else (shader._uploadVertexBuffer !== vertexBuffer || forceUploadParams) && (shader.uploadAttributes(vertexDeclaration.shaderValues.data, null), 
                        shader._uploadVertexBuffer = vertexBuffer);
                        (shader._uploadScene !== scene || forceUploadParams) && (shader.uploadSceneUniforms(scene._shaderValues.data), 
                        shader._uploadScene = scene), (camera !== shader._uploadCamera || shader._uploadSprite3D !== owner || forceUploadParams) && (shader.uploadSpriteUniforms(owner._shaderValues.data), 
                        shader._uploadSprite3D = owner), (camera !== shader._uploadCamera || forceUploadParams) && (shader.uploadCameraUniforms(camera._shaderValues.data), 
                        shader._uploadCamera = camera), (shader._uploadMaterial !== material || forceUploadParams) && (material._upload(), 
                        shader._uploadMaterial = material), lastStateMaterial !== material ? (material._setRenderStateBlendDepth(), 
                        material._setRenderStateFrontFace(isTarget, owner.transform), lastStateMaterial = material, 
                        lastStateOwner = owner) : lastStateOwner !== owner && (material._setRenderStateFrontFace(isTarget, owner.transform), 
                        lastStateOwner = owner), renderObj._render(state), shader._uploadLoopCount = loopCount;
                    }
                    owner._postRenderUpdateComponents(state);
                } else if (2 === renderElement._type) {
                    renderElement.renderObj;
                    state.owner = owner = renderElement._sprite3D, state.renderElement = renderElement, 
                    state._batchIndexStart = renderElement._tempBatchIndexStart, state._batchIndexEnd = renderElement._tempBatchIndexEnd, 
                    renderObj = renderElement.renderObj, material = renderElement._material, this._begainRenderElement(state, renderObj, material) && (vertexDeclaration = (vertexBuffer = renderObj._getVertexBuffer(0)).vertexDeclaration, 
                    forceUploadParams = (shader = state._shader = material._getShader(scene._shaderDefineValue, vertexDeclaration.shaderDefineValue, owner._shaderDefineValue)).bind() || loopCount !== shader._uploadLoopCount, 
                    (shader._uploadVertexBuffer !== vertexBuffer || forceUploadParams) && (shader.uploadAttributes(vertexDeclaration.shaderValues.data, null), 
                    shader._uploadVertexBuffer = vertexBuffer), (shader._uploadScene !== scene || forceUploadParams) && (shader.uploadSceneUniforms(scene._shaderValues.data), 
                    shader._uploadScene = scene), (camera !== shader._uploadCamera || shader._uploadSprite3D !== owner || forceUploadParams) && (shader.uploadSpriteUniforms(owner._shaderValues.data), 
                    shader._uploadSprite3D = owner), (camera !== shader._uploadCamera || forceUploadParams) && (shader.uploadCameraUniforms(camera._shaderValues.data), 
                    shader._uploadCamera = camera), (shader._uploadMaterial !== material || forceUploadParams) && (material._upload(), 
                    shader._uploadMaterial = material), lastStateMaterial !== material ? (material._setRenderStateBlendDepth(), 
                    material._setRenderStateFrontFace(isTarget, owner.transform), lastStateMaterial = material, 
                    lastStateOwner = owner) : lastStateOwner !== owner && (material._setRenderStateFrontFace(isTarget, owner.transform), 
                    lastStateOwner = owner), renderObj._render(state), shader._uploadLoopCount = loopCount);
                }
            }
        }, __proto._renderShadow = function(state, isOnePSSM) {
            for (var vertexBuffer, vertexDeclaration, shader, lastStateMaterial, lastStateOwner, loopCount = Stat.loopCount, scene = this._scene, camera = state.camera, forceUploadParams = !1, i = 0, n = this._finalElements.length; i < n; i++) {
                var renderObj, material, owner, renderElement = this._finalElements[i];
                0 === renderElement._type && (state.owner = owner = renderElement._sprite3D, isOnePSSM || owner._projectionViewWorldUpdateCamera === camera && owner._projectionViewWorldUpdateLoopCount === Stat.loopCount || (owner._render._renderUpdate(state._projectionViewMatrix), 
                owner._projectionViewWorldUpdateLoopCount = Stat.loopCount, owner._projectionViewWorldUpdateCamera = camera), 
                state.renderElement = renderElement, owner._preRenderUpdateComponents(state), renderObj = renderElement.renderObj, 
                material = renderElement._material, this._begainRenderElement(state, renderObj, null) && (vertexDeclaration = (vertexBuffer = renderObj._getVertexBuffer(0)).vertexDeclaration, 
                forceUploadParams = (shader = state._shader = material._getShader(scene._shaderDefineValue, vertexDeclaration.shaderDefineValue, owner._shaderDefineValue)).bind() || loopCount !== shader._uploadLoopCount, 
                (shader._uploadVertexBuffer !== vertexBuffer || forceUploadParams) && (shader.uploadAttributes(vertexDeclaration.shaderValues.data, null), 
                shader._uploadVertexBuffer = vertexBuffer), (camera !== shader._uploadCamera || shader._uploadSprite3D !== owner || forceUploadParams) && (shader.uploadSpriteUniforms(owner._shaderValues.data), 
                shader._uploadSprite3D = owner), (camera !== shader._uploadCamera || forceUploadParams) && (shader.uploadCameraUniforms(camera._shaderValues.data), 
                shader._uploadCamera = camera), (shader._uploadMaterial !== material || forceUploadParams) && (material._upload(), 
                shader._uploadMaterial = material), shader._uploadRenderElement, lastStateMaterial !== material ? (material._setRenderStateFrontFace(!1, owner.transform), 
                lastStateMaterial = material, lastStateOwner = owner) : lastStateOwner !== owner && (material._setRenderStateFrontFace(!1, owner.transform), 
                lastStateOwner = owner), renderObj._render(state), shader._uploadLoopCount = loopCount), 
                owner._postRenderUpdateComponents(state));
            }
        }, __proto._clearRenderElements = function() {
            this._dynamicBatchCombineRenderElements.length = 0, this._renderElements.length = 0, 
            this._needSort = !0;
        }, __proto._addRenderElement = function(renderElement) {
            this._renderElements.push(renderElement), this._needSort = !0;
        }, __proto._addDynamicBatchElement = function(dynamicBatchElement) {
            this._dynamicBatchCombineRenderElements.push(dynamicBatchElement);
        }, __getset(0, __proto, "id", function() {
            return this._id;
        }), RenderQueue._uniqueIDCounter = 0, RenderQueue._cameraPosition = null, RenderQueue;
    }(), RenderState = function() {
        function RenderState() {
            this._staticBatch = null, this._batchIndexStart = 0, this._batchIndexEnd = 0, this._viewMatrix = null, 
            this._projectionMatrix = null, this._projectionViewMatrix = null, this._viewport = null, 
            this._shader = null, this.elapsedTime = NaN, this.scene = null, this.owner = null, 
            this.renderElement = null, this.camera = null;
        }
        return __class(RenderState, "laya.d3.core.render.RenderState"), RenderState.clientWidth = 0, 
        RenderState.clientHeight = 0, RenderState;
    }(), OctreeNode = function() {
        function OctreeNode(scene, currentDepth) {
            this._exactBox = null, this._relaxBox = null, this._scene = null, this._parent = null, 
            this._currentDepth = 0, this._boundingSphere = new BoundSphere(new Vector3(), 0), 
            this._corners = [ new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3() ], 
            this._boundingBoxCenter = new Vector3(), this._children = __newvec(8), this._objects = [], 
            this._tempBoundBoxCorners = [ new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3() ], 
            this._scene = scene, this._currentDepth = currentDepth;
        }
        __class(OctreeNode, "laya.d3.core.scene.OctreeNode");
        var __proto = OctreeNode.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.scene.ITreeNode": !0
        }), __proto.init = function(center, treeSize) {
            var min = new Vector3(), max = new Vector3();
            Vector3.scale(treeSize, -.5, min), Vector3.scale(treeSize, .5, max), Vector3.add(min, center, min), 
            Vector3.add(max, center, max), this.exactBox = new BoundBox(min, max), this.relaxBox = new BoundBox(min, max);
        }, __proto.addTreeNode = function(render) {
            1 === Collision.boxContainsBox(this._relaxBox, render.boundingBox) ? this.addNodeDown(render, 0) : this.addObject(render);
        }, __proto.addChild = function(index) {
            var child = this._children[index];
            if (null == child) {
                child = new OctreeNode(this._scene, this._currentDepth + 1), (this._children[index] = child)._parent = this, 
                Vector3.subtract(this._exactBox.max, this._exactBox.min, OctreeNode.tempSize), Vector3.multiply(OctreeNode.tempSize, OctreeNode._octreeSplit[index], OctreeNode.tempCenter), 
                Vector3.add(this._exactBox.min, OctreeNode.tempCenter, OctreeNode.tempCenter), Vector3.scale(OctreeNode.tempSize, .25, OctreeNode.tempSize);
                var min = new Vector3(), max = new Vector3();
                Vector3.subtract(OctreeNode.tempCenter, OctreeNode.tempSize, min), Vector3.add(OctreeNode.tempCenter, OctreeNode.tempSize, max), 
                child.exactBox = new BoundBox(min, max), Vector3.scale(OctreeNode.tempSize, OctreeNode.relax, OctreeNode.tempSize);
                var relaxMin = new Vector3(), relaxMax = new Vector3();
                Vector3.subtract(OctreeNode.tempCenter, OctreeNode.tempSize, relaxMin), Vector3.add(OctreeNode.tempCenter, OctreeNode.tempSize, relaxMax), 
                child.relaxBox = new BoundBox(relaxMin, relaxMax);
            }
            return child;
        }, __proto.addObject = function(object) {
            (object._treeNode = this)._objects.push(object);
        }, __proto.removeObject = function(object) {
            if (object._treeNode != this) return console.log("OctreeNode::removeObject error"), 
            !1;
            var index = this._objects.indexOf(object);
            return -1 !== index && (this._objects.splice(index, 1), !0);
        }, __proto.clearObject = function() {
            this._objects.length = 0;
        }, __proto.addNodeUp = function(render, depth) {
            this._parent && 1 !== Collision.boxContainsBox(this._exactBox, render.boundingBox) ? this._parent.addNodeUp(render, depth - 1) : this.addNodeDown(render, depth);
        }, __proto.addNodeDown = function(render, depth) {
            if (depth < this._scene.treeLevel) {
                var childIndex = this.inChildIndex(render.boundingBoxCenter), child = this.addChild(childIndex);
                1 === Collision.boxContainsBox(child._relaxBox, render.boundingBox) ? child.addNodeDown(render, ++depth) : this.addObject(render);
            } else this.addObject(render);
        }, __proto.inChildIndex = function(objectCenter) {
            return 4 * (objectCenter.z < this._boundingBoxCenter.z ? 0 : 1) + 2 * (objectCenter.y < this._boundingBoxCenter.y ? 0 : 1) + (objectCenter.x < this._boundingBoxCenter.x ? 0 : 1);
        }, __proto.updateObject = function(render) {
            1 === Collision.boxContainsBox(this._relaxBox, render.boundingBox) ? (this.removeObject(render), 
            render._treeNode = null, this.addNodeDown(render, this._currentDepth)) : this._parent && (this.removeObject(render), 
            render._treeNode = null, this._parent.addNodeUp(render, this._currentDepth - 1));
        }, __proto.cullingObjects = function(boundFrustum, testVisible, flags, cameraPosition, projectionView) {
            var n, i = 0, j = 0, m = 0, dynamicBatchManager = this._scene._dynamicBatchManager;
            for (i = 0, n = this._objects.length; i < n; i++) {
                var render = this._objects[i];
                if (Layer.isVisible(render._owner.layer.mask) && render.enable) {
                    if (testVisible && (Stat.treeSpriteCollision += 1, 0 === boundFrustum.containsBoundSphere(render.boundingSphere))) continue;
                    render._renderUpdate(projectionView), render._distanceForSort = Vector3.distance(render.boundingSphere.center, cameraPosition) + render.sortingFudge;
                    var renderElements = render._renderElements;
                    for (j = 0, m = renderElements.length; j < m; j++) {
                        var renderElement = renderElements[j], staticBatch = renderElement._staticBatch;
                        if (staticBatch && staticBatch._material === renderElement._material) staticBatch._addBatchRenderElement(renderElement); else {
                            var renderObj = renderElement.renderObj;
                            renderObj.triangleCount < 10 && 1 === renderObj._vertexBufferCount && renderObj._getIndexBuffer() && renderElement._material.renderQueue < 2 && renderElement._canDynamicBatch && !render._owner.isStatic ? dynamicBatchManager._addPrepareRenderElement(renderElement) : this._scene.getRenderQueue(renderElement._material.renderQueue)._addRenderElement(renderElement);
                        }
                    }
                }
            }
            for (i = 0; i < 8; i++) {
                var child = this._children[i];
                if (null != child) {
                    var testVisibleChild = testVisible;
                    if (testVisible) {
                        var type = boundFrustum.containsBoundBox(child._relaxBox);
                        if (Stat.treeNodeCollision += 1, 0 === type) continue;
                        testVisibleChild = 2 === type;
                    }
                    child.cullingObjects(boundFrustum, testVisibleChild, flags, cameraPosition, projectionView);
                }
            }
        }, __proto.cullingShadowObjects = function(lightBoundFrustum, splitShadowQueues, testVisible, flags, scene) {
            var n, i = 0, j = 0, m = 0;
            this._scene._dynamicBatchManager;
            for (i = 0, n = this._objects.length; i < n; i++) {
                var baseRender = this._objects[i];
                if (baseRender.castShadow && Layer.isVisible(baseRender._owner.layer.mask) && baseRender.enable) {
                    if (testVisible && 0 === lightBoundFrustum[0].containsBoundSphere(baseRender.boundingSphere)) continue;
                    for (var k = 1, kNum = lightBoundFrustum.length; k < kNum; k++) {
                        var shadowQueue = splitShadowQueues[k - 1];
                        if (0 !== lightBoundFrustum[k].containsBoundSphere(baseRender.boundingSphere)) {
                            var renderElements = baseRender._renderElements;
                            for (j = 0, m = renderElements.length; j < m; j++) shadowQueue._addRenderElement(renderElements[j]);
                        }
                    }
                }
            }
            for (i = 0; i < 8; i++) {
                var child = this._children[i];
                if (null != child) {
                    var testVisibleChild = testVisible;
                    if (testVisible) {
                        var type = lightBoundFrustum[0].containsBoundBox(child._relaxBox);
                        if (0 === type) continue;
                        testVisibleChild = 2 === type;
                    }
                    child.cullingShadowObjects(lightBoundFrustum, splitShadowQueues, testVisibleChild, flags, scene);
                }
            }
        }, __proto.cullingShadowObjectsOnePSSM = function(lightBoundFrustum, splitShadowQueues, lightViewProjectMatrix, testVisible, flags, scene) {
            var n, shadowQueue = splitShadowQueues[0], i = 0, j = 0, m = 0;
            for (i = 0, n = this._objects.length; i < n; i++) {
                var baseRender = this._objects[i];
                if (baseRender.castShadow && Layer.isVisible(baseRender._owner.layer.mask) && baseRender.enable) {
                    if (testVisible && 0 === lightBoundFrustum.containsBoundSphere(baseRender.boundingSphere)) continue;
                    baseRender._renderUpdate(lightViewProjectMatrix);
                    var renderElements = baseRender._renderElements;
                    for (j = 0, m = renderElements.length; j < m; j++) shadowQueue._addRenderElement(renderElements[j]);
                }
            }
            for (i = 0; i < 8; i++) {
                var child = this._children[i];
                if (null != child) {
                    var testVisibleChild = testVisible;
                    if (testVisible) {
                        var type = lightBoundFrustum.containsBoundBox(child._relaxBox);
                        if (0 === type) continue;
                        testVisibleChild = 2 === type;
                    }
                    child.cullingShadowObjectsOnePSSM(lightBoundFrustum, splitShadowQueues, lightViewProjectMatrix, testVisibleChild, flags, scene);
                }
            }
        }, __proto.renderBoudingBox = function(linePhasor) {
            this._renderBoudingBox(linePhasor);
            for (var i = 0; i < 8; ++i) {
                var pChild = this._children[i];
                pChild && pChild.renderBoudingBox(linePhasor);
            }
        }, __proto.buildAllChild = function(depth) {
            if (depth < this._scene.treeLevel) for (var i = 0; i < 8; i++) {
                this.addChild(i).buildAllChild(depth + 1);
            }
        }, __proto._renderBoudingBox = function(linePhasor) {}, __getset(0, __proto, "exactBox", function() {
            return this._exactBox;
        }, function(value) {
            this._exactBox = value, Vector3.add(value.min, value.max, this._boundingBoxCenter), 
            Vector3.scale(this._boundingBoxCenter, .5, this._boundingBoxCenter);
        }), __getset(0, __proto, "relaxBox", function() {
            return this._relaxBox;
        }, function(value) {
            (this._relaxBox = value).getCorners(this._corners), BoundSphere.createfromPoints(this._corners, this._boundingSphere);
        }), OctreeNode.debugMode = !1, OctreeNode.relax = 1.15, OctreeNode.CHILDNUM = 8, 
        __static(OctreeNode, [ "tempVector0", function() {
            return this.tempVector0 = new Vector3();
        }, "tempSize", function() {
            return this.tempSize = new Vector3();
        }, "tempCenter", function() {
            return this.tempCenter = new Vector3();
        }, "_octreeSplit", function() {
            return this._octreeSplit = [ new Vector3(.25, .25, .25), new Vector3(.75, .25, .25), new Vector3(.25, .75, .25), new Vector3(.75, .75, .25), new Vector3(.25, .25, .75), new Vector3(.75, .25, .75), new Vector3(.25, .75, .75), new Vector3(.75, .75, .75) ];
        } ]), OctreeNode;
    }(), Color$1 = (function() {
        function SceneManager() {}
        __class(SceneManager, "laya.d3.core.scene.SceneManager");
    }(), function() {
        function Color(r, g, b, a) {
            this._r = NaN, this._g = NaN, this._b = NaN, this._a = NaN, void 0 === r && (r = 1), 
            void 0 === g && (g = 1), void 0 === b && (b = 1), void 0 === a && (a = 1), this._r = r, 
            this._g = g, this._b = b, this._a = a;
        }
        return __class(Color, "laya.d3.core.trail.module.Color", null, "Color$1"), Color.prototype.cloneTo = function(destObject) {
            destObject._r = this._r, destObject._g = this._g, destObject._b = this._b, destObject._a = this._a;
        }, __static(Color, [ "RED", function() {
            return this.RED = new Color(1, 0, 0, 1);
        }, "GREEN", function() {
            return this.GREEN = new Color(0, 1, 0, 1);
        }, "BLUE", function() {
            return this.BLUE = new Color(0, 0, 1, 1);
        }, "CYAN", function() {
            return this.CYAN = new Color(0, 1, 1, 1);
        }, "YELLOW", function() {
            return this.YELLOW = new Color(1, .92, .016, 1);
        }, "MAGENTA", function() {
            return this.MAGENTA = new Color(1, 0, 1, 1);
        }, "GRAY", function() {
            return this.GRAY = new Color(.5, .5, .5, 1);
        }, "WHITE", function() {
            return this.WHITE = new Color(1, 1, 1, 1);
        }, "BLACK", function() {
            return this.BLACK = new Color(0, 0, 0, 1);
        } ]), Color;
    }()), GradientAlphaKey = (function() {
        function Gradient() {
            this._mode = 0, this._colorKeys = null, this._alphaKeys = null, this.index = 0, 
            this._colorKeyData = new Float32Array(40), this._alphaKeyData = new Float32Array(20), 
            this._colorKeys = [], this._alphaKeys = [];
        }
        __class(Gradient, "laya.d3.core.trail.module.Gradient");
        var __proto = Gradient.prototype;
        __proto.setKeys = function(colorKeys, alphaKeys) {
            var gradientColorKey, gradientAlphaKey;
            this._colorKeys = colorKeys;
            for (var i = this.index = 0; i < colorKeys.length; i++) {
                var color = (gradientColorKey = colorKeys[i]).color;
                this._colorKeyData[this.index++] = color._r, this._colorKeyData[this.index++] = color._g, 
                this._colorKeyData[this.index++] = color._b, this._colorKeyData[this.index++] = gradientColorKey.time;
            }
            this._alphaKeys = alphaKeys;
            for (var j = this.index = 0; j < alphaKeys.length; j++) gradientAlphaKey = alphaKeys[j], 
            this._alphaKeyData[this.index++] = gradientAlphaKey.alpha, this._alphaKeyData[this.index++] = gradientAlphaKey.time;
        }, __proto.cloneTo = function(destObject) {
            var i = 0, j = 0, cks = this.colorKeys, _cks = [];
            for (i = 0, j = cks.length; i < j; i++) {
                var _ck = new GradientColorKey();
                cks[i].cloneTo(_ck), _cks.push(_ck);
            }
            var aks = this.alphaKeys, _aks = [];
            for (i = 0, j = aks.length; i < j; i++) {
                var _ak = new GradientAlphaKey();
                aks[i].cloneTo(_ak), _aks.push(_ak);
            }
            destObject.setKeys(_cks, _aks);
        }, __getset(0, __proto, "mode", function() {
            return this._mode;
        }, function(value) {
            this._mode = value;
        }), __getset(0, __proto, "colorKeys", function() {
            return this._colorKeys;
        }, function(values) {
            this._colorKeys = values;
            for (var i = this.index = 0; i < values.length; i++) {
                var value = values[i], color = value.color;
                this._colorKeyData[this.index++] = color._r, this._colorKeyData[this.index++] = color._g, 
                this._colorKeyData[this.index++] = color._b, this._colorKeyData[this.index++] = value.time;
            }
        }), __getset(0, __proto, "alphaKeys", function() {
            return this._alphaKeys;
        }, function(values) {
            this._alphaKeys = values;
            for (var i = this.index = 0; i < values.length; i++) {
                var value = values[i];
                this._alphaKeyData[this.index++] = value.alpha, this._alphaKeyData[this.index++] = value.time;
            }
        });
    }(), function() {
        function GradientAlphaKey(alpha, time) {
            this._alpha = NaN, this._time = NaN, void 0 === alpha && (alpha = 0), void 0 === time && (time = 0), 
            this._alpha = alpha, this._time = time;
        }
        __class(GradientAlphaKey, "laya.d3.core.trail.module.GradientAlphaKey");
        var __proto = GradientAlphaKey.prototype;
        return __proto.cloneTo = function(destObject) {
            destObject.alpha = this.alpha, destObject.time = this.time;
        }, __getset(0, __proto, "alpha", function() {
            return this._alpha;
        }, function(value) {
            this._alpha = value;
        }), __getset(0, __proto, "time", function() {
            return this._time;
        }, function(value) {
            this._time = value;
        }), GradientAlphaKey;
    }()), GradientColorKey = function() {
        function GradientColorKey(color, time) {
            this._color = null, this._time = NaN, void 0 === time && (time = 0), this._color = color || new Color$1(), 
            this._time = time;
        }
        __class(GradientColorKey, "laya.d3.core.trail.module.GradientColorKey");
        var __proto = GradientColorKey.prototype;
        return __proto.cloneTo = function(destObject) {
            this.color.cloneTo(destObject.color), destObject.time = this.time;
        }, __getset(0, __proto, "color", function() {
            return this._color;
        }, function(value) {
            this._color = value;
        }), __getset(0, __proto, "time", function() {
            return this._time;
        }, function(value) {
            this._time = value;
        }), GradientColorKey;
    }(), VertexTrail = (function() {
        function GradientMode() {}
        __class(GradientMode, "laya.d3.core.trail.module.GradientMode"), GradientMode.Blend = 0, 
        GradientMode.Fixed = 1;
    }(), function() {
        function TextureMode() {}
        __class(TextureMode, "laya.d3.core.trail.module.TextureMode"), TextureMode.Stretch = 0, 
        TextureMode.Tile = 1;
    }(), function() {
        function TrailKeyFrame() {
            this.time = NaN, this.inTangent = NaN, this.outTangent = NaN, this.value = NaN;
        }
        __class(TrailKeyFrame, "laya.d3.core.trail.module.TrailKeyFrame"), TrailKeyFrame.prototype.cloneTo = function(destObject) {
            destObject.time = this.time, destObject.inTangent = this.inTangent, destObject.outTangent = this.outTangent, 
            destObject.value = this.value;
        };
    }(), function() {
        function TrailRenderElement(owner) {
            this._id = 0, this._owner = null, this._camera = null, this._vertexBuffers = null, 
            this._verticesCount = 0, this._virtualVerticesCount = 0, this._maxVerticesCount = 256, 
            this._vertices1 = null, this._vertexBuffer1 = null, this._floatCountPerVertices1 = 8, 
            this._verticesIndex1 = 0, this._everyAddVerticeCount1 = 0, this._delLength = 0, 
            this._vertices2 = null, this._vertexBuffer2 = null, this._floatCountPerVertices2 = 1, 
            this._everyGroupVertexBirthTime = null, this._VerticesToTailLength = null, this._everyVertexToPreVertexDistance = null, 
            this._pointe = null, this._pointAtoBVector3e = null, this._isStart = !1, this._isFinish = !1, 
            this._isDead = !1, this._curtime = NaN, this._curDisappearIndex = 0, this._lastPosition = new Vector3(), 
            this._curPosition = new Vector3(), this._delVector3 = new Vector3(), this._lastFixedVertexPosition = new Vector3(), 
            this._pointAtoBVector3 = new Vector3(), this._pointA = new Vector3(), this._pointB = new Vector3(), 
            this._owner = owner, this._id = TrailRenderElement.renderElementCount++, 0 == this._id ? owner._owner.transform.position.cloneTo(this._lastPosition) : owner._curSubTrailFinishPosition.cloneTo(this._lastPosition), 
            this._everyGroupVertexBirthTime = [], this._VerticesToTailLength = new Float32Array(this._maxVerticesCount), 
            this._everyVertexToPreVertexDistance = new Float32Array(this._maxVerticesCount), 
            this._vertices1 = new Float32Array(this._maxVerticesCount * this._floatCountPerVertices1), 
            this._vertices2 = new Float32Array(this._maxVerticesCount * this._floatCountPerVertices2), 
            this._vertexBuffer1 = new VertexBuffer3D(VertexTrail.vertexDeclaration1, this._maxVerticesCount, 35044, !0), 
            this._vertexBuffer2 = new VertexBuffer3D(VertexTrail.vertexDeclaration2, this._maxVerticesCount, 35044, !0), 
            this._vertexBuffers = [], this._vertexBuffers.push(this._vertexBuffer1), this._vertexBuffers.push(this._vertexBuffer2);
        }
        __class(TrailRenderElement, "laya.d3.core.trail.TrailRenderElement");
        var __proto = TrailRenderElement.prototype;
        Laya.imps(__proto, {
            "laya.d3.core.render.IRenderable": !0
        }), __proto._updateTrail = function() {
            this._everyAddVerticeCount1 = 0, this._isStart || this._addTrailByFirstPosition(this._lastPosition, this._curPosition), 
            this._addTrailByNextPosition(this._curPosition), this._vertexBuffer1.setData(this._vertices1, this._verticesIndex1, this._verticesIndex1, this._everyAddVerticeCount1), 
            this._verticesIndex1 += this._everyAddVerticeCount1, this._curPosition.cloneTo(this._lastPosition), 
            2 == this._virtualVerticesCount && (this._verticesIndex1 -= 2 * this._floatCountPerVertices1);
        }, __proto._addTrailByFirstPosition = function(firstPosition, secondPosition) {
            Vector3.subtract(secondPosition, firstPosition, this._delVector3), Vector3.cross(this._delVector3, this._camera.forward, this._pointAtoBVector3), 
            Vector3.normalize(this._pointAtoBVector3, this._pointAtoBVector3), Vector3.scale(this._pointAtoBVector3, this._owner.widthMultiplier / 2, this._pointAtoBVector3), 
            this._updateVerticesByPosition(firstPosition), firstPosition.cloneTo(this._lastFixedVertexPosition), 
            this._verticesCount += 2, this._curtime = this._owner._hasLifeSubTrail ? this._owner._curSubTrailFinishCurTime : this._owner._curtime, 
            this._everyGroupVertexBirthTime.push(this._curtime), this._isStart = !0, this._owner._hasLifeSubTrail = !0;
        }, __proto._addTrailByNextPosition = function(position) {
            Vector3.subtract(position, this._lastFixedVertexPosition, this._delVector3), Vector3.cross(this._delVector3, this._camera.forward, this._pointAtoBVector3), 
            Vector3.normalize(this._pointAtoBVector3, this._pointAtoBVector3), Vector3.scale(this._pointAtoBVector3, this._owner.widthMultiplier / 2, this._pointAtoBVector3), 
            this._delLength = Vector3.scalarLength(this._delVector3), this._delLength - this._owner.minVertexDistance >= MathUtils3D.zeroTolerance ? (this._owner._trailTotalLength += this._delLength, 
            this._owner._trailSupplementLength = 0, this._updateVerticesByPosition(position), 
            position.cloneTo(this._lastFixedVertexPosition), this._verticesCount += 2, this._virtualVerticesCount = 0, 
            this._everyGroupVertexBirthTime.push(this._owner._curtime), this._verticesCount == this._maxVerticesCount && this._onTrailRenderElementFinish()) : (this._owner._trailSupplementLength = this._delLength, 
            this._updateVerticesByPosition(position), this._virtualVerticesCount = 2);
        }, __proto._updateVerticesByPosition = function(position) {
            this._pointe = position.elements, this._pointAtoBVector3e = this._pointAtoBVector3.elements, 
            this._curtime = this._owner._curtime, this._owner._hasLifeSubTrail && 0 == this._isStart && (this._pointe = this._owner._curSubTrailFinishPosition.elements, 
            this._pointAtoBVector3e = this._owner._curSubTrailFinishDirection.elements, this._curtime = this._owner._curSubTrailFinishCurTime), 
            this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = this._pointe[0], 
            this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = this._pointe[1], 
            this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = this._pointe[2], 
            this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = -this._pointAtoBVector3e[0], 
            this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = -this._pointAtoBVector3e[1], 
            this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = -this._pointAtoBVector3e[2], 
            this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = this._curtime, 
            this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = 1, this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = this._pointe[0], 
            this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = this._pointe[1], 
            this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = this._pointe[2], 
            this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = this._pointAtoBVector3e[0], 
            this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = this._pointAtoBVector3e[1], 
            this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = this._pointAtoBVector3e[2], 
            this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = this._curtime, 
            this._vertices1[this._verticesIndex1 + this._everyAddVerticeCount1++] = 0, this._VerticesToTailLength[this._verticesCount / 2] = this._owner._trailTotalLength + this._owner._trailSupplementLength, 
            0 == this._owner._trailSupplementLength ? this._everyVertexToPreVertexDistance[this._verticesCount / 2] = this._delLength : this._everyVertexToPreVertexDistance[this._verticesCount / 2] = this._isStart ? this._owner._trailSupplementLength : 0;
        }, __proto._updateVertexBuffer2 = function() {
            var j, _uvIndex = 0, _uvX = 0, i = 0;
            for (i = 0, j = (this._verticesCount + this._virtualVerticesCount) / 2; i < j; i++) _uvX = 0 == this._owner.textureMode ? (this._VerticesToTailLength[i] - this._owner._trailDeadLength) / (this._owner._trailTotalLength + this._owner._trailSupplementLength - this._owner._trailDeadLength) : this._owner._trailTotalLength + this._owner._trailSupplementLength - this._VerticesToTailLength[i], 
            this._vertices2[_uvIndex++] = 1 - _uvX, this._vertices2[_uvIndex++] = 1 - _uvX;
            this._vertexBuffer2.setData(this._vertices2, 0, 0, this._verticesCount + this._virtualVerticesCount);
        }, __proto._onTrailRenderElementFinish = function() {
            this._lastFixedVertexPosition.cloneTo(this._owner._curSubTrailFinishPosition), this._pointAtoBVector3.cloneTo(this._owner._curSubTrailFinishDirection), 
            this._owner._curSubTrailFinishCurTime = this._owner._curtime, this._isFinish = !0;
        }, __proto._updateDisappear = function() {
            var j, i = 0;
            for (i = this._curDisappearIndex, j = (this._verticesCount + this._virtualVerticesCount) / 2; i < j; i++) this._owner._curtime - this._everyGroupVertexBirthTime[i] >= this._owner.time + MathUtils3D.zeroTolerance && (this._curDisappearIndex++, 
            this._owner._trailDeadLength += this._everyVertexToPreVertexDistance[this._curDisappearIndex], 
            this._curDisappearIndex >= (this._verticesCount + this._virtualVerticesCount) / 2 && (this._isDead = !0));
        }, __proto._beforeRender = function(state) {
            return this._camera = state.camera, null != this._camera && (this._owner._owner.transform.position.cloneTo(this._curPosition), 
            !this._isDead && (this._verticesCount < this._maxVerticesCount ? (this._owner._isStart || (this._owner._owner.transform.position.cloneTo(this._lastPosition), 
            this._owner._isStart = !0), Vector3.equals(this._lastPosition, this._curPosition) || this._updateTrail()) : this._isFinish && (this._isFinish = !1, 
            this._owner._curSubTrailFinished = !0), 0 < this._verticesCount) && (this._updateVertexBuffer2(), 
            this._updateDisappear(), !0));
        }, __proto._render = function(state) {
            this._isDead || (WebGL.mainContext.drawArrays(5, 2 * this._curDisappearIndex, this._verticesCount + this._virtualVerticesCount - 2 * this._curDisappearIndex), 
            console.log(2 * this._curDisappearIndex, this._verticesCount + this._virtualVerticesCount - 2 * this._curDisappearIndex), 
            Stat.drawCall++, Stat.trianglesFaces += this._verticesCount + this._virtualVerticesCount - 2 * this._curDisappearIndex - 2);
        }, __proto._getVertexBuffer = function(index) {
            return void 0 === index && (index = 0), 0 === index ? this._vertexBuffer1 : 1 === index ? this._vertexBuffer2 : null;
        }, __proto._getVertexBuffers = function() {
            return this._vertexBuffers;
        }, __proto._getIndexBuffer = function() {
            return null;
        }, __proto.reActivate = function() {
            this._id = laya.d3.core.trail.TrailRenderElement.renderElementCount++, this._isStart = !1, 
            this._isFinish = !1, this._isDead = !1, this._verticesCount = 0, this._virtualVerticesCount = 0, 
            this._verticesIndex1 = 0, this._delLength = 0, this._curDisappearIndex = 0, this._everyGroupVertexBirthTime = [], 
            this._owner._curSubTrailFinishPosition.cloneTo(this._lastPosition);
        }, __proto._destroy = function() {
            this._vertexBuffer1.dispose(), this._vertexBuffer2.dispose(), this._vertices1 = null, 
            this._vertexBuffer1 = null, this._vertices2 = null, this._vertexBuffer2 = null, 
            this._vertexBuffers = null, this._everyGroupVertexBirthTime = null, this._VerticesToTailLength = null, 
            this._everyVertexToPreVertexDistance = null, this._lastPosition = null, this._curPosition = null, 
            this._delVector3 = null, this._lastFixedVertexPosition = null, this._pointAtoBVector3 = null, 
            this._pointe = null, this._pointAtoBVector3e = null, this._pointA = null, this._pointB = null;
        }, __getset(0, __proto, "_vertexBufferCount", function() {
            return this._vertexBuffers.length;
        }), __getset(0, __proto, "triangleCount", function() {
            return 0;
        }), TrailRenderElement.renderElementCount = 0;
    }(), function() {
        function VertexTrail() {}
        __class(VertexTrail, "laya.d3.core.trail.VertexTrail");
        var __proto = VertexTrail.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexTrail._vertexDeclaration1;
        }), __getset(1, VertexTrail, "vertexDeclaration1", function() {
            return VertexTrail._vertexDeclaration1;
        }), __getset(1, VertexTrail, "vertexDeclaration2", function() {
            return VertexTrail._vertexDeclaration2;
        }), __static(VertexTrail, [ "_vertexDeclaration1", function() {
            return this._vertexDeclaration1 = new VertexDeclaration(32, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 41), new VertexElement(24, "single", 33), new VertexElement(28, "single", 40) ]);
        }, "_vertexDeclaration2", function() {
            return this._vertexDeclaration2 = new VertexDeclaration(4, [ new VertexElement(0, "single", 38) ]);
        } ]), VertexTrail;
    }()), DynamicBatch = function() {
        function DynamicBatch(vertexDeclaration) {
            this._vertexDeclaration = null, this._vertexDatas = null, this._indexDatas = null, 
            this._vertexBuffer = null, this._indexBuffer = null, this._currentCombineVertexCount = 0, 
            this._currentCombineIndexCount = 0, this._combineRenderElements = null, this._materials = null, 
            this._materialToRenderElementsOffsets = null, this._merageElements = null, this._combineRenderElementPool = null, 
            this._combineRenderElementPoolIndex = 0, this._currentCombineVertexCount = 0, this._currentCombineIndexCount = 0, 
            this._combineRenderElements = [], this._materialToRenderElementsOffsets = [], this._materials = [], 
            this._merageElements = [], this._combineRenderElementPool = [], this._combineRenderElementPoolIndex = 0, 
            this._vertexDeclaration = vertexDeclaration;
        }
        __class(DynamicBatch, "laya.d3.graphics.DynamicBatch");
        var __proto = DynamicBatch.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.render.IRenderable": !0
        }), __proto._getVertexBuffer = function(index) {
            return void 0 === index && (index = 0), 0 === index ? this._vertexBuffer : null;
        }, __proto._getIndexBuffer = function() {
            return this._indexBuffer;
        }, __proto._getCombineRenderElementFromPool = function(view, projection, projectionView) {
            var renderElement = this._combineRenderElementPool[this._combineRenderElementPoolIndex++];
            return renderElement || (this._combineRenderElementPool[this._combineRenderElementPoolIndex - 1] = renderElement = new RenderElement(), 
            renderElement._sprite3D = new MeshSprite3D()), renderElement._sprite3D._render._renderUpdate(projectionView), 
            renderElement;
        }, __proto._getRenderElement = function(view, projection, projectionView) {
            this._vertexDatas || (this._vertexDatas = new Float32Array(this._vertexDeclaration.vertexStride / 4 * DynamicBatch.maxVertexCount), 
            this._indexDatas = new Uint16Array(DynamicBatch.maxIndexCount), this._vertexBuffer = VertexBuffer3D.create(this._vertexDeclaration, DynamicBatch.maxVertexCount, 35048), 
            this._indexBuffer = IndexBuffer3D.create("ushort", DynamicBatch.maxIndexCount, 35048));
            for (var curMerVerCount = this._merageElements.length = 0, curIndexCount = 0, i = 0, n = this._combineRenderElements.length; i < n; i++) {
                var renderElement = this._combineRenderElements[i], subVertexDatas = renderElement.getDynamicBatchBakedVertexs(0), subIndexDatas = renderElement.getBakedIndices(), isInvert = renderElement._sprite3D.transform._isFrontFaceInvert, indexOffset = curMerVerCount / (this._vertexDeclaration.vertexStride / 4), indexStart = curIndexCount, indexEnd = indexStart + subIndexDatas.length;
                renderElement._tempBatchIndexStart = indexStart, renderElement._tempBatchIndexEnd = indexEnd, 
                this._indexDatas.set(subIndexDatas, curIndexCount);
                var k = 0;
                if (isInvert) for (k = indexStart; k < indexEnd; k += 3) {
                    this._indexDatas[k] = indexOffset + this._indexDatas[k];
                    var index1 = this._indexDatas[k + 1], index2 = this._indexDatas[k + 2];
                    this._indexDatas[k + 1] = indexOffset + index2, this._indexDatas[k + 2] = indexOffset + index1;
                } else for (k = indexStart; k < indexEnd; k += 3) this._indexDatas[k] = indexOffset + this._indexDatas[k], 
                this._indexDatas[k + 1] = indexOffset + this._indexDatas[k + 1], this._indexDatas[k + 2] = indexOffset + this._indexDatas[k + 2];
                curIndexCount += subIndexDatas.length, this._vertexDatas.set(subVertexDatas, curMerVerCount), 
                curMerVerCount += subVertexDatas.length;
            }
            for (this._vertexBuffer.setData(this._vertexDatas), this._indexBuffer.setData(this._indexDatas), 
            i = this._combineRenderElementPoolIndex = 0, n = this._materials.length; i < n; i++) {
                var merageElement = this._getCombineRenderElementFromPool(view, projection, projectionView);
                merageElement._type = 2, merageElement._staticBatch = null;
                var renderElementStartIndex = (merageElement.renderObj = this)._combineRenderElements[this._materialToRenderElementsOffsets[i]]._tempBatchIndexStart, renderElementEndIndex = i + 1 === this._materialToRenderElementsOffsets.length ? curIndexCount : this._combineRenderElements[this._materialToRenderElementsOffsets[i + 1]]._tempBatchIndexStart;
                merageElement._tempBatchIndexStart = renderElementStartIndex, merageElement._tempBatchIndexEnd = renderElementEndIndex, 
                merageElement._material = this._materials[i], this._merageElements.push(merageElement);
            }
        }, __proto._addCombineRenderObjTest = function(renderElement) {
            var renderObj = renderElement.renderObj, indexCount = this._currentCombineIndexCount + renderObj._getIndexBuffer().indexCount, vertexCount = this._currentCombineVertexCount + renderObj._getVertexBuffer().vertexCount;
            return !(DynamicBatch.maxVertexCount < vertexCount || DynamicBatch.maxIndexCount < indexCount);
        }, __proto._addCombineRenderObj = function(renderElement) {
            var renderObj = renderElement.renderObj;
            this._combineRenderElements.push(renderElement), this._currentCombineIndexCount = this._currentCombineIndexCount + renderObj._getIndexBuffer().indexCount, 
            this._currentCombineVertexCount = this._currentCombineVertexCount + renderObj._getVertexBuffer().vertexCount;
        }, __proto._addCombineMaterial = function(material) {
            this._materials.push(material);
        }, __proto._addMaterialToRenderElementOffset = function(offset) {
            this._materialToRenderElementsOffsets.push(offset);
        }, __proto._clearRenderElements = function() {
            this._combineRenderElements.length = 0, this._materials.length = 0, this._materialToRenderElementsOffsets.length = 0, 
            this._currentCombineVertexCount = 0, this._currentCombineIndexCount = 0;
        }, __proto._addToRenderQueue = function(scene, view, projection, projectionView) {
            this._getRenderElement(view, projection, projectionView);
            for (var i = 0, n = this._materials.length; i < n; i++) scene.getRenderQueue(this._materials[i].renderQueue)._addDynamicBatchElement(this._merageElements[i]);
        }, __proto._beforeRender = function(state) {
            return this._vertexBuffer._bind(), this._indexBuffer._bind(), !0;
        }, __proto._render = function(state) {
            var indexCount = state._batchIndexEnd - state._batchIndexStart;
            WebGL.mainContext.drawElements(4, indexCount, 5123, 2 * state._batchIndexStart), 
            Stat.drawCall++, Stat.trianglesFaces += indexCount / 3;
        }, __proto._getVertexBuffers = function() {
            return null;
        }, __getset(0, __proto, "_vertexBufferCount", function() {
            return 1;
        }), __getset(0, __proto, "triangleCount", function() {
            return this._indexBuffer.indexCount / 3;
        }), __getset(0, __proto, "combineRenderElementsCount", function() {
            return this._combineRenderElements.length;
        }), DynamicBatch.maxVertexCount = 2e4, DynamicBatch.maxIndexCount = 4e4, DynamicBatch.maxCombineTriangleCount = 10, 
        DynamicBatch;
    }(), DynamicBatchManager = function() {
        function DynamicBatchManager() {
            this._dynamicBatches = null, this._prepareDynamicBatchCombineElements = null, this._dynamicBatches = {}, 
            this._prepareDynamicBatchCombineElements = [];
        }
        __class(DynamicBatchManager, "laya.d3.graphics.DynamicBatchManager");
        var __proto = DynamicBatchManager.prototype;
        return __proto.getDynamicBatch = function(_vertexDeclaration, number) {
            var dynamicBatch, key = _vertexDeclaration.id.toString() + number;
            return this._dynamicBatches[key] ? dynamicBatch = this._dynamicBatches[key] : this._dynamicBatches[key] = dynamicBatch = new DynamicBatch(_vertexDeclaration), 
            dynamicBatch;
        }, __proto._garbageCollection = function() {
            for (var key in this._dynamicBatches) 0 === this._dynamicBatches[key].combineRenderElementsCount && delete this._dynamicBatches[key];
        }, __proto._addPrepareRenderElement = function(renderElement) {
            this._prepareDynamicBatchCombineElements.push(renderElement);
        }, __proto._finishCombineDynamicBatch = function(scene) {
            var lastMaterial, lastVertexDeclaration, lastRenderElement;
            this._prepareDynamicBatchCombineElements.sort(DynamicBatchManager._sortPrepareDynamicBatch);
            for (var curMaterial, curRenderElement, curDynamicBatch, laterAddMaterial, laterAddRenderElement, lastBatchNumber = -1, lastCanMerage = !0, curbatchNumber = 0, laterAddMatToElementOffset = -1, i = 0, n = this._prepareDynamicBatchCombineElements.length; i < n; i++) {
                var curDeclaration = (curRenderElement = this._prepareDynamicBatchCombineElements[i]).renderObj._getVertexBuffer(0).vertexDeclaration, declarationChanged = lastVertexDeclaration !== curDeclaration;
                declarationChanged && (curbatchNumber = 0, lastVertexDeclaration = curDeclaration);
                var batchNumbrChanged = curbatchNumber !== lastBatchNumber;
                if (batchNumbrChanged && (lastBatchNumber = curbatchNumber), (declarationChanged || batchNumbrChanged) && (curDynamicBatch = this.getDynamicBatch(curDeclaration, curbatchNumber), 
                lastMaterial = null), lastCanMerage) if (curDynamicBatch._addCombineRenderObjTest(curRenderElement)) {
                    if (lastMaterial !== (curMaterial = curRenderElement._material)) laterAddMaterial && (scene.getRenderQueue(laterAddRenderElement._material.renderQueue)._addRenderElement(laterAddRenderElement), 
                    laterAddRenderElement = laterAddMaterial = null, laterAddMatToElementOffset = -1), 
                    laterAddMaterial = curMaterial, laterAddMatToElementOffset = curDynamicBatch.combineRenderElementsCount, 
                    laterAddRenderElement = curRenderElement, lastMaterial = curMaterial; else if (laterAddMaterial) {
                        var lastRenderObj = laterAddRenderElement.renderObj, curRenderObj = curRenderElement.renderObj;
                        lastRenderObj._getVertexBuffer().vertexCount + curRenderObj._getVertexBuffer().vertexCount > DynamicBatch.maxVertexCount || lastRenderObj._getIndexBuffer().indexCount + curRenderObj._getIndexBuffer().indexCount > DynamicBatch.maxIndexCount ? (scene.getRenderQueue(laterAddRenderElement._material.renderQueue)._addRenderElement(laterAddRenderElement), 
                        laterAddMaterial = curMaterial, laterAddMatToElementOffset = curDynamicBatch.combineRenderElementsCount, 
                        laterAddRenderElement = curRenderElement) : (curDynamicBatch._addCombineMaterial(laterAddMaterial), 
                        curDynamicBatch._addMaterialToRenderElementOffset(laterAddMatToElementOffset), curDynamicBatch._addCombineRenderObj(laterAddRenderElement), 
                        laterAddRenderElement = laterAddMaterial = null, laterAddMatToElementOffset = -1, 
                        curDynamicBatch._addCombineRenderObj(curRenderElement));
                    } else curDynamicBatch._addCombineRenderObj(curRenderElement);
                    lastCanMerage = !0;
                } else laterAddMaterial && (scene.getRenderQueue(laterAddRenderElement._material.renderQueue)._addRenderElement(laterAddRenderElement), 
                laterAddRenderElement = laterAddMaterial = null, laterAddMatToElementOffset = -1), 
                curbatchNumber++, lastCanMerage = !1; else lastRenderElement = this._prepareDynamicBatchCombineElements[i - 1], 
                curDynamicBatch._addMaterialToRenderElementOffset(curDynamicBatch.combineRenderElementsCount), 
                lastMaterial = lastRenderElement._material, curDynamicBatch._addCombineMaterial(lastMaterial), 
                curDynamicBatch._addCombineRenderObj(lastRenderElement), lastCanMerage = !0, lastMaterial !== (curMaterial = curRenderElement._material) ? (laterAddMaterial = curMaterial, 
                laterAddMatToElementOffset = curDynamicBatch.combineRenderElementsCount, laterAddRenderElement = curRenderElement) : curDynamicBatch._addCombineRenderObj(curRenderElement), 
                lastMaterial = curMaterial;
            }
            laterAddMaterial && (scene.getRenderQueue(laterAddRenderElement._material.renderQueue)._addRenderElement(laterAddRenderElement), 
            laterAddRenderElement = laterAddMaterial = null, laterAddMatToElementOffset = -1), 
            this._prepareDynamicBatchCombineElements.length = 0;
        }, __proto._clearRenderElements = function() {
            for (var key in this._dynamicBatches) this._dynamicBatches[key]._clearRenderElements();
        }, __proto._addToRenderQueue = function(scene, view, projection, projectionView) {
            for (var key in this._dynamicBatches) {
                var dynamicBatch = this._dynamicBatches[key];
                0 < dynamicBatch.combineRenderElementsCount && dynamicBatch._addToRenderQueue(scene, view, projection, projectionView);
            }
        }, __proto.dispose = function() {
            this._dynamicBatches = null;
        }, DynamicBatchManager._sortPrepareDynamicBatch = function(a, b) {
            return a._mainSortID - b._mainSortID;
        }, DynamicBatchManager;
    }(), FrustumCulling = function() {
        function FrustumCulling() {}
        return __class(FrustumCulling, "laya.d3.graphics.FrustumCulling"), FrustumCulling.renderShadowObjectCulling = function(scene, lightFrustum, shadowQueues, lightViewProjectMatrix, nPSSMNum) {
            var i = 0, j = 0, n = 0, m = 0;
            for (i = 0, n = shadowQueues.length; i < n; i++) {
                var quene = shadowQueues[i];
                quene && quene._clearRenderElements();
            }
            var baseRender, shadowQueue, renderElements, frustumCullingObjects = scene._cullingRenders;
            if (1 < nPSSMNum) {
                for (i = 0, n = scene._cullingRendersLength; i < n; i++) if ((baseRender = frustumCullingObjects[i]).castShadow && Layer.isVisible(baseRender._owner.layer.mask) && baseRender.enable) for (var k = 1, kNum = lightFrustum.length; k < kNum; k++) if (shadowQueue = shadowQueues[k - 1], 
                0 !== lightFrustum[k].containsBoundSphere(baseRender.boundingSphere)) for (j = 0, 
                m = (renderElements = baseRender._renderElements).length; j < m; j++) shadowQueue._addRenderElement(renderElements[j]);
            } else for (i = 0, n = scene._cullingRendersLength; i < n; i++) if ((baseRender = frustumCullingObjects[i]).castShadow && Layer.isVisible(baseRender._owner.layer.mask) && baseRender.enable && 0 !== lightFrustum[0].containsBoundSphere(baseRender.boundingSphere)) for (baseRender._renderUpdate(lightViewProjectMatrix), 
            shadowQueue = shadowQueues[0], j = 0, m = (renderElements = baseRender._renderElements).length; j < m; j++) shadowQueue._addRenderElement(renderElements[j]);
        }, FrustumCulling.renderShadowObjectCullingOctree = function(scene, lightFrustum, quenesResult, lightViewProjectMatrix, nPSSMNum) {
            for (var i = 0, n = quenesResult.length; i < n; i++) {
                var quene = quenesResult[i];
                quene && quene._clearRenderElements();
            }
            1 < nPSSMNum ? scene.treeRoot.cullingShadowObjects(lightFrustum, quenesResult, !0, 0, scene) : scene.treeRoot.cullingShadowObjectsOnePSSM(lightFrustum[0], quenesResult, lightViewProjectMatrix, !0, 0, scene);
        }, FrustumCulling.renderObjectCulling = function(boundFrustum, scene, camera, view, projection, projectionView) {
            var i = 0, n = 0, j = 0, m = 0, queues = scene._quenes, dynamicBatchManager = scene._dynamicBatchManager, frustumCullingObjects = scene._cullingRenders;
            for (i = 0, n = queues.length; i < n; i++) {
                var queue = queues[i];
                queue && queue._clearRenderElements();
            }
            var staticBatchManagers = StaticBatchManager._staticBatchManagers;
            for (i = 0, n = staticBatchManagers.length; i < n; i++) staticBatchManagers[i]._clearRenderElements();
            dynamicBatchManager._clearRenderElements();
            var cameraPosition = camera.transform.position;
            for (i = 0, n = scene._cullingRendersLength; i < n; i++) {
                var baseRender = frustumCullingObjects[i];
                if (Layer.isVisible(baseRender._owner.layer.mask) && baseRender.enable && 0 !== boundFrustum.containsBoundSphere(baseRender.boundingSphere) && baseRender._renderUpdate(projectionView)) {
                    baseRender._distanceForSort = Vector3.distance(baseRender.boundingSphere.center, cameraPosition) + baseRender.sortingFudge;
                    var renderElements = baseRender._renderElements;
                    for (j = 0, m = renderElements.length; j < m; j++) {
                        var renderElement = renderElements[j], staticBatch = renderElement._staticBatch;
                        if (staticBatch && staticBatch._material === renderElement._material) staticBatch._addBatchRenderElement(renderElement); else {
                            var renderObj = renderElement.renderObj;
                            renderObj.triangleCount < 10 && 1 === renderObj._vertexBufferCount && renderObj._getIndexBuffer() && renderElement._material.renderQueue < 2 && renderElement._canDynamicBatch && !baseRender._owner.isStatic ? dynamicBatchManager._addPrepareRenderElement(renderElement) : scene.getRenderQueue(renderElement._material.renderQueue)._addRenderElement(renderElement);
                        }
                    }
                }
            }
            for (i = 0, n = staticBatchManagers.length; i < n; i++) staticBatchManagers[i]._addToRenderQueue(scene, view, projection, projectionView);
            dynamicBatchManager._finishCombineDynamicBatch(scene), dynamicBatchManager._addToRenderQueue(scene, view, projection, projectionView);
        }, FrustumCulling.renderObjectCullingOctree = function(boundFrustum, scene, camera, view, projection, projectionView) {
            var i = 0, n = 0, queues = scene._quenes, dynamicBatchManager = scene._dynamicBatchManager;
            for (i = 0, n = queues.length; i < n; i++) {
                var queue = queues[i];
                queue && queue._clearRenderElements();
            }
            var staticBatchManagers = StaticBatchManager._staticBatchManagers;
            for (i = 0, n = staticBatchManagers.length; i < n; i++) staticBatchManagers[i]._clearRenderElements();
            for (dynamicBatchManager._clearRenderElements(), scene._cullingRenders.length = 0, 
            scene.treeRoot.cullingObjects(boundFrustum, !0, 0, camera.transform.position, projectionView), 
            i = 0, n = staticBatchManagers.length; i < n; i++) staticBatchManagers[i]._addToRenderQueue(scene, view, projection, projectionView);
            dynamicBatchManager._finishCombineDynamicBatch(scene), dynamicBatchManager._addToRenderQueue(scene, view, projection, projectionView);
        }, FrustumCulling.renderObjectCullingNoBoundFrustum = function(scene, camera, view, projection, projectionView) {
            var i = 0, n = 0, j = 0, m = 0, queues = scene._quenes, dynamicBatchManager = scene._dynamicBatchManager, frustumCullingObjects = scene._cullingRenders;
            for (i = 0, n = queues.length; i < n; i++) {
                var queue = queues[i];
                queue && queue._clearRenderElements();
            }
            var staticBatchManagers = StaticBatchManager._staticBatchManagers;
            for (i = 0, n = staticBatchManagers.length; i < n; i++) staticBatchManagers[i]._clearRenderElements();
            dynamicBatchManager._clearRenderElements();
            var cameraPosition = camera.transform.position;
            for (i = 0, n = scene._cullingRendersLength; i < n; i++) {
                var baseRender = frustumCullingObjects[i];
                if (Layer.isVisible(baseRender._owner.layer.mask) && baseRender.enable) {
                    baseRender._renderUpdate(projectionView), baseRender._distanceForSort = Vector3.distance(baseRender.boundingSphere.center, cameraPosition) + baseRender.sortingFudge;
                    var renderElements = baseRender._renderElements;
                    for (j = 0, m = renderElements.length; j < m; j++) {
                        var renderElement = renderElements[j], staticBatch = renderElement._staticBatch;
                        if (staticBatch && staticBatch._material === renderElement._material) staticBatch._addBatchRenderElement(renderElement); else {
                            var renderObj = renderElement.renderObj;
                            renderObj.triangleCount < 10 && 1 === renderObj._vertexBufferCount && renderObj._getIndexBuffer() && renderElement._material.renderQueue < 2 && renderElement._canDynamicBatch && !baseRender._owner.isStatic ? dynamicBatchManager._addPrepareRenderElement(renderElement) : scene.getRenderQueue(renderElement._material.renderQueue)._addRenderElement(renderElement);
                        }
                    }
                }
            }
            for (i = 0, n = staticBatchManagers.length; i < n; i++) staticBatchManagers[i]._addToRenderQueue(scene, view, projection, projectionView);
            dynamicBatchManager._finishCombineDynamicBatch(scene), dynamicBatchManager._addToRenderQueue(scene, view, projection, projectionView);
        }, FrustumCulling;
    }(), StaticBatchManager = function() {
        function StaticBatchManager() {
            this._initBatchRenderElements = null, this._staticBatches = null, this._initBatchRenderElements = [], 
            this._staticBatches = {};
        }
        __class(StaticBatchManager, "laya.d3.graphics.StaticBatchManager");
        var __proto = StaticBatchManager.prototype;
        return __proto._finishInit = function() {
            for (var key in this._staticBatches) this._staticBatches[key]._finishInit();
            this._initBatchRenderElements.length = 0;
        }, __proto._initStaticBatchs = function(rootSprite) {
            throw new Error("StaticBatchManager:must override this function.");
        }, __proto._addInitBatchSprite = function(renderableSprite3D) {
            for (var renderElements = renderableSprite3D._render._renderElements, i = 0, n = renderElements.length; i < n; i++) this._initBatchRenderElements.push(renderElements[i]);
        }, __proto._clearRenderElements = function() {
            for (var key in this._staticBatches) this._staticBatches[key]._clearRenderElements();
        }, __proto._garbageCollection = function(renderElement) {
            var staticBatch = renderElement._staticBatch, initBatchRenderElements = staticBatch._initBatchRenderElements, index = initBatchRenderElements.indexOf(renderElement);
            initBatchRenderElements.splice(index, 1), 0 === initBatchRenderElements.length && (staticBatch.dispose(), 
            delete this._staticBatches[staticBatch._key]);
        }, __proto._addToRenderQueue = function(scene, view, projection, projectionView) {
            for (var key in this._staticBatches) {
                var staticBatch = this._staticBatches[key];
                0 < staticBatch._batchRenderElements.length && staticBatch._updateToRenderQueue(scene, projectionView);
            }
        }, __proto.dispose = function() {
            this._staticBatches = null;
        }, StaticBatchManager._addToStaticBatchQueue = function(sprite3D) {
            sprite3D instanceof laya.d3.core.RenderableSprite3D && sprite3D._addToInitStaticBatchManager();
            for (var i = 0, n = sprite3D.numChildren; i < n; i++) StaticBatchManager._addToStaticBatchQueue(sprite3D._childs[i]);
        }, StaticBatchManager.combine = function(staticBatchRoot, renderableSprite3Ds) {
            var staticBatchManager, i = 0, n = 0;
            if (renderableSprite3Ds) for (i = 0, n = renderableSprite3Ds.length; i < n; i++) {
                renderableSprite3Ds[i]._addToInitStaticBatchManager();
            } else staticBatchRoot && StaticBatchManager._addToStaticBatchQueue(staticBatchRoot);
            for (i = 0, n = StaticBatchManager._staticBatchManagers.length; i < n; i++) (staticBatchManager = StaticBatchManager._staticBatchManagers[i])._initStaticBatchs(staticBatchRoot), 
            staticBatchManager._finishInit();
        }, StaticBatchManager._staticBatchManagers = [], StaticBatchManager;
    }(), StaticBatch = function() {
        function StaticBatch(key, manager, rootOwner) {
            this._combineRenderElementPoolIndex = 0, this._combineRenderElementPool = null, 
            this._initBatchRenderElements = null, this._batchRenderElements = null, this._material = null, 
            this._rootOwner = null, this._key = null, this._manager = null, this._key = key, 
            this._manager = manager, this._combineRenderElementPoolIndex = 0, this._combineRenderElementPool = [], 
            this._initBatchRenderElements = [], this._batchRenderElements = [], this._rootOwner = rootOwner;
        }
        __class(StaticBatch, "laya.d3.graphics.StaticBatch");
        var __proto = StaticBatch.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.render.IRenderable": !0,
            "laya.resource.IDispose": !0
        }), __proto._binarySearch = function(renderElement) {
            for (var start = 0, end = this._batchRenderElements.length - 1, mid = 0; start <= end; ) mid = Math.floor((start + end) / 2), 
            this._compareBatchRenderElement(this._batchRenderElements[mid], renderElement) ? end = mid - 1 : start = mid + 1;
            return start;
        }, __proto._compareBatchRenderElement = function(a, b) {
            throw new Error("StaticBatch:must override this function.");
        }, __proto._getVertexDecLightMap = function(vertexDeclaration) {
            return vertexDeclaration === VertexPositionNormalTextureSkinSTangent.vertexDeclaration ? VertexPositionNormalTexture0Texture1SkinSTangent.vertexDeclaration : vertexDeclaration === VertexPositionNormalTextureSkin.vertexDeclaration ? VertexPositionNormalTexture0Texture1Skin.vertexDeclaration : vertexDeclaration === VertexPositionNormalColorTextureSTangent.vertexDeclaration ? VertexPositionNormalColorTexture0Texture1STangent.vertexDeclaration : vertexDeclaration === VertexPositionNTBTexture.vertexDeclaration ? null : vertexDeclaration === VertexPositionNormalColorTexture.vertexDeclaration ? VertexPositionNormalColorTexture0Texture1.vertexDeclaration : vertexDeclaration === VertexPositionNormalTextureSTangent.vertexDeclaration ? VertexPositionNormalTexture0Texture1STangent.vertexDeclaration : vertexDeclaration === VertexPositionNormalTexture.vertexDeclaration ? VertexPositionNormalTexture0Texture1.vertexDeclaration : vertexDeclaration === VertexPositionNormalTextureSkinTangent.vertexDeclaration ? VertexPositionNormalTexture0Texture1SkinTangent.vertexDeclaration : vertexDeclaration === VertexPositionNormalTextureSkin.vertexDeclaration ? VertexPositionNormalTexture0Texture1Skin.vertexDeclaration : vertexDeclaration === VertexPositionNormalColorTextureTangent.vertexDeclaration ? VertexPositionNormalColorTexture0Texture1Tangent.vertexDeclaration : vertexDeclaration === VertexPositionNTBTexture.vertexDeclaration ? null : vertexDeclaration === VertexPositionNormalColorTexture.vertexDeclaration ? VertexPositionNormalColorTexture0Texture1.vertexDeclaration : vertexDeclaration === VertexPositionNormalTextureTangent.vertexDeclaration ? VertexPositionNormalTexture0Texture1Tangent.vertexDeclaration : vertexDeclaration === VertexPositionNormalTexture.vertexDeclaration ? VertexPositionNormalTexture0Texture1.vertexDeclaration : vertexDeclaration;
        }, __proto._getCombineRenderElementFromPool = function() {
            throw new Error("StaticBatch:must override this function.");
        }, __proto._addBatchRenderElement = function(renderElement) {
            this._batchRenderElements.splice(this._binarySearch(renderElement), 0, renderElement);
        }, __proto._updateToRenderQueue = function(scene, projectionView) {
            this._combineRenderElementPoolIndex = 0, this._getRenderElement(scene.getRenderQueue(this._material.renderQueue)._renderElements, scene, projectionView);
        }, __proto._getRenderElement = function(mergeElements, scene, projectionView) {
            throw new Error("StaticBatch:must override this function.");
        }, __proto._finishInit = function() {
            throw new Error("StaticBatch:must override this function.");
        }, __proto._clearRenderElements = function() {
            this._batchRenderElements.length = 0;
        }, __proto.dispose = function() {}, __proto._getVertexBuffer = function(index) {
            return void 0 === index && (index = 0), null;
        }, __proto._getIndexBuffer = function() {
            return null;
        }, __proto._beforeRender = function(state) {
            return !0;
        }, __proto._render = function(state) {}, __proto._getVertexBuffers = function() {
            return null;
        }, __getset(0, __proto, "_vertexBufferCount", function() {
            return 1;
        }), __getset(0, __proto, "triangleCount", function() {
            return 0;
        }), StaticBatch.combine = function(staticBatchRoot) {
            console.log("StaticBatch: discard property,please use StaticBatchManager.combine() function instead."), 
            StaticBatchManager.combine(staticBatchRoot);
        }, StaticBatch.maxBatchVertexCount = 65535, StaticBatch;
    }(), VertexDeclaration = function() {
        function VertexDeclaration(vertexStride, vertexElements) {
            if (this._id = 0, this._shaderValues = null, this._shaderDefineValue = 0, this._vertexStride = 0, 
            this._vertexElements = null, this._vertexElementsDic = null, this._id = ++VertexDeclaration._uniqueIDCounter, 
            this._id > VertexDeclaration.maxVertexDeclaration) throw new Error("VertexDeclaration: VertexDeclaration count should not large than ", VertexDeclaration.maxVertexDeclaration);
            this._shaderValues = new ValusArray(), this._vertexElementsDic = {}, this._vertexStride = vertexStride, 
            this._vertexElements = vertexElements;
            for (var i = 0; i < vertexElements.length; i++) {
                var vertexElement = vertexElements[i], attributeName = vertexElement.elementUsage;
                this._vertexElementsDic[attributeName] = vertexElement;
                var value = [ VertexDeclaration._getTypeSize(vertexElement.elementFormat) / 4, 5126, !1, this._vertexStride, vertexElement.offset ];
                switch (this._shaderValues.setValue(attributeName, value), attributeName) {
                  case 1:
                    this._addShaderDefine(ShaderCompile3D.SHADERDEFINE_COLOR);
                    break;

                  case 2:
                    this._addShaderDefine(ShaderCompile3D.SHADERDEFINE_UV0);
                    break;

                  case 15:
                    this._addShaderDefine(ShaderCompile3D.SHADERDEFINE_UV1);
                }
            }
        }
        __class(VertexDeclaration, "laya.d3.graphics.VertexDeclaration");
        var __proto = VertexDeclaration.prototype;
        return __proto._addShaderDefine = function(value) {
            this._shaderDefineValue |= value;
        }, __proto._removeShaderDefine = function(value) {
            this._shaderDefineValue &= ~value;
        }, __proto.getVertexElements = function() {
            return this._vertexElements.slice();
        }, __proto.getVertexElementByUsage = function(usage) {
            return this._vertexElementsDic[usage];
        }, __proto.unBinding = function() {}, __getset(0, __proto, "shaderDefineValue", function() {
            return this._shaderDefineValue;
        }), __getset(0, __proto, "id", function() {
            return this._id;
        }), __getset(0, __proto, "vertexStride", function() {
            return this._vertexStride;
        }), __getset(0, __proto, "shaderValues", function() {
            return this._shaderValues;
        }), VertexDeclaration._getTypeSize = function(format) {
            switch (format) {
              case "single":
                return 4;

              case "vector2":
                return 8;

              case "vector3":
                return 12;

              case "vector4":
                return 16;

              case "color":
              case "byte4":
              case "short2":
                return 4;

              case "short4":
                return 8;

              case "normalizedshort2":
                return 4;

              case "normalizedshort4":
                return 8;

              case "halfvector2":
                return 4;

              case "halfvector4":
                return 8;
            }
            return 0;
        }, VertexDeclaration.getVertexStride = function(vertexElements) {
            for (var curStride = 0, i = 0; i < vertexElements.Length; i++) {
                var element = vertexElements[i], stride = element.offset + VertexDeclaration._getTypeSize(element.elementFormat);
                curStride < stride && (curStride = stride);
            }
            return curStride;
        }, VertexDeclaration._maxVertexDeclarationBit = 1e3, VertexDeclaration._uniqueIDCounter = 1, 
        __static(VertexDeclaration, [ "maxVertexDeclaration", function() {
            return this.maxVertexDeclaration = 2147483647 - 1e3 * Math.floor(2147483.647);
        } ]), VertexDeclaration;
    }(), VertexElement = function() {
        function VertexElement(offset, elementFormat, elementUsage) {
            this.offset = 0, this.elementFormat = null, this.elementUsage = 0, this.offset = offset, 
            this.elementFormat = elementFormat, this.elementUsage = elementUsage;
        }
        return __class(VertexElement, "laya.d3.graphics.VertexElement"), VertexElement;
    }(), VertexPosition = (function() {
        function VertexElementFormat() {}
        __class(VertexElementFormat, "laya.d3.graphics.VertexElementFormat"), VertexElementFormat.Single = "single", 
        VertexElementFormat.Vector2 = "vector2", VertexElementFormat.Vector3 = "vector3", 
        VertexElementFormat.Vector4 = "vector4", VertexElementFormat.Color = "color", VertexElementFormat.Byte4 = "byte4", 
        VertexElementFormat.Short2 = "short2", VertexElementFormat.Short4 = "short4", VertexElementFormat.NormalizedShort2 = "normalizedshort2", 
        VertexElementFormat.NormalizedShort4 = "normalizedshort4", VertexElementFormat.HalfVector2 = "halfvector2", 
        VertexElementFormat.HalfVector4 = "halfvector4";
    }(), function() {
        function VertexElementUsage() {}
        __class(VertexElementUsage, "laya.d3.graphics.VertexElementUsage"), VertexElementUsage.POSITION0 = 0, 
        VertexElementUsage.COLOR0 = 1, VertexElementUsage.TEXTURECOORDINATE0 = 2, VertexElementUsage.NORMAL0 = 3, 
        VertexElementUsage.BINORMAL0 = 4, VertexElementUsage.TANGENT0 = 5, VertexElementUsage.BLENDINDICES0 = 6, 
        VertexElementUsage.BLENDWEIGHT0 = 7, VertexElementUsage.DEPTH0 = 8, VertexElementUsage.FOG0 = 9, 
        VertexElementUsage.POINTSIZE0 = 10, VertexElementUsage.SAMPLE0 = 11, VertexElementUsage.TESSELLATEFACTOR0 = 12, 
        VertexElementUsage.COLOR1 = 13, VertexElementUsage.NEXTTEXTURECOORDINATE0 = 14, 
        VertexElementUsage.TEXTURECOORDINATE1 = 15, VertexElementUsage.NEXTTEXTURECOORDINATE1 = 16, 
        VertexElementUsage.CORNERTEXTURECOORDINATE0 = 17, VertexElementUsage.VELOCITY0 = 18, 
        VertexElementUsage.STARTCOLOR0 = 19, VertexElementUsage.STARTSIZE = 20, VertexElementUsage.AGEADDSCALE0 = 21, 
        VertexElementUsage.STARTROTATION = 22, VertexElementUsage.ENDCOLOR0 = 23, VertexElementUsage.STARTLIFETIME = 24, 
        VertexElementUsage.TIME0 = 33, VertexElementUsage.SHAPEPOSITIONSTARTLIFETIME = 30, 
        VertexElementUsage.DIRECTIONTIME = 32, VertexElementUsage.SIZEROTATION0 = 27, VertexElementUsage.RADIUS0 = 28, 
        VertexElementUsage.RADIAN0 = 29, VertexElementUsage.STARTSPEED = 31, VertexElementUsage.RANDOM0 = 34, 
        VertexElementUsage.RANDOM1 = 35, VertexElementUsage.SIMULATIONWORLDPOSTION = 36, 
        VertexElementUsage.SIMULATIONWORLDROTATION = 37, VertexElementUsage.TEXTURECOORDINATE0X = 38, 
        VertexElementUsage.TEXTURECOORDINATE0X1 = 39, VertexElementUsage.TEXTURECOORDINATE0Y = 40, 
        VertexElementUsage.OFFSETVECTOR = 41;
    }(), function() {
        function VertexGlitter(position, textureCoordinate, time) {
            this._position = null, this._textureCoordinate0 = null, this._time = NaN, this._position = position, 
            this._textureCoordinate0 = textureCoordinate, this._time = time;
        }
        __class(VertexGlitter, "laya.d3.graphics.VertexGlitter");
        var __proto = VertexGlitter.prototype;
        Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "textureCoordinate", function() {
            return this._textureCoordinate0;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "time", function() {
            return this._time;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexGlitter._vertexDeclaration;
        }), __getset(1, VertexGlitter, "vertexDeclaration", function() {
            return VertexGlitter._vertexDeclaration;
        }), __static(VertexGlitter, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(24, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector2", 2), new VertexElement(20, "single", 33) ]);
        } ]);
    }(), function() {
        function VertexParticle(cornerTextureCoordinate, position, velocity, startColor, endColor, sizeRotation, radius, radian, ageAddScale, time) {
            this._cornerTextureCoordinate = null, this._position = null, this._velocity = null, 
            this._startColor = null, this._endColor = null, this._sizeRotation = null, this._radius = null, 
            this._radian = null, this._ageAddScale = NaN, this._time = NaN, this._cornerTextureCoordinate = cornerTextureCoordinate, 
            this._position = position, this._velocity = velocity, this._startColor = startColor, 
            this._endColor = endColor, this._sizeRotation = sizeRotation, this._radius = radius, 
            this._radian = radian, this._ageAddScale = ageAddScale, this._time = time;
        }
        __class(VertexParticle, "laya.d3.graphics.VertexParticle");
        var __proto = VertexParticle.prototype;
        Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "endColor", function() {
            return this._endColor;
        }), __getset(0, __proto, "cornerTextureCoordinate", function() {
            return this._cornerTextureCoordinate;
        }), __getset(0, __proto, "sizeRotation", function() {
            return this._sizeRotation;
        }), __getset(0, __proto, "velocity", function() {
            return this._velocity;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "startColor", function() {
            return this._startColor;
        }), __getset(0, __proto, "radius", function() {
            return this._radius;
        }), __getset(0, __proto, "radian", function() {
            return this._radian;
        }), __getset(0, __proto, "ageAddScale", function() {
            return this._ageAddScale;
        }), __getset(0, __proto, "time", function() {
            return this._time;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexParticle._vertexDeclaration;
        }), __getset(1, VertexParticle, "vertexDeclaration", function() {
            return VertexParticle._vertexDeclaration;
        }), __static(VertexParticle, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(116, [ new VertexElement(0, "vector4", 17), new VertexElement(16, "vector3", 0), new VertexElement(28, "vector3", 18), new VertexElement(40, "vector4", 19), new VertexElement(56, "vector4", 23), new VertexElement(72, "vector3", 27), new VertexElement(84, "vector2", 28), new VertexElement(92, "vector4", 29), new VertexElement(108, "single", 24), new VertexElement(112, "single", 33) ]);
        } ]);
    }(), function() {
        function VertexPosition(position) {
            this._position = null, this._position = position;
        }
        __class(VertexPosition, "laya.d3.graphics.VertexPosition");
        var __proto = VertexPosition.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPosition._vertexDeclaration;
        }), __getset(1, VertexPosition, "vertexDeclaration", function() {
            return VertexPosition._vertexDeclaration;
        }), __static(VertexPosition, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(12, [ new VertexElement(0, "vector3", 0) ]);
        } ]), VertexPosition;
    }()), VertexPositionNormal = function() {
        function VertexPositionNormal(position, normal) {
            this._position = null, this._normal = null, this._position = position, this._normal = normal;
        }
        __class(VertexPositionNormal, "laya.d3.graphics.VertexPositionNormal");
        var __proto = VertexPositionNormal.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormal._vertexDeclaration;
        }), __getset(1, VertexPositionNormal, "vertexDeclaration", function() {
            return VertexPositionNormal._vertexDeclaration;
        }), __static(VertexPositionNormal, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(24, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3) ]);
        } ]), VertexPositionNormal;
    }(), VertexPositionNormalColor = function() {
        function VertexPositionNormalColor(position, normal, color) {
            this._position = null, this._normal = null, this._color = null, this._position = position, 
            this._normal = normal, this._color = color;
        }
        __class(VertexPositionNormalColor, "laya.d3.graphics.VertexPositionNormalColor");
        var __proto = VertexPositionNormalColor.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColor._vertexDeclaration;
        }), __getset(1, VertexPositionNormalColor, "vertexDeclaration", function() {
            return VertexPositionNormalColor._vertexDeclaration;
        }), __static(VertexPositionNormalColor, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(40, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1) ]);
        } ]), VertexPositionNormalColor;
    }(), VertexPositionNormalColorSkin = function() {
        function VertexPositionNormalColorSkin(position, normal, color, blendIndex, blendWeight) {
            this._position = null, this._normal = null, this._color = null, this._blendIndex = null, 
            this._blendWeight = null, this._position = position, this._normal = normal, this._color = color, 
            this._blendIndex = blendIndex, this._blendWeight = blendWeight;
        }
        __class(VertexPositionNormalColorSkin, "laya.d3.graphics.VertexPositionNormalColorSkin");
        var __proto = VertexPositionNormalColorSkin.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorSkin._vertexDeclaration;
        }), __getset(1, VertexPositionNormalColorSkin, "vertexDeclaration", function() {
            return VertexPositionNormalColorSkin._vertexDeclaration;
        }), __static(VertexPositionNormalColorSkin, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(72, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector4", 7), new VertexElement(56, "vector4", 6) ]);
        } ]), VertexPositionNormalColorSkin;
    }(), VertexPositionNormalColorSkinSTangent = function() {
        function VertexPositionNormalColorSkinSTangent(position, normal, color, tangent, blendIndex, blendWeight) {
            this._position = null, this._normal = null, this._color = null, this._blendIndex = null, 
            this._blendWeight = null, this._tangent = null, this._position = position, this._normal = normal, 
            this._color = color, this._tangent = tangent, this._blendIndex = blendIndex, this._blendWeight = blendWeight;
        }
        __class(VertexPositionNormalColorSkinSTangent, "laya.d3.graphics.VertexPositionNormalColorSkinSTangent");
        var __proto = VertexPositionNormalColorSkinSTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorSkinSTangent._vertexDeclaration;
        }), __getset(1, VertexPositionNormalColorSkinSTangent, "vertexDeclaration", function() {
            return VertexPositionNormalColorSkinSTangent._vertexDeclaration;
        }), __static(VertexPositionNormalColorSkinSTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(88, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector4", 7), new VertexElement(56, "vector4", 6), new VertexElement(72, "vector4", 5) ]);
        } ]), VertexPositionNormalColorSkinSTangent;
    }(), VertexPositionNormalColorSkinTangent = function() {
        function VertexPositionNormalColorSkinTangent(position, normal, color, tangent, blendIndex, blendWeight) {
            this._position = null, this._normal = null, this._color = null, this._blendIndex = null, 
            this._blendWeight = null, this._tangent = null, this._position = position, this._normal = normal, 
            this._color = color, this._tangent = tangent, this._blendIndex = blendIndex, this._blendWeight = blendWeight;
        }
        __class(VertexPositionNormalColorSkinTangent, "laya.d3.graphics.VertexPositionNormalColorSkinTangent");
        var __proto = VertexPositionNormalColorSkinTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorSkinTangent._vertexDeclaration;
        }), __getset(1, VertexPositionNormalColorSkinTangent, "vertexDeclaration", function() {
            return VertexPositionNormalColorSkinTangent._vertexDeclaration;
        }), __static(VertexPositionNormalColorSkinTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(84, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector4", 7), new VertexElement(56, "vector4", 6), new VertexElement(72, "vector3", 5) ]);
        } ]), VertexPositionNormalColorSkinTangent;
    }(), VertexPositionNormalColorSTangent = function() {
        function VertexPositionNormalColorSTangent(position, normal, color, tangent) {
            this._position = null, this._normal = null, this._color = null, this._tangent = null, 
            this._position = position, this._normal = normal, this._color = color, this._tangent = tangent;
        }
        __class(VertexPositionNormalColorSTangent, "laya.d3.graphics.VertexPositionNormalColorSTangent");
        var __proto = VertexPositionNormalColorSTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorSTangent._vertexDeclaration;
        }), __getset(1, VertexPositionNormalColorSTangent, "vertexDeclaration", function() {
            return VertexPositionNormalColorSTangent._vertexDeclaration;
        }), __static(VertexPositionNormalColorSTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(56, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector4", 5) ]);
        } ]), VertexPositionNormalColorSTangent;
    }(), VertexPositionNormalColorTangent = function() {
        function VertexPositionNormalColorTangent(position, normal, color, tangent) {
            this._position = null, this._normal = null, this._color = null, this._tangent = null, 
            this._position = position, this._normal = normal, this._color = color, this._tangent = tangent;
        }
        __class(VertexPositionNormalColorTangent, "laya.d3.graphics.VertexPositionNormalColorTangent");
        var __proto = VertexPositionNormalColorTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorTangent._vertexDeclaration;
        }), __getset(1, VertexPositionNormalColorTangent, "vertexDeclaration", function() {
            return VertexPositionNormalColorTangent._vertexDeclaration;
        }), __static(VertexPositionNormalColorTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(52, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector3", 5) ]);
        } ]), VertexPositionNormalColorTangent;
    }(), VertexPositionNormalColorTexture = function() {
        function VertexPositionNormalColorTexture(position, normal, color, textureCoordinate) {
            this._position = null, this._normal = null, this._color = null, this._textureCoordinate = null, 
            this._position = position, this._normal = normal, this._color = color, this._textureCoordinate = textureCoordinate;
        }
        __class(VertexPositionNormalColorTexture, "laya.d3.graphics.VertexPositionNormalColorTexture");
        var __proto = VertexPositionNormalColorTexture.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "textureCoordinate", function() {
            return this._textureCoordinate;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorTexture._vertexDeclaration;
        }), __getset(1, VertexPositionNormalColorTexture, "vertexDeclaration", function() {
            return VertexPositionNormalColorTexture._vertexDeclaration;
        }), __static(VertexPositionNormalColorTexture, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(48, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector2", 2) ]);
        } ]), VertexPositionNormalColorTexture;
    }(), VertexPositionNormalColorTexture0Texture1 = function() {
        function VertexPositionNormalColorTexture0Texture1(position, normal, color, textureCoordinate0, textureCoordinate1) {
            this._position = null, this._normal = null, this._color = null, this._textureCoordinate0 = null, 
            this._textureCoordinate1 = null, this._position = position, this._normal = normal, 
            this._color = color, this._textureCoordinate0 = textureCoordinate0, this._textureCoordinate1 = textureCoordinate1;
        }
        __class(VertexPositionNormalColorTexture0Texture1, "laya.d3.graphics.VertexPositionNormalColorTexture0Texture1");
        var __proto = VertexPositionNormalColorTexture0Texture1.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "textureCoordinate0", function() {
            return this._textureCoordinate0;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorTexture0Texture1._vertexDeclaration;
        }), __getset(0, __proto, "textureCoordinate1", function() {
            return this._textureCoordinate1;
        }), __getset(1, VertexPositionNormalColorTexture0Texture1, "vertexDeclaration", function() {
            return VertexPositionNormalColorTexture0Texture1._vertexDeclaration;
        }), __static(VertexPositionNormalColorTexture0Texture1, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(56, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector2", 2), new VertexElement(48, "vector2", 15) ]);
        } ]), VertexPositionNormalColorTexture0Texture1;
    }(), VertexPositionNormalColorTexture0Texture1Skin = function() {
        function VertexPositionNormalColorTexture0Texture1Skin(position, normal, color, textureCoordinate0, textureCoordinate1, blendIndex, blendWeight) {
            this._position = null, this._normal = null, this._color = null, this._textureCoordinate0 = null, 
            this._textureCoordinate1 = null, this._blendIndex = null, this._blendWeight = null, 
            this._position = position, this._normal = normal, this._color = color, this._textureCoordinate0 = textureCoordinate0, 
            this._textureCoordinate1 = textureCoordinate1, this._blendIndex = blendIndex, this._blendWeight = blendWeight;
        }
        __class(VertexPositionNormalColorTexture0Texture1Skin, "laya.d3.graphics.VertexPositionNormalColorTexture0Texture1Skin");
        var __proto = VertexPositionNormalColorTexture0Texture1Skin.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "textureCoordinate0", function() {
            return this._textureCoordinate0;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorTexture0Texture1Skin._vertexDeclaration;
        }), __getset(0, __proto, "textureCoordinate1", function() {
            return this._textureCoordinate1;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(1, VertexPositionNormalColorTexture0Texture1Skin, "vertexDeclaration", function() {
            return VertexPositionNormalColorTexture0Texture1Skin._vertexDeclaration;
        }), __static(VertexPositionNormalColorTexture0Texture1Skin, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(88, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector2", 2), new VertexElement(48, "vector2", 15), new VertexElement(56, "vector4", 7), new VertexElement(72, "vector4", 6) ]);
        } ]), VertexPositionNormalColorTexture0Texture1Skin;
    }(), VertexPositionNormalColorTexture0Texture1SkinSTangent = function() {
        function VertexPositionNormalColorTexture0Texture1SkinSTangent(position, normal, color, textureCoordinate0, textureCoordinate1, tangent, blendIndex, blendWeight) {
            this._position = null, this._normal = null, this._color = null, this._textureCoordinate0 = null, 
            this._textureCoordinate1 = null, this._blendIndex = null, this._blendWeight = null, 
            this._tangent = null, this._position = position, this._normal = normal, this._color = color, 
            this._textureCoordinate0 = textureCoordinate0, this._textureCoordinate1 = textureCoordinate1, 
            this._tangent = tangent, this._blendIndex = blendIndex, this._blendWeight = blendWeight;
        }
        __class(VertexPositionNormalColorTexture0Texture1SkinSTangent, "laya.d3.graphics.VertexPositionNormalColorTexture0Texture1SkinSTangent");
        var __proto = VertexPositionNormalColorTexture0Texture1SkinSTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "textureCoordinate0", function() {
            return this._textureCoordinate0;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorTexture0Texture1SkinSTangent._vertexDeclaration;
        }), __getset(0, __proto, "textureCoordinate1", function() {
            return this._textureCoordinate1;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(1, VertexPositionNormalColorTexture0Texture1SkinSTangent, "vertexDeclaration", function() {
            return VertexPositionNormalColorTexture0Texture1SkinSTangent._vertexDeclaration;
        }), __static(VertexPositionNormalColorTexture0Texture1SkinSTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(104, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector2", 2), new VertexElement(48, "vector2", 15), new VertexElement(56, "vector4", 7), new VertexElement(72, "vector4", 6), new VertexElement(88, "vector4", 5) ]);
        } ]), VertexPositionNormalColorTexture0Texture1SkinSTangent;
    }(), VertexPositionNormalColorTexture0Texture1SkinTangent = function() {
        function VertexPositionNormalColorTexture0Texture1SkinTangent() {
            this._position = null, this._normal = null, this._color = null, this._textureCoordinate0 = null, 
            this._textureCoordinate1 = null, this._blendIndex = null, this._blendWeight = null, 
            this._tangent = null;
        }
        __class(VertexPositionNormalColorTexture0Texture1SkinTangent, "laya.d3.graphics.VertexPositionNormalColorTexture0Texture1SkinTangent");
        var __proto = VertexPositionNormalColorTexture0Texture1SkinTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __proto.VertexPositionNormalColorTexture0SkinTangent = function(position, normal, color, textureCoordinate0, textureCoordinate1, tangent, blendIndex, blendWeight) {
            this._position = position, this._normal = normal, this._color = color, this._textureCoordinate0 = textureCoordinate0, 
            this._textureCoordinate1 = textureCoordinate1, this._tangent = tangent, this._blendIndex = blendIndex, 
            this._blendWeight = blendWeight;
        }, __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "textureCoordinate0", function() {
            return this._textureCoordinate0;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorTexture0Texture1SkinTangent._vertexDeclaration;
        }), __getset(0, __proto, "textureCoordinate1", function() {
            return this._textureCoordinate1;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(1, VertexPositionNormalColorTexture0Texture1SkinTangent, "vertexDeclaration", function() {
            return VertexPositionNormalColorTexture0Texture1SkinTangent._vertexDeclaration;
        }), __static(VertexPositionNormalColorTexture0Texture1SkinTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(100, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector2", 2), new VertexElement(48, "vector2", 15), new VertexElement(56, "vector4", 7), new VertexElement(72, "vector4", 6), new VertexElement(88, "vector3", 5) ]);
        } ]), VertexPositionNormalColorTexture0Texture1SkinTangent;
    }(), VertexPositionNormalColorTexture0Texture1STangent = function() {
        function VertexPositionNormalColorTexture0Texture1STangent(position, normal, color, textureCoordinate0, textureCoordinate1, tangent) {
            this._position = null, this._normal = null, this._color = null, this._textureCoordinate0 = null, 
            this._textureCoordinate1 = null, this._tangent = null, this._position = position, 
            this._normal = normal, this._color = color, this._textureCoordinate0 = textureCoordinate0, 
            this._textureCoordinate1 = textureCoordinate1, this._tangent = tangent;
        }
        __class(VertexPositionNormalColorTexture0Texture1STangent, "laya.d3.graphics.VertexPositionNormalColorTexture0Texture1STangent");
        var __proto = VertexPositionNormalColorTexture0Texture1STangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "textureCoordinate0", function() {
            return this._textureCoordinate0;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorTexture0Texture1STangent._vertexDeclaration;
        }), __getset(0, __proto, "textureCoordinate1", function() {
            return this._textureCoordinate1;
        }), __getset(1, VertexPositionNormalColorTexture0Texture1STangent, "vertexDeclaration", function() {
            return VertexPositionNormalColorTexture0Texture1STangent._vertexDeclaration;
        }), __static(VertexPositionNormalColorTexture0Texture1STangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(72, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector2", 2), new VertexElement(48, "vector2", 15), new VertexElement(56, "vector4", 5) ]);
        } ]), VertexPositionNormalColorTexture0Texture1STangent;
    }(), VertexPositionNormalColorTexture0Texture1Tangent = function() {
        function VertexPositionNormalColorTexture0Texture1Tangent() {
            this._position = null, this._normal = null, this._color = null, this._textureCoordinate0 = null, 
            this._textureCoordinate1 = null, this._tangent = null;
        }
        __class(VertexPositionNormalColorTexture0Texture1Tangent, "laya.d3.graphics.VertexPositionNormalColorTexture0Texture1Tangent");
        var __proto = VertexPositionNormalColorTexture0Texture1Tangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __proto.VertexPositionNormalColorTexture0Tangent = function(position, normal, color, textureCoordinate0, textureCoordinate1, tangent) {
            this._position = position, this._normal = normal, this._color = color, this._textureCoordinate0 = textureCoordinate0, 
            this._textureCoordinate1 = textureCoordinate1, this._tangent = tangent;
        }, __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "textureCoordinate0", function() {
            return this._textureCoordinate0;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorTexture0Texture1Tangent._vertexDeclaration;
        }), __getset(0, __proto, "textureCoordinate1", function() {
            return this._textureCoordinate1;
        }), __getset(1, VertexPositionNormalColorTexture0Texture1Tangent, "vertexDeclaration", function() {
            return VertexPositionNormalColorTexture0Texture1Tangent._vertexDeclaration;
        }), __static(VertexPositionNormalColorTexture0Texture1Tangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(68, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector2", 2), new VertexElement(48, "vector2", 15), new VertexElement(56, "vector3", 5) ]);
        } ]), VertexPositionNormalColorTexture0Texture1Tangent;
    }(), VertexPositionNormalColorTextureSkin = function() {
        function VertexPositionNormalColorTextureSkin(position, normal, color, textureCoordinate, blendIndex, blendWeight) {
            this._position = null, this._normal = null, this._color = null, this._textureCoordinate = null, 
            this._blendIndex = null, this._blendWeight = null, this._position = position, this._normal = normal, 
            this._color = color, this._textureCoordinate = textureCoordinate, this._blendIndex = blendIndex, 
            this._blendWeight = blendWeight;
        }
        __class(VertexPositionNormalColorTextureSkin, "laya.d3.graphics.VertexPositionNormalColorTextureSkin");
        var __proto = VertexPositionNormalColorTextureSkin.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "textureCoordinate", function() {
            return this._textureCoordinate;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorTextureSkin._vertexDeclaration;
        }), __getset(1, VertexPositionNormalColorTextureSkin, "vertexDeclaration", function() {
            return VertexPositionNormalColorTextureSkin._vertexDeclaration;
        }), __static(VertexPositionNormalColorTextureSkin, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(80, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector2", 2), new VertexElement(48, "vector4", 7), new VertexElement(64, "vector4", 6) ]);
        } ]), VertexPositionNormalColorTextureSkin;
    }(), VertexPositionNormalColorTextureSkinSTangent = function() {
        function VertexPositionNormalColorTextureSkinSTangent(position, normal, color, textureCoordinate, tangent, blendIndex, blendWeight) {
            this._position = null, this._normal = null, this._color = null, this._textureCoordinate = null, 
            this._blendIndex = null, this._blendWeight = null, this._tangent = null, this._position = position, 
            this._normal = normal, this._color = color, this._textureCoordinate = textureCoordinate, 
            this._tangent = tangent, this._blendIndex = blendIndex, this._blendWeight = blendWeight;
        }
        __class(VertexPositionNormalColorTextureSkinSTangent, "laya.d3.graphics.VertexPositionNormalColorTextureSkinSTangent");
        var __proto = VertexPositionNormalColorTextureSkinSTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "textureCoordinate", function() {
            return this._textureCoordinate;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorTextureSkinSTangent._vertexDeclaration;
        }), __getset(1, VertexPositionNormalColorTextureSkinSTangent, "vertexDeclaration", function() {
            return VertexPositionNormalColorTextureSkinSTangent._vertexDeclaration;
        }), __static(VertexPositionNormalColorTextureSkinSTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(96, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector2", 2), new VertexElement(48, "vector4", 7), new VertexElement(64, "vector4", 6), new VertexElement(80, "vector4", 5) ]);
        } ]), VertexPositionNormalColorTextureSkinSTangent;
    }(), VertexPositionNormalColorTextureSkinTangent = function() {
        function VertexPositionNormalColorTextureSkinTangent(position, normal, color, textureCoordinate, tangent, blendIndex, blendWeight) {
            this._position = null, this._normal = null, this._color = null, this._textureCoordinate = null, 
            this._blendIndex = null, this._blendWeight = null, this._tangent = null, this._position = position, 
            this._normal = normal, this._color = color, this._textureCoordinate = textureCoordinate, 
            this._tangent = tangent, this._blendIndex = blendIndex, this._blendWeight = blendWeight;
        }
        __class(VertexPositionNormalColorTextureSkinTangent, "laya.d3.graphics.VertexPositionNormalColorTextureSkinTangent");
        var __proto = VertexPositionNormalColorTextureSkinTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "textureCoordinate", function() {
            return this._textureCoordinate;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorTextureSkinTangent._vertexDeclaration;
        }), __getset(1, VertexPositionNormalColorTextureSkinTangent, "vertexDeclaration", function() {
            return VertexPositionNormalColorTextureSkinTangent._vertexDeclaration;
        }), __static(VertexPositionNormalColorTextureSkinTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(92, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector2", 2), new VertexElement(48, "vector4", 7), new VertexElement(64, "vector4", 6), new VertexElement(80, "vector3", 5) ]);
        } ]), VertexPositionNormalColorTextureSkinTangent;
    }(), VertexPositionNormalColorTextureSTangent = function() {
        function VertexPositionNormalColorTextureSTangent(position, normal, color, textureCoordinate, tangent) {
            this._position = null, this._normal = null, this._color = null, this._textureCoordinate = null, 
            this._tangent = null, this._position = position, this._normal = normal, this._color = color, 
            this._textureCoordinate = textureCoordinate, this._tangent = tangent;
        }
        __class(VertexPositionNormalColorTextureSTangent, "laya.d3.graphics.VertexPositionNormalColorTextureSTangent");
        var __proto = VertexPositionNormalColorTextureSTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "textureCoordinate", function() {
            return this._textureCoordinate;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorTextureSTangent._vertexDeclaration;
        }), __getset(1, VertexPositionNormalColorTextureSTangent, "vertexDeclaration", function() {
            return VertexPositionNormalColorTextureSTangent._vertexDeclaration;
        }), __static(VertexPositionNormalColorTextureSTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(64, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector2", 2), new VertexElement(48, "vector4", 5) ]);
        } ]), VertexPositionNormalColorTextureSTangent;
    }(), VertexPositionNormalColorTextureTangent = function() {
        function VertexPositionNormalColorTextureTangent(position, normal, color, textureCoordinate, tangent) {
            this._position = null, this._normal = null, this._color = null, this._textureCoordinate = null, 
            this._tangent = null, this._position = position, this._normal = normal, this._color = color, 
            this._textureCoordinate = textureCoordinate, this._tangent = tangent;
        }
        __class(VertexPositionNormalColorTextureTangent, "laya.d3.graphics.VertexPositionNormalColorTextureTangent");
        var __proto = VertexPositionNormalColorTextureTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "textureCoordinate", function() {
            return this._textureCoordinate;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "color", function() {
            return this._color;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalColorTextureTangent._vertexDeclaration;
        }), __getset(1, VertexPositionNormalColorTextureTangent, "vertexDeclaration", function() {
            return VertexPositionNormalColorTextureTangent._vertexDeclaration;
        }), __static(VertexPositionNormalColorTextureTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(60, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 1), new VertexElement(40, "vector2", 2), new VertexElement(48, "vector3", 5) ]);
        } ]), VertexPositionNormalColorTextureTangent;
    }(), VertexPositionNormalSTangent = function() {
        function VertexPositionNormalSTangent(position, normal, tangent) {
            this._position = null, this._normal = null, this._tangent = null, this._position = position, 
            this._normal = normal, this._tangent = tangent;
        }
        __class(VertexPositionNormalSTangent, "laya.d3.graphics.VertexPositionNormalSTangent");
        var __proto = VertexPositionNormalSTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalSTangent._vertexDeclaration;
        }), __getset(1, VertexPositionNormalSTangent, "vertexDeclaration", function() {
            return VertexPositionNormalSTangent._vertexDeclaration;
        }), __static(VertexPositionNormalSTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(40, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector4", 5) ]);
        } ]), VertexPositionNormalSTangent;
    }(), VertexPositionNormalTangent = function() {
        function VertexPositionNormalTangent(position, normal, tangent) {
            this._position = null, this._normal = null, this._tangent = null, this._position = position, 
            this._normal = normal, this._tangent = tangent;
        }
        __class(VertexPositionNormalTangent, "laya.d3.graphics.VertexPositionNormalTangent");
        var __proto = VertexPositionNormalTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalTangent._vertexDeclaration;
        }), __getset(1, VertexPositionNormalTangent, "vertexDeclaration", function() {
            return VertexPositionNormalTangent._vertexDeclaration;
        }), __static(VertexPositionNormalTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(36, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector3", 5) ]);
        } ]), VertexPositionNormalTangent;
    }(), VertexPositionNormalTexture = function() {
        function VertexPositionNormalTexture(position, normal, textureCoordinate) {
            this._position = null, this._normal = null, this._textureCoordinate = null, this._position = position, 
            this._normal = normal, this._textureCoordinate = textureCoordinate;
        }
        __class(VertexPositionNormalTexture, "laya.d3.graphics.VertexPositionNormalTexture");
        var __proto = VertexPositionNormalTexture.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "textureCoordinate", function() {
            return this._textureCoordinate;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalTexture._vertexDeclaration;
        }), __getset(1, VertexPositionNormalTexture, "vertexDeclaration", function() {
            return VertexPositionNormalTexture._vertexDeclaration;
        }), __static(VertexPositionNormalTexture, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(32, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector2", 2) ]);
        } ]), VertexPositionNormalTexture;
    }(), VertexPositionNormalTexture0Texture1 = function() {
        function VertexPositionNormalTexture0Texture1(position, normal, textureCoordinate0, textureCoordinate1) {
            this._position = null, this._normal = null, this._textureCoordinate0 = null, this._textureCoordinate1 = null, 
            this._position = position, this._normal = normal, this._textureCoordinate0 = textureCoordinate0, 
            this._textureCoordinate1 = textureCoordinate1;
        }
        __class(VertexPositionNormalTexture0Texture1, "laya.d3.graphics.VertexPositionNormalTexture0Texture1");
        var __proto = VertexPositionNormalTexture0Texture1.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "textureCoordinate0", function() {
            return this._textureCoordinate0;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalTexture0Texture1._vertexDeclaration;
        }), __getset(0, __proto, "textureCoordinate1", function() {
            return this._textureCoordinate1;
        }), __getset(1, VertexPositionNormalTexture0Texture1, "vertexDeclaration", function() {
            return VertexPositionNormalTexture0Texture1._vertexDeclaration;
        }), __static(VertexPositionNormalTexture0Texture1, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(40, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector2", 2), new VertexElement(32, "vector2", 15) ]);
        } ]), VertexPositionNormalTexture0Texture1;
    }(), VertexPositionNormalTexture0Texture1Skin = function() {
        function VertexPositionNormalTexture0Texture1Skin(position, normal, textureCoordinate0, textureCoordinate1, blendIndex, blendWeight) {
            this._position = null, this._normal = null, this._textureCoordinate0 = null, this._textureCoordinate1 = null, 
            this._blendIndex = null, this._blendWeight = null, this._position = position, this._normal = normal, 
            this._textureCoordinate0 = textureCoordinate0, this._textureCoordinate1 = textureCoordinate1, 
            this._blendIndex = blendIndex, this._blendWeight = blendWeight;
        }
        __class(VertexPositionNormalTexture0Texture1Skin, "laya.d3.graphics.VertexPositionNormalTexture0Texture1Skin");
        var __proto = VertexPositionNormalTexture0Texture1Skin.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "textureCoordinate0", function() {
            return this._textureCoordinate0;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalTexture0Texture1Skin._vertexDeclaration;
        }), __getset(0, __proto, "textureCoordinate1", function() {
            return this._textureCoordinate1;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(1, VertexPositionNormalTexture0Texture1Skin, "vertexDeclaration", function() {
            return VertexPositionNormalTexture0Texture1Skin._vertexDeclaration;
        }), __static(VertexPositionNormalTexture0Texture1Skin, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(72, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector2", 2), new VertexElement(32, "vector2", 15), new VertexElement(40, "vector4", 7), new VertexElement(56, "vector4", 6) ]);
        } ]), VertexPositionNormalTexture0Texture1Skin;
    }(), VertexPositionNormalTexture0Texture1SkinSTangent = function() {
        function VertexPositionNormalTexture0Texture1SkinSTangent(position, normal, textureCoordinate0, textureCoordinate1, tangent, blendIndex, blendWeight) {
            this._position = null, this._normal = null, this._textureCoordinate0 = null, this._textureCoordinate1 = null, 
            this._blendIndex = null, this._blendWeight = null, this._tangent = null, this._position = position, 
            this._normal = normal, this._textureCoordinate0 = textureCoordinate0, this._textureCoordinate1 = textureCoordinate1, 
            this._tangent = tangent, this._blendIndex = blendIndex, this._blendWeight = blendWeight;
        }
        __class(VertexPositionNormalTexture0Texture1SkinSTangent, "laya.d3.graphics.VertexPositionNormalTexture0Texture1SkinSTangent");
        var __proto = VertexPositionNormalTexture0Texture1SkinSTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "textureCoordinate0", function() {
            return this._textureCoordinate0;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalTexture0Texture1SkinSTangent._vertexDeclaration;
        }), __getset(0, __proto, "textureCoordinate1", function() {
            return this._textureCoordinate1;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(1, VertexPositionNormalTexture0Texture1SkinSTangent, "vertexDeclaration", function() {
            return VertexPositionNormalTexture0Texture1SkinSTangent._vertexDeclaration;
        }), __static(VertexPositionNormalTexture0Texture1SkinSTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(88, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector2", 2), new VertexElement(32, "vector2", 15), new VertexElement(40, "vector4", 7), new VertexElement(56, "vector4", 6), new VertexElement(72, "vector4", 5) ]);
        } ]), VertexPositionNormalTexture0Texture1SkinSTangent;
    }(), VertexPositionNormalTexture0Texture1SkinTangent = function() {
        function VertexPositionNormalTexture0Texture1SkinTangent() {
            this._position = null, this._normal = null, this._textureCoordinate0 = null, this._textureCoordinate1 = null, 
            this._blendIndex = null, this._blendWeight = null, this._tangent = null;
        }
        __class(VertexPositionNormalTexture0Texture1SkinTangent, "laya.d3.graphics.VertexPositionNormalTexture0Texture1SkinTangent");
        var __proto = VertexPositionNormalTexture0Texture1SkinTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __proto.VertexPositionNormalTexture0SkinTangent = function(position, normal, textureCoordinate0, textureCoordinate1, tangent, blendIndex, blendWeight) {
            this._position = position, this._normal = normal, this._textureCoordinate0 = textureCoordinate0, 
            this._textureCoordinate1 = textureCoordinate1, this._tangent = tangent, this._blendIndex = blendIndex, 
            this._blendWeight = blendWeight;
        }, __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "textureCoordinate0", function() {
            return this._textureCoordinate0;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalTexture0Texture1SkinTangent._vertexDeclaration;
        }), __getset(0, __proto, "textureCoordinate1", function() {
            return this._textureCoordinate1;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(1, VertexPositionNormalTexture0Texture1SkinTangent, "vertexDeclaration", function() {
            return VertexPositionNormalTexture0Texture1SkinTangent._vertexDeclaration;
        }), __static(VertexPositionNormalTexture0Texture1SkinTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(84, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector2", 2), new VertexElement(32, "vector2", 15), new VertexElement(40, "vector4", 7), new VertexElement(56, "vector4", 6), new VertexElement(72, "vector3", 5) ]);
        } ]), VertexPositionNormalTexture0Texture1SkinTangent;
    }(), VertexPositionNormalTexture0Texture1STangent = function() {
        function VertexPositionNormalTexture0Texture1STangent(position, normal, textureCoordinate0, textureCoordinate1, tangent) {
            this._position = null, this._normal = null, this._textureCoordinate0 = null, this._textureCoordinate1 = null, 
            this._tangent = null, this._position = position, this._normal = normal, this._textureCoordinate0 = textureCoordinate0, 
            this._textureCoordinate1 = textureCoordinate1, this._tangent = tangent;
        }
        __class(VertexPositionNormalTexture0Texture1STangent, "laya.d3.graphics.VertexPositionNormalTexture0Texture1STangent");
        var __proto = VertexPositionNormalTexture0Texture1STangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "textureCoordinate0", function() {
            return this._textureCoordinate0;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalTexture0Texture1STangent._vertexDeclaration;
        }), __getset(0, __proto, "textureCoordinate1", function() {
            return this._textureCoordinate1;
        }), __getset(1, VertexPositionNormalTexture0Texture1STangent, "vertexDeclaration", function() {
            return VertexPositionNormalTexture0Texture1STangent._vertexDeclaration;
        }), __static(VertexPositionNormalTexture0Texture1STangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(56, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector2", 2), new VertexElement(32, "vector2", 15), new VertexElement(40, "vector4", 5) ]);
        } ]), VertexPositionNormalTexture0Texture1STangent;
    }(), VertexPositionNormalTexture0Texture1Tangent = function() {
        function VertexPositionNormalTexture0Texture1Tangent() {
            this._position = null, this._normal = null, this._textureCoordinate0 = null, this._textureCoordinate1 = null, 
            this._tangent = null;
        }
        __class(VertexPositionNormalTexture0Texture1Tangent, "laya.d3.graphics.VertexPositionNormalTexture0Texture1Tangent");
        var __proto = VertexPositionNormalTexture0Texture1Tangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __proto.VertexPositionNormalTexture0Tangent = function(position, normal, textureCoordinate0, textureCoordinate1, tangent) {
            this._position = position, this._normal = normal, this._textureCoordinate0 = textureCoordinate0, 
            this._textureCoordinate1 = textureCoordinate1, this._tangent = tangent;
        }, __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "textureCoordinate0", function() {
            return this._textureCoordinate0;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalTexture0Texture1Tangent._vertexDeclaration;
        }), __getset(0, __proto, "textureCoordinate1", function() {
            return this._textureCoordinate1;
        }), __getset(1, VertexPositionNormalTexture0Texture1Tangent, "vertexDeclaration", function() {
            return VertexPositionNormalTexture0Texture1Tangent._vertexDeclaration;
        }), __static(VertexPositionNormalTexture0Texture1Tangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(52, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector2", 2), new VertexElement(32, "vector2", 15), new VertexElement(40, "vector3", 5) ]);
        } ]), VertexPositionNormalTexture0Texture1Tangent;
    }(), VertexPositionNormalTextureSkin = function() {
        function VertexPositionNormalTextureSkin(position, normal, textureCoordinate, blendIndex, blendWeight) {
            this._position = null, this._normal = null, this._textureCoordinate = null, this._blendIndex = null, 
            this._blendWeight = null, this._position = position, this._normal = normal, this._textureCoordinate = textureCoordinate, 
            this._blendIndex = blendIndex, this._blendWeight = blendWeight;
        }
        __class(VertexPositionNormalTextureSkin, "laya.d3.graphics.VertexPositionNormalTextureSkin");
        var __proto = VertexPositionNormalTextureSkin.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "textureCoordinate", function() {
            return this._textureCoordinate;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalTextureSkin._vertexDeclaration;
        }), __getset(1, VertexPositionNormalTextureSkin, "vertexDeclaration", function() {
            return VertexPositionNormalTextureSkin._vertexDeclaration;
        }), __static(VertexPositionNormalTextureSkin, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(64, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector2", 2), new VertexElement(32, "vector4", 7), new VertexElement(48, "vector4", 6) ]);
        } ]), VertexPositionNormalTextureSkin;
    }(), VertexPositionNormalTextureSkinSTangent = function() {
        function VertexPositionNormalTextureSkinSTangent(position, normal, textureCoordinate, tangent, blendIndex, blendWeight) {
            this._position = null, this._normal = null, this._textureCoordinate = null, this._blendIndex = null, 
            this._blendWeight = null, this._tangent = null, this._position = position, this._normal = normal, 
            this._textureCoordinate = textureCoordinate, this._tangent = tangent, this._blendIndex = blendIndex, 
            this._blendWeight = blendWeight;
        }
        __class(VertexPositionNormalTextureSkinSTangent, "laya.d3.graphics.VertexPositionNormalTextureSkinSTangent");
        var __proto = VertexPositionNormalTextureSkinSTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "textureCoordinate", function() {
            return this._textureCoordinate;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalTextureSkinSTangent._vertexDeclaration;
        }), __getset(1, VertexPositionNormalTextureSkinSTangent, "vertexDeclaration", function() {
            return VertexPositionNormalTextureSkinSTangent._vertexDeclaration;
        }), __static(VertexPositionNormalTextureSkinSTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(80, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector2", 2), new VertexElement(32, "vector4", 7), new VertexElement(48, "vector4", 6), new VertexElement(64, "vector4", 5) ]);
        } ]), VertexPositionNormalTextureSkinSTangent;
    }(), VertexPositionNormalTextureSkinTangent = function() {
        function VertexPositionNormalTextureSkinTangent(position, normal, textureCoordinate, tangent, blendIndex, blendWeight) {
            this._position = null, this._normal = null, this._textureCoordinate = null, this._blendIndex = null, 
            this._blendWeight = null, this._tangent = null, this._position = position, this._normal = normal, 
            this._textureCoordinate = textureCoordinate, this._tangent = tangent, this._blendIndex = blendIndex, 
            this._blendWeight = blendWeight;
        }
        __class(VertexPositionNormalTextureSkinTangent, "laya.d3.graphics.VertexPositionNormalTextureSkinTangent");
        var __proto = VertexPositionNormalTextureSkinTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "textureCoordinate", function() {
            return this._textureCoordinate;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalTextureSkinTangent._vertexDeclaration;
        }), __getset(1, VertexPositionNormalTextureSkinTangent, "vertexDeclaration", function() {
            return VertexPositionNormalTextureSkinTangent._vertexDeclaration;
        }), __static(VertexPositionNormalTextureSkinTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(76, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector2", 2), new VertexElement(32, "vector4", 7), new VertexElement(48, "vector4", 6), new VertexElement(64, "vector3", 5) ]);
        } ]), VertexPositionNormalTextureSkinTangent;
    }(), VertexPositionNormalTextureSTangent = function() {
        function VertexPositionNormalTextureSTangent(position, normal, textureCoordinate, tangent) {
            this._position = null, this._normal = null, this._textureCoordinate = null, this._tangent = null, 
            this._position = position, this._normal = normal, this._textureCoordinate = textureCoordinate, 
            this._tangent = tangent;
        }
        __class(VertexPositionNormalTextureSTangent, "laya.d3.graphics.VertexPositionNormalTextureSTangent");
        var __proto = VertexPositionNormalTextureSTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "textureCoordinate", function() {
            return this._textureCoordinate;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalTextureSTangent._vertexDeclaration;
        }), __getset(1, VertexPositionNormalTextureSTangent, "vertexDeclaration", function() {
            return VertexPositionNormalTextureSTangent._vertexDeclaration;
        }), __static(VertexPositionNormalTextureSTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(48, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector2", 2), new VertexElement(32, "vector4", 5) ]);
        } ]), VertexPositionNormalTextureSTangent;
    }(), VertexPositionNormalTextureTangent = function() {
        function VertexPositionNormalTextureTangent(position, normal, textureCoordinate, tangent) {
            this._position = null, this._normal = null, this._textureCoordinate = null, this._tangent = null, 
            this._position = position, this._normal = normal, this._textureCoordinate = textureCoordinate, 
            this._tangent = tangent;
        }
        __class(VertexPositionNormalTextureTangent, "laya.d3.graphics.VertexPositionNormalTextureTangent");
        var __proto = VertexPositionNormalTextureTangent.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "textureCoordinate", function() {
            return this._textureCoordinate;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNormalTextureTangent._vertexDeclaration;
        }), __getset(1, VertexPositionNormalTextureTangent, "vertexDeclaration", function() {
            return VertexPositionNormalTextureTangent._vertexDeclaration;
        }), __static(VertexPositionNormalTextureTangent, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(44, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector2", 2), new VertexElement(32, "vector3", 5) ]);
        } ]), VertexPositionNormalTextureTangent;
    }(), VertexPositionNTBTexture = function() {
        function VertexPositionNTBTexture(position, normal, textureCoordinate) {
            this._position = null, this._normal = null, this._textureCoordinate = null, this._position = position, 
            this._normal = normal, this._textureCoordinate = textureCoordinate;
        }
        __class(VertexPositionNTBTexture, "laya.d3.graphics.VertexPositionNTBTexture");
        var __proto = VertexPositionNTBTexture.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "textureCoordinate", function() {
            return this._textureCoordinate;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNTBTexture._vertexDeclaration;
        }), __getset(1, VertexPositionNTBTexture, "vertexDeclaration", function() {
            return VertexPositionNTBTexture._vertexDeclaration;
        }), __static(VertexPositionNTBTexture, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(56, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector3", 5), new VertexElement(36, "vector3", 4), new VertexElement(48, "vector2", 2) ]);
        } ]), VertexPositionNTBTexture;
    }(), VertexPositionNTBTexture0Texture1Skin = function() {
        function VertexPositionNTBTexture0Texture1Skin(position, normal, binormal, textureCoordinate0, textureCoordinate1, tangent, blendIndex, blendWeight) {
            this._position = null, this._normal = null, this._textureCoordinate0 = null, this._textureCoordinate1 = null, 
            this._blendIndex = null, this._blendWeight = null, this._tangent = null, this.binormal = null, 
            this._position = position, this._normal = normal, this._textureCoordinate0 = textureCoordinate0, 
            this._textureCoordinate1 = textureCoordinate1, this._tangent = tangent, binormal = binormal, 
            this._blendIndex = blendIndex, this._blendWeight = blendWeight;
        }
        __class(VertexPositionNTBTexture0Texture1Skin, "laya.d3.graphics.VertexPositionNTBTexture0Texture1Skin");
        var __proto = VertexPositionNTBTexture0Texture1Skin.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "tangent", function() {
            return this._tangent;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "textureCoordinate0", function() {
            return this._textureCoordinate0;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNTBTexture0Texture1Skin._vertexDeclaration;
        }), __getset(0, __proto, "textureCoordinate1", function() {
            return this._textureCoordinate1;
        }), __getset(0, __proto, "blendIndex", function() {
            return this._blendIndex;
        }), __getset(0, __proto, "blendWeight", function() {
            return this._blendWeight;
        }), __getset(1, VertexPositionNTBTexture0Texture1Skin, "vertexDeclaration", function() {
            return VertexPositionNTBTexture0Texture1Skin._vertexDeclaration;
        }), __static(VertexPositionNTBTexture0Texture1Skin, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(96, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector3", 5), new VertexElement(36, "vector3", 4), new VertexElement(48, "vector2", 2), new VertexElement(56, "vector2", 15), new VertexElement(64, "vector4", 7), new VertexElement(80, "vector4", 6) ]);
        } ]), VertexPositionNTBTexture0Texture1Skin;
    }(), VertexPositionNTBTextureSkin = function() {
        function VertexPositionNTBTextureSkin(position, normal, textureCoordinate) {
            this._position = null, this._normal = null, this._textureCoordinate = null, this._position = position, 
            this._normal = normal, this._textureCoordinate = textureCoordinate;
        }
        __class(VertexPositionNTBTextureSkin, "laya.d3.graphics.VertexPositionNTBTextureSkin");
        var __proto = VertexPositionNTBTextureSkin.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "textureCoordinate", function() {
            return this._textureCoordinate;
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionNTBTextureSkin._vertexDeclaration;
        }), __getset(1, VertexPositionNTBTextureSkin, "vertexDeclaration", function() {
            return VertexPositionNTBTextureSkin._vertexDeclaration;
        }), __static(VertexPositionNTBTextureSkin, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(88, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector3", 5), new VertexElement(36, "vector3", 4), new VertexElement(48, "vector2", 2), new VertexElement(56, "vector4", 7), new VertexElement(72, "vector4", 6) ]);
        } ]), VertexPositionNTBTextureSkin;
    }(), VertexPositionTexture0 = (function() {
        function VertexPositionTerrain(position, normal, textureCoord0, textureCoord1) {
            this._position = null, this._normal = null, this._textureCoord0 = null, this._textureCoord1 = null, 
            this._position = position, this._normal = normal, this._textureCoord0 = textureCoord0, 
            this._textureCoord1 = textureCoord1;
        }
        __class(VertexPositionTerrain, "laya.d3.graphics.VertexPositionTerrain");
        var __proto = VertexPositionTerrain.prototype;
        Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "normal", function() {
            return this._normal;
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "textureCoord0", function() {
            return this._textureCoord0;
        }), __getset(0, __proto, "textureCoord1", function() {
            return this._textureCoord1;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionTerrain._vertexDeclaration;
        }), __getset(1, VertexPositionTerrain, "vertexDeclaration", function() {
            return VertexPositionTerrain._vertexDeclaration;
        }), __static(VertexPositionTerrain, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(40, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector3", 3), new VertexElement(24, "vector2", 2), new VertexElement(32, "vector2", 15) ]);
        } ]);
    }(), function() {
        function VertexPositionTexture0(position, textureCoordinate0) {
            this._position = null, this._textureCoordinate0 = null, this._position = position, 
            this._textureCoordinate0 = textureCoordinate0;
        }
        __class(VertexPositionTexture0, "laya.d3.graphics.VertexPositionTexture0");
        var __proto = VertexPositionTexture0.prototype;
        return Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "position", function() {
            return this._position;
        }), __getset(0, __proto, "textureCoordinate0", function() {
            return this._textureCoordinate0;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexPositionTexture0._vertexDeclaration;
        }), __getset(1, VertexPositionTexture0, "vertexDeclaration", function() {
            return VertexPositionTexture0._vertexDeclaration;
        }), __static(VertexPositionTexture0, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(20, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector2", 2) ]);
        } ]), VertexPositionTexture0;
    }()), LoadModelV01 = (function() {
        function VertexShurikenParticleBillboard(cornerTextureCoordinate, positionStartLifeTime, velocity, startColor, startSize, startRotation0, startRotation1, startRotation2, ageAddScale, time, startSpeed, randoms0, randoms1, simulationWorldPostion) {
            this._cornerTextureCoordinate = null, this._positionStartLifeTime = null, this._velocity = null, 
            this._startColor = null, this._startSize = null, this._startRotation0 = null, this._startRotation1 = null, 
            this._startRotation2 = null, this._startLifeTime = NaN, this._time = NaN, this._startSpeed = NaN, 
            this._randoms0 = null, this._randoms1 = null, this._simulationWorldPostion = null, 
            this._cornerTextureCoordinate = cornerTextureCoordinate, this._positionStartLifeTime = positionStartLifeTime, 
            this._velocity = velocity, this._startColor = startColor, this._startSize = startSize, 
            this._startRotation0 = startRotation0, this._startRotation1 = startRotation1, this._startRotation2 = startRotation2, 
            this._startLifeTime = ageAddScale, this._time = time, this._startSpeed = startSpeed, 
            this._randoms0 = this.random0, this._randoms1 = this.random1, this._simulationWorldPostion = simulationWorldPostion;
        }
        __class(VertexShurikenParticleBillboard, "laya.d3.graphics.VertexShurikenParticleBillboard");
        var __proto = VertexShurikenParticleBillboard.prototype;
        Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "cornerTextureCoordinate", function() {
            return this._cornerTextureCoordinate;
        }), __getset(0, __proto, "random1", function() {
            return this._randoms1;
        }), __getset(0, __proto, "startRotation2", function() {
            return this._startRotation2;
        }), __getset(0, __proto, "positionStartLifeTime", function() {
            return this._positionStartLifeTime;
        }), __getset(0, __proto, "velocity", function() {
            return this._velocity;
        }), __getset(0, __proto, "random0", function() {
            return this._randoms0;
        }), __getset(0, __proto, "startSize", function() {
            return this._startSize;
        }), __getset(0, __proto, "startColor", function() {
            return this._startColor;
        }), __getset(0, __proto, "startRotation0", function() {
            return this._startRotation0;
        }), __getset(0, __proto, "startRotation1", function() {
            return this._startRotation1;
        }), __getset(0, __proto, "startLifeTime", function() {
            return this._startLifeTime;
        }), __getset(0, __proto, "time", function() {
            return this._time;
        }), __getset(0, __proto, "startSpeed", function() {
            return this._startSpeed;
        }), __getset(0, __proto, "simulationWorldPostion", function() {
            return this._simulationWorldPostion;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexShurikenParticleBillboard._vertexDeclaration;
        }), __getset(1, VertexShurikenParticleBillboard, "vertexDeclaration", function() {
            return VertexShurikenParticleBillboard._vertexDeclaration;
        }), __static(VertexShurikenParticleBillboard, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(152, [ new VertexElement(0, "vector4", 17), new VertexElement(16, "vector4", 30), new VertexElement(32, "vector4", 32), new VertexElement(48, "vector4", 19), new VertexElement(64, "vector3", 20), new VertexElement(76, "vector3", 22), new VertexElement(88, "single", 31), new VertexElement(92, "vector4", 34), new VertexElement(108, "vector4", 35), new VertexElement(124, "vector3", 36), new VertexElement(136, "vector4", 37) ]);
        } ]);
    }(), function() {
        function VertexShurikenParticleMesh(cornerTextureCoordinate, positionStartLifeTime, velocity, startColor, startSize, startRotation0, startRotation1, startRotation2, ageAddScale, time, startSpeed, randoms0, randoms1, simulationWorldPostion) {
            this._cornerTextureCoordinate = null, this._positionStartLifeTime = null, this._velocity = null, 
            this._startColor = null, this._startSize = null, this._startRotation0 = null, this._startRotation1 = null, 
            this._startRotation2 = null, this._startLifeTime = NaN, this._time = NaN, this._startSpeed = NaN, 
            this._randoms0 = null, this._randoms1 = null, this._simulationWorldPostion = null, 
            this._cornerTextureCoordinate = cornerTextureCoordinate, this._positionStartLifeTime = positionStartLifeTime, 
            this._velocity = velocity, this._startColor = startColor, this._startSize = startSize, 
            this._startRotation0 = startRotation0, this._startRotation1 = startRotation1, this._startRotation2 = startRotation2, 
            this._startLifeTime = ageAddScale, this._time = time, this._startSpeed = startSpeed, 
            this._randoms0 = this.random0, this._randoms1 = this.random1, this._simulationWorldPostion = simulationWorldPostion;
        }
        __class(VertexShurikenParticleMesh, "laya.d3.graphics.VertexShurikenParticleMesh");
        var __proto = VertexShurikenParticleMesh.prototype;
        Laya.imps(__proto, {
            "laya.d3.graphics.IVertex": !0
        }), __getset(0, __proto, "cornerTextureCoordinate", function() {
            return this._cornerTextureCoordinate;
        }), __getset(0, __proto, "velocity", function() {
            return this._velocity;
        }), __getset(0, __proto, "position", function() {
            return this._positionStartLifeTime;
        }), __getset(0, __proto, "random0", function() {
            return this._randoms0;
        }), __getset(0, __proto, "startSize", function() {
            return this._startSize;
        }), __getset(0, __proto, "startColor", function() {
            return this._startColor;
        }), __getset(0, __proto, "startRotation0", function() {
            return this._startRotation0;
        }), __getset(0, __proto, "startRotation1", function() {
            return this._startRotation1;
        }), __getset(0, __proto, "random1", function() {
            return this._randoms1;
        }), __getset(0, __proto, "startRotation2", function() {
            return this._startRotation2;
        }), __getset(0, __proto, "startLifeTime", function() {
            return this._startLifeTime;
        }), __getset(0, __proto, "time", function() {
            return this._time;
        }), __getset(0, __proto, "startSpeed", function() {
            return this._startSpeed;
        }), __getset(0, __proto, "simulationWorldPostion", function() {
            return this._simulationWorldPostion;
        }), __getset(0, __proto, "vertexDeclaration", function() {
            return VertexShurikenParticleMesh._vertexDeclaration;
        }), __getset(1, VertexShurikenParticleMesh, "vertexDeclaration", function() {
            return VertexShurikenParticleMesh._vertexDeclaration;
        }), __static(VertexShurikenParticleMesh, [ "_vertexDeclaration", function() {
            return this._vertexDeclaration = new VertexDeclaration(172, [ new VertexElement(0, "vector3", 0), new VertexElement(12, "vector4", 1), new VertexElement(28, "vector2", 2), new VertexElement(36, "vector4", 30), new VertexElement(52, "vector4", 32), new VertexElement(68, "vector4", 19), new VertexElement(84, "vector3", 20), new VertexElement(96, "vector3", 22), new VertexElement(108, "single", 31), new VertexElement(112, "vector4", 34), new VertexElement(128, "vector4", 35), new VertexElement(144, "vector3", 36), new VertexElement(156, "vector4", 37) ]);
        } ]);
    }(), function() {
        function LoadModelV01(readData, version, mesh, materials, subMeshes, materialMap) {
            this._version = null, this._strings = [ "BLOCK", "DATA", "STRINGS" ], this._materials = null, 
            this._subMeshes = null, this._materialMap = null, this._readData = null, this._mesh = null, 
            this._BLOCK = {
                count: 0
            }, this._DATA = {
                offset: 0,
                size: 0
            }, this._STRINGS = {
                offset: 0,
                size: 0
            }, this._shaderAttributes = null, this._mesh = mesh, this._materials = materials, 
            this._subMeshes = subMeshes, this._materialMap = materialMap, this._version = version, 
            this._onLoaded(readData);
        }
        __class(LoadModelV01, "laya.d3.loaders.LoadModelV01");
        var __proto = LoadModelV01.prototype;
        return __proto._onLoaded = function(readData) {
            this._readData = readData, this.READ_BLOCK();
            for (var i = 0; i < this._BLOCK.count; i++) {
                var index = this._readData.getUint16(), blockName = this._strings[index], fn = this["READ_" + blockName];
                if (null == fn) throw new Error("model file err,no this function:" + index + " " + blockName);
                if (!fn.call(this)) break;
            }
            return this._mesh;
        }, __proto.onError = function() {}, __proto._readString = function() {
            return this._strings[this._readData.getUint16()];
        }, __proto.READ_BLOCK = function() {
            this._readData.getUint16();
            return this._BLOCK.count = this._readData.getUint16(), !0;
        }, __proto.READ_DATA = function() {
            return this._DATA.offset = this._readData.getUint32(), this._DATA.size = this._readData.getUint32(), 
            !0;
        }, __proto.READ_STRINGS = function() {
            this._STRINGS.offset = this._readData.getUint16(), this._STRINGS.size = this._readData.getUint16();
            var ofs = this._readData.pos;
            this._readData.pos = this._STRINGS.offset + this._DATA.offset;
            for (var i = 0; i < this._STRINGS.size; i++) this._strings[i] = this._readData.readUTFString();
            return this._readData.pos = ofs, !0;
        }, __proto.READ_MATERIAL = function() {
            var index = this._readData.getUint16(), url = (this._readString(), this._readString());
            return this._materials[index] = "null" !== url ? Loader.getRes(this._materialMap[url]) : new BaseMaterial(), 
            !0;
        }, __proto.READ_MESH = function() {
            this._readString();
            switch (this._version) {
              case "LAYAMODEL:01":
                console.log("Warning: The (.lm) file is converted by old fbxTools,please reConverted it use  lastest fbxTools version,later we will remove the  support of old version (.lm) support.");
                break;

              case "LAYASKINANI:01":
              case "LAYAMODEL:02":
                var n, arrayBuffer = this._readData.__getBuffer(), i = 0, bindPoseStart = this._readData.getUint32(), binPoseLength = this._readData.getUint32(), inverseGlobalBindPoseStart = (new Float32Array(arrayBuffer.slice(bindPoseStart + this._DATA.offset, bindPoseStart + this._DATA.offset + binPoseLength)), 
                this._readData.getUint32()), inverseGlobalBinPoseLength = this._readData.getUint32(), invGloBindPoseDatas = new Float32Array(arrayBuffer.slice(inverseGlobalBindPoseStart + this._DATA.offset, inverseGlobalBindPoseStart + this._DATA.offset + inverseGlobalBinPoseLength));
                for (this.mesh._inverseBindPoses = [], i = 0, n = invGloBindPoseDatas.length; i < n; i += 16) {
                    var inverseGlobalBindPose = new Matrix4x4(invGloBindPoseDatas[i + 0], invGloBindPoseDatas[i + 1], invGloBindPoseDatas[i + 2], invGloBindPoseDatas[i + 3], invGloBindPoseDatas[i + 4], invGloBindPoseDatas[i + 5], invGloBindPoseDatas[i + 6], invGloBindPoseDatas[i + 7], invGloBindPoseDatas[i + 8], invGloBindPoseDatas[i + 9], invGloBindPoseDatas[i + 10], invGloBindPoseDatas[i + 11], invGloBindPoseDatas[i + 12], invGloBindPoseDatas[i + 13], invGloBindPoseDatas[i + 14], invGloBindPoseDatas[i + 15]);
                    this.mesh._inverseBindPoses.push(inverseGlobalBindPose);
                }
                break;

              default:
                throw new Error("LoadModel:unknown version.");
            }
            return !0;
        }, __proto.READ_SUBMESH = function() {
            this._readString(), this._readData.getUint8();
            var bufferAttribute = this._readString();
            this._shaderAttributes = bufferAttribute.match(LoadModelV01._attrReg);
            var ibofs = this._readData.getUint32(), ibsize = this._readData.getUint32(), vbofs = (this._readData.getUint32(), 
            this._readData.getUint32(), this._readData.getUint32()), vbsize = this._readData.getUint32(), boneDicofs = this._readData.getUint32(), boneDicsize = this._readData.getUint32(), arrayBuffer = this._readData.__getBuffer(), submesh = new SubMesh(this._mesh), vertexDeclaration = this._getVertexDeclaration(), vb = VertexBuffer3D.create(vertexDeclaration, vbsize / vertexDeclaration.vertexStride, 35044, !0), vbStart = vbofs + this._DATA.offset, vbArrayBuffer = arrayBuffer.slice(vbStart, vbStart + vbsize);
            vb.setData(new Float32Array(vbArrayBuffer));
            for (var vertexElements = (submesh._vertexBuffer = vb).vertexDeclaration.getVertexElements(), i = 0; i < vertexElements.length; i++) submesh._bufferUsage[vertexElements[i].elementUsage] = vb;
            var ib = IndexBuffer3D.create("ushort", ibsize / 2, 35044, !0), ibStart = ibofs + this._DATA.offset, ibArrayBuffer = arrayBuffer.slice(ibStart, ibStart + ibsize);
            ib.setData(new Uint16Array(ibArrayBuffer)), submesh._indexBuffer = ib;
            var boneDicArrayBuffer = arrayBuffer.slice(boneDicofs + this._DATA.offset, boneDicofs + this._DATA.offset + boneDicsize);
            return submesh._boneIndicesList[0] = new Uint8Array(boneDicArrayBuffer), this._subMeshes.push(submesh), 
            !0;
        }, __proto.READ_DATAAREA = function() {
            return !1;
        }, __proto._getVertexDeclaration = function() {
            for (var vertexDeclaration, position = !1, normal = !1, color = !1, texcoord0 = !1, texcoord1 = !1, tangent = !1, blendWeight = !1, blendIndex = !1, binormal = !1, i = 0; i < this._shaderAttributes.length; i += 8) switch (this._shaderAttributes[i]) {
              case "POSITION":
                position = !0;
                break;

              case "NORMAL":
                normal = !0;
                break;

              case "COLOR":
                color = !0;
                break;

              case "UV":
                texcoord0 = !0;
                break;

              case "UV1":
                texcoord1 = !0;
                break;

              case "BLENDWEIGHT":
                blendWeight = !0;
                break;

              case "BLENDINDICES":
                blendIndex = !0;
                break;

              case "TANGENT":
                tangent = !0;
                break;

              case "BINORMAL":
                binormal = !0;
            }
            return position && normal && color && texcoord0 && texcoord1 && blendWeight && blendIndex && tangent ? vertexDeclaration = VertexPositionNormalColorTexture0Texture1SkinTangent.vertexDeclaration : position && normal && color && texcoord0 && texcoord1 && blendWeight && blendIndex ? vertexDeclaration = VertexPositionNormalColorTexture0Texture1Skin.vertexDeclaration : position && normal && texcoord0 && texcoord1 && blendWeight && blendIndex && tangent ? vertexDeclaration = VertexPositionNormalTexture0Texture1SkinTangent.vertexDeclaration : position && normal && texcoord0 && texcoord1 && blendWeight && blendIndex ? vertexDeclaration = VertexPositionNormalTexture0Texture1Skin.vertexDeclaration : position && normal && color && texcoord0 && blendWeight && blendIndex && tangent ? vertexDeclaration = VertexPositionNormalColorTextureSkinTangent.vertexDeclaration : position && normal && color && texcoord0 && blendWeight && blendIndex ? vertexDeclaration = VertexPositionNormalColorTextureSkin.vertexDeclaration : position && normal && tangent && binormal && texcoord0 && blendWeight && blendIndex ? vertexDeclaration = VertexPositionNTBTextureSkin.vertexDeclaration : position && normal && texcoord0 && blendWeight && blendIndex && tangent ? vertexDeclaration = VertexPositionNormalTextureSkinTangent.vertexDeclaration : position && normal && texcoord0 && blendWeight && blendIndex ? vertexDeclaration = VertexPositionNormalTextureSkin.vertexDeclaration : position && normal && color && blendWeight && blendIndex && tangent ? vertexDeclaration = VertexPositionNormalColorSkinTangent.vertexDeclaration : position && normal && color && blendWeight && blendIndex ? vertexDeclaration = VertexPositionNormalColorSkin.vertexDeclaration : position && normal && color && texcoord0 && texcoord1 && tangent ? vertexDeclaration = VertexPositionNormalColorTexture0Texture1Tangent.vertexDeclaration : position && normal && color && texcoord0 && texcoord1 ? vertexDeclaration = VertexPositionNormalColorTexture0Texture1.vertexDeclaration : position && normal && texcoord0 && texcoord1 && tangent ? vertexDeclaration = VertexPositionNormalTexture0Texture1Tangent.vertexDeclaration : position && normal && texcoord0 && texcoord1 ? vertexDeclaration = VertexPositionNormalTexture0Texture1.vertexDeclaration : position && normal && color && texcoord0 && tangent ? vertexDeclaration = VertexPositionNormalColorTextureTangent.vertexDeclaration : position && normal && texcoord0 && tangent && binormal ? vertexDeclaration = VertexPositionNTBTexture.vertexDeclaration : position && normal && color && texcoord0 ? vertexDeclaration = VertexPositionNormalColorTexture.vertexDeclaration : position && normal && texcoord0 && tangent ? vertexDeclaration = VertexPositionNormalTextureTangent.vertexDeclaration : position && normal && texcoord0 ? vertexDeclaration = VertexPositionNormalTexture.vertexDeclaration : position && normal && color && tangent ? vertexDeclaration = VertexPositionNormalColorTangent.vertexDeclaration : position && normal && color && (vertexDeclaration = VertexPositionNormalColor.vertexDeclaration), 
            vertexDeclaration;
        }, __getset(0, __proto, "mesh", function() {
            return this._mesh;
        }), LoadModelV01._attrReg = new RegExp("(\\w+)|([:,;])", "g"), LoadModelV01;
    }()), LoadModelV02 = function() {
        function LoadModelV02() {}
        return __class(LoadModelV02, "laya.d3.loaders.LoadModelV02"), LoadModelV02.parse = function(readData, version, mesh, materials, subMeshes, materialMap) {
            LoadModelV02._mesh = mesh, LoadModelV02._materials = materials, LoadModelV02._subMeshes = subMeshes, 
            LoadModelV02._materialMap = materialMap, LoadModelV02._version = version, LoadModelV02._readData = readData, 
            LoadModelV02.READ_DATA(), LoadModelV02.READ_BLOCK(), LoadModelV02.READ_STRINGS();
            for (var i = 0, n = LoadModelV02._BLOCK.count; i < n; i++) {
                LoadModelV02._readData.pos = LoadModelV02._BLOCK.blockStarts[i];
                var index = LoadModelV02._readData.getUint16(), blockName = LoadModelV02._strings[index], fn = LoadModelV02["READ_" + blockName];
                if (null == fn) throw new Error("model file err,no this function:" + index + " " + blockName);
                fn.call();
            }
            LoadModelV02._strings.length = 0, LoadModelV02._readData = null, LoadModelV02._version = null, 
            LoadModelV02._mesh = null, LoadModelV02._materials = null, LoadModelV02._subMeshes = null, 
            LoadModelV02._materialMap = null;
        }, LoadModelV02._readString = function() {
            return LoadModelV02._strings[LoadModelV02._readData.getUint16()];
        }, LoadModelV02.READ_DATA = function() {
            LoadModelV02._DATA.offset = LoadModelV02._readData.getUint32(), LoadModelV02._DATA.size = LoadModelV02._readData.getUint32();
        }, LoadModelV02.READ_BLOCK = function() {
            for (var count = LoadModelV02._BLOCK.count = LoadModelV02._readData.getUint16(), blockStarts = LoadModelV02._BLOCK.blockStarts = [], blockLengths = LoadModelV02._BLOCK.blockLengths = [], i = 0; i < count; i++) blockStarts.push(LoadModelV02._readData.getUint32()), 
            blockLengths.push(LoadModelV02._readData.getUint32());
        }, LoadModelV02.READ_STRINGS = function() {
            var offset = LoadModelV02._readData.getUint32(), count = LoadModelV02._readData.getUint16(), prePos = LoadModelV02._readData.pos;
            LoadModelV02._readData.pos = offset + LoadModelV02._DATA.offset;
            for (var i = 0; i < count; i++) LoadModelV02._strings[i] = LoadModelV02._readData.readUTFString();
            LoadModelV02._readData.pos = prePos;
        }, LoadModelV02.READ_MATERIAL = function() {
            LoadModelV02._readString(), LoadModelV02._readString();
            var url = LoadModelV02._readString();
            return "" !== url && LoadModelV02._materials.push(Loader.getRes(LoadModelV02._materialMap[url])), 
            !0;
        }, LoadModelV02.READ_MESH = function() {
            LoadModelV02._readString();
            var n, arrayBuffer = LoadModelV02._readData.__getBuffer(), i = 0, vertexBufferCount = LoadModelV02._readData.getInt16(), offset = LoadModelV02._DATA.offset;
            for (i = 0; i < vertexBufferCount; i++) {
                var vbStart = offset + LoadModelV02._readData.getUint32(), vbLength = LoadModelV02._readData.getUint32(), vbDatas = new Float32Array(arrayBuffer.slice(vbStart, vbStart + vbLength)), shaderAttributes = LoadModelV02._readString().match(LoadModelV02._attrReg), vertexDeclaration = LoadModelV02._getVertexDeclaration(shaderAttributes), vertexBuffer = VertexBuffer3D.create(vertexDeclaration, 4 * vbDatas.length / vertexDeclaration.vertexStride, 35044, !0);
                vertexBuffer.setData(vbDatas), LoadModelV02._mesh._vertexBuffers.push(vertexBuffer);
            }
            var ibStart = offset + LoadModelV02._readData.getUint32(), ibLength = LoadModelV02._readData.getUint32(), ibDatas = new Uint16Array(arrayBuffer.slice(ibStart, ibStart + ibLength)), indexBuffer = IndexBuffer3D.create("ushort", ibLength / 2, 35044, !0);
            indexBuffer.setData(ibDatas), LoadModelV02._mesh._indexBuffer = indexBuffer;
            var boneNames = LoadModelV02._mesh._boneNames = [], boneCount = LoadModelV02._readData.getUint16();
            for (boneNames.length = boneCount, i = 0; i < boneCount; i++) boneNames[i] = LoadModelV02._strings[LoadModelV02._readData.getUint16()];
            var bindPoseStart = LoadModelV02._readData.getUint32(), binPoseLength = LoadModelV02._readData.getUint32(), inverseGlobalBindPoseStart = (new Float32Array(arrayBuffer.slice(offset + bindPoseStart, offset + bindPoseStart + binPoseLength)), 
            LoadModelV02._readData.getUint32()), inverseGlobalBinPoseLength = LoadModelV02._readData.getUint32(), invGloBindPoseDatas = new Float32Array(arrayBuffer.slice(offset + inverseGlobalBindPoseStart, offset + inverseGlobalBindPoseStart + inverseGlobalBinPoseLength));
            for (LoadModelV02._mesh._inverseBindPoses = [], i = 0, n = invGloBindPoseDatas.length; i < n; i += 16) {
                var inverseGlobalBindPose = new Matrix4x4(invGloBindPoseDatas[i + 0], invGloBindPoseDatas[i + 1], invGloBindPoseDatas[i + 2], invGloBindPoseDatas[i + 3], invGloBindPoseDatas[i + 4], invGloBindPoseDatas[i + 5], invGloBindPoseDatas[i + 6], invGloBindPoseDatas[i + 7], invGloBindPoseDatas[i + 8], invGloBindPoseDatas[i + 9], invGloBindPoseDatas[i + 10], invGloBindPoseDatas[i + 11], invGloBindPoseDatas[i + 12], invGloBindPoseDatas[i + 13], invGloBindPoseDatas[i + 14], invGloBindPoseDatas[i + 15]);
                LoadModelV02._mesh._inverseBindPoses.push(inverseGlobalBindPose);
            }
            return LoadModelV02._mesh._skinnedDatas = new Float32Array(16 * invGloBindPoseDatas.length), 
            !0;
        }, LoadModelV02.READ_SUBMESH = function() {
            var arrayBuffer = LoadModelV02._readData.__getBuffer(), submesh = new SubMesh(LoadModelV02._mesh), vbIndex = LoadModelV02._readData.getInt16(), vbStart = LoadModelV02._readData.getUint32(), vbLength = LoadModelV02._readData.getUint32();
            submesh._vertexBuffer = LoadModelV02._mesh._vertexBuffers[vbIndex], submesh._vertexStart = vbStart, 
            submesh._vertexCount = vbLength;
            var ibStart = LoadModelV02._readData.getUint32(), ibCount = LoadModelV02._readData.getUint32(), indexBuffer = LoadModelV02._mesh._indexBuffer;
            submesh._indexBuffer = indexBuffer, submesh._indexStart = ibStart, submesh._indexCount = ibCount, 
            submesh._indices = new Uint16Array(indexBuffer.getData().buffer, 2 * ibStart, ibCount);
            var offset = LoadModelV02._DATA.offset, subIndexBufferStart = submesh._subIndexBufferStart, subIndexBufferCount = submesh._subIndexBufferCount, boneIndicesList = submesh._boneIndicesList, drawCount = LoadModelV02._readData.getUint16();
            subIndexBufferStart.length = drawCount, subIndexBufferCount.length = drawCount, 
            boneIndicesList.length = drawCount;
            for (var i = 0; i < drawCount; i++) {
                subIndexBufferStart[i] = LoadModelV02._readData.getUint32(), subIndexBufferCount[i] = LoadModelV02._readData.getUint32();
                var boneDicofs = LoadModelV02._readData.getUint32(), boneDicsize = LoadModelV02._readData.getUint32();
                submesh._boneIndicesList[i] = new Uint8Array(arrayBuffer.slice(offset + boneDicofs, offset + boneDicofs + boneDicsize));
            }
            return LoadModelV02._subMeshes.push(submesh), !0;
        }, LoadModelV02._getVertexDeclaration = function(shaderAttributes) {
            for (var vertexDeclaration, position = !1, normal = !1, color = !1, texcoord0 = !1, texcoord1 = !1, tangent = !1, blendWeight = !1, blendIndex = !1, binormal = !1, i = 0; i < shaderAttributes.length; i++) switch (shaderAttributes[i]) {
              case "POSITION":
                position = !0;
                break;

              case "NORMAL":
                normal = !0;
                break;

              case "COLOR":
                color = !0;
                break;

              case "UV":
                texcoord0 = !0;
                break;

              case "UV1":
                texcoord1 = !0;
                break;

              case "BLENDWEIGHT":
                blendWeight = !0;
                break;

              case "BLENDINDICES":
                blendIndex = !0;
                break;

              case "TANGENT":
                tangent = !0;
                break;

              case "BINORMAL":
                binormal = !0;
            }
            return position && normal && color && texcoord0 && texcoord1 && blendWeight && blendIndex && tangent ? vertexDeclaration = VertexPositionNormalColorTexture0Texture1SkinTangent.vertexDeclaration : position && normal && color && texcoord0 && texcoord1 && blendWeight && blendIndex ? vertexDeclaration = VertexPositionNormalColorTexture0Texture1Skin.vertexDeclaration : position && normal && texcoord0 && texcoord1 && blendWeight && blendIndex && tangent ? vertexDeclaration = VertexPositionNormalTexture0Texture1SkinTangent.vertexDeclaration : position && normal && texcoord0 && texcoord1 && blendWeight && blendIndex ? vertexDeclaration = VertexPositionNormalTexture0Texture1Skin.vertexDeclaration : position && normal && color && texcoord0 && blendWeight && blendIndex && tangent ? vertexDeclaration = VertexPositionNormalColorTextureSkinTangent.vertexDeclaration : position && normal && color && texcoord0 && blendWeight && blendIndex ? vertexDeclaration = VertexPositionNormalColorTextureSkin.vertexDeclaration : position && normal && texcoord0 && blendWeight && blendIndex && tangent ? vertexDeclaration = VertexPositionNormalTextureSkinTangent.vertexDeclaration : position && normal && texcoord0 && blendWeight && blendIndex ? vertexDeclaration = VertexPositionNormalTextureSkin.vertexDeclaration : position && normal && color && blendWeight && blendIndex && tangent ? vertexDeclaration = VertexPositionNormalColorSkinTangent.vertexDeclaration : position && normal && color && blendWeight && blendIndex ? vertexDeclaration = VertexPositionNormalColorSkin.vertexDeclaration : position && normal && color && texcoord0 && texcoord1 && tangent ? vertexDeclaration = VertexPositionNormalColorTexture0Texture1Tangent.vertexDeclaration : position && normal && color && texcoord0 && texcoord1 ? vertexDeclaration = VertexPositionNormalColorTexture0Texture1.vertexDeclaration : position && normal && texcoord0 && texcoord1 && tangent ? vertexDeclaration = VertexPositionNormalTexture0Texture1Tangent.vertexDeclaration : position && normal && texcoord0 && texcoord1 ? vertexDeclaration = VertexPositionNormalTexture0Texture1.vertexDeclaration : position && normal && color && texcoord0 && tangent ? vertexDeclaration = VertexPositionNormalColorTextureTangent.vertexDeclaration : position && normal && texcoord0 && tangent && binormal ? vertexDeclaration = VertexPositionNTBTexture.vertexDeclaration : position && normal && color && texcoord0 ? vertexDeclaration = VertexPositionNormalColorTexture.vertexDeclaration : position && normal && texcoord0 && tangent ? vertexDeclaration = VertexPositionNormalTextureTangent.vertexDeclaration : position && normal && texcoord0 ? vertexDeclaration = VertexPositionNormalTexture.vertexDeclaration : position && normal && color && tangent ? vertexDeclaration = VertexPositionNormalColorTangent.vertexDeclaration : position && normal && color && (vertexDeclaration = VertexPositionNormalColor.vertexDeclaration), 
            vertexDeclaration;
        }, LoadModelV02._attrReg = new RegExp("(\\w+)|([:,;])", "g"), LoadModelV02._strings = [], 
        LoadModelV02._readData = null, LoadModelV02._version = null, LoadModelV02._mesh = null, 
        LoadModelV02._materials = null, LoadModelV02._subMeshes = null, LoadModelV02._materialMap = null, 
        __static(LoadModelV02, [ "_BLOCK", function() {
            return this._BLOCK = {
                count: 0
            };
        }, "_DATA", function() {
            return this._DATA = {
                offset: 0,
                size: 0
            };
        } ]), LoadModelV02;
    }(), LoadModelV03 = function() {
        function LoadModelV03() {}
        return __class(LoadModelV03, "laya.d3.loaders.LoadModelV03"), LoadModelV03.parse = function(readData, version, mesh, subMeshes, materialMap) {
            LoadModelV03._mesh = mesh, LoadModelV03._subMeshes = subMeshes, LoadModelV03._materialMap = materialMap, 
            LoadModelV03._version = version, LoadModelV03._readData = readData, LoadModelV03.READ_DATA(), 
            LoadModelV03.READ_BLOCK(), LoadModelV03.READ_STRINGS();
            for (var i = 0, n = LoadModelV03._BLOCK.count; i < n; i++) {
                LoadModelV03._readData.pos = LoadModelV03._BLOCK.blockStarts[i];
                var index = LoadModelV03._readData.getUint16(), blockName = LoadModelV03._strings[index], fn = LoadModelV03["READ_" + blockName];
                if (null == fn) throw new Error("model file err,no this function:" + index + " " + blockName);
                fn.call();
            }
            LoadModelV03._strings.length = 0, LoadModelV03._readData = null, LoadModelV03._version = null, 
            LoadModelV03._mesh = null, LoadModelV03._subMeshes = null, LoadModelV03._materialMap = null;
        }, LoadModelV03._readString = function() {
            return LoadModelV03._strings[LoadModelV03._readData.getUint16()];
        }, LoadModelV03.READ_DATA = function() {
            LoadModelV03._DATA.offset = LoadModelV03._readData.getUint32(), LoadModelV03._DATA.size = LoadModelV03._readData.getUint32();
        }, LoadModelV03.READ_BLOCK = function() {
            for (var count = LoadModelV03._BLOCK.count = LoadModelV03._readData.getUint16(), blockStarts = LoadModelV03._BLOCK.blockStarts = [], blockLengths = LoadModelV03._BLOCK.blockLengths = [], i = 0; i < count; i++) blockStarts.push(LoadModelV03._readData.getUint32()), 
            blockLengths.push(LoadModelV03._readData.getUint32());
        }, LoadModelV03.READ_STRINGS = function() {
            var offset = LoadModelV03._readData.getUint32(), count = LoadModelV03._readData.getUint16(), prePos = LoadModelV03._readData.pos;
            LoadModelV03._readData.pos = offset + LoadModelV03._DATA.offset;
            for (var i = 0; i < count; i++) LoadModelV03._strings[i] = LoadModelV03._readData.readUTFString();
            LoadModelV03._readData.pos = prePos;
        }, LoadModelV03.READ_MESH = function() {
            LoadModelV03._readString();
            var n, arrayBuffer = LoadModelV03._readData.__getBuffer(), i = 0, vertexBufferCount = LoadModelV03._readData.getInt16(), offset = LoadModelV03._DATA.offset;
            for (i = 0; i < vertexBufferCount; i++) {
                var vertexDeclaration, vbStart = offset + LoadModelV03._readData.getUint32(), vbLength = LoadModelV03._readData.getUint32(), vbDatas = new Float32Array(arrayBuffer.slice(vbStart, vbStart + vbLength)), bufferAttribute = LoadModelV03._readString();
                switch (LoadModelV03._version) {
                  case "LAYAMODEL:03":
                    vertexDeclaration = LoadModelV03._vertexDeclarationMap_Discard[bufferAttribute];
                    break;

                  case "LAYAMODEL:0301":
                    vertexDeclaration = LoadModelV03._vertexDeclarationMap[bufferAttribute];
                    break;

                  default:
                    throw new Error("LoadModelV03: unknown version.");
                }
                if (!vertexDeclaration) throw new Error("LoadModelV03: unknown vertexDeclaration.");
                var vertexBuffer = VertexBuffer3D.create(vertexDeclaration, 4 * vbDatas.length / vertexDeclaration.vertexStride, 35044, !0);
                vertexBuffer.setData(vbDatas), LoadModelV03._mesh._vertexBuffers.push(vertexBuffer);
            }
            var ibStart = offset + LoadModelV03._readData.getUint32(), ibLength = LoadModelV03._readData.getUint32(), ibDatas = new Uint16Array(arrayBuffer.slice(ibStart, ibStart + ibLength)), indexBuffer = IndexBuffer3D.create("ushort", ibLength / 2, 35044, !0);
            indexBuffer.setData(ibDatas), LoadModelV03._mesh._indexBuffer = indexBuffer;
            var boneNames = LoadModelV03._mesh._boneNames = [], boneCount = LoadModelV03._readData.getUint16();
            for (boneNames.length = boneCount, i = 0; i < boneCount; i++) boneNames[i] = LoadModelV03._strings[LoadModelV03._readData.getUint16()];
            LoadModelV03._readData.pos += 8;
            var inverseGlobalBindPoseStart = LoadModelV03._readData.getUint32(), inverseGlobalBinPoseLength = LoadModelV03._readData.getUint32(), invGloBindPoseDatas = new Float32Array(arrayBuffer.slice(offset + inverseGlobalBindPoseStart, offset + inverseGlobalBindPoseStart + inverseGlobalBinPoseLength));
            for (LoadModelV03._mesh._inverseBindPoses = [], i = 0, n = invGloBindPoseDatas.length; i < n; i += 16) {
                var inverseGlobalBindPose = new Matrix4x4(invGloBindPoseDatas[i + 0], invGloBindPoseDatas[i + 1], invGloBindPoseDatas[i + 2], invGloBindPoseDatas[i + 3], invGloBindPoseDatas[i + 4], invGloBindPoseDatas[i + 5], invGloBindPoseDatas[i + 6], invGloBindPoseDatas[i + 7], invGloBindPoseDatas[i + 8], invGloBindPoseDatas[i + 9], invGloBindPoseDatas[i + 10], invGloBindPoseDatas[i + 11], invGloBindPoseDatas[i + 12], invGloBindPoseDatas[i + 13], invGloBindPoseDatas[i + 14], invGloBindPoseDatas[i + 15]);
                LoadModelV03._mesh._inverseBindPoses.push(inverseGlobalBindPose);
            }
            return LoadModelV03._mesh._skinnedDatas = new Float32Array(16 * invGloBindPoseDatas.length), 
            !0;
        }, LoadModelV03.READ_SUBMESH = function() {
            var arrayBuffer = LoadModelV03._readData.__getBuffer(), submesh = new SubMesh(LoadModelV03._mesh), vbIndex = LoadModelV03._readData.getInt16(), vbStart = LoadModelV03._readData.getUint32(), vbLength = LoadModelV03._readData.getUint32();
            submesh._vertexBuffer = LoadModelV03._mesh._vertexBuffers[vbIndex], submesh._vertexStart = vbStart, 
            submesh._vertexCount = vbLength;
            var ibStart = LoadModelV03._readData.getUint32(), ibCount = LoadModelV03._readData.getUint32(), indexBuffer = LoadModelV03._mesh._indexBuffer;
            submesh._indexBuffer = indexBuffer, submesh._indexStart = ibStart, submesh._indexCount = ibCount, 
            submesh._indices = new Uint16Array(indexBuffer.getData().buffer, 2 * ibStart, ibCount);
            var offset = LoadModelV03._DATA.offset, subIndexBufferStart = submesh._subIndexBufferStart, subIndexBufferCount = submesh._subIndexBufferCount, boneIndicesList = submesh._boneIndicesList, drawCount = LoadModelV03._readData.getUint16();
            subIndexBufferStart.length = drawCount, subIndexBufferCount.length = drawCount, 
            boneIndicesList.length = drawCount;
            for (var i = 0; i < drawCount; i++) {
                subIndexBufferStart[i] = LoadModelV03._readData.getUint32(), subIndexBufferCount[i] = LoadModelV03._readData.getUint32();
                var boneDicofs = LoadModelV03._readData.getUint32(), boneDicsize = LoadModelV03._readData.getUint32();
                boneIndicesList[i] = new Uint8Array(arrayBuffer.slice(offset + boneDicofs, offset + boneDicofs + boneDicsize));
            }
            return LoadModelV03._subMeshes.push(submesh), !0;
        }, LoadModelV03._strings = [], LoadModelV03._readData = null, LoadModelV03._version = null, 
        LoadModelV03._mesh = null, LoadModelV03._subMeshes = null, LoadModelV03._materialMap = null, 
        __static(LoadModelV03, [ "_vertexDeclarationMap_Discard", function() {
            return this._vertexDeclarationMap_Discard = {
                "POSITION,NORMAL,COLOR,UV,UV1,BLENDWEIGHT,BLENDINDICES,TANGENT": VertexPositionNormalColorTexture0Texture1SkinTangent.vertexDeclaration,
                "POSITION,NORMAL,COLOR,UV,UV1,BLENDWEIGHT,BLENDINDICES": VertexPositionNormalColorTexture0Texture1Skin.vertexDeclaration,
                "POSITION,NORMAL,TANGENT,BINORMAL,UV,UV1,BLENDWEIGHT,BLENDINDICES,": VertexPositionNTBTexture0Texture1Skin.vertexDeclaration,
                "POSITION,NORMAL,UV,UV1,BLENDWEIGHT,BLENDINDICES,TANGENT": VertexPositionNormalTexture0Texture1SkinTangent.vertexDeclaration,
                "POSITION,NORMAL,UV,UV1,BLENDWEIGHT,BLENDINDICES": VertexPositionNormalTexture0Texture1Skin.vertexDeclaration,
                "POSITION,NORMAL,COLOR,UV,BLENDWEIGHT,BLENDINDICES,TANGENT": VertexPositionNormalColorTextureSkinTangent.vertexDeclaration,
                "POSITION,NORMAL,COLOR,UV,BLENDWEIGHT,BLENDINDICES": VertexPositionNormalColorTextureSkin.vertexDeclaration,
                "POSITION,NORMAL,UV,BLENDWEIGHT,BLENDINDICES,TANGENT": VertexPositionNormalTextureSkinTangent.vertexDeclaration,
                "POSITION,NORMAL,UV,BLENDWEIGHT,BLENDINDICES": VertexPositionNormalTextureSkin.vertexDeclaration,
                "POSITION,NORMAL,COLOR,BLENDWEIGHT,BLENDINDICES,TANGENT": VertexPositionNormalColorSkinTangent.vertexDeclaration,
                "POSITION,NORMAL,COLOR,BLENDWEIGHT,BLENDINDICES": VertexPositionNormalColorSkin.vertexDeclaration,
                "POSITION,NORMAL,COLOR,UV,UV1,TANGENT": VertexPositionNormalColorTexture0Texture1Tangent.vertexDeclaration,
                "POSITION,NORMAL,COLOR,UV,UV1": VertexPositionNormalColorTexture0Texture1.vertexDeclaration,
                "POSITION,NORMAL,UV,UV1,TANGENT": VertexPositionNormalTexture0Texture1Tangent.vertexDeclaration,
                "POSITION,NORMAL,UV,UV1": VertexPositionNormalTexture0Texture1.vertexDeclaration,
                "POSITION,NORMAL,COLOR,UV,TANGENT": VertexPositionNormalColorTextureTangent.vertexDeclaration,
                "POSITION,NORMAL,UV,TANGENT,BINORMAL": VertexPositionNTBTexture.vertexDeclaration,
                "POSITION,NORMAL,COLOR,UV": VertexPositionNormalColorTexture.vertexDeclaration,
                "POSITION,NORMAL,UV,TANGENT": VertexPositionNormalTextureTangent.vertexDeclaration,
                "POSITION,NORMAL,UV": VertexPositionNormalTexture.vertexDeclaration,
                "POSITION,NORMAL,COLOR,TANGENT": VertexPositionNormalColorTangent.vertexDeclaration,
                "POSITION,NORMAL,COLOR": VertexPositionNormalColor.vertexDeclaration,
                "POSITION,NORMAL,TANGENT": VertexPositionNormalTangent.vertexDeclaration,
                "POSITION,NORMAL": VertexPositionNormal.vertexDeclaration,
                "POSITION,UV": VertexPositionTexture0.vertexDeclaration,
                POSITION: VertexPosition.vertexDeclaration
            };
        }, "_vertexDeclarationMap", function() {
            return this._vertexDeclarationMap = {
                "POSITION,NORMAL,COLOR,UV,UV1,BLENDWEIGHT,BLENDINDICES,TANGENT": VertexPositionNormalColorTexture0Texture1SkinSTangent.vertexDeclaration,
                "POSITION,NORMAL,COLOR,UV,UV1,BLENDWEIGHT,BLENDINDICES": VertexPositionNormalColorTexture0Texture1Skin.vertexDeclaration,
                "POSITION,NORMAL,TANGENT,BINORMAL,UV,UV1,BLENDWEIGHT,BLENDINDICES,": VertexPositionNTBTexture0Texture1Skin.vertexDeclaration,
                "POSITION,NORMAL,UV,UV1,BLENDWEIGHT,BLENDINDICES,TANGENT": VertexPositionNormalTexture0Texture1SkinSTangent.vertexDeclaration,
                "POSITION,NORMAL,UV,UV1,BLENDWEIGHT,BLENDINDICES": VertexPositionNormalTexture0Texture1Skin.vertexDeclaration,
                "POSITION,NORMAL,COLOR,UV,BLENDWEIGHT,BLENDINDICES,TANGENT": VertexPositionNormalColorTextureSkinSTangent.vertexDeclaration,
                "POSITION,NORMAL,COLOR,UV,BLENDWEIGHT,BLENDINDICES": VertexPositionNormalColorTextureSkin.vertexDeclaration,
                "POSITION,NORMAL,UV,BLENDWEIGHT,BLENDINDICES,TANGENT": VertexPositionNormalTextureSkinSTangent.vertexDeclaration,
                "POSITION,NORMAL,UV,BLENDWEIGHT,BLENDINDICES": VertexPositionNormalTextureSkin.vertexDeclaration,
                "POSITION,NORMAL,COLOR,BLENDWEIGHT,BLENDINDICES,TANGENT": VertexPositionNormalColorSkinSTangent.vertexDeclaration,
                "POSITION,NORMAL,COLOR,BLENDWEIGHT,BLENDINDICES": VertexPositionNormalColorSkin.vertexDeclaration,
                "POSITION,NORMAL,COLOR,UV,UV1,TANGENT": VertexPositionNormalColorTexture0Texture1STangent.vertexDeclaration,
                "POSITION,NORMAL,COLOR,UV,UV1": VertexPositionNormalColorTexture0Texture1.vertexDeclaration,
                "POSITION,NORMAL,UV,UV1,TANGENT": VertexPositionNormalTexture0Texture1STangent.vertexDeclaration,
                "POSITION,NORMAL,UV,UV1": VertexPositionNormalTexture0Texture1.vertexDeclaration,
                "POSITION,NORMAL,COLOR,UV,TANGENT": VertexPositionNormalColorTextureSTangent.vertexDeclaration,
                "POSITION,NORMAL,UV,TANGENT,BINORMAL": VertexPositionNTBTexture.vertexDeclaration,
                "POSITION,NORMAL,COLOR,UV": VertexPositionNormalColorTexture.vertexDeclaration,
                "POSITION,NORMAL,UV,TANGENT": VertexPositionNormalTextureSTangent.vertexDeclaration,
                "POSITION,NORMAL,UV": VertexPositionNormalTexture.vertexDeclaration,
                "POSITION,NORMAL,COLOR,TANGENT": VertexPositionNormalColorSTangent.vertexDeclaration,
                "POSITION,NORMAL,COLOR": VertexPositionNormalColor.vertexDeclaration,
                "POSITION,NORMAL,TANGENT": VertexPositionNormalSTangent.vertexDeclaration,
                "POSITION,NORMAL": VertexPositionNormal.vertexDeclaration,
                "POSITION,UV": VertexPositionTexture0.vertexDeclaration,
                POSITION: VertexPosition.vertexDeclaration
            };
        }, "_BLOCK", function() {
            return this._BLOCK = {
                count: 0
            };
        }, "_DATA", function() {
            return this._DATA = {
                offset: 0,
                size: 0
            };
        } ]), LoadModelV03;
    }(), MeshReader = function() {
        function MeshReader() {}
        return __class(MeshReader, "laya.d3.loaders.MeshReader"), MeshReader.read = function(data, mesh, materials, subMeshes, materialMap) {
            var readData = new Byte(data);
            readData.pos = 0;
            var version = readData.readUTFString();
            switch (version) {
              case "LAYAMODEL:01":
              case "LAYASKINANI:01":
                MeshReader._readVersion01(readData, version, mesh, materials, subMeshes, materialMap);
                break;

              case "LAYAMODEL:02":
                LoadModelV02.parse(readData, version, mesh, materials, subMeshes, materialMap);
                break;

              case "LAYAMODEL:03":
              case "LAYAMODEL:0301":
                LoadModelV03.parse(readData, version, mesh, subMeshes, materialMap);
                break;

              default:
                throw new Error("MeshReader: unknown mesh version.");
            }
            mesh._setSubMeshes(subMeshes);
        }, MeshReader._readVersion01 = function(readData, version, mesh, materials, subMeshes, materialMap) {
            new LoadModelV01(readData, version, mesh, materials, subMeshes, materialMap);
        }, MeshReader;
    }(), BoundBox = function() {
        function BoundBox(min, max) {
            this.min = null, this.max = null, this.min = min, this.max = max;
        }
        __class(BoundBox, "laya.d3.math.BoundBox");
        var __proto = BoundBox.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.getCorners = function(corners) {
            corners.length = 8;
            var mine = this.min.elements, maxe = this.max.elements, minX = mine[0], minY = mine[1], minZ = mine[2], maxX = maxe[0], maxY = maxe[1], maxZ = maxe[2];
            corners[0] = new Vector3(minX, maxY, maxZ), corners[1] = new Vector3(maxX, maxY, maxZ), 
            corners[2] = new Vector3(maxX, minY, maxZ), corners[3] = new Vector3(minX, minY, maxZ), 
            corners[4] = new Vector3(minX, maxY, minZ), corners[5] = new Vector3(maxX, maxY, minZ), 
            corners[6] = new Vector3(maxX, minY, minZ), corners[7] = new Vector3(minX, minY, minZ);
        }, __proto.toDefault = function() {
            this.min.toDefault(), this.max.toDefault();
        }, __proto.cloneTo = function(destObject) {
            var dest = destObject;
            this.min.cloneTo(dest.min), this.max.cloneTo(dest.max);
        }, __proto.clone = function() {
            var dest = new this.constructor(new Vector3(), new Vector3());
            return this.cloneTo(dest), dest;
        }, BoundBox.createfromPoints = function(points, out) {
            if (null == points) throw new Error("points");
            var min = out.min, max = out.max, minE = min.elements;
            minE[0] = Number.MAX_VALUE, minE[1] = Number.MAX_VALUE, minE[2] = Number.MAX_VALUE;
            var maxE = max.elements;
            maxE[0] = -Number.MAX_VALUE, maxE[1] = -Number.MAX_VALUE, maxE[2] = -Number.MAX_VALUE;
            for (var i = 0, n = points.length; i < n; ++i) Vector3.min(min, points[i], min), 
            Vector3.max(max, points[i], max);
        }, BoundBox.merge = function(box1, box2, out) {
            Vector3.min(box1.min, box2.min, out.min), Vector3.max(box1.max, box2.max, out.max);
        }, BoundBox;
    }(), BoundFrustum = function() {
        function BoundFrustum(matrix) {
            this._matrix = null, this._near = null, this._far = null, this._left = null, this._right = null, 
            this._top = null, this._bottom = null, this._matrix = matrix, this._near = new Plane(new Vector3()), 
            this._far = new Plane(new Vector3()), this._left = new Plane(new Vector3()), this._right = new Plane(new Vector3()), 
            this._top = new Plane(new Vector3()), this._bottom = new Plane(new Vector3()), BoundFrustum._getPlanesFromMatrix(this._matrix, this._near, this._far, this._left, this._right, this._top, this._bottom);
        }
        __class(BoundFrustum, "laya.d3.math.BoundFrustum");
        var __proto = BoundFrustum.prototype;
        return __proto.equalsBoundFrustum = function(other) {
            return this._matrix.equalsOtherMatrix(other.matrix);
        }, __proto.equalsObj = function(obj) {
            if (obj instanceof laya.d3.math.BoundFrustum) {
                var bf = obj;
                return this.equalsBoundFrustum(bf);
            }
            return !1;
        }, __proto.getPlane = function(index) {
            switch (index) {
              case 0:
                return this._near;

              case 1:
                return this._far;

              case 2:
                return this._left;

              case 3:
                return this._right;

              case 4:
                return this._top;

              case 5:
                return this._bottom;

              default:
                return null;
            }
        }, __proto.getCorners = function(corners) {
            BoundFrustum._get3PlaneInterPoint(this._near, this._bottom, this._right).cloneTo(corners[0]), 
            BoundFrustum._get3PlaneInterPoint(this._near, this._top, this._right).cloneTo(corners[1]), 
            BoundFrustum._get3PlaneInterPoint(this._near, this._top, this._left).cloneTo(corners[2]), 
            BoundFrustum._get3PlaneInterPoint(this._near, this._bottom, this._left).cloneTo(corners[3]), 
            BoundFrustum._get3PlaneInterPoint(this._far, this._bottom, this._right).cloneTo(corners[4]), 
            BoundFrustum._get3PlaneInterPoint(this._far, this._top, this._right).cloneTo(corners[5]), 
            BoundFrustum._get3PlaneInterPoint(this._far, this._top, this._left).cloneTo(corners[6]), 
            BoundFrustum._get3PlaneInterPoint(this._far, this._bottom, this._left).cloneTo(corners[7]);
        }, __proto.containsPoint = function(point) {
            for (var result = Plane.PlaneIntersectionType_Front, planeResult = Plane.PlaneIntersectionType_Front, i = 0; i < 6; i++) {
                switch (i) {
                  case 0:
                    planeResult = Collision.intersectsPlaneAndPoint(this._near, point);
                    break;

                  case 1:
                    planeResult = Collision.intersectsPlaneAndPoint(this._far, point);
                    break;

                  case 2:
                    planeResult = Collision.intersectsPlaneAndPoint(this._left, point);
                    break;

                  case 3:
                    planeResult = Collision.intersectsPlaneAndPoint(this._right, point);
                    break;

                  case 4:
                    planeResult = Collision.intersectsPlaneAndPoint(this._top, point);
                    break;

                  case 5:
                    planeResult = Collision.intersectsPlaneAndPoint(this._bottom, point);
                }
                switch (planeResult) {
                  case Plane.PlaneIntersectionType_Back:
                    return 0;

                  case Plane.PlaneIntersectionType_Intersecting:
                    result = Plane.PlaneIntersectionType_Intersecting;
                }
            }
            switch (result) {
              case Plane.PlaneIntersectionType_Intersecting:
                return 2;

              default:
                return 1;
            }
        }, __proto.containsBoundBox = function(box) {
            for (var plane, p = BoundFrustum._tempV30, n = BoundFrustum._tempV31, result = 1, i = 0; i < 6; i++) {
                if (plane = this.getPlane(i), this._getBoxToPlanePVertexNVertex(box, plane.normal, p, n), 
                Collision.intersectsPlaneAndPoint(plane, p) === Plane.PlaneIntersectionType_Back) return 0;
                Collision.intersectsPlaneAndPoint(plane, n) === Plane.PlaneIntersectionType_Back && (result = 2);
            }
            return result;
        }, __proto.containsBoundSphere = function(sphere) {
            for (var result = Plane.PlaneIntersectionType_Front, planeResult = Plane.PlaneIntersectionType_Front, i = 0; i < 6; i++) {
                switch (i) {
                  case 0:
                    planeResult = Collision.intersectsPlaneAndSphere(this._near, sphere);
                    break;

                  case 1:
                    planeResult = Collision.intersectsPlaneAndSphere(this._far, sphere);
                    break;

                  case 2:
                    planeResult = Collision.intersectsPlaneAndSphere(this._left, sphere);
                    break;

                  case 3:
                    planeResult = Collision.intersectsPlaneAndSphere(this._right, sphere);
                    break;

                  case 4:
                    planeResult = Collision.intersectsPlaneAndSphere(this._top, sphere);
                    break;

                  case 5:
                    planeResult = Collision.intersectsPlaneAndSphere(this._bottom, sphere);
                }
                switch (planeResult) {
                  case Plane.PlaneIntersectionType_Back:
                    return 0;

                  case Plane.PlaneIntersectionType_Intersecting:
                    result = Plane.PlaneIntersectionType_Intersecting;
                }
            }
            switch (result) {
              case Plane.PlaneIntersectionType_Intersecting:
                return 2;

              default:
                return 1;
            }
        }, __proto._getBoxToPlanePVertexNVertex = function(box, planeNormal, outP, outN) {
            var boxMin = box.min, boxMinE = boxMin.elements, boxMax = box.max, boxMaxE = boxMax.elements, planeNorE = planeNormal.elements, planeNorEX = planeNorE[0], planeNorEY = planeNorE[1], planeNorEZ = planeNorE[2];
            boxMin.cloneTo(outP);
            var outPE = outP.elements;
            0 <= planeNorEX && (outPE[0] = boxMaxE[0]), 0 <= planeNorEY && (outPE[1] = boxMaxE[1]), 
            0 <= planeNorEZ && (outPE[2] = boxMaxE[2]), boxMax.cloneTo(outN);
            var outNE = outN.elements;
            0 <= planeNorEX && (outNE[0] = boxMinE[0]), 0 <= planeNorEY && (outNE[1] = boxMinE[1]), 
            0 <= planeNorEZ && (outNE[2] = boxMinE[2]);
        }, __getset(0, __proto, "top", function() {
            return this._top;
        }), __getset(0, __proto, "matrix", function() {
            return this._matrix;
        }, function(matrix) {
            this._matrix = matrix, BoundFrustum._getPlanesFromMatrix(this._matrix, this._near, this._far, this._left, this._right, this._top, this._bottom);
        }), __getset(0, __proto, "near", function() {
            return this._near;
        }), __getset(0, __proto, "far", function() {
            return this._far;
        }), __getset(0, __proto, "left", function() {
            return this._left;
        }), __getset(0, __proto, "right", function() {
            return this._right;
        }), __getset(0, __proto, "bottom", function() {
            return this._bottom;
        }), BoundFrustum._getPlanesFromMatrix = function(m, np, fp, lp, rp, tp, bp) {
            var matrixE = m.elements, m11 = matrixE[0], m12 = matrixE[1], m13 = matrixE[2], m14 = matrixE[3], m21 = matrixE[4], m22 = matrixE[5], m23 = matrixE[6], m24 = matrixE[7], m31 = matrixE[8], m32 = matrixE[9], m33 = matrixE[10], m34 = matrixE[11], m41 = matrixE[12], m42 = matrixE[13], m43 = matrixE[14], m44 = matrixE[15], nearNorE = np.normal.elements;
            nearNorE[0] = m14 + m13, nearNorE[1] = m24 + m23, nearNorE[2] = m34 + m33, np.distance = m44 + m43, 
            np.normalize();
            var farNorE = fp.normal.elements;
            farNorE[0] = m14 - m13, farNorE[1] = m24 - m23, farNorE[2] = m34 - m33, fp.distance = m44 - m43, 
            fp.normalize();
            var leftNorE = lp.normal.elements;
            leftNorE[0] = m14 + m11, leftNorE[1] = m24 + m21, leftNorE[2] = m34 + m31, lp.distance = m44 + m41, 
            lp.normalize();
            var rightNorE = rp.normal.elements;
            rightNorE[0] = m14 - m11, rightNorE[1] = m24 - m21, rightNorE[2] = m34 - m31, rp.distance = m44 - m41, 
            rp.normalize();
            var topNorE = tp.normal.elements;
            topNorE[0] = m14 - m12, topNorE[1] = m24 - m22, topNorE[2] = m34 - m32, tp.distance = m44 - m42, 
            tp.normalize();
            var bottomNorE = bp.normal.elements;
            bottomNorE[0] = m14 + m12, bottomNorE[1] = m24 + m22, bottomNorE[2] = m34 + m32, 
            bp.distance = m44 + m42, bp.normalize();
        }, BoundFrustum._get3PlaneInterPoint = function(p1, p2, p3) {
            var p1Nor = p1.normal, p2Nor = p2.normal, p3Nor = p3.normal;
            Vector3.cross(p2Nor, p3Nor, BoundFrustum._tempV30), Vector3.cross(p3Nor, p1Nor, BoundFrustum._tempV31), 
            Vector3.cross(p1Nor, p2Nor, BoundFrustum._tempV32);
            var a = Vector3.dot(p1Nor, BoundFrustum._tempV30), b = Vector3.dot(p2Nor, BoundFrustum._tempV31), c = Vector3.dot(p3Nor, BoundFrustum._tempV32);
            return Vector3.scale(BoundFrustum._tempV30, -p1.distance / a, BoundFrustum._tempV33), 
            Vector3.scale(BoundFrustum._tempV31, -p2.distance / b, BoundFrustum._tempV34), Vector3.scale(BoundFrustum._tempV32, -p3.distance / c, BoundFrustum._tempV35), 
            Vector3.add(BoundFrustum._tempV33, BoundFrustum._tempV34, BoundFrustum._tempV36), 
            Vector3.add(BoundFrustum._tempV35, BoundFrustum._tempV36, BoundFrustum._tempV37), 
            BoundFrustum._tempV37;
        }, __static(BoundFrustum, [ "_tempV30", function() {
            return this._tempV30 = new Vector3();
        }, "_tempV31", function() {
            return this._tempV31 = new Vector3();
        }, "_tempV32", function() {
            return this._tempV32 = new Vector3();
        }, "_tempV33", function() {
            return this._tempV33 = new Vector3();
        }, "_tempV34", function() {
            return this._tempV34 = new Vector3();
        }, "_tempV35", function() {
            return this._tempV35 = new Vector3();
        }, "_tempV36", function() {
            return this._tempV36 = new Vector3();
        }, "_tempV37", function() {
            return this._tempV37 = new Vector3();
        } ]), BoundFrustum;
    }(), BoundSphere = function() {
        function BoundSphere(center, radius) {
            this.center = null, this.radius = NaN, this.center = center, this.radius = radius;
        }
        __class(BoundSphere, "laya.d3.math.BoundSphere");
        var __proto = BoundSphere.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.toDefault = function() {
            this.center.toDefault(), this.radius = 0;
        }, __proto.intersectsRayDistance = function(ray) {
            return Collision.intersectsRayAndSphereRD(ray, this);
        }, __proto.intersectsRayPoint = function(ray, outPoint) {
            return Collision.intersectsRayAndSphereRP(ray, this, outPoint);
        }, __proto.cloneTo = function(destObject) {
            var dest = destObject;
            this.center.cloneTo(dest.center), dest.radius = this.radius;
        }, __proto.clone = function() {
            var dest = new this.constructor(new Vector3(), new Vector3());
            return this.cloneTo(dest), dest;
        }, BoundSphere.createFromSubPoints = function(points, start, count, out) {
            if (null == points) throw new Error("points");
            if (start < 0 || start >= points.length) throw new Error("start" + start + "Must be in the range [0, " + (points.length - 1) + "]");
            if (count < 0 || start + count > points.length) throw new Error("count" + count + "Must be in the range <= " + points.length + "}");
            var upperEnd = start + count, center = BoundSphere._tempVector3;
            center.elements[0] = 0, center.elements[1] = 0, center.elements[2] = 0;
            for (var i = start; i < upperEnd; ++i) Vector3.add(points[i], center, center);
            var outCenter = out.center;
            Vector3.scale(center, 1 / count, outCenter);
            var radius = 0;
            for (i = start; i < upperEnd; ++i) {
                var distance = Vector3.distanceSquared(outCenter, points[i]);
                radius < distance && (radius = distance);
            }
            out.radius = Math.sqrt(radius);
        }, BoundSphere.createfromPoints = function(points, out) {
            if (null == points) throw new Error("points");
            BoundSphere.createFromSubPoints(points, 0, points.length, out);
        }, __static(BoundSphere, [ "_tempVector3", function() {
            return this._tempVector3 = new Vector3();
        } ]), BoundSphere;
    }(), MathUtils3D = (function() {
        function ContainmentType() {}
        __class(ContainmentType, "laya.d3.math.ContainmentType"), ContainmentType.Disjoint = 0, 
        ContainmentType.Contains = 1, ContainmentType.Intersects = 2;
    }(), function() {
        function MathUtils3D() {}
        return __class(MathUtils3D, "laya.d3.math.MathUtils3D"), MathUtils3D.isZero = function(v) {
            return Math.abs(v) < MathUtils3D.zeroTolerance;
        }, MathUtils3D.nearEqual = function(n1, n2) {
            return !!MathUtils3D.isZero(n1 - n2);
        }, MathUtils3D.fastInvSqrt = function(value) {
            return MathUtils3D.isZero(value) ? value : 1 / Math.sqrt(value);
        }, __static(MathUtils3D, [ "zeroTolerance", function() {
            return this.zeroTolerance = 1e-6;
        }, "MaxValue", function() {
            return this.MaxValue = 3.40282347e38;
        }, "MinValue", function() {
            return this.MinValue = -3.40282347e38;
        } ]), MathUtils3D;
    }()), Matrix3x3 = function() {
        function Matrix3x3() {
            var e = this.elements = new Float32Array(9);
            e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 1, e[5] = 0, e[6] = 0, e[7] = 0, 
            e[8] = 1;
        }
        __class(Matrix3x3, "laya.d3.math.Matrix3x3");
        var __proto = Matrix3x3.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.determinant = function() {
            var f = this.elements, a00 = f[0], a01 = f[1], a02 = f[2], a10 = f[3], a11 = f[4], a12 = f[5], a20 = f[6], a21 = f[7], a22 = f[8];
            return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);
        }, __proto.translate = function(trans, out) {
            var e = out.elements, f = this.elements, g = trans.elements, a00 = f[0], a01 = f[1], a02 = f[2], a10 = f[3], a11 = f[4], a12 = f[5], a20 = f[6], a21 = f[7], a22 = f[8], x = g[0], y = g[1];
            e[0] = a00, e[1] = a01, e[2] = a02, e[3] = a10, e[4] = a11, e[5] = a12, e[6] = x * a00 + y * a10 + a20, 
            e[7] = x * a01 + y * a11 + a21, e[8] = x * a02 + y * a12 + a22;
        }, __proto.rotate = function(rad, out) {
            var e = out.elements, f = this.elements, a00 = f[0], a01 = f[1], a02 = f[2], a10 = f[3], a11 = f[4], a12 = f[5], a20 = f[6], a21 = f[7], a22 = f[8], s = Math.sin(rad), c = Math.cos(rad);
            e[0] = c * a00 + s * a10, e[1] = c * a01 + s * a11, e[2] = c * a02 + s * a12, e[3] = c * a10 - s * a00, 
            e[4] = c * a11 - s * a01, e[5] = c * a12 - s * a02, e[6] = a20, e[7] = a21, e[8] = a22;
        }, __proto.scale = function(scale, out) {
            var e = out.elements, f = this.elements, g = scale.elements, x = g[0], y = g[1];
            e[0] = x * f[0], e[1] = x * f[1], e[2] = x * f[2], e[3] = y * f[3], e[4] = y * f[4], 
            e[5] = y * f[5], e[6] = f[6], e[7] = f[7], e[8] = f[8];
        }, __proto.invert = function(out) {
            var e = out.elements, f = this.elements, a00 = f[0], a01 = f[1], a02 = f[2], a10 = f[3], a11 = f[4], a12 = f[5], a20 = f[6], a21 = f[7], a22 = f[8], b01 = a22 * a11 - a12 * a21, b11 = -a22 * a10 + a12 * a20, b21 = a21 * a10 - a11 * a20, det = a00 * b01 + a01 * b11 + a02 * b21;
            det || (out = null), det = 1 / det, e[0] = b01 * det, e[1] = (-a22 * a01 + a02 * a21) * det, 
            e[2] = (a12 * a01 - a02 * a11) * det, e[3] = b11 * det, e[4] = (a22 * a00 - a02 * a20) * det, 
            e[5] = (-a12 * a00 + a02 * a10) * det, e[6] = b21 * det, e[7] = (-a21 * a00 + a01 * a20) * det, 
            e[8] = (a11 * a00 - a01 * a10) * det;
        }, __proto.transpose = function(out) {
            var e = out.elements, f = this.elements;
            if (out === this) {
                var a01 = f[1], a02 = f[2], a12 = f[5];
                e[1] = f[3], e[2] = f[6], e[3] = a01, e[5] = f[7], e[6] = a02, e[7] = a12;
            } else e[0] = f[0], e[1] = f[3], e[2] = f[6], e[3] = f[1], e[4] = f[4], e[5] = f[7], 
            e[6] = f[2], e[7] = f[5], e[8] = f[8];
        }, __proto.identity = function() {
            var e = this.elements;
            e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 1, e[5] = 0, e[6] = 0, e[7] = 0, 
            e[8] = 1;
        }, __proto.cloneTo = function(destObject) {
            var i, s, d;
            if ((s = this.elements) !== (d = destObject.elements)) for (i = 0; i < 9; ++i) d[i] = s[i];
        }, __proto.clone = function() {
            var dest = new this.constructor();
            return this.cloneTo(dest), dest;
        }, Matrix3x3.createFromTranslation = function(trans, out) {
            out.elements;
            var g = trans.elements;
            out[0] = 1, out[1] = 0, out[2] = 0, out[3] = 0, out[4] = 1, out[5] = 0, out[6] = g[0], 
            out[7] = g[1], out[8] = 1;
        }, Matrix3x3.createFromRotation = function(rad, out) {
            var e = out.elements, s = Math.sin(rad), c = Math.cos(rad);
            e[0] = c, e[1] = s, e[2] = 0, e[3] = -s, e[4] = c, e[5] = 0, e[6] = 0, e[7] = 0, 
            e[8] = 1;
        }, Matrix3x3.createFromScaling = function(scale, out) {
            var e = out.elements, g = scale.elements;
            e[0] = g[0], e[1] = 0, e[2] = 0, e[3] = 0, e[4] = g[1], e[5] = 0, e[6] = 0, e[7] = 0, 
            e[8] = 1;
        }, Matrix3x3.createFromMatrix4x4 = function(sou, out) {
            out[0] = sou[0], out[1] = sou[1], out[2] = sou[2], out[3] = sou[4], out[4] = sou[5], 
            out[5] = sou[6], out[6] = sou[8], out[7] = sou[9], out[8] = sou[10];
        }, Matrix3x3.multiply = function(left, right, out) {
            var e = out.elements, f = left.elements, g = right.elements, a00 = f[0], a01 = f[1], a02 = f[2], a10 = f[3], a11 = f[4], a12 = f[5], a20 = f[6], a21 = f[7], a22 = f[8], b00 = g[0], b01 = g[1], b02 = g[2], b10 = g[3], b11 = g[4], b12 = g[5], b20 = g[6], b21 = g[7], b22 = g[8];
            e[0] = b00 * a00 + b01 * a10 + b02 * a20, e[1] = b00 * a01 + b01 * a11 + b02 * a21, 
            e[2] = b00 * a02 + b01 * a12 + b02 * a22, e[3] = b10 * a00 + b11 * a10 + b12 * a20, 
            e[4] = b10 * a01 + b11 * a11 + b12 * a21, e[5] = b10 * a02 + b11 * a12 + b12 * a22, 
            e[6] = b20 * a00 + b21 * a10 + b22 * a20, e[7] = b20 * a01 + b21 * a11 + b22 * a21, 
            e[8] = b20 * a02 + b21 * a12 + b22 * a22;
        }, Matrix3x3.lookAt = function(eye, target, up, out) {
            Vector3.subtract(eye, target, Matrix3x3._tempV30), Vector3.normalize(Matrix3x3._tempV30, Matrix3x3._tempV30), 
            Vector3.cross(up, Matrix3x3._tempV30, Matrix3x3._tempV31), Vector3.normalize(Matrix3x3._tempV31, Matrix3x3._tempV31), 
            Vector3.cross(Matrix3x3._tempV30, Matrix3x3._tempV31, Matrix3x3._tempV32);
            var v0e = Matrix3x3._tempV30.elements, v1e = Matrix3x3._tempV31.elements, v2e = Matrix3x3._tempV32.elements, me = out.elements;
            me[0] = v1e[0], me[3] = v1e[1], me[6] = v1e[2], me[1] = v2e[0], me[4] = v2e[1], 
            me[7] = v2e[2], me[2] = v0e[0], me[5] = v0e[1], me[8] = v0e[2];
        }, Matrix3x3.DEFAULT = new Matrix3x3(), __static(Matrix3x3, [ "_tempV30", function() {
            return this._tempV30 = new Vector3();
        }, "_tempV31", function() {
            return this._tempV31 = new Vector3();
        }, "_tempV32", function() {
            return this._tempV32 = new Vector3();
        } ]), Matrix3x3;
    }(), Matrix4x4 = function() {
        function Matrix4x4(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) {
            void 0 === m11 && (m11 = 1), void 0 === m12 && (m12 = 0), void 0 === m13 && (m13 = 0), 
            void 0 === m14 && (m14 = 0), void 0 === m21 && (m21 = 0), void 0 === m22 && (m22 = 1), 
            void 0 === m23 && (m23 = 0), void 0 === m24 && (m24 = 0), void 0 === m31 && (m31 = 0), 
            void 0 === m32 && (m32 = 0), void 0 === m33 && (m33 = 1), void 0 === m34 && (m34 = 0), 
            void 0 === m41 && (m41 = 0), void 0 === m42 && (m42 = 0), void 0 === m43 && (m43 = 0), 
            void 0 === m44 && (m44 = 1);
            var e = this.elements = new Float32Array(16);
            e[0] = m11, e[1] = m12, e[2] = m13, e[3] = m14, e[4] = m21, e[5] = m22, e[6] = m23, 
            e[7] = m24, e[8] = m31, e[9] = m32, e[10] = m33, e[11] = m34, e[12] = m41, e[13] = m42, 
            e[14] = m43, e[15] = m44;
        }
        __class(Matrix4x4, "laya.d3.math.Matrix4x4");
        var __proto = Matrix4x4.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.getElementByRowColumn = function(row, column) {
            if (row < 0 || 3 < row) throw new Error("row", "Rows and columns for matrices run from 0 to 3, inclusive.");
            if (column < 0 || 3 < column) throw new Error("column", "Rows and columns for matrices run from 0 to 3, inclusive.");
            return this.elements[4 * row + column];
        }, __proto.setElementByRowColumn = function(row, column, value) {
            if (row < 0 || 3 < row) throw new Error("row", "Rows and columns for matrices run from 0 to 3, inclusive.");
            if (column < 0 || 3 < column) throw new Error("column", "Rows and columns for matrices run from 0 to 3, inclusive.");
            this.elements[4 * row + column] = value;
        }, __proto.equalsOtherMatrix = function(other) {
            var e = this.elements, oe = other.elements;
            return MathUtils3D.nearEqual(e[0], oe[0]) && MathUtils3D.nearEqual(e[1], oe[1]) && MathUtils3D.nearEqual(e[2], oe[2]) && MathUtils3D.nearEqual(e[3], oe[3]) && MathUtils3D.nearEqual(e[4], oe[4]) && MathUtils3D.nearEqual(e[5], oe[5]) && MathUtils3D.nearEqual(e[6], oe[6]) && MathUtils3D.nearEqual(e[7], oe[7]) && MathUtils3D.nearEqual(e[8], oe[8]) && MathUtils3D.nearEqual(e[9], oe[9]) && MathUtils3D.nearEqual(e[10], oe[10]) && MathUtils3D.nearEqual(e[11], oe[11]) && MathUtils3D.nearEqual(e[12], oe[12]) && MathUtils3D.nearEqual(e[13], oe[13]) && MathUtils3D.nearEqual(e[14], oe[14]) && MathUtils3D.nearEqual(e[15], oe[15]);
        }, __proto.decomposeTransRotScale = function(translation, rotation, scale) {
            var rotationMatrix = Matrix4x4._tempMatrix4x4;
            return this.decomposeTransRotMatScale(translation, rotationMatrix, scale) ? (Quaternion.createFromMatrix4x4(rotationMatrix, rotation), 
            !0) : (rotation.identity(), !1);
        }, __proto.decomposeTransRotMatScale = function(translation, rotationMatrix, scale) {
            var e = this.elements, te = translation.elements, re = rotationMatrix.elements, se = scale.elements;
            te[0] = e[12], te[1] = e[13], te[2] = e[14];
            var m11 = e[0], m12 = e[1], m13 = e[2], m21 = e[4], m22 = e[5], m23 = e[6], m31 = e[8], m32 = e[9], m33 = e[10], sX = se[0] = Math.sqrt(m11 * m11 + m12 * m12 + m13 * m13), sY = se[1] = Math.sqrt(m21 * m21 + m22 * m22 + m23 * m23), sZ = se[2] = Math.sqrt(m31 * m31 + m32 * m32 + m33 * m33);
            if (MathUtils3D.isZero(sX) || MathUtils3D.isZero(sY) || MathUtils3D.isZero(sZ)) return re[1] = re[2] = re[3] = re[4] = re[6] = re[7] = re[8] = re[9] = re[11] = re[12] = re[13] = re[14] = 0, 
            re[0] = re[5] = re[10] = re[15] = 1, !1;
            var at = Matrix4x4._tempVector0, atE = at.elements;
            atE[0] = m31 / sZ, atE[1] = m32 / sZ, atE[2] = m33 / sZ;
            var tempRight = Matrix4x4._tempVector1, tempRightE = tempRight.elements;
            tempRightE[0] = m11 / sX, tempRightE[1] = m12 / sX, tempRightE[2] = m13 / sX;
            var up = Matrix4x4._tempVector2;
            Vector3.cross(at, tempRight, up);
            var right = Matrix4x4._tempVector1;
            return Vector3.cross(up, at, right), re[3] = re[7] = re[11] = re[12] = re[13] = re[14] = 0, 
            re[15] = 1, re[0] = right.x, re[1] = right.y, re[2] = right.z, re[4] = up.x, re[5] = up.y, 
            re[6] = up.z, re[8] = at.x, re[9] = at.y, re[10] = at.z, re[0] * m11 + re[1] * m12 + re[2] * m13 < 0 && (se[0] = -sX), 
            re[4] * m21 + re[5] * m22 + re[6] * m23 < 0 && (se[1] = -sY), re[8] * m31 + re[9] * m32 + re[10] * m33 < 0 && (se[2] = -sZ), 
            !0;
        }, __proto.decomposeYawPitchRoll = function(yawPitchRoll) {
            var yawPitchRollE = yawPitchRoll.elements, pitch = Math.asin(-this.elements[9]);
            yawPitchRollE[1] = pitch, Math.cos(pitch) > MathUtils3D.zeroTolerance ? (yawPitchRollE[2] = Math.atan2(this.elements[1], this.elements[5]), 
            yawPitchRollE[0] = Math.atan2(this.elements[8], this.elements[10])) : (yawPitchRollE[2] = Math.atan2(-this.elements[4], this.elements[0]), 
            yawPitchRollE[0] = 0);
        }, __proto.normalize = function() {
            var v = this.elements, c = v[0], d = v[1], e = v[2], g = Math.sqrt(c * c + d * d + e * e);
            if (!g) return v[0] = 0, v[1] = 0, void (v[2] = 0);
            1 != g && (g = 1 / g, v[0] = c * g, v[1] = d * g, v[2] = e * g);
        }, __proto.transpose = function() {
            var e, t;
            return t = (e = this.elements)[1], e[1] = e[4], e[4] = t, t = e[2], e[2] = e[8], 
            e[8] = t, t = e[3], e[3] = e[12], e[12] = t, t = e[6], e[6] = e[9], e[9] = t, t = e[7], 
            e[7] = e[13], e[13] = t, t = e[11], e[11] = e[14], e[14] = t, this;
        }, __proto.invert = function(out) {
            var ae = this.elements, oe = out.elements, a00 = ae[0], a01 = ae[1], a02 = ae[2], a03 = ae[3], a10 = ae[4], a11 = ae[5], a12 = ae[6], a13 = ae[7], a20 = ae[8], a21 = ae[9], a22 = ae[10], a23 = ae[11], a30 = ae[12], a31 = ae[13], a32 = ae[14], a33 = ae[15], b00 = a00 * a11 - a01 * a10, b01 = a00 * a12 - a02 * a10, b02 = a00 * a13 - a03 * a10, b03 = a01 * a12 - a02 * a11, b04 = a01 * a13 - a03 * a11, b05 = a02 * a13 - a03 * a12, b06 = a20 * a31 - a21 * a30, b07 = a20 * a32 - a22 * a30, b08 = a20 * a33 - a23 * a30, b09 = a21 * a32 - a22 * a31, b10 = a21 * a33 - a23 * a31, b11 = a22 * a33 - a23 * a32, det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
            0 !== Math.abs(det) && (det = 1 / det, oe[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det, 
            oe[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det, oe[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det, 
            oe[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det, oe[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det, 
            oe[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det, oe[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det, 
            oe[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det, oe[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det, 
            oe[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det, oe[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det, 
            oe[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det, oe[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det, 
            oe[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det, oe[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det, 
            oe[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det);
        }, __proto.identity = function() {
            var e = this.elements;
            e[1] = e[2] = e[3] = e[4] = e[6] = e[7] = e[8] = e[9] = e[11] = e[12] = e[13] = e[14] = 0, 
            e[0] = e[5] = e[10] = e[15] = 1;
        }, __proto.cloneTo = function(destObject) {
            var i, s, d;
            if ((s = this.elements) !== (d = destObject.elements)) for (i = 0; i < 16; ++i) d[i] = s[i];
        }, __proto.clone = function() {
            var dest = new this.constructor();
            return this.cloneTo(dest), dest;
        }, __proto.getTranslationVector = function(out) {
            var me = this.elements, te = out.elements;
            te[0] = me[12], te[1] = me[13], te[2] = me[14];
        }, __proto.setTranslationVector = function(translate) {
            var me = this.elements, ve = translate.elements;
            me[12] = ve[0], me[13] = ve[1], me[14] = ve[2];
        }, __proto.getForward = function(out) {
            var me = this.elements, te = out.elements;
            te[0] = -me[8], te[1] = -me[9], te[2] = -me[10];
        }, __proto.setForward = function(forward) {
            var me = this.elements, ve = forward.elements;
            me[8] = -ve[0], me[9] = -ve[1], me[10] = -ve[2];
        }, Matrix4x4.createRotationX = function(rad, out) {
            var oe = out.elements, s = Math.sin(rad), c = Math.cos(rad);
            oe[1] = oe[2] = oe[3] = oe[4] = oe[7] = oe[8] = oe[11] = oe[12] = oe[13] = oe[14] = 0, 
            oe[0] = oe[15] = 1, oe[5] = oe[10] = c, oe[6] = s, oe[9] = -s;
        }, Matrix4x4.createRotationY = function(rad, out) {
            var oe = out.elements, s = Math.sin(rad), c = Math.cos(rad);
            oe[1] = oe[3] = oe[4] = oe[6] = oe[7] = oe[9] = oe[11] = oe[12] = oe[13] = oe[14] = 0, 
            oe[5] = oe[15] = 1, oe[0] = oe[10] = c, oe[2] = -s, oe[8] = s;
        }, Matrix4x4.createRotationZ = function(rad, out) {
            var oe = out.elements, s = Math.sin(rad), c = Math.cos(rad);
            oe[2] = oe[3] = oe[6] = oe[7] = oe[8] = oe[9] = oe[11] = oe[12] = oe[13] = oe[14] = 0, 
            oe[10] = oe[15] = 1, oe[0] = oe[5] = c, oe[1] = s, oe[4] = -s;
        }, Matrix4x4.createRotationYawPitchRoll = function(yaw, pitch, roll, result) {
            Quaternion.createFromYawPitchRoll(yaw, pitch, roll, Matrix4x4._tempQuaternion), 
            Matrix4x4.createRotationQuaternion(Matrix4x4._tempQuaternion, result);
        }, Matrix4x4.createRotationAxis = function(axis, angle, result) {
            var axisE = axis.elements, x = axisE[0], y = axisE[1], z = axisE[2], cos = Math.cos(angle), sin = Math.sin(angle), xx = x * x, yy = y * y, zz = z * z, xy = x * y, xz = x * z, yz = y * z, resultE = result.elements;
            resultE[3] = resultE[7] = resultE[11] = resultE[12] = resultE[13] = resultE[14] = 0, 
            resultE[15] = 1, resultE[0] = xx + cos * (1 - xx), resultE[1] = xy - cos * xy + sin * z, 
            resultE[2] = xz - cos * xz - sin * y, resultE[4] = xy - cos * xy - sin * z, resultE[5] = yy + cos * (1 - yy), 
            resultE[6] = yz - cos * yz + sin * x, resultE[8] = xz - cos * xz + sin * y, resultE[9] = yz - cos * yz - sin * x, 
            resultE[10] = zz + cos * (1 - zz);
        }, Matrix4x4.createRotationQuaternion = function(rotation, result) {
            var rotationE = rotation.elements, resultE = result.elements, rotationX = rotationE[0], rotationY = rotationE[1], rotationZ = rotationE[2], rotationW = rotationE[3], xx = rotationX * rotationX, yy = rotationY * rotationY, zz = rotationZ * rotationZ, xy = rotationX * rotationY, zw = rotationZ * rotationW, zx = rotationZ * rotationX, yw = rotationY * rotationW, yz = rotationY * rotationZ, xw = rotationX * rotationW;
            resultE[3] = resultE[7] = resultE[11] = resultE[12] = resultE[13] = resultE[14] = 0, 
            resultE[15] = 1, resultE[0] = 1 - 2 * (yy + zz), resultE[1] = 2 * (xy + zw), resultE[2] = 2 * (zx - yw), 
            resultE[4] = 2 * (xy - zw), resultE[5] = 1 - 2 * (zz + xx), resultE[6] = 2 * (yz + xw), 
            resultE[8] = 2 * (zx + yw), resultE[9] = 2 * (yz - xw), resultE[10] = 1 - 2 * (yy + xx);
        }, Matrix4x4.createTranslate = function(trans, out) {
            var te = trans.elements, oe = out.elements;
            oe[4] = oe[8] = oe[1] = oe[9] = oe[2] = oe[6] = oe[3] = oe[7] = oe[11] = 0, oe[0] = oe[5] = oe[10] = oe[15] = 1, 
            oe[12] = te[0], oe[13] = te[1], oe[14] = te[2];
        }, Matrix4x4.createScaling = function(scale, out) {
            var se = scale.elements, oe = out.elements;
            oe[0] = se[0], oe[5] = se[1], oe[10] = se[2], oe[1] = oe[4] = oe[8] = oe[12] = oe[9] = oe[13] = oe[2] = oe[6] = oe[14] = oe[3] = oe[7] = oe[11] = 0, 
            oe[15] = 1;
        }, Matrix4x4.multiply = function(left, right, out) {
            var i, e, a, b, ai0, ai1, ai2, ai3;
            for (e = out.elements, a = left.elements, e === (b = right.elements) && (b = b.slice()), 
            i = 0; i < 4; i++) ai0 = a[i], ai1 = a[i + 4], ai2 = a[i + 8], ai3 = a[i + 12], 
            e[i] = ai0 * b[0] + ai1 * b[1] + ai2 * b[2] + ai3 * b[3], e[i + 4] = ai0 * b[4] + ai1 * b[5] + ai2 * b[6] + ai3 * b[7], 
            e[i + 8] = ai0 * b[8] + ai1 * b[9] + ai2 * b[10] + ai3 * b[11], e[i + 12] = ai0 * b[12] + ai1 * b[13] + ai2 * b[14] + ai3 * b[15];
        }, Matrix4x4.createFromQuaternion = function(rotation, out) {
            var e = out.elements, q = rotation.elements, x = q[0], y = q[1], z = q[2], w = q[3], x2 = x + x, y2 = y + y, z2 = z + z, xx = x * x2, yx = y * x2, yy = y * y2, zx = z * x2, zy = z * y2, zz = z * z2, wx = w * x2, wy = w * y2, wz = w * z2;
            e[0] = 1 - yy - zz, e[1] = yx + wz, e[2] = zx - wy, e[3] = 0, e[4] = yx - wz, e[5] = 1 - xx - zz, 
            e[6] = zy + wx, e[7] = 0, e[8] = zx + wy, e[9] = zy - wx, e[10] = 1 - xx - yy, e[11] = 0, 
            e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1;
        }, Matrix4x4.createAffineTransformation = function(trans, rot, scale, out) {
            var te = trans.elements, re = rot.elements, se = scale.elements, oe = out.elements, x = re[0], y = re[1], z = re[2], w = re[3], x2 = x + x, y2 = y + y, z2 = z + z, xx = x * x2, xy = x * y2, xz = x * z2, yy = y * y2, yz = y * z2, zz = z * z2, wx = w * x2, wy = w * y2, wz = w * z2, sx = se[0], sy = se[1], sz = se[2];
            oe[0] = (1 - (yy + zz)) * sx, oe[1] = (xy + wz) * sx, oe[2] = (xz - wy) * sx, oe[3] = 0, 
            oe[4] = (xy - wz) * sy, oe[5] = (1 - (xx + zz)) * sy, oe[6] = (yz + wx) * sy, oe[7] = 0, 
            oe[8] = (xz + wy) * sz, oe[9] = (yz - wx) * sz, oe[10] = (1 - (xx + yy)) * sz, oe[11] = 0, 
            oe[12] = te[0], oe[13] = te[1], oe[14] = te[2], oe[15] = 1;
        }, Matrix4x4.createLookAt = function(eye, target, up, out) {
            var oE = out.elements, xaxis = Matrix4x4._tempVector0, yaxis = Matrix4x4._tempVector1, zaxis = Matrix4x4._tempVector2;
            Vector3.subtract(eye, target, zaxis), Vector3.normalize(zaxis, zaxis), Vector3.cross(up, zaxis, xaxis), 
            Vector3.normalize(xaxis, xaxis), Vector3.cross(zaxis, xaxis, yaxis), out.identity(), 
            oE[0] = xaxis.x, oE[4] = xaxis.y, oE[8] = xaxis.z, oE[1] = yaxis.x, oE[5] = yaxis.y, 
            oE[9] = yaxis.z, oE[2] = zaxis.x, oE[6] = zaxis.y, oE[10] = zaxis.z, oE[12] = -Vector3.dot(xaxis, eye), 
            oE[13] = -Vector3.dot(yaxis, eye), oE[14] = -Vector3.dot(zaxis, eye);
        }, Matrix4x4.createPerspective = function(fov, aspect, near, far, out) {
            var oe = out.elements, f = 1 / Math.tan(fov / 2), nf = 1 / (near - far);
            oe[0] = f / aspect, oe[5] = f, oe[10] = (far + near) * nf, oe[11] = -1, oe[14] = 2 * far * near * nf, 
            oe[1] = oe[2] = oe[3] = oe[4] = oe[6] = oe[7] = oe[8] = oe[9] = oe[12] = oe[13] = oe[15] = 0;
        }, Matrix4x4.createOrthoOffCenterRH = function(left, right, bottom, top, near, far, out) {
            var oe = out.elements, lr = 1 / (left - right), bt = 1 / (bottom - top), nf = 1 / (near - far);
            oe[1] = oe[2] = oe[3] = oe[4] = oe[6] = oe[7] = oe[8] = oe[9] = oe[11] = 0, oe[15] = 1, 
            oe[0] = -2 * lr, oe[5] = -2 * bt, oe[10] = 2 * nf, oe[12] = (left + right) * lr, 
            oe[13] = (top + bottom) * bt, oe[14] = (far + near) * nf;
        }, Matrix4x4.translation = function(v3, out) {
            var ve = v3.elements, oe = out.elements;
            oe[0] = oe[5] = oe[10] = oe[15] = 1, oe[12] = ve[0], oe[13] = ve[1], oe[14] = ve[2];
        }, __static(Matrix4x4, [ "_tempMatrix4x4", function() {
            return this._tempMatrix4x4 = new Matrix4x4();
        }, "_tempVector0", function() {
            return this._tempVector0 = new Vector3();
        }, "_tempVector1", function() {
            return this._tempVector1 = new Vector3();
        }, "_tempVector2", function() {
            return this._tempVector2 = new Vector3();
        }, "_tempQuaternion", function() {
            return this._tempQuaternion = new Quaternion();
        }, "DEFAULT", function() {
            return this.DEFAULT = new Matrix4x4();
        }, "ZERO", function() {
            return this.ZERO = new Matrix4x4(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
        } ]), Matrix4x4;
    }(), Plane = (function() {
        function OrientedBoundBox(extents, transformation) {
            this.extents = null, this.transformation = null, this.extents = extents, this.transformation = transformation;
        }
        __class(OrientedBoundBox, "laya.d3.math.OrientedBoundBox");
        var __proto = OrientedBoundBox.prototype;
        __proto.getCorners = function(corners) {
            var xve = OrientedBoundBox._tempV30.elements, yve = OrientedBoundBox._tempV31.elements, zve = OrientedBoundBox._tempV32.elements, extentsE = this.extents.elements;
            xve[0] = extentsE[0], xve[1] = xve[2] = 0, yve[1] = extentsE[1], yve[0] = yve[2] = 0, 
            zve[2] = extentsE[2], zve[0] = zve[1] = 0, Vector3.TransformNormal(OrientedBoundBox._tempV30, this.transformation, OrientedBoundBox._tempV30), 
            Vector3.TransformNormal(OrientedBoundBox._tempV31, this.transformation, OrientedBoundBox._tempV31), 
            Vector3.TransformNormal(OrientedBoundBox._tempV32, this.transformation, OrientedBoundBox._tempV32);
            var center = OrientedBoundBox._tempV33;
            this.transformation.getTranslationVector(center), corners.length = 8, Vector3.add(center, OrientedBoundBox._tempV30, OrientedBoundBox._tempV34), 
            Vector3.add(OrientedBoundBox._tempV34, OrientedBoundBox._tempV31, OrientedBoundBox._tempV34), 
            Vector3.add(OrientedBoundBox._tempV34, OrientedBoundBox._tempV32, corners[0]), Vector3.add(center, OrientedBoundBox._tempV30, OrientedBoundBox._tempV34), 
            Vector3.add(OrientedBoundBox._tempV34, OrientedBoundBox._tempV31, OrientedBoundBox._tempV34), 
            Vector3.subtract(OrientedBoundBox._tempV34, OrientedBoundBox._tempV32, corners[1]), 
            Vector3.subtract(center, OrientedBoundBox._tempV30, OrientedBoundBox._tempV34), 
            Vector3.add(OrientedBoundBox._tempV34, OrientedBoundBox._tempV31, OrientedBoundBox._tempV34), 
            Vector3.subtract(OrientedBoundBox._tempV34, OrientedBoundBox._tempV32, corners[2]), 
            Vector3.subtract(center, OrientedBoundBox._tempV30, OrientedBoundBox._tempV34), 
            Vector3.add(OrientedBoundBox._tempV34, OrientedBoundBox._tempV31, OrientedBoundBox._tempV34), 
            Vector3.add(OrientedBoundBox._tempV34, OrientedBoundBox._tempV32, corners[3]), Vector3.add(center, OrientedBoundBox._tempV30, OrientedBoundBox._tempV34), 
            Vector3.subtract(OrientedBoundBox._tempV34, OrientedBoundBox._tempV31, OrientedBoundBox._tempV34), 
            Vector3.add(OrientedBoundBox._tempV34, OrientedBoundBox._tempV32, corners[4]), Vector3.add(center, OrientedBoundBox._tempV30, OrientedBoundBox._tempV34), 
            Vector3.subtract(OrientedBoundBox._tempV34, OrientedBoundBox._tempV31, OrientedBoundBox._tempV34), 
            Vector3.subtract(OrientedBoundBox._tempV34, OrientedBoundBox._tempV32, corners[5]), 
            Vector3.subtract(center, OrientedBoundBox._tempV30, OrientedBoundBox._tempV34), 
            Vector3.subtract(OrientedBoundBox._tempV34, OrientedBoundBox._tempV31, OrientedBoundBox._tempV34), 
            Vector3.subtract(OrientedBoundBox._tempV34, OrientedBoundBox._tempV32, corners[6]), 
            Vector3.subtract(center, OrientedBoundBox._tempV30, OrientedBoundBox._tempV34), 
            Vector3.subtract(OrientedBoundBox._tempV34, OrientedBoundBox._tempV31, OrientedBoundBox._tempV34), 
            Vector3.add(OrientedBoundBox._tempV34, OrientedBoundBox._tempV32, corners[7]);
        }, __proto.transform = function(mat) {
            Matrix4x4.multiply(this.transformation, mat, this.transformation);
        }, __proto.scale = function(scaling) {
            Vector3.multiply(this.extents, scaling, this.extents);
        }, __proto.translate = function(translation) {
            this.transformation.getTranslationVector(OrientedBoundBox._tempV30), Vector3.add(OrientedBoundBox._tempV30, translation, OrientedBoundBox._tempV31), 
            this.transformation.setTranslationVector(OrientedBoundBox._tempV31);
        }, __proto.Size = function(out) {
            Vector3.scale(this.extents, 2, out);
        }, __proto.getSize = function(out) {
            var extentsE = this.extents.elements;
            OrientedBoundBox._tempV30.x = extentsE[0], OrientedBoundBox._tempV31.y = extentsE[1], 
            OrientedBoundBox._tempV32.z = extentsE[2], Vector3.TransformNormal(OrientedBoundBox._tempV30, this.transformation, OrientedBoundBox._tempV30), 
            Vector3.TransformNormal(OrientedBoundBox._tempV31, this.transformation, OrientedBoundBox._tempV31), 
            Vector3.TransformNormal(OrientedBoundBox._tempV31, this.transformation, OrientedBoundBox._tempV32);
            var oe = out.elements;
            oe[0] = Vector3.scalarLength(OrientedBoundBox._tempV30), oe[1] = Vector3.scalarLength(OrientedBoundBox._tempV31), 
            oe[2] = Vector3.scalarLength(OrientedBoundBox._tempV32);
        }, __proto.getSizeSquared = function(out) {
            var extentsE = this.extents.elements;
            OrientedBoundBox._tempV30.x = extentsE[0], OrientedBoundBox._tempV31.y = extentsE[1], 
            OrientedBoundBox._tempV32.z = extentsE[2], Vector3.TransformNormal(OrientedBoundBox._tempV30, this.transformation, OrientedBoundBox._tempV30), 
            Vector3.TransformNormal(OrientedBoundBox._tempV31, this.transformation, OrientedBoundBox._tempV31), 
            Vector3.TransformNormal(OrientedBoundBox._tempV31, this.transformation, OrientedBoundBox._tempV32);
            var oe = out.elements;
            oe[0] = Vector3.scalarLengthSquared(OrientedBoundBox._tempV30), oe[1] = Vector3.scalarLengthSquared(OrientedBoundBox._tempV31), 
            oe[2] = Vector3.scalarLengthSquared(OrientedBoundBox._tempV32);
        }, __proto.getCenter = function(center) {
            this.transformation.getTranslationVector(center);
        }, __proto.containsPoint = function(point) {
            var extentsE = this.extents.elements, extentsEX = extentsE[0], extentsEY = extentsE[1], extentsEZ = extentsE[2];
            this.transformation.invert(OrientedBoundBox._tempM0), Vector3.transformCoordinate(point, OrientedBoundBox._tempM0, OrientedBoundBox._tempV30);
            var _tempV30e = OrientedBoundBox._tempV30.elements, _tempV30ex = Math.abs(_tempV30e[0]), _tempV30ey = Math.abs(_tempV30e[1]), _tempV30ez = Math.abs(_tempV30e[2]);
            return MathUtils3D.nearEqual(_tempV30ex, extentsEX) && MathUtils3D.nearEqual(_tempV30ey, extentsEY) && MathUtils3D.nearEqual(_tempV30ez, extentsEZ) ? 2 : _tempV30ex < extentsEX && _tempV30ey < extentsEY && _tempV30ez < extentsEZ ? 1 : 0;
        }, __proto.containsPoints = function(points) {
            var extentse = this.extents.elements, extentsex = extentse[0], extentsey = extentse[1], extentsez = extentse[2];
            this.transformation.invert(OrientedBoundBox._tempM0);
            for (var containsAll = !0, containsAny = !1, i = 0; i < points.length; i++) {
                Vector3.transformCoordinate(points[i], OrientedBoundBox._tempM0, OrientedBoundBox._tempV30);
                var _tempV30e = OrientedBoundBox._tempV30.elements, _tempV30ex = Math.abs(_tempV30e[0]), _tempV30ey = Math.abs(_tempV30e[1]), _tempV30ez = Math.abs(_tempV30e[2]);
                MathUtils3D.nearEqual(_tempV30ex, extentsex) && MathUtils3D.nearEqual(_tempV30ey, extentsey) && MathUtils3D.nearEqual(_tempV30ez, extentsez) && (containsAny = !0), 
                _tempV30ex < extentsex && _tempV30ey < extentsey && _tempV30ez < extentsez ? containsAny = !0 : containsAll = !1;
            }
            return containsAll ? 1 : containsAny ? 2 : 0;
        }, __proto.containsSphere = function(sphere, ignoreScale) {
            void 0 === ignoreScale && (ignoreScale = !1);
            var extentsE = this.extents.elements, extentsEX = extentsE[0], extentsEY = extentsE[1], extentsEZ = extentsE[2], sphereR = sphere.radius;
            this.transformation.invert(OrientedBoundBox._tempM0), Vector3.transformCoordinate(sphere.center, OrientedBoundBox._tempM0, OrientedBoundBox._tempV30);
            var locRadius = NaN;
            if (locRadius = ignoreScale ? sphereR : (Vector3.scale(Vector3.UnitX, sphereR, OrientedBoundBox._tempV31), 
            Vector3.TransformNormal(OrientedBoundBox._tempV31, OrientedBoundBox._tempM0, OrientedBoundBox._tempV31), 
            Vector3.scalarLength(OrientedBoundBox._tempV31)), Vector3.scale(this.extents, -1, OrientedBoundBox._tempV32), 
            Vector3.Clamp(OrientedBoundBox._tempV30, OrientedBoundBox._tempV32, this.extents, OrientedBoundBox._tempV33), 
            locRadius * locRadius < Vector3.distanceSquared(OrientedBoundBox._tempV30, OrientedBoundBox._tempV33)) return 0;
            var tempV30e = OrientedBoundBox._tempV30.elements, tempV30ex = tempV30e[0], tempV30ey = tempV30e[1], tempV30ez = tempV30e[2], tempV32e = OrientedBoundBox._tempV32.elements, tempV32ex = tempV32e[0], tempV32ey = tempV32e[1], tempV32ez = tempV32e[2];
            return tempV32ex + locRadius <= tempV30ex && tempV30ex <= extentsEX - locRadius && locRadius < extentsEX - tempV32ex && tempV32ey + locRadius <= tempV30ey && tempV30ey <= extentsEY - locRadius && locRadius < extentsEY - tempV32ey && tempV32ez + locRadius <= tempV30ez && tempV30ez <= extentsEZ - locRadius && locRadius < extentsEZ - tempV32ez ? 1 : 2;
        }, __proto.containsOrientedBoundBox = function(obb) {
            var i = 0, k = 0;
            obb.getCorners(OrientedBoundBox._corners);
            var cornersCheck = this.containsPoints(OrientedBoundBox._corners);
            if (0 != cornersCheck) return cornersCheck;
            var sizeAe = this.extents.elements;
            obb.extents.cloneTo(OrientedBoundBox._tempV35);
            var sizeBe = OrientedBoundBox._tempV35.elements;
            OrientedBoundBox._getRows(this.transformation, OrientedBoundBox._rows1), OrientedBoundBox._getRows(obb.transformation, OrientedBoundBox._rows2);
            var dotNumber = NaN;
            for (i = 0; i < 4; i++) for (k = 0; k < 4; k++) 3 == i || 3 == k ? (OrientedBoundBox._tempM0.setElementByRowColumn(i, k, 0), 
            OrientedBoundBox._tempM1.setElementByRowColumn(i, k, 0)) : (dotNumber = Vector3.dot(OrientedBoundBox._rows1[i], OrientedBoundBox._rows2[k]), 
            OrientedBoundBox._tempM0.setElementByRowColumn(i, k, dotNumber), OrientedBoundBox._tempM1.setElementByRowColumn(i, k, Math.abs(dotNumber)));
            obb.getCenter(OrientedBoundBox._tempV34), this.getCenter(OrientedBoundBox._tempV36), 
            Vector3.subtract(OrientedBoundBox._tempV34, OrientedBoundBox._tempV36, OrientedBoundBox._tempV30);
            var vsepAe = OrientedBoundBox._tempV31.elements;
            vsepAe[0] = Vector3.dot(OrientedBoundBox._tempV30, OrientedBoundBox._rows1[0]), 
            vsepAe[1] = Vector3.dot(OrientedBoundBox._tempV30, OrientedBoundBox._rows1[1]), 
            vsepAe[2] = Vector3.dot(OrientedBoundBox._tempV30, OrientedBoundBox._rows1[2]);
            var _tempV32e = OrientedBoundBox._tempV32.elements, _tempV33e = OrientedBoundBox._tempV33.elements;
            for (i = 0; i < 3; i++) if (_tempV32e[0] = OrientedBoundBox._tempM1.getElementByRowColumn(i, 0), 
            _tempV32e[1] = OrientedBoundBox._tempM1.getElementByRowColumn(i, 1), _tempV32e[2] = OrientedBoundBox._tempM1.getElementByRowColumn(i, 2), 
            sizeAe[i] + Vector3.dot(OrientedBoundBox._tempV35, OrientedBoundBox._tempV32) < Math.abs(vsepAe[i])) return 0;
            for (k = 0; k < 3; k++) if (_tempV32e[0] = OrientedBoundBox._tempM1.getElementByRowColumn(0, k), 
            _tempV32e[1] = OrientedBoundBox._tempM1.getElementByRowColumn(1, k), _tempV32e[2] = OrientedBoundBox._tempM1.getElementByRowColumn(2, k), 
            _tempV33e[0] = OrientedBoundBox._tempM0.getElementByRowColumn(0, k), _tempV33e[1] = OrientedBoundBox._tempM0.getElementByRowColumn(1, k), 
            _tempV33e[2] = OrientedBoundBox._tempM0.getElementByRowColumn(2, k), Vector3.dot(this.extents, OrientedBoundBox._tempV32) + sizeBe[k] < Math.abs(Vector3.dot(OrientedBoundBox._tempV31, OrientedBoundBox._tempV33))) return 0;
            for (i = 0; i < 3; i++) for (k = 0; k < 3; k++) {
                var i1 = (i + 1) % 3, i2 = (i + 2) % 3, k1 = (k + 1) % 3, k2 = (k + 2) % 3;
                if (sizeAe[i1] * OrientedBoundBox._tempM1.getElementByRowColumn(i2, k) + sizeAe[i2] * OrientedBoundBox._tempM1.getElementByRowColumn(i1, k) + (sizeBe[k1] * OrientedBoundBox._tempM1.getElementByRowColumn(i, k2) + sizeBe[k2] * OrientedBoundBox._tempM1.getElementByRowColumn(i, k1)) < Math.abs(vsepAe[i2] * OrientedBoundBox._tempM0.getElementByRowColumn(i1, k) - vsepAe[i1] * OrientedBoundBox._tempM0.getElementByRowColumn(i2, k))) return 0;
            }
            return 2;
        }, __proto.containsLine = function(point1, point2) {
            OrientedBoundBox._corners[0] = point1, OrientedBoundBox._corners[1] = point2;
            var cornersCheck = this.containsPoints(OrientedBoundBox._corners);
            if (0 != cornersCheck) return cornersCheck;
            var extentsE = this.extents.elements, extentsX = extentsE[0], extentsY = extentsE[1], extentsZ = extentsE[2];
            this.transformation.invert(OrientedBoundBox._tempM0), Vector3.transformCoordinate(point1, OrientedBoundBox._tempM0, OrientedBoundBox._tempV30), 
            Vector3.transformCoordinate(point2, OrientedBoundBox._tempM0, OrientedBoundBox._tempV31), 
            Vector3.add(OrientedBoundBox._tempV30, OrientedBoundBox._tempV31, OrientedBoundBox._tempV32), 
            Vector3.scale(OrientedBoundBox._tempV32, .5, OrientedBoundBox._tempV32), Vector3.subtract(OrientedBoundBox._tempV30, OrientedBoundBox._tempV32, OrientedBoundBox._tempV33);
            var _tempV33e = OrientedBoundBox._tempV33.elements, _tempV33X = _tempV33e[0], _tempV33Y = _tempV33e[1], _tempV33Z = _tempV33e[2], _tempV34e = OrientedBoundBox._tempV34.elements, _tempV34X = _tempV34e[0] = Math.abs(_tempV33e[0]), _tempV34Y = _tempV34e[1] = Math.abs(_tempV33e[1]), _tempV34Z = _tempV34e[2] = Math.abs(_tempV33e[2]), _tempV32e = OrientedBoundBox._tempV32.elements, _tempV32X = _tempV32e[0], _tempV32Y = _tempV32e[1], _tempV32Z = _tempV32e[2];
            return Math.abs(_tempV32X) > extentsX + _tempV34X ? 0 : Math.abs(_tempV32Y) > extentsY + _tempV34Y ? 0 : Math.abs(_tempV32Z) > extentsZ + _tempV34Z ? 0 : Math.abs(_tempV32Y * _tempV33Z - _tempV32Z * _tempV33Y) > extentsY * _tempV34Z + extentsZ * _tempV34Y ? 0 : Math.abs(_tempV32X * _tempV33Z - _tempV32Z * _tempV33X) > extentsX * _tempV34Z + extentsZ * _tempV34X ? 0 : Math.abs(_tempV32X * _tempV33Y - _tempV32Y * _tempV33X) > extentsX * _tempV34Y + extentsY * _tempV34X ? 0 : 2;
        }, __proto.containsBoundBox = function(box) {
            var i = 0, k = 0, min = box.min, max = box.max;
            box.getCorners(OrientedBoundBox._corners);
            var cornersCheck = this.containsPoints(OrientedBoundBox._corners);
            if (0 != cornersCheck) return cornersCheck;
            Vector3.subtract(max, min, OrientedBoundBox._tempV30), Vector3.scale(OrientedBoundBox._tempV30, .5, OrientedBoundBox._tempV30), 
            Vector3.add(min, OrientedBoundBox._tempV30, OrientedBoundBox._tempV30), Vector3.subtract(max, OrientedBoundBox._tempV30, OrientedBoundBox._tempV31);
            var sizeAe = this.extents.elements, sizeBe = OrientedBoundBox._tempV31.elements;
            OrientedBoundBox._getRows(this.transformation, OrientedBoundBox._rows1), this.transformation.invert(OrientedBoundBox._tempM0);
            for (i = 0; i < 3; i++) for (k = 0; k < 3; k++) OrientedBoundBox._tempM1.setElementByRowColumn(i, k, Math.abs(OrientedBoundBox._tempM0.getElementByRowColumn(i, k)));
            this.getCenter(OrientedBoundBox._tempV35), Vector3.subtract(OrientedBoundBox._tempV30, OrientedBoundBox._tempV35, OrientedBoundBox._tempV32);
            var vsepAe = OrientedBoundBox._tempV31.elements;
            vsepAe[0] = Vector3.dot(OrientedBoundBox._tempV32, OrientedBoundBox._rows1[0]), 
            vsepAe[1] = Vector3.dot(OrientedBoundBox._tempV32, OrientedBoundBox._rows1[1]), 
            vsepAe[2] = Vector3.dot(OrientedBoundBox._tempV32, OrientedBoundBox._rows1[2]);
            var _tempV33e = OrientedBoundBox._tempV33.elements, _tempV34e = OrientedBoundBox._tempV34.elements;
            for (i = 0; i < 3; i++) if (_tempV33e[0] = OrientedBoundBox._tempM1.getElementByRowColumn(i, 0), 
            _tempV33e[1] = OrientedBoundBox._tempM1.getElementByRowColumn(i, 1), _tempV33e[2] = OrientedBoundBox._tempM1.getElementByRowColumn(i, 2), 
            sizeAe[i] + Vector3.dot(OrientedBoundBox._tempV31, OrientedBoundBox._tempV33) < Math.abs(vsepAe[i])) return 0;
            for (k = 0; k < 3; k++) if (_tempV33e[0] = OrientedBoundBox._tempM1.getElementByRowColumn(0, k), 
            _tempV33e[1] = OrientedBoundBox._tempM1.getElementByRowColumn(1, k), _tempV33e[2] = OrientedBoundBox._tempM1.getElementByRowColumn(2, k), 
            _tempV34e[0] = OrientedBoundBox._tempM0.getElementByRowColumn(0, k), _tempV34e[1] = OrientedBoundBox._tempM0.getElementByRowColumn(1, k), 
            _tempV34e[2] = OrientedBoundBox._tempM0.getElementByRowColumn(2, k), Vector3.dot(this.extents, OrientedBoundBox._tempV33) + sizeBe[k] < Math.abs(Vector3.dot(OrientedBoundBox._tempV31, OrientedBoundBox._tempV34))) return 0;
            for (i = 0; i < 3; i++) for (k = 0; k < 3; k++) {
                var i1 = (i + 1) % 3, i2 = (i + 2) % 3, k1 = (k + 1) % 3, k2 = (k + 2) % 3;
                if (sizeAe[i1] * OrientedBoundBox._tempM1.getElementByRowColumn(i2, k) + sizeAe[i2] * OrientedBoundBox._tempM1.getElementByRowColumn(i1, k) + (sizeBe[k1] * OrientedBoundBox._tempM1.getElementByRowColumn(i, k2) + sizeBe[k2] * OrientedBoundBox._tempM1.getElementByRowColumn(i, k1)) < Math.abs(vsepAe[i2] * OrientedBoundBox._tempM0.getElementByRowColumn(i1, k) - vsepAe[i1] * OrientedBoundBox._tempM0.getElementByRowColumn(i2, k))) return 0;
            }
            return 2;
        }, __proto.intersectsRay = function(ray, out) {
            Vector3.scale(this.extents, -1, OrientedBoundBox._tempV30), this.transformation.invert(OrientedBoundBox._tempM0), 
            Vector3.TransformNormal(ray.direction, OrientedBoundBox._tempM0, OrientedBoundBox._ray.direction), 
            Vector3.transformCoordinate(ray.origin, OrientedBoundBox._tempM0, OrientedBoundBox._ray.origin), 
            OrientedBoundBox._boxBound1.min = OrientedBoundBox._tempV30, OrientedBoundBox._boxBound1.max = this.extents;
            var intersects = Collision.intersectsRayAndBoxRP(OrientedBoundBox._ray, OrientedBoundBox._boxBound1, out);
            return -1 !== intersects && Vector3.transformCoordinate(out, this.transformation, out), 
            intersects;
        }, __proto._getLocalCorners = function(corners) {
            corners.length = 8;
            var extentsE = this.extents.elements;
            OrientedBoundBox._tempV30.x = extentsE[0], OrientedBoundBox._tempV31.y = extentsE[1], 
            OrientedBoundBox._tempV32.z = extentsE[2], Vector3.add(OrientedBoundBox._tempV30, OrientedBoundBox._tempV31, OrientedBoundBox._tempV33), 
            Vector3.add(OrientedBoundBox._tempV33, OrientedBoundBox._tempV32, corners[0]), Vector3.add(OrientedBoundBox._tempV30, OrientedBoundBox._tempV31, OrientedBoundBox._tempV33), 
            Vector3.subtract(OrientedBoundBox._tempV33, OrientedBoundBox._tempV32, corners[1]), 
            Vector3.subtract(OrientedBoundBox._tempV31, OrientedBoundBox._tempV30, OrientedBoundBox._tempV33), 
            Vector3.subtract(OrientedBoundBox._tempV33, OrientedBoundBox._tempV30, corners[2]), 
            Vector3.subtract(OrientedBoundBox._tempV31, OrientedBoundBox._tempV30, OrientedBoundBox._tempV33), 
            Vector3.add(OrientedBoundBox._tempV33, OrientedBoundBox._tempV32, corners[3]), Vector3.subtract(OrientedBoundBox._tempV30, OrientedBoundBox._tempV31, OrientedBoundBox._tempV33), 
            Vector3.add(OrientedBoundBox._tempV33, OrientedBoundBox._tempV32, corners[4]), Vector3.subtract(OrientedBoundBox._tempV30, OrientedBoundBox._tempV31, OrientedBoundBox._tempV33), 
            Vector3.subtract(OrientedBoundBox._tempV33, OrientedBoundBox._tempV32, corners[5]), 
            Vector3.scale(corners[0], -1, corners[6]), Vector3.subtract(OrientedBoundBox._tempV32, OrientedBoundBox._tempV30, OrientedBoundBox._tempV33), 
            Vector3.subtract(OrientedBoundBox._tempV33, OrientedBoundBox._tempV31, corners[7]);
        }, __proto.equals = function(obb) {
            return this.extents == obb.extents && this.transformation == obb.transformation;
        }, __proto.cloneTo = function(destObject) {
            var dest = destObject;
            this.extents.cloneTo(dest.extents), this.transformation.cloneTo(dest.transformation);
        }, OrientedBoundBox.createByBoundBox = function(box, out) {
            var min = box.min, max = box.max;
            Vector3.subtract(max, min, OrientedBoundBox._tempV30), Vector3.scale(OrientedBoundBox._tempV30, .5, OrientedBoundBox._tempV30), 
            Vector3.add(min, OrientedBoundBox._tempV30, OrientedBoundBox._tempV31), Vector3.subtract(max, OrientedBoundBox._tempV31, OrientedBoundBox._tempV32), 
            Matrix4x4.translation(OrientedBoundBox._tempV31, OrientedBoundBox._tempM0);
            var extents = OrientedBoundBox._tempV32.clone(), transformation = OrientedBoundBox._tempM0.clone();
            out.extents = extents, out.transformation = transformation;
        }, OrientedBoundBox.createByMinAndMaxVertex = function(min, max) {
            return Vector3.subtract(max, min, OrientedBoundBox._tempV30), Vector3.scale(OrientedBoundBox._tempV30, .5, OrientedBoundBox._tempV30), 
            Vector3.add(min, OrientedBoundBox._tempV30, OrientedBoundBox._tempV31), Vector3.subtract(max, OrientedBoundBox._tempV31, OrientedBoundBox._tempV32), 
            Matrix4x4.translation(OrientedBoundBox._tempV31, OrientedBoundBox._tempM0), new OrientedBoundBox(OrientedBoundBox._tempV32, OrientedBoundBox._tempM0);
        }, OrientedBoundBox._getRows = function(mat, out) {
            out.length = 3;
            var mate = mat.elements, row0e = out[0].elements;
            row0e[0] = mate[0], row0e[1] = mate[1], row0e[2] = mate[2];
            var row1e = out[1].elements;
            row1e[0] = mate[4], row1e[1] = mate[5], row1e[2] = mate[6];
            var row2e = out[2].elements;
            row2e[0] = mate[8], row2e[1] = mate[9], row2e[2] = mate[10];
        }, OrientedBoundBox.getObbtoObbMatrix4x4 = function(a, b, noMatrixScaleApplied, out) {
            var at = a.transformation, bt = b.transformation;
            if (noMatrixScaleApplied) {
                OrientedBoundBox._getRows(at, OrientedBoundBox._rows1), OrientedBoundBox._getRows(bt, OrientedBoundBox._rows2);
                for (var i = 0; i < 3; i++) for (var k = 0; k < 3; k++) out.setElementByRowColumn(i, k, Vector3.dot(OrientedBoundBox._rows2[i], OrientedBoundBox._rows1[k]));
                b.getCenter(OrientedBoundBox._tempV30), a.getCenter(OrientedBoundBox._tempV31), 
                Vector3.subtract(OrientedBoundBox._tempV30, OrientedBoundBox._tempV31, OrientedBoundBox._tempV32);
                var AtoBMe = out.elements;
                AtoBMe[12] = Vector3.dot(OrientedBoundBox._tempV32, OrientedBoundBox._rows1[0]), 
                AtoBMe[13] = Vector3.dot(OrientedBoundBox._tempV32, OrientedBoundBox._rows1[1]), 
                AtoBMe[14] = Vector3.dot(OrientedBoundBox._tempV32, OrientedBoundBox._rows1[2]), 
                AtoBMe[15] = 1;
            } else at.invert(OrientedBoundBox._tempM0), Matrix4x4.multiply(bt, OrientedBoundBox._tempM0, out);
        }, OrientedBoundBox.merge = function(a, b, noMatrixScaleApplied) {
            var ae = a.extents, at = a.transformation;
            OrientedBoundBox.getObbtoObbMatrix4x4(a, b, noMatrixScaleApplied, OrientedBoundBox._tempM0), 
            b._getLocalCorners(OrientedBoundBox._corners), Vector3.transformCoordinate(OrientedBoundBox._corners[0], OrientedBoundBox._tempM0, OrientedBoundBox._corners[0]), 
            Vector3.transformCoordinate(OrientedBoundBox._corners[1], OrientedBoundBox._tempM0, OrientedBoundBox._corners[1]), 
            Vector3.transformCoordinate(OrientedBoundBox._corners[2], OrientedBoundBox._tempM0, OrientedBoundBox._corners[2]), 
            Vector3.transformCoordinate(OrientedBoundBox._corners[3], OrientedBoundBox._tempM0, OrientedBoundBox._corners[3]), 
            Vector3.transformCoordinate(OrientedBoundBox._corners[4], OrientedBoundBox._tempM0, OrientedBoundBox._corners[4]), 
            Vector3.transformCoordinate(OrientedBoundBox._corners[5], OrientedBoundBox._tempM0, OrientedBoundBox._corners[5]), 
            Vector3.transformCoordinate(OrientedBoundBox._corners[6], OrientedBoundBox._tempM0, OrientedBoundBox._corners[6]), 
            Vector3.transformCoordinate(OrientedBoundBox._corners[7], OrientedBoundBox._tempM0, OrientedBoundBox._corners[7]), 
            Vector3.scale(ae, -1, OrientedBoundBox._boxBound1.min), ae.cloneTo(OrientedBoundBox._boxBound1.max), 
            BoundBox.createfromPoints(OrientedBoundBox._corners, OrientedBoundBox._boxBound2), 
            BoundBox.merge(OrientedBoundBox._boxBound2, OrientedBoundBox._boxBound1, OrientedBoundBox._boxBound3);
            var box3Min = OrientedBoundBox._boxBound3.min, box3Max = OrientedBoundBox._boxBound3.max;
            Vector3.subtract(box3Max, box3Min, OrientedBoundBox._tempV30), Vector3.scale(OrientedBoundBox._tempV30, .5, OrientedBoundBox._tempV30), 
            Vector3.add(box3Min, OrientedBoundBox._tempV30, OrientedBoundBox._tempV32), Vector3.subtract(box3Max, OrientedBoundBox._tempV32, ae), 
            Vector3.transformCoordinate(OrientedBoundBox._tempV32, at, OrientedBoundBox._tempV33);
        }, __static(OrientedBoundBox, [ "_tempV30", function() {
            return this._tempV30 = new Vector3();
        }, "_tempV31", function() {
            return this._tempV31 = new Vector3();
        }, "_tempV32", function() {
            return this._tempV32 = new Vector3();
        }, "_tempV33", function() {
            return this._tempV33 = new Vector3();
        }, "_tempV34", function() {
            return this._tempV34 = new Vector3();
        }, "_tempV35", function() {
            return this._tempV35 = new Vector3();
        }, "_tempV36", function() {
            return this._tempV36 = new Vector3();
        }, "_tempM0", function() {
            return this._tempM0 = new Matrix4x4();
        }, "_tempM1", function() {
            return this._tempM1 = new Matrix4x4();
        }, "_corners", function() {
            return this._corners = [ new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3() ];
        }, "_rows1", function() {
            return this._rows1 = [ new Vector3(), new Vector3(), new Vector3() ];
        }, "_rows2", function() {
            return this._rows2 = [ new Vector3(), new Vector3(), new Vector3() ];
        }, "_ray", function() {
            return this._ray = new Ray(new Vector3(), new Vector3());
        }, "_boxBound1", function() {
            return this._boxBound1 = new BoundBox(new Vector3(), new Vector3());
        }, "_boxBound2", function() {
            return this._boxBound2 = new BoundBox(new Vector3(), new Vector3());
        }, "_boxBound3", function() {
            return this._boxBound3 = new BoundBox(new Vector3(), new Vector3());
        } ]);
    }(), function() {
        function Plane(normal, d) {
            this.normal = null, this.distance = NaN, void 0 === d && (d = 0), this.normal = normal, 
            this.distance = d;
        }
        return __class(Plane, "laya.d3.math.Plane"), Plane.prototype.normalize = function() {
            var normalE = this.normal.elements, normalEX = normalE[0], normalEY = normalE[1], normalEZ = normalE[2], magnitude = 1 / Math.sqrt(normalEX * normalEX + normalEY * normalEY + normalEZ * normalEZ);
            normalE[0] = normalEX * magnitude, normalE[1] = normalEY * magnitude, normalE[2] = normalEZ * magnitude, 
            this.distance *= magnitude;
        }, Plane.createPlaneBy3P = function(point1, point2, point3) {
            var point1e = point1.elements, point2e = point2.elements, point3e = point3.elements, x1 = point2e[0] - point1e[0], y1 = point2e[1] - point1e[1], z1 = point2e[2] - point1e[2], x2 = point3e[0] - point1e[0], y2 = point3e[1] - point1e[1], z2 = point3e[2] - point1e[2], yz = y1 * z2 - z1 * y2, xz = z1 * x2 - x1 * z2, xy = x1 * y2 - y1 * x2, invPyth = 1 / Math.sqrt(yz * yz + xz * xz + xy * xy), x = yz * invPyth, y = xz * invPyth, z = xy * invPyth, TEMPVec3e = Plane._TEMPVec3.elements;
            TEMPVec3e[0] = x, TEMPVec3e[1] = y, TEMPVec3e[2] = z;
            var d = -(x * point1e[0] + y * point1e[1] + z * point1e[2]);
            return new Plane(Plane._TEMPVec3, d);
        }, Plane.PlaneIntersectionType_Back = 0, Plane.PlaneIntersectionType_Front = 1, 
        Plane.PlaneIntersectionType_Intersecting = 2, __static(Plane, [ "_TEMPVec3", function() {
            return this._TEMPVec3 = new Vector3();
        } ]), Plane;
    }()), Quaternion = function() {
        function Quaternion(x, y, z, w) {
            this.elements = new Float32Array(4), void 0 === x && (x = 0), void 0 === y && (y = 0), 
            void 0 === z && (z = 0), void 0 === w && (w = 1), this.elements[0] = x, this.elements[1] = y, 
            this.elements[2] = z, this.elements[3] = w;
        }
        __class(Quaternion, "laya.d3.math.Quaternion");
        var __proto = Quaternion.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.scaling = function(scaling, out) {
            var e = out.elements, f = this.elements;
            e[0] = f[0] * scaling, e[1] = f[1] * scaling, e[2] = f[2] * scaling, e[3] = f[3] * scaling;
        }, __proto.normalize = function(out) {
            var e = out.elements, f = this.elements, x = f[0], y = f[1], z = f[2], w = f[3], len = x * x + y * y + z * z + w * w;
            0 < len && (len = 1 / Math.sqrt(len), e[0] = x * len, e[1] = y * len, e[2] = z * len, 
            e[3] = w * len);
        }, __proto.length = function() {
            var f = this.elements, x = f[0], y = f[1], z = f[2], w = f[3];
            return Math.sqrt(x * x + y * y + z * z + w * w);
        }, __proto.rotateX = function(rad, out) {
            var e = out.elements, f = this.elements;
            rad *= .5;
            var ax = f[0], ay = f[1], az = f[2], aw = f[3], bx = Math.sin(rad), bw = Math.cos(rad);
            e[0] = ax * bw + aw * bx, e[1] = ay * bw + az * bx, e[2] = az * bw - ay * bx, e[3] = aw * bw - ax * bx;
        }, __proto.rotateY = function(rad, out) {
            var e = out.elements, f = this.elements;
            rad *= .5;
            var ax = f[0], ay = f[1], az = f[2], aw = f[3], by = Math.sin(rad), bw = Math.cos(rad);
            e[0] = ax * bw - az * by, e[1] = ay * bw + aw * by, e[2] = az * bw + ax * by, e[3] = aw * bw - ay * by;
        }, __proto.rotateZ = function(rad, out) {
            var e = out.elements, f = this.elements;
            rad *= .5;
            var ax = f[0], ay = f[1], az = f[2], aw = f[3], bz = Math.sin(rad), bw = Math.cos(rad);
            e[0] = ax * bw + ay * bz, e[1] = ay * bw - ax * bz, e[2] = az * bw + aw * bz, e[3] = aw * bw - az * bz;
        }, __proto.getYawPitchRoll = function(out) {
            Vector3.transformQuat(Vector3.ForwardRH, this, Quaternion.TEMPVector31), Vector3.transformQuat(Vector3.Up, this, Quaternion.TEMPVector32);
            var upe = Quaternion.TEMPVector32.elements;
            Quaternion.angleTo(Vector3.ZERO, Quaternion.TEMPVector31, Quaternion.TEMPVector33);
            var anglee = Quaternion.TEMPVector33.elements;
            anglee[0] == Math.PI / 2 ? (anglee[1] = Quaternion.arcTanAngle(upe[2], upe[0]), 
            anglee[2] = 0) : anglee[0] == -Math.PI / 2 ? (anglee[1] = Quaternion.arcTanAngle(-upe[2], -upe[0]), 
            anglee[2] = 0) : (Matrix4x4.createRotationY(-anglee[1], Quaternion.TEMPMatrix0), 
            Matrix4x4.createRotationX(-anglee[0], Quaternion.TEMPMatrix1), Vector3.transformCoordinate(Quaternion.TEMPVector32, Quaternion.TEMPMatrix0, Quaternion.TEMPVector32), 
            Vector3.transformCoordinate(Quaternion.TEMPVector32, Quaternion.TEMPMatrix1, Quaternion.TEMPVector32), 
            anglee[2] = Quaternion.arcTanAngle(upe[1], -upe[0])), anglee[1] <= -Math.PI && (anglee[1] = Math.PI), 
            anglee[2] <= -Math.PI && (anglee[2] = Math.PI), anglee[1] >= Math.PI && anglee[2] >= Math.PI && (anglee[1] = 0, 
            anglee[2] = 0, anglee[0] = Math.PI - anglee[0]);
            var oe = out.elements;
            oe[0] = anglee[1], oe[1] = anglee[0], oe[2] = anglee[2];
        }, __proto.invert = function(out) {
            var e = out.elements, f = this.elements, a0 = f[0], a1 = f[1], a2 = f[2], a3 = f[3], dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3, invDot = dot ? 1 / dot : 0;
            e[0] = -a0 * invDot, e[1] = -a1 * invDot, e[2] = -a2 * invDot, e[3] = a3 * invDot;
        }, __proto.identity = function() {
            var e = this.elements;
            e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 1;
        }, __proto.fromArray = function(array, offset) {
            void 0 === offset && (offset = 0), this.elements[0] = array[offset + 0], this.elements[1] = array[offset + 1], 
            this.elements[2] = array[offset + 2], this.elements[3] = array[offset + 3];
        }, __proto.cloneTo = function(destObject) {
            var i, s, d;
            if ((s = this.elements) !== (d = destObject.elements)) for (i = 0; i < 4; ++i) d[i] = s[i];
        }, __proto.clone = function() {
            var dest = new this.constructor();
            return this.cloneTo(dest), dest;
        }, __proto.equals = function(b) {
            var ae = this.elements, be = b.elements;
            return MathUtils3D.nearEqual(ae[0], be[0]) && MathUtils3D.nearEqual(ae[1], be[1]) && MathUtils3D.nearEqual(ae[2], be[2]) && MathUtils3D.nearEqual(ae[3], be[3]);
        }, __proto.lengthSquared = function() {
            var x = this.elements[0], y = this.elements[1], z = this.elements[2], w = this.elements[3];
            return x * x + y * y + z * z + w * w;
        }, __getset(0, __proto, "x", function() {
            return this.elements[0];
        }), __getset(0, __proto, "y", function() {
            return this.elements[1];
        }), __getset(0, __proto, "z", function() {
            return this.elements[2];
        }), __getset(0, __proto, "w", function() {
            return this.elements[3];
        }), Quaternion.createFromYawPitchRoll = function(yaw, pitch, roll, out) {
            var halfRoll = .5 * roll, halfPitch = .5 * pitch, halfYaw = .5 * yaw, sinRoll = Math.sin(halfRoll), cosRoll = Math.cos(halfRoll), sinPitch = Math.sin(halfPitch), cosPitch = Math.cos(halfPitch), sinYaw = Math.sin(halfYaw), cosYaw = Math.cos(halfYaw), oe = out.elements;
            oe[0] = cosYaw * sinPitch * cosRoll + sinYaw * cosPitch * sinRoll, oe[1] = sinYaw * cosPitch * cosRoll - cosYaw * sinPitch * sinRoll, 
            oe[2] = cosYaw * cosPitch * sinRoll - sinYaw * sinPitch * cosRoll, oe[3] = cosYaw * cosPitch * cosRoll + sinYaw * sinPitch * sinRoll;
        }, Quaternion.multiply = function(left, right, out) {
            var le = left.elements, re = right.elements, oe = out.elements, lx = le[0], ly = le[1], lz = le[2], lw = le[3], rx = re[0], ry = re[1], rz = re[2], rw = re[3], a = ly * rz - lz * ry, b = lz * rx - lx * rz, c = lx * ry - ly * rx, d = lx * rx + ly * ry + lz * rz;
            oe[0] = lx * rw + rx * lw + a, oe[1] = ly * rw + ry * lw + b, oe[2] = lz * rw + rz * lw + c, 
            oe[3] = lw * rw - d;
        }, Quaternion.arcTanAngle = function(x, y) {
            return 0 == x ? 1 == y ? Math.PI / 2 : -Math.PI / 2 : 0 < x ? Math.atan(y / x) : x < 0 ? 0 < y ? Math.atan(y / x) + Math.PI : Math.atan(y / x) - Math.PI : 0;
        }, Quaternion.angleTo = function(from, location, angle) {
            Vector3.subtract(location, from, Quaternion.TEMPVector30), Vector3.normalize(Quaternion.TEMPVector30, Quaternion.TEMPVector30), 
            angle.elements[0] = Math.asin(Quaternion.TEMPVector30.y), angle.elements[1] = Quaternion.arcTanAngle(-Quaternion.TEMPVector30.z, -Quaternion.TEMPVector30.x);
        }, Quaternion.createFromAxisAngle = function(axis, rad, out) {
            var e = out.elements, f = axis.elements;
            rad *= .5;
            var s = Math.sin(rad);
            e[0] = s * f[0], e[1] = s * f[1], e[2] = s * f[2], e[3] = Math.cos(rad);
        }, Quaternion.createFromMatrix3x3 = function(sou, out) {
            var fRoot, e = out.elements, f = sou.elements, fTrace = f[0] + f[4] + f[8];
            if (0 < fTrace) fRoot = Math.sqrt(fTrace + 1), e[3] = .5 * fRoot, fRoot = .5 / fRoot, 
            e[0] = (f[5] - f[7]) * fRoot, e[1] = (f[6] - f[2]) * fRoot, e[2] = (f[1] - f[3]) * fRoot; else {
                var i = 0;
                f[4] > f[0] && (i = 1), f[8] > f[3 * i + i] && (i = 2);
                var j = (i + 1) % 3, k = (i + 2) % 3;
                fRoot = Math.sqrt(f[3 * i + i] - f[3 * j + j] - f[3 * k + k] + 1), e[i] = .5 * fRoot, 
                fRoot = .5 / fRoot, e[3] = (f[3 * j + k] - f[3 * k + j]) * fRoot, e[j] = (f[3 * j + i] + f[3 * i + j]) * fRoot, 
                e[k] = (f[3 * k + i] + f[3 * i + k]) * fRoot;
            }
        }, Quaternion.createFromMatrix4x4 = function(mat, out) {
            var sqrt, half, me = mat.elements, oe = out.elements, scale = me[0] + me[5] + me[10];
            0 < scale ? (sqrt = Math.sqrt(scale + 1), oe[3] = .5 * sqrt, sqrt = .5 / sqrt, oe[0] = (me[6] - me[9]) * sqrt, 
            oe[1] = (me[8] - me[2]) * sqrt, oe[2] = (me[1] - me[4]) * sqrt) : me[0] >= me[5] && me[0] >= me[10] ? (half = .5 / (sqrt = Math.sqrt(1 + me[0] - me[5] - me[10])), 
            oe[0] = .5 * sqrt, oe[1] = (me[1] + me[4]) * half, oe[2] = (me[2] + me[8]) * half, 
            oe[3] = (me[6] - me[9]) * half) : me[5] > me[10] ? (half = .5 / (sqrt = Math.sqrt(1 + me[5] - me[0] - me[10])), 
            oe[0] = (me[4] + me[1]) * half, oe[1] = .5 * sqrt, oe[2] = (me[9] + me[6]) * half, 
            oe[3] = (me[8] - me[2]) * half) : (half = .5 / (sqrt = Math.sqrt(1 + me[10] - me[0] - me[5])), 
            oe[0] = (me[8] + me[2]) * half, oe[1] = (me[9] + me[6]) * half, oe[2] = .5 * sqrt, 
            oe[3] = (me[1] - me[4]) * half);
        }, Quaternion.slerp = function(left, right, t, out) {
            var omega, cosom, sinom, scale0, scale1, a = left.elements, b = right.elements, oe = out.elements, ax = a[0], ay = a[1], az = a[2], aw = a[3], bx = b[0], by = b[1], bz = b[2], bw = b[3];
            return (cosom = ax * bx + ay * by + az * bz + aw * bw) < 0 && (cosom = -cosom, bx = -bx, 
            by = -by, bz = -bz, bw = -bw), scale1 = 1e-6 < 1 - cosom ? (omega = Math.acos(cosom), 
            sinom = Math.sin(omega), scale0 = Math.sin((1 - t) * omega) / sinom, Math.sin(t * omega) / sinom) : (scale0 = 1 - t, 
            t), oe[0] = scale0 * ax + scale1 * bx, oe[1] = scale0 * ay + scale1 * by, oe[2] = scale0 * az + scale1 * bz, 
            oe[3] = scale0 * aw + scale1 * bw, oe;
        }, Quaternion.lerp = function(left, right, t, out) {
            var e = out.elements, f = left.elements, g = right.elements, ax = f[0], ay = f[1], az = f[2], aw = f[3];
            e[0] = ax + t * (g[0] - ax), e[1] = ay + t * (g[1] - ay), e[2] = az + t * (g[2] - az), 
            e[3] = aw + t * (g[3] - aw);
        }, Quaternion.add = function(left, right, out) {
            var e = out.elements, f = left.elements, g = right.elements;
            e[0] = f[0] + g[0], e[1] = f[1] + g[1], e[2] = f[2] + g[2], e[3] = f[3] + g[3];
        }, Quaternion.dot = function(left, right) {
            var f = left.elements, g = right.elements;
            return f[0] * g[0] + f[1] * g[1] + f[2] * g[2] + f[3] * g[3];
        }, Quaternion.rotationLookAt = function(forward, up, out) {
            Quaternion.lookAt(Vector3.ZERO, forward, up, out);
        }, Quaternion.lookAt = function(eye, target, up, out) {
            Matrix3x3.lookAt(eye, target, up, Quaternion._tempMatrix3x3), Quaternion.rotationMatrix(Quaternion._tempMatrix3x3, out);
        }, Quaternion.invert = function(value, out) {
            var vE = value.elements, oE = out.elements, lengthSq = value.lengthSquared();
            MathUtils3D.isZero(lengthSq) || (lengthSq = 1 / lengthSq, oE[0] = -vE[0] * lengthSq, 
            oE[1] = -vE[1] * lengthSq, oE[2] = -vE[2] * lengthSq, oE[3] = vE[3] * lengthSq);
        }, Quaternion.rotationMatrix = function(matrix3x3, out) {
            var me = matrix3x3.elements, m11 = me[0], m12 = me[1], m13 = me[2], m21 = me[3], m22 = me[4], m23 = me[5], m31 = me[6], m32 = me[7], m33 = me[8], oe = out.elements, sqrt = NaN, half = NaN, scale = m11 + m22 + m33;
            0 < scale ? (sqrt = Math.sqrt(scale + 1), oe[3] = .5 * sqrt, sqrt = .5 / sqrt, oe[0] = (m23 - m32) * sqrt, 
            oe[1] = (m31 - m13) * sqrt, oe[2] = (m12 - m21) * sqrt) : m22 <= m11 && m33 <= m11 ? (half = .5 / (sqrt = Math.sqrt(1 + m11 - m22 - m33)), 
            oe[0] = .5 * sqrt, oe[1] = (m12 + m21) * half, oe[2] = (m13 + m31) * half, oe[3] = (m23 - m32) * half) : m33 < m22 ? (half = .5 / (sqrt = Math.sqrt(1 + m22 - m11 - m33)), 
            oe[0] = (m21 + m12) * half, oe[1] = .5 * sqrt, oe[2] = (m32 + m23) * half, oe[3] = (m31 - m13) * half) : (half = .5 / (sqrt = Math.sqrt(1 + m33 - m11 - m22)), 
            oe[0] = (m31 + m13) * half, oe[1] = (m32 + m23) * half, oe[2] = .5 * sqrt, oe[3] = (m12 - m21) * half);
        }, Quaternion.DEFAULT = new Quaternion(), __static(Quaternion, [ "TEMPVector30", function() {
            return this.TEMPVector30 = new Vector3();
        }, "TEMPVector31", function() {
            return this.TEMPVector31 = new Vector3();
        }, "TEMPVector32", function() {
            return this.TEMPVector32 = new Vector3();
        }, "TEMPVector33", function() {
            return this.TEMPVector33 = new Vector3();
        }, "TEMPMatrix0", function() {
            return this.TEMPMatrix0 = new Matrix4x4();
        }, "TEMPMatrix1", function() {
            return this.TEMPMatrix1 = new Matrix4x4();
        }, "_tempMatrix3x3", function() {
            return this._tempMatrix3x3 = new Matrix3x3();
        }, "NAN", function() {
            return this.NAN = new Quaternion(NaN, NaN, NaN, NaN);
        } ]), Quaternion;
    }(), Rand = function() {
        function Rand(seed) {
            this._temp = new Uint32Array(1), this.seeds = new Uint32Array(4), this.seeds[0] = seed, 
            this.seeds[1] = 1812433253 * this.seeds[0] + 1, this.seeds[2] = 1812433253 * this.seeds[1] + 1, 
            this.seeds[3] = 1812433253 * this.seeds[2] + 1;
        }
        __class(Rand, "laya.d3.math.Rand");
        var __proto = Rand.prototype;
        return __proto.getUint = function() {
            return this._temp[0] = this.seeds[0] ^ this.seeds[0] << 11, this.seeds[0] = this.seeds[1], 
            this.seeds[1] = this.seeds[2], this.seeds[2] = this.seeds[3], this.seeds[3] = this.seeds[3] ^ this.seeds[3] >>> 19 ^ this._temp[0] ^ this._temp[0] >>> 8, 
            this.seeds[3];
        }, __proto.getFloat = function() {
            return this.getUint(), (8388607 & this.seeds[3]) * (1 / 8388607);
        }, __proto.getSignedFloat = function() {
            return 2 * this.getFloat() - 1;
        }, __getset(0, __proto, "seed", function() {
            return this.seeds[0];
        }, function(seed) {
            this.seeds[0] = seed, this.seeds[1] = 1812433253 * this.seeds[0] + 1, this.seeds[2] = 1812433253 * this.seeds[1] + 1, 
            this.seeds[3] = 1812433253 * this.seeds[2] + 1;
        }), Rand.getFloatFromInt = function(v) {
            return 1 / 8388607 * (8388607 & v);
        }, Rand.getByteFromInt = function(v) {
            return (8388607 & v) >>> 15;
        }, Rand;
    }(), Ray = (function() {
        function RandX(seed) {
            if (this._state0U = NaN, this._state0L = NaN, this._state1U = NaN, this._state1L = NaN, 
            !(seed instanceof Array) || 4 !== seed.length) throw new Error("Rand:Seed must be an array with 4 numbers");
            this._state0U = 0 | seed[0], this._state0L = 0 | seed[1], this._state1U = 0 | seed[2], 
            this._state1L = 0 | seed[3];
        }
        __class(RandX, "laya.d3.math.RandX");
        var __proto = RandX.prototype;
        __proto.randomint = function() {
            var s1U = this._state0U, s1L = this._state0L, s0U = this._state1U, s0L = this._state1L, sumL = (s0L >>> 0) + (s1L >>> 0), resU = s0U + s1U + (sumL / 2 >>> 31) >>> 0, resL = sumL >>> 0, t1U = 0, t1L = 0;
            t1U = (s1U ^= t1U = s1U << 23 | (-512 & s1L) >>> 9) ^ (this._state0U = s0U), t1L = (s1L ^= t1L = s1L << 23) ^ (this._state0L = s0L);
            t1U ^= s1U >>> 18, t1L ^= s1L >>> 18 | (262143 & s1U) << 14;
            return t1U ^= s0U >>> 5, t1L ^= s0L >>> 5 | (31 & s0U) << 27, this._state1U = t1U, 
            this._state1L = t1L, [ resU, resL ];
        }, __proto.random = function() {
            var t2 = this.randomint(), t2U = t2[0], xU = 1023 << 20 | t2U >>> 12, xL = 0 | (t2[1] >>> 12 | (4095 & t2U) << 20);
            return RandX._CONVERTION_BUFFER.setUint32(0, xU, !1), RandX._CONVERTION_BUFFER.setUint32(4, xL, !1), 
            Rand._CONVERTION_BUFFER.getFloat64(0, !1) - 1;
        }, __static(RandX, [ "_CONVERTION_BUFFER", function() {
            return this._CONVERTION_BUFFER = new DataView(new ArrayBuffer(8));
        }, "defaultRand", function() {
            return this.defaultRand = new Rand([ 0, Date.now() / 65536, 0, Date.now() % 65536 ]);
        } ]);
    }(), function() {
        function Ray(origin, direction) {
            this.origin = null, this.direction = null, this.origin = origin, this.direction = direction;
        }
        return __class(Ray, "laya.d3.math.Ray"), Ray;
    }()), Vector2 = function() {
        function Vector2(x, y) {
            this.elements = new Float32Array(2), void 0 === x && (x = 0), void 0 === y && (y = 0);
            var v = this.elements;
            v[0] = x, v[1] = y;
        }
        __class(Vector2, "laya.d3.math.Vector2");
        var __proto = Vector2.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.fromArray = function(array, offset) {
            void 0 === offset && (offset = 0), this.elements[0] = array[offset + 0], this.elements[1] = array[offset + 1];
        }, __proto.cloneTo = function(destObject) {
            var destE = destObject.elements, s = this.elements;
            destE[0] = s[0], destE[1] = s[1];
        }, __proto.clone = function() {
            var destVector2 = new this.constructor();
            return this.cloneTo(destVector2), destVector2;
        }, __getset(0, __proto, "x", function() {
            return this.elements[0];
        }, function(value) {
            this.elements[0] = value;
        }), __getset(0, __proto, "y", function() {
            return this.elements[1];
        }, function(value) {
            this.elements[1] = value;
        }), Vector2.scale = function(a, b, out) {
            var e = out.elements, f = a.elements;
            e[0] = f[0] * b, e[1] = f[1] * b;
        }, __static(Vector2, [ "ZERO", function() {
            return this.ZERO = new Vector2(0, 0);
        }, "ONE", function() {
            return this.ONE = new Vector2(1, 1);
        } ]), Vector2;
    }(), Vector3 = function() {
        function Vector3(x, y, z) {
            this.elements = new Float32Array(3), void 0 === x && (x = 0), void 0 === y && (y = 0), 
            void 0 === z && (z = 0);
            var v = this.elements;
            v[0] = x, v[1] = y, v[2] = z;
        }
        __class(Vector3, "laya.d3.math.Vector3");
        var __proto = Vector3.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.fromArray = function(array, offset) {
            void 0 === offset && (offset = 0), this.elements[0] = array[offset + 0], this.elements[1] = array[offset + 1], 
            this.elements[2] = array[offset + 2];
        }, __proto.cloneTo = function(destObject) {
            var destE = destObject.elements, s = this.elements;
            destE[0] = s[0], destE[1] = s[1], destE[2] = s[2];
        }, __proto.clone = function() {
            var destVector3 = new this.constructor();
            return this.cloneTo(destVector3), destVector3;
        }, __proto.toDefault = function() {
            this.elements[0] = 0, this.elements[1] = 0, this.elements[2] = 0;
        }, __proto.reset = function(x, y, z) {
            this.elements[0] = x, this.elements[1] = y, this.elements[2] = z;
        }, __getset(0, __proto, "x", function() {
            return this.elements[0];
        }, function(value) {
            this.elements[0] = value;
        }), __getset(0, __proto, "y", function() {
            return this.elements[1];
        }, function(value) {
            this.elements[1] = value;
        }), __getset(0, __proto, "z", function() {
            return this.elements[2];
        }, function(value) {
            this.elements[2] = value;
        }), Vector3.distanceSquared = function(value1, value2) {
            var value1e = value1.elements, value2e = value2.elements, x = value1e[0] - value2e[0], y = value1e[1] - value2e[1], z = value1e[2] - value2e[2];
            return x * x + y * y + z * z;
        }, Vector3.distance = function(value1, value2) {
            var value1e = value1.elements, value2e = value2.elements, x = value1e[0] - value2e[0], y = value1e[1] - value2e[1], z = value1e[2] - value2e[2];
            return Math.sqrt(x * x + y * y + z * z);
        }, Vector3.min = function(a, b, out) {
            var e = out.elements, f = a.elements, g = b.elements;
            e[0] = Math.min(f[0], g[0]), e[1] = Math.min(f[1], g[1]), e[2] = Math.min(f[2], g[2]);
        }, Vector3.max = function(a, b, out) {
            var e = out.elements, f = a.elements, g = b.elements;
            e[0] = Math.max(f[0], g[0]), e[1] = Math.max(f[1], g[1]), e[2] = Math.max(f[2], g[2]);
        }, Vector3.transformQuat = function(source, rotation, out) {
            var destination = out.elements, se = source.elements, re = rotation.elements, x = se[0], y = se[1], z = se[2], qx = re[0], qy = re[1], qz = re[2], qw = re[3], ix = qw * x + qy * z - qz * y, iy = qw * y + qz * x - qx * z, iz = qw * z + qx * y - qy * x, iw = -qx * x - qy * y - qz * z;
            destination[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy, destination[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz, 
            destination[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
        }, Vector3.scalarLength = function(a) {
            var f = a.elements, x = f[0], y = f[1], z = f[2];
            return Math.sqrt(x * x + y * y + z * z);
        }, Vector3.scalarLengthSquared = function(a) {
            var f = a.elements, x = f[0], y = f[1], z = f[2];
            return x * x + y * y + z * z;
        }, Vector3.normalize = function(s, out) {
            var se = s.elements, oe = out.elements, x = se[0], y = se[1], z = se[2], len = x * x + y * y + z * z;
            0 < len && (len = 1 / Math.sqrt(len), oe[0] = se[0] * len, oe[1] = se[1] * len, 
            oe[2] = se[2] * len);
        }, Vector3.multiply = function(a, b, out) {
            var e = out.elements, f = a.elements, g = b.elements;
            e[0] = f[0] * g[0], e[1] = f[1] * g[1], e[2] = f[2] * g[2];
        }, Vector3.scale = function(a, b, out) {
            var e = out.elements, f = a.elements;
            e[0] = f[0] * b, e[1] = f[1] * b, e[2] = f[2] * b;
        }, Vector3.lerp = function(a, b, t, out) {
            var e = out.elements, f = a.elements, g = b.elements, ax = f[0], ay = f[1], az = f[2];
            e[0] = ax + t * (g[0] - ax), e[1] = ay + t * (g[1] - ay), e[2] = az + t * (g[2] - az);
        }, Vector3.transformV3ToV3 = function(vector, transform, result) {
            var intermediate = Vector3._tempVector4;
            Vector3.transformV3ToV4(vector, transform, intermediate);
            var intermediateElem = intermediate.elements, resultElem = result.elements;
            resultElem[0] = intermediateElem[0], resultElem[1] = intermediateElem[1], resultElem[2] = intermediateElem[2];
        }, Vector3.transformV3ToV4 = function(vector, transform, result) {
            var vectorElem = vector.elements, vectorX = vectorElem[0], vectorY = vectorElem[1], vectorZ = vectorElem[2], transformElem = transform.elements, resultElem = result.elements;
            resultElem[0] = vectorX * transformElem[0] + vectorY * transformElem[4] + vectorZ * transformElem[8] + transformElem[12], 
            resultElem[1] = vectorX * transformElem[1] + vectorY * transformElem[5] + vectorZ * transformElem[9] + transformElem[13], 
            resultElem[2] = vectorX * transformElem[2] + vectorY * transformElem[6] + vectorZ * transformElem[10] + transformElem[14], 
            resultElem[3] = vectorX * transformElem[3] + vectorY * transformElem[7] + vectorZ * transformElem[11] + transformElem[15];
        }, Vector3.TransformNormal = function(normal, transform, result) {
            var normalElem = normal.elements, normalX = normalElem[0], normalY = normalElem[1], normalZ = normalElem[2], transformElem = transform.elements, resultElem = result.elements;
            resultElem[0] = normalX * transformElem[0] + normalY * transformElem[4] + normalZ * transformElem[8], 
            resultElem[1] = normalX * transformElem[1] + normalY * transformElem[5] + normalZ * transformElem[9], 
            resultElem[2] = normalX * transformElem[2] + normalY * transformElem[6] + normalZ * transformElem[10];
        }, Vector3.transformCoordinate = function(coordinate, transform, result) {
            var vectorElem = Vector3._tempVector4.elements, coordinateElem = coordinate.elements, coordinateX = coordinateElem[0], coordinateY = coordinateElem[1], coordinateZ = coordinateElem[2], transformElem = transform.elements;
            vectorElem[0] = coordinateX * transformElem[0] + coordinateY * transformElem[4] + coordinateZ * transformElem[8] + transformElem[12], 
            vectorElem[1] = coordinateX * transformElem[1] + coordinateY * transformElem[5] + coordinateZ * transformElem[9] + transformElem[13], 
            vectorElem[2] = coordinateX * transformElem[2] + coordinateY * transformElem[6] + coordinateZ * transformElem[10] + transformElem[14], 
            vectorElem[3] = 1 / (coordinateX * transformElem[3] + coordinateY * transformElem[7] + coordinateZ * transformElem[11] + transformElem[15]);
            var resultElem = result.elements;
            resultElem[0] = vectorElem[0] * vectorElem[3], resultElem[1] = vectorElem[1] * vectorElem[3], 
            resultElem[2] = vectorElem[2] * vectorElem[3];
        }, Vector3.Clamp = function(value, min, max, out) {
            var valuee = value.elements, x = valuee[0], y = valuee[1], z = valuee[2], mine = min.elements, mineX = mine[0], mineY = mine[1], mineZ = mine[2], maxe = max.elements, maxeX = maxe[0], maxeY = maxe[1], maxeZ = maxe[2], oute = out.elements;
            x = (x = maxeX < x ? maxeX : x) < mineX ? mineX : x, y = (y = maxeY < y ? maxeY : y) < mineY ? mineY : y, 
            z = (z = maxeZ < z ? maxeZ : z) < mineZ ? mineZ : z, oute[0] = x, oute[1] = y, oute[2] = z;
        }, Vector3.add = function(a, b, out) {
            var e = out.elements, f = a.elements, g = b.elements;
            e[0] = f[0] + g[0], e[1] = f[1] + g[1], e[2] = f[2] + g[2];
        }, Vector3.subtract = function(a, b, o) {
            var oe = o.elements, ae = a.elements, be = b.elements;
            oe[0] = ae[0] - be[0], oe[1] = ae[1] - be[1], oe[2] = ae[2] - be[2];
        }, Vector3.cross = function(a, b, o) {
            var ae = a.elements, be = b.elements, oe = o.elements, ax = ae[0], ay = ae[1], az = ae[2], bx = be[0], by = be[1], bz = be[2];
            oe[0] = ay * bz - az * by, oe[1] = az * bx - ax * bz, oe[2] = ax * by - ay * bx;
        }, Vector3.dot = function(a, b) {
            var ae = a.elements, be = b.elements;
            return ae[0] * be[0] + ae[1] * be[1] + ae[2] * be[2];
        }, Vector3.equals = function(a, b) {
            var ae = a.elements, be = b.elements;
            return MathUtils3D.nearEqual(Math.abs(ae[0]), Math.abs(be[0])) && MathUtils3D.nearEqual(Math.abs(ae[1]), Math.abs(be[1])) && MathUtils3D.nearEqual(Math.abs(ae[2]), Math.abs(be[2]));
        }, Vector3.ZERO = new Vector3(0, 0, 0), Vector3.ONE = new Vector3(1, 1, 1), Vector3.NegativeUnitX = new Vector3(-1, 0, 0), 
        Vector3.UnitX = new Vector3(1, 0, 0), Vector3.UnitY = new Vector3(0, 1, 0), Vector3.UnitZ = new Vector3(0, 0, 1), 
        Vector3.ForwardRH = new Vector3(0, 0, -1), Vector3.ForwardLH = new Vector3(0, 0, 1), 
        Vector3.Up = new Vector3(0, 1, 0), Vector3.NAN = new Vector3(NaN, NaN, NaN), __static(Vector3, [ "_tempVector4", function() {
            return this._tempVector4 = new Vector4();
        } ]), Vector3;
    }(), Vector4 = function() {
        function Vector4(x, y, z, w) {
            this.elements = new Float32Array(4), void 0 === x && (x = 0), void 0 === y && (y = 0), 
            void 0 === z && (z = 0), void 0 === w && (w = 0);
            var v = this.elements;
            v[0] = x, v[1] = y, v[2] = z, v[3] = w;
        }
        __class(Vector4, "laya.d3.math.Vector4");
        var __proto = Vector4.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto.fromArray = function(array, offset) {
            void 0 === offset && (offset = 0), this.elements[0] = array[offset + 0], this.elements[1] = array[offset + 1], 
            this.elements[2] = array[offset + 2], this.elements[3] = array[offset + 3];
        }, __proto.cloneTo = function(destObject) {
            var destE = destObject.elements, s = this.elements;
            destE[0] = s[0], destE[1] = s[1], destE[2] = s[2], destE[3] = s[3];
        }, __proto.clone = function() {
            var destVector4 = new this.constructor();
            return this.cloneTo(destVector4), destVector4;
        }, __proto.length = function() {
            return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w);
        }, __proto.lengthSquared = function() {
            return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w;
        }, __getset(0, __proto, "x", function() {
            return this.elements[0];
        }, function(value) {
            this.elements[0] = value;
        }), __getset(0, __proto, "y", function() {
            return this.elements[1];
        }, function(value) {
            this.elements[1] = value;
        }), __getset(0, __proto, "z", function() {
            return this.elements[2];
        }, function(value) {
            this.elements[2] = value;
        }), __getset(0, __proto, "w", function() {
            return this.elements[3];
        }, function(value) {
            this.elements[3] = value;
        }), Vector4.lerp = function(a, b, t, out) {
            var e = out.elements, f = a.elements, g = b.elements, ax = f[0], ay = f[1], az = f[2], aw = f[3];
            e[0] = ax + t * (g[0] - ax), e[1] = ay + t * (g[1] - ay), e[2] = az + t * (g[2] - az), 
            e[3] = aw + t * (g[3] - aw);
        }, Vector4.transformByM4x4 = function(vector4, m4x4, out) {
            var ve = vector4.elements, vx = ve[0], vy = ve[1], vz = ve[2], vw = ve[3], me = m4x4.elements, oe = out.elements;
            oe[0] = vx * me[0] + vy * me[4] + vz * me[8] + vw * me[12], oe[1] = vx * me[1] + vy * me[5] + vz * me[9] + vw * me[13], 
            oe[2] = vx * me[2] + vy * me[6] + vz * me[10] + vw * me[14], oe[3] = vx * me[3] + vy * me[7] + vz * me[11] + vw * me[15];
        }, Vector4.equals = function(a, b) {
            var ae = a.elements, be = b.elements;
            return MathUtils3D.nearEqual(Math.abs(ae[0]), Math.abs(be[0])) && MathUtils3D.nearEqual(Math.abs(ae[1]), Math.abs(be[1])) && MathUtils3D.nearEqual(Math.abs(ae[2]), Math.abs(be[2])) && MathUtils3D.nearEqual(Math.abs(ae[3]), Math.abs(be[3]));
        }, Vector4.normalize = function(s, out) {
            var se = s.elements, oe = out.elements, len = s.length();
            0 < len && (oe[0] = se[0] * len, oe[1] = se[1] * len, oe[2] = se[2] * len, oe[3] = se[3] * len);
        }, Vector4.add = function(a, b, out) {
            var oe = out.elements, ae = a.elements, be = b.elements;
            oe[0] = ae[0] + be[0], oe[1] = ae[1] + be[1], oe[2] = ae[2] + be[2], oe[3] = ae[3] + be[3];
        }, Vector4.subtract = function(a, b, out) {
            var oe = out.elements, ae = a.elements, be = b.elements;
            oe[0] = ae[0] - be[0], oe[1] = ae[1] - be[1], oe[2] = ae[2] - be[2], oe[3] = ae[3] - be[3];
        }, Vector4.multiply = function(a, b, out) {
            var oe = out.elements, ae = a.elements, be = b.elements;
            oe[0] = ae[0] * be[0], oe[1] = ae[1] * be[1], oe[2] = ae[2] * be[2], oe[3] = ae[3] * be[3];
        }, Vector4.scale = function(a, b, out) {
            var oe = out.elements, ae = a.elements;
            oe[0] = ae[0] * b, oe[1] = ae[1] * b, oe[2] = ae[2] * b, oe[3] = ae[3] * b;
        }, Vector4.Clamp = function(value, min, max, out) {
            var valuee = value.elements, x = valuee[0], y = valuee[1], z = valuee[2], w = valuee[3], mine = min.elements, mineX = mine[0], mineY = mine[1], mineZ = mine[2], mineW = mine[3], maxe = max.elements, maxeX = maxe[0], maxeY = maxe[1], maxeZ = maxe[2], maxeW = maxe[3], oute = out.elements;
            x = (x = maxeX < x ? maxeX : x) < mineX ? mineX : x, y = (y = maxeY < y ? maxeY : y) < mineY ? mineY : y, 
            z = (z = maxeZ < z ? maxeZ : z) < mineZ ? mineZ : z, w = (w = maxeW < w ? maxeW : w) < mineW ? mineW : w, 
            oute[0] = x, oute[1] = y, oute[2] = z, oute[3] = w;
        }, Vector4.distanceSquared = function(value1, value2) {
            var value1e = value1.elements, value2e = value2.elements, x = value1e[0] - value2e[0], y = value1e[1] - value2e[1], z = value1e[2] - value2e[2], w = value1e[3] - value2e[3];
            return x * x + y * y + z * z + w * w;
        }, Vector4.distance = function(value1, value2) {
            var value1e = value1.elements, value2e = value2.elements, x = value1e[0] - value2e[0], y = value1e[1] - value2e[1], z = value1e[2] - value2e[2], w = value1e[3] - value2e[3];
            return Math.sqrt(x * x + y * y + z * z + w * w);
        }, Vector4.dot = function(a, b) {
            var ae = a.elements, be = b.elements;
            return ae[0] * be[0] + ae[1] * be[1] + ae[2] * be[2] + ae[3] * be[3];
        }, Vector4.min = function(a, b, out) {
            var e = out.elements, f = a.elements, g = b.elements;
            e[0] = Math.min(f[0], g[0]), e[1] = Math.min(f[1], g[1]), e[2] = Math.min(f[2], g[2]), 
            e[3] = Math.min(f[3], g[3]);
        }, Vector4.max = function(a, b, out) {
            var e = out.elements, f = a.elements, g = b.elements;
            e[0] = Math.max(f[0], g[0]), e[1] = Math.max(f[1], g[1]), e[2] = Math.max(f[2], g[2]), 
            e[3] = Math.max(f[3], g[3]);
        }, __static(Vector4, [ "ZERO", function() {
            return this.ZERO = new Vector4();
        }, "ONE", function() {
            return this.ONE = new Vector4(1, 1, 1, 1);
        }, "UnitX", function() {
            return this.UnitX = new Vector4(1, 0, 0, 0);
        }, "UnitY", function() {
            return this.UnitY = new Vector4(0, 1, 0, 0);
        }, "UnitZ", function() {
            return this.UnitZ = new Vector4(0, 0, 1, 0);
        }, "UnitW", function() {
            return this.UnitW = new Vector4(0, 0, 0, 1);
        } ]), Vector4;
    }(), Viewport = function() {
        function Viewport(x, y, width, height) {
            this.minDepth = 0, this.maxDepth = 1, this.x = x, this.y = y, this.width = width, 
            this.height = height;
        }
        __class(Viewport, "laya.d3.math.Viewport");
        var __proto = Viewport.prototype;
        return __proto.project = function(source, matrix, out) {
            Vector3.transformV3ToV3(source, matrix, out);
            var sourceEleme = source.elements, matrixEleme = matrix.elements, outEleme = out.elements, a = sourceEleme[0] * matrixEleme[3] + sourceEleme[1] * matrixEleme[7] + sourceEleme[2] * matrixEleme[11] + matrixEleme[15];
            1 !== a && (outEleme[0] = outEleme[0] / a, outEleme[1] = outEleme[1] / a, outEleme[2] = outEleme[2] / a), 
            outEleme[0] = .5 * (outEleme[0] + 1) * this.width + this.x, outEleme[1] = .5 * (1 - outEleme[1]) * this.height + this.y, 
            outEleme[2] = outEleme[2] * (this.maxDepth - this.minDepth) + this.minDepth;
        }, __proto.unprojectFromMat = function(source, matrix, out) {
            var sourceEleme = source.elements, matrixEleme = matrix.elements, outEleme = out.elements;
            outEleme[0] = (sourceEleme[0] - this.x) / this.width * 2 - 1, outEleme[1] = -((sourceEleme[1] - this.y) / this.height * 2 - 1);
            var halfDepth = (this.maxDepth - this.minDepth) / 2;
            outEleme[2] = (sourceEleme[2] - this.minDepth - halfDepth) / halfDepth;
            var a = outEleme[0] * matrixEleme[3] + outEleme[1] * matrixEleme[7] + outEleme[2] * matrixEleme[11] + matrixEleme[15];
            Vector3.transformV3ToV3(out, matrix, out), 1 !== a && (outEleme[0] = outEleme[0] / a, 
            outEleme[1] = outEleme[1] / a, outEleme[2] = outEleme[2] / a);
        }, __proto.unprojectFromWVP = function(source, projection, view, world, out) {
            Matrix4x4.multiply(projection, view, Viewport._tempMatrix4x4), world && Matrix4x4.multiply(Viewport._tempMatrix4x4, world, Viewport._tempMatrix4x4), 
            Viewport._tempMatrix4x4.invert(Viewport._tempMatrix4x4), this.unprojectFromMat(source, Viewport._tempMatrix4x4, out);
        }, __static(Viewport, [ "_tempMatrix4x4", function() {
            return this._tempMatrix4x4 = new Matrix4x4();
        } ]), Viewport;
    }(), SubMesh = function() {
        function SubMesh(mesh) {
            this._mesh = null, this._boneIndicesList = null, this._subIndexBufferStart = null, 
            this._subIndexBufferCount = null, this._skinAnimationDatas = null, this._bufferUsage = null, 
            this._indexInMesh = 0, this._vertexBuffer = null, this._vertexStart = 0, this._vertexCount = 0, 
            this._indexBuffer = null, this._indexStart = 0, this._indexCount = 0, this._indices = null, 
            this._bufferUsage = {}, this._mesh = mesh, this._boneIndicesList = [], this._subIndexBufferStart = [], 
            this._subIndexBufferCount = [];
        }
        __class(SubMesh, "laya.d3.resource.models.SubMesh");
        var __proto = SubMesh.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.render.IRenderable": !0,
            "laya.resource.IDispose": !0
        }), __proto._getVertexBuffer = function(index) {
            return void 0 === index && (index = 0), 0 === index ? this._vertexBuffer : null;
        }, __proto._getIndexBuffer = function() {
            return this._indexBuffer;
        }, __proto._getStaticBatchBakedVertexs = function(batchOwnerTransform, owner) {
            var bakedVertexes, uv1Element, vertexBuffer = this._vertexBuffer, vertexDeclaration = vertexBuffer.vertexDeclaration, positionOffset = vertexDeclaration.getVertexElementByUsage(0).offset / 4, normalOffset = vertexDeclaration.getVertexElementByUsage(3).offset / 4, lightmapScaleOffset = owner.meshRender.lightmapScaleOffset, i = 0, n = 0, bakedVertexFloatCount = 0, lightingMapTexcoordOffset = 0, uv0Offset = 0, oriVertexFloatCount = 0;
            if (lightmapScaleOffset) if (uv1Element = vertexDeclaration.getVertexElementByUsage(15)) bakedVertexFloatCount = vertexDeclaration.vertexStride / 4, 
            bakedVertexes = 0 < this._vertexCount ? vertexBuffer.getData().slice(this._vertexStart * bakedVertexFloatCount, (this._vertexStart + this._vertexCount) * bakedVertexFloatCount) : vertexBuffer.getData().slice(), 
            lightingMapTexcoordOffset = uv1Element.offset / 4; else {
                bakedVertexFloatCount = (oriVertexFloatCount = vertexDeclaration.vertexStride / 4) + 2, 
                bakedVertexes = this._vertexCount ? new Float32Array(this._vertexCount * (vertexBuffer.vertexDeclaration.vertexStride / 4 + 2)) : new Float32Array(vertexBuffer.vertexCount * (vertexBuffer.vertexDeclaration.vertexStride / 4 + 2)), 
                lightingMapTexcoordOffset = (uv0Offset = vertexDeclaration.getVertexElementByUsage(2).offset / 4) + 2;
                var oriVertexes = vertexBuffer.getData();
                for (i = 0, n = oriVertexes.length / oriVertexFloatCount; i < n; i++) {
                    var oriVertexOffset = 0;
                    oriVertexOffset = 0 < this._vertexCount ? (this._vertexStart + i) * oriVertexFloatCount : i * oriVertexFloatCount;
                    var bakedVertexOffset = i * bakedVertexFloatCount, j = 0;
                    for (j = 0; j < lightingMapTexcoordOffset; j++) bakedVertexes[bakedVertexOffset + j] = oriVertexes[oriVertexOffset + j];
                    for (j = lightingMapTexcoordOffset; j < oriVertexFloatCount; j++) bakedVertexes[bakedVertexOffset + j + 2] = oriVertexes[oriVertexOffset + j];
                }
            } else bakedVertexFloatCount = vertexDeclaration.vertexStride / 4, bakedVertexes = this._vertexCount ? vertexBuffer.getData().slice(this._vertexStart * bakedVertexFloatCount, (this._vertexStart + this._vertexCount) * bakedVertexFloatCount) : vertexBuffer.getData().slice();
            if (batchOwnerTransform) {
                var rootMat = batchOwnerTransform.worldMatrix, rootInvertMat = SubMesh._tempMatrix4x40;
                rootMat.invert(rootInvertMat);
                var result = SubMesh._tempMatrix4x41, transform = owner.transform.worldMatrix;
                Matrix4x4.multiply(rootInvertMat, transform, result);
            } else result = owner.transform.worldMatrix;
            var rotation = SubMesh._tempQuaternion0;
            for (result.decomposeTransRotScale(SubMesh._tempVector30, rotation, SubMesh._tempVector31), 
            i = 0, n = bakedVertexes.length / bakedVertexFloatCount; i < n; i++) {
                var posOffset = i * bakedVertexFloatCount + positionOffset, norOffset = i * bakedVertexFloatCount + normalOffset;
                if (Utils3D.transformVector3ArrayToVector3ArrayCoordinate(bakedVertexes, posOffset, result, bakedVertexes, posOffset), 
                Utils3D.transformVector3ArrayByQuat(bakedVertexes, norOffset, rotation, bakedVertexes, norOffset), 
                lightmapScaleOffset) {
                    var lightingMapTexOffset = i * bakedVertexFloatCount + lightingMapTexcoordOffset;
                    if (uv1Element) Utils3D.transformLightingMapTexcoordByUV1Array(bakedVertexes, lightingMapTexOffset, lightmapScaleOffset, bakedVertexes, lightingMapTexOffset); else {
                        var tex0Offset = i * oriVertexFloatCount + uv0Offset;
                        Utils3D.transformLightingMapTexcoordByUV0Array(oriVertexes, tex0Offset, lightmapScaleOffset, bakedVertexes, lightingMapTexOffset);
                    }
                }
            }
            return bakedVertexes;
        }, __proto._getVertexBuffers = function() {
            return null;
        }, __proto._beforeRender = function(state) {
            return this._vertexBuffer._bind(), this._indexBuffer._bind(), !0;
        }, __proto._render = function(state) {
            var skinAnimationDatas, indexCount = 0, renderElement = state.renderElement;
            if (1 < this._indexCount) {
                var boneIndicesListCount = this._boneIndicesList.length;
                if (1 < boneIndicesListCount) {
                    for (var i = 0; i < boneIndicesListCount; i++) (skinAnimationDatas = renderElement._skinAnimationDatas || this._skinAnimationDatas) && (renderElement._shaderValue.setValue(0, skinAnimationDatas[i]), 
                    state._shader.uploadRenderElementUniforms(renderElement._shaderValue.data)), WebGL.mainContext.drawElements(4, this._subIndexBufferCount[i], 5123, 2 * this._subIndexBufferStart[i]);
                    Stat.drawCall += boneIndicesListCount;
                } else (skinAnimationDatas = renderElement._skinAnimationDatas || this._skinAnimationDatas) && (renderElement._shaderValue.setValue(0, skinAnimationDatas[0]), 
                state._shader.uploadRenderElementUniforms(renderElement._shaderValue.data)), WebGL.mainContext.drawElements(4, this._indexCount, 5123, 2 * this._indexStart), 
                Stat.drawCall++;
                indexCount = this._indexCount;
            } else indexCount = this._indexBuffer.indexCount, (skinAnimationDatas = renderElement._skinAnimationDatas || this._skinAnimationDatas) && (renderElement._shaderValue.setValue(0, skinAnimationDatas[0]), 
            state._shader.uploadRenderElementUniforms(renderElement._shaderValue.data)), WebGL.mainContext.drawElements(4, indexCount, 5123, 0), 
            Stat.drawCall++;
            Stat.trianglesFaces += indexCount / 3;
        }, __proto.getIndices = function() {
            return 0 < this._indexCount ? this._indices : this._indexBuffer.getData();
        }, __proto.dispose = function() {
            this._indexBuffer.destroy(), this._vertexBuffer.destroy(), this._mesh = null, this._boneIndicesList = null, 
            this._subIndexBufferStart = null, this._subIndexBufferCount = null, this._skinAnimationDatas = null, 
            this._bufferUsage = null, this._vertexBuffer = null, this._indexBuffer = null;
        }, __getset(0, __proto, "_vertexBufferCount", function() {
            return 1;
        }), __getset(0, __proto, "triangleCount", function() {
            return this._indexBuffer.indexCount / 3;
        }), __static(SubMesh, [ "_tempVector30", function() {
            return this._tempVector30 = new Vector3();
        }, "_tempVector31", function() {
            return this._tempVector31 = new Vector3();
        }, "_tempQuaternion0", function() {
            return this._tempQuaternion0 = new Quaternion();
        }, "_tempMatrix4x40", function() {
            return this._tempMatrix4x40 = new Matrix4x4();
        }, "_tempMatrix4x41", function() {
            return this._tempMatrix4x41 = new Matrix4x4();
        } ]), SubMesh;
    }(), ShaderDefines$1 = function() {
        function ShaderDefines(shaderdefines) {
            this.defineCounter = 0, this.defines = null, shaderdefines ? (this.defineCounter = shaderdefines.defineCounter, 
            this.defines = shaderdefines.defines.slice()) : (this.defineCounter = 0, this.defines = []);
        }
        return __class(ShaderDefines, "laya.d3.shader.ShaderDefines", null, "ShaderDefines$1"), 
        ShaderDefines.prototype.registerDefine = function(name) {
            var value = Math.pow(2, this.defineCounter++);
            return this.defines[value] = name, value;
        }, ShaderDefines;
    }(), ShaderInit3D = function() {
        function ShaderInit3D() {}
        return __class(ShaderInit3D, "laya.d3.shader.ShaderInit3D"), ShaderInit3D.__init__ = function() {
            var attributeMap, uniformMap;
            ShaderCompile3D._globalRegDefine("HIGHPRECISION", ShaderCompile3D.SHADERDEFINE_HIGHPRECISION), 
            ShaderCompile3D._globalRegDefine("FOG", ShaderCompile3D.SHADERDEFINE_FOG), ShaderCompile3D._globalRegDefine("DIRECTIONLIGHT", ShaderCompile3D.SHADERDEFINE_DIRECTIONLIGHT), 
            ShaderCompile3D._globalRegDefine("POINTLIGHT", ShaderCompile3D.SHADERDEFINE_POINTLIGHT), 
            ShaderCompile3D._globalRegDefine("SPOTLIGHT", ShaderCompile3D.SHADERDEFINE_SPOTLIGHT), 
            ShaderCompile3D._globalRegDefine("UV", ShaderCompile3D.SHADERDEFINE_UV0), ShaderCompile3D._globalRegDefine("COLOR", ShaderCompile3D.SHADERDEFINE_COLOR), 
            ShaderCompile3D._globalRegDefine("UV1", ShaderCompile3D.SHADERDEFINE_UV1), ShaderCompile3D._globalRegDefine("CASTSHADOW", ParallelSplitShadowMap.SHADERDEFINE_CAST_SHADOW), 
            ShaderCompile3D._globalRegDefine("SHADOWMAP_PSSM1", ParallelSplitShadowMap.SHADERDEFINE_SHADOW_PSSM1), 
            ShaderCompile3D._globalRegDefine("SHADOWMAP_PSSM2", ParallelSplitShadowMap.SHADERDEFINE_SHADOW_PSSM2), 
            ShaderCompile3D._globalRegDefine("SHADOWMAP_PSSM3", ParallelSplitShadowMap.SHADERDEFINE_SHADOW_PSSM3), 
            ShaderCompile3D._globalRegDefine("SHADOWMAP_PCF_NO", ParallelSplitShadowMap.SHADERDEFINE_SHADOW_PCF_NO), 
            ShaderCompile3D._globalRegDefine("SHADOWMAP_PCF1", ParallelSplitShadowMap.SHADERDEFINE_SHADOW_PCF1), 
            ShaderCompile3D._globalRegDefine("SHADOWMAP_PCF2", ParallelSplitShadowMap.SHADERDEFINE_SHADOW_PCF2), 
            ShaderCompile3D._globalRegDefine("SHADOWMAP_PCF3", ParallelSplitShadowMap.SHADERDEFINE_SHADOW_PCF3), 
            ShaderCompile3D._globalRegDefine("DEPTHFOG", ShaderCompile3D.SAHDERDEFINE_DEPTHFOG), 
            Shader3D.addInclude("LightHelper.glsl", "\nstruct DirectionLight\n{\n vec3 Direction;\n vec3 Diffuse;\n};\n\nstruct PointLight\n{\n vec3 Diffuse;\n vec3 Attenuation;\n vec3 Position;\n float Range;\n};\n\nstruct SpotLight\n{\n vec3 Diffuse;\n vec3 Attenuation;\n vec3 Position;\n vec3 Direction;\n float Spot;\n float Range;\n};\n\n\nvec3 NormalSampleToWorldSpace(vec3 normalMapSample, vec3 unitNormal, vec3 tangent)\n{\n\tvec3 normalT = 2.0*normalMapSample - 1.0;\n\n\t// Build orthonormal basis.\n\tvec3 N = normalize(unitNormal);\n\tvec3 T = normalize(tangent- dot(tangent, N)*N);\n\tvec3 B = cross(T, N);\n\n\tmat3 TBN = mat3(T, B, N);\n\n\t// Transform from tangent space to world space.\n\tvec3 bumpedNormal = TBN*normalT;\n\n\treturn bumpedNormal;\n}\n\n\nvoid  computeDirectionLight(in vec3 matDif,in vec3 matAmb,in vec4 matSpe,in DirectionLight dirLight,in vec3 ambinentColor,in vec3 normal,in vec3 toEye,out vec3 dif,out vec3 amb,out vec3 spec)\n{\n\tdif=vec3(0.0);//不初始化在IOS中闪烁，PC中不会闪烁\n\tamb=vec3(0.0);\n\tspec=vec3(0.0);\n\tvec3 lightVec=-normalize(dirLight.Direction);\n\t\n\tamb=matAmb*ambinentColor;\n\t\n\tfloat  diffuseFactor=dot(lightVec, normal);\n\t\n\tif(diffuseFactor>0.0)\n\t{\n\t   vec3 v = reflect(-lightVec, normal);\n\t   float specFactor = pow(max(dot(v, toEye), 0.0), matSpe.w);\n\t   \n\t   dif = diffuseFactor * matDif * dirLight.Diffuse;\n\t   spec = specFactor * matSpe.rgb;\n\t}\n\t\n}\n\nvoid computePointLight(in vec3 matDif,in vec3 matAmb,in vec4 matSpe,in PointLight poiLight,in vec3 ambinentColor, in vec3 pos,in vec3 normal,in vec3 toEye,out vec3 dif,out vec3 amb,out vec3 spec)\n{\n\tdif=vec3(0.0);\n\tamb=vec3(0.0);\n\tspec=vec3(0.0);\n\tvec3 lightVec = poiLight.Position - pos;\n\t\t\n\tfloat d = length(lightVec);\n\t\n\tif( d > poiLight.Range )\n\t\treturn;\n\t\t\n\tlightVec /= d; \n\t\n\tamb = matAmb*ambinentColor;\t\n\n\tfloat diffuseFactor = dot(lightVec, normal);\n\n\tif( diffuseFactor > 0.0 )\n\t{\n\t\tvec3 v= reflect(-lightVec, normal);\n\t\tfloat specFactor = pow(max(dot(v, toEye), 0.0), matSpe.w);\n\t\t\t\t\t\n\t\tdif = diffuseFactor * matDif * poiLight.Diffuse;\n\t\tspec = specFactor * matSpe.rgb;\n\t}\n\n\tfloat attenuate = 1.0 / dot(poiLight.Attenuation, vec3(1.0, d, d*d));\n\n\tdif *= attenuate;\n\tspec*= attenuate;\n}\n\nvoid ComputeSpotLight(in vec3 matDif,in vec3 matAmb,in vec4 matSpe,in SpotLight spoLight,in vec3 ambinentColor,in vec3 pos, in vec3 normal,in vec3 toEye,out vec3 dif,out vec3 amb,out vec3 spec)\n{\n\tamb = vec3(0.0);\n\tdif =vec3(0.0);\n\tspec= vec3(0.0);\n\tvec3 lightVec = spoLight.Position - pos;\n\t\t\n\tfloat d = length(lightVec);\n\t\n\tif( d > spoLight.Range)\n\t\treturn;\n\t\t\n\tlightVec /= d; \n\t\n\tamb = matAmb*ambinentColor;\t\n\n\tfloat diffuseFactor = dot(lightVec, normal);\n\n\tif(diffuseFactor > 0.0)\n\t{\n\t\tvec3 v= reflect(-lightVec, normal);\n\t\tfloat specFactor = pow(max(dot(v, toEye), 0.0), matSpe.w);\n\t\t\t\t\t\n\t\tdif = diffuseFactor * matDif * spoLight.Diffuse;\n\t\tspec = specFactor * matSpe.rgb;\n\t}\n\t\n\tfloat spot = pow(max(dot(-lightVec, normalize(spoLight.Direction)), 0.0), spoLight.Spot);\n\n\tfloat attenuate = spot/dot(spoLight.Attenuation, vec3(1.0, d, d*d));\n\n\tamb *= spot;\n\tdif *= attenuate;\n\tspec*= attenuate;\n}\n\n"), 
            Shader3D.addInclude("ShadowHelper.glsl", "uniform sampler2D u_shadowMap1;\nuniform sampler2D u_shadowMap2;\nuniform sampler2D u_shadowMap3;\nuniform vec2\t  u_shadowPCFoffset;\nuniform vec4     u_shadowPSSMDistance;\nvec4 packDepth(const in float depth)\n{\n\tconst vec4 bitShift = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);\n\tconst vec4 bitMask\t= vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);\n\tvec4 res = mod(depth*bitShift*vec4(255), vec4(256))/vec4(255);\n\tres -= res.xxyz * bitMask;\n\treturn res;\n}\nfloat unpackDepth(const in vec4 rgbaDepth)\n{\n\tconst vec4 bitShift = vec4(1.0/(256.0*256.0*256.0), 1.0/(256.0*256.0), 1.0/256.0, 1.0);\n\tfloat depth = dot(rgbaDepth, bitShift);\n\treturn depth;\n}\nfloat tex2DPCF( sampler2D shadowMap,vec2 texcoord,vec2 invsize,float zRef )\n{\n\tvec2 texelpos =texcoord / invsize;\n\tvec2 lerps = fract( texelpos );\n\tfloat sourcevals[4];\n\tsourcevals[0] = float( unpackDepth(texture2D(shadowMap,texcoord)) > zRef );\n\tsourcevals[1] = float( unpackDepth(texture2D(shadowMap,texcoord + vec2(invsize.x,0))) > zRef );\n\tsourcevals[2] = float( unpackDepth(texture2D(shadowMap,texcoord + vec2(0,invsize.y))) > zRef );\n\tsourcevals[3] = float( unpackDepth(texture2D(shadowMap,texcoord + vec2(invsize.x, invsize.y) )) > zRef );\n\treturn mix( mix(sourcevals[0],sourcevals[2],lerps.y),mix(sourcevals[1],sourcevals[3],lerps.y),lerps.x );\n}\nfloat getShadowPSSM3( sampler2D shadowMap1,sampler2D shadowMap2,sampler2D shadowMap3,mat4 lightShadowVP[4],vec4 pssmDistance,vec2 shadowPCFOffset,vec3 worldPos,float posViewZ,float zBias )\n{\n\tfloat value = 1.0;\n\tint nPSNum = int(posViewZ>pssmDistance.x);\n\tnPSNum += int(posViewZ>pssmDistance.y);\n\tnPSNum += int(posViewZ>pssmDistance.z);\n\t//真SB,webgl不支持在PS中直接访问数组\n\tmat4 lightVP;\n\tif( nPSNum == 0 )\n\t{\n\t\tlightVP = lightShadowVP[1];\n\t}\n\telse if( nPSNum == 1 )\n\t{\n\t\tlightVP = lightShadowVP[2];\n\t}\n\telse if( nPSNum == 2 )\n\t{\n\t\tlightVP = lightShadowVP[3];\n\t}\n\tvec4 vLightMVPPos = lightVP * vec4(worldPos,1.0);\n\t//为了效率，在CPU计算/2.0 + 0.5\n\t//vec3 vText = (vLightMVPPos.xyz / vLightMVPPos.w)/2.0 + 0.5;\n\tvec3 vText = vLightMVPPos.xyz / vLightMVPPos.w;\n\tfloat fMyZ = vText.z - zBias;\n\t/*\n\tbvec4 bInFrustumVec = bvec4 ( vText.x >= 0.0, vText.x <= 1.0, vText.y >= 0.0, vText.y <= 1.0 );\n\tbool bInFrustum = all( bInFrustumVec );\n\tbvec2 bFrustumTestVec = bvec2( bInFrustum, fMyZ <= 1.0 );\n\tbool bFrustumTest = all( bFrustumTestVec );\n\tif ( bFrustumTest ) \n\t*/\n\tif( fMyZ <= 1.0 )\n\t{\n\t\tfloat zdepth=0.0;\n#ifdef SHADOWMAP_PCF3\n\t\tif ( nPSNum == 0 )\n\t\t{\n\t\t\tvalue =  tex2DPCF( shadowMap1, vText.xy,shadowPCFOffset,fMyZ );\n\t\t\tvalue += tex2DPCF( shadowMap1, vText.xy+vec2(shadowPCFOffset.xy),shadowPCFOffset,\tfMyZ );\n\t\t\tvalue += tex2DPCF( shadowMap1, vText.xy+vec2(shadowPCFOffset.x,0),shadowPCFOffset,\tfMyZ );\n\t\t\tvalue += tex2DPCF( shadowMap1, vText.xy+vec2(0,shadowPCFOffset.y),shadowPCFOffset,\tfMyZ );\n\t\t\tvalue = value/4.0;\n\t\t} \n\t\telse if( nPSNum == 1 )\n\t\t{\n\t\t\tvalue = tex2DPCF( shadowMap2,vText.xy,shadowPCFOffset,fMyZ);\n\t\t}\n\t\telse if( nPSNum == 2 )\n\t\t{\n\t\t\tvec4 color = texture2D( shadowMap3,vText.xy );\n\t\t\tzdepth = unpackDepth(color);\n\t\t\tvalue = float(fMyZ < zdepth);\n\t\t}\n#endif\n#ifdef SHADOWMAP_PCF2\n\t\tif ( nPSNum == 0 )\n\t\t{\n\t\t\tvalue = tex2DPCF( shadowMap1,vText.xy,shadowPCFOffset,fMyZ);\n\t\t}\n\t\telse if( nPSNum == 1 )\n\t\t{\n\t\t\tvalue = tex2DPCF( shadowMap2,vText.xy,shadowPCFOffset,fMyZ);\n\t\t}\n\t\telse if( nPSNum == 2 )\n\t\t{\n\t\t\tvec4 color = texture2D( shadowMap3,vText.xy );\n\t\t\tzdepth = unpackDepth(color);\n\t\t\tvalue = float(fMyZ < zdepth);\n\t\t}\n\n#endif\n#ifdef SHADOWMAP_PCF1\n\t\tif ( nPSNum == 0 )\n\t\t{\n\t\t\tvalue = tex2DPCF( shadowMap1,vText.xy,shadowPCFOffset,fMyZ);\n\t\t}\n\t\telse if( nPSNum == 1 )\n\t\t{\n\t\t\tvec4 color = texture2D( shadowMap2,vText.xy );\n\t\t\tzdepth = unpackDepth(color);\n\t\t\tvalue = float(fMyZ < zdepth);\n\t\t}\n\t\telse if( nPSNum == 2 )\n\t\t{\n\t\t\tvec4 color = texture2D( shadowMap3,vText.xy );\n\t\t\tzdepth = unpackDepth(color);\n\t\t\tvalue = float(fMyZ < zdepth);\n\t\t}\n#endif\n#ifdef SHADOWMAP_PCF_NO\n\t\tvec4 color;\n\t\tif ( nPSNum == 0 )\n\t\t{\n\t\t\tcolor = texture2D( shadowMap1,vText.xy );\n\t\t}\n\t\telse if( nPSNum == 1 )\n\t\t{\n\t\t\tcolor = texture2D( shadowMap2,vText.xy );\n\t\t}\n\t\telse if( nPSNum == 2 )\n\t\t{\n\t\t\tcolor = texture2D( shadowMap3,vText.xy );\n\t\t}\n\t\tzdepth = unpackDepth(color);\n\t\tvalue = float(fMyZ < zdepth);\n#endif\n\t}\n\treturn value;\n}\nfloat getShadowPSSM2( sampler2D shadowMap1,sampler2D shadowMap2,mat4 lightShadowVP[4],vec4 pssmDistance,vec2 shadowPCFOffset,vec3 worldPos,float posViewZ,float zBias )\n{\n\tfloat value = 1.0;\n\tint nPSNum = int(posViewZ>pssmDistance.x);\n\tnPSNum += int(posViewZ>pssmDistance.y);\n\t//真SB,webgl不支持在PS中直接访问数组\n\tmat4 lightVP;\n\tif( nPSNum == 0 )\n\t{\n\t\tlightVP = lightShadowVP[1];\n\t}\n\telse if( nPSNum == 1 )\n\t{\n\t\tlightVP = lightShadowVP[2];\n\t}\n\tvec4 vLightMVPPos = lightVP * vec4(worldPos,1.0);\n\t//为了效率，在CPU计算/2.0 + 0.5\n\t//vec3 vText = (vLightMVPPos.xyz / vLightMVPPos.w)/2.0 + 0.5;\n\tvec3 vText = vLightMVPPos.xyz / vLightMVPPos.w;\n\tfloat fMyZ = vText.z - zBias;\n\t/*\n\tbvec4 bInFrustumVec = bvec4 ( vText.x >= 0.0, vText.x <= 1.0, vText.y >= 0.0, vText.y <= 1.0 );\n\tbool bInFrustum = all( bInFrustumVec );\n\tbvec2 bFrustumTestVec = bvec2( bInFrustum, fMyZ <= 1.0 );\n\tbool bFrustumTest = all( bFrustumTestVec );\n\tif ( bFrustumTest ) \n\t*/\n\tif( fMyZ <= 1.0 )\n\t{\n\t\tfloat zdepth=0.0;\n#ifdef SHADOWMAP_PCF3\n\t\tif ( nPSNum == 0 )\n\t\t{\n\t\t\tvalue =  tex2DPCF( shadowMap1, vText.xy,shadowPCFOffset,fMyZ );\n\t\t\tvalue += tex2DPCF( shadowMap1, vText.xy+vec2(shadowPCFOffset.xy),shadowPCFOffset,\tfMyZ );\n\t\t\tvalue += tex2DPCF( shadowMap1, vText.xy+vec2(shadowPCFOffset.x,0),shadowPCFOffset,\tfMyZ );\n\t\t\tvalue += tex2DPCF( shadowMap1, vText.xy+vec2(0,shadowPCFOffset.y),shadowPCFOffset,\tfMyZ );\n\t\t\tvalue = value/4.0;\n\t\t}\n\t\telse if( nPSNum == 1 )\n\t\t{\n\t\t\tvalue = tex2DPCF( shadowMap2,vText.xy,shadowPCFOffset,fMyZ);\n\t\t}\n#endif\n#ifdef SHADOWMAP_PCF2\n\t\tif ( nPSNum == 0 )\n\t\t{\n\t\t\tvalue = tex2DPCF( shadowMap1,vText.xy,shadowPCFOffset,fMyZ);\n\t\t}\n\t\telse if( nPSNum == 1 )\n\t\t{\n\t\t\tvalue = tex2DPCF( shadowMap2,vText.xy,shadowPCFOffset,fMyZ);\n\t\t}\n#endif\n#ifdef SHADOWMAP_PCF1\n\t\tif ( nPSNum == 0 )\n\t\t{\n\t\t\tvalue = tex2DPCF( shadowMap1,vText.xy,shadowPCFOffset,fMyZ);\n\t\t}\n\t\telse if( nPSNum == 1 )\n\t\t{\n\t\t\tvec4 color = texture2D( shadowMap2,vText.xy );\n\t\t\tzdepth = unpackDepth(color);\n\t\t\tvalue = float(fMyZ < zdepth);\n\t\t}\n#endif\n#ifdef SHADOWMAP_PCF_NO\n\t\tvec4 color;\n\t\tif ( nPSNum == 0 )\n\t\t{\n\t\t\tcolor = texture2D( shadowMap1,vText.xy );\n\t\t}\n\t\telse if( nPSNum == 1 )\n\t\t{\n\t\t\tcolor = texture2D( shadowMap2,vText.xy );\n\t\t}\n\t\tzdepth = unpackDepth(color);\n\t\tvalue = float(fMyZ < zdepth);\n#endif\n\t}\n\treturn value;\n}\nfloat getShadowPSSM1( sampler2D shadowMap1,vec4 lightMVPPos,vec4 pssmDistance,vec2 shadowPCFOffset,float posViewZ,float zBias )\n{\n\tfloat value = 1.0;\n\tif( posViewZ < pssmDistance.x )\n\t{\n\t\tvec3 vText = lightMVPPos.xyz / lightMVPPos.w;\n\t\tfloat fMyZ = vText.z - zBias;\n\t\t/*\n\t\tbvec4 bInFrustumVec = bvec4 ( vText.x >= 0.0, vText.x <= 1.0, vText.y >= 0.0, vText.y <= 1.0 );\n\t\tbool bInFrustum = all( bInFrustumVec );\n\t\tbvec2 bFrustumTestVec = bvec2( bInFrustum, fMyZ <= 1.0 );\n\t\tbool bFrustumTest = all( bFrustumTestVec );\n\t\t*/\n\t\tif ( fMyZ <= 1.0 ) \n\t\t{\n\t\t\tfloat zdepth=0.0;\n#ifdef SHADOWMAP_PCF3\n\t\t\tvalue =  tex2DPCF( shadowMap1, vText.xy,shadowPCFOffset,fMyZ );\n\t\t\tvalue += tex2DPCF( shadowMap1, vText.xy+vec2(shadowPCFOffset.xy),shadowPCFOffset,fMyZ );\n\t\t\tvalue += tex2DPCF( shadowMap1, vText.xy+vec2(shadowPCFOffset.x,0),shadowPCFOffset,fMyZ );\n\t\t\tvalue += tex2DPCF( shadowMap1, vText.xy+vec2(0,shadowPCFOffset.y),shadowPCFOffset,fMyZ );\n\t\t\tvalue = value/4.0;\n#endif\n#ifdef SHADOWMAP_PCF2\t\t\n\t\t\tvalue = tex2DPCF( shadowMap1,vText.xy,shadowPCFOffset,fMyZ);\n#endif\n#ifdef SHADOWMAP_PCF1\n\t\t\tvalue = tex2DPCF( shadowMap1,vText.xy,shadowPCFOffset,fMyZ);\n#endif\n#ifdef SHADOWMAP_PCF_NO\t\t\n\t\t\tvec4 color = texture2D( shadowMap1,vText.xy );\n\t\t\tzdepth = unpackDepth(color);\n\t\t\tvalue = float(fMyZ < zdepth);\n#endif\n\t\t}\n\t}\n\treturn value;\n}"), 
            attributeMap = {
                a_Position: 0,
                a_Color: 1,
                a_Normal: 3,
                a_Texcoord0: 2,
                a_Texcoord1: 15,
                a_TexcoordNext0: 14,
                a_BoneWeights: 7,
                a_BoneIndices: 6,
                a_Tangent0: 5
            }, uniformMap = {
                u_Bones: [ 0, 0 ],
                u_DiffuseTexture: [ 1, 1 ],
                u_SpecularTexture: [ 3, 1 ],
                u_NormalTexture: [ 2, 1 ],
                u_AmbientTexture: [ 5, 1 ],
                u_ReflectTexture: [ 6, 1 ],
                u_AlphaTestValue: [ 0, 1 ],
                u_Albedo: [ 7, 1 ],
                u_UVMatrix: [ 13, 1 ],
                u_UVAge: [ 14, 1 ],
                u_UVAniAge: [ 8, 1 ],
                u_MaterialDiffuse: [ 10, 1 ],
                u_MaterialAmbient: [ 9, 1 ],
                u_MaterialSpecular: [ 11, 1 ],
                u_MaterialReflect: [ 12, 1 ],
                u_TilingOffset: [ 15, 1 ],
                u_WorldMat: [ 0, 2 ],
                u_MvpMatrix: [ 1, 2 ],
                u_LightmapScaleOffset: [ 2, 2 ],
                u_LightMap: [ 3, 2 ],
                u_CameraPos: [ 0, 3 ],
                u_FogStart: [ 1, 4 ],
                u_FogRange: [ 2, 4 ],
                u_FogColor: [ 0, 4 ],
                "u_DirectionLight.Direction": [ 3, 4 ],
                "u_DirectionLight.Diffuse": [ 4, 4 ],
                "u_PointLight.Position": [ 5, 4 ],
                "u_PointLight.Range": [ 6, 4 ],
                "u_PointLight.Attenuation": [ 7, 4 ],
                "u_PointLight.Diffuse": [ 8, 4 ],
                "u_SpotLight.Position": [ 9, 4 ],
                "u_SpotLight.Direction": [ 10, 4 ],
                "u_SpotLight.Range": [ 12, 4 ],
                "u_SpotLight.Spot": [ 11, 4 ],
                "u_SpotLight.Attenuation": [ 13, 4 ],
                "u_SpotLight.Diffuse": [ 14, 4 ],
                u_AmbientColor: [ 21, 4 ],
                u_shadowMap1: [ 18, 4 ],
                u_shadowMap2: [ 19, 4 ],
                u_shadowMap3: [ 20, 4 ],
                u_shadowPSSMDistance: [ 15, 4 ],
                u_lightShadowVP: [ 16, 4 ],
                u_shadowPCFoffset: [ 17, 4 ]
            };
            var SIMPLE = Shader3D.nameKey.add("SIMPLE");
            shaderCompile = ShaderCompile3D.add(SIMPLE, "attribute vec4 a_Position;\nuniform mat4 u_MvpMatrix;\n\n\n\n#if defined(DIFFUSEMAP)||((defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT))&&(defined(COLOR)&&defined(SPECULARMAP)||defined(NORMALMAP)))||(defined(LIGHTMAP)&&defined(UV))\nattribute vec2 a_Texcoord0;\nvarying vec2 v_Texcoord0;\n  #ifdef UVTRANSFORM \n  uniform mat4 u_UVMatrix;\n  #endif\n#endif\n\n#if defined(AMBIENTMAP)||(defined(LIGHTMAP)&&defined(UV1))\nattribute vec2 a_Texcoord1;\n#endif\n\n#if defined(AMBIENTMAP)||defined(LIGHTMAP)\nuniform vec4 u_LightmapScaleOffset;\nvarying vec2 v_LightMapUV;\n#endif\n\n\n#ifdef COLOR\nattribute vec4 a_Color;\nvarying vec4 v_Color;\n#endif\n\n#ifdef BONE\nattribute vec4 a_BoneIndices;\nattribute vec4 a_BoneWeights;\nconst int c_MaxBoneCount = 24;\nuniform mat4 u_Bones[c_MaxBoneCount];\n#endif\n\n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)||defined(REFLECTMAP)\nattribute vec3 a_Normal;\nvarying vec3 v_Normal;\n#endif\n\n#if (defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)||defined(REFLECTMAP))&&defined(NORMALMAP)\nattribute vec3 a_Tangent0;\nvarying vec3 v_Tangent0;\n#endif\n\n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)||defined(FOG)||defined(DEPTHFOG)||defined(REFLECTMAP)||defined(RECEIVESHADOW)\nuniform mat4 u_WorldMat;\nvarying vec3 v_PositionWorld;\n#endif\n\nvarying float v_posViewZ;\n#ifdef RECEIVESHADOW\n  #ifdef SHADOWMAP_PSSM1 \n  varying vec4 v_lightMVPPos;\n  uniform mat4 u_lightShadowVP[4];\n  #endif\n#endif\n\n#ifdef TILINGOFFSET\n\tuniform vec4 u_TilingOffset;\n#endif\n\nvoid main_castShadow()\n{\n#ifdef BONE\n\tmat4 skinTransform=mat4(0.0);\n\tskinTransform += u_Bones[int(a_BoneIndices.x)] * a_BoneWeights.x;\n\tskinTransform += u_Bones[int(a_BoneIndices.y)] * a_BoneWeights.y;\n\tskinTransform += u_Bones[int(a_BoneIndices.z)] * a_BoneWeights.z;\n\tskinTransform += u_Bones[int(a_BoneIndices.w)] * a_BoneWeights.w;\n\tvec4 position=skinTransform*a_Position;\n\tgl_Position = u_MvpMatrix * position;\n#else\n\tgl_Position = u_MvpMatrix * a_Position;\n#endif\n \n//TODO没考虑UV动画呢\n#if defined(DIFFUSEMAP)&&defined(ALPHATEST)\n\tv_Texcoord0=a_Texcoord0;\n#endif\n\tv_posViewZ = gl_Position.z;\n}\n\nvoid main_normal()\n{\n#ifdef BONE\n\tmat4 skinTransform=mat4(0.0);\n\tskinTransform += u_Bones[int(a_BoneIndices.x)] * a_BoneWeights.x;\n\tskinTransform += u_Bones[int(a_BoneIndices.y)] * a_BoneWeights.y;\n\tskinTransform += u_Bones[int(a_BoneIndices.z)] * a_BoneWeights.z;\n\tskinTransform += u_Bones[int(a_BoneIndices.w)] * a_BoneWeights.w;\n\tvec4 position=skinTransform*a_Position;\n\tgl_Position = u_MvpMatrix * position;\n#else\n\tgl_Position = u_MvpMatrix * a_Position;\n#endif\n\n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)||defined(REFLECTMAP)\n\tmat3 worldMat;\n\t#ifdef BONE\n\t\tworldMat=mat3(u_WorldMat*skinTransform);\n\t#else\n\t\tworldMat=mat3(u_WorldMat);\n\t#endif  \n\tv_Normal=worldMat*a_Normal;\n\t#if (defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT))&&defined(NORMALMAP)\n\t\tv_Tangent0=worldMat*a_Tangent0;\n\t#endif\n#endif\n\n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)||defined(FOG)||defined(DEPTHFOG)||defined(REFLECTMAP)||defined(RECEIVESHADOW)\n\t#ifdef BONE\n\t\tv_PositionWorld=(u_WorldMat*position).xyz;\n\t#else\n\t\tv_PositionWorld=(u_WorldMat*a_Position).xyz;\n\t#endif\n#endif\n\n#if defined(DIFFUSEMAP)||((defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT))&&(defined(COLOR)&&defined(SPECULARMAP)||defined(NORMALMAP)))\n\tv_Texcoord0=a_Texcoord0;\n\t#ifdef TILINGOFFSET\n\t\tv_Texcoord0=(vec2(v_Texcoord0.x,v_Texcoord0.y-1.0)*u_TilingOffset.xy)+u_TilingOffset.zw;\n\t\tv_Texcoord0=vec2(v_Texcoord0.x,v_Texcoord0.y+1.0);\n\t#endif\n\t#ifdef UVTRANSFORM\n\t\tv_Texcoord0=(u_UVMatrix*vec4(v_Texcoord0,0.0,1.0)).xy;\n\t#endif\n#endif\n\n#if defined(AMBIENTMAP)||defined(LIGHTMAP)\n\t#ifdef SCALEOFFSETLIGHTINGMAPUV\n\t\t#ifdef UV1\n\t\t\tv_LightMapUV=vec2(a_Texcoord1.x*u_LightmapScaleOffset.x+u_LightmapScaleOffset.z,1.0+a_Texcoord1.y*u_LightmapScaleOffset.y+u_LightmapScaleOffset.w);\n\t\t#else\n\t\t\tv_LightMapUV=vec2(a_Texcoord0.x,a_Texcoord0.y-1.0)*u_LightmapScaleOffset.xy+u_LightmapScaleOffset.zw;\n\t\t#endif \n\t#else\n\t\t#ifdef UV1\n\t\t\tv_LightMapUV=a_Texcoord1;\n\t\t#else\n\t\t\tv_LightMapUV=a_Texcoord0;\n\t\t#endif \n\t#endif \n#endif\n\n#ifdef COLOR\n\tv_Color=a_Color;\n#endif\n\n#ifdef RECEIVESHADOW\n\tv_posViewZ = gl_Position.w;\n\t#ifdef SHADOWMAP_PSSM1 \n\t\tv_lightMVPPos = u_lightShadowVP[0] * vec4(v_PositionWorld,1.0);\n\t#endif\n#endif\n}\n\nvoid main()\n{\n#ifdef CASTSHADOW\n\tmain_castShadow();\n#else\n\tmain_normal();\n#endif\n}", '#ifdef HIGHPRECISION\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\n#include "LightHelper.glsl";\n\nuniform vec4 u_Albedo;\n\n#ifdef ALPHATEST\nuniform float u_AlphaTestValue;\n#endif\n\n#ifdef DIFFUSEMAP\nuniform sampler2D u_DiffuseTexture;\n#endif\n\n#ifdef REFLECTMAP\nuniform samplerCube u_ReflectTexture;\nuniform vec3 u_MaterialReflect;\n#endif\n\n#if   defined(DIFFUSEMAP)||((defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT))&&(defined(COLOR)&&defined(SPECULARMAP)||defined(NORMALMAP)))\nvarying vec2 v_Texcoord0;\n#endif\n\n#if defined(AMBIENTMAP)||defined(LIGHTMAP)\nvarying vec2 v_LightMapUV;\n#endif\n#ifdef AMBIENTMAP\nuniform sampler2D u_AmbientTexture;\n#endif\n#ifdef LIGHTMAP\nuniform sampler2D u_LightMap;\n#endif\n\n#ifdef COLOR\nvarying vec4 v_Color;\n#endif\n\n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)\nuniform vec3 u_MaterialDiffuse;\nuniform vec4 u_MaterialSpecular;\n  #if (defined(DIFFUSEMAP)||defined(COLOR))&&defined(SPECULARMAP) \n  uniform sampler2D u_SpecularTexture;\n  #endif\n#endif\n\n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)||defined(AMBIENTMAP)||defined(LIGHTMAP)\nuniform vec3 u_MaterialAmbient;\n#endif\n\n#if defined(FOG)||defined(DEPTHFOG)\n\tuniform float u_FogStart;\n\tuniform float u_FogRange;\n\t#ifdef ADDTIVEFOG\n\t#else\n\t\tuniform vec3 u_FogColor;\n\t#endif\n#endif\n\n\n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)||defined(REFLECTMAP)\nvarying vec3 v_Normal;\n#endif\n\n#if (defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT))&&defined(NORMALMAP)\nuniform sampler2D u_NormalTexture;\nvarying vec3 v_Tangent0;\n#endif\n\n#ifdef DIRECTIONLIGHT\nuniform DirectionLight u_DirectionLight;\n#endif\n\n#ifdef POINTLIGHT\nuniform PointLight u_PointLight;\n#endif\n\n#ifdef SPOTLIGHT\nuniform SpotLight u_SpotLight;\n#endif\n\nuniform vec3 u_AmbientColor;\n\n\n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)||defined(FOG)||defined(DEPTHFOG)||defined(REFLECTMAP)||(defined(RECEIVESHADOW)&&(defined(SHADOWMAP_PSM2)||defined(SHADOWMAP_PSM3)))\nuniform vec3 u_CameraPos;\n#endif\n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)||defined(FOG)||defined(DEPTHFOG)||defined(REFLECTMAP)\nvarying vec3 v_PositionWorld;\n#endif\n\n#include "ShadowHelper.glsl"\n#ifdef RECEIVESHADOW\n\t#if defined(SHADOWMAP_PSSM2)||defined(SHADOWMAP_PSSM3)\n\tuniform mat4 u_lightShadowVP[4];\n\t#endif\n\t#ifdef SHADOWMAP_PSSM1 \n\tvarying vec4 v_lightMVPPos;\n\t#endif\n#endif\nvarying float v_posViewZ;\n\n\n\nvoid main_castShadow()\n{\n\t//gl_FragColor=vec4(v_posViewZ,0.0,0.0,1.0);\n\tgl_FragColor=packDepth(v_posViewZ);\n\t#if defined(DIFFUSEMAP)&&defined(ALPHATEST)\n\t\tfloat alpha = texture2D(u_DiffuseTexture,v_Texcoord0).w;\n\t\tif( alpha < u_AlphaTestValue )\n\t\t{\n\t\t\tdiscard;\n\t\t}\n\t#endif\n}\nvoid main_normal()\n{\n#if defined(DIFFUSEMAP)&&!defined(COLOR)\n\tgl_FragColor=texture2D(u_DiffuseTexture, v_Texcoord0);\n#endif \n  \n#if defined(COLOR)&&!defined(DIFFUSEMAP)\n\tgl_FragColor=v_Color;\n#endif \n  \n#if defined(DIFFUSEMAP)&&defined(COLOR)\n\tvec4 texColor=texture2D(u_DiffuseTexture, v_Texcoord0);\n\tgl_FragColor=texColor*v_Color;\n#endif\n  \n#if !defined(DIFFUSEMAP)&&!defined(COLOR)\n\tgl_FragColor=vec4(1.0,1.0,1.0,1.0);\n#endif \n    \n#ifdef ALPHATEST\n\tif(gl_FragColor.a-u_AlphaTestValue<0.0)\n\t\tdiscard;\n#endif\n  \n  \n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)||defined(REFLECTMAP)\n\tvec3 normal;\n    #if (defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT))&&defined(NORMALMAP)\n\t\tvec3 normalMapSample = texture2D(u_NormalTexture, v_Texcoord0).rgb;\n\t\tnormal = normalize(NormalSampleToWorldSpace(normalMapSample, v_Normal, v_Tangent0));\n\t#else\n\t\tnormal = normalize(v_Normal);\n    #endif\n#endif\n\t\n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)\n\tvec3 diffuse = vec3(0.0);\n\tvec3 ambient = vec3(0.0);\n\tvec3 specular= vec3(0.0);\n\tvec3 dif, amb, spe;\n#endif\n  \n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)||defined(FOG)||defined(REFLECTMAP)\n\tvec3 toEye;\n\t#ifdef FOG\n\t\ttoEye=u_CameraPos-v_PositionWorld;\n\t\tfloat toEyeLength=length(toEye);\n\t\ttoEye/=toEyeLength;\n\t#else\n\t\ttoEye=normalize(u_CameraPos-v_PositionWorld);\n\t#endif\n#endif\n\t\n#ifdef DIRECTIONLIGHT\n\tcomputeDirectionLight(u_MaterialDiffuse,u_MaterialAmbient,u_MaterialSpecular,u_DirectionLight,u_AmbientColor,normal,toEye, dif, amb, spe);\n\tdiffuse+=dif;\n\tambient+=amb;\n\tspecular+=spe;\n#endif\n \n#ifdef POINTLIGHT\n\tcomputePointLight(u_MaterialDiffuse,u_MaterialAmbient,u_MaterialSpecular,u_PointLight,u_AmbientColor,v_PositionWorld,normal,toEye, dif, amb, spe);\n\tdiffuse+=dif;\n\tambient+=amb;\n\tspecular+=spe;\n#endif\n\n#ifdef SPOTLIGHT\n\tComputeSpotLight(u_MaterialDiffuse,u_MaterialAmbient,u_MaterialSpecular,u_SpotLight,u_AmbientColor,v_PositionWorld,normal,toEye, dif, amb, spe);\n\tdiffuse+=dif;\n\tambient+=amb;\n\tspecular+=spe;\n#endif\n\n#ifdef RECEIVESHADOW\n\tfloat shadowValue = 1.0;\n\t#ifdef SHADOWMAP_PSSM3\n\t\tshadowValue = getShadowPSSM3( u_shadowMap1,u_shadowMap2,u_shadowMap3,u_lightShadowVP,u_shadowPSSMDistance,u_shadowPCFoffset,v_PositionWorld,v_posViewZ,0.001);\n\t#endif\n\t#ifdef SHADOWMAP_PSSM2\n\t\tshadowValue = getShadowPSSM2( u_shadowMap1,u_shadowMap2,u_lightShadowVP,u_shadowPSSMDistance,u_shadowPCFoffset,v_PositionWorld,v_posViewZ,0.001);\n\t#endif \n\t#ifdef SHADOWMAP_PSSM1\n\t\tshadowValue = getShadowPSSM1( u_shadowMap1,v_lightMVPPos,u_shadowPSSMDistance,u_shadowPCFoffset,v_posViewZ,0.001);\n\t#endif\n#endif\n\n#ifdef AMBIENTMAP\n\t#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)\n\t\tgl_FragColor.rgb=gl_FragColor.rgb*(u_MaterialAmbient+texture2D(u_AmbientTexture, v_LightMapUV).rgb); \n\t#else\n\t\t#if defined(RECEIVESHADOW)\n\t\t\tgl_FragColor.rgb=gl_FragColor.rgb*(u_MaterialAmbient+texture2D(u_AmbientTexture, v_LightMapUV).rgb * shadowValue);\n\t\t#else\n\t\t\tgl_FragColor.rgb=gl_FragColor.rgb*(u_MaterialAmbient+texture2D(u_AmbientTexture, v_LightMapUV).rgb); \n\t\t#endif\n\t#endif\n#endif\n\n#ifdef LIGHTMAP\n\t#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)\n\t\tgl_FragColor.rgb=gl_FragColor.rgb*(u_MaterialAmbient+texture2D(u_LightMap, v_LightMapUV).rgb); \n\t#else\n\t\t#if defined(RECEIVESHADOW)\n\t\t\tgl_FragColor.rgb=gl_FragColor.rgb*(u_MaterialAmbient+texture2D(u_LightMap, v_LightMapUV).rgb * shadowValue);\n\t\t#else\n\t\t\tgl_FragColor.rgb=gl_FragColor.rgb*(u_MaterialAmbient+texture2D(u_LightMap, v_LightMapUV).rgb); \n\t\t#endif\n\t#endif\n#endif\n\ngl_FragColor=gl_FragColor*u_Albedo;\n\n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)\n\t#if (defined(DIFFUSEMAP)||defined(COLOR))&&defined(SPECULARMAP)\n\t\tspecular =specular*texture2D(u_SpecularTexture, v_Texcoord0).rgb;\n    #endif\n\t#ifdef RECEIVESHADOW\n\t\tgl_FragColor =vec4( gl_FragColor.rgb*(ambient + diffuse*shadowValue) + specular*shadowValue,gl_FragColor.a);\n\t#else\n\t\tgl_FragColor =vec4( gl_FragColor.rgb*(ambient + diffuse) + specular,gl_FragColor.a);\n\t#endif\n#endif\n  \n#ifdef REFLECTMAP\n\tvec3 incident = -toEye;\n\tvec3 reflectionVector = reflect(incident,normal);\n\tvec3 reflectionColor  = textureCube(u_ReflectTexture,reflectionVector).rgb;\n\tgl_FragColor.rgb += u_MaterialReflect*reflectionColor;\n#endif\n  \n#ifdef FOG\n\tfloat lerpFact=clamp((toEyeLength-u_FogStart)/u_FogRange,0.0,1.0);\n\t#ifdef ADDTIVEFOG\n\t\tgl_FragColor.rgb=mix(gl_FragColor.rgb,vec3(0.0,0.0,0.0),lerpFact);\n\t#else\n\t\tgl_FragColor.rgb=mix(gl_FragColor.rgb,u_FogColor,lerpFact);\n\t#endif\n#endif\n#ifdef DEPTHFOG\n\tfloat lerpFact = (-v_PositionWorld.y-u_FogStart)/u_FogRange;\n\tgl_FragColor.rgb=mix(gl_FragColor.rgb,u_FogColor,lerpFact);\n#endif\n}\n\nvoid main()\n{\n#ifdef CASTSHADOW\t\t\n\tmain_castShadow();\n#else\n  main_normal();\n#endif  \n}\n\n', attributeMap, uniformMap), 
            StandardMaterial.SHADERDEFINE_DIFFUSEMAP = shaderCompile.registerMaterialDefine("DIFFUSEMAP"), 
            StandardMaterial.SHADERDEFINE_NORMALMAP = shaderCompile.registerMaterialDefine("NORMALMAP"), 
            StandardMaterial.SHADERDEFINE_SPECULARMAP = shaderCompile.registerMaterialDefine("SPECULARMAP"), 
            StandardMaterial.SHADERDEFINE_EMISSIVEMAP = shaderCompile.registerMaterialDefine("EMISSIVEMAP"), 
            StandardMaterial.SHADERDEFINE_AMBIENTMAP = shaderCompile.registerMaterialDefine("AMBIENTMAP"), 
            StandardMaterial.SHADERDEFINE_REFLECTMAP = shaderCompile.registerMaterialDefine("REFLECTMAP"), 
            StandardMaterial.SHADERDEFINE_UVTRANSFORM = shaderCompile.registerMaterialDefine("UVTRANSFORM"), 
            StandardMaterial.SHADERDEFINE_TILINGOFFSET = shaderCompile.registerMaterialDefine("TILINGOFFSET"), 
            StandardMaterial.SHADERDEFINE_ADDTIVEFOG = shaderCompile.registerMaterialDefine("ADDTIVEFOG");
        }, ShaderInit3D;
    }(), ValusArray = function() {
        function ValusArray() {
            this._data = null, this._data = [];
        }
        __class(ValusArray, "laya.d3.shader.ValusArray");
        var __proto = ValusArray.prototype;
        return __proto.setValue = function(name, value) {
            this._data[name] = value;
        }, __getset(0, __proto, "data", function() {
            return this._data;
        }), ValusArray;
    }(), ParallelSplitShadowMap = function() {
        function ParallelSplitShadowMap() {}
        return ParallelSplitShadowMap.SHADERDEFINE_RECEIVE_SHADOW = 1, ParallelSplitShadowMap.SHADERDEFINE_CAST_SHADOW = 512, 
        ParallelSplitShadowMap.SHADERDEFINE_SHADOW_PSSM1 = 1024, ParallelSplitShadowMap.SHADERDEFINE_SHADOW_PSSM2 = 2048, 
        ParallelSplitShadowMap.SHADERDEFINE_SHADOW_PSSM3 = 4096, ParallelSplitShadowMap.SHADERDEFINE_SHADOW_PCF_NO = 8192, 
        ParallelSplitShadowMap.SHADERDEFINE_SHADOW_PCF1 = 16384, ParallelSplitShadowMap.SHADERDEFINE_SHADOW_PCF2 = 32768, 
        ParallelSplitShadowMap.SHADERDEFINE_SHADOW_PCF3 = 65536, ParallelSplitShadowMap.MAX_PSSM_COUNT = 3, 
        ParallelSplitShadowMap;
    }(), Picker = (function() {
        function ChunkInfo() {
            this.alphaMap = null, this.detailID = null, this.normalMap = null;
        }
        __class(ChunkInfo, "laya.d3.terrain.unit.ChunkInfo");
    }(), function() {
        function DetailTextureInfo() {
            this.diffuseTexture = null, this.normalTexture = null, this.scale = null, this.offset = null;
        }
        __class(DetailTextureInfo, "laya.d3.terrain.unit.DetailTextureInfo");
    }(), function() {
        function MaterialInfo() {
            this.ambientColor = null, this.diffuseColor = null, this.specularColor = null;
        }
        __class(MaterialInfo, "laya.d3.terrain.unit.MaterialInfo");
    }(), function() {
        function Picker() {}
        return __class(Picker, "laya.d3.utils.Picker"), Picker.calculateCursorRay = function(point, viewPort, projectionMatrix, viewMatrix, world, out) {
            var x = point.elements[0], y = point.elements[1], nearSource = Picker._tempVector30, nerSourceE = nearSource.elements;
            nerSourceE[0] = x, nerSourceE[1] = y, nerSourceE[2] = viewPort.minDepth;
            var farSource = Picker._tempVector31, farSourceE = farSource.elements;
            farSourceE[0] = x, farSourceE[1] = y, farSourceE[2] = viewPort.maxDepth;
            var nearPoint = out.origin, farPoint = Picker._tempVector32;
            viewPort.unprojectFromWVP(nearSource, projectionMatrix, viewMatrix, world, nearPoint), 
            viewPort.unprojectFromWVP(farSource, projectionMatrix, viewMatrix, world, farPoint);
            var outDire = out.direction.elements;
            outDire[0] = farPoint.x - nearPoint.x, outDire[1] = farPoint.y - nearPoint.y, outDire[2] = farPoint.z - nearPoint.z, 
            Vector3.normalize(out.direction, out.direction);
        }, Picker.rayIntersectsPositionsAndIndices = function(ray, vertexDatas, vertexDeclaration, indices, outHitInfo) {
            for (var vertexStrideFloatCount = vertexDeclaration.vertexStride / 4, positionVertexElementOffset = vertexDeclaration.getVertexElementByUsage(0).offset / 4, closestIntersection = Number.MAX_VALUE, closestTriangleVertexIndex1 = -1, closestTriangleVertexIndex2 = -1, closestTriangleVertexIndex3 = -1, j = 0; j < indices.length; j += 3) {
                var vertex1 = Picker._tempVector35, vertex1E = vertex1.elements, vertex1Index = indices[j] * vertexStrideFloatCount, vertex1PositionIndex = vertex1Index + positionVertexElementOffset;
                vertex1E[0] = vertexDatas[vertex1PositionIndex], vertex1E[1] = vertexDatas[1 + vertex1PositionIndex], 
                vertex1E[2] = vertexDatas[2 + vertex1PositionIndex];
                var vertex2 = Picker._tempVector36, vertex2E = vertex2.elements, vertex2Index = indices[j + 1] * vertexStrideFloatCount, vertex2PositionIndex = vertex2Index + positionVertexElementOffset;
                vertex2E[0] = vertexDatas[vertex2PositionIndex], vertex2E[1] = vertexDatas[1 + vertex2PositionIndex], 
                vertex2E[2] = vertexDatas[2 + vertex2PositionIndex];
                var vertex3 = Picker._tempVector37, vertex3E = vertex3.elements, vertex3Index = indices[j + 2] * vertexStrideFloatCount, vertex3PositionIndex = vertex3Index + positionVertexElementOffset;
                vertex3E[0] = vertexDatas[vertex3PositionIndex], vertex3E[1] = vertexDatas[1 + vertex3PositionIndex], 
                vertex3E[2] = vertexDatas[2 + vertex3PositionIndex];
                var intersection = laya.d3.utils.Picker.rayIntersectsTriangle(ray, vertex1, vertex2, vertex3);
                !isNaN(intersection) && intersection < closestIntersection && (closestIntersection = intersection, 
                closestTriangleVertexIndex1 = vertex1Index, closestTriangleVertexIndex2 = vertex2Index, 
                closestTriangleVertexIndex3 = vertex3Index);
            }
            if (closestIntersection === Number.MAX_VALUE) return outHitInfo.position.toDefault(), 
            outHitInfo.distance = Number.MAX_VALUE, outHitInfo.trianglePositions[0].toDefault(), 
            outHitInfo.trianglePositions[1].toDefault(), outHitInfo.trianglePositions[2].toDefault(), 
            outHitInfo.triangleNormals[0].toDefault(), outHitInfo.triangleNormals[1].toDefault(), 
            outHitInfo.triangleNormals[2].toDefault(), !1;
            outHitInfo.distance = closestIntersection, Vector3.scale(ray.direction, closestIntersection, outHitInfo.position), 
            Vector3.add(ray.origin, outHitInfo.position, outHitInfo.position);
            var trianglePositions = outHitInfo.trianglePositions, position0 = trianglePositions[0], position1 = trianglePositions[1], position2 = trianglePositions[2], position0E = position0.elements, position1E = position1.elements, position2E = position2.elements, closestVertex1PositionIndex = closestTriangleVertexIndex1 + positionVertexElementOffset;
            position0E[0] = vertexDatas[closestVertex1PositionIndex], position0E[1] = vertexDatas[closestVertex1PositionIndex + 1], 
            position0E[2] = vertexDatas[closestVertex1PositionIndex + 2];
            var closestVertex2PositionIndex = closestTriangleVertexIndex2 + positionVertexElementOffset;
            position1E[0] = vertexDatas[closestVertex2PositionIndex], position1E[1] = vertexDatas[closestVertex2PositionIndex + 1], 
            position1E[2] = vertexDatas[closestVertex2PositionIndex + 2];
            var closestVertex3PositionIndex = closestTriangleVertexIndex3 + positionVertexElementOffset;
            position2E[0] = vertexDatas[closestVertex3PositionIndex], position2E[1] = vertexDatas[closestVertex3PositionIndex + 1], 
            position2E[2] = vertexDatas[closestVertex3PositionIndex + 2];
            var normalVertexElement = vertexDeclaration.getVertexElementByUsage(3);
            if (normalVertexElement) {
                var normalVertexElementOffset = normalVertexElement.offset / 4, triangleNormals = outHitInfo.triangleNormals, normal0 = triangleNormals[0], normal1 = triangleNormals[1], normal2 = triangleNormals[2], normal0E = normal0.elements, normal1E = normal1.elements, normal2E = normal2.elements, closestVertex1NormalIndex = closestTriangleVertexIndex1 + normalVertexElementOffset;
                normal0E[0] = vertexDatas[closestVertex1NormalIndex], normal0E[1] = vertexDatas[closestVertex1NormalIndex + 1], 
                normal0E[2] = vertexDatas[closestVertex1NormalIndex + 2];
                var closestVertex2NormalIndex = closestTriangleVertexIndex2 + normalVertexElementOffset;
                normal1E[0] = vertexDatas[closestVertex2NormalIndex], normal1E[1] = vertexDatas[closestVertex2NormalIndex + 1], 
                normal1E[2] = vertexDatas[closestVertex2NormalIndex + 2];
                var closestVertex3NormalIndex = closestTriangleVertexIndex3 + normalVertexElementOffset;
                normal2E[0] = vertexDatas[closestVertex3NormalIndex], normal2E[1] = vertexDatas[closestVertex3NormalIndex + 1], 
                normal2E[2] = vertexDatas[closestVertex3NormalIndex + 2];
            }
            return !0;
        }, Picker.rayIntersectsTriangle = function(ray, vertex1, vertex2, vertex3) {
            var edge1 = Picker._tempVector30, edge2 = Picker._tempVector31;
            Vector3.subtract(vertex2, vertex1, edge1), Vector3.subtract(vertex3, vertex1, edge2);
            var determinant, directionCrossEdge2 = Picker._tempVector32;
            if (Vector3.cross(ray.direction, edge2, directionCrossEdge2), (determinant = Vector3.dot(edge1, directionCrossEdge2)) > -Number.MIN_VALUE && determinant < Number.MIN_VALUE) return Number.NaN;
            var triangleU, inverseDeterminant = 1 / determinant, distanceVector = Picker._tempVector33;
            if (Vector3.subtract(ray.origin, vertex1, distanceVector), triangleU = Vector3.dot(distanceVector, directionCrossEdge2), 
            (triangleU *= inverseDeterminant) < 0 || 1 < triangleU) return Number.NaN;
            var triangleV, rayDistance, distanceCrossEdge1 = Picker._tempVector34;
            return Vector3.cross(distanceVector, edge1, distanceCrossEdge1), triangleV = Vector3.dot(ray.direction, distanceCrossEdge1), 
            (triangleV *= inverseDeterminant) < 0 || 1 < triangleU + triangleV ? Number.NaN : (rayDistance = Vector3.dot(edge2, distanceCrossEdge1), 
            (rayDistance *= inverseDeterminant) < 0 ? Number.NaN : rayDistance);
        }, __static(Picker, [ "_tempVector30", function() {
            return this._tempVector30 = new Vector3();
        }, "_tempVector31", function() {
            return this._tempVector31 = new Vector3();
        }, "_tempVector32", function() {
            return this._tempVector32 = new Vector3();
        }, "_tempVector33", function() {
            return this._tempVector33 = new Vector3();
        }, "_tempVector34", function() {
            return this._tempVector34 = new Vector3();
        }, "_tempVector35", function() {
            return this._tempVector35 = new Vector3();
        }, "_tempVector36", function() {
            return this._tempVector36 = new Vector3();
        }, "_tempVector37", function() {
            return this._tempVector37 = new Vector3();
        } ]), Picker;
    }()), Size = (function() {
        function RaycastHit() {
            this.distance = NaN, this.trianglePositions = null, this.triangleNormals = null, 
            this.position = null, this.sprite3D = null, this.distance = -1, this.trianglePositions = [ new Vector3(), new Vector3(), new Vector3() ], 
            this.trianglePositions.length = 3, this.triangleNormals = [ new Vector3(), new Vector3(), new Vector3() ], 
            this.triangleNormals.length = 3, this.position = new Vector3();
        }
        __class(RaycastHit, "laya.d3.utils.RaycastHit"), RaycastHit.prototype.cloneTo = function(dec) {
            dec.distance = this.distance, this.trianglePositions[0].cloneTo(dec.trianglePositions[0]), 
            this.trianglePositions[1].cloneTo(dec.trianglePositions[1]), this.trianglePositions[2].cloneTo(dec.trianglePositions[2]), 
            this.triangleNormals[0].cloneTo(dec.triangleNormals[0]), this.triangleNormals[1].cloneTo(dec.triangleNormals[1]), 
            this.triangleNormals[2].cloneTo(dec.triangleNormals[2]), this.position.cloneTo(dec.position), 
            dec.sprite3D = this.sprite3D;
        };
    }(), function() {
        function Size(width, height) {
            this._width = 0, this._height = 0, this._width = width, this._height = height;
        }
        __class(Size, "laya.d3.utils.Size");
        var __proto = Size.prototype;
        return __getset(0, __proto, "width", function() {
            return -1 === this._width ? RenderState.clientWidth : this._width;
        }), __getset(0, __proto, "height", function() {
            return -1 === this._height ? RenderState.clientHeight : this._height;
        }), __getset(1, Size, "fullScreen", function() {
            return new Size(-1, -1);
        }), Size;
    }()), Utils3D = function() {
        function Utils3D() {}
        return __class(Utils3D, "laya.d3.utils.Utils3D"), Utils3D._rotationTransformScaleSkinAnimation = function(tx, ty, tz, qx, qy, qz, qw, sx, sy, sz, outArray, outOffset) {
            var i, ai0, ai1, ai2, ai3, re = Utils3D._tempArray16_0, se = Utils3D._tempArray16_1, tse = Utils3D._tempArray16_2, x2 = qx + qx, y2 = qy + qy, z2 = qz + qz, xx = qx * x2, yx = qy * x2, yy = qy * y2, zx = qz * x2, zy = qz * y2, zz = qz * z2, wx = qw * x2, wy = qw * y2, wz = qw * z2;
            for (re[15] = 1, re[0] = 1 - yy - zz, re[1] = yx + wz, re[2] = zx - wy, re[4] = yx - wz, 
            re[5] = 1 - xx - zz, re[6] = zy + wx, re[8] = zx + wy, re[9] = zy - wx, re[10] = 1 - xx - yy, 
            se[15] = 1, se[0] = sx, se[5] = sy, se[10] = sz, i = 0; i < 4; i++) ai0 = re[i], 
            ai1 = re[i + 4], ai2 = re[i + 8], ai3 = re[i + 12], tse[i] = ai0, tse[i + 4] = ai1, 
            tse[i + 8] = ai2, tse[i + 12] = ai0 * tx + ai1 * ty + ai2 * tz + ai3;
            for (i = 0; i < 4; i++) ai0 = tse[i], ai1 = tse[i + 4], ai2 = tse[i + 8], ai3 = tse[i + 12], 
            outArray[i + outOffset] = ai0 * se[0] + ai1 * se[1] + ai2 * se[2] + ai3 * se[3], 
            outArray[i + outOffset + 4] = ai0 * se[4] + ai1 * se[5] + ai2 * se[6] + ai3 * se[7], 
            outArray[i + outOffset + 8] = ai0 * se[8] + ai1 * se[9] + ai2 * se[10] + ai3 * se[11], 
            outArray[i + outOffset + 12] = ai0 * se[12] + ai1 * se[13] + ai2 * se[14] + ai3 * se[15];
        }, Utils3D._createNodeByJson = function(rootNode, nodeData, node, innerResouMap) {
            if (!node) switch (nodeData.type) {
              case "Sprite3D":
                node = new Sprite3D();
                break;

              case "MeshSprite3D":
                node = new MeshSprite3D();
                break;

              case "SkinnedMeshSprite3D":
                node = new SkinnedMeshSprite3D();
                break;

              case "ShuriKenParticle3D":
              case "MyShuriKenParticle3D":
                node = new ShuriKenParticle3D();
                break;

              case "TrailSprite3D":
                node = new TrailSprite3D();
                break;

              case "Terrain":
                node = new Terrain();
                break;

              case "Camera":
                node = new Camera();
                break;

              case "DirectionLight":
                node = new DirectionLight();
                break;

              default:
                throw new Error("Utils3D:unidentified class type in (.lh) file.");
            }
            var props = nodeData.props;
            if (props) for (var key in props) node[key] = props[key];
            var customProps = nodeData.customProps;
            customProps && (node instanceof laya.d3.core.Sprite3D ? (node._parseBaseCustomProps(customProps), 
            node._parseCustomProps(rootNode, innerResouMap, customProps, nodeData), node._parseCustomComponent(rootNode, innerResouMap, nodeData.components)) : node._parseCustomProps(rootNode, innerResouMap, customProps, nodeData));
            var childData = nodeData.child;
            if (childData) for (var i = 0, n = childData.length; i < n; i++) {
                var child = Utils3D._createNodeByJson(rootNode, childData[i], null, innerResouMap);
                node.addChild(child);
            }
            return node;
        }, Utils3D._computeBoneAndAnimationDatasByBindPoseMatrxix = function(bones, curData, inverGlobalBindPose, outBonesDatas, outAnimationDatas, boneIndexToMesh) {
            var i, parentOffset, offset = 0, matOffset = 0, boneLength = bones.length;
            for (i = 0; i < boneLength; offset += bones[i].keyframeWidth, matOffset += 16, i++) laya.d3.utils.Utils3D._rotationTransformScaleSkinAnimation(curData[offset + 0], curData[offset + 1], curData[offset + 2], curData[offset + 3], curData[offset + 4], curData[offset + 5], curData[offset + 6], curData[offset + 7], curData[offset + 8], curData[offset + 9], outBonesDatas, matOffset), 
            0 != i && (parentOffset = 16 * bones[i].parentIndex, laya.d3.utils.Utils3D.mulMatrixByArray(outBonesDatas, parentOffset, outBonesDatas, matOffset, outBonesDatas, matOffset));
            var n = inverGlobalBindPose.length;
            for (i = 0; i < n; i++) laya.d3.utils.Utils3D.mulMatrixByArrayAndMatrixFast(outBonesDatas, 16 * boneIndexToMesh[i], inverGlobalBindPose[i], outAnimationDatas, 16 * i);
        }, Utils3D._computeAnimationDatasByArrayAndMatrixFast = function(inverGlobalBindPose, bonesDatas, outAnimationDatas, boneIndexToMesh) {
            for (var i = 0, n = inverGlobalBindPose.length; i < n; i++) laya.d3.utils.Utils3D.mulMatrixByArrayAndMatrixFast(bonesDatas, 16 * boneIndexToMesh[i], inverGlobalBindPose[i], outAnimationDatas, 16 * i);
        }, Utils3D._computeBoneAndAnimationDatasByBindPoseMatrxixOld = function(bones, curData, inverGlobalBindPose, outBonesDatas, outAnimationDatas) {
            var i, parentOffset, offset = 0, matOffset = 0, boneLength = bones.length;
            for (i = 0; i < boneLength; offset += bones[i].keyframeWidth, matOffset += 16, i++) laya.d3.utils.Utils3D._rotationTransformScaleSkinAnimation(curData[offset + 7], curData[offset + 8], curData[offset + 9], curData[offset + 3], curData[offset + 4], curData[offset + 5], curData[offset + 6], curData[offset + 0], curData[offset + 1], curData[offset + 2], outBonesDatas, matOffset), 
            0 != i && (parentOffset = 16 * bones[i].parentIndex, laya.d3.utils.Utils3D.mulMatrixByArray(outBonesDatas, parentOffset, outBonesDatas, matOffset, outBonesDatas, matOffset));
            var n = inverGlobalBindPose.length;
            for (i = 0; i < n; i++) {
                var arrayOffset = 16 * i;
                laya.d3.utils.Utils3D.mulMatrixByArrayAndMatrixFast(outBonesDatas, arrayOffset, inverGlobalBindPose[i], outAnimationDatas, arrayOffset);
            }
        }, Utils3D._computeAnimationDatasByArrayAndMatrixFastOld = function(inverGlobalBindPose, bonesDatas, outAnimationDatas) {
            for (var n = inverGlobalBindPose.length, i = 0; i < n; i++) {
                var arrayOffset = 16 * i;
                laya.d3.utils.Utils3D.mulMatrixByArrayAndMatrixFast(bonesDatas, arrayOffset, inverGlobalBindPose[i], outAnimationDatas, arrayOffset);
            }
        }, Utils3D._computeRootAnimationData = function(bones, curData, animationDatas) {
            for (var i = 0, offset = 0, matOffset = 0, boneLength = bones.length; i < boneLength; offset += bones[i].keyframeWidth, 
            matOffset += 16, i++) laya.d3.utils.Utils3D.createAffineTransformationArray(curData[offset + 0], curData[offset + 1], curData[offset + 2], curData[offset + 3], curData[offset + 4], curData[offset + 5], curData[offset + 6], curData[offset + 7], curData[offset + 8], curData[offset + 9], animationDatas, matOffset);
        }, Utils3D.transformVector3ArrayByQuat = function(sourceArray, sourceOffset, rotation, outArray, outOffset) {
            var re = rotation.elements, x = sourceArray[sourceOffset], y = sourceArray[sourceOffset + 1], z = sourceArray[sourceOffset + 2], qx = re[0], qy = re[1], qz = re[2], qw = re[3], ix = qw * x + qy * z - qz * y, iy = qw * y + qz * x - qx * z, iz = qw * z + qx * y - qy * x, iw = -qx * x - qy * y - qz * z;
            outArray[outOffset] = ix * qw + iw * -qx + iy * -qz - iz * -qy, outArray[outOffset + 1] = iy * qw + iw * -qy + iz * -qx - ix * -qz, 
            outArray[outOffset + 2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
        }, Utils3D.mulMatrixByArray = function(leftArray, leftOffset, rightArray, rightOffset, outArray, outOffset) {
            var i, ai0, ai1, ai2, ai3;
            if (outArray === rightArray) {
                for (rightArray = Utils3D._tempArray16_3, i = 0; i < 16; ++i) rightArray[i] = outArray[outOffset + i];
                rightOffset = 0;
            }
            for (i = 0; i < 4; i++) ai0 = leftArray[leftOffset + i], ai1 = leftArray[leftOffset + i + 4], 
            ai2 = leftArray[leftOffset + i + 8], ai3 = leftArray[leftOffset + i + 12], outArray[outOffset + i] = ai0 * rightArray[rightOffset + 0] + ai1 * rightArray[rightOffset + 1] + ai2 * rightArray[rightOffset + 2] + ai3 * rightArray[rightOffset + 3], 
            outArray[outOffset + i + 4] = ai0 * rightArray[rightOffset + 4] + ai1 * rightArray[rightOffset + 5] + ai2 * rightArray[rightOffset + 6] + ai3 * rightArray[rightOffset + 7], 
            outArray[outOffset + i + 8] = ai0 * rightArray[rightOffset + 8] + ai1 * rightArray[rightOffset + 9] + ai2 * rightArray[rightOffset + 10] + ai3 * rightArray[rightOffset + 11], 
            outArray[outOffset + i + 12] = ai0 * rightArray[rightOffset + 12] + ai1 * rightArray[rightOffset + 13] + ai2 * rightArray[rightOffset + 14] + ai3 * rightArray[rightOffset + 15];
        }, Utils3D.mulMatrixByArrayFast = function(leftArray, leftOffset, rightArray, rightOffset, outArray, outOffset) {
            var i, ai0, ai1, ai2, ai3;
            for (i = 0; i < 4; i++) ai0 = leftArray[leftOffset + i], ai1 = leftArray[leftOffset + i + 4], 
            ai2 = leftArray[leftOffset + i + 8], ai3 = leftArray[leftOffset + i + 12], outArray[outOffset + i] = ai0 * rightArray[rightOffset + 0] + ai1 * rightArray[rightOffset + 1] + ai2 * rightArray[rightOffset + 2] + ai3 * rightArray[rightOffset + 3], 
            outArray[outOffset + i + 4] = ai0 * rightArray[rightOffset + 4] + ai1 * rightArray[rightOffset + 5] + ai2 * rightArray[rightOffset + 6] + ai3 * rightArray[rightOffset + 7], 
            outArray[outOffset + i + 8] = ai0 * rightArray[rightOffset + 8] + ai1 * rightArray[rightOffset + 9] + ai2 * rightArray[rightOffset + 10] + ai3 * rightArray[rightOffset + 11], 
            outArray[outOffset + i + 12] = ai0 * rightArray[rightOffset + 12] + ai1 * rightArray[rightOffset + 13] + ai2 * rightArray[rightOffset + 14] + ai3 * rightArray[rightOffset + 15];
        }, Utils3D.mulMatrixByArrayAndMatrixFast = function(leftArray, leftOffset, rightMatrix, outArray, outOffset) {
            var i, ai0, ai1, ai2, ai3, rightMatrixE = rightMatrix.elements, m11 = rightMatrixE[0], m12 = rightMatrixE[1], m13 = rightMatrixE[2], m14 = rightMatrixE[3], m21 = rightMatrixE[4], m22 = rightMatrixE[5], m23 = rightMatrixE[6], m24 = rightMatrixE[7], m31 = rightMatrixE[8], m32 = rightMatrixE[9], m33 = rightMatrixE[10], m34 = rightMatrixE[11], m41 = rightMatrixE[12], m42 = rightMatrixE[13], m43 = rightMatrixE[14], m44 = rightMatrixE[15], ai0LeftOffset = leftOffset, ai1LeftOffset = leftOffset + 4, ai2LeftOffset = leftOffset + 8, ai3LeftOffset = leftOffset + 12, ai0OutOffset = outOffset, ai1OutOffset = outOffset + 4, ai2OutOffset = outOffset + 8, ai3OutOffset = outOffset + 12;
            for (i = 0; i < 4; i++) ai0 = leftArray[ai0LeftOffset + i], ai1 = leftArray[ai1LeftOffset + i], 
            ai2 = leftArray[ai2LeftOffset + i], ai3 = leftArray[ai3LeftOffset + i], outArray[ai0OutOffset + i] = ai0 * m11 + ai1 * m12 + ai2 * m13 + ai3 * m14, 
            outArray[ai1OutOffset + i] = ai0 * m21 + ai1 * m22 + ai2 * m23 + ai3 * m24, outArray[ai2OutOffset + i] = ai0 * m31 + ai1 * m32 + ai2 * m33 + ai3 * m34, 
            outArray[ai3OutOffset + i] = ai0 * m41 + ai1 * m42 + ai2 * m43 + ai3 * m44;
        }, Utils3D.createAffineTransformationArray = function(tX, tY, tZ, rX, rY, rZ, rW, sX, sY, sZ, outArray, outOffset) {
            var x2 = rX + rX, y2 = rY + rY, z2 = rZ + rZ, xx = rX * x2, xy = rX * y2, xz = rX * z2, yy = rY * y2, yz = rY * z2, zz = rZ * z2, wx = rW * x2, wy = rW * y2, wz = rW * z2;
            outArray[outOffset + 0] = (1 - (yy + zz)) * sX, outArray[outOffset + 1] = (xy + wz) * sX, 
            outArray[outOffset + 2] = (xz - wy) * sX, outArray[outOffset + 3] = 0, outArray[outOffset + 4] = (xy - wz) * sY, 
            outArray[outOffset + 5] = (1 - (xx + zz)) * sY, outArray[outOffset + 6] = (yz + wx) * sY, 
            outArray[outOffset + 7] = 0, outArray[outOffset + 8] = (xz + wy) * sZ, outArray[outOffset + 9] = (yz - wx) * sZ, 
            outArray[outOffset + 10] = (1 - (xx + yy)) * sZ, outArray[outOffset + 11] = 0, outArray[outOffset + 12] = tX, 
            outArray[outOffset + 13] = tY, outArray[outOffset + 14] = tZ, outArray[outOffset + 15] = 1;
        }, Utils3D.transformVector3ArrayToVector3ArrayCoordinate = function(source, sourceOffset, transform, result, resultOffset) {
            var vectorElem = Utils3D._tempArray4_0, coordinateX = source[sourceOffset + 0], coordinateY = source[sourceOffset + 1], coordinateZ = source[sourceOffset + 2], transformElem = transform.elements;
            vectorElem[0] = coordinateX * transformElem[0] + coordinateY * transformElem[4] + coordinateZ * transformElem[8] + transformElem[12], 
            vectorElem[1] = coordinateX * transformElem[1] + coordinateY * transformElem[5] + coordinateZ * transformElem[9] + transformElem[13], 
            vectorElem[2] = coordinateX * transformElem[2] + coordinateY * transformElem[6] + coordinateZ * transformElem[10] + transformElem[14], 
            vectorElem[3] = 1 / (coordinateX * transformElem[3] + coordinateY * transformElem[7] + coordinateZ * transformElem[11] + transformElem[15]), 
            result[resultOffset + 0] = vectorElem[0] * vectorElem[3], result[resultOffset + 1] = vectorElem[1] * vectorElem[3], 
            result[resultOffset + 2] = vectorElem[2] * vectorElem[3];
        }, Utils3D.transformLightingMapTexcoordByUV0Array = function(source, sourceOffset, lightingMapScaleOffset, result, resultOffset) {
            var lightingMapScaleOffsetE = lightingMapScaleOffset.elements;
            result[resultOffset + 0] = source[sourceOffset + 0] * lightingMapScaleOffsetE[0] + lightingMapScaleOffsetE[2], 
            result[resultOffset + 1] = (source[sourceOffset + 1] - 1) * lightingMapScaleOffsetE[1] + lightingMapScaleOffsetE[3];
        }, Utils3D.transformLightingMapTexcoordByUV1Array = function(source, sourceOffset, lightingMapScaleOffset, result, resultOffset) {
            var lightingMapScaleOffsetE = lightingMapScaleOffset.elements;
            result[resultOffset + 0] = source[sourceOffset + 0] * lightingMapScaleOffsetE[0] + lightingMapScaleOffsetE[2], 
            result[resultOffset + 1] = 1 + source[sourceOffset + 1] * lightingMapScaleOffsetE[1] + lightingMapScaleOffsetE[3];
        }, Utils3D.getURLVerion = function(url) {
            var index = url.indexOf("?");
            return 0 <= index ? url.substr(index) : null;
        }, Utils3D._quaternionCreateFromYawPitchRollArray = function(yaw, pitch, roll, out) {
            var halfRoll = .5 * roll, halfPitch = .5 * pitch, halfYaw = .5 * yaw, sinRoll = Math.sin(halfRoll), cosRoll = Math.cos(halfRoll), sinPitch = Math.sin(halfPitch), cosPitch = Math.cos(halfPitch), sinYaw = Math.sin(halfYaw), cosYaw = Math.cos(halfYaw);
            out[0] = cosYaw * sinPitch * cosRoll + sinYaw * cosPitch * sinRoll, out[1] = sinYaw * cosPitch * cosRoll - cosYaw * sinPitch * sinRoll, 
            out[2] = cosYaw * cosPitch * sinRoll - sinYaw * sinPitch * cosRoll, out[3] = cosYaw * cosPitch * cosRoll + sinYaw * sinPitch * sinRoll;
        }, Utils3D._createAffineTransformationArray = function(trans, rot, scale, outE) {
            var x = rot[0], y = rot[1], z = rot[2], w = rot[3], x2 = x + x, y2 = y + y, z2 = z + z, xx = x * x2, xy = x * y2, xz = x * z2, yy = y * y2, yz = y * z2, zz = z * z2, wx = w * x2, wy = w * y2, wz = w * z2, sx = scale[0], sy = scale[1], sz = scale[2];
            outE[0] = (1 - (yy + zz)) * sx, outE[1] = (xy + wz) * sx, outE[2] = (xz - wy) * sx, 
            outE[3] = 0, outE[4] = (xy - wz) * sy, outE[5] = (1 - (xx + zz)) * sy, outE[6] = (yz + wx) * sy, 
            outE[7] = 0, outE[8] = (xz + wy) * sz, outE[9] = (yz - wx) * sz, outE[10] = (1 - (xx + yy)) * sz, 
            outE[11] = 0, outE[12] = trans[0], outE[13] = trans[1], outE[14] = trans[2], outE[15] = 1;
        }, Utils3D._mulMatrixArray = function(leftMatrixE, rightMatrix, outArray, outOffset) {
            var i, ai0, ai1, ai2, ai3, rightMatrixE = rightMatrix.elements, m11 = rightMatrixE[0], m12 = rightMatrixE[1], m13 = rightMatrixE[2], m14 = rightMatrixE[3], m21 = rightMatrixE[4], m22 = rightMatrixE[5], m23 = rightMatrixE[6], m24 = rightMatrixE[7], m31 = rightMatrixE[8], m32 = rightMatrixE[9], m33 = rightMatrixE[10], m34 = rightMatrixE[11], m41 = rightMatrixE[12], m42 = rightMatrixE[13], m43 = rightMatrixE[14], m44 = rightMatrixE[15], ai0OutOffset = outOffset, ai1OutOffset = outOffset + 4, ai2OutOffset = outOffset + 8, ai3OutOffset = outOffset + 12;
            for (i = 0; i < 4; i++) ai0 = leftMatrixE[i], ai1 = leftMatrixE[i + 4], ai2 = leftMatrixE[i + 8], 
            ai3 = leftMatrixE[i + 12], outArray[ai0OutOffset + i] = ai0 * m11 + ai1 * m12 + ai2 * m13 + ai3 * m14, 
            outArray[ai1OutOffset + i] = ai0 * m21 + ai1 * m22 + ai2 * m23 + ai3 * m24, outArray[ai2OutOffset + i] = ai0 * m31 + ai1 * m32 + ai2 * m33 + ai3 * m34, 
            outArray[ai3OutOffset + i] = ai0 * m41 + ai1 * m42 + ai2 * m43 + ai3 * m44;
        }, Utils3D.getYawPitchRoll = function(quaternion, out) {
            Utils3D.transformQuat(Vector3.ForwardRH, quaternion, Quaternion.TEMPVector31), Utils3D.transformQuat(Vector3.Up, quaternion, Quaternion.TEMPVector32);
            var upe = Quaternion.TEMPVector32.elements;
            Utils3D.angleTo(Vector3.ZERO, Quaternion.TEMPVector31, Quaternion.TEMPVector33);
            var anglee = Quaternion.TEMPVector33.elements;
            anglee[0] == Math.PI / 2 ? (anglee[1] = Utils3D.arcTanAngle(upe[2], upe[0]), anglee[2] = 0) : anglee[0] == -Math.PI / 2 ? (anglee[1] = Utils3D.arcTanAngle(-upe[2], -upe[0]), 
            anglee[2] = 0) : (Matrix4x4.createRotationY(-anglee[1], Quaternion.TEMPMatrix0), 
            Matrix4x4.createRotationX(-anglee[0], Quaternion.TEMPMatrix1), Vector3.transformCoordinate(Quaternion.TEMPVector32, Quaternion.TEMPMatrix0, Quaternion.TEMPVector32), 
            Vector3.transformCoordinate(Quaternion.TEMPVector32, Quaternion.TEMPMatrix1, Quaternion.TEMPVector32), 
            anglee[2] = Utils3D.arcTanAngle(upe[1], -upe[0])), anglee[1] <= -Math.PI && (anglee[1] = Math.PI), 
            anglee[2] <= -Math.PI && (anglee[2] = Math.PI), anglee[1] >= Math.PI && anglee[2] >= Math.PI && (anglee[1] = 0, 
            anglee[2] = 0, anglee[0] = Math.PI - anglee[0]), out[0] = anglee[1], out[1] = anglee[0], 
            out[2] = anglee[2];
        }, Utils3D.arcTanAngle = function(x, y) {
            return 0 == x ? 1 == y ? Math.PI / 2 : -Math.PI / 2 : 0 < x ? Math.atan(y / x) : x < 0 ? 0 < y ? Math.atan(y / x) + Math.PI : Math.atan(y / x) - Math.PI : 0;
        }, Utils3D.angleTo = function(from, location, angle) {
            Vector3.subtract(location, from, Quaternion.TEMPVector30), Vector3.normalize(Quaternion.TEMPVector30, Quaternion.TEMPVector30), 
            angle.elements[0] = Math.asin(Quaternion.TEMPVector30.y), angle.elements[1] = Utils3D.arcTanAngle(-Quaternion.TEMPVector30.z, -Quaternion.TEMPVector30.x);
        }, Utils3D.transformQuat = function(source, rotation, out) {
            var destination = out.elements, se = source.elements, re = rotation, x = se[0], y = se[1], z = se[2], qx = re[0], qy = re[1], qz = re[2], qw = re[3], ix = qw * x + qy * z - qz * y, iy = qw * y + qz * x - qx * z, iz = qw * z + qx * y - qy * x, iw = -qx * x - qy * y - qz * z;
            destination[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy, destination[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz, 
            destination[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
        }, Utils3D.quaterionNormalize = function(f, e) {
            var x = f[0], y = f[1], z = f[2], w = f[3], len = x * x + y * y + z * z + w * w;
            0 < len && (len = 1 / Math.sqrt(len), e[0] = x * len, e[1] = y * len, e[2] = z * len, 
            e[3] = w * len);
        }, Utils3D.matrix4x4MultiplyFFF = function(a, b, e) {
            var i, ai0, ai1, ai2, ai3;
            if (e === b) for (b = new Float32Array(16), i = 0; i < 16; ++i) b[i] = e[i];
            for (i = 0; i < 4; i++) ai0 = a[i], ai1 = a[i + 4], ai2 = a[i + 8], ai3 = a[i + 12], 
            e[i] = ai0 * b[0] + ai1 * b[1] + ai2 * b[2] + ai3 * b[3], e[i + 4] = ai0 * b[4] + ai1 * b[5] + ai2 * b[6] + ai3 * b[7], 
            e[i + 8] = ai0 * b[8] + ai1 * b[9] + ai2 * b[10] + ai3 * b[11], e[i + 12] = ai0 * b[12] + ai1 * b[13] + ai2 * b[14] + ai3 * b[15];
        }, Utils3D.matrix4x4MultiplyMFM = function(left, right, out) {
            Utils3D.matrix4x4MultiplyFFF(left.elements, right, out.elements);
        }, __static(Utils3D, [ "_typeToFunO", function() {
            return this._typeToFunO = {
                INT16: "writeInt16",
                SHORT: "writeInt16",
                UINT16: "writeUint16",
                UINT32: "writeUint32",
                FLOAT32: "writeFloat32",
                INT: "writeInt32",
                UINT: "writeUint32",
                BYTE: "writeByte",
                STRING: "writeUTFString"
            };
        }, "_tempVector3_0", function() {
            return this._tempVector3_0 = new Vector3();
        }, "_tempVector3_1", function() {
            return this._tempVector3_1 = new Vector3();
        }, "_tempVector3_2", function() {
            return this._tempVector3_2 = new Vector3();
        }, "_tempVector3_3", function() {
            return this._tempVector3_3 = new Vector3();
        }, "_tempVector3_4", function() {
            return this._tempVector3_4 = new Vector3();
        }, "_tempVector3_5", function() {
            return this._tempVector3_5 = new Vector3();
        }, "_tempVector3_6", function() {
            return this._tempVector3_6 = new Vector3();
        }, "_tempArray4_0", function() {
            return this._tempArray4_0 = new Float32Array(4);
        }, "_tempArray16_0", function() {
            return this._tempArray16_0 = new Float32Array(16);
        }, "_tempArray16_1", function() {
            return this._tempArray16_1 = new Float32Array(16);
        }, "_tempArray16_2", function() {
            return this._tempArray16_2 = new Float32Array(16);
        }, "_tempArray16_3", function() {
            return this._tempArray16_3 = new Float32Array(16);
        } ]), Utils3D;
    }(), Laya3D = function() {
        function Laya3D() {}
        return __class(Laya3D, "Laya3D"), Laya3D._cancelLoadByUrl = function(url) {
            Laya.loader.cancelLoadByUrl(url), Laya3D._innerFirstLevelLoaderManager.cancelLoadByUrl(url), 
            Laya3D._innerSecondLevelLoaderManager.cancelLoadByUrl(url), Laya3D._innerThirdLevelLoaderManager.cancelLoadByUrl(url), 
            Laya3D._innerFourthLevelLoaderManager.cancelLoadByUrl(url);
        }, Laya3D._changeWebGLSize = function(width, height) {
            WebGL.onStageResize(width, height), RenderState.clientWidth = width, RenderState.clientHeight = height;
        }, Laya3D.__init__ = function() {
            var createMap = LoaderManager.createMap;
            createMap.lh = [ Sprite3D, "SPRITE3DHIERARCHY" ], createMap.ls = [ Scene, "SPRITE3DHIERARCHY" ], 
            createMap.lm = [ Mesh, "MESH" ], createMap.lmat = [ StandardMaterial, "MATERIAL" ], 
            createMap.jpg = [ Texture2D, "nativeimage" ], createMap.jpeg = [ Texture2D, "nativeimage" ], 
            createMap.png = [ Texture2D, "nativeimage" ], createMap.pkm = [ Texture2D, "arraybuffer" ], 
            createMap.raw = [ DataTexture2D, "arraybuffer" ], createMap.mipmaps = [ DataTexture2D, "arraybuffer" ], 
            Loader.parserMap.SPRITE3DHIERARCHY = Laya3D._loadHierarchy, Loader.parserMap.MESH = Laya3D._loadMesh, 
            Loader.parserMap.MATERIAL = Laya3D._loadMaterial, Loader.parserMap.TEXTURECUBE = Laya3D._loadTextureCube, 
            Loader.parserMap.TERRAIN = Laya3D._loadTerrain, Laya3D._innerFirstLevelLoaderManager.on("error", null, Laya3D._eventLoadManagerError), 
            Laya3D._innerSecondLevelLoaderManager.on("error", null, Laya3D._eventLoadManagerError), 
            Laya3D._innerThirdLevelLoaderManager.on("error", null, Laya3D._eventLoadManagerError), 
            Laya3D._innerFourthLevelLoaderManager.on("error", null, Laya3D._eventLoadManagerError);
        }, Laya3D.READ_BLOCK = function() {
            return Laya3D._readData.pos += 4, !0;
        }, Laya3D.READ_DATA = function() {
            return Laya3D._DATA.offset = Laya3D._readData.getUint32(), Laya3D._DATA.size = Laya3D._readData.getUint32(), 
            !0;
        }, Laya3D.READ_STRINGS = function() {
            var materialUrls = [], _STRINGS = {
                offset: 0,
                size: 0
            };
            _STRINGS.offset = Laya3D._readData.getUint16(), _STRINGS.size = Laya3D._readData.getUint16();
            Laya3D._readData.pos;
            Laya3D._readData.pos = _STRINGS.offset + Laya3D._DATA.offset;
            for (var i = 0; i < _STRINGS.size; i++) {
                var string = Laya3D._readData.readUTFString();
                -1 === string.lastIndexOf(".lmat") && -1 === string.lastIndexOf(".lpbr") || materialUrls.push(string);
            }
            return materialUrls;
        }, Laya3D.formatRelativePath = function(base, value) {
            var path;
            if ("." === value.charAt(0)) {
                for (var parts = (base + value).split("/"), i = 0, len = parts.length; i < len; i++) if (".." == parts[i]) {
                    var index = i - 1;
                    0 < index && ".." !== parts[index] && (parts.splice(index, 2), i -= 2);
                }
                path = parts.join("/");
            } else path = base + value;
            return null != URL.customFormat && (path = URL.customFormat(path, null)), path;
        }, Laya3D._eventLoadManagerError = function(msg) {
            Laya.loader.event("error", msg);
        }, Laya3D._addHierarchyInnerUrls = function(urls, urlMap, urlVersion, hierarchyBasePath, path, clas) {
            var formatSubUrl = Laya3D.formatRelativePath(hierarchyBasePath, path);
            urlVersion && (formatSubUrl += urlVersion), urls.push({
                url: formatSubUrl,
                clas: clas
            }), urlMap[path] = formatSubUrl;
        }, Laya3D._getSprite3DHierarchyInnerUrls = function(node, firstLevelUrls, secondLevelUrls, fourthLelUrls, urlMap, urlVersion, hierarchyBasePath) {
            var customProps, i = 0, n = 0;
            switch (node.type) {
              case "Scene":
                var lightmaps = node.customProps.lightmaps;
                for (i = 0, n = lightmaps.length; i < n; i++) {
                    var lightMap = lightmaps[i].replace(".exr", ".png");
                    Laya3D._addHierarchyInnerUrls(fourthLelUrls, urlMap, urlVersion, hierarchyBasePath, lightMap, Texture2D);
                }
                break;

              case "MeshSprite3D":
              case "TrailSprite3D":
              case "LineSprite3D":
              case "SkinnedMeshSprite3D":
                var meshPath;
                if (node.instanceParams) (meshPath = node.instanceParams.loadPath) && Laya3D._addHierarchyInnerUrls(firstLevelUrls, urlMap, urlVersion, hierarchyBasePath, meshPath, Mesh); else {
                    (meshPath = (customProps = node.customProps).meshPath) && Laya3D._addHierarchyInnerUrls(firstLevelUrls, urlMap, urlVersion, hierarchyBasePath, meshPath, Mesh);
                    var materials = customProps.materials;
                    if (materials) for (i = 0, n = materials.length; i < n; i++) {
                        for (var mat = materials[i], clasPaths = mat.type.split("."), clas = Browser.window, j = 0, length = clasPaths.length; j < length; ++j) {
                            clas = clas[clasPaths[j]];
                        }
                        if ("function" != typeof clas) throw "_getSprite3DHierarchyInnerUrls 错误: " + mat.type + " 不是类";
                        Laya3D._addHierarchyInnerUrls(secondLevelUrls, urlMap, urlVersion, hierarchyBasePath, mat.path, clas);
                    }
                }
                break;

              case "ShuriKenParticle3D":
              case "MyShuriKenParticle3D":
                var parMeshPath = (customProps = node.customProps).meshPath;
                parMeshPath && Laya3D._addHierarchyInnerUrls(firstLevelUrls, urlMap, urlVersion, hierarchyBasePath, parMeshPath, Mesh);
                var materialData = customProps.material;
                if (materialData) {
                    clasPaths = materialData.type.split("."), clas = Browser.window;
                    for (j = 0, length = clasPaths.length; j < length; ++j) {
                        clas = clas[clasPaths[j]];
                    }
                    Laya3D._addHierarchyInnerUrls(secondLevelUrls, urlMap, urlVersion, hierarchyBasePath, materialData.path, clas);
                } else {
                    var materialPath = customProps.materialPath;
                    if (materialPath) Laya3D._addHierarchyInnerUrls(secondLevelUrls, urlMap, urlVersion, hierarchyBasePath, materialPath, ShurikenParticleMaterial); else {
                        var texturePath = customProps.texturePath;
                        texturePath && Laya3D._addHierarchyInnerUrls(fourthLelUrls, urlMap, urlVersion, hierarchyBasePath, texturePath, Texture2D);
                    }
                }
                break;

              case "Terrain":
                Laya3D._addHierarchyInnerUrls(fourthLelUrls, urlMap, urlVersion, hierarchyBasePath, node.customProps.dataPath, TerrainRes);
            }
            var components = node.components;
            for (var k in components) {
                var component = components[k];
                switch (k) {
                  case "Animator":
                    var avatarPath = component.avatarPath;
                    if (avatarPath) Laya3D._addHierarchyInnerUrls(fourthLelUrls, urlMap, urlVersion, hierarchyBasePath, avatarPath, Avatar); else {
                        var avatarData = component.avatar;
                        avatarData && Laya3D._addHierarchyInnerUrls(fourthLelUrls, urlMap, urlVersion, hierarchyBasePath, avatarData.path, Avatar);
                    }
                    var clipPaths = component.clipPaths;
                    for (i = 0, n = clipPaths.length; i < n; i++) Laya3D._addHierarchyInnerUrls(fourthLelUrls, urlMap, urlVersion, hierarchyBasePath, clipPaths[i], AnimationClip);
                }
            }
            var children = node.child;
            for (i = 0, n = children.length; i < n; i++) Laya3D._getSprite3DHierarchyInnerUrls(children[i], firstLevelUrls, secondLevelUrls, fourthLelUrls, urlMap, urlVersion, hierarchyBasePath);
        }, Laya3D._loadHierarchy = function(loader) {
            loader.on("loaded", null, Laya3D._onHierarchylhLoaded, [ loader, loader._class._getGroup() ]), 
            loader.load(loader.url, "json", !1, null, !0);
        }, Laya3D._onHierarchylhLoaded = function(loader, group, lhData) {
            if (loader._class.destroyed) loader.endLoad(); else {
                var url = loader.url, urlVersion = Utils3D.getURLVerion(url), hierarchyBasePath = URL.getPath(url), firstLevUrls = [], secondLevUrls = [], forthLevUrls = [], urlMap = {};
                Laya3D._getSprite3DHierarchyInnerUrls(lhData, firstLevUrls, secondLevUrls, forthLevUrls, urlMap, urlVersion, hierarchyBasePath);
                var urlCount = firstLevUrls.length + secondLevUrls.length + forthLevUrls.length, totalProcessCount = urlCount + 1, weight = 1 / totalProcessCount;
                if (Laya3D._onProcessChange(loader, 0, weight, 1), 0 < forthLevUrls.length) {
                    var processCeil = urlCount / totalProcessCount, processHandler = Handler.create(null, Laya3D._onProcessChange, [ loader, weight, processCeil ], !1);
                    Laya3D._innerFourthLevelLoaderManager.create(forthLevUrls, Handler.create(null, Laya3D._onHierarchyInnerForthLevResouLoaded, [ loader, group, processHandler, lhData, urlMap, firstLevUrls, secondLevUrls, weight + processCeil * forthLevUrls.length, processCeil ]), processHandler, null, null, 1, !0, group);
                } else Laya3D._onHierarchyInnerForthLevResouLoaded(loader, group, null, lhData, urlMap, firstLevUrls, secondLevUrls, weight, processCeil);
            }
        }, Laya3D._onHierarchyInnerForthLevResouLoaded = function(loader, group, processHandler, lhData, urlMap, firstLevUrls, secondLevUrls, processOffset, processCeil) {
            if (loader._class.destroyed) loader.endLoad(); else if (processHandler && processHandler.recover(), 
            0 < secondLevUrls.length) {
                var process = Handler.create(null, Laya3D._onProcessChange, [ loader, processOffset, processCeil ], !1);
                Laya3D._innerSecondLevelLoaderManager.create(secondLevUrls, Handler.create(null, Laya3D._onHierarchyInnerSecondLevResouLoaded, [ loader, group, process, lhData, urlMap, firstLevUrls, processOffset + processCeil * secondLevUrls.length, processCeil ]), processHandler, null, null, 1, !0, group);
            } else Laya3D._onHierarchyInnerSecondLevResouLoaded(loader, group, null, lhData, urlMap, firstLevUrls, processOffset, processCeil);
        }, Laya3D._onHierarchyInnerSecondLevResouLoaded = function(loader, group, processHandler, lhData, urlMap, firstLevUrls, processOffset, processCeil) {
            if (loader._class.destroyed) loader.endLoad(); else if (processHandler && processHandler.recover(), 
            0 < firstLevUrls.length) {
                var process = Handler.create(null, Laya3D._onProcessChange, [ loader, processOffset, processCeil ], !1);
                Laya3D._innerFirstLevelLoaderManager.create(firstLevUrls, Handler.create(null, Laya3D._onHierarchyInnerFirstLevResouLoaded, [ loader, process, lhData, urlMap ]), processHandler, null, null, 1, !0, group);
            } else Laya3D._onHierarchyInnerFirstLevResouLoaded(loader, null, lhData, urlMap);
        }, Laya3D._onHierarchyInnerFirstLevResouLoaded = function(loader, processHandler, lhData, urlMap) {
            processHandler && processHandler.recover(), loader.endLoad([ lhData, urlMap ]);
        }, Laya3D._loadTerrain = function(loader) {
            loader.on("loaded", null, Laya3D._onTerrainLtLoaded, [ loader, loader._class._getGroup() ]), 
            loader.load(loader.url, "json", !1, null, !0);
        }, Laya3D._onTerrainLtLoaded = function(loader, group, ltData) {
            if (loader._class.destroyed) loader.endLoad(); else {
                var heightMapURL, formatUrl, url = loader.url, urlVersion = Utils3D.getURLVerion(url), terrainBasePath = URL.getPath(url), textureURLs = [], urlMap = {}, i = 0, n = 0, heightData = ltData.heightData;
                heightMapURL = heightData.url, formatUrl = Laya3D.formatRelativePath(terrainBasePath, heightMapURL), 
                urlVersion && (formatUrl += urlVersion), heightMapURL = urlMap[heightMapURL] = formatUrl;
                var detailTextures = ltData.detailTexture;
                for (i = 0, n = detailTextures.length; i < n; i++) textureURLs.push({
                    url: detailTextures[i].diffuse
                });
                var normalMaps = ltData.normalMap;
                for (i = 0, n = normalMaps.length; i < n; i++) textureURLs.push({
                    url: normalMaps[i]
                });
                var alphaMaps = ltData.alphaMap;
                for (i = 0, n = alphaMaps.length; i < n; i++) textureURLs.push({
                    url: alphaMaps[i],
                    params: [ !1, !1, 6408, !0 ]
                });
                for (i = 0, n = textureURLs.length; i < n; i++) {
                    var subUrl = textureURLs[i].url;
                    formatUrl = Laya3D.formatRelativePath(terrainBasePath, subUrl), urlVersion && (formatUrl += urlVersion), 
                    textureURLs[i].url = formatUrl, urlMap[subUrl] = formatUrl;
                }
                var texsUrlCount = textureURLs.length, totalProcessCount = texsUrlCount + 2, weight = 1 / totalProcessCount;
                Laya3D._onProcessChange(loader, 0, weight, 1);
                var loadInfo = {
                    heightMapLoaded: !1,
                    texturesLoaded: !1
                }, hmProcessHandler = Handler.create(null, Laya3D._onProcessChange, [ loader, weight, weight ], !1);
                Laya3D._innerFourthLevelLoaderManager.create(heightMapURL, Handler.create(null, Laya3D._onTerrainHeightMapLoaded, [ loader, hmProcessHandler, ltData, urlMap, loadInfo ]), hmProcessHandler, null, [ heightData.numX, heightData.numZ, heightData.bitType, heightData.value ], 1, !0, group);
                var texsProcessHandler = Handler.create(null, Laya3D._onProcessChange, [ loader, 2 * weight, texsUrlCount / totalProcessCount ], !1);
                Laya3D._innerFourthLevelLoaderManager.create(textureURLs, Handler.create(null, Laya3D._onTerrainTexturesLoaded, [ loader, texsProcessHandler, ltData, urlMap, loadInfo ]), texsProcessHandler, null, null, 1, !0, group);
            }
        }, Laya3D._onTerrainHeightMapLoaded = function(loader, processHandler, ltData, urlMap, loadInfo) {
            loadInfo.heightMapLoaded = !0, loadInfo.texturesLoaded && (loader.endLoad([ ltData, urlMap ]), 
            processHandler.recover());
        }, Laya3D._onTerrainTexturesLoaded = function(loader, processHandler, ltData, urlMap, loadInfo) {
            loadInfo.texturesLoaded = !0, loadInfo.heightMapLoaded && (loader.endLoad([ ltData, urlMap ]), 
            processHandler.recover());
        }, Laya3D._loadMesh = function(loader) {
            loader.on("loaded", null, Laya3D._onMeshLmLoaded, [ loader, loader._class._getGroup() ]), 
            loader.load(loader.url, "arraybuffer", !1, null, !0);
        }, Laya3D._onMeshLmLoaded = function(loader, group, lmData) {
            if (loader._class.destroyed) loader.endLoad(); else {
                var urls, formatSubUrl, n, url = loader.url, urlVersion = Utils3D.getURLVerion(url), meshBasePath = URL.getPath(url), urlMap = {}, i = 0, count = 0;
                switch ((Laya3D._readData = new Byte(lmData)).pos = 0, Laya3D._readData.readUTFString()) {
                  case "LAYAMODEL:02":
                  case "LAYAMODEL:03":
                  case "LAYAMODEL:0301":
                    var dataOffset = Laya3D._readData.getUint32();
                    Laya3D._readData.pos = Laya3D._readData.pos + 4, count = Laya3D._readData.getUint16(), 
                    Laya3D._readData.pos = Laya3D._readData.pos + 8 * count;
                    var offset = Laya3D._readData.getUint32();
                    for (count = Laya3D._readData.getUint16(), Laya3D._readData.pos = dataOffset + offset, 
                    urls = [], i = 0; i < count; i++) {
                        var string = Laya3D._readData.readUTFString();
                        -1 !== string.lastIndexOf(".lmat") && urls.push(string);
                    }
                    break;

                  default:
                    for (Laya3D.READ_BLOCK(), i = 0; i < 2; i++) {
                        var index = Laya3D._readData.getUint16(), blockName = Laya3D._strings[index], fn = Laya3D["READ_" + blockName];
                        if (null == fn) throw new Error("model file err,no this function:" + index + " " + blockName);
                        1 === i ? urls = fn.call() : fn.call();
                    }
                }
                for (i = 0, n = urls.length; i < n; i++) {
                    var subUrl = urls[i];
                    formatSubUrl = Laya3D.formatRelativePath(meshBasePath, subUrl), urlVersion && (formatSubUrl += urlVersion), 
                    urls[i] = formatSubUrl, urlMap[subUrl] = formatSubUrl;
                }
                if (0 < urls.length) {
                    Laya3D._onProcessChange(loader, 0, .5, 1);
                    var processHandler = Handler.create(null, Laya3D._onProcessChange, [ loader, .5, .5 ], !1);
                    Laya3D._innerSecondLevelLoaderManager.create(urls, Handler.create(null, Laya3D._onMeshMateialLoaded, [ loader, processHandler, lmData, urlMap ]), processHandler, null, null, 1, !0, group);
                } else loader.endLoad([ lmData, urlMap ]);
            }
        }, Laya3D._onMeshMateialLoaded = function(loader, processHandler, lmData, urlMap) {
            loader.endLoad([ lmData, urlMap ]), processHandler.recover();
        }, Laya3D._getMaterialTexturePath = function(path, urlVersion, materialBath) {
            var extenIndex = path.length - 4;
            return path.indexOf(".dds") != extenIndex && path.indexOf(".tga") != extenIndex && path.indexOf(".exr") != extenIndex && path.indexOf(".DDS") != extenIndex && path.indexOf(".TGA") != extenIndex && path.indexOf(".EXR") != extenIndex || (path = path.substr(0, extenIndex) + ".png"), 
            path = Laya3D.formatRelativePath(materialBath, path), urlVersion && (path += urlVersion), 
            path;
        }, Laya3D._loadMaterial = function(loader) {
            loader.on("loaded", null, Laya3D._onMaterilLmatLoaded, [ loader, loader._class._getGroup() ]), 
            loader.load(loader.url, "json", !1, null, !0);
        }, Laya3D._onMaterilLmatLoaded = function(loader, group, lmatData) {
            if (loader._class.destroyed) loader.endLoad(); else {
                var formatSubUrl, url = loader.url, urlVersion = Utils3D.getURLVerion(url), materialBasePath = URL.getPath(url), urls = [], urlMap = {}, customProps = lmatData.customProps, version = lmatData.version;
                if (version) switch (version) {
                  case "LAYAMATERIAL:01":
                  case "LAYAMATERIAL:02":
                    for (var textures = lmatData.props.textures, i = 0, n = textures.length; i < n; i++) {
                        var tex = textures[i], path = tex.path;
                        if (path) {
                            var extenIndex = path.length - 4;
                            path.indexOf(".exr") != extenIndex && path.indexOf(".EXR") != extenIndex || (path = path.substr(0, extenIndex) + ".png"), 
                            formatSubUrl = Laya3D.formatRelativePath(materialBasePath, path), urlVersion && (formatSubUrl += urlVersion), 
                            urls.push({
                                url: formatSubUrl,
                                params: tex.params
                            }), urlMap[path] = formatSubUrl;
                        }
                    }
                    break;

                  default:
                    throw new Error("Laya3D:unkonwn version.");
                } else {
                    var diffuseTexture = customProps.diffuseTexture.texture2D;
                    if (diffuseTexture && (formatSubUrl = Laya3D._getMaterialTexturePath(diffuseTexture, urlVersion, materialBasePath), 
                    urls.push(formatSubUrl), urlMap[diffuseTexture] = formatSubUrl), customProps.normalTexture) {
                        var normalTexture = customProps.normalTexture.texture2D;
                        normalTexture && (formatSubUrl = Laya3D._getMaterialTexturePath(normalTexture, urlVersion, materialBasePath), 
                        urls.push(formatSubUrl), urlMap[normalTexture] = formatSubUrl);
                    }
                    if (customProps.specularTexture) {
                        var specularTexture = customProps.specularTexture.texture2D;
                        specularTexture && (formatSubUrl = Laya3D._getMaterialTexturePath(specularTexture, urlVersion, materialBasePath), 
                        urls.push(formatSubUrl), urlMap[specularTexture] = formatSubUrl);
                    }
                    if (customProps.emissiveTexture) {
                        var emissiveTexture = customProps.emissiveTexture.texture2D;
                        emissiveTexture && (formatSubUrl = Laya3D._getMaterialTexturePath(emissiveTexture, urlVersion, materialBasePath), 
                        urls.push(formatSubUrl), urlMap[emissiveTexture] = formatSubUrl);
                    }
                    if (customProps.ambientTexture) {
                        var ambientTexture = customProps.ambientTexture.texture2D;
                        ambientTexture && (formatSubUrl = Laya3D._getMaterialTexturePath(ambientTexture, urlVersion, materialBasePath), 
                        urls.push(formatSubUrl), urlMap[ambientTexture] = formatSubUrl);
                    }
                    if (customProps.reflectTexture) {
                        var reflectTexture = customProps.reflectTexture.texture2D;
                        reflectTexture && (formatSubUrl = Laya3D._getMaterialTexturePath(reflectTexture, urlVersion, materialBasePath), 
                        urls.push(formatSubUrl), urlMap[reflectTexture] = formatSubUrl);
                    }
                }
                var urlCount = urls.length, totalProcessCount = urlCount + 1, lmatWeight = 1 / totalProcessCount;
                if (Laya3D._onProcessChange(loader, 0, lmatWeight, 1), 0 < urlCount) {
                    var processHandler = Handler.create(null, Laya3D._onProcessChange, [ loader, lmatWeight, urlCount / totalProcessCount ], !1);
                    Laya3D._innerFourthLevelLoaderManager.create(urls, Handler.create(null, Laya3D._onMateialTexturesLoaded, [ loader, processHandler, lmatData, urlMap ]), processHandler, Texture2D, null, 1, !0, group);
                } else Laya3D._onMateialTexturesLoaded(loader, null, lmatData, null);
            }
        }, Laya3D._onMateialTexturesLoaded = function(loader, processHandler, lmatData, urlMap) {
            loader.endLoad([ lmatData, urlMap ]), processHandler && processHandler.recover();
        }, Laya3D._loadTextureCube = function(loader) {
            loader.on("loaded", null, Laya3D._onTextureCubeLtcLoaded, [ loader ]), loader.load(loader.url, "json", !1, null, !0);
        }, Laya3D._onTextureCubeLtcLoaded = function(loader, ltcData) {
            if (loader._class.destroyed) loader.endLoad(); else {
                var ltcBasePath = URL.getPath(loader.url), urls = [ Laya3D.formatRelativePath(ltcBasePath, ltcData.px), Laya3D.formatRelativePath(ltcBasePath, ltcData.nx), Laya3D.formatRelativePath(ltcBasePath, ltcData.py), Laya3D.formatRelativePath(ltcBasePath, ltcData.ny), Laya3D.formatRelativePath(ltcBasePath, ltcData.pz), Laya3D.formatRelativePath(ltcBasePath, ltcData.nz) ];
                Laya3D._onProcessChange(loader, 0, 1 / 7, 1);
                var processHandler = Handler.create(null, Laya3D._onProcessChange, [ loader, 1 / 7, 6 / 7 ], !1);
                Laya3D._innerFourthLevelLoaderManager.load(urls, Handler.create(null, Laya3D._onTextureCubeImagesLoaded, [ loader, urls, processHandler ]), processHandler, "nativeimage");
            }
        }, Laya3D._onTextureCubeImagesLoaded = function(loader, urls, processHandler) {
            var images = [];
            images.length = 6;
            for (var i = 0; i < 6; i++) {
                var url = urls[i];
                images[i] = Loader.getRes(url), Loader.clearRes(url);
            }
            loader.endLoad(images), processHandler.recover();
        }, Laya3D._onProcessChange = function(loader, offset, weight, process) {
            (process = offset + process * weight) < 1 && loader.event("progress", process);
        }, Laya3D.init = function(width, height, antialias, alpha, premultipliedAlpha, stencil) {
            return void 0 === antialias && (antialias = !1), void 0 === alpha && (alpha = !1), 
            void 0 === premultipliedAlpha && (premultipliedAlpha = !0), void 0 === stencil && (stencil = !0), 
            !!Laya3D.inited || (RunDriver.update3DLoop = function() {}, RunDriver.cancelLoadByUrl = function(url) {
                Laya3D._cancelLoadByUrl(url);
            }, Config.isAntialias = antialias, Config.isAlpha = alpha, Config.premultipliedAlpha = premultipliedAlpha, 
            Config.isStencil = stencil, !!WebGL.enable() && (RunDriver.changeWebGLSize = Laya3D._changeWebGLSize, 
            Render.is3DMode = !0, Laya.init(width, height), Layer.__init__(), ShaderInit3D.__init__(), 
            MeshSprite3D.__init__(), AnimationNode.__init__(), Laya3D.__init__(), AtlasResourceManager.maxTextureCount = 2, 
            (Laya3D.debugMode || OctreeNode.debugMode) && (Laya3D._debugPhasorSprite = new PhasorSpriter3D()), 
            Laya3D.inited = !0));
        }, Laya3D.HIERARCHY = "SPRITE3DHIERARCHY", Laya3D.MESH = "MESH", Laya3D.MATERIAL = "MATERIAL", 
        Laya3D.PBRMATERIAL = "PBRMTL", Laya3D.TEXTURECUBE = "TEXTURECUBE", Laya3D.TERRAIN = "TERRAIN", 
        Laya3D._readData = null, Laya3D._debugPhasorSprite = null, Laya3D.debugMode = !1, 
        Laya3D.inited = !1, __static(Laya3D, [ "_DATA", function() {
            return this._DATA = {
                offset: 0,
                size: 0
            };
        }, "_strings", function() {
            return this._strings = [ "BLOCK", "DATA", "STRINGS" ];
        }, "_innerFirstLevelLoaderManager", function() {
            return this._innerFirstLevelLoaderManager = new LoaderManager();
        }, "_innerSecondLevelLoaderManager", function() {
            return this._innerSecondLevelLoaderManager = new LoaderManager();
        }, "_innerThirdLevelLoaderManager", function() {
            return this._innerThirdLevelLoaderManager = new LoaderManager();
        }, "_innerFourthLevelLoaderManager", function() {
            return this._innerFourthLevelLoaderManager = new LoaderManager();
        } ]), Laya3D;
    }(), AnimationTransform3D = function(_super) {
        function AnimationTransform3D(owner) {
            AnimationTransform3D.__super.call(this), this._owner = owner, this._childs = [], 
            this._localMatrix = new Float32Array(16), this._localQuaternionUpdate = !1, this._locaEulerlUpdate = !1, 
            this._localUpdate = !1, this._worldUpdate = !0;
        }
        __class(AnimationTransform3D, "laya.d3.animation.AnimationTransform3D", EventDispatcher);
        var __proto = AnimationTransform3D.prototype;
        return __proto._getlocalMatrix = function() {
            return this._localUpdate && (Utils3D._createAffineTransformationArray(this._localPosition, this._localRotation, this._localScale, this._localMatrix), 
            this._localUpdate = !1), this._localMatrix;
        }, __proto._onWorldTransform = function() {
            if (!this._worldUpdate) {
                this._worldUpdate = !0;
                for (var i = 0, n = this._childs.length; i < n; i++) this._childs[i]._onWorldTransform();
            }
        }, __proto._setWorldMatrixAndUpdate = function(matrix) {
            if (this._worldMatrix = matrix, null == this._parent) throw new Error("don't need to set worldMatrix to root Node.");
            if (null == this._parent._parent) for (var locMat = this._getlocalMatrix(), i = 0; i < 16; ++i) this._worldMatrix[i] = locMat[i]; else Utils3D.matrix4x4MultiplyFFF(this._parent.getWorldMatrix(), this._getlocalMatrix(), this._worldMatrix);
            this._worldUpdate = !1;
        }, __proto._setWorldMatrixNoUpdate = function(matrix) {
            this._worldMatrix = matrix;
        }, __proto._setWorldMatrixIgnoreUpdate = function(matrix) {
            this._worldMatrix = matrix, this._worldUpdate = !1;
        }, __proto.getLocalPosition = function() {
            return this._localPosition;
        }, __proto.setLocalPosition = function(value) {
            if (this._parent) this._localPosition = value, this._localUpdate = !0, this._onWorldTransform(); else {
                var entityTransform = this._entity.owner._transform, entityPosition = this._entity.localPosition, entityPositionE = entityPosition.elements;
                entityPositionE[0] = value[0], entityPositionE[1] = value[1], entityPositionE[2] = value[2], 
                entityTransform.localPosition = entityPosition;
            }
        }, __proto.getLocalRotation = function() {
            if (this._localQuaternionUpdate) {
                var eulerE = this._localRotationEuler;
                Utils3D._quaternionCreateFromYawPitchRollArray(eulerE[1] / AnimationTransform3D._angleToRandin, eulerE[0] / AnimationTransform3D._angleToRandin, eulerE[2] / AnimationTransform3D._angleToRandin, this._localRotation), 
                this._localQuaternionUpdate = !1;
            }
            return this._localRotation;
        }, __proto.setLocalRotation = function(value) {
            if (this._parent) this._localRotation = value, Utils3D.quaterionNormalize(this._localRotation, this._localRotation), 
            this._locaEulerlUpdate = !0, this._localQuaternionUpdate = !1, this._localUpdate = !0, 
            this._onWorldTransform(); else {
                var entityTransform = this._entity.owner._transform, entityRotation = this._entity.localRotation, entityRotationE = entityRotation.elements;
                entityRotationE[0] = value[0], entityRotationE[1] = value[1], entityRotationE[2] = value[2], 
                entityRotationE[3] = value[3], entityTransform.localRotation = entityRotation;
            }
        }, __proto.getLocalScale = function() {
            return this._localScale;
        }, __proto.setLocalScale = function(value) {
            if (this._parent) this._localScale = value, this._localUpdate = !0, this._onWorldTransform(); else {
                var entityTransform = this._entity.owner._transform, entityScale = this._entity.localScale, entityScaleE = entityScale.elements;
                entityScaleE[0] = value[0], entityScaleE[1] = value[1], entityScaleE[2] = value[2], 
                entityTransform.localScale = entityScale;
            }
        }, __proto.getLocalRotationEuler = function() {
            if (this._locaEulerlUpdate) {
                Utils3D.getYawPitchRoll(this._localRotation, AnimationTransform3D._tempVector3);
                var eulerE = AnimationTransform3D._tempVector3, localRotationEulerE = this._localRotationEuler;
                localRotationEulerE[0] = eulerE[1] * AnimationTransform3D._angleToRandin, localRotationEulerE[1] = eulerE[0] * AnimationTransform3D._angleToRandin, 
                localRotationEulerE[2] = eulerE[2] * AnimationTransform3D._angleToRandin, this._locaEulerlUpdate = !1;
            }
            return this._localRotationEuler;
        }, __proto.setLocalRotationEuler = function(value) {
            if (this._parent) Utils3D._quaternionCreateFromYawPitchRollArray(value[1] / AnimationTransform3D._angleToRandin, value[0] / AnimationTransform3D._angleToRandin, value[2] / AnimationTransform3D._angleToRandin, this._localRotation), 
            this._localRotationEuler = value, this._locaEulerlUpdate = !1, this._localQuaternionUpdate = !1, 
            this._localUpdate = !0, this._onWorldTransform(); else {
                var entityTransform = this._entity.owner._transform, entityLocalRotationEuler = this._entity.localRotationEuler, elements = entityLocalRotationEuler.elements;
                elements[0] = value[0], elements[1] = value[1], elements[2] = value[2], entityTransform.localRotationEuler = entityLocalRotationEuler;
            }
        }, __proto.getWorldMatrix = function() {
            if (this._worldUpdate) {
                if (null != this._parent._parent) Utils3D.matrix4x4MultiplyFFF(this._parent.getWorldMatrix(), this._getlocalMatrix(), this._worldMatrix); else for (var locMat = this._getlocalMatrix(), i = 0; i < 16; ++i) this._worldMatrix[i] = locMat[i];
                this._worldUpdate = !1;
            }
            return this._worldMatrix;
        }, __proto.setParent = function(value) {
            if (this._parent !== value) {
                if (this._parent) {
                    var parentChilds = this._parent._childs, index = parentChilds.indexOf(this);
                    parentChilds.splice(index, 1);
                }
                value && (value._childs.push(this), value && this._onWorldTransform()), this._parent = value;
            }
        }, __static(AnimationTransform3D, [ "_tempVector3", function() {
            return this._tempVector3 = new Float32Array(3);
        }, "_angleToRandin", function() {
            return this._angleToRandin = 180 / Math.PI;
        } ]), AnimationTransform3D;
    }(), Component3D = function(_super) {
        function Component3D() {
            this._destroyed = !1, this._id = 0, this._enable = !1, this._owner = null, this.started = !1, 
            Component3D.__super.call(this), this._destroyed = !1, this._id = Component3D._uniqueIDCounter, 
            Component3D._uniqueIDCounter++;
        }
        __class(Component3D, "laya.d3.component.Component3D", EventDispatcher);
        var __proto = Component3D.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.render.IUpdate": !0,
            "laya.resource.IDestroy": !0
        }), __proto._initialize = function(owner) {
            this._owner = owner, this._enable = !0, this.started = !1, this._load(owner);
        }, __proto._destroy = function() {
            this._unload(this._owner), this._owner = null, this._destroyed = !0;
        }, __proto._load = function(owner) {}, __proto._start = function(state) {}, __proto._update = function(state) {}, 
        __proto._lateUpdate = function(state) {}, __proto._preRenderUpdate = function(state) {}, 
        __proto._postRenderUpdate = function(state) {}, __proto._unload = function(owner) {
            this.offAll();
        }, __proto._cloneTo = function(dest) {}, __getset(0, __proto, "id", function() {
            return this._id;
        }), __getset(0, __proto, "destroyed", function() {
            return this._destroyed;
        }), __getset(0, __proto, "owner", function() {
            return this._owner;
        }), __getset(0, __proto, "enable", function() {
            return this._enable;
        }, function(value) {
            this._enable !== value && (this._enable = value, this.event("enablechanged", this._enable));
        }), __getset(0, __proto, "isSingleton", function() {
            return Component3D._isSingleton;
        }), Component3D._isSingleton = !0, Component3D._uniqueIDCounter = 1, Component3D;
    }(), GeometryFilter = function(_super) {
        function GeometryFilter() {
            this._destroyed = !1, GeometryFilter.__super.call(this), this._destroyed = !1;
        }
        __class(GeometryFilter, "laya.d3.core.GeometryFilter", EventDispatcher);
        var __proto = GeometryFilter.prototype;
        return Laya.imps(__proto, {
            "laya.resource.IDestroy": !0
        }), __proto._destroy = function() {
            this.offAll(), this._destroyed = !0;
        }, __getset(0, __proto, "_isAsyncLoaded", function() {
            return !0;
        }), __getset(0, __proto, "_originalBoundingBoxCorners", function() {
            throw new Error("BaseRender: must override it.");
        }), __getset(0, __proto, "_originalBoundingSphere", function() {
            throw new Error("BaseRender: must override it.");
        }), __getset(0, __proto, "_originalBoundingBox", function() {
            throw new Error("BaseRender: must override it.");
        }), __getset(0, __proto, "destroyed", function() {
            return this._destroyed;
        }), GeometryFilter;
    }(), BaseRender = function(_super) {
        function BaseRender(owner) {
            BaseRender.__super.call(this), this._id = ++BaseRender._uniqueIDCounter, this._indexInSceneFrustumCullingObjects = -1, 
            this._boundingBox = new BoundBox(new Vector3(), new Vector3()), this._boundingBoxCenter = new Vector3(), 
            this._boundingSphere = new BoundSphere(new Vector3(), 0), this._boundingSphereNeedChange = !0, 
            this._boundingBoxNeedChange = !0, this._boundingBoxCenterNeedChange = !0, this._octreeNodeNeedChange = !0, 
            this._materials = [], this._renderElements = [], this._isPartOfStaticBatch = !1, 
            this._destroyed = !1, this._owner = owner, this._enable = !0, this._materialsInstance = [], 
            this.lightmapIndex = -1, this.castShadow = !1, this.receiveShadow = !1, this.sortingFudge = 0, 
            this._owner.transform.on("worldmatrixneedchanged", this, this._onWorldMatNeedChange);
        }
        __class(BaseRender, "laya.d3.core.render.BaseRender", EventDispatcher);
        var __proto = BaseRender.prototype;
        return Laya.imps(__proto, {
            "laya.resource.IDestroy": !0
        }), __proto._changeMaterialReference = function(lastValue, value) {
            lastValue && lastValue._removeReference(), value._addReference();
        }, __proto._getInstanceMaterial = function(material, index) {
            var insMat = new material.constructor();
            return material.cloneTo(insMat), insMat.name = insMat.name + "(Instance)", this._materialsInstance[index] = !0, 
            this._changeMaterialReference(this._materials[index], insMat), this._materials[index] = insMat;
        }, __proto._setShaderValuelightMap = function(lightMap) {
            this._setShaderValueTexture(3, lightMap);
        }, __proto._onWorldMatNeedChange = function() {
            this._boundingSphereNeedChange = !0, this._boundingBoxNeedChange = !0, this._boundingBoxCenterNeedChange = !0, 
            this._octreeNodeNeedChange = !0;
        }, __proto._renderRenderableBoundBox = function() {
            var linePhasor = Laya3D._debugPhasorSprite, boundBox = this.boundingBox, corners = BaseRender._tempBoundBoxCorners;
            boundBox.getCorners(corners), linePhasor.line(corners[0], BaseRender._greenColor, corners[1], BaseRender._greenColor), 
            linePhasor.line(corners[2], BaseRender._greenColor, corners[3], BaseRender._greenColor), 
            linePhasor.line(corners[4], BaseRender._greenColor, corners[5], BaseRender._greenColor), 
            linePhasor.line(corners[6], BaseRender._greenColor, corners[7], BaseRender._greenColor), 
            linePhasor.line(corners[0], BaseRender._greenColor, corners[3], BaseRender._greenColor), 
            linePhasor.line(corners[1], BaseRender._greenColor, corners[2], BaseRender._greenColor), 
            linePhasor.line(corners[2], BaseRender._greenColor, corners[6], BaseRender._greenColor), 
            linePhasor.line(corners[3], BaseRender._greenColor, corners[7], BaseRender._greenColor), 
            linePhasor.line(corners[0], BaseRender._greenColor, corners[4], BaseRender._greenColor), 
            linePhasor.line(corners[1], BaseRender._greenColor, corners[5], BaseRender._greenColor), 
            linePhasor.line(corners[4], BaseRender._greenColor, corners[7], BaseRender._greenColor), 
            linePhasor.line(corners[5], BaseRender._greenColor, corners[6], BaseRender._greenColor);
        }, __proto._calculateBoundingSphere = function() {
            throw "BaseRender: must override it.";
        }, __proto._calculateBoundingBox = function() {
            throw "BaseRender: must override it.";
        }, __proto._setShaderValueTexture = function(shaderName, texture) {
            this._owner._shaderValues.setValue(shaderName, texture);
        }, __proto._setShaderValueMatrix4x4 = function(shaderName, matrix4x4) {
            this._owner._shaderValues.setValue(shaderName, matrix4x4 ? matrix4x4.elements : null);
        }, __proto._setShaderValueColor = function(shaderIndex, color) {
            this._owner._shaderValues.setValue(shaderIndex, color ? color.elements : null);
        }, __proto._setShaderValueBuffer = function(shaderIndex, buffer) {
            this._owner._shaderValues.setValue(shaderIndex, buffer);
        }, __proto._setShaderValueInt = function(shaderIndex, i) {
            this._owner._shaderValues.setValue(shaderIndex, i);
        }, __proto._setShaderValueBool = function(shaderIndex, b) {
            this._owner._shaderValues.setValue(shaderIndex, b);
        }, __proto._setShaderValueNumber = function(shaderIndex, number) {
            this._owner._shaderValues.setValue(shaderIndex, number);
        }, __proto._setShaderValueVector2 = function(shaderIndex, vector2) {
            this._owner._shaderValues.setValue(shaderIndex, vector2 ? vector2.elements : null);
        }, __proto._addShaderDefine = function(value) {
            this._owner._shaderDefineValue |= value;
        }, __proto._removeShaderDefine = function(value) {
            this._owner._shaderDefineValue &= ~value;
        }, __proto._renderUpdate = function(projectionView) {
            return !0;
        }, __proto._applyLightMapParams = function() {
            if (0 <= this._lightmapIndex) {
                var scene = this._owner.scene;
                if (scene) {
                    var lightMap = scene.getlightmaps()[this._lightmapIndex];
                    lightMap ? (this._addShaderDefine(RenderableSprite3D.SAHDERDEFINE_LIGHTMAP), lightMap.loaded ? this._setShaderValuelightMap(lightMap) : lightMap.once("loaded", this, this._setShaderValuelightMap)) : this._removeShaderDefine(RenderableSprite3D.SAHDERDEFINE_LIGHTMAP);
                } else this._removeShaderDefine(RenderableSprite3D.SAHDERDEFINE_LIGHTMAP);
            } else this._removeShaderDefine(RenderableSprite3D.SAHDERDEFINE_LIGHTMAP);
        }, __proto._updateOctreeNode = function() {
            var treeNode = this._treeNode;
            treeNode && this._octreeNodeNeedChange && (treeNode.updateObject(this), this._octreeNodeNeedChange = !1);
        }, __proto._destroy = function() {
            this.offAll();
            var i = 0, n = 0;
            for (i = 0, n = this._renderElements.length; i < n; i++) this._renderElements[i]._destroy();
            for (i = 0, n = this._materials.length; i < n; i++) this._materials[i]._removeReference();
            this._renderElements = null, this._owner = null, this._materials = null, this._boundingBox = null, 
            this._boundingBoxCenter = null, this._boundingSphere = null, this._lightmapScaleOffset = null, 
            this._destroyed = !0;
        }, __getset(0, __proto, "boundingSphere", function() {
            return this._boundingSphereNeedChange && (this._calculateBoundingSphere(), this._boundingSphereNeedChange = !1), 
            this._boundingSphere;
        }), __getset(0, __proto, "id", function() {
            return this._id;
        }), __getset(0, __proto, "material", function() {
            var material = this._materials[0];
            if (material && !this._materialsInstance[0]) {
                var insMat = this._getInstanceMaterial(material, 0);
                this.event("materialchanged", [ this, 0, insMat ]);
            }
            return this._materials[0];
        }, function(value) {
            this.sharedMaterial = value;
        }), __getset(0, __proto, "sharedMaterial", function() {
            return this._materials[0];
        }, function(value) {
            var lastValue = this._materials[0];
            lastValue !== value && (this._materials[0] = value, this._materialsInstance[0] = !1, 
            this._changeMaterialReference(lastValue, value), this.event("materialchanged", [ this, 0, value ]));
        }), __getset(0, __proto, "lightmapIndex", function() {
            return this._lightmapIndex;
        }, function(value) {
            this._lightmapIndex = value, this._applyLightMapParams();
        }), __getset(0, __proto, "lightmapScaleOffset", function() {
            return this._lightmapScaleOffset;
        }, function(value) {
            this._lightmapScaleOffset = value, this._setShaderValueColor(2, value), this._addShaderDefine(RenderableSprite3D.SHADERDEFINE_SCALEOFFSETLIGHTINGMAPUV);
        }), __getset(0, __proto, "enable", function() {
            return this._enable;
        }, function(value) {
            this._enable = value, this.event("enablechanged", [ this, value ]);
        }), __getset(0, __proto, "materials", function() {
            for (var i = 0, n = this._materials.length; i < n; i++) if (!this._materialsInstance[i]) {
                var insMat = this._getInstanceMaterial(this._materials[i], i);
                this.event("materialchanged", [ this, i, insMat ]);
            }
            return this._materials.slice();
        }, function(value) {
            this.sharedMaterials = value;
        }), __getset(0, __proto, "sharedMaterials", function() {
            return this._materials.slice();
        }, function(value) {
            if (!value) throw new Error("MeshRender: shadredMaterials value can't be null.");
            var len = value.length;
            this._materialsInstance.length = len;
            for (var i = 0; i < len; i++) {
                var lastValue = this._materials[i];
                lastValue !== value[i] && (this._materialsInstance[i] = !1, this._changeMaterialReference(lastValue, value[i]), 
                this.event("materialchanged", [ this, i, value[i] ]));
            }
            this._materials = value;
        }), __getset(0, __proto, "boundingBox", function() {
            return this._boundingBoxNeedChange && (this._calculateBoundingBox(), this._boundingBoxNeedChange = !1), 
            this._boundingBox;
        }), __getset(0, __proto, "boundingBoxCenter", function() {
            if (this._boundingBoxCenterNeedChange) {
                var boundBox = this.boundingBox;
                Vector3.add(boundBox.min, boundBox.max, this._boundingBoxCenter), Vector3.scale(this._boundingBoxCenter, .5, this._boundingBoxCenter), 
                this._boundingBoxCenterNeedChange = !1;
            }
            return this._boundingBoxCenter;
        }), __getset(0, __proto, "receiveShadow", function() {
            return this._receiveShadow;
        }, function(value) {
            this._receiveShadow !== value && ((this._receiveShadow = value) ? this._addShaderDefine(ParallelSplitShadowMap.SHADERDEFINE_RECEIVE_SHADOW) : this._removeShaderDefine(ParallelSplitShadowMap.SHADERDEFINE_RECEIVE_SHADOW));
        }), __getset(0, __proto, "destroyed", function() {
            return this._destroyed;
        }), BaseRender._uniqueIDCounter = 0, __static(BaseRender, [ "_tempBoundBoxCorners", function() {
            return this._tempBoundBoxCorners = [ new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3(), new Vector3() ];
        }, "_greenColor", function() {
            return this._greenColor = new Vector4(0, 1, 0, 1);
        } ]), BaseRender;
    }(), Transform3D = function(_super) {
        function Transform3D(owner) {
            this._owner = null, this._localQuaternionUpdate = !1, this._locaEulerlUpdate = !1, 
            this._localUpdate = !1, this._worldUpdate = !0, this._positionUpdate = !0, this._rotationUpdate = !0, 
            this._scaleUpdate = !0, this._parent = null, this._childs = null, this._dummy = null, 
            this.pivot = null, Transform3D.__super.call(this), this._localPosition = new Vector3(), 
            this._localRotation = new Quaternion(0, 0, 0, 1), this._localScale = new Vector3(1, 1, 1), 
            this._localRotationEuler = new Vector3(), this._localMatrix = new Matrix4x4(), this._position = new Vector3(), 
            this._rotation = new Quaternion(0, 0, 0, 1), this._scale = new Vector3(1, 1, 1), 
            this._worldMatrix = new Matrix4x4(), this._forward = new Vector3(), this._up = new Vector3(), 
            this._right = new Vector3(), this._owner = owner, this._childs = [];
        }
        __class(Transform3D, "laya.d3.core.Transform3D", EventDispatcher);
        var __proto = Transform3D.prototype;
        return __proto._updateLocalMatrix = function() {
            if (!this.pivot || 0 === this.pivot.x && 0 === this.pivot.y && 0 === this.pivot.z) Matrix4x4.createAffineTransformation(this._localPosition, this.localRotation, this._localScale, this._localMatrix); else {
                var scalePivot = Transform3D._tempVector30;
                Vector3.multiply(this.pivot, this._localScale, scalePivot);
                var scaleOffsetPosition = Transform3D._tempVector31;
                Vector3.subtract(scalePivot, this.pivot, scaleOffsetPosition);
                var rotationOffsetPosition = Transform3D._tempVector32, localRot = this.localRotation;
                Vector3.transformQuat(scalePivot, localRot, rotationOffsetPosition), Vector3.subtract(rotationOffsetPosition, scalePivot, rotationOffsetPosition);
                var resultLocalPosition = Transform3D._tempVector33;
                Vector3.subtract(this._localPosition, scaleOffsetPosition, resultLocalPosition), 
                Vector3.subtract(resultLocalPosition, rotationOffsetPosition, resultLocalPosition), 
                Matrix4x4.createAffineTransformation(resultLocalPosition, localRot, this._localScale, this._localMatrix);
            }
        }, __proto._onWorldPositionRotationTransform = function() {
            if (!this._worldUpdate || !this._positionUpdate || !this._rotationUpdate) {
                this._worldUpdate = this._positionUpdate = this._rotationUpdate = !0, this.event("worldmatrixneedchanged");
                for (var i = 0, n = this._childs.length; i < n; i++) this._childs[i]._onWorldPositionRotationTransform();
            }
        }, __proto._onWorldPositionScaleTransform = function() {
            if (!this._worldUpdate || !this._positionUpdate || !this._scaleUpdate) {
                this._worldUpdate = this._positionUpdate = this._scaleUpdate = !0, this.event("worldmatrixneedchanged");
                for (var i = 0, n = this._childs.length; i < n; i++) this._childs[i]._onWorldPositionScaleTransform();
            }
        }, __proto._onWorldPositionTransform = function() {
            if (!this._worldUpdate || !this._positionUpdate) {
                this._worldUpdate = this._positionUpdate = !0, this.event("worldmatrixneedchanged");
                for (var i = 0, n = this._childs.length; i < n; i++) this._childs[i]._onWorldPositionTransform();
            }
        }, __proto._onWorldRotationTransform = function() {
            if (!this._worldUpdate || !this._rotationUpdate) {
                this._worldUpdate = this._rotationUpdate = !0, this.event("worldmatrixneedchanged");
                for (var i = 0, n = this._childs.length; i < n; i++) this._childs[i]._onWorldPositionRotationTransform();
            }
        }, __proto._onWorldScaleTransform = function() {
            if (!this._worldUpdate || !this._scaleUpdate) {
                this._worldUpdate = this._scaleUpdate = !0, this.event("worldmatrixneedchanged");
                for (var i = 0, n = this._childs.length; i < n; i++) this._childs[i]._onWorldPositionScaleTransform();
            }
        }, __proto._onWorldTransform = function() {
            if (!(this._worldUpdate && this._positionUpdate && this._rotationUpdate && this._scaleUpdate)) {
                this._worldUpdate = this._positionUpdate = this._rotationUpdate = this._scaleUpdate = !0, 
                this.event("worldmatrixneedchanged");
                for (var i = 0, n = this._childs.length; i < n; i++) this._childs[i]._onWorldTransform();
            }
        }, __proto.translate = function(translation, isLocal) {
            void 0 === isLocal && (isLocal = !0), isLocal ? (Matrix4x4.createFromQuaternion(this.localRotation, Transform3D._tempMatrix0), 
            Vector3.transformCoordinate(translation, Transform3D._tempMatrix0, Transform3D._tempVector30), 
            Vector3.add(this.localPosition, Transform3D._tempVector30, this._localPosition), 
            this.localPosition = this._localPosition) : (Vector3.add(this.position, translation, this._position), 
            this.position = this._position);
        }, __proto.rotate = function(rotation, isLocal, isRadian) {
            var rot;
            void 0 === isLocal && (isLocal = !0), void 0 === isRadian && (isRadian = !0), rot = isRadian ? rotation : (Vector3.scale(rotation, Math.PI / 180, Transform3D._tempVector30), 
            Transform3D._tempVector30), Quaternion.createFromYawPitchRoll(rot.y, rot.x, rot.z, Transform3D._tempQuaternion0), 
            isLocal ? (Quaternion.multiply(this._localRotation, Transform3D._tempQuaternion0, this._localRotation), 
            this.localRotation = this._localRotation) : (Quaternion.multiply(Transform3D._tempQuaternion0, this.rotation, this._rotation), 
            this.rotation = this._rotation);
        }, __proto.lookAt = function(target, up, isLocal) {
            void 0 === isLocal && (isLocal = !1);
            var eyeE, targetE = target.elements;
            if (isLocal) {
                if (eyeE = this._localPosition.elements, Math.abs(eyeE[0] - targetE[0]) < MathUtils3D.zeroTolerance && Math.abs(eyeE[1] - targetE[1]) < MathUtils3D.zeroTolerance && Math.abs(eyeE[2] - targetE[2]) < MathUtils3D.zeroTolerance) return;
                Quaternion.lookAt(this._localPosition, target, up, this._localRotation), this._localRotation.invert(this._localRotation), 
                this.localRotation = this._localRotation;
            } else {
                var worldPosition = this.position;
                if (eyeE = worldPosition.elements, Math.abs(eyeE[0] - targetE[0]) < MathUtils3D.zeroTolerance && Math.abs(eyeE[1] - targetE[1]) < MathUtils3D.zeroTolerance && Math.abs(eyeE[2] - targetE[2]) < MathUtils3D.zeroTolerance) return;
                Quaternion.lookAt(worldPosition, target, up, this._rotation), this._rotation.invert(this._rotation), 
                this.rotation = this._rotation;
            }
        }, __getset(0, __proto, "_isFrontFaceInvert", function() {
            var scale = this.scale, isInvert = scale.x < 0;
            return scale.y < 0 && (isInvert = !isInvert), scale.z < 0 && (isInvert = !isInvert), 
            isInvert;
        }), __getset(0, __proto, "owner", function() {
            return this._owner;
        }), __getset(0, __proto, "localRotation", function() {
            if (this._localQuaternionUpdate) {
                var eulerE = this._localRotationEuler.elements;
                Quaternion.createFromYawPitchRoll(eulerE[1] / Transform3D._angleToRandin, eulerE[0] / Transform3D._angleToRandin, eulerE[2] / Transform3D._angleToRandin, this._localRotation);
            }
            return this._localRotation;
        }, function(value) {
            this._localRotation = value, this._localRotation.normalize(this._localRotation), 
            this._locaEulerlUpdate = !0, this._localQuaternionUpdate = !1, this._localUpdate = !0, 
            !this.pivot || 0 === this.pivot.x && 0 === this.pivot.y && 0 === this.pivot.z ? this._onWorldRotationTransform() : this._onWorldPositionRotationTransform();
        }), __getset(0, __proto, "worldMatrix", function() {
            return this._worldUpdate && (null != this._parent ? Matrix4x4.multiply(this._parent.worldMatrix, this.localMatrix, this._worldMatrix) : this.localMatrix.cloneTo(this._worldMatrix), 
            this._worldUpdate = !1), this._worldMatrix;
        }, function(value) {
            null === this._parent ? value.cloneTo(this._localMatrix) : (this._parent.worldMatrix.invert(this._localMatrix), 
            Matrix4x4.multiply(this._localMatrix, value, this._localMatrix)), this.localMatrix = this._localMatrix, 
            this._worldMatrix = value, this._worldUpdate = !1;
        }), __getset(0, __proto, "worldNeedUpdate", function() {
            return this._worldUpdate;
        }), __getset(0, __proto, "localMatrix", function() {
            return this._localUpdate && (this._updateLocalMatrix(), this._localUpdate = !1), 
            this._localMatrix;
        }, function(value) {
            this._localMatrix = value, this._localMatrix.decomposeTransRotScale(this._localPosition, this._localRotation, this._localScale), 
            this._localUpdate = !1, this._onWorldTransform();
        }), __getset(0, __proto, "dummy", function() {
            return this._dummy;
        }, function(value) {
            this._dummy !== value && (this._dummy && (this._dummy._entity = null), value && (value._entity = this), 
            this._dummy = value);
        }), __getset(0, __proto, "localPosition", function() {
            return this._localPosition;
        }, function(value) {
            this._localPosition = value, this._localUpdate = !0, this._onWorldPositionTransform();
        }), __getset(0, __proto, "position", function() {
            if (this._positionUpdate) {
                if (null != this._parent) {
                    var parentPosition = this._parent.position;
                    Vector3.multiply(this._localPosition, this._parent.scale, Transform3D._tempVector30), 
                    Vector3.transformQuat(Transform3D._tempVector30, this._parent.rotation, Transform3D._tempVector30), 
                    Vector3.add(parentPosition, Transform3D._tempVector30, this._position);
                } else this._localPosition.cloneTo(this._position);
                this._positionUpdate = !1;
            }
            return this._position;
        }, function(value) {
            if (null != this._parent) {
                Vector3.subtract(value, this._parent.position, this._localPosition);
                var parentScaleE = this._parent.scale.elements, psX = parentScaleE[0], psY = parentScaleE[1], psZ = parentScaleE[2];
                if (1 !== psX || 1 !== psY || 1 !== psZ) {
                    var invertScale = Transform3D._tempVector30, invertScaleE = invertScale.elements;
                    invertScaleE[0] = 1 / psX, invertScaleE[1] = 1 / psY, invertScaleE[2] = 1 / psZ, 
                    Vector3.multiply(this._localPosition, invertScale, this._localPosition);
                }
                this._parent.rotation.invert(Transform3D._tempQuaternion0), Vector3.transformQuat(this._localPosition, Transform3D._tempQuaternion0, this._localPosition);
            } else value.cloneTo(this._localPosition);
            this.localPosition = this._localPosition, this._position = value, this._positionUpdate = !1;
        }), __getset(0, __proto, "localScale", function() {
            return this._localScale;
        }, function(value) {
            this._localScale = value, this._localUpdate = !0, !this.pivot || 0 === this.pivot.x && 0 === this.pivot.y && 0 === this.pivot.z ? this._onWorldScaleTransform() : this._onWorldPositionScaleTransform();
        }), __getset(0, __proto, "localRotationEuler", function() {
            if (this._locaEulerlUpdate) {
                this._localRotation.getYawPitchRoll(Transform3D._tempVector30);
                var eulerE = Transform3D._tempVector30.elements, localRotationEulerE = this._localRotationEuler.elements;
                localRotationEulerE[0] = eulerE[1] * Transform3D._angleToRandin, localRotationEulerE[1] = eulerE[0] * Transform3D._angleToRandin, 
                localRotationEulerE[2] = eulerE[2] * Transform3D._angleToRandin;
            }
            return this._localRotationEuler;
        }, function(value) {
            this._localRotationEuler = value, this._locaEulerlUpdate = !1, this._localQuaternionUpdate = !0, 
            this._localUpdate = !0, !this.pivot || 0 === this.pivot.x && 0 === this.pivot.y && 0 === this.pivot.z ? this._onWorldRotationTransform() : this._onWorldPositionRotationTransform();
        }), __getset(0, __proto, "rotation", function() {
            return this._rotationUpdate && (null != this._parent ? Quaternion.multiply(this._parent.rotation, this.localRotation, this._rotation) : this.localRotation.cloneTo(this._rotation), 
            this._rotationUpdate = !1), this._rotation;
        }, function(value) {
            null != this._parent ? (this._parent.rotation.invert(Transform3D._tempQuaternion0), 
            Quaternion.multiply(value, Transform3D._tempQuaternion0, this._localRotation)) : value.cloneTo(this._localRotation), 
            this.localRotation = this._localRotation, this._rotation = value, this._rotationUpdate = !1;
        }), __getset(0, __proto, "scale", function() {
            return this._scaleUpdate && (null !== this._parent ? Vector3.multiply(this._parent.scale, this._localScale, this._scale) : this._localScale.cloneTo(this._scale), 
            this._scaleUpdate = !1), this._scale;
        }, function(value) {
            if (null !== this._parent) {
                var pScaleE = this._parent.scale.elements, invPScaleE = Transform3D._tempVector30.elements;
                invPScaleE[0] = 1 / pScaleE[0], invPScaleE[1] = 1 / pScaleE[1], invPScaleE[2] = 1 / pScaleE[2], 
                Vector3.multiply(value, Transform3D._tempVector30, this._localScale);
            } else value.cloneTo(this._localScale);
            this.localScale = this._localScale, this._scale = value, this._scaleUpdate = !1;
        }), __getset(0, __proto, "rotationEuler", null, function(value) {
            Quaternion.createFromYawPitchRoll(value.y, value.x, value.z, this._rotation), this.rotation = this._rotation;
        }), __getset(0, __proto, "forward", function() {
            var worldMatElem = this.worldMatrix.elements;
            return this._forward.elements[0] = -worldMatElem[8], this._forward.elements[1] = -worldMatElem[9], 
            this._forward.elements[2] = -worldMatElem[10], this._forward;
        }), __getset(0, __proto, "up", function() {
            var worldMatElem = this.worldMatrix.elements;
            return this._up.elements[0] = worldMatElem[4], this._up.elements[1] = worldMatElem[5], 
            this._up.elements[2] = worldMatElem[6], this._up;
        }), __getset(0, __proto, "right", function() {
            var worldMatElem = this.worldMatrix.elements;
            return this._right.elements[0] = worldMatElem[0], this._right.elements[1] = worldMatElem[1], 
            this._right.elements[2] = worldMatElem[2], this._right;
        }), __getset(0, __proto, "parent", function() {
            return this._parent;
        }, function(value) {
            if (this._parent !== value) {
                if (this._parent) {
                    var parentChilds = this._parent._childs, index = parentChilds.indexOf(this);
                    parentChilds.splice(index, 1);
                }
                value && (value._childs.push(this), value && this._onWorldTransform()), this._parent = value;
            }
        }), __static(Transform3D, [ "_tempVector30", function() {
            return this._tempVector30 = new Vector3();
        }, "_tempVector31", function() {
            return this._tempVector31 = new Vector3();
        }, "_tempVector32", function() {
            return this._tempVector32 = new Vector3();
        }, "_tempVector33", function() {
            return this._tempVector33 = new Vector3();
        }, "_tempQuaternion0", function() {
            return this._tempQuaternion0 = new Quaternion();
        }, "_tempMatrix0", function() {
            return this._tempMatrix0 = new Matrix4x4();
        }, "_angleToRandin", function() {
            return this._angleToRandin = 180 / Math.PI;
        } ]), Transform3D;
    }(), SubMeshRenderElement = (function(_super) {
        function TransformUV() {
            this._rotation = 0, this._matNeedUpdte = !1, TransformUV.__super.call(this), this._matrix = new Matrix4x4(), 
            this._offset = new Vector2(), this._tiling = new Vector2(1, 1);
        }
        __class(TransformUV, "laya.d3.core.TransformUV", EventDispatcher);
        var __proto = TransformUV.prototype;
        Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto._updateMatrix = function() {
            TransformUV._tempOffsetV3.elements[0] = this._offset.x, TransformUV._tempOffsetV3.elements[1] = this._offset.y, 
            Quaternion.createFromYawPitchRoll(0, 0, this._rotation, TransformUV._tempRotationQua), 
            TransformUV._tempTitlingV3.elements[0] = this._tiling.x, TransformUV._tempTitlingV3.elements[1] = this._tiling.y, 
            Matrix4x4.createAffineTransformation(TransformUV._tempOffsetV3, TransformUV._tempRotationQua, TransformUV._tempTitlingV3, this._matrix);
        }, __proto.cloneTo = function(destObject) {
            destObject._matrix = this._matrix.clone(), destObject._offset = this._offset.clone(), 
            destObject._rotation = this._rotation, destObject._tiling = this._tiling.clone();
        }, __proto.clone = function() {
            var dest = new this.constructor();
            return this.cloneTo(dest), dest;
        }, __getset(0, __proto, "matrix", function() {
            return this._matNeedUpdte && (this._updateMatrix(), this._matNeedUpdte = !1), this._matrix;
        }), __getset(0, __proto, "tiling", function() {
            return this._tiling;
        }, function(value) {
            this._tiling = value, this._matNeedUpdte = !0;
        }), __getset(0, __proto, "offset", function() {
            return this._offset;
        }, function(value) {
            this._offset = value, this._matNeedUpdte = !0;
        }), __getset(0, __proto, "rotation", function() {
            return this._rotation;
        }, function(value) {
            this._rotation = value, this._matNeedUpdte = !0;
        }), __static(TransformUV, [ "_tempOffsetV3", function() {
            return this._tempOffsetV3 = new Vector3(0, 0, 0);
        }, "_tempRotationQua", function() {
            return this._tempRotationQua = new Quaternion();
        }, "_tempTitlingV3", function() {
            return this._tempTitlingV3 = new Vector3(1, 1, 1);
        } ]);
    }(), function(_super) {
        function BoxShape() {
            this.x = NaN, this.y = NaN, this.z = NaN, BoxShape.__super.call(this), this.x = 1, 
            this.y = 1, this.z = 1, this.randomDirection = !1;
        }
        __class(BoxShape, "laya.d3.core.particleShuriKen.module.shape.BoxShape", _super);
        var __proto = BoxShape.prototype;
        __proto._getShapeBoundBox = function(boundBox) {
            var minE = boundBox.min.elements;
            minE[0] = .5 * -this.x, minE[1] = .5 * -this.y, minE[2] = .5 * -this.z;
            var maxE = boundBox.max.elements;
            maxE[0] = .5 * this.x, maxE[1] = .5 * this.y, maxE[2] = .5 * this.z;
        }, __proto._getSpeedBoundBox = function(boundBox) {
            var minE = boundBox.min.elements;
            minE[0] = 0, minE[1] = 0, minE[2] = 0;
            var maxE = boundBox.max.elements;
            maxE[0] = 0, maxE[1] = 1, maxE[2] = 0;
        }, __proto.generatePositionAndDirection = function(position, direction, rand, randomSeeds) {
            var rpE = position.elements, rdE = direction.elements;
            rand ? (rand.seed = randomSeeds[16], ShapeUtils._randomPointInsideHalfUnitBox(position, rand), 
            randomSeeds[16] = rand.seed) : ShapeUtils._randomPointInsideHalfUnitBox(position), 
            rpE[0] = this.x * rpE[0], rpE[1] = this.y * rpE[1], rpE[2] = this.z * rpE[2], this.randomDirection ? rand ? (rand.seed = randomSeeds[17], 
            ShapeUtils._randomPointUnitSphere(direction, rand), randomSeeds[17] = rand.seed) : ShapeUtils._randomPointUnitSphere(direction) : (rdE[0] = 0, 
            rdE[1] = 0, rdE[2] = 1);
        }, __proto.cloneTo = function(destObject) {
            _super.prototype.cloneTo.call(this, destObject);
            var destShape = destObject;
            destShape.x = this.x, destShape.y = this.y, destShape.z = this.z, destShape.randomDirection = this.randomDirection;
        };
    }(BaseShape), function(_super) {
        function CircleShape() {
            this.radius = NaN, this.arc = NaN, this.emitFromEdge = !1, CircleShape.__super.call(this), 
            this.radius = 1, this.arc = 2 * Math.PI, this.emitFromEdge = !1, this.randomDirection = !1;
        }
        __class(CircleShape, "laya.d3.core.particleShuriKen.module.shape.CircleShape", _super);
        var __proto = CircleShape.prototype;
        __proto._getShapeBoundBox = function(boundBox) {
            var minE = boundBox.min.elements;
            minE[0] = minE[2] = -this.radius, minE[1] = 0;
            var maxE = boundBox.max.elements;
            maxE[0] = maxE[2] = this.radius, maxE[1] = 0;
        }, __proto._getSpeedBoundBox = function(boundBox) {
            var minE = boundBox.min.elements;
            minE[0] = minE[1] = -1, minE[2] = 0;
            var maxE = boundBox.max.elements;
            maxE[0] = maxE[1] = 1, maxE[2] = 0;
        }, __proto.generatePositionAndDirection = function(position, direction, rand, randomSeeds) {
            var rpE = position.elements, positionPointE = CircleShape._tempPositionPoint.elements;
            rand ? (rand.seed = randomSeeds[16], this.emitFromEdge ? ShapeUtils._randomPointUnitArcCircle(this.arc, CircleShape._tempPositionPoint, rand) : ShapeUtils._randomPointInsideUnitArcCircle(this.arc, CircleShape._tempPositionPoint, rand), 
            randomSeeds[16] = rand.seed) : this.emitFromEdge ? ShapeUtils._randomPointUnitArcCircle(this.arc, CircleShape._tempPositionPoint) : ShapeUtils._randomPointInsideUnitArcCircle(this.arc, CircleShape._tempPositionPoint), 
            rpE[0] = -positionPointE[0], rpE[1] = positionPointE[1], rpE[2] = 0, Vector3.scale(position, this.radius, position), 
            this.randomDirection ? rand ? (rand.seed = randomSeeds[17], ShapeUtils._randomPointUnitSphere(direction, rand), 
            randomSeeds[17] = rand.seed) : ShapeUtils._randomPointUnitSphere(direction) : position.cloneTo(direction);
        }, __proto.cloneTo = function(destObject) {
            _super.prototype.cloneTo.call(this, destObject);
            var destShape = destObject;
            destShape.radius = this.radius, destShape.arc = this.arc, destShape.emitFromEdge = this.emitFromEdge, 
            destShape.randomDirection = this.randomDirection;
        }, __static(CircleShape, [ "_tempPositionPoint", function() {
            return this._tempPositionPoint = new Vector2();
        } ]);
    }(BaseShape), function(_super) {
        function ConeShape() {
            this.angle = NaN, this.radius = NaN, this.length = NaN, this.emitType = 0, ConeShape.__super.call(this), 
            this.angle = 25 / 180 * Math.PI, this.radius = 1, this.length = 5, this.emitType = 0, 
            this.randomDirection = !1;
        }
        __class(ConeShape, "laya.d3.core.particleShuriKen.module.shape.ConeShape", _super);
        var __proto = ConeShape.prototype;
        __proto._getShapeBoundBox = function(boundBox) {
            var coneRadius2 = this.radius + this.length * Math.sin(this.angle), coneLength = this.length * Math.cos(this.angle), minE = boundBox.min.elements;
            minE[0] = minE[1] = -coneRadius2, minE[2] = 0;
            var maxE = boundBox.max.elements;
            maxE[0] = maxE[1] = coneRadius2, maxE[2] = coneLength;
        }, __proto._getSpeedBoundBox = function(boundBox) {
            var sinA = Math.sin(this.angle), minE = boundBox.min.elements;
            minE[0] = minE[1] = -sinA, minE[2] = 0;
            var maxE = boundBox.max.elements;
            maxE[0] = minE[1] = sinA, maxE[2] = 1;
        }, __proto.generatePositionAndDirection = function(position, direction, rand, randomSeeds) {
            var directionPointE, rpE = position.elements, rdE = direction.elements, positionPointE = ConeShape._tempPositionPoint.elements, positionX = NaN, positionY = NaN, dirCosA = Math.cos(this.angle), dirSinA = Math.sin(this.angle);
            switch (this.emitType) {
              case 0:
                rand ? (rand.seed = randomSeeds[16], ShapeUtils._randomPointInsideUnitCircle(ConeShape._tempPositionPoint, rand), 
                randomSeeds[16] = rand.seed) : ShapeUtils._randomPointInsideUnitCircle(ConeShape._tempPositionPoint), 
                positionX = positionPointE[0], positionY = positionPointE[1], rpE[0] = positionX * this.radius, 
                rpE[1] = positionY * this.radius, rpE[2] = 0, this.randomDirection ? (rand ? (rand.seed = randomSeeds[17], 
                ShapeUtils._randomPointInsideUnitCircle(ConeShape._tempDirectionPoint, rand), randomSeeds[17] = rand.seed) : ShapeUtils._randomPointInsideUnitCircle(ConeShape._tempDirectionPoint), 
                directionPointE = ConeShape._tempDirectionPoint.elements, rdE[0] = directionPointE[0] * dirSinA, 
                rdE[1] = directionPointE[1] * dirSinA) : (rdE[0] = positionX * dirSinA, rdE[1] = positionY * dirSinA), 
                rdE[2] = dirCosA;
                break;

              case 1:
                rand ? (rand.seed = randomSeeds[16], ShapeUtils._randomPointUnitCircle(ConeShape._tempPositionPoint, rand), 
                randomSeeds[16] = rand.seed) : ShapeUtils._randomPointUnitCircle(ConeShape._tempPositionPoint), 
                positionX = positionPointE[0], positionY = positionPointE[1], rpE[0] = positionX * this.radius, 
                rpE[1] = positionY * this.radius, rpE[2] = 0, this.randomDirection ? (rand ? (rand.seed = randomSeeds[17], 
                ShapeUtils._randomPointInsideUnitCircle(ConeShape._tempDirectionPoint, rand), randomSeeds[17] = rand.seed) : ShapeUtils._randomPointInsideUnitCircle(ConeShape._tempDirectionPoint), 
                directionPointE = ConeShape._tempDirectionPoint.elements, rdE[0] = directionPointE[0] * dirSinA, 
                rdE[1] = directionPointE[1] * dirSinA) : (rdE[0] = positionX * dirSinA, rdE[1] = positionY * dirSinA), 
                rdE[2] = dirCosA;
                break;

              case 2:
                rand ? (rand.seed = randomSeeds[16], ShapeUtils._randomPointInsideUnitCircle(ConeShape._tempPositionPoint, rand)) : ShapeUtils._randomPointInsideUnitCircle(ConeShape._tempPositionPoint), 
                positionX = positionPointE[0], positionY = positionPointE[1], rpE[0] = positionX * this.radius, 
                rpE[1] = positionY * this.radius, rdE[rpE[2] = 0] = positionX * dirSinA, rdE[1] = positionY * dirSinA, 
                rdE[2] = dirCosA, Vector3.normalize(direction, direction), rand ? (Vector3.scale(direction, this.length * rand.getFloat(), direction), 
                randomSeeds[16] = rand.seed) : Vector3.scale(direction, this.length * Math.random(), direction), 
                Vector3.add(position, direction, position), this.randomDirection && (rand ? (rand.seed = randomSeeds[17], 
                ShapeUtils._randomPointUnitSphere(direction, rand), randomSeeds[17] = rand.seed) : ShapeUtils._randomPointUnitSphere(direction));
                break;

              case 3:
                rand ? (rand.seed = randomSeeds[16], ShapeUtils._randomPointUnitCircle(ConeShape._tempPositionPoint, rand)) : ShapeUtils._randomPointUnitCircle(ConeShape._tempPositionPoint), 
                positionX = positionPointE[0], positionY = positionPointE[1], rpE[0] = positionX * this.radius, 
                rpE[1] = positionY * this.radius, rdE[rpE[2] = 0] = positionX * dirSinA, rdE[1] = positionY * dirSinA, 
                rdE[2] = dirCosA, Vector3.normalize(direction, direction), rand ? (Vector3.scale(direction, this.length * rand.getFloat(), direction), 
                randomSeeds[16] = rand.seed) : Vector3.scale(direction, this.length * Math.random(), direction), 
                Vector3.add(position, direction, position), this.randomDirection && (rand ? (rand.seed = randomSeeds[17], 
                ShapeUtils._randomPointUnitSphere(direction, rand), randomSeeds[17] = rand.seed) : ShapeUtils._randomPointUnitSphere(direction));
                break;

              default:
                throw new Error("ConeShape:emitType is invalid.");
            }
        }, __proto.cloneTo = function(destObject) {
            _super.prototype.cloneTo.call(this, destObject);
            var destShape = destObject;
            destShape.angle = this.angle, destShape.radius = this.radius, destShape.length = this.length, 
            destShape.emitType = this.emitType, destShape.randomDirection = this.randomDirection;
        }, __static(ConeShape, [ "_tempPositionPoint", function() {
            return this._tempPositionPoint = new Vector2();
        }, "_tempDirectionPoint", function() {
            return this._tempDirectionPoint = new Vector2();
        } ]);
    }(BaseShape), function(_super) {
        function HemisphereShape() {
            this.radius = NaN, this.emitFromShell = !1, HemisphereShape.__super.call(this), 
            this.radius = 1, this.emitFromShell = !1, this.randomDirection = !1;
        }
        __class(HemisphereShape, "laya.d3.core.particleShuriKen.module.shape.HemisphereShape", _super);
        var __proto = HemisphereShape.prototype;
        __proto._getShapeBoundBox = function(boundBox) {
            var minE = boundBox.min.elements;
            minE[0] = minE[1] = minE[2] = -this.radius;
            var maxE = boundBox.max.elements;
            maxE[0] = maxE[1] = this.radius, maxE[2] = 0;
        }, __proto._getSpeedBoundBox = function(boundBox) {
            var minE = boundBox.min.elements;
            minE[0] = minE[1] = -1, minE[2] = 0;
            var maxE = boundBox.max.elements;
            maxE[0] = maxE[1] = maxE[2] = 1;
        }, __proto.generatePositionAndDirection = function(position, direction, rand, randomSeeds) {
            var rpE = position.elements;
            rand ? (rand.seed = randomSeeds[16], this.emitFromShell ? ShapeUtils._randomPointUnitSphere(position, rand) : ShapeUtils._randomPointInsideUnitSphere(position, rand), 
            randomSeeds[16] = rand.seed) : this.emitFromShell ? ShapeUtils._randomPointUnitSphere(position) : ShapeUtils._randomPointInsideUnitSphere(position), 
            Vector3.scale(position, this.radius, position);
            var z = rpE[2];
            z < 0 && (rpE[2] = -1 * z), this.randomDirection ? rand ? (rand.seed = randomSeeds[17], 
            ShapeUtils._randomPointUnitSphere(direction, rand), randomSeeds[17] = rand.seed) : ShapeUtils._randomPointUnitSphere(direction) : position.cloneTo(direction);
        }, __proto.cloneTo = function(destObject) {
            _super.prototype.cloneTo.call(this, destObject);
            var destShape = destObject;
            destShape.radius = this.radius, destShape.emitFromShell = this.emitFromShell, destShape.randomDirection = this.randomDirection;
        };
    }(BaseShape), function(_super) {
        function SphereShape() {
            this.radius = NaN, this.emitFromShell = !1, SphereShape.__super.call(this), this.radius = 1, 
            this.emitFromShell = !1, this.randomDirection = !1;
        }
        __class(SphereShape, "laya.d3.core.particleShuriKen.module.shape.SphereShape", _super);
        var __proto = SphereShape.prototype;
        __proto._getShapeBoundBox = function(boundBox) {
            var minE = boundBox.min.elements;
            minE[0] = minE[1] = minE[2] = -this.radius;
            var maxE = boundBox.max.elements;
            maxE[0] = maxE[1] = maxE[2] = this.radius;
        }, __proto._getSpeedBoundBox = function(boundBox) {
            var minE = boundBox.min.elements;
            minE[0] = minE[1] = minE[2] = -1;
            var maxE = boundBox.max.elements;
            maxE[0] = maxE[1] = maxE[2] = 1;
        }, __proto.generatePositionAndDirection = function(position, direction, rand, randomSeeds) {
            rand ? (rand.seed = randomSeeds[16], this.emitFromShell ? ShapeUtils._randomPointUnitSphere(position, rand) : ShapeUtils._randomPointInsideUnitSphere(position, rand), 
            randomSeeds[16] = rand.seed) : this.emitFromShell ? ShapeUtils._randomPointUnitSphere(position) : ShapeUtils._randomPointInsideUnitSphere(position), 
            Vector3.scale(position, this.radius, position), this.randomDirection ? rand ? (rand.seed = randomSeeds[17], 
            ShapeUtils._randomPointUnitSphere(direction, rand), randomSeeds[17] = rand.seed) : ShapeUtils._randomPointUnitSphere(direction) : position.cloneTo(direction);
        }, __proto.cloneTo = function(destObject) {
            _super.prototype.cloneTo.call(this, destObject);
            var destShape = destObject;
            destShape.radius = this.radius, destShape.emitFromShell = this.emitFromShell, destShape.randomDirection = this.randomDirection;
        };
    }(BaseShape), function(_super) {
        function SubMeshRenderElement() {
            this._batchIndexStart = 0, this._batchIndexEnd = 0, this._skinAnimationDatas = null, 
            SubMeshRenderElement.__super.call(this);
        }
        return __class(SubMeshRenderElement, "laya.d3.core.render.SubMeshRenderElement", RenderElement), 
        SubMeshRenderElement;
    }()), ShaderCompile3D = function(_super) {
        function ShaderCompile3D(name, vs, ps, attributeMap, uniformMap, includeFiles) {
            this._name = NaN, this._attributeMap = null, this._renderElementUniformMap = null, 
            this._materialUniformMap = null, this._spriteUniformMap = null, this._cameraUniformMap = null, 
            this._sceneUniformMap = null, this.sharders = null, this._spriteDefineCounter = 3, 
            this._spriteInt2name = [], this._spriteName2Int = {}, this._materialDefineCounter = 1, 
            this._materialInt2name = [], this._materialName2Int = {}, this._conchShader = null, 
            this._name = name, this._renderElementUniformMap = {}, this._materialUniformMap = {}, 
            this._spriteUniformMap = {}, this._cameraUniformMap = {}, this._sceneUniformMap = {}, 
            this.sharders = [], this._spriteInt2name[ParallelSplitShadowMap.SHADERDEFINE_RECEIVE_SHADOW] = "RECEIVESHADOW", 
            this._spriteInt2name[RenderableSprite3D.SHADERDEFINE_SCALEOFFSETLIGHTINGMAPUV] = "SCALEOFFSETLIGHTINGMAPUV", 
            this._spriteInt2name[RenderableSprite3D.SAHDERDEFINE_LIGHTMAP] = "LIGHTMAP", this._spriteInt2name[0] = "BONE", 
            this._materialInt2name[BaseMaterial.SHADERDEFINE_ALPHATEST] = "ALPHATEST";
            ShaderCompile3D.__super.call(this, name, vs, ps, null, {}), this._attributeMap = attributeMap;
            var key;
            for (key in uniformMap) {
                var uniformParam = uniformMap[key];
                switch (uniformParam[1]) {
                  case 0:
                    this._renderElementUniformMap[key] = uniformParam[0];
                    break;

                  case 1:
                    this._materialUniformMap[key] = uniformParam[0];
                    break;

                  case 2:
                    this._spriteUniformMap[key] = uniformParam[0];
                    break;

                  case 3:
                    this._cameraUniformMap[key] = uniformParam[0];
                    break;

                  case 4:
                    this._sceneUniformMap[key] = uniformParam[0];
                    break;

                  default:
                    throw new Error("ShaderCompile3D: period is unkonw.");
                }
            }
        }
        __class(ShaderCompile3D, "laya.d3.shader.ShaderCompile3D", ShaderCompile);
        var __proto = ShaderCompile3D.prototype;
        return __proto._definesToNameDic = function(value, int2Name) {
            for (var o = {}, d = 1, i = 0; i < 32 && !(value < (d = 1 << i)); i++) if (value & d) {
                var name = int2Name[d];
                name && (o[name] = "");
            }
            return o;
        }, __proto.withCompile = function(publicDefine, spriteDefine, materialDefine) {
            var shader, spriteDefShaders, materialDefShaders;
            if (spriteDefShaders = this.sharders[publicDefine]) if (materialDefShaders = spriteDefShaders[spriteDefine]) {
                if (shader = materialDefShaders[materialDefine]) return shader;
            } else materialDefShaders = spriteDefShaders[spriteDefine] = []; else materialDefShaders = (spriteDefShaders = this.sharders[publicDefine] = [])[spriteDefine] = [];
            var key, publicDefGroup = this._definesToNameDic(publicDefine, ShaderCompile3D._globalInt2name), spriteDefGroup = this._definesToNameDic(spriteDefine, this._spriteInt2name), materialDefGroup = this._definesToNameDic(materialDefine, this._materialInt2name);
            laya.d3.shader.ShaderCompile3D.debugMode && "custom_particle_shader" == Shader3D.nameKey.getName(this._name) && console.log("shaderCompile.precompileShaderWithShaderDefine(", publicDefine, ",", spriteDefine, ",", materialDefine, ")");
            var defMap = {}, defineStr = "";
            if (publicDefGroup) for (key in publicDefGroup) defineStr += "#define " + key + "\n", 
            defMap[key] = !0;
            if (spriteDefGroup) for (key in spriteDefGroup) defineStr += "#define " + key + "\n", 
            defMap[key] = !0;
            if (materialDefGroup) for (key in materialDefGroup) defineStr += "#define " + key + "\n", 
            defMap[key] = !0;
            var vs = this._VS.toscript(defMap, []), ps = this._PS.toscript(defMap, []);
            return shader = Shader3D.create(defineStr + vs.join("\n"), defineStr + ps.join("\n"), this._attributeMap, this._sceneUniformMap, this._cameraUniformMap, this._spriteUniformMap, this._materialUniformMap, this._renderElementUniformMap), 
            materialDefShaders[materialDefine] = shader;
        }, __proto.precompileShaderWithShaderDefine = function(publicDefine, spriteDefine, materialDefine) {
            this.withCompile(publicDefine, spriteDefine, materialDefine);
        }, __proto.addMaterialDefines = function(shaderdefines) {
            var defines = shaderdefines.defines;
            for (var k in defines) {
                var name = defines[k], i = parseInt(k);
                this._materialInt2name[i] = name, this._materialName2Int[name] = i;
            }
        }, __proto.addSpriteDefines = function(shaderdefines) {
            var defines = shaderdefines.defines;
            for (var k in defines) {
                var name = defines[k], i = parseInt(k);
                this._spriteInt2name[i] = name, this._spriteName2Int[name] = i;
            }
        }, __proto.getMaterialDefineByName = function(name) {
            return this._materialName2Int[name];
        }, __proto.registerMaterialDefine = function(name) {
            var value = Math.pow(2, this._materialDefineCounter++);
            return this._materialInt2name[value] = name, this._materialName2Int[name] = value;
        }, __proto.registerSpriteDefine = function(name) {
            var value = Math.pow(2, this._spriteDefineCounter++);
            return this._spriteInt2name[value] = name, this._spriteName2Int[name] = value;
        }, ShaderCompile3D._globalRegDefine = function(name, value) {
            ShaderCompile3D._globalInt2name[value] = name;
        }, ShaderCompile3D.add = function(nameID, vs, ps, attributeMap, uniformMap) {
            return laya.d3.shader.ShaderCompile3D._preCompileShader[nameID] = new ShaderCompile3D(nameID, vs, ps, attributeMap, uniformMap, ShaderCompile.includes);
        }, ShaderCompile3D.get = function(name) {
            return laya.d3.shader.ShaderCompile3D._preCompileShader[Shader3D.nameKey.getID(name)];
        }, ShaderCompile3D._preCompileShader = {}, ShaderCompile3D._globalInt2name = [], 
        ShaderCompile3D.debugMode = !1, ShaderCompile3D.SHADERDEFINE_HIGHPRECISION = 1, 
        ShaderCompile3D.SHADERDEFINE_FOG = 4, ShaderCompile3D.SHADERDEFINE_DIRECTIONLIGHT = 8, 
        ShaderCompile3D.SHADERDEFINE_POINTLIGHT = 16, ShaderCompile3D.SHADERDEFINE_SPOTLIGHT = 32, 
        ShaderCompile3D.SHADERDEFINE_UV0 = 64, ShaderCompile3D.SHADERDEFINE_COLOR = 128, 
        ShaderCompile3D.SHADERDEFINE_UV1 = 256, ShaderCompile3D.SAHDERDEFINE_DEPTHFOG = 131072, 
        ShaderCompile3D;
    }(), MeshSprite3DStaticBatchManager = function(_super) {
        function MeshSprite3DStaticBatchManager() {
            MeshSprite3DStaticBatchManager.__super.call(this);
        }
        __class(MeshSprite3DStaticBatchManager, "laya.d3.graphics.MeshSprite3DStaticBatchManager", StaticBatchManager);
        var __proto = MeshSprite3DStaticBatchManager.prototype;
        return __proto._getStaticBatch = function(rootOwner, vertexDeclaration, material, number) {
            var staticBatch, key;
            return key = rootOwner ? rootOwner.id.toString() + material.id.toString() + vertexDeclaration.id.toString() + number.toString() : material.id.toString() + vertexDeclaration.id.toString() + number.toString(), 
            this._staticBatches[key] ? staticBatch = this._staticBatches[key] : this._staticBatches[key] = staticBatch = new SubMeshStaticBatch(key, this, rootOwner, vertexDeclaration, material), 
            staticBatch;
        }, __proto._initStaticBatchs = function(rootOwner) {
            var lastMaterial, lastVertexDeclaration;
            this._initBatchRenderElements.sort(MeshSprite3DStaticBatchManager._sortPrepareStaticBatch);
            for (var curStaticBatch, lastCanMerage = !1, batchNumber = 0, i = 0, n = this._initBatchRenderElements.length; i < n; i++) {
                var oldStaticBatch, renderElement = this._initBatchRenderElements[i], vb = renderElement.renderObj._getVertexBuffer(0);
                renderElement._sprite3D;
                if (lastVertexDeclaration === vb.vertexDeclaration && lastMaterial === renderElement._material) if (lastCanMerage) curStaticBatch._addCombineBatchRenderObjTest(renderElement) ? (oldStaticBatch = renderElement._staticBatch) !== curStaticBatch && (oldStaticBatch && oldStaticBatch._deleteCombineBatchRenderObj(renderElement), 
                curStaticBatch._addCombineBatchRenderObj(renderElement)) : (lastCanMerage = !1, 
                batchNumber++); else {
                    var lastRenderObj = this._initBatchRenderElements[i - 1], lastRenderElement = lastRenderObj.renderObj, curRenderElement = renderElement.renderObj;
                    lastCanMerage = !(65535 < lastRenderElement._getVertexBuffer().vertexCount + curRenderElement._getVertexBuffer().vertexCount) && (curStaticBatch = this._getStaticBatch(rootOwner, lastVertexDeclaration, lastMaterial, batchNumber), 
                    (oldStaticBatch = lastRenderObj._staticBatch) !== curStaticBatch && (oldStaticBatch && oldStaticBatch._deleteCombineBatchRenderObj(lastRenderObj), 
                    curStaticBatch._addCombineBatchRenderObj(lastRenderObj)), (oldStaticBatch = renderElement._staticBatch) !== curStaticBatch && (oldStaticBatch && oldStaticBatch._deleteCombineBatchRenderObj(renderElement), 
                    curStaticBatch._addCombineBatchRenderObj(renderElement)), !0);
                } else lastCanMerage = !1, batchNumber = 0;
                lastMaterial = renderElement._material, lastVertexDeclaration = vb.vertexDeclaration;
            }
        }, MeshSprite3DStaticBatchManager._sortPrepareStaticBatch = function(a, b) {
            var aRender = a._render, bRender = b._render, lightMapIndexOffset = aRender.lightmapIndex - bRender.lightmapIndex;
            if (0 != lightMapIndexOffset) return lightMapIndexOffset;
            var receiveShadowValue = aRender.receiveShadow - bRender.receiveShadow;
            if (0 != receiveShadowValue) return receiveShadowValue;
            var mainID = a._mainSortID - b._mainSortID;
            return 0 == mainID ? a.renderObj.triangleCount - b.renderObj.triangleCount : mainID;
        }, MeshSprite3DStaticBatchManager;
    }(), SubMeshStaticBatch = function(_super) {
        function SubMeshStaticBatch(key, manager, rootOwner, vertexDeclaration, material) {
            this._batchOwnerIndices = null, this._batchOwners = null, this._needFinishCombine = !1, 
            this._currentCombineVertexCount = 0, this._currentCombineIndexCount = 0, this._vertexDeclaration = null, 
            this._vertexBuffer = null, this._indexBuffer = null, SubMeshStaticBatch.__super.call(this, key, manager, rootOwner), 
            this._batchOwnerIndices = [], this._batchOwners = [], this._needFinishCombine = !1, 
            this._currentCombineVertexCount = 0, this._currentCombineIndexCount = 0, this._vertexDeclaration = vertexDeclaration, 
            this._material = material;
        }
        __class(SubMeshStaticBatch, "laya.d3.graphics.SubMeshStaticBatch", StaticBatch);
        var __proto = SubMeshStaticBatch.prototype;
        return __proto._compareBatchRenderElement = function(a, b) {
            return a._batchIndexStart > b._batchIndexStart;
        }, __proto._addCombineBatchRenderObjTest = function(renderElement) {
            var subMeshVertexCount = renderElement.renderObj._vertexCount;
            return !(65535 < (0 < subMeshVertexCount ? this._currentCombineVertexCount + subMeshVertexCount : this._currentCombineVertexCount + renderElement.renderObj._getVertexBuffer().vertexCount));
        }, __proto._addCombineBatchRenderObj = function(renderElement) {
            var subMesh = renderElement.renderObj, subMeshVertexCount = subMesh._vertexCount;
            this._initBatchRenderElements.push(renderElement), renderElement._staticBatch = this, 
            0 < subMeshVertexCount ? (this._currentCombineIndexCount += subMesh._indexCount, 
            this._currentCombineVertexCount += subMeshVertexCount) : (this._currentCombineIndexCount = this._currentCombineIndexCount + subMesh._getIndexBuffer().indexCount, 
            this._currentCombineVertexCount = this._currentCombineVertexCount + subMesh._getVertexBuffer().vertexCount), 
            this._needFinishCombine = !0;
        }, __proto._deleteCombineBatchRenderObj = function(renderElement) {
            var subMesh = renderElement.renderObj, index = this._initBatchRenderElements.indexOf(renderElement);
            if (-1 !== index) {
                this._initBatchRenderElements.splice(index, 1), renderElement._staticBatch = null;
                var subMeshVertexCount = subMesh._vertexCount;
                0 < subMeshVertexCount ? (this._currentCombineIndexCount = this._currentCombineIndexCount - subMesh._indexCount, 
                this._currentCombineVertexCount = this._currentCombineVertexCount - subMeshVertexCount) : (this._currentCombineIndexCount = this._currentCombineIndexCount - subMesh._getIndexBuffer().indexCount, 
                this._currentCombineVertexCount = this._currentCombineVertexCount - subMesh._getVertexBuffer().vertexCount), 
                this._needFinishCombine = !0;
            }
        }, __proto._finishInit = function() {
            if (this._needFinishCombine) {
                var curMerVerCount = 0, curIndexCount = 0;
                0 <= this._initBatchRenderElements[0]._sprite3D._render.lightmapIndex ? this._vertexDeclaration = this._getVertexDecLightMap(this._vertexDeclaration) : this._material instanceof laya.d3.core.material.StandardMaterial && this._material.ambientTexture && (this._vertexDeclaration = this._getVertexDecLightMap(this._vertexDeclaration));
                var vertexDatas = new Float32Array(this._vertexDeclaration.vertexStride / 4 * this._currentCombineVertexCount), indexDatas = new Uint16Array(this._currentCombineIndexCount);
                this._vertexBuffer && (this._vertexBuffer.destroy(), this._indexBuffer.destroy()), 
                this._vertexBuffer = VertexBuffer3D.create(this._vertexDeclaration, this._currentCombineVertexCount, 35044), 
                this._indexBuffer = IndexBuffer3D.create("ushort", this._currentCombineIndexCount, 35044);
                for (var i = 0, n = this._initBatchRenderElements.length; i < n; i++) {
                    var renderElement = this._initBatchRenderElements[i], subMesh = renderElement.renderObj, subVertexDatas = subMesh._getStaticBatchBakedVertexs(this._rootOwner ? this._rootOwner._transform : null, renderElement._sprite3D), subIndexDatas = subMesh.getIndices(), isInvert = renderElement._sprite3D.transform._isFrontFaceInvert, indexOffset = curMerVerCount / (this._vertexDeclaration.vertexStride / 4) - subMesh._vertexStart, indexStart = curIndexCount, indexEnd = indexStart + subIndexDatas.length;
                    renderElement._batchIndexStart = indexStart, renderElement._batchIndexEnd = indexEnd, 
                    indexDatas.set(subIndexDatas, curIndexCount);
                    var k = 0;
                    if (isInvert) for (k = indexStart; k < indexEnd; k += 3) {
                        indexDatas[k] = indexOffset + indexDatas[k];
                        var index1 = indexDatas[k + 1], index2 = indexDatas[k + 2];
                        indexDatas[k + 1] = indexOffset + index2, indexDatas[k + 2] = indexOffset + index1;
                    } else for (k = indexStart; k < indexEnd; k += 3) indexDatas[k] = indexOffset + indexDatas[k], 
                    indexDatas[k + 1] = indexOffset + indexDatas[k + 1], indexDatas[k + 2] = indexOffset + indexDatas[k + 2];
                    curIndexCount += subIndexDatas.length, vertexDatas.set(subVertexDatas, curMerVerCount), 
                    curMerVerCount += subVertexDatas.length;
                }
                this._vertexBuffer.setData(vertexDatas), this._indexBuffer.setData(indexDatas), 
                this._needFinishCombine = !1;
            }
        }, __proto._getCombineRenderElementFromPool = function() {
            return this._combineRenderElementPool[this._combineRenderElementPoolIndex++] || (this._combineRenderElementPool[this._combineRenderElementPoolIndex - 1] = new SubMeshRenderElement());
        }, __proto._getRenderElement = function(renderQueueElements, scene, projectionView) {
            for (var lastRenderElement, renderElement, count = this._batchRenderElements.length, canMerge = !0, i = 0; i < count; i++) {
                var lastRender, merageElement, render = (renderElement = this._batchRenderElements[i])._sprite3D._render;
                if (0 !== i && (canMerge = (lastRender = (lastRenderElement = this._batchRenderElements[i - 1])._sprite3D._render).lightmapIndex !== render.lightmapIndex || lastRender.receiveShadow !== render.receiveShadow || lastRenderElement._batchIndexEnd !== renderElement._batchIndexStart), 
                canMerge) {
                    (merageElement = this._getCombineRenderElementFromPool()).renderObj = this, merageElement._material = this._material, 
                    merageElement._batchIndexStart = renderElement._batchIndexStart, merageElement._batchIndexEnd = renderElement._batchIndexEnd;
                    var lightMapIndex = render.lightmapIndex, cacheLightMapIndex = lightMapIndex + 1, lightMapBatchOwnerIndices = this._batchOwnerIndices[cacheLightMapIndex];
                    lightMapBatchOwnerIndices || (lightMapBatchOwnerIndices = this._batchOwnerIndices[cacheLightMapIndex] = []);
                    var batchOwner, batchOwnerIndex = lightMapBatchOwnerIndices[renderElement._render.receiveShadow ? 1 : 0];
                    void 0 === batchOwnerIndex ? (lightMapBatchOwnerIndices[render.receiveShadow ? 1 : 0] = this._batchOwners.length, 
                    (batchOwner = new MeshSprite3D(null, "StaticBatchMeshSprite3D"))._scene = scene, 
                    batchOwner._transform = this._rootOwner ? this._rootOwner._transform : null, batchOwner._render.lightmapIndex = lightMapIndex, 
                    batchOwner._render.receiveShadow = renderElement._render.receiveShadow, this._batchOwners.push(batchOwner)) : batchOwner = this._batchOwners[batchOwnerIndex], 
                    batchOwner._render._renderUpdate(projectionView), merageElement._sprite3D = batchOwner, 
                    renderQueueElements.push(merageElement);
                } else merageElement._batchIndexEnd = renderElement._batchIndexEnd;
            }
        }, __proto._beforeRender = function(state) {
            return this._vertexBuffer._bind(), this._indexBuffer._bind(), !0;
        }, __proto._render = function(state) {
            var renderElement = state.renderElement, batchIndexStart = renderElement._batchIndexStart, indexCount = renderElement._batchIndexEnd - batchIndexStart;
            WebGL.mainContext.drawElements(4, indexCount, 5123, 2 * batchIndexStart), Stat.drawCall++, 
            Stat.trianglesFaces += indexCount / 3;
        }, __proto.dispose = function() {
            this._batchOwnerIndices = null, this._batchOwners = null, this._vertexDeclaration = null, 
            this._vertexBuffer.destroy(), this._indexBuffer.destroy();
        }, __proto._getVertexBuffer = function(index) {
            return void 0 === index && (index = 0), this._vertexBuffer;
        }, SubMeshStaticBatch;
    }(), ComponentNode = function(_super) {
        function ComponentNode() {
            this._componentsMap = null, this._typeComponentsIndices = null, this._components = null, 
            this._scripts = null, ComponentNode.__super.call(this), this._componentsMap = [], 
            this._typeComponentsIndices = [], this._components = [], this._scripts = [];
        }
        __class(ComponentNode, "laya.d3.core.ComponentNode", Node);
        var __proto = ComponentNode.prototype;
        return __proto.addComponent = function(type) {
            var typeComponentIndex, index = this._componentsMap.indexOf(type);
            if (-1 === index) typeComponentIndex = [], this._componentsMap.push(type), this._typeComponentsIndices.push(typeComponentIndex); else if (typeComponentIndex = this._typeComponentsIndices[index], 
            this._components[typeComponentIndex[0]].isSingleton) throw new Error("无法单实例创建" + type + "组件，" + type + "组件已存在！");
            var component = ClassUtils.getInstance(type);
            return typeComponentIndex.push(this._components.length), this._components.push(component), 
            component instanceof laya.d3.component.Script && this._scripts.push(component), 
            component._initialize(this), component;
        }, __proto._removeComponent = function(mapIndex, index) {
            var componentIndices = this._typeComponentsIndices[mapIndex], componentIndex = componentIndices[index], component = this._components[componentIndex];
            this._components.splice(componentIndex, 1), component instanceof laya.d3.component.Script && this._scripts.splice(this._scripts.indexOf(component), 1), 
            componentIndices.splice(index, 1), 0 === componentIndices.length && (this._typeComponentsIndices.splice(mapIndex, 1), 
            this._componentsMap.splice(mapIndex, 1));
            for (var i = 0, n = this._componentsMap.length; i < n; i++) for (var j = (componentIndices = this._typeComponentsIndices[i]).length - 1; 0 <= j; j--) {
                var oldComponentIndex = componentIndices[j];
                if (!(componentIndex < oldComponentIndex)) break;
                componentIndices[j] = --oldComponentIndex;
            }
            component._destroy();
        }, __proto.getComponentByType = function(type, typeIndex) {
            void 0 === typeIndex && (typeIndex = 0);
            var mapIndex = this._componentsMap.indexOf(type);
            return -1 === mapIndex ? null : this._components[this._typeComponentsIndices[mapIndex][typeIndex]];
        }, __proto.getComponentsByType = function(type, components) {
            var index = this._componentsMap.indexOf(type);
            if (-1 !== index) {
                var typeComponents = this._typeComponentsIndices[index], count = typeComponents.length;
                components.length = count;
                for (var i = 0; i < count; i++) components[i] = this._components[typeComponents[i]];
            } else components.length = 0;
        }, __proto.getComponentByIndex = function(index) {
            return this._components[index];
        }, __proto.removeComponentByType = function(type, typeIndex) {
            void 0 === typeIndex && (typeIndex = 0);
            var mapIndex = this._componentsMap.indexOf(type);
            -1 !== mapIndex && this._removeComponent(mapIndex, typeIndex);
        }, __proto.removeComponentsByType = function(type) {
            var mapIndex = this._componentsMap.indexOf(type);
            if (-1 !== mapIndex) for (var componentIndices = this._typeComponentsIndices[mapIndex], i = 0, n = componentIndices.length; i < n; componentIndices.length < n ? n-- : i++) this._removeComponent(mapIndex, i);
        }, __proto.removeAllComponent = function() {
            for (var i = 0, n = this._componentsMap.length; i < n; this._componentsMap.length < n ? n-- : i++) this.removeComponentsByType(this._componentsMap[i]);
        }, __proto._updateComponents = function(state) {
            for (var i = 0, n = this._components.length; i < n; i++) {
                var component = this._components[i];
                !component.started && (component._start(state), component.started = !0), component.enable && component._update(state);
            }
        }, __proto._lateUpdateComponents = function(state) {
            for (var i = 0; i < this._components.length; i++) {
                var component = this._components[i];
                !component.started && (component._start(state), component.started = !0), component.enable && component._lateUpdate(state);
            }
        }, __proto._preRenderUpdateComponents = function(state) {
            for (var i = 0; i < this._components.length; i++) {
                var component = this._components[i];
                !component.started && (component._start(state), component.started = !0), component.enable && component._preRenderUpdate(state);
            }
        }, __proto._postRenderUpdateComponents = function(state) {
            for (var i = 0; i < this._components.length; i++) {
                var component = this._components[i];
                !component.started && (component._start(state), component.started = !0), component.enable && component._postRenderUpdate(state);
            }
        }, ComponentNode;
    }(), BaseMaterial = function(_super) {
        function BaseMaterial() {
            BaseMaterial.__super.call(this), this._shaderDefineValue = 0, this._disablePublicShaderDefine = 0, 
            this._shaderValues = new ValusArray(), this._values = [], this.renderQueue = 2e3, 
            this._alphaTest = !1, this.cull = 2, this.blend = 0, this.srcBlend = 1, this.dstBlend = 0, 
            this.srcBlendRGB = 1, this.dstBlendRGB = 0, this.srcBlendAlpha = 1, this.dstBlendAlpha = 0, 
            this.blendConstColor = new Vector4(1, 1, 1, 1), this.blendEquation = 0, this.blendEquationRGB = 0, 
            this.blendEquationAlpha = 0, this.depthTest = 513, this.depthWrite = !0;
        }
        __class(BaseMaterial, "laya.d3.core.material.BaseMaterial", _super);
        var __proto = BaseMaterial.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.IClone": !0
        }), __proto._addShaderDefine = function(value) {
            this._shaderDefineValue |= value;
        }, __proto._removeShaderDefine = function(value) {
            this._shaderDefineValue &= ~value;
        }, __proto._addDisablePublicShaderDefine = function(value) {
            this._disablePublicShaderDefine |= value;
        }, __proto._removeDisablePublicShaderDefine = function(value) {
            this._disablePublicShaderDefine &= ~value;
        }, __proto._setBuffer = function(shaderIndex, buffer) {
            this._shaderValues.setValue(shaderIndex, buffer), this._values[shaderIndex] = buffer;
        }, __proto._getBuffer = function(shaderIndex) {
            return this._values[shaderIndex];
        }, __proto._setMatrix4x4 = function(shaderIndex, matrix4x4) {
            this._shaderValues.setValue(shaderIndex, matrix4x4 ? matrix4x4.elements : null), 
            this._values[shaderIndex] = matrix4x4;
        }, __proto._getMatrix4x4 = function(shaderIndex) {
            return this._values[shaderIndex];
        }, __proto._setInt = function(shaderIndex, i) {
            this._shaderValues.setValue(shaderIndex, i), this._values[shaderIndex] = i;
        }, __proto._getInt = function(shaderIndex) {
            return this._values[shaderIndex];
        }, __proto._setNumber = function(shaderIndex, number) {
            this._shaderValues.setValue(shaderIndex, number), this._values[shaderIndex] = number;
        }, __proto._getNumber = function(shaderIndex) {
            return this._values[shaderIndex];
        }, __proto._setBool = function(shaderIndex, b) {
            this._shaderValues.setValue(shaderIndex, b), this._values[shaderIndex] = b;
        }, __proto._getBool = function(shaderIndex) {
            return this._values[shaderIndex];
        }, __proto._setVector2 = function(shaderIndex, vector2) {
            this._shaderValues.setValue(shaderIndex, vector2 ? vector2.elements : null), this._values[shaderIndex] = vector2;
        }, __proto._getVector2 = function(shaderIndex) {
            return this._values[shaderIndex];
        }, __proto._setColor = function(shaderIndex, color) {
            this._shaderValues.setValue(shaderIndex, color ? color.elements : null), this._values[shaderIndex] = color;
        }, __proto._getColor = function(shaderIndex) {
            return this._values[shaderIndex];
        }, __proto._setTexture = function(shaderIndex, texture) {
            var lastValue = this._values[shaderIndex];
            this._values[shaderIndex] = texture, this._shaderValues.setValue(shaderIndex, texture), 
            0 < this.referenceCount && (lastValue && lastValue._removeReference(), texture && texture._addReference());
        }, __proto._getTexture = function(shaderIndex) {
            return this._values[shaderIndex];
        }, __proto._upload = function() {
            this._shader.uploadMaterialUniforms(this._shaderValues.data);
        }, __proto._getShader = function(sceneDefineValue, vertexDefineValue, spriteDefineValue) {
            var publicDefineValue = (sceneDefineValue | vertexDefineValue) & ~this._disablePublicShaderDefine;
            return this._shader = this._shaderCompile.withCompile(publicDefineValue, spriteDefineValue, this._shaderDefineValue), 
            this._shader;
        }, __proto._setRenderStateBlendDepth = function() {
            var gl = WebGL.mainContext;
            switch (WebGLContext.setDepthMask(gl, this.depthWrite), 0 === this.depthTest ? WebGLContext.setDepthTest(gl, !1) : (WebGLContext.setDepthTest(gl, !0), 
            WebGLContext.setDepthFunc(gl, this.depthTest)), this.blend) {
              case 0:
                WebGLContext.setBlend(gl, !1);
                break;

              case 1:
                WebGLContext.setBlend(gl, !0), WebGLContext.setBlendFunc(gl, this.srcBlend, this.dstBlend);
                break;

              case 2:
                WebGLContext.setBlend(gl, !0);
            }
        }, __proto._setRenderStateFrontFace = function(isTarget, transform) {
            var gl = WebGL.mainContext, forntFace = 0;
            switch (this.cull) {
              case 0:
                WebGLContext.setCullFace(gl, !1);
                break;

              case 1:
                WebGLContext.setCullFace(gl, !0), forntFace = isTarget ? transform && transform._isFrontFaceInvert ? 2305 : 2304 : transform && transform._isFrontFaceInvert ? 2304 : 2305, 
                WebGLContext.setFrontFace(gl, forntFace);
                break;

              case 2:
                WebGLContext.setCullFace(gl, !0), forntFace = isTarget ? transform && transform._isFrontFaceInvert ? 2304 : 2305 : transform && transform._isFrontFaceInvert ? 2305 : 2304, 
                WebGLContext.setFrontFace(gl, forntFace);
            }
        }, __proto.onAsynLoaded = function(url, data, params) {
            var jsonData = data[0], textureMap = data[1];
            switch (jsonData.version) {
              case "LAYAMATERIAL:01":
                var i = 0, n = 0, props = jsonData.props;
                for (var key in props) switch (key) {
                  case "vectors":
                    var vectors = props[key];
                    for (i = 0, n = vectors.length; i < n; i++) {
                        var vector = vectors[i], vectorValue = vector.value;
                        switch (vectorValue.length) {
                          case 2:
                            this[vector.name] = new Vector2(vectorValue[0], vectorValue[1]);
                            break;

                          case 3:
                            this[vector.name] = new Vector3(vectorValue[0], vectorValue[1], vectorValue[2]);
                            break;

                          case 4:
                            this[vector.name] = new Vector4(vectorValue[0], vectorValue[1], vectorValue[2], vectorValue[3]);
                            break;

                          default:
                            throw new Error("BaseMaterial:unkonwn color length.");
                        }
                    }
                    break;

                  case "textures":
                    var textures = props[key];
                    for (i = 0, n = textures.length; i < n; i++) {
                        var texture = textures[i], path = texture.path;
                        path && (this[texture.name] = Loader.getRes(textureMap[path]));
                    }
                    break;

                  case "defines":
                    var defineNames = props[key];
                    for (i = 0, n = defineNames.length; i < n; i++) {
                        var define = this._shaderCompile.getMaterialDefineByName(defineNames[i]);
                        this._addShaderDefine(define);
                    }
                    break;

                  case "cull":
                  case "blend":
                  case "srcBlend":
                  case "dstBlend":
                  case "depthWrite":
                    this[key] = props[key];
                    break;

                  case "renderQueue":
                    switch (props[key]) {
                      case 1:
                        this.renderQueue = 2e3;
                        break;

                      case 2:
                        this.renderQueue = 3e3;
                    }
                    break;

                  default:
                    this[key] = props[key];
                }
                break;

              case "LAYAMATERIAL:02":
                for (key in props = jsonData.props) switch (key) {
                  case "vectors":
                    for (i = 0, n = (vectors = props[key]).length; i < n; i++) switch ((vectorValue = (vector = vectors[i]).value).length) {
                      case 2:
                        this[vector.name] = new Vector2(vectorValue[0], vectorValue[1]);
                        break;

                      case 3:
                        this[vector.name] = new Vector3(vectorValue[0], vectorValue[1], vectorValue[2]);
                        break;

                      case 4:
                        this[vector.name] = new Vector4(vectorValue[0], vectorValue[1], vectorValue[2], vectorValue[3]);
                        break;

                      default:
                        throw new Error("BaseMaterial:unkonwn color length.");
                    }
                    break;

                  case "textures":
                    for (i = 0, n = (textures = props[key]).length; i < n; i++) (path = (texture = textures[i]).path) && (this[texture.name] = Loader.getRes(textureMap[path]));
                    break;

                  case "defines":
                    for (i = 0, n = (defineNames = props[key]).length; i < n; i++) define = this._shaderCompile.getMaterialDefineByName(defineNames[i]), 
                    this._addShaderDefine(define);
                    break;

                  default:
                    this[key] = props[key];
                }
                break;

              default:
                throw new Error("BaseMaterial:unkonwn version.");
            }
            this._endLoaded();
        }, __proto._addReference = function() {
            _super.prototype._addReference.call(this);
            for (var i = 0, n = this._values.length; i < n; i++) {
                var value = this._values[i];
                value && value instanceof laya.d3.resource.BaseTexture && value._addReference();
            }
        }, __proto._removeReference = function() {
            _super.prototype._removeReference.call(this);
            for (var i = 0, n = this._values.length; i < n; i++) {
                var value = this._values[i];
                value && value instanceof laya.d3.resource.BaseTexture && value._removeReference();
            }
        }, __proto.disposeResource = function() {
            this.blendConstColor = null, this._shader = null, this._shaderValues = null, this._values = null;
        }, __proto.setShaderName = function(name) {
            var nameID = Shader3D.nameKey.getID(name);
            if (-1 === nameID) throw new Error("BaseMaterial: unknown shader name.");
            this._shaderCompile = ShaderCompile3D._preCompileShader[nameID];
        }, __proto.cloneTo = function(destObject) {
            var destBaseMaterial = destObject;
            destBaseMaterial.name = this.name, destBaseMaterial.cull = this.cull, destBaseMaterial.blend = this.blend, 
            destBaseMaterial.srcBlend = this.srcBlend, destBaseMaterial.dstBlend = this.dstBlend, 
            destBaseMaterial.srcBlendRGB = this.srcBlendRGB, destBaseMaterial.dstBlendRGB = this.dstBlendRGB, 
            destBaseMaterial.srcBlendAlpha = this.srcBlendAlpha, destBaseMaterial.dstBlendAlpha = this.dstBlendAlpha, 
            this.blendConstColor.cloneTo(destBaseMaterial.blendConstColor), destBaseMaterial.blendEquation = this.blendEquation, 
            destBaseMaterial.blendEquationRGB = this.blendEquationRGB, destBaseMaterial.blendEquationAlpha = this.blendEquationAlpha, 
            destBaseMaterial.depthTest = this.depthTest, destBaseMaterial.depthWrite = this.depthWrite, 
            destBaseMaterial.renderQueue = this.renderQueue, destBaseMaterial._shader = this._shader, 
            destBaseMaterial._disablePublicShaderDefine = this._disablePublicShaderDefine, destBaseMaterial._shaderDefineValue = this._shaderDefineValue;
            var n, i = 0, destShaderValues = destBaseMaterial._shaderValues;
            destBaseMaterial._shaderValues.data.length = this._shaderValues.data.length;
            var valueCount = this._values.length, destValues = destBaseMaterial._values;
            for (i = 0, n = destValues.length = valueCount; i < n; i++) {
                var value = this._values[i];
                if (value) if ("number" == typeof value) destValues[i] = value, destShaderValues.data[i] = value; else if ("number" == typeof value && Math.floor(value) == value) destValues[i] = value, 
                destShaderValues.data[i] = value; else if ("boolean" == typeof value) destValues[i] = value, 
                destShaderValues.data[i] = value; else if (value instanceof laya.d3.math.Vector2) {
                    var v2 = destValues[i] || (destValues[i] = new Vector2());
                    value.cloneTo(v2), destShaderValues.data[i] = v2.elements;
                } else if (value instanceof laya.d3.math.Vector3) {
                    var v3 = destValues[i] || (destValues[i] = new Vector3());
                    value.cloneTo(v3), destShaderValues.data[i] = v3.elements;
                } else if (value instanceof laya.d3.math.Vector4) {
                    var v4 = destValues[i] || (destValues[i] = new Vector4());
                    value.cloneTo(v4), destShaderValues.data[i] = v4.elements;
                } else if (value instanceof laya.d3.math.Matrix4x4) {
                    var mat = destValues[i] || (destValues[i] = new Matrix4x4());
                    value.cloneTo(mat), destShaderValues.data[i] = mat.elements;
                } else value instanceof laya.d3.resource.BaseTexture && (destValues[i] = value, 
                destShaderValues.data[i] = value);
            }
        }, __proto.clone = function() {
            var destBaseMaterial = new this.constructor();
            return this.cloneTo(destBaseMaterial), destBaseMaterial;
        }, __getset(0, __proto, "alphaTestValue", function() {
            return this._getNumber(0);
        }, function(value) {
            this._setNumber(0, value);
        }), __getset(0, __proto, "alphaTest", function() {
            return this._alphaTest;
        }, function(value) {
            (this._alphaTest = value) ? this._addShaderDefine(laya.d3.core.material.BaseMaterial.SHADERDEFINE_ALPHATEST) : this._removeShaderDefine(laya.d3.core.material.BaseMaterial.SHADERDEFINE_ALPHATEST);
        }), BaseMaterial.__init__ = function() {
            BaseMaterial.SHADERDEFINE_ALPHATEST = BaseMaterial.shaderDefines.registerDefine("ALPHATEST");
        }, BaseMaterial.RENDERQUEUE_OPAQUE = 2e3, BaseMaterial.RENDERQUEUE_ALPHATEST = 2450, 
        BaseMaterial.RENDERQUEUE_TRANSPARENT = 3e3, BaseMaterial.CULL_NONE = 0, BaseMaterial.CULL_FRONT = 1, 
        BaseMaterial.CULL_BACK = 2, BaseMaterial.BLEND_DISABLE = 0, BaseMaterial.BLEND_ENABLE_ALL = 1, 
        BaseMaterial.BLEND_ENABLE_SEPERATE = 2, BaseMaterial.BLENDPARAM_ZERO = 0, BaseMaterial.BLENDPARAM_ONE = 1, 
        BaseMaterial.BLENDPARAM_SRC_COLOR = 768, BaseMaterial.BLENDPARAM_ONE_MINUS_SRC_COLOR = 769, 
        BaseMaterial.BLENDPARAM_DST_COLOR = 774, BaseMaterial.BLENDPARAM_ONE_MINUS_DST_COLOR = 775, 
        BaseMaterial.BLENDPARAM_SRC_ALPHA = 770, BaseMaterial.BLENDPARAM_ONE_MINUS_SRC_ALPHA = 771, 
        BaseMaterial.BLENDPARAM_DST_ALPHA = 772, BaseMaterial.BLENDPARAM_ONE_MINUS_DST_ALPHA = 773, 
        BaseMaterial.BLENDPARAM_SRC_ALPHA_SATURATE = 776, BaseMaterial.BLENDEQUATION_ADD = 0, 
        BaseMaterial.BLENDEQUATION_SUBTRACT = 1, BaseMaterial.BLENDEQUATION_REVERSE_SUBTRACT = 2, 
        BaseMaterial.DEPTHTEST_OFF = 0, BaseMaterial.DEPTHTEST_NEVER = 512, BaseMaterial.DEPTHTEST_LESS = 513, 
        BaseMaterial.DEPTHTEST_EQUAL = 514, BaseMaterial.DEPTHTEST_LEQUAL = 515, BaseMaterial.DEPTHTEST_GREATER = 516, 
        BaseMaterial.DEPTHTEST_NOTEQUAL = 517, BaseMaterial.DEPTHTEST_GEQUAL = 518, BaseMaterial.DEPTHTEST_ALWAYS = 519, 
        BaseMaterial.SHADERDEFINE_ALPHATEST = 1, BaseMaterial.ALPHATESTVALUE = 0, __static(BaseMaterial, [ "shaderDefines", function() {
            return this.shaderDefines = new ShaderDefines$1();
        } ]), BaseMaterial;
    }(Resource), BaseTexture = function(_super) {
        function BaseTexture() {
            this._type = 0, this._width = 0, this._height = 0, this._size = null, this._repeat = !1, 
            this._mipmap = !1, this._minFifter = 0, this._magFifter = 0, this._format = 0, this._source = null, 
            this._conchTexture = null, this._wrapModeU = 0, this._wrapModeV = 0, BaseTexture.__super.call(this), 
            this._repeat = !0, this.mipmap = !0, this.minFifter = -1, this.magFifter = -1;
        }
        __class(BaseTexture, "laya.d3.resource.BaseTexture", Resource);
        var __proto = BaseTexture.prototype;
        return __getset(0, __proto, "width", function() {
            return this._width;
        }), __getset(0, __proto, "repeat", function() {
            return this._repeat;
        }, function(value) {
            if (this._repeat !== value && (this._repeat = value, this._source)) {
                var gl = WebGL.mainContext;
                WebGLContext.bindTexture(gl, this._type, this._source), Arith.isPOT(this._width, this._height) && this._repeat ? (gl.texParameteri(this._type, 10242, 10497), 
                gl.texParameteri(this._type, 10243, 10497)) : (gl.texParameteri(this._type, 10242, 33071), 
                gl.texParameteri(this._type, 10243, 33071));
            }
        }), __getset(0, __proto, "height", function() {
            return this._height;
        }), __getset(0, __proto, "magFifter", function() {
            return this._magFifter;
        }, function(value) {
            (this._magFifter = value) != this._magFifter && this._conchTexture && this._conchTexture.setMaxFifter(value);
        }), __getset(0, __proto, "wrapModeV", function() {
            return this._wrapModeV;
        }), __getset(0, __proto, "size", function() {
            return this._size;
        }), __getset(0, __proto, "wrapModeU", function() {
            return this._wrapModeU;
        }), __getset(0, __proto, "mipmap", function() {
            return this._mipmap;
        }, function(value) {
            this._mipmap = value, this._mipmap != value && this._conchTexture && this._conchTexture.setMipMap(value);
        }), __getset(0, __proto, "minFifter", function() {
            return this._minFifter;
        }, function(value) {
            this._minFifter = value, this._minFifter != value && this._conchTexture && this._conchTexture.setMinFifter(value);
        }), __getset(0, __proto, "format", function() {
            return this._format;
        }), __getset(0, __proto, "source", function() {
            return this.activeResource(), this._source;
        }), __getset(0, __proto, "defaulteTexture", function() {
            return SolidColorTexture2D.grayTexture;
        }), BaseTexture.WARPMODE_REPEAT = 0, BaseTexture.WARPMODE_CLAMP = 1, BaseTexture;
    }(), BaseMesh = function(_super) {
        function BaseMesh() {
            this._subMeshCount = 0, this._boundingBox = null, this._boundingSphere = null, this._boundingBoxCorners = null, 
            this._positions = null, BaseMesh.__super.call(this), this._boundingBoxCorners = __newvec(8, null);
        }
        __class(BaseMesh, "laya.d3.resource.models.BaseMesh", Resource);
        var __proto = BaseMesh.prototype;
        return __proto._getPositions = function() {
            throw new Error("未Override,请重载该属性！");
        }, __proto._generateBoundingObject = function() {
            this._boundingSphere = new BoundSphere(new Vector3(), 0), BoundSphere.createfromPoints(this._positions, this._boundingSphere), 
            this._boundingBox = new BoundBox(new Vector3(), new Vector3()), BoundBox.createfromPoints(this._positions, this._boundingBox), 
            this._boundingBox.getCorners(this._boundingBoxCorners);
        }, __proto.getRenderElementsCount = function() {
            throw new Error("未Override,请重载该属性！");
        }, __proto.getRenderElement = function(index) {
            throw new Error("未Override,请重载该属性！");
        }, __getset(0, __proto, "subMeshCount", function() {
            return this._subMeshCount;
        }), __getset(0, __proto, "boundingBox", function() {
            return this._boundingBox;
        }), __getset(0, __proto, "boundingBoxCorners", function() {
            return this._boundingBoxCorners;
        }), __getset(0, __proto, "boundingSphere", function() {
            return this._boundingSphere;
        }), BaseMesh;
    }(), MeshFilter = (function(_super) {
        function Script() {
            Script.__super.call(this);
        }
        __class(Script, "laya.d3.component.Script", Component3D);
        var __proto = Script.prototype;
        __proto.onTriggerEnter = function(other) {}, __proto.onTriggerExit = function(other) {}, 
        __proto.onTriggerStay = function(other) {}, __getset(0, __proto, "isSingleton", function() {
            return Script._isSingleton;
        }), Script._isSingleton = !1;
    }(), function(_super) {
        function MeshFilter(owner) {
            this._owner = null, this._sharedMesh = null, MeshFilter.__super.call(this), this._owner = owner;
        }
        __class(MeshFilter, "laya.d3.core.MeshFilter", _super);
        var __proto = MeshFilter.prototype;
        return __proto._sharedMeshLoaded = function() {
            this.event("loaded");
        }, __proto._destroy = function() {
            _super.prototype._destroy.call(this), this._owner = null, this._sharedMesh && (this._sharedMesh._removeReference(), 
            this._sharedMesh = null);
        }, __getset(0, __proto, "sharedMesh", function() {
            return this._sharedMesh;
        }, function(value) {
            var lastValue = this._sharedMesh;
            lastValue && lastValue._removeReference(), (this._sharedMesh = value)._addReference(), 
            this.event("meshchanged", [ this, lastValue, value ]), value.loaded || this._sharedMesh.once("loaded", this, this._sharedMeshLoaded);
        }), __getset(0, __proto, "_isAsyncLoaded", function() {
            return this._sharedMesh.loaded;
        }), __getset(0, __proto, "_originalBoundingBoxCorners", function() {
            return this._sharedMesh.boundingBoxCorners;
        }), __getset(0, __proto, "_originalBoundingSphere", function() {
            return this._sharedMesh.boundingSphere;
        }), __getset(0, __proto, "_originalBoundingBox", function() {
            return this._sharedMesh.boundingBox;
        }), MeshFilter;
    }(GeometryFilter)), MeshRender = function(_super) {
        function MeshRender(owner) {
            MeshRender.__super.call(this, owner), owner.meshFilter.on("meshchanged", this, this._onMeshChanged);
        }
        __class(MeshRender, "laya.d3.core.MeshRender", BaseRender);
        var __proto = MeshRender.prototype;
        return __proto._onMeshChanged = function(meshFilter, oldMesh, mesh) {
            mesh.loaded ? this._boundingSphereNeedChange = this._boundingBoxNeedChange = this._boundingBoxCenterNeedChange = this._octreeNodeNeedChange = !0 : mesh.once("loaded", this, this._onMeshLoaed);
        }, __proto._onMeshLoaed = function(sender, enable) {
            this._boundingSphereNeedChange = this._boundingBoxNeedChange = this._boundingBoxCenterNeedChange = this._octreeNodeNeedChange = !0;
        }, __proto._calculateBoundingSphereByInitSphere = function(boundSphere) {
            var maxScale = NaN, transform = this._owner.transform, scaleE = transform.scale.elements, scaleX = Math.abs(scaleE[0]), scaleY = Math.abs(scaleE[1]), scaleZ = Math.abs(scaleE[2]);
            maxScale = scaleY <= scaleX && scaleZ <= scaleX ? scaleX : scaleZ <= scaleY ? scaleY : scaleZ, 
            Vector3.transformCoordinate(boundSphere.center, transform.worldMatrix, this._boundingSphere.center), 
            this._boundingSphere.radius = boundSphere.radius * maxScale;
        }, __proto._calculateBoundBoxByInitCorners = function(corners) {
            for (var worldMat = this._owner.transform.worldMatrix, i = 0; i < 8; i++) Vector3.transformCoordinate(corners[i], worldMat, BaseRender._tempBoundBoxCorners[i]);
            BoundBox.createfromPoints(BaseRender._tempBoundBoxCorners, this._boundingBox);
        }, __proto._calculateBoundingSphere = function() {
            var sharedMesh = this._owner.meshFilter.sharedMesh;
            null == sharedMesh || null == sharedMesh.boundingSphere ? this._boundingSphere.toDefault() : this._calculateBoundingSphereByInitSphere(sharedMesh.boundingSphere);
        }, __proto._calculateBoundingBox = function() {
            var sharedMesh = this._owner.meshFilter.sharedMesh;
            null == sharedMesh || null == sharedMesh.boundingBox ? this._boundingBox.toDefault() : this._calculateBoundBoxByInitCorners(sharedMesh.boundingBoxCorners);
        }, __proto._renderUpdate = function(projectionView) {
            var transform = this._owner.transform;
            if (transform) {
                this._setShaderValueMatrix4x4(0, transform.worldMatrix);
                var projViewWorld = this._owner.getProjectionViewWorldMatrix(projectionView);
                this._setShaderValueMatrix4x4(1, projViewWorld);
            } else this._setShaderValueMatrix4x4(0, Matrix4x4.DEFAULT), this._setShaderValueMatrix4x4(1, projectionView);
            return Laya3D.debugMode && this._renderRenderableBoundBox(), !0;
        }, MeshRender;
    }(), Scene = function(_super) {
        function Scene() {
            this._time = 0, this._enableLightCount = 3, this._customRenderQueneIndex = 11, this.enableLight = !0, 
            Scene.__super.call(this), this._renderState = new RenderState(), this._lights = [], 
            this._quenes = [], this._cameraPool = [], this._renderableSprite3Ds = [], this.__loaded = !0, 
            this._lightmaps = [], this._shaderValues = new ValusArray(), this.parallelSplitShadowMaps = [], 
            this._dynamicBatchManager = new DynamicBatchManager(), this._cullingRenders = [], 
            this._cullingRendersLength = 0, this.enableFog = !1, this.fogStart = 300, this.fogRange = 1e3, 
            this.fogColor = new Vector3(.7, .7, .7), this.ambientColor = new Vector3(.212, .227, .259), 
            WebGL.shaderHighPrecision && this.addShaderDefine(ShaderCompile3D.SHADERDEFINE_HIGHPRECISION), 
            this.on("display", this, this._display), this.on("undisplay", this, this._unDisplay), 
            this._componentsMap = [], this._typeComponentsIndices = [], this._components = [];
        }
        __class(Scene, "laya.d3.core.scene.Scene", _super);
        var __proto = Scene.prototype;
        return Laya.imps(__proto, {
            "laya.webgl.submit.ISubmit": !0,
            "laya.resource.ICreateResource": !0
        }), __proto._setUrl = function(url) {
            this._url = url;
        }, __proto._getGroup = function() {
            return this._group;
        }, __proto._setGroup = function(value) {
            this._group = value;
        }, __proto._display = function() {
            Laya.stage._scenes.push(this), Laya.stage._scenes.sort(Scene._sortScenes);
            for (var i = 0, n = this._childs.length; i < n; i++) {
                var spr = this._childs[i];
                spr.active && spr._activeHierarchy();
            }
        }, __proto._unDisplay = function() {
            var scenes = Laya.stage._scenes;
            scenes.splice(scenes.indexOf(this), 1);
            for (var i = 0, n = this._childs.length; i < n; i++) {
                var spr = this._childs[i];
                spr.active && spr._inActiveHierarchy();
            }
        }, __proto._addChild3D = function(sprite3D) {
            sprite3D.transform._onWorldTransform(), sprite3D._setBelongScene(this), this.displayedInStage && sprite3D.active && sprite3D._activeHierarchy();
        }, __proto._removeChild3D = function(sprite3D) {
            sprite3D.transform.parent = null, this.displayedInStage && sprite3D.active && sprite3D._inActiveHierarchy(), 
            sprite3D._setUnBelongScene();
        }, __proto.initOctree = function(width, height, depth, center, level) {
            void 0 === level && (level = 6), this.treeSize = new Vector3(width, height, depth), 
            this.treeLevel = level, this.treeRoot = new OctreeNode(this, 0), this.treeRoot.init(center, this.treeSize);
        }, __proto._prepareUpdateToRenderState = function(gl, state) {
            state.elapsedTime = this._lastCurrentTime ? this.timer.currTimer - this._lastCurrentTime : 0, 
            this._lastCurrentTime = this.timer.currTimer, state.scene = this;
        }, __proto._prepareSceneToRender = function(state) {
            var lightCount = this._lights.length;
            if (0 < lightCount) for (var renderLightCount = 0, i = 0; i < lightCount && !(this._lights[i]._prepareToScene(state) && ++renderLightCount >= this._enableLightCount); i++) ;
        }, __proto._updateChilds = function(state) {
            for (var i = 0, n = this._childs.length; i < n; ++i) this._childs[i]._update(state);
        }, __proto._preRenderScene = function(gl, state, boundFrustum) {
            var iNum, view = state._viewMatrix, projection = state._projectionMatrix, projectionView = state._projectionViewMatrix, i = 0, camera = state.camera;
            for (camera.useOcclusionCulling ? this.treeRoot ? FrustumCulling.renderObjectCullingOctree(boundFrustum, this, camera, view, projection, projectionView) : FrustumCulling.renderObjectCulling(boundFrustum, this, camera, view, projection, projectionView) : FrustumCulling.renderObjectCullingNoBoundFrustum(this, camera, view, projection, projectionView), 
            i = 0, iNum = this._quenes.length; i < iNum; i++) this._quenes[i] && this._quenes[i]._preRender(state);
        }, __proto._clear = function(gl, state) {
            var viewport = state._viewport, camera = state.camera, vpX = viewport.x, vpY = camera.renderTargetSize.height - viewport.y - viewport.height, vpWidth = viewport.width, vpHeight = viewport.height;
            gl.viewport(vpX, vpY, vpWidth, vpHeight);
            var flag = 256, renderTarget = camera.renderTarget;
            switch (camera.clearFlag) {
              case 0:
                var clearColor = camera.clearColor;
                if (clearColor) {
                    gl.enable(3089), gl.scissor(vpX, vpY, vpWidth, vpHeight);
                    var clearColorE = clearColor.elements;
                    gl.clearColor(clearColorE[0], clearColorE[1], clearColorE[2], clearColorE[3]), flag |= 16384;
                }
                if (renderTarget) switch (clearColor || (flag = 16384), renderTarget.depthStencilFormat) {
                  case 33189:
                    flag |= 256;
                    break;

                  case 36168:
                    flag |= 1024;
                    break;

                  case 34041:
                    flag |= 256, flag |= 1024;
                }
                gl.clear(flag), clearColor && gl.disable(3089);
                break;

              case 1:
              case 2:
                if (renderTarget) switch (flag = 16384, renderTarget.depthStencilFormat) {
                  case 33189:
                    flag |= 256;
                    break;

                  case 36168:
                    flag |= 1024;
                    break;

                  case 34041:
                    flag |= 256, flag |= 1024;
                }
                gl.clear(flag);
                break;

              case 3:
                break;

              default:
                throw new Error("BaseScene:camera clearFlag invalid.");
            }
        }, __proto._renderScene = function(gl, state) {
            var n, queue, camera = state.camera, i = 0;
            for (i = 0; i < 2; i++) (queue = this._quenes[i]) && (camera.renderTarget ? queue._render(state, !0) : queue._render(state, !1));
            if (1 === camera.clearFlag) {
                var sky = camera.sky;
                sky && (WebGLContext.setCullFace(gl, !1), WebGLContext.setDepthFunc(gl, 515), WebGLContext.setDepthMask(gl, !1), 
                sky._render(state), WebGLContext.setDepthFunc(gl, 513), WebGLContext.setDepthMask(gl, !0));
            }
            for (i = 2, n = this._quenes.length; i < n; i++) (queue = this._quenes[i]) && (queue._sortAlpha(state.camera.transform.position), 
            camera.renderTarget ? queue._render(state, !0) : queue._render(state, !1));
        }, __proto._set3DRenderConfig = function(gl) {
            gl.disable(3042), WebGLContext._blend = !1, gl.blendFunc(770, 771), WebGLContext._sFactor = 770, 
            WebGLContext._dFactor = 771, gl.disable(2929), WebGLContext._depthTest = !1, gl.enable(2884), 
            WebGLContext._cullFace = !0, gl.depthMask(1), WebGLContext._depthMask = !0, gl.frontFace(2304), 
            WebGLContext._frontFace = 2304;
        }, __proto._set2DRenderConfig = function(gl) {
            WebGLContext.setBlend(gl, !0), WebGLContext.setBlendFunc(gl, 1, 771), WebGLContext.setDepthTest(gl, !1), 
            WebGLContext.setCullFace(gl, !1), WebGLContext.setDepthMask(gl, !0), WebGLContext.setFrontFace(gl, 2305), 
            gl.viewport(0, 0, RenderState2D.width, RenderState2D.height);
        }, __proto._parseCustomProps = function(rootNode, innerResouMap, customProps, nodeData) {
            var lightMapsData = nodeData.customProps.lightmaps, lightMapCount = lightMapsData.length, lightmaps = this._lightmaps;
            lightmaps.length = lightMapCount;
            for (var i = 0; i < lightMapCount; i++) lightmaps[i] = Loader.getRes(innerResouMap[lightMapsData[i].replace(".exr", ".png")]);
            this.setlightmaps(lightmaps);
            var ambientColorData = nodeData.customProps.ambientColor;
            ambientColorData && (this.ambientColor = new Vector3(ambientColorData[0], ambientColorData[1], ambientColorData[2]));
            var fogColorData = nodeData.customProps.fogColor;
            fogColorData && (this.fogColor = new Vector3(fogColorData[0], fogColorData[1], fogColorData[2]));
        }, __proto._addLight = function(light) {
            this._lights.indexOf(light) < 0 && this._lights.push(light);
        }, __proto._removeLight = function(light) {
            var index = this._lights.indexOf(light);
            0 <= index && this._lights.splice(index, 1);
        }, __proto._updateScene = function() {
            var renderState = this._renderState;
            this._prepareUpdateToRenderState(WebGL.mainContext, renderState), this._updateComponents(renderState), 
            this._updateChilds(renderState), this._lateUpdateComponents(renderState), this._time += renderState.elapsedTime / 1e3, 
            this._shaderValues.setValue(22, this._time);
        }, __proto._updateSceneConch = function() {
            var renderState = this._renderState;
            this._prepareUpdateToRenderState(WebGL.mainContext, renderState), this._updateComponents(renderState), 
            this._lateUpdateComponents(renderState), this._prepareSceneToRender(renderState);
            for (var i = 0, n = this._cameraPool.length; i < n; i++) {
                var camera = this._cameraPool[i];
                (renderState.camera = camera)._prepareCameraToRender();
            }
        }, __proto._preRenderShadow = function(state, lightFrustum, shdowQueues, lightViewProjectMatrix, nPSSMNum) {
            this.treeRoot ? FrustumCulling.renderShadowObjectCullingOctree(this, lightFrustum, shdowQueues, lightViewProjectMatrix, nPSSMNum) : FrustumCulling.renderShadowObjectCulling(this, lightFrustum, shdowQueues, lightViewProjectMatrix, nPSSMNum);
            for (var i = 0, iNum = shdowQueues.length; i < iNum; i++) shdowQueues[i] && shdowQueues[i]._preRender(state);
        }, __proto._renderShadowMap = function(gl, state, sceneCamera) {
            var parallelSplitShadowMap = this.parallelSplitShadowMaps[0];
            parallelSplitShadowMap._calcAllLightCameraInfo(sceneCamera);
            var renderTarget, shadowQuene, lightCamera, pssmNum = parallelSplitShadowMap.PSSMNum;
            if (this._preRenderShadow(state, parallelSplitShadowMap._lightCulling, parallelSplitShadowMap._shadowQuenes, parallelSplitShadowMap._lightVPMatrix[0], pssmNum), 
            this.addShaderDefine(ParallelSplitShadowMap.SHADERDEFINE_CAST_SHADOW), 1 < pssmNum) for (var i = 0; i < pssmNum; i++) renderTarget = parallelSplitShadowMap.getRenderTarget(i + 1), 
            parallelSplitShadowMap.beginRenderTarget(i + 1), gl.clearColor(1, 1, 1, 1), gl.clear(16640), 
            gl.viewport(0, 0, renderTarget.width, renderTarget.height), state.camera = lightCamera = parallelSplitShadowMap.getLightCamera(i), 
            lightCamera._prepareCameraToRender(), lightCamera._prepareCameraViewProject(lightCamera.viewMatrix, lightCamera.projectionMatrix), 
            state._projectionViewMatrix = parallelSplitShadowMap._lightVPMatrix[i + 1], (shadowQuene = parallelSplitShadowMap._shadowQuenes[i])._preRender(state), 
            shadowQuene._renderShadow(state, !1), parallelSplitShadowMap.endRenderTarget(i + 1); else renderTarget = parallelSplitShadowMap.getRenderTarget(1), 
            parallelSplitShadowMap.beginRenderTarget(1), gl.clearColor(1, 1, 1, 1), gl.clear(16640), 
            gl.viewport(0, 0, renderTarget.width, renderTarget.height), state.camera = lightCamera = parallelSplitShadowMap.getLightCamera(0), 
            lightCamera._prepareCameraToRender(), lightCamera._prepareCameraViewProject(lightCamera.viewMatrix, lightCamera.projectionMatrix), 
            state._projectionViewMatrix = parallelSplitShadowMap._lightVPMatrix[0], (shadowQuene = parallelSplitShadowMap._shadowQuenes[0])._preRender(state), 
            shadowQuene._renderShadow(state, !0), parallelSplitShadowMap.endRenderTarget(1);
            this.removeShaderDefine(ParallelSplitShadowMap.SHADERDEFINE_CAST_SHADOW);
        }, __proto.addTreeNode = function(renderObj) {
            this.treeRoot.addTreeNode(renderObj);
        }, __proto.removeTreeNode = function(renderObj) {
            this.treeSize && renderObj._treeNode && renderObj._treeNode.removeObject(renderObj);
        }, __proto.setlightmaps = function(value) {
            this._lightmaps = value;
            for (var i = 0, n = this._renderableSprite3Ds.length; i < n; i++) this._renderableSprite3Ds[i]._render._applyLightMapParams();
        }, __proto.getlightmaps = function() {
            return this._lightmaps;
        }, __proto.addChildAt = function(node, index) {
            if (!(node instanceof laya.d3.core.Sprite3D)) throw new Error("Sprite3D:Node type must Sprite3D.");
            if (!node || this.destroyed || node === this) return node;
            if (node.zOrder && this._set$P("hasZorder", !0), 0 <= index && index <= this._childs.length) {
                if (node._parent === this) {
                    var oldIndex = this.getChildIndex(node);
                    this._childs.splice(oldIndex, 1), this._childs.splice(index, 0, node), this.conchModel && (this.conchModel.removeChild(node.conchModel), 
                    this.conchModel.addChildAt(node.conchModel, index)), this._childChanged();
                } else node.parent && node.parent.removeChild(node), this._childs === Node.ARRAY_EMPTY && (this._childs = []), 
                this._childs.splice(index, 0, node), this.conchModel && this.conchModel.addChildAt(node.conchModel, index), 
                (node.parent = this)._addChild3D(node);
                return node;
            }
            throw new Error("appendChildAt:The index is out of bounds");
        }, __proto.addChild = function(node) {
            if (!(node instanceof laya.d3.core.Sprite3D)) throw new Error("Sprite3D:Node type must Sprite3D.");
            if (!node || this.destroyed || node === this) return node;
            if (node.zOrder && this._set$P("hasZorder", !0), node._parent === this) {
                var index = this.getChildIndex(node);
                index !== this._childs.length - 1 && (this._childs.splice(index, 1), this._childs.push(node), 
                this.conchModel && (this.conchModel.removeChild(node.conchModel), this.conchModel.addChildAt(node.conchModel, this._childs.length - 1)), 
                this._childChanged());
            } else node.parent && node.parent.removeChild(node), this._childs === Node.ARRAY_EMPTY && (this._childs = []), 
            this._childs.push(node), this.conchModel && this.conchModel.addChildAt(node.conchModel, this._childs.length - 1), 
            (node.parent = this)._childChanged(), this._addChild3D(node);
            return node;
        }, __proto.removeChildAt = function(index) {
            var node = this.getChildAt(index);
            return node && (this._removeChild3D(node), this._childs.splice(index, 1), this.conchModel && this.conchModel.removeChild(node.conchModel), 
            node.parent = null), node;
        }, __proto.removeChildren = function(beginIndex, endIndex) {
            if (void 0 === beginIndex && (beginIndex = 0), void 0 === endIndex && (endIndex = 2147483647), 
            this._childs && 0 < this._childs.length) {
                var childs = this._childs;
                if (0 === beginIndex && n <= endIndex) {
                    var arr = childs;
                    this._childs = Node.ARRAY_EMPTY;
                } else arr = childs.splice(beginIndex, endIndex - beginIndex);
                for (var i = 0, n = arr.length; i < n; i++) this._removeChild3D(arr[i]), arr[i].parent = null, 
                this.conchModel && this.conchModel.removeChild(arr[i].conchModel);
            }
            return this;
        }, __proto.addFrustumCullingObject = function(renderObject) {
            this.treeRoot ? this.addTreeNode(renderObject) : (this._cullingRendersLength === this._cullingRenders.length ? this._cullingRenders.push(renderObject) : this._cullingRenders[this._cullingRendersLength] = renderObject, 
            renderObject._indexInSceneFrustumCullingObjects = this._cullingRendersLength++);
        }, __proto.removeFrustumCullingObject = function(renderObject) {
            if (this.treeRoot) this.removeTreeNode(renderObject); else {
                this._cullingRendersLength--;
                var indexInSceneFrustumCullingObjects = renderObject._indexInSceneFrustumCullingObjects;
                if (indexInSceneFrustumCullingObjects !== this._cullingRendersLength) {
                    var endRender = this._cullingRenders[this._cullingRendersLength];
                    (this._cullingRenders[indexInSceneFrustumCullingObjects] = endRender)._indexInSceneFrustumCullingObjects = indexInSceneFrustumCullingObjects, 
                    renderObject._indexInSceneFrustumCullingObjects = -1;
                }
            }
        }, __proto.getRenderQueue = function(index) {
            return index < 3e3 ? this._quenes[1] || (this._quenes[1] = new RenderQueue(this)) : this._quenes[2] || (this._quenes[2] = new RenderQueue(this));
        }, __proto.addRenderQuene = function() {
            this._quenes[this._customRenderQueneIndex++] = new RenderQueue(this);
        }, __proto.addShaderDefine = function(define) {
            this._shaderDefineValue |= define;
        }, __proto.removeShaderDefine = function(define) {
            this._shaderDefineValue &= ~define;
        }, __proto.addScript = function(type) {
            return this._addComponent(type);
        }, __proto.getScriptByType = function(type, typeIndex) {
            return void 0 === typeIndex && (typeIndex = 0), this._getComponentByType(type, typeIndex);
        }, __proto.getScriptsByType = function(type, scripts) {
            this._getComponentsByType(type, scripts);
        }, __proto.getScriptByIndex = function(index) {
            return this._getComponentByIndex(index);
        }, __proto.removeScriptByType = function(type, typeIndex) {
            void 0 === typeIndex && (typeIndex = 0), this._removeComponentByType(type, typeIndex);
        }, __proto.removeScriptsByType = function(type) {
            this._removeComponentByType(type);
        }, __proto.removeAllScript = function() {
            this._removeAllComponent();
        }, __proto.render = function(context, x, y) {
            (Render._context.ctx._renderKey = 0) < this._childs.length && context.addRenderObject(this);
        }, __proto.renderSubmit = function() {
            var gl = WebGL.mainContext, renderState = this._renderState;
            this._set3DRenderConfig(gl), this._prepareSceneToRender(this._renderState);
            var camera, i = 0, n = 0;
            if (Laya3D.debugMode || OctreeNode.debugMode) for (i = 0, n = this._cameraPool.length; i < n; i++) camera = this._cameraPool[i], 
            Laya3D._debugPhasorSprite.begin(1, camera), camera.activeInHierarchy && camera._renderCamera(gl, renderState, this), 
            Laya3D._debugPhasorSprite.end(); else for (i = 0, n = this._cameraPool.length; i < n; i++) (camera = this._cameraPool[i]).activeInHierarchy && camera._renderCamera(gl, renderState, this);
            return this._set2DRenderConfig(gl), 1;
        }, __proto.onAsynLoaded = function(url, data, params) {
            var json = data[0];
            if ("Scene" !== json.type) throw new Error("Scene: the .lh file root type must be Scene,please use other function to  load  this file.");
            var innerResouMap = data[1];
            Utils3D._createNodeByJson(this, json, this, innerResouMap), this.event("hierarchyloaded", [ this ]), 
            this.__loaded = !0;
        }, __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), this.destroyed || (_super.prototype.destroy.call(this, destroyChild), 
            this._renderState = null, this._lights = null, this._lightmaps = null, this._renderTargetTexture = null, 
            this._shaderValues = null, this._cullingRenders = null, this._dynamicBatchManager = null, 
            this._quenes = null, this._cameraPool = null, this._renderableSprite3Ds = null, 
            this.treeRoot = null, this.treeSize = null, this.parallelSplitShadowMaps = null, 
            this._typeComponentsIndices = null, this._components = null, Loader.clearRes(this.url), 
            this.loaded || Laya3D._cancelLoadByUrl(this.url));
        }, __proto.getRenderType = function() {
            return 0;
        }, __proto.releaseRender = function() {}, __proto._addComponent = function(type) {
            var typeComponentIndex, index = this._componentsMap.indexOf(type);
            if (-1 === index) typeComponentIndex = [], this._componentsMap.push(type), this._typeComponentsIndices.push(typeComponentIndex); else if (typeComponentIndex = this._typeComponentsIndices[index], 
            this._components[typeComponentIndex[0]].isSingleton) throw new Error("无法单实例创建" + type + "组件，" + type + "组件已存在！");
            var component = ClassUtils.getInstance(type);
            typeComponentIndex.push(this._components.length), this._components.push(component);
            return component._initialize(this), component;
        }, __proto._removeComponent = function(mapIndex, index) {
            var componentIndices = this._typeComponentsIndices[mapIndex], componentIndex = componentIndices[index], component = this._components[componentIndex];
            this._components.splice(componentIndex, 1), componentIndices.splice(index, 1), 0 === componentIndices.length && (this._typeComponentsIndices.splice(mapIndex, 1), 
            this._componentsMap.splice(mapIndex, 1));
            for (var i = 0, n = this._componentsMap.length; i < n; i++) for (var j = (componentIndices = this._typeComponentsIndices[i]).length - 1; 0 <= j; j--) {
                var oldComponentIndex = componentIndices[j];
                if (!(componentIndex < oldComponentIndex)) break;
                componentIndices[j] = --oldComponentIndex;
            }
            component._destroy();
        }, __proto._getComponentByType = function(type, typeIndex) {
            void 0 === typeIndex && (typeIndex = 0);
            var mapIndex = this._componentsMap.indexOf(type);
            return -1 === mapIndex ? null : this._components[this._typeComponentsIndices[mapIndex][typeIndex]];
        }, __proto._getComponentsByType = function(type, components) {
            var index = this._componentsMap.indexOf(type);
            if (-1 !== index) {
                var typeComponents = this._typeComponentsIndices[index], count = typeComponents.length;
                components.length = count;
                for (var i = 0; i < count; i++) components[i] = this._components[typeComponents[i]];
            } else components.length = 0;
        }, __proto._getComponentByIndex = function(index) {
            return this._components[index];
        }, __proto._removeComponentByType = function(type, typeIndex) {
            void 0 === typeIndex && (typeIndex = 0);
            var mapIndex = this._componentsMap.indexOf(type);
            -1 !== mapIndex && this._removeComponent(mapIndex, typeIndex);
        }, __proto._removeComponentsByType = function(type) {
            var mapIndex = this._componentsMap.indexOf(type);
            if (-1 !== mapIndex) for (var componentIndices = this._typeComponentsIndices[mapIndex], i = 0, n = componentIndices.length; i < n; componentIndices.length < n ? n-- : i++) this._removeComponent(mapIndex, i);
        }, __proto._removeAllComponent = function() {
            for (var i = 0, n = this._componentsMap.length; i < n; this._componentsMap.length < n ? n-- : i++) this._removeComponentsByType(this._componentsMap[i]);
        }, __proto._updateComponents = function(state) {
            for (var i = 0, n = this._components.length; i < n; i++) {
                var component = this._components[i];
                !component.started && (component._start(state), component.started = !0), component.enable && component._update(state);
            }
        }, __proto._lateUpdateComponents = function(state) {
            for (var i = 0; i < this._components.length; i++) {
                var component = this._components[i];
                !component.started && (component._start(state), component.started = !0), component.enable && component._lateUpdate(state);
            }
        }, __proto._preRenderUpdateComponents = function(state) {
            for (var i = 0; i < this._components.length; i++) {
                var component = this._components[i];
                !component.started && (component._start(state), component.started = !0), component.enable && component._preRenderUpdate(state);
            }
        }, __proto._postRenderUpdateComponents = function(state) {
            for (var i = 0; i < this._components.length; i++) {
                var component = this._components[i];
                !component.started && (component._start(state), component.started = !0), component.enable && component._postRenderUpdate(state);
            }
        }, __getset(0, __proto, "_loaded", null, function(value) {
            this.__loaded = value;
        }), __getset(0, __proto, "fogColor", function() {
            return this._fogColor;
        }, function(value) {
            this._fogColor = value, this._shaderValues.setValue(0, value.elements);
        }), __getset(0, __proto, "enableFog", function() {
            return this._enableFog;
        }, function(value) {
            this._enableFog !== value && ((this._enableFog = value) ? (this.addShaderDefine(ShaderCompile3D.SHADERDEFINE_FOG), 
            this.removeShaderDefine(ShaderCompile3D.SAHDERDEFINE_DEPTHFOG)) : this.removeShaderDefine(ShaderCompile3D.SHADERDEFINE_FOG));
        }), __getset(0, __proto, "url", function() {
            return this._url;
        }), __getset(0, __proto, "loaded", function() {
            return this.__loaded;
        }), __getset(0, __proto, "enableDepthFog", function() {
            return this._enableDepthFog;
        }, function(v) {
            this._enableDepthFog != v && ((this._enableDepthFog = v) ? (this.addShaderDefine(ShaderCompile3D.SAHDERDEFINE_DEPTHFOG), 
            this.removeShaderDefine(ShaderCompile3D.SHADERDEFINE_FOG)) : this.removeShaderDefine(ShaderCompile3D.SAHDERDEFINE_DEPTHFOG));
        }), __getset(0, __proto, "fogStart", function() {
            return this._fogStart;
        }, function(value) {
            this._fogStart = value, this._shaderValues.setValue(1, value);
        }), __getset(0, __proto, "fogRange", function() {
            return this._fogRange;
        }, function(value) {
            this._fogRange = value, this._shaderValues.setValue(2, value);
        }), __getset(0, __proto, "ambientColor", function() {
            return this._ambientColor;
        }, function(value) {
            this._ambientColor = value, this._shaderValues.setValue(21, value.elements);
        }), __getset(0, __proto, "scene", function() {
            return this;
        }), __getset(0, __proto, "renderableSprite3Ds", function() {
            return this._renderableSprite3Ds.slice();
        }), Scene._sortScenes = function(a, b) {
            if (a.parent !== Laya.stage || b.parent !== Laya.stage) return a.parent !== Laya.stage && b.parent !== Laya.stage ? Scene._sortScenes(a.parent, b.parent) : a.parent === Laya.stage ? -1 : 1;
            var stageChildren = Laya.stage._childs;
            return stageChildren.indexOf(a) - stageChildren.indexOf(b);
        }, Scene.load = function(url) {
            return Laya.loader.create(url, null, null, Scene);
        }, Scene.FOGCOLOR = 0, Scene.FOGSTART = 1, Scene.FOGRANGE = 2, Scene.LIGHTDIRECTION = 3, 
        Scene.LIGHTDIRCOLOR = 4, Scene.POINTLIGHTPOS = 5, Scene.POINTLIGHTRANGE = 6, Scene.POINTLIGHTATTENUATION = 7, 
        Scene.POINTLIGHTCOLOR = 8, Scene.SPOTLIGHTPOS = 9, Scene.SPOTLIGHTDIRECTION = 10, 
        Scene.SPOTLIGHTSPOT = 11, Scene.SPOTLIGHTRANGE = 12, Scene.SPOTLIGHTATTENUATION = 13, 
        Scene.SPOTLIGHTCOLOR = 14, Scene.SHADOWDISTANCE = 15, Scene.SHADOWLIGHTVIEWPROJECT = 16, 
        Scene.SHADOWMAPPCFOFFSET = 17, Scene.SHADOWMAPTEXTURE1 = 18, Scene.SHADOWMAPTEXTURE2 = 19, 
        Scene.SHADOWMAPTEXTURE3 = 20, Scene.AMBIENTCOLOR = 21, Scene.TIME = 22, Scene;
    }(Sprite), Sprite3D = function(_super) {
        function Sprite3D(name) {
            Sprite3D.__super.call(this), this.__loaded = !0, this._projectionViewWorldUpdateLoopCount = -1, 
            this._activeInHierarchy = !1, this._projectionViewWorldMatrix = new Matrix4x4(), 
            this._shaderValues = new ValusArray(), this._colliders = [], this._id = ++Sprite3D._uniqueIDCounter, 
            this._transform = new Transform3D(this), this.name = name || "Sprite3D-" + Sprite3D._nameNumberCounter++, 
            this.layer = Layer.currentCreationLayer, this.active = !0;
        }
        __class(Sprite3D, "laya.d3.core.Sprite3D", ComponentNode);
        var __proto = Sprite3D.prototype;
        return Laya.imps(__proto, {
            "laya.d3.core.render.IUpdate": !0,
            "laya.resource.ICreateResource": !0,
            "laya.d3.core.IClone": !0
        }), __proto._setUrl = function(url) {
            this._url = url;
        }, __proto._getGroup = function() {
            return this._group;
        }, __proto._setGroup = function(value) {
            this._group = value;
        }, __proto._addChild3D = function(sprite3D) {
            sprite3D.transform.parent = this.transform, this._hierarchyAnimator && (!sprite3D._hierarchyAnimator && sprite3D._setHierarchyAnimator(this._hierarchyAnimator, null), 
            this._getAnimatorToLinkSprite3D(sprite3D, !0, [ sprite3D.name ])), this._scene && (sprite3D._setBelongScene(this._scene), 
            this._activeInHierarchy && sprite3D._active && sprite3D._activeHierarchy());
        }, __proto._removeChild3D = function(sprite3D) {
            sprite3D.transform.parent = null, this._scene && (this._activeInHierarchy && sprite3D._active && sprite3D._inActiveHierarchy(), 
            sprite3D._setUnBelongScene()), this._hierarchyAnimator && (sprite3D._hierarchyAnimator == this._hierarchyAnimator && sprite3D._clearHierarchyAnimator(this._hierarchyAnimator, null), 
            this._getAnimatorToLinkSprite3D(sprite3D, !1, [ sprite3D.name ]));
        }, __proto._parseBaseCustomProps = function(customProps) {
            var loccalPosition = this.transform.localPosition;
            customProps.translate ? (loccalPosition.fromArray(customProps.translate), loccalPosition.x *= 100, 
            loccalPosition.y *= 100, loccalPosition.z *= 100) : loccalPosition.elements.fill(0), 
            this.transform.localPosition = loccalPosition;
            var localRotation = this.transform.localRotation;
            customProps.rotation ? localRotation.fromArray(customProps.rotation) : localRotation.fromArray([ 0, 0, 0, -1 ]), 
            this.transform.localRotation = localRotation;
            var localScale = this.transform.localScale;
            customProps.scale ? localScale.fromArray(customProps.scale) : localScale.elements.fill(1), 
            this.transform.localScale = localScale;
            var layerData = customProps.layer;
            null != layerData && (this.layer = Layer.getLayerByNumber(layerData));
        }, __proto._parseCustomComponent = function(rootNode, innerResouMap, componentsData) {
            for (var k in componentsData) {
                var component = componentsData[k];
                switch (k) {
                  case "Animator":
                    var animator = this.addComponent(Animator);
                    if (component.avatarPath) animator.avatar = Loader.getRes(innerResouMap[component.avatarPath]); else {
                        var avatarData = component.avatar;
                        if (avatarData) {
                            animator.avatar = Loader.getRes(innerResouMap[avatarData.path]);
                            var linkSprites = avatarData.linkSprites;
                            linkSprites && rootNode.once("hierarchyloaded", this, this._onRootNodeHierarchyLoaded, [ animator, linkSprites ]);
                        }
                    }
                    for (var clipPaths = component.clipPaths, clipCount = clipPaths.length, i = 0; i < clipCount; i++) animator.addClip(Loader.getRes(innerResouMap[clipPaths[i]]));
                    animator.clip = Loader.getRes(innerResouMap[clipPaths[0]]);
                    var playOnWake = component.playOnWake;
                    void 0 !== playOnWake && (animator.playOnWake = playOnWake);
                    break;

                  case "Rigidbody":
                    this.addComponent(Rigidbody);
                    break;

                  case "SphereCollider":
                    var sphereCollider = this.addComponent(SphereCollider);
                    sphereCollider.isTrigger = component.isTrigger;
                    var center = sphereCollider.center;
                    center.fromArray(component.center), sphereCollider.center = center, sphereCollider.radius = component.radius;
                    break;

                  case "BoxCollider":
                    var boxCollider = this.addComponent(BoxCollider);
                    boxCollider.isTrigger = component.isTrigger, boxCollider.center.fromArray(component.center);
                    var size = boxCollider.size;
                    size.fromArray(component.size), boxCollider.size = size;
                    break;

                  case "MeshCollider":
                    this.addComponent(MeshCollider);
                }
            }
        }, __proto._onRootNodeHierarchyLoaded = function(animator, linkSprites) {
            for (var k in linkSprites) {
                for (var nodeOwner = this, path = linkSprites[k], j = 0, m = path.length; j < m; j++) {
                    var p = path[j];
                    if ("" === p) break;
                    if (!(nodeOwner = nodeOwner.getChildByName(p))) break;
                }
                nodeOwner && animator.linkSprite3DToAvatarNode(k, nodeOwner);
            }
        }, __proto._setHierarchyAnimator = function(animator, parentAnimator) {
            this._changeHierarchyAnimator(animator);
            for (var i = 0, n = this._childs.length; i < n; i++) {
                var child = this._childs[i];
                child._hierarchyAnimator == parentAnimator && child._setHierarchyAnimator(animator, parentAnimator);
            }
        }, __proto._clearHierarchyAnimator = function(animator, parentAnimator) {
            this._changeHierarchyAnimator(parentAnimator);
            for (var i = 0, n = this._childs.length; i < n; i++) {
                var child = this._childs[i];
                child._hierarchyAnimator == animator && child._clearHierarchyAnimator(animator, parentAnimator);
            }
        }, __proto._getAnimatorToLinkSprite3D = function(sprite3D, isLink, path) {
            var animator = this.getComponentByType(Animator);
            if (animator && (animator.avatar ? animator.avatar._version || sprite3D._setAnimatorToLinkAvatar(animator, isLink) : sprite3D._setAnimatorToLinkSprite3DNoAvatar(animator, isLink, path)), 
            this._parent && this._parent instanceof laya.d3.core.Sprite3D) {
                path.unshift(this._parent.name);
                var p = this._parent;
                p._hierarchyAnimator && p._getAnimatorToLinkSprite3D(sprite3D, isLink, path);
            }
        }, __proto._setAnimatorToLinkSprite3DNoAvatar = function(animator, isLink, path) {
            var i = 0, n = 0;
            for (i = 0, n = animator.getClipCount(); i < n; i++) animator._handleSpriteOwnersBySprite(i, isLink, path, this);
            for (i = 0, n = this._childs.length; i < n; i++) {
                var child = this._childs[i], index = path.length;
                path.push(child.name), child._setAnimatorToLinkSprite3DNoAvatar(animator, isLink, path), 
                path.splice(index, 1);
            }
        }, __proto._changeHierarchyAnimator = function(animator) {
            this._hierarchyAnimator = animator;
        }, __proto._isLinkSpriteToAnimationNode = function(animator, node, isLink) {
            var nodeIndex = animator._avatarNodes.indexOf(node), cacheSpriteToNodesMap = animator._cacheSpriteToNodesMap;
            if (isLink) this._transform.dummy = node.transform, animator._cacheNodesToSpriteMap[nodeIndex] = cacheSpriteToNodesMap.length, 
            cacheSpriteToNodesMap.push(nodeIndex); else {
                this._transform.dummy = null;
                var index = animator._cacheNodesToSpriteMap[nodeIndex];
                animator._cacheNodesToSpriteMap[nodeIndex] = null, cacheSpriteToNodesMap.splice(index, 1);
            }
        }, __proto._setBelongScene = function(scene) {
            this._scene = scene;
            for (var i = 0, n = this._childs.length; i < n; i++) this._childs[i]._setBelongScene(scene);
        }, __proto._setUnBelongScene = function() {
            this._scene = null;
            for (var i = 0, n = this._childs.length; i < n; i++) this._childs[i]._setUnBelongScene();
        }, __proto._activeHierarchy = function() {
            var i = 0, n = 0;
            for (this._activeInHierarchy = !0, this._addSelfRenderObjects(), i = 0, n = this._colliders.length; i < n; i++) this._layer._addCollider(this._colliders[i]);
            for (this.event("activeinhierarchychanged", !0), i = 0, n = this._childs.length; i < n; i++) {
                var child = this._childs[i];
                child._active && child._activeHierarchy();
            }
        }, __proto._inActiveHierarchy = function() {
            var i = 0, n = 0;
            for (this._activeInHierarchy = !1, this._clearSelfRenderObjects(), i = 0, n = this._colliders.length; i < n; i++) {
                var col = this._colliders[i];
                col._clearCollsionMap(), this._layer._removeCollider(col);
            }
            for (this.event("activeinhierarchychanged", !1), i = 0, n = this._childs.length; i < n; i++) {
                var child = this._childs[i];
                child._active && child._inActiveHierarchy();
            }
        }, __proto.addComponent = function(type) {
            var typeComponentIndex, index = this._componentsMap.indexOf(type);
            if (-1 === index) typeComponentIndex = [], this._componentsMap.push(type), this._typeComponentsIndices.push(typeComponentIndex); else if (typeComponentIndex = this._typeComponentsIndices[index], 
            this._components[typeComponentIndex[0]].isSingleton) throw new Error("无法单实例创建" + type + "组件，" + type + "组件已存在！");
            var component = ClassUtils.getInstance(type);
            if (typeComponentIndex.push(this._components.length), this._components.push(component), 
            component instanceof laya.d3.component.physics.Collider) this.getComponentByType(Rigidbody) && (component._isRigidbody = !0), 
            this._activeInHierarchy && this._layer._addCollider(component), this._colliders.push(component); else if (component instanceof laya.d3.component.Animator) {
                var animator = component;
                this._setHierarchyAnimator(animator, this._parent ? this._parent._hierarchyAnimator : null), 
                this._setAnimatorToLinkSprite3DNoAvatar(animator, !0, []);
            } else if (component instanceof laya.d3.component.Rigidbody) for (var i = 0, n = this._colliders.length; i < n; i++) this._colliders[i]._setIsRigidbody(!0);
            return component instanceof laya.d3.component.Script && this._scripts.push(component), 
            component._initialize(this), component;
        }, __proto._removeComponent = function(mapIndex, index) {
            var i = 0, n = 0, componentIndices = this._typeComponentsIndices[mapIndex], componentIndex = componentIndices[index], component = this._components[componentIndex];
            if (component instanceof laya.d3.component.physics.Collider) {
                var colliderComponent = component;
                this._activeInHierarchy && this._layer._removeCollider(colliderComponent), this._colliders.splice(this._colliders.indexOf(colliderComponent), 1);
            } else if (component instanceof laya.d3.component.Animator) {
                var animator = component;
                this._clearHierarchyAnimator(animator, this._parent ? this._parent._hierarchyAnimator : null);
            } else if (component instanceof laya.d3.component.Rigidbody) for (i = 0, n = this._colliders.length; i < n; i++) {
                var collider = this._colliders[i];
                collider._setIsRigidbody(!1);
                var runtimeCollisonMap = collider._runtimeCollisonMap, runtimeCollisonTestMap = collider._runtimeCollisonTestMap;
                for (var k in runtimeCollisonMap) delete runtimeCollisonTestMap[k];
            }
            for (this._components.splice(componentIndex, 1), component instanceof laya.d3.component.Script && this._scripts.splice(this._scripts.indexOf(component), 1), 
            componentIndices.splice(index, 1), 0 === componentIndices.length && (this._typeComponentsIndices.splice(mapIndex, 1), 
            this._componentsMap.splice(mapIndex, 1)), i = 0, n = this._componentsMap.length; i < n; i++) for (var j = (componentIndices = this._typeComponentsIndices[i]).length - 1; 0 <= j; j--) {
                var oldComponentIndex = componentIndices[j];
                if (!(componentIndex < oldComponentIndex)) break;
                componentIndices[j] = --oldComponentIndex;
            }
            component._destroy();
        }, __proto._clearSelfRenderObjects = function() {}, __proto._addSelfRenderObjects = function() {}, 
        __proto._parseCustomProps = function(rootNode, innerResouMap, customProps, nodeData) {}, 
        __proto._updateChilds = function(state) {
            var n = this._childs.length;
            if (0 !== n) for (var i = 0; i < n; ++i) this._childs[i]._update(state);
        }, __proto._getSortID = function(renderElement, material) {
            return 1e3 * material.id + renderElement._getVertexBuffer().vertexDeclaration.id;
        }, __proto._update = function(state) {
            (state.owner = this)._activeInHierarchy && (this._updateComponents(state), this._lateUpdateComponents(state), 
            Stat.spriteCount++, this._childs.length && this._updateChilds(state));
        }, __proto.getProjectionViewWorldMatrix = function(projectionViewMatrix) {
            return Matrix4x4.multiply(projectionViewMatrix, this.transform.worldMatrix, this._projectionViewWorldMatrix), 
            this._projectionViewWorldMatrix;
        }, __proto.loadHierarchy = function(url) {
            this.addChild(laya.d3.core.Sprite3D.load(url));
        }, __proto.addChildAt = function(node, index) {
            if (!(node instanceof laya.d3.core.Sprite3D)) throw new Error("Sprite3D:Node type must Sprite3D.");
            if (!node || this.destroyed || node === this) return node;
            if (node.zOrder && this._set$P("hasZorder", !0), 0 <= index && index <= this._childs.length) {
                if (node._parent === this) {
                    var oldIndex = this.getChildIndex(node);
                    this._childs.splice(oldIndex, 1), this._childs.splice(index, 0, node), this.conchModel && (this.conchModel.removeChild(node.conchModel), 
                    this.conchModel.addChildAt(node.conchModel, index)), this._childChanged();
                } else node.parent && node.parent.removeChild(node), this._childs === Node.ARRAY_EMPTY && (this._childs = []), 
                this._childs.splice(index, 0, node), this.conchModel && this.conchModel.addChildAt(node.conchModel, index), 
                (node.parent = this)._addChild3D(node);
                return node;
            }
            throw new Error("appendChildAt:The index is out of bounds");
        }, __proto.addChild = function(node) {
            if (!(node instanceof laya.d3.core.Sprite3D)) throw new Error("Sprite3D:Node type must Sprite3D.");
            if (!node || this.destroyed || node === this) return node;
            if (node.zOrder && this._set$P("hasZorder", !0), node._parent === this) {
                var index = this.getChildIndex(node);
                index !== this._childs.length - 1 && (this._childs.splice(index, 1), this._childs.push(node), 
                this.conchModel && (this.conchModel.removeChild(node.conchModel), this.conchModel.addChildAt(node.conchModel, this._childs.length - 1)), 
                this._childChanged());
            } else node.parent && node.parent.removeChild(node), this._childs === Node.ARRAY_EMPTY && (this._childs = []), 
            this._childs.push(node), this.conchModel && this.conchModel.addChildAt(node.conchModel, this._childs.length - 1), 
            (node.parent = this)._childChanged(), this._addChild3D(node);
            return node;
        }, __proto.removeChildAt = function(index) {
            var node = this.getChildAt(index);
            return node && (this._removeChild3D(node), this._childs.splice(index, 1), this.conchModel && this.conchModel.removeChild(node.conchModel), 
            node.parent = null), node;
        }, __proto.removeChildren = function(beginIndex, endIndex) {
            if (void 0 === beginIndex && (beginIndex = 0), void 0 === endIndex && (endIndex = 2147483647), 
            this._childs && 0 < this._childs.length) {
                var childs = this._childs;
                if (0 === beginIndex && n <= endIndex) {
                    var arr = childs;
                    this._childs = Node.ARRAY_EMPTY;
                } else arr = childs.splice(beginIndex, endIndex - beginIndex);
                for (var i = 0, n = arr.length; i < n; i++) this._removeChild3D(arr[i]), arr[i].parent = null, 
                this.conchModel && this.conchModel.removeChild(arr[i].conchModel);
            }
            return this;
        }, __proto.onAsynLoaded = function(url, data, params) {
            var json = data[0];
            if ("Sprite3D" !== json.type) throw new Error("Sprite3D: The .lh file root type must be Sprite3D,please use other function to  load  this file.");
            var innerResouMap = data[1];
            Utils3D._createNodeByJson(this, json, this, innerResouMap), this.event("hierarchyloaded", [ this ]), 
            this.__loaded = !0;
        }, __proto.cloneTo = function(destObject) {
            if (this.destroyed) throw new Error("Sprite3D: Can't be cloned if the Sprite3D has destroyed.");
            var destSprite3D = destObject;
            destSprite3D.name = this.name, destSprite3D._destroyed = this._destroyed, destSprite3D.timer = this.timer, 
            destSprite3D._$P = this._$P, destSprite3D.active = this._active;
            var destLocalPosition = destSprite3D.transform.localPosition;
            this.transform.localPosition.cloneTo(destLocalPosition), destSprite3D.transform.localPosition = destLocalPosition;
            var destLocalRotation = destSprite3D.transform.localRotation;
            this.transform.localRotation.cloneTo(destLocalRotation), destSprite3D.transform.localRotation = destLocalRotation;
            var destLocalScale = destSprite3D.transform.localScale;
            this.transform.localScale.cloneTo(destLocalScale), destSprite3D.transform.localScale = destLocalScale, 
            destSprite3D.isStatic = this.isStatic;
            var i = 0, n = 0;
            for (i = 0, n = this._componentsMap.length; i < n; i++) {
                var destComponent = destSprite3D.addComponent(this._componentsMap[i]);
                this._components[i]._cloneTo(destComponent);
            }
            for (i = 0, n = this._childs.length; i < n; i++) destSprite3D.addChild(this._childs[i].clone());
            var destAnimator = destSprite3D.getComponentByType(Animator);
            if (destAnimator) {
                var destLinkSpritesData = destAnimator._linkSpritesData;
                if (destLinkSpritesData) for (var k in destLinkSpritesData) {
                    for (var path = destLinkSpritesData[k], sp = destSprite3D, j = 0, m = path.length; j < m && (sp = sp.getChildByName(path[j])); j++) ;
                    if (sp) {
                        var node = destAnimator._avatarNodeMap[k];
                        sp._isLinkSpriteToAnimationNode(destAnimator, node, !0);
                    }
                }
            }
        }, __proto.clone = function() {
            var destSprite3D = new this.constructor();
            return this.cloneTo(destSprite3D), destSprite3D;
        }, __proto.destroy = function(destroyChild) {
            if (void 0 === destroyChild && (destroyChild = !0), !this.destroyed) {
                laya.display.Node.prototype.destroy.call(this, destroyChild);
                var n, i = 0;
                for (i = 0, n = this._components.length; i < n; i++) this._components[i]._destroy();
                this._components = null, this._componentsMap = null, this._typeComponentsIndices = null, 
                this._transform = null, this._colliders = null, Loader.clearRes(this.url), this.loaded || Laya3D._cancelLoadByUrl(this.url);
            }
        }, __proto._handleSpriteToAvatar = function(animator, isLink) {
            animator._avatarNodes;
            var node = animator._avatarNodeMap[this.name];
            node && node.name === this.name && !this._transform.dummy && this._isLinkSpriteToAnimationNode(animator, node, isLink);
        }, __proto._setAnimatorToLinkAvatar = function(animator, isLink) {
            this._handleSpriteToAvatar(animator, isLink);
            for (var i = 0, n = this._childs.length; i < n; i++) {
                this._childs[i]._setAnimatorToLinkAvatar(animator, isLink);
            }
        }, __getset(0, __proto, "activeInHierarchy", function() {
            return this._activeInHierarchy;
        }), __getset(0, __proto, "_loaded", null, function(value) {
            this.__loaded = value;
        }), __getset(0, __proto, "active", function() {
            return this._active;
        }, function(value) {
            this._active !== value && (this._active = value, this._parent && (this._parent === this._scene && this._parent.displayedInStage || this._parent._activeInHierarchy) && (value ? this._activeHierarchy() : this._inActiveHierarchy()));
        }), __getset(0, __proto, "componentsCount", function() {
            return this._components.length;
        }), __getset(0, __proto, "loaded", function() {
            return this.__loaded;
        }), __getset(0, __proto, "id", function() {
            return this._id;
        }), __getset(0, __proto, "url", function() {
            return this._url;
        }), __getset(0, __proto, "layer", function() {
            return this._layer;
        }, function(value) {
            if (this._layer !== value) {
                if (!value) throw new Error("Layer value can be null.");
                if (this._activeInHierarchy) {
                    var i = 0, n = this._colliders.length;
                    if (this._layer) for (i = 0; i < n; i++) this._layer._removeCollider(this._colliders[i]);
                    for (i = 0; i < n; i++) value._addCollider(this._colliders[i]);
                }
                this._layer = value, this.event("layerchanged", value);
            }
        }), __getset(0, __proto, "scene", function() {
            return this._scene;
        }), __getset(0, __proto, "transform", function() {
            return this._transform;
        }), Sprite3D.instantiate = function(original, parent, worldPositionStays, position, rotation) {
            void 0 === worldPositionStays && (worldPositionStays = !0);
            var destSprite3D = original.clone();
            parent && parent.addChild(destSprite3D);
            var transform = destSprite3D.transform;
            if (worldPositionStays) {
                var worldMatrix = transform.worldMatrix;
                original.transform.worldMatrix.cloneTo(worldMatrix), transform.worldMatrix = worldMatrix;
            } else position && (transform.position = position), rotation && (transform.rotation = rotation);
            return destSprite3D;
        }, Sprite3D.load = function(url) {
            return Laya.loader.create(url, null, null, Sprite3D);
        }, Sprite3D.WORLDMATRIX = 0, Sprite3D.MVPMATRIX = 1, Sprite3D._uniqueIDCounter = 0, 
        Sprite3D._nameNumberCounter = 0, Sprite3D;
    }(), Shader3D = function(_super) {
        function Shader3D(vs, ps, attributeMap, sceneUniformMap, cameraUniformMap, spriteUniformMap, materialUniformMap, renderElementUniformMap) {
            if (this._curActTexIndex = 0, this._program = null, this._attributeParams = null, 
            this._uniformParams = null, this._attributeParamsMap = [], this._sceneUniformParamsMap = [], 
            this._cameraUniformParamsMap = [], this._spriteUniformParamsMap = [], this._materialUniformParamsMap = [], 
            this._renderElementUniformParamsMap = [], Shader3D.__super.call(this), !vs || !ps) throw "Shader Error";
            this._id = ++Shader3D._count, this._vs = vs, this._ps = ps, this._attributeMap = attributeMap, 
            this._sceneUniformMap = sceneUniformMap, this._cameraUniformMap = cameraUniformMap, 
            this._spriteUniformMap = spriteUniformMap, this._materialUniformMap = materialUniformMap, 
            this._renderElementUniformMap = renderElementUniformMap, this.recreateResource();
        }
        __class(Shader3D, "laya.d3.shader.Shader3D", BaseShader);
        var __proto = Shader3D.prototype;
        return __proto.recreateResource = function() {
            this._compile(), this.completeCreate(), this.memorySize = 0;
        }, __proto.disposeResource = function() {
            WebGL.mainContext.deleteShader(this._vshader), WebGL.mainContext.deleteShader(this._pshader), 
            WebGL.mainContext.deleteProgram(this._program), this._vshader = this._pshader = this._program = null, 
            this._attributeParams = null, this._uniformParams = null, this.memorySize = 0, this._curActTexIndex = 0;
        }, __proto._compile = function() {
            if (this._vs && this._ps && !this._attributeParams && !this._uniformParams) {
                this._reCompile = !0, this._attributeParams = [], this._uniformParams = [];
                var text = [ this._vs, this._ps ], gl = WebGL.mainContext;
                if (this._program = gl.createProgram(), this._vshader = Shader3D._createShader(gl, text[0], 35633), 
                this._pshader = Shader3D._createShader(gl, text[1], 35632), gl.attachShader(this._program, this._vshader), 
                gl.attachShader(this._program, this._pshader), gl.linkProgram(this._program), !Render.isConchApp && ShaderCompile3D.debugMode && !gl.getProgramParameter(this._program, 35714)) throw gl.getProgramInfoLog(this._program);
                var one, i = 0, n = 0, attribNum = 0;
                for (attribNum = Render.isConchApp ? gl.getProgramParameterEx(this._vs, this._ps, "", 35721) : gl.getProgramParameter(this._program, 35721), 
                i = 0; i < attribNum; i++) {
                    var attrib = null;
                    one = {
                        vartype: "attribute",
                        ivartype: 0,
                        attrib: attrib = Render.isConchApp ? gl.getActiveAttribEx(this._vs, this._ps, "", i) : gl.getActiveAttrib(this._program, i),
                        location: gl.getAttribLocation(this._program, attrib.name),
                        name: attrib.name,
                        type: attrib.type,
                        isArray: !1,
                        isSame: !1,
                        preValue: null,
                        indexOfParams: 0
                    }, this._attributeParams.push(one);
                }
                var nUniformNum = 0;
                for (nUniformNum = Render.isConchApp ? gl.getProgramParameterEx(this._vs, this._ps, "", 35718) : gl.getProgramParameter(this._program, 35718), 
                i = 0; i < nUniformNum; i++) {
                    var uniform = null;
                    uniform = Render.isConchApp ? gl.getActiveUniformEx(this._vs, this._ps, "", i) : gl.getActiveUniform(this._program, i), 
                    0 < (one = {
                        vartype: "uniform",
                        ivartype: 1,
                        attrib: attrib,
                        location: gl.getUniformLocation(this._program, uniform.name),
                        name: uniform.name,
                        type: uniform.type,
                        isArray: !1,
                        isSame: !1,
                        preValue: null,
                        indexOfParams: 0
                    }).name.indexOf("[0]") && (one.name = one.name.substr(0, one.name.length - 3), one.isArray = !0, 
                    one.location = gl.getUniformLocation(this._program, one.name)), this._uniformParams.push(one);
                }
                for (i = 0, n = this._attributeParams.length; i < n; i++) (one = this._attributeParams[i]).indexOfParams = i, 
                one.index = 1, one.value = [ one.location, null ], one.codename = one.name, one.name = null != this._attributeMap[one.codename] ? this._attributeMap[one.codename] : one.codename, 
                this._attributeParamsMap.push(one.name), this._attributeParamsMap.push(one), one._this = this, 
                one.uploadedValue = [], one.fun = this._attribute;
                for (i = 0, n = this._uniformParams.length; i < n; i++) switch ((one = this._uniformParams[i]).indexOfParams = i, 
                one.index = 1, one.value = [ one.location, null ], one.codename = one.name, null != this._sceneUniformMap[one.codename] ? (one.name = this._sceneUniformMap[one.codename], 
                this._sceneUniformParamsMap.push(one.name), this._sceneUniformParamsMap.push(one)) : null != this._cameraUniformMap[one.codename] ? (one.name = this._cameraUniformMap[one.codename], 
                this._cameraUniformParamsMap.push(one.name), this._cameraUniformParamsMap.push(one)) : null != this._spriteUniformMap[one.codename] ? (one.name = this._spriteUniformMap[one.codename], 
                this._spriteUniformParamsMap.push(one.name), this._spriteUniformParamsMap.push(one)) : null != this._materialUniformMap[one.codename] ? (one.name = this._materialUniformMap[one.codename], 
                this._materialUniformParamsMap.push(one.name), this._materialUniformParamsMap.push(one)) : null != this._renderElementUniformMap[one.codename] ? (one.name = this._renderElementUniformMap[one.codename], 
                this._renderElementUniformParamsMap.push(one.name), this._renderElementUniformParamsMap.push(one)) : console.log("Shader:can't find uinform name:" + one.codename + " in shader file."), 
                one._this = this, one.uploadedValue = [], one.type) {
                  case 5124:
                    one.fun = one.isArray ? this._uniform1iv : this._uniform1i;
                    break;

                  case 5126:
                    one.fun = one.isArray ? this._uniform1fv : this._uniform1f;
                    break;

                  case 35664:
                    one.fun = one.isArray ? this._uniform_vec2v : this._uniform_vec2;
                    break;

                  case 35665:
                    one.fun = one.isArray ? this._uniform_vec3v : this._uniform_vec3;
                    break;

                  case 35666:
                    one.fun = one.isArray ? this._uniform_vec4v : this._uniform_vec4;
                    break;

                  case 35678:
                    one.fun = this._uniform_sampler2D;
                    break;

                  case 35680:
                    one.fun = this._uniform_samplerCube;
                    break;

                  case 35676:
                    one.fun = this._uniformMatrix4fv;
                    break;

                  case 35670:
                    one.fun = this._uniform1i;
                    break;

                  case 35674:
                    one.fun = this._uinformMatrix2fv;
                    break;

                  case 35675:
                    one.fun = this._uinformMatrix3fv;
                    break;

                  default:
                    throw new Error("compile shader err!");
                }
            }
        }, __proto._attribute = function(one, value) {
            var gl = WebGL.mainContext, enableAtributes = Buffer._enableAtributes, location = one.location;
            return enableAtributes[location] || gl.enableVertexAttribArray(location), gl.vertexAttribPointer(location, value[0], value[1], value[2], value[3], value[4]), 
            enableAtributes[location] = Buffer._bindVertexBuffer, 1;
        }, __proto._uniform1f = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value ? (WebGL.mainContext.uniform1f(one.location, uploadedValue[0] = value), 
            1) : 0;
        }, __proto._uniform1fv = function(one, value) {
            if (value.length < 4) {
                var uploadedValue = one.uploadedValue;
                return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] || uploadedValue[2] !== value[2] || uploadedValue[3] !== value[3] ? (WebGL.mainContext.uniform1fv(one.location, value), 
                uploadedValue[0] = value[0], uploadedValue[1] = value[1], uploadedValue[2] = value[2], 
                uploadedValue[3] = value[3], 1) : 0;
            }
            return WebGL.mainContext.uniform1fv(one.location, value), 1;
        }, __proto._uniform_vec2 = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] ? (WebGL.mainContext.uniform2f(one.location, uploadedValue[0] = value[0], uploadedValue[1] = value[1]), 
            1) : 0;
        }, __proto._uniform_vec2v = function(one, value) {
            if (value.length < 2) {
                var uploadedValue = one.uploadedValue;
                return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] || uploadedValue[2] !== value[2] || uploadedValue[3] !== value[3] ? (WebGL.mainContext.uniform2fv(one.location, value), 
                uploadedValue[0] = value[0], uploadedValue[1] = value[1], uploadedValue[2] = value[2], 
                uploadedValue[3] = value[3], 1) : 0;
            }
            return WebGL.mainContext.uniform2fv(one.location, value), 1;
        }, __proto._uniform_vec3 = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] || uploadedValue[2] !== value[2] ? (WebGL.mainContext.uniform3f(one.location, uploadedValue[0] = value[0], uploadedValue[1] = value[1], uploadedValue[2] = value[2]), 
            1) : 0;
        }, __proto._uniform_vec3v = function(one, value) {
            return WebGL.mainContext.uniform3fv(one.location, value), 1;
        }, __proto._uniform_vec4 = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] || uploadedValue[2] !== value[2] || uploadedValue[3] !== value[3] ? (WebGL.mainContext.uniform4f(one.location, uploadedValue[0] = value[0], uploadedValue[1] = value[1], uploadedValue[2] = value[2], uploadedValue[3] = value[3]), 
            1) : 0;
        }, __proto._uniform_vec4v = function(one, value) {
            return WebGL.mainContext.uniform4fv(one.location, value), 1;
        }, __proto._uniformMatrix2fv = function(one, value) {
            return WebGL.mainContext.uniformMatrix2fv(one.location, !1, value), 1;
        }, __proto._uniformMatrix3fv = function(one, value) {
            return WebGL.mainContext.uniformMatrix3fv(one.location, !1, value), 1;
        }, __proto._uniformMatrix4fv = function(one, value) {
            return WebGL.mainContext.uniformMatrix4fv(one.location, !1, value), 1;
        }, __proto._uinformMatrix2fv = function(one, value) {
            return WebGL.mainContext.uniformMatrix2fv(one.location, !1, value), 1;
        }, __proto._uinformMatrix3fv = function(one, value) {
            return WebGL.mainContext.uniformMatrix3fv(one.location, !1, value), 1;
        }, __proto._uniform1i = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value ? (WebGL.mainContext.uniform1i(one.location, uploadedValue[0] = value), 
            1) : 0;
        }, __proto._uniform1iv = function(one, value) {
            return WebGL.mainContext.uniform1iv(one.location, value), 1;
        }, __proto._uniform_ivec2 = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] ? (WebGL.mainContext.uniform2i(one.location, uploadedValue[0] = value[0], uploadedValue[1] = value[1]), 
            1) : 0;
        }, __proto._uniform_ivec2v = function(one, value) {
            return WebGL.mainContext.uniform2iv(one.location, value), 1;
        }, __proto._uniform_vec3i = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] || uploadedValue[2] !== value[2] ? (WebGL.mainContext.uniform3i(one.location, uploadedValue[0] = value[0], uploadedValue[1] = value[1], uploadedValue[2] = value[2]), 
            1) : 0;
        }, __proto._uniform_vec3vi = function(one, value) {
            return WebGL.mainContext.uniform3iv(one.location, value), 1;
        }, __proto._uniform_vec4i = function(one, value) {
            var uploadedValue = one.uploadedValue;
            return uploadedValue[0] !== value[0] || uploadedValue[1] !== value[1] || uploadedValue[2] !== value[2] || uploadedValue[3] !== value[3] ? (WebGL.mainContext.uniform4i(one.location, uploadedValue[0] = value[0], uploadedValue[1] = value[1], uploadedValue[2] = value[2], uploadedValue[3] = value[3]), 
            1) : 0;
        }, __proto._uniform_vec4vi = function(one, value) {
            return WebGL.mainContext.uniform4iv(one.location, value), 1;
        }, __proto._uniform_sampler2D = function(one, texture) {
            var value = texture.source || texture.defaulteTexture.source, gl = WebGL.mainContext, uploadedValue = one.uploadedValue;
            if (null != uploadedValue[0]) return gl.activeTexture(Shader3D._TEXTURES[uploadedValue[0]]), 
            value && WebGLContext.bindTexture(gl, 3553, value), 0;
            if (7 < this._curActTexIndex) throw new Error("Shader3D: shader support textures max count is 8,can't large than it.");
            return uploadedValue[0] = this._curActTexIndex, gl.uniform1i(one.location, this._curActTexIndex), 
            gl.activeTexture(Shader3D._TEXTURES[this._curActTexIndex]), value && WebGLContext.bindTexture(gl, 3553, value), 
            this._curActTexIndex++, 1;
        }, __proto._uniform_samplerCube = function(one, texture) {
            var value = texture.source || texture.defaulteTexture.source, gl = WebGL.mainContext, uploadedValue = one.uploadedValue;
            if (null != uploadedValue[0]) return gl.activeTexture(Shader3D._TEXTURES[uploadedValue[0]]), 
            value ? WebGLContext.bindTexture(gl, 34067, value) : WebGLContext.bindTexture(gl, 34067, SolidColorTextureCube.grayTexture.source), 
            0;
            if (7 < this._curActTexIndex) throw new Error("Shader3D: shader support textures max count is 8,can't large than it.");
            return uploadedValue[0] = this._curActTexIndex, gl.uniform1i(one.location, this._curActTexIndex), 
            gl.activeTexture(Shader3D._TEXTURES[this._curActTexIndex]), value ? WebGLContext.bindTexture(gl, 34067, value) : WebGLContext.bindTexture(gl, 34067, SolidColorTextureCube.grayTexture.source), 
            this._curActTexIndex++, 1;
        }, __proto._noSetValue = function(one) {
            console.log("no....:" + one.name);
        }, __proto.bind = function() {
            return BaseShader.activeShader = this, (BaseShader.bindShader = this).activeResource(), 
            WebGLContext.UseProgram(this._program);
        }, __proto.uploadAttributes = function(attributeShaderValue, _bufferUsage) {
            for (var value, one, shaderCall = 0, i = 0, n = this._attributeParamsMap.length; i < n; i += 2) one = this._attributeParamsMap[i + 1], 
            null != (value = attributeShaderValue[this._attributeParamsMap[i]]) && (_bufferUsage && _bufferUsage[one.name] && _bufferUsage[one.name].bind(), 
            shaderCall += one.fun.call(this, one, value));
            Stat.shaderCall += shaderCall;
        }, __proto.uploadAttributesX = function(attributeShaderValue, vb) {
            for (var value, one, shaderCall = 0, i = 0, n = this._attributeParamsMap.length; i < n; i += 2) one = this._attributeParamsMap[i + 1], 
            null != (value = attributeShaderValue[this._attributeParamsMap[i]]) && (vb._bind(), 
            shaderCall += one.fun.call(this, one, value));
            Stat.shaderCall += shaderCall;
        }, __proto.uploadSceneUniforms = function(shaderValue) {
            for (var value, one, shaderCall = 0, i = 0, n = this._sceneUniformParamsMap.length; i < n; i += 2) one = this._sceneUniformParamsMap[i + 1], 
            null != (value = shaderValue[this._sceneUniformParamsMap[i]]) && (shaderCall += one.fun.call(this, one, value));
            Stat.shaderCall += shaderCall;
        }, __proto.uploadCameraUniforms = function(shaderValue) {
            for (var value, one, shaderCall = 0, i = 0, n = this._cameraUniformParamsMap.length; i < n; i += 2) one = this._cameraUniformParamsMap[i + 1], 
            null != (value = shaderValue[this._cameraUniformParamsMap[i]]) && (shaderCall += one.fun.call(this, one, value));
            Stat.shaderCall += shaderCall;
        }, __proto.uploadSpriteUniforms = function(shaderValue) {
            for (var value, one, shaderCall = 0, i = 0, n = this._spriteUniformParamsMap.length; i < n; i += 2) one = this._spriteUniformParamsMap[i + 1], 
            null != (value = shaderValue[this._spriteUniformParamsMap[i]]) && (shaderCall += one.fun.call(this, one, value));
            Stat.shaderCall += shaderCall;
        }, __proto.uploadMaterialUniforms = function(shaderValue) {
            for (var value, one, shaderCall = 0, i = 0, n = this._materialUniformParamsMap.length; i < n; i += 2) one = this._materialUniformParamsMap[i + 1], 
            null != (value = shaderValue[this._materialUniformParamsMap[i]]) && (shaderCall += one.fun.call(this, one, value));
            Stat.shaderCall += shaderCall;
        }, __proto.uploadRenderElementUniforms = function(shaderValue) {
            for (var value, one, shaderCall = 0, i = 0, n = this._renderElementUniformParamsMap.length; i < n; i += 2) one = this._renderElementUniformParamsMap[i + 1], 
            null != (value = shaderValue[this._renderElementUniformParamsMap[i]]) && (shaderCall += one.fun.call(this, one, value));
            Stat.shaderCall += shaderCall;
        }, Shader3D.create = function(vs, ps, attributeMap, sceneUniformMap, cameraUniformMap, spriteUniformMap, materialUniformMap, renderElementUniformMap) {
            return new Shader3D(vs, ps, attributeMap, sceneUniformMap, cameraUniformMap, spriteUniformMap, materialUniformMap, renderElementUniformMap);
        }, Shader3D.addInclude = function(fileName, txt) {
            ShaderCompile.addInclude(fileName, txt);
        }, Shader3D._createShader = function(gl, str, type) {
            var shader = gl.createShader(type);
            if (gl.shaderSource(shader, str), gl.compileShader(shader), ShaderCompile3D.debugMode && !gl.getShaderParameter(shader, 35713)) throw gl.getShaderInfoLog(shader);
            return shader;
        }, Shader3D.PERIOD_RENDERELEMENT = 0, Shader3D.PERIOD_MATERIAL = 1, Shader3D.PERIOD_SPRITE = 2, 
        Shader3D.PERIOD_CAMERA = 3, Shader3D.PERIOD_SCENE = 4, Shader3D._TEXTURES = [ 33984, 33985, 33986, 33987, 33988, 33989, 33990, 33991 ], 
        Shader3D._count = 0, __static(Shader3D, [ "shaderParamsMap", function() {
            return this.shaderParamsMap = {
                float: 5126,
                int: 5124,
                bool: 35670,
                vec2: 35664,
                vec3: 35665,
                vec4: 35666,
                ivec2: 35667,
                ivec3: 35668,
                ivec4: 35669,
                bvec2: 35671,
                bvec3: 35672,
                bvec4: 35673,
                mat2: 35674,
                mat3: 35675,
                mat4: 35676,
                sampler2D: 35678,
                samplerCube: 35680
            };
        }, "nameKey", function() {
            return this.nameKey = new StringKey();
        } ]), Shader3D;
    }(), StandardMaterial = function(_super) {
        function StandardMaterial() {
            this._transformUV = null, StandardMaterial.__super.call(this), this.setShaderName("SIMPLE"), 
            this._setColor(9, new Vector3(.6, .6, .6)), this._setColor(10, new Vector3(1, 1, 1)), 
            this._setColor(11, new Vector4(1, 1, 1, 8)), this._setColor(12, new Vector3(1, 1, 1)), 
            this._setColor(7, new Vector4(1, 1, 1, 1)), this._setNumber(0, .5), this._setColor(15, new Vector4(1, 1, 0, 0)), 
            this.renderMode = 1;
        }
        __class(StandardMaterial, "laya.d3.core.material.StandardMaterial", _super);
        var __proto = StandardMaterial.prototype;
        return __proto.disableLight = function() {
            this._addDisablePublicShaderDefine(ShaderCompile3D.SHADERDEFINE_POINTLIGHT | ShaderCompile3D.SHADERDEFINE_SPOTLIGHT | ShaderCompile3D.SHADERDEFINE_DIRECTIONLIGHT);
        }, __proto.disableFog = function() {
            this._addDisablePublicShaderDefine(ShaderCompile3D.SHADERDEFINE_FOG);
        }, __proto.onAsynLoaded = function(url, data, params) {
            var jsonData = data[0];
            if (jsonData.version) _super.prototype.onAsynLoaded.call(this, url, data, params); else {
                var textureMap = data[1], props = jsonData.props;
                for (var prop in props) this[prop] = props[prop];
                StandardMaterial._parseStandardMaterial(textureMap, this, jsonData), this._endLoaded();
            }
        }, __proto.cloneTo = function(destObject) {
            _super.prototype.cloneTo.call(this, destObject);
            var dest = destObject;
            this._transformUV && (dest._transformUV = this._transformUV.clone());
        }, __getset(0, __proto, "ambientColor", function() {
            return this._getColor(9);
        }, function(value) {
            this._setColor(9, value);
        }), __getset(0, __proto, "ambientTexture", function() {
            return this._getTexture(5);
        }, function(value) {
            value ? this._addShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_AMBIENTMAP) : this._removeShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_AMBIENTMAP), 
            this._setTexture(5, value);
        }), __getset(0, __proto, "renderMode", null, function(value) {
            switch (value) {
              case 1:
                this.renderQueue = 2e3, this.depthWrite = !0, this.cull = 2, this.blend = 0, this.alphaTest = !1, 
                this._removeShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              case 2:
                this.renderQueue = 2e3, this.depthWrite = !0, this.cull = 0, this.blend = 0, this.alphaTest = !1, 
                this._removeShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              case 3:
                this.depthWrite = !0, this.cull = 2, this.blend = 0, this.renderQueue = 2e3, this.alphaTest = !0, 
                this._removeShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              case 4:
                this.renderQueue = 2e3, this.depthWrite = !0, this.cull = 0, this.blend = 0, this.alphaTest = !0, 
                this._removeShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              case 13:
                this.renderQueue = 3e3, this.depthWrite = !0, this.cull = 2, this.blend = 1, this.srcBlend = 770, 
                this.dstBlend = 771, this.alphaTest = !1, this._removeShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              case 14:
                this.renderQueue = 3e3, this.depthWrite = !0, this.cull = 0, this.blend = 1, this.srcBlend = 770, 
                this.dstBlend = 771, this.alphaTest = !1, this._removeShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              case 15:
                this.renderQueue = 3e3, this.depthWrite = !0, this.cull = 2, this.blend = 1, this.srcBlend = 770, 
                this.dstBlend = 1, this.alphaTest = !1, this._addShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              case 16:
                this.renderQueue = 3e3, this.depthWrite = !0, this.cull = 0, this.blend = 1, this.srcBlend = 770, 
                this.dstBlend = 1, this.alphaTest = !1, this._addShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              case 5:
                this.renderQueue = 3e3, this.depthWrite = !1, this.cull = 2, this.blend = 1, this.srcBlend = 770, 
                this.dstBlend = 771, this.alphaTest = !1, this._removeShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              case 6:
                this.renderQueue = 3e3, this.depthWrite = !1, this.cull = 0, this.blend = 1, this.srcBlend = 770, 
                this.dstBlend = 771, this.alphaTest = !1, this._removeShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              case 7:
                this.renderQueue = 3e3, this.depthWrite = !1, this.cull = 2, this.blend = 1, this.srcBlend = 770, 
                this.dstBlend = 1, this.alphaTest = !1, this._addShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              case 8:
                this.renderQueue = 3e3, this.depthWrite = !1, this.cull = 0, this.blend = 1, this.srcBlend = 770, 
                this.dstBlend = 1, this.alphaTest = !1, this._addShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              case 9:
                this.renderQueue = 3e3, this.depthTest = 513, this.cull = 2, this.blend = 1, this.srcBlend = 770, 
                this.dstBlend = 771, this.alphaTest = !1, this._removeShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              case 10:
                this.renderQueue = 3e3, this.depthTest = 513, this.cull = 0, this.blend = 1, this.srcBlend = 770, 
                this.dstBlend = 771, this.alphaTest = !1, this._removeShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              case 11:
                this.renderQueue = 3e3, this.depthTest = 513, this.cull = 2, this.blend = 1, this.srcBlend = 770, 
                this.dstBlend = 1, this.alphaTest = !1, this._addShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              case 12:
                this.renderQueue = 3e3, this.depthTest = 513, this.cull = 0, this.blend = 1, this.srcBlend = 770, 
                this.dstBlend = 1, this.alphaTest = !1, this._addShaderDefine(StandardMaterial.SHADERDEFINE_ADDTIVEFOG);
                break;

              default:
                throw new Error("Material:renderMode value error.");
            }
            this._conchMaterial && this._conchMaterial.setRenderMode(value);
        }), __getset(0, __proto, "reflectColor", function() {
            return this._getColor(12);
        }, function(value) {
            this._setColor(12, value);
        }), __getset(0, __proto, "tilingOffset", function() {
            return this._getColor(15);
        }, function(value) {
            if (value) {
                var valueE = value.elements;
                1 != valueE[0] || 1 != valueE[1] || 0 != valueE[2] || 0 != valueE[3] ? this._addShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_TILINGOFFSET) : this._removeShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_TILINGOFFSET);
            } else this._removeShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_TILINGOFFSET);
            this._setColor(15, value);
        }), __getset(0, __proto, "albedo", function() {
            return this._getColor(7);
        }, function(value) {
            this._setColor(7, value);
        }), __getset(0, __proto, "diffuseColor", function() {
            return this._getColor(10);
        }, function(value) {
            this._setColor(10, value);
        }), __getset(0, __proto, "albedoColor", function() {
            return this._getColor(7);
        }, function(value) {
            this._setColor(7, value);
        }), __getset(0, __proto, "specularColor", function() {
            return this._getColor(11);
        }, function(value) {
            this._setColor(11, value);
        }), __getset(0, __proto, "diffuseTexture", function() {
            return this._getTexture(1);
        }, function(value) {
            value ? this._addShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_DIFFUSEMAP) : this._removeShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_DIFFUSEMAP), 
            this._setTexture(1, value);
        }), __getset(0, __proto, "normalTexture", function() {
            return this._getTexture(2);
        }, function(value) {
            value ? this._addShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_NORMALMAP) : this._removeShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_NORMALMAP), 
            this._setTexture(2, value);
        }), __getset(0, __proto, "specularTexture", function() {
            return this._getTexture(3);
        }, function(value) {
            value ? this._addShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_SPECULARMAP) : this._removeShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_SPECULARMAP), 
            this._setTexture(3, value);
        }), __getset(0, __proto, "emissiveTexture", function() {
            return this._getTexture(4);
        }, function(value) {
            value ? this._addShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_EMISSIVEMAP) : this._removeShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_EMISSIVEMAP), 
            this._setTexture(4, value);
        }), __getset(0, __proto, "reflectTexture", function() {
            return this._getTexture(6);
        }, function(value) {
            value ? this._addShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_REFLECTMAP) : this._removeShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_REFLECTMAP), 
            this._setTexture(6, value);
        }), __getset(0, __proto, "transformUV", function() {
            return this._transformUV;
        }, function(value) {
            this._transformUV = value, this._setMatrix4x4(13, value.matrix), value ? this._addShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_UVTRANSFORM) : this._removeShaderDefine(laya.d3.core.material.StandardMaterial.SHADERDEFINE_UVTRANSFORM), 
            this._conchMaterial && this._conchMaterial.setShaderValue(13, value.matrix.elements, 0);
        }), StandardMaterial.__init__ = function() {
            StandardMaterial.SHADERDEFINE_DIFFUSEMAP = StandardMaterial.shaderDefines.registerDefine("DIFFUSEMAP"), 
            StandardMaterial.SHADERDEFINE_NORMALMAP = StandardMaterial.shaderDefines.registerDefine("NORMALMAP"), 
            StandardMaterial.SHADERDEFINE_SPECULARMAP = StandardMaterial.shaderDefines.registerDefine("SPECULARMAP"), 
            StandardMaterial.SHADERDEFINE_EMISSIVEMAP = StandardMaterial.shaderDefines.registerDefine("EMISSIVEMAP"), 
            StandardMaterial.SHADERDEFINE_AMBIENTMAP = StandardMaterial.shaderDefines.registerDefine("AMBIENTMAP"), 
            StandardMaterial.SHADERDEFINE_REFLECTMAP = StandardMaterial.shaderDefines.registerDefine("REFLECTMAP"), 
            StandardMaterial.SHADERDEFINE_UVTRANSFORM = StandardMaterial.shaderDefines.registerDefine("UVTRANSFORM"), 
            StandardMaterial.SHADERDEFINE_TILINGOFFSET = StandardMaterial.shaderDefines.registerDefine("TILINGOFFSET"), 
            StandardMaterial.SHADERDEFINE_ADDTIVEFOG = StandardMaterial.shaderDefines.registerDefine("ADDTIVEFOG");
        }, StandardMaterial.load = function(url) {
            return Laya.loader.create(url, null, null, StandardMaterial);
        }, StandardMaterial._parseStandardMaterial = function(textureMap, material, json) {
            var customProps = json.customProps, ambientColorValue = customProps.ambientColor;
            material.ambientColor = new Vector3(ambientColorValue[0], ambientColorValue[1], ambientColorValue[2]);
            var diffuseColorValue = customProps.diffuseColor;
            material.diffuseColor = new Vector3(diffuseColorValue[0], diffuseColorValue[1], diffuseColorValue[2]);
            var specularColorValue = customProps.specularColor;
            material.specularColor = new Vector4(specularColorValue[0], specularColorValue[1], specularColorValue[2], specularColorValue[3]);
            var reflectColorValue = customProps.reflectColor;
            material.reflectColor = new Vector3(reflectColorValue[0], reflectColorValue[1], reflectColorValue[2]);
            var albedoColorValue = customProps.albedoColor;
            albedoColorValue && (material.albedo = new Vector4(albedoColorValue[0], albedoColorValue[1], albedoColorValue[2], albedoColorValue[3]));
            var diffuseTexture = customProps.diffuseTexture.texture2D;
            diffuseTexture && (material.diffuseTexture = Loader.getRes(textureMap[diffuseTexture]));
            var normalTexture = customProps.normalTexture.texture2D;
            normalTexture && (material.normalTexture = Loader.getRes(textureMap[normalTexture]));
            var specularTexture = customProps.specularTexture.texture2D;
            specularTexture && (material.specularTexture = Loader.getRes(textureMap[specularTexture]));
            var emissiveTexture = customProps.emissiveTexture.texture2D;
            emissiveTexture && (material.emissiveTexture = Loader.getRes(textureMap[emissiveTexture]));
            var ambientTexture = customProps.ambientTexture.texture2D;
            ambientTexture && (material.ambientTexture = Loader.getRes(textureMap[ambientTexture]));
            var reflectTexture = customProps.reflectTexture.texture2D;
            reflectTexture && (material.reflectTexture = Loader.getRes(textureMap[reflectTexture]));
        }, StandardMaterial.RENDERMODE_OPAQUE = 1, StandardMaterial.RENDERMODE_OPAQUEDOUBLEFACE = 2, 
        StandardMaterial.RENDERMODE_CUTOUT = 3, StandardMaterial.RENDERMODE_CUTOUTDOUBLEFACE = 4, 
        StandardMaterial.RENDERMODE_TRANSPARENT = 13, StandardMaterial.RENDERMODE_TRANSPARENTDOUBLEFACE = 14, 
        StandardMaterial.RENDERMODE_ADDTIVE = 15, StandardMaterial.RENDERMODE_ADDTIVEDOUBLEFACE = 16, 
        StandardMaterial.RENDERMODE_DEPTHREAD_TRANSPARENT = 5, StandardMaterial.RENDERMODE_DEPTHREAD_TRANSPARENTDOUBLEFACE = 6, 
        StandardMaterial.RENDERMODE_DEPTHREAD_ADDTIVE = 7, StandardMaterial.RENDERMODE_DEPTHREAD_ADDTIVEDOUBLEFACE = 8, 
        StandardMaterial.RENDERMODE_NONDEPTH_TRANSPARENT = 9, StandardMaterial.RENDERMODE_NONDEPTH_TRANSPARENTDOUBLEFACE = 10, 
        StandardMaterial.RENDERMODE_NONDEPTH_ADDTIVE = 11, StandardMaterial.RENDERMODE_NONDEPTH_ADDTIVEDOUBLEFACE = 12, 
        StandardMaterial.SHADERDEFINE_DIFFUSEMAP = 0, StandardMaterial.SHADERDEFINE_NORMALMAP = 0, 
        StandardMaterial.SHADERDEFINE_SPECULARMAP = 0, StandardMaterial.SHADERDEFINE_EMISSIVEMAP = 0, 
        StandardMaterial.SHADERDEFINE_AMBIENTMAP = 0, StandardMaterial.SHADERDEFINE_REFLECTMAP = 0, 
        StandardMaterial.SHADERDEFINE_UVTRANSFORM = 0, StandardMaterial.SHADERDEFINE_TILINGOFFSET = 0, 
        StandardMaterial.SHADERDEFINE_ADDTIVEFOG = 0, StandardMaterial.DIFFUSETEXTURE = 1, 
        StandardMaterial.NORMALTEXTURE = 2, StandardMaterial.SPECULARTEXTURE = 3, StandardMaterial.EMISSIVETEXTURE = 4, 
        StandardMaterial.AMBIENTTEXTURE = 5, StandardMaterial.REFLECTTEXTURE = 6, StandardMaterial.ALBEDO = 7, 
        StandardMaterial.UVANIAGE = 8, StandardMaterial.MATERIALAMBIENT = 9, StandardMaterial.MATERIALDIFFUSE = 10, 
        StandardMaterial.MATERIALSPECULAR = 11, StandardMaterial.MATERIALREFLECT = 12, StandardMaterial.UVMATRIX = 13, 
        StandardMaterial.UVAGE = 14, StandardMaterial.TILINGOFFSET = 15, __static(StandardMaterial, [ "defaultMaterial", function() {
            var material = new StandardMaterial();
            return material.lock = !0, this.defaultMaterial = material;
        }, "shaderDefines", function() {
            return this.shaderDefines = new ShaderDefines$1(BaseMaterial.shaderDefines);
        } ]), StandardMaterial;
    }(BaseMaterial), IndexBuffer3D = function(_super) {
        function IndexBuffer3D(indexType, indexCount, bufferUsage, canRead) {
            this._indexType = null, this._indexTypeByteCount = 0, this._indexCount = 0, this._canRead = !1, 
            void 0 === bufferUsage && (bufferUsage = 35044), void 0 === canRead && (canRead = !1), 
            IndexBuffer3D.__super.call(this), this._indexType = indexType, this._indexCount = indexCount, 
            this._bufferUsage = bufferUsage, this._bufferType = 34963, this._canRead = canRead;
            var byteLength;
            if ("ushort" == indexType) this._indexTypeByteCount = 2; else {
                if ("ubyte" != indexType) throw new Error("unidentification index type.");
                this._indexTypeByteCount = 1;
            }
            byteLength = this._indexTypeByteCount * indexCount, this._byteLength = byteLength, 
            this._bind(), Buffer._gl.bufferData(this._bufferType, byteLength, this._bufferUsage), 
            canRead ? ("ushort" == indexType ? this._buffer = new Uint16Array(indexCount) : "ubyte" == indexType && (this._buffer = new Uint8Array(indexCount)), 
            this.memorySize = 2 * byteLength) : this.memorySize = byteLength;
        }
        __class(IndexBuffer3D, "laya.d3.graphics.IndexBuffer3D", _super);
        var __proto = IndexBuffer3D.prototype;
        return __proto.setData = function(data, bufferOffset, dataStartIndex, dataCount) {
            void 0 === bufferOffset && (bufferOffset = 0), void 0 === dataStartIndex && (dataStartIndex = 0), 
            void 0 === dataCount && (dataCount = 4294967295);
            var byteCount = 0;
            if ("ushort" == this._indexType ? (byteCount = 2, 0 === dataStartIndex && 4294967295 === dataCount || (data = new Uint16Array(data.buffer, dataStartIndex * byteCount, dataCount))) : "ubyte" == this._indexType && (byteCount = 1, 
            0 === dataStartIndex && 4294967295 === dataCount || (data = new Uint8Array(data.buffer, dataStartIndex * byteCount, dataCount))), 
            this._bind(), Buffer._gl.bufferSubData(this._bufferType, bufferOffset * byteCount, data), 
            this._canRead) if (0 !== bufferOffset || 0 !== dataStartIndex || 4294967295 !== dataCount) {
                var maxLength = this._buffer.length - bufferOffset;
                maxLength < dataCount && (dataCount = maxLength);
                for (var i = 0; i < dataCount; i++) this._buffer[bufferOffset + i] = data[i];
            } else this._buffer = data;
        }, __proto.getData = function() {
            if (this._canRead) return this._buffer;
            throw new Error("Can't read data from VertexBuffer with only write flag!");
        }, __proto.disposeResource = function() {
            _super.prototype.disposeResource.call(this), this._buffer = null, this.memorySize = 0;
        }, __getset(0, __proto, "indexType", function() {
            return this._indexType;
        }), __getset(0, __proto, "indexTypeByteCount", function() {
            return this._indexTypeByteCount;
        }), __getset(0, __proto, "indexCount", function() {
            return this._indexCount;
        }), __getset(0, __proto, "canRead", function() {
            return this._canRead;
        }), IndexBuffer3D.INDEXTYPE_UBYTE = "ubyte", IndexBuffer3D.INDEXTYPE_USHORT = "ushort", 
        IndexBuffer3D.create = function(indexType, indexCount, bufferUsage, canRead) {
            return void 0 === bufferUsage && (bufferUsage = 35044), void 0 === canRead && (canRead = !1), 
            new IndexBuffer3D(indexType, indexCount, bufferUsage, canRead);
        }, IndexBuffer3D;
    }(Buffer), VertexBuffer3D = function(_super) {
        function VertexBuffer3D(vertexDeclaration, vertexCount, bufferUsage, canRead) {
            this._vertexDeclaration = null, this._vertexCount = 0, this._canRead = !1, void 0 === canRead && (canRead = !1), 
            VertexBuffer3D.__super.call(this), this._vertexDeclaration = vertexDeclaration, 
            this._vertexCount = vertexCount, this._bufferUsage = bufferUsage, this._bufferType = 34962, 
            this._canRead = canRead, this.memorySize = this._byteLength = this._vertexDeclaration.vertexStride * vertexCount, 
            this._bind(), Buffer._gl.bufferData(this._bufferType, this._byteLength, this._bufferUsage), 
            canRead && (this._buffer = new Float32Array(this._byteLength / 4));
        }
        __class(VertexBuffer3D, "laya.d3.graphics.VertexBuffer3D", _super);
        var __proto = VertexBuffer3D.prototype;
        return __proto.bindWithIndexBuffer = function(ib) {
            ib && ib._bind(), this._bind();
        }, __proto.setData = function(data, bufferOffset, dataStartIndex, dataCount) {
            if (void 0 === bufferOffset && (bufferOffset = 0), void 0 === dataStartIndex && (dataStartIndex = 0), 
            void 0 === dataCount && (dataCount = 4294967295), 0 === dataStartIndex && 4294967295 === dataCount || (data = new Float32Array(data.buffer, 4 * dataStartIndex, dataCount)), 
            this._bind(), Buffer._gl.bufferSubData(this._bufferType, 4 * bufferOffset, data), 
            this._canRead) if (0 !== bufferOffset || 0 !== dataStartIndex || 4294967295 !== dataCount) {
                var maxLength = this._buffer.length - bufferOffset;
                maxLength < dataCount && (dataCount = maxLength);
                for (var i = 0; i < dataCount; i++) this._buffer[bufferOffset + i] = data[i];
            } else this._buffer = data;
        }, __proto.getData = function() {
            if (this._canRead) return this._buffer;
            throw new Error("Can't read data from VertexBuffer with only write flag!");
        }, __proto.disposeResource = function() {
            for (var gl = WebGL.mainContext, elements = this._vertexDeclaration.getVertexElements(), enableAtributes = Buffer._enableAtributes, i = 0, n = elements.length; i < n; i++) enableAtributes[i] === this._glBuffer && (gl.disableVertexAttribArray(i), 
            enableAtributes[i] = null);
            _super.prototype.disposeResource.call(this), this._buffer = null, this._vertexDeclaration = null, 
            this.memorySize = 0;
        }, __getset(0, __proto, "vertexDeclaration", function() {
            return this._vertexDeclaration;
        }), __getset(0, __proto, "vertexCount", function() {
            return this._vertexCount;
        }), __getset(0, __proto, "canRead", function() {
            return this._canRead;
        }), VertexBuffer3D.create = function(vertexDeclaration, vertexCount, bufferUsage, canRead) {
            return void 0 === bufferUsage && (bufferUsage = 35044), void 0 === canRead && (canRead = !1), 
            new VertexBuffer3D(vertexDeclaration, vertexCount, bufferUsage, canRead);
        }, VertexBuffer3D;
    }(Buffer), DataTexture2D = function(_super) {
        function DataTexture2D() {
            this.simLodInfo = null, this._src = null, this._buffer = null, this._mipmaps = null, 
            this._recreateLock = !1, this._needReleaseAgain = !1, DataTexture2D.__super.call(this), 
            this._type = 3553;
        }
        __class(DataTexture2D, "laya.d3.resource.DataTexture2D", BaseTexture);
        var __proto = DataTexture2D.prototype;
        return __proto.genDebugMipmaps = function() {
            var ret = [];
            return ret.push(new Uint8Array(new Uint32Array(131072).fill(4278190335).buffer)), 
            ret.push(new Uint8Array(new Uint32Array(32768).fill(4278223103).buffer)), ret.push(new Uint8Array(new Uint32Array(8192).fill(4278255615).buffer)), 
            ret.push(new Uint8Array(new Uint32Array(2048).fill(4278255360).buffer)), ret.push(new Uint8Array(new Uint32Array(512).fill(4286595072).buffer)), 
            ret.push(new Uint8Array(new Uint32Array(128).fill(4294901760).buffer)), ret.push(new Uint8Array(new Uint32Array(32).fill(4294901888).buffer)), 
            ret.push(new Uint8Array(new Uint32Array(8).fill(0).buffer)), ret.push(new Uint8Array(new Uint32Array(2).fill(4286611584).buffer)), 
            ret.push(new Uint8Array(new Uint32Array(1).fill(4294967295).buffer)), ret;
        }, __proto._onTextureLoaded = function(buff) {}, __proto._createWebGlTexture = function() {
            if (!this._buffer && !this._mipmaps) throw "create GLTextur err:no data";
            var gl = WebGL.mainContext;
            gl.getExtension("EXT_shader_texture_lod");
            var glTexture = this._source = gl.createTexture(), w = this._width, h = this._height, preTarget = WebGLContext.curBindTexTarget, preTexture = WebGLContext.curBindTexValue;
            if (WebGLContext.bindTexture(gl, this._type, glTexture), this._mipmaps) {
                if (laya.d3.resource.DataTexture2D.lodasatlas) {
                    var infoi = 0;
                    gl.texImage2D(this._type, 0, 6408, this._width, this._height, 0, 6408, 5121, null);
                    for (var i = 0; i < this._mipmaps.length; i++) {
                        if (this._mipmaps[i].byteLength != cw * ch * 4) throw "mipmap size error  level:" + i;
                        gl.texSubImage2D(this._type, 0, DataTexture2D.simLodRect[infoi++], DataTexture2D.simLodRect[infoi++], DataTexture2D.simLodRect[infoi++], DataTexture2D.simLodRect[infoi++], 6408, 5121, new Uint8Array(this._mipmaps[i]));
                    }
                    this.minFifter = 9729, this.magFifter = 9729;
                } else {
                    var cw = this._width, ch = this._height;
                    for (infoi = 0, gl.texImage2D(this._type, 0, 6408, this._width, this._height, 0, 6408, 5121, null), 
                    i = 0; i < this._mipmaps.length; i++) {
                        if (this._mipmaps[i].byteLength != cw * ch * 4) throw "mipmap size error  level:" + i;
                        gl.texImage2D(this._type, i, 6408, cw, ch, 0, 6408, 5121, new Uint8Array(this._mipmaps[i])), 
                        (cw /= 2) < 1 && (cw = 1), (ch /= 2) < 1 && (ch = 1), this.minFifter = 9987, this.magFifter = 9729;
                    }
                }
                this.mipmap = !1;
            } else {
                var format = this._buffer.byteLength / (w * h) == 4 ? 6408 : 6407;
                this._buffer instanceof Uint8Array || (this._buffer = new Uint8Array(this._buffer)), 
                gl.texImage2D(this._type, 0, format, w, h, 0, format, 5121, this._buffer);
            }
            var minFifter = this._minFifter, magFifter = this._magFifter, wrapModeU = 0 == this._wrapModeU ? 10497 : 33071, wrapModeV = 0 == this._wrapModeV ? 10497 : 33071, isPot = Arith.isPOT(w, h);
            isPot ? (this._mipmap || this._mipmaps ? -1 !== minFifter || (minFifter = 9987) : -1 !== minFifter || (minFifter = 9729), 
            -1 !== magFifter || (magFifter = 9729), gl.texParameteri(this._type, 10241, minFifter), 
            gl.texParameteri(this._type, 10240, magFifter), gl.texParameteri(this._type, 10242, wrapModeU), 
            gl.texParameteri(this._type, 10243, wrapModeV), this._mipmap && gl.generateMipmap(this._type)) : (-1 !== minFifter || (minFifter = 9729), 
            -1 !== magFifter || (magFifter = 9729), gl.texParameteri(this._type, 10241, minFifter), 
            gl.texParameteri(this._type, 10240, magFifter), gl.texParameteri(this._type, 10242, 33071), 
            gl.texParameteri(this._type, 10243, 33071)), preTarget && preTexture && WebGLContext.bindTexture(gl, preTarget, preTexture), 
            this.src && 0 < this.src.length && (this._buffer = null), this.memorySize = isPot ? w * h * 4 * (1 + 1 / 3) : w * h * 4, 
            this._recreateLock = !1;
        }, __proto.recreateResource = function() {
            if (this._buffer || null != this._src && "" !== this._src) if (this._needReleaseAgain = !1, 
            this._buffer || this._mipmaps) {
                if (this._recreateLock) return;
                this._createWebGlTexture(), this.completeCreate();
            } else {
                this._recreateLock = !0;
            }
        }, __proto.onAsynLoaded = function(url, data, params) {
            var imgdata;
            params && (imgdata = params[0].call(this, data)), imgdata && (this._width = imgdata.width, 
            this._height = imgdata.height, this._buffer = imgdata.data), this._src = url, this._size = new Size(this._width, this._height), 
            this._conchTexture ? alert("怎么给runtime传递datatexture数据") : this.activeResource(), 
            this._endLoaded();
        }, __proto.getPixels = function() {
            return new Uint8Array(this._buffer);
        }, __proto.disposeResource = function() {
            this._recreateLock && (this._needReleaseAgain = !0), this._source && (WebGL.mainContext.deleteTexture(this._source), 
            this._source = null, this._buffer = null, this.memorySize = 0);
        }, __getset(0, __proto, "src", function() {
            return this._src;
        }), DataTexture2D.create = function(data, w, h, magfilter, minfilter, mipmap) {
            if (void 0 === magfilter && (magfilter = 9729), void 0 === minfilter && (minfilter = 9729), 
            void 0 === mipmap && (mipmap = !0), !data || data.byteLength < w * h * 4) throw "DataTexture2D create error";
            var ret = new DataTexture2D();
            return ret._buffer = data, ret._width = w, ret._height = h, ret._mipmap = mipmap, 
            ret._magFifter = magfilter, ret._minFifter = minfilter, ret._size = new Size(ret._width, ret._height), 
            ret._conchTexture ? alert("怎么给runtime传递datatexture数据") : ret.activeResource(), ret;
        }, DataTexture2D.load = function(url, w, h, magfilter, minfilter) {
            if (void 0 === w && (w = 0), void 0 === h && (h = 0), void 0 === magfilter && (magfilter = 9729), 
            void 0 === minfilter && (minfilter = 9729), "mipmaps" === Utils.getFileExtension(url)) {
                var ret = Laya.loader.create(url, null, null, DataTexture2D, [ function(data) {
                    this._mipmaps = [];
                    var szinfo = new Uint32Array(data);
                    this._width = szinfo[0];
                    var validw = 512;
                    if (laya.d3.resource.DataTexture2D.lodasatlas && (this._width *= 2, validw = 1024), 
                    this._width != validw) throw console.error("现在只支持512x256的环境贴图。当前的是" + szinfo[0]), 
                    "现在只支持512x256的环境贴图。当前的是" + szinfo[0];
                    this._height = szinfo[1];
                    for (var curw = laya.d3.resource.DataTexture2D.lodasatlas ? this._width / 2 : this._width, curh = this._height, cursz = 8; ;) {
                        var curbufsz = curw * curh * 4;
                        if (cursz + curbufsz > data.byteLength) throw "load mipmaps data size error ";
                        var tbuf = new Uint8Array(data, cursz, curbufsz);
                        if (this._mipmaps.push(tbuf), cursz += curbufsz, 1 == curw && 1 == curh) break;
                        (curw /= 2) < 1 && (curw = 1), (curh /= 2) < 1 && (curh = 1);
                    }
                    return null;
                } ]);
                if (laya.d3.resource.DataTexture2D.lodasatlas) {
                    ret.simLodInfo = new Float32Array(40);
                    for (var i = 0; i < ret.simLodInfo.length; ) ret.simLodInfo[i] = (DataTexture2D.simLodRect[i] + .5) / 1024, 
                    i++, ret.simLodInfo[i] = (DataTexture2D.simLodRect[i] + .5) / 256, i++, ret.simLodInfo[i] = Math.max(DataTexture2D.simLodRect[i] - 1, .1) / 1024, 
                    i++, ret.simLodInfo[i] = Math.max(DataTexture2D.simLodRect[i] - 1.5, .1) / 256, 
                    i++;
                }
                return ret;
            }
            if ("number" == typeof w) return Laya.loader.create(url, null, null, DataTexture2D, [ function(data) {
                return this._width = w, this._height = h, this._buffer = data, null;
            } ]);
            if ("function" == typeof w) return Laya.loader.create(url, null, null, DataTexture2D, [ w ]);
            throw new Error("unknown params.");
        }, DataTexture2D.lodasatlas = !1, __static(DataTexture2D, [ "simLodRect", function() {
            return this.simLodRect = new Uint32Array([ 0, 0, 512, 256, 512, 0, 256, 128, 768, 0, 128, 64, 896, 0, 64, 32, 960, 0, 32, 16, 992, 0, 16, 8, 1008, 0, 8, 4, 1016, 0, 4, 2, 1020, 0, 2, 1, 1022, 0, 1, 1 ]);
        } ]), DataTexture2D;
    }(), Mesh = (function(_super) {
        function PrimitiveMesh() {
            this._numberVertices = 0, this._numberIndices = 0, this._vertexBuffer = null, this._indexBuffer = null, 
            PrimitiveMesh.__super.call(this);
        }
        __class(PrimitiveMesh, "laya.d3.resource.models.PrimitiveMesh", BaseMesh);
        var __proto = PrimitiveMesh.prototype;
        Laya.imps(__proto, {
            "laya.d3.core.render.IRenderable": !0
        }), __proto._getVertexBuffer = function(index) {
            return void 0 === index && (index = 0), 0 === index ? this._vertexBuffer : null;
        }, __proto._getVertexBuffers = function() {
            return null;
        }, __proto._getIndexBuffer = function() {
            return this._indexBuffer;
        }, __proto._getPositions = function() {
            var positionElement, vertices = [], vertexElements = this._vertexBuffer.vertexDeclaration.getVertexElements(), j = 0;
            for (j = 0; j < vertexElements.length; j++) {
                var vertexElement = vertexElements[j];
                if ("vector3" === vertexElement.elementFormat && 0 === vertexElement.elementUsage) {
                    positionElement = vertexElement;
                    break;
                }
            }
            var verticesData = this._vertexBuffer.getData();
            for (j = 0; j < verticesData.length; j += this._vertexBuffer.vertexDeclaration.vertexStride / 4) {
                var ofset = j + positionElement.offset / 4, position = new Vector3(verticesData[ofset + 0], verticesData[ofset + 1], verticesData[ofset + 2]);
                vertices.push(position);
            }
            return vertices;
        }, __proto.getRenderElement = function(index) {
            return this;
        }, __proto.getRenderElementsCount = function() {
            return 1;
        }, __proto.disposeResource = function() {
            this._vertexBuffer && (this._vertexBuffer._removeReference(), this._vertexBuffer = null), 
            this._indexBuffer && (this._indexBuffer._removeReference(), this._indexBuffer = null), 
            this.memorySize = 0;
        }, __proto._beforeRender = function(state) {
            return this._vertexBuffer._bind(), this._indexBuffer._bind(), !0;
        }, __proto._render = function(state) {
            WebGL.mainContext.drawElements(4, this._numberIndices, 5123, 0), Stat.drawCall++, 
            Stat.trianglesFaces += this._numberIndices / 3;
        }, __getset(0, __proto, "_vertexBufferCount", function() {
            return 1;
        }), __getset(0, __proto, "triangleCount", function() {
            return this._indexBuffer.indexCount / 3;
        });
    }(), function(_super) {
        function Mesh() {
            this._materials = null, this._subMeshes = null, this._vertexBuffers = null, this._indexBuffer = null, 
            this._boneNames = null, this._inverseBindPoses = null, this._skinnedDatas = null, 
            Mesh.__super.call(this), this._subMeshes = [], this._materials = [], this._vertexBuffers = [];
        }
        __class(Mesh, "laya.d3.resource.models.Mesh", BaseMesh);
        var __proto = Mesh.prototype;
        return __proto._getPositions = function() {
            var vertexBuffer, positionElement, vertexElements, vertexElement, verticesData, vertices = [], i = 0, j = 0, ofset = 0;
            if (0 !== this._vertexBuffers.length) {
                var vertexBufferCount = this._vertexBuffers.length;
                for (i = 0; i < vertexBufferCount; i++) {
                    for (vertexElements = (vertexBuffer = this._vertexBuffers[i]).vertexDeclaration.getVertexElements(), 
                    j = 0; j < vertexElements.length; j++) if ("vector3" === (vertexElement = vertexElements[j]).elementFormat && 0 === vertexElement.elementUsage) {
                        positionElement = vertexElement;
                        break;
                    }
                    for (verticesData = vertexBuffer.getData(), j = 0; j < verticesData.length; j += vertexBuffer.vertexDeclaration.vertexStride / 4) ofset = j + positionElement.offset / 4, 
                    vertices.push(new Vector3(verticesData[ofset + 0], verticesData[ofset + 1], verticesData[ofset + 2]));
                }
            } else {
                var submesheCount = this._subMeshes.length;
                for (i = 0; i < submesheCount; i++) {
                    for (vertexElements = (vertexBuffer = this._subMeshes[i]._getVertexBuffer()).vertexDeclaration.getVertexElements(), 
                    j = 0; j < vertexElements.length; j++) if ("vector3" === (vertexElement = vertexElements[j]).elementFormat && 0 === vertexElement.elementUsage) {
                        positionElement = vertexElement;
                        break;
                    }
                    for (verticesData = vertexBuffer.getData(), j = 0; j < verticesData.length; j += vertexBuffer.vertexDeclaration.vertexStride / 4) ofset = j + positionElement.offset / 4, 
                    vertices.push(new Vector3(verticesData[ofset + 0], verticesData[ofset + 1], verticesData[ofset + 2]));
                }
            }
            return vertices;
        }, __proto._setSubMeshes = function(subMeshes) {
            this._subMeshes = subMeshes, this._subMeshCount = subMeshes.length;
            for (var i = 0; i < this._subMeshCount; i++) subMeshes[i]._indexInMesh = i;
            this._positions = this._getPositions(), this._generateBoundingObject();
        }, __proto.onAsynLoaded = function(url, data, params) {
            var bufferData = data[0], textureMap = data[1];
            MeshReader.read(bufferData, this, this._materials, this._subMeshes, textureMap), 
            this.completeCreate(), this._endLoaded();
        }, __proto.getSubMesh = function(index) {
            return this._subMeshes[index];
        }, __proto.getSubMeshCount = function() {
            return this._subMeshes.length;
        }, __proto.getRenderElementsCount = function() {
            return this._subMeshes.length;
        }, __proto.getRenderElement = function(index) {
            return this._subMeshes[index];
        }, __proto.disposeResource = function() {
            for (var i = 0; i < this._subMeshes.length; i++) this._subMeshes[i].dispose();
            this._materials = null, this._subMeshes = null, this._vertexBuffers = null, this._indexBuffer = null, 
            this._boneNames = null, this._inverseBindPoses = null;
        }, __getset(0, __proto, "materials", function() {
            return this._materials.slice();
        }), __getset(0, __proto, "InverseAbsoluteBindPoses", function() {
            return this._inverseBindPoses;
        }), Mesh.load = function(url) {
            return Laya.loader.create(url, null, null, Mesh);
        }, Mesh;
    }()), SolidColorTexture2D = (function(_super) {
        function RenderTexture(width, height, surfaceFormat, surfaceType, depthStencilFormat, mipMap, repeat, minFifter, magFifter) {
            this._alreadyResolved = !1, this._surfaceFormat = 0, this._surfaceType = 0, this._depthStencilFormat = 0, 
            this._frameBuffer = null, this._depthStencilBuffer = null, void 0 === surfaceFormat && (surfaceFormat = 6408), 
            void 0 === surfaceType && (surfaceType = 5121), void 0 === depthStencilFormat && (depthStencilFormat = 33189), 
            void 0 === mipMap && (mipMap = !1), void 0 === repeat && (repeat = !1), void 0 === minFifter && (minFifter = -1), 
            void 0 === magFifter && (magFifter = -1), RenderTexture.__super.call(this), this._type = 3553, 
            this._width = width, this._height = height, this._size = new Size(width, height), 
            this._surfaceFormat = surfaceFormat, this._surfaceType = surfaceType, this._depthStencilFormat = depthStencilFormat, 
            Render.isConchWebGL && 34041 === this._depthStencilFormat && (this._depthStencilFormat = 33189), 
            this._mipmap = mipMap, this._repeat = repeat, this._minFifter = minFifter, this._magFifter = magFifter, 
            this.activeResource(), this._alreadyResolved = !0;
        }
        __class(RenderTexture, "laya.d3.resource.RenderTexture", BaseTexture);
        var __proto = RenderTexture.prototype;
        __proto.recreateResource = function() {
            var gl = WebGL.mainContext;
            this._frameBuffer = gl.createFramebuffer(), this._source = gl.createTexture();
            var preTarget = WebGLContext.curBindTexTarget, preTexture = WebGLContext.curBindTexValue;
            WebGLContext.bindTexture(gl, this._type, this._source), gl.texImage2D(this._type, 0, 6408, this._width, this._height, 0, this._surfaceFormat, this._surfaceType, null);
            var minFifter = this._minFifter, magFifter = this._magFifter, repeat = this._repeat ? 10497 : 33071;
            if (Arith.isPOT(this._width, this._height) ? (this._mipmap ? -1 !== minFifter || (minFifter = 9987) : -1 !== minFifter || (minFifter = 9729), 
            -1 !== magFifter || (magFifter = 9729), gl.texParameteri(this._type, 10241, minFifter), 
            gl.texParameteri(this._type, 10240, magFifter), gl.texParameteri(this._type, 10242, repeat), 
            gl.texParameteri(this._type, 10243, repeat), this._mipmap && gl.generateMipmap(this._type)) : (-1 !== minFifter || (minFifter = 9729), 
            -1 !== magFifter || (magFifter = 9729), gl.texParameteri(this._type, 10241, minFifter), 
            gl.texParameteri(this._type, 10240, magFifter), gl.texParameteri(this._type, 10242, 33071), 
            gl.texParameteri(this._type, 10243, 33071)), preTarget && preTexture && WebGLContext.bindTexture(gl, preTarget, preTexture), 
            gl.bindFramebuffer(36160, this._frameBuffer), this._depthStencilFormat) switch (this._depthStencilBuffer = gl.createRenderbuffer(), 
            gl.bindRenderbuffer(36161, this._depthStencilBuffer), gl.renderbufferStorage(36161, this._depthStencilFormat, this._width, this._height), 
            gl.bindRenderbuffer(36161, null), this._depthStencilFormat) {
              case 33189:
                gl.framebufferRenderbuffer(36160, 36096, 36161, this._depthStencilBuffer);
                break;

              case 36168:
                gl.framebufferRenderbuffer(36160, 36128, 36161, this._depthStencilBuffer);
                break;

              case 34041:
                gl.framebufferRenderbuffer(36160, 33306, 36161, this._depthStencilBuffer);
            }
            gl.framebufferTexture2D(36160, 36064, 3553, this._source, 0), gl.bindFramebuffer(36160, null), 
            this.memorySize = this._width * this._height * 4, this.completeCreate();
        }, __proto.start = function() {
            WebGL.mainContext.bindFramebuffer(36160, this.frameBuffer), (RenderTexture._currentRenderTarget = this)._alreadyResolved = !1;
        }, __proto.end = function() {
            WebGL.mainContext.bindFramebuffer(36160, null), RenderTexture._currentRenderTarget = null, 
            this._alreadyResolved = !0;
        }, __proto.getData = function(x, y, width, height) {
            var gl = WebGL.mainContext;
            if (gl.bindFramebuffer(36160, this._frameBuffer), !(36053 === gl.checkFramebufferStatus(36160))) return gl.bindFramebuffer(36160, null), 
            null;
            var pixels = new Uint8Array(this._width * this._height * 4);
            return gl.readPixels(x, y, width, height, this._surfaceFormat, this._surfaceType, pixels), 
            gl.bindFramebuffer(36160, null), pixels;
        }, __proto.disposeResource = function() {
            if (this._frameBuffer) {
                var gl = WebGL.mainContext;
                gl.deleteTexture(this._source), gl.deleteFramebuffer(this._frameBuffer), gl.deleteRenderbuffer(this._depthStencilBuffer), 
                this._source = null, this._frameBuffer = null, this._depthStencilBuffer = null, 
                this.memorySize = 0;
            }
        }, __getset(0, __proto, "surfaceFormat", function() {
            return this._surfaceFormat;
        }), __getset(0, __proto, "surfaceType", function() {
            return this._surfaceType;
        }), __getset(0, __proto, "depthStencilFormat", function() {
            return this._depthStencilFormat;
        }), __getset(0, __proto, "source", function() {
            return this._alreadyResolved ? Laya.superGet(BaseTexture, this, "source") : null;
        }), __getset(0, __proto, "depthStencilBuffer", function() {
            return this._depthStencilBuffer;
        }), __getset(0, __proto, "frameBuffer", function() {
            return this._frameBuffer;
        }), RenderTexture._currentRenderTarget = null;
    }(), function(_super) {
        function SolidColorTexture2D(color) {
            this._color = null, this._pixels = null, SolidColorTexture2D.__super.call(this), 
            this._type = 3553, this._width = 1, this._height = 1, this._size = new Size(this.width, this.height), 
            this._color = color, this._pixels = new Uint8Array([ 255 * color.x, 255 * color.y, 255 * color.z, 255 * color.w ]);
        }
        __class(SolidColorTexture2D, "laya.d3.resource.SolidColorTexture2D", BaseTexture);
        var __proto = SolidColorTexture2D.prototype;
        return __proto._createWebGlTexture = function() {
            var gl = WebGL.mainContext, glTex = this._source = gl.createTexture(), w = this._width, h = this._height, preTarget = WebGLContext.curBindTexTarget, preTexture = WebGLContext.curBindTexValue;
            WebGLContext.bindTexture(gl, this._type, glTex), gl.texImage2D(this._type, 0, 6408, w, h, 0, 6408, 5121, this._pixels);
            var minFifter = this._minFifter, magFifter = this._magFifter, repeat = this._repeat ? 10497 : 33071, isPot = Arith.isPOT(w, h);
            isPot ? (this._mipmap ? -1 !== minFifter || (minFifter = 9987) : -1 !== minFifter || (minFifter = 9729), 
            -1 !== magFifter || (magFifter = 9729), gl.texParameteri(this._type, 10241, minFifter), 
            gl.texParameteri(this._type, 10240, magFifter), gl.texParameteri(this._type, 10242, repeat), 
            gl.texParameteri(this._type, 10243, repeat), this._mipmap && gl.generateMipmap(this._type)) : (-1 !== minFifter || (minFifter = 9729), 
            -1 !== magFifter || (magFifter = 9729), gl.texParameteri(this._type, 10241, minFifter), 
            gl.texParameteri(this._type, 10240, magFifter), gl.texParameteri(this._type, 10242, 33071), 
            gl.texParameteri(this._type, 10243, 33071)), preTarget && preTexture && WebGLContext.bindTexture(gl, preTarget, preTexture), 
            this.memorySize = isPot ? w * h * 4 * (1 + 1 / 3) : w * h * 4;
        }, __proto.recreateResource = function() {
            this._createWebGlTexture(), this.completeCreate();
        }, __proto.disposeResource = function() {
            this._source && (WebGL.mainContext.deleteTexture(this._source), this._source = null, 
            this.memorySize = 0);
        }, __static(SolidColorTexture2D, [ "magentaTexture", function() {
            var texture = new SolidColorTexture2D(new Vector4(1, 0, 1, 1));
            return texture.lock = !0, this.magentaTexture = texture;
        }, "grayTexture", function() {
            var texture = new SolidColorTexture2D(new Vector4(.5, .5, .5, 1));
            return texture.lock = !0, this.grayTexture = texture;
        } ]), SolidColorTexture2D;
    }()), Texture2D = function(_super) {
        function Texture2D(canRead, reapeat, format, mipmap) {
            this._canRead = !1, this._image = null, this._pixels = null, void 0 === canRead && (canRead = !1), 
            void 0 === reapeat && (reapeat = !0), void 0 === format && (format = 6408), void 0 === mipmap && (mipmap = !0), 
            Texture2D.__super.call(this), this._type = 3553, this._repeat = reapeat, this._canRead = canRead, 
            this._format = format, this._mipmap = mipmap;
        }
        __class(Texture2D, "laya.d3.resource.Texture2D", BaseTexture);
        var __proto = Texture2D.prototype;
        return __proto._createWebGlTexture = function() {
            if (!this._image) throw "create GLTextur err:no data:" + this._image;
            var gl = WebGL.mainContext, glTexture = this._source = gl.createTexture(), w = this._width, h = this._height, preTarget = WebGLContext.curBindTexTarget, preTexture = WebGLContext.curBindTexValue;
            switch (WebGLContext.bindTexture(gl, this._type, glTexture), this._format) {
              case 6407:
              case 6408:
                this._canRead ? gl.texImage2D(this._type, 0, this._format, w, h, 0, this._format, 5121, this._pixels) : this._image instanceof laya.webgl.resource.WebGLImage ? gl.texImage2D(this._type, 0, this._image._format, w, h, 0, this._image._format, 5121, this._image.atlasSource) : gl.texImage2D(this._type, 0, this._format, this._format, 5121, this._image);
                break;

              case WebGL.compressEtc1.COMPRESSED_RGB_ETC1_WEBGL:
                gl.compressedTexImage2D(this._type, 0, this._format, this._width, this._height, 0, this._image);
            }
            var minFifter = this._minFifter, magFifter = this._magFifter, repeat = this._repeat ? 10497 : 33071, wrapModeU = 0 == this._wrapModeU ? 10497 : 33071, wrapModeV = 0 == this._wrapModeV ? 10497 : 33071, isPot = Arith.isPOT(w, h);
            isPot ? (this._mipmap ? -1 !== minFifter || (minFifter = 9987) : -1 !== minFifter || (minFifter = 9729), 
            -1 !== magFifter || (magFifter = 9729), gl.texParameteri(this._type, 10241, minFifter), 
            gl.texParameteri(this._type, 10240, magFifter), gl.texParameteri(this._type, 10242, repeat), 
            gl.texParameteri(this._type, 10243, repeat), gl.texParameteri(this._type, 10242, wrapModeU), 
            gl.texParameteri(this._type, 10243, wrapModeV), this._mipmap && gl.generateMipmap(this._type)) : (-1 !== minFifter || (minFifter = 9729), 
            -1 !== magFifter || (magFifter = 9729), gl.texParameteri(this._type, 10241, minFifter), 
            gl.texParameteri(this._type, 10240, magFifter), gl.texParameteri(this._type, 10242, 33071), 
            gl.texParameteri(this._type, 10243, 33071)), preTarget && preTexture && WebGLContext.bindTexture(gl, preTarget, preTexture), 
            this._image.onload = null, this._image = null, this.memorySize = isPot ? w * h * 4 * (1 + 1 / 3) : w * h * 4;
        }, __proto.recreateResource = function() {
            this._createWebGlTexture(), this.completeCreate();
        }, __proto.onAsynLoaded = function(url, data, params) {
            if (params) {
                var canRead = params[0];
                void 0 !== canRead && (this._canRead = canRead);
                var repeat = params[1];
                void 0 !== repeat && (this._repeat = repeat);
                var format = params[2];
                void 0 !== format && (this._format = format);
                var mipmap = params[3];
                void 0 !== mipmap && (this._mipmap = mipmap);
                var wrapModeU = params.wrapModeU;
                void 0 !== wrapModeU && (this._wrapModeU = wrapModeU);
                var wrapModeV = params.wrapModeV;
                void 0 !== wrapModeV && (this._wrapModeV = wrapModeV);
            }
            switch (this._format) {
              case 6407:
              case 6408:
                var w = (this._image = data).width, h = data.height;
                this._width = w, this._height = h, this._size = new Size(w, h), this._canRead && (Render.isConchApp ? data instanceof window.HTMLElement && (this._pixels = new Uint8Array(data.getImageData(0, 0, w, h))) : (Browser.canvas.size(w, h), 
                Browser.canvas.clear(), Browser.context.drawImage(data, 0, 0, w, h), this._pixels = new Uint8Array(Browser.context.getImageData(0, 0, w, h).data.buffer)));
                break;

              case WebGL.compressEtc1.COMPRESSED_RGB_ETC1_WEBGL:
                var readData = new Byte(data);
                readData.readUTFBytes(4), readData.readUTFBytes(2), readData.getInt16();
                readData.endian = "bigEndian", this._width = readData.getInt16(), this._height = readData.getInt16(), 
                this._size = new Size(this._width, this._height);
                readData.getInt16(), readData.getInt16();
                this._image = new Uint8Array(data, readData.pos);
            }
            this.recreateResource(), this._endLoaded();
        }, __proto.getPixels = function() {
            if (this._canRead) return this._pixels;
            throw new Error("Texture2D: must set texture canRead is true.");
        }, __proto.disposeResource = function() {
            this._source && (WebGL.mainContext.deleteTexture(this._source), this._source = null, 
            this._image = null, this.memorySize = 0);
        }, __getset(0, __proto, "_src", function() {
            return this.url;
        }), __getset(0, __proto, "src", function() {
            return this.url;
        }), Texture2D.load = function(url) {
            return Laya.loader.create(url, null, null, Texture2D);
        }, Texture2D;
    }(), BaseCamera = function(_super) {
        function BaseCamera(nearPlane, farPlane) {
            BaseCamera.__super.call(this), void 0 === nearPlane && (nearPlane = .3), void 0 === farPlane && (farPlane = 1e3), 
            this._tempVector3 = new Vector3(), this._position = new Vector3(), this._up = new Vector3(), 
            this._forward = new Vector3(), this._right = new Vector3(), this._fieldOfView = 60, 
            this._useUserProjectionMatrix = !1, this._orthographic = !1, this._viewportExpressedInClipSpace = !0, 
            this._renderTargetSize = Size.fullScreen, this._orthographicVerticalSize = 10, this.renderingOrder = 0, 
            this._nearPlane = nearPlane, this._farPlane = farPlane, this.cullingMask = 2147483647, 
            this.clearFlag = 0, this.useOcclusionCulling = !0, this._calculateProjectionMatrix(), 
            Laya.stage.on("resize", this, this._onScreenSizeChanged);
        }
        __class(BaseCamera, "laya.d3.core.BaseCamera", _super);
        var __proto = BaseCamera.prototype;
        return __proto._sortCamerasByRenderingOrder = function() {
            if (this._displayedInStage) for (var cameraPool = this.scene._cameraPool, n = cameraPool.length - 1, i = 0; i < n; i++) if (cameraPool[i].renderingOrder > cameraPool[n].renderingOrder) {
                var tempCamera = cameraPool[i];
                cameraPool[i] = cameraPool[n], cameraPool[n] = tempCamera;
            }
        }, __proto._calculateProjectionMatrix = function() {}, __proto._onScreenSizeChanged = function() {
            this._calculateProjectionMatrix();
        }, __proto._prepareCameraToRender = function() {
            Layer._currentCameraCullingMask = this.cullingMask;
            var cameraSV = this._shaderValues;
            cameraSV.setValue(0, this.transform.position.elements), cameraSV.setValue(5, this.forward.elements), 
            cameraSV.setValue(6, this.up.elements);
        }, __proto._prepareCameraViewProject = function(viewMatrix, projectMatrix) {
            var cameraSV = this._shaderValues;
            cameraSV.setValue(1, viewMatrix.elements), cameraSV.setValue(2, projectMatrix.elements);
        }, __proto._renderCamera = function(gl, state, scene) {}, __proto.addLayer = function(layer) {
            29 !== layer.number && 30 != layer.number && (this.cullingMask = this.cullingMask | layer.mask);
        }, __proto.removeLayer = function(layer) {
            29 !== layer.number && 30 != layer.number && (this.cullingMask = this.cullingMask & ~layer.mask);
        }, __proto.addAllLayers = function() {
            this.cullingMask = 2147483647;
        }, __proto.removeAllLayers = function() {
            this.cullingMask = 0 | Layer.getLayerByNumber(29).mask | Layer.getLayerByNumber(30).mask;
        }, __proto.ResetProjectionMatrix = function() {
            this._useUserProjectionMatrix = !1, this._calculateProjectionMatrix();
        }, __proto.moveForward = function(distance) {
            this._tempVector3.elements[0] = this._tempVector3.elements[1] = 0, this._tempVector3.elements[2] = distance, 
            this.transform.translate(this._tempVector3);
        }, __proto.moveRight = function(distance) {
            this._tempVector3.elements[1] = this._tempVector3.elements[2] = 0, this._tempVector3.elements[0] = distance, 
            this.transform.translate(this._tempVector3);
        }, __proto.moveVertical = function(distance) {
            this._tempVector3.elements[0] = this._tempVector3.elements[2] = 0, this._tempVector3.elements[1] = distance, 
            this.transform.translate(this._tempVector3, !1);
        }, __proto._addSelfRenderObjects = function() {
            var cameraPool = this.scene._cameraPool, cmaeraCount = cameraPool.length;
            if (0 < cmaeraCount) {
                for (var i = cmaeraCount - 1; 0 <= i; i--) if (this.renderingOrder <= cameraPool[i].renderingOrder) {
                    cameraPool.splice(i + 1, 0, this);
                    break;
                }
            } else cameraPool.push(this), this.scene.conchModel && this.scene.conchModel.setCurrentCamera(this.conchModel);
        }, __proto._clearSelfRenderObjects = function() {
            var cameraPool = this.scene._cameraPool;
            cameraPool.splice(cameraPool.indexOf(this), 1);
        }, __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), this._sky && this._sky.destroy(), 
            this.renderTarget = null, Laya.stage.off("resize", this, this._onScreenSizeChanged), 
            _super.prototype.destroy.call(this, destroyChild);
        }, __getset(0, __proto, "sky", function() {
            return this._sky;
        }, function(value) {
            (this._sky = value)._ownerCamera = this;
        }), __getset(0, __proto, "forward", function() {
            var worldMatrixe = this.transform.worldMatrix.elements, forwarde = this._forward.elements;
            return forwarde[0] = -worldMatrixe[8], forwarde[1] = -worldMatrixe[9], forwarde[2] = -worldMatrixe[10], 
            this._forward;
        }), __getset(0, __proto, "position", function() {
            var worldMatrixe = this.transform.worldMatrix.elements, positione = this._position.elements;
            return positione[0] = worldMatrixe[12], positione[1] = worldMatrixe[13], positione[2] = worldMatrixe[14], 
            this._position;
        }), __getset(0, __proto, "renderTarget", function() {
            return this._renderTarget;
        }, function(value) {
            null != (this._renderTarget = value) && (this._renderTargetSize = value.size);
        }), __getset(0, __proto, "up", function() {
            var worldMatrixe = this.transform.worldMatrix.elements, upe = this._up.elements;
            return upe[0] = worldMatrixe[4], upe[1] = worldMatrixe[5], upe[2] = worldMatrixe[6], 
            this._up;
        }), __getset(0, __proto, "right", function() {
            var worldMatrixe = this.transform.worldMatrix.elements, righte = this._right.elements;
            return righte[0] = worldMatrixe[0], righte[1] = worldMatrixe[1], righte[2] = worldMatrixe[2], 
            this._right;
        }), __getset(0, __proto, "renderTargetSize", function() {
            return this._renderTargetSize;
        }, function(value) {
            null != this.renderTarget && this._renderTargetSize, this._renderTargetSize = value, 
            this._calculateProjectionMatrix();
        }), __getset(0, __proto, "fieldOfView", function() {
            return this._fieldOfView;
        }, function(value) {
            this._fieldOfView = value, this._calculateProjectionMatrix();
        }), __getset(0, __proto, "nearPlane", function() {
            return this._nearPlane;
        }, function(value) {
            this._nearPlane = value, this._calculateProjectionMatrix();
        }), __getset(0, __proto, "farPlane", function() {
            return this._farPlane;
        }, function(vaule) {
            this._farPlane = vaule, this._calculateProjectionMatrix();
        }), __getset(0, __proto, "orthographic", function() {
            return this._orthographic;
        }, function(vaule) {
            this._orthographic = vaule, this._calculateProjectionMatrix();
        }), __getset(0, __proto, "orthographicVerticalSize", function() {
            return this._orthographicVerticalSize;
        }, function(vaule) {
            this._orthographicVerticalSize = vaule, this._calculateProjectionMatrix();
        }), __getset(0, __proto, "renderingOrder", function() {
            return this._renderingOrder;
        }, function(value) {
            this._renderingOrder = value, this._sortCamerasByRenderingOrder();
        }), BaseCamera.CAMERAPOS = 0, BaseCamera.VIEWMATRIX = 1, BaseCamera.PROJECTMATRIX = 2, 
        BaseCamera.VPMATRIX = 3, BaseCamera.VPMATRIX_NO_TRANSLATE = 4, BaseCamera.CAMERADIRECTION = 5, 
        BaseCamera.CAMERAUP = 6, BaseCamera.ENVIRONMENTDIFFUSE = 7, BaseCamera.ENVIRONMENTSPECULAR = 8, 
        BaseCamera.SIMLODINFO = 9, BaseCamera.DIFFUSEIRRADMATR = 10, BaseCamera.DIFFUSEIRRADMATG = 11, 
        BaseCamera.DIFFUSEIRRADMATB = 12, BaseCamera.HDREXPOSURE = 13, BaseCamera.RENDERINGTYPE_DEFERREDLIGHTING = "DEFERREDLIGHTING", 
        BaseCamera.RENDERINGTYPE_FORWARDRENDERING = "FORWARDRENDERING", BaseCamera.CLEARFLAG_SOLIDCOLOR = 0, 
        BaseCamera.CLEARFLAG_SKY = 1, BaseCamera.CLEARFLAG_DEPTHONLY = 2, BaseCamera.CLEARFLAG_NONE = 3, 
        __static(BaseCamera, [ "_invertYScaleMatrix", function() {
            return this._invertYScaleMatrix = new Matrix4x4(1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
        }, "_invertYProjectionMatrix", function() {
            return this._invertYProjectionMatrix = new Matrix4x4();
        }, "_invertYProjectionViewMatrix", function() {
            return this._invertYProjectionViewMatrix = new Matrix4x4();
        } ]), BaseCamera;
    }(Sprite3D), RenderableSprite3D = function(_super) {
        function RenderableSprite3D(name) {
            this._render = null, this._geometryFilter = null, RenderableSprite3D.__super.call(this, name);
        }
        __class(RenderableSprite3D, "laya.d3.core.RenderableSprite3D", _super);
        var __proto = RenderableSprite3D.prototype;
        return __proto._addToInitStaticBatchManager = function() {}, __proto._setBelongScene = function(scene) {
            _super.prototype._setBelongScene.call(this, scene), scene._renderableSprite3Ds.push(this), 
            this._render._applyLightMapParams();
        }, __proto._setUnBelongScene = function() {
            var renderableSprite3Ds = this._scene._renderableSprite3Ds, index = renderableSprite3Ds.indexOf(this);
            renderableSprite3Ds.splice(index, 1), this._render._removeShaderDefine(laya.d3.core.RenderableSprite3D.SAHDERDEFINE_LIGHTMAP), 
            _super.prototype._setUnBelongScene.call(this);
        }, __proto._update = function(state) {
            (state.owner = this)._activeInHierarchy && (this._updateComponents(state), this._render._updateOctreeNode(), 
            this._lateUpdateComponents(state), Stat.spriteCount++, this._childs.length && this._updateChilds(state));
        }, __proto.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), _super.prototype.destroy.call(this, destroyChild), 
            this._render._destroy(), this._render = null;
        }, RenderableSprite3D.__init__ = function() {
            RenderableSprite3D.SHADERDEFINE_SCALEOFFSETLIGHTINGMAPUV = RenderableSprite3D.shaderDefines.registerDefine("SCALEOFFSETLIGHTINGMAPUV"), 
            RenderableSprite3D.SAHDERDEFINE_LIGHTMAP = RenderableSprite3D.shaderDefines.registerDefine("LIGHTMAP");
        }, RenderableSprite3D.SHADERDEFINE_SCALEOFFSETLIGHTINGMAPUV = 2, RenderableSprite3D.SAHDERDEFINE_LIGHTMAP = 4, 
        RenderableSprite3D.LIGHTMAPSCALEOFFSET = 2, RenderableSprite3D.LIGHTMAP = 3, __static(RenderableSprite3D, [ "shaderDefines", function() {
            return this.shaderDefines = new ShaderDefines$1();
        } ]), RenderableSprite3D;
    }(Sprite3D), Camera = function(_super) {
        function Camera(aspectRatio, nearPlane, farPlane) {
            void 0 === aspectRatio && (aspectRatio = 0), void 0 === nearPlane && (nearPlane = .3), 
            void 0 === farPlane && (farPlane = 1e3), this._viewMatrix = new Matrix4x4(), this._projectionMatrix = new Matrix4x4(), 
            this._projectionViewMatrix = new Matrix4x4(), this._viewport = new Viewport(0, 0, 0, 0), 
            this._normalizedViewport = new Viewport(0, 0, 1, 1), this._aspectRatio = aspectRatio, 
            this._boundFrustumUpdate = !0, this._boundFrustum = new BoundFrustum(Matrix4x4.DEFAULT), 
            Camera.__super.call(this, nearPlane, farPlane), this.transform.on("worldmatrixneedchanged", this, this._onWorldMatrixChanged);
        }
        __class(Camera, "laya.d3.core.Camera", BaseCamera);
        var __proto = Camera.prototype;
        return __proto._onWorldMatrixChanged = function() {
            this._boundFrustumUpdate = !0;
        }, __proto._parseCustomProps = function(rootNode, innerResouMap, customProps, json) {
            var color = customProps.clearColor;
            this.clearColor = new Vector4(color[0], color[1], color[2], color[3]);
            var viewport = customProps.viewport;
            this.normalizedViewport = new Viewport(viewport[0], viewport[1], viewport[2], viewport[3]);
        }, __proto._calculateProjectionMatrix = function() {
            if (!this._useUserProjectionMatrix) if (this._orthographic) {
                var halfWidth = this.orthographicVerticalSize * this.aspectRatio * .5, halfHeight = .5 * this.orthographicVerticalSize;
                Matrix4x4.createOrthoOffCenterRH(-halfWidth, halfWidth, -halfHeight, halfHeight, this.nearPlane, this.farPlane, this._projectionMatrix);
            } else Matrix4x4.createPerspective(3.1416 * this.fieldOfView / 180, this.aspectRatio, this.nearPlane, this.farPlane, this._projectionMatrix);
            this._boundFrustumUpdate = !0;
        }, __proto._update = function(state) {
            this.conchModel && (this.conchModel.setViewMatrix(this.viewMatrix.elements), this.conchModel.setProjectMatrix(this.projectionMatrix.elements)), 
            laya.d3.core.Sprite3D.prototype._update.call(this, state);
        }, __proto._renderCamera = function(gl, state, scene) {
            var viewMat, projectMat;
            scene.parallelSplitShadowMaps[0] && scene._renderShadowMap(gl, state, this), (state.camera = this)._prepareCameraToRender(), 
            scene._preRenderUpdateComponents(state), viewMat = state._viewMatrix = this.viewMatrix;
            var renderTar = this._renderTarget;
            renderTar ? (renderTar.start(), Matrix4x4.multiply(BaseCamera._invertYScaleMatrix, this._projectionMatrix, BaseCamera._invertYProjectionMatrix), 
            Matrix4x4.multiply(BaseCamera._invertYScaleMatrix, this.projectionViewMatrix, BaseCamera._invertYProjectionViewMatrix), 
            projectMat = state._projectionMatrix = BaseCamera._invertYProjectionMatrix, state._projectionViewMatrix = BaseCamera._invertYProjectionViewMatrix) : (projectMat = state._projectionMatrix = this._projectionMatrix, 
            state._projectionViewMatrix = this.projectionViewMatrix), this._prepareCameraViewProject(viewMat, projectMat), 
            state._viewport = this.viewport, scene._preRenderScene(gl, state, this.boundFrustum), 
            scene._clear(gl, state), scene._renderScene(gl, state), scene._postRenderUpdateComponents(state), 
            renderTar && renderTar.end();
        }, __proto.viewportPointToRay = function(point, out) {
            Picker.calculateCursorRay(point, this.viewport, this._projectionMatrix, this.viewMatrix, null, out);
        }, __proto.normalizedViewportPointToRay = function(point, out) {
            var finalPoint = Camera._tempVector20, vp = this.viewport, nVpPosE = point.elements, vpPosE = finalPoint.elements;
            vpPosE[0] = nVpPosE[0] * vp.width, vpPosE[1] = nVpPosE[1] * vp.height, Picker.calculateCursorRay(finalPoint, this.viewport, this._projectionMatrix, this.viewMatrix, null, out);
        }, __proto.worldToViewportPoint = function(position, out) {
            Matrix4x4.multiply(this._projectionMatrix, this._viewMatrix, this._projectionViewMatrix), 
            this.viewport.project(position, this._projectionViewMatrix, out);
            var outE = out.elements;
            outE[0] = outE[0] / Laya.stage.clientScaleX, outE[1] = outE[1] / Laya.stage.clientScaleY;
        }, __proto.worldToNormalizedViewportPoint = function(position, out) {
            Matrix4x4.multiply(this._projectionMatrix, this._viewMatrix, this._projectionViewMatrix), 
            this.normalizedViewport.project(position, this._projectionViewMatrix, out);
            var outE = out.elements;
            outE[0] = outE[0] / Laya.stage.clientScaleX, outE[1] = outE[1] / Laya.stage.clientScaleY;
        }, __proto.convertScreenCoordToOrthographicCoord = function(source, out) {
            if (this._orthographic) {
                var clientWidth = RenderState.clientWidth, clientHeight = RenderState.clientHeight, ratioX = this.orthographicVerticalSize * this.aspectRatio / clientWidth, ratioY = this.orthographicVerticalSize / clientHeight, sE = source.elements, oE = out.elements;
                return oE[0] = (-clientWidth / 2 + sE[0]) * ratioX, oE[1] = (clientHeight / 2 - sE[1]) * ratioY, 
                oE[2] = (this.nearPlane - this.farPlane) * (sE[2] + 1) / 2 - this.nearPlane, Vector3.transformCoordinate(out, this.transform.worldMatrix, out), 
                !0;
            }
            return !1;
        }, __getset(0, __proto, "projectionViewMatrix", function() {
            return Matrix4x4.multiply(this.projectionMatrix, this.viewMatrix, this._projectionViewMatrix), 
            this._projectionViewMatrix;
        }), __getset(0, __proto, "aspectRatio", function() {
            if (0 !== this._aspectRatio) return this._aspectRatio;
            var vp = this.viewport;
            return vp.width / vp.height;
        }, function(value) {
            if (value < 0) throw new Error("Camera: the aspect ratio has to be a positive real number.");
            this._aspectRatio = value, this._calculateProjectionMatrix();
        }), __getset(0, __proto, "boundFrustum", function() {
            return this._boundFrustumUpdate && (this._boundFrustum.matrix = this.projectionViewMatrix), 
            this._boundFrustum;
        }), __getset(0, __proto, "needViewport", function() {
            var nVp = this.normalizedViewport;
            return 0 === nVp.x && 0 === nVp.y && 1 === nVp.width && 1 === nVp.height;
        }), __getset(0, __proto, "viewport", function() {
            if (this._viewportExpressedInClipSpace) {
                var nVp = this._normalizedViewport, size = this.renderTargetSize, sizeW = size.width, sizeH = size.height;
                this._viewport.x = nVp.x * sizeW, this._viewport.y = nVp.y * sizeH, this._viewport.width = nVp.width * sizeW, 
                this._viewport.height = nVp.height * sizeH;
            }
            return this._viewport;
        }, function(value) {
            if (null != this.renderTarget && (value.x < 0 || value.y < 0 || 0 == value.width || 0 == value.height)) throw new Error("Camera: viewport size invalid.", "value");
            this._viewportExpressedInClipSpace = !1, this._viewport = value, this._calculateProjectionMatrix();
        }), __getset(0, __proto, "normalizedViewport", function() {
            if (!this._viewportExpressedInClipSpace) {
                var vp = this._viewport, size = this.renderTargetSize, sizeW = size.width, sizeH = size.height;
                this._normalizedViewport.x = vp.x / sizeW, this._normalizedViewport.y = vp.y / sizeH, 
                this._normalizedViewport.width = vp.width / sizeW, this._normalizedViewport.height = vp.height / sizeH;
            }
            return this._normalizedViewport;
        }, function(value) {
            value.x < 0 && (value.x = 0, console.warn("Camera: viewport.x must large than 0.0.")), 
            value.y < 0 && (value.y = 0, console.warn("Camera: viewport.y must large than 0.0.")), 
            1 < value.x + value.width && (value.width = 1 - value.x, console.warn("Camera: viewport.width + viewport.x must less than 1.0.")), 
            1 < value.y + value.height && (value.height = 1 - value.y, console.warn("Camera: viewport.height + viewport.y must less than 1.0.")), 
            this._viewportExpressedInClipSpace = !0, this._normalizedViewport = value, this._calculateProjectionMatrix();
        }), __getset(0, __proto, "projectionMatrix", function() {
            return this._projectionMatrix;
        }, function(value) {
            this._projectionMatrix = value, this._useUserProjectionMatrix = !0;
        }), __getset(0, __proto, "viewMatrix", function() {
            return this.transform.worldMatrix.invert(this._viewMatrix), this._viewMatrix;
        }), __static(Camera, [ "_tempVector20", function() {
            return this._tempVector20 = new Vector2();
        } ]), Camera;
    }(), MeshSprite3D = function(_super) {
        function MeshSprite3D(mesh, name) {
            MeshSprite3D.__super.call(this, name), this._geometryFilter = new MeshFilter(this), 
            this._render = new MeshRender(this), this._geometryFilter.on("meshchanged", this, this._onMeshChanged), 
            this._render.on("materialchanged", this, this._onMaterialChanged), mesh && (this._geometryFilter.sharedMesh = mesh) instanceof laya.d3.resource.models.Mesh && (mesh.loaded ? this._render.sharedMaterials = mesh.materials : mesh.once("loaded", this, this._applyMeshMaterials));
        }
        __class(MeshSprite3D, "laya.d3.core.MeshSprite3D", _super);
        var __proto = MeshSprite3D.prototype;
        return __proto._changeRenderObjectByMesh = function(index) {
            var renderObjects = this._render._renderElements, renderElement = renderObjects[index];
            renderElement || (renderElement = renderObjects[index] = new SubMeshRenderElement()), 
            renderElement._render = this._render;
            var material = this._render.sharedMaterials[index];
            material || (material = StandardMaterial.defaultMaterial);
            var renderObj = this._geometryFilter.sharedMesh.getRenderElement(index);
            return renderElement._mainSortID = this._getSortID(renderObj, material), renderElement._sprite3D = this, 
            renderElement.renderObj = renderObj, renderElement._material = material, renderElement;
        }, __proto._changeRenderObjectByMaterial = function(index, material) {
            var renderElement = this._render._renderElements[index];
            material || (material = StandardMaterial.defaultMaterial);
            var renderObj = this._geometryFilter.sharedMesh.getRenderElement(index);
            return renderElement._mainSortID = this._getSortID(renderObj, material), renderElement._sprite3D = this, 
            renderElement.renderObj = renderObj, renderElement._material = material, renderElement;
        }, __proto._changeRenderObjectsByMesh = function() {
            var renderElementsCount = this._geometryFilter.sharedMesh.getRenderElementsCount();
            this._render._renderElements.length = renderElementsCount;
            for (var i = 0; i < renderElementsCount; i++) this._changeRenderObjectByMesh(i);
        }, __proto._onMeshChanged = function(meshFilter) {
            var mesh = meshFilter.sharedMesh;
            mesh.loaded ? this._changeRenderObjectsByMesh() : mesh.once("loaded", this, this._onMeshLoaded);
        }, __proto._onMeshLoaded = function(sender) {
            sender === this.meshFilter.sharedMesh && this._changeRenderObjectsByMesh();
        }, __proto._onMaterialChanged = function(meshRender, index, material) {
            index < this._render._renderElements.length && this._changeRenderObjectByMaterial(index, material);
        }, __proto._clearSelfRenderObjects = function() {
            this.scene.removeFrustumCullingObject(this._render);
        }, __proto._addSelfRenderObjects = function() {
            this.scene.addFrustumCullingObject(this._render);
        }, __proto._parseCustomProps = function(rootNode, innerResouMap, customProps, json) {
            var render = this.meshRender, lightmapIndex = customProps.lightmapIndex;
            null != lightmapIndex && (render.lightmapIndex = lightmapIndex);
            var meshPath, mesh, lightmapScaleOffsetArray = customProps.lightmapScaleOffset;
            if (lightmapScaleOffsetArray && (render.lightmapScaleOffset = new Vector4(lightmapScaleOffsetArray[0], lightmapScaleOffsetArray[1], lightmapScaleOffsetArray[2], lightmapScaleOffsetArray[3])), 
            json.instanceParams) (meshPath = json.instanceParams.loadPath) && (mesh = Loader.getRes(innerResouMap[meshPath]), 
            (this.meshFilter.sharedMesh = mesh).loaded ? render.sharedMaterials = mesh.materials : mesh.once("loaded", this, this._applyMeshMaterials)); else {
                (meshPath = customProps.meshPath) && (mesh = Loader.getRes(innerResouMap[meshPath]), 
                this.meshFilter.sharedMesh = mesh);
                var materials = customProps.materials;
                if (materials) {
                    var sharedMaterials = render.sharedMaterials, materialCount = materials.length;
                    sharedMaterials.length = materialCount;
                    for (var i = 0; i < materialCount; i++) sharedMaterials[i] = Loader.getRes(innerResouMap[materials[i].path]);
                    render.sharedMaterials = sharedMaterials;
                }
            }
        }, __proto._applyMeshMaterials = function(mesh) {
            for (var shaderMaterials = this._render.sharedMaterials, meshMaterials = mesh.materials, i = 0, n = meshMaterials.length; i < n; i++) shaderMaterials[i] || (shaderMaterials[i] = meshMaterials[i]);
            this._render.sharedMaterials = shaderMaterials;
        }, __proto._addToInitStaticBatchManager = function() {
            MeshSprite3D._staticBatchManager._addInitBatchSprite(this);
        }, __proto.cloneTo = function(destObject) {
            var meshSprite3D = destObject;
            meshSprite3D._geometryFilter.sharedMesh = this._geometryFilter.sharedMesh;
            var meshRender = this._render, destMeshRender = meshSprite3D._render;
            destMeshRender.enable = meshRender.enable, destMeshRender.sharedMaterials = meshRender.sharedMaterials, 
            destMeshRender.castShadow = meshRender.castShadow;
            var lightmapScaleOffset = meshRender.lightmapScaleOffset;
            lightmapScaleOffset && (destMeshRender.lightmapScaleOffset = lightmapScaleOffset.clone()), 
            destMeshRender.lightmapIndex = meshRender.lightmapIndex, destMeshRender.receiveShadow = meshRender.receiveShadow, 
            destMeshRender.sortingFudge = meshRender.sortingFudge, laya.d3.core.Sprite3D.prototype.cloneTo.call(this, destObject);
        }, __proto.destroy = function(destroyChild) {
            if (void 0 === destroyChild && (destroyChild = !0), !this.destroyed) {
                var mesh = this.meshFilter.sharedMesh;
                null != mesh && (mesh.loaded || mesh.off("loaded", this, this._applyMeshMaterials)), 
                _super.prototype.destroy.call(this, destroyChild), this._geometryFilter._destroy();
            }
        }, __getset(0, __proto, "meshFilter", function() {
            return this._geometryFilter;
        }), __getset(0, __proto, "meshRender", function() {
            return this._render;
        }), MeshSprite3D.__init__ = function() {
            StaticBatchManager._staticBatchManagers.push(MeshSprite3D._staticBatchManager);
        }, MeshSprite3D.load = function(url) {
            return Laya.loader.create(url, null, null, MeshSprite3D);
        }, __static(MeshSprite3D, [ "_staticBatchManager", function() {
            return this._staticBatchManager = new MeshSprite3DStaticBatchManager();
        } ]), MeshSprite3D;
    }(RenderableSprite3D);
}(window, document, Laya), "function" == typeof define && define.amd && define("laya.core", [ "arequire", "exports" ], function(arequire, exports) {
    "use strict";
    for (var i in Object.defineProperty(exports, "__esModule", {
        value: !0
    }), Laya) {
        var o = Laya[i];
        o && o.__isclass && (exports[i] = o);
    }
}), function(window, document, Laya) {
    Laya.un, Laya.uns;
    var __static = Laya.static, __class = Laya.class, __getset = Laya.getset, Browser = (Laya.__newvec, 
    laya.utils.Browser), EventDispatcher = (laya.events.Event, laya.events.EventDispatcher), HTMLImage = laya.resource.HTMLImage, Handler = laya.utils.Handler, Input = laya.display.Input, Loader = laya.net.Loader, LocalStorage = laya.net.LocalStorage, Render = (laya.maths.Matrix, 
    laya.renders.Render), RunDriver = laya.utils.RunDriver, SoundChannel = laya.media.SoundChannel, SoundManager = laya.media.SoundManager, URL = laya.net.URL, Utils = laya.utils.Utils, MiniAdpter = function() {
        function MiniAdpter() {}
        return __class(MiniAdpter, "laya.wx.mini.MiniAdpter"), MiniAdpter.getJson = function(data) {
            return JSON.parse(data);
        }, MiniAdpter.init = function(isPosMsg, isSon) {
            if (void 0 === isPosMsg && (isPosMsg = !1), void 0 === isSon && (isSon = !1), !(MiniAdpter._inited || (MiniAdpter._inited = !0, 
            (MiniAdpter.window = window).navigator.userAgent.indexOf("MiniGame") < 0))) {
                MiniAdpter.EnvConfig = {};
                try {
                    laya.webgl.resource.WebGLCanvas.premulAlpha = !0;
                } catch (e) {}
                MiniFileMgr.setNativeFileDir("/layaairGame"), MiniFileMgr.existDir(MiniFileMgr.fileNativeDir, Handler.create(MiniAdpter, MiniAdpter.onMkdirCallBack)), 
                MiniAdpter.systemInfo = wx.getSystemInfoSync(), MiniAdpter.window.focus = function() {}, 
                Laya._getUrlPath = function() {}, MiniAdpter.window.logtime = function(str) {}, 
                MiniAdpter.window.alertTimeLog = function(str) {}, MiniAdpter.window.resetShareInfo = function() {}, 
                MiniAdpter.window.CanvasRenderingContext2D = function() {}, MiniAdpter.window.CanvasRenderingContext2D.prototype = MiniAdpter.window.wx.createCanvas().getContext("2d").__proto__, 
                MiniAdpter.window.document.body.appendChild = function() {}, MiniAdpter.EnvConfig.pixelRatioInt = 0, 
                RunDriver.getPixelRatio = MiniAdpter.pixelRatio, MiniAdpter._preCreateElement = Browser.createElement, 
                Browser.createElement = MiniAdpter.createElement, RunDriver.createShaderCondition = MiniAdpter.createShaderCondition, 
                Utils.parseXMLFromString = MiniAdpter.parseXMLFromString, Input._createInputElement = MiniInput._createInputElement, 
                base.background.system.HttpFileSystem.fromCache = MiniAdpter.fromCache, base.background.system.HttpFileSystem.openEntry = MiniAdpter.openEntry, 
                base.background.system.IndexedDBCache.writeCache = MiniAdpter.writeCache, base.background.system.IndexedDBCache.readCache = MiniAdpter.readCache, 
                (LocalStorage._baseClass = MiniLocalStorage).__init__();
            }
        }, MiniAdpter.writeCache = function(url, version, buffer) {
            51200 < buffer.byteLength && MiniFileMgr.writeFile(url, version, buffer, buffer.byteLength, "");
        }, MiniAdpter.readCache = function(url, callback) {
            var tmpUrl = window.tempFiles[url];
            if (tmpUrl) MiniFileMgr.fs.getFileInfo({
                filePath: tmpUrl,
                success: function(res) {
                    MiniAdpter.createImg(url, tmpUrl);
                },
                fail: function(res) {
                    callback(url, 0, null);
                }
            }); else {
                var turl = url.replace(/\//g, "."), fp = MiniFileMgr.getFileNativePath(turl);
                MiniFileMgr.fs.getFileInfo({
                    filePath: fp,
                    success: function(res) {
                        var info = MiniFileMgr.getFileInfo(url);
                        info ? -1 !== url.indexOf(".png") || -1 !== url.indexOf(".jpg") ? (info.time = Date.now(), 
                        callback(url, info.version, 1)) : MiniFileMgr.fs.readFile({
                            filePath: fp,
                            success: function(res) {
                                info.time = Date.now(), callback(url, info.version, res.data);
                            },
                            fail: function(res) {
                                callback(url, 0, null);
                            }
                        }) : callback(url, 0, null);
                    },
                    fail: function(res) {
                        callback(url, 0, null);
                    }
                });
            }
        }, MiniAdpter.fromCache = function(url, version, buffer) {
            var HttpFileSystem = base.background.system.HttpFileSystem;
            if (null == buffer || HttpFileSystem._versionPool[url] != version) {
                var entry = HttpFileSystem._loaderPool[url];
                HttpFileSystem.openEntry(entry);
            } else if (1 == buffer) {
                var turl = url.replace(/\//g, ".");
                MiniAdpter.createImg(url, MiniFileMgr.getFileNativePath(turl));
            } else HttpFileSystem.onComplete(url, 0, buffer);
        }, MiniAdpter.createImg = function(url, realUrl) {
            var HttpFileSystem = base.background.system.HttpFileSystem, source_1 = new Image();
            source_1.crossOrigin = url && 0 == url.indexOf("data:") ? null : "anonymous", source_1.onload = function(e) {
                source_1.onload = source_1.onerror = null, HttpFileSystem.onComplete(url, 200, source_1);
            }, source_1.onerror = function() {
                source_1.onload = source_1.onerror = null, HttpFileSystem.onComplete(url, 404, null);
            }, source_1.src = realUrl;
        }, MiniAdpter.openEntry = function(entry) {
            if (0 == entry.status) {
                entry.startTime = Date.now();
                var url = entry.url;
                if (entry.status = 1, 0 !== url.indexOf("data:image")) {
                    var s = url.toLowerCase(), HttpFileSystem = base.background.system.HttpFileSystem;
                    if (this._enableRaw || !StringUtils.endsWith(s, ".jpg") && !StringUtils.endsWith(s, ".png")) if (-1 != s.indexOf("local_res")) MiniFileMgr.fs.readFile({
                        filePath: url,
                        success: function(res) {
                            HttpFileSystem.onComplete(url, 0, res.data);
                        }
                    }); else {
                        var request = entry.request = 0 != HttpFileSystem._processorQueue.length ? HttpFileSystem._processorQueue.pop() : new XMLHttpRequest();
                        request.responseType = "arraybuffer", request.onreadystatechange = function(e) {
                            var request = e.target;
                            if (4 == request.readyState) if (200 == request.status || 0 == request.status && null != request.response && 0 < request.response.byteLength) null != HttpFileSystem._versionPool[url] && base.background.system.IndexedDBCache.writeCache(url, HttpFileSystem._versionPool[url], request.response), 
                            HttpFileSystem.onComplete(url, request.status, request.response); else if (0 == --entry.live) HttpFileSystem.onComplete(url, request.status, null); else {
                                request.abort();
                                var version_1 = HttpFileSystem._versionPool[url] || Date.now();
                                request.open("GET", "" + MiniAdpter.getHost(url) + url + "?v=" + version_1), request.send();
                            }
                        };
                        version = HttpFileSystem._versionPool[url] || Date.now();
                        request.open("GET", 0 == url.indexOf("local_res") ? url : "" + MiniAdpter.getHost(url) + url + "?v=" + version), 
                        request.send();
                    } else {
                        if (0 == url.indexOf("local_res")) return void MiniAdpter.createImg(url, url);
                        var host = MiniAdpter.getHost(url), version = HttpFileSystem._versionPool[url] || Date.now();
                        wx.downloadFile({
                            url: host + url + "?v=" + version,
                            success: function(res) {
                                MiniFileMgr.fs.getFileInfo({
                                    filePath: res.tempFilePath,
                                    success: function(res1) {
                                        51200 < res1.size && host ? MiniFileMgr.writeFile(url, version, null, res1.size, res.tempFilePath) : (window.tempFiles[url] = res.tempFilePath, 
                                        MiniAdpter.createImg(url, res.tempFilePath));
                                    },
                                    fail: function(res1) {}
                                });
                            },
                            fail: function() {
                                HttpFileSystem.onComplete(url, 404, null);
                            }
                        });
                    }
                } else MiniAdpter.createImg(url, url);
            }
        }, MiniAdpter.getHost = function(str) {
            return -1 == str.indexOf(":") ? base.background.system.HttpFileSystem._host : "";
        }, MiniAdpter.measureText = function(str) {
            var tempObj = MiniAdpter._measureText(str);
            return tempObj || (tempObj = {
                width: 16
            }, console.warn("-------微信获取文字宽度失败----等待修复---------")), tempObj;
        }, MiniAdpter.getUrlEncode = function(url, type) {
            return -1 != url.indexOf(".fnt") ? "utf8" : "arraybuffer" == type ? "" : "ascii";
        }, MiniAdpter.downLoadFile = function(fileUrl, fileType, callBack, encoding) {
            void 0 === fileType && (fileType = ""), void 0 === encoding && (encoding = "ascii"), 
            MiniFileMgr.getFileInfo(fileUrl) ? null != callBack && callBack.runWith([ 0 ]) : MiniFileMgr.downLoadFile(fileUrl, fileType, callBack, encoding);
        }, MiniAdpter.remove = function(fileUrl, callBack) {
            MiniFileMgr.deleteFile("", fileUrl, callBack, "", 0);
        }, MiniAdpter.removeAll = function() {
            MiniFileMgr.deleteAll();
        }, MiniAdpter.hasNativeFile = function(fileUrl) {
            return MiniFileMgr.isLocalNativeFile(fileUrl);
        }, MiniAdpter.getFileInfo = function(fileUrl) {
            return MiniFileMgr.getFileInfo(fileUrl);
        }, MiniAdpter.getFileList = function() {
            return MiniFileMgr.filesListObj;
        }, MiniAdpter.exitMiniProgram = function() {
            MiniAdpter.window.wx.exitMiniProgram();
        }, MiniAdpter.onMkdirCallBack = function(errorCode, data) {
            errorCode || (MiniFileMgr.filesListObj = JSON.parse(data.data));
        }, MiniAdpter.pixelRatio = function() {
            if (!MiniAdpter.EnvConfig.pixelRatioInt) try {
                return MiniAdpter.EnvConfig.pixelRatioInt = MiniAdpter.systemInfo.pixelRatio, MiniAdpter.systemInfo.pixelRatio;
            } catch (error) {}
            return MiniAdpter.EnvConfig.pixelRatioInt;
        }, MiniAdpter.createElement = function(type) {
            var _source;
            if ("canvas" == type) return _source = 1 == MiniAdpter.idx ? window.canvas : window.wx.createCanvas(), 
            MiniAdpter.idx++, _source;
            if ("textarea" == type || "input" == type) return MiniAdpter.onCreateInput(type);
            if ("div" != type) return MiniAdpter._preCreateElement(type);
            var node = MiniAdpter._preCreateElement(type);
            return node.contains = function(value) {
                return null;
            }, node.removeChild = function(value) {}, node;
        }, MiniAdpter.onCreateInput = function(type) {
            var node = MiniAdpter._preCreateElement(type);
            return node.focus = MiniInput.wxinputFocus, node.blur = MiniInput.wxinputblur, node.style = {}, 
            node.value = 0, node.parentElement = {}, node.placeholder = {}, node.type = {}, 
            node.setColor = function(value) {}, node.setType = function(value) {}, node.setFontFace = function(value) {}, 
            node.addEventListener = function(value) {}, node.contains = function(value) {
                return null;
            }, node.removeChild = function(value) {}, node;
        }, MiniAdpter.createShaderCondition = function(conditionScript) {
            var _$this = this;
            return function() {
                return _$this[conditionScript.replace("this.", "")];
            };
        }, MiniAdpter.sendAtlasToOpenDataContext = function(url) {
            var atlasJson = Loader.getRes(url);
            if (!atlasJson) throw "传递的url没有获取到对应的图集数据信息，请确保图集已经过！";
            var textureUrl, postData = {
                frames: atlasJson.frames,
                meta: atlasJson.meta
            };
            textureUrl = url.indexOf(".atlas") ? url.replace(".atlas", ".png") : url.replace(".json", ".png");
            var fileMd5Name = MiniFileMgr.getFileInfo(textureUrl).md5, fileNativeUrl = MiniFileMgr.getFileNativePath(fileMd5Name);
            if (!fileNativeUrl) throw "获取图集的磁盘url路径不存在！";
            wx.postMessage({
                url: url,
                atlasdata: postData,
                imgNativeUrl: fileNativeUrl,
                imgReadyUrl: textureUrl,
                isLoad: "opendatacontext"
            });
        }, MiniAdpter.sendJsonDataToDataContext = function(url) {
            var atlasJson = Loader.getRes(url);
            if (!atlasJson) throw "传递的url没有获取到对应的图集数据信息，请确保图集已经过！";
            wx.postMessage({
                url: url,
                atlasdata: atlasJson,
                isLoad: "openJsondatacontext"
            });
        }, MiniAdpter.EnvConfig = null, MiniAdpter.window = null, MiniAdpter._preCreateElement = null, 
        MiniAdpter._inited = !1, MiniAdpter.systemInfo = null, MiniAdpter.autoCacheFile = !0, 
        MiniAdpter.minClearSize = 5242880, MiniAdpter._measureText = null, MiniAdpter.parseXMLFromString = function(value) {
            var rst;
            value = value.replace(/>\s+</g, "><");
            try {
                rst = new window.Parser.DOMParser().parseFromString(value, "text/xml");
            } catch (error) {
                error = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(error);
                throw "需要引入xml解析库文件";
            }
            return rst;
        }, MiniAdpter.idx = 1, __static(MiniAdpter, [ "nativefiles", function() {
            return this.nativefiles = [ "layaNativeDir", "wxlocal" ];
        } ]), MiniAdpter;
    }(), MiniFileMgr = function() {
        function MiniFileMgr() {}
        return __class(MiniFileMgr, "laya.wx.mini.MiniFileMgr"), MiniFileMgr.getFileInfo = function(fileUrl) {
            var fileObj = MiniFileMgr.filesListObj[fileUrl];
            return null == fileObj ? null : fileObj;
        }, MiniFileMgr.read = function(filePath, encoding, callBack, readyUrl, isSaveFile, fileType) {
            var fileUrl;
            void 0 === encoding && (encoding = "ascill"), void 0 === readyUrl && (readyUrl = ""), 
            void 0 === isSaveFile && (isSaveFile = !1), void 0 === fileType && (fileType = ""), 
            fileUrl = "" == readyUrl || -1 == readyUrl.indexOf("http://") && -1 == readyUrl.indexOf("https://") ? filePath : MiniFileMgr.getFileNativePath(filePath), 
            MiniFileMgr.fs.readFile({
                filePath: fileUrl,
                encoding: encoding,
                success: function(data) {
                    null != callBack && callBack.runWith([ 0, data ]);
                },
                fail: function(data) {
                    data && "" != readyUrl ? MiniFileMgr.downFiles(readyUrl, encoding, callBack, readyUrl, isSaveFile, fileType) : null != callBack && callBack.runWith([ 1 ]);
                }
            });
        }, MiniFileMgr.downFiles = function(fileUrl, encoding, callBack, readyUrl, isSaveFile, fileType, isAutoClear) {
            void 0 === encoding && (encoding = "ascii"), void 0 === readyUrl && (readyUrl = ""), 
            void 0 === isSaveFile && (isSaveFile = !1), void 0 === fileType && (fileType = ""), 
            void 0 === isAutoClear && (isAutoClear = !0), MiniFileMgr.wxdown({
                url: fileUrl,
                success: function(data) {
                    200 === data.statusCode ? MiniFileMgr.readFile(data.tempFilePath, encoding, callBack, readyUrl, isSaveFile, fileType, isAutoClear) : null != callBack && callBack.runWith([ 1, data ]);
                },
                fail: function(data) {
                    null != callBack && callBack.runWith([ 1, data ]);
                }
            }).onProgressUpdate(function(data) {
                null != callBack && callBack.runWith([ 2, data.progress ]);
            });
        }, MiniFileMgr.readFile = function(filePath, encoding, callBack, readyUrl, isSaveFile, fileType, isAutoClear) {
            void 0 === encoding && (encoding = "ascill"), void 0 === readyUrl && (readyUrl = ""), 
            void 0 === isSaveFile && (isSaveFile = !1), void 0 === fileType && (fileType = ""), 
            void 0 === isAutoClear && (isAutoClear = !0), MiniFileMgr.fs.readFile({
                filePath: filePath,
                encoding: encoding,
                success: function(data) {
                    -1 != filePath.indexOf("http://") || -1 != filePath.indexOf("https://") ? (MiniAdpter.autoCacheFile || isSaveFile) && MiniFileMgr.copyFile(filePath, readyUrl, callBack, encoding, isAutoClear) : null != callBack && callBack.runWith([ 0, data ]);
                },
                fail: function(data) {
                    data && null != callBack && callBack.runWith([ 1, data ]);
                }
            });
        }, MiniFileMgr.downOtherFiles = function(fileUrl, callBack, readyUrl, isSaveFile, isAutoClear) {
            void 0 === readyUrl && (readyUrl = ""), void 0 === isSaveFile && (isSaveFile = !1), 
            void 0 === isAutoClear && (isAutoClear = !0), MiniFileMgr.wxdown({
                url: fileUrl,
                success: function(data) {
                    200 === data.statusCode && ((MiniAdpter.autoCacheFile || isSaveFile) && -1 == readyUrl.indexOf("wx.qlogo.cn") && -1 == readyUrl.indexOf(".php") ? MiniFileMgr.copyFile(data.tempFilePath, readyUrl, callBack, "", isAutoClear) : null != callBack && callBack.runWith([ 0, data.tempFilePath ]));
                },
                fail: function(data) {
                    null != callBack && callBack.runWith([ 1, data ]);
                }
            });
        }, MiniFileMgr.downLoadFile = function(fileUrl, fileType, callBack, encoding) {
            void 0 === fileType && (fileType = ""), void 0 === encoding && (encoding = "ascii"), 
            window.navigator.userAgent.indexOf("MiniGame") < 0 ? Laya.loader.load(fileUrl, callBack) : "image" == fileType || "sound" == fileType ? MiniFileMgr.downOtherFiles(fileUrl, callBack, fileUrl, !0, !1) : MiniFileMgr.downFiles(fileUrl, encoding, callBack, fileUrl, !0, fileType, !1);
        }, MiniFileMgr.copyFile = function(tempFilePath, readyUrl, callBack, encoding, isAutoClear) {
            void 0 === encoding && (encoding = ""), void 0 === isAutoClear && (isAutoClear = !0);
            var temp = tempFilePath.split("/"), tempFileName = temp[temp.length - 1], fileObj = MiniFileMgr.getFileInfo(readyUrl), saveFilePath = MiniFileMgr.getFileNativePath(tempFileName), fileUseSize = MiniFileMgr.getCacheUseSize();
            fileObj ? fileObj.readyUrl != readyUrl ? MiniFileMgr.fs.getFileInfo({
                filePath: tempFilePath,
                success: function(data) {
                    isAutoClear && 209715200 <= fileUseSize + 4194304 + data.size && (data.size > MiniAdpter.minClearSize && (MiniAdpter.minClearSize = data.size), 
                    MiniFileMgr.onClearCacheRes()), MiniFileMgr.deleteFile(tempFileName, readyUrl, callBack, encoding, data.size);
                },
                fail: function(data) {
                    null != callBack && callBack.runWith([ 1, data ]);
                }
            }) : null != callBack && callBack.runWith([ 0 ]) : MiniFileMgr.fs.getFileInfo({
                filePath: tempFilePath,
                success: function(data) {
                    isAutoClear && 209715200 <= fileUseSize + 4194304 + data.size && (data.size > MiniAdpter.minClearSize && (MiniAdpter.minClearSize = data.size), 
                    MiniFileMgr.onClearCacheRes()), MiniFileMgr.fs.copyFile({
                        srcPath: tempFilePath,
                        destPath: saveFilePath,
                        success: function(data2) {
                            MiniFileMgr.onSaveFile(readyUrl, tempFileName, !0, encoding, callBack, data.size);
                        },
                        fail: function(data) {
                            null != callBack && callBack.runWith([ 1, data ]);
                        }
                    });
                },
                fail: function(data) {
                    null != callBack && callBack.runWith([ 1, data ]);
                }
            });
        }, MiniFileMgr.writeFile = function(url, version, buffer, dataLen, tempPath) {
            var turl = url.replace(/\//g, "."), fileObj = MiniFileMgr.getFileInfo(url);
            209715200 <= MiniFileMgr.getCacheUseSize() + 4194304 + dataLen && (MiniAdpter.minClearSize = dataLen, 
            MiniFileMgr.onClearCacheRes());
            function successFunc(res) {
                buffer || MiniAdpter.createImg(url, MiniFileMgr.getFileNativePath(turl)), null == MiniFileMgr.filesListObj.fileUsedSize && (MiniFileMgr.filesListObj.fileUsedSize = 0);
                var sizeOffset = dataLen - (fileObj ? fileObj.size : 0);
                MiniFileMgr.filesListObj[url] = {
                    url: url,
                    size: dataLen,
                    version: version,
                    time: -1 !== url.indexOf(".obj") || -1 !== window.alwaysCache.indexOf(url) ? 9999999999999 : Date.now()
                }, MiniFileMgr.filesListObj.fileUsedSize = parseInt(MiniFileMgr.filesListObj.fileUsedSize) + sizeOffset, 
                MiniFileMgr.fs.writeFile({
                    filePath: MiniFileMgr.fileNativeDir + "/" + MiniFileMgr.fileListName,
                    encoding: "utf8",
                    data: JSON.stringify(MiniFileMgr.filesListObj),
                    success: function(data) {},
                    fail: function(data) {}
                });
            }
            function failFunc(res) {
                console.log("fail.......", url, res);
            }
            buffer ? MiniFileMgr.fs.writeFile({
                data: buffer,
                encoding: "binary",
                filePath: MiniFileMgr.getFileNativePath(turl),
                success: successFunc,
                fail: failFunc
            }) : MiniFileMgr.fs.saveFile({
                tempFilePath: tempPath,
                filePath: MiniFileMgr.getFileNativePath(turl),
                success: successFunc,
                fail: failFunc
            });
        }, MiniFileMgr.onClearCacheRes = function() {
            var memSize = MiniAdpter.minClearSize, tempFileListArr = [];
            for (var key in MiniFileMgr.filesListObj) tempFileListArr.push(MiniFileMgr.filesListObj[key]);
            MiniFileMgr.sortOn(tempFileListArr, "time", 16);
            for (var clearSize = 0, i = 1, sz = tempFileListArr.length; i < sz; i++) {
                var fileObj = tempFileListArr[i];
                if (memSize <= clearSize) break;
                var url = fileObj.url, turl = url.replace(/\//g, ".");
                MiniFileMgr.fs.unlink({
                    filePath: MiniFileMgr.getFileNativePath(turl),
                    success: function(res) {
                        if (clearSize += fileObj.size, MiniFileMgr.filesListObj[url]) {
                            var deletefileSize = parseInt(MiniFileMgr.filesListObj[url].size);
                            MiniFileMgr.filesListObj.fileUsedSize = parseInt(MiniFileMgr.filesListObj.fileUsedSize) - deletefileSize, 
                            delete MiniFileMgr.filesListObj[url], MiniFileMgr.fs.writeFile({
                                filePath: MiniFileMgr.fileNativeDir + "/" + MiniFileMgr.fileListName,
                                encoding: "utf8",
                                data: JSON.stringify(MiniFileMgr.filesListObj),
                                success: function(data) {},
                                fail: function(data) {}
                            });
                        }
                    }
                });
            }
        }, MiniFileMgr.sortOn = function(array, name, options) {
            return void 0 === options && (options = 0), 16 == options ? array.sort(function(a, b) {
                return a[name] - b[name];
            }) : 18 == options ? array.sort(function(a, b) {
                return b[name] - a[name];
            }) : array.sort(function(a, b) {
                return a[name] - b[name];
            });
        }, MiniFileMgr.getFileNativePath = function(fileName) {
            return laya.wx.mini.MiniFileMgr.fileNativeDir + "/" + fileName;
        }, MiniFileMgr.deleteFile = function(tempFileName, readyUrl, callBack, encoding, fileSize) {
            void 0 === readyUrl && (readyUrl = ""), void 0 === encoding && (encoding = ""), 
            void 0 === fileSize && (fileSize = 0);
            var fileObj = MiniFileMgr.getFileInfo(readyUrl), deleteFileUrl = MiniFileMgr.getFileNativePath(fileObj.md5);
            MiniFileMgr.fs.unlink({
                filePath: deleteFileUrl,
                success: function(data) {
                    var isAdd = "" != tempFileName;
                    if ("" != tempFileName) {
                        var saveFilePath = MiniFileMgr.getFileNativePath(tempFileName);
                        MiniFileMgr.fs.copyFile({
                            srcPath: tempFileName,
                            destPath: saveFilePath,
                            success: function(data) {
                                MiniFileMgr.onSaveFile(readyUrl, tempFileName, isAdd, encoding, callBack, data.size);
                            },
                            fail: function(data) {
                                null != callBack && callBack.runWith([ 1, data ]);
                            }
                        });
                    } else MiniFileMgr.onSaveFile(readyUrl, tempFileName, isAdd, encoding, callBack, fileSize);
                },
                fail: function(data) {}
            });
        }, MiniFileMgr.deleteAll = function() {
            var tempFileListArr = [];
            for (var key in MiniFileMgr.filesListObj) tempFileListArr.push(MiniFileMgr.filesListObj[key]);
            for (var i = 1, sz = tempFileListArr.length; i < sz; i++) {
                var fileObj = tempFileListArr[i];
                MiniFileMgr.deleteFile("", fileObj.readyUrl);
            }
        }, MiniFileMgr.onSaveFile = function(readyUrl, md5Name, isAdd, encoding, callBack, fileSize) {
            void 0 === isAdd && (isAdd = !0), void 0 === encoding && (encoding = ""), void 0 === fileSize && (fileSize = 0);
            var fileurlkey = readyUrl;
            if (null == MiniFileMgr.filesListObj.fileUsedSize && (MiniFileMgr.filesListObj.fileUsedSize = 0), 
            isAdd) {
                MiniFileMgr.getFileNativePath(md5Name);
                MiniFileMgr.filesListObj[fileurlkey] = {
                    md5: md5Name,
                    readyUrl: readyUrl,
                    size: fileSize,
                    time: Browser.now(),
                    encoding: encoding
                }, MiniFileMgr.filesListObj.fileUsedSize = parseInt(MiniFileMgr.filesListObj.fileUsedSize) + fileSize, 
                MiniFileMgr.writeFilesList(fileurlkey, JSON.stringify(MiniFileMgr.filesListObj), !0), 
                null != callBack && callBack.runWith([ 0 ]);
            } else if (MiniFileMgr.filesListObj[fileurlkey]) {
                var deletefileSize = parseInt(MiniFileMgr.filesListObj[fileurlkey].size);
                MiniFileMgr.filesListObj.fileUsedSize = parseInt(MiniFileMgr.filesListObj.fileUsedSize) - deletefileSize, 
                delete MiniFileMgr.filesListObj[fileurlkey], MiniFileMgr.writeFilesList(fileurlkey, JSON.stringify(MiniFileMgr.filesListObj), !1), 
                null != callBack && callBack.runWith([ 0 ]);
            }
        }, MiniFileMgr.writeFilesList = function(fileurlkey, filesListStr, isAdd) {
            var listFilesPath = MiniFileMgr.fileNativeDir + "/" + MiniFileMgr.fileListName;
            MiniFileMgr.fs.writeFile({
                filePath: listFilesPath,
                encoding: "utf8",
                data: filesListStr,
                success: function(data) {},
                fail: function(data) {}
            });
        }, MiniFileMgr.getCacheUseSize = function() {
            return MiniFileMgr.filesListObj && MiniFileMgr.filesListObj.fileUsedSize ? MiniFileMgr.filesListObj.fileUsedSize : 0;
        }, MiniFileMgr.existDir = function(dirPath, callBack) {
            MiniFileMgr.fs.readdir({
                dirPath: dirPath,
                success: function(res) {
                    console.log("readdir success.............", res), -1 !== res.files.indexOf(MiniFileMgr.fileListName) ? MiniFileMgr.readSync(MiniFileMgr.fileListName, "utf8", callBack) : callBack && callBack.runWith([ 1, null ]);
                },
                fail: function(res) {
                    console.log("readdir fail..............", dirPath), MiniFileMgr.fs.mkdir({
                        dirPath: dirPath,
                        success: function(data) {
                            console.log("mkdir success...............", data), null != callBack && callBack.runWith([ 0, {
                                data: JSON.stringify({})
                            } ]);
                        },
                        fail: function(data) {
                            console.log("mkdir fail.............", data), null != callBack && callBack.runWith([ 1, data ]);
                        }
                    });
                }
            });
        }, MiniFileMgr.readSync = function(filePath, encoding, callBack, readyUrl) {
            void 0 === encoding && (encoding = "ascill"), void 0 === readyUrl && (readyUrl = "");
            var filesListStr, fileUrl = MiniFileMgr.getFileNativePath(filePath);
            try {
                filesListStr = MiniFileMgr.fs.readFileSync(fileUrl, encoding), null != callBack && callBack.runWith([ 0, {
                    data: filesListStr
                } ]);
            } catch (error) {
                error = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(error);
                null != callBack && callBack.runWith([ 1 ]);
            }
        }, MiniFileMgr.setNativeFileDir = function(value) {
            MiniFileMgr.fileNativeDir = wx.env.USER_DATA_PATH + value, window.cachePath = MiniFileMgr.fileNativeDir;
        }, MiniFileMgr.filesListObj = {}, MiniFileMgr.fileNativeDir = null, MiniFileMgr.fileListName = "layaairfiles.txt", 
        MiniFileMgr.ziyuFileData = {}, MiniFileMgr.ziyuFileTextureData = {}, MiniFileMgr.loadPath = "", 
        MiniFileMgr.DESCENDING = 2, MiniFileMgr.NUMERIC = 16, __static(MiniFileMgr, [ "fs", function() {
            return this.fs = wx.getFileSystemManager();
        }, "wxdown", function() {
            return this.wxdown = wx.downloadFile;
        } ]), MiniFileMgr;
    }(), MiniInput = (function() {
        function MiniImage() {}
        __class(MiniImage, "laya.wx.mini.MiniImage"), MiniImage.prototype._loadImage = function(url) {
            url = URL.formatURL(url);
            var obj = MiniFileMgr.getFileInfo(url);
            obj ? MiniImage.onCreateImage(url, this, MiniFileMgr.getFileNativePath(obj.md5)) : MiniFileMgr.downOtherFiles(url, new Handler(MiniImage, MiniImage.onDownImgCallBack, [ url, this ]), url);
        }, MiniImage.onDownImgCallBack = function(sourceUrl, thisLoader, errorCode, tempFilePath) {
            void 0 === tempFilePath && (tempFilePath = ""), errorCode ? thisLoader.onError(null) : MiniImage.onCreateImage(sourceUrl, thisLoader, tempFilePath);
        }, MiniImage.onCreateImage = function(sourceUrl, thisLoader, tempFilePath) {
            var image;
            function clear() {
                image.onload = null, image.onerror = null, delete thisLoader.imgCache[sourceUrl];
            }
            null == thisLoader.imgCache && (thisLoader.imgCache = {});
            function onload() {
                clear(), thisLoader._url = URL.formatURL(thisLoader._url), thisLoader.onLoaded(image);
            }
            function onerror() {
                clear(), thisLoader.event("error", "Load image failed");
            }
            "nativeimage" == thisLoader._type ? ((image = new Browser.window.Image()).crossOrigin = "", 
            image.onload = onload, image.onerror = onerror, image.src = tempFilePath, thisLoader.imgCache[sourceUrl] = image) : new HTMLImage.create(tempFilePath, {
                onload: onload,
                onerror: onerror,
                onCreate: function(img) {
                    image = img, thisLoader.imgCache[sourceUrl] = img;
                }
            });
        };
    }(), function() {
        function MiniInput() {}
        return __class(MiniInput, "laya.wx.mini.MiniInput"), MiniInput._createInputElement = function() {
            Input._initInput(Input.area = Browser.createElement("textarea")), Input._initInput(Input.input = Browser.createElement("input")), 
            Input.inputContainer = Browser.createElement("div"), Input.inputContainer.style.position = "absolute", 
            Input.inputContainer.style.zIndex = 1e5, Browser.container.appendChild(Input.inputContainer), 
            Input.inputContainer.setPos = function(x, y) {
                Input.inputContainer.style.left = x + "px", Input.inputContainer.style.top = y + "px";
            }, Laya.stage.on("resize", null, MiniInput._onStageResize), wx.onWindowResize && wx.onWindowResize(function(res) {
                window.dispatchEvent && window.dispatchEvent("resize");
            }), SoundManager._soundClass = MiniSound, SoundManager._musicClass = MiniSound;
            var model = MiniAdpter.systemInfo.model, system = MiniAdpter.systemInfo.system;
            -1 != model.indexOf("iPhone") && (Browser.onIPhone = !0, Browser.onIOS = !0, Browser.onIPad = !0, 
            Browser.onAndroid = !1), -1 == system.indexOf("Android") && -1 == system.indexOf("Adr") || (Browser.onAndroid = !0, 
            Browser.onIPhone = !1, Browser.onIOS = !1, Browser.onIPad = !1);
        }, MiniInput._onStageResize = function() {
            Laya.stage._canvasTransform.identity().scale(Browser.width / Render.canvas.width / RunDriver.getPixelRatio(), Browser.height / Render.canvas.height / RunDriver.getPixelRatio());
        }, MiniInput.wxinputFocus = function(e) {
            var _inputTarget = Input.inputElement.target;
            _inputTarget && !_inputTarget.editable || (MiniAdpter.window.wx.offKeyboardConfirm(), 
            MiniAdpter.window.wx.offKeyboardInput(), MiniAdpter.window.wx.showKeyboard({
                defaultValue: _inputTarget.text,
                maxLength: _inputTarget.maxChars,
                multiple: _inputTarget.multiline,
                confirmHold: !0,
                confirmType: "done",
                success: function(res) {},
                fail: function(res) {}
            }), MiniAdpter.window.wx.onKeyboardConfirm(function(res) {
                var str = res ? res.value : "";
                _inputTarget.text = str, _inputTarget.event("input"), laya.wx.mini.MiniInput.inputEnter();
            }), MiniAdpter.window.wx.onKeyboardInput(function(res) {
                var str = res ? res.value : "";
                _inputTarget.multiline || -1 == str.indexOf("\n") ? (_inputTarget.text = str, _inputTarget.event("input")) : laya.wx.mini.MiniInput.inputEnter();
            }));
        }, MiniInput.inputEnter = function() {
            Input.inputElement.target.focus = !1;
        }, MiniInput.wxinputblur = function() {
            MiniInput.hideKeyboard();
        }, MiniInput.hideKeyboard = function() {
            MiniAdpter.window.wx.offKeyboardConfirm(), MiniAdpter.window.wx.offKeyboardInput(), 
            MiniAdpter.window.wx.hideKeyboard({
                success: function(res) {
                    console.log("隐藏键盘");
                },
                fail: function(res) {
                    console.log("隐藏键盘出错:" + (res ? res.errMsg : ""));
                }
            });
        }, MiniInput;
    }()), MiniLocalStorage = function() {
        function MiniLocalStorage() {}
        return __class(MiniLocalStorage, "laya.wx.mini.MiniLocalStorage"), MiniLocalStorage.__init__ = function() {
            MiniLocalStorage.items = MiniLocalStorage;
        }, MiniLocalStorage.setItem = function(key, value) {
            try {
                wx.setStorageSync(key, value);
            } catch (error) {
                error = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(error);
                wx.setStorage({
                    key: key,
                    data: value
                });
            }
        }, MiniLocalStorage.getItem = function(key) {
            return wx.getStorageSync(key);
        }, MiniLocalStorage.setJSON = function(key, value) {
            MiniLocalStorage.setItem(key, value);
        }, MiniLocalStorage.getJSON = function(key) {
            return MiniLocalStorage.getItem(key);
        }, MiniLocalStorage.removeItem = function(key) {
            wx.removeStorageSync(key);
        }, MiniLocalStorage.clear = function() {
            wx.clearStorageSync();
        }, MiniLocalStorage.getStorageInfoSync = function() {
            try {
                var res = wx.getStorageInfoSync();
                return console.log(res.keys), console.log(res.currentSize), console.log(res.limitSize), 
                res;
            } catch (e) {}
            return null;
        }, MiniLocalStorage.support = !0, MiniLocalStorage.items = null, MiniLocalStorage;
    }(), MiniSound = (function() {
        function MiniLocation() {}
        __class(MiniLocation, "laya.wx.mini.MiniLocation"), MiniLocation.__init__ = function() {
            MiniAdpter.window.navigator.geolocation.getCurrentPosition = MiniLocation.getCurrentPosition, 
            MiniAdpter.window.navigator.geolocation.watchPosition = MiniLocation.watchPosition, 
            MiniAdpter.window.navigator.geolocation.clearWatch = MiniLocation.clearWatch;
        }, MiniLocation.getCurrentPosition = function(success, error, options) {
            var paramO;
            (paramO = {
                success: function(res) {
                    null != success && success(res);
                }
            }).fail = error, MiniAdpter.window.wx.getLocation(paramO);
        }, MiniLocation.watchPosition = function(success, error, options) {
            var curWatchO;
            return MiniLocation._curID++, (curWatchO = {}).success = success, curWatchO.error = error, 
            MiniLocation._watchDic[MiniLocation._curID] = curWatchO, Laya.timer.loop(1e3, null, MiniLocation._myLoop), 
            MiniLocation._curID;
        }, MiniLocation.clearWatch = function(id) {
            delete MiniLocation._watchDic[id], MiniLocation._hasWatch() || Laya.timer.clear(null, MiniLocation._myLoop);
        }, MiniLocation._hasWatch = function() {
            var key;
            for (key in MiniLocation._watchDic) if (MiniLocation._watchDic[key]) return !0;
            return !1;
        }, MiniLocation._myLoop = function() {
            MiniLocation.getCurrentPosition(MiniLocation._mySuccess, MiniLocation._myError);
        }, MiniLocation._mySuccess = function(res) {
            var key, rst = {};
            for (key in rst.coords = res, rst.timestamp = Browser.now(), MiniLocation._watchDic) MiniLocation._watchDic[key].success && MiniLocation._watchDic[key].success(rst);
        }, MiniLocation._myError = function(res) {
            var key;
            for (key in MiniLocation._watchDic) MiniLocation._watchDic[key].error && MiniLocation._watchDic[key].error(res);
        }, MiniLocation._watchDic = {}, MiniLocation._curID = 0;
    }(), function(_super) {
        function MiniAccelerator() {
            MiniAccelerator.__super.call(this);
        }
        __class(MiniAccelerator, "laya.wx.mini.MiniAccelerator", _super);
        var __proto = MiniAccelerator.prototype;
        __proto.on = function(type, caller, listener, args) {
            return _super.prototype.on.call(this, type, caller, listener, args), MiniAccelerator.startListen(this.onDeviceOrientationChange), 
            this;
        }, __proto.off = function(type, caller, listener, onceOnly) {
            return void 0 === onceOnly && (onceOnly = !1), this.hasListener(type) || MiniAccelerator.stopListen(), 
            _super.prototype.off.call(this, type, caller, listener, onceOnly);
        }, MiniAccelerator.__init__ = function() {
            try {
                var Acc;
                if (!(Acc = laya.device.motion.Accelerator)) return;
                Acc.prototype.on = MiniAccelerator.prototype.on, Acc.prototype.off = MiniAccelerator.prototype.off;
            } catch (e) {}
        }, MiniAccelerator.startListen = function(callBack) {
            if (MiniAccelerator._callBack = callBack, !MiniAccelerator._isListening) {
                MiniAccelerator._isListening = !0;
                try {
                    wx.onAccelerometerChange(MiniAccelerator.onAccelerometerChange);
                } catch (e) {}
            }
        }, MiniAccelerator.stopListen = function() {
            MiniAccelerator._isListening = !1;
            try {
                wx.stopAccelerometer({});
            } catch (e) {}
        }, MiniAccelerator.onAccelerometerChange = function(res) {
            var e;
            (e = {}).acceleration = res, e.accelerationIncludingGravity = res, e.rotationRate = {}, 
            null != MiniAccelerator._callBack && MiniAccelerator._callBack(e);
        }, MiniAccelerator._isListening = !1, MiniAccelerator._callBack = null;
    }(EventDispatcher), function(_super) {
        function MiniLoader() {
            MiniLoader.__super.call(this);
        }
        __class(MiniLoader, "laya.wx.mini.MiniLoader", EventDispatcher), MiniLoader.prototype.load = function(url, type, cache, group, ignoreCache) {
            void 0 === cache && (cache = !0), void 0 === ignoreCache && (ignoreCache = !1);
            if (0 === (this._url = url).indexOf("data:image") ? this._type = type = "image" : this._type = type || (type = this.getTypeFromUrl(url)), 
            this._cache = cache, this._data = null, !ignoreCache && Loader.loadedMap[URL.formatURL(url)]) return this._data = Loader.loadedMap[URL.formatURL(url)], 
            this.event("progress", 1), void this.event("complete", this._data);
            if (null != Loader.parserMap[type]) return this._customParse = !0, void (Loader.parserMap[type] instanceof laya.utils.Handler ? Loader.parserMap[type].runWith(this) : Loader.parserMap[type].call(null, this));
            var encoding = MiniAdpter.getUrlEncode(url, type), urlType = Utils.getFileExtension(url);
            if (-1 != MiniLoader._fileTypeArr.indexOf(urlType)) MiniAdpter.EnvConfig.load.call(this, url, type, cache, group, ignoreCache); else if (MiniFileMgr.getFileInfo(url)) {
                var fileObj = MiniFileMgr.getFileInfo(url);
                fileObj.encoding = null == fileObj.encoding ? "ascii" : fileObj.encoding, MiniFileMgr.readFile(url, fileObj.encoding, new Handler(MiniLoader, MiniLoader.onReadNativeCallBack, [ encoding, url, type, cache, group, ignoreCache, this ]), url);
            } else {
                if (MiniFileMgr.isLocalNativeFile(url)) return void MiniFileMgr.read(url, encoding, new Handler(MiniLoader, MiniLoader.onReadNativeCallBack, [ encoding, url, type, cache, group, ignoreCache, this ]));
                var tempUrl = url;
                -1 != (url = URL.formatURL(url)).indexOf("http://") || -1 != url.indexOf("https://") ? MiniAdpter.EnvConfig.load.call(this, tempUrl, type, cache, group, ignoreCache) : MiniFileMgr.readFile(url, encoding, new Handler(MiniLoader, MiniLoader.onReadNativeCallBack, [ encoding, url, type, cache, group, ignoreCache, this ]), url);
            }
        }, MiniLoader.onReadNativeCallBack = function(encoding, url, type, cache, group, ignoreCache, thisLoader, errorCode, data) {
            var tempData;
            (void 0 === cache && (cache = !0), void 0 === ignoreCache && (ignoreCache = !1), 
            void 0 === errorCode && (errorCode = 0), errorCode) ? 1 == errorCode && (console.log("-----------本地加载失败，尝试外网加载----"), 
            MiniAdpter.EnvConfig.load.call(thisLoader, url, type, cache, group, ignoreCache)) : (tempData = "json" == type || "atlas" == type ? MiniAdpter.getJson(data.data) : "xml" == type ? Utils.parseXMLFromString(data.data) : data.data, 
            thisLoader.onLoaded(tempData));
        }, __static(MiniLoader, [ "_fileTypeArr", function() {
            return this._fileTypeArr = [ "png", "jpg", "bmp", "jpeg", "gif" ];
        } ]);
    }(), function(_super) {
        function MiniSound() {
            this._sound = null, this.url = null, this.loaded = !1, this.readyUrl = null, MiniSound.__super.call(this);
        }
        __class(MiniSound, "laya.wx.mini.MiniSound", EventDispatcher);
        var __proto = MiniSound.prototype;
        return __proto.load = function(url) {
            url = URL.formatURL(url), this.url = url, this.readyUrl = url, MiniSound._audioCache[this.readyUrl] ? this.event("complete") : this.onDownLoadCallBack(url, 0);
        }, __proto.onDownLoadCallBack = function(sourceUrl, errorCode) {
            this._sound = MiniSound._createSound(), this._sound.src = sourceUrl, this._sound.onCanplay(MiniSound.bindToThis(this.onCanPlay, this)), 
            this._sound.onError(MiniSound.bindToThis(this.onError, this));
        }, __proto.onError = function(error) {
            try {
                console.log("-----1---------------minisound-----id:" + MiniSound._id), console.log(error);
            } catch (error) {
                error = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(error);
                console.log("-----2---------------minisound-----id:" + MiniSound._id), console.log(error);
            }
            this.event("error"), this._sound.offError(null);
        }, __proto.onCanPlay = function() {
            this.loaded = !0, this.event("complete"), this._sound.offCanplay(null);
        }, __proto.play = function(startTime, loops) {
            var tSound;
            void 0 === startTime && (startTime = 0), void 0 === loops && (loops = 0), (tSound = this.url == SoundManager._tMusic ? (MiniSound._musicAudio || (MiniSound._musicAudio = MiniSound._createSound()), 
            MiniSound._musicAudio) : MiniSound._audioCache[this.readyUrl] ? MiniSound._audioCache[this.readyUrl]._sound : MiniSound._createSound()).src = this.url;
            var channel = new MiniSoundChannel(tSound, this);
            return channel.url = this.url, channel.loops = loops, channel.loop = 0 === loops, 
            channel.startTime = startTime, channel.play(), SoundManager.addChannel(channel), 
            channel;
        }, __proto.dispose = function() {
            var ad = MiniSound._audioCache[this.readyUrl];
            ad && (ad.src = "", ad._sound && (ad._sound.destroy(), ad._sound = null, ad = null), 
            delete MiniSound._audioCache[this.readyUrl]);
        }, __getset(0, __proto, "duration", function() {
            return this._sound.duration;
        }), MiniSound._createSound = function() {
            return MiniSound._id++, MiniAdpter.window.wx.createInnerAudioContext();
        }, MiniSound.bindToThis = function(fun, scope) {
            return fun.bind(scope);
        }, MiniSound._musicAudio = null, MiniSound._id = 0, MiniSound._audioCache = {}, 
        MiniSound;
    }()), MiniSoundChannel = function(_super) {
        function MiniSoundChannel(audio, miniSound) {
            this._audio = null, this._onEnd = null, this._miniSound = null, MiniSoundChannel.__super.call(this), 
            this._audio = audio, this._miniSound = miniSound, this._onEnd = MiniSoundChannel.bindToThis(this.__onEnd, this), 
            audio.onEnded(this._onEnd);
        }
        __class(MiniSoundChannel, "laya.wx.mini.MiniSoundChannel", SoundChannel);
        var __proto = MiniSoundChannel.prototype;
        return __proto.__onEnd = function() {
            if (1 == this.loops) return this.completeHandler && (Laya.timer.once(10, this, this.__runComplete, [ this.completeHandler ], !1), 
            this.completeHandler = null), this.stop(), void this.event("complete");
            0 < this.loops && this.loops--, this.startTime = 0, this.play();
        }, __proto.play = function() {
            this.isStopped = !1, SoundManager.addChannel(this), this._audio.play();
        }, __proto.stop = function() {
            this.isStopped = !0, SoundManager.removeChannel(this), this.completeHandler = null, 
            this._audio && (this._audio.pause(), this._audio.offEnded(null), this._audio = null, 
            this._miniSound = null, this._onEnd = null);
        }, __proto.pause = function() {
            this.isStopped = !0, this._audio.pause();
        }, __proto.resume = function() {
            this._audio && (this.isStopped = !1, SoundManager.addChannel(this), this._audio.play());
        }, __getset(0, __proto, "startTime", null, function(time) {
            this._audio && (this._audio.startTime = time);
        }), __getset(0, __proto, "autoplay", function() {
            return this._audio.autoplay;
        }, function(value) {
            this._audio.autoplay = value;
        }), __getset(0, __proto, "position", function() {
            return this._audio ? this._audio.currentTime : 0;
        }), __getset(0, __proto, "duration", function() {
            return this._audio ? this._audio.duration : 0;
        }), __getset(0, __proto, "loop", function() {
            return this._audio.loop;
        }, function(value) {
            this._audio.loop = value;
        }), __getset(0, __proto, "volume", function() {
            return this._audio ? this._audio.volume : 1;
        }, function(v) {
            this._audio && (this._audio.volume = v);
        }), MiniSoundChannel.bindToThis = function(fun, scope) {
            return fun.bind(scope);
        }, MiniSoundChannel;
    }();
}(window, document, Laya), "function" == typeof define && define.amd && define("laya.core", [ "arequire", "exports" ], function(arequire, exports) {
    "use strict";
    for (var i in Object.defineProperty(exports, "__esModule", {
        value: !0
    }), Laya) {
        var o = Laya[i];
        o && o.__isclass && (exports[i] = o);
    }
});

var Box2D = {};

window.Box2D = Box2D, function(F, G) {
    function K() {}
    F.inherit = function(y, w) {
        K.prototype = w.prototype, y.prototype = new K(), y.prototype.constructor = y;
    }, F.generateCallback = function(y, w) {
        return function() {
            w.apply(y, arguments);
        };
    }, F.NVector = function(y) {
        y === G && (y = 0);
        for (var w = Array(y || 0), A = 0; A < y; ++A) w[A] = 0;
        return w;
    }, F.is = function(y, w) {
        return null !== y && (w instanceof Function && y instanceof w || !(y.constructor.__implements == G || !y.constructor.__implements[w]));
    }, F.parseUInt = function(y) {
        return Math.abs(parseInt(y));
    };
}(Box2D);

var Vector = Array, Vector_a2j_Number = Box2D.NVector, i, __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, base, utils, base, utils, utils, base, base, base, base, base, utils, base, base, utils, base;

for (void 0 === Box2D && (Box2D = {}), void 0 === Box2D.Collision && (Box2D.Collision = {}), 
void 0 === Box2D.Collision.Shapes && (Box2D.Collision.Shapes = {}), void 0 === Box2D.Common && (Box2D.Common = {}), 
void 0 === Box2D.Common.Math && (Box2D.Common.Math = {}), void 0 === Box2D.Dynamics && (Box2D.Dynamics = {}), 
void 0 === Box2D.Dynamics.Contacts && (Box2D.Dynamics.Contacts = {}), void 0 === Box2D.Dynamics.Controllers && (Box2D.Dynamics.Controllers = {}), 
void 0 === Box2D.Dynamics.Joints && (Box2D.Dynamics.Joints = {}), Box2D.Collision.IBroadPhase = "Box2D.Collision.IBroadPhase", 
Box2D.Collision.b2AABB = function F() {
    F.b2AABB.apply(this, arguments);
}, Box2D.Collision.b2Bound = function G() {
    G.b2Bound.apply(this, arguments);
}, Box2D.Collision.b2BoundValues = function K() {
    K.b2BoundValues.apply(this, arguments), this.constructor === K && this.b2BoundValues.apply(this, arguments);
}, Box2D.Collision.b2Collision = function y() {
    y.b2Collision.apply(this, arguments);
}, Box2D.Collision.b2ContactID = function w() {
    w.b2ContactID.apply(this, arguments), this.constructor === w && this.b2ContactID.apply(this, arguments);
}, Box2D.Collision.b2ContactPoint = function A() {
    A.b2ContactPoint.apply(this, arguments);
}, Box2D.Collision.b2Distance = function U() {
    U.b2Distance.apply(this, arguments);
}, Box2D.Collision.b2DistanceInput = function p() {
    p.b2DistanceInput.apply(this, arguments);
}, Box2D.Collision.b2DistanceOutput = function B() {
    B.b2DistanceOutput.apply(this, arguments);
}, Box2D.Collision.b2DistanceProxy = function Q() {
    Q.b2DistanceProxy.apply(this, arguments);
}, Box2D.Collision.b2DynamicTree = function V() {
    V.b2DynamicTree.apply(this, arguments), this.constructor === V && this.b2DynamicTree.apply(this, arguments);
}, Box2D.Collision.b2DynamicTreeBroadPhase = function M() {
    M.b2DynamicTreeBroadPhase.apply(this, arguments);
}, Box2D.Collision.b2DynamicTreeNode = function L() {
    L.b2DynamicTreeNode.apply(this, arguments);
}, Box2D.Collision.b2DynamicTreePair = function I() {
    I.b2DynamicTreePair.apply(this, arguments);
}, Box2D.Collision.b2Manifold = function W() {
    W.b2Manifold.apply(this, arguments), this.constructor === W && this.b2Manifold.apply(this, arguments);
}, Box2D.Collision.b2ManifoldPoint = function Y() {
    Y.b2ManifoldPoint.apply(this, arguments), this.constructor === Y && this.b2ManifoldPoint.apply(this, arguments);
}, Box2D.Collision.b2Point = function k() {
    k.b2Point.apply(this, arguments);
}, Box2D.Collision.b2RayCastInput = function z() {
    z.b2RayCastInput.apply(this, arguments), this.constructor === z && this.b2RayCastInput.apply(this, arguments);
}, Box2D.Collision.b2RayCastOutput = function u() {
    u.b2RayCastOutput.apply(this, arguments);
}, Box2D.Collision.b2Segment = function D() {
    D.b2Segment.apply(this, arguments);
}, Box2D.Collision.b2SeparationFunction = function H() {
    H.b2SeparationFunction.apply(this, arguments);
}, Box2D.Collision.b2Simplex = function O() {
    O.b2Simplex.apply(this, arguments), this.constructor === O && this.b2Simplex.apply(this, arguments);
}, Box2D.Collision.b2SimplexCache = function E() {
    E.b2SimplexCache.apply(this, arguments);
}, Box2D.Collision.b2SimplexVertex = function R() {
    R.b2SimplexVertex.apply(this, arguments);
}, Box2D.Collision.b2TimeOfImpact = function N() {
    N.b2TimeOfImpact.apply(this, arguments);
}, Box2D.Collision.b2TOIInput = function S() {
    S.b2TOIInput.apply(this, arguments);
}, Box2D.Collision.b2WorldManifold = function aa() {
    aa.b2WorldManifold.apply(this, arguments), this.constructor === aa && this.b2WorldManifold.apply(this, arguments);
}, Box2D.Collision.ClipVertex = function Z() {
    Z.ClipVertex.apply(this, arguments);
}, Box2D.Collision.Features = function d() {
    d.Features.apply(this, arguments);
}, Box2D.Collision.Shapes.b2CircleShape = function h() {
    h.b2CircleShape.apply(this, arguments), this.constructor === h && this.b2CircleShape.apply(this, arguments);
}, Box2D.Collision.Shapes.b2EdgeChainDef = function l() {
    l.b2EdgeChainDef.apply(this, arguments), this.constructor === l && this.b2EdgeChainDef.apply(this, arguments);
}, Box2D.Collision.Shapes.b2EdgeShape = function j() {
    j.b2EdgeShape.apply(this, arguments), this.constructor === j && this.b2EdgeShape.apply(this, arguments);
}, Box2D.Collision.Shapes.b2MassData = function o() {
    o.b2MassData.apply(this, arguments);
}, Box2D.Collision.Shapes.b2PolygonShape = function q() {
    q.b2PolygonShape.apply(this, arguments), this.constructor === q && this.b2PolygonShape.apply(this, arguments);
}, Box2D.Collision.Shapes.b2Shape = function n() {
    n.b2Shape.apply(this, arguments), this.constructor === n && this.b2Shape.apply(this, arguments);
}, Box2D.Common.b2internal = "Box2D.Common.b2internal", Box2D.Common.b2Color = function a() {
    a.b2Color.apply(this, arguments), this.constructor === a && this.b2Color.apply(this, arguments);
}, Box2D.Common.b2Settings = function c() {
    c.b2Settings.apply(this, arguments);
}, Box2D.Common.Math.b2Mat22 = function g() {
    g.b2Mat22.apply(this, arguments), this.constructor === g && this.b2Mat22.apply(this, arguments);
}, Box2D.Common.Math.b2Mat33 = function b() {
    b.b2Mat33.apply(this, arguments), this.constructor === b && this.b2Mat33.apply(this, arguments);
}, Box2D.Common.Math.b2Math = function e() {
    e.b2Math.apply(this, arguments);
}, Box2D.Common.Math.b2Sweep = function f() {
    f.b2Sweep.apply(this, arguments);
}, Box2D.Common.Math.b2Transform = function m() {
    m.b2Transform.apply(this, arguments), this.constructor === m && this.b2Transform.apply(this, arguments);
}, Box2D.Common.Math.b2Vec2 = function r() {
    r.b2Vec2.apply(this, arguments), this.constructor === r && this.b2Vec2.apply(this, arguments);
}, Box2D.Common.Math.b2Vec3 = function s() {
    s.b2Vec3.apply(this, arguments), this.constructor === s && this.b2Vec3.apply(this, arguments);
}, Box2D.Dynamics.b2Body = function v() {
    v.b2Body.apply(this, arguments), this.constructor === v && this.b2Body.apply(this, arguments);
}, Box2D.Dynamics.b2BodyDef = function t() {
    t.b2BodyDef.apply(this, arguments), this.constructor === t && this.b2BodyDef.apply(this, arguments);
}, Box2D.Dynamics.b2ContactFilter = function x() {
    x.b2ContactFilter.apply(this, arguments);
}, Box2D.Dynamics.b2ContactImpulse = function C() {
    C.b2ContactImpulse.apply(this, arguments);
}, Box2D.Dynamics.b2ContactListener = function J() {
    J.b2ContactListener.apply(this, arguments);
}, Box2D.Dynamics.b2ContactManager = function T() {
    T.b2ContactManager.apply(this, arguments), this.constructor === T && this.b2ContactManager.apply(this, arguments);
}, Box2D.Dynamics.b2DebugDraw = function P() {
    P.b2DebugDraw.apply(this, arguments), this.constructor === P && this.b2DebugDraw.apply(this, arguments);
}, Box2D.Dynamics.b2DestructionListener = function X() {
    X.b2DestructionListener.apply(this, arguments);
}, Box2D.Dynamics.b2FilterData = function $() {
    $.b2FilterData.apply(this, arguments);
}, Box2D.Dynamics.b2Fixture = function ba() {
    ba.b2Fixture.apply(this, arguments), this.constructor === ba && this.b2Fixture.apply(this, arguments);
}, Box2D.Dynamics.b2FixtureDef = function ca() {
    ca.b2FixtureDef.apply(this, arguments), this.constructor === ca && this.b2FixtureDef.apply(this, arguments);
}, Box2D.Dynamics.b2Island = function da() {
    da.b2Island.apply(this, arguments), this.constructor === da && this.b2Island.apply(this, arguments);
}, Box2D.Dynamics.b2TimeStep = function Fa() {
    Fa.b2TimeStep.apply(this, arguments);
}, Box2D.Dynamics.b2World = function ea() {
    ea.b2World.apply(this, arguments), this.constructor === ea && this.b2World.apply(this, arguments);
}, Box2D.Dynamics.Contacts.b2CircleContact = function Ga() {
    Ga.b2CircleContact.apply(this, arguments);
}, Box2D.Dynamics.Contacts.b2Contact = function fa() {
    fa.b2Contact.apply(this, arguments), this.constructor === fa && this.b2Contact.apply(this, arguments);
}, Box2D.Dynamics.Contacts.b2ContactConstraint = function ga() {
    ga.b2ContactConstraint.apply(this, arguments), this.constructor === ga && this.b2ContactConstraint.apply(this, arguments);
}, Box2D.Dynamics.Contacts.b2ContactConstraintPoint = function Ha() {
    Ha.b2ContactConstraintPoint.apply(this, arguments);
}, Box2D.Dynamics.Contacts.b2ContactEdge = function Ia() {
    Ia.b2ContactEdge.apply(this, arguments);
}, Box2D.Dynamics.Contacts.b2ContactFactory = function ha() {
    ha.b2ContactFactory.apply(this, arguments), this.constructor === ha && this.b2ContactFactory.apply(this, arguments);
}, Box2D.Dynamics.Contacts.b2ContactRegister = function Ja() {
    Ja.b2ContactRegister.apply(this, arguments);
}, Box2D.Dynamics.Contacts.b2ContactResult = function Ka() {
    Ka.b2ContactResult.apply(this, arguments);
}, Box2D.Dynamics.Contacts.b2ContactSolver = function ia() {
    ia.b2ContactSolver.apply(this, arguments), this.constructor === ia && this.b2ContactSolver.apply(this, arguments);
}, Box2D.Dynamics.Contacts.b2EdgeAndCircleContact = function La() {
    La.b2EdgeAndCircleContact.apply(this, arguments);
}, Box2D.Dynamics.Contacts.b2NullContact = function ja() {
    ja.b2NullContact.apply(this, arguments), this.constructor === ja && this.b2NullContact.apply(this, arguments);
}, Box2D.Dynamics.Contacts.b2PolyAndCircleContact = function Ma() {
    Ma.b2PolyAndCircleContact.apply(this, arguments);
}, Box2D.Dynamics.Contacts.b2PolyAndEdgeContact = function Na() {
    Na.b2PolyAndEdgeContact.apply(this, arguments);
}, Box2D.Dynamics.Contacts.b2PolygonContact = function Oa() {
    Oa.b2PolygonContact.apply(this, arguments);
}, Box2D.Dynamics.Contacts.b2PositionSolverManifold = function ka() {
    ka.b2PositionSolverManifold.apply(this, arguments), this.constructor === ka && this.b2PositionSolverManifold.apply(this, arguments);
}, Box2D.Dynamics.Controllers.b2BuoyancyController = function Pa() {
    Pa.b2BuoyancyController.apply(this, arguments);
}, Box2D.Dynamics.Controllers.b2ConstantAccelController = function Qa() {
    Qa.b2ConstantAccelController.apply(this, arguments);
}, Box2D.Dynamics.Controllers.b2ConstantForceController = function Ra() {
    Ra.b2ConstantForceController.apply(this, arguments);
}, Box2D.Dynamics.Controllers.b2Controller = function Sa() {
    Sa.b2Controller.apply(this, arguments);
}, Box2D.Dynamics.Controllers.b2ControllerEdge = function Ta() {
    Ta.b2ControllerEdge.apply(this, arguments);
}, Box2D.Dynamics.Controllers.b2GravityController = function Ua() {
    Ua.b2GravityController.apply(this, arguments);
}, Box2D.Dynamics.Controllers.b2TensorDampingController = function Va() {
    Va.b2TensorDampingController.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2DistanceJoint = function la() {
    la.b2DistanceJoint.apply(this, arguments), this.constructor === la && this.b2DistanceJoint.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2DistanceJointDef = function ma() {
    ma.b2DistanceJointDef.apply(this, arguments), this.constructor === ma && this.b2DistanceJointDef.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2FrictionJoint = function na() {
    na.b2FrictionJoint.apply(this, arguments), this.constructor === na && this.b2FrictionJoint.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2FrictionJointDef = function oa() {
    oa.b2FrictionJointDef.apply(this, arguments), this.constructor === oa && this.b2FrictionJointDef.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2GearJoint = function pa() {
    pa.b2GearJoint.apply(this, arguments), this.constructor === pa && this.b2GearJoint.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2GearJointDef = function qa() {
    qa.b2GearJointDef.apply(this, arguments), this.constructor === qa && this.b2GearJointDef.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2Jacobian = function Wa() {
    Wa.b2Jacobian.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2Joint = function ra() {
    ra.b2Joint.apply(this, arguments), this.constructor === ra && this.b2Joint.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2JointDef = function sa() {
    sa.b2JointDef.apply(this, arguments), this.constructor === sa && this.b2JointDef.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2JointEdge = function Xa() {
    Xa.b2JointEdge.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2LineJoint = function ta() {
    ta.b2LineJoint.apply(this, arguments), this.constructor === ta && this.b2LineJoint.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2LineJointDef = function ua() {
    ua.b2LineJointDef.apply(this, arguments), this.constructor === ua && this.b2LineJointDef.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2MouseJoint = function va() {
    va.b2MouseJoint.apply(this, arguments), this.constructor === va && this.b2MouseJoint.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2MouseJointDef = function wa() {
    wa.b2MouseJointDef.apply(this, arguments), this.constructor === wa && this.b2MouseJointDef.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2PrismaticJoint = function xa() {
    xa.b2PrismaticJoint.apply(this, arguments), this.constructor === xa && this.b2PrismaticJoint.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2PrismaticJointDef = function ya() {
    ya.b2PrismaticJointDef.apply(this, arguments), this.constructor === ya && this.b2PrismaticJointDef.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2PulleyJoint = function za() {
    za.b2PulleyJoint.apply(this, arguments), this.constructor === za && this.b2PulleyJoint.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2PulleyJointDef = function Aa() {
    Aa.b2PulleyJointDef.apply(this, arguments), this.constructor === Aa && this.b2PulleyJointDef.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2RevoluteJoint = function Ba() {
    Ba.b2RevoluteJoint.apply(this, arguments), this.constructor === Ba && this.b2RevoluteJoint.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2RevoluteJointDef = function Ca() {
    Ca.b2RevoluteJointDef.apply(this, arguments), this.constructor === Ca && this.b2RevoluteJointDef.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2WeldJoint = function Da() {
    Da.b2WeldJoint.apply(this, arguments), this.constructor === Da && this.b2WeldJoint.apply(this, arguments);
}, Box2D.Dynamics.Joints.b2WeldJointDef = function Ea() {
    Ea.b2WeldJointDef.apply(this, arguments), this.constructor === Ea && this.b2WeldJointDef.apply(this, arguments);
}, Box2D.postDefs = [], function() {
    var F = Box2D.Collision.Shapes.b2CircleShape, G = Box2D.Collision.Shapes.b2PolygonShape, K = Box2D.Collision.Shapes.b2Shape, y = Box2D.Common.b2Settings, w = Box2D.Common.Math.b2Math, A = Box2D.Common.Math.b2Sweep, U = Box2D.Common.Math.b2Transform, p = Box2D.Common.Math.b2Vec2, B = Box2D.Collision.b2AABB, Q = Box2D.Collision.b2Bound, V = Box2D.Collision.b2BoundValues, M = Box2D.Collision.b2Collision, L = Box2D.Collision.b2ContactID, I = Box2D.Collision.b2ContactPoint, W = Box2D.Collision.b2Distance, Y = Box2D.Collision.b2DistanceInput, k = Box2D.Collision.b2DistanceOutput, z = Box2D.Collision.b2DistanceProxy, u = Box2D.Collision.b2DynamicTree, D = Box2D.Collision.b2DynamicTreeBroadPhase, H = Box2D.Collision.b2DynamicTreeNode, O = Box2D.Collision.b2DynamicTreePair, E = Box2D.Collision.b2Manifold, R = Box2D.Collision.b2ManifoldPoint, N = Box2D.Collision.b2Point, S = Box2D.Collision.b2RayCastInput, aa = Box2D.Collision.b2RayCastOutput, Z = Box2D.Collision.b2Segment, d = Box2D.Collision.b2SeparationFunction, h = Box2D.Collision.b2Simplex, l = Box2D.Collision.b2SimplexCache, j = Box2D.Collision.b2SimplexVertex, o = Box2D.Collision.b2TimeOfImpact, q = Box2D.Collision.b2TOIInput, n = Box2D.Collision.b2WorldManifold, a = Box2D.Collision.ClipVertex, c = Box2D.Collision.Features, g = Box2D.Collision.IBroadPhase;
    B.b2AABB = function() {
        this.lowerBound = new p(), this.upperBound = new p();
    }, B.prototype.IsValid = function() {
        var b = this.upperBound.y - this.lowerBound.y;
        return (b = 0 <= this.upperBound.x - this.lowerBound.x && 0 <= b) && this.lowerBound.IsValid() && this.upperBound.IsValid();
    }, B.prototype.GetCenter = function() {
        return new p((this.lowerBound.x + this.upperBound.x) / 2, (this.lowerBound.y + this.upperBound.y) / 2);
    }, B.prototype.GetExtents = function() {
        return new p((this.upperBound.x - this.lowerBound.x) / 2, (this.upperBound.y - this.lowerBound.y) / 2);
    }, B.prototype.Contains = function(b) {
        var e = !0;
        return (e = (e = (e = e && this.lowerBound.x <= b.lowerBound.x) && this.lowerBound.y <= b.lowerBound.y) && b.upperBound.x <= this.upperBound.x) && b.upperBound.y <= this.upperBound.y;
    }, B.prototype.RayCast = function(b, e) {
        var f = -Number.MAX_VALUE, m = Number.MAX_VALUE, r = e.p1.x, s = e.p1.y, v = e.p2.x - e.p1.x, t = e.p2.y - e.p1.y, x = Math.abs(t), C = b.normal, J = 0, T = 0, P = J = 0;
        if (P = 0, Math.abs(v) < Number.MIN_VALUE) {
            if (r < this.lowerBound.x || this.upperBound.x < r) return !1;
        } else if (J = 1 / v, T = (this.lowerBound.x - r) * J, P = -1, (J = (this.upperBound.x - r) * J) < T && (P = T, 
        T = J, J = P, P = 1), f < T && (C.x = P, C.y = 0, f = T), (m = Math.min(m, J)) < f) return !1;
        if (x < Number.MIN_VALUE) {
            if (s < this.lowerBound.y || this.upperBound.y < s) return !1;
        } else if (J = 1 / t, T = (this.lowerBound.y - s) * J, P = -1, (J = (this.upperBound.y - s) * J) < T && (P = T, 
        T = J, J = P, P = 1), f < T && (C.y = P, C.x = 0, f = T), (m = Math.min(m, J)) < f) return !1;
        return b.fraction = f, !0;
    }, B.prototype.TestOverlap = function(b) {
        var e = b.lowerBound.y - this.upperBound.y, f = this.lowerBound.y - b.upperBound.y;
        return !(0 < b.lowerBound.x - this.upperBound.x || 0 < e) && !(0 < this.lowerBound.x - b.upperBound.x || 0 < f);
    }, B.Combine = function(b, e) {
        var f = new B();
        return f.Combine(b, e), f;
    }, B.prototype.Combine = function(b, e) {
        this.lowerBound.x = Math.min(b.lowerBound.x, e.lowerBound.x), this.lowerBound.y = Math.min(b.lowerBound.y, e.lowerBound.y), 
        this.upperBound.x = Math.max(b.upperBound.x, e.upperBound.x), this.upperBound.y = Math.max(b.upperBound.y, e.upperBound.y);
    }, Q.b2Bound = function() {}, Q.prototype.IsLower = function() {
        return 0 == (1 & this.value);
    }, Q.prototype.IsUpper = function() {
        return 1 == (1 & this.value);
    }, Q.prototype.Swap = function(b) {
        var e = this.value, f = this.proxy, m = this.stabbingCount;
        this.value = b.value, this.proxy = b.proxy, this.stabbingCount = b.stabbingCount, 
        b.value = e, b.proxy = f, b.stabbingCount = m;
    }, V.b2BoundValues = function() {}, V.prototype.b2BoundValues = function() {
        this.lowerValues = new Vector_a2j_Number(), this.lowerValues[0] = 0, this.lowerValues[1] = 0, 
        this.upperValues = new Vector_a2j_Number(), this.upperValues[0] = 0, this.upperValues[1] = 0;
    }, M.b2Collision = function() {}, M.ClipSegmentToLine = function(b, e, f, m) {
        void 0 === m && (m = 0);
        var r, s = 0, v = (r = e[0]).v, t = (r = e[1]).v, x = f.x * v.x + f.y * v.y - m;
        return r = f.x * t.x + f.y * t.y - m, x <= 0 && b[s++].Set(e[0]), r <= 0 && b[s++].Set(e[1]), 
        x * r < 0 && (f = x / (x - r), (r = (r = b[s]).v).x = v.x + f * (t.x - v.x), r.y = v.y + f * (t.y - v.y), 
        (r = b[s]).id = (0 < x ? e[0] : e[1]).id, ++s), s;
    }, M.EdgeSeparation = function(b, e, f, m, r) {
        void 0 === f && (f = 0), parseInt(b.m_vertexCount);
        var s = b.m_vertices;
        b = b.m_normals;
        var x, C, v = parseInt(m.m_vertexCount), t = m.m_vertices;
        x = e.R, C = b[f], b = x.col1.x * C.x + x.col2.x * C.y, m = x.col1.y * C.x + x.col2.y * C.y;
        var J = (x = r.R).col1.x * b + x.col1.y * m;
        x = x.col2.x * b + x.col2.y * m;
        for (var T = 0, P = Number.MAX_VALUE, X = 0; X < v; ++X) (C = (C = t[X]).x * J + C.y * x) < P && (P = C, 
        T = X);
        return C = s[f], x = e.R, f = e.position.x + (x.col1.x * C.x + x.col2.x * C.y), 
        e = e.position.y + (x.col1.y * C.x + x.col2.y * C.y), C = t[T], x = r.R, s = r.position.x + (x.col1.x * C.x + x.col2.x * C.y), 
        r = r.position.y + (x.col1.y * C.x + x.col2.y * C.y), (s -= f) * b + (r -= e) * m;
    }, M.FindMaxSeparation = function(b, e, f, m, r) {
        var t, x, s = parseInt(e.m_vertexCount), v = e.m_normals;
        x = r.R, t = m.m_centroid;
        var C = r.position.x + (x.col1.x * t.x + x.col2.x * t.y), J = r.position.y + (x.col1.y * t.x + x.col2.y * t.y);
        x = f.R, t = e.m_centroid, C -= f.position.x + (x.col1.x * t.x + x.col2.x * t.y), 
        J -= f.position.y + (x.col1.y * t.x + x.col2.y * t.y), x = C * f.R.col1.x + J * f.R.col1.y, 
        J = C * f.R.col2.x + J * f.R.col2.y, C = 0;
        for (var T = -Number.MAX_VALUE, P = 0; P < s; ++P) T < (t = (t = v[P]).x * x + t.y * J) && (T = t, 
        C = P);
        v = M.EdgeSeparation(e, f, C, m, r), t = parseInt(0 <= C - 1 ? C - 1 : s - 1), x = M.EdgeSeparation(e, f, t, m, r), 
        J = parseInt(C + 1 < s ? C + 1 : 0), T = M.EdgeSeparation(e, f, J, m, r);
        var X = P = 0, $ = 0;
        if (v < x && T < x) $ = -1, P = t, X = x; else {
            if (!(v < T)) return b[0] = C, v;
            $ = 1, P = J, X = T;
        }
        for (;C = -1 == $ ? 0 <= P - 1 ? P - 1 : s - 1 : P + 1 < s ? P + 1 : 0, X < (v = M.EdgeSeparation(e, f, C, m, r)); ) P = C, 
        X = v;
        return b[0] = P, X;
    }, M.FindIncidentEdge = function(b, e, f, m, r, s) {
        void 0 === m && (m = 0), parseInt(e.m_vertexCount);
        var x, v = e.m_normals, t = parseInt(r.m_vertexCount);
        e = r.m_vertices, r = r.m_normals, x = f.R, f = v[m], v = x.col1.x * f.x + x.col2.x * f.y;
        var C = x.col1.y * f.x + x.col2.y * f.y;
        f = (x = s.R).col1.x * v + x.col1.y * C, C = x.col2.x * v + x.col2.y * C, v = f, 
        x = 0;
        for (var J = Number.MAX_VALUE, T = 0; T < t; ++T) (f = v * (f = r[T]).x + C * f.y) < J && (J = f, 
        x = T);
        r = parseInt(x), v = parseInt(r + 1 < t ? r + 1 : 0), t = b[0], f = e[r], x = s.R, 
        t.v.x = s.position.x + (x.col1.x * f.x + x.col2.x * f.y), t.v.y = s.position.y + (x.col1.y * f.x + x.col2.y * f.y), 
        t.id.features.referenceEdge = m, t.id.features.incidentEdge = r, t.id.features.incidentVertex = 0, 
        t = b[1], f = e[v], x = s.R, t.v.x = s.position.x + (x.col1.x * f.x + x.col2.x * f.y), 
        t.v.y = s.position.y + (x.col1.y * f.x + x.col2.y * f.y), t.id.features.referenceEdge = m, 
        t.id.features.incidentEdge = v, t.id.features.incidentVertex = 1;
    }, M.MakeClipPointVector = function() {
        var b = new Vector(2);
        return b[0] = new a(), b[1] = new a(), b;
    }, M.CollidePolygons = function(b, e, f, m, r) {
        var s;
        b.m_pointCount = 0;
        var v = e.m_radius + m.m_radius;
        s = 0, M.s_edgeAO[0] = s;
        var t = M.FindMaxSeparation(M.s_edgeAO, e, f, m, r);
        if (s = M.s_edgeAO[0], !(v < t)) {
            var x = 0;
            M.s_edgeBO[0] = x;
            var C = M.FindMaxSeparation(M.s_edgeBO, m, r, e, f);
            if (x = M.s_edgeBO[0], !(v < C)) {
                var P, J = 0, T = 0;
                T = .98 * t + .001 < C ? (t = m, m = e, e = r, f = f, J = x, b.m_type = E.e_faceB, 
                1) : (t = e, m = m, e = f, f = r, J = s, b.m_type = E.e_faceA, 0), s = M.s_incidentEdge, 
                M.FindIncidentEdge(s, t, e, J, m, f), x = parseInt(t.m_vertexCount), t = (r = t.m_vertices)[J], 
                P = J + 1 < x ? r[parseInt(J + 1)] : r[0], (J = M.s_localTangent).Set(P.x - t.x, P.y - t.y), 
                J.Normalize(), (r = M.s_localNormal).x = J.y, r.y = -J.x, (m = M.s_planePoint).Set(.5 * (t.x + P.x), .5 * (t.y + P.y)), 
                C = M.s_tangent, x = e.R, C.x = x.col1.x * J.x + x.col2.x * J.y, C.y = x.col1.y * J.x + x.col2.y * J.y;
                var X = M.s_tangent2;
                X.x = -C.x, X.y = -C.y, (J = M.s_normal).x = C.y, J.y = -C.x;
                var $ = M.s_v11, ba = M.s_v12;
                if ($.x = e.position.x + (x.col1.x * t.x + x.col2.x * t.y), $.y = e.position.y + (x.col1.y * t.x + x.col2.y * t.y), 
                ba.x = e.position.x + (x.col1.x * P.x + x.col2.x * P.y), ba.y = e.position.y + (x.col1.y * P.x + x.col2.y * P.y), 
                e = J.x * $.x + J.y * $.y, x = C.x * ba.x + C.y * ba.y + v, P = M.s_clipPoints1, 
                t = M.s_clipPoints2, ba = 0, !((ba = M.ClipSegmentToLine(P, s, X, -C.x * $.x - C.y * $.y + v)) < 2 || (ba = M.ClipSegmentToLine(t, P, C, x)) < 2)) {
                    for (b.m_localPlaneNormal.SetV(r), b.m_localPoint.SetV(m), m = r = 0; m < y.b2_maxManifoldPoints; ++m) s = t[m], 
                    J.x * s.v.x + J.y * s.v.y - e <= v && (C = b.m_points[r], x = f.R, X = s.v.x - f.position.x, 
                    $ = s.v.y - f.position.y, C.m_localPoint.x = X * x.col1.x + $ * x.col1.y, C.m_localPoint.y = X * x.col2.x + $ * x.col2.y, 
                    C.m_id.Set(s.id), C.m_id.features.flip = T, ++r);
                    b.m_pointCount = r;
                }
            }
        }
    }, M.CollideCircles = function(b, e, f, m, r) {
        var s, v;
        b.m_pointCount = 0, s = f.R, v = e.m_p;
        var t = f.position.x + (s.col1.x * v.x + s.col2.x * v.y);
        f = f.position.y + (s.col1.y * v.x + s.col2.y * v.y), s = r.R, v = m.m_p, t = r.position.x + (s.col1.x * v.x + s.col2.x * v.y) - t, 
        r = r.position.y + (s.col1.y * v.x + s.col2.y * v.y) - f, (s = e.m_radius + m.m_radius) * s < t * t + r * r || (b.m_type = E.e_circles, 
        b.m_localPoint.SetV(e.m_p), b.m_localPlaneNormal.SetZero(), b.m_pointCount = 1, 
        b.m_points[0].m_localPoint.SetV(m.m_p), b.m_points[0].m_id.key = 0);
    }, M.CollidePolygonAndCircle = function(b, e, f, m, r) {
        var t, x, s = b.m_pointCount = 0, v = 0;
        x = r.R, t = m.m_p;
        var C = r.position.y + (x.col1.y * t.x + x.col2.y * t.y);
        s = r.position.x + (x.col1.x * t.x + x.col2.x * t.y) - f.position.x, v = C - f.position.y, 
        f = s * (x = f.R).col1.x + v * x.col1.y, x = s * x.col2.x + v * x.col2.y;
        var J = 0;
        C = -Number.MAX_VALUE, r = e.m_radius + m.m_radius;
        var T = parseInt(e.m_vertexCount), P = e.m_vertices;
        e = e.m_normals;
        for (var X = 0; X < T; ++X) {
            if (s = f - (t = P[X]).x, v = x - t.y, r < (s = (t = e[X]).x * s + t.y * v)) return;
            C < s && (C = s, J = X);
        }
        if (s = parseInt(J), v = parseInt(s + 1 < T ? s + 1 : 0), t = P[s], P = P[v], C < Number.MIN_VALUE) b.m_pointCount = 1, 
        b.m_type = E.e_faceA, b.m_localPlaneNormal.SetV(e[J]), b.m_localPoint.x = .5 * (t.x + P.x), 
        b.m_localPoint.y = .5 * (t.y + P.y); else if (C = (f - P.x) * (t.x - P.x) + (x - P.y) * (t.y - P.y), 
        (f - t.x) * (P.x - t.x) + (x - t.y) * (P.y - t.y) <= 0) {
            if ((f - t.x) * (f - t.x) + (x - t.y) * (x - t.y) > r * r) return;
            b.m_pointCount = 1, b.m_type = E.e_faceA, b.m_localPlaneNormal.x = f - t.x, b.m_localPlaneNormal.y = x - t.y, 
            b.m_localPlaneNormal.Normalize(), b.m_localPoint.SetV(t);
        } else if (C <= 0) {
            if ((f - P.x) * (f - P.x) + (x - P.y) * (x - P.y) > r * r) return;
            b.m_pointCount = 1, b.m_type = E.e_faceA, b.m_localPlaneNormal.x = f - P.x, b.m_localPlaneNormal.y = x - P.y, 
            b.m_localPlaneNormal.Normalize(), b.m_localPoint.SetV(P);
        } else {
            if (J = .5 * (t.x + P.x), t = .5 * (t.y + P.y), r < (C = (f - J) * e[s].x + (x - t) * e[s].y)) return;
            b.m_pointCount = 1, b.m_type = E.e_faceA, b.m_localPlaneNormal.x = e[s].x, b.m_localPlaneNormal.y = e[s].y, 
            b.m_localPlaneNormal.Normalize(), b.m_localPoint.Set(J, t);
        }
        b.m_points[0].m_localPoint.SetV(m.m_p), b.m_points[0].m_id.key = 0;
    }, M.TestOverlap = function(b, e) {
        var f = e.lowerBound, m = b.upperBound, r = f.x - m.x, s = f.y - m.y;
        f = b.lowerBound, m = e.upperBound;
        var v = f.y - m.y;
        return !(0 < r || 0 < s) && !(0 < f.x - m.x || 0 < v);
    }, Box2D.postDefs.push(function() {
        Box2D.Collision.b2Collision.s_incidentEdge = M.MakeClipPointVector(), Box2D.Collision.b2Collision.s_clipPoints1 = M.MakeClipPointVector(), 
        Box2D.Collision.b2Collision.s_clipPoints2 = M.MakeClipPointVector(), Box2D.Collision.b2Collision.s_edgeAO = new Vector_a2j_Number(1), 
        Box2D.Collision.b2Collision.s_edgeBO = new Vector_a2j_Number(1), Box2D.Collision.b2Collision.s_localTangent = new p(), 
        Box2D.Collision.b2Collision.s_localNormal = new p(), Box2D.Collision.b2Collision.s_planePoint = new p(), 
        Box2D.Collision.b2Collision.s_normal = new p(), Box2D.Collision.b2Collision.s_tangent = new p(), 
        Box2D.Collision.b2Collision.s_tangent2 = new p(), Box2D.Collision.b2Collision.s_v11 = new p(), 
        Box2D.Collision.b2Collision.s_v12 = new p(), Box2D.Collision.b2Collision.b2CollidePolyTempVec = new p(), 
        Box2D.Collision.b2Collision.b2_nullFeature = 255;
    }), L.b2ContactID = function() {
        this.features = new c();
    }, L.prototype.b2ContactID = function() {
        this.features._m_id = this;
    }, L.prototype.Set = function(b) {
        this.key = b._key;
    }, L.prototype.Copy = function() {
        var b = new L();
        return b.key = this.key, b;
    }, Object.defineProperty(L.prototype, "key", {
        enumerable: !1,
        configurable: !0,
        get: function() {
            return this._key;
        }
    }), Object.defineProperty(L.prototype, "key", {
        enumerable: !1,
        configurable: !0,
        set: function(b) {
            void 0 === b && (b = 0), this._key = b, this.features._referenceEdge = 255 & this._key, 
            this.features._incidentEdge = (65280 & this._key) >> 8 & 255, this.features._incidentVertex = (16711680 & this._key) >> 16 & 255, 
            this.features._flip = (4278190080 & this._key) >> 24 & 255;
        }
    }), I.b2ContactPoint = function() {
        this.position = new p(), this.velocity = new p(), this.normal = new p(), this.id = new L();
    }, W.b2Distance = function() {}, W.Distance = function(b, e, f) {
        ++W.b2_gjkCalls;
        var m = f.proxyA, r = f.proxyB, s = f.transformA, v = f.transformB, t = W.s_simplex;
        t.ReadCache(e, m, s, r, v);
        var x = t.m_vertices, C = W.s_saveA, J = W.s_saveB, T = 0;
        t.GetClosestPoint().LengthSquared();
        for (var X, P = 0, $ = 0; $ < 20; ) {
            for (T = t.m_count, P = 0; P < T; P++) C[P] = x[P].indexA, J[P] = x[P].indexB;
            switch (t.m_count) {
              case 1:
                break;

              case 2:
                t.Solve2();
                break;

              case 3:
                t.Solve3();
                break;

              default:
                y.b2Assert(!1);
            }
            if (3 == t.m_count) break;
            if ((X = t.GetClosestPoint()).LengthSquared(), (P = t.GetSearchDirection()).LengthSquared() < Number.MIN_VALUE * Number.MIN_VALUE) break;
            (X = x[t.m_count]).indexA = m.GetSupport(w.MulTMV(s.R, P.GetNegative())), X.wA = w.MulX(s, m.GetVertex(X.indexA)), 
            X.indexB = r.GetSupport(w.MulTMV(v.R, P)), X.wB = w.MulX(v, r.GetVertex(X.indexB)), 
            X.w = w.SubtractVV(X.wB, X.wA), ++$, ++W.b2_gjkIters;
            var ba = !1;
            for (P = 0; P < T; P++) if (X.indexA == C[P] && X.indexB == J[P]) {
                ba = !0;
                break;
            }
            if (ba) break;
            ++t.m_count;
        }
        W.b2_gjkMaxIters = w.Max(W.b2_gjkMaxIters, $), t.GetWitnessPoints(b.pointA, b.pointB), 
        b.distance = w.SubtractVV(b.pointA, b.pointB).Length(), b.iterations = $, t.WriteCache(e), 
        f.useRadii && (e = m.m_radius, r = r.m_radius, b.distance > e + r && b.distance > Number.MIN_VALUE ? (b.distance -= e + r, 
        (f = w.SubtractVV(b.pointB, b.pointA)).Normalize(), b.pointA.x += e * f.x, b.pointA.y += e * f.y, 
        b.pointB.x -= r * f.x, b.pointB.y -= r * f.y) : ((X = new p()).x = .5 * (b.pointA.x + b.pointB.x), 
        X.y = .5 * (b.pointA.y + b.pointB.y), b.pointA.x = b.pointB.x = X.x, b.pointA.y = b.pointB.y = X.y, 
        b.distance = 0));
    }, Box2D.postDefs.push(function() {
        Box2D.Collision.b2Distance.s_simplex = new h(), Box2D.Collision.b2Distance.s_saveA = new Vector_a2j_Number(3), 
        Box2D.Collision.b2Distance.s_saveB = new Vector_a2j_Number(3);
    }), Y.b2DistanceInput = function() {}, k.b2DistanceOutput = function() {
        this.pointA = new p(), this.pointB = new p();
    }, z.b2DistanceProxy = function() {}, z.prototype.Set = function(b) {
        switch (b.GetType()) {
          case K.e_circleShape:
            b = b instanceof F ? b : null, this.m_vertices = new Vector(1, !0), this.m_vertices[0] = b.m_p, 
            this.m_count = 1, this.m_radius = b.m_radius;
            break;

          case K.e_polygonShape:
            b = b instanceof G ? b : null, this.m_vertices = b.m_vertices, this.m_count = b.m_vertexCount, 
            this.m_radius = b.m_radius;
            break;

          default:
            y.b2Assert(!1);
        }
    }, z.prototype.GetSupport = function(b) {
        for (var e = 0, f = this.m_vertices[0].x * b.x + this.m_vertices[0].y * b.y, m = 1; m < this.m_count; ++m) {
            var r = this.m_vertices[m].x * b.x + this.m_vertices[m].y * b.y;
            f < r && (e = m, f = r);
        }
        return e;
    }, z.prototype.GetSupportVertex = function(b) {
        for (var e = 0, f = this.m_vertices[0].x * b.x + this.m_vertices[0].y * b.y, m = 1; m < this.m_count; ++m) {
            var r = this.m_vertices[m].x * b.x + this.m_vertices[m].y * b.y;
            f < r && (e = m, f = r);
        }
        return this.m_vertices[e];
    }, z.prototype.GetVertexCount = function() {
        return this.m_count;
    }, z.prototype.GetVertex = function(b) {
        return void 0 === b && (b = 0), y.b2Assert(0 <= b && b < this.m_count), this.m_vertices[b];
    }, u.b2DynamicTree = function() {}, u.prototype.b2DynamicTree = function() {
        this.m_freeList = this.m_root = null, this.m_insertionCount = this.m_path = 0;
    }, u.prototype.CreateProxy = function(b, e) {
        var f = this.AllocateNode(), m = y.b2_aabbExtension, r = y.b2_aabbExtension;
        return f.aabb.lowerBound.x = b.lowerBound.x - m, f.aabb.lowerBound.y = b.lowerBound.y - r, 
        f.aabb.upperBound.x = b.upperBound.x + m, f.aabb.upperBound.y = b.upperBound.y + r, 
        f.userData = e, this.InsertLeaf(f), f;
    }, u.prototype.DestroyProxy = function(b) {
        this.RemoveLeaf(b), this.FreeNode(b);
    }, u.prototype.MoveProxy = function(b, e, f) {
        if (y.b2Assert(b.IsLeaf()), b.aabb.Contains(e)) return !1;
        this.RemoveLeaf(b);
        var m = y.b2_aabbExtension + y.b2_aabbMultiplier * (0 < f.x ? f.x : -f.x);
        return f = y.b2_aabbExtension + y.b2_aabbMultiplier * (0 < f.y ? f.y : -f.y), b.aabb.lowerBound.x = e.lowerBound.x - m, 
        b.aabb.lowerBound.y = e.lowerBound.y - f, b.aabb.upperBound.x = e.upperBound.x + m, 
        b.aabb.upperBound.y = e.upperBound.y + f, this.InsertLeaf(b), !0;
    }, u.prototype.Rebalance = function(b) {
        if (void 0 === b && (b = 0), null != this.m_root) for (var e = 0; e < b; e++) {
            for (var f = this.m_root, m = 0; 0 == f.IsLeaf(); ) f = this.m_path >> m & 1 ? f.child2 : f.child1, 
            m = m + 1 & 31;
            ++this.m_path, this.RemoveLeaf(f), this.InsertLeaf(f);
        }
    }, u.prototype.GetFatAABB = function(b) {
        return b.aabb;
    }, u.prototype.GetUserData = function(b) {
        return b.userData;
    }, u.prototype.Query = function(b, e) {
        if (null != this.m_root) {
            var f = new Vector(), m = 0;
            for (f[m++] = this.m_root; 0 < m; ) {
                var r = f[--m];
                if (r.aabb.TestOverlap(e)) if (r.IsLeaf()) {
                    if (!b(r)) break;
                } else f[m++] = r.child1, f[m++] = r.child2;
            }
        }
    }, u.prototype.RayCast = function(b, e) {
        if (null != this.m_root) {
            var f = e.p1, m = e.p2, r = w.SubtractVV(f, m);
            r.Normalize(), r = w.CrossFV(1, r);
            var s = w.AbsV(r), v = e.maxFraction, t = new B(), x = 0, C = 0;
            x = f.x + v * (m.x - f.x), C = f.y + v * (m.y - f.y), t.lowerBound.x = Math.min(f.x, x), 
            t.lowerBound.y = Math.min(f.y, C), t.upperBound.x = Math.max(f.x, x), t.upperBound.y = Math.max(f.y, C);
            var J = new Vector(), T = 0;
            for (J[T++] = this.m_root; 0 < T; ) if (0 != (v = J[--T]).aabb.TestOverlap(t) && (x = v.aabb.GetCenter(), 
            C = v.aabb.GetExtents(), !(0 < Math.abs(r.x * (f.x - x.x) + r.y * (f.y - x.y)) - s.x * C.x - s.y * C.y))) if (v.IsLeaf()) {
                if ((x = new S()).p1 = e.p1, x.p2 = e.p2, x.maxFraction = e.maxFraction, 0 == (v = b(x, v))) break;
                0 < v && (x = f.x + v * (m.x - f.x), C = f.y + v * (m.y - f.y), t.lowerBound.x = Math.min(f.x, x), 
                t.lowerBound.y = Math.min(f.y, C), t.upperBound.x = Math.max(f.x, x), t.upperBound.y = Math.max(f.y, C));
            } else J[T++] = v.child1, J[T++] = v.child2;
        }
    }, u.prototype.AllocateNode = function() {
        if (this.m_freeList) {
            var b = this.m_freeList;
            return this.m_freeList = b.parent, b.parent = null, b.child1 = null, b.child2 = null, 
            b;
        }
        return new H();
    }, u.prototype.FreeNode = function(b) {
        b.parent = this.m_freeList, this.m_freeList = b;
    }, u.prototype.InsertLeaf = function(b) {
        if (++this.m_insertionCount, null == this.m_root) this.m_root = b, this.m_root.parent = null; else {
            var e = b.aabb.GetCenter(), f = this.m_root;
            if (0 == f.IsLeaf()) do {
                var m = f.child1;
                f = f.child2, f = Math.abs((m.aabb.lowerBound.x + m.aabb.upperBound.x) / 2 - e.x) + Math.abs((m.aabb.lowerBound.y + m.aabb.upperBound.y) / 2 - e.y) < Math.abs((f.aabb.lowerBound.x + f.aabb.upperBound.x) / 2 - e.x) + Math.abs((f.aabb.lowerBound.y + f.aabb.upperBound.y) / 2 - e.y) ? m : f;
            } while (0 == f.IsLeaf());
            if (e = f.parent, (m = this.AllocateNode()).parent = e, m.userData = null, m.aabb.Combine(b.aabb, f.aabb), 
            e) {
                f.parent.child1 == f ? e.child1 = m : e.child2 = m, m.child1 = f, m.child2 = b, 
                f.parent = m, b.parent = m;
                do {
                    if (e.aabb.Contains(m.aabb)) break;
                    e.aabb.Combine(e.child1.aabb, e.child2.aabb), e = (m = e).parent;
                } while (e);
            } else m.child1 = f, m.child2 = b, f.parent = m, this.m_root = b.parent = m;
        }
    }, u.prototype.RemoveLeaf = function(b) {
        if (b == this.m_root) this.m_root = null; else {
            var e = b.parent, f = e.parent;
            if (b = e.child1 == b ? e.child2 : e.child1, f) for (f.child1 == e ? f.child1 = b : f.child2 = b, 
            b.parent = f, this.FreeNode(e); f && (e = f.aabb, f.aabb = B.Combine(f.child1.aabb, f.child2.aabb), 
            !e.Contains(f.aabb)); ) f = f.parent; else (this.m_root = b).parent = null, this.FreeNode(e);
        }
    }, D.b2DynamicTreeBroadPhase = function() {
        this.m_tree = new u(), this.m_moveBuffer = new Vector(), this.m_pairBuffer = new Vector(), 
        this.m_pairCount = 0;
    }, D.prototype.CreateProxy = function(b, e) {
        var f = this.m_tree.CreateProxy(b, e);
        return ++this.m_proxyCount, this.BufferMove(f), f;
    }, D.prototype.DestroyProxy = function(b) {
        this.UnBufferMove(b), --this.m_proxyCount, this.m_tree.DestroyProxy(b);
    }, D.prototype.MoveProxy = function(b, e, f) {
        this.m_tree.MoveProxy(b, e, f) && this.BufferMove(b);
    }, D.prototype.TestOverlap = function(b, e) {
        var f = this.m_tree.GetFatAABB(b), m = this.m_tree.GetFatAABB(e);
        return f.TestOverlap(m);
    }, D.prototype.GetUserData = function(b) {
        return this.m_tree.GetUserData(b);
    }, D.prototype.GetFatAABB = function(b) {
        return this.m_tree.GetFatAABB(b);
    }, D.prototype.GetProxyCount = function() {
        return this.m_proxyCount;
    }, D.prototype.UpdatePairs = function(b) {
        var m, e = this, f = e.m_pairCount = 0;
        for (f = 0; f < e.m_moveBuffer.length; ++f) {
            m = e.m_moveBuffer[f];
            var r = e.m_tree.GetFatAABB(m);
            e.m_tree.Query(function(t) {
                if (t == m) return !0;
                e.m_pairCount == e.m_pairBuffer.length && (e.m_pairBuffer[e.m_pairCount] = new O());
                var x = e.m_pairBuffer[e.m_pairCount];
                return x.proxyA = t < m ? t : m, x.proxyB = m <= t ? t : m, ++e.m_pairCount, !0;
            }, r);
        }
        for (f = e.m_moveBuffer.length = 0; f < e.m_pairCount; ) {
            r = e.m_pairBuffer[f];
            var s = e.m_tree.GetUserData(r.proxyA);
            for (b(s, e.m_tree.GetUserData(r.proxyB)), ++f; f < e.m_pairCount && ((s = e.m_pairBuffer[f]).proxyA == r.proxyA && s.proxyB == r.proxyB); ) ++f;
        }
    }, D.prototype.Query = function(b, e) {
        this.m_tree.Query(b, e);
    }, D.prototype.RayCast = function(b, e) {
        this.m_tree.RayCast(b, e);
    }, D.prototype.Validate = function() {}, D.prototype.Rebalance = function(b) {
        void 0 === b && (b = 0), this.m_tree.Rebalance(b);
    }, D.prototype.BufferMove = function(b) {
        this.m_moveBuffer[this.m_moveBuffer.length] = b;
    }, D.prototype.UnBufferMove = function(b) {
        this.m_moveBuffer.splice(parseInt(this.m_moveBuffer.indexOf(b)), 1);
    }, D.prototype.ComparePairs = function() {
        return 0;
    }, D.__implements = {}, D.__implements[g] = !0, H.b2DynamicTreeNode = function() {
        this.aabb = new B();
    }, H.prototype.IsLeaf = function() {
        return null == this.child1;
    }, O.b2DynamicTreePair = function() {}, E.b2Manifold = function() {
        this.m_pointCount = 0;
    }, E.prototype.b2Manifold = function() {
        this.m_points = new Vector(y.b2_maxManifoldPoints);
        for (var b = 0; b < y.b2_maxManifoldPoints; b++) this.m_points[b] = new R();
        this.m_localPlaneNormal = new p(), this.m_localPoint = new p();
    }, E.prototype.Reset = function() {
        for (var b = 0; b < y.b2_maxManifoldPoints; b++) (this.m_points[b] instanceof R ? this.m_points[b] : null).Reset();
        this.m_localPlaneNormal.SetZero(), this.m_localPoint.SetZero(), this.m_pointCount = this.m_type = 0;
    }, E.prototype.Set = function(b) {
        this.m_pointCount = b.m_pointCount;
        for (var e = 0; e < y.b2_maxManifoldPoints; e++) (this.m_points[e] instanceof R ? this.m_points[e] : null).Set(b.m_points[e]);
        this.m_localPlaneNormal.SetV(b.m_localPlaneNormal), this.m_localPoint.SetV(b.m_localPoint), 
        this.m_type = b.m_type;
    }, E.prototype.Copy = function() {
        var b = new E();
        return b.Set(this), b;
    }, Box2D.postDefs.push(function() {
        Box2D.Collision.b2Manifold.e_circles = 1, Box2D.Collision.b2Manifold.e_faceA = 2, 
        Box2D.Collision.b2Manifold.e_faceB = 4;
    }), R.b2ManifoldPoint = function() {
        this.m_localPoint = new p(), this.m_id = new L();
    }, R.prototype.b2ManifoldPoint = function() {
        this.Reset();
    }, R.prototype.Reset = function() {
        this.m_localPoint.SetZero(), this.m_tangentImpulse = this.m_normalImpulse = 0, this.m_id.key = 0;
    }, R.prototype.Set = function(b) {
        this.m_localPoint.SetV(b.m_localPoint), this.m_normalImpulse = b.m_normalImpulse, 
        this.m_tangentImpulse = b.m_tangentImpulse, this.m_id.Set(b.m_id);
    }, N.b2Point = function() {
        this.p = new p();
    }, N.prototype.Support = function() {
        return this.p;
    }, N.prototype.GetFirstVertex = function() {
        return this.p;
    }, S.b2RayCastInput = function() {
        this.p1 = new p(), this.p2 = new p();
    }, S.prototype.b2RayCastInput = function(b, e, f) {
        void 0 === b && (b = null), void 0 === e && (e = null), void 0 === f && (f = 1), 
        b && this.p1.SetV(b), e && this.p2.SetV(e), this.maxFraction = f;
    }, aa.b2RayCastOutput = function() {
        this.normal = new p();
    }, Z.b2Segment = function() {
        this.p1 = new p(), this.p2 = new p();
    }, Z.prototype.TestSegment = function(b, e, f, m) {
        void 0 === m && (m = 0);
        var r = f.p1, s = f.p2.x - r.x, v = f.p2.y - r.y;
        f = this.p2.y - this.p1.y;
        var t = -(this.p2.x - this.p1.x), x = 100 * Number.MIN_VALUE, C = -(s * f + v * t);
        if (x < C) {
            var J = r.x - this.p1.x, T = r.y - this.p1.y;
            if (0 <= (r = J * f + T * t) && r <= m * C && -x * C <= (m = -s * T + v * J) && m <= C * (1 + x)) return r /= C, 
            f /= m = Math.sqrt(f * f + t * t), t /= m, b[0] = r, e.Set(f, t), !0;
        }
        return !1;
    }, Z.prototype.Extend = function(b) {
        this.ExtendForward(b), this.ExtendBackward(b);
    }, Z.prototype.ExtendForward = function(b) {
        var e = this.p2.x - this.p1.x, f = this.p2.y - this.p1.y;
        b = Math.min(0 < e ? (b.upperBound.x - this.p1.x) / e : e < 0 ? (b.lowerBound.x - this.p1.x) / e : Number.POSITIVE_INFINITY, 0 < f ? (b.upperBound.y - this.p1.y) / f : f < 0 ? (b.lowerBound.y - this.p1.y) / f : Number.POSITIVE_INFINITY), 
        this.p2.x = this.p1.x + e * b, this.p2.y = this.p1.y + f * b;
    }, Z.prototype.ExtendBackward = function(b) {
        var e = -this.p2.x + this.p1.x, f = -this.p2.y + this.p1.y;
        b = Math.min(0 < e ? (b.upperBound.x - this.p2.x) / e : e < 0 ? (b.lowerBound.x - this.p2.x) / e : Number.POSITIVE_INFINITY, 0 < f ? (b.upperBound.y - this.p2.y) / f : f < 0 ? (b.lowerBound.y - this.p2.y) / f : Number.POSITIVE_INFINITY), 
        this.p1.x = this.p2.x + e * b, this.p1.y = this.p2.y + f * b;
    }, d.b2SeparationFunction = function() {
        this.m_localPoint = new p(), this.m_axis = new p();
    }, d.prototype.Initialize = function(b, e, f, m, r) {
        this.m_proxyA = e, this.m_proxyB = m;
        var s = parseInt(b.count);
        y.b2Assert(0 < s && s < 3);
        var v, t, x, C, J = C = x = m = e = 0, T = 0;
        J = 0, 1 == s ? (this.m_type = d.e_points, v = this.m_proxyA.GetVertex(b.indexA[0]), 
        t = this.m_proxyB.GetVertex(b.indexB[0]), s = v, b = f.R, e = f.position.x + (b.col1.x * s.x + b.col2.x * s.y), 
        m = f.position.y + (b.col1.y * s.x + b.col2.y * s.y), s = t, b = r.R, x = r.position.x + (b.col1.x * s.x + b.col2.x * s.y), 
        C = r.position.y + (b.col1.y * s.x + b.col2.y * s.y), this.m_axis.x = x - e, this.m_axis.y = C - m, 
        this.m_axis.Normalize()) : (b.indexB[0] == b.indexB[1] ? (this.m_type = d.e_faceA, 
        e = this.m_proxyA.GetVertex(b.indexA[0]), m = this.m_proxyA.GetVertex(b.indexA[1]), 
        t = this.m_proxyB.GetVertex(b.indexB[0]), this.m_localPoint.x = .5 * (e.x + m.x), 
        this.m_localPoint.y = .5 * (e.y + m.y), this.m_axis = w.CrossVF(w.SubtractVV(m, e), 1), 
        this.m_axis.Normalize(), s = this.m_axis, J = (b = f.R).col1.x * s.x + b.col2.x * s.y, 
        T = b.col1.y * s.x + b.col2.y * s.y, s = this.m_localPoint, b = f.R, e = f.position.x + (b.col1.x * s.x + b.col2.x * s.y), 
        m = f.position.y + (b.col1.y * s.x + b.col2.y * s.y), s = t, b = r.R, J = ((x = r.position.x + (b.col1.x * s.x + b.col2.x * s.y)) - e) * J + ((C = r.position.y + (b.col1.y * s.x + b.col2.y * s.y)) - m) * T) : b.indexA[0] == b.indexA[0] ? (this.m_type = d.e_faceB, 
        x = this.m_proxyB.GetVertex(b.indexB[0]), C = this.m_proxyB.GetVertex(b.indexB[1]), 
        v = this.m_proxyA.GetVertex(b.indexA[0]), this.m_localPoint.x = .5 * (x.x + C.x), 
        this.m_localPoint.y = .5 * (x.y + C.y), this.m_axis = w.CrossVF(w.SubtractVV(C, x), 1), 
        this.m_axis.Normalize(), s = this.m_axis, J = (b = r.R).col1.x * s.x + b.col2.x * s.y, 
        T = b.col1.y * s.x + b.col2.y * s.y, s = this.m_localPoint, b = r.R, x = r.position.x + (b.col1.x * s.x + b.col2.x * s.y), 
        C = r.position.y + (b.col1.y * s.x + b.col2.y * s.y), s = v, b = f.R, J = ((e = f.position.x + (b.col1.x * s.x + b.col2.x * s.y)) - x) * J + ((m = f.position.y + (b.col1.y * s.x + b.col2.y * s.y)) - C) * T) : (e = this.m_proxyA.GetVertex(b.indexA[0]), 
        m = this.m_proxyA.GetVertex(b.indexA[1]), x = this.m_proxyB.GetVertex(b.indexB[0]), 
        C = this.m_proxyB.GetVertex(b.indexB[1]), w.MulX(f, v), v = w.MulMV(f.R, w.SubtractVV(m, e)), 
        w.MulX(r, t), J = w.MulMV(r.R, w.SubtractVV(C, x)), r = v.x * v.x + v.y * v.y, t = J.x * J.x + J.y * J.y, 
        b = w.SubtractVV(J, v), f = v.x * b.x + v.y * b.y, b = J.x * b.x + J.y * b.y, v = v.x * J.x + v.y * J.y, 
        (J = 0) != (T = r * t - v * v) && (J = w.Clamp((v * b - f * t) / T, 0, 1)), (v * J + b) / t < 0 && (J = w.Clamp((v - f) / r, 0, 1)), 
        (v = new p()).x = e.x + J * (m.x - e.x), v.y = e.y + J * (m.y - e.y), (t = new p()).x = x.x + J * (C.x - x.x), 
        t.y = x.y + J * (C.y - x.y), 0 == J || 1 == J ? (this.m_type = d.e_faceB, this.m_axis = w.CrossVF(w.SubtractVV(C, x), 1), 
        this.m_axis.Normalize(), this.m_localPoint = t) : (this.m_type = d.e_faceA, this.m_axis = w.CrossVF(w.SubtractVV(m, e), 1), 
        this.m_localPoint = v)), J < 0 && this.m_axis.NegativeSelf());
    }, d.prototype.Evaluate = function(b, e) {
        var f, m, r = 0;
        switch (this.m_type) {
          case d.e_points:
            return f = w.MulTMV(b.R, this.m_axis), m = w.MulTMV(e.R, this.m_axis.GetNegative()), 
            f = this.m_proxyA.GetSupportVertex(f), m = this.m_proxyB.GetSupportVertex(m), f = w.MulX(b, f), 
            ((m = w.MulX(e, m)).x - f.x) * this.m_axis.x + (m.y - f.y) * this.m_axis.y;

          case d.e_faceA:
            return r = w.MulMV(b.R, this.m_axis), f = w.MulX(b, this.m_localPoint), m = w.MulTMV(e.R, r.GetNegative()), 
            m = this.m_proxyB.GetSupportVertex(m), ((m = w.MulX(e, m)).x - f.x) * r.x + (m.y - f.y) * r.y;

          case d.e_faceB:
            return r = w.MulMV(e.R, this.m_axis), m = w.MulX(e, this.m_localPoint), f = w.MulTMV(b.R, r.GetNegative()), 
            f = this.m_proxyA.GetSupportVertex(f), ((f = w.MulX(b, f)).x - m.x) * r.x + (f.y - m.y) * r.y;

          default:
            return y.b2Assert(!1), 0;
        }
    }, Box2D.postDefs.push(function() {
        Box2D.Collision.b2SeparationFunction.e_points = 1, Box2D.Collision.b2SeparationFunction.e_faceA = 2, 
        Box2D.Collision.b2SeparationFunction.e_faceB = 4;
    }), h.b2Simplex = function() {
        this.m_v1 = new j(), this.m_v2 = new j(), this.m_v3 = new j(), this.m_vertices = new Vector(3);
    }, h.prototype.b2Simplex = function() {
        this.m_vertices[0] = this.m_v1, this.m_vertices[1] = this.m_v2, this.m_vertices[2] = this.m_v3;
    }, h.prototype.ReadCache = function(b, e, f, m, r) {
        var s, v;
        y.b2Assert(0 <= b.count && b.count <= 3), this.m_count = b.count;
        for (var t = this.m_vertices, x = 0; x < this.m_count; x++) {
            var C = t[x];
            C.indexA = b.indexA[x], C.indexB = b.indexB[x], s = e.GetVertex(C.indexA), v = m.GetVertex(C.indexB), 
            C.wA = w.MulX(f, s), C.wB = w.MulX(r, v), C.w = w.SubtractVV(C.wB, C.wA), C.a = 0;
        }
        1 < this.m_count && (b = b.metric, ((s = this.GetMetric()) < .5 * b || 2 * b < s || s < Number.MIN_VALUE) && (this.m_count = 0)), 
        0 == this.m_count && ((C = t[0]).indexA = 0, C.indexB = 0, s = e.GetVertex(0), v = m.GetVertex(0), 
        C.wA = w.MulX(f, s), C.wB = w.MulX(r, v), C.w = w.SubtractVV(C.wB, C.wA), this.m_count = 1);
    }, h.prototype.WriteCache = function(b) {
        b.metric = this.GetMetric(), b.count = Box2D.parseUInt(this.m_count);
        for (var e = this.m_vertices, f = 0; f < this.m_count; f++) b.indexA[f] = Box2D.parseUInt(e[f].indexA), 
        b.indexB[f] = Box2D.parseUInt(e[f].indexB);
    }, h.prototype.GetSearchDirection = function() {
        switch (this.m_count) {
          case 1:
            return this.m_v1.w.GetNegative();

          case 2:
            var b = w.SubtractVV(this.m_v2.w, this.m_v1.w);
            return 0 < w.CrossVV(b, this.m_v1.w.GetNegative()) ? w.CrossFV(1, b) : w.CrossVF(b, 1);

          default:
            return y.b2Assert(!1), new p();
        }
    }, h.prototype.GetClosestPoint = function() {
        switch (this.m_count) {
          case 0:
            return y.b2Assert(!1), new p();

          case 1:
            return this.m_v1.w;

          case 2:
            return new p(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);

          default:
            return y.b2Assert(!1), new p();
        }
    }, h.prototype.GetWitnessPoints = function(b, e) {
        switch (this.m_count) {
          case 0:
            y.b2Assert(!1);
            break;

          case 1:
            b.SetV(this.m_v1.wA), e.SetV(this.m_v1.wB);
            break;

          case 2:
            b.x = this.m_v1.a * this.m_v1.wA.x + this.m_v2.a * this.m_v2.wA.x, b.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 = b.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 = b.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;
            break;

          default:
            y.b2Assert(!1);
        }
    }, h.prototype.GetMetric = function() {
        switch (this.m_count) {
          case 0:
            return y.b2Assert(!1), 0;

          case 1:
            return 0;

          case 2:
            return w.SubtractVV(this.m_v1.w, this.m_v2.w).Length();

          case 3:
            return w.CrossVV(w.SubtractVV(this.m_v2.w, this.m_v1.w), w.SubtractVV(this.m_v3.w, this.m_v1.w));

          default:
            return y.b2Assert(!1), 0;
        }
    }, h.prototype.Solve2 = function() {
        var b = this.m_v1.w, e = this.m_v2.w, f = w.SubtractVV(e, b);
        (b = -(b.x * f.x + b.y * f.y)) <= 0 ? this.m_count = this.m_v1.a = 1 : (e = e.x * f.x + e.y * f.y) <= 0 ? (this.m_count = this.m_v2.a = 1, 
        this.m_v1.Set(this.m_v2)) : (f = 1 / (e + b), this.m_v1.a = e * f, this.m_v2.a = b * f, 
        this.m_count = 2);
    }, h.prototype.Solve3 = function() {
        var b = this.m_v1.w, e = this.m_v2.w, f = this.m_v3.w, m = w.SubtractVV(e, b), r = w.Dot(b, m), s = w.Dot(e, m);
        r = -r;
        var v = w.SubtractVV(f, b), t = w.Dot(b, v), x = w.Dot(f, v);
        t = -t;
        var C = w.SubtractVV(f, e), J = w.Dot(e, C);
        C = w.Dot(f, C), J = -J, m = (v = w.CrossVV(m, v)) * w.CrossVV(e, f), f = v * w.CrossVV(f, b), 
        b = v * w.CrossVV(b, e), r <= 0 && t <= 0 ? this.m_count = this.m_v1.a = 1 : 0 < s && 0 < r && b <= 0 ? (x = 1 / (s + r), 
        this.m_v1.a = s * x, this.m_v2.a = r * x, this.m_count = 2) : 0 < x && 0 < t && f <= 0 ? (s = 1 / (x + t), 
        this.m_v1.a = x * s, this.m_v3.a = t * s, this.m_count = 2, this.m_v2.Set(this.m_v3)) : s <= 0 && J <= 0 ? (this.m_count = this.m_v2.a = 1, 
        this.m_v1.Set(this.m_v2)) : x <= 0 && C <= 0 ? (this.m_count = this.m_v3.a = 1, 
        this.m_v1.Set(this.m_v3)) : 0 < C && 0 < J && m <= 0 ? (s = 1 / (C + J), this.m_v2.a = C * s, 
        this.m_v3.a = J * s, this.m_count = 2, this.m_v1.Set(this.m_v3)) : (s = 1 / (m + f + b), 
        this.m_v1.a = m * s, this.m_v2.a = f * s, this.m_v3.a = b * s, this.m_count = 3);
    }, l.b2SimplexCache = function() {
        this.indexA = new Vector_a2j_Number(3), this.indexB = new Vector_a2j_Number(3);
    }, j.b2SimplexVertex = function() {}, j.prototype.Set = function(b) {
        this.wA.SetV(b.wA), this.wB.SetV(b.wB), this.w.SetV(b.w), this.a = b.a, this.indexA = b.indexA, 
        this.indexB = b.indexB;
    }, o.b2TimeOfImpact = function() {}, o.TimeOfImpact = function(b) {
        ++o.b2_toiCalls;
        var e = b.proxyA, f = b.proxyB, m = b.sweepA, r = b.sweepB;
        y.b2Assert(m.t0 == r.t0), y.b2Assert(1 - m.t0 > Number.MIN_VALUE);
        var s = e.m_radius + f.m_radius;
        b = b.tolerance;
        var v = 0, t = 0, x = 0;
        for (o.s_cache.count = 0, o.s_distanceInput.useRadii = !1; ;) {
            if (m.GetTransform(o.s_xfA, v), r.GetTransform(o.s_xfB, v), o.s_distanceInput.proxyA = e, 
            o.s_distanceInput.proxyB = f, o.s_distanceInput.transformA = o.s_xfA, o.s_distanceInput.transformB = o.s_xfB, 
            W.Distance(o.s_distanceOutput, o.s_cache, o.s_distanceInput), o.s_distanceOutput.distance <= 0) {
                v = 1;
                break;
            }
            o.s_fcn.Initialize(o.s_cache, e, o.s_xfA, f, o.s_xfB);
            var C = o.s_fcn.Evaluate(o.s_xfA, o.s_xfB);
            if (C <= 0) {
                v = 1;
                break;
            }
            if (0 == t && (x = s < C ? w.Max(s - b, .75 * s) : w.Max(C - b, .02 * s)), C - x < .5 * b) {
                if (0 != t) break;
                v = 1;
                break;
            }
            var J = v, T = v, P = 1;
            C = C, m.GetTransform(o.s_xfA, P), r.GetTransform(o.s_xfB, P);
            var X = o.s_fcn.Evaluate(o.s_xfA, o.s_xfB);
            if (x <= X) {
                v = 1;
                break;
            }
            for (var $ = 0; ;) {
                var ba;
                ba = 1 & $ ? T + (x - C) * (P - T) / (X - C) : .5 * (T + P), m.GetTransform(o.s_xfA, ba), 
                r.GetTransform(o.s_xfB, ba);
                var ca = o.s_fcn.Evaluate(o.s_xfA, o.s_xfB);
                if (w.Abs(ca - x) < .025 * b) {
                    J = ba;
                    break;
                }
                if (x < ca ? (T = ba, C = ca) : (P = ba, X = ca), ++$, ++o.b2_toiRootIters, 50 == $) break;
            }
            if (o.b2_toiMaxRootIters = w.Max(o.b2_toiMaxRootIters, $), J < (1 + 100 * Number.MIN_VALUE) * v) break;
            if (v = J, t++, ++o.b2_toiIters, 1e3 == t) break;
        }
        return o.b2_toiMaxIters = w.Max(o.b2_toiMaxIters, t), v;
    }, Box2D.postDefs.push(function() {
        Box2D.Collision.b2TimeOfImpact.b2_toiCalls = 0, Box2D.Collision.b2TimeOfImpact.b2_toiIters = 0, 
        Box2D.Collision.b2TimeOfImpact.b2_toiMaxIters = 0, Box2D.Collision.b2TimeOfImpact.b2_toiRootIters = 0, 
        Box2D.Collision.b2TimeOfImpact.b2_toiMaxRootIters = 0, Box2D.Collision.b2TimeOfImpact.s_cache = new l(), 
        Box2D.Collision.b2TimeOfImpact.s_distanceInput = new Y(), Box2D.Collision.b2TimeOfImpact.s_xfA = new U(), 
        Box2D.Collision.b2TimeOfImpact.s_xfB = new U(), Box2D.Collision.b2TimeOfImpact.s_fcn = new d(), 
        Box2D.Collision.b2TimeOfImpact.s_distanceOutput = new k();
    }), q.b2TOIInput = function() {
        this.proxyA = new z(), this.proxyB = new z(), this.sweepA = new A(), this.sweepB = new A();
    }, n.b2WorldManifold = function() {
        this.m_normal = new p();
    }, n.prototype.b2WorldManifold = function() {
        this.m_points = new Vector(y.b2_maxManifoldPoints);
        for (var b = 0; b < y.b2_maxManifoldPoints; b++) this.m_points[b] = new p();
    }, n.prototype.Initialize = function(b, e, f, m, r) {
        if (void 0 === f && (f = 0), void 0 === r && (r = 0), 0 != b.m_pointCount) {
            var v, t, s = 0, x = 0, C = 0, J = 0, T = 0, P = 0;
            switch (v = 0, b.m_type) {
              case E.e_circles:
                t = e.R, v = b.m_localPoint, s = e.position.x + t.col1.x * v.x + t.col2.x * v.y, 
                e = e.position.y + t.col1.y * v.x + t.col2.y * v.y, t = m.R, v = b.m_points[0].m_localPoint, 
                b = m.position.x + t.col1.x * v.x + t.col2.x * v.y, m = m.position.y + t.col1.y * v.x + t.col2.y * v.y, 
                (x = (v = b - s) * v + (t = m - e) * t) > Number.MIN_VALUE * Number.MIN_VALUE ? (x = Math.sqrt(x), 
                this.m_normal.x = v / x, this.m_normal.y = t / x) : (this.m_normal.x = 1, this.m_normal.y = 0), 
                v = e + f * this.m_normal.y, m -= r * this.m_normal.y, this.m_points[0].x = .5 * (s + f * this.m_normal.x + (b - r * this.m_normal.x)), 
                this.m_points[0].y = .5 * (v + m);
                break;

              case E.e_faceA:
                for (t = e.R, v = b.m_localPlaneNormal, x = t.col1.x * v.x + t.col2.x * v.y, C = t.col1.y * v.x + t.col2.y * v.y, 
                t = e.R, v = b.m_localPoint, J = e.position.x + t.col1.x * v.x + t.col2.x * v.y, 
                T = e.position.y + t.col1.y * v.x + t.col2.y * v.y, this.m_normal.x = x, this.m_normal.y = C, 
                s = 0; s < b.m_pointCount; s++) t = m.R, v = b.m_points[s].m_localPoint, P = m.position.x + t.col1.x * v.x + t.col2.x * v.y, 
                v = m.position.y + t.col1.y * v.x + t.col2.y * v.y, this.m_points[s].x = P + .5 * (f - (P - J) * x - (v - T) * C - r) * x, 
                this.m_points[s].y = v + .5 * (f - (P - J) * x - (v - T) * C - r) * C;
                break;

              case E.e_faceB:
                for (t = m.R, v = b.m_localPlaneNormal, x = t.col1.x * v.x + t.col2.x * v.y, C = t.col1.y * v.x + t.col2.y * v.y, 
                t = m.R, v = b.m_localPoint, J = m.position.x + t.col1.x * v.x + t.col2.x * v.y, 
                T = m.position.y + t.col1.y * v.x + t.col2.y * v.y, this.m_normal.x = -x, this.m_normal.y = -C, 
                s = 0; s < b.m_pointCount; s++) t = e.R, v = b.m_points[s].m_localPoint, P = e.position.x + t.col1.x * v.x + t.col2.x * v.y, 
                v = e.position.y + t.col1.y * v.x + t.col2.y * v.y, this.m_points[s].x = P + .5 * (r - (P - J) * x - (v - T) * C - f) * x, 
                this.m_points[s].y = v + .5 * (r - (P - J) * x - (v - T) * C - f) * C;
            }
        }
    }, a.ClipVertex = function() {
        this.v = new p(), this.id = new L();
    }, a.prototype.Set = function(b) {
        this.v.SetV(b.v), this.id.Set(b.id);
    }, c.Features = function() {}, Object.defineProperty(c.prototype, "referenceEdge", {
        enumerable: !1,
        configurable: !0,
        get: function() {
            return this._referenceEdge;
        }
    }), Object.defineProperty(c.prototype, "referenceEdge", {
        enumerable: !1,
        configurable: !0,
        set: function(b) {
            void 0 === b && (b = 0), this._referenceEdge = b, this._m_id._key = 4294967040 & this._m_id._key | 255 & this._referenceEdge;
        }
    }), Object.defineProperty(c.prototype, "incidentEdge", {
        enumerable: !1,
        configurable: !0,
        get: function() {
            return this._incidentEdge;
        }
    }), Object.defineProperty(c.prototype, "incidentEdge", {
        enumerable: !1,
        configurable: !0,
        set: function(b) {
            void 0 === b && (b = 0), this._incidentEdge = b, this._m_id._key = 4294902015 & this._m_id._key | this._incidentEdge << 8 & 65280;
        }
    }), Object.defineProperty(c.prototype, "incidentVertex", {
        enumerable: !1,
        configurable: !0,
        get: function() {
            return this._incidentVertex;
        }
    }), Object.defineProperty(c.prototype, "incidentVertex", {
        enumerable: !1,
        configurable: !0,
        set: function(b) {
            void 0 === b && (b = 0), this._incidentVertex = b, this._m_id._key = 4278255615 & this._m_id._key | this._incidentVertex << 16 & 16711680;
        }
    }), Object.defineProperty(c.prototype, "flip", {
        enumerable: !1,
        configurable: !0,
        get: function() {
            return this._flip;
        }
    }), Object.defineProperty(c.prototype, "flip", {
        enumerable: !1,
        configurable: !0,
        set: function(b) {
            void 0 === b && (b = 0), this._flip = b, this._m_id._key = 16777215 & this._m_id._key | this._flip << 24 & 4278190080;
        }
    });
}(), function() {
    var F = Box2D.Common.b2Settings, G = Box2D.Collision.Shapes.b2CircleShape, K = Box2D.Collision.Shapes.b2EdgeChainDef, y = Box2D.Collision.Shapes.b2EdgeShape, w = Box2D.Collision.Shapes.b2MassData, A = Box2D.Collision.Shapes.b2PolygonShape, U = Box2D.Collision.Shapes.b2Shape, p = Box2D.Common.Math.b2Mat22, B = Box2D.Common.Math.b2Math, Q = Box2D.Common.Math.b2Transform, V = Box2D.Common.Math.b2Vec2, M = Box2D.Collision.b2Distance, L = Box2D.Collision.b2DistanceInput, I = Box2D.Collision.b2DistanceOutput, W = Box2D.Collision.b2DistanceProxy, Y = Box2D.Collision.b2SimplexCache;
    Box2D.inherit(G, Box2D.Collision.Shapes.b2Shape), G.prototype.__super = Box2D.Collision.Shapes.b2Shape.prototype, 
    G.b2CircleShape = function() {
        Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this, arguments), this.m_p = new V();
    }, G.prototype.Copy = function() {
        var k = new G();
        return k.Set(this), k;
    }, G.prototype.Set = function(k) {
        this.__super.Set.call(this, k), Box2D.is(k, G) && this.m_p.SetV((k instanceof G ? k : null).m_p);
    }, G.prototype.TestPoint = function(k, z) {
        var u = k.R, D = k.position.x + (u.col1.x * this.m_p.x + u.col2.x * this.m_p.y);
        return u = k.position.y + (u.col1.y * this.m_p.x + u.col2.y * this.m_p.y), (D = z.x - D) * D + (u = z.y - u) * u <= this.m_radius * this.m_radius;
    }, G.prototype.RayCast = function(k, z, u) {
        var D = u.R, H = z.p1.x - (u.position.x + (D.col1.x * this.m_p.x + D.col2.x * this.m_p.y));
        u = z.p1.y - (u.position.y + (D.col1.y * this.m_p.x + D.col2.y * this.m_p.y)), D = z.p2.x - z.p1.x;
        var O = z.p2.y - z.p1.y, E = H * D + u * O, R = D * D + O * O, N = E * E - R * (H * H + u * u - this.m_radius * this.m_radius);
        return !(N < 0 || R < Number.MIN_VALUE) && (0 <= (E = -(E + Math.sqrt(N))) && E <= z.maxFraction * R && (E /= R, 
        k.fraction = E, k.normal.x = H + E * D, k.normal.y = u + E * O, k.normal.Normalize(), 
        !0));
    }, G.prototype.ComputeAABB = function(k, z) {
        var u = z.R, D = z.position.x + (u.col1.x * this.m_p.x + u.col2.x * this.m_p.y);
        u = z.position.y + (u.col1.y * this.m_p.x + u.col2.y * this.m_p.y), k.lowerBound.Set(D - this.m_radius, u - this.m_radius), 
        k.upperBound.Set(D + this.m_radius, u + this.m_radius);
    }, G.prototype.ComputeMass = function(k, z) {
        void 0 === z && (z = 0), k.mass = z * F.b2_pi * this.m_radius * this.m_radius, k.center.SetV(this.m_p), 
        k.I = k.mass * (.5 * this.m_radius * this.m_radius + (this.m_p.x * this.m_p.x + this.m_p.y * this.m_p.y));
    }, G.prototype.ComputeSubmergedArea = function(k, z, u, D) {
        void 0 === z && (z = 0), u = B.MulX(u, this.m_p);
        var H = -(B.Dot(k, u) - z);
        if (H < -this.m_radius + Number.MIN_VALUE) return 0;
        if (H > this.m_radius) return D.SetV(u), Math.PI * this.m_radius * this.m_radius;
        var O = H * H;
        return H = (z = this.m_radius * this.m_radius) * (Math.asin(H / this.m_radius) + Math.PI / 2) + H * Math.sqrt(z - O), 
        z = -2 / 3 * Math.pow(z - O, 1.5) / H, D.x = u.x + k.x * z, D.y = u.y + k.y * z, 
        H;
    }, G.prototype.GetLocalPosition = function() {
        return this.m_p;
    }, G.prototype.SetLocalPosition = function(k) {
        this.m_p.SetV(k);
    }, G.prototype.GetRadius = function() {
        return this.m_radius;
    }, G.prototype.SetRadius = function(k) {
        void 0 === k && (k = 0), this.m_radius = k;
    }, G.prototype.b2CircleShape = function(k) {
        void 0 === k && (k = 0), this.__super.b2Shape.call(this), this.m_type = U.e_circleShape, 
        this.m_radius = k;
    }, K.b2EdgeChainDef = function() {}, K.prototype.b2EdgeChainDef = function() {
        this.vertexCount = 0, this.isALoop = !0, this.vertices = [];
    }, Box2D.inherit(y, Box2D.Collision.Shapes.b2Shape), y.prototype.__super = Box2D.Collision.Shapes.b2Shape.prototype, 
    y.b2EdgeShape = function() {
        Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this, arguments), this.s_supportVec = new V(), 
        this.m_v1 = new V(), this.m_v2 = new V(), this.m_coreV1 = new V(), this.m_coreV2 = new V(), 
        this.m_normal = new V(), this.m_direction = new V(), this.m_cornerDir1 = new V(), 
        this.m_cornerDir2 = new V();
    }, y.prototype.TestPoint = function() {
        return !1;
    }, y.prototype.RayCast = function(k, z, u) {
        var D, H = z.p2.x - z.p1.x, O = z.p2.y - z.p1.y;
        D = u.R;
        var E = u.position.x + (D.col1.x * this.m_v1.x + D.col2.x * this.m_v1.y), R = u.position.y + (D.col1.y * this.m_v1.x + D.col2.y * this.m_v1.y), N = u.position.y + (D.col1.y * this.m_v2.x + D.col2.y * this.m_v2.y) - R, S = -(H * N + O * (u = -(u.position.x + (D.col1.x * this.m_v2.x + D.col2.x * this.m_v2.y) - E)));
        if ((D = 100 * Number.MIN_VALUE) < S) {
            E = z.p1.x - E;
            var aa = z.p1.y - R;
            if (0 <= (R = E * N + aa * u) && R <= z.maxFraction * S && -D * S <= (z = -H * aa + O * E) && z <= S * (1 + D)) return R /= S, 
            k.fraction = R, z = Math.sqrt(N * N + u * u), k.normal.x = N / z, k.normal.y = u / z, 
            !0;
        }
        return !1;
    }, y.prototype.ComputeAABB = function(k, z) {
        var u = z.R, D = z.position.x + (u.col1.x * this.m_v1.x + u.col2.x * this.m_v1.y), H = z.position.y + (u.col1.y * this.m_v1.x + u.col2.y * this.m_v1.y), O = z.position.x + (u.col1.x * this.m_v2.x + u.col2.x * this.m_v2.y);
        u = z.position.y + (u.col1.y * this.m_v2.x + u.col2.y * this.m_v2.y), D < O ? (k.lowerBound.x = D, 
        k.upperBound.x = O) : (k.lowerBound.x = O, k.upperBound.x = D), H < u ? (k.lowerBound.y = H, 
        k.upperBound.y = u) : (k.lowerBound.y = u, k.upperBound.y = H);
    }, y.prototype.ComputeMass = function(k) {
        k.mass = 0, k.center.SetV(this.m_v1), k.I = 0;
    }, y.prototype.ComputeSubmergedArea = function(k, z, u, D) {
        void 0 === z && (z = 0);
        var H = new V(k.x * z, k.y * z), O = B.MulX(u, this.m_v1);
        u = B.MulX(u, this.m_v2);
        var E = B.Dot(k, O) - z;
        if (k = B.Dot(k, u) - z, 0 < E) {
            if (0 < k) return 0;
            O.x = -k / (E - k) * O.x + E / (E - k) * u.x, O.y = -k / (E - k) * O.y + E / (E - k) * u.y;
        } else 0 < k && (u.x = -k / (E - k) * O.x + E / (E - k) * u.x, u.y = -k / (E - k) * O.y + E / (E - k) * u.y);
        return D.x = (H.x + O.x + u.x) / 3, D.y = (H.y + O.y + u.y) / 3, .5 * ((O.x - H.x) * (u.y - H.y) - (O.y - H.y) * (u.x - H.x));
    }, y.prototype.GetLength = function() {
        return this.m_length;
    }, y.prototype.GetVertex1 = function() {
        return this.m_v1;
    }, y.prototype.GetVertex2 = function() {
        return this.m_v2;
    }, y.prototype.GetCoreVertex1 = function() {
        return this.m_coreV1;
    }, y.prototype.GetCoreVertex2 = function() {
        return this.m_coreV2;
    }, y.prototype.GetNormalVector = function() {
        return this.m_normal;
    }, y.prototype.GetDirectionVector = function() {
        return this.m_direction;
    }, y.prototype.GetCorner1Vector = function() {
        return this.m_cornerDir1;
    }, y.prototype.GetCorner2Vector = function() {
        return this.m_cornerDir2;
    }, y.prototype.Corner1IsConvex = function() {
        return this.m_cornerConvex1;
    }, y.prototype.Corner2IsConvex = function() {
        return this.m_cornerConvex2;
    }, y.prototype.GetFirstVertex = function(k) {
        var z = k.R;
        return new V(k.position.x + (z.col1.x * this.m_coreV1.x + z.col2.x * this.m_coreV1.y), k.position.y + (z.col1.y * this.m_coreV1.x + z.col2.y * this.m_coreV1.y));
    }, y.prototype.GetNextEdge = function() {
        return this.m_nextEdge;
    }, y.prototype.GetPrevEdge = function() {
        return this.m_prevEdge;
    }, y.prototype.Support = function(k, z, u) {
        void 0 === z && (z = 0), void 0 === u && (u = 0);
        var D = k.R, H = k.position.x + (D.col1.x * this.m_coreV1.x + D.col2.x * this.m_coreV1.y), O = k.position.y + (D.col1.y * this.m_coreV1.x + D.col2.y * this.m_coreV1.y), E = k.position.x + (D.col1.x * this.m_coreV2.x + D.col2.x * this.m_coreV2.y);
        return E * z + (k = k.position.y + (D.col1.y * this.m_coreV2.x + D.col2.y * this.m_coreV2.y)) * u < H * z + O * u ? (this.s_supportVec.x = H, 
        this.s_supportVec.y = O) : (this.s_supportVec.x = E, this.s_supportVec.y = k), this.s_supportVec;
    }, y.prototype.b2EdgeShape = function(k, z) {
        this.__super.b2Shape.call(this), this.m_type = U.e_edgeShape, this.m_nextEdge = this.m_prevEdge = null, 
        this.m_v1 = k, this.m_v2 = z, this.m_direction.Set(this.m_v2.x - this.m_v1.x, this.m_v2.y - this.m_v1.y), 
        this.m_length = this.m_direction.Normalize(), this.m_normal.Set(this.m_direction.y, -this.m_direction.x), 
        this.m_coreV1.Set(-F.b2_toiSlop * (this.m_normal.x - this.m_direction.x) + this.m_v1.x, -F.b2_toiSlop * (this.m_normal.y - this.m_direction.y) + this.m_v1.y), 
        this.m_coreV2.Set(-F.b2_toiSlop * (this.m_normal.x + this.m_direction.x) + this.m_v2.x, -F.b2_toiSlop * (this.m_normal.y + this.m_direction.y) + this.m_v2.y), 
        this.m_cornerDir1 = this.m_normal, this.m_cornerDir2.Set(-this.m_normal.x, -this.m_normal.y);
    }, y.prototype.SetPrevEdge = function(k, z, u, D) {
        this.m_prevEdge = k, this.m_coreV1 = z, this.m_cornerDir1 = u, this.m_cornerConvex1 = D;
    }, y.prototype.SetNextEdge = function(k, z, u, D) {
        this.m_nextEdge = k, this.m_coreV2 = z, this.m_cornerDir2 = u, this.m_cornerConvex2 = D;
    }, w.b2MassData = function() {
        this.mass = 0, this.center = new V(0, 0), this.I = 0;
    }, Box2D.inherit(A, Box2D.Collision.Shapes.b2Shape), A.prototype.__super = Box2D.Collision.Shapes.b2Shape.prototype, 
    A.b2PolygonShape = function() {
        Box2D.Collision.Shapes.b2Shape.b2Shape.apply(this, arguments);
    }, A.prototype.Copy = function() {
        var k = new A();
        return k.Set(this), k;
    }, A.prototype.Set = function(k) {
        if (this.__super.Set.call(this, k), Box2D.is(k, A)) {
            k = k instanceof A ? k : null, this.m_centroid.SetV(k.m_centroid), this.m_vertexCount = k.m_vertexCount, 
            this.Reserve(this.m_vertexCount);
            for (var z = 0; z < this.m_vertexCount; z++) this.m_vertices[z].SetV(k.m_vertices[z]), 
            this.m_normals[z].SetV(k.m_normals[z]);
        }
    }, A.prototype.SetAsArray = function(k, z) {
        void 0 === z && (z = 0);
        var H, u = new Vector(), D = 0;
        for (D = 0; D < k.length; ++D) H = k[D], u.push(H);
        this.SetAsVector(u, z);
    }, A.AsArray = function(k, z) {
        void 0 === z && (z = 0);
        var u = new A();
        return u.SetAsArray(k, z), u;
    }, A.prototype.SetAsVector = function(k, z) {
        void 0 === z && (z = 0), 0 == z && (z = k.length), F.b2Assert(2 <= z), this.m_vertexCount = z, 
        this.Reserve(z);
        var u = 0;
        for (u = 0; u < this.m_vertexCount; u++) this.m_vertices[u].SetV(k[u]);
        for (u = 0; u < this.m_vertexCount; ++u) {
            var D = parseInt(u), H = parseInt(u + 1 < this.m_vertexCount ? u + 1 : 0);
            D = B.SubtractVV(this.m_vertices[H], this.m_vertices[D]), F.b2Assert(D.LengthSquared() > Number.MIN_VALUE), 
            this.m_normals[u].SetV(B.CrossVF(D, 1)), this.m_normals[u].Normalize();
        }
        this.m_centroid = A.ComputeCentroid(this.m_vertices, this.m_vertexCount);
    }, A.AsVector = function(k, z) {
        void 0 === z && (z = 0);
        var u = new A();
        return u.SetAsVector(k, z), u;
    }, A.prototype.SetAsBox = function(k, z) {
        void 0 === k && (k = 0), void 0 === z && (z = 0), this.m_vertexCount = 4, this.Reserve(4), 
        this.m_vertices[0].Set(-k, -z), this.m_vertices[1].Set(k, -z), this.m_vertices[2].Set(k, z), 
        this.m_vertices[3].Set(-k, z), 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();
    }, A.AsBox = function(k, z) {
        void 0 === k && (k = 0), void 0 === z && (z = 0);
        var u = new A();
        return u.SetAsBox(k, z), u;
    }, A.prototype.SetAsOrientedBox = function(k, z, u, D) {
        for (void 0 === k && (k = 0), void 0 === z && (z = 0), void 0 === u && (u = null), 
        void 0 === D && (D = 0), this.m_vertexCount = 4, this.Reserve(4), this.m_vertices[0].Set(-k, -z), 
        this.m_vertices[1].Set(k, -z), this.m_vertices[2].Set(k, z), this.m_vertices[3].Set(-k, z), 
        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 = u, (k = new Q()).position = u, k.R.Set(D), 
        u = 0; u < this.m_vertexCount; ++u) this.m_vertices[u] = B.MulX(k, this.m_vertices[u]), 
        this.m_normals[u] = B.MulMV(k.R, this.m_normals[u]);
    }, A.AsOrientedBox = function(k, z, u, D) {
        void 0 === k && (k = 0), void 0 === z && (z = 0), void 0 === u && (u = null), void 0 === D && (D = 0);
        var H = new A();
        return H.SetAsOrientedBox(k, z, u, D), H;
    }, A.prototype.SetAsEdge = function(k, z) {
        this.m_vertexCount = 2, this.Reserve(2), this.m_vertices[0].SetV(k), this.m_vertices[1].SetV(z), 
        this.m_centroid.x = .5 * (k.x + z.x), this.m_centroid.y = .5 * (k.y + z.y), this.m_normals[0] = B.CrossVF(B.SubtractVV(z, k), 1), 
        this.m_normals[0].Normalize(), this.m_normals[1].x = -this.m_normals[0].x, this.m_normals[1].y = -this.m_normals[0].y;
    }, A.AsEdge = function(k, z) {
        var u = new A();
        return u.SetAsEdge(k, z), u;
    }, A.prototype.TestPoint = function(k, z) {
        var u;
        u = k.R;
        for (var D = z.x - k.position.x, H = z.y - k.position.y, O = D * u.col1.x + H * u.col1.y, E = D * u.col2.x + H * u.col2.y, R = 0; R < this.m_vertexCount; ++R) if (D = O - (u = this.m_vertices[R]).x, 
        H = E - u.y, 0 < (u = this.m_normals[R]).x * D + u.y * H) return !1;
        return !0;
    }, A.prototype.RayCast = function(k, z, u) {
        var R, N, D = 0, H = z.maxFraction, O = 0, E = 0;
        O = z.p1.x - u.position.x, E = z.p1.y - u.position.y;
        var S = O * (R = u.R).col1.x + E * R.col1.y, aa = O * R.col2.x + E * R.col2.y;
        O = z.p2.x - u.position.x, E = z.p2.y - u.position.y, z = O * (R = u.R).col1.x + E * R.col1.y - S, 
        R = O * R.col2.x + E * R.col2.y - aa;
        for (var Z = parseInt(-1), d = 0; d < this.m_vertexCount; ++d) {
            if (O = (N = this.m_vertices[d]).x - S, E = N.y - aa, O = (N = this.m_normals[d]).x * O + N.y * E, 
            0 == (E = N.x * z + N.y * R)) {
                if (O < 0) return !1;
            } else E < 0 && O < D * E ? (D = O / E, Z = d) : 0 < E && O < H * E && (H = O / E);
            if (H < D - Number.MIN_VALUE) return !1;
        }
        return 0 <= Z && (k.fraction = D, R = u.R, N = this.m_normals[Z], k.normal.x = R.col1.x * N.x + R.col2.x * N.y, 
        k.normal.y = R.col1.y * N.x + R.col2.y * N.y, !0);
    }, A.prototype.ComputeAABB = function(k, z) {
        for (var u = z.R, D = this.m_vertices[0], H = z.position.x + (u.col1.x * D.x + u.col2.x * D.y), O = z.position.y + (u.col1.y * D.x + u.col2.y * D.y), E = H, R = O, N = 1; N < this.m_vertexCount; ++N) {
            D = this.m_vertices[N];
            var S = z.position.x + (u.col1.x * D.x + u.col2.x * D.y);
            H = H < S ? H : S, O = O < (D = z.position.y + (u.col1.y * D.x + u.col2.y * D.y)) ? O : D, 
            E = S < E ? E : S, R = D < R ? R : D;
        }
        k.lowerBound.x = H - this.m_radius, k.lowerBound.y = O - this.m_radius, k.upperBound.x = E + this.m_radius, 
        k.upperBound.y = R + this.m_radius;
    }, A.prototype.ComputeMass = function(k, z) {
        if (void 0 === z && (z = 0), 2 == this.m_vertexCount) k.center.x = .5 * (this.m_vertices[0].x + this.m_vertices[1].x), 
        k.center.y = .5 * (this.m_vertices[0].y + this.m_vertices[1].y), k.mass = 0, k.I = 0; else {
            for (var u = 0, D = 0, H = 0, O = 0, E = 1 / 3, R = 0; R < this.m_vertexCount; ++R) {
                var N = this.m_vertices[R], S = R + 1 < this.m_vertexCount ? this.m_vertices[parseInt(R + 1)] : this.m_vertices[0], aa = N.x - 0, Z = N.y - 0, d = S.x - 0, h = S.y - 0, l = aa * h - Z * d, j = .5 * l;
                H += j, u += j * E * (0 + N.x + S.x), D += j * E * (0 + N.y + S.y), O += l * (E * (.25 * ((N = aa) * N + (d = d) * N + d * d) + (0 * N + 0 * d)) + 0 + (E * (.25 * ((Z = Z) * Z + (h = h) * Z + h * h) + (0 * Z + 0 * h)) + 0));
            }
            k.mass = z * H, u *= 1 / H, D *= 1 / H, k.center.Set(u, D), k.I = z * O;
        }
    }, A.prototype.ComputeSubmergedArea = function(k, z, u, D) {
        void 0 === z && (z = 0);
        var H = B.MulTMV(u.R, k), O = z - B.Dot(k, u.position), E = new Vector_a2j_Number(), R = 0, N = parseInt(-1);
        z = parseInt(-1);
        var S = !1;
        for (k = k = 0; k < this.m_vertexCount; ++k) {
            E[k] = B.Dot(H, this.m_vertices[k]) - O;
            var aa = E[k] < -Number.MIN_VALUE;
            0 < k && (aa ? S || (N = k - 1, R++) : S && (z = k - 1, R++)), S = aa;
        }
        switch (R) {
          case 0:
            return S ? (k = new w(), this.ComputeMass(k, 1), D.SetV(B.MulX(u, k.center)), k.mass) : 0;

          case 1:
            -1 == N ? N = this.m_vertexCount - 1 : z = this.m_vertexCount - 1;
        }
        for (k = parseInt((N + 1) % this.m_vertexCount), H = parseInt((z + 1) % this.m_vertexCount), 
        O = (0 - E[N]) / (E[k] - E[N]), E = (0 - E[z]) / (E[H] - E[z]), N = new V(this.m_vertices[N].x * (1 - O) + this.m_vertices[k].x * O, this.m_vertices[N].y * (1 - O) + this.m_vertices[k].y * O), 
        z = new V(this.m_vertices[z].x * (1 - E) + this.m_vertices[H].x * E, this.m_vertices[z].y * (1 - E) + this.m_vertices[H].y * E), 
        E = 0, O = new V(), R = this.m_vertices[k], k = k; k != H; ) S = (k = (k + 1) % this.m_vertexCount) == H ? z : this.m_vertices[k], 
        E += aa = .5 * ((R.x - N.x) * (S.y - N.y) - (R.y - N.y) * (S.x - N.x)), O.x += aa * (N.x + R.x + S.x) / 3, 
        O.y += aa * (N.y + R.y + S.y) / 3, R = S;
        return O.Multiply(1 / E), D.SetV(B.MulX(u, O)), E;
    }, A.prototype.GetVertexCount = function() {
        return this.m_vertexCount;
    }, A.prototype.GetVertices = function() {
        return this.m_vertices;
    }, A.prototype.GetNormals = function() {
        return this.m_normals;
    }, A.prototype.GetSupport = function(k) {
        for (var z = 0, u = this.m_vertices[0].x * k.x + this.m_vertices[0].y * k.y, D = 1; D < this.m_vertexCount; ++D) {
            var H = this.m_vertices[D].x * k.x + this.m_vertices[D].y * k.y;
            u < H && (z = D, u = H);
        }
        return z;
    }, A.prototype.GetSupportVertex = function(k) {
        for (var z = 0, u = this.m_vertices[0].x * k.x + this.m_vertices[0].y * k.y, D = 1; D < this.m_vertexCount; ++D) {
            var H = this.m_vertices[D].x * k.x + this.m_vertices[D].y * k.y;
            u < H && (z = D, u = H);
        }
        return this.m_vertices[z];
    }, A.prototype.Validate = function() {
        return !1;
    }, A.prototype.b2PolygonShape = function() {
        this.__super.b2Shape.call(this), this.m_type = U.e_polygonShape, this.m_centroid = new V(), 
        this.m_vertices = new Vector(), this.m_normals = new Vector();
    }, A.prototype.Reserve = function(k) {
        void 0 === k && (k = 0);
        for (var z = parseInt(this.m_vertices.length); z < k; z++) this.m_vertices[z] = new V(), 
        this.m_normals[z] = new V();
    }, A.ComputeCentroid = function(k, z) {
        void 0 === z && (z = 0);
        for (var u = new V(), D = 0, O = 0; O < z; ++O) {
            var E = k[O], R = O + 1 < z ? k[parseInt(O + 1)] : k[0], N = .5 * ((E.x - 0) * (R.y - 0) - (E.y - 0) * (R.x - 0));
            D += N, u.x += 1 / 3 * N * (0 + E.x + R.x), u.y += 1 / 3 * N * (0 + E.y + R.y);
        }
        return u.x *= 1 / D, u.y *= 1 / D, u;
    }, A.ComputeOBB = function(k, z, u) {
        void 0 === u && (u = 0);
        var D = 0, H = new Vector(u + 1);
        for (D = 0; D < u; ++D) H[D] = z[D];
        for (H[u] = H[0], z = Number.MAX_VALUE, D = 1; D <= u; ++D) {
            for (var O = H[parseInt(D - 1)], E = H[D].x - O.x, R = H[D].y - O.y, N = Math.sqrt(E * E + R * R), S = -(R /= N), aa = E /= N, Z = N = Number.MAX_VALUE, d = -Number.MAX_VALUE, h = -Number.MAX_VALUE, l = 0; l < u; ++l) {
                var j = H[l].x - O.x, o = H[l].y - O.y, q = E * j + R * o;
                q < N && (N = q), (j = S * j + aa * o) < Z && (Z = j), d < q && (d = q), h < j && (h = j);
            }
            (l = (d - N) * (h - Z)) < .95 * z && (z = l, k.R.col1.x = E, k.R.col1.y = R, k.R.col2.x = S, 
            k.R.col2.y = aa, E = .5 * (N + d), R = .5 * (Z + h), S = k.R, k.center.x = O.x + (S.col1.x * E + S.col2.x * R), 
            k.center.y = O.y + (S.col1.y * E + S.col2.y * R), k.extents.x = .5 * (d - N), k.extents.y = .5 * (h - Z));
        }
    }, Box2D.postDefs.push(function() {
        Box2D.Collision.Shapes.b2PolygonShape.s_mat = new p();
    }), U.b2Shape = function() {}, U.prototype.Copy = function() {
        return null;
    }, U.prototype.Set = function(k) {
        this.m_radius = k.m_radius;
    }, U.prototype.GetType = function() {
        return this.m_type;
    }, U.prototype.TestPoint = function() {
        return !1;
    }, U.prototype.RayCast = function() {
        return !1;
    }, U.prototype.ComputeAABB = function() {}, U.prototype.ComputeMass = function() {}, 
    U.prototype.ComputeSubmergedArea = function() {
        return 0;
    }, U.TestOverlap = function(k, z, u, D) {
        var H = new L();
        return H.proxyA = new W(), H.proxyA.Set(k), H.proxyB = new W(), H.proxyB.Set(u), 
        H.transformA = z, H.transformB = D, H.useRadii = !0, (k = new Y()).count = 0, z = new I(), 
        M.Distance(z, k, H), z.distance < 10 * Number.MIN_VALUE;
    }, U.prototype.b2Shape = function() {
        this.m_type = U.e_unknownShape, this.m_radius = F.b2_linearSlop;
    }, Box2D.postDefs.push(function() {
        Box2D.Collision.Shapes.b2Shape.e_unknownShape = parseInt(-1), Box2D.Collision.Shapes.b2Shape.e_circleShape = 0, 
        Box2D.Collision.Shapes.b2Shape.e_polygonShape = 1, Box2D.Collision.Shapes.b2Shape.e_edgeShape = 2, 
        Box2D.Collision.Shapes.b2Shape.e_shapeTypeCount = 3, Box2D.Collision.Shapes.b2Shape.e_hitCollide = 1, 
        Box2D.Collision.Shapes.b2Shape.e_missCollide = 0, Box2D.Collision.Shapes.b2Shape.e_startsInsideCollide = parseInt(-1);
    });
}(), function() {
    var F = Box2D.Common.b2Color, G = Box2D.Common.b2Settings, K = Box2D.Common.Math.b2Math;
    F.b2Color = function() {
        this._b = this._g = this._r = 0;
    }, F.prototype.b2Color = function(y, w, A) {
        void 0 === y && (y = 0), void 0 === w && (w = 0), void 0 === A && (A = 0), this._r = Box2D.parseUInt(255 * K.Clamp(y, 0, 1)), 
        this._g = Box2D.parseUInt(255 * K.Clamp(w, 0, 1)), this._b = Box2D.parseUInt(255 * K.Clamp(A, 0, 1));
    }, F.prototype.Set = function(y, w, A) {
        void 0 === y && (y = 0), void 0 === w && (w = 0), void 0 === A && (A = 0), this._r = Box2D.parseUInt(255 * K.Clamp(y, 0, 1)), 
        this._g = Box2D.parseUInt(255 * K.Clamp(w, 0, 1)), this._b = Box2D.parseUInt(255 * K.Clamp(A, 0, 1));
    }, Object.defineProperty(F.prototype, "r", {
        enumerable: !1,
        configurable: !0,
        set: function(y) {
            void 0 === y && (y = 0), this._r = Box2D.parseUInt(255 * K.Clamp(y, 0, 1));
        }
    }), Object.defineProperty(F.prototype, "g", {
        enumerable: !1,
        configurable: !0,
        set: function(y) {
            void 0 === y && (y = 0), this._g = Box2D.parseUInt(255 * K.Clamp(y, 0, 1));
        }
    }), Object.defineProperty(F.prototype, "b", {
        enumerable: !1,
        configurable: !0,
        set: function(y) {
            void 0 === y && (y = 0), this._b = Box2D.parseUInt(255 * K.Clamp(y, 0, 1));
        }
    }), Object.defineProperty(F.prototype, "color", {
        enumerable: !1,
        configurable: !0,
        get: function() {
            return this._r << 16 | this._g << 8 | this._b;
        }
    }), G.b2Settings = function() {}, G.b2MixFriction = function(y, w) {
        return void 0 === y && (y = 0), void 0 === w && (w = 0), Math.sqrt(y * w);
    }, G.b2MixRestitution = function(y, w) {
        return void 0 === y && (y = 0), void 0 === w && (w = 0), w < y ? y : w;
    }, G.b2Assert = function(y) {
        if (!y) throw "Assertion Failed";
    }, Box2D.postDefs.push(function() {
        Box2D.Common.b2Settings.VERSION = "2.1alpha", Box2D.Common.b2Settings.USHRT_MAX = 65535, 
        Box2D.Common.b2Settings.b2_pi = Math.PI, Box2D.Common.b2Settings.b2_maxManifoldPoints = 2, 
        Box2D.Common.b2Settings.b2_aabbExtension = .1, Box2D.Common.b2Settings.b2_aabbMultiplier = 2, 
        Box2D.Common.b2Settings.b2_polygonRadius = 2 * G.b2_linearSlop, Box2D.Common.b2Settings.b2_linearSlop = .005, 
        Box2D.Common.b2Settings.b2_angularSlop = 2 / 180 * G.b2_pi, Box2D.Common.b2Settings.b2_toiSlop = 8 * G.b2_linearSlop, 
        Box2D.Common.b2Settings.b2_maxTOIContactsPerIsland = 32, Box2D.Common.b2Settings.b2_maxTOIJointsPerIsland = 32, 
        Box2D.Common.b2Settings.b2_velocityThreshold = 1, Box2D.Common.b2Settings.b2_maxLinearCorrection = .2, 
        Box2D.Common.b2Settings.b2_maxAngularCorrection = 8 / 180 * G.b2_pi, Box2D.Common.b2Settings.b2_maxTranslation = 2, 
        Box2D.Common.b2Settings.b2_maxTranslationSquared = G.b2_maxTranslation * G.b2_maxTranslation, 
        Box2D.Common.b2Settings.b2_maxRotation = .5 * G.b2_pi, Box2D.Common.b2Settings.b2_maxRotationSquared = G.b2_maxRotation * G.b2_maxRotation, 
        Box2D.Common.b2Settings.b2_contactBaumgarte = .2, Box2D.Common.b2Settings.b2_timeToSleep = .5, 
        Box2D.Common.b2Settings.b2_linearSleepTolerance = .01, Box2D.Common.b2Settings.b2_angularSleepTolerance = 2 / 180 * G.b2_pi;
    });
}(), function() {
    var F = Box2D.Common.Math.b2Mat22, G = Box2D.Common.Math.b2Mat33, K = Box2D.Common.Math.b2Math, y = Box2D.Common.Math.b2Sweep, w = Box2D.Common.Math.b2Transform, A = Box2D.Common.Math.b2Vec2, U = Box2D.Common.Math.b2Vec3;
    F.b2Mat22 = function() {
        this.col1 = new A(), this.col2 = new A();
    }, F.prototype.b2Mat22 = function() {
        this.SetIdentity();
    }, F.FromAngle = function(p) {
        void 0 === p && (p = 0);
        var B = new F();
        return B.Set(p), B;
    }, F.FromVV = function(p, B) {
        var Q = new F();
        return Q.SetVV(p, B), Q;
    }, F.prototype.Set = function(p) {
        void 0 === p && (p = 0);
        var B = Math.cos(p);
        p = Math.sin(p), this.col1.x = B, this.col2.x = -p, this.col1.y = p, this.col2.y = B;
    }, F.prototype.SetVV = function(p, B) {
        this.col1.SetV(p), this.col2.SetV(B);
    }, F.prototype.Copy = function() {
        var p = new F();
        return p.SetM(this), p;
    }, F.prototype.SetM = function(p) {
        this.col1.SetV(p.col1), this.col2.SetV(p.col2);
    }, F.prototype.AddM = function(p) {
        this.col1.x += p.col1.x, this.col1.y += p.col1.y, this.col2.x += p.col2.x, this.col2.y += p.col2.y;
    }, F.prototype.SetIdentity = function() {
        this.col1.x = 1, this.col2.x = 0, this.col1.y = 0, this.col2.y = 1;
    }, F.prototype.SetZero = function() {
        this.col1.x = 0, this.col2.x = 0, this.col1.y = 0, this.col2.y = 0;
    }, F.prototype.GetAngle = function() {
        return Math.atan2(this.col1.y, this.col1.x);
    }, F.prototype.GetInverse = function(p) {
        var B = this.col1.x, Q = this.col2.x, V = this.col1.y, M = this.col2.y, L = B * M - Q * V;
        return 0 != L && (L = 1 / L), p.col1.x = L * M, p.col2.x = -L * Q, p.col1.y = -L * V, 
        p.col2.y = L * B, p;
    }, F.prototype.Solve = function(p, B, Q) {
        void 0 === B && (B = 0), void 0 === Q && (Q = 0);
        var V = this.col1.x, M = this.col2.x, L = this.col1.y, I = this.col2.y, W = V * I - M * L;
        return 0 != W && (W = 1 / W), p.x = W * (I * B - M * Q), p.y = W * (V * Q - L * B), 
        p;
    }, F.prototype.Abs = function() {
        this.col1.Abs(), this.col2.Abs();
    }, G.b2Mat33 = function() {
        this.col1 = new U(), this.col2 = new U(), this.col3 = new U();
    }, G.prototype.b2Mat33 = function(p, B, Q) {
        void 0 === p && (p = null), void 0 === B && (B = null), void 0 === Q && (Q = null), 
        p || B || Q ? (this.col1.SetV(p), this.col2.SetV(B), this.col3.SetV(Q)) : (this.col1.SetZero(), 
        this.col2.SetZero(), this.col3.SetZero());
    }, G.prototype.SetVVV = function(p, B, Q) {
        this.col1.SetV(p), this.col2.SetV(B), this.col3.SetV(Q);
    }, G.prototype.Copy = function() {
        return new G(this.col1, this.col2, this.col3);
    }, G.prototype.SetM = function(p) {
        this.col1.SetV(p.col1), this.col2.SetV(p.col2), this.col3.SetV(p.col3);
    }, G.prototype.AddM = function(p) {
        this.col1.x += p.col1.x, this.col1.y += p.col1.y, this.col1.z += p.col1.z, this.col2.x += p.col2.x, 
        this.col2.y += p.col2.y, this.col2.z += p.col2.z, this.col3.x += p.col3.x, this.col3.y += p.col3.y, 
        this.col3.z += p.col3.z;
    }, G.prototype.SetIdentity = function() {
        this.col1.x = 1, this.col2.x = 0, this.col3.x = 0, this.col1.y = 0, this.col2.y = 1, 
        this.col3.y = 0, this.col1.z = 0, this.col2.z = 0, this.col3.z = 1;
    }, G.prototype.SetZero = function() {
        this.col1.x = 0, this.col2.x = 0, this.col3.x = 0, this.col1.y = 0, this.col2.y = 0, 
        this.col3.y = 0, this.col1.z = 0, this.col2.z = 0, this.col3.z = 0;
    }, G.prototype.Solve22 = function(p, B, Q) {
        void 0 === B && (B = 0), void 0 === Q && (Q = 0);
        var V = this.col1.x, M = this.col2.x, L = this.col1.y, I = this.col2.y, W = V * I - M * L;
        return 0 != W && (W = 1 / W), p.x = W * (I * B - M * Q), p.y = W * (V * Q - L * B), 
        p;
    }, G.prototype.Solve33 = function(p, B, Q, V) {
        void 0 === B && (B = 0), void 0 === Q && (Q = 0), void 0 === V && (V = 0);
        var M = this.col1.x, L = this.col1.y, I = this.col1.z, W = this.col2.x, Y = this.col2.y, k = this.col2.z, z = this.col3.x, u = this.col3.y, D = this.col3.z, H = M * (Y * D - k * u) + L * (k * z - W * D) + I * (W * u - Y * z);
        return 0 != H && (H = 1 / H), p.x = H * (B * (Y * D - k * u) + Q * (k * z - W * D) + V * (W * u - Y * z)), 
        p.y = H * (M * (Q * D - V * u) + L * (V * z - B * D) + I * (B * u - Q * z)), p.z = H * (M * (Y * V - k * Q) + L * (k * B - W * V) + I * (W * Q - Y * B)), 
        p;
    }, K.b2Math = function() {}, K.IsValid = function(p) {
        return void 0 === p && (p = 0), isFinite(p);
    }, K.Dot = function(p, B) {
        return p.x * B.x + p.y * B.y;
    }, K.CrossVV = function(p, B) {
        return p.x * B.y - p.y * B.x;
    }, K.CrossVF = function(p, B) {
        return void 0 === B && (B = 0), new A(B * p.y, -B * p.x);
    }, K.CrossFV = function(p, B) {
        return void 0 === p && (p = 0), new A(-p * B.y, p * B.x);
    }, K.MulMV = function(p, B) {
        return new A(p.col1.x * B.x + p.col2.x * B.y, p.col1.y * B.x + p.col2.y * B.y);
    }, K.MulTMV = function(p, B) {
        return new A(K.Dot(B, p.col1), K.Dot(B, p.col2));
    }, K.MulX = function(p, B) {
        var Q = K.MulMV(p.R, B);
        return Q.x += p.position.x, Q.y += p.position.y, Q;
    }, K.MulXT = function(p, B) {
        var Q = K.SubtractVV(B, p.position), V = Q.x * p.R.col1.x + Q.y * p.R.col1.y;
        return Q.y = Q.x * p.R.col2.x + Q.y * p.R.col2.y, Q.x = V, Q;
    }, K.AddVV = function(p, B) {
        return new A(p.x + B.x, p.y + B.y);
    }, K.SubtractVV = function(p, B) {
        return new A(p.x - B.x, p.y - B.y);
    }, K.Distance = function(p, B) {
        var Q = p.x - B.x, V = p.y - B.y;
        return Math.sqrt(Q * Q + V * V);
    }, K.DistanceSquared = function(p, B) {
        var Q = p.x - B.x, V = p.y - B.y;
        return Q * Q + V * V;
    }, K.MulFV = function(p, B) {
        return void 0 === p && (p = 0), new A(p * B.x, p * B.y);
    }, K.AddMM = function(p, B) {
        return F.FromVV(K.AddVV(p.col1, B.col1), K.AddVV(p.col2, B.col2));
    }, K.MulMM = function(p, B) {
        return F.FromVV(K.MulMV(p, B.col1), K.MulMV(p, B.col2));
    }, K.MulTMM = function(p, B) {
        var Q = new A(K.Dot(p.col1, B.col1), K.Dot(p.col2, B.col1)), V = new A(K.Dot(p.col1, B.col2), K.Dot(p.col2, B.col2));
        return F.FromVV(Q, V);
    }, K.Abs = function(p) {
        return void 0 === p && (p = 0), 0 < p ? p : -p;
    }, K.AbsV = function(p) {
        return new A(K.Abs(p.x), K.Abs(p.y));
    }, K.AbsM = function(p) {
        return F.FromVV(K.AbsV(p.col1), K.AbsV(p.col2));
    }, K.Min = function(p, B) {
        return void 0 === p && (p = 0), void 0 === B && (B = 0), p < B ? p : B;
    }, K.MinV = function(p, B) {
        return new A(K.Min(p.x, B.x), K.Min(p.y, B.y));
    }, K.Max = function(p, B) {
        return void 0 === p && (p = 0), void 0 === B && (B = 0), B < p ? p : B;
    }, K.MaxV = function(p, B) {
        return new A(K.Max(p.x, B.x), K.Max(p.y, B.y));
    }, K.Clamp = function(p, B, Q) {
        return void 0 === p && (p = 0), void 0 === B && (B = 0), void 0 === Q && (Q = 0), 
        p < B ? B : Q < p ? Q : p;
    }, K.ClampV = function(p, B, Q) {
        return K.MaxV(B, K.MinV(p, Q));
    }, K.Swap = function(p, B) {
        var Q = p[0];
        p[0] = B[0], B[0] = Q;
    }, K.Random = function() {
        return 2 * Math.random() - 1;
    }, K.RandomRange = function(p, B) {
        void 0 === p && (p = 0), void 0 === B && (B = 0);
        var Q = Math.random();
        return (B - p) * Q + p;
    }, K.NextPowerOfTwo = function(p) {
        return void 0 === p && (p = 0), p |= p >> 1 & 2147483647, p |= p >> 2 & 1073741823, 
        p |= p >> 4 & 268435455, p |= p >> 8 & 16777215, (p |= p >> 16 & 65535) + 1;
    }, K.IsPowerOfTwo = function(p) {
        return void 0 === p && (p = 0), 0 < p && 0 == (p & p - 1);
    }, Box2D.postDefs.push(function() {
        Box2D.Common.Math.b2Math.b2Vec2_zero = new A(0, 0), Box2D.Common.Math.b2Math.b2Mat22_identity = F.FromVV(new A(1, 0), new A(0, 1)), 
        Box2D.Common.Math.b2Math.b2Transform_identity = new w(K.b2Vec2_zero, K.b2Mat22_identity);
    }), y.b2Sweep = function() {
        this.localCenter = new A(), this.c0 = new A(), this.c = new A();
    }, y.prototype.Set = function(p) {
        this.localCenter.SetV(p.localCenter), this.c0.SetV(p.c0), this.c.SetV(p.c), this.a0 = p.a0, 
        this.a = p.a, this.t0 = p.t0;
    }, y.prototype.Copy = function() {
        var p = new y();
        return p.localCenter.SetV(this.localCenter), p.c0.SetV(this.c0), p.c.SetV(this.c), 
        p.a0 = this.a0, p.a = this.a, p.t0 = this.t0, p;
    }, y.prototype.GetTransform = function(p, B) {
        void 0 === B && (B = 0), p.position.x = (1 - B) * this.c0.x + B * this.c.x, p.position.y = (1 - B) * this.c0.y + B * this.c.y, 
        p.R.Set((1 - B) * this.a0 + B * this.a);
        var Q = p.R;
        p.position.x -= Q.col1.x * this.localCenter.x + Q.col2.x * this.localCenter.y, p.position.y -= Q.col1.y * this.localCenter.x + Q.col2.y * this.localCenter.y;
    }, y.prototype.Advance = function(p) {
        if (void 0 === p && (p = 0), this.t0 < p && 1 - this.t0 > Number.MIN_VALUE) {
            var B = (p - this.t0) / (1 - this.t0);
            this.c0.x = (1 - B) * this.c0.x + B * this.c.x, this.c0.y = (1 - B) * this.c0.y + B * this.c.y, 
            this.a0 = (1 - B) * this.a0 + B * this.a, this.t0 = p;
        }
    }, w.b2Transform = function() {
        this.position = new A(), this.R = new F();
    }, w.prototype.b2Transform = function(p, B) {
        void 0 === p && (p = null), void 0 === B && (B = null), p && (this.position.SetV(p), 
        this.R.SetM(B));
    }, w.prototype.Initialize = function(p, B) {
        this.position.SetV(p), this.R.SetM(B);
    }, w.prototype.SetIdentity = function() {
        this.position.SetZero(), this.R.SetIdentity();
    }, w.prototype.Set = function(p) {
        this.position.SetV(p.position), this.R.SetM(p.R);
    }, w.prototype.GetAngle = function() {
        return Math.atan2(this.R.col1.y, this.R.col1.x);
    }, A.b2Vec2 = function() {}, A.prototype.b2Vec2 = function(p, B) {
        void 0 === p && (p = 0), void 0 === B && (B = 0), this.x = p, this.y = B;
    }, A.prototype.SetZero = function() {
        this.y = this.x = 0;
    }, A.prototype.Set = function(p, B) {
        void 0 === p && (p = 0), void 0 === B && (B = 0), this.x = p, this.y = B;
    }, A.prototype.SetV = function(p) {
        this.x = p.x, this.y = p.y;
    }, A.prototype.GetNegative = function() {
        return new A(-this.x, -this.y);
    }, A.prototype.NegativeSelf = function() {
        this.x = -this.x, this.y = -this.y;
    }, A.Make = function(p, B) {
        return void 0 === p && (p = 0), void 0 === B && (B = 0), new A(p, B);
    }, A.prototype.Copy = function() {
        return new A(this.x, this.y);
    }, A.prototype.Add = function(p) {
        this.x += p.x, this.y += p.y;
    }, A.prototype.Subtract = function(p) {
        this.x -= p.x, this.y -= p.y;
    }, A.prototype.Multiply = function(p) {
        void 0 === p && (p = 0), this.x *= p, this.y *= p;
    }, A.prototype.MulM = function(p) {
        var B = this.x;
        this.x = p.col1.x * B + p.col2.x * this.y, this.y = p.col1.y * B + p.col2.y * this.y;
    }, A.prototype.MulTM = function(p) {
        var B = K.Dot(this, p.col1);
        this.y = K.Dot(this, p.col2), this.x = B;
    }, A.prototype.CrossVF = function(p) {
        void 0 === p && (p = 0);
        var B = this.x;
        this.x = p * this.y, this.y = -p * B;
    }, A.prototype.CrossFV = function(p) {
        void 0 === p && (p = 0);
        var B = this.x;
        this.x = -p * this.y, this.y = p * B;
    }, A.prototype.MinV = function(p) {
        this.x = this.x < p.x ? this.x : p.x, this.y = this.y < p.y ? this.y : p.y;
    }, A.prototype.MaxV = function(p) {
        this.x = this.x > p.x ? this.x : p.x, this.y = this.y > p.y ? this.y : p.y;
    }, A.prototype.Abs = function() {
        this.x < 0 && (this.x = -this.x), this.y < 0 && (this.y = -this.y);
    }, A.prototype.Length = function() {
        return Math.sqrt(this.x * this.x + this.y * this.y);
    }, A.prototype.LengthSquared = function() {
        return this.x * this.x + this.y * this.y;
    }, A.prototype.Normalize = function() {
        var p = Math.sqrt(this.x * this.x + this.y * this.y);
        if (p < Number.MIN_VALUE) return 0;
        var B = 1 / p;
        return this.x *= B, this.y *= B, p;
    }, A.prototype.IsValid = function() {
        return K.IsValid(this.x) && K.IsValid(this.y);
    }, U.b2Vec3 = function() {}, U.prototype.b2Vec3 = function(p, B, Q) {
        void 0 === p && (p = 0), void 0 === B && (B = 0), void 0 === Q && (Q = 0), this.x = p, 
        this.y = B, this.z = Q;
    }, U.prototype.SetZero = function() {
        this.x = this.y = this.z = 0;
    }, U.prototype.Set = function(p, B, Q) {
        void 0 === p && (p = 0), void 0 === B && (B = 0), void 0 === Q && (Q = 0), this.x = p, 
        this.y = B, this.z = Q;
    }, U.prototype.SetV = function(p) {
        this.x = p.x, this.y = p.y, this.z = p.z;
    }, U.prototype.GetNegative = function() {
        return new U(-this.x, -this.y, -this.z);
    }, U.prototype.NegativeSelf = function() {
        this.x = -this.x, this.y = -this.y, this.z = -this.z;
    }, U.prototype.Copy = function() {
        return new U(this.x, this.y, this.z);
    }, U.prototype.Add = function(p) {
        this.x += p.x, this.y += p.y, this.z += p.z;
    }, U.prototype.Subtract = function(p) {
        this.x -= p.x, this.y -= p.y, this.z -= p.z;
    }, U.prototype.Multiply = function(p) {
        void 0 === p && (p = 0), this.x *= p, this.y *= p, this.z *= p;
    };
}(), function() {
    var F = Box2D.Common.Math.b2Math, G = Box2D.Common.Math.b2Sweep, K = Box2D.Common.Math.b2Transform, y = Box2D.Common.Math.b2Vec2, w = Box2D.Common.b2Color, A = Box2D.Common.b2Settings, U = Box2D.Collision.b2AABB, p = Box2D.Collision.b2ContactPoint, B = Box2D.Collision.b2DynamicTreeBroadPhase, Q = Box2D.Collision.b2RayCastInput, V = Box2D.Collision.b2RayCastOutput, M = Box2D.Collision.Shapes.b2CircleShape, L = Box2D.Collision.Shapes.b2EdgeShape, I = Box2D.Collision.Shapes.b2MassData, W = Box2D.Collision.Shapes.b2PolygonShape, Y = Box2D.Collision.Shapes.b2Shape, k = Box2D.Dynamics.b2Body, z = Box2D.Dynamics.b2BodyDef, u = Box2D.Dynamics.b2ContactFilter, D = Box2D.Dynamics.b2ContactImpulse, H = Box2D.Dynamics.b2ContactListener, O = Box2D.Dynamics.b2ContactManager, E = Box2D.Dynamics.b2DebugDraw, R = Box2D.Dynamics.b2DestructionListener, N = Box2D.Dynamics.b2FilterData, S = Box2D.Dynamics.b2Fixture, aa = Box2D.Dynamics.b2FixtureDef, Z = Box2D.Dynamics.b2Island, d = Box2D.Dynamics.b2TimeStep, h = Box2D.Dynamics.b2World, l = Box2D.Dynamics.Contacts.b2Contact, j = Box2D.Dynamics.Contacts.b2ContactFactory, o = Box2D.Dynamics.Contacts.b2ContactSolver, q = Box2D.Dynamics.Joints.b2Joint, n = Box2D.Dynamics.Joints.b2PulleyJoint;
    k.b2Body = function() {
        this.m_xf = new K(), this.m_sweep = new G(), this.m_linearVelocity = new y(), this.m_force = new y();
    }, k.prototype.connectEdges = function(a, c, g) {
        void 0 === g && (g = 0);
        var b = Math.atan2(c.GetDirectionVector().y, c.GetDirectionVector().x);
        g = F.MulFV(Math.tan(.5 * (b - g)), c.GetDirectionVector()), g = F.SubtractVV(g, c.GetNormalVector()), 
        g = F.MulFV(A.b2_toiSlop, g), g = F.AddVV(g, c.GetVertex1());
        var e = F.AddVV(a.GetDirectionVector(), c.GetDirectionVector());
        e.Normalize();
        var f = 0 < F.Dot(a.GetDirectionVector(), c.GetNormalVector());
        return a.SetNextEdge(c, g, e, f), c.SetPrevEdge(a, g, e, f), b;
    }, k.prototype.CreateFixture = function(a) {
        if (1 == this.m_world.IsLocked()) return null;
        var c = new S();
        return c.Create(this, this.m_xf, a), this.m_flags & k.e_activeFlag && c.CreateProxy(this.m_world.m_contactManager.m_broadPhase, this.m_xf), 
        c.m_next = this.m_fixtureList, this.m_fixtureList = c, ++this.m_fixtureCount, c.m_body = this, 
        0 < c.m_density && this.ResetMassData(), this.m_world.m_flags |= h.e_newFixture, 
        c;
    }, k.prototype.CreateFixture2 = function(a, c) {
        void 0 === c && (c = 0);
        var g = new aa();
        return g.shape = a, g.density = c, this.CreateFixture(g);
    }, k.prototype.DestroyFixture = function(a) {
        if (1 != this.m_world.IsLocked()) {
            for (var c = this.m_fixtureList, g = null; null != c; ) {
                if (c == a) {
                    g ? g.m_next = a.m_next : this.m_fixtureList = a.m_next;
                    break;
                }
                c = (g = c).m_next;
            }
            for (c = this.m_contactList; c; ) {
                g = c.contact, c = c.next;
                var b = g.GetFixtureA(), e = g.GetFixtureB();
                a != b && a != e || this.m_world.m_contactManager.Destroy(g);
            }
            this.m_flags & k.e_activeFlag && a.DestroyProxy(this.m_world.m_contactManager.m_broadPhase), 
            a.Destroy(), a.m_body = null, a.m_next = null, --this.m_fixtureCount, this.ResetMassData();
        }
    }, k.prototype.SetPositionAndAngle = function(a, c) {
        var g;
        if (void 0 === c && (c = 0), 1 != this.m_world.IsLocked()) {
            this.m_xf.R.Set(c), this.m_xf.position.SetV(a), g = this.m_xf.R;
            var b = this.m_sweep.localCenter;
            for (this.m_sweep.c.x = g.col1.x * b.x + g.col2.x * b.y, this.m_sweep.c.y = g.col1.y * b.x + g.col2.y * b.y, 
            this.m_sweep.c.x += this.m_xf.position.x, this.m_sweep.c.y += this.m_xf.position.y, 
            this.m_sweep.c0.SetV(this.m_sweep.c), this.m_sweep.a0 = this.m_sweep.a = c, b = this.m_world.m_contactManager.m_broadPhase, 
            g = this.m_fixtureList; g; g = g.m_next) g.Synchronize(b, this.m_xf, this.m_xf);
            this.m_world.m_contactManager.FindNewContacts();
        }
    }, k.prototype.SetTransform = function(a) {
        this.SetPositionAndAngle(a.position, a.GetAngle());
    }, k.prototype.GetTransform = function() {
        return this.m_xf;
    }, k.prototype.GetPosition = function() {
        return this.m_xf.position;
    }, k.prototype.SetPosition = function(a) {
        this.SetPositionAndAngle(a, this.GetAngle());
    }, k.prototype.GetAngle = function() {
        return this.m_sweep.a;
    }, k.prototype.SetAngle = function(a) {
        void 0 === a && (a = 0), this.SetPositionAndAngle(this.GetPosition(), a);
    }, k.prototype.GetWorldCenter = function() {
        return this.m_sweep.c;
    }, k.prototype.GetLocalCenter = function() {
        return this.m_sweep.localCenter;
    }, k.prototype.SetLinearVelocity = function(a) {
        this.m_type != k.b2_staticBody && this.m_linearVelocity.SetV(a);
    }, k.prototype.GetLinearVelocity = function() {
        return this.m_linearVelocity;
    }, k.prototype.SetAngularVelocity = function(a) {
        void 0 === a && (a = 0), this.m_type != k.b2_staticBody && (this.m_angularVelocity = a);
    }, k.prototype.GetAngularVelocity = function() {
        return this.m_angularVelocity;
    }, k.prototype.GetDefinition = function() {
        var a = new z();
        return a.type = this.GetType(), a.allowSleep = (this.m_flags & k.e_allowSleepFlag) == k.e_allowSleepFlag, 
        a.angle = this.GetAngle(), a.angularDamping = this.m_angularDamping, a.angularVelocity = this.m_angularVelocity, 
        a.fixedRotation = (this.m_flags & k.e_fixedRotationFlag) == k.e_fixedRotationFlag, 
        a.bullet = (this.m_flags & k.e_bulletFlag) == k.e_bulletFlag, a.awake = (this.m_flags & k.e_awakeFlag) == k.e_awakeFlag, 
        a.linearDamping = this.m_linearDamping, a.linearVelocity.SetV(this.GetLinearVelocity()), 
        a.position = this.GetPosition(), a.userData = this.GetUserData(), a;
    }, k.prototype.ApplyForce = function(a, c) {
        this.m_type == k.b2_dynamicBody && (0 == this.IsAwake() && this.SetAwake(!0), this.m_force.x += a.x, 
        this.m_force.y += a.y, this.m_torque += (c.x - this.m_sweep.c.x) * a.y - (c.y - this.m_sweep.c.y) * a.x);
    }, k.prototype.ApplyTorque = function(a) {
        void 0 === a && (a = 0), this.m_type == k.b2_dynamicBody && (0 == this.IsAwake() && this.SetAwake(!0), 
        this.m_torque += a);
    }, k.prototype.ApplyImpulse = function(a, c) {
        this.m_type == k.b2_dynamicBody && (0 == this.IsAwake() && this.SetAwake(!0), this.m_linearVelocity.x += this.m_invMass * a.x, 
        this.m_linearVelocity.y += this.m_invMass * a.y, this.m_angularVelocity += this.m_invI * ((c.x - this.m_sweep.c.x) * a.y - (c.y - this.m_sweep.c.y) * a.x));
    }, k.prototype.Split = function(a) {
        for (var f, c = this.GetLinearVelocity().Copy(), g = this.GetAngularVelocity(), b = this.GetWorldCenter(), e = this.m_world.CreateBody(this.GetDefinition()), m = this.m_fixtureList; m; ) if (a(m)) {
            var r = m.m_next;
            f ? f.m_next = r : this.m_fixtureList = r, this.m_fixtureCount--, m.m_next = e.m_fixtureList, 
            e.m_fixtureList = m, e.m_fixtureCount++, m.m_body = e, m = r;
        } else m = (f = m).m_next;
        return this.ResetMassData(), e.ResetMassData(), f = this.GetWorldCenter(), a = e.GetWorldCenter(), 
        f = F.AddVV(c, F.CrossFV(g, F.SubtractVV(f, b))), c = F.AddVV(c, F.CrossFV(g, F.SubtractVV(a, b))), 
        this.SetLinearVelocity(f), e.SetLinearVelocity(c), this.SetAngularVelocity(g), e.SetAngularVelocity(g), 
        this.SynchronizeFixtures(), e.SynchronizeFixtures(), e;
    }, k.prototype.Merge = function(a) {
        var c;
        for (c = a.m_fixtureList; c; ) {
            var g = c.m_next;
            a.m_fixtureCount--, c.m_next = this.m_fixtureList, this.m_fixtureList = c, this.m_fixtureCount++, 
            c.m_body = e, c = g;
        }
        b.m_fixtureCount = 0;
        var b = this, e = a;
        b.GetWorldCenter(), e.GetWorldCenter(), b.GetLinearVelocity().Copy(), e.GetLinearVelocity().Copy(), 
        b.GetAngularVelocity(), e.GetAngularVelocity(), b.ResetMassData(), this.SynchronizeFixtures();
    }, k.prototype.GetMass = function() {
        return this.m_mass;
    }, k.prototype.GetInertia = function() {
        return this.m_I;
    }, k.prototype.GetMassData = function(a) {
        a.mass = this.m_mass, a.I = this.m_I, a.center.SetV(this.m_sweep.localCenter);
    }, k.prototype.SetMassData = function(a) {
        if (A.b2Assert(0 == this.m_world.IsLocked()), 1 != this.m_world.IsLocked() && this.m_type == k.b2_dynamicBody) {
            this.m_invI = this.m_I = this.m_invMass = 0, this.m_mass = a.mass, this.m_mass <= 0 && (this.m_mass = 1), 
            this.m_invMass = 1 / this.m_mass, 0 < a.I && 0 == (this.m_flags & k.e_fixedRotationFlag) && (this.m_I = a.I - this.m_mass * (a.center.x * a.center.x + a.center.y * a.center.y), 
            this.m_invI = 1 / this.m_I);
            var c = this.m_sweep.c.Copy();
            this.m_sweep.localCenter.SetV(a.center), this.m_sweep.c0.SetV(F.MulX(this.m_xf, this.m_sweep.localCenter)), 
            this.m_sweep.c.SetV(this.m_sweep.c0), this.m_linearVelocity.x += this.m_angularVelocity * -(this.m_sweep.c.y - c.y), 
            this.m_linearVelocity.y += this.m_angularVelocity * +(this.m_sweep.c.x - c.x);
        }
    }, k.prototype.ResetMassData = function() {
        if (this.m_invI = this.m_I = this.m_invMass = this.m_mass = 0, this.m_sweep.localCenter.SetZero(), 
        this.m_type != k.b2_staticBody && this.m_type != k.b2_kinematicBody) {
            for (var a = y.Make(0, 0), c = this.m_fixtureList; c; c = c.m_next) if (0 != c.m_density) {
                var g = c.GetMassData();
                this.m_mass += g.mass, a.x += g.center.x * g.mass, a.y += g.center.y * g.mass, this.m_I += g.I;
            }
            0 < this.m_mass ? (this.m_invMass = 1 / this.m_mass, a.x *= this.m_invMass, a.y *= this.m_invMass) : this.m_invMass = this.m_mass = 1, 
            0 < this.m_I && 0 == (this.m_flags & k.e_fixedRotationFlag) ? (this.m_I -= this.m_mass * (a.x * a.x + a.y * a.y), 
            this.m_I *= this.m_inertiaScale, A.b2Assert(0 < this.m_I), this.m_invI = 1 / this.m_I) : this.m_invI = this.m_I = 0, 
            c = this.m_sweep.c.Copy(), this.m_sweep.localCenter.SetV(a), this.m_sweep.c0.SetV(F.MulX(this.m_xf, this.m_sweep.localCenter)), 
            this.m_sweep.c.SetV(this.m_sweep.c0), this.m_linearVelocity.x += this.m_angularVelocity * -(this.m_sweep.c.y - c.y), 
            this.m_linearVelocity.y += this.m_angularVelocity * +(this.m_sweep.c.x - c.x);
        }
    }, k.prototype.GetWorldPoint = function(a) {
        var c = this.m_xf.R;
        return (a = new y(c.col1.x * a.x + c.col2.x * a.y, c.col1.y * a.x + c.col2.y * a.y)).x += this.m_xf.position.x, 
        a.y += this.m_xf.position.y, a;
    }, k.prototype.GetWorldVector = function(a) {
        return F.MulMV(this.m_xf.R, a);
    }, k.prototype.GetLocalPoint = function(a) {
        return F.MulXT(this.m_xf, a);
    }, k.prototype.GetLocalVector = function(a) {
        return F.MulTMV(this.m_xf.R, a);
    }, k.prototype.GetLinearVelocityFromWorldPoint = function(a) {
        return new y(this.m_linearVelocity.x - this.m_angularVelocity * (a.y - this.m_sweep.c.y), this.m_linearVelocity.y + this.m_angularVelocity * (a.x - this.m_sweep.c.x));
    }, k.prototype.GetLinearVelocityFromLocalPoint = function(a) {
        var c = this.m_xf.R;
        return (a = new y(c.col1.x * a.x + c.col2.x * a.y, c.col1.y * a.x + c.col2.y * a.y)).x += this.m_xf.position.x, 
        a.y += this.m_xf.position.y, new y(this.m_linearVelocity.x - this.m_angularVelocity * (a.y - this.m_sweep.c.y), this.m_linearVelocity.y + this.m_angularVelocity * (a.x - this.m_sweep.c.x));
    }, k.prototype.GetLinearDamping = function() {
        return this.m_linearDamping;
    }, k.prototype.SetLinearDamping = function(a) {
        void 0 === a && (a = 0), this.m_linearDamping = a;
    }, k.prototype.GetAngularDamping = function() {
        return this.m_angularDamping;
    }, k.prototype.SetAngularDamping = function(a) {
        void 0 === a && (a = 0), this.m_angularDamping = a;
    }, k.prototype.SetType = function(a) {
        if (void 0 === a && (a = 0), this.m_type != a) for (this.m_type = a, this.ResetMassData(), 
        this.m_type == k.b2_staticBody && (this.m_linearVelocity.SetZero(), this.m_angularVelocity = 0), 
        this.SetAwake(!0), this.m_force.SetZero(), this.m_torque = 0, a = this.m_contactList; a; a = a.next) a.contact.FlagForFiltering();
    }, k.prototype.GetType = function() {
        return this.m_type;
    }, k.prototype.SetBullet = function(a) {
        a ? this.m_flags |= k.e_bulletFlag : this.m_flags &= ~k.e_bulletFlag;
    }, k.prototype.IsBullet = function() {
        return (this.m_flags & k.e_bulletFlag) == k.e_bulletFlag;
    }, k.prototype.SetSleepingAllowed = function(a) {
        a ? this.m_flags |= k.e_allowSleepFlag : (this.m_flags &= ~k.e_allowSleepFlag, this.SetAwake(!0));
    }, k.prototype.SetAwake = function(a) {
        a ? (this.m_flags |= k.e_awakeFlag, this.m_sleepTime = 0) : (this.m_flags &= ~k.e_awakeFlag, 
        this.m_sleepTime = 0, this.m_linearVelocity.SetZero(), this.m_angularVelocity = 0, 
        this.m_force.SetZero(), this.m_torque = 0);
    }, k.prototype.IsAwake = function() {
        return (this.m_flags & k.e_awakeFlag) == k.e_awakeFlag;
    }, k.prototype.SetFixedRotation = function(a) {
        a ? this.m_flags |= k.e_fixedRotationFlag : this.m_flags &= ~k.e_fixedRotationFlag, 
        this.ResetMassData();
    }, k.prototype.IsFixedRotation = function() {
        return (this.m_flags & k.e_fixedRotationFlag) == k.e_fixedRotationFlag;
    }, k.prototype.SetActive = function(a) {
        var c;
        if (a != this.IsActive()) if (a) for (this.m_flags |= k.e_activeFlag, a = this.m_world.m_contactManager.m_broadPhase, 
        c = this.m_fixtureList; c; c = c.m_next) c.CreateProxy(a, this.m_xf); else {
            for (this.m_flags &= ~k.e_activeFlag, a = this.m_world.m_contactManager.m_broadPhase, 
            c = this.m_fixtureList; c; c = c.m_next) c.DestroyProxy(a);
            for (a = this.m_contactList; a; ) a = (c = a).next, this.m_world.m_contactManager.Destroy(c.contact);
            this.m_contactList = null;
        }
    }, k.prototype.IsActive = function() {
        return (this.m_flags & k.e_activeFlag) == k.e_activeFlag;
    }, k.prototype.IsSleepingAllowed = function() {
        return (this.m_flags & k.e_allowSleepFlag) == k.e_allowSleepFlag;
    }, k.prototype.GetFixtureList = function() {
        return this.m_fixtureList;
    }, k.prototype.GetJointList = function() {
        return this.m_jointList;
    }, k.prototype.GetControllerList = function() {
        return this.m_controllerList;
    }, k.prototype.GetContactList = function() {
        return this.m_contactList;
    }, k.prototype.GetNext = function() {
        return this.m_next;
    }, k.prototype.GetUserData = function() {
        return this.m_userData;
    }, k.prototype.SetUserData = function(a) {
        this.m_userData = a;
    }, k.prototype.GetWorld = function() {
        return this.m_world;
    }, k.prototype.b2Body = function(a, c) {
        this.m_flags = 0, a.bullet && (this.m_flags |= k.e_bulletFlag), a.fixedRotation && (this.m_flags |= k.e_fixedRotationFlag), 
        a.allowSleep && (this.m_flags |= k.e_allowSleepFlag), a.awake && (this.m_flags |= k.e_awakeFlag), 
        a.active && (this.m_flags |= k.e_activeFlag), this.m_world = c, this.m_xf.position.SetV(a.position), 
        this.m_xf.R.Set(a.angle), this.m_sweep.localCenter.SetZero(), this.m_sweep.t0 = 1, 
        this.m_sweep.a0 = this.m_sweep.a = a.angle;
        var g = this.m_xf.R, b = this.m_sweep.localCenter;
        this.m_sweep.c.x = g.col1.x * b.x + g.col2.x * b.y, this.m_sweep.c.y = g.col1.y * b.x + g.col2.y * b.y, 
        this.m_sweep.c.x += this.m_xf.position.x, this.m_sweep.c.y += this.m_xf.position.y, 
        this.m_sweep.c0.SetV(this.m_sweep.c), this.m_contactList = this.m_controllerList = this.m_jointList = null, 
        this.m_controllerCount = 0, this.m_next = this.m_prev = null, this.m_linearVelocity.SetV(a.linearVelocity), 
        this.m_angularVelocity = a.angularVelocity, this.m_linearDamping = a.linearDamping, 
        this.m_angularDamping = a.angularDamping, this.m_force.Set(0, 0), this.m_sleepTime = this.m_torque = 0, 
        this.m_type = a.type, this.m_type == k.b2_dynamicBody ? this.m_invMass = this.m_mass = 1 : this.m_invMass = this.m_mass = 0, 
        this.m_invI = this.m_I = 0, this.m_inertiaScale = a.inertiaScale, this.m_userData = a.userData, 
        this.m_fixtureList = null, this.m_fixtureCount = 0;
    }, k.prototype.SynchronizeFixtures = function() {
        var a = k.s_xf1;
        a.R.Set(this.m_sweep.a0);
        var c = a.R, g = this.m_sweep.localCenter;
        for (a.position.x = this.m_sweep.c0.x - (c.col1.x * g.x + c.col2.x * g.y), a.position.y = this.m_sweep.c0.y - (c.col1.y * g.x + c.col2.y * g.y), 
        g = this.m_world.m_contactManager.m_broadPhase, c = this.m_fixtureList; c; c = c.m_next) c.Synchronize(g, a, this.m_xf);
    }, k.prototype.SynchronizeTransform = function() {
        this.m_xf.R.Set(this.m_sweep.a);
        var a = this.m_xf.R, c = this.m_sweep.localCenter;
        this.m_xf.position.x = this.m_sweep.c.x - (a.col1.x * c.x + a.col2.x * c.y), this.m_xf.position.y = this.m_sweep.c.y - (a.col1.y * c.x + a.col2.y * c.y);
    }, k.prototype.ShouldCollide = function(a) {
        if (this.m_type != k.b2_dynamicBody && a.m_type != k.b2_dynamicBody) return !1;
        for (var c = this.m_jointList; c; c = c.next) if (c.other == a && 0 == c.joint.m_collideConnected) return !1;
        return !0;
    }, k.prototype.Advance = function(a) {
        void 0 === a && (a = 0), this.m_sweep.Advance(a), this.m_sweep.c.SetV(this.m_sweep.c0), 
        this.m_sweep.a = this.m_sweep.a0, this.SynchronizeTransform();
    }, Box2D.postDefs.push(function() {
        Box2D.Dynamics.b2Body.s_xf1 = new K(), Box2D.Dynamics.b2Body.e_islandFlag = 1, Box2D.Dynamics.b2Body.e_awakeFlag = 2, 
        Box2D.Dynamics.b2Body.e_allowSleepFlag = 4, Box2D.Dynamics.b2Body.e_bulletFlag = 8, 
        Box2D.Dynamics.b2Body.e_fixedRotationFlag = 16, Box2D.Dynamics.b2Body.e_activeFlag = 32, 
        Box2D.Dynamics.b2Body.b2_staticBody = 0, Box2D.Dynamics.b2Body.b2_kinematicBody = 1, 
        Box2D.Dynamics.b2Body.b2_dynamicBody = 2;
    }), z.b2BodyDef = function() {
        this.position = new y(), this.linearVelocity = new y();
    }, z.prototype.b2BodyDef = function() {
        this.userData = null, this.position.Set(0, 0), this.angle = 0, this.linearVelocity.Set(0, 0), 
        this.angularDamping = this.linearDamping = this.angularVelocity = 0, this.awake = this.allowSleep = !0, 
        this.bullet = this.fixedRotation = !1, this.type = k.b2_staticBody, this.active = !0, 
        this.inertiaScale = 1;
    }, u.b2ContactFilter = function() {}, u.prototype.ShouldCollide = function(a, c) {
        var g = a.GetFilterData(), b = c.GetFilterData();
        return g.groupIndex == b.groupIndex && 0 != g.groupIndex ? 0 < g.groupIndex : 0 != (g.maskBits & b.categoryBits) && 0 != (g.categoryBits & b.maskBits);
    }, u.prototype.RayCollide = function(a, c) {
        return !a || this.ShouldCollide(a instanceof S ? a : null, c);
    }, Box2D.postDefs.push(function() {
        Box2D.Dynamics.b2ContactFilter.b2_defaultFilter = new u();
    }), D.b2ContactImpulse = function() {
        this.normalImpulses = new Vector_a2j_Number(A.b2_maxManifoldPoints), this.tangentImpulses = new Vector_a2j_Number(A.b2_maxManifoldPoints);
    }, H.b2ContactListener = function() {}, H.prototype.BeginContact = function() {}, 
    H.prototype.EndContact = function() {}, H.prototype.PreSolve = function() {}, H.prototype.PostSolve = function() {}, 
    Box2D.postDefs.push(function() {
        Box2D.Dynamics.b2ContactListener.b2_defaultListener = new H();
    }), O.b2ContactManager = function() {}, O.prototype.b2ContactManager = function() {
        this.m_world = null, this.m_contactCount = 0, this.m_contactFilter = u.b2_defaultFilter, 
        this.m_contactListener = H.b2_defaultListener, this.m_contactFactory = new j(this.m_allocator), 
        this.m_broadPhase = new B();
    }, O.prototype.AddPair = function(a, c) {
        var g = a instanceof S ? a : null, b = c instanceof S ? c : null, e = g.GetBody(), f = b.GetBody();
        if (e != f) {
            for (var m = f.GetContactList(); m; ) {
                if (m.other == e) {
                    var r = m.contact.GetFixtureA(), s = m.contact.GetFixtureB();
                    if (r == g && s == b) return;
                    if (r == b && s == g) return;
                }
                m = m.next;
            }
            0 != f.ShouldCollide(e) && 0 != this.m_contactFilter.ShouldCollide(g, b) && (g = (m = this.m_contactFactory.Create(g, b)).GetFixtureA(), 
            b = m.GetFixtureB(), e = g.m_body, f = b.m_body, m.m_prev = null, m.m_next = this.m_world.m_contactList, 
            null != this.m_world.m_contactList && (this.m_world.m_contactList.m_prev = m), ((this.m_world.m_contactList = m).m_nodeA.contact = m).m_nodeA.other = f, 
            m.m_nodeA.prev = null, m.m_nodeA.next = e.m_contactList, null != e.m_contactList && (e.m_contactList.prev = m.m_nodeA), 
            e.m_contactList = m.m_nodeA, (m.m_nodeB.contact = m).m_nodeB.other = e, m.m_nodeB.prev = null, 
            m.m_nodeB.next = f.m_contactList, null != f.m_contactList && (f.m_contactList.prev = m.m_nodeB), 
            f.m_contactList = m.m_nodeB, ++this.m_world.m_contactCount);
        }
    }, O.prototype.FindNewContacts = function() {
        this.m_broadPhase.UpdatePairs(Box2D.generateCallback(this, this.AddPair));
    }, O.prototype.Destroy = function(a) {
        var c = a.GetFixtureA(), g = a.GetFixtureB();
        c = c.GetBody(), g = g.GetBody(), a.IsTouching() && this.m_contactListener.EndContact(a), 
        a.m_prev && (a.m_prev.m_next = a.m_next), a.m_next && (a.m_next.m_prev = a.m_prev), 
        a == this.m_world.m_contactList && (this.m_world.m_contactList = a.m_next), a.m_nodeA.prev && (a.m_nodeA.prev.next = a.m_nodeA.next), 
        a.m_nodeA.next && (a.m_nodeA.next.prev = a.m_nodeA.prev), a.m_nodeA == c.m_contactList && (c.m_contactList = a.m_nodeA.next), 
        a.m_nodeB.prev && (a.m_nodeB.prev.next = a.m_nodeB.next), a.m_nodeB.next && (a.m_nodeB.next.prev = a.m_nodeB.prev), 
        a.m_nodeB == g.m_contactList && (g.m_contactList = a.m_nodeB.next), this.m_contactFactory.Destroy(a), 
        --this.m_contactCount;
    }, O.prototype.Collide = function() {
        for (var a = this.m_world.m_contactList; a; ) {
            var c = a.GetFixtureA(), g = a.GetFixtureB(), b = c.GetBody(), e = g.GetBody();
            if (0 == b.IsAwake() && 0 == e.IsAwake()) a = a.GetNext(); else {
                if (a.m_flags & l.e_filterFlag) {
                    if (0 == e.ShouldCollide(b)) {
                        a = (c = a).GetNext(), this.Destroy(c);
                        continue;
                    }
                    if (0 == this.m_contactFilter.ShouldCollide(c, g)) {
                        a = (c = a).GetNext(), this.Destroy(c);
                        continue;
                    }
                    a.m_flags &= ~l.e_filterFlag;
                }
                0 == this.m_broadPhase.TestOverlap(c.m_proxy, g.m_proxy) ? (a = (c = a).GetNext(), 
                this.Destroy(c)) : (a.Update(this.m_contactListener), a = a.GetNext());
            }
        }
    }, Box2D.postDefs.push(function() {
        Box2D.Dynamics.b2ContactManager.s_evalCP = new p();
    }), E.b2DebugDraw = function() {}, E.prototype.b2DebugDraw = function() {}, E.prototype.SetFlags = function() {}, 
    E.prototype.GetFlags = function() {}, E.prototype.AppendFlags = function() {}, E.prototype.ClearFlags = function() {}, 
    E.prototype.SetSprite = function() {}, E.prototype.GetSprite = function() {}, E.prototype.SetDrawScale = function() {}, 
    E.prototype.GetDrawScale = function() {}, E.prototype.SetLineThickness = function() {}, 
    E.prototype.GetLineThickness = function() {}, E.prototype.SetAlpha = function() {}, 
    E.prototype.GetAlpha = function() {}, E.prototype.SetFillAlpha = function() {}, 
    E.prototype.GetFillAlpha = function() {}, E.prototype.SetXFormScale = function() {}, 
    E.prototype.GetXFormScale = function() {}, E.prototype.DrawPolygon = function() {}, 
    E.prototype.DrawSolidPolygon = function() {}, E.prototype.DrawCircle = function() {}, 
    E.prototype.DrawSolidCircle = function() {}, E.prototype.DrawSegment = function() {}, 
    E.prototype.DrawTransform = function() {}, Box2D.postDefs.push(function() {
        Box2D.Dynamics.b2DebugDraw.e_shapeBit = 1, Box2D.Dynamics.b2DebugDraw.e_jointBit = 2, 
        Box2D.Dynamics.b2DebugDraw.e_aabbBit = 4, Box2D.Dynamics.b2DebugDraw.e_pairBit = 8, 
        Box2D.Dynamics.b2DebugDraw.e_centerOfMassBit = 16, Box2D.Dynamics.b2DebugDraw.e_controllerBit = 32;
    }), R.b2DestructionListener = function() {}, R.prototype.SayGoodbyeJoint = function() {}, 
    R.prototype.SayGoodbyeFixture = function() {}, N.b2FilterData = function() {
        this.categoryBits = 1, this.maskBits = 65535, this.groupIndex = 0;
    }, N.prototype.Copy = function() {
        var a = new N();
        return a.categoryBits = this.categoryBits, a.maskBits = this.maskBits, a.groupIndex = this.groupIndex, 
        a;
    }, S.b2Fixture = function() {
        this.m_filter = new N();
    }, S.prototype.GetType = function() {
        return this.m_shape.GetType();
    }, S.prototype.GetShape = function() {
        return this.m_shape;
    }, S.prototype.SetSensor = function(a) {
        if (this.m_isSensor != a && (this.m_isSensor = a, null != this.m_body)) for (a = this.m_body.GetContactList(); a; ) {
            var c = a.contact, g = c.GetFixtureA(), b = c.GetFixtureB();
            g != this && b != this || c.SetSensor(g.IsSensor() || b.IsSensor()), a = a.next;
        }
    }, S.prototype.IsSensor = function() {
        return this.m_isSensor;
    }, S.prototype.SetFilterData = function(a) {
        if (this.m_filter = a.Copy(), !this.m_body) for (a = this.m_body.GetContactList(); a; ) {
            var c = a.contact, g = c.GetFixtureA(), b = c.GetFixtureB();
            g != this && b != this || c.FlagForFiltering(), a = a.next;
        }
    }, S.prototype.GetFilterData = function() {
        return this.m_filter.Copy();
    }, S.prototype.GetBody = function() {
        return this.m_body;
    }, S.prototype.GetNext = function() {
        return this.m_next;
    }, S.prototype.GetUserData = function() {
        return this.m_userData;
    }, S.prototype.SetUserData = function(a) {
        this.m_userData = a;
    }, S.prototype.TestPoint = function(a) {
        return this.m_shape.TestPoint(this.m_body.GetTransform(), a);
    }, S.prototype.RayCast = function(a, c) {
        return this.m_shape.RayCast(a, c, this.m_body.GetTransform());
    }, S.prototype.GetMassData = function(a) {
        return void 0 === a && (a = null), null == a && (a = new I()), this.m_shape.ComputeMass(a, this.m_density), 
        a;
    }, S.prototype.SetDensity = function(a) {
        void 0 === a && (a = 0), this.m_density = a;
    }, S.prototype.GetDensity = function() {
        return this.m_density;
    }, S.prototype.GetFriction = function() {
        return this.m_friction;
    }, S.prototype.SetFriction = function(a) {
        void 0 === a && (a = 0), this.m_friction = a;
    }, S.prototype.GetRestitution = function() {
        return this.m_restitution;
    }, S.prototype.SetRestitution = function(a) {
        void 0 === a && (a = 0), this.m_restitution = a;
    }, S.prototype.GetAABB = function() {
        return this.m_aabb;
    }, S.prototype.b2Fixture = function() {
        this.m_aabb = new U(), this.m_shape = this.m_next = this.m_body = this.m_userData = null, 
        this.m_restitution = this.m_friction = this.m_density = 0;
    }, S.prototype.Create = function(a, c, g) {
        this.m_userData = g.userData, this.m_friction = g.friction, this.m_restitution = g.restitution, 
        this.m_body = a, this.m_next = null, this.m_filter = g.filter.Copy(), this.m_isSensor = g.isSensor, 
        this.m_shape = g.shape.Copy(), this.m_density = g.density;
    }, S.prototype.Destroy = function() {
        this.m_shape = null;
    }, S.prototype.CreateProxy = function(a, c) {
        this.m_shape.ComputeAABB(this.m_aabb, c), this.m_proxy = a.CreateProxy(this.m_aabb, this);
    }, S.prototype.DestroyProxy = function(a) {
        null != this.m_proxy && (a.DestroyProxy(this.m_proxy), this.m_proxy = null);
    }, S.prototype.Synchronize = function(a, c, g) {
        if (this.m_proxy) {
            var b = new U(), e = new U();
            this.m_shape.ComputeAABB(b, c), this.m_shape.ComputeAABB(e, g), this.m_aabb.Combine(b, e), 
            c = F.SubtractVV(g.position, c.position), a.MoveProxy(this.m_proxy, this.m_aabb, c);
        }
    }, aa.b2FixtureDef = function() {
        this.filter = new N();
    }, aa.prototype.b2FixtureDef = function() {
        this.userData = this.shape = null, this.friction = .2, this.density = this.restitution = 0, 
        this.filter.categoryBits = 1, this.filter.maskBits = 65535, this.filter.groupIndex = 0, 
        this.isSensor = !1;
    }, Z.b2Island = function() {}, Z.prototype.b2Island = function() {
        this.m_bodies = new Vector(), this.m_contacts = new Vector(), this.m_joints = new Vector();
    }, Z.prototype.Initialize = function(a, c, g, b, e, f) {
        void 0 === a && (a = 0), void 0 === c && (c = 0), void 0 === g && (g = 0);
        var m = 0;
        for (this.m_bodyCapacity = a, this.m_contactCapacity = c, this.m_jointCapacity = g, 
        this.m_jointCount = this.m_contactCount = this.m_bodyCount = 0, this.m_allocator = b, 
        this.m_listener = e, this.m_contactSolver = f, m = this.m_bodies.length; m < a; m++) this.m_bodies[m] = null;
        for (m = this.m_contacts.length; m < c; m++) this.m_contacts[m] = null;
        for (m = this.m_joints.length; m < g; m++) this.m_joints[m] = null;
    }, Z.prototype.Clear = function() {
        this.m_jointCount = this.m_contactCount = this.m_bodyCount = 0;
    }, Z.prototype.Solve = function(a, c, g) {
        var f, b = 0, e = 0;
        for (b = 0; b < this.m_bodyCount; ++b) (e = this.m_bodies[b]).GetType() == k.b2_dynamicBody && (e.m_linearVelocity.x += a.dt * (c.x + e.m_invMass * e.m_force.x), 
        e.m_linearVelocity.y += a.dt * (c.y + e.m_invMass * e.m_force.y), e.m_angularVelocity += a.dt * e.m_invI * e.m_torque, 
        e.m_linearVelocity.Multiply(F.Clamp(1 - a.dt * e.m_linearDamping, 0, 1)), e.m_angularVelocity *= F.Clamp(1 - a.dt * e.m_angularDamping, 0, 1));
        for (this.m_contactSolver.Initialize(a, this.m_contacts, this.m_contactCount, this.m_allocator), 
        (c = this.m_contactSolver).InitVelocityConstraints(a), b = 0; b < this.m_jointCount; ++b) (f = this.m_joints[b]).InitVelocityConstraints(a);
        for (b = 0; b < a.velocityIterations; ++b) {
            for (e = 0; e < this.m_jointCount; ++e) (f = this.m_joints[e]).SolveVelocityConstraints(a);
            c.SolveVelocityConstraints();
        }
        for (b = 0; b < this.m_jointCount; ++b) (f = this.m_joints[b]).FinalizeVelocityConstraints();
        for (c.FinalizeVelocityConstraints(), b = 0; b < this.m_bodyCount; ++b) if ((e = this.m_bodies[b]).GetType() != k.b2_staticBody) {
            var m = a.dt * e.m_linearVelocity.x, r = a.dt * e.m_linearVelocity.y;
            m * m + r * r > A.b2_maxTranslationSquared && (e.m_linearVelocity.Normalize(), e.m_linearVelocity.x *= A.b2_maxTranslation * a.inv_dt, 
            e.m_linearVelocity.y *= A.b2_maxTranslation * a.inv_dt), (m = a.dt * e.m_angularVelocity) * m > A.b2_maxRotationSquared && (e.m_angularVelocity = e.m_angularVelocity < 0 ? -A.b2_maxRotation * a.inv_dt : A.b2_maxRotation * a.inv_dt), 
            e.m_sweep.c0.SetV(e.m_sweep.c), e.m_sweep.a0 = e.m_sweep.a, e.m_sweep.c.x += a.dt * e.m_linearVelocity.x, 
            e.m_sweep.c.y += a.dt * e.m_linearVelocity.y, e.m_sweep.a += a.dt * e.m_angularVelocity, 
            e.SynchronizeTransform();
        }
        for (b = 0; b < a.positionIterations; ++b) {
            for (m = c.SolvePositionConstraints(A.b2_contactBaumgarte), r = !0, e = 0; e < this.m_jointCount; ++e) f = (f = this.m_joints[e]).SolvePositionConstraints(A.b2_contactBaumgarte), 
            r = r && f;
            if (m && r) break;
        }
        if (this.Report(c.m_constraints), g) {
            for (g = Number.MAX_VALUE, c = A.b2_linearSleepTolerance * A.b2_linearSleepTolerance, 
            m = A.b2_angularSleepTolerance * A.b2_angularSleepTolerance, b = 0; b < this.m_bodyCount; ++b) (e = this.m_bodies[b]).GetType() != k.b2_staticBody && (0 == (e.m_flags & k.e_allowSleepFlag) && (g = e.m_sleepTime = 0), 
            g = 0 == (e.m_flags & k.e_allowSleepFlag) || e.m_angularVelocity * e.m_angularVelocity > m || F.Dot(e.m_linearVelocity, e.m_linearVelocity) > c ? e.m_sleepTime = 0 : (e.m_sleepTime += a.dt, 
            F.Min(g, e.m_sleepTime)));
            if (g >= A.b2_timeToSleep) for (b = 0; b < this.m_bodyCount; ++b) (e = this.m_bodies[b]).SetAwake(!1);
        }
    }, Z.prototype.SolveTOI = function(a) {
        var c = 0, g = 0;
        this.m_contactSolver.Initialize(a, this.m_contacts, this.m_contactCount, this.m_allocator);
        var b = this.m_contactSolver;
        for (c = 0; c < this.m_jointCount; ++c) this.m_joints[c].InitVelocityConstraints(a);
        for (c = 0; c < a.velocityIterations; ++c) for (b.SolveVelocityConstraints(), g = 0; g < this.m_jointCount; ++g) this.m_joints[g].SolveVelocityConstraints(a);
        for (c = 0; c < this.m_bodyCount; ++c) if ((g = this.m_bodies[c]).GetType() != k.b2_staticBody) {
            var e = a.dt * g.m_linearVelocity.x, f = a.dt * g.m_linearVelocity.y;
            e * e + f * f > A.b2_maxTranslationSquared && (g.m_linearVelocity.Normalize(), g.m_linearVelocity.x *= A.b2_maxTranslation * a.inv_dt, 
            g.m_linearVelocity.y *= A.b2_maxTranslation * a.inv_dt), (e = a.dt * g.m_angularVelocity) * e > A.b2_maxRotationSquared && (g.m_angularVelocity = g.m_angularVelocity < 0 ? -A.b2_maxRotation * a.inv_dt : A.b2_maxRotation * a.inv_dt), 
            g.m_sweep.c0.SetV(g.m_sweep.c), g.m_sweep.a0 = g.m_sweep.a, g.m_sweep.c.x += a.dt * g.m_linearVelocity.x, 
            g.m_sweep.c.y += a.dt * g.m_linearVelocity.y, g.m_sweep.a += a.dt * g.m_angularVelocity, 
            g.SynchronizeTransform();
        }
        for (c = 0; c < a.positionIterations; ++c) {
            for (e = b.SolvePositionConstraints(.75), f = !0, g = 0; g < this.m_jointCount; ++g) {
                var m = this.m_joints[g].SolvePositionConstraints(A.b2_contactBaumgarte);
                f = f && m;
            }
            if (e && f) break;
        }
        this.Report(b.m_constraints);
    }, Z.prototype.Report = function(a) {
        if (null != this.m_listener) for (var c = 0; c < this.m_contactCount; ++c) {
            for (var g = this.m_contacts[c], b = a[c], e = 0; e < b.pointCount; ++e) Z.s_impulse.normalImpulses[e] = b.points[e].normalImpulse, 
            Z.s_impulse.tangentImpulses[e] = b.points[e].tangentImpulse;
            this.m_listener.PostSolve(g, Z.s_impulse);
        }
    }, Z.prototype.AddBody = function(a) {
        a.m_islandIndex = this.m_bodyCount, this.m_bodies[this.m_bodyCount++] = a;
    }, Z.prototype.AddContact = function(a) {
        this.m_contacts[this.m_contactCount++] = a;
    }, Z.prototype.AddJoint = function(a) {
        this.m_joints[this.m_jointCount++] = a;
    }, Box2D.postDefs.push(function() {
        Box2D.Dynamics.b2Island.s_impulse = new D();
    }), d.b2TimeStep = function() {}, d.prototype.Set = function(a) {
        this.dt = a.dt, this.inv_dt = a.inv_dt, this.positionIterations = a.positionIterations, 
        this.velocityIterations = a.velocityIterations, this.warmStarting = a.warmStarting;
    }, h.b2World = function() {
        this.s_stack = new Vector(), this.m_contactManager = new O(), this.m_contactSolver = new o(), 
        this.m_island = new Z();
    }, h.prototype.b2World = function(a, c) {
        this.m_controllerList = this.m_jointList = this.m_contactList = this.m_bodyList = this.m_debugDraw = this.m_destructionListener = null, 
        this.m_controllerCount = this.m_jointCount = this.m_contactCount = this.m_bodyCount = 0, 
        h.m_warmStarting = !0, h.m_continuousPhysics = !0, this.m_allowSleep = c, this.m_gravity = a, 
        this.m_inv_dt0 = 0, (this.m_contactManager.m_world = this).m_groundBody = this.CreateBody(new z());
    }, h.prototype.SetDestructionListener = function(a) {
        this.m_destructionListener = a;
    }, h.prototype.SetContactFilter = function(a) {
        this.m_contactManager.m_contactFilter = a;
    }, h.prototype.SetContactListener = function(a) {
        this.m_contactManager.m_contactListener = a;
    }, h.prototype.SetDebugDraw = function(a) {
        this.m_debugDraw = a;
    }, h.prototype.SetBroadPhase = function(a) {
        var c = this.m_contactManager.m_broadPhase;
        this.m_contactManager.m_broadPhase = a;
        for (var g = this.m_bodyList; g; g = g.m_next) for (var b = g.m_fixtureList; b; b = b.m_next) b.m_proxy = a.CreateProxy(c.GetFatAABB(b.m_proxy), b);
    }, h.prototype.Validate = function() {
        this.m_contactManager.m_broadPhase.Validate();
    }, h.prototype.GetProxyCount = function() {
        return this.m_contactManager.m_broadPhase.GetProxyCount();
    }, h.prototype.CreateBody = function(a) {
        return 1 == this.IsLocked() ? null : ((a = new k(a, this)).m_prev = null, (a.m_next = this.m_bodyList) && (this.m_bodyList.m_prev = a), 
        this.m_bodyList = a, ++this.m_bodyCount, a);
    }, h.prototype.DestroyBody = function(a) {
        if (1 != this.IsLocked()) {
            for (var c = a.m_jointList; c; ) {
                var g = c;
                c = c.next, this.m_destructionListener && this.m_destructionListener.SayGoodbyeJoint(g.joint), 
                this.DestroyJoint(g.joint);
            }
            for (c = a.m_controllerList; c; ) c = (g = c).nextController, g.controller.RemoveBody(a);
            for (c = a.m_contactList; c; ) c = (g = c).next, this.m_contactManager.Destroy(g.contact);
            for (a.m_contactList = null, c = a.m_fixtureList; c; ) c = (g = c).m_next, this.m_destructionListener && this.m_destructionListener.SayGoodbyeFixture(g), 
            g.DestroyProxy(this.m_contactManager.m_broadPhase), g.Destroy();
            a.m_fixtureList = null, a.m_fixtureCount = 0, a.m_prev && (a.m_prev.m_next = a.m_next), 
            a.m_next && (a.m_next.m_prev = a.m_prev), a == this.m_bodyList && (this.m_bodyList = a.m_next), 
            --this.m_bodyCount;
        }
    }, h.prototype.CreateJoint = function(a) {
        var c = q.Create(a, null);
        c.m_prev = null, (c.m_next = this.m_jointList) && (this.m_jointList.m_prev = c), 
        this.m_jointList = c, ++this.m_jointCount, (c.m_edgeA.joint = c).m_edgeA.other = c.m_bodyB, 
        c.m_edgeA.prev = null, (c.m_edgeA.next = c.m_bodyA.m_jointList) && (c.m_bodyA.m_jointList.prev = c.m_edgeA), 
        c.m_bodyA.m_jointList = c.m_edgeA, (c.m_edgeB.joint = c).m_edgeB.other = c.m_bodyA, 
        c.m_edgeB.prev = null, (c.m_edgeB.next = c.m_bodyB.m_jointList) && (c.m_bodyB.m_jointList.prev = c.m_edgeB), 
        c.m_bodyB.m_jointList = c.m_edgeB;
        var g = a.bodyA, b = a.bodyB;
        if (0 == a.collideConnected) for (a = b.GetContactList(); a; ) a.other == g && a.contact.FlagForFiltering(), 
        a = a.next;
        return c;
    }, h.prototype.DestroyJoint = function(a) {
        var c = a.m_collideConnected;
        a.m_prev && (a.m_prev.m_next = a.m_next), a.m_next && (a.m_next.m_prev = a.m_prev), 
        a == this.m_jointList && (this.m_jointList = a.m_next);
        var g = a.m_bodyA, b = a.m_bodyB;
        if (g.SetAwake(!0), b.SetAwake(!0), a.m_edgeA.prev && (a.m_edgeA.prev.next = a.m_edgeA.next), 
        a.m_edgeA.next && (a.m_edgeA.next.prev = a.m_edgeA.prev), a.m_edgeA == g.m_jointList && (g.m_jointList = a.m_edgeA.next), 
        a.m_edgeA.prev = null, a.m_edgeA.next = null, a.m_edgeB.prev && (a.m_edgeB.prev.next = a.m_edgeB.next), 
        a.m_edgeB.next && (a.m_edgeB.next.prev = a.m_edgeB.prev), a.m_edgeB == b.m_jointList && (b.m_jointList = a.m_edgeB.next), 
        a.m_edgeB.prev = null, a.m_edgeB.next = null, q.Destroy(a, null), --this.m_jointCount, 
        0 == c) for (a = b.GetContactList(); a; ) a.other == g && a.contact.FlagForFiltering(), 
        a = a.next;
    }, h.prototype.AddController = function(a) {
        return a.m_next = this.m_controllerList, a.m_prev = null, ((this.m_controllerList = a).m_world = this).m_controllerCount++, 
        a;
    }, h.prototype.RemoveController = function(a) {
        a.m_prev && (a.m_prev.m_next = a.m_next), a.m_next && (a.m_next.m_prev = a.m_prev), 
        this.m_controllerList == a && (this.m_controllerList = a.m_next), this.m_controllerCount--;
    }, h.prototype.CreateController = function(a) {
        if (a.m_world != this) throw Error("Controller can only be a member of one world");
        return a.m_next = this.m_controllerList, a.m_prev = null, this.m_controllerList && (this.m_controllerList.m_prev = a), 
        this.m_controllerList = a, ++this.m_controllerCount, a.m_world = this, a;
    }, h.prototype.DestroyController = function(a) {
        a.Clear(), a.m_next && (a.m_next.m_prev = a.m_prev), a.m_prev && (a.m_prev.m_next = a.m_next), 
        a == this.m_controllerList && (this.m_controllerList = a.m_next), --this.m_controllerCount;
    }, h.prototype.SetWarmStarting = function(a) {
        h.m_warmStarting = a;
    }, h.prototype.SetContinuousPhysics = function(a) {
        h.m_continuousPhysics = a;
    }, h.prototype.GetBodyCount = function() {
        return this.m_bodyCount;
    }, h.prototype.GetJointCount = function() {
        return this.m_jointCount;
    }, h.prototype.GetContactCount = function() {
        return this.m_contactCount;
    }, h.prototype.SetGravity = function(a) {
        this.m_gravity = a;
    }, h.prototype.GetGravity = function() {
        return this.m_gravity;
    }, h.prototype.GetGroundBody = function() {
        return this.m_groundBody;
    }, h.prototype.Step = function(a, c, g) {
        void 0 === a && (a = 0), void 0 === c && (c = 0), void 0 === g && (g = 0), this.m_flags & h.e_newFixture && (this.m_contactManager.FindNewContacts(), 
        this.m_flags &= ~h.e_newFixture), this.m_flags |= h.e_locked;
        var b = h.s_timestep2;
        b.dt = a, b.velocityIterations = c, b.positionIterations = g, b.inv_dt = 0 < a ? 1 / a : 0, 
        b.dtRatio = this.m_inv_dt0 * a, b.warmStarting = h.m_warmStarting, this.m_contactManager.Collide(), 
        0 < b.dt && this.Solve(b), h.m_continuousPhysics && 0 < b.dt && this.SolveTOI(b), 
        0 < b.dt && (this.m_inv_dt0 = b.inv_dt), this.m_flags &= ~h.e_locked;
    }, h.prototype.ClearForces = function() {
        for (var a = this.m_bodyList; a; a = a.m_next) a.m_force.SetZero(), a.m_torque = 0;
    }, h.prototype.DrawDebugData = function() {
        if (null != this.m_debugDraw) {
            this.m_debugDraw.m_sprite.graphics.clear();
            var c, g, b, e, a = this.m_debugDraw.GetFlags();
            new y(), new y(), new y(), new U(), new U(), e = [ new y(), new y(), new y(), new y() ];
            var f = new w(0, 0, 0);
            if (a & E.e_shapeBit) for (c = this.m_bodyList; c; c = c.m_next) for (e = c.m_xf, 
            g = c.GetFixtureList(); g; g = g.m_next) b = g.GetShape(), 0 == c.IsActive() ? f.Set(.5, .5, .3) : c.GetType() == k.b2_staticBody ? f.Set(.5, .9, .5) : c.GetType() == k.b2_kinematicBody ? f.Set(.5, .5, .9) : 0 == c.IsAwake() ? f.Set(.6, .6, .6) : f.Set(.9, .7, .7), 
            this.DrawShape(b, e, f);
            if (a & E.e_jointBit) for (c = this.m_jointList; c; c = c.m_next) this.DrawJoint(c);
            if (a & E.e_controllerBit) for (c = this.m_controllerList; c; c = c.m_next) c.Draw(this.m_debugDraw);
            if (a & E.e_pairBit) for (f.Set(.3, .9, .9), c = this.m_contactManager.m_contactList; c; c = c.GetNext()) b = c.GetFixtureA(), 
            g = c.GetFixtureB(), b = b.GetAABB().GetCenter(), g = g.GetAABB().GetCenter(), this.m_debugDraw.DrawSegment(b, g, f);
            if (a & E.e_aabbBit) for (b = this.m_contactManager.m_broadPhase, e = [ new y(), new y(), new y(), new y() ], 
            c = this.m_bodyList; c; c = c.GetNext()) if (0 != c.IsActive()) for (g = c.GetFixtureList(); g; g = g.GetNext()) {
                var m = b.GetFatAABB(g.m_proxy);
                e[0].Set(m.lowerBound.x, m.lowerBound.y), e[1].Set(m.upperBound.x, m.lowerBound.y), 
                e[2].Set(m.upperBound.x, m.upperBound.y), e[3].Set(m.lowerBound.x, m.upperBound.y), 
                this.m_debugDraw.DrawPolygon(e, 4, f);
            }
            if (a & E.e_centerOfMassBit) for (c = this.m_bodyList; c; c = c.m_next) (e = h.s_xf).R = c.m_xf.R, 
            e.position = c.GetWorldCenter(), this.m_debugDraw.DrawTransform(e);
        }
    }, h.prototype.QueryAABB = function(a, c) {
        var g = this.m_contactManager.m_broadPhase;
        g.Query(function(b) {
            return a(g.GetUserData(b));
        }, c);
    }, h.prototype.QueryShape = function(a, c, g) {
        void 0 === g && (g = null), null == g && (g = new K()).SetIdentity();
        var b = this.m_contactManager.m_broadPhase, e = new U();
        c.ComputeAABB(e, g), b.Query(function(f) {
            return f = b.GetUserData(f) instanceof S ? b.GetUserData(f) : null, !Y.TestOverlap(c, g, f.GetShape(), f.GetBody().GetTransform()) || a(f);
        }, e);
    }, h.prototype.QueryPoint = function(a, c) {
        var g = this.m_contactManager.m_broadPhase, b = new U();
        b.lowerBound.Set(c.x - A.b2_linearSlop, c.y - A.b2_linearSlop), b.upperBound.Set(c.x + A.b2_linearSlop, c.y + A.b2_linearSlop), 
        g.Query(function(e) {
            return !(e = g.GetUserData(e) instanceof S ? g.GetUserData(e) : null).TestPoint(c) || a(e);
        }, b);
    }, h.prototype.RayCast = function(a, c, g) {
        var b = this.m_contactManager.m_broadPhase, e = new V(), f = new Q(c, g);
        b.RayCast(function(m, r) {
            var s = b.GetUserData(r);
            if ((s = s instanceof S ? s : null).RayCast(e, m)) {
                var v = e.fraction, t = new y((1 - v) * c.x + v * g.x, (1 - v) * c.y + v * g.y);
                return a(s, t, e.normal, v);
            }
            return m.maxFraction;
        }, f);
    }, h.prototype.RayCastOne = function(a, c) {
        var g;
        return this.RayCast(function(b, e, f, m) {
            return void 0 === m && (m = 0), g = b, m;
        }, a, c), g;
    }, h.prototype.RayCastAll = function(a, c) {
        var g = new Vector();
        return this.RayCast(function(b) {
            return g[g.length] = b, 1;
        }, a, c), g;
    }, h.prototype.GetBodyList = function() {
        return this.m_bodyList;
    }, h.prototype.GetJointList = function() {
        return this.m_jointList;
    }, h.prototype.GetContactList = function() {
        return this.m_contactList;
    }, h.prototype.IsLocked = function() {
        return 0 < (this.m_flags & h.e_locked);
    }, h.prototype.Solve = function(a) {
        for (var c, g = this.m_controllerList; g; g = g.m_next) g.Step(a);
        for ((g = this.m_island).Initialize(this.m_bodyCount, this.m_contactCount, this.m_jointCount, null, this.m_contactManager.m_contactListener, this.m_contactSolver), 
        c = this.m_bodyList; c; c = c.m_next) c.m_flags &= ~k.e_islandFlag;
        for (var b = this.m_contactList; b; b = b.m_next) b.m_flags &= ~l.e_islandFlag;
        for (b = this.m_jointList; b; b = b.m_next) b.m_islandFlag = !1;
        parseInt(this.m_bodyCount), b = this.s_stack;
        for (var e = this.m_bodyList; e; e = e.m_next) if (!(e.m_flags & k.e_islandFlag) && 0 != e.IsAwake() && 0 != e.IsActive() && e.GetType() != k.b2_staticBody) {
            g.Clear();
            var f = 0;
            for ((b[f++] = e).m_flags |= k.e_islandFlag; 0 < f; ) if (c = b[--f], g.AddBody(c), 
            0 == c.IsAwake() && c.SetAwake(!0), c.GetType() != k.b2_staticBody) {
                for (var m, r = c.m_contactList; r; r = r.next) r.contact.m_flags & l.e_islandFlag || 1 != r.contact.IsSensor() && 0 != r.contact.IsEnabled() && 0 != r.contact.IsTouching() && (g.AddContact(r.contact), 
                r.contact.m_flags |= l.e_islandFlag, (m = r.other).m_flags & k.e_islandFlag || ((b[f++] = m).m_flags |= k.e_islandFlag));
                for (c = c.m_jointList; c; c = c.next) 1 != c.joint.m_islandFlag && 0 != (m = c.other).IsActive() && (g.AddJoint(c.joint), 
                c.joint.m_islandFlag = !0, m.m_flags & k.e_islandFlag || ((b[f++] = m).m_flags |= k.e_islandFlag));
            }
            for (g.Solve(a, this.m_gravity, this.m_allowSleep), f = 0; f < g.m_bodyCount; ++f) (c = g.m_bodies[f]).GetType() == k.b2_staticBody && (c.m_flags &= ~k.e_islandFlag);
        }
        for (f = 0; f < b.length && b[f]; ++f) b[f] = null;
        for (c = this.m_bodyList; c; c = c.m_next) 0 == c.IsAwake() || 0 == c.IsActive() || c.GetType() != k.b2_staticBody && c.SynchronizeFixtures();
        this.m_contactManager.FindNewContacts();
    }, h.prototype.SolveTOI = function(a) {
        var c, g, b, e = this.m_island;
        e.Initialize(this.m_bodyCount, A.b2_maxTOIContactsPerIsland, A.b2_maxTOIJointsPerIsland, null, this.m_contactManager.m_contactListener, this.m_contactSolver);
        var f = h.s_queue;
        for (c = this.m_bodyList; c; c = c.m_next) c.m_flags &= ~k.e_islandFlag, c.m_sweep.t0 = 0;
        for (b = this.m_contactList; b; b = b.m_next) b.m_flags &= ~(l.e_toiFlag | l.e_islandFlag);
        for (b = this.m_jointList; b; b = b.m_next) b.m_islandFlag = !1;
        for (;;) {
            var m = null, r = 1;
            for (b = this.m_contactList; b; b = b.m_next) if (1 != b.IsSensor() && 0 != b.IsEnabled() && 0 != b.IsContinuous()) {
                if (c = 1, b.m_flags & l.e_toiFlag) c = b.m_toi; else {
                    if (c = b.m_fixtureA, g = b.m_fixtureB, c = c.m_body, g = g.m_body, !(c.GetType() == k.b2_dynamicBody && 0 != c.IsAwake() || g.GetType() == k.b2_dynamicBody && 0 != g.IsAwake())) continue;
                    var s = c.m_sweep.t0;
                    c.m_sweep.t0 < g.m_sweep.t0 ? (s = g.m_sweep.t0, c.m_sweep.Advance(s)) : g.m_sweep.t0 < c.m_sweep.t0 && (s = c.m_sweep.t0, 
                    g.m_sweep.Advance(s)), c = b.ComputeTOI(c.m_sweep, g.m_sweep), A.b2Assert(0 <= c && c <= 1), 
                    0 < c && c < 1 && 1 < (c = (1 - c) * s + c) && (c = 1), b.m_toi = c, b.m_flags |= l.e_toiFlag;
                }
                Number.MIN_VALUE < c && c < r && (m = b, r = c);
            }
            if (null == m || 1 - 100 * Number.MIN_VALUE < r) break;
            if (c = m.m_fixtureA, g = m.m_fixtureB, c = c.m_body, g = g.m_body, h.s_backupA.Set(c.m_sweep), 
            h.s_backupB.Set(g.m_sweep), c.Advance(r), g.Advance(r), m.Update(this.m_contactManager.m_contactListener), 
            m.m_flags &= ~l.e_toiFlag, 1 == m.IsSensor() || 0 == m.IsEnabled()) c.m_sweep.Set(h.s_backupA), 
            g.m_sweep.Set(h.s_backupB), c.SynchronizeTransform(), g.SynchronizeTransform(); else if (0 != m.IsTouching()) {
                for ((c = c).GetType() != k.b2_dynamicBody && (c = g), e.Clear(), m = b = 0, (f[b + m++] = c).m_flags |= k.e_islandFlag; 0 < m; ) if (c = f[b++], 
                --m, e.AddBody(c), 0 == c.IsAwake() && c.SetAwake(!0), c.GetType() == k.b2_dynamicBody) {
                    for (g = c.m_contactList; g && e.m_contactCount != e.m_contactCapacity; g = g.next) g.contact.m_flags & l.e_islandFlag || 1 != g.contact.IsSensor() && 0 != g.contact.IsEnabled() && 0 != g.contact.IsTouching() && (e.AddContact(g.contact), 
                    g.contact.m_flags |= l.e_islandFlag, (s = g.other).m_flags & k.e_islandFlag || (s.GetType() != k.b2_staticBody && (s.Advance(r), 
                    s.SetAwake(!0)), f[b + m] = s, ++m, s.m_flags |= k.e_islandFlag));
                    for (c = c.m_jointList; c; c = c.next) e.m_jointCount != e.m_jointCapacity && 1 != c.joint.m_islandFlag && 0 != (s = c.other).IsActive() && (e.AddJoint(c.joint), 
                    c.joint.m_islandFlag = !0, s.m_flags & k.e_islandFlag || (s.GetType() != k.b2_staticBody && (s.Advance(r), 
                    s.SetAwake(!0)), f[b + m] = s, ++m, s.m_flags |= k.e_islandFlag));
                }
                for ((b = h.s_timestep).warmStarting = !1, b.dt = (1 - r) * a.dt, b.inv_dt = 1 / b.dt, 
                b.dtRatio = 0, b.velocityIterations = a.velocityIterations, b.positionIterations = a.positionIterations, 
                e.SolveTOI(b), r = r = 0; r < e.m_bodyCount; ++r) if ((c = e.m_bodies[r]).m_flags &= ~k.e_islandFlag, 
                0 != c.IsAwake() && c.GetType() == k.b2_dynamicBody) for (c.SynchronizeFixtures(), 
                g = c.m_contactList; g; g = g.next) g.contact.m_flags &= ~l.e_toiFlag;
                for (r = 0; r < e.m_contactCount; ++r) (b = e.m_contacts[r]).m_flags &= ~(l.e_toiFlag | l.e_islandFlag);
                for (r = 0; r < e.m_jointCount; ++r) (b = e.m_joints[r]).m_islandFlag = !1;
                this.m_contactManager.FindNewContacts();
            }
        }
    }, h.prototype.DrawJoint = function(a) {
        var c = a.GetBodyA(), g = a.GetBodyB(), b = c.m_xf.position, e = g.m_xf.position, f = a.GetAnchorA(), m = a.GetAnchorB(), r = h.s_jointColor;
        switch (a.m_type) {
          case q.e_distanceJoint:
            this.m_debugDraw.DrawSegment(f, m, r);
            break;

          case q.e_pulleyJoint:
            a = (c = a instanceof n ? a : null).GetGroundAnchorA(), c = c.GetGroundAnchorB(), 
            this.m_debugDraw.DrawSegment(a, f, r), this.m_debugDraw.DrawSegment(c, m, r), this.m_debugDraw.DrawSegment(a, c, r);
            break;

          case q.e_mouseJoint:
            this.m_debugDraw.DrawSegment(f, m, r);
            break;

          default:
            c != this.m_groundBody && this.m_debugDraw.DrawSegment(b, f, r), this.m_debugDraw.DrawSegment(f, m, r), 
            g != this.m_groundBody && this.m_debugDraw.DrawSegment(e, m, r);
        }
    }, h.prototype.DrawShape = function(a, c, g) {
        switch (a.m_type) {
          case Y.e_circleShape:
            var b = a instanceof M ? a : null;
            this.m_debugDraw.DrawSolidCircle(F.MulX(c, b.m_p), b.m_radius, c.R.col1, g);
            break;

          case Y.e_polygonShape:
            b = 0, b = a instanceof W ? a : null, a = parseInt(b.GetVertexCount());
            var e = b.GetVertices(), f = new Vector(a);
            for (b = 0; b < a; ++b) f[b] = F.MulX(c, e[b]);
            this.m_debugDraw.DrawSolidPolygon(f, a, g);
            break;

          case Y.e_edgeShape:
            b = a instanceof L ? a : null, this.m_debugDraw.DrawSegment(F.MulX(c, b.GetVertex1()), F.MulX(c, b.GetVertex2()), g);
        }
    }, Box2D.postDefs.push(function() {
        Box2D.Dynamics.b2World.s_timestep2 = new d(), Box2D.Dynamics.b2World.s_xf = new K(), 
        Box2D.Dynamics.b2World.s_backupA = new G(), Box2D.Dynamics.b2World.s_backupB = new G(), 
        Box2D.Dynamics.b2World.s_timestep = new d(), Box2D.Dynamics.b2World.s_queue = new Vector(), 
        Box2D.Dynamics.b2World.s_jointColor = new w(.5, .8, .8), Box2D.Dynamics.b2World.e_newFixture = 1, 
        Box2D.Dynamics.b2World.e_locked = 2;
    });
}(), function() {
    var F = Box2D.Collision.Shapes.b2CircleShape, G = Box2D.Collision.Shapes.b2EdgeShape, K = Box2D.Collision.Shapes.b2PolygonShape, y = Box2D.Collision.Shapes.b2Shape, w = Box2D.Dynamics.Contacts.b2CircleContact, A = Box2D.Dynamics.Contacts.b2Contact, U = Box2D.Dynamics.Contacts.b2ContactConstraint, p = Box2D.Dynamics.Contacts.b2ContactConstraintPoint, B = Box2D.Dynamics.Contacts.b2ContactEdge, Q = Box2D.Dynamics.Contacts.b2ContactFactory, V = Box2D.Dynamics.Contacts.b2ContactRegister, M = Box2D.Dynamics.Contacts.b2ContactResult, L = Box2D.Dynamics.Contacts.b2ContactSolver, I = Box2D.Dynamics.Contacts.b2EdgeAndCircleContact, W = Box2D.Dynamics.Contacts.b2NullContact, Y = Box2D.Dynamics.Contacts.b2PolyAndCircleContact, k = Box2D.Dynamics.Contacts.b2PolyAndEdgeContact, z = Box2D.Dynamics.Contacts.b2PolygonContact, u = Box2D.Dynamics.Contacts.b2PositionSolverManifold, D = Box2D.Dynamics.b2Body, H = Box2D.Dynamics.b2TimeStep, O = Box2D.Common.b2Settings, E = Box2D.Common.Math.b2Mat22, R = Box2D.Common.Math.b2Math, N = Box2D.Common.Math.b2Vec2, S = Box2D.Collision.b2Collision, aa = Box2D.Collision.b2ContactID, Z = Box2D.Collision.b2Manifold, d = Box2D.Collision.b2TimeOfImpact, h = Box2D.Collision.b2TOIInput, l = Box2D.Collision.b2WorldManifold;
    Box2D.inherit(w, Box2D.Dynamics.Contacts.b2Contact), w.prototype.__super = Box2D.Dynamics.Contacts.b2Contact.prototype, 
    w.b2CircleContact = function() {
        Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this, arguments);
    }, w.Create = function() {
        return new w();
    }, w.Destroy = function() {}, w.prototype.Reset = function(j, o) {
        this.__super.Reset.call(this, j, o);
    }, w.prototype.Evaluate = function() {
        var j = this.m_fixtureA.GetBody(), o = this.m_fixtureB.GetBody();
        S.CollideCircles(this.m_manifold, this.m_fixtureA.GetShape() instanceof F ? this.m_fixtureA.GetShape() : null, j.m_xf, this.m_fixtureB.GetShape() instanceof F ? this.m_fixtureB.GetShape() : null, o.m_xf);
    }, A.b2Contact = function() {
        this.m_nodeA = new B(), this.m_nodeB = new B(), this.m_manifold = new Z(), this.m_oldManifold = new Z();
    }, A.prototype.GetManifold = function() {
        return this.m_manifold;
    }, A.prototype.GetWorldManifold = function(j) {
        var o = this.m_fixtureA.GetBody(), q = this.m_fixtureB.GetBody(), n = this.m_fixtureA.GetShape(), a = this.m_fixtureB.GetShape();
        j.Initialize(this.m_manifold, o.GetTransform(), n.m_radius, q.GetTransform(), a.m_radius);
    }, A.prototype.IsTouching = function() {
        return (this.m_flags & A.e_touchingFlag) == A.e_touchingFlag;
    }, A.prototype.IsContinuous = function() {
        return (this.m_flags & A.e_continuousFlag) == A.e_continuousFlag;
    }, A.prototype.SetSensor = function(j) {
        j ? this.m_flags |= A.e_sensorFlag : this.m_flags &= ~A.e_sensorFlag;
    }, A.prototype.IsSensor = function() {
        return (this.m_flags & A.e_sensorFlag) == A.e_sensorFlag;
    }, A.prototype.SetEnabled = function(j) {
        j ? this.m_flags |= A.e_enabledFlag : this.m_flags &= ~A.e_enabledFlag;
    }, A.prototype.IsEnabled = function() {
        return (this.m_flags & A.e_enabledFlag) == A.e_enabledFlag;
    }, A.prototype.GetNext = function() {
        return this.m_next;
    }, A.prototype.GetFixtureA = function() {
        return this.m_fixtureA;
    }, A.prototype.GetFixtureB = function() {
        return this.m_fixtureB;
    }, A.prototype.FlagForFiltering = function() {
        this.m_flags |= A.e_filterFlag;
    }, A.prototype.b2Contact = function() {}, A.prototype.Reset = function(j, o) {
        if (void 0 === j && (j = null), void 0 === o && (o = null), this.m_flags = A.e_enabledFlag, 
        j && o) {
            (j.IsSensor() || o.IsSensor()) && (this.m_flags |= A.e_sensorFlag);
            var q = j.GetBody(), n = o.GetBody();
            (q.GetType() != D.b2_dynamicBody || q.IsBullet() || n.GetType() != D.b2_dynamicBody || n.IsBullet()) && (this.m_flags |= A.e_continuousFlag), 
            this.m_fixtureA = j, this.m_fixtureB = o, this.m_manifold.m_pointCount = 0, this.m_next = this.m_prev = null, 
            this.m_nodeA.contact = null, this.m_nodeA.prev = null, this.m_nodeA.next = null, 
            this.m_nodeA.other = null, this.m_nodeB.contact = null, this.m_nodeB.prev = null, 
            this.m_nodeB.next = null, this.m_nodeB.other = null;
        } else this.m_fixtureB = this.m_fixtureA = null;
    }, A.prototype.Update = function(j) {
        var o = this.m_oldManifold;
        this.m_oldManifold = this.m_manifold, this.m_manifold = o, this.m_flags |= A.e_enabledFlag;
        var q = !1;
        o = (this.m_flags & A.e_touchingFlag) == A.e_touchingFlag;
        var n = this.m_fixtureA.m_body, a = this.m_fixtureB.m_body, c = this.m_fixtureA.m_aabb.TestOverlap(this.m_fixtureB.m_aabb);
        if (this.m_flags & A.e_sensorFlag) c && (q = this.m_fixtureA.GetShape(), c = this.m_fixtureB.GetShape(), 
        n = n.GetTransform(), a = a.GetTransform(), q = y.TestOverlap(q, n, c, a)), this.m_manifold.m_pointCount = 0; else {
            if (n.GetType() != D.b2_dynamicBody || n.IsBullet() || a.GetType() != D.b2_dynamicBody || a.IsBullet() ? this.m_flags |= A.e_continuousFlag : this.m_flags &= ~A.e_continuousFlag, 
            c) for (this.Evaluate(), q = 0 < this.m_manifold.m_pointCount, c = 0; c < this.m_manifold.m_pointCount; ++c) {
                var g = this.m_manifold.m_points[c];
                g.m_normalImpulse = 0, g.m_tangentImpulse = 0;
                for (var b = g.m_id, e = 0; e < this.m_oldManifold.m_pointCount; ++e) {
                    var f = this.m_oldManifold.m_points[e];
                    if (f.m_id.key == b.key) {
                        g.m_normalImpulse = f.m_normalImpulse, g.m_tangentImpulse = f.m_tangentImpulse;
                        break;
                    }
                }
            } else this.m_manifold.m_pointCount = 0;
            q != o && (n.SetAwake(!0), a.SetAwake(!0));
        }
        q ? this.m_flags |= A.e_touchingFlag : this.m_flags &= ~A.e_touchingFlag, 0 == o && 1 == q && j.BeginContact(this), 
        1 == o && 0 == q && j.EndContact(this), 0 == (this.m_flags & A.e_sensorFlag) && j.PreSolve(this, this.m_oldManifold);
    }, A.prototype.Evaluate = function() {}, A.prototype.ComputeTOI = function(j, o) {
        return A.s_input.proxyA.Set(this.m_fixtureA.GetShape()), A.s_input.proxyB.Set(this.m_fixtureB.GetShape()), 
        A.s_input.sweepA = j, A.s_input.sweepB = o, A.s_input.tolerance = O.b2_linearSlop, 
        d.TimeOfImpact(A.s_input);
    }, Box2D.postDefs.push(function() {
        Box2D.Dynamics.Contacts.b2Contact.e_sensorFlag = 1, Box2D.Dynamics.Contacts.b2Contact.e_continuousFlag = 2, 
        Box2D.Dynamics.Contacts.b2Contact.e_islandFlag = 4, Box2D.Dynamics.Contacts.b2Contact.e_toiFlag = 8, 
        Box2D.Dynamics.Contacts.b2Contact.e_touchingFlag = 16, Box2D.Dynamics.Contacts.b2Contact.e_enabledFlag = 32, 
        Box2D.Dynamics.Contacts.b2Contact.e_filterFlag = 64, Box2D.Dynamics.Contacts.b2Contact.s_input = new h();
    }), U.b2ContactConstraint = function() {
        this.localPlaneNormal = new N(), this.localPoint = new N(), this.normal = new N(), 
        this.normalMass = new E(), this.K = new E();
    }, U.prototype.b2ContactConstraint = function() {
        this.points = new Vector(O.b2_maxManifoldPoints);
        for (var j = 0; j < O.b2_maxManifoldPoints; j++) this.points[j] = new p();
    }, p.b2ContactConstraintPoint = function() {
        this.localPoint = new N(), this.rA = new N(), this.rB = new N();
    }, B.b2ContactEdge = function() {}, Q.b2ContactFactory = function() {}, Q.prototype.b2ContactFactory = function(j) {
        this.m_allocator = j, this.InitializeRegisters();
    }, Q.prototype.AddType = function(j, o, q, n) {
        void 0 === q && (q = 0), void 0 === n && (n = 0), this.m_registers[q][n].createFcn = j, 
        this.m_registers[q][n].destroyFcn = o, this.m_registers[q][n].primary = !0, q != n && (this.m_registers[n][q].createFcn = j, 
        this.m_registers[n][q].destroyFcn = o, this.m_registers[n][q].primary = !1);
    }, Q.prototype.InitializeRegisters = function() {
        this.m_registers = new Vector(y.e_shapeTypeCount);
        for (var j = 0; j < y.e_shapeTypeCount; j++) {
            this.m_registers[j] = new Vector(y.e_shapeTypeCount);
            for (var o = 0; o < y.e_shapeTypeCount; o++) this.m_registers[j][o] = new V();
        }
        this.AddType(w.Create, w.Destroy, y.e_circleShape, y.e_circleShape), this.AddType(Y.Create, Y.Destroy, y.e_polygonShape, y.e_circleShape), 
        this.AddType(z.Create, z.Destroy, y.e_polygonShape, y.e_polygonShape), this.AddType(I.Create, I.Destroy, y.e_edgeShape, y.e_circleShape), 
        this.AddType(k.Create, k.Destroy, y.e_polygonShape, y.e_edgeShape);
    }, Q.prototype.Create = function(j, o) {
        var q = parseInt(j.GetType()), n = parseInt(o.GetType());
        return (q = this.m_registers[q][n]).pool ? (n = q.pool, q.pool = n.m_next, q.poolCount--, 
        n.Reset(j, o), n) : null != (n = q.createFcn) ? (q.primary ? (n = n(this.m_allocator)).Reset(j, o) : (n = n(this.m_allocator)).Reset(o, j), 
        n) : null;
    }, Q.prototype.Destroy = function(j) {
        0 < j.m_manifold.m_pointCount && (j.m_fixtureA.m_body.SetAwake(!0), j.m_fixtureB.m_body.SetAwake(!0));
        var o = parseInt(j.m_fixtureA.GetType()), q = parseInt(j.m_fixtureB.GetType());
        (o = this.m_registers[o][q]).poolCount++, j.m_next = o.pool, o.pool = j, (o = o.destroyFcn)(j, this.m_allocator);
    }, V.b2ContactRegister = function() {}, M.b2ContactResult = function() {
        this.position = new N(), this.normal = new N(), this.id = new aa();
    }, L.b2ContactSolver = function() {
        this.m_step = new H(), this.m_constraints = new Vector();
    }, L.prototype.b2ContactSolver = function() {}, L.prototype.Initialize = function(j, o, q, n) {
        var a;
        for (void 0 === q && (q = 0), this.m_step.Set(j), this.m_allocator = n, j = 0, this.m_constraintCount = q; this.m_constraints.length < this.m_constraintCount; ) this.m_constraints[this.m_constraints.length] = new U();
        for (j = 0; j < q; ++j) {
            n = (a = o[j]).m_fixtureA;
            var c = a.m_fixtureB, g = n.m_shape.m_radius, b = c.m_shape.m_radius, e = n.m_body, f = c.m_body, m = a.GetManifold(), r = O.b2MixFriction(n.GetFriction(), c.GetFriction()), s = O.b2MixRestitution(n.GetRestitution(), c.GetRestitution()), v = e.m_linearVelocity.x, t = e.m_linearVelocity.y, x = f.m_linearVelocity.x, C = f.m_linearVelocity.y, J = e.m_angularVelocity, T = f.m_angularVelocity;
            for (O.b2Assert(0 < m.m_pointCount), L.s_worldManifold.Initialize(m, e.m_xf, g, f.m_xf, b), 
            c = L.s_worldManifold.m_normal.x, a = L.s_worldManifold.m_normal.y, (n = this.m_constraints[j]).bodyA = e, 
            n.bodyB = f, n.manifold = m, n.normal.x = c, n.normal.y = a, n.pointCount = m.m_pointCount, 
            n.friction = r, n.restitution = s, n.localPlaneNormal.x = m.m_localPlaneNormal.x, 
            n.localPlaneNormal.y = m.m_localPlaneNormal.y, n.localPoint.x = m.m_localPoint.x, 
            n.localPoint.y = m.m_localPoint.y, n.radius = g + b, n.type = m.m_type, g = 0; g < n.pointCount; ++g) {
                r = m.m_points[g], (b = n.points[g]).normalImpulse = r.m_normalImpulse, b.tangentImpulse = r.m_tangentImpulse, 
                b.localPoint.SetV(r.m_localPoint), r = b.rA.x = L.s_worldManifold.m_points[g].x - e.m_sweep.c.x, 
                s = b.rA.y = L.s_worldManifold.m_points[g].y - e.m_sweep.c.y;
                var P = b.rB.x = L.s_worldManifold.m_points[g].x - f.m_sweep.c.x, X = b.rB.y = L.s_worldManifold.m_points[g].y - f.m_sweep.c.y, $ = r * a - s * c, ba = P * a - X * c;
                $ *= $, ba *= ba, b.normalMass = 1 / (e.m_invMass + f.m_invMass + e.m_invI * $ + f.m_invI * ba);
                var ca = e.m_mass * e.m_invMass + f.m_mass * f.m_invMass;
                ca += e.m_mass * e.m_invI * $ + f.m_mass * f.m_invI * ba, b.equalizedMass = 1 / ca, 
                $ = r * (ca = -c) - s * (ba = a), ba = P * ca - X * ba, $ *= $, ba *= ba, b.tangentMass = 1 / (e.m_invMass + f.m_invMass + e.m_invI * $ + f.m_invI * ba), 
                b.velocityBias = 0, (r = n.normal.x * (x + -T * X - v - -J * s) + n.normal.y * (C + T * P - t - J * r)) < -O.b2_velocityThreshold && (b.velocityBias += -n.restitution * r);
            }
            2 == n.pointCount && (C = n.points[0], x = n.points[1], m = e.m_invMass, e = e.m_invI, 
            v = f.m_invMass, f = f.m_invI, t = C.rA.x * a - C.rA.y * c, C = C.rB.x * a - C.rB.y * c, 
            J = x.rA.x * a - x.rA.y * c, x = x.rB.x * a - x.rB.y * c, (c = m + v + e * t * t + f * C * C) * c < 100 * (c * (a = m + v + e * J * J + f * x * x) - (f = m + v + e * t * J + f * C * x) * f) ? (n.K.col1.Set(c, f), 
            n.K.col2.Set(f, a), n.K.GetInverse(n.normalMass)) : n.pointCount = 1);
        }
    }, L.prototype.InitVelocityConstraints = function(j) {
        for (var o = 0; o < this.m_constraintCount; ++o) {
            var q = this.m_constraints[o], n = q.bodyA, a = q.bodyB, c = n.m_invMass, g = n.m_invI, b = a.m_invMass, e = a.m_invI, f = q.normal.x, m = q.normal.y, r = m, s = -f, v = 0, t = 0;
            if (j.warmStarting) for (t = q.pointCount, v = 0; v < t; ++v) {
                var x = q.points[v];
                x.normalImpulse *= j.dtRatio, x.tangentImpulse *= j.dtRatio;
                var C = x.normalImpulse * f + x.tangentImpulse * r, J = x.normalImpulse * m + x.tangentImpulse * s;
                n.m_angularVelocity -= g * (x.rA.x * J - x.rA.y * C), n.m_linearVelocity.x -= c * C, 
                n.m_linearVelocity.y -= c * J, a.m_angularVelocity += e * (x.rB.x * J - x.rB.y * C), 
                a.m_linearVelocity.x += b * C, a.m_linearVelocity.y += b * J;
            } else for (t = q.pointCount, v = 0; v < t; ++v) (n = q.points[v]).normalImpulse = 0, 
            n.tangentImpulse = 0;
        }
    }, L.prototype.SolveVelocityConstraints = function() {
        for (var o, f, j = 0, q = 0, n = 0, a = 0, c = n = n = q = q = 0, g = q = q = 0, b = q = a = 0, e = 0, m = 0; m < this.m_constraintCount; ++m) {
            var r = (a = this.m_constraints[m]).bodyA, s = a.bodyB, v = r.m_angularVelocity, t = s.m_angularVelocity, x = r.m_linearVelocity, C = s.m_linearVelocity, J = r.m_invMass, T = r.m_invI, P = s.m_invMass, X = s.m_invI;
            b = a.normal.x;
            var $ = e = a.normal.y;
            for (f = -b, g = a.friction, j = 0; j < a.pointCount; j++) o = a.points[j], q = (q = C.x - t * o.rB.y - x.x + v * o.rA.y) * $ + (n = C.y + t * o.rB.x - x.y - v * o.rA.x) * f, 
            q = o.tangentMass * -q, n = g * o.normalImpulse, c = (q = (n = R.Clamp(o.tangentImpulse + q, -n, n)) - o.tangentImpulse) * $, 
            q *= f, x.x -= J * c, x.y -= J * q, v -= T * (o.rA.x * q - o.rA.y * c), C.x += P * c, 
            C.y += P * q, t += X * (o.rB.x * q - o.rB.y * c), o.tangentImpulse = n;
            if (parseInt(a.pointCount), 1 == a.pointCount) o = a.points[0], a = (q = C.x + -t * o.rB.y - x.x - -v * o.rA.y) * b + (n = C.y + t * o.rB.x - x.y - v * o.rA.x) * e, 
            q = -o.normalMass * (a - o.velocityBias), c = (q = (n = 0 < (n = o.normalImpulse + q) ? n : 0) - o.normalImpulse) * b, 
            q *= e, x.x -= J * c, x.y -= J * q, v -= T * (o.rA.x * q - o.rA.y * c), C.x += P * c, 
            C.y += P * q, t += X * (o.rB.x * q - o.rB.y * c), o.normalImpulse = n; else {
                o = a.points[0], j = a.points[1], q = o.normalImpulse, g = j.normalImpulse;
                var ba = (C.x - t * o.rB.y - x.x + v * o.rA.y) * b + (C.y + t * o.rB.x - x.y - v * o.rA.x) * e, ca = (C.x - t * j.rB.y - x.x + v * j.rA.y) * b + (C.y + t * j.rB.x - x.y - v * j.rA.x) * e;
                for (n = ba - o.velocityBias, c = ca - j.velocityBias, n -= (f = a.K).col1.x * q + f.col2.x * g, 
                c -= f.col1.y * q + f.col2.y * g; ;) {
                    if ($ = -((f = a.normalMass).col1.x * n + f.col2.x * c), f = -(f.col1.y * n + f.col2.y * c), 
                    0 <= $ && 0 <= f) {
                        a = (q = $ - q) * b, q *= e, b *= g = f - g, e *= g, x.x -= J * (a + b), x.y -= J * (q + e), 
                        v -= T * (o.rA.x * q - o.rA.y * a + j.rA.x * e - j.rA.y * b), C.x += P * (a + b), 
                        C.y += P * (q + e), t += X * (o.rB.x * q - o.rB.y * a + j.rB.x * e - j.rB.y * b), 
                        o.normalImpulse = $, j.normalImpulse = f;
                        break;
                    }
                    if ($ = -o.normalMass * n, f = 0, ca = a.K.col1.y * $ + c, 0 <= $ && 0 <= ca) {
                        a = (q = $ - q) * b, q *= e, b *= g = f - g, e *= g, x.x -= J * (a + b), x.y -= J * (q + e), 
                        v -= T * (o.rA.x * q - o.rA.y * a + j.rA.x * e - j.rA.y * b), C.x += P * (a + b), 
                        C.y += P * (q + e), t += X * (o.rB.x * q - o.rB.y * a + j.rB.x * e - j.rB.y * b), 
                        o.normalImpulse = $, j.normalImpulse = f;
                        break;
                    }
                    if ($ = 0, f = -j.normalMass * c, ba = a.K.col2.x * f + n, 0 <= f && 0 <= ba) {
                        a = (q = $ - q) * b, q *= e, b *= g = f - g, e *= g, x.x -= J * (a + b), x.y -= J * (q + e), 
                        v -= T * (o.rA.x * q - o.rA.y * a + j.rA.x * e - j.rA.y * b), C.x += P * (a + b), 
                        C.y += P * (q + e), t += X * (o.rB.x * q - o.rB.y * a + j.rB.x * e - j.rB.y * b), 
                        o.normalImpulse = $, j.normalImpulse = f;
                        break;
                    }
                    if (f = $ = 0, ca = c, 0 <= (ba = n) && 0 <= ca) {
                        a = (q = $ - q) * b, q *= e, b *= g = f - g, e *= g, x.x -= J * (a + b), x.y -= J * (q + e), 
                        v -= T * (o.rA.x * q - o.rA.y * a + j.rA.x * e - j.rA.y * b), C.x += P * (a + b), 
                        C.y += P * (q + e), t += X * (o.rB.x * q - o.rB.y * a + j.rB.x * e - j.rB.y * b), 
                        o.normalImpulse = $, j.normalImpulse = f;
                        break;
                    }
                    break;
                }
            }
            r.m_angularVelocity = v, s.m_angularVelocity = t;
        }
    }, L.prototype.FinalizeVelocityConstraints = function() {
        for (var j = 0; j < this.m_constraintCount; ++j) for (var o = this.m_constraints[j], q = o.manifold, n = 0; n < o.pointCount; ++n) {
            var a = q.m_points[n], c = o.points[n];
            a.m_normalImpulse = c.normalImpulse, a.m_tangentImpulse = c.tangentImpulse;
        }
    }, L.prototype.SolvePositionConstraints = function(j) {
        void 0 === j && (j = 0);
        for (var o = 0, q = 0; q < this.m_constraintCount; q++) {
            var n = this.m_constraints[q], a = n.bodyA, c = n.bodyB, g = a.m_mass * a.m_invMass, b = a.m_mass * a.m_invI, e = c.m_mass * c.m_invMass, f = c.m_mass * c.m_invI;
            L.s_psm.Initialize(n);
            for (var m = L.s_psm.m_normal, r = 0; r < n.pointCount; r++) {
                var s = n.points[r], v = L.s_psm.m_points[r], t = L.s_psm.m_separations[r], x = v.x - a.m_sweep.c.x, C = v.y - a.m_sweep.c.y, J = v.x - c.m_sweep.c.x;
                v = v.y - c.m_sweep.c.y, o = o < t ? o : t, t = R.Clamp(j * (t + O.b2_linearSlop), -O.b2_maxLinearCorrection, 0), 
                s = (t = -s.equalizedMass * t) * m.x, t *= m.y, a.m_sweep.c.x -= g * s, a.m_sweep.c.y -= g * t, 
                a.m_sweep.a -= b * (x * t - C * s), a.SynchronizeTransform(), c.m_sweep.c.x += e * s, 
                c.m_sweep.c.y += e * t, c.m_sweep.a += f * (J * t - v * s), c.SynchronizeTransform();
            }
        }
        return o > -1.5 * O.b2_linearSlop;
    }, Box2D.postDefs.push(function() {
        Box2D.Dynamics.Contacts.b2ContactSolver.s_worldManifold = new l(), Box2D.Dynamics.Contacts.b2ContactSolver.s_psm = new u();
    }), Box2D.inherit(I, Box2D.Dynamics.Contacts.b2Contact), I.prototype.__super = Box2D.Dynamics.Contacts.b2Contact.prototype, 
    I.b2EdgeAndCircleContact = function() {
        Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this, arguments);
    }, I.Create = function() {
        return new I();
    }, I.Destroy = function() {}, I.prototype.Reset = function(j, o) {
        this.__super.Reset.call(this, j, o);
    }, I.prototype.Evaluate = function() {
        var j = this.m_fixtureA.GetBody(), o = this.m_fixtureB.GetBody();
        this.b2CollideEdgeAndCircle(this.m_manifold, this.m_fixtureA.GetShape() instanceof G ? this.m_fixtureA.GetShape() : null, j.m_xf, this.m_fixtureB.GetShape() instanceof F ? this.m_fixtureB.GetShape() : null, o.m_xf);
    }, I.prototype.b2CollideEdgeAndCircle = function() {}, Box2D.inherit(W, Box2D.Dynamics.Contacts.b2Contact), 
    W.prototype.__super = Box2D.Dynamics.Contacts.b2Contact.prototype, W.b2NullContact = function() {
        Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this, arguments);
    }, W.prototype.b2NullContact = function() {
        this.__super.b2Contact.call(this);
    }, W.prototype.Evaluate = function() {}, Box2D.inherit(Y, Box2D.Dynamics.Contacts.b2Contact), 
    Y.prototype.__super = Box2D.Dynamics.Contacts.b2Contact.prototype, Y.b2PolyAndCircleContact = function() {
        Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this, arguments);
    }, Y.Create = function() {
        return new Y();
    }, Y.Destroy = function() {}, Y.prototype.Reset = function(j, o) {
        this.__super.Reset.call(this, j, o), O.b2Assert(j.GetType() == y.e_polygonShape), 
        O.b2Assert(o.GetType() == y.e_circleShape);
    }, Y.prototype.Evaluate = function() {
        var j = this.m_fixtureA.m_body, o = this.m_fixtureB.m_body;
        S.CollidePolygonAndCircle(this.m_manifold, this.m_fixtureA.GetShape() instanceof K ? this.m_fixtureA.GetShape() : null, j.m_xf, this.m_fixtureB.GetShape() instanceof F ? this.m_fixtureB.GetShape() : null, o.m_xf);
    }, Box2D.inherit(k, Box2D.Dynamics.Contacts.b2Contact), k.prototype.__super = Box2D.Dynamics.Contacts.b2Contact.prototype, 
    k.b2PolyAndEdgeContact = function() {
        Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this, arguments);
    }, k.Create = function() {
        return new k();
    }, k.Destroy = function() {}, k.prototype.Reset = function(j, o) {
        this.__super.Reset.call(this, j, o), O.b2Assert(j.GetType() == y.e_polygonShape), 
        O.b2Assert(o.GetType() == y.e_edgeShape);
    }, k.prototype.Evaluate = function() {
        var j = this.m_fixtureA.GetBody(), o = this.m_fixtureB.GetBody();
        this.b2CollidePolyAndEdge(this.m_manifold, this.m_fixtureA.GetShape() instanceof K ? this.m_fixtureA.GetShape() : null, j.m_xf, this.m_fixtureB.GetShape() instanceof G ? this.m_fixtureB.GetShape() : null, o.m_xf);
    }, k.prototype.b2CollidePolyAndEdge = function() {}, Box2D.inherit(z, Box2D.Dynamics.Contacts.b2Contact), 
    z.prototype.__super = Box2D.Dynamics.Contacts.b2Contact.prototype, z.b2PolygonContact = function() {
        Box2D.Dynamics.Contacts.b2Contact.b2Contact.apply(this, arguments);
    }, z.Create = function() {
        return new z();
    }, z.Destroy = function() {}, z.prototype.Reset = function(j, o) {
        this.__super.Reset.call(this, j, o);
    }, z.prototype.Evaluate = function() {
        var j = this.m_fixtureA.GetBody(), o = this.m_fixtureB.GetBody();
        S.CollidePolygons(this.m_manifold, this.m_fixtureA.GetShape() instanceof K ? this.m_fixtureA.GetShape() : null, j.m_xf, this.m_fixtureB.GetShape() instanceof K ? this.m_fixtureB.GetShape() : null, o.m_xf);
    }, u.b2PositionSolverManifold = function() {}, u.prototype.b2PositionSolverManifold = function() {
        this.m_normal = new N(), this.m_separations = new Vector_a2j_Number(O.b2_maxManifoldPoints), 
        this.m_points = new Vector(O.b2_maxManifoldPoints);
        for (var j = 0; j < O.b2_maxManifoldPoints; j++) this.m_points[j] = new N();
    }, u.prototype.Initialize = function(j) {
        O.b2Assert(0 < j.pointCount);
        var a, o = 0, q = 0, n = 0, c = 0, g = 0;
        switch (j.type) {
          case Z.e_circles:
            a = j.bodyA.m_xf.R, n = j.localPoint, o = j.bodyA.m_xf.position.x + (a.col1.x * n.x + a.col2.x * n.y), 
            q = j.bodyA.m_xf.position.y + (a.col1.y * n.x + a.col2.y * n.y), a = j.bodyB.m_xf.R, 
            n = j.points[0].localPoint, c = j.bodyB.m_xf.position.x + (a.col1.x * n.x + a.col2.x * n.y), 
            a = j.bodyB.m_xf.position.y + (a.col1.y * n.x + a.col2.y * n.y);
            var b = (n = c - o) * n + (g = a - q) * g;
            b > Number.MIN_VALUE * Number.MIN_VALUE ? (b = Math.sqrt(b), this.m_normal.x = n / b, 
            this.m_normal.y = g / b) : (this.m_normal.x = 1, this.m_normal.y = 0), this.m_points[0].x = .5 * (o + c), 
            this.m_points[0].y = .5 * (q + a), this.m_separations[0] = n * this.m_normal.x + g * this.m_normal.y - j.radius;
            break;

          case Z.e_faceA:
            for (a = j.bodyA.m_xf.R, n = j.localPlaneNormal, this.m_normal.x = a.col1.x * n.x + a.col2.x * n.y, 
            this.m_normal.y = a.col1.y * n.x + a.col2.y * n.y, a = j.bodyA.m_xf.R, n = j.localPoint, 
            c = j.bodyA.m_xf.position.x + (a.col1.x * n.x + a.col2.x * n.y), g = j.bodyA.m_xf.position.y + (a.col1.y * n.x + a.col2.y * n.y), 
            a = j.bodyB.m_xf.R, o = 0; o < j.pointCount; ++o) n = j.points[o].localPoint, q = j.bodyB.m_xf.position.x + (a.col1.x * n.x + a.col2.x * n.y), 
            n = j.bodyB.m_xf.position.y + (a.col1.y * n.x + a.col2.y * n.y), this.m_separations[o] = (q - c) * this.m_normal.x + (n - g) * this.m_normal.y - j.radius, 
            this.m_points[o].x = q, this.m_points[o].y = n;
            break;

          case Z.e_faceB:
            for (a = j.bodyB.m_xf.R, n = j.localPlaneNormal, this.m_normal.x = a.col1.x * n.x + a.col2.x * n.y, 
            this.m_normal.y = a.col1.y * n.x + a.col2.y * n.y, a = j.bodyB.m_xf.R, n = j.localPoint, 
            c = j.bodyB.m_xf.position.x + (a.col1.x * n.x + a.col2.x * n.y), g = j.bodyB.m_xf.position.y + (a.col1.y * n.x + a.col2.y * n.y), 
            a = j.bodyA.m_xf.R, o = 0; o < j.pointCount; ++o) n = j.points[o].localPoint, q = j.bodyA.m_xf.position.x + (a.col1.x * n.x + a.col2.x * n.y), 
            n = j.bodyA.m_xf.position.y + (a.col1.y * n.x + a.col2.y * n.y), this.m_separations[o] = (q - c) * this.m_normal.x + (n - g) * this.m_normal.y - j.radius, 
            this.m_points[o].Set(q, n);
            this.m_normal.x *= -1, this.m_normal.y *= -1;
        }
    }, Box2D.postDefs.push(function() {
        Box2D.Dynamics.Contacts.b2PositionSolverManifold.circlePointA = new N(), Box2D.Dynamics.Contacts.b2PositionSolverManifold.circlePointB = new N();
    });
}(), function() {
    var F = Box2D.Common.Math.b2Mat22, G = Box2D.Common.Math.b2Math, K = Box2D.Common.Math.b2Vec2, y = Box2D.Common.b2Color, w = Box2D.Dynamics.Controllers.b2BuoyancyController, A = Box2D.Dynamics.Controllers.b2ConstantAccelController, U = Box2D.Dynamics.Controllers.b2ConstantForceController, p = Box2D.Dynamics.Controllers.b2Controller, B = Box2D.Dynamics.Controllers.b2ControllerEdge, Q = Box2D.Dynamics.Controllers.b2GravityController, V = Box2D.Dynamics.Controllers.b2TensorDampingController;
    Box2D.inherit(w, Box2D.Dynamics.Controllers.b2Controller), w.prototype.__super = Box2D.Dynamics.Controllers.b2Controller.prototype, 
    w.b2BuoyancyController = function() {
        Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this, arguments), this.normal = new K(0, -1), 
        this.density = this.offset = 0, this.velocity = new K(0, 0), this.linearDrag = 2, 
        this.angularDrag = 1, this.useDensity = !1, this.useWorldGravity = !0, this.gravity = null;
    }, w.prototype.Step = function() {
        if (this.m_bodyList) {
            this.useWorldGravity && (this.gravity = this.GetWorld().GetGravity().Copy());
            for (var M = this.m_bodyList; M; M = M.nextBody) {
                var L = M.body;
                if (0 != L.IsAwake()) {
                    for (var I = new K(), W = new K(), Y = 0, k = 0, z = L.GetFixtureList(); z; z = z.GetNext()) {
                        var u = new K(), D = z.GetShape().ComputeSubmergedArea(this.normal, this.offset, L.GetTransform(), u);
                        Y += D, I.x += D * u.x, I.y += D * u.y;
                        k += 1 * D, W.x += D * u.x * 1, W.y += D * u.y * 1;
                    }
                    I.x /= Y, I.y /= Y, W.x /= k, W.y /= k, Y < Number.MIN_VALUE || ((k = this.gravity.GetNegative()).Multiply(this.density * Y), 
                    L.ApplyForce(k, W), (W = L.GetLinearVelocityFromWorldPoint(I)).Subtract(this.velocity), 
                    W.Multiply(-this.linearDrag * Y), L.ApplyForce(W, I), L.ApplyTorque(-L.GetInertia() / L.GetMass() * Y * L.GetAngularVelocity() * this.angularDrag));
                }
            }
        }
    }, w.prototype.Draw = function(M) {
        var L = new K(), I = new K();
        L.x = this.normal.x * this.offset + 1e3 * this.normal.y, L.y = this.normal.y * this.offset - 1e3 * this.normal.x, 
        I.x = this.normal.x * this.offset - 1e3 * this.normal.y, I.y = this.normal.y * this.offset + 1e3 * this.normal.x;
        var W = new y(0, 0, 1);
        M.DrawSegment(L, I, W);
    }, Box2D.inherit(A, Box2D.Dynamics.Controllers.b2Controller), A.prototype.__super = Box2D.Dynamics.Controllers.b2Controller.prototype, 
    A.b2ConstantAccelController = function() {
        Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this, arguments), this.A = new K(0, 0);
    }, A.prototype.Step = function(M) {
        M = new K(this.A.x * M.dt, this.A.y * M.dt);
        for (var L = this.m_bodyList; L; L = L.nextBody) {
            var I = L.body;
            I.IsAwake() && I.SetLinearVelocity(new K(I.GetLinearVelocity().x + M.x, I.GetLinearVelocity().y + M.y));
        }
    }, Box2D.inherit(U, Box2D.Dynamics.Controllers.b2Controller), U.prototype.__super = Box2D.Dynamics.Controllers.b2Controller.prototype, 
    U.b2ConstantForceController = function() {
        Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this, arguments), this.F = new K(0, 0);
    }, U.prototype.Step = function() {
        for (var M = this.m_bodyList; M; M = M.nextBody) {
            var L = M.body;
            L.IsAwake() && L.ApplyForce(this.F, L.GetWorldCenter());
        }
    }, p.b2Controller = function() {}, p.prototype.Step = function() {}, p.prototype.Draw = function() {}, 
    p.prototype.AddBody = function(M) {
        var L = new B();
        L.controller = this, L.body = M, L.nextBody = this.m_bodyList, L.prevBody = null, 
        (this.m_bodyList = L).nextBody && (L.nextBody.prevBody = L), this.m_bodyCount++, 
        L.nextController = M.m_controllerList, L.prevController = null, (M.m_controllerList = L).nextController && (L.nextController.prevController = L), 
        M.m_controllerCount++;
    }, p.prototype.RemoveBody = function(M) {
        for (var L = M.m_controllerList; L && L.controller != this; ) L = L.nextController;
        L.prevBody && (L.prevBody.nextBody = L.nextBody), L.nextBody && (L.nextBody.prevBody = L.prevBody), 
        L.nextController && (L.nextController.prevController = L.prevController), L.prevController && (L.prevController.nextController = L.nextController), 
        this.m_bodyList == L && (this.m_bodyList = L.nextBody), M.m_controllerList == L && (M.m_controllerList = L.nextController), 
        M.m_controllerCount--, this.m_bodyCount--;
    }, p.prototype.Clear = function() {
        for (;this.m_bodyList; ) this.RemoveBody(this.m_bodyList.body);
    }, p.prototype.GetNext = function() {
        return this.m_next;
    }, p.prototype.GetWorld = function() {
        return this.m_world;
    }, p.prototype.GetBodyList = function() {
        return this.m_bodyList;
    }, B.b2ControllerEdge = function() {}, Box2D.inherit(Q, Box2D.Dynamics.Controllers.b2Controller), 
    Q.prototype.__super = Box2D.Dynamics.Controllers.b2Controller.prototype, Q.b2GravityController = function() {
        Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this, arguments), this.G = 1, 
        this.invSqr = !0;
    }, Q.prototype.Step = function() {
        var M = null, L = null, I = null, W = 0, Y = null, k = null, z = null, u = 0, D = 0, H = 0;
        if (u = null, this.invSqr) for (M = this.m_bodyList; M; M = M.nextBody) for (I = (L = M.body).GetWorldCenter(), 
        W = L.GetMass(), Y = this.m_bodyList; Y != M; Y = Y.nextBody) (H = (u = (z = (k = Y.body).GetWorldCenter()).x - I.x) * u + (D = z.y - I.y) * D) < Number.MIN_VALUE || ((u = new K(u, D)).Multiply(this.G / H / Math.sqrt(H) * W * k.GetMass()), 
        L.IsAwake() && L.ApplyForce(u, I), u.Multiply(-1), k.IsAwake() && k.ApplyForce(u, z)); else for (M = this.m_bodyList; M; M = M.nextBody) for (I = (L = M.body).GetWorldCenter(), 
        W = L.GetMass(), Y = this.m_bodyList; Y != M; Y = Y.nextBody) (H = (u = (z = (k = Y.body).GetWorldCenter()).x - I.x) * u + (D = z.y - I.y) * D) < Number.MIN_VALUE || ((u = new K(u, D)).Multiply(this.G / H * W * k.GetMass()), 
        L.IsAwake() && L.ApplyForce(u, I), u.Multiply(-1), k.IsAwake() && k.ApplyForce(u, z));
    }, Box2D.inherit(V, Box2D.Dynamics.Controllers.b2Controller), V.prototype.__super = Box2D.Dynamics.Controllers.b2Controller.prototype, 
    V.b2TensorDampingController = function() {
        Box2D.Dynamics.Controllers.b2Controller.b2Controller.apply(this, arguments), this.T = new F(), 
        this.maxTimestep = 0;
    }, V.prototype.SetAxisAligned = function(M, L) {
        void 0 === M && (M = 0), void 0 === L && (L = 0), this.T.col1.x = -M, this.T.col1.y = 0, 
        this.T.col2.x = 0, this.T.col2.y = -L, this.maxTimestep = 0 < M || 0 < L ? 1 / Math.max(M, L) : 0;
    }, V.prototype.Step = function(M) {
        if (!((M = M.dt) <= Number.MIN_VALUE)) {
            M > this.maxTimestep && 0 < this.maxTimestep && (M = this.maxTimestep);
            for (var L = this.m_bodyList; L; L = L.nextBody) {
                var I = L.body;
                if (I.IsAwake()) {
                    var W = I.GetWorldVector(G.MulMV(this.T, I.GetLocalVector(I.GetLinearVelocity())));
                    I.SetLinearVelocity(new K(I.GetLinearVelocity().x + W.x * M, I.GetLinearVelocity().y + W.y * M));
                }
            }
        }
    };
}(), function() {
    var F = Box2D.Common.b2Settings, G = Box2D.Common.Math.b2Mat22, K = Box2D.Common.Math.b2Mat33, y = Box2D.Common.Math.b2Math, w = Box2D.Common.Math.b2Vec2, A = Box2D.Common.Math.b2Vec3, U = Box2D.Dynamics.Joints.b2DistanceJoint, p = Box2D.Dynamics.Joints.b2DistanceJointDef, B = Box2D.Dynamics.Joints.b2FrictionJoint, Q = Box2D.Dynamics.Joints.b2FrictionJointDef, V = Box2D.Dynamics.Joints.b2GearJoint, M = Box2D.Dynamics.Joints.b2GearJointDef, L = Box2D.Dynamics.Joints.b2Jacobian, I = Box2D.Dynamics.Joints.b2Joint, W = Box2D.Dynamics.Joints.b2JointDef, Y = Box2D.Dynamics.Joints.b2JointEdge, k = Box2D.Dynamics.Joints.b2LineJoint, z = Box2D.Dynamics.Joints.b2LineJointDef, u = Box2D.Dynamics.Joints.b2MouseJoint, D = Box2D.Dynamics.Joints.b2MouseJointDef, H = Box2D.Dynamics.Joints.b2PrismaticJoint, O = Box2D.Dynamics.Joints.b2PrismaticJointDef, E = Box2D.Dynamics.Joints.b2PulleyJoint, R = Box2D.Dynamics.Joints.b2PulleyJointDef, N = Box2D.Dynamics.Joints.b2RevoluteJoint, S = Box2D.Dynamics.Joints.b2RevoluteJointDef, aa = Box2D.Dynamics.Joints.b2WeldJoint, Z = Box2D.Dynamics.Joints.b2WeldJointDef;
    Box2D.inherit(U, Box2D.Dynamics.Joints.b2Joint), U.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype, 
    U.b2DistanceJoint = function() {
        Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments), this.m_localAnchor1 = new w(), 
        this.m_localAnchor2 = new w(), this.m_u = new w();
    }, U.prototype.GetAnchorA = function() {
        return this.m_bodyA.GetWorldPoint(this.m_localAnchor1);
    }, U.prototype.GetAnchorB = function() {
        return this.m_bodyB.GetWorldPoint(this.m_localAnchor2);
    }, U.prototype.GetReactionForce = function(d) {
        return void 0 === d && (d = 0), new w(d * this.m_impulse * this.m_u.x, d * this.m_impulse * this.m_u.y);
    }, U.prototype.GetReactionTorque = function() {
        return 0;
    }, U.prototype.GetLength = function() {
        return this.m_length;
    }, U.prototype.SetLength = function(d) {
        void 0 === d && (d = 0), this.m_length = d;
    }, U.prototype.GetFrequency = function() {
        return this.m_frequencyHz;
    }, U.prototype.SetFrequency = function(d) {
        void 0 === d && (d = 0), this.m_frequencyHz = d;
    }, U.prototype.GetDampingRatio = function() {
        return this.m_dampingRatio;
    }, U.prototype.SetDampingRatio = function(d) {
        void 0 === d && (d = 0), this.m_dampingRatio = d;
    }, U.prototype.b2DistanceJoint = function(d) {
        this.__super.b2Joint.call(this, d), this.m_localAnchor1.SetV(d.localAnchorA), this.m_localAnchor2.SetV(d.localAnchorB), 
        this.m_length = d.length, this.m_frequencyHz = d.frequencyHz, this.m_dampingRatio = d.dampingRatio, 
        this.m_bias = this.m_gamma = this.m_impulse = 0;
    }, U.prototype.InitVelocityConstraints = function(d) {
        var h, l = 0, j = this.m_bodyA, o = this.m_bodyB;
        h = j.m_xf.R;
        var q = this.m_localAnchor1.x - j.m_sweep.localCenter.x, n = this.m_localAnchor1.y - j.m_sweep.localCenter.y;
        l = h.col1.x * q + h.col2.x * n, n = h.col1.y * q + h.col2.y * n, q = l, h = o.m_xf.R;
        var a = this.m_localAnchor2.x - o.m_sweep.localCenter.x, c = this.m_localAnchor2.y - o.m_sweep.localCenter.y;
        l = h.col1.x * a + h.col2.x * c, c = h.col1.y * a + h.col2.y * c, a = l, this.m_u.x = o.m_sweep.c.x + a - j.m_sweep.c.x - q, 
        this.m_u.y = o.m_sweep.c.y + c - j.m_sweep.c.y - n, (l = Math.sqrt(this.m_u.x * this.m_u.x + this.m_u.y * this.m_u.y)) > F.b2_linearSlop ? this.m_u.Multiply(1 / l) : this.m_u.SetZero(), 
        h = q * this.m_u.y - n * this.m_u.x;
        var g = a * this.m_u.y - c * this.m_u.x;
        if (h = j.m_invMass + j.m_invI * h * h + o.m_invMass + o.m_invI * g * g, this.m_mass = 0 != h ? 1 / h : 0, 
        0 < this.m_frequencyHz) {
            l -= this.m_length, g = 2 * Math.PI * this.m_frequencyHz;
            var b = this.m_mass * g * g;
            this.m_gamma = d.dt * (2 * this.m_mass * this.m_dampingRatio * g + d.dt * b), this.m_gamma = 0 != this.m_gamma ? 1 / this.m_gamma : 0, 
            this.m_bias = l * d.dt * b * this.m_gamma, this.m_mass = h + this.m_gamma, this.m_mass = 0 != this.m_mass ? 1 / this.m_mass : 0;
        }
        d.warmStarting ? (this.m_impulse *= d.dtRatio, d = this.m_impulse * this.m_u.x, 
        h = this.m_impulse * this.m_u.y, j.m_linearVelocity.x -= j.m_invMass * d, j.m_linearVelocity.y -= j.m_invMass * h, 
        j.m_angularVelocity -= j.m_invI * (q * h - n * d), o.m_linearVelocity.x += o.m_invMass * d, 
        o.m_linearVelocity.y += o.m_invMass * h, o.m_angularVelocity += o.m_invI * (a * h - c * d)) : this.m_impulse = 0;
    }, U.prototype.SolveVelocityConstraints = function() {
        var d, h = this.m_bodyA, l = this.m_bodyB;
        d = h.m_xf.R;
        var j = this.m_localAnchor1.x - h.m_sweep.localCenter.x, o = this.m_localAnchor1.y - h.m_sweep.localCenter.y, q = d.col1.x * j + d.col2.x * o;
        o = d.col1.y * j + d.col2.y * o, j = q, d = l.m_xf.R;
        var n = this.m_localAnchor2.x - l.m_sweep.localCenter.x, a = this.m_localAnchor2.y - l.m_sweep.localCenter.y;
        q = d.col1.x * n + d.col2.x * a, a = d.col1.y * n + d.col2.y * a, n = q, q = -this.m_mass * (this.m_u.x * (l.m_linearVelocity.x + -l.m_angularVelocity * a - (h.m_linearVelocity.x + -h.m_angularVelocity * o)) + this.m_u.y * (l.m_linearVelocity.y + l.m_angularVelocity * n - (h.m_linearVelocity.y + h.m_angularVelocity * j)) + this.m_bias + this.m_gamma * this.m_impulse), 
        this.m_impulse += q, d = q * this.m_u.x, q *= this.m_u.y, h.m_linearVelocity.x -= h.m_invMass * d, 
        h.m_linearVelocity.y -= h.m_invMass * q, h.m_angularVelocity -= h.m_invI * (j * q - o * d), 
        l.m_linearVelocity.x += l.m_invMass * d, l.m_linearVelocity.y += l.m_invMass * q, 
        l.m_angularVelocity += l.m_invI * (n * q - a * d);
    }, U.prototype.SolvePositionConstraints = function() {
        var d;
        if (0 < this.m_frequencyHz) return !0;
        var h = this.m_bodyA, l = this.m_bodyB;
        d = h.m_xf.R;
        var j = this.m_localAnchor1.x - h.m_sweep.localCenter.x, o = this.m_localAnchor1.y - h.m_sweep.localCenter.y, q = d.col1.x * j + d.col2.x * o;
        o = d.col1.y * j + d.col2.y * o, j = q, d = l.m_xf.R;
        var n = this.m_localAnchor2.x - l.m_sweep.localCenter.x, a = this.m_localAnchor2.y - l.m_sweep.localCenter.y;
        q = d.col1.x * n + d.col2.x * a, a = d.col1.y * n + d.col2.y * a, n = q, q = l.m_sweep.c.x + n - h.m_sweep.c.x - j;
        var c = l.m_sweep.c.y + a - h.m_sweep.c.y - o;
        q /= d = Math.sqrt(q * q + c * c), c /= d, d -= this.m_length, d = y.Clamp(d, -F.b2_maxLinearCorrection, F.b2_maxLinearCorrection);
        var g = -this.m_mass * d;
        return this.m_u.Set(q, c), q = g * this.m_u.x, c = g * this.m_u.y, h.m_sweep.c.x -= h.m_invMass * q, 
        h.m_sweep.c.y -= h.m_invMass * c, h.m_sweep.a -= h.m_invI * (j * c - o * q), l.m_sweep.c.x += l.m_invMass * q, 
        l.m_sweep.c.y += l.m_invMass * c, l.m_sweep.a += l.m_invI * (n * c - a * q), h.SynchronizeTransform(), 
        l.SynchronizeTransform(), y.Abs(d) < F.b2_linearSlop;
    }, Box2D.inherit(p, Box2D.Dynamics.Joints.b2JointDef), p.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype, 
    p.b2DistanceJointDef = function() {
        Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments), this.localAnchorA = new w(), 
        this.localAnchorB = new w();
    }, p.prototype.b2DistanceJointDef = function() {
        this.__super.b2JointDef.call(this), this.type = I.e_distanceJoint, this.length = 1, 
        this.dampingRatio = this.frequencyHz = 0;
    }, p.prototype.Initialize = function(d, h, l, j) {
        this.bodyA = d, this.bodyB = h, this.localAnchorA.SetV(this.bodyA.GetLocalPoint(l)), 
        this.localAnchorB.SetV(this.bodyB.GetLocalPoint(j)), d = j.x - l.x, l = j.y - l.y, 
        this.length = Math.sqrt(d * d + l * l), this.dampingRatio = this.frequencyHz = 0;
    }, Box2D.inherit(B, Box2D.Dynamics.Joints.b2Joint), B.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype, 
    B.b2FrictionJoint = function() {
        Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments), this.m_localAnchorA = new w(), 
        this.m_localAnchorB = new w(), this.m_linearMass = new G(), this.m_linearImpulse = new w();
    }, B.prototype.GetAnchorA = function() {
        return this.m_bodyA.GetWorldPoint(this.m_localAnchorA);
    }, B.prototype.GetAnchorB = function() {
        return this.m_bodyB.GetWorldPoint(this.m_localAnchorB);
    }, B.prototype.GetReactionForce = function(d) {
        return void 0 === d && (d = 0), new w(d * this.m_linearImpulse.x, d * this.m_linearImpulse.y);
    }, B.prototype.GetReactionTorque = function(d) {
        return void 0 === d && (d = 0), d * this.m_angularImpulse;
    }, B.prototype.SetMaxForce = function(d) {
        void 0 === d && (d = 0), this.m_maxForce = d;
    }, B.prototype.GetMaxForce = function() {
        return this.m_maxForce;
    }, B.prototype.SetMaxTorque = function(d) {
        void 0 === d && (d = 0), this.m_maxTorque = d;
    }, B.prototype.GetMaxTorque = function() {
        return this.m_maxTorque;
    }, B.prototype.b2FrictionJoint = function(d) {
        this.__super.b2Joint.call(this, d), this.m_localAnchorA.SetV(d.localAnchorA), this.m_localAnchorB.SetV(d.localAnchorB), 
        this.m_linearMass.SetZero(), this.m_angularMass = 0, this.m_linearImpulse.SetZero(), 
        this.m_angularImpulse = 0, this.m_maxForce = d.maxForce, this.m_maxTorque = d.maxTorque;
    }, B.prototype.InitVelocityConstraints = function(d) {
        var h, l = 0, j = this.m_bodyA, o = this.m_bodyB;
        h = j.m_xf.R;
        var q = this.m_localAnchorA.x - j.m_sweep.localCenter.x, n = this.m_localAnchorA.y - j.m_sweep.localCenter.y;
        l = h.col1.x * q + h.col2.x * n, n = h.col1.y * q + h.col2.y * n, q = l, h = o.m_xf.R;
        var a = this.m_localAnchorB.x - o.m_sweep.localCenter.x, c = this.m_localAnchorB.y - o.m_sweep.localCenter.y;
        l = h.col1.x * a + h.col2.x * c, c = h.col1.y * a + h.col2.y * c, a = l, h = j.m_invMass, 
        l = o.m_invMass;
        var g = j.m_invI, b = o.m_invI, e = new G();
        e.col1.x = h + l, e.col2.x = 0, e.col1.y = 0, e.col2.y = h + l, e.col1.x += g * n * n, 
        e.col2.x += -g * q * n, e.col1.y += -g * q * n, e.col2.y += g * q * q, e.col1.x += b * c * c, 
        e.col2.x += -b * a * c, e.col1.y += -b * a * c, e.col2.y += b * a * a, e.GetInverse(this.m_linearMass), 
        this.m_angularMass = g + b, 0 < this.m_angularMass && (this.m_angularMass = 1 / this.m_angularMass), 
        d.warmStarting ? (this.m_linearImpulse.x *= d.dtRatio, this.m_linearImpulse.y *= d.dtRatio, 
        this.m_angularImpulse *= d.dtRatio, d = this.m_linearImpulse, j.m_linearVelocity.x -= h * d.x, 
        j.m_linearVelocity.y -= h * d.y, j.m_angularVelocity -= g * (q * d.y - n * d.x + this.m_angularImpulse), 
        o.m_linearVelocity.x += l * d.x, o.m_linearVelocity.y += l * d.y, o.m_angularVelocity += b * (a * d.y - c * d.x + this.m_angularImpulse)) : (this.m_linearImpulse.SetZero(), 
        this.m_angularImpulse = 0);
    }, B.prototype.SolveVelocityConstraints = function(d) {
        var h, l = 0, j = this.m_bodyA, o = this.m_bodyB, q = j.m_linearVelocity, n = j.m_angularVelocity, a = o.m_linearVelocity, c = o.m_angularVelocity, g = j.m_invMass, b = o.m_invMass, e = j.m_invI, f = o.m_invI;
        h = j.m_xf.R;
        var m = this.m_localAnchorA.x - j.m_sweep.localCenter.x, r = this.m_localAnchorA.y - j.m_sweep.localCenter.y;
        l = h.col1.x * m + h.col2.x * r, r = h.col1.y * m + h.col2.y * r, m = l, h = o.m_xf.R;
        var s = this.m_localAnchorB.x - o.m_sweep.localCenter.x, v = this.m_localAnchorB.y - o.m_sweep.localCenter.y;
        l = h.col1.x * s + h.col2.x * v, v = h.col1.y * s + h.col2.y * v, s = l, h = 0, 
        l = -this.m_angularMass * (c - n);
        var t = this.m_angularImpulse;
        h = d.dt * this.m_maxTorque, this.m_angularImpulse = y.Clamp(this.m_angularImpulse + l, -h, h), 
        n -= e * (l = this.m_angularImpulse - t), c += f * l, h = y.MulMV(this.m_linearMass, new w(-(a.x - c * v - q.x + n * r), -(a.y + c * s - q.y - n * m))), 
        l = this.m_linearImpulse.Copy(), this.m_linearImpulse.Add(h), h = d.dt * this.m_maxForce, 
        this.m_linearImpulse.LengthSquared() > h * h && (this.m_linearImpulse.Normalize(), 
        this.m_linearImpulse.Multiply(h)), h = y.SubtractVV(this.m_linearImpulse, l), q.x -= g * h.x, 
        q.y -= g * h.y, n -= e * (m * h.y - r * h.x), a.x += b * h.x, a.y += b * h.y, c += f * (s * h.y - v * h.x), 
        j.m_angularVelocity = n, o.m_angularVelocity = c;
    }, B.prototype.SolvePositionConstraints = function() {
        return !0;
    }, Box2D.inherit(Q, Box2D.Dynamics.Joints.b2JointDef), Q.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype, 
    Q.b2FrictionJointDef = function() {
        Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments), this.localAnchorA = new w(), 
        this.localAnchorB = new w();
    }, Q.prototype.b2FrictionJointDef = function() {
        this.__super.b2JointDef.call(this), this.type = I.e_frictionJoint, this.maxTorque = this.maxForce = 0;
    }, Q.prototype.Initialize = function(d, h, l) {
        this.bodyA = d, this.bodyB = h, this.localAnchorA.SetV(this.bodyA.GetLocalPoint(l)), 
        this.localAnchorB.SetV(this.bodyB.GetLocalPoint(l));
    }, Box2D.inherit(V, Box2D.Dynamics.Joints.b2Joint), V.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype, 
    V.b2GearJoint = function() {
        Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments), this.m_groundAnchor1 = new w(), 
        this.m_groundAnchor2 = new w(), this.m_localAnchor1 = new w(), this.m_localAnchor2 = new w(), 
        this.m_J = new L();
    }, V.prototype.GetAnchorA = function() {
        return this.m_bodyA.GetWorldPoint(this.m_localAnchor1);
    }, V.prototype.GetAnchorB = function() {
        return this.m_bodyB.GetWorldPoint(this.m_localAnchor2);
    }, V.prototype.GetReactionForce = function(d) {
        return void 0 === d && (d = 0), new w(d * this.m_impulse * this.m_J.linearB.x, d * this.m_impulse * this.m_J.linearB.y);
    }, V.prototype.GetReactionTorque = function(d) {
        void 0 === d && (d = 0);
        var h = this.m_bodyB.m_xf.R, l = this.m_localAnchor1.x - this.m_bodyB.m_sweep.localCenter.x, j = this.m_localAnchor1.y - this.m_bodyB.m_sweep.localCenter.y, o = h.col1.x * l + h.col2.x * j;
        return j = h.col1.y * l + h.col2.y * j, l = o, d * (this.m_impulse * this.m_J.angularB - l * this.m_impulse * this.m_J.linearB.y + j * this.m_impulse * this.m_J.linearB.x);
    }, V.prototype.GetRatio = function() {
        return this.m_ratio;
    }, V.prototype.SetRatio = function(d) {
        void 0 === d && (d = 0), this.m_ratio = d;
    }, V.prototype.b2GearJoint = function(d) {
        this.__super.b2Joint.call(this, d);
        var h = parseInt(d.joint1.m_type), l = parseInt(d.joint2.m_type);
        this.m_prismatic2 = this.m_revolute2 = this.m_prismatic1 = this.m_revolute1 = null;
        var j = 0, o = 0;
        this.m_ground1 = d.joint1.GetBodyA(), this.m_bodyA = d.joint1.GetBodyB(), j = h == I.e_revoluteJoint ? (this.m_revolute1 = d.joint1 instanceof N ? d.joint1 : null, 
        this.m_groundAnchor1.SetV(this.m_revolute1.m_localAnchor1), this.m_localAnchor1.SetV(this.m_revolute1.m_localAnchor2), 
        this.m_revolute1.GetJointAngle()) : (this.m_prismatic1 = d.joint1 instanceof H ? d.joint1 : null, 
        this.m_groundAnchor1.SetV(this.m_prismatic1.m_localAnchor1), this.m_localAnchor1.SetV(this.m_prismatic1.m_localAnchor2), 
        this.m_prismatic1.GetJointTranslation()), this.m_ground2 = d.joint2.GetBodyA(), 
        this.m_bodyB = d.joint2.GetBodyB(), o = l == I.e_revoluteJoint ? (this.m_revolute2 = d.joint2 instanceof N ? d.joint2 : null, 
        this.m_groundAnchor2.SetV(this.m_revolute2.m_localAnchor1), this.m_localAnchor2.SetV(this.m_revolute2.m_localAnchor2), 
        this.m_revolute2.GetJointAngle()) : (this.m_prismatic2 = d.joint2 instanceof H ? d.joint2 : null, 
        this.m_groundAnchor2.SetV(this.m_prismatic2.m_localAnchor1), this.m_localAnchor2.SetV(this.m_prismatic2.m_localAnchor2), 
        this.m_prismatic2.GetJointTranslation()), this.m_ratio = d.ratio, this.m_constant = j + this.m_ratio * o, 
        this.m_impulse = 0;
    }, V.prototype.InitVelocityConstraints = function(d) {
        var h = this.m_ground1, l = this.m_ground2, j = this.m_bodyA, o = this.m_bodyB, q = 0, n = 0, a = 0, c = 0, g = a = 0, b = 0;
        this.m_J.SetZero(), this.m_revolute1 ? (this.m_J.angularA = -1, b += j.m_invI) : (h = h.m_xf.R, 
        n = this.m_prismatic1.m_localXAxis1, q = h.col1.x * n.x + h.col2.x * n.y, n = h.col1.y * n.x + h.col2.y * n.y, 
        h = j.m_xf.R, a = this.m_localAnchor1.x - j.m_sweep.localCenter.x, c = this.m_localAnchor1.y - j.m_sweep.localCenter.y, 
        g = h.col1.x * a + h.col2.x * c, c = h.col1.y * a + h.col2.y * c, a = (a = g) * n - c * q, 
        this.m_J.linearA.Set(-q, -n), this.m_J.angularA = -a, b += j.m_invMass + j.m_invI * a * a), 
        this.m_revolute2 ? (this.m_J.angularB = -this.m_ratio, b += this.m_ratio * this.m_ratio * o.m_invI) : (h = l.m_xf.R, 
        n = this.m_prismatic2.m_localXAxis1, q = h.col1.x * n.x + h.col2.x * n.y, n = h.col1.y * n.x + h.col2.y * n.y, 
        h = o.m_xf.R, a = this.m_localAnchor2.x - o.m_sweep.localCenter.x, c = this.m_localAnchor2.y - o.m_sweep.localCenter.y, 
        g = h.col1.x * a + h.col2.x * c, c = h.col1.y * a + h.col2.y * c, a = (a = g) * n - c * q, 
        this.m_J.linearB.Set(-this.m_ratio * q, -this.m_ratio * n), this.m_J.angularB = -this.m_ratio * a, 
        b += this.m_ratio * this.m_ratio * (o.m_invMass + o.m_invI * a * a)), this.m_mass = 0 < b ? 1 / b : 0, 
        d.warmStarting ? (j.m_linearVelocity.x += j.m_invMass * this.m_impulse * this.m_J.linearA.x, 
        j.m_linearVelocity.y += j.m_invMass * this.m_impulse * this.m_J.linearA.y, j.m_angularVelocity += j.m_invI * this.m_impulse * this.m_J.angularA, 
        o.m_linearVelocity.x += o.m_invMass * this.m_impulse * this.m_J.linearB.x, o.m_linearVelocity.y += o.m_invMass * this.m_impulse * this.m_J.linearB.y, 
        o.m_angularVelocity += o.m_invI * this.m_impulse * this.m_J.angularB) : this.m_impulse = 0;
    }, V.prototype.SolveVelocityConstraints = function() {
        var d = this.m_bodyA, h = this.m_bodyB, l = -this.m_mass * this.m_J.Compute(d.m_linearVelocity, d.m_angularVelocity, h.m_linearVelocity, h.m_angularVelocity);
        this.m_impulse += l, d.m_linearVelocity.x += d.m_invMass * l * this.m_J.linearA.x, 
        d.m_linearVelocity.y += d.m_invMass * l * this.m_J.linearA.y, d.m_angularVelocity += d.m_invI * l * this.m_J.angularA, 
        h.m_linearVelocity.x += h.m_invMass * l * this.m_J.linearB.x, h.m_linearVelocity.y += h.m_invMass * l * this.m_J.linearB.y, 
        h.m_angularVelocity += h.m_invI * l * this.m_J.angularB;
    }, V.prototype.SolvePositionConstraints = function() {
        var j, d = this.m_bodyA, h = this.m_bodyB, l = 0;
        return l = this.m_revolute1 ? this.m_revolute1.GetJointAngle() : this.m_prismatic1.GetJointTranslation(), 
        j = this.m_revolute2 ? this.m_revolute2.GetJointAngle() : this.m_prismatic2.GetJointTranslation(), 
        l = -this.m_mass * (this.m_constant - (l + this.m_ratio * j)), d.m_sweep.c.x += d.m_invMass * l * this.m_J.linearA.x, 
        d.m_sweep.c.y += d.m_invMass * l * this.m_J.linearA.y, d.m_sweep.a += d.m_invI * l * this.m_J.angularA, 
        h.m_sweep.c.x += h.m_invMass * l * this.m_J.linearB.x, h.m_sweep.c.y += h.m_invMass * l * this.m_J.linearB.y, 
        h.m_sweep.a += h.m_invI * l * this.m_J.angularB, d.SynchronizeTransform(), h.SynchronizeTransform(), 
        0 < F.b2_linearSlop;
    }, Box2D.inherit(M, Box2D.Dynamics.Joints.b2JointDef), M.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype, 
    M.b2GearJointDef = function() {
        Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments);
    }, M.prototype.b2GearJointDef = function() {
        this.__super.b2JointDef.call(this), this.type = I.e_gearJoint, this.joint2 = this.joint1 = null, 
        this.ratio = 1;
    }, L.b2Jacobian = function() {
        this.linearA = new w(), this.linearB = new w();
    }, L.prototype.SetZero = function() {
        this.linearA.SetZero(), this.angularA = 0, this.linearB.SetZero(), this.angularB = 0;
    }, L.prototype.Set = function(d, h, l, j) {
        void 0 === h && (h = 0), void 0 === j && (j = 0), this.linearA.SetV(d), this.angularA = h, 
        this.linearB.SetV(l), this.angularB = j;
    }, L.prototype.Compute = function(d, h, l, j) {
        return void 0 === h && (h = 0), void 0 === j && (j = 0), this.linearA.x * d.x + this.linearA.y * d.y + this.angularA * h + (this.linearB.x * l.x + this.linearB.y * l.y) + this.angularB * j;
    }, I.b2Joint = function() {
        this.m_edgeA = new Y(), this.m_edgeB = new Y(), this.m_localCenterA = new w(), this.m_localCenterB = new w();
    }, I.prototype.GetType = function() {
        return this.m_type;
    }, I.prototype.GetAnchorA = function() {
        return null;
    }, I.prototype.GetAnchorB = function() {
        return null;
    }, I.prototype.GetReactionForce = function() {
        return null;
    }, I.prototype.GetReactionTorque = function() {
        return 0;
    }, I.prototype.GetBodyA = function() {
        return this.m_bodyA;
    }, I.prototype.GetBodyB = function() {
        return this.m_bodyB;
    }, I.prototype.GetNext = function() {
        return this.m_next;
    }, I.prototype.GetUserData = function() {
        return this.m_userData;
    }, I.prototype.SetUserData = function(d) {
        this.m_userData = d;
    }, I.prototype.IsActive = function() {
        return this.m_bodyA.IsActive() && this.m_bodyB.IsActive();
    }, I.Create = function(d) {
        var h = null;
        switch (d.type) {
          case I.e_distanceJoint:
            h = new U(d instanceof p ? d : null);
            break;

          case I.e_mouseJoint:
            h = new u(d instanceof D ? d : null);
            break;

          case I.e_prismaticJoint:
            h = new H(d instanceof O ? d : null);
            break;

          case I.e_revoluteJoint:
            h = new N(d instanceof S ? d : null);
            break;

          case I.e_pulleyJoint:
            h = new E(d instanceof R ? d : null);
            break;

          case I.e_gearJoint:
            h = new V(d instanceof M ? d : null);
            break;

          case I.e_lineJoint:
            h = new k(d instanceof z ? d : null);
            break;

          case I.e_weldJoint:
            h = new aa(d instanceof Z ? d : null);
            break;

          case I.e_frictionJoint:
            h = new B(d instanceof Q ? d : null);
        }
        return h;
    }, I.Destroy = function() {}, I.prototype.b2Joint = function(d) {
        F.b2Assert(d.bodyA != d.bodyB), this.m_type = d.type, this.m_next = this.m_prev = null, 
        this.m_bodyA = d.bodyA, this.m_bodyB = d.bodyB, this.m_collideConnected = d.collideConnected, 
        this.m_islandFlag = !1, this.m_userData = d.userData;
    }, I.prototype.InitVelocityConstraints = function() {}, I.prototype.SolveVelocityConstraints = function() {}, 
    I.prototype.FinalizeVelocityConstraints = function() {}, I.prototype.SolvePositionConstraints = function() {
        return !1;
    }, Box2D.postDefs.push(function() {
        Box2D.Dynamics.Joints.b2Joint.e_unknownJoint = 0, Box2D.Dynamics.Joints.b2Joint.e_revoluteJoint = 1, 
        Box2D.Dynamics.Joints.b2Joint.e_prismaticJoint = 2, Box2D.Dynamics.Joints.b2Joint.e_distanceJoint = 3, 
        Box2D.Dynamics.Joints.b2Joint.e_pulleyJoint = 4, Box2D.Dynamics.Joints.b2Joint.e_mouseJoint = 5, 
        Box2D.Dynamics.Joints.b2Joint.e_gearJoint = 6, Box2D.Dynamics.Joints.b2Joint.e_lineJoint = 7, 
        Box2D.Dynamics.Joints.b2Joint.e_weldJoint = 8, Box2D.Dynamics.Joints.b2Joint.e_frictionJoint = 9, 
        Box2D.Dynamics.Joints.b2Joint.e_inactiveLimit = 0, Box2D.Dynamics.Joints.b2Joint.e_atLowerLimit = 1, 
        Box2D.Dynamics.Joints.b2Joint.e_atUpperLimit = 2, Box2D.Dynamics.Joints.b2Joint.e_equalLimits = 3;
    }), W.b2JointDef = function() {}, W.prototype.b2JointDef = function() {
        this.type = I.e_unknownJoint, this.bodyB = this.bodyA = this.userData = null, this.collideConnected = !1;
    }, Y.b2JointEdge = function() {}, Box2D.inherit(k, Box2D.Dynamics.Joints.b2Joint), 
    k.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype, k.b2LineJoint = function() {
        Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments), this.m_localAnchor1 = new w(), 
        this.m_localAnchor2 = new w(), this.m_localXAxis1 = new w(), this.m_localYAxis1 = new w(), 
        this.m_axis = new w(), this.m_perp = new w(), this.m_K = new G(), this.m_impulse = new w();
    }, k.prototype.GetAnchorA = function() {
        return this.m_bodyA.GetWorldPoint(this.m_localAnchor1);
    }, k.prototype.GetAnchorB = function() {
        return this.m_bodyB.GetWorldPoint(this.m_localAnchor2);
    }, k.prototype.GetReactionForce = function(d) {
        return void 0 === d && (d = 0), new w(d * (this.m_impulse.x * this.m_perp.x + (this.m_motorImpulse + this.m_impulse.y) * this.m_axis.x), d * (this.m_impulse.x * this.m_perp.y + (this.m_motorImpulse + this.m_impulse.y) * this.m_axis.y));
    }, k.prototype.GetReactionTorque = function(d) {
        return void 0 === d && (d = 0), d * this.m_impulse.y;
    }, k.prototype.GetJointTranslation = function() {
        var d = this.m_bodyA, h = this.m_bodyB, l = d.GetWorldPoint(this.m_localAnchor1), j = h.GetWorldPoint(this.m_localAnchor2);
        return h = j.x - l.x, l = j.y - l.y, (d = d.GetWorldVector(this.m_localXAxis1)).x * h + d.y * l;
    }, k.prototype.GetJointSpeed = function() {
        var l, d = this.m_bodyA, h = this.m_bodyB;
        l = d.m_xf.R;
        var j = this.m_localAnchor1.x - d.m_sweep.localCenter.x, o = this.m_localAnchor1.y - d.m_sweep.localCenter.y, q = l.col1.x * j + l.col2.x * o;
        o = l.col1.y * j + l.col2.y * o, j = q, l = h.m_xf.R;
        var n = this.m_localAnchor2.x - h.m_sweep.localCenter.x, a = this.m_localAnchor2.y - h.m_sweep.localCenter.y;
        q = l.col1.x * n + l.col2.x * a, a = l.col1.y * n + l.col2.y * a, n = q, l = h.m_sweep.c.x + n - (d.m_sweep.c.x + j), 
        q = h.m_sweep.c.y + a - (d.m_sweep.c.y + o);
        var c = d.GetWorldVector(this.m_localXAxis1), g = d.m_linearVelocity, b = h.m_linearVelocity;
        return d = d.m_angularVelocity, h = h.m_angularVelocity, l * -d * c.y + q * d * c.x + (c.x * (b.x + -h * a - g.x - -d * o) + c.y * (b.y + h * n - g.y - d * j));
    }, k.prototype.IsLimitEnabled = function() {
        return this.m_enableLimit;
    }, k.prototype.EnableLimit = function(d) {
        this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_enableLimit = d;
    }, k.prototype.GetLowerLimit = function() {
        return this.m_lowerTranslation;
    }, k.prototype.GetUpperLimit = function() {
        return this.m_upperTranslation;
    }, k.prototype.SetLimits = function(d, h) {
        void 0 === d && (d = 0), void 0 === h && (h = 0), this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), 
        this.m_lowerTranslation = d, this.m_upperTranslation = h;
    }, k.prototype.IsMotorEnabled = function() {
        return this.m_enableMotor;
    }, k.prototype.EnableMotor = function(d) {
        this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_enableMotor = d;
    }, k.prototype.SetMotorSpeed = function(d) {
        void 0 === d && (d = 0), this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_motorSpeed = d;
    }, k.prototype.GetMotorSpeed = function() {
        return this.m_motorSpeed;
    }, k.prototype.SetMaxMotorForce = function(d) {
        void 0 === d && (d = 0), this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_maxMotorForce = d;
    }, k.prototype.GetMaxMotorForce = function() {
        return this.m_maxMotorForce;
    }, k.prototype.GetMotorForce = function() {
        return this.m_motorImpulse;
    }, k.prototype.b2LineJoint = function(d) {
        this.__super.b2Joint.call(this, d), this.m_localAnchor1.SetV(d.localAnchorA), this.m_localAnchor2.SetV(d.localAnchorB), 
        this.m_localXAxis1.SetV(d.localAxisA), this.m_localYAxis1.x = -this.m_localXAxis1.y, 
        this.m_localYAxis1.y = this.m_localXAxis1.x, this.m_impulse.SetZero(), this.m_motorImpulse = this.m_motorMass = 0, 
        this.m_lowerTranslation = d.lowerTranslation, this.m_upperTranslation = d.upperTranslation, 
        this.m_maxMotorForce = d.maxMotorForce, this.m_motorSpeed = d.motorSpeed, this.m_enableLimit = d.enableLimit, 
        this.m_enableMotor = d.enableMotor, this.m_limitState = I.e_inactiveLimit, this.m_axis.SetZero(), 
        this.m_perp.SetZero();
    }, k.prototype.InitVelocityConstraints = function(d) {
        var j, h = this.m_bodyA, l = this.m_bodyB, o = 0;
        this.m_localCenterA.SetV(h.GetLocalCenter()), this.m_localCenterB.SetV(l.GetLocalCenter());
        var q = h.GetTransform();
        l.GetTransform(), j = h.m_xf.R;
        var n = this.m_localAnchor1.x - this.m_localCenterA.x, a = this.m_localAnchor1.y - this.m_localCenterA.y;
        o = j.col1.x * n + j.col2.x * a, a = j.col1.y * n + j.col2.y * a, n = o, j = l.m_xf.R;
        var c = this.m_localAnchor2.x - this.m_localCenterB.x, g = this.m_localAnchor2.y - this.m_localCenterB.y;
        o = j.col1.x * c + j.col2.x * g, g = j.col1.y * c + j.col2.y * g, c = o, j = l.m_sweep.c.x + c - h.m_sweep.c.x - n, 
        o = l.m_sweep.c.y + g - h.m_sweep.c.y - a, this.m_invMassA = h.m_invMass, this.m_invMassB = l.m_invMass, 
        this.m_invIA = h.m_invI, this.m_invIB = l.m_invI, this.m_axis.SetV(y.MulMV(q.R, this.m_localXAxis1)), 
        this.m_a1 = (j + n) * this.m_axis.y - (o + a) * this.m_axis.x, this.m_a2 = c * this.m_axis.y - g * this.m_axis.x, 
        this.m_motorMass = this.m_invMassA + this.m_invMassB + this.m_invIA * this.m_a1 * this.m_a1 + this.m_invIB * this.m_a2 * this.m_a2, 
        this.m_motorMass = this.m_motorMass > Number.MIN_VALUE ? 1 / this.m_motorMass : 0, 
        this.m_perp.SetV(y.MulMV(q.R, this.m_localYAxis1)), this.m_s1 = (j + n) * this.m_perp.y - (o + a) * this.m_perp.x, 
        this.m_s2 = c * this.m_perp.y - g * this.m_perp.x, q = this.m_invMassA, n = this.m_invMassB, 
        a = this.m_invIA, c = this.m_invIB, this.m_K.col1.x = q + n + a * this.m_s1 * this.m_s1 + c * this.m_s2 * this.m_s2, 
        this.m_K.col1.y = a * this.m_s1 * this.m_a1 + c * this.m_s2 * this.m_a2, this.m_K.col2.x = this.m_K.col1.y, 
        this.m_K.col2.y = q + n + a * this.m_a1 * this.m_a1 + c * this.m_a2 * this.m_a2, 
        this.m_enableLimit ? (j = this.m_axis.x * j + this.m_axis.y * o, y.Abs(this.m_upperTranslation - this.m_lowerTranslation) < 2 * F.b2_linearSlop ? this.m_limitState = I.e_equalLimits : j <= this.m_lowerTranslation ? this.m_limitState != I.e_atLowerLimit && (this.m_limitState = I.e_atLowerLimit, 
        this.m_impulse.y = 0) : j >= this.m_upperTranslation ? this.m_limitState != I.e_atUpperLimit && (this.m_limitState = I.e_atUpperLimit, 
        this.m_impulse.y = 0) : (this.m_limitState = I.e_inactiveLimit, this.m_impulse.y = 0)) : this.m_limitState = I.e_inactiveLimit, 
        0 == this.m_enableMotor && (this.m_motorImpulse = 0), d.warmStarting ? (this.m_impulse.x *= d.dtRatio, 
        this.m_impulse.y *= d.dtRatio, this.m_motorImpulse *= d.dtRatio, d = this.m_impulse.x * this.m_perp.x + (this.m_motorImpulse + this.m_impulse.y) * this.m_axis.x, 
        j = this.m_impulse.x * this.m_perp.y + (this.m_motorImpulse + this.m_impulse.y) * this.m_axis.y, 
        o = this.m_impulse.x * this.m_s1 + (this.m_motorImpulse + this.m_impulse.y) * this.m_a1, 
        q = this.m_impulse.x * this.m_s2 + (this.m_motorImpulse + this.m_impulse.y) * this.m_a2, 
        h.m_linearVelocity.x -= this.m_invMassA * d, h.m_linearVelocity.y -= this.m_invMassA * j, 
        h.m_angularVelocity -= this.m_invIA * o, l.m_linearVelocity.x += this.m_invMassB * d, 
        l.m_linearVelocity.y += this.m_invMassB * j, l.m_angularVelocity += this.m_invIB * q) : (this.m_impulse.SetZero(), 
        this.m_motorImpulse = 0);
    }, k.prototype.SolveVelocityConstraints = function(d) {
        var h = this.m_bodyA, l = this.m_bodyB, j = h.m_linearVelocity, o = h.m_angularVelocity, q = l.m_linearVelocity, n = l.m_angularVelocity, a = 0, c = 0, g = 0, b = 0;
        this.m_enableMotor && this.m_limitState != I.e_equalLimits && (b = this.m_motorMass * (this.m_motorSpeed - (this.m_axis.x * (q.x - j.x) + this.m_axis.y * (q.y - j.y) + this.m_a2 * n - this.m_a1 * o)), 
        a = this.m_motorImpulse, c = d.dt * this.m_maxMotorForce, this.m_motorImpulse = y.Clamp(this.m_motorImpulse + b, -c, c), 
        a = (b = this.m_motorImpulse - a) * this.m_axis.x, c = b * this.m_axis.y, g = b * this.m_a1, 
        b *= this.m_a2, j.x -= this.m_invMassA * a, j.y -= this.m_invMassA * c, o -= this.m_invIA * g, 
        q.x += this.m_invMassB * a, q.y += this.m_invMassB * c, n += this.m_invIB * b), 
        c = this.m_perp.x * (q.x - j.x) + this.m_perp.y * (q.y - j.y) + this.m_s2 * n - this.m_s1 * o, 
        b = this.m_enableLimit && this.m_limitState != I.e_inactiveLimit ? (g = this.m_axis.x * (q.x - j.x) + this.m_axis.y * (q.y - j.y) + this.m_a2 * n - this.m_a1 * o, 
        a = this.m_impulse.Copy(), d = this.m_K.Solve(new w(), -c, -g), this.m_impulse.Add(d), 
        this.m_limitState == I.e_atLowerLimit ? this.m_impulse.y = y.Max(this.m_impulse.y, 0) : this.m_limitState == I.e_atUpperLimit && (this.m_impulse.y = y.Min(this.m_impulse.y, 0)), 
        c = -c - (this.m_impulse.y - a.y) * this.m_K.col2.x, g = (g = 0) != this.m_K.col1.x ? c / this.m_K.col1.x + a.x : a.x, 
        this.m_impulse.x = g, d.x = this.m_impulse.x - a.x, d.y = this.m_impulse.y - a.y, 
        a = d.x * this.m_perp.x + d.y * this.m_axis.x, c = d.x * this.m_perp.y + d.y * this.m_axis.y, 
        g = d.x * this.m_s1 + d.y * this.m_a1, d.x * this.m_s2 + d.y * this.m_a2) : (d = (d = 0) != this.m_K.col1.x ? -c / this.m_K.col1.x : 0, 
        this.m_impulse.x += d, a = d * this.m_perp.x, c = d * this.m_perp.y, g = d * this.m_s1, 
        d * this.m_s2), j.x -= this.m_invMassA * a, j.y -= this.m_invMassA * c, o -= this.m_invIA * g, 
        q.x += this.m_invMassB * a, q.y += this.m_invMassB * c, n += this.m_invIB * b, h.m_linearVelocity.SetV(j), 
        h.m_angularVelocity = o, l.m_linearVelocity.SetV(q), l.m_angularVelocity = n;
    }, k.prototype.SolvePositionConstraints = function() {
        var n, d = this.m_bodyA, h = this.m_bodyB, l = d.m_sweep.c, j = d.m_sweep.a, o = h.m_sweep.c, q = h.m_sweep.a, a = 0, c = 0, g = 0, b = 0, e = n = 0, f = 0;
        c = !1;
        var m = 0, r = G.FromAngle(j);
        g = G.FromAngle(q), n = r, f = this.m_localAnchor1.x - this.m_localCenterA.x;
        var s = this.m_localAnchor1.y - this.m_localCenterA.y;
        if (a = n.col1.x * f + n.col2.x * s, s = n.col1.y * f + n.col2.y * s, f = a, n = g, 
        g = this.m_localAnchor2.x - this.m_localCenterB.x, b = this.m_localAnchor2.y - this.m_localCenterB.y, 
        a = n.col1.x * g + n.col2.x * b, b = n.col1.y * g + n.col2.y * b, g = a, n = o.x + g - l.x - f, 
        a = o.y + b - l.y - s, this.m_enableLimit) {
            this.m_axis = y.MulMV(r, this.m_localXAxis1), this.m_a1 = (n + f) * this.m_axis.y - (a + s) * this.m_axis.x, 
            this.m_a2 = g * this.m_axis.y - b * this.m_axis.x;
            var v = this.m_axis.x * n + this.m_axis.y * a;
            y.Abs(this.m_upperTranslation - this.m_lowerTranslation) < 2 * F.b2_linearSlop ? (m = y.Clamp(v, -F.b2_maxLinearCorrection, F.b2_maxLinearCorrection), 
            e = y.Abs(v), c = !0) : v <= this.m_lowerTranslation ? (m = y.Clamp(v - this.m_lowerTranslation + F.b2_linearSlop, -F.b2_maxLinearCorrection, 0), 
            e = this.m_lowerTranslation - v, c = !0) : v >= this.m_upperTranslation && (m = y.Clamp(v - this.m_upperTranslation + F.b2_linearSlop, 0, F.b2_maxLinearCorrection), 
            e = v - this.m_upperTranslation, c = !0);
        }
        return this.m_perp = y.MulMV(r, this.m_localYAxis1), this.m_s1 = (n + f) * this.m_perp.y - (a + s) * this.m_perp.x, 
        this.m_s2 = g * this.m_perp.y - b * this.m_perp.x, r = new w(), s = this.m_perp.x * n + this.m_perp.y * a, 
        e = y.Max(e, y.Abs(s)), f = 0, c ? (c = this.m_invMassA, g = this.m_invMassB, b = this.m_invIA, 
        n = this.m_invIB, this.m_K.col1.x = c + g + b * this.m_s1 * this.m_s1 + n * this.m_s2 * this.m_s2, 
        this.m_K.col1.y = b * this.m_s1 * this.m_a1 + n * this.m_s2 * this.m_a2, this.m_K.col2.x = this.m_K.col1.y, 
        this.m_K.col2.y = c + g + b * this.m_a1 * this.m_a1 + n * this.m_a2 * this.m_a2, 
        this.m_K.Solve(r, -s, -m)) : (c = this.m_invMassA, g = this.m_invMassB, b = this.m_invIA, 
        n = this.m_invIB, m = c + g + b * this.m_s1 * this.m_s1 + n * this.m_s2 * this.m_s2, 
        c = (c = 0) != m ? -s / m : 0, r.x = c, r.y = 0), m = r.x * this.m_perp.x + r.y * this.m_axis.x, 
        c = r.x * this.m_perp.y + r.y * this.m_axis.y, s = r.x * this.m_s1 + r.y * this.m_a1, 
        r = r.x * this.m_s2 + r.y * this.m_a2, l.x -= this.m_invMassA * m, l.y -= this.m_invMassA * c, 
        j -= this.m_invIA * s, o.x += this.m_invMassB * m, o.y += this.m_invMassB * c, q += this.m_invIB * r, 
        d.m_sweep.a = j, h.m_sweep.a = q, d.SynchronizeTransform(), h.SynchronizeTransform(), 
        e <= F.b2_linearSlop && f <= F.b2_angularSlop;
    }, Box2D.inherit(z, Box2D.Dynamics.Joints.b2JointDef), z.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype, 
    z.b2LineJointDef = function() {
        Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments), this.localAnchorA = new w(), 
        this.localAnchorB = new w(), this.localAxisA = new w();
    }, z.prototype.b2LineJointDef = function() {
        this.__super.b2JointDef.call(this), this.type = I.e_lineJoint, this.localAxisA.Set(1, 0), 
        this.enableLimit = !1, this.upperTranslation = this.lowerTranslation = 0, this.enableMotor = !1, 
        this.motorSpeed = this.maxMotorForce = 0;
    }, z.prototype.Initialize = function(d, h, l, j) {
        this.bodyA = d, this.bodyB = h, this.localAnchorA = this.bodyA.GetLocalPoint(l), 
        this.localAnchorB = this.bodyB.GetLocalPoint(l), this.localAxisA = this.bodyA.GetLocalVector(j);
    }, Box2D.inherit(u, Box2D.Dynamics.Joints.b2Joint), u.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype, 
    u.b2MouseJoint = function() {
        Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments), this.K = new G(), 
        this.K1 = new G(), this.K2 = new G(), this.m_localAnchor = new w(), this.m_target = new w(), 
        this.m_impulse = new w(), this.m_mass = new G(), this.m_C = new w();
    }, u.prototype.GetAnchorA = function() {
        return this.m_target;
    }, u.prototype.GetAnchorB = function() {
        return this.m_bodyB.GetWorldPoint(this.m_localAnchor);
    }, u.prototype.GetReactionForce = function(d) {
        return void 0 === d && (d = 0), new w(d * this.m_impulse.x, d * this.m_impulse.y);
    }, u.prototype.GetReactionTorque = function() {
        return 0;
    }, u.prototype.GetTarget = function() {
        return this.m_target;
    }, u.prototype.SetTarget = function(d) {
        0 == this.m_bodyB.IsAwake() && this.m_bodyB.SetAwake(!0), this.m_target = d;
    }, u.prototype.GetMaxForce = function() {
        return this.m_maxForce;
    }, u.prototype.SetMaxForce = function(d) {
        void 0 === d && (d = 0), this.m_maxForce = d;
    }, u.prototype.GetFrequency = function() {
        return this.m_frequencyHz;
    }, u.prototype.SetFrequency = function(d) {
        void 0 === d && (d = 0), this.m_frequencyHz = d;
    }, u.prototype.GetDampingRatio = function() {
        return this.m_dampingRatio;
    }, u.prototype.SetDampingRatio = function(d) {
        void 0 === d && (d = 0), this.m_dampingRatio = d;
    }, u.prototype.b2MouseJoint = function(d) {
        this.__super.b2Joint.call(this, d), this.m_target.SetV(d.target);
        var h = this.m_target.x - this.m_bodyB.m_xf.position.x, l = this.m_target.y - this.m_bodyB.m_xf.position.y, j = this.m_bodyB.m_xf.R;
        this.m_localAnchor.x = h * j.col1.x + l * j.col1.y, this.m_localAnchor.y = h * j.col2.x + l * j.col2.y, 
        this.m_maxForce = d.maxForce, this.m_impulse.SetZero(), this.m_frequencyHz = d.frequencyHz, 
        this.m_dampingRatio = d.dampingRatio, this.m_gamma = this.m_beta = 0;
    }, u.prototype.InitVelocityConstraints = function(d) {
        var h = this.m_bodyB, l = h.GetMass(), j = 2 * Math.PI * this.m_frequencyHz, o = l * j * j;
        this.m_gamma = d.dt * (2 * l * this.m_dampingRatio * j + d.dt * o), this.m_gamma = 0 != this.m_gamma ? 1 / this.m_gamma : 0, 
        this.m_beta = d.dt * o * this.m_gamma, o = h.m_xf.R, l = this.m_localAnchor.x - h.m_sweep.localCenter.x, 
        j = this.m_localAnchor.y - h.m_sweep.localCenter.y;
        var q = o.col1.x * l + o.col2.x * j;
        j = o.col1.y * l + o.col2.y * j, l = q, o = h.m_invMass, q = h.m_invI, this.K1.col1.x = o, 
        this.K1.col2.x = 0, this.K1.col1.y = 0, this.K1.col2.y = o, this.K2.col1.x = q * j * j, 
        this.K2.col2.x = -q * l * j, this.K2.col1.y = -q * l * j, this.K2.col2.y = q * l * l, 
        this.K.SetM(this.K1), this.K.AddM(this.K2), this.K.col1.x += this.m_gamma, this.K.col2.y += this.m_gamma, 
        this.K.GetInverse(this.m_mass), this.m_C.x = h.m_sweep.c.x + l - this.m_target.x, 
        this.m_C.y = h.m_sweep.c.y + j - this.m_target.y, h.m_angularVelocity *= .98, this.m_impulse.x *= d.dtRatio, 
        this.m_impulse.y *= d.dtRatio, h.m_linearVelocity.x += o * this.m_impulse.x, h.m_linearVelocity.y += o * this.m_impulse.y, 
        h.m_angularVelocity += q * (l * this.m_impulse.y - j * this.m_impulse.x);
    }, u.prototype.SolveVelocityConstraints = function(d) {
        var l, h = this.m_bodyB, j = 0, o = 0;
        l = h.m_xf.R;
        var q = this.m_localAnchor.x - h.m_sweep.localCenter.x, n = this.m_localAnchor.y - h.m_sweep.localCenter.y;
        j = l.col1.x * q + l.col2.x * n, n = l.col1.y * q + l.col2.y * n, q = j, j = h.m_linearVelocity.x + -h.m_angularVelocity * n;
        var a = h.m_linearVelocity.y + h.m_angularVelocity * q;
        l = this.m_mass, j = j + this.m_beta * this.m_C.x + this.m_gamma * this.m_impulse.x, 
        o = a + this.m_beta * this.m_C.y + this.m_gamma * this.m_impulse.y, a = -(l.col1.x * j + l.col2.x * o), 
        o = -(l.col1.y * j + l.col2.y * o), l = this.m_impulse.x, j = this.m_impulse.y, 
        this.m_impulse.x += a, this.m_impulse.y += o, d = d.dt * this.m_maxForce, this.m_impulse.LengthSquared() > d * d && this.m_impulse.Multiply(d / this.m_impulse.Length()), 
        a = this.m_impulse.x - l, o = this.m_impulse.y - j, h.m_linearVelocity.x += h.m_invMass * a, 
        h.m_linearVelocity.y += h.m_invMass * o, h.m_angularVelocity += h.m_invI * (q * o - n * a);
    }, u.prototype.SolvePositionConstraints = function() {
        return !0;
    }, Box2D.inherit(D, Box2D.Dynamics.Joints.b2JointDef), D.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype, 
    D.b2MouseJointDef = function() {
        Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments), this.target = new w();
    }, D.prototype.b2MouseJointDef = function() {
        this.__super.b2JointDef.call(this), this.type = I.e_mouseJoint, this.maxForce = 0, 
        this.frequencyHz = 5, this.dampingRatio = .7;
    }, Box2D.inherit(H, Box2D.Dynamics.Joints.b2Joint), H.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype, 
    H.b2PrismaticJoint = function() {
        Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments), this.m_localAnchor1 = new w(), 
        this.m_localAnchor2 = new w(), this.m_localXAxis1 = new w(), this.m_localYAxis1 = new w(), 
        this.m_axis = new w(), this.m_perp = new w(), this.m_K = new K(), this.m_impulse = new A();
    }, H.prototype.GetAnchorA = function() {
        return this.m_bodyA.GetWorldPoint(this.m_localAnchor1);
    }, H.prototype.GetAnchorB = function() {
        return this.m_bodyB.GetWorldPoint(this.m_localAnchor2);
    }, H.prototype.GetReactionForce = function(d) {
        return void 0 === d && (d = 0), new w(d * (this.m_impulse.x * this.m_perp.x + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.x), d * (this.m_impulse.x * this.m_perp.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.y));
    }, H.prototype.GetReactionTorque = function(d) {
        return void 0 === d && (d = 0), d * this.m_impulse.y;
    }, H.prototype.GetJointTranslation = function() {
        var d = this.m_bodyA, h = this.m_bodyB, l = d.GetWorldPoint(this.m_localAnchor1), j = h.GetWorldPoint(this.m_localAnchor2);
        return h = j.x - l.x, l = j.y - l.y, (d = d.GetWorldVector(this.m_localXAxis1)).x * h + d.y * l;
    }, H.prototype.GetJointSpeed = function() {
        var l, d = this.m_bodyA, h = this.m_bodyB;
        l = d.m_xf.R;
        var j = this.m_localAnchor1.x - d.m_sweep.localCenter.x, o = this.m_localAnchor1.y - d.m_sweep.localCenter.y, q = l.col1.x * j + l.col2.x * o;
        o = l.col1.y * j + l.col2.y * o, j = q, l = h.m_xf.R;
        var n = this.m_localAnchor2.x - h.m_sweep.localCenter.x, a = this.m_localAnchor2.y - h.m_sweep.localCenter.y;
        q = l.col1.x * n + l.col2.x * a, a = l.col1.y * n + l.col2.y * a, n = q, l = h.m_sweep.c.x + n - (d.m_sweep.c.x + j), 
        q = h.m_sweep.c.y + a - (d.m_sweep.c.y + o);
        var c = d.GetWorldVector(this.m_localXAxis1), g = d.m_linearVelocity, b = h.m_linearVelocity;
        return d = d.m_angularVelocity, h = h.m_angularVelocity, l * -d * c.y + q * d * c.x + (c.x * (b.x + -h * a - g.x - -d * o) + c.y * (b.y + h * n - g.y - d * j));
    }, H.prototype.IsLimitEnabled = function() {
        return this.m_enableLimit;
    }, H.prototype.EnableLimit = function(d) {
        this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_enableLimit = d;
    }, H.prototype.GetLowerLimit = function() {
        return this.m_lowerTranslation;
    }, H.prototype.GetUpperLimit = function() {
        return this.m_upperTranslation;
    }, H.prototype.SetLimits = function(d, h) {
        void 0 === d && (d = 0), void 0 === h && (h = 0), this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), 
        this.m_lowerTranslation = d, this.m_upperTranslation = h;
    }, H.prototype.IsMotorEnabled = function() {
        return this.m_enableMotor;
    }, H.prototype.EnableMotor = function(d) {
        this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_enableMotor = d;
    }, H.prototype.SetMotorSpeed = function(d) {
        void 0 === d && (d = 0), this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_motorSpeed = d;
    }, H.prototype.GetMotorSpeed = function() {
        return this.m_motorSpeed;
    }, H.prototype.SetMaxMotorForce = function(d) {
        void 0 === d && (d = 0), this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_maxMotorForce = d;
    }, H.prototype.GetMotorForce = function() {
        return this.m_motorImpulse;
    }, H.prototype.b2PrismaticJoint = function(d) {
        this.__super.b2Joint.call(this, d), this.m_localAnchor1.SetV(d.localAnchorA), this.m_localAnchor2.SetV(d.localAnchorB), 
        this.m_localXAxis1.SetV(d.localAxisA), this.m_localYAxis1.x = -this.m_localXAxis1.y, 
        this.m_localYAxis1.y = this.m_localXAxis1.x, this.m_refAngle = d.referenceAngle, 
        this.m_impulse.SetZero(), this.m_motorImpulse = this.m_motorMass = 0, this.m_lowerTranslation = d.lowerTranslation, 
        this.m_upperTranslation = d.upperTranslation, this.m_maxMotorForce = d.maxMotorForce, 
        this.m_motorSpeed = d.motorSpeed, this.m_enableLimit = d.enableLimit, this.m_enableMotor = d.enableMotor, 
        this.m_limitState = I.e_inactiveLimit, this.m_axis.SetZero(), this.m_perp.SetZero();
    }, H.prototype.InitVelocityConstraints = function(d) {
        var j, h = this.m_bodyA, l = this.m_bodyB, o = 0;
        this.m_localCenterA.SetV(h.GetLocalCenter()), this.m_localCenterB.SetV(l.GetLocalCenter());
        var q = h.GetTransform();
        l.GetTransform(), j = h.m_xf.R;
        var n = this.m_localAnchor1.x - this.m_localCenterA.x, a = this.m_localAnchor1.y - this.m_localCenterA.y;
        o = j.col1.x * n + j.col2.x * a, a = j.col1.y * n + j.col2.y * a, n = o, j = l.m_xf.R;
        var c = this.m_localAnchor2.x - this.m_localCenterB.x, g = this.m_localAnchor2.y - this.m_localCenterB.y;
        o = j.col1.x * c + j.col2.x * g, g = j.col1.y * c + j.col2.y * g, c = o, j = l.m_sweep.c.x + c - h.m_sweep.c.x - n, 
        o = l.m_sweep.c.y + g - h.m_sweep.c.y - a, this.m_invMassA = h.m_invMass, this.m_invMassB = l.m_invMass, 
        this.m_invIA = h.m_invI, this.m_invIB = l.m_invI, this.m_axis.SetV(y.MulMV(q.R, this.m_localXAxis1)), 
        this.m_a1 = (j + n) * this.m_axis.y - (o + a) * this.m_axis.x, this.m_a2 = c * this.m_axis.y - g * this.m_axis.x, 
        this.m_motorMass = this.m_invMassA + this.m_invMassB + this.m_invIA * this.m_a1 * this.m_a1 + this.m_invIB * this.m_a2 * this.m_a2, 
        this.m_motorMass > Number.MIN_VALUE && (this.m_motorMass = 1 / this.m_motorMass), 
        this.m_perp.SetV(y.MulMV(q.R, this.m_localYAxis1)), this.m_s1 = (j + n) * this.m_perp.y - (o + a) * this.m_perp.x, 
        this.m_s2 = c * this.m_perp.y - g * this.m_perp.x, q = this.m_invMassA, n = this.m_invMassB, 
        a = this.m_invIA, c = this.m_invIB, this.m_K.col1.x = q + n + a * this.m_s1 * this.m_s1 + c * this.m_s2 * this.m_s2, 
        this.m_K.col1.y = a * this.m_s1 + c * this.m_s2, this.m_K.col1.z = a * this.m_s1 * this.m_a1 + c * this.m_s2 * this.m_a2, 
        this.m_K.col2.x = this.m_K.col1.y, this.m_K.col2.y = a + c, this.m_K.col2.z = a * this.m_a1 + c * this.m_a2, 
        this.m_K.col3.x = this.m_K.col1.z, this.m_K.col3.y = this.m_K.col2.z, this.m_K.col3.z = q + n + a * this.m_a1 * this.m_a1 + c * this.m_a2 * this.m_a2, 
        this.m_enableLimit ? (j = this.m_axis.x * j + this.m_axis.y * o, y.Abs(this.m_upperTranslation - this.m_lowerTranslation) < 2 * F.b2_linearSlop ? this.m_limitState = I.e_equalLimits : j <= this.m_lowerTranslation ? this.m_limitState != I.e_atLowerLimit && (this.m_limitState = I.e_atLowerLimit, 
        this.m_impulse.z = 0) : j >= this.m_upperTranslation ? this.m_limitState != I.e_atUpperLimit && (this.m_limitState = I.e_atUpperLimit, 
        this.m_impulse.z = 0) : (this.m_limitState = I.e_inactiveLimit, this.m_impulse.z = 0)) : this.m_limitState = I.e_inactiveLimit, 
        0 == this.m_enableMotor && (this.m_motorImpulse = 0), d.warmStarting ? (this.m_impulse.x *= d.dtRatio, 
        this.m_impulse.y *= d.dtRatio, this.m_motorImpulse *= d.dtRatio, d = this.m_impulse.x * this.m_perp.x + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.x, 
        j = this.m_impulse.x * this.m_perp.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_axis.y, 
        o = this.m_impulse.x * this.m_s1 + this.m_impulse.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_a1, 
        q = this.m_impulse.x * this.m_s2 + this.m_impulse.y + (this.m_motorImpulse + this.m_impulse.z) * this.m_a2, 
        h.m_linearVelocity.x -= this.m_invMassA * d, h.m_linearVelocity.y -= this.m_invMassA * j, 
        h.m_angularVelocity -= this.m_invIA * o, l.m_linearVelocity.x += this.m_invMassB * d, 
        l.m_linearVelocity.y += this.m_invMassB * j, l.m_angularVelocity += this.m_invIB * q) : (this.m_impulse.SetZero(), 
        this.m_motorImpulse = 0);
    }, H.prototype.SolveVelocityConstraints = function(d) {
        var h = this.m_bodyA, l = this.m_bodyB, j = h.m_linearVelocity, o = h.m_angularVelocity, q = l.m_linearVelocity, n = l.m_angularVelocity, a = 0, c = 0, g = 0, b = 0;
        this.m_enableMotor && this.m_limitState != I.e_equalLimits && (b = this.m_motorMass * (this.m_motorSpeed - (this.m_axis.x * (q.x - j.x) + this.m_axis.y * (q.y - j.y) + this.m_a2 * n - this.m_a1 * o)), 
        a = this.m_motorImpulse, d = d.dt * this.m_maxMotorForce, this.m_motorImpulse = y.Clamp(this.m_motorImpulse + b, -d, d), 
        a = (b = this.m_motorImpulse - a) * this.m_axis.x, c = b * this.m_axis.y, g = b * this.m_a1, 
        b *= this.m_a2, j.x -= this.m_invMassA * a, j.y -= this.m_invMassA * c, o -= this.m_invIA * g, 
        q.x += this.m_invMassB * a, q.y += this.m_invMassB * c, n += this.m_invIB * b), 
        g = this.m_perp.x * (q.x - j.x) + this.m_perp.y * (q.y - j.y) + this.m_s2 * n - this.m_s1 * o, 
        c = n - o, b = this.m_enableLimit && this.m_limitState != I.e_inactiveLimit ? (d = this.m_axis.x * (q.x - j.x) + this.m_axis.y * (q.y - j.y) + this.m_a2 * n - this.m_a1 * o, 
        a = this.m_impulse.Copy(), d = this.m_K.Solve33(new A(), -g, -c, -d), this.m_impulse.Add(d), 
        this.m_limitState == I.e_atLowerLimit ? this.m_impulse.z = y.Max(this.m_impulse.z, 0) : this.m_limitState == I.e_atUpperLimit && (this.m_impulse.z = y.Min(this.m_impulse.z, 0)), 
        g = -g - (this.m_impulse.z - a.z) * this.m_K.col3.x, c = -c - (this.m_impulse.z - a.z) * this.m_K.col3.y, 
        (c = this.m_K.Solve22(new w(), g, c)).x += a.x, c.y += a.y, this.m_impulse.x = c.x, 
        this.m_impulse.y = c.y, d.x = this.m_impulse.x - a.x, d.y = this.m_impulse.y - a.y, 
        d.z = this.m_impulse.z - a.z, a = d.x * this.m_perp.x + d.z * this.m_axis.x, c = d.x * this.m_perp.y + d.z * this.m_axis.y, 
        g = d.x * this.m_s1 + d.y + d.z * this.m_a1, d.x * this.m_s2 + d.y + d.z * this.m_a2) : (d = this.m_K.Solve22(new w(), -g, -c), 
        this.m_impulse.x += d.x, this.m_impulse.y += d.y, a = d.x * this.m_perp.x, c = d.x * this.m_perp.y, 
        g = d.x * this.m_s1 + d.y, d.x * this.m_s2 + d.y), j.x -= this.m_invMassA * a, j.y -= this.m_invMassA * c, 
        o -= this.m_invIA * g, q.x += this.m_invMassB * a, q.y += this.m_invMassB * c, n += this.m_invIB * b, 
        h.m_linearVelocity.SetV(j), h.m_angularVelocity = o, l.m_linearVelocity.SetV(q), 
        l.m_angularVelocity = n;
    }, H.prototype.SolvePositionConstraints = function() {
        var n, d = this.m_bodyA, h = this.m_bodyB, l = d.m_sweep.c, j = d.m_sweep.a, o = h.m_sweep.c, q = h.m_sweep.a, a = 0, c = 0, g = 0, b = a = n = 0, e = 0;
        c = !1;
        var f = 0, m = G.FromAngle(j), r = G.FromAngle(q);
        n = m, e = this.m_localAnchor1.x - this.m_localCenterA.x;
        var s = this.m_localAnchor1.y - this.m_localCenterA.y;
        if (a = n.col1.x * e + n.col2.x * s, s = n.col1.y * e + n.col2.y * s, e = a, n = r, 
        r = this.m_localAnchor2.x - this.m_localCenterB.x, g = this.m_localAnchor2.y - this.m_localCenterB.y, 
        a = n.col1.x * r + n.col2.x * g, g = n.col1.y * r + n.col2.y * g, r = a, n = o.x + r - l.x - e, 
        a = o.y + g - l.y - s, this.m_enableLimit) {
            this.m_axis = y.MulMV(m, this.m_localXAxis1), this.m_a1 = (n + e) * this.m_axis.y - (a + s) * this.m_axis.x, 
            this.m_a2 = r * this.m_axis.y - g * this.m_axis.x;
            var v = this.m_axis.x * n + this.m_axis.y * a;
            y.Abs(this.m_upperTranslation - this.m_lowerTranslation) < 2 * F.b2_linearSlop ? (f = y.Clamp(v, -F.b2_maxLinearCorrection, F.b2_maxLinearCorrection), 
            b = y.Abs(v), c = !0) : v <= this.m_lowerTranslation ? (f = y.Clamp(v - this.m_lowerTranslation + F.b2_linearSlop, -F.b2_maxLinearCorrection, 0), 
            b = this.m_lowerTranslation - v, c = !0) : v >= this.m_upperTranslation && (f = y.Clamp(v - this.m_upperTranslation + F.b2_linearSlop, 0, F.b2_maxLinearCorrection), 
            b = v - this.m_upperTranslation, c = !0);
        }
        return this.m_perp = y.MulMV(m, this.m_localYAxis1), this.m_s1 = (n + e) * this.m_perp.y - (a + s) * this.m_perp.x, 
        this.m_s2 = r * this.m_perp.y - g * this.m_perp.x, m = new A(), s = this.m_perp.x * n + this.m_perp.y * a, 
        r = q - j - this.m_refAngle, b = y.Max(b, y.Abs(s)), e = y.Abs(r), c ? (c = this.m_invMassA, 
        g = this.m_invMassB, n = this.m_invIA, a = this.m_invIB, this.m_K.col1.x = c + g + n * this.m_s1 * this.m_s1 + a * this.m_s2 * this.m_s2, 
        this.m_K.col1.y = n * this.m_s1 + a * this.m_s2, this.m_K.col1.z = n * this.m_s1 * this.m_a1 + a * this.m_s2 * this.m_a2, 
        this.m_K.col2.x = this.m_K.col1.y, this.m_K.col2.y = n + a, this.m_K.col2.z = n * this.m_a1 + a * this.m_a2, 
        this.m_K.col3.x = this.m_K.col1.z, this.m_K.col3.y = this.m_K.col2.z, this.m_K.col3.z = c + g + n * this.m_a1 * this.m_a1 + a * this.m_a2 * this.m_a2, 
        this.m_K.Solve33(m, -s, -r, -f)) : (c = this.m_invMassA, g = this.m_invMassB, n = this.m_invIA, 
        a = this.m_invIB, f = n * this.m_s1 + a * this.m_s2, v = n + a, this.m_K.col1.Set(c + g + n * this.m_s1 * this.m_s1 + a * this.m_s2 * this.m_s2, f, 0), 
        this.m_K.col2.Set(f, v, 0), f = this.m_K.Solve22(new w(), -s, -r), m.x = f.x, m.y = f.y, 
        m.z = 0), f = m.x * this.m_perp.x + m.z * this.m_axis.x, c = m.x * this.m_perp.y + m.z * this.m_axis.y, 
        s = m.x * this.m_s1 + m.y + m.z * this.m_a1, m = m.x * this.m_s2 + m.y + m.z * this.m_a2, 
        l.x -= this.m_invMassA * f, l.y -= this.m_invMassA * c, j -= this.m_invIA * s, o.x += this.m_invMassB * f, 
        o.y += this.m_invMassB * c, q += this.m_invIB * m, d.m_sweep.a = j, h.m_sweep.a = q, 
        d.SynchronizeTransform(), h.SynchronizeTransform(), b <= F.b2_linearSlop && e <= F.b2_angularSlop;
    }, Box2D.inherit(O, Box2D.Dynamics.Joints.b2JointDef), O.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype, 
    O.b2PrismaticJointDef = function() {
        Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments), this.localAnchorA = new w(), 
        this.localAnchorB = new w(), this.localAxisA = new w();
    }, O.prototype.b2PrismaticJointDef = function() {
        this.__super.b2JointDef.call(this), this.type = I.e_prismaticJoint, this.localAxisA.Set(1, 0), 
        this.referenceAngle = 0, this.enableLimit = !1, this.upperTranslation = this.lowerTranslation = 0, 
        this.enableMotor = !1, this.motorSpeed = this.maxMotorForce = 0;
    }, O.prototype.Initialize = function(d, h, l, j) {
        this.bodyA = d, this.bodyB = h, this.localAnchorA = this.bodyA.GetLocalPoint(l), 
        this.localAnchorB = this.bodyB.GetLocalPoint(l), this.localAxisA = this.bodyA.GetLocalVector(j), 
        this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle();
    }, Box2D.inherit(E, Box2D.Dynamics.Joints.b2Joint), E.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype, 
    E.b2PulleyJoint = function() {
        Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments), this.m_groundAnchor1 = new w(), 
        this.m_groundAnchor2 = new w(), this.m_localAnchor1 = new w(), this.m_localAnchor2 = new w(), 
        this.m_u1 = new w(), this.m_u2 = new w();
    }, E.prototype.GetAnchorA = function() {
        return this.m_bodyA.GetWorldPoint(this.m_localAnchor1);
    }, E.prototype.GetAnchorB = function() {
        return this.m_bodyB.GetWorldPoint(this.m_localAnchor2);
    }, E.prototype.GetReactionForce = function(d) {
        return void 0 === d && (d = 0), new w(d * this.m_impulse * this.m_u2.x, d * this.m_impulse * this.m_u2.y);
    }, E.prototype.GetReactionTorque = function() {
        return 0;
    }, E.prototype.GetGroundAnchorA = function() {
        var d = this.m_ground.m_xf.position.Copy();
        return d.Add(this.m_groundAnchor1), d;
    }, E.prototype.GetGroundAnchorB = function() {
        var d = this.m_ground.m_xf.position.Copy();
        return d.Add(this.m_groundAnchor2), d;
    }, E.prototype.GetLength1 = function() {
        var d = this.m_bodyA.GetWorldPoint(this.m_localAnchor1), h = d.x - (this.m_ground.m_xf.position.x + this.m_groundAnchor1.x);
        return d = d.y - (this.m_ground.m_xf.position.y + this.m_groundAnchor1.y), Math.sqrt(h * h + d * d);
    }, E.prototype.GetLength2 = function() {
        var d = this.m_bodyB.GetWorldPoint(this.m_localAnchor2), h = d.x - (this.m_ground.m_xf.position.x + this.m_groundAnchor2.x);
        return d = d.y - (this.m_ground.m_xf.position.y + this.m_groundAnchor2.y), Math.sqrt(h * h + d * d);
    }, E.prototype.GetRatio = function() {
        return this.m_ratio;
    }, E.prototype.b2PulleyJoint = function(d) {
        this.__super.b2Joint.call(this, d), this.m_ground = this.m_bodyA.m_world.m_groundBody, 
        this.m_groundAnchor1.x = d.groundAnchorA.x - this.m_ground.m_xf.position.x, this.m_groundAnchor1.y = d.groundAnchorA.y - this.m_ground.m_xf.position.y, 
        this.m_groundAnchor2.x = d.groundAnchorB.x - this.m_ground.m_xf.position.x, this.m_groundAnchor2.y = d.groundAnchorB.y - this.m_ground.m_xf.position.y, 
        this.m_localAnchor1.SetV(d.localAnchorA), this.m_localAnchor2.SetV(d.localAnchorB), 
        this.m_ratio = d.ratio, this.m_constant = d.lengthA + this.m_ratio * d.lengthB, 
        this.m_maxLength1 = y.Min(d.maxLengthA, this.m_constant - this.m_ratio * E.b2_minPulleyLength), 
        this.m_maxLength2 = y.Min(d.maxLengthB, (this.m_constant - E.b2_minPulleyLength) / this.m_ratio), 
        this.m_limitImpulse2 = this.m_limitImpulse1 = this.m_impulse = 0;
    }, E.prototype.InitVelocityConstraints = function(d) {
        var j, h = this.m_bodyA, l = this.m_bodyB;
        j = h.m_xf.R;
        var o = this.m_localAnchor1.x - h.m_sweep.localCenter.x, q = this.m_localAnchor1.y - h.m_sweep.localCenter.y, n = j.col1.x * o + j.col2.x * q;
        q = j.col1.y * o + j.col2.y * q, o = n, j = l.m_xf.R;
        var a = this.m_localAnchor2.x - l.m_sweep.localCenter.x, c = this.m_localAnchor2.y - l.m_sweep.localCenter.y;
        n = j.col1.x * a + j.col2.x * c, c = j.col1.y * a + j.col2.y * c, a = n, j = l.m_sweep.c.x + a, 
        n = l.m_sweep.c.y + c;
        var g = this.m_ground.m_xf.position.x + this.m_groundAnchor2.x, b = this.m_ground.m_xf.position.y + this.m_groundAnchor2.y;
        this.m_u1.Set(h.m_sweep.c.x + o - (this.m_ground.m_xf.position.x + this.m_groundAnchor1.x), h.m_sweep.c.y + q - (this.m_ground.m_xf.position.y + this.m_groundAnchor1.y)), 
        this.m_u2.Set(j - g, n - b), j = this.m_u1.Length(), n = this.m_u2.Length(), j > F.b2_linearSlop ? this.m_u1.Multiply(1 / j) : this.m_u1.SetZero(), 
        n > F.b2_linearSlop ? this.m_u2.Multiply(1 / n) : this.m_u2.SetZero(), 0 < this.m_constant - j - this.m_ratio * n ? (this.m_state = I.e_inactiveLimit, 
        this.m_impulse = 0) : this.m_state = I.e_atUpperLimit, j < this.m_maxLength1 ? (this.m_limitState1 = I.e_inactiveLimit, 
        this.m_limitImpulse1 = 0) : this.m_limitState1 = I.e_atUpperLimit, n < this.m_maxLength2 ? (this.m_limitState2 = I.e_inactiveLimit, 
        this.m_limitImpulse2 = 0) : this.m_limitState2 = I.e_atUpperLimit, j = o * this.m_u1.y - q * this.m_u1.x, 
        n = a * this.m_u2.y - c * this.m_u2.x, this.m_limitMass1 = h.m_invMass + h.m_invI * j * j, 
        this.m_limitMass2 = l.m_invMass + l.m_invI * n * n, this.m_pulleyMass = this.m_limitMass1 + this.m_ratio * this.m_ratio * this.m_limitMass2, 
        this.m_limitMass1 = 1 / this.m_limitMass1, this.m_limitMass2 = 1 / this.m_limitMass2, 
        this.m_pulleyMass = 1 / this.m_pulleyMass, d.warmStarting ? (this.m_impulse *= d.dtRatio, 
        this.m_limitImpulse1 *= d.dtRatio, this.m_limitImpulse2 *= d.dtRatio, d = (-this.m_impulse - this.m_limitImpulse1) * this.m_u1.x, 
        j = (-this.m_impulse - this.m_limitImpulse1) * this.m_u1.y, n = (-this.m_ratio * this.m_impulse - this.m_limitImpulse2) * this.m_u2.x, 
        g = (-this.m_ratio * this.m_impulse - this.m_limitImpulse2) * this.m_u2.y, h.m_linearVelocity.x += h.m_invMass * d, 
        h.m_linearVelocity.y += h.m_invMass * j, h.m_angularVelocity += h.m_invI * (o * j - q * d), 
        l.m_linearVelocity.x += l.m_invMass * n, l.m_linearVelocity.y += l.m_invMass * g, 
        l.m_angularVelocity += l.m_invI * (a * g - c * n)) : this.m_limitImpulse2 = this.m_limitImpulse1 = this.m_impulse = 0;
    }, E.prototype.SolveVelocityConstraints = function() {
        var l, d = this.m_bodyA, h = this.m_bodyB;
        l = d.m_xf.R;
        var j = this.m_localAnchor1.x - d.m_sweep.localCenter.x, o = this.m_localAnchor1.y - d.m_sweep.localCenter.y, q = l.col1.x * j + l.col2.x * o;
        o = l.col1.y * j + l.col2.y * o, j = q, l = h.m_xf.R;
        var n = this.m_localAnchor2.x - h.m_sweep.localCenter.x, a = this.m_localAnchor2.y - h.m_sweep.localCenter.y;
        q = l.col1.x * n + l.col2.x * a, a = l.col1.y * n + l.col2.y * a, n = q;
        var c = q = l = 0, g = 0;
        l = g = l = g = c = q = l = 0, this.m_state == I.e_atUpperLimit && (l = d.m_linearVelocity.x + -d.m_angularVelocity * o, 
        q = d.m_linearVelocity.y + d.m_angularVelocity * j, c = h.m_linearVelocity.x + -h.m_angularVelocity * a, 
        g = h.m_linearVelocity.y + h.m_angularVelocity * n, l = -(this.m_u1.x * l + this.m_u1.y * q) - this.m_ratio * (this.m_u2.x * c + this.m_u2.y * g), 
        g = this.m_pulleyMass * -l, l = this.m_impulse, this.m_impulse = y.Max(0, this.m_impulse + g), 
        l = -(g = this.m_impulse - l) * this.m_u1.x, q = -g * this.m_u1.y, c = -this.m_ratio * g * this.m_u2.x, 
        g = -this.m_ratio * g * this.m_u2.y, d.m_linearVelocity.x += d.m_invMass * l, d.m_linearVelocity.y += d.m_invMass * q, 
        d.m_angularVelocity += d.m_invI * (j * q - o * l), h.m_linearVelocity.x += h.m_invMass * c, 
        h.m_linearVelocity.y += h.m_invMass * g, h.m_angularVelocity += h.m_invI * (n * g - a * c)), 
        this.m_limitState1 == I.e_atUpperLimit && (l = d.m_linearVelocity.x + -d.m_angularVelocity * o, 
        q = d.m_linearVelocity.y + d.m_angularVelocity * j, l = -(this.m_u1.x * l + this.m_u1.y * q), 
        g = -this.m_limitMass1 * l, l = this.m_limitImpulse1, this.m_limitImpulse1 = y.Max(0, this.m_limitImpulse1 + g), 
        l = -(g = this.m_limitImpulse1 - l) * this.m_u1.x, q = -g * this.m_u1.y, d.m_linearVelocity.x += d.m_invMass * l, 
        d.m_linearVelocity.y += d.m_invMass * q, d.m_angularVelocity += d.m_invI * (j * q - o * l)), 
        this.m_limitState2 == I.e_atUpperLimit && (c = h.m_linearVelocity.x + -h.m_angularVelocity * a, 
        g = h.m_linearVelocity.y + h.m_angularVelocity * n, l = -(this.m_u2.x * c + this.m_u2.y * g), 
        g = -this.m_limitMass2 * l, l = this.m_limitImpulse2, this.m_limitImpulse2 = y.Max(0, this.m_limitImpulse2 + g), 
        c = -(g = this.m_limitImpulse2 - l) * this.m_u2.x, g = -g * this.m_u2.y, h.m_linearVelocity.x += h.m_invMass * c, 
        h.m_linearVelocity.y += h.m_invMass * g, h.m_angularVelocity += h.m_invI * (n * g - a * c));
    }, E.prototype.SolvePositionConstraints = function() {
        var l, d = this.m_bodyA, h = this.m_bodyB, j = this.m_ground.m_xf.position.x + this.m_groundAnchor1.x, o = this.m_ground.m_xf.position.y + this.m_groundAnchor1.y, q = this.m_ground.m_xf.position.x + this.m_groundAnchor2.x, n = this.m_ground.m_xf.position.y + this.m_groundAnchor2.y, a = 0, c = 0, g = 0, b = 0, e = l = 0, f = 0, m = 0, r = e = m = l = e = l = 0;
        return this.m_state == I.e_atUpperLimit && (l = d.m_xf.R, a = this.m_localAnchor1.x - d.m_sweep.localCenter.x, 
        c = this.m_localAnchor1.y - d.m_sweep.localCenter.y, e = l.col1.x * a + l.col2.x * c, 
        c = l.col1.y * a + l.col2.y * c, a = e, l = h.m_xf.R, g = this.m_localAnchor2.x - h.m_sweep.localCenter.x, 
        b = this.m_localAnchor2.y - h.m_sweep.localCenter.y, e = l.col1.x * g + l.col2.x * b, 
        b = l.col1.y * g + l.col2.y * b, g = e, l = d.m_sweep.c.x + a, e = d.m_sweep.c.y + c, 
        f = h.m_sweep.c.x + g, m = h.m_sweep.c.y + b, this.m_u1.Set(l - j, e - o), this.m_u2.Set(f - q, m - n), 
        l = this.m_u1.Length(), e = this.m_u2.Length(), l > F.b2_linearSlop ? this.m_u1.Multiply(1 / l) : this.m_u1.SetZero(), 
        e > F.b2_linearSlop ? this.m_u2.Multiply(1 / e) : this.m_u2.SetZero(), l = this.m_constant - l - this.m_ratio * e, 
        r = y.Max(r, -l), l = y.Clamp(l + F.b2_linearSlop, -F.b2_maxLinearCorrection, 0), 
        l = -(m = -this.m_pulleyMass * l) * this.m_u1.x, e = -m * this.m_u1.y, f = -this.m_ratio * m * this.m_u2.x, 
        m = -this.m_ratio * m * this.m_u2.y, d.m_sweep.c.x += d.m_invMass * l, d.m_sweep.c.y += d.m_invMass * e, 
        d.m_sweep.a += d.m_invI * (a * e - c * l), h.m_sweep.c.x += h.m_invMass * f, h.m_sweep.c.y += h.m_invMass * m, 
        h.m_sweep.a += h.m_invI * (g * m - b * f), d.SynchronizeTransform(), h.SynchronizeTransform()), 
        this.m_limitState1 == I.e_atUpperLimit && (l = d.m_xf.R, a = this.m_localAnchor1.x - d.m_sweep.localCenter.x, 
        c = this.m_localAnchor1.y - d.m_sweep.localCenter.y, e = l.col1.x * a + l.col2.x * c, 
        c = l.col1.y * a + l.col2.y * c, a = e, l = d.m_sweep.c.x + a, e = d.m_sweep.c.y + c, 
        this.m_u1.Set(l - j, e - o), (l = this.m_u1.Length()) > F.b2_linearSlop ? (this.m_u1.x *= 1 / l, 
        this.m_u1.y *= 1 / l) : this.m_u1.SetZero(), l = this.m_maxLength1 - l, r = y.Max(r, -l), 
        l = y.Clamp(l + F.b2_linearSlop, -F.b2_maxLinearCorrection, 0), l = -(m = -this.m_limitMass1 * l) * this.m_u1.x, 
        e = -m * this.m_u1.y, d.m_sweep.c.x += d.m_invMass * l, d.m_sweep.c.y += d.m_invMass * e, 
        d.m_sweep.a += d.m_invI * (a * e - c * l), d.SynchronizeTransform()), this.m_limitState2 == I.e_atUpperLimit && (l = h.m_xf.R, 
        g = this.m_localAnchor2.x - h.m_sweep.localCenter.x, b = this.m_localAnchor2.y - h.m_sweep.localCenter.y, 
        e = l.col1.x * g + l.col2.x * b, b = l.col1.y * g + l.col2.y * b, g = e, f = h.m_sweep.c.x + g, 
        m = h.m_sweep.c.y + b, this.m_u2.Set(f - q, m - n), (e = this.m_u2.Length()) > F.b2_linearSlop ? (this.m_u2.x *= 1 / e, 
        this.m_u2.y *= 1 / e) : this.m_u2.SetZero(), l = this.m_maxLength2 - e, r = y.Max(r, -l), 
        l = y.Clamp(l + F.b2_linearSlop, -F.b2_maxLinearCorrection, 0), f = -(m = -this.m_limitMass2 * l) * this.m_u2.x, 
        m = -m * this.m_u2.y, h.m_sweep.c.x += h.m_invMass * f, h.m_sweep.c.y += h.m_invMass * m, 
        h.m_sweep.a += h.m_invI * (g * m - b * f), h.SynchronizeTransform()), r < F.b2_linearSlop;
    }, Box2D.postDefs.push(function() {
        Box2D.Dynamics.Joints.b2PulleyJoint.b2_minPulleyLength = 2;
    }), Box2D.inherit(R, Box2D.Dynamics.Joints.b2JointDef), R.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype, 
    R.b2PulleyJointDef = function() {
        Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments), this.groundAnchorA = new w(), 
        this.groundAnchorB = new w(), this.localAnchorA = new w(), this.localAnchorB = new w();
    }, R.prototype.b2PulleyJointDef = function() {
        this.__super.b2JointDef.call(this), this.type = I.e_pulleyJoint, this.groundAnchorA.Set(-1, 1), 
        this.groundAnchorB.Set(1, 1), this.localAnchorA.Set(-1, 0), this.localAnchorB.Set(1, 0), 
        this.maxLengthB = this.lengthB = this.maxLengthA = this.lengthA = 0, this.ratio = 1, 
        this.collideConnected = !0;
    }, R.prototype.Initialize = function(d, h, l, j, o, q, n) {
        void 0 === n && (n = 0), this.bodyA = d, this.bodyB = h, this.groundAnchorA.SetV(l), 
        this.groundAnchorB.SetV(j), this.localAnchorA = this.bodyA.GetLocalPoint(o), this.localAnchorB = this.bodyB.GetLocalPoint(q), 
        d = o.x - l.x, l = o.y - l.y, this.lengthA = Math.sqrt(d * d + l * l), l = q.x - j.x, 
        j = q.y - j.y, this.lengthB = Math.sqrt(l * l + j * j), this.ratio = n, n = this.lengthA + this.ratio * this.lengthB, 
        this.maxLengthA = n - this.ratio * E.b2_minPulleyLength, this.maxLengthB = (n - E.b2_minPulleyLength) / this.ratio;
    }, Box2D.inherit(N, Box2D.Dynamics.Joints.b2Joint), N.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype, 
    N.b2RevoluteJoint = function() {
        Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments), this.K = new G(), 
        this.K1 = new G(), this.K2 = new G(), this.K3 = new G(), this.impulse3 = new A(), 
        this.impulse2 = new w(), this.reduced = new w(), this.m_localAnchor1 = new w(), 
        this.m_localAnchor2 = new w(), this.m_impulse = new A(), this.m_mass = new K();
    }, N.prototype.GetAnchorA = function() {
        return this.m_bodyA.GetWorldPoint(this.m_localAnchor1);
    }, N.prototype.GetAnchorB = function() {
        return this.m_bodyB.GetWorldPoint(this.m_localAnchor2);
    }, N.prototype.GetReactionForce = function(d) {
        return void 0 === d && (d = 0), new w(d * this.m_impulse.x, d * this.m_impulse.y);
    }, N.prototype.GetReactionTorque = function(d) {
        return void 0 === d && (d = 0), d * this.m_impulse.z;
    }, N.prototype.GetJointAngle = function() {
        return this.m_bodyB.m_sweep.a - this.m_bodyA.m_sweep.a - this.m_referenceAngle;
    }, N.prototype.GetJointSpeed = function() {
        return this.m_bodyB.m_angularVelocity - this.m_bodyA.m_angularVelocity;
    }, N.prototype.IsLimitEnabled = function() {
        return this.m_enableLimit;
    }, N.prototype.EnableLimit = function(d) {
        this.m_enableLimit = d;
    }, N.prototype.GetLowerLimit = function() {
        return this.m_lowerAngle;
    }, N.prototype.GetUpperLimit = function() {
        return this.m_upperAngle;
    }, N.prototype.SetLimits = function(d, h) {
        void 0 === d && (d = 0), void 0 === h && (h = 0), this.m_lowerAngle = d, this.m_upperAngle = h;
    }, N.prototype.IsMotorEnabled = function() {
        return this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_enableMotor;
    }, N.prototype.EnableMotor = function(d) {
        this.m_enableMotor = d;
    }, N.prototype.SetMotorSpeed = function(d) {
        void 0 === d && (d = 0), this.m_bodyA.SetAwake(!0), this.m_bodyB.SetAwake(!0), this.m_motorSpeed = d;
    }, N.prototype.GetMotorSpeed = function() {
        return this.m_motorSpeed;
    }, N.prototype.SetMaxMotorTorque = function(d) {
        void 0 === d && (d = 0), this.m_maxMotorTorque = d;
    }, N.prototype.GetMotorTorque = function() {
        return this.m_maxMotorTorque;
    }, N.prototype.b2RevoluteJoint = function(d) {
        this.__super.b2Joint.call(this, d), this.m_localAnchor1.SetV(d.localAnchorA), this.m_localAnchor2.SetV(d.localAnchorB), 
        this.m_referenceAngle = d.referenceAngle, this.m_impulse.SetZero(), this.m_motorImpulse = 0, 
        this.m_lowerAngle = d.lowerAngle, this.m_upperAngle = d.upperAngle, this.m_maxMotorTorque = d.maxMotorTorque, 
        this.m_motorSpeed = d.motorSpeed, this.m_enableLimit = d.enableLimit, this.m_enableMotor = d.enableMotor, 
        this.m_limitState = I.e_inactiveLimit;
    }, N.prototype.InitVelocityConstraints = function(d) {
        var j, h = this.m_bodyA, l = this.m_bodyB, o = 0;
        j = h.m_xf.R;
        var q = this.m_localAnchor1.x - h.m_sweep.localCenter.x, n = this.m_localAnchor1.y - h.m_sweep.localCenter.y;
        o = j.col1.x * q + j.col2.x * n, n = j.col1.y * q + j.col2.y * n, q = o, j = l.m_xf.R;
        var a = this.m_localAnchor2.x - l.m_sweep.localCenter.x, c = this.m_localAnchor2.y - l.m_sweep.localCenter.y;
        o = j.col1.x * a + j.col2.x * c, c = j.col1.y * a + j.col2.y * c, a = o, j = h.m_invMass, 
        o = l.m_invMass;
        var g = h.m_invI, b = l.m_invI;
        if (this.m_mass.col1.x = j + o + n * n * g + c * c * b, this.m_mass.col2.x = -n * q * g - c * a * b, 
        this.m_mass.col3.x = -n * g - c * b, this.m_mass.col1.y = this.m_mass.col2.x, this.m_mass.col2.y = j + o + q * q * g + a * a * b, 
        this.m_mass.col3.y = q * g + a * b, this.m_mass.col1.z = this.m_mass.col3.x, this.m_mass.col2.z = this.m_mass.col3.y, 
        this.m_mass.col3.z = g + b, this.m_motorMass = 1 / (g + b), 0 == this.m_enableMotor && (this.m_motorImpulse = 0), 
        this.m_enableLimit) {
            var e = l.m_sweep.a - h.m_sweep.a - this.m_referenceAngle;
            y.Abs(this.m_upperAngle - this.m_lowerAngle) < 2 * F.b2_angularSlop ? this.m_limitState = I.e_equalLimits : e <= this.m_lowerAngle ? (this.m_limitState != I.e_atLowerLimit && (this.m_impulse.z = 0), 
            this.m_limitState = I.e_atLowerLimit) : e >= this.m_upperAngle ? (this.m_limitState != I.e_atUpperLimit && (this.m_impulse.z = 0), 
            this.m_limitState = I.e_atUpperLimit) : (this.m_limitState = I.e_inactiveLimit, 
            this.m_impulse.z = 0);
        } else this.m_limitState = I.e_inactiveLimit;
        d.warmStarting ? (this.m_impulse.x *= d.dtRatio, this.m_impulse.y *= d.dtRatio, 
        this.m_motorImpulse *= d.dtRatio, d = this.m_impulse.x, e = this.m_impulse.y, h.m_linearVelocity.x -= j * d, 
        h.m_linearVelocity.y -= j * e, h.m_angularVelocity -= g * (q * e - n * d + this.m_motorImpulse + this.m_impulse.z), 
        l.m_linearVelocity.x += o * d, l.m_linearVelocity.y += o * e, l.m_angularVelocity += b * (a * e - c * d + this.m_motorImpulse + this.m_impulse.z)) : (this.m_impulse.SetZero(), 
        this.m_motorImpulse = 0);
    }, N.prototype.SolveVelocityConstraints = function(d) {
        var h = this.m_bodyA, l = this.m_bodyB, j = 0, o = j = 0, q = 0, n = 0, a = 0, c = h.m_linearVelocity, g = h.m_angularVelocity, b = l.m_linearVelocity, e = l.m_angularVelocity, f = h.m_invMass, m = l.m_invMass, r = h.m_invI, s = l.m_invI;
        if (this.m_enableMotor && this.m_limitState != I.e_equalLimits && (o = this.m_motorMass * -(e - g - this.m_motorSpeed), 
        q = this.m_motorImpulse, n = d.dt * this.m_maxMotorTorque, this.m_motorImpulse = y.Clamp(this.m_motorImpulse + o, -n, n), 
        g -= r * (o = this.m_motorImpulse - q), e += s * o), this.m_enableLimit && this.m_limitState != I.e_inactiveLimit) {
            d = h.m_xf.R, o = this.m_localAnchor1.x - h.m_sweep.localCenter.x, q = this.m_localAnchor1.y - h.m_sweep.localCenter.y, 
            j = d.col1.x * o + d.col2.x * q, q = d.col1.y * o + d.col2.y * q, o = j, d = l.m_xf.R, 
            n = this.m_localAnchor2.x - l.m_sweep.localCenter.x, a = this.m_localAnchor2.y - l.m_sweep.localCenter.y, 
            j = d.col1.x * n + d.col2.x * a, a = d.col1.y * n + d.col2.y * a, n = j, d = b.x + -e * a - c.x - -g * q;
            var v = b.y + e * n - c.y - g * o;
            this.m_mass.Solve33(this.impulse3, -d, -v, -(e - g)), this.m_limitState == I.e_equalLimits ? this.m_impulse.Add(this.impulse3) : this.m_limitState == I.e_atLowerLimit ? (j = this.m_impulse.z + this.impulse3.z) < 0 && (this.m_mass.Solve22(this.reduced, -d, -v), 
            this.impulse3.x = this.reduced.x, this.impulse3.y = this.reduced.y, this.impulse3.z = -this.m_impulse.z, 
            this.m_impulse.x += this.reduced.x, this.m_impulse.y += this.reduced.y, this.m_impulse.z = 0) : this.m_limitState == I.e_atUpperLimit && 0 < (j = this.m_impulse.z + this.impulse3.z) && (this.m_mass.Solve22(this.reduced, -d, -v), 
            this.impulse3.x = this.reduced.x, this.impulse3.y = this.reduced.y, this.impulse3.z = -this.m_impulse.z, 
            this.m_impulse.x += this.reduced.x, this.m_impulse.y += this.reduced.y, this.m_impulse.z = 0), 
            c.x -= f * this.impulse3.x, c.y -= f * this.impulse3.y, g -= r * (o * this.impulse3.y - q * this.impulse3.x + this.impulse3.z), 
            b.x += m * this.impulse3.x, b.y += m * this.impulse3.y, e += s * (n * this.impulse3.y - a * this.impulse3.x + this.impulse3.z);
        } else d = h.m_xf.R, o = this.m_localAnchor1.x - h.m_sweep.localCenter.x, q = this.m_localAnchor1.y - h.m_sweep.localCenter.y, 
        j = d.col1.x * o + d.col2.x * q, q = d.col1.y * o + d.col2.y * q, o = j, d = l.m_xf.R, 
        n = this.m_localAnchor2.x - l.m_sweep.localCenter.x, a = this.m_localAnchor2.y - l.m_sweep.localCenter.y, 
        j = d.col1.x * n + d.col2.x * a, a = d.col1.y * n + d.col2.y * a, n = j, this.m_mass.Solve22(this.impulse2, -(b.x + -e * a - c.x - -g * q), -(b.y + e * n - c.y - g * o)), 
        this.m_impulse.x += this.impulse2.x, this.m_impulse.y += this.impulse2.y, c.x -= f * this.impulse2.x, 
        c.y -= f * this.impulse2.y, g -= r * (o * this.impulse2.y - q * this.impulse2.x), 
        b.x += m * this.impulse2.x, b.y += m * this.impulse2.y, e += s * (n * this.impulse2.y - a * this.impulse2.x);
        h.m_linearVelocity.SetV(c), h.m_angularVelocity = g, l.m_linearVelocity.SetV(b), 
        l.m_angularVelocity = e;
    }, N.prototype.SolvePositionConstraints = function() {
        var h, d = 0, l = this.m_bodyA, j = this.m_bodyB, o = 0, q = h = 0, n = 0, a = 0;
        if (this.m_enableLimit && this.m_limitState != I.e_inactiveLimit) {
            d = j.m_sweep.a - l.m_sweep.a - this.m_referenceAngle;
            var c = 0;
            this.m_limitState == I.e_equalLimits ? (d = y.Clamp(d - this.m_lowerAngle, -F.b2_maxAngularCorrection, F.b2_maxAngularCorrection), 
            c = -this.m_motorMass * d, o = y.Abs(d)) : this.m_limitState == I.e_atLowerLimit ? (o = -(d -= this.m_lowerAngle), 
            d = y.Clamp(d + F.b2_angularSlop, -F.b2_maxAngularCorrection, 0), c = -this.m_motorMass * d) : this.m_limitState == I.e_atUpperLimit && (o = d -= this.m_upperAngle, 
            d = y.Clamp(d - F.b2_angularSlop, 0, F.b2_maxAngularCorrection), c = -this.m_motorMass * d), 
            l.m_sweep.a -= l.m_invI * c, j.m_sweep.a += j.m_invI * c, l.SynchronizeTransform(), 
            j.SynchronizeTransform();
        }
        h = l.m_xf.R, c = this.m_localAnchor1.x - l.m_sweep.localCenter.x, d = this.m_localAnchor1.y - l.m_sweep.localCenter.y, 
        q = h.col1.x * c + h.col2.x * d, d = h.col1.y * c + h.col2.y * d, c = q, h = j.m_xf.R;
        var g = this.m_localAnchor2.x - j.m_sweep.localCenter.x, b = this.m_localAnchor2.y - j.m_sweep.localCenter.y;
        q = h.col1.x * g + h.col2.x * b, b = h.col1.y * g + h.col2.y * b, g = q;
        var e = (n = j.m_sweep.c.x + g - l.m_sweep.c.x - c) * n + (a = j.m_sweep.c.y + b - l.m_sweep.c.y - d) * a;
        h = Math.sqrt(e), q = l.m_invMass;
        var f = j.m_invMass, m = l.m_invI, r = j.m_invI, s = 10 * F.b2_linearSlop;
        return s * s < e && (n = (e = 1 / (q + f)) * -n, a = e * -a, l.m_sweep.c.x -= .5 * q * n, 
        l.m_sweep.c.y -= .5 * q * a, j.m_sweep.c.x += .5 * f * n, j.m_sweep.c.y += .5 * f * a, 
        n = j.m_sweep.c.x + g - l.m_sweep.c.x - c, a = j.m_sweep.c.y + b - l.m_sweep.c.y - d), 
        this.K1.col1.x = q + f, this.K1.col2.x = 0, this.K1.col1.y = 0, this.K1.col2.y = q + f, 
        this.K2.col1.x = m * d * d, this.K2.col2.x = -m * c * d, this.K2.col1.y = -m * c * d, 
        this.K2.col2.y = m * c * c, this.K3.col1.x = r * b * b, this.K3.col2.x = -r * g * b, 
        this.K3.col1.y = -r * g * b, this.K3.col2.y = r * g * g, this.K.SetM(this.K1), this.K.AddM(this.K2), 
        this.K.AddM(this.K3), this.K.Solve(N.tImpulse, -n, -a), n = N.tImpulse.x, a = N.tImpulse.y, 
        l.m_sweep.c.x -= l.m_invMass * n, l.m_sweep.c.y -= l.m_invMass * a, l.m_sweep.a -= l.m_invI * (c * a - d * n), 
        j.m_sweep.c.x += j.m_invMass * n, j.m_sweep.c.y += j.m_invMass * a, j.m_sweep.a += j.m_invI * (g * a - b * n), 
        l.SynchronizeTransform(), j.SynchronizeTransform(), h <= F.b2_linearSlop && o <= F.b2_angularSlop;
    }, Box2D.postDefs.push(function() {
        Box2D.Dynamics.Joints.b2RevoluteJoint.tImpulse = new w();
    }), Box2D.inherit(S, Box2D.Dynamics.Joints.b2JointDef), S.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype, 
    S.b2RevoluteJointDef = function() {
        Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments), this.localAnchorA = new w(), 
        this.localAnchorB = new w();
    }, S.prototype.b2RevoluteJointDef = function() {
        this.__super.b2JointDef.call(this), this.type = I.e_revoluteJoint, this.localAnchorA.Set(0, 0), 
        this.localAnchorB.Set(0, 0), this.motorSpeed = this.maxMotorTorque = this.upperAngle = this.lowerAngle = this.referenceAngle = 0, 
        this.enableMotor = this.enableLimit = !1;
    }, S.prototype.Initialize = function(d, h, l) {
        this.bodyA = d, this.bodyB = h, this.localAnchorA = this.bodyA.GetLocalPoint(l), 
        this.localAnchorB = this.bodyB.GetLocalPoint(l), this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle();
    }, Box2D.inherit(aa, Box2D.Dynamics.Joints.b2Joint), aa.prototype.__super = Box2D.Dynamics.Joints.b2Joint.prototype, 
    aa.b2WeldJoint = function() {
        Box2D.Dynamics.Joints.b2Joint.b2Joint.apply(this, arguments), this.m_localAnchorA = new w(), 
        this.m_localAnchorB = new w(), this.m_impulse = new A(), this.m_mass = new K();
    }, aa.prototype.GetAnchorA = function() {
        return this.m_bodyA.GetWorldPoint(this.m_localAnchorA);
    }, aa.prototype.GetAnchorB = function() {
        return this.m_bodyB.GetWorldPoint(this.m_localAnchorB);
    }, aa.prototype.GetReactionForce = function(d) {
        return void 0 === d && (d = 0), new w(d * this.m_impulse.x, d * this.m_impulse.y);
    }, aa.prototype.GetReactionTorque = function(d) {
        return void 0 === d && (d = 0), d * this.m_impulse.z;
    }, aa.prototype.b2WeldJoint = function(d) {
        this.__super.b2Joint.call(this, d), this.m_localAnchorA.SetV(d.localAnchorA), this.m_localAnchorB.SetV(d.localAnchorB), 
        this.m_referenceAngle = d.referenceAngle, this.m_impulse.SetZero(), this.m_mass = new K();
    }, aa.prototype.InitVelocityConstraints = function(d) {
        var h, l = 0, j = this.m_bodyA, o = this.m_bodyB;
        h = j.m_xf.R;
        var q = this.m_localAnchorA.x - j.m_sweep.localCenter.x, n = this.m_localAnchorA.y - j.m_sweep.localCenter.y;
        l = h.col1.x * q + h.col2.x * n, n = h.col1.y * q + h.col2.y * n, q = l, h = o.m_xf.R;
        var a = this.m_localAnchorB.x - o.m_sweep.localCenter.x, c = this.m_localAnchorB.y - o.m_sweep.localCenter.y;
        l = h.col1.x * a + h.col2.x * c, c = h.col1.y * a + h.col2.y * c, a = l, h = j.m_invMass, 
        l = o.m_invMass;
        var g = j.m_invI, b = o.m_invI;
        this.m_mass.col1.x = h + l + n * n * g + c * c * b, this.m_mass.col2.x = -n * q * g - c * a * b, 
        this.m_mass.col3.x = -n * g - c * b, this.m_mass.col1.y = this.m_mass.col2.x, this.m_mass.col2.y = h + l + q * q * g + a * a * b, 
        this.m_mass.col3.y = q * g + a * b, this.m_mass.col1.z = this.m_mass.col3.x, this.m_mass.col2.z = this.m_mass.col3.y, 
        this.m_mass.col3.z = g + b, d.warmStarting ? (this.m_impulse.x *= d.dtRatio, this.m_impulse.y *= d.dtRatio, 
        this.m_impulse.z *= d.dtRatio, j.m_linearVelocity.x -= h * this.m_impulse.x, j.m_linearVelocity.y -= h * this.m_impulse.y, 
        j.m_angularVelocity -= g * (q * this.m_impulse.y - n * this.m_impulse.x + this.m_impulse.z), 
        o.m_linearVelocity.x += l * this.m_impulse.x, o.m_linearVelocity.y += l * this.m_impulse.y, 
        o.m_angularVelocity += b * (a * this.m_impulse.y - c * this.m_impulse.x + this.m_impulse.z)) : this.m_impulse.SetZero();
    }, aa.prototype.SolveVelocityConstraints = function() {
        var d, h = 0, l = this.m_bodyA, j = this.m_bodyB, o = l.m_linearVelocity, q = l.m_angularVelocity, n = j.m_linearVelocity, a = j.m_angularVelocity, c = l.m_invMass, g = j.m_invMass, b = l.m_invI, e = j.m_invI;
        d = l.m_xf.R;
        var f = this.m_localAnchorA.x - l.m_sweep.localCenter.x, m = this.m_localAnchorA.y - l.m_sweep.localCenter.y;
        h = d.col1.x * f + d.col2.x * m, m = d.col1.y * f + d.col2.y * m, f = h, d = j.m_xf.R;
        var r = this.m_localAnchorB.x - j.m_sweep.localCenter.x, s = this.m_localAnchorB.y - j.m_sweep.localCenter.y;
        h = d.col1.x * r + d.col2.x * s, s = d.col1.y * r + d.col2.y * s, r = h, d = n.x - a * s - o.x + q * m, 
        h = n.y + a * r - o.y - q * f;
        var v = a - q, t = new A();
        this.m_mass.Solve33(t, -d, -h, -v), this.m_impulse.Add(t), o.x -= c * t.x, o.y -= c * t.y, 
        q -= b * (f * t.y - m * t.x + t.z), n.x += g * t.x, n.y += g * t.y, a += e * (r * t.y - s * t.x + t.z), 
        l.m_angularVelocity = q, j.m_angularVelocity = a;
    }, aa.prototype.SolvePositionConstraints = function() {
        var d, h = 0, l = this.m_bodyA, j = this.m_bodyB;
        d = l.m_xf.R;
        var o = this.m_localAnchorA.x - l.m_sweep.localCenter.x, q = this.m_localAnchorA.y - l.m_sweep.localCenter.y;
        h = d.col1.x * o + d.col2.x * q, q = d.col1.y * o + d.col2.y * q, o = h, d = j.m_xf.R;
        var n = this.m_localAnchorB.x - j.m_sweep.localCenter.x, a = this.m_localAnchorB.y - j.m_sweep.localCenter.y;
        h = d.col1.x * n + d.col2.x * a, a = d.col1.y * n + d.col2.y * a, n = h, d = l.m_invMass, 
        h = j.m_invMass;
        var c = l.m_invI, g = j.m_invI, b = j.m_sweep.c.x + n - l.m_sweep.c.x - o, e = j.m_sweep.c.y + a - l.m_sweep.c.y - q, f = j.m_sweep.a - l.m_sweep.a - this.m_referenceAngle, m = 10 * F.b2_linearSlop, r = Math.sqrt(b * b + e * e), s = y.Abs(f);
        return m < r && (c *= 1, g *= 1), this.m_mass.col1.x = d + h + q * q * c + a * a * g, 
        this.m_mass.col2.x = -q * o * c - a * n * g, this.m_mass.col3.x = -q * c - a * g, 
        this.m_mass.col1.y = this.m_mass.col2.x, this.m_mass.col2.y = d + h + o * o * c + n * n * g, 
        this.m_mass.col3.y = o * c + n * g, this.m_mass.col1.z = this.m_mass.col3.x, this.m_mass.col2.z = this.m_mass.col3.y, 
        this.m_mass.col3.z = c + g, m = new A(), this.m_mass.Solve33(m, -b, -e, -f), l.m_sweep.c.x -= d * m.x, 
        l.m_sweep.c.y -= d * m.y, l.m_sweep.a -= c * (o * m.y - q * m.x + m.z), j.m_sweep.c.x += h * m.x, 
        j.m_sweep.c.y += h * m.y, j.m_sweep.a += g * (n * m.y - a * m.x + m.z), l.SynchronizeTransform(), 
        j.SynchronizeTransform(), r <= F.b2_linearSlop && s <= F.b2_angularSlop;
    }, Box2D.inherit(Z, Box2D.Dynamics.Joints.b2JointDef), Z.prototype.__super = Box2D.Dynamics.Joints.b2JointDef.prototype, 
    Z.b2WeldJointDef = function() {
        Box2D.Dynamics.Joints.b2JointDef.b2JointDef.apply(this, arguments), this.localAnchorA = new w(), 
        this.localAnchorB = new w();
    }, Z.prototype.b2WeldJointDef = function() {
        this.__super.b2JointDef.call(this), this.type = I.e_weldJoint, this.referenceAngle = 0;
    }, Z.prototype.Initialize = function(d, h, l) {
        this.bodyA = d, this.bodyB = h, this.localAnchorA.SetV(this.bodyA.GetLocalPoint(l)), 
        this.localAnchorB.SetV(this.bodyB.GetLocalPoint(l)), this.referenceAngle = this.bodyB.GetAngle() - this.bodyA.GetAngle();
    };
}(), function() {
    var F = Box2D.Dynamics.b2DebugDraw;
    F.b2DebugDraw = function() {
        this.m_xformScale = this.m_fillAlpha = this.m_alpha = this.m_lineThickness = this.m_drawScale = 1;
        var G = this;
        this.m_sprite = {
            graphics: {
                clear: function() {
                    G.m_ctx.clearRect(0, 0, G.m_ctx.canvas.width, G.m_ctx.canvas.height);
                }
            }
        };
    }, F.prototype._color = function(G, K) {
        return "rgba(" + ((16711680 & G) >> 16) + "," + ((65280 & G) >> 8) + "," + (255 & G) + "," + K + ")";
    }, F.prototype.b2DebugDraw = function() {
        this.m_drawFlags = 0;
    }, F.prototype.SetFlags = function(G) {
        void 0 === G && (G = 0), this.m_drawFlags = G;
    }, F.prototype.GetFlags = function() {
        return this.m_drawFlags;
    }, F.prototype.AppendFlags = function(G) {
        void 0 === G && (G = 0), this.m_drawFlags |= G;
    }, F.prototype.ClearFlags = function(G) {
        void 0 === G && (G = 0), this.m_drawFlags &= ~G;
    }, F.prototype.SetSprite = function(G) {
        this.m_ctx = G;
    }, F.prototype.GetSprite = function() {
        return this.m_ctx;
    }, F.prototype.SetDrawScale = function(G) {
        void 0 === G && (G = 0), this.m_drawScale = G;
    }, F.prototype.GetDrawScale = function() {
        return this.m_drawScale;
    }, F.prototype.SetLineThickness = function(G) {
        void 0 === G && (G = 0), this.m_lineThickness = G, this.m_ctx.strokeWidth = G;
    }, F.prototype.GetLineThickness = function() {
        return this.m_lineThickness;
    }, F.prototype.SetAlpha = function(G) {
        void 0 === G && (G = 0), this.m_alpha = G;
    }, F.prototype.GetAlpha = function() {
        return this.m_alpha;
    }, F.prototype.SetFillAlpha = function(G) {
        void 0 === G && (G = 0), this.m_fillAlpha = G;
    }, F.prototype.GetFillAlpha = function() {
        return this.m_fillAlpha;
    }, F.prototype.SetXFormScale = function(G) {
        void 0 === G && (G = 0), this.m_xformScale = G;
    }, F.prototype.GetXFormScale = function() {
        return this.m_xformScale;
    }, F.prototype.DrawPolygon = function(G, K, y) {
        if (K) {
            var w = this.m_ctx, A = this.m_drawScale;
            for (w.beginPath(), w.strokeStyle = this._color(y.color, this.m_alpha), w.moveTo(G[0].x * A, G[0].y * A), 
            y = 1; y < K; y++) w.lineTo(G[y].x * A, G[y].y * A);
            w.lineTo(G[0].x * A, G[0].y * A), w.closePath(), w.stroke();
        }
    }, F.prototype.DrawSolidPolygon = function(G, K, y) {
        if (K) {
            var w = this.m_ctx, A = this.m_drawScale;
            for (w.beginPath(), w.strokeStyle = this._color(y.color, this.m_alpha), w.fillStyle = this._color(y.color, this.m_fillAlpha), 
            w.moveTo(G[0].x * A, G[0].y * A), y = 1; y < K; y++) w.lineTo(G[y].x * A, G[y].y * A);
            w.lineTo(G[0].x * A, G[0].y * A), w.closePath(), w.fill(), w.stroke();
        }
    }, F.prototype.DrawCircle = function(G, K, y) {
        if (K) {
            var w = this.m_ctx, A = this.m_drawScale;
            w.beginPath(), w.strokeStyle = this._color(y.color, this.m_alpha), w.arc(G.x * A, G.y * A, K * A, 0, 2 * Math.PI, !0), 
            w.closePath(), w.stroke();
        }
    }, F.prototype.DrawSolidCircle = function(G, K, y, w) {
        if (K) {
            var A = this.m_ctx, U = this.m_drawScale, p = G.x * U, B = G.y * U;
            A.moveTo(0, 0), A.beginPath(), A.strokeStyle = this._color(w.color, this.m_alpha), 
            A.fillStyle = this._color(w.color, this.m_fillAlpha), A.arc(p, B, K * U, 0, 2 * Math.PI, !0), 
            A.moveTo(p, B), A.lineTo((G.x + y.x * K) * U, (G.y + y.y * K) * U), A.closePath(), 
            A.fill(), A.stroke();
        }
    }, F.prototype.DrawSegment = function(G, K, y) {
        var w = this.m_ctx, A = this.m_drawScale;
        w.strokeStyle = this._color(y.color, this.m_alpha), w.beginPath(), w.moveTo(G.x * A, G.y * A), 
        w.lineTo(K.x * A, K.y * A), w.closePath(), w.stroke();
    }, F.prototype.DrawTransform = function(G) {
        var K = this.m_ctx, y = this.m_drawScale;
        K.beginPath(), K.strokeStyle = this._color(16711680, this.m_alpha), K.moveTo(G.position.x * y, G.position.y * y), 
        K.lineTo((G.position.x + this.m_xformScale * G.R.col1.x) * y, (G.position.y + this.m_xformScale * G.R.col1.y) * y), 
        K.strokeStyle = this._color(65280, this.m_alpha), K.moveTo(G.position.x * y, G.position.y * y), 
        K.lineTo((G.position.x + this.m_xformScale * G.R.col2.x) * y, (G.position.y + this.m_xformScale * G.R.col2.y) * y), 
        K.closePath(), K.stroke();
    };
}(), i = 0; i < Box2D.postDefs.length; ++i) Box2D.postDefs[i]();

delete Box2D.postDefs, function(root, factory) {
    root.Matter = factory();
}(window, function() {
    return function(modules) {
        var installedModules = {};
        function __webpack_require__(moduleId) {
            if (installedModules[moduleId]) return installedModules[moduleId].exports;
            var module = installedModules[moduleId] = {
                i: moduleId,
                l: !1,
                exports: {}
            };
            return modules[moduleId].call(gmodule.exports, module, gmodule.exports, __webpack_require__), 
            module.l = !0, gmodule.exports;
        }
        return __webpack_require__.m = modules, __webpack_require__.c = installedModules, 
        __webpack_require__.d = function(exports, name, getter) {
            __webpack_require__.o(exports, name) || Object.defineProperty(exports, name, {
                enumerable: !0,
                get: getter
            });
        }, __webpack_require__.r = function(exports) {
            "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
                value: "Module"
            }), Object.defineProperty(exports, "__esModule", {
                value: !0
            });
        }, __webpack_require__.t = function(value, mode) {
            if (1 & mode && (value = __webpack_require__(value)), 8 & mode) return value;
            if (4 & mode && "object" == typeof value && value && value.__esModule) return value;
            var ns = Object.create(null);
            if (__webpack_require__.r(ns), Object.defineProperty(ns, "default", {
                enumerable: !0,
                value: value
            }), 2 & mode && "string" != typeof value) for (var key in value) __webpack_require__.d(ns, key, function(key) {
                return value[key];
            }.bind(null, key));
            return ns;
        }, __webpack_require__.n = function(module) {
            var getter = module && module.__esModule ? function() {
                return module.default;
            } : function() {
                return module;
            };
            return __webpack_require__.d(getter, "a", getter), getter;
        }, __webpack_require__.o = function(object, property) {
            return Object.prototype.hasOwnProperty.call(object, property);
        }, __webpack_require__.p = "", __webpack_require__(__webpack_require__.s = 21);
    }([ function(module, exports) {
        var Common = {};
        gmodule.exports = Common, function() {
            Common._nextId = 0, Common._seed = 0, Common._nowStartTime = +new Date(), Common._warnedOnce = {}, 
            Common._decomp = null, Common.extend = function(obj, deep) {
                var argsStart, deepClone;
                deepClone = "boolean" == typeof deep ? (argsStart = 2, deep) : (argsStart = 1, !0);
                for (var i = argsStart; i < arguments.length; i++) {
                    var source = arguments[i];
                    if (source) for (var prop in source) deepClone && source[prop] && source[prop].constructor === Object ? obj[prop] && obj[prop].constructor !== Object ? obj[prop] = source[prop] : (obj[prop] = obj[prop] || {}, 
                    Common.extend(obj[prop], deepClone, source[prop])) : obj[prop] = source[prop];
                }
                return obj;
            }, Common.clone = function(obj, deep) {
                return Common.extend({}, deep, obj);
            }, Common.keys = function(obj) {
                if (Object.keys) return Object.keys(obj);
                var keys = [];
                for (var key in obj) keys.push(key);
                return keys;
            }, Common.values = function(obj) {
                var values = [];
                if (Object.keys) {
                    for (var keys = Object.keys(obj), i = 0; i < keys.length; i++) values.push(obj[keys[i]]);
                    return values;
                }
                for (var key in obj) values.push(obj[key]);
                return values;
            }, Common.get = function(obj, path, begin, end) {
                path = path.split(".").slice(begin, end);
                for (var i = 0; i < path.length; i += 1) obj = obj[path[i]];
                return obj;
            }, Common.set = function(obj, path, val, begin, end) {
                var parts = path.split(".").slice(begin, end);
                return Common.get(obj, path, 0, -1)[parts[parts.length - 1]] = val;
            }, Common.shuffle = function(array) {
                for (var i = array.length - 1; 0 < i; i--) {
                    var j = Math.floor(Common.random() * (i + 1)), temp = array[i];
                    array[i] = array[j], array[j] = temp;
                }
                return array;
            }, Common.choose = function(choices) {
                return choices[Math.floor(Common.random() * choices.length)];
            }, Common.isElement = function(obj) {
                return "undefined" != typeof HTMLElement ? obj instanceof HTMLElement : !!(obj && obj.nodeType && obj.nodeName);
            }, Common.isArray = function(obj) {
                return "[object Array]" === Object.prototype.toString.call(obj);
            }, Common.isFunction = function(obj) {
                return "function" == typeof obj;
            }, Common.isPlainObject = function(obj) {
                return "object" == typeof obj && obj.constructor === Object;
            }, Common.isString = function(obj) {
                return "[object String]" === toString.call(obj);
            }, Common.clamp = function(value, min, max) {
                return value < min ? min : max < value ? max : value;
            }, Common.sign = function(value) {
                return value < 0 ? -1 : 1;
            }, Common.now = function() {
                if ("undefined" != typeof window && window.performance) {
                    if (window.performance.now) return window.performance.now();
                    if (window.performance.webkitNow) return window.performance.webkitNow();
                }
                return Date.now ? Date.now() : new Date() - Common._nowStartTime;
            }, Common.random = function(min, max) {
                return max = void 0 !== max ? max : 1, (min = void 0 !== min ? min : 0) + _seededRandom() * (max - min);
            };
            var _seededRandom = function() {
                return Common._seed = (9301 * Common._seed + 49297) % 233280, Common._seed / 233280;
            };
            Common.colorToNumber = function(colorString) {
                return 3 == (colorString = colorString.replace("#", "")).length && (colorString = colorString.charAt(0) + colorString.charAt(0) + colorString.charAt(1) + colorString.charAt(1) + colorString.charAt(2) + colorString.charAt(2)), 
                parseInt(colorString, 16);
            }, Common.logLevel = 1, Common.log = function() {
                console && 0 < Common.logLevel && Common.logLevel <= 3 && console.log.apply(console, [ "matter-js:" ].concat(Array.prototype.slice.call(arguments)));
            }, Common.info = function() {
                console && 0 < Common.logLevel && Common.logLevel <= 2 && console.info.apply(console, [ "matter-js:" ].concat(Array.prototype.slice.call(arguments)));
            }, Common.warn = function() {
                console && 0 < Common.logLevel && Common.logLevel <= 3 && console.warn.apply(console, [ "matter-js:" ].concat(Array.prototype.slice.call(arguments)));
            }, Common.warnOnce = function() {
                var message = Array.prototype.slice.call(arguments).join(" ");
                Common._warnedOnce[message] || (Common.warn(message), Common._warnedOnce[message] = !0);
            }, Common.deprecated = function(obj, prop, warning) {
                obj[prop] = Common.chain(function() {
                    Common.warnOnce("🔅 deprecated 🔅", warning);
                }, obj[prop]);
            }, Common.nextId = function() {
                return Common._nextId++;
            }, Common.indexOf = function(haystack, needle) {
                if (haystack.indexOf) return haystack.indexOf(needle);
                for (var i = 0; i < haystack.length; i++) if (haystack[i] === needle) return i;
                return -1;
            }, Common.map = function(list, func) {
                if (list.map) return list.map(func);
                for (var mapped = [], i = 0; i < list.length; i += 1) mapped.push(func(list[i]));
                return mapped;
            }, Common.topologicalSort = function(graph) {
                var result = [], visited = [], temp = [];
                for (var node in graph) visited[node] || temp[node] || Common._topologicalSort(node, visited, temp, graph, result);
                return result;
            }, Common._topologicalSort = function(node, visited, temp, graph, result) {
                var neighbors = graph[node] || [];
                temp[node] = !0;
                for (var i = 0; i < neighbors.length; i += 1) {
                    var neighbor = neighbors[i];
                    temp[neighbor] || (visited[neighbor] || Common._topologicalSort(neighbor, visited, temp, graph, result));
                }
                temp[node] = !1, visited[node] = !0, result.push(node);
            }, Common.chain = function() {
                for (var funcs = [], i = 0; i < arguments.length; i += 1) {
                    var func = arguments[i];
                    func._chained ? funcs.push.apply(funcs, func._chained) : funcs.push(func);
                }
                function chain() {
                    for (var lastResult, args = new Array(arguments.length), i = 0, l = arguments.length; i < l; i++) args[i] = arguments[i];
                    for (i = 0; i < funcs.length; i += 1) {
                        var result = funcs[i].apply(lastResult, args);
                        void 0 !== result && (lastResult = result);
                    }
                    return lastResult;
                }
                return chain._chained = funcs, chain;
            }, Common.chainPathBefore = function(base, path, func) {
                return Common.set(base, path, Common.chain(func, Common.get(base, path)));
            }, Common.chainPathAfter = function(base, path, func) {
                return Common.set(base, path, Common.chain(Common.get(base, path), func));
            }, Common.setDecomp = function(decomp) {
                Common._decomp = decomp;
            }, Common.getDecomp = function() {
                var decomp = Common._decomp;
                try {
                    decomp || "undefined" == typeof window || (decomp = window.decomp), decomp || "undefined" == typeof global || (decomp = global.decomp);
                } catch (e) {
                    e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                    decomp = null;
                }
                return decomp;
            };
        }();
    }, function(module, exports) {
        var Bounds = {};
        (gmodule.exports = Bounds).create = function(vertices) {
            var bounds = {
                min: {
                    x: 0,
                    y: 0
                },
                max: {
                    x: 0,
                    y: 0
                }
            };
            return vertices && Bounds.update(bounds, vertices), bounds;
        }, Bounds.update = function(bounds, vertices, velocity) {
            bounds.min.x = 1 / 0, bounds.max.x = -1 / 0, bounds.min.y = 1 / 0, bounds.max.y = -1 / 0;
            for (var i = 0; i < vertices.length; i++) {
                var vertex = vertices[i];
                vertex.x > bounds.max.x && (bounds.max.x = vertex.x), vertex.x < bounds.min.x && (bounds.min.x = vertex.x), 
                vertex.y > bounds.max.y && (bounds.max.y = vertex.y), vertex.y < bounds.min.y && (bounds.min.y = vertex.y);
            }
            velocity && (0 < velocity.x ? bounds.max.x += velocity.x : bounds.min.x += velocity.x, 
            0 < velocity.y ? bounds.max.y += velocity.y : bounds.min.y += velocity.y);
        }, Bounds.contains = function(bounds, point) {
            return point.x >= bounds.min.x && point.x <= bounds.max.x && point.y >= bounds.min.y && point.y <= bounds.max.y;
        }, Bounds.overlaps = function(boundsA, boundsB) {
            return boundsA.min.x <= boundsB.max.x && boundsA.max.x >= boundsB.min.x && boundsA.max.y >= boundsB.min.y && boundsA.min.y <= boundsB.max.y;
        }, Bounds.translate = function(bounds, vector) {
            bounds.min.x += vector.x, bounds.max.x += vector.x, bounds.min.y += vector.y, bounds.max.y += vector.y;
        }, Bounds.shift = function(bounds, position) {
            var deltaX = bounds.max.x - bounds.min.x, deltaY = bounds.max.y - bounds.min.y;
            bounds.min.x = position.x, bounds.max.x = position.x + deltaX, bounds.min.y = position.y, 
            bounds.max.y = position.y + deltaY;
        };
    }, function(module, exports) {
        var Vector = {};
        (gmodule.exports = Vector).create = function(x, y) {
            return {
                x: x || 0,
                y: y || 0
            };
        }, Vector.clone = function(vector) {
            return {
                x: vector.x,
                y: vector.y
            };
        }, Vector.magnitude = function(vector) {
            return Math.sqrt(vector.x * vector.x + vector.y * vector.y);
        }, Vector.magnitudeSquared = function(vector) {
            return vector.x * vector.x + vector.y * vector.y;
        }, Vector.rotate = function(vector, angle, output) {
            var cos = Math.cos(angle), sin = Math.sin(angle);
            output || (output = {});
            var x = vector.x * cos - vector.y * sin;
            return output.y = vector.x * sin + vector.y * cos, output.x = x, output;
        }, Vector.rotateAbout = function(vector, angle, point, output) {
            var cos = Math.cos(angle), sin = Math.sin(angle);
            output || (output = {});
            var x = point.x + ((vector.x - point.x) * cos - (vector.y - point.y) * sin);
            return output.y = point.y + ((vector.x - point.x) * sin + (vector.y - point.y) * cos), 
            output.x = x, output;
        }, Vector.normalise = function(vector) {
            var magnitude = Vector.magnitude(vector);
            return 0 === magnitude ? {
                x: 0,
                y: 0
            } : {
                x: vector.x / magnitude,
                y: vector.y / magnitude
            };
        }, Vector.dot = function(vectorA, vectorB) {
            return vectorA.x * vectorB.x + vectorA.y * vectorB.y;
        }, Vector.cross = function(vectorA, vectorB) {
            return vectorA.x * vectorB.y - vectorA.y * vectorB.x;
        }, Vector.cross3 = function(vectorA, vectorB, vectorC) {
            return (vectorB.x - vectorA.x) * (vectorC.y - vectorA.y) - (vectorB.y - vectorA.y) * (vectorC.x - vectorA.x);
        }, Vector.add = function(vectorA, vectorB, output) {
            return output || (output = {}), output.x = vectorA.x + vectorB.x, output.y = vectorA.y + vectorB.y, 
            output;
        }, Vector.sub = function(vectorA, vectorB, output) {
            return output || (output = {}), output.x = vectorA.x - vectorB.x, output.y = vectorA.y - vectorB.y, 
            output;
        }, Vector.mult = function(vector, scalar) {
            return {
                x: vector.x * scalar,
                y: vector.y * scalar
            };
        }, Vector.div = function(vector, scalar) {
            return {
                x: vector.x / scalar,
                y: vector.y / scalar
            };
        }, Vector.perp = function(vector, negate) {
            return {
                x: (negate = !0 === negate ? -1 : 1) * -vector.y,
                y: negate * vector.x
            };
        }, Vector.neg = function(vector) {
            return {
                x: -vector.x,
                y: -vector.y
            };
        }, Vector.angle = function(vectorA, vectorB) {
            return Math.atan2(vectorB.y - vectorA.y, vectorB.x - vectorA.x);
        }, Vector._temp = [ Vector.create(), Vector.create(), Vector.create(), Vector.create(), Vector.create(), Vector.create() ];
    }, function(module, exports, __webpack_require__) {
        var Vertices = {};
        gmodule.exports = Vertices;
        var Vector = __webpack_require__(2), Common = __webpack_require__(0);
        Vertices.create = function(points, body) {
            for (var vertices = [], i = 0; i < points.length; i++) {
                var point = points[i], vertex = {
                    x: point.x,
                    y: point.y,
                    index: i,
                    body: body,
                    isInternal: !1
                };
                vertices.push(vertex);
            }
            return vertices;
        }, Vertices.fromPath = function(path, body) {
            var points = [];
            return path.replace(/L?\s*([-\d.e]+)[\s,]*([-\d.e]+)*/gi, function(match, x, y) {
                points.push({
                    x: parseFloat(x),
                    y: parseFloat(y)
                });
            }), Vertices.create(points, body);
        }, Vertices.centre = function(vertices) {
            for (var cross, temp, j, area = Vertices.area(vertices, !0), centre = {
                x: 0,
                y: 0
            }, i = 0; i < vertices.length; i++) j = (i + 1) % vertices.length, cross = Vector.cross(vertices[i], vertices[j]), 
            temp = Vector.mult(Vector.add(vertices[i], vertices[j]), cross), centre = Vector.add(centre, temp);
            return Vector.div(centre, 6 * area);
        }, Vertices.mean = function(vertices) {
            for (var average = {
                x: 0,
                y: 0
            }, i = 0; i < vertices.length; i++) average.x += vertices[i].x, average.y += vertices[i].y;
            return Vector.div(average, vertices.length);
        }, Vertices.area = function(vertices, signed) {
            for (var area = 0, j = vertices.length - 1, i = 0; i < vertices.length; i++) area += (vertices[j].x - vertices[i].x) * (vertices[j].y + vertices[i].y), 
            j = i;
            return signed ? area / 2 : Math.abs(area) / 2;
        }, Vertices.inertia = function(vertices, mass) {
            for (var cross, j, numerator = 0, denominator = 0, v = vertices, n = 0; n < v.length; n++) j = (n + 1) % v.length, 
            numerator += (cross = Math.abs(Vector.cross(v[j], v[n]))) * (Vector.dot(v[j], v[j]) + Vector.dot(v[j], v[n]) + Vector.dot(v[n], v[n])), 
            denominator += cross;
            return mass / 6 * (numerator / denominator);
        }, Vertices.translate = function(vertices, vector, scalar) {
            scalar = void 0 !== scalar ? scalar : 1;
            var i, verticesLength = vertices.length, translateX = vector.x * scalar, translateY = vector.y * scalar;
            for (i = 0; i < verticesLength; i++) vertices[i].x += translateX, vertices[i].y += translateY;
            return vertices;
        }, Vertices.rotate = function(vertices, angle, point) {
            if (0 !== angle) {
                var vertex, dx, dy, i, cos = Math.cos(angle), sin = Math.sin(angle), pointX = point.x, pointY = point.y, verticesLength = vertices.length;
                for (i = 0; i < verticesLength; i++) dx = (vertex = vertices[i]).x - pointX, dy = vertex.y - pointY, 
                vertex.x = pointX + (dx * cos - dy * sin), vertex.y = pointY + (dx * sin + dy * cos);
                return vertices;
            }
        }, Vertices.contains = function(vertices, point) {
            for (var nextVertex, pointX = point.x, pointY = point.y, verticesLength = vertices.length, vertex = vertices[verticesLength - 1], i = 0; i < verticesLength; i++) {
                if (nextVertex = vertices[i], 0 < (pointX - vertex.x) * (nextVertex.y - vertex.y) + (pointY - vertex.y) * (vertex.x - nextVertex.x)) return !1;
                vertex = nextVertex;
            }
            return !0;
        }, Vertices.scale = function(vertices, scaleX, scaleY, point) {
            if (1 === scaleX && 1 === scaleY) return vertices;
            var vertex, delta;
            point = point || Vertices.centre(vertices);
            for (var i = 0; i < vertices.length; i++) vertex = vertices[i], delta = Vector.sub(vertex, point), 
            vertices[i].x = point.x + delta.x * scaleX, vertices[i].y = point.y + delta.y * scaleY;
            return vertices;
        }, Vertices.chamfer = function(vertices, radius, quality, qualityMin, qualityMax) {
            radius = "number" == typeof radius ? [ radius ] : radius || [ 8 ], quality = void 0 !== quality ? quality : -1, 
            qualityMin = qualityMin || 2, qualityMax = qualityMax || 14;
            for (var newVertices = [], i = 0; i < vertices.length; i++) {
                var prevVertex = vertices[0 <= i - 1 ? i - 1 : vertices.length - 1], vertex = vertices[i], nextVertex = vertices[(i + 1) % vertices.length], currentRadius = radius[i < radius.length ? i : radius.length - 1];
                if (0 !== currentRadius) {
                    var prevNormal = Vector.normalise({
                        x: vertex.y - prevVertex.y,
                        y: prevVertex.x - vertex.x
                    }), nextNormal = Vector.normalise({
                        x: nextVertex.y - vertex.y,
                        y: vertex.x - nextVertex.x
                    }), diagonalRadius = Math.sqrt(2 * Math.pow(currentRadius, 2)), radiusVector = Vector.mult(Common.clone(prevNormal), currentRadius), midNormal = Vector.normalise(Vector.mult(Vector.add(prevNormal, nextNormal), .5)), scaledVertex = Vector.sub(vertex, Vector.mult(midNormal, diagonalRadius)), precision = quality;
                    -1 === quality && (precision = 1.75 * Math.pow(currentRadius, .32)), (precision = Common.clamp(precision, qualityMin, qualityMax)) % 2 == 1 && (precision += 1);
                    for (var theta = Math.acos(Vector.dot(prevNormal, nextNormal)) / precision, j = 0; j < precision; j++) newVertices.push(Vector.add(Vector.rotate(radiusVector, theta * j), scaledVertex));
                } else newVertices.push(vertex);
            }
            return newVertices;
        }, Vertices.clockwiseSort = function(vertices) {
            var centre = Vertices.mean(vertices);
            return vertices.sort(function(vertexA, vertexB) {
                return Vector.angle(centre, vertexA) - Vector.angle(centre, vertexB);
            }), vertices;
        }, Vertices.isConvex = function(vertices) {
            var i, j, k, z, flag = 0, n = vertices.length;
            if (n < 3) return null;
            for (i = 0; i < n; i++) if (k = (i + 2) % n, z = (vertices[j = (i + 1) % n].x - vertices[i].x) * (vertices[k].y - vertices[j].y), 
            (z -= (vertices[j].y - vertices[i].y) * (vertices[k].x - vertices[j].x)) < 0 ? flag |= 1 : 0 < z && (flag |= 2), 
            3 === flag) return !1;
            return 0 !== flag || null;
        }, Vertices.hull = function(vertices) {
            var vertex, i, upper = [], lower = [];
            for ((vertices = vertices.slice(0)).sort(function(vertexA, vertexB) {
                var dx = vertexA.x - vertexB.x;
                return 0 != dx ? dx : vertexA.y - vertexB.y;
            }), i = 0; i < vertices.length; i += 1) {
                for (vertex = vertices[i]; 2 <= lower.length && Vector.cross3(lower[lower.length - 2], lower[lower.length - 1], vertex) <= 0; ) lower.pop();
                lower.push(vertex);
            }
            for (i = vertices.length - 1; 0 <= i; i -= 1) {
                for (vertex = vertices[i]; 2 <= upper.length && Vector.cross3(upper[upper.length - 2], upper[upper.length - 1], vertex) <= 0; ) upper.pop();
                upper.push(vertex);
            }
            return upper.pop(), lower.pop(), upper.concat(lower);
        };
    }, function(module, exports, __webpack_require__) {
        var Events = {};
        gmodule.exports = Events;
        var Common = __webpack_require__(0);
        Events.on = function(object, eventNames, callback) {
            for (var name, names = eventNames.split(" "), i = 0; i < names.length; i++) name = names[i], 
            object.events = object.events || {}, object.events[name] = object.events[name] || [], 
            object.events[name].push(callback);
            return callback;
        }, Events.off = function(object, eventNames, callback) {
            if (eventNames) {
                "function" == typeof eventNames && (callback = eventNames, eventNames = Common.keys(object.events).join(" "));
                for (var names = eventNames.split(" "), i = 0; i < names.length; i++) {
                    var callbacks = object.events[names[i]], newCallbacks = [];
                    if (callback && callbacks) for (var j = 0; j < callbacks.length; j++) callbacks[j] !== callback && newCallbacks.push(callbacks[j]);
                    object.events[names[i]] = newCallbacks;
                }
            } else object.events = {};
        }, Events.trigger = function(object, eventNames, event) {
            var names, name, callbacks, eventClone, events = object.events;
            if (events && 0 < Common.keys(events).length) {
                event || (event = {}), names = eventNames.split(" ");
                for (var i = 0; i < names.length; i++) if (callbacks = events[name = names[i]]) {
                    (eventClone = Common.clone(event, !1)).name = name, eventClone.source = object;
                    for (var j = 0; j < callbacks.length; j++) callbacks[j].apply(object, [ eventClone ]);
                }
            }
        };
    }, function(module, exports, __webpack_require__) {
        var Composite = {};
        gmodule.exports = Composite;
        var Events = __webpack_require__(4), Common = __webpack_require__(0), Bounds = __webpack_require__(1), Body = __webpack_require__(6);
        Composite.create = function(options) {
            return Common.extend({
                id: Common.nextId(),
                type: "composite",
                parent: null,
                isModified: !1,
                bodies: [],
                constraints: [],
                composites: [],
                label: "Composite",
                plugin: {},
                cache: {
                    allBodies: null,
                    allConstraints: null,
                    allComposites: null
                }
            }, options);
        }, Composite.setModified = function(composite, isModified, updateParents, updateChildren) {
            if ((composite.isModified = isModified) && composite.cache && (composite.cache.allBodies = null, 
            composite.cache.allConstraints = null, composite.cache.allComposites = null), updateParents && composite.parent && Composite.setModified(composite.parent, isModified, updateParents, updateChildren), 
            updateChildren) for (var i = 0; i < composite.composites.length; i++) {
                var childComposite = composite.composites[i];
                Composite.setModified(childComposite, isModified, updateParents, updateChildren);
            }
        }, Composite.add = function(composite, object) {
            var objects = [].concat(object);
            Events.trigger(composite, "beforeAdd", {
                object: object
            });
            for (var i = 0; i < objects.length; i++) {
                var obj = objects[i];
                switch (obj.type) {
                  case "body":
                    if (obj.parent !== obj) {
                        Common.warn("Composite.add: skipped adding a compound body part (you must add its parent instead)");
                        break;
                    }
                    Composite.addBody(composite, obj);
                    break;

                  case "constraint":
                    Composite.addConstraint(composite, obj);
                    break;

                  case "composite":
                    Composite.addComposite(composite, obj);
                    break;

                  case "mouseConstraint":
                    Composite.addConstraint(composite, obj.constraint);
                }
            }
            return Events.trigger(composite, "afterAdd", {
                object: object
            }), composite;
        }, Composite.remove = function(composite, object, deep) {
            var objects = [].concat(object);
            Events.trigger(composite, "beforeRemove", {
                object: object
            });
            for (var i = 0; i < objects.length; i++) {
                var obj = objects[i];
                switch (obj.type) {
                  case "body":
                    Composite.removeBody(composite, obj, deep);
                    break;

                  case "constraint":
                    Composite.removeConstraint(composite, obj, deep);
                    break;

                  case "composite":
                    Composite.removeComposite(composite, obj, deep);
                    break;

                  case "mouseConstraint":
                    Composite.removeConstraint(composite, obj.constraint);
                }
            }
            return Events.trigger(composite, "afterRemove", {
                object: object
            }), composite;
        }, Composite.addComposite = function(compositeA, compositeB) {
            return compositeA.composites.push(compositeB), compositeB.parent = compositeA, Composite.setModified(compositeA, !0, !0, !1), 
            compositeA;
        }, Composite.removeComposite = function(compositeA, compositeB, deep) {
            var position = Common.indexOf(compositeA.composites, compositeB);
            if (-1 !== position && Composite.removeCompositeAt(compositeA, position), deep) for (var i = 0; i < compositeA.composites.length; i++) Composite.removeComposite(compositeA.composites[i], compositeB, !0);
            return compositeA;
        }, Composite.removeCompositeAt = function(composite, position) {
            return composite.composites.splice(position, 1), Composite.setModified(composite, !0, !0, !1), 
            composite;
        }, Composite.addBody = function(composite, body) {
            return composite.bodies.push(body), Composite.setModified(composite, !0, !0, !1), 
            composite;
        }, Composite.removeBody = function(composite, body, deep) {
            var position = Common.indexOf(composite.bodies, body);
            if (-1 !== position && Composite.removeBodyAt(composite, position), deep) for (var i = 0; i < composite.composites.length; i++) Composite.removeBody(composite.composites[i], body, !0);
            return composite;
        }, Composite.removeBodyAt = function(composite, position) {
            return composite.bodies.splice(position, 1), Composite.setModified(composite, !0, !0, !1), 
            composite;
        }, Composite.addConstraint = function(composite, constraint) {
            return composite.constraints.push(constraint), Composite.setModified(composite, !0, !0, !1), 
            composite;
        }, Composite.removeConstraint = function(composite, constraint, deep) {
            var position = Common.indexOf(composite.constraints, constraint);
            if (-1 !== position && Composite.removeConstraintAt(composite, position), deep) for (var i = 0; i < composite.composites.length; i++) Composite.removeConstraint(composite.composites[i], constraint, !0);
            return composite;
        }, Composite.removeConstraintAt = function(composite, position) {
            return composite.constraints.splice(position, 1), Composite.setModified(composite, !0, !0, !1), 
            composite;
        }, Composite.clear = function(composite, keepStatic, deep) {
            if (deep) for (var i = 0; i < composite.composites.length; i++) Composite.clear(composite.composites[i], keepStatic, !0);
            return keepStatic ? composite.bodies = composite.bodies.filter(function(body) {
                return body.isStatic;
            }) : composite.bodies.length = 0, composite.constraints.length = 0, composite.composites.length = 0, 
            Composite.setModified(composite, !0, !0, !1), composite;
        }, Composite.allBodies = function(composite) {
            if (composite.cache && composite.cache.allBodies) return composite.cache.allBodies;
            for (var bodies = [].concat(composite.bodies), i = 0; i < composite.composites.length; i++) bodies = bodies.concat(Composite.allBodies(composite.composites[i]));
            return composite.cache && (composite.cache.allBodies = bodies), bodies;
        }, Composite.allConstraints = function(composite) {
            if (composite.cache && composite.cache.allConstraints) return composite.cache.allConstraints;
            for (var constraints = [].concat(composite.constraints), i = 0; i < composite.composites.length; i++) constraints = constraints.concat(Composite.allConstraints(composite.composites[i]));
            return composite.cache && (composite.cache.allConstraints = constraints), constraints;
        }, Composite.allComposites = function(composite) {
            if (composite.cache && composite.cache.allComposites) return composite.cache.allComposites;
            for (var composites = [].concat(composite.composites), i = 0; i < composite.composites.length; i++) composites = composites.concat(Composite.allComposites(composite.composites[i]));
            return composite.cache && (composite.cache.allComposites = composites), composites;
        }, Composite.get = function(composite, id, type) {
            var objects, object;
            switch (type) {
              case "body":
                objects = Composite.allBodies(composite);
                break;

              case "constraint":
                objects = Composite.allConstraints(composite);
                break;

              case "composite":
                objects = Composite.allComposites(composite).concat(composite);
            }
            return objects ? 0 === (object = objects.filter(function(object) {
                return object.id.toString() === id.toString();
            })).length ? null : object[0] : null;
        }, Composite.move = function(compositeA, objects, compositeB) {
            return Composite.remove(compositeA, objects), Composite.add(compositeB, objects), 
            compositeA;
        }, Composite.rebase = function(composite) {
            for (var objects = Composite.allBodies(composite).concat(Composite.allConstraints(composite)).concat(Composite.allComposites(composite)), i = 0; i < objects.length; i++) objects[i].id = Common.nextId();
            return composite;
        }, Composite.translate = function(composite, translation, recursive) {
            for (var bodies = recursive ? Composite.allBodies(composite) : composite.bodies, i = 0; i < bodies.length; i++) Body.translate(bodies[i], translation);
            return composite;
        }, Composite.rotate = function(composite, rotation, point, recursive) {
            for (var cos = Math.cos(rotation), sin = Math.sin(rotation), bodies = recursive ? Composite.allBodies(composite) : composite.bodies, i = 0; i < bodies.length; i++) {
                var body = bodies[i], dx = body.position.x - point.x, dy = body.position.y - point.y;
                Body.setPosition(body, {
                    x: point.x + (dx * cos - dy * sin),
                    y: point.y + (dx * sin + dy * cos)
                }), Body.rotate(body, rotation);
            }
            return composite;
        }, Composite.scale = function(composite, scaleX, scaleY, point, recursive) {
            for (var bodies = recursive ? Composite.allBodies(composite) : composite.bodies, i = 0; i < bodies.length; i++) {
                var body = bodies[i], dx = body.position.x - point.x, dy = body.position.y - point.y;
                Body.setPosition(body, {
                    x: point.x + dx * scaleX,
                    y: point.y + dy * scaleY
                }), Body.scale(body, scaleX, scaleY);
            }
            return composite;
        }, Composite.bounds = function(composite) {
            for (var bodies = Composite.allBodies(composite), vertices = [], i = 0; i < bodies.length; i += 1) {
                var body = bodies[i];
                vertices.push(body.bounds.min, body.bounds.max);
            }
            return Bounds.create(vertices);
        };
    }, function(module, exports, __webpack_require__) {
        var Body = {};
        gmodule.exports = Body;
        var Vertices = __webpack_require__(3), Vector = __webpack_require__(2), Sleeping = __webpack_require__(7), Common = (__webpack_require__(16), 
        __webpack_require__(0)), Bounds = __webpack_require__(1), Axes = __webpack_require__(11);
        !function() {
            Body._inertiaScale = 4, Body._nextCollidingGroupId = 1, Body._nextNonCollidingGroupId = -1, 
            Body._nextCategory = 1, Body.create = function(options) {
                var defaults = {
                    id: Common.nextId(),
                    type: "body",
                    label: "Body",
                    parts: [],
                    plugin: {},
                    angle: 0,
                    vertices: Vertices.fromPath("L 0 0 L 40 0 L 40 40 L 0 40"),
                    position: {
                        x: 0,
                        y: 0
                    },
                    force: {
                        x: 0,
                        y: 0
                    },
                    torque: 0,
                    positionImpulse: {
                        x: 0,
                        y: 0
                    },
                    constraintImpulse: {
                        x: 0,
                        y: 0,
                        angle: 0
                    },
                    totalContacts: 0,
                    speed: 0,
                    angularSpeed: 0,
                    velocity: {
                        x: 0,
                        y: 0
                    },
                    angularVelocity: 0,
                    isSensor: !1,
                    isStatic: !1,
                    isSleeping: !1,
                    motion: 0,
                    sleepThreshold: 60,
                    density: .001,
                    restitution: 0,
                    friction: .1,
                    frictionStatic: .5,
                    frictionAir: .01,
                    collisionFilter: {
                        category: 1,
                        mask: 4294967295,
                        group: 0
                    },
                    slop: .05,
                    timeScale: 1,
                    render: {
                        visible: !0,
                        opacity: 1,
                        strokeStyle: null,
                        fillStyle: null,
                        lineWidth: null,
                        sprite: {
                            xScale: 1,
                            yScale: 1,
                            xOffset: 0,
                            yOffset: 0
                        }
                    },
                    events: null,
                    bounds: null,
                    chamfer: null,
                    circleRadius: 0,
                    positionPrev: null,
                    anglePrev: 0,
                    parent: null,
                    axes: null,
                    area: 0,
                    mass: 0,
                    inertia: 0,
                    _original: null
                }, body = Common.extend(defaults, options);
                return _initProperties(body, options), body;
            }, Body.nextGroup = function(isNonColliding) {
                return isNonColliding ? Body._nextNonCollidingGroupId-- : Body._nextCollidingGroupId++;
            }, Body.nextCategory = function() {
                return Body._nextCategory = Body._nextCategory << 1, Body._nextCategory;
            };
            var _initProperties = function(body, options) {
                options = options || {}, Body.set(body, {
                    bounds: body.bounds || Bounds.create(body.vertices),
                    positionPrev: body.positionPrev || Vector.clone(body.position),
                    anglePrev: body.anglePrev || body.angle,
                    vertices: body.vertices,
                    parts: body.parts || [ body ],
                    isStatic: body.isStatic,
                    isSleeping: body.isSleeping,
                    parent: body.parent || body
                }), Vertices.rotate(body.vertices, body.angle, body.position), Axes.rotate(body.axes, body.angle), 
                Bounds.update(body.bounds, body.vertices, body.velocity), Body.set(body, {
                    axes: options.axes || body.axes,
                    area: options.area || body.area,
                    mass: options.mass || body.mass,
                    inertia: options.inertia || body.inertia
                });
                var defaultFillStyle = body.isStatic ? "#14151f" : Common.choose([ "#f19648", "#f5d259", "#f55a3c", "#063e7b", "#ececd1" ]), defaultStrokeStyle = body.isStatic ? "#555" : "#ccc", defaultLineWidth = body.isStatic && null === body.render.fillStyle ? 1 : 0;
                body.render.fillStyle = body.render.fillStyle || defaultFillStyle, body.render.strokeStyle = body.render.strokeStyle || defaultStrokeStyle, 
                body.render.lineWidth = body.render.lineWidth || defaultLineWidth, body.render.sprite.xOffset += -(body.bounds.min.x - body.position.x) / (body.bounds.max.x - body.bounds.min.x), 
                body.render.sprite.yOffset += -(body.bounds.min.y - body.position.y) / (body.bounds.max.y - body.bounds.min.y);
            };
            Body.set = function(body, settings, value) {
                var property;
                for (property in "string" == typeof settings && (property = settings, (settings = {})[property] = value), 
                settings) if (Object.prototype.hasOwnProperty.call(settings, property)) switch (value = settings[property], 
                property) {
                  case "isStatic":
                    Body.setStatic(body, value);
                    break;

                  case "isSleeping":
                    Sleeping.set(body, value);
                    break;

                  case "mass":
                    Body.setMass(body, value);
                    break;

                  case "density":
                    Body.setDensity(body, value);
                    break;

                  case "inertia":
                    Body.setInertia(body, value);
                    break;

                  case "vertices":
                    Body.setVertices(body, value);
                    break;

                  case "position":
                    Body.setPosition(body, value);
                    break;

                  case "angle":
                    Body.setAngle(body, value);
                    break;

                  case "velocity":
                    Body.setVelocity(body, value);
                    break;

                  case "angularVelocity":
                    Body.setAngularVelocity(body, value);
                    break;

                  case "parts":
                    Body.setParts(body, value);
                    break;

                  case "centre":
                    Body.setCentre(body, value);
                    break;

                  default:
                    body[property] = value;
                }
            }, Body.setStatic = function(body, isStatic) {
                for (var i = 0; i < body.parts.length; i++) {
                    var part = body.parts[i];
                    (part.isStatic = isStatic) ? (part._original = {
                        restitution: part.restitution,
                        friction: part.friction,
                        mass: part.mass,
                        inertia: part.inertia,
                        density: part.density,
                        inverseMass: part.inverseMass,
                        inverseInertia: part.inverseInertia
                    }, part.restitution = 0, part.friction = 1, part.mass = part.inertia = part.density = 1 / 0, 
                    part.inverseMass = part.inverseInertia = 0, part.positionPrev.x = part.position.x, 
                    part.positionPrev.y = part.position.y, part.anglePrev = part.angle, part.angularVelocity = 0, 
                    part.speed = 0, part.angularSpeed = 0, part.motion = 0) : part._original && (part.restitution = part._original.restitution, 
                    part.friction = part._original.friction, part.mass = part._original.mass, part.inertia = part._original.inertia, 
                    part.density = part._original.density, part.inverseMass = part._original.inverseMass, 
                    part.inverseInertia = part._original.inverseInertia, part._original = null);
                }
            }, Body.setMass = function(body, mass) {
                var moment = body.inertia / (body.mass / 6);
                body.inertia = mass / 6 * moment, body.inverseInertia = 1 / body.inertia, body.mass = mass, 
                body.inverseMass = 1 / body.mass, body.density = body.mass / body.area;
            }, Body.setDensity = function(body, density) {
                Body.setMass(body, density * body.area), body.density = density;
            }, Body.setInertia = function(body, inertia) {
                body.inertia = inertia, body.inverseInertia = 1 / body.inertia;
            }, Body.setVertices = function(body, vertices) {
                vertices[0].body === body ? body.vertices = vertices : body.vertices = Vertices.create(vertices, body), 
                body.axes = Axes.fromVertices(body.vertices), body.area = Vertices.area(body.vertices), 
                Body.setMass(body, body.density * body.area);
                var centre = Vertices.centre(body.vertices);
                Vertices.translate(body.vertices, centre, -1), Body.setInertia(body, Body._inertiaScale * Vertices.inertia(body.vertices, body.mass)), 
                Vertices.translate(body.vertices, body.position), Bounds.update(body.bounds, body.vertices, body.velocity);
            }, Body.setParts = function(body, parts, autoHull) {
                var i;
                for (parts = parts.slice(0), body.parts.length = 0, body.parts.push(body), body.parent = body, 
                i = 0; i < parts.length; i++) {
                    var part = parts[i];
                    part !== body && (part.parent = body).parts.push(part);
                }
                if (1 !== body.parts.length) {
                    if (autoHull = void 0 === autoHull || autoHull) {
                        var vertices = [];
                        for (i = 0; i < parts.length; i++) vertices = vertices.concat(parts[i].vertices);
                        Vertices.clockwiseSort(vertices);
                        var hull = Vertices.hull(vertices), hullCentre = Vertices.centre(hull);
                        Body.setVertices(body, hull), Vertices.translate(body.vertices, hullCentre);
                    }
                    var total = Body._totalProperties(body);
                    body.area = total.area, (body.parent = body).position.x = total.centre.x, body.position.y = total.centre.y, 
                    body.positionPrev.x = total.centre.x, body.positionPrev.y = total.centre.y, Body.setMass(body, total.mass), 
                    Body.setInertia(body, total.inertia), Body.setPosition(body, total.centre);
                }
            }, Body.setCentre = function(body, centre, relative) {
                relative ? (body.positionPrev.x += centre.x, body.positionPrev.y += centre.y, body.position.x += centre.x, 
                body.position.y += centre.y) : (body.positionPrev.x = centre.x - (body.position.x - body.positionPrev.x), 
                body.positionPrev.y = centre.y - (body.position.y - body.positionPrev.y), body.position.x = centre.x, 
                body.position.y = centre.y);
            }, Body.setPosition = function(body, position) {
                var delta = Vector.sub(position, body.position);
                body.positionPrev.x += delta.x, body.positionPrev.y += delta.y;
                for (var i = 0; i < body.parts.length; i++) {
                    var part = body.parts[i];
                    part.position.x += delta.x, part.position.y += delta.y, Vertices.translate(part.vertices, delta), 
                    Bounds.update(part.bounds, part.vertices, body.velocity);
                }
            }, Body.setAngle = function(body, angle) {
                var delta = angle - body.angle;
                body.anglePrev += delta;
                for (var i = 0; i < body.parts.length; i++) {
                    var part = body.parts[i];
                    part.angle += delta, Vertices.rotate(part.vertices, delta, body.position), Axes.rotate(part.axes, delta), 
                    Bounds.update(part.bounds, part.vertices, body.velocity), 0 < i && Vector.rotateAbout(part.position, delta, body.position, part.position);
                }
            }, Body.setVelocity = function(body, velocity) {
                body.positionPrev.x = body.position.x - velocity.x, body.positionPrev.y = body.position.y - velocity.y, 
                body.velocity.x = velocity.x, body.velocity.y = velocity.y, body.speed = Vector.magnitude(body.velocity);
            }, Body.setAngularVelocity = function(body, velocity) {
                body.anglePrev = body.angle - velocity, body.angularVelocity = velocity, body.angularSpeed = Math.abs(body.angularVelocity);
            }, Body.translate = function(body, translation) {
                Body.setPosition(body, Vector.add(body.position, translation));
            }, Body.rotate = function(body, rotation, point) {
                if (point) {
                    var cos = Math.cos(rotation), sin = Math.sin(rotation), dx = body.position.x - point.x, dy = body.position.y - point.y;
                    Body.setPosition(body, {
                        x: point.x + (dx * cos - dy * sin),
                        y: point.y + (dx * sin + dy * cos)
                    }), Body.setAngle(body, body.angle + rotation);
                } else Body.setAngle(body, body.angle + rotation);
            }, Body.scale = function(body, scaleX, scaleY, point) {
                var totalArea = 0, totalInertia = 0;
                point = point || body.position;
                for (var i = 0; i < body.parts.length; i++) {
                    var part = body.parts[i];
                    Vertices.scale(part.vertices, scaleX, scaleY, point), part.axes = Axes.fromVertices(part.vertices), 
                    part.area = Vertices.area(part.vertices), Body.setMass(part, body.density * part.area), 
                    Vertices.translate(part.vertices, {
                        x: -part.position.x,
                        y: -part.position.y
                    }), Body.setInertia(part, Body._inertiaScale * Vertices.inertia(part.vertices, part.mass)), 
                    Vertices.translate(part.vertices, {
                        x: part.position.x,
                        y: part.position.y
                    }), 0 < i && (totalArea += part.area, totalInertia += part.inertia), part.position.x = point.x + (part.position.x - point.x) * scaleX, 
                    part.position.y = point.y + (part.position.y - point.y) * scaleY, Bounds.update(part.bounds, part.vertices, body.velocity);
                }
                1 < body.parts.length && (body.area = totalArea, body.isStatic || (Body.setMass(body, body.density * totalArea), 
                Body.setInertia(body, totalInertia))), body.circleRadius && (scaleX === scaleY ? body.circleRadius *= scaleX : body.circleRadius = null);
            }, Body.update = function(body, deltaTime, timeScale, correction) {
                var deltaTimeSquared = Math.pow(deltaTime * timeScale * body.timeScale, 2), frictionAir = 1 - body.frictionAir * timeScale * body.timeScale, velocityPrevX = body.position.x - body.positionPrev.x, velocityPrevY = body.position.y - body.positionPrev.y;
                body.velocity.x = velocityPrevX * frictionAir * correction + body.force.x / body.mass * deltaTimeSquared, 
                body.velocity.y = velocityPrevY * frictionAir * correction + body.force.y / body.mass * deltaTimeSquared, 
                body.positionPrev.x = body.position.x, body.positionPrev.y = body.position.y, body.position.x += body.velocity.x, 
                body.position.y += body.velocity.y, body.angularVelocity = (body.angle - body.anglePrev) * frictionAir * correction + body.torque / body.inertia * deltaTimeSquared, 
                body.anglePrev = body.angle, body.angle += body.angularVelocity, body.speed = Vector.magnitude(body.velocity), 
                body.angularSpeed = Math.abs(body.angularVelocity);
                for (var i = 0; i < body.parts.length; i++) {
                    var part = body.parts[i];
                    Vertices.translate(part.vertices, body.velocity), 0 < i && (part.position.x += body.velocity.x, 
                    part.position.y += body.velocity.y), 0 !== body.angularVelocity && (Vertices.rotate(part.vertices, body.angularVelocity, body.position), 
                    Axes.rotate(part.axes, body.angularVelocity), 0 < i && Vector.rotateAbout(part.position, body.angularVelocity, body.position, part.position)), 
                    Bounds.update(part.bounds, part.vertices, body.velocity);
                }
            }, Body.applyForce = function(body, position, force) {
                body.force.x += force.x, body.force.y += force.y;
                var offset_x = position.x - body.position.x, offset_y = position.y - body.position.y;
                body.torque += offset_x * force.y - offset_y * force.x;
            }, Body._totalProperties = function(body) {
                for (var properties = {
                    mass: 0,
                    area: 0,
                    inertia: 0,
                    centre: {
                        x: 0,
                        y: 0
                    }
                }, i = 1 === body.parts.length ? 0 : 1; i < body.parts.length; i++) {
                    var part = body.parts[i], mass = part.mass !== 1 / 0 ? part.mass : 1;
                    properties.mass += mass, properties.area += part.area, properties.inertia += part.inertia, 
                    properties.centre = Vector.add(properties.centre, Vector.mult(part.position, mass));
                }
                return properties.centre = Vector.div(properties.centre, properties.mass), properties;
            };
        }();
    }, function(module, exports, __webpack_require__) {
        var Sleeping = {};
        gmodule.exports = Sleeping;
        var Events = __webpack_require__(4);
        Sleeping._motionWakeThreshold = .18, Sleeping._motionSleepThreshold = .08, Sleeping._minBias = .9, 
        Sleeping.update = function(bodies, timeScale) {
            for (var timeFactor = timeScale * timeScale * timeScale, i = 0; i < bodies.length; i++) {
                var body = bodies[i], motion = body.speed * body.speed + body.angularSpeed * body.angularSpeed;
                if (0 === body.force.x && 0 === body.force.y) {
                    var minMotion = Math.min(body.motion, motion), maxMotion = Math.max(body.motion, motion);
                    body.motion = Sleeping._minBias * minMotion + (1 - Sleeping._minBias) * maxMotion, 
                    0 < body.sleepThreshold && body.motion < Sleeping._motionSleepThreshold * timeFactor ? (body.sleepCounter += 1, 
                    body.sleepCounter >= body.sleepThreshold && Sleeping.set(body, !0)) : 0 < body.sleepCounter && (body.sleepCounter -= 1);
                } else Sleeping.set(body, !1);
            }
        }, Sleeping.afterCollisions = function(pairs, timeScale) {
            for (var timeFactor = timeScale * timeScale * timeScale, i = 0; i < pairs.length; i++) {
                var pair = pairs[i];
                if (pair.isActive) {
                    var collision = pair.collision, bodyA = collision.bodyA.parent, bodyB = collision.bodyB.parent;
                    if (!(bodyA.isSleeping && bodyB.isSleeping || bodyA.isStatic || bodyB.isStatic) && (bodyA.isSleeping || bodyB.isSleeping)) {
                        var sleepingBody = bodyA.isSleeping && !bodyA.isStatic ? bodyA : bodyB, movingBody = sleepingBody === bodyA ? bodyB : bodyA;
                        !sleepingBody.isStatic && movingBody.motion > Sleeping._motionWakeThreshold * timeFactor && Sleeping.set(sleepingBody, !1);
                    }
                }
            }
        }, Sleeping.set = function(body, isSleeping) {
            var wasSleeping = body.isSleeping;
            isSleeping ? (body.isSleeping = !0, body.sleepCounter = body.sleepThreshold, body.positionImpulse.x = 0, 
            body.positionImpulse.y = 0, body.positionPrev.x = body.position.x, body.positionPrev.y = body.position.y, 
            body.anglePrev = body.angle, body.speed = 0, body.angularSpeed = 0, body.motion = 0, 
            wasSleeping || Events.trigger(body, "sleepStart")) : (body.isSleeping = !1, body.sleepCounter = 0, 
            wasSleeping && Events.trigger(body, "sleepEnd"));
        };
    }, function(module, exports, __webpack_require__) {
        var Collision = {};
        gmodule.exports = Collision;
        var _supports, _overlapAB, _overlapBA, Vertices = __webpack_require__(3), Pair = __webpack_require__(9);
        _supports = [], _overlapAB = {
            overlap: 0,
            axis: null
        }, _overlapBA = {
            overlap: 0,
            axis: null
        }, Collision.create = function(bodyA, bodyB) {
            return {
                pair: null,
                collided: !1,
                bodyA: bodyA,
                bodyB: bodyB,
                parentA: bodyA.parent,
                parentB: bodyB.parent,
                depth: 0,
                normal: {
                    x: 0,
                    y: 0
                },
                tangent: {
                    x: 0,
                    y: 0
                },
                penetration: {
                    x: 0,
                    y: 0
                },
                supports: []
            };
        }, Collision.collides = function(bodyA, bodyB, pairs) {
            if (Collision._overlapAxes(_overlapAB, bodyA.vertices, bodyB.vertices, bodyA.axes), 
            _overlapAB.overlap <= 0) return null;
            if (Collision._overlapAxes(_overlapBA, bodyB.vertices, bodyA.vertices, bodyB.axes), 
            _overlapBA.overlap <= 0) return null;
            var collision, minOverlap, pair = pairs && pairs.table[Pair.id(bodyA, bodyB)];
            pair ? collision = pair.collision : ((collision = Collision.create(bodyA, bodyB)).collided = !0, 
            collision.bodyA = bodyA.id < bodyB.id ? bodyA : bodyB, collision.bodyB = bodyA.id < bodyB.id ? bodyB : bodyA, 
            collision.parentA = collision.bodyA.parent, collision.parentB = collision.bodyB.parent), 
            bodyA = collision.bodyA, bodyB = collision.bodyB, minOverlap = _overlapAB.overlap < _overlapBA.overlap ? _overlapAB : _overlapBA;
            var normal = collision.normal, supports = collision.supports, minAxis = minOverlap.axis, minAxisX = minAxis.x, minAxisY = minAxis.y;
            minAxisX * (bodyB.position.x - bodyA.position.x) + minAxisY * (bodyB.position.y - bodyA.position.y) < 0 ? (normal.x = minAxisX, 
            normal.y = minAxisY) : (normal.x = -minAxisX, normal.y = -minAxisY), collision.tangent.x = -normal.y, 
            collision.tangent.y = normal.x, collision.depth = minOverlap.overlap, collision.penetration.x = normal.x * collision.depth, 
            collision.penetration.y = normal.y * collision.depth;
            var supportsB = Collision._findSupports(bodyA, bodyB, normal, 1), supportCount = 0;
            if (Vertices.contains(bodyA.vertices, supportsB[0]) && (supports[supportCount++] = supportsB[0]), 
            Vertices.contains(bodyA.vertices, supportsB[1]) && (supports[supportCount++] = supportsB[1]), 
            supportCount < 2) {
                var supportsA = Collision._findSupports(bodyB, bodyA, normal, -1);
                Vertices.contains(bodyB.vertices, supportsA[0]) && (supports[supportCount++] = supportsA[0]), 
                supportCount < 2 && Vertices.contains(bodyB.vertices, supportsA[1]) && (supports[supportCount++] = supportsA[1]);
            }
            return 0 === supportCount && (supports[supportCount++] = supportsB[0]), supports.length = supportCount, 
            collision;
        }, Collision._overlapAxes = function(result, verticesA, verticesB, axes) {
            var overlap, overlapAB, overlapBA, dot, i, j, verticesALength = verticesA.length, verticesBLength = verticesB.length, verticesAX = verticesA[0].x, verticesAY = verticesA[0].y, verticesBX = verticesB[0].x, verticesBY = verticesB[0].y, axesLength = axes.length, overlapMin = Number.MAX_VALUE, overlapAxisNumber = 0;
            for (i = 0; i < axesLength; i++) {
                var axis = axes[i], axisX = axis.x, axisY = axis.y, minA = verticesAX * axisX + verticesAY * axisY, minB = verticesBX * axisX + verticesBY * axisY, maxA = minA, maxB = minB;
                for (j = 1; j < verticesALength; j += 1) maxA < (dot = verticesA[j].x * axisX + verticesA[j].y * axisY) ? maxA = dot : dot < minA && (minA = dot);
                for (j = 1; j < verticesBLength; j += 1) maxB < (dot = verticesB[j].x * axisX + verticesB[j].y * axisY) ? maxB = dot : dot < minB && (minB = dot);
                if ((overlap = (overlapAB = maxA - minB) < (overlapBA = maxB - minA) ? overlapAB : overlapBA) < overlapMin && (overlapAxisNumber = i, 
                (overlapMin = overlap) <= 0)) break;
            }
            result.axis = axes[overlapAxisNumber], result.overlap = overlapMin;
        }, Collision._projectToAxis = function(projection, vertices, axis) {
            for (var min = vertices[0].x * axis.x + vertices[0].y * axis.y, max = min, i = 1; i < vertices.length; i += 1) {
                var dot = vertices[i].x * axis.x + vertices[i].y * axis.y;
                max < dot ? max = dot : dot < min && (min = dot);
            }
            projection.min = min, projection.max = max;
        }, Collision._findSupports = function(bodyA, bodyB, normal, direction) {
            var vertexA, vertexB, vertexC, distance, j, vertices = bodyB.vertices, verticesLength = vertices.length, bodyAPositionX = bodyA.position.x, bodyAPositionY = bodyA.position.y, normalX = normal.x * direction, normalY = normal.y * direction, nearestDistance = Number.MAX_VALUE;
            for (j = 0; j < verticesLength; j += 1) (distance = normalX * (bodyAPositionX - (vertexB = vertices[j]).x) + normalY * (bodyAPositionY - vertexB.y)) < nearestDistance && (nearestDistance = distance, 
            vertexA = vertexB);
            return nearestDistance = normalX * (bodyAPositionX - (vertexC = vertices[(verticesLength + vertexA.index - 1) % verticesLength]).x) + normalY * (bodyAPositionY - vertexC.y), 
            normalX * (bodyAPositionX - (vertexB = vertices[(vertexA.index + 1) % verticesLength]).x) + normalY * (bodyAPositionY - vertexB.y) < nearestDistance ? (_supports[0] = vertexA, 
            _supports[1] = vertexB) : (_supports[0] = vertexA, _supports[1] = vertexC), _supports;
        };
    }, function(module, exports, __webpack_require__) {
        var Pair = {};
        gmodule.exports = Pair;
        var Contact = __webpack_require__(17);
        Pair.create = function(collision, timestamp) {
            var bodyA = collision.bodyA, bodyB = collision.bodyB, pair = {
                id: Pair.id(bodyA, bodyB),
                bodyA: bodyA,
                bodyB: bodyB,
                collision: collision,
                contacts: [],
                activeContacts: [],
                separation: 0,
                isActive: !0,
                confirmedActive: !0,
                isSensor: bodyA.isSensor || bodyB.isSensor,
                timeCreated: timestamp,
                timeUpdated: timestamp,
                inverseMass: 0,
                friction: 0,
                frictionStatic: 0,
                restitution: 0,
                slop: 0
            };
            return Pair.update(pair, collision, timestamp), pair;
        }, Pair.update = function(pair, collision, timestamp) {
            var contacts = pair.contacts, supports = collision.supports, activeContacts = pair.activeContacts, parentA = collision.parentA, parentB = collision.parentB, parentAVerticesLength = parentA.vertices.length;
            pair.isActive = !0, pair.timeUpdated = timestamp, pair.collision = collision, pair.separation = collision.depth, 
            pair.inverseMass = parentA.inverseMass + parentB.inverseMass, pair.friction = parentA.friction < parentB.friction ? parentA.friction : parentB.friction, 
            pair.frictionStatic = parentA.frictionStatic > parentB.frictionStatic ? parentA.frictionStatic : parentB.frictionStatic, 
            pair.restitution = parentA.restitution > parentB.restitution ? parentA.restitution : parentB.restitution, 
            pair.slop = parentA.slop > parentB.slop ? parentA.slop : parentB.slop, collision.pair = pair;
            for (var i = activeContacts.length = 0; i < supports.length; i++) {
                var support = supports[i], contactId = support.body === parentA ? support.index : parentAVerticesLength + support.index, contact = contacts[contactId];
                contact ? activeContacts.push(contact) : activeContacts.push(contacts[contactId] = Contact.create(support));
            }
        }, Pair.setActive = function(pair, isActive, timestamp) {
            isActive ? (pair.isActive = !0, pair.timeUpdated = timestamp) : (pair.isActive = !1, 
            pair.activeContacts.length = 0);
        }, Pair.id = function(bodyA, bodyB) {
            return bodyA.id < bodyB.id ? "A" + bodyA.id + "B" + bodyB.id : "A" + bodyB.id + "B" + bodyA.id;
        };
    }, function(module, exports, __webpack_require__) {
        var Constraint = {};
        gmodule.exports = Constraint;
        var Vertices = __webpack_require__(3), Vector = __webpack_require__(2), Sleeping = __webpack_require__(7), Bounds = __webpack_require__(1), Axes = __webpack_require__(11), Common = __webpack_require__(0);
        Constraint._warming = .4, Constraint._torqueDampen = 1, Constraint._minLength = 1e-6, 
        Constraint.create = function(options) {
            var constraint = options;
            constraint.bodyA && !constraint.pointA && (constraint.pointA = {
                x: 0,
                y: 0
            }), constraint.bodyB && !constraint.pointB && (constraint.pointB = {
                x: 0,
                y: 0
            });
            var initialPointA = constraint.bodyA ? Vector.add(constraint.bodyA.position, constraint.pointA) : constraint.pointA, initialPointB = constraint.bodyB ? Vector.add(constraint.bodyB.position, constraint.pointB) : constraint.pointB, length = Vector.magnitude(Vector.sub(initialPointA, initialPointB));
            constraint.length = void 0 !== constraint.length ? constraint.length : length, constraint.id = constraint.id || Common.nextId(), 
            constraint.label = constraint.label || "Constraint", constraint.type = "constraint", 
            constraint.stiffness = constraint.stiffness || (0 < constraint.length ? 1 : .7), 
            constraint.damping = constraint.damping || 0, constraint.angularStiffness = constraint.angularStiffness || 0, 
            constraint.angleA = constraint.bodyA ? constraint.bodyA.angle : constraint.angleA, 
            constraint.angleB = constraint.bodyB ? constraint.bodyB.angle : constraint.angleB, 
            constraint.plugin = {};
            var render = {
                visible: !0,
                lineWidth: 2,
                strokeStyle: "#ffffff",
                type: "line",
                anchors: !0
            };
            return 0 === constraint.length && .1 < constraint.stiffness ? (render.type = "pin", 
            render.anchors = !1) : constraint.stiffness < .9 && (render.type = "spring"), constraint.render = Common.extend(render, constraint.render), 
            constraint;
        }, Constraint.preSolveAll = function(bodies) {
            for (var i = 0; i < bodies.length; i += 1) {
                var body = bodies[i], impulse = body.constraintImpulse;
                body.isStatic || 0 === impulse.x && 0 === impulse.y && 0 === impulse.angle || (body.position.x += impulse.x, 
                body.position.y += impulse.y, body.angle += impulse.angle);
            }
        }, Constraint.solveAll = function(constraints, timeScale) {
            for (var i = 0; i < constraints.length; i += 1) {
                var constraint = constraints[i], fixedA = !constraint.bodyA || constraint.bodyA && constraint.bodyA.isStatic, fixedB = !constraint.bodyB || constraint.bodyB && constraint.bodyB.isStatic;
                (fixedA || fixedB) && Constraint.solve(constraints[i], timeScale);
            }
            for (i = 0; i < constraints.length; i += 1) fixedA = !(constraint = constraints[i]).bodyA || constraint.bodyA && constraint.bodyA.isStatic, 
            fixedB = !constraint.bodyB || constraint.bodyB && constraint.bodyB.isStatic, fixedA || fixedB || Constraint.solve(constraints[i], timeScale);
        }, Constraint.solve = function(constraint, timeScale) {
            var bodyA = constraint.bodyA, bodyB = constraint.bodyB, pointA = constraint.pointA, pointB = constraint.pointB;
            if (bodyA || bodyB) {
                bodyA && !bodyA.isStatic && (Vector.rotate(pointA, bodyA.angle - constraint.angleA, pointA), 
                constraint.angleA = bodyA.angle), bodyB && !bodyB.isStatic && (Vector.rotate(pointB, bodyB.angle - constraint.angleB, pointB), 
                constraint.angleB = bodyB.angle);
                var pointAWorld = pointA, pointBWorld = pointB;
                if (bodyA && (pointAWorld = Vector.add(bodyA.position, pointA)), bodyB && (pointBWorld = Vector.add(bodyB.position, pointB)), 
                pointAWorld && pointBWorld) {
                    var delta = Vector.sub(pointAWorld, pointBWorld), currentLength = Vector.magnitude(delta);
                    currentLength < Constraint._minLength && (currentLength = Constraint._minLength);
                    var torque, share, normal, normalVelocity, relativeVelocity, difference = (currentLength - constraint.length) / currentLength, stiffness = constraint.stiffness < 1 ? constraint.stiffness * timeScale : constraint.stiffness, force = Vector.mult(delta, difference * stiffness), massTotal = (bodyA ? bodyA.inverseMass : 0) + (bodyB ? bodyB.inverseMass : 0), resistanceTotal = massTotal + ((bodyA ? bodyA.inverseInertia : 0) + (bodyB ? bodyB.inverseInertia : 0));
                    if (constraint.damping) {
                        var zero = Vector.create();
                        normal = Vector.div(delta, currentLength), relativeVelocity = Vector.sub(bodyB && Vector.sub(bodyB.position, bodyB.positionPrev) || zero, bodyA && Vector.sub(bodyA.position, bodyA.positionPrev) || zero), 
                        normalVelocity = Vector.dot(normal, relativeVelocity);
                    }
                    bodyA && !bodyA.isStatic && (share = bodyA.inverseMass / massTotal, bodyA.constraintImpulse.x -= force.x * share, 
                    bodyA.constraintImpulse.y -= force.y * share, bodyA.position.x -= force.x * share, 
                    bodyA.position.y -= force.y * share, constraint.damping && (bodyA.positionPrev.x -= constraint.damping * normal.x * normalVelocity * share, 
                    bodyA.positionPrev.y -= constraint.damping * normal.y * normalVelocity * share), 
                    torque = Vector.cross(pointA, force) / resistanceTotal * Constraint._torqueDampen * bodyA.inverseInertia * (1 - constraint.angularStiffness), 
                    bodyA.constraintImpulse.angle -= torque, bodyA.angle -= torque), bodyB && !bodyB.isStatic && (share = bodyB.inverseMass / massTotal, 
                    bodyB.constraintImpulse.x += force.x * share, bodyB.constraintImpulse.y += force.y * share, 
                    bodyB.position.x += force.x * share, bodyB.position.y += force.y * share, constraint.damping && (bodyB.positionPrev.x += constraint.damping * normal.x * normalVelocity * share, 
                    bodyB.positionPrev.y += constraint.damping * normal.y * normalVelocity * share), 
                    torque = Vector.cross(pointB, force) / resistanceTotal * Constraint._torqueDampen * bodyB.inverseInertia * (1 - constraint.angularStiffness), 
                    bodyB.constraintImpulse.angle += torque, bodyB.angle += torque);
                }
            }
        }, Constraint.postSolveAll = function(bodies) {
            for (var i = 0; i < bodies.length; i++) {
                var body = bodies[i], impulse = body.constraintImpulse;
                if (!(body.isStatic || 0 === impulse.x && 0 === impulse.y && 0 === impulse.angle)) {
                    Sleeping.set(body, !1);
                    for (var j = 0; j < body.parts.length; j++) {
                        var part = body.parts[j];
                        Vertices.translate(part.vertices, impulse), 0 < j && (part.position.x += impulse.x, 
                        part.position.y += impulse.y), 0 !== impulse.angle && (Vertices.rotate(part.vertices, impulse.angle, body.position), 
                        Axes.rotate(part.axes, impulse.angle), 0 < j && Vector.rotateAbout(part.position, impulse.angle, body.position, part.position)), 
                        Bounds.update(part.bounds, part.vertices, body.velocity);
                    }
                    impulse.angle *= Constraint._warming, impulse.x *= Constraint._warming, impulse.y *= Constraint._warming;
                }
            }
        }, Constraint.pointAWorld = function(constraint) {
            return {
                x: (constraint.bodyA ? constraint.bodyA.position.x : 0) + constraint.pointA.x,
                y: (constraint.bodyA ? constraint.bodyA.position.y : 0) + constraint.pointA.y
            };
        }, Constraint.pointBWorld = function(constraint) {
            return {
                x: (constraint.bodyB ? constraint.bodyB.position.x : 0) + constraint.pointB.x,
                y: (constraint.bodyB ? constraint.bodyB.position.y : 0) + constraint.pointB.y
            };
        };
    }, function(module, exports, __webpack_require__) {
        var Axes = {};
        gmodule.exports = Axes;
        var Vector = __webpack_require__(2), Common = __webpack_require__(0);
        Axes.fromVertices = function(vertices) {
            for (var axes = {}, i = 0; i < vertices.length; i++) {
                var j = (i + 1) % vertices.length, normal = Vector.normalise({
                    x: vertices[j].y - vertices[i].y,
                    y: vertices[i].x - vertices[j].x
                }), gradient = 0 === normal.y ? 1 / 0 : normal.x / normal.y;
                axes[gradient = gradient.toFixed(3).toString()] = normal;
            }
            return Common.values(axes);
        }, Axes.rotate = function(axes, angle) {
            if (0 !== angle) for (var cos = Math.cos(angle), sin = Math.sin(angle), i = 0; i < axes.length; i++) {
                var xx, axis = axes[i];
                xx = axis.x * cos - axis.y * sin, axis.y = axis.x * sin + axis.y * cos, axis.x = xx;
            }
        };
    }, function(module, exports, __webpack_require__) {
        var Bodies = {};
        gmodule.exports = Bodies;
        var Vertices = __webpack_require__(3), Common = __webpack_require__(0), Body = __webpack_require__(6), Bounds = __webpack_require__(1), Vector = __webpack_require__(2);
        Bodies.rectangle = function(x, y, width, height, options) {
            options = options || {};
            var rectangle = {
                label: "Rectangle Body",
                position: {
                    x: x,
                    y: y
                },
                vertices: Vertices.fromPath("L 0 0 L " + width + " 0 L " + width + " " + height + " L 0 " + height)
            };
            if (options.chamfer) {
                var chamfer = options.chamfer;
                rectangle.vertices = Vertices.chamfer(rectangle.vertices, chamfer.radius, chamfer.quality, chamfer.qualityMin, chamfer.qualityMax), 
                delete options.chamfer;
            }
            return Body.create(Common.extend({}, rectangle, options));
        }, Bodies.trapezoid = function(x, y, width, height, slope, options) {
            options = options || {};
            var verticesPath, x1 = width * (slope *= .5), x2 = x1 + (1 - 2 * slope) * width, x3 = x2 + x1;
            verticesPath = slope < .5 ? "L 0 0 L " + x1 + " " + -height + " L " + x2 + " " + -height + " L " + x3 + " 0" : "L 0 0 L " + x2 + " " + -height + " L " + x3 + " 0";
            var trapezoid = {
                label: "Trapezoid Body",
                position: {
                    x: x,
                    y: y
                },
                vertices: Vertices.fromPath(verticesPath)
            };
            if (options.chamfer) {
                var chamfer = options.chamfer;
                trapezoid.vertices = Vertices.chamfer(trapezoid.vertices, chamfer.radius, chamfer.quality, chamfer.qualityMin, chamfer.qualityMax), 
                delete options.chamfer;
            }
            return Body.create(Common.extend({}, trapezoid, options));
        }, Bodies.circle = function(x, y, radius, options, maxSides) {
            options = options || {};
            var circle = {
                label: "Circle Body",
                circleRadius: radius
            };
            maxSides = maxSides || 25;
            var sides = Math.ceil(Math.max(10, Math.min(maxSides, radius)));
            return sides % 2 == 1 && (sides += 1), Bodies.polygon(x, y, sides, radius, Common.extend({}, circle, options));
        }, Bodies.polygon = function(x, y, sides, radius, options) {
            if (options = options || {}, sides < 3) return Bodies.circle(x, y, radius, options);
            for (var theta = 2 * Math.PI / sides, path = "", offset = .5 * theta, i = 0; i < sides; i += 1) {
                var angle = offset + i * theta, xx = Math.cos(angle) * radius, yy = Math.sin(angle) * radius;
                path += "L " + xx.toFixed(3) + " " + yy.toFixed(3) + " ";
            }
            var polygon = {
                label: "Polygon Body",
                position: {
                    x: x,
                    y: y
                },
                vertices: Vertices.fromPath(path)
            };
            if (options.chamfer) {
                var chamfer = options.chamfer;
                polygon.vertices = Vertices.chamfer(polygon.vertices, chamfer.radius, chamfer.quality, chamfer.qualityMin, chamfer.qualityMax), 
                delete options.chamfer;
            }
            return Body.create(Common.extend({}, polygon, options));
        }, Bodies.fromVertices = function(x, y, vertexSets, options, flagInternal, removeCollinear, minimumArea, removeDuplicatePoints) {
            var canDecomp, body, parts, isConvex, vertices, i, j, k, v, z, decomp = Common.getDecomp();
            for (canDecomp = Boolean(decomp && decomp.quickDecomp), options = options || {}, 
            parts = [], flagInternal = void 0 !== flagInternal && flagInternal, removeCollinear = void 0 !== removeCollinear ? removeCollinear : .01, 
            minimumArea = void 0 !== minimumArea ? minimumArea : 10, removeDuplicatePoints = void 0 !== removeDuplicatePoints ? removeDuplicatePoints : .01, 
            Common.isArray(vertexSets[0]) || (vertexSets = [ vertexSets ]), v = 0; v < vertexSets.length; v += 1) if (vertices = vertexSets[v], 
            !(isConvex = Vertices.isConvex(vertices)) && !canDecomp && Common.warnOnce("Bodies.fromVertices: Install the 'poly-decomp' library and use Common.setDecomp or provide 'decomp' as a global to decompose concave vertices."), 
            isConvex || !canDecomp) vertices = isConvex ? Vertices.clockwiseSort(vertices) : Vertices.hull(vertices), 
            parts.push({
                position: {
                    x: x,
                    y: y
                },
                vertices: vertices
            }); else {
                var concave = vertices.map(function(vertex) {
                    return [ vertex.x, vertex.y ];
                });
                decomp.makeCCW(concave), !1 !== removeCollinear && decomp.removeCollinearPoints(concave, removeCollinear), 
                !1 !== removeDuplicatePoints && decomp.removeDuplicatePoints && decomp.removeDuplicatePoints(concave, removeDuplicatePoints);
                var decomposed = decomp.quickDecomp(concave);
                for (i = 0; i < decomposed.length; i++) {
                    var chunkVertices = decomposed[i].map(function(vertices) {
                        return {
                            x: vertices[0],
                            y: vertices[1]
                        };
                    });
                    0 < minimumArea && Vertices.area(chunkVertices) < minimumArea || parts.push({
                        position: Vertices.centre(chunkVertices),
                        vertices: chunkVertices
                    });
                }
            }
            for (i = 0; i < parts.length; i++) parts[i] = Body.create(Common.extend(parts[i], options));
            if (flagInternal) for (i = 0; i < parts.length; i++) {
                var partA = parts[i];
                for (j = i + 1; j < parts.length; j++) {
                    var partB = parts[j];
                    if (Bounds.overlaps(partA.bounds, partB.bounds)) {
                        var pav = partA.vertices, pbv = partB.vertices;
                        for (k = 0; k < partA.vertices.length; k++) for (z = 0; z < partB.vertices.length; z++) {
                            var da = Vector.magnitudeSquared(Vector.sub(pav[(k + 1) % pav.length], pbv[z])), db = Vector.magnitudeSquared(Vector.sub(pav[k], pbv[(z + 1) % pbv.length]));
                            da < 5 && db < 5 && (pav[k].isInternal = !0, pbv[z].isInternal = !0);
                        }
                    }
                }
            }
            return 1 < parts.length ? (body = Body.create(Common.extend({
                parts: parts.slice(0)
            }, options)), Body.setPosition(body, {
                x: x,
                y: y
            }), body) : parts[0];
        };
    }, function(module, exports, __webpack_require__) {
        var Mouse = {};
        gmodule.exports = Mouse;
        var Common = __webpack_require__(0);
        Mouse.create = function(element) {
            var mouse = {};
            return element || Common.log("Mouse.create: element was undefined, defaulting to document.body", "warn"), 
            mouse.element = element || document.body, mouse.absolute = {
                x: 0,
                y: 0
            }, mouse.position = {
                x: 0,
                y: 0
            }, mouse.mousedownPosition = {
                x: 0,
                y: 0
            }, mouse.mouseupPosition = {
                x: 0,
                y: 0
            }, mouse.offset = {
                x: 0,
                y: 0
            }, mouse.scale = {
                x: 1,
                y: 1
            }, mouse.wheelDelta = 0, mouse.button = -1, mouse.pixelRatio = parseInt(mouse.element.getAttribute("data-pixel-ratio"), 10) || 1, 
            mouse.sourceEvents = {
                mousemove: null,
                mousedown: null,
                mouseup: null,
                mousewheel: null
            }, mouse.mousemove = function(event) {
                var position = Mouse._getRelativeMousePosition(event, mouse.element, mouse.pixelRatio);
                event.changedTouches && (mouse.button = 0, event.preventDefault()), mouse.absolute.x = position.x, 
                mouse.absolute.y = position.y, mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x, 
                mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y, mouse.sourceEvents.mousemove = event;
            }, mouse.mousedown = function(event) {
                var position = Mouse._getRelativeMousePosition(event, mouse.element, mouse.pixelRatio);
                event.changedTouches ? (mouse.button = 0, event.preventDefault()) : mouse.button = event.button, 
                mouse.absolute.x = position.x, mouse.absolute.y = position.y, mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x, 
                mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y, mouse.mousedownPosition.x = mouse.position.x, 
                mouse.mousedownPosition.y = mouse.position.y, mouse.sourceEvents.mousedown = event;
            }, mouse.mouseup = function(event) {
                var position = Mouse._getRelativeMousePosition(event, mouse.element, mouse.pixelRatio);
                event.changedTouches && event.preventDefault(), mouse.button = -1, mouse.absolute.x = position.x, 
                mouse.absolute.y = position.y, mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x, 
                mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y, mouse.mouseupPosition.x = mouse.position.x, 
                mouse.mouseupPosition.y = mouse.position.y, mouse.sourceEvents.mouseup = event;
            }, mouse.mousewheel = function(event) {
                mouse.wheelDelta = Math.max(-1, Math.min(1, event.wheelDelta || -event.detail)), 
                event.preventDefault();
            }, Mouse.setElement(mouse, mouse.element), mouse;
        }, Mouse.setElement = function(mouse, element) {
            (mouse.element = element).addEventListener("mousemove", mouse.mousemove), element.addEventListener("mousedown", mouse.mousedown), 
            element.addEventListener("mouseup", mouse.mouseup), element.addEventListener("mousewheel", mouse.mousewheel), 
            element.addEventListener("DOMMouseScroll", mouse.mousewheel), element.addEventListener("touchmove", mouse.mousemove), 
            element.addEventListener("touchstart", mouse.mousedown), element.addEventListener("touchend", mouse.mouseup);
        }, Mouse.clearSourceEvents = function(mouse) {
            mouse.sourceEvents.mousemove = null, mouse.sourceEvents.mousedown = null, mouse.sourceEvents.mouseup = null, 
            mouse.sourceEvents.mousewheel = null, mouse.wheelDelta = 0;
        }, Mouse.setOffset = function(mouse, offset) {
            mouse.offset.x = offset.x, mouse.offset.y = offset.y, mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x, 
            mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y;
        }, Mouse.setScale = function(mouse, scale) {
            mouse.scale.x = scale.x, mouse.scale.y = scale.y, mouse.position.x = mouse.absolute.x * mouse.scale.x + mouse.offset.x, 
            mouse.position.y = mouse.absolute.y * mouse.scale.y + mouse.offset.y;
        }, Mouse._getRelativeMousePosition = function(event, element, pixelRatio) {
            var x, y, elementBounds = element.getBoundingClientRect(), rootNode = document.documentElement || document.body.parentNode || document.body, scrollX = void 0 !== window.pageXOffset ? window.pageXOffset : rootNode.scrollLeft, scrollY = void 0 !== window.pageYOffset ? window.pageYOffset : rootNode.scrollTop, touches = event.changedTouches;
            return y = touches ? (x = touches[0].pageX - elementBounds.left - scrollX, touches[0].pageY - elementBounds.top - scrollY) : (x = event.pageX - elementBounds.left - scrollX, 
            event.pageY - elementBounds.top - scrollY), {
                x: x / (element.clientWidth / (element.width || element.clientWidth) * pixelRatio),
                y: y / (element.clientHeight / (element.height || element.clientHeight) * pixelRatio)
            };
        };
    }, function(module, exports, __webpack_require__) {
        var Detector = {};
        gmodule.exports = Detector;
        var Common = __webpack_require__(0), Collision = __webpack_require__(8);
        Detector.create = function(options) {
            return Common.extend({
                bodies: [],
                pairs: null
            }, options);
        }, Detector.setBodies = function(detector, bodies) {
            detector.bodies = bodies.slice(0);
        }, Detector.clear = function(detector) {
            detector.bodies = [];
        }, Detector.collisions = function(detector) {
            var i, j, collisions = [], pairs = detector.pairs, bodies = detector.bodies, bodiesLength = bodies.length, canCollide = Detector.canCollide, collides = Collision.collides;
            for (bodies.sort(Detector._compareBoundsX), i = 0; i < bodiesLength; i++) {
                var bodyA = bodies[i], boundsA = bodyA.bounds, boundXMax = bodyA.bounds.max.x, boundYMax = bodyA.bounds.max.y, boundYMin = bodyA.bounds.min.y, bodyAStatic = bodyA.isStatic || bodyA.isSleeping, partsALength = bodyA.parts.length, partsASingle = 1 === partsALength;
                for (j = i + 1; j < bodiesLength; j++) {
                    var bodyB = bodies[j];
                    if ((boundsB = bodyB.bounds).min.x > boundXMax) break;
                    if (!(boundYMax < boundsB.min.y || boundYMin > boundsB.max.y) && (!bodyAStatic || !bodyB.isStatic && !bodyB.isSleeping) && canCollide(bodyA.collisionFilter, bodyB.collisionFilter)) {
                        var partsBLength = bodyB.parts.length;
                        if (partsASingle && 1 === partsBLength) (collision = collides(bodyA, bodyB, pairs)) && collisions.push(collision); else for (var partsBStart = 1 < partsBLength ? 1 : 0, k = 1 < partsALength ? 1 : 0; k < partsALength; k++) for (var partA = bodyA.parts[k], z = (boundsA = partA.bounds, 
                        partsBStart); z < partsBLength; z++) {
                            var collision, partB = bodyB.parts[z], boundsB = partB.bounds;
                            boundsA.min.x > boundsB.max.x || boundsA.max.x < boundsB.min.x || boundsA.max.y < boundsB.min.y || boundsA.min.y > boundsB.max.y || (collision = collides(partA, partB, pairs)) && collisions.push(collision);
                        }
                    }
                }
            }
            return collisions;
        }, Detector.canCollide = function(filterA, filterB) {
            return filterA.group === filterB.group && 0 !== filterA.group ? 0 < filterA.group : 0 != (filterA.mask & filterB.category) && 0 != (filterB.mask & filterA.category);
        }, Detector._compareBoundsX = function(bodyA, bodyB) {
            return bodyA.bounds.min.x - bodyB.bounds.min.x;
        };
    }, function(module, exports, __webpack_require__) {
        var Plugin = {};
        gmodule.exports = Plugin;
        var Common = __webpack_require__(0);
        Plugin._registry = {}, Plugin.register = function(plugin) {
            if (Plugin.isPlugin(plugin) || Common.warn("Plugin.register:", Plugin.toString(plugin), "does not implement all required fields."), 
            plugin.name in Plugin._registry) {
                var registered = Plugin._registry[plugin.name], pluginVersion = Plugin.versionParse(plugin.version).number, registeredVersion = Plugin.versionParse(registered.version).number;
                registeredVersion < pluginVersion ? (Common.warn("Plugin.register:", Plugin.toString(registered), "was upgraded to", Plugin.toString(plugin)), 
                Plugin._registry[plugin.name] = plugin) : pluginVersion < registeredVersion ? Common.warn("Plugin.register:", Plugin.toString(registered), "can not be downgraded to", Plugin.toString(plugin)) : plugin !== registered && Common.warn("Plugin.register:", Plugin.toString(plugin), "is already registered to different plugin object");
            } else Plugin._registry[plugin.name] = plugin;
            return plugin;
        }, Plugin.resolve = function(dependency) {
            return Plugin._registry[Plugin.dependencyParse(dependency).name];
        }, Plugin.toString = function(plugin) {
            return "string" == typeof plugin ? plugin : (plugin.name || "anonymous") + "@" + (plugin.version || plugin.range || "0.0.0");
        }, Plugin.isPlugin = function(obj) {
            return obj && obj.name && obj.version && obj.install;
        }, Plugin.isUsed = function(module, name) {
            return -1 < module.used.indexOf(name);
        }, Plugin.isFor = function(plugin, module) {
            var parsed = plugin.for && Plugin.dependencyParse(plugin.for);
            return !plugin.for || module.name === parsed.name && Plugin.versionSatisfies(module.version, parsed.range);
        }, Plugin.use = function(module, plugins) {
            if (module.uses = (module.uses || []).concat(plugins || []), 0 !== module.uses.length) {
                for (var dependencies = Plugin.dependencies(module), sortedDependencies = Common.topologicalSort(dependencies), status = [], i = 0; i < sortedDependencies.length; i += 1) if (sortedDependencies[i] !== module.name) {
                    var plugin = Plugin.resolve(sortedDependencies[i]);
                    plugin ? Plugin.isUsed(module, plugin.name) || (Plugin.isFor(plugin, module) || (Common.warn("Plugin.use:", Plugin.toString(plugin), "is for", plugin.for, "but installed on", Plugin.toString(module) + "."), 
                    plugin._warned = !0), plugin.install ? plugin.install(module) : (Common.warn("Plugin.use:", Plugin.toString(plugin), "does not specify an install function."), 
                    plugin._warned = !0), plugin._warned ? (status.push("🔶 " + Plugin.toString(plugin)), 
                    delete plugin._warned) : status.push("✅ " + Plugin.toString(plugin)), module.used.push(plugin.name)) : status.push("❌ " + sortedDependencies[i]);
                }
                0 < status.length && Common.info(status.join("  "));
            } else Common.warn("Plugin.use:", Plugin.toString(module), "does not specify any dependencies to install.");
        }, Plugin.dependencies = function(module, tracked) {
            var parsedBase = Plugin.dependencyParse(module), name = parsedBase.name;
            if (!(name in (tracked = tracked || {}))) {
                module = Plugin.resolve(module) || module, tracked[name] = Common.map(module.uses || [], function(dependency) {
                    Plugin.isPlugin(dependency) && Plugin.register(dependency);
                    var parsed = Plugin.dependencyParse(dependency), resolved = Plugin.resolve(dependency);
                    return resolved && !Plugin.versionSatisfies(resolved.version, parsed.range) ? (Common.warn("Plugin.dependencies:", Plugin.toString(resolved), "does not satisfy", Plugin.toString(parsed), "used by", Plugin.toString(parsedBase) + "."), 
                    resolved._warned = !0, module._warned = !0) : resolved || (Common.warn("Plugin.dependencies:", Plugin.toString(dependency), "used by", Plugin.toString(parsedBase), "could not be resolved."), 
                    module._warned = !0), parsed.name;
                });
                for (var i = 0; i < tracked[name].length; i += 1) Plugin.dependencies(tracked[name][i], tracked);
                return tracked;
            }
        }, Plugin.dependencyParse = function(dependency) {
            return Common.isString(dependency) ? (/^[\w-]+(@(\*|[\^~]?\d+\.\d+\.\d+(-[0-9A-Za-z-+]+)?))?$/.test(dependency) || Common.warn("Plugin.dependencyParse:", dependency, "is not a valid dependency string."), 
            {
                name: dependency.split("@")[0],
                range: dependency.split("@")[1] || "*"
            }) : {
                name: dependency.name,
                range: dependency.range || dependency.version
            };
        }, Plugin.versionParse = function(range) {
            var pattern = /^(\*)|(\^|~|>=|>)?\s*((\d+)\.(\d+)\.(\d+))(-[0-9A-Za-z-+]+)?$/;
            pattern.test(range) || Common.warn("Plugin.versionParse:", range, "is not a valid version or range.");
            var parts = pattern.exec(range), major = Number(parts[4]), minor = Number(parts[5]), patch = Number(parts[6]);
            return {
                isRange: Boolean(parts[1] || parts[2]),
                version: parts[3],
                range: range,
                operator: parts[1] || parts[2] || "",
                major: major,
                minor: minor,
                patch: patch,
                parts: [ major, minor, patch ],
                prerelease: parts[7],
                number: 1e8 * major + 1e4 * minor + patch
            };
        }, Plugin.versionSatisfies = function(version, range) {
            range = range || "*";
            var r = Plugin.versionParse(range), v = Plugin.versionParse(version);
            if (r.isRange) {
                if ("*" === r.operator || "*" === version) return !0;
                if (">" === r.operator) return v.number > r.number;
                if (">=" === r.operator) return v.number >= r.number;
                if ("~" === r.operator) return v.major === r.major && v.minor === r.minor && v.patch >= r.patch;
                if ("^" === r.operator) return 0 < r.major ? v.major === r.major && v.number >= r.number : 0 < r.minor ? v.minor === r.minor && v.patch >= r.patch : v.patch === r.patch;
            }
            return version === range || "*" === version;
        };
    }, function(module, exports, __webpack_require__) {
        var Render = {};
        gmodule.exports = Render;
        var Common = __webpack_require__(0), Composite = __webpack_require__(5), Bounds = __webpack_require__(1), Events = __webpack_require__(4), Vector = __webpack_require__(2), Mouse = __webpack_require__(13);
        !function() {
            var _requestAnimationFrame, _cancelAnimationFrame;
            "undefined" != typeof window && (_requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) {
                window.setTimeout(function() {
                    callback(Common.now());
                }, 1e3 / 60);
            }, _cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame), 
            Render._goodFps = 30, Render._goodDelta = 1e3 / 60, Render.create = function(options) {
                var defaults = {
                    controller: Render,
                    engine: null,
                    element: null,
                    canvas: null,
                    mouse: null,
                    frameRequestId: null,
                    timing: {
                        historySize: 60,
                        delta: 0,
                        deltaHistory: [],
                        lastTime: 0,
                        lastTimestamp: 0,
                        lastElapsed: 0,
                        timestampElapsed: 0,
                        timestampElapsedHistory: [],
                        engineDeltaHistory: [],
                        engineElapsedHistory: [],
                        elapsedHistory: []
                    },
                    options: {
                        width: 800,
                        height: 600,
                        pixelRatio: 1,
                        background: "#14151f",
                        wireframeBackground: "#14151f",
                        hasBounds: !!options.bounds,
                        enabled: !0,
                        wireframes: !0,
                        showSleeping: !0,
                        showDebug: !1,
                        showStats: !1,
                        showPerformance: !1,
                        showBounds: !1,
                        showVelocity: !1,
                        showCollisions: !1,
                        showSeparations: !1,
                        showAxes: !1,
                        showPositions: !1,
                        showAngleIndicator: !1,
                        showIds: !1,
                        showVertexNumbers: !1,
                        showConvexHulls: !1,
                        showInternalEdges: !1,
                        showMousePosition: !1
                    }
                }, render = Common.extend(defaults, options);
                return render.canvas && (render.canvas.width = render.options.width || render.canvas.width, 
                render.canvas.height = render.options.height || render.canvas.height), render.mouse = options.mouse, 
                render.engine = options.engine, render.canvas = render.canvas || _createCanvas(render.options.width, render.options.height), 
                render.context = render.canvas.getContext("2d"), render.textures = {}, render.bounds = render.bounds || {
                    min: {
                        x: 0,
                        y: 0
                    },
                    max: {
                        x: render.canvas.width,
                        y: render.canvas.height
                    }
                }, render.options.showBroadphase = !1, 1 !== render.options.pixelRatio && Render.setPixelRatio(render, render.options.pixelRatio), 
                Common.isElement(render.element) ? render.element.appendChild(render.canvas) : render.canvas.parentNode || Common.log("Render.create: options.element was undefined, render.canvas was created but not appended", "warn"), 
                render;
            }, Render.run = function(render) {
                !function loop(time) {
                    render.frameRequestId = _requestAnimationFrame(loop), _updateTiming(render, time), 
                    Render.world(render, time), (render.options.showStats || render.options.showDebug) && Render.stats(render, render.context, time), 
                    (render.options.showPerformance || render.options.showDebug) && Render.performance(render, render.context, time);
                }();
            }, Render.stop = function(render) {
                _cancelAnimationFrame(render.frameRequestId);
            }, Render.setPixelRatio = function(render, pixelRatio) {
                var options = render.options, canvas = render.canvas;
                "auto" === pixelRatio && (pixelRatio = _getPixelRatio(canvas)), options.pixelRatio = pixelRatio, 
                canvas.setAttribute("data-pixel-ratio", pixelRatio), canvas.width = options.width * pixelRatio, 
                canvas.height = options.height * pixelRatio, canvas.style.width = options.width + "px", 
                canvas.style.height = options.height + "px";
            }, Render.lookAt = function(render, objects, padding, center) {
                center = void 0 === center || center, objects = Common.isArray(objects) ? objects : [ objects ], 
                padding = padding || {
                    x: 0,
                    y: 0
                };
                for (var bounds = {
                    min: {
                        x: 1 / 0,
                        y: 1 / 0
                    },
                    max: {
                        x: -1 / 0,
                        y: -1 / 0
                    }
                }, i = 0; i < objects.length; i += 1) {
                    var object = objects[i], min = object.bounds ? object.bounds.min : object.min || object.position || object, max = object.bounds ? object.bounds.max : object.max || object.position || object;
                    min && max && (min.x < bounds.min.x && (bounds.min.x = min.x), max.x > bounds.max.x && (bounds.max.x = max.x), 
                    min.y < bounds.min.y && (bounds.min.y = min.y), max.y > bounds.max.y && (bounds.max.y = max.y));
                }
                var width = bounds.max.x - bounds.min.x + 2 * padding.x, height = bounds.max.y - bounds.min.y + 2 * padding.y, viewHeight = render.canvas.height, outerRatio = render.canvas.width / viewHeight, innerRatio = width / height, scaleX = 1, scaleY = 1;
                outerRatio < innerRatio ? scaleY = innerRatio / outerRatio : scaleX = outerRatio / innerRatio, 
                render.options.hasBounds = !0, render.bounds.min.x = bounds.min.x, render.bounds.max.x = bounds.min.x + width * scaleX, 
                render.bounds.min.y = bounds.min.y, render.bounds.max.y = bounds.min.y + height * scaleY, 
                center && (render.bounds.min.x += .5 * width - width * scaleX * .5, render.bounds.max.x += .5 * width - width * scaleX * .5, 
                render.bounds.min.y += .5 * height - height * scaleY * .5, render.bounds.max.y += .5 * height - height * scaleY * .5), 
                render.bounds.min.x -= padding.x, render.bounds.max.x -= padding.x, render.bounds.min.y -= padding.y, 
                render.bounds.max.y -= padding.y, render.mouse && (Mouse.setScale(render.mouse, {
                    x: (render.bounds.max.x - render.bounds.min.x) / render.canvas.width,
                    y: (render.bounds.max.y - render.bounds.min.y) / render.canvas.height
                }), Mouse.setOffset(render.mouse, render.bounds.min));
            }, Render.startViewTransform = function(render) {
                var boundsWidth = render.bounds.max.x - render.bounds.min.x, boundsHeight = render.bounds.max.y - render.bounds.min.y, boundsScaleX = boundsWidth / render.options.width, boundsScaleY = boundsHeight / render.options.height;
                render.context.setTransform(render.options.pixelRatio / boundsScaleX, 0, 0, render.options.pixelRatio / boundsScaleY, 0, 0), 
                render.context.translate(-render.bounds.min.x, -render.bounds.min.y);
            }, Render.endViewTransform = function(render) {
                render.context.setTransform(render.options.pixelRatio, 0, 0, render.options.pixelRatio, 0, 0);
            }, Render.world = function(render, time) {
                var i, startTime = Common.now(), engine = render.engine, world = engine.world, canvas = render.canvas, context = render.context, options = render.options, timing = render.timing, allBodies = Composite.allBodies(world), allConstraints = Composite.allConstraints(world), background = options.wireframes ? options.wireframeBackground : options.background, bodies = [], constraints = [], event = {
                    timestamp: engine.timing.timestamp
                };
                if (Events.trigger(render, "beforeRender", event), render.currentBackground !== background && _applyBackground(render, background), 
                context.globalCompositeOperation = "source-in", context.fillStyle = "transparent", 
                context.fillRect(0, 0, canvas.width, canvas.height), context.globalCompositeOperation = "source-over", 
                options.hasBounds) {
                    for (i = 0; i < allBodies.length; i++) {
                        var body = allBodies[i];
                        Bounds.overlaps(body.bounds, render.bounds) && bodies.push(body);
                    }
                    for (i = 0; i < allConstraints.length; i++) {
                        var constraint = allConstraints[i], bodyA = constraint.bodyA, bodyB = constraint.bodyB, pointAWorld = constraint.pointA, pointBWorld = constraint.pointB;
                        bodyA && (pointAWorld = Vector.add(bodyA.position, constraint.pointA)), bodyB && (pointBWorld = Vector.add(bodyB.position, constraint.pointB)), 
                        pointAWorld && pointBWorld && ((Bounds.contains(render.bounds, pointAWorld) || Bounds.contains(render.bounds, pointBWorld)) && constraints.push(constraint));
                    }
                    Render.startViewTransform(render), render.mouse && (Mouse.setScale(render.mouse, {
                        x: (render.bounds.max.x - render.bounds.min.x) / render.options.width,
                        y: (render.bounds.max.y - render.bounds.min.y) / render.options.height
                    }), Mouse.setOffset(render.mouse, render.bounds.min));
                } else constraints = allConstraints, bodies = allBodies, 1 !== render.options.pixelRatio && render.context.setTransform(render.options.pixelRatio, 0, 0, render.options.pixelRatio, 0, 0);
                !options.wireframes || engine.enableSleeping && options.showSleeping ? Render.bodies(render, bodies, context) : (options.showConvexHulls && Render.bodyConvexHulls(render, bodies, context), 
                Render.bodyWireframes(render, bodies, context)), options.showBounds && Render.bodyBounds(render, bodies, context), 
                (options.showAxes || options.showAngleIndicator) && Render.bodyAxes(render, bodies, context), 
                options.showPositions && Render.bodyPositions(render, bodies, context), options.showVelocity && Render.bodyVelocity(render, bodies, context), 
                options.showIds && Render.bodyIds(render, bodies, context), options.showSeparations && Render.separations(render, engine.pairs.list, context), 
                options.showCollisions && Render.collisions(render, engine.pairs.list, context), 
                options.showVertexNumbers && Render.vertexNumbers(render, bodies, context), options.showMousePosition && Render.mousePosition(render, render.mouse, context), 
                Render.constraints(constraints, context), options.hasBounds && Render.endViewTransform(render), 
                Events.trigger(render, "afterRender", event), timing.lastElapsed = Common.now() - startTime;
            }, Render.stats = function(render, context, time) {
                for (var engine = render.engine, world = engine.world, bodies = Composite.allBodies(world), parts = 0, x = 0, i = 0; i < bodies.length; i += 1) parts += bodies[i].parts.length;
                var sections = {
                    Part: parts,
                    Body: bodies.length,
                    Cons: Composite.allConstraints(world).length,
                    Comp: Composite.allComposites(world).length,
                    Pair: engine.pairs.list.length
                };
                for (var key in context.fillStyle = "#0e0f19", context.fillRect(x, 0, 302.5, 44), 
                context.font = "12px Arial", context.textBaseline = "top", context.textAlign = "right", 
                sections) {
                    var section = sections[key];
                    context.fillStyle = "#aaa", context.fillText(key, x + 55, 8), context.fillStyle = "#eee", 
                    context.fillText(section, x + 55, 26), x += 55;
                }
            }, Render.performance = function(render, context) {
                var engine = render.engine, timing = render.timing, deltaHistory = timing.deltaHistory, elapsedHistory = timing.elapsedHistory, timestampElapsedHistory = timing.timestampElapsedHistory, engineDeltaHistory = timing.engineDeltaHistory, engineElapsedHistory = timing.engineElapsedHistory, lastEngineDelta = engine.timing.lastDelta, deltaMean = _mean(deltaHistory), elapsedMean = _mean(elapsedHistory), engineDeltaMean = _mean(engineDeltaHistory), engineElapsedMean = _mean(engineElapsedHistory), rateMean = _mean(timestampElapsedHistory) / deltaMean || 0, fps = 1e3 / deltaMean || 0;
                context.fillStyle = "#0e0f19", context.fillRect(0, 50, 370, 34), Render.status(context, 10, 69, 60, 4, deltaHistory.length, Math.round(fps) + " fps", fps / Render._goodFps, function(i) {
                    return deltaHistory[i] / deltaMean - 1;
                }), Render.status(context, 82, 69, 60, 4, engineDeltaHistory.length, lastEngineDelta.toFixed(2) + " dt", Render._goodDelta / lastEngineDelta, function(i) {
                    return engineDeltaHistory[i] / engineDeltaMean - 1;
                }), Render.status(context, 154, 69, 60, 4, engineElapsedHistory.length, engineElapsedMean.toFixed(2) + " ut", 1 - engineElapsedMean / Render._goodFps, function(i) {
                    return engineElapsedHistory[i] / engineElapsedMean - 1;
                }), Render.status(context, 226, 69, 60, 4, elapsedHistory.length, elapsedMean.toFixed(2) + " rt", 1 - elapsedMean / Render._goodFps, function(i) {
                    return elapsedHistory[i] / elapsedMean - 1;
                }), Render.status(context, 298, 69, 60, 4, timestampElapsedHistory.length, rateMean.toFixed(2) + " x", rateMean * rateMean * rateMean, function(i) {
                    return (timestampElapsedHistory[i] / deltaHistory[i] / rateMean || 0) - 1;
                });
            }, Render.status = function(context, x, y, width, height, count, label, indicator, plotY) {
                context.strokeStyle = "#888", context.fillStyle = "#444", context.lineWidth = 1, 
                context.fillRect(x, y + 7, width, 1), context.beginPath(), context.moveTo(x, y + 7 - height * Common.clamp(.4 * plotY(0), -2, 2));
                for (var i = 0; i < width; i += 1) context.lineTo(x + i, y + 7 - (i < count ? height * Common.clamp(.4 * plotY(i), -2, 2) : 0));
                context.stroke(), context.fillStyle = "hsl(" + Common.clamp(25 + 95 * indicator, 0, 120) + ",100%,60%)", 
                context.fillRect(x, y - 7, 4, 4), context.font = "12px Arial", context.textBaseline = "middle", 
                context.textAlign = "right", context.fillStyle = "#eee", context.fillText(label, x + width, y - 5);
            }, Render.constraints = function(constraints, context) {
                for (var c = context, i = 0; i < constraints.length; i++) {
                    var constraint = constraints[i];
                    if (constraint.render.visible && constraint.pointA && constraint.pointB) {
                        var start, end, bodyA = constraint.bodyA, bodyB = constraint.bodyB;
                        if (start = bodyA ? Vector.add(bodyA.position, constraint.pointA) : constraint.pointA, 
                        "pin" === constraint.render.type) c.beginPath(), c.arc(start.x, start.y, 3, 0, 2 * Math.PI), 
                        c.closePath(); else {
                            if (end = bodyB ? Vector.add(bodyB.position, constraint.pointB) : constraint.pointB, 
                            c.beginPath(), c.moveTo(start.x, start.y), "spring" === constraint.render.type) for (var offset, delta = Vector.sub(end, start), normal = Vector.perp(Vector.normalise(delta)), coils = Math.ceil(Common.clamp(constraint.length / 5, 12, 20)), j = 1; j < coils; j += 1) offset = j % 2 == 0 ? 1 : -1, 
                            c.lineTo(start.x + delta.x * (j / coils) + normal.x * offset * 4, start.y + delta.y * (j / coils) + normal.y * offset * 4);
                            c.lineTo(end.x, end.y);
                        }
                        constraint.render.lineWidth && (c.lineWidth = constraint.render.lineWidth, c.strokeStyle = constraint.render.strokeStyle, 
                        c.stroke()), constraint.render.anchors && (c.fillStyle = constraint.render.strokeStyle, 
                        c.beginPath(), c.arc(start.x, start.y, 3, 0, 2 * Math.PI), c.arc(end.x, end.y, 3, 0, 2 * Math.PI), 
                        c.closePath(), c.fill());
                    }
                }
            }, Render.bodies = function(render, bodies, context) {
                var body, part, i, k, c = context, options = (render.engine, render.options), showInternalEdges = options.showInternalEdges || !options.wireframes;
                for (i = 0; i < bodies.length; i++) if ((body = bodies[i]).render.visible) for (k = 1 < body.parts.length ? 1 : 0; k < body.parts.length; k++) if ((part = body.parts[k]).render.visible) {
                    if (options.showSleeping && body.isSleeping ? c.globalAlpha = .5 * part.render.opacity : 1 !== part.render.opacity && (c.globalAlpha = part.render.opacity), 
                    part.render.sprite && part.render.sprite.texture && !options.wireframes) {
                        var sprite = part.render.sprite, texture = _getTexture(render, sprite.texture);
                        c.translate(part.position.x, part.position.y), c.rotate(part.angle), c.drawImage(texture, texture.width * -sprite.xOffset * sprite.xScale, texture.height * -sprite.yOffset * sprite.yScale, texture.width * sprite.xScale, texture.height * sprite.yScale), 
                        c.rotate(-part.angle), c.translate(-part.position.x, -part.position.y);
                    } else {
                        if (part.circleRadius) c.beginPath(), c.arc(part.position.x, part.position.y, part.circleRadius, 0, 2 * Math.PI); else {
                            c.beginPath(), c.moveTo(part.vertices[0].x, part.vertices[0].y);
                            for (var j = 1; j < part.vertices.length; j++) !part.vertices[j - 1].isInternal || showInternalEdges ? c.lineTo(part.vertices[j].x, part.vertices[j].y) : c.moveTo(part.vertices[j].x, part.vertices[j].y), 
                            part.vertices[j].isInternal && !showInternalEdges && c.moveTo(part.vertices[(j + 1) % part.vertices.length].x, part.vertices[(j + 1) % part.vertices.length].y);
                            c.lineTo(part.vertices[0].x, part.vertices[0].y), c.closePath();
                        }
                        options.wireframes ? (c.lineWidth = 1, c.strokeStyle = "#bbb", c.stroke()) : (c.fillStyle = part.render.fillStyle, 
                        part.render.lineWidth && (c.lineWidth = part.render.lineWidth, c.strokeStyle = part.render.strokeStyle, 
                        c.stroke()), c.fill());
                    }
                    c.globalAlpha = 1;
                }
            }, Render.bodyWireframes = function(render, bodies, context) {
                var body, part, i, j, k, c = context, showInternalEdges = render.options.showInternalEdges;
                for (c.beginPath(), i = 0; i < bodies.length; i++) if ((body = bodies[i]).render.visible) for (k = 1 < body.parts.length ? 1 : 0; k < body.parts.length; k++) {
                    for (part = body.parts[k], c.moveTo(part.vertices[0].x, part.vertices[0].y), j = 1; j < part.vertices.length; j++) !part.vertices[j - 1].isInternal || showInternalEdges ? c.lineTo(part.vertices[j].x, part.vertices[j].y) : c.moveTo(part.vertices[j].x, part.vertices[j].y), 
                    part.vertices[j].isInternal && !showInternalEdges && c.moveTo(part.vertices[(j + 1) % part.vertices.length].x, part.vertices[(j + 1) % part.vertices.length].y);
                    c.lineTo(part.vertices[0].x, part.vertices[0].y);
                }
                c.lineWidth = 1, c.strokeStyle = "#bbb", c.stroke();
            }, Render.bodyConvexHulls = function(render, bodies, context) {
                var body, i, j, c = context;
                for (c.beginPath(), i = 0; i < bodies.length; i++) if ((body = bodies[i]).render.visible && 1 !== body.parts.length) {
                    for (c.moveTo(body.vertices[0].x, body.vertices[0].y), j = 1; j < body.vertices.length; j++) c.lineTo(body.vertices[j].x, body.vertices[j].y);
                    c.lineTo(body.vertices[0].x, body.vertices[0].y);
                }
                c.lineWidth = 1, c.strokeStyle = "rgba(255,255,255,0.2)", c.stroke();
            }, Render.vertexNumbers = function(render, bodies, context) {
                var i, j, k, c = context;
                for (i = 0; i < bodies.length; i++) {
                    var parts = bodies[i].parts;
                    for (k = 1 < parts.length ? 1 : 0; k < parts.length; k++) {
                        var part = parts[k];
                        for (j = 0; j < part.vertices.length; j++) c.fillStyle = "rgba(255,255,255,0.2)", 
                        c.fillText(i + "_" + j, part.position.x + .8 * (part.vertices[j].x - part.position.x), part.position.y + .8 * (part.vertices[j].y - part.position.y));
                    }
                }
            }, Render.mousePosition = function(render, mouse, context) {
                var c = context;
                c.fillStyle = "rgba(255,255,255,0.8)", c.fillText(mouse.position.x + "  " + mouse.position.y, mouse.position.x + 5, mouse.position.y - 5);
            }, Render.bodyBounds = function(render, bodies, context) {
                var c = context, options = (render.engine, render.options);
                c.beginPath();
                for (var i = 0; i < bodies.length; i++) {
                    if (bodies[i].render.visible) for (var parts = bodies[i].parts, j = 1 < parts.length ? 1 : 0; j < parts.length; j++) {
                        var part = parts[j];
                        c.rect(part.bounds.min.x, part.bounds.min.y, part.bounds.max.x - part.bounds.min.x, part.bounds.max.y - part.bounds.min.y);
                    }
                }
                options.wireframes ? c.strokeStyle = "rgba(255,255,255,0.08)" : c.strokeStyle = "rgba(0,0,0,0.1)", 
                c.lineWidth = 1, c.stroke();
            }, Render.bodyAxes = function(render, bodies, context) {
                var part, i, j, k, c = context, options = (render.engine, render.options);
                for (c.beginPath(), i = 0; i < bodies.length; i++) {
                    var body = bodies[i], parts = body.parts;
                    if (body.render.visible) if (options.showAxes) for (j = 1 < parts.length ? 1 : 0; j < parts.length; j++) for (part = parts[j], 
                    k = 0; k < part.axes.length; k++) {
                        var axis = part.axes[k];
                        c.moveTo(part.position.x, part.position.y), c.lineTo(part.position.x + 20 * axis.x, part.position.y + 20 * axis.y);
                    } else for (j = 1 < parts.length ? 1 : 0; j < parts.length; j++) for (part = parts[j], 
                    k = 0; k < part.axes.length; k++) c.moveTo(part.position.x, part.position.y), c.lineTo((part.vertices[0].x + part.vertices[part.vertices.length - 1].x) / 2, (part.vertices[0].y + part.vertices[part.vertices.length - 1].y) / 2);
                }
                options.wireframes ? (c.strokeStyle = "indianred", c.lineWidth = 1) : (c.strokeStyle = "rgba(255, 255, 255, 0.4)", 
                c.globalCompositeOperation = "overlay", c.lineWidth = 2), c.stroke(), c.globalCompositeOperation = "source-over";
            }, Render.bodyPositions = function(render, bodies, context) {
                var body, part, i, k, c = context, options = (render.engine, render.options);
                for (c.beginPath(), i = 0; i < bodies.length; i++) if ((body = bodies[i]).render.visible) for (k = 0; k < body.parts.length; k++) part = body.parts[k], 
                c.arc(part.position.x, part.position.y, 3, 0, 2 * Math.PI, !1), c.closePath();
                for (options.wireframes ? c.fillStyle = "indianred" : c.fillStyle = "rgba(0,0,0,0.5)", 
                c.fill(), c.beginPath(), i = 0; i < bodies.length; i++) (body = bodies[i]).render.visible && (c.arc(body.positionPrev.x, body.positionPrev.y, 2, 0, 2 * Math.PI, !1), 
                c.closePath());
                c.fillStyle = "rgba(255,165,0,0.8)", c.fill();
            }, Render.bodyVelocity = function(render, bodies, context) {
                var c = context;
                c.beginPath();
                for (var i = 0; i < bodies.length; i++) {
                    var body = bodies[i];
                    body.render.visible && (c.moveTo(body.position.x, body.position.y), c.lineTo(body.position.x + 2 * (body.position.x - body.positionPrev.x), body.position.y + 2 * (body.position.y - body.positionPrev.y)));
                }
                c.lineWidth = 3, c.strokeStyle = "cornflowerblue", c.stroke();
            }, Render.bodyIds = function(render, bodies, context) {
                var i, j, c = context;
                for (i = 0; i < bodies.length; i++) if (bodies[i].render.visible) {
                    var parts = bodies[i].parts;
                    for (j = 1 < parts.length ? 1 : 0; j < parts.length; j++) {
                        var part = parts[j];
                        c.font = "12px Arial", c.fillStyle = "rgba(255,255,255,0.5)", c.fillText(part.id, part.position.x + 10, part.position.y - 10);
                    }
                }
            }, Render.collisions = function(render, pairs, context) {
                var pair, collision, i, j, c = context, options = render.options;
                for (c.beginPath(), i = 0; i < pairs.length; i++) if ((pair = pairs[i]).isActive) for (collision = pair.collision, 
                j = 0; j < pair.activeContacts.length; j++) {
                    var vertex = pair.activeContacts[j].vertex;
                    c.rect(vertex.x - 1.5, vertex.y - 1.5, 3.5, 3.5);
                }
                for (options.wireframes ? c.fillStyle = "rgba(255,255,255,0.7)" : c.fillStyle = "orange", 
                c.fill(), c.beginPath(), i = 0; i < pairs.length; i++) if ((pair = pairs[i]).isActive && (collision = pair.collision, 
                0 < pair.activeContacts.length)) {
                    var normalPosX = pair.activeContacts[0].vertex.x, normalPosY = pair.activeContacts[0].vertex.y;
                    2 === pair.activeContacts.length && (normalPosX = (pair.activeContacts[0].vertex.x + pair.activeContacts[1].vertex.x) / 2, 
                    normalPosY = (pair.activeContacts[0].vertex.y + pair.activeContacts[1].vertex.y) / 2), 
                    collision.bodyB === collision.supports[0].body || !0 === collision.bodyA.isStatic ? c.moveTo(normalPosX - 8 * collision.normal.x, normalPosY - 8 * collision.normal.y) : c.moveTo(normalPosX + 8 * collision.normal.x, normalPosY + 8 * collision.normal.y), 
                    c.lineTo(normalPosX, normalPosY);
                }
                options.wireframes ? c.strokeStyle = "rgba(255,165,0,0.7)" : c.strokeStyle = "orange", 
                c.lineWidth = 1, c.stroke();
            }, Render.separations = function(render, pairs, context) {
                var pair, collision, bodyA, bodyB, i, c = context, options = render.options;
                for (c.beginPath(), i = 0; i < pairs.length; i++) if ((pair = pairs[i]).isActive) {
                    bodyA = (collision = pair.collision).bodyA;
                    var k = 1;
                    (bodyB = collision.bodyB).isStatic || bodyA.isStatic || (k = .5), bodyB.isStatic && (k = 0), 
                    c.moveTo(bodyB.position.x, bodyB.position.y), c.lineTo(bodyB.position.x - collision.penetration.x * k, bodyB.position.y - collision.penetration.y * k), 
                    k = 1, bodyB.isStatic || bodyA.isStatic || (k = .5), bodyA.isStatic && (k = 0), 
                    c.moveTo(bodyA.position.x, bodyA.position.y), c.lineTo(bodyA.position.x + collision.penetration.x * k, bodyA.position.y + collision.penetration.y * k);
                }
                options.wireframes ? c.strokeStyle = "rgba(255,165,0,0.5)" : c.strokeStyle = "orange", 
                c.stroke();
            }, Render.inspector = function(inspector, context) {
                inspector.engine;
                var bounds, selected = inspector.selected, render = inspector.render, options = render.options;
                if (options.hasBounds) {
                    var boundsWidth = render.bounds.max.x - render.bounds.min.x, boundsHeight = render.bounds.max.y - render.bounds.min.y, boundsScaleX = boundsWidth / render.options.width, boundsScaleY = boundsHeight / render.options.height;
                    context.scale(1 / boundsScaleX, 1 / boundsScaleY), context.translate(-render.bounds.min.x, -render.bounds.min.y);
                }
                for (var i = 0; i < selected.length; i++) {
                    var item = selected[i].data;
                    switch (context.translate(.5, .5), context.lineWidth = 1, context.strokeStyle = "rgba(255,165,0,0.9)", 
                    context.setLineDash([ 1, 2 ]), item.type) {
                      case "body":
                        bounds = item.bounds, context.beginPath(), context.rect(Math.floor(bounds.min.x - 3), Math.floor(bounds.min.y - 3), Math.floor(bounds.max.x - bounds.min.x + 6), Math.floor(bounds.max.y - bounds.min.y + 6)), 
                        context.closePath(), context.stroke();
                        break;

                      case "constraint":
                        var point = item.pointA;
                        item.bodyA && (point = item.pointB), context.beginPath(), context.arc(point.x, point.y, 10, 0, 2 * Math.PI), 
                        context.closePath(), context.stroke();
                    }
                    context.setLineDash([]), context.translate(-.5, -.5);
                }
                null !== inspector.selectStart && (context.translate(.5, .5), context.lineWidth = 1, 
                context.strokeStyle = "rgba(255,165,0,0.6)", context.fillStyle = "rgba(255,165,0,0.1)", 
                bounds = inspector.selectBounds, context.beginPath(), context.rect(Math.floor(bounds.min.x), Math.floor(bounds.min.y), Math.floor(bounds.max.x - bounds.min.x), Math.floor(bounds.max.y - bounds.min.y)), 
                context.closePath(), context.stroke(), context.fill(), context.translate(-.5, -.5)), 
                options.hasBounds && context.setTransform(1, 0, 0, 1, 0, 0);
            };
            var _updateTiming = function(render, time) {
                var engine = render.engine, timing = render.timing, historySize = timing.historySize, timestamp = engine.timing.timestamp;
                timing.delta = time - timing.lastTime || Render._goodDelta, timing.lastTime = time, 
                timing.timestampElapsed = timestamp - timing.lastTimestamp || 0, timing.lastTimestamp = timestamp, 
                timing.deltaHistory.unshift(timing.delta), timing.deltaHistory.length = Math.min(timing.deltaHistory.length, historySize), 
                timing.engineDeltaHistory.unshift(engine.timing.lastDelta), timing.engineDeltaHistory.length = Math.min(timing.engineDeltaHistory.length, historySize), 
                timing.timestampElapsedHistory.unshift(timing.timestampElapsed), timing.timestampElapsedHistory.length = Math.min(timing.timestampElapsedHistory.length, historySize), 
                timing.engineElapsedHistory.unshift(engine.timing.lastElapsed), timing.engineElapsedHistory.length = Math.min(timing.engineElapsedHistory.length, historySize), 
                timing.elapsedHistory.unshift(timing.lastElapsed), timing.elapsedHistory.length = Math.min(timing.elapsedHistory.length, historySize);
            }, _mean = function(values) {
                for (var result = 0, i = 0; i < values.length; i += 1) result += values[i];
                return result / values.length || 0;
            }, _createCanvas = function(width, height) {
                var canvas = document.createElement("canvas");
                return canvas.width = width, canvas.height = height, canvas.oncontextmenu = function() {
                    return !1;
                }, canvas.onselectstart = function() {
                    return !1;
                }, canvas;
            }, _getPixelRatio = function(canvas) {
                var context = canvas.getContext("2d");
                return (window.devicePixelRatio || 1) / (context.webkitBackingStorePixelRatio || context.mozBackingStorePixelRatio || context.msBackingStorePixelRatio || context.oBackingStorePixelRatio || context.backingStorePixelRatio || 1);
            }, _getTexture = function(render, imagePath) {
                var image = render.textures[imagePath];
                return image || ((image = render.textures[imagePath] = new Image()).src = imagePath, 
                image);
            }, _applyBackground = function(render, background) {
                var cssBackground = background;
                /(jpg|gif|png)$/.test(background) && (cssBackground = "url(" + background + ")"), 
                render.canvas.style.background = cssBackground, render.canvas.style.backgroundSize = "contain", 
                render.currentBackground = background;
            };
        }();
    }, function(module, exports) {
        var Contact = {};
        (gmodule.exports = Contact).create = function(vertex) {
            return {
                vertex: vertex,
                normalImpulse: 0,
                tangentImpulse: 0
            };
        };
    }, function(module, exports, __webpack_require__) {
        var Engine = {};
        gmodule.exports = Engine;
        var Sleeping = __webpack_require__(7), Resolver = __webpack_require__(19), Detector = __webpack_require__(14), Pairs = __webpack_require__(20), Events = __webpack_require__(4), Composite = __webpack_require__(5), Constraint = __webpack_require__(10), Common = __webpack_require__(0), Body = __webpack_require__(6);
        Engine.create = function(options) {
            options = options || {};
            var engine = Common.extend({
                positionIterations: 6,
                velocityIterations: 4,
                constraintIterations: 2,
                enableSleeping: !1,
                events: [],
                plugin: {},
                gravity: {
                    x: 0,
                    y: 1,
                    scale: .001
                },
                timing: {
                    timestamp: 0,
                    timeScale: 1,
                    lastDelta: 0,
                    lastElapsed: 0
                }
            }, options);
            return engine.world = options.world || Composite.create({
                label: "World"
            }), engine.pairs = options.pairs || Pairs.create(), engine.detector = options.detector || Detector.create(), 
            engine.grid = {
                buckets: []
            }, engine.world.gravity = engine.gravity, engine.broadphase = engine.grid, engine.metrics = {}, 
            engine;
        }, Engine.update = function(engine, delta, correction) {
            var startTime = Common.now();
            delta = delta || 1e3 / 60, correction = correction || 1;
            var i, world = engine.world, detector = engine.detector, pairs = engine.pairs, timing = engine.timing, timestamp = timing.timestamp;
            timing.timestamp += delta * timing.timeScale, timing.lastDelta = delta * timing.timeScale;
            var event = {
                timestamp: timing.timestamp
            };
            Events.trigger(engine, "beforeUpdate", event);
            var allBodies = Composite.allBodies(world), allConstraints = Composite.allConstraints(world);
            for (world.isModified && Detector.setBodies(detector, allBodies), world.isModified && Composite.setModified(world, !1, !1, !0), 
            engine.enableSleeping && Sleeping.update(allBodies, timing.timeScale), Engine._bodiesApplyGravity(allBodies, engine.gravity), 
            Engine._bodiesUpdate(allBodies, delta, timing.timeScale, correction, world.bounds), 
            Constraint.preSolveAll(allBodies), i = 0; i < engine.constraintIterations; i++) Constraint.solveAll(allConstraints, timing.timeScale);
            Constraint.postSolveAll(allBodies), detector.pairs = engine.pairs;
            var collisions = Detector.collisions(detector);
            for (Pairs.update(pairs, collisions, timestamp), engine.enableSleeping && Sleeping.afterCollisions(pairs.list, timing.timeScale), 
            0 < pairs.collisionStart.length && Events.trigger(engine, "collisionStart", {
                pairs: pairs.collisionStart
            }), Resolver.preSolvePosition(pairs.list), i = 0; i < engine.positionIterations; i++) Resolver.solvePosition(pairs.list, timing.timeScale);
            for (Resolver.postSolvePosition(allBodies), Constraint.preSolveAll(allBodies), i = 0; i < engine.constraintIterations; i++) Constraint.solveAll(allConstraints, timing.timeScale);
            for (Constraint.postSolveAll(allBodies), Resolver.preSolveVelocity(pairs.list), 
            i = 0; i < engine.velocityIterations; i++) Resolver.solveVelocity(pairs.list, timing.timeScale);
            return 0 < pairs.collisionActive.length && Events.trigger(engine, "collisionActive", {
                pairs: pairs.collisionActive
            }), 0 < pairs.collisionEnd.length && Events.trigger(engine, "collisionEnd", {
                pairs: pairs.collisionEnd
            }), Engine._bodiesClearForces(allBodies), Events.trigger(engine, "afterUpdate", event), 
            engine.timing.lastElapsed = Common.now() - startTime, engine;
        }, Engine.merge = function(engineA, engineB) {
            if (Common.extend(engineA, engineB), engineB.world) {
                engineA.world = engineB.world, Engine.clear(engineA);
                for (var bodies = Composite.allBodies(engineA.world), i = 0; i < bodies.length; i++) {
                    var body = bodies[i];
                    Sleeping.set(body, !1), body.id = Common.nextId();
                }
            }
        }, Engine.clear = function(engine) {
            Pairs.clear(engine.pairs), Detector.clear(engine.detector);
        }, Engine._bodiesClearForces = function(bodies) {
            for (var i = 0; i < bodies.length; i++) {
                var body = bodies[i];
                body.force.x = 0, body.force.y = 0, body.torque = 0;
            }
        }, Engine._bodiesApplyGravity = function(bodies, gravity) {
            var gravityScale = void 0 !== gravity.scale ? gravity.scale : .001;
            if ((0 !== gravity.x || 0 !== gravity.y) && 0 !== gravityScale) for (var i = 0; i < bodies.length; i++) {
                var body = bodies[i];
                body.isStatic || body.isSleeping || body.isNullGravity || (body.force.y += body.mass * gravity.y * gravityScale, 
                body.force.x += body.mass * gravity.x * gravityScale);
            }
        }, Engine._bodiesUpdate = function(bodies, deltaTime, timeScale, correction, worldBounds) {
            for (var i = 0; i < bodies.length; i++) {
                var body = bodies[i];
                body.isStatic || body.isSleeping || Body.update(body, deltaTime, timeScale, correction);
            }
        };
    }, function(module, exports, __webpack_require__) {
        var Resolver = {};
        gmodule.exports = Resolver;
        var Vertices = __webpack_require__(3), Bounds = __webpack_require__(1);
        Resolver._restingThresh = 4, Resolver._restingThreshTangent = 6, Resolver._positionDampen = .9, 
        Resolver._positionWarming = .8, Resolver._frictionNormalMultiplier = 5, Resolver.preSolvePosition = function(pairs) {
            var i, pair, activeCount, pairsLength = pairs.length;
            for (i = 0; i < pairsLength; i++) (pair = pairs[i]).isActive && (activeCount = pair.activeContacts.length, 
            pair.collision.parentA.totalContacts += activeCount, pair.collision.parentB.totalContacts += activeCount);
        }, Resolver.solvePosition = function(pairs, timeScale) {
            var i, pair, collision, bodyA, bodyB, normal, contactShare, positionImpulse, positionDampen = Resolver._positionDampen, pairsLength = pairs.length;
            for (i = 0; i < pairsLength; i++) (pair = pairs[i]).isActive && !pair.isSensor && (bodyA = (collision = pair.collision).parentA, 
            bodyB = collision.parentB, normal = collision.normal, pair.separation = normal.x * (bodyB.positionImpulse.x + collision.penetration.x - bodyA.positionImpulse.x) + normal.y * (bodyB.positionImpulse.y + collision.penetration.y - bodyA.positionImpulse.y));
            for (i = 0; i < pairsLength; i++) (pair = pairs[i]).isActive && !pair.isSensor && (bodyA = (collision = pair.collision).parentA, 
            bodyB = collision.parentB, normal = collision.normal, positionImpulse = (pair.separation - pair.slop) * timeScale, 
            (bodyA.isStatic || bodyB.isStatic) && (positionImpulse *= 2), bodyA.isStatic || bodyA.isSleeping || (contactShare = positionDampen / bodyA.totalContacts, 
            bodyA.positionImpulse.x += normal.x * positionImpulse * contactShare, bodyA.positionImpulse.y += normal.y * positionImpulse * contactShare), 
            bodyB.isStatic || bodyB.isSleeping || (contactShare = positionDampen / bodyB.totalContacts, 
            bodyB.positionImpulse.x -= normal.x * positionImpulse * contactShare, bodyB.positionImpulse.y -= normal.y * positionImpulse * contactShare));
        }, Resolver.postSolvePosition = function(bodies) {
            for (var positionWarming = Resolver._positionWarming, bodiesLength = bodies.length, verticesTranslate = Vertices.translate, boundsUpdate = Bounds.update, i = 0; i < bodiesLength; i++) {
                var body = bodies[i], positionImpulse = body.positionImpulse, positionImpulseX = positionImpulse.x, positionImpulseY = positionImpulse.y, velocity = body.velocity;
                if ((body.totalContacts = 0) !== positionImpulseX || 0 !== positionImpulseY) {
                    for (var j = 0; j < body.parts.length; j++) {
                        var part = body.parts[j];
                        verticesTranslate(part.vertices, positionImpulse), boundsUpdate(part.bounds, part.vertices, velocity), 
                        part.position.x += positionImpulseX, part.position.y += positionImpulseY;
                    }
                    body.positionPrev.x += positionImpulseX, body.positionPrev.y += positionImpulseY, 
                    positionImpulseX * velocity.x + positionImpulseY * velocity.y < 0 ? (positionImpulse.x = 0, 
                    positionImpulse.y = 0) : (positionImpulse.x *= positionWarming, positionImpulse.y *= positionWarming);
                }
            }
        }, Resolver.preSolveVelocity = function(pairs) {
            var i, j, pairsLength = pairs.length;
            for (i = 0; i < pairsLength; i++) {
                var pair = pairs[i];
                if (pair.isActive && !pair.isSensor) {
                    var contacts = pair.activeContacts, contactsLength = contacts.length, collision = pair.collision, bodyA = collision.parentA, bodyB = collision.parentB, normal = collision.normal, tangent = collision.tangent;
                    for (j = 0; j < contactsLength; j++) {
                        var contact = contacts[j], contactVertex = contact.vertex, normalImpulse = contact.normalImpulse, tangentImpulse = contact.tangentImpulse;
                        if (0 !== normalImpulse || 0 !== tangentImpulse) {
                            var impulseX = normal.x * normalImpulse + tangent.x * tangentImpulse, impulseY = normal.y * normalImpulse + tangent.y * tangentImpulse;
                            bodyA.isStatic || bodyA.isSleeping || (bodyA.positionPrev.x += impulseX * bodyA.inverseMass, 
                            bodyA.positionPrev.y += impulseY * bodyA.inverseMass, bodyA.anglePrev += bodyA.inverseInertia * ((contactVertex.x - bodyA.position.x) * impulseY - (contactVertex.y - bodyA.position.y) * impulseX)), 
                            bodyB.isStatic || bodyB.isSleeping || (bodyB.positionPrev.x -= impulseX * bodyB.inverseMass, 
                            bodyB.positionPrev.y -= impulseY * bodyB.inverseMass, bodyB.anglePrev -= bodyB.inverseInertia * ((contactVertex.x - bodyB.position.x) * impulseY - (contactVertex.y - bodyB.position.y) * impulseX));
                        }
                    }
                }
            }
        }, Resolver.solveVelocity = function(pairs, timeScale) {
            var tangentImpulse, maxFriction, i, j, timeScaleSquared = timeScale * timeScale, restingThresh = Resolver._restingThresh * timeScaleSquared, frictionNormalMultiplier = Resolver._frictionNormalMultiplier, restingThreshTangent = Resolver._restingThreshTangent * timeScaleSquared, NumberMaxValue = Number.MAX_VALUE, pairsLength = pairs.length;
            for (i = 0; i < pairsLength; i++) {
                var pair = pairs[i];
                if (pair.isActive && !pair.isSensor) {
                    var collision = pair.collision, bodyA = collision.parentA, bodyB = collision.parentB, bodyAVelocity = bodyA.velocity, bodyBVelocity = bodyB.velocity, normalX = collision.normal.x, normalY = collision.normal.y, tangentX = collision.tangent.x, tangentY = collision.tangent.y, contacts = pair.activeContacts, contactsLength = contacts.length, contactShare = 1 / contactsLength, inverseMassTotal = bodyA.inverseMass + bodyB.inverseMass, friction = pair.friction * pair.frictionStatic * frictionNormalMultiplier * timeScaleSquared;
                    for (bodyAVelocity.x = bodyA.position.x - bodyA.positionPrev.x, bodyAVelocity.y = bodyA.position.y - bodyA.positionPrev.y, 
                    bodyBVelocity.x = bodyB.position.x - bodyB.positionPrev.x, bodyBVelocity.y = bodyB.position.y - bodyB.positionPrev.y, 
                    bodyA.angularVelocity = bodyA.angle - bodyA.anglePrev, bodyB.angularVelocity = bodyB.angle - bodyB.anglePrev, 
                    j = 0; j < contactsLength; j++) {
                        var contact = contacts[j], contactVertex = contact.vertex, offsetAX = contactVertex.x - bodyA.position.x, offsetAY = contactVertex.y - bodyA.position.y, offsetBX = contactVertex.x - bodyB.position.x, offsetBY = contactVertex.y - bodyB.position.y, velocityPointAX = bodyAVelocity.x - offsetAY * bodyA.angularVelocity, velocityPointAY = bodyAVelocity.y + offsetAX * bodyA.angularVelocity, relativeVelocityX = velocityPointAX - (bodyBVelocity.x - offsetBY * bodyB.angularVelocity), relativeVelocityY = velocityPointAY - (bodyBVelocity.y + offsetBX * bodyB.angularVelocity), normalVelocity = normalX * relativeVelocityX + normalY * relativeVelocityY, tangentVelocity = tangentX * relativeVelocityX + tangentY * relativeVelocityY, normalOverlap = pair.separation + normalVelocity, normalForce = Math.min(normalOverlap, 1), frictionLimit = (normalForce = normalOverlap < 0 ? 0 : normalForce) * friction;
                        frictionLimit < tangentVelocity || frictionLimit < -tangentVelocity ? (maxFriction = 0 < tangentVelocity ? tangentVelocity : -tangentVelocity, 
                        (tangentImpulse = pair.friction * (0 < tangentVelocity ? 1 : -1) * timeScaleSquared) < -maxFriction ? tangentImpulse = -maxFriction : maxFriction < tangentImpulse && (tangentImpulse = maxFriction)) : (tangentImpulse = tangentVelocity, 
                        maxFriction = NumberMaxValue);
                        var oAcN = offsetAX * normalY - offsetAY * normalX, oBcN = offsetBX * normalY - offsetBY * normalX, share = contactShare / (inverseMassTotal + bodyA.inverseInertia * oAcN * oAcN + bodyB.inverseInertia * oBcN * oBcN), normalImpulse = (1 + pair.restitution) * normalVelocity * share;
                        if (tangentImpulse *= share, restingThresh < normalVelocity * normalVelocity && normalVelocity < 0) contact.normalImpulse = 0; else {
                            var contactNormalImpulse = contact.normalImpulse;
                            contact.normalImpulse += normalImpulse, contact.normalImpulse = Math.min(contact.normalImpulse, 0), 
                            normalImpulse = contact.normalImpulse - contactNormalImpulse;
                        }
                        if (restingThreshTangent < tangentVelocity * tangentVelocity) contact.tangentImpulse = 0; else {
                            var contactTangentImpulse = contact.tangentImpulse;
                            contact.tangentImpulse += tangentImpulse, contact.tangentImpulse < -maxFriction && (contact.tangentImpulse = -maxFriction), 
                            contact.tangentImpulse > maxFriction && (contact.tangentImpulse = maxFriction), 
                            tangentImpulse = contact.tangentImpulse - contactTangentImpulse;
                        }
                        var impulseX = normalX * normalImpulse + tangentX * tangentImpulse, impulseY = normalY * normalImpulse + tangentY * tangentImpulse;
                        bodyA.isStatic || bodyA.isSleeping || (bodyA.positionPrev.x += impulseX * bodyA.inverseMass, 
                        bodyA.positionPrev.y += impulseY * bodyA.inverseMass, bodyA.anglePrev += (offsetAX * impulseY - offsetAY * impulseX) * bodyA.inverseInertia), 
                        bodyB.isStatic || bodyB.isSleeping || (bodyB.positionPrev.x -= impulseX * bodyB.inverseMass, 
                        bodyB.positionPrev.y -= impulseY * bodyB.inverseMass, bodyB.anglePrev -= (offsetBX * impulseY - offsetBY * impulseX) * bodyB.inverseInertia);
                    }
                }
            }
        };
    }, function(module, exports, __webpack_require__) {
        var Pairs = {};
        gmodule.exports = Pairs;
        var Pair = __webpack_require__(9), Common = __webpack_require__(0);
        Pairs.create = function(options) {
            return Common.extend({
                table: {},
                list: [],
                collisionStart: [],
                collisionActive: [],
                collisionEnd: []
            }, options);
        }, Pairs.update = function(pairs, collisions, timestamp) {
            var collision, pairIndex, pair, i, pairsList = pairs.list, pairsListLength = pairsList.length, pairsTable = pairs.table, collisionsLength = collisions.length, collisionStart = pairs.collisionStart, collisionEnd = pairs.collisionEnd, collisionActive = pairs.collisionActive;
            for (collisionStart.length = 0, collisionEnd.length = 0, i = collisionActive.length = 0; i < pairsListLength; i++) pairsList[i].confirmedActive = !1;
            for (i = 0; i < collisionsLength; i++) (pair = (collision = collisions[i]).pair) ? (pair.isActive ? collisionActive.push(pair) : collisionStart.push(pair), 
            Pair.update(pair, collision, timestamp), pair.confirmedActive = !0) : (pairsTable[(pair = Pair.create(collision, timestamp)).id] = pair, 
            collisionStart.push(pair), pairsList.push(pair));
            var removePairIndex = [];
            for (pairsListLength = pairsList.length, i = 0; i < pairsListLength; i++) (pair = pairsList[i]).confirmedActive || (Pair.setActive(pair, !1, timestamp), 
            collisionEnd.push(pair), pair.collision.bodyA.isSleeping || pair.collision.bodyB.isSleeping || removePairIndex.push(i));
            for (i = 0; i < removePairIndex.length; i++) pair = pairsList[pairIndex = removePairIndex[i] - i], 
            pairsList.splice(pairIndex, 1), delete pairsTable[pair.id];
        }, Pairs.clear = function(pairs) {
            return pairs.table = {}, pairs.list.length = 0, pairs.collisionStart.length = 0, 
            pairs.collisionActive.length = 0, pairs.collisionEnd.length = 0, pairs;
        };
    }, function(module, exports, __webpack_require__) {
        var Matter = gmodule.exports = __webpack_require__(22);
        Matter.Axes = __webpack_require__(11), Matter.Bodies = __webpack_require__(12), 
        Matter.Body = __webpack_require__(6), Matter.Bounds = __webpack_require__(1), Matter.Collision = __webpack_require__(8), 
        Matter.Common = __webpack_require__(0), Matter.Composite = __webpack_require__(5), 
        Matter.Composites = __webpack_require__(23), Matter.Constraint = __webpack_require__(10), 
        Matter.Contact = __webpack_require__(17), Matter.Detector = __webpack_require__(14), 
        Matter.Engine = __webpack_require__(18), Matter.Events = __webpack_require__(4), 
        Matter.Grid = __webpack_require__(24), Matter.Mouse = __webpack_require__(13), Matter.MouseConstraint = __webpack_require__(25), 
        Matter.Pair = __webpack_require__(9), Matter.Pairs = __webpack_require__(20), Matter.Plugin = __webpack_require__(15), 
        Matter.Query = __webpack_require__(26), Matter.Render = __webpack_require__(16), 
        Matter.Resolver = __webpack_require__(19), Matter.Runner = __webpack_require__(27), 
        Matter.SAT = __webpack_require__(28), Matter.Sleeping = __webpack_require__(7), 
        Matter.Svg = __webpack_require__(29), Matter.Vector = __webpack_require__(2), Matter.Vertices = __webpack_require__(3), 
        Matter.World = __webpack_require__(30), Matter.Engine.run = Matter.Runner.run, Matter.Common.deprecated(Matter.Engine, "run", "Engine.run ➤ use Matter.Runner.run(engine) instead");
    }, function(module, exports, __webpack_require__) {
        var Matter = {};
        gmodule.exports = Matter;
        var Plugin = __webpack_require__(15), Common = __webpack_require__(0);
        Matter.name = "matter-js", Matter.version = "0.18.0", Matter.uses = [], Matter.used = [], 
        Matter.use = function() {
            Plugin.use(Matter, Array.prototype.slice.call(arguments));
        }, Matter.before = function(path, func) {
            return path = path.replace(/^Matter./, ""), Common.chainPathBefore(Matter, path, func);
        }, Matter.after = function(path, func) {
            return path = path.replace(/^Matter./, ""), Common.chainPathAfter(Matter, path, func);
        };
    }, function(module, exports, __webpack_require__) {
        var Composites = {};
        gmodule.exports = Composites;
        var Composite = __webpack_require__(5), Constraint = __webpack_require__(10), Common = __webpack_require__(0), Body = __webpack_require__(6), Bodies = __webpack_require__(12), deprecated = Common.deprecated;
        Composites.stack = function(xx, yy, columns, rows, columnGap, rowGap, callback) {
            for (var lastBody, stack = Composite.create({
                label: "Stack"
            }), x = xx, y = yy, i = 0, row = 0; row < rows; row++) {
                for (var maxHeight = 0, column = 0; column < columns; column++) {
                    var body = callback(x, y, column, row, lastBody, i);
                    if (body) {
                        var bodyHeight = body.bounds.max.y - body.bounds.min.y, bodyWidth = body.bounds.max.x - body.bounds.min.x;
                        maxHeight < bodyHeight && (maxHeight = bodyHeight), Body.translate(body, {
                            x: .5 * bodyWidth,
                            y: .5 * bodyHeight
                        }), x = body.bounds.max.x + columnGap, Composite.addBody(stack, body), lastBody = body, 
                        i += 1;
                    } else x += columnGap;
                }
                y += maxHeight + rowGap, x = xx;
            }
            return stack;
        }, Composites.chain = function(composite, xOffsetA, yOffsetA, xOffsetB, yOffsetB, options) {
            for (var bodies = composite.bodies, i = 1; i < bodies.length; i++) {
                var bodyA = bodies[i - 1], bodyB = bodies[i], bodyAHeight = bodyA.bounds.max.y - bodyA.bounds.min.y, bodyAWidth = bodyA.bounds.max.x - bodyA.bounds.min.x, bodyBHeight = bodyB.bounds.max.y - bodyB.bounds.min.y, defaults = {
                    bodyA: bodyA,
                    pointA: {
                        x: bodyAWidth * xOffsetA,
                        y: bodyAHeight * yOffsetA
                    },
                    bodyB: bodyB,
                    pointB: {
                        x: (bodyB.bounds.max.x - bodyB.bounds.min.x) * xOffsetB,
                        y: bodyBHeight * yOffsetB
                    }
                }, constraint = Common.extend(defaults, options);
                Composite.addConstraint(composite, Constraint.create(constraint));
            }
            return composite.label += " Chain", composite;
        }, Composites.mesh = function(composite, columns, rows, crossBrace, options) {
            var row, col, bodyA, bodyB, bodyC, bodies = composite.bodies;
            for (row = 0; row < rows; row++) {
                for (col = 1; col < columns; col++) bodyA = bodies[col - 1 + row * columns], bodyB = bodies[col + row * columns], 
                Composite.addConstraint(composite, Constraint.create(Common.extend({
                    bodyA: bodyA,
                    bodyB: bodyB
                }, options)));
                if (0 < row) for (col = 0; col < columns; col++) bodyA = bodies[col + (row - 1) * columns], 
                bodyB = bodies[col + row * columns], Composite.addConstraint(composite, Constraint.create(Common.extend({
                    bodyA: bodyA,
                    bodyB: bodyB
                }, options))), crossBrace && 0 < col && (bodyC = bodies[col - 1 + (row - 1) * columns], 
                Composite.addConstraint(composite, Constraint.create(Common.extend({
                    bodyA: bodyC,
                    bodyB: bodyB
                }, options)))), crossBrace && col < columns - 1 && (bodyC = bodies[col + 1 + (row - 1) * columns], 
                Composite.addConstraint(composite, Constraint.create(Common.extend({
                    bodyA: bodyC,
                    bodyB: bodyB
                }, options))));
            }
            return composite.label += " Mesh", composite;
        }, Composites.pyramid = function(xx, yy, columns, rows, columnGap, rowGap, callback) {
            return Composites.stack(xx, yy, columns, rows, columnGap, rowGap, function(x, y, column, row, lastBody, i) {
                var actualRows = Math.min(rows, Math.ceil(columns / 2)), lastBodyWidth = lastBody ? lastBody.bounds.max.x - lastBody.bounds.min.x : 0;
                if (!(actualRows < row || column < (row = actualRows - row) || columns - 1 - row < column)) return 1 === i && Body.translate(lastBody, {
                    x: (column + (columns % 2 == 1 ? 1 : -1)) * lastBodyWidth,
                    y: 0
                }), callback(xx + (lastBody ? column * lastBodyWidth : 0) + column * columnGap, y, column, row, lastBody, i);
            });
        }, Composites.newtonsCradle = function(xx, yy, number, size, length) {
            for (var newtonsCradle = Composite.create({
                label: "Newtons Cradle"
            }), i = 0; i < number; i++) {
                var circle = Bodies.circle(xx + i * (1.9 * size), yy + length, size, {
                    inertia: 1 / 0,
                    restitution: 1,
                    friction: 0,
                    frictionAir: 1e-4,
                    slop: 1
                }), constraint = Constraint.create({
                    pointA: {
                        x: xx + i * (1.9 * size),
                        y: yy
                    },
                    bodyB: circle
                });
                Composite.addBody(newtonsCradle, circle), Composite.addConstraint(newtonsCradle, constraint);
            }
            return newtonsCradle;
        }, deprecated(Composites, "newtonsCradle", "Composites.newtonsCradle ➤ moved to newtonsCradle example"), 
        Composites.car = function(xx, yy, width, height, wheelSize) {
            var group = Body.nextGroup(!0), wheelAOffset = .5 * -width + 20, wheelBOffset = .5 * width - 20, car = Composite.create({
                label: "Car"
            }), body = Bodies.rectangle(xx, yy, width, height, {
                collisionFilter: {
                    group: group
                },
                chamfer: {
                    radius: .5 * height
                },
                density: 2e-4
            }), wheelA = Bodies.circle(xx + wheelAOffset, yy + 0, wheelSize, {
                collisionFilter: {
                    group: group
                },
                friction: .8
            }), wheelB = Bodies.circle(xx + wheelBOffset, yy + 0, wheelSize, {
                collisionFilter: {
                    group: group
                },
                friction: .8
            }), axelA = Constraint.create({
                bodyB: body,
                pointB: {
                    x: wheelAOffset,
                    y: 0
                },
                bodyA: wheelA,
                stiffness: 1,
                length: 0
            }), axelB = Constraint.create({
                bodyB: body,
                pointB: {
                    x: wheelBOffset,
                    y: 0
                },
                bodyA: wheelB,
                stiffness: 1,
                length: 0
            });
            return Composite.addBody(car, body), Composite.addBody(car, wheelA), Composite.addBody(car, wheelB), 
            Composite.addConstraint(car, axelA), Composite.addConstraint(car, axelB), car;
        }, deprecated(Composites, "car", "Composites.car ➤ moved to car example"), Composites.softBody = function(xx, yy, columns, rows, columnGap, rowGap, crossBrace, particleRadius, particleOptions, constraintOptions) {
            particleOptions = Common.extend({
                inertia: 1 / 0
            }, particleOptions), constraintOptions = Common.extend({
                stiffness: .2,
                render: {
                    type: "line",
                    anchors: !1
                }
            }, constraintOptions);
            var softBody = Composites.stack(xx, yy, columns, rows, columnGap, rowGap, function(x, y) {
                return Bodies.circle(x, y, particleRadius, particleOptions);
            });
            return Composites.mesh(softBody, columns, rows, crossBrace, constraintOptions), 
            softBody.label = "Soft Body", softBody;
        }, deprecated(Composites, "softBody", "Composites.softBody ➤ moved to softBody and cloth examples");
    }, function(module, exports, __webpack_require__) {
        var Grid = {};
        gmodule.exports = Grid;
        var Pair = __webpack_require__(9), Common = __webpack_require__(0), deprecated = Common.deprecated;
        Grid.create = function(options) {
            return Common.extend({
                buckets: {},
                pairs: {},
                pairsList: [],
                bucketWidth: 48,
                bucketHeight: 48
            }, options);
        }, Grid.update = function(grid, bodies, engine, forceUpdate) {
            var i, col, row, bucket, bucketId, world = engine.world, buckets = grid.buckets, gridChanged = !1;
            for (i = 0; i < bodies.length; i++) {
                var body = bodies[i];
                if ((!body.isSleeping || forceUpdate) && (!world.bounds || !(body.bounds.max.x < world.bounds.min.x || body.bounds.min.x > world.bounds.max.x || body.bounds.max.y < world.bounds.min.y || body.bounds.min.y > world.bounds.max.y))) {
                    var newRegion = Grid._getRegion(grid, body);
                    if (!body.region || newRegion.id !== body.region.id || forceUpdate) {
                        body.region && !forceUpdate || (body.region = newRegion);
                        var union = Grid._regionUnion(newRegion, body.region);
                        for (col = union.startCol; col <= union.endCol; col++) for (row = union.startRow; row <= union.endRow; row++) {
                            bucket = buckets[bucketId = Grid._getBucketId(col, row)];
                            var isInsideNewRegion = col >= newRegion.startCol && col <= newRegion.endCol && row >= newRegion.startRow && row <= newRegion.endRow, isInsideOldRegion = col >= body.region.startCol && col <= body.region.endCol && row >= body.region.startRow && row <= body.region.endRow;
                            !isInsideNewRegion && isInsideOldRegion && isInsideOldRegion && bucket && Grid._bucketRemoveBody(grid, bucket, body), 
                            (body.region === newRegion || isInsideNewRegion && !isInsideOldRegion || forceUpdate) && (bucket || (bucket = Grid._createBucket(buckets, bucketId)), 
                            Grid._bucketAddBody(grid, bucket, body));
                        }
                        body.region = newRegion, gridChanged = !0;
                    }
                }
            }
            gridChanged && (grid.pairsList = Grid._createActivePairsList(grid));
        }, deprecated(Grid, "update", "Grid.update ➤ replaced by Matter.Detector"), Grid.clear = function(grid) {
            grid.buckets = {}, grid.pairs = {}, grid.pairsList = [];
        }, deprecated(Grid, "clear", "Grid.clear ➤ replaced by Matter.Detector"), Grid._regionUnion = function(regionA, regionB) {
            var startCol = Math.min(regionA.startCol, regionB.startCol), endCol = Math.max(regionA.endCol, regionB.endCol), startRow = Math.min(regionA.startRow, regionB.startRow), endRow = Math.max(regionA.endRow, regionB.endRow);
            return Grid._createRegion(startCol, endCol, startRow, endRow);
        }, Grid._getRegion = function(grid, body) {
            var bounds = body.bounds, startCol = Math.floor(bounds.min.x / grid.bucketWidth), endCol = Math.floor(bounds.max.x / grid.bucketWidth), startRow = Math.floor(bounds.min.y / grid.bucketHeight), endRow = Math.floor(bounds.max.y / grid.bucketHeight);
            return Grid._createRegion(startCol, endCol, startRow, endRow);
        }, Grid._createRegion = function(startCol, endCol, startRow, endRow) {
            return {
                id: startCol + "," + endCol + "," + startRow + "," + endRow,
                startCol: startCol,
                endCol: endCol,
                startRow: startRow,
                endRow: endRow
            };
        }, Grid._getBucketId = function(column, row) {
            return "C" + column + "R" + row;
        }, Grid._createBucket = function(buckets, bucketId) {
            return buckets[bucketId] = [];
        }, Grid._bucketAddBody = function(grid, bucket, body) {
            var i, gridPairs = grid.pairs, pairId = Pair.id, bucketLength = bucket.length;
            for (i = 0; i < bucketLength; i++) {
                var bodyB = bucket[i];
                if (!(body.id === bodyB.id || body.isStatic && bodyB.isStatic)) {
                    var id = pairId(body, bodyB), pair = gridPairs[id];
                    pair ? pair[2] += 1 : gridPairs[id] = [ body, bodyB, 1 ];
                }
            }
            bucket.push(body);
        }, Grid._bucketRemoveBody = function(grid, bucket, body) {
            var i, gridPairs = grid.pairs, pairId = Pair.id;
            bucket.splice(Common.indexOf(bucket, body), 1);
            var bucketLength = bucket.length;
            for (i = 0; i < bucketLength; i++) {
                var pair = gridPairs[pairId(body, bucket[i])];
                pair && (pair[2] -= 1);
            }
        }, Grid._createActivePairsList = function(grid) {
            var pair, k, gridPairs = grid.pairs, pairKeys = Common.keys(gridPairs), pairKeysLength = pairKeys.length, pairs = [];
            for (k = 0; k < pairKeysLength; k++) 0 < (pair = gridPairs[pairKeys[k]])[2] ? pairs.push(pair) : delete gridPairs[pairKeys[k]];
            return pairs;
        };
    }, function(module, exports, __webpack_require__) {
        var MouseConstraint = {};
        gmodule.exports = MouseConstraint;
        var Vertices = __webpack_require__(3), Sleeping = __webpack_require__(7), Mouse = __webpack_require__(13), Events = __webpack_require__(4), Detector = __webpack_require__(14), Constraint = __webpack_require__(10), Composite = __webpack_require__(5), Common = __webpack_require__(0), Bounds = __webpack_require__(1);
        MouseConstraint.create = function(engine, options) {
            var mouse = (engine ? engine.mouse : null) || (options ? options.mouse : null);
            mouse || (engine && engine.render && engine.render.canvas ? mouse = Mouse.create(engine.render.canvas) : options && options.element ? mouse = Mouse.create(options.element) : (mouse = Mouse.create(), 
            Common.warn("MouseConstraint.create: options.mouse was undefined, options.element was undefined, may not function as expected")));
            var defaults = {
                type: "mouseConstraint",
                mouse: mouse,
                element: null,
                body: null,
                constraint: Constraint.create({
                    label: "Mouse Constraint",
                    pointA: mouse.position,
                    pointB: {
                        x: 0,
                        y: 0
                    },
                    length: .01,
                    stiffness: .1,
                    angularStiffness: 1,
                    render: {
                        strokeStyle: "#90EE90",
                        lineWidth: 3
                    }
                }),
                collisionFilter: {
                    category: 1,
                    mask: 4294967295,
                    group: 0
                }
            }, mouseConstraint = Common.extend(defaults, options);
            return Events.on(engine, "beforeUpdate", function() {
                var allBodies = Composite.allBodies(engine.world);
                MouseConstraint.update(mouseConstraint, allBodies), MouseConstraint._triggerEvents(mouseConstraint);
            }), mouseConstraint;
        }, MouseConstraint.update = function(mouseConstraint, bodies) {
            var mouse = mouseConstraint.mouse, constraint = mouseConstraint.constraint, body = mouseConstraint.body;
            if (0 === mouse.button) {
                if (constraint.bodyB) Sleeping.set(constraint.bodyB, !1), constraint.pointA = mouse.position; else for (var i = 0; i < bodies.length; i++) if (body = bodies[i], 
                Bounds.contains(body.bounds, mouse.position) && Detector.canCollide(body.collisionFilter, mouseConstraint.collisionFilter)) for (var j = 1 < body.parts.length ? 1 : 0; j < body.parts.length; j++) {
                    var part = body.parts[j];
                    if (Vertices.contains(part.vertices, mouse.position)) {
                        constraint.pointA = mouse.position, constraint.bodyB = mouseConstraint.body = body, 
                        constraint.pointB = {
                            x: mouse.position.x - body.position.x,
                            y: mouse.position.y - body.position.y
                        }, constraint.angleB = body.angle, Sleeping.set(body, !1), Events.trigger(mouseConstraint, "startdrag", {
                            mouse: mouse,
                            body: body
                        });
                        break;
                    }
                }
            } else constraint.bodyB = mouseConstraint.body = null, constraint.pointB = null, 
            body && Events.trigger(mouseConstraint, "enddrag", {
                mouse: mouse,
                body: body
            });
        }, MouseConstraint._triggerEvents = function(mouseConstraint) {
            var mouse = mouseConstraint.mouse, mouseEvents = mouse.sourceEvents;
            mouseEvents.mousemove && Events.trigger(mouseConstraint, "mousemove", {
                mouse: mouse
            }), mouseEvents.mousedown && Events.trigger(mouseConstraint, "mousedown", {
                mouse: mouse
            }), mouseEvents.mouseup && Events.trigger(mouseConstraint, "mouseup", {
                mouse: mouse
            }), Mouse.clearSourceEvents(mouse);
        };
    }, function(module, exports, __webpack_require__) {
        var Query = {};
        gmodule.exports = Query;
        var Vector = __webpack_require__(2), Collision = __webpack_require__(8), Bounds = __webpack_require__(1), Bodies = __webpack_require__(12), Vertices = __webpack_require__(3);
        Query.collides = function(body, bodies) {
            for (var collisions = [], bodiesLength = bodies.length, bounds = body.bounds, collides = Collision.collides, overlaps = Bounds.overlaps, i = 0; i < bodiesLength; i++) {
                var bodyA = bodies[i], partsALength = bodyA.parts.length, partsAStart = 1 === partsALength ? 0 : 1;
                if (overlaps(bodyA.bounds, bounds)) for (var j = partsAStart; j < partsALength; j++) {
                    var part = bodyA.parts[j];
                    if (overlaps(part.bounds, bounds)) {
                        var collision = collides(part, body);
                        if (collision) {
                            collisions.push(collision);
                            break;
                        }
                    }
                }
            }
            return collisions;
        }, Query.ray = function(bodies, startPoint, endPoint, rayWidth) {
            rayWidth = rayWidth || 1e-100;
            for (var rayAngle = Vector.angle(startPoint, endPoint), rayLength = Vector.magnitude(Vector.sub(startPoint, endPoint)), rayX = .5 * (endPoint.x + startPoint.x), rayY = .5 * (endPoint.y + startPoint.y), ray = Bodies.rectangle(rayX, rayY, rayLength, rayWidth, {
                angle: rayAngle
            }), collisions = Query.collides(ray, bodies), i = 0; i < collisions.length; i += 1) {
                var collision = collisions[i];
                collision.body = collision.bodyB = collision.bodyA;
            }
            return collisions;
        }, Query.region = function(bodies, bounds, outside) {
            for (var result = [], i = 0; i < bodies.length; i++) {
                var body = bodies[i], overlaps = Bounds.overlaps(body.bounds, bounds);
                (overlaps && !outside || !overlaps && outside) && result.push(body);
            }
            return result;
        }, Query.point = function(bodies, point) {
            for (var result = [], i = 0; i < bodies.length; i++) {
                var body = bodies[i];
                if (Bounds.contains(body.bounds, point)) for (var j = 1 === body.parts.length ? 0 : 1; j < body.parts.length; j++) {
                    var part = body.parts[j];
                    if (Bounds.contains(part.bounds, point) && Vertices.contains(part.vertices, point)) {
                        result.push(body);
                        break;
                    }
                }
            }
            return result;
        };
    }, function(module, exports, __webpack_require__) {
        var Runner = {};
        gmodule.exports = Runner;
        var Events = __webpack_require__(4), Engine = __webpack_require__(18), Common = __webpack_require__(0);
        !function() {
            var _requestAnimationFrame, _cancelAnimationFrame, _frameTimeout;
            ("undefined" != typeof window && (_requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame, 
            _cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame), 
            _requestAnimationFrame) || (_requestAnimationFrame = function(callback) {
                _frameTimeout = setTimeout(function() {
                    callback(Common.now());
                }, 1e3 / 60);
            }, _cancelAnimationFrame = function() {
                clearTimeout(_frameTimeout);
            });
            Runner.create = function(options) {
                var runner = Common.extend({
                    fps: 60,
                    correction: 1,
                    deltaSampleSize: 60,
                    counterTimestamp: 0,
                    frameCounter: 0,
                    deltaHistory: [],
                    timePrev: null,
                    timeScalePrev: 1,
                    frameRequestId: null,
                    isFixed: !1,
                    enabled: !0
                }, options);
                return runner.delta = runner.delta || 1e3 / runner.fps, runner.deltaMin = runner.deltaMin || 1e3 / runner.fps, 
                runner.deltaMax = runner.deltaMax || 1e3 / (.5 * runner.fps), runner.fps = 1e3 / runner.delta, 
                runner;
            }, Runner.run = function(runner, engine) {
                return void 0 !== runner.positionIterations && (engine = runner, runner = Runner.create()), 
                function render(time) {
                    runner.frameRequestId = _requestAnimationFrame(render), time && runner.enabled && Runner.tick(runner, engine, time);
                }(), runner;
            }, Runner.tick = function(runner, engine, time) {
                var delta, timing = engine.timing, correction = 1, event = {
                    timestamp: timing.timestamp
                };
                Events.trigger(runner, "beforeTick", event), runner.isFixed ? delta = runner.delta : (delta = time - runner.timePrev || runner.delta, 
                runner.timePrev = time, runner.deltaHistory.push(delta), runner.deltaHistory = runner.deltaHistory.slice(-runner.deltaSampleSize), 
                correction = (delta = (delta = (delta = Math.min.apply(null, runner.deltaHistory)) < runner.deltaMin ? runner.deltaMin : delta) > runner.deltaMax ? runner.deltaMax : delta) / runner.delta, 
                runner.delta = delta), 0 !== runner.timeScalePrev && (correction *= timing.timeScale / runner.timeScalePrev), 
                0 === timing.timeScale && (correction = 0), runner.timeScalePrev = timing.timeScale, 
                runner.correction = correction, runner.frameCounter += 1, 1e3 <= time - runner.counterTimestamp && (runner.fps = runner.frameCounter * ((time - runner.counterTimestamp) / 1e3), 
                runner.counterTimestamp = time, runner.frameCounter = 0), Events.trigger(runner, "tick", event), 
                Events.trigger(runner, "beforeUpdate", event), Engine.update(engine, delta, correction), 
                Events.trigger(runner, "afterUpdate", event), Events.trigger(runner, "afterTick", event);
            }, Runner.stop = function(runner) {
                _cancelAnimationFrame(runner.frameRequestId);
            }, Runner.start = function(runner, engine) {
                Runner.run(runner, engine);
            };
        }();
    }, function(module, exports, __webpack_require__) {
        var SAT = {};
        gmodule.exports = SAT;
        var Collision = __webpack_require__(8), deprecated = __webpack_require__(0).deprecated;
        SAT.collides = function(bodyA, bodyB) {
            return Collision.collides(bodyA, bodyB);
        }, deprecated(SAT, "collides", "SAT.collides ➤ replaced by Collision.collides");
    }, function(module, exports, __webpack_require__) {
        var Svg = {};
        gmodule.exports = Svg;
        __webpack_require__(1);
        var Common = __webpack_require__(0);
        Svg.pathToVertices = function(path, sampleLength) {
            "undefined" == typeof window || "SVGPathSeg" in window || Common.warn("Svg.pathToVertices: SVGPathSeg not defined, a polyfill is required.");
            var i, il, total, point, segment, segments, segmentsQueue, lastSegment, lastPoint, lx, ly, points = [], length = 0, x = 0, y = 0;
            function addPoint(px, py, pathSegType) {
                var isRelative = pathSegType % 2 == 1 && 1 < pathSegType;
                if (!lastPoint || px != lastPoint.x || py != lastPoint.y) {
                    ly = lastPoint && isRelative ? (lx = lastPoint.x, lastPoint.y) : lx = 0;
                    var point = {
                        x: lx + px,
                        y: ly + py
                    };
                    !isRelative && lastPoint || (lastPoint = point), points.push(point), x = lx + px, 
                    y = ly + py;
                }
            }
            function addSegmentPoint(segment) {
                var segType = segment.pathSegTypeAsLetter.toUpperCase();
                if ("Z" !== segType) {
                    switch (segType) {
                      case "M":
                      case "L":
                      case "T":
                      case "C":
                      case "S":
                      case "Q":
                        x = segment.x, y = segment.y;
                        break;

                      case "H":
                        x = segment.x;
                        break;

                      case "V":
                        y = segment.y;
                    }
                    addPoint(x, y, segment.pathSegType);
                }
            }
            for (sampleLength = sampleLength || 15, Svg._svgPathToAbsolute(path), total = path.getTotalLength(), 
            segments = [], i = 0; i < path.pathSegList.numberOfItems; i += 1) segments.push(path.pathSegList.getItem(i));
            for (segmentsQueue = segments.concat(); length < total; ) {
                if ((segment = segments[path.getPathSegAtLength(length)]) != lastSegment) {
                    for (;segmentsQueue.length && segmentsQueue[0] != segment; ) addSegmentPoint(segmentsQueue.shift());
                    lastSegment = segment;
                }
                switch (segment.pathSegTypeAsLetter.toUpperCase()) {
                  case "C":
                  case "T":
                  case "S":
                  case "Q":
                  case "A":
                    point = path.getPointAtLength(length), addPoint(point.x, point.y, 0);
                }
                length += sampleLength;
            }
            for (i = 0, il = segmentsQueue.length; i < il; ++i) addSegmentPoint(segmentsQueue[i]);
            return points;
        }, Svg._svgPathToAbsolute = function(path) {
            for (var x0, y0, x1, y1, x2, y2, segs = path.pathSegList, x = 0, y = 0, len = segs.numberOfItems, i = 0; i < len; ++i) {
                var seg = segs.getItem(i), segType = seg.pathSegTypeAsLetter;
                if (/[MLHVCSQTA]/.test(segType)) "x" in seg && (x = seg.x), "y" in seg && (y = seg.y); else switch ("x1" in seg && (x1 = x + seg.x1), 
                "x2" in seg && (x2 = x + seg.x2), "y1" in seg && (y1 = y + seg.y1), "y2" in seg && (y2 = y + seg.y2), 
                "x" in seg && (x += seg.x), "y" in seg && (y += seg.y), segType) {
                  case "m":
                    segs.replaceItem(path.createSVGPathSegMovetoAbs(x, y), i);
                    break;

                  case "l":
                    segs.replaceItem(path.createSVGPathSegLinetoAbs(x, y), i);
                    break;

                  case "h":
                    segs.replaceItem(path.createSVGPathSegLinetoHorizontalAbs(x), i);
                    break;

                  case "v":
                    segs.replaceItem(path.createSVGPathSegLinetoVerticalAbs(y), i);
                    break;

                  case "c":
                    segs.replaceItem(path.createSVGPathSegCurvetoCubicAbs(x, y, x1, y1, x2, y2), i);
                    break;

                  case "s":
                    segs.replaceItem(path.createSVGPathSegCurvetoCubicSmoothAbs(x, y, x2, y2), i);
                    break;

                  case "q":
                    segs.replaceItem(path.createSVGPathSegCurvetoQuadraticAbs(x, y, x1, y1), i);
                    break;

                  case "t":
                    segs.replaceItem(path.createSVGPathSegCurvetoQuadraticSmoothAbs(x, y), i);
                    break;

                  case "a":
                    segs.replaceItem(path.createSVGPathSegArcAbs(x, y, seg.r1, seg.r2, seg.angle, seg.largeArcFlag, seg.sweepFlag), i);
                    break;

                  case "z":
                  case "Z":
                    x = x0, y = y0;
                }
                "M" != segType && "m" != segType || (x0 = x, y0 = y);
            }
        };
    }, function(module, exports, __webpack_require__) {
        var World = {};
        gmodule.exports = World;
        var Composite = __webpack_require__(5);
        __webpack_require__(0);
        World.create = Composite.create, World.add = Composite.add, World.remove = Composite.remove, 
        World.clear = Composite.clear, World.addComposite = Composite.addComposite, World.addBody = Composite.addBody, 
        World.addConstraint = Composite.addConstraint;
    } ]);
}), window.decomp = function e(t, n, r) {
    function s(o, u) {
        if (!n[o]) {
            if (!t[o]) {
                var a = "function" == typeof arequire && arequire;
                if (!u && a) return a(o, !0);
                if (i) return i(o, !0);
                throw new Error("Cannot find module '" + o + "'");
            }
            var f = n[o] = {
                exports: {}
            };
            t[o][0].call(f.exports, function(e) {
                var n = t[o][1][e];
                return s(n || e);
            }, f, f.exports, e, t, n, r);
        }
        return n[o].exports;
    }
    for (var i = "function" == typeof arequire && arequire, o = 0; o < r.length; o++) s(r[o]);
    return s;
}({
    1: [ function(_dereq_, module, exports) {
        function lineInt(l1, l2, precision) {
            precision = precision || 0;
            var a1, b1, c1, a2, b2, c2, det, i = [ 0, 0 ];
            return a1 = l1[1][1] - l1[0][1], b1 = l1[0][0] - l1[1][0], c1 = a1 * l1[0][0] + b1 * l1[0][1], 
            a2 = l2[1][1] - l2[0][1], b2 = l2[0][0] - l2[1][0], c2 = a2 * l2[0][0] + b2 * l2[0][1], 
            scalar_eq(det = a1 * b2 - a2 * b1, 0, precision) || (i[0] = (b2 * c1 - b1 * c2) / det, 
            i[1] = (a1 * c2 - a2 * c1) / det), i;
        }
        function lineSegmentsIntersect(p1, p2, q1, q2) {
            var dx = p2[0] - p1[0], dy = p2[1] - p1[1], da = q2[0] - q1[0], db = q2[1] - q1[1];
            if (da * dy - db * dx == 0) return !1;
            var s = (dx * (q1[1] - p1[1]) + dy * (p1[0] - q1[0])) / (da * dy - db * dx), t = (da * (p1[1] - q1[1]) + db * (q1[0] - p1[0])) / (db * dx - da * dy);
            return 0 <= s && s <= 1 && 0 <= t && t <= 1;
        }
        function triangleArea(a, b, c) {
            return (b[0] - a[0]) * (c[1] - a[1]) - (c[0] - a[0]) * (b[1] - a[1]);
        }
        function isLeft(a, b, c) {
            return 0 < triangleArea(a, b, c);
        }
        function isLeftOn(a, b, c) {
            return 0 <= triangleArea(a, b, c);
        }
        function isRight(a, b, c) {
            return triangleArea(a, b, c) < 0;
        }
        function isRightOn(a, b, c) {
            return triangleArea(a, b, c) <= 0;
        }
        gmodule.exports = {
            decomp: function(polygon) {
                var edges = function polygonGetCutEdges(polygon) {
                    for (var min = [], tmp1 = [], tmp2 = [], tmpPoly = [], nDiags = Number.MAX_VALUE, i = 0; i < polygon.length; ++i) if (polygonIsReflex(polygon, i)) for (var j = 0; j < polygon.length; ++j) if (polygonCanSee(polygon, i, j)) {
                        tmp1 = polygonGetCutEdges(polygonCopy(polygon, i, j, tmpPoly)), tmp2 = polygonGetCutEdges(polygonCopy(polygon, j, i, tmpPoly));
                        for (var k = 0; k < tmp2.length; k++) tmp1.push(tmp2[k]);
                        tmp1.length < nDiags && (nDiags = (min = tmp1).length, min.push([ polygonAt(polygon, i), polygonAt(polygon, j) ]));
                    }
                    return min;
                }(polygon);
                return 0 < edges.length ? function polygonSlice(polygon, cutEdges) {
                    if (0 === cutEdges.length) return [ polygon ];
                    if (cutEdges instanceof Array && cutEdges.length && cutEdges[0] instanceof Array && 2 === cutEdges[0].length && cutEdges[0][0] instanceof Array) {
                        for (var polys = [ polygon ], i = 0; i < cutEdges.length; i++) for (var cutEdge = cutEdges[i], j = 0; j < polys.length; j++) {
                            var poly = polys[j], result = polygonSlice(poly, cutEdge);
                            if (result) {
                                polys.splice(j, 1), polys.push(result[0], result[1]);
                                break;
                            }
                        }
                        return polys;
                    }
                    var cutEdge = cutEdges, i = polygon.indexOf(cutEdge[0]), j = polygon.indexOf(cutEdge[1]);
                    return -1 !== i && -1 !== j && [ polygonCopy(polygon, i, j), polygonCopy(polygon, j, i) ];
                }(polygon, edges) : [ polygon ];
            },
            quickDecomp: function polygonQuickDecomp(polygon, result, reflexVertices, steinerPoints, delta, maxlevel, level) {
                maxlevel = maxlevel || 100, level = level || 0, delta = delta || 25, result = void 0 !== result ? result : [], 
                reflexVertices = reflexVertices || [], steinerPoints = steinerPoints || [];
                var upperInt = [ 0, 0 ], lowerInt = [ 0, 0 ], p = [ 0, 0 ], upperDist = 0, lowerDist = 0, d = 0, closestDist = 0, upperIndex = 0, lowerIndex = 0, closestIndex = 0, lowerPoly = [], upperPoly = [], poly = polygon, v = polygon;
                if (v.length < 3) return result;
                if (maxlevel < ++level) return console.warn("quickDecomp: max level (" + maxlevel + ") reached."), 
                result;
                for (var i = 0; i < polygon.length; ++i) if (polygonIsReflex(poly, i)) {
                    reflexVertices.push(poly[i]), upperDist = lowerDist = Number.MAX_VALUE;
                    for (var j = 0; j < polygon.length; ++j) isLeft(polygonAt(poly, i - 1), polygonAt(poly, i), polygonAt(poly, j)) && isRightOn(polygonAt(poly, i - 1), polygonAt(poly, i), polygonAt(poly, j - 1)) && (p = getIntersectionPoint(polygonAt(poly, i - 1), polygonAt(poly, i), polygonAt(poly, j), polygonAt(poly, j - 1)), 
                    isRight(polygonAt(poly, i + 1), polygonAt(poly, i), p) && (d = sqdist(poly[i], p)) < lowerDist && (lowerDist = d, 
                    lowerInt = p, lowerIndex = j)), isLeft(polygonAt(poly, i + 1), polygonAt(poly, i), polygonAt(poly, j + 1)) && isRightOn(polygonAt(poly, i + 1), polygonAt(poly, i), polygonAt(poly, j)) && (p = getIntersectionPoint(polygonAt(poly, i + 1), polygonAt(poly, i), polygonAt(poly, j), polygonAt(poly, j + 1)), 
                    isLeft(polygonAt(poly, i - 1), polygonAt(poly, i), p) && (d = sqdist(poly[i], p)) < upperDist && (upperDist = d, 
                    upperInt = p, upperIndex = j));
                    if (lowerIndex === (upperIndex + 1) % polygon.length) p[0] = (lowerInt[0] + upperInt[0]) / 2, 
                    p[1] = (lowerInt[1] + upperInt[1]) / 2, steinerPoints.push(p), i < upperIndex ? (polygonAppend(lowerPoly, poly, i, upperIndex + 1), 
                    lowerPoly.push(p), upperPoly.push(p), 0 !== lowerIndex && polygonAppend(upperPoly, poly, lowerIndex, poly.length), 
                    polygonAppend(upperPoly, poly, 0, i + 1)) : (0 !== i && polygonAppend(lowerPoly, poly, i, poly.length), 
                    polygonAppend(lowerPoly, poly, 0, upperIndex + 1), lowerPoly.push(p), upperPoly.push(p), 
                    polygonAppend(upperPoly, poly, lowerIndex, i + 1)); else {
                        if (upperIndex < lowerIndex && (upperIndex += polygon.length), closestDist = Number.MAX_VALUE, 
                        upperIndex < lowerIndex) return result;
                        for (var j = lowerIndex; j <= upperIndex; ++j) isLeftOn(polygonAt(poly, i - 1), polygonAt(poly, i), polygonAt(poly, j)) && isRightOn(polygonAt(poly, i + 1), polygonAt(poly, i), polygonAt(poly, j)) && (d = sqdist(polygonAt(poly, i), polygonAt(poly, j))) < closestDist && polygonCanSee2(poly, i, j) && (closestDist = d, 
                        closestIndex = j % polygon.length);
                        i < closestIndex ? (polygonAppend(lowerPoly, poly, i, closestIndex + 1), 0 !== closestIndex && polygonAppend(upperPoly, poly, closestIndex, v.length), 
                        polygonAppend(upperPoly, poly, 0, i + 1)) : (0 !== i && polygonAppend(lowerPoly, poly, i, v.length), 
                        polygonAppend(lowerPoly, poly, 0, closestIndex + 1), polygonAppend(upperPoly, poly, closestIndex, i + 1));
                    }
                    return lowerPoly.length < upperPoly.length ? (polygonQuickDecomp(lowerPoly, result, reflexVertices, steinerPoints, delta, maxlevel, level), 
                    polygonQuickDecomp(upperPoly, result, reflexVertices, steinerPoints, delta, maxlevel, level)) : (polygonQuickDecomp(upperPoly, result, reflexVertices, steinerPoints, delta, maxlevel, level), 
                    polygonQuickDecomp(lowerPoly, result, reflexVertices, steinerPoints, delta, maxlevel, level)), 
                    result;
                }
                return result.push(polygon), result;
            },
            isSimple: function(polygon) {
                var i, path = polygon;
                for (i = 0; i < path.length - 1; i++) for (var j = 0; j < i - 1; j++) if (lineSegmentsIntersect(path[i], path[i + 1], path[j], path[j + 1])) return !1;
                for (i = 1; i < path.length - 2; i++) if (lineSegmentsIntersect(path[0], path[path.length - 1], path[i], path[i + 1])) return !1;
                return !0;
            },
            removeCollinearPoints: function(polygon, precision) {
                for (var num = 0, i = polygon.length - 1; 3 < polygon.length && 0 <= i; --i) collinear(polygonAt(polygon, i - 1), polygonAt(polygon, i), polygonAt(polygon, i + 1), precision) && (polygon.splice(i % polygon.length, 1), 
                num++);
                return num;
            },
            removeDuplicatePoints: function(polygon, precision) {
                for (var i = polygon.length - 1; 1 <= i; --i) for (var pi = polygon[i], j = i - 1; 0 <= j; --j) points_eq(pi, polygon[j], precision) && polygon.splice(i, 1);
            },
            makeCCW: function(polygon) {
                for (var br = 0, v = polygon, i = 1; i < polygon.length; ++i) (v[i][1] < v[br][1] || v[i][1] === v[br][1] && v[i][0] > v[br][0]) && (br = i);
                return !isLeft(polygonAt(polygon, br - 1), polygonAt(polygon, br), polygonAt(polygon, br + 1)) && (function(polygon) {
                    for (var tmp = [], N = polygon.length, i = 0; i !== N; i++) tmp.push(polygon.pop());
                    for (var i = 0; i !== N; i++) polygon[i] = tmp[i];
                }(polygon), !0);
            }
        };
        var tmpPoint1 = [], tmpPoint2 = [];
        function collinear(a, b, c, thresholdAngle) {
            if (thresholdAngle) {
                var ab = tmpPoint1, bc = tmpPoint2;
                ab[0] = b[0] - a[0], ab[1] = b[1] - a[1], bc[0] = c[0] - b[0], bc[1] = c[1] - b[1];
                var dot = ab[0] * bc[0] + ab[1] * bc[1], magA = Math.sqrt(ab[0] * ab[0] + ab[1] * ab[1]), magB = Math.sqrt(bc[0] * bc[0] + bc[1] * bc[1]), angle = Math.acos(dot / (magA * magB));
                return angle < thresholdAngle;
            }
            return 0 === triangleArea(a, b, c);
        }
        function sqdist(a, b) {
            var dx = b[0] - a[0], dy = b[1] - a[1];
            return dx * dx + dy * dy;
        }
        function polygonAt(polygon, i) {
            var s = polygon.length;
            return polygon[i < 0 ? i % s + s : i % s];
        }
        function polygonAppend(polygon, poly, from, to) {
            for (var i = from; i < to; i++) polygon.push(poly[i]);
        }
        function polygonIsReflex(polygon, i) {
            return isRight(polygonAt(polygon, i - 1), polygonAt(polygon, i), polygonAt(polygon, i + 1));
        }
        var tmpLine1 = [], tmpLine2 = [];
        function polygonCanSee(polygon, a, b) {
            var p, dist, l1 = tmpLine1, l2 = tmpLine2;
            if (isLeftOn(polygonAt(polygon, a + 1), polygonAt(polygon, a), polygonAt(polygon, b)) && isRightOn(polygonAt(polygon, a - 1), polygonAt(polygon, a), polygonAt(polygon, b))) return !1;
            dist = sqdist(polygonAt(polygon, a), polygonAt(polygon, b));
            for (var i = 0; i !== polygon.length; ++i) if ((i + 1) % polygon.length !== a && i !== a && isLeftOn(polygonAt(polygon, a), polygonAt(polygon, b), polygonAt(polygon, i + 1)) && isRightOn(polygonAt(polygon, a), polygonAt(polygon, b), polygonAt(polygon, i)) && (l1[0] = polygonAt(polygon, a), 
            l1[1] = polygonAt(polygon, b), l2[0] = polygonAt(polygon, i), l2[1] = polygonAt(polygon, i + 1), 
            p = lineInt(l1, l2), sqdist(polygonAt(polygon, a), p) < dist)) return !1;
            return !0;
        }
        function polygonCanSee2(polygon, a, b) {
            for (var i = 0; i !== polygon.length; ++i) if (i !== a && i !== b && (i + 1) % polygon.length !== a && (i + 1) % polygon.length !== b && lineSegmentsIntersect(polygonAt(polygon, a), polygonAt(polygon, b), polygonAt(polygon, i), polygonAt(polygon, i + 1))) return !1;
            return !0;
        }
        function polygonCopy(polygon, i, j, targetPoly) {
            var p = targetPoly || [];
            if (function(polygon) {
                polygon.length = 0;
            }(p), i < j) for (var k = i; k <= j; k++) p.push(polygon[k]); else {
                for (var k = 0; k <= j; k++) p.push(polygon[k]);
                for (var k = i; k < polygon.length; k++) p.push(polygon[k]);
            }
            return p;
        }
        function getIntersectionPoint(p1, p2, q1, q2, delta) {
            delta = delta || 0;
            var a1 = p2[1] - p1[1], b1 = p1[0] - p2[0], c1 = a1 * p1[0] + b1 * p1[1], a2 = q2[1] - q1[1], b2 = q1[0] - q2[0], c2 = a2 * q1[0] + b2 * q1[1], det = a1 * b2 - a2 * b1;
            return scalar_eq(det, 0, delta) ? [ 0, 0 ] : [ (b2 * c1 - b1 * c2) / det, (a1 * c2 - a2 * c1) / det ];
        }
        function scalar_eq(a, b, precision) {
            return precision = precision || 0, Math.abs(a - b) <= precision;
        }
        function points_eq(a, b, precision) {
            return scalar_eq(a[0], b[0], precision) && scalar_eq(a[1], b[1], precision);
        }
    }, {} ]
}, {}, [ 1 ])(1), window.RenderLaya = function() {
    Matter || console.log("请引入Matter.js");
    var RenderLaya = {}, Composite = Matter.Composite, Common = Matter.Common, Bounds = Matter.Bounds, Events = Matter.Events, Vector = (Matter.Grid, 
    Matter.Vector);
    RenderLaya.create = function(options) {
        var defaults = {
            controller: RenderLaya,
            engine: null,
            element: null,
            canvas: null,
            container: null,
            spriteContainer: null,
            options: {
                width: 800,
                height: 600,
                background: "#fff",
                wireframeBackground: "#222",
                hasBounds: !1,
                enabled: !0,
                wireframes: !0,
                showBounds: !1,
                showVelocity: !1,
                showAxes: !1,
                showPositions: !1,
                showAngleIndicator: !1,
                showIds: !1,
                hideWireFrames: !1
            }
        }, render = Common.extend(defaults, options);
        if (render.mouse = options.mouse, render.engine = options.engine, render.container = render.container || Laya.stage, 
        !Laya.Box) throw new Error("must import Laya");
        return render.spriteContainer = render.spriteContainer || new Laya.Box(), render.bounds = render.bounds || {
            min: {
                x: 0,
                y: 0
            },
            max: {
                x: render.option && render.option.width,
                y: render.option && render.option.height
            }
        }, render.sprites = {}, render.primitives = {}, render.container.addChild(render.spriteContainer), 
        render.canvas && (render.canvas.oncontextmenu = function() {
            return !1;
        }, render.canvas.onselectstart = function() {
            return !1;
        }), render;
    }, RenderLaya.run = function(render) {
        Laya.timer.frameLoop(1, this, RenderLaya.world, [ render ], !0), Events.on(render.engine.world, "afterRemove", RenderLaya.onRemoveSprite);
    }, RenderLaya.stop = function(render) {
        Laya.timer.clear(this, RenderLaya.world), Events.off(render.engine.world, "afterRemove", RenderLaya.onRemoveSprite);
    }, RenderLaya.onRemoveSprite = function(args) {
        if (args.object && args.object.bodies && Array.isArray(args.object.bodies)) for (var i = 0, len = args.object.bodies.length; i < len; i++) RenderLaya.onRemoveSprite({
            object: args.object.bodies[i]
        });
        var sprite = args.object && args.object.render && args.object.render.layaSprite;
        sprite && sprite.parent && sprite.parent.removeChild(sprite);
    }, RenderLaya.setBackground = function(render, background) {
        if (render.currentBackground !== background) {
            var isColor = background.indexOf && -1 !== background.indexOf("#"), isTransparent = (render.sprites["bg-0"], 
            !render.options.wireframes && "transparent" === render.options.background);
            isColor ? render.container === Laya.stage ? render.container.bgColor = background : render.container && render.container.graphics && (render.container.graphics.clear(), 
            render.container.graphics.drawRect(0, 0, Laya.stage.width, Laya.stage.height, background)) : isTransparent ? render.container === Laya.stage && (render.container.bgColor = null) : (render.container.loadImage(background), 
            render.container.bgColor = "#FFFFFF"), render.currentBackground = background;
        }
    }, RenderLaya.world = function(render) {
        var i, engine = render.engine, world = engine.world, container = render.container, options = render.options, bodies = Composite.allBodies(world), allConstraints = Composite.allConstraints(world), constraints = [];
        options.wireframes ? RenderLaya.setBackground(render, options.wireframeBackground) : RenderLaya.setBackground(render, options.background);
        var boundsWidth = render.bounds.max.x - render.bounds.min.x, boundsHeight = render.bounds.max.y - render.bounds.min.y, boundsScaleX = boundsWidth / render.options.width, boundsScaleY = boundsHeight / render.options.height;
        if (options.hasBounds) {
            for (i = 0; i < bodies.length; i++) {
                var body = bodies[i];
                body.render.sprite.visible = Bounds.overlaps(body.bounds, render.bounds);
            }
            for (i = 0; i < allConstraints.length; i++) {
                var constraint = allConstraints[i], bodyA = constraint.bodyA, bodyB = constraint.bodyB, pointAWorld = constraint.pointA, pointBWorld = constraint.pointB;
                bodyA && (pointAWorld = Vector.add(bodyA.position, constraint.pointA)), bodyB && (pointBWorld = Vector.add(bodyB.position, constraint.pointB)), 
                pointAWorld && pointBWorld && (Bounds.contains(render.bounds, pointAWorld) || Bounds.contains(render.bounds, pointBWorld)) && constraints.push(constraint);
            }
            container.scale(1 / boundsScaleX, 1 / boundsScaleY), container.pos(-render.bounds.min.x * (1 / boundsScaleX), -render.bounds.min.y * (1 / boundsScaleY));
        } else constraints = allConstraints;
        for (i = 0; i < bodies.length; i++) RenderLaya.body(render, bodies[i]);
        for (i = 0; i < constraints.length; i++) RenderLaya.constraint(render, constraints[i]);
    }, RenderLaya.constraint = function(render, constraint) {
        render.engine;
        var fromX, fromY, toX, toY, options = render.options, bodyA = constraint.bodyA, bodyB = constraint.bodyB, pointA = constraint.pointA, pointB = constraint.pointB, container = render.container, constraintRender = constraint.render, primitiveId = "c-" + constraint.id, primitive = render.primitives && render.primitives[primitiveId];
        primitive || (primitive = render.primitives[primitiveId] = new Laya.Sprite()), constraintRender.visible && constraint.pointA && constraint.pointB ? (container.contains(primitive) || container.addChild(primitive), 
        primitive.graphics.clear(), fromY = bodyA ? (fromX = bodyA.position.x + pointA.x, 
        bodyA.position.y + pointA.y) : (fromX = pointA.x, pointA.y), toY = bodyB ? (toX = bodyB.position.x + pointB.x, 
        bodyB.position.y + pointB.y) : (toX = pointB.x, pointB.y), options.hideWireFrames || primitive.graphics.drawLine(fromX, fromY, toX, toY, constraintRender.strokeStyle, constraintRender.lineWidth)) : primitive.graphics.clear();
    }, RenderLaya.body = function(render, body) {
        render.engine;
        var options = render.options, bodyRender = body.render;
        if (bodyRender.visible) if (bodyRender.sprite && bodyRender.sprite.texture && !options.wireframes) {
            var spriteId = "b-" + body.id, sprite = render.sprites && render.sprites[spriteId], spriteContainer = render.spriteContainer;
            sprite ? body.render.sprite.change && _updateBodySprite(sprite, body) : (sprite = render.sprites[spriteId] = _createBodySprite(render, body), 
            bodyRender.layaSprite = sprite), spriteContainer.contains(sprite) || spriteContainer.addChild(sprite), 
            sprite.x = body.position.x, sprite.y = body.position.y, sprite.rotation = 180 * body.angle / Math.PI, 
            sprite.scaleX = bodyRender.sprite.xScale || 1, sprite.scaleY = bodyRender.sprite.yScale || 1;
        } else {
            var primitiveId = "b-" + body.id, primitive = render.primitives[primitiveId], container = render.container;
            primitive || ((primitive = render.primitives[primitiveId] = _createBodyPrimitive(render, body)).initialAngle = body.angle), 
            container.contains(primitive) || container.addChild(primitive), RenderLaya.bodyWireframes(render, body, primitive);
        }
    }, RenderLaya.bodyWireframes = function(render, body, primitive) {
        var fillStyle, strokeStyle, lineWidth, part, bodyPosition, bodyRender = body.render, options = render.options, points = [];
        primitive.graphics.clear();
        for (var k = 1 < body.parts.length ? 1 : 0; k < body.parts.length; k++) {
            bodyPosition = body.position, part = body.parts[k], options.showBounds && !options.hideWireFrames && (lineWidth = 1, 
            strokeStyle = "#3b3b3b", primitive.graphics.drawRect(part.bounds.min.x, part.bounds.min.y, part.bounds.max.x - part.bounds.min.x, part.bounds.max.y - part.bounds.min.y, null, strokeStyle, lineWidth)), 
            lineWidth = options.wireframes ? (fillStyle = null, strokeStyle = "#bbb", 1) : (fillStyle = bodyRender.fillStyle, 
            strokeStyle = bodyRender.strokeStyle, bodyRender.lineWidth);
            for (var _spointarr = [], j = 0; j < part.vertices.length; j++) _spointarr.push(part.vertices[j].x - bodyPosition.x, part.vertices[j].y - bodyPosition.y), 
            points.push(part.vertices[j].x - bodyPosition.x, part.vertices[j].y - bodyPosition.y);
            if (part.framePartRect && part.render.visible && primitive.graphics.drawPoly(bodyPosition.x, bodyPosition.y, _spointarr, part.render.fillStyle, part.render.strokeStyle, part.render.lineWidth), 
            options.hideWireFrames || primitive.graphics.drawPoly(bodyPosition.x, bodyPosition.y, points, fillStyle, strokeStyle, lineWidth), 
            !options.hideWireFrames) {
                if (options.showAngleIndicator || options.showAxes) if (lineWidth = 1, strokeStyle = options.wireframes ? "#CD5C5C" : bodyRender.strokeStyle || "#f00", 
                options.showAxes) for (k = 0; k < part.axes.length; k++) {
                    var axis = part.axes[k];
                    primitive.graphics.drawLine(part.position.x, part.position.y, part.position.x + 20 * axis.x, part.position.y + 20 * axis.y, strokeStyle, lineWidth);
                } else for (k = 0; k < part.axes.length; k++) primitive.graphics.drawLine(part.position.x, part.position.y, (part.vertices[0].x + part.vertices[part.vertices.length - 1].x) / 2, (part.vertices[0].y + part.vertices[part.vertices.length - 1].y) / 2, strokeStyle, lineWidth);
                options.showPositions && (strokeStyle = options.wireframes ? "#CD5C5C" : bodyRender.strokeStyle || "#f00", 
                primitive.graphics.drawCircle(part.position.x, part.position.y, 3, strokeStyle)), 
                options.showVelocity && (lineWidth = 3, strokeStyle = "#6495ED", primitive.graphics.drawLine(bodyPosition.x, bodyPosition.y, bodyPosition.x + 2 * (bodyPosition.x - body.positionPrev.x), bodyPosition.y + 2 * (bodyPosition.y - body.positionPrev.y), strokeStyle, lineWidth)), 
                options.showIds && Laya && Laya.Text;
            }
        }
    };
    var _createBodySprite = function(render, body) {
        var bodyRender = body.render, texturePath = bodyRender.sprite.texture, sprite = new Laya.Sprite();
        return sprite.loadImage(texturePath, void 0, void 0, body.render.sprite.width, body.render.sprite.height), 
        sprite.pivotX = body.render.sprite.xOffset, sprite.pivotY = body.render.sprite.yOffset, 
        sprite;
    }, _updateBodySprite = function(sprite, body) {
        var bodyRender = body.render, texturePath = bodyRender.sprite.texture;
        return sprite.graphics.clear(!0), body.render.sprite.change = !1, sprite.loadImage(texturePath, void 0, void 0, body.render.sprite.width, body.render.sprite.height), 
        sprite.pivotX = body.render.sprite.xOffset, sprite.pivotY = body.render.sprite.yOffset, 
        sprite;
    }, _createBodyPrimitive = function(render, body) {
        if (!Laya.Sprite) throw new Error("must import Laya.");
        return new Laya.Sprite();
    };
    return RenderLaya;
}(), function(factory) {
    var root = "object" == typeof global ? global : "object" == typeof self ? self : "object" == typeof this ? this : {};
    function createExporter(exports, previous) {
        return exports !== root && ("function" == typeof Object.create ? Object.defineProperty(exports, "__esModule", {
            value: !0
        }) : exports.__esModule = !0), function(id, v) {
            return exports[id] = previous ? previous(id, v) : v;
        };
    }
    "function" == typeof define && define.amd ? define("tslib", [ "exports" ], function(exports) {
        factory(createExporter(root, createExporter(exports)));
    }) : "object" == typeof module && "object" == typeof gmodule.exports ? factory(createExporter(root, createExporter(gmodule.exports))) : factory(createExporter(root));
}(function(exporter) {
    var extendStatics = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(d, b) {
        d.__proto__ = b;
    } || function(d, b) {
        for (var p in b) b.hasOwnProperty(p) && (d[p] = b[p]);
    };
    __extends = function(d, b) {
        function __() {
            this.constructor = d;
        }
        extendStatics(d, b), d.prototype = null === b ? Object.create(b) : (__.prototype = b.prototype, 
        new __());
    }, __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) for (var p in s = arguments[i]) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
        return t;
    }, __rest = function(s, e) {
        var t = {};
        for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
        if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
            var i = 0;
            for (p = Object.getOwnPropertySymbols(s); i < p.length; i++) e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
        }
        return t;
    }, __decorate = function(decorators, target, key, desc) {
        var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; 0 <= i; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : 3 < c ? d(target, key, r) : d(target, key)) || r);
        return 3 < c && r && Object.defineProperty(target, key, r), r;
    }, __param = function(paramIndex, decorator) {
        return function(target, key) {
            decorator(target, key, paramIndex);
        };
    }, __metadata = function(metadataKey, metadataValue) {
        if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
    }, __awaiter = function(thisArg, _arguments, P, generator) {
        return new (P || (P = Promise))(function(resolve, reject) {
            function fulfilled(value) {
                try {
                    step(generator.next(value));
                } catch (e) {
                    e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                    reject(e);
                }
            }
            function rejected(value) {
                try {
                    step(generator.throw(value));
                } catch (e) {
                    e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                    reject(e);
                }
            }
            function step(result) {
                result.done ? resolve(result.value) : new P(function(resolve) {
                    resolve(result.value);
                }).then(fulfilled, rejected);
            }
            step((generator = generator.apply(thisArg, _arguments || [])).next());
        });
    }, __generator = function(thisArg, body) {
        var f, y, t, g, _ = {
            label: 0,
            sent: function() {
                if (1 & t[0]) throw t[1];
                return t[1];
            },
            trys: [],
            ops: []
        };
        return g = {
            next: verb(0),
            throw: verb(1),
            return: verb(2)
        }, "function" == typeof Symbol && (g[Symbol.iterator] = function() {
            return this;
        }), g;
        function verb(n) {
            return function(v) {
                return function(op) {
                    if (f) throw new TypeError("Generator is already executing.");
                    for (;_; ) try {
                        if (f = 1, y && (t = 2 & op[0] ? y.return : op[0] ? y.throw || ((t = y.return) && t.call(y), 
                        0) : y.next) && !(t = t.call(y, op[1])).done) return t;
                        switch (y = 0, t && (op = [ 2 & op[0], t.value ]), op[0]) {
                          case 0:
                          case 1:
                            t = op;
                            break;

                          case 4:
                            return _.label++, {
                                value: op[1],
                                done: !1
                            };

                          case 5:
                            _.label++, y = op[1], op = [ 0 ];
                            continue;

                          case 7:
                            op = _.ops.pop(), _.trys.pop();
                            continue;

                          default:
                            if (!(t = 0 < (t = _.trys).length && t[t.length - 1]) && (6 === op[0] || 2 === op[0])) {
                                _ = 0;
                                continue;
                            }
                            if (3 === op[0] && (!t || op[1] > t[0] && op[1] < t[3])) {
                                _.label = op[1];
                                break;
                            }
                            if (6 === op[0] && _.label < t[1]) {
                                _.label = t[1], t = op;
                                break;
                            }
                            if (t && _.label < t[2]) {
                                _.label = t[2], _.ops.push(op);
                                break;
                            }
                            t[2] && _.ops.pop(), _.trys.pop();
                            continue;
                        }
                        op = body.call(thisArg, _);
                    } catch (e) {
                        e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                        op = [ 6, e ], y = 0;
                    } finally {
                        f = t = 0;
                    }
                    if (5 & op[0]) throw op[1];
                    return {
                        value: op[0] ? op[1] : void 0,
                        done: !0
                    };
                }([ n, v ]);
            };
        }
    }, __exportStar = function(m, exports) {
        for (var p in m) exports.hasOwnProperty(p) || (exports[p] = m[p]);
    }, __values = function(o) {
        var m = "function" == typeof Symbol && o[Symbol.iterator], i = 0;
        return m ? m.call(o) : {
            next: function() {
                return o && i >= o.length && (o = void 0), {
                    value: o && o[i++],
                    done: !o
                };
            }
        };
    }, __read = function(o, n) {
        var m = "function" == typeof Symbol && o[Symbol.iterator];
        if (!m) return o;
        var r, e, i = m.call(o), ar = [];
        try {
            for (;(void 0 === n || 0 < n--) && !(r = i.next()).done; ) ar.push(r.value);
        } catch (error) {
            error = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(error);
            e = {
                error: error
            };
        } finally {
            try {
                r && !r.done && (m = i.return) && m.call(i);
            } finally {
                if (e) throw e.error;
            }
        }
        return ar;
    }, __spread = function() {
        for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
        return ar;
    }, __spreadArrays = function() {
        for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
        var r = Array(s), k = 0;
        for (i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, 
        k++) r[k] = a[j];
        return r;
    }, __await = function(v) {
        return this instanceof __await ? (this.v = v, this) : new __await(v);
    }, __asyncGenerator = function(thisArg, _arguments, generator) {
        if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
        var i, g = generator.apply(thisArg, _arguments || []), q = [];
        return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
            return this;
        }, i;
        function verb(n) {
            g[n] && (i[n] = function(v) {
                return new Promise(function(a, b) {
                    1 < q.push([ n, v, a, b ]) || resume(n, v);
                });
            });
        }
        function resume(n, v) {
            try {
                !function(r) {
                    r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
                }(g[n](v));
            } catch (e) {
                e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                settle(q[0][3], e);
            }
        }
        function fulfill(value) {
            resume("next", value);
        }
        function reject(value) {
            resume("throw", value);
        }
        function settle(f, v) {
            f(v), q.shift(), q.length && resume(q[0][0], q[0][1]);
        }
    }, __asyncDelegator = function(o) {
        var i, p;
        return i = {}, verb("next"), verb("throw", function(e) {
            throw e;
        }), verb("return"), i[Symbol.iterator] = function() {
            return this;
        }, i;
        function verb(n, f) {
            i[n] = o[n] ? function(v) {
                return (p = !p) ? {
                    value: __await(o[n](v)),
                    done: "return" === n
                } : f ? f(v) : v;
            } : f;
        }
    }, __asyncValues = function(o) {
        if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
        var i, m = o[Symbol.asyncIterator];
        return m ? m.call(o) : (o = "function" == typeof __values ? __values(o) : o[Symbol.iterator](), 
        i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
            return this;
        }, i);
        function verb(n) {
            i[n] = o[n] && function(v) {
                return new Promise(function(resolve, reject) {
                    (function(resolve, reject, d, v) {
                        Promise.resolve(v).then(function(v) {
                            resolve({
                                value: v,
                                done: d
                            });
                        }, reject);
                    })(resolve, reject, (v = o[n](v)).done, v.value);
                });
            };
        }
    }, __makeTemplateObject = function(cooked, raw) {
        return Object.defineProperty ? Object.defineProperty(cooked, "raw", {
            value: raw
        }) : cooked.raw = raw, cooked;
    }, __importStar = function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (null != mod) for (var k in mod) Object.hasOwnProperty.call(mod, k) && (result[k] = mod[k]);
        return result.default = mod, result;
    }, __importDefault = function(mod) {
        return mod && mod.__esModule ? mod : {
            default: mod
        };
    }, exporter("__extends", __extends), exporter("__assign", __assign), exporter("__rest", __rest), 
    exporter("__decorate", __decorate), exporter("__param", __param), exporter("__metadata", __metadata), 
    exporter("__awaiter", __awaiter), exporter("__generator", __generator), exporter("__exportStar", __exportStar), 
    exporter("__values", __values), exporter("__read", __read), exporter("__spread", __spread), 
    exporter("__spreadArrays", __spreadArrays), exporter("__await", __await), exporter("__asyncGenerator", __asyncGenerator), 
    exporter("__asyncDelegator", __asyncDelegator), exporter("__asyncValues", __asyncValues), 
    exporter("__makeTemplateObject", __makeTemplateObject), exporter("__importStar", __importStar), 
    exporter("__importDefault", __importDefault);
}), function(base) {
    !function(assets) {
        var Entry = function() {}, HandlePool = function() {
            function HandlePool() {
                this._slots = new Array(4096), this._count = 0, this._freeSlot = null;
            }
            return Object.defineProperty(HandlePool, "instance", {
                get: function() {
                    return HandlePool._instance;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(HandlePool.prototype, "count", {
                get: function() {
                    return this._count;
                },
                enumerable: !0,
                configurable: !0
            }), HandlePool.prototype.lock = function(handle) {
                var slot = this.findEntry(handle);
                return null == slot ? null : (++slot.ref, slot.res);
            }, HandlePool.prototype.getValue = function(handle) {
                var slot = this.findEntry(handle);
                return null == slot ? null : slot.res;
            }, HandlePool.prototype.getArgs = function(handle) {
                var slot = this.findEntry(handle);
                return null == slot ? null : slot.args;
            }, HandlePool.prototype.getRefCount = function(handle) {
                var slot = this.findEntry(handle);
                return null == slot ? 0 : slot.ref;
            }, HandlePool.prototype.free = function(handle) {
                var slot = this.findEntry(handle);
                if (null == slot) return !0;
                if (0 < --slot.ref) return !1;
                var destroy = slot.destroy, args = slot.args, res = slot.res, magic = slot.handle / 65536 | 0;
                return magic = 65535 == magic ? 1 : magic + 1, slot.handle = 65536 * magic + (65535 & slot.handle), 
                slot.ref = null == this._freeSlot ? -1 : 65535 & this._freeSlot.handle, slot.args = null, 
                slot.res = null, slot.destroy = null, this._freeSlot = slot, --this._count, null != destroy && destroy(args, res), 
                !0;
            }, HandlePool.prototype.alloc = function(args, res, destroy) {
                if (null == res) return 0;
                if (this._count == this._slots.length) {
                    if (65536 < 2 * this._count) throw Error("HandlePool overflow");
                    this._slots.length = 2 * this._count;
                }
                var slot;
                if (null != this._freeSlot) {
                    ++this._count;
                    var next = (slot = this._freeSlot).ref;
                    slot.ref = 1, this._freeSlot = -1 != next ? this._slots[next] : null;
                } else (slot = new Entry()).handle = 65536 | this._count, slot.ref = 1, this._slots[this._count++] = slot;
                return slot.args = args, slot.res = res, slot.destroy = destroy, slot.handle;
            }, HandlePool.prototype.findEntry = function(handle) {
                var index = 65535 & handle;
                if (index >= this._slots.length) return null;
                var slot = this._slots[index];
                return null == slot || null == slot.res || slot.handle != handle ? null : slot;
            }, HandlePool._instance = new HandlePool(), HandlePool;
        }();
        assets.HandlePool = HandlePool;
    }(base.assets || (base.assets = {}));
}(base || (base = {})), function(utils) {
    !function(collections) {
        var Heap = function() {
            function Heap(c) {
                this._elements = [], this._comparator = c;
            }
            return Object.defineProperty(Heap.prototype, "size", {
                get: function() {
                    return this._elements.length;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(Heap.prototype, "top", {
                get: function() {
                    return this._elements[0];
                },
                enumerable: !0,
                configurable: !0
            }), Heap.prototype.isEmtry = function() {
                return 0 === this._elements.length;
            }, Heap.prototype.push = function(e) {
                this._elements.push(e), this.shiftUp(this._elements.length - 1, e);
            }, Heap.prototype.pop = function() {
                var result = this._elements[0], value = this._elements.pop();
                return 0 != this._elements.length && this.shiftDown(0, value), result;
            }, Heap.prototype.remove = function(e) {
                var i = e.pointer;
                if (i >= this._elements.length) return !1;
                if (this._elements[i] != e) return !1;
                var value = this._elements.pop();
                return i < this._elements.length && this.shiftDown(i, value), !0;
            }, Heap.prototype.updateElement = function(e) {
                var i = e.pointer;
                if (!(i >= this._elements.length) && this._elements[i] == e) {
                    if (0 != i) {
                        var p = i - 1 >> 1;
                        if (this._comparator(e, this._elements[p])) return void this.shiftUp(i, e);
                    }
                    var count = this._elements.length, l = 1 + (i << 1), r = 1 + l;
                    if (l < count) {
                        var v = this._elements[l];
                        r < count && this._comparator(this._elements[r], v) && (v = this._elements[r]), 
                        this._comparator(v, e) && this.shiftDown(i, e);
                    }
                }
            }, Heap.prototype.shiftDown = function(i, e) {
                for (var v, l = 1 + (i << 1), r = l + 1, count = this._elements.length; l < count && (v = this._elements[l], 
                r < count && this._comparator(this._elements[r], v) && (v = this._elements[r], l = r), 
                !this._comparator(e, v)); ) v.pointer = i, this._elements[i] = v, r = (l = 1 + ((i = l) << 1)) + 1;
                e.pointer = i, this._elements[i] = e;
            }, Heap.prototype.shiftUp = function(i, e) {
                for (var v, p = i - 1 >> 1; 0 != i && (v = this._elements[p], this._comparator(e, v)); ) v.pointer = i, 
                this._elements[i] = v, p = (i = p) - 1 >> 1;
                e.pointer = i, this._elements[i] = e;
            }, Heap;
        }();
        collections.Heap = Heap;
    }(utils.collections || (utils.collections = {}));
}(utils || (utils = {})), function(base) {
    !function(assets) {
        var Heap = utils.collections.Heap, RecoverEntry = function() {
            function RecoverEntry() {}
            return RecoverEntry.allocEntry = function() {
                var result;
                return null != RecoverEntry._freeEntry ? RecoverEntry._freeEntry = (result = RecoverEntry._freeEntry).next : result = new RecoverEntry(), 
                result;
            }, RecoverEntry.freeEntry = function(e) {
                e.res = "", e.value = 0, e.recover = null, e.pointer = 4294967295, e.next = this._freeEntry, 
                e.cost = 0, this._freeEntry = e;
            }, RecoverEntry._freeEntry = null, RecoverEntry;
        }(), RecoverQueue = function() {
            function RecoverQueue(name, limit) {
                this._cache = {}, this._heap = new Heap(function(l, r) {
                    return l.value < r.value;
                }), this._id = 0, this._name = "RecoverQueue", this._cost = 0, this._limit = 0, 
                this._name = name, this._id = ++RecoverQueue.sid, this._limit = limit;
            }
            return Object.defineProperty(RecoverQueue, "default", {
                get: function() {
                    return RecoverQueue._default;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(RecoverQueue.prototype, "name", {
                get: function() {
                    return this._name;
                },
                enumerable: !0,
                configurable: !0
            }), RecoverQueue.prototype.gc = function(force) {
                void 0 === force && (force = !1);
                for (var queue = new Array(); !this._heap.isEmtry() && (this._cost > this._limit || force); ) {
                    var e = this._heap.pop();
                    delete this._cache[e.res], queue.push(e);
                }
                for (var _i = 0, queue_1 = queue; _i < queue_1.length; _i++) {
                    (e = queue_1[_i]) && (null != e.recover && e.recover(e.res), this._cost -= e.cost, 
                    RecoverEntry.freeEntry(e));
                }
            }, RecoverQueue.prototype.addToQueue = function(res, cost, recover, interval) {
                var entry = this._cache[res];
                null == entry ? ((entry = RecoverEntry.allocEntry()).res = res, entry.recover = recover, 
                entry.pointer = 0, entry.cost = cost, entry.value = Date.now() + interval, this._heap.push(entry), 
                this._cache[res] = entry, this._cost += cost) : (entry.recover = recover, this._cost -= entry.cost, 
                this._cost += cost, entry.cost = cost, entry.value = Date.now() + interval, this._heap.updateElement(entry));
            }, RecoverQueue.prototype.removeToQueue = function(res) {
                var entry = this._cache[res];
                null != entry && (this._cost -= entry.cost, this._heap.remove(entry), delete this._cache[res], 
                RecoverEntry.freeEntry(entry));
            }, RecoverQueue.prototype.updateQueue = function() {
                var now = Date.now();
                if (!this._heap.isEmtry()) {
                    var e = this._heap.top;
                    e.value <= now && (this._cost -= e.cost, this._heap.pop(), delete this._cache[e.res], 
                    null != e.recover && e.recover(e.res), RecoverEntry.freeEntry(e));
                }
                if (this.gc(), this._heap.isEmtry() && 0 != this._cost) throw new Error(this._name + " cost not emtry~~~");
            }, RecoverQueue.sid = 0, RecoverQueue._default = new RecoverQueue("default", 104857600), 
            RecoverQueue;
        }();
        assets.RecoverQueue = RecoverQueue;
    }(base.assets || (base.assets = {}));
}(base || (base = {})), function(utils) {
    var ArrayUtils = function() {
        function ArrayUtils() {}
        return ArrayUtils.copy = function(source, sourceOffset, target, targetOffset, length) {
            if (source.length < sourceOffset + length) return !1;
            if (target.length < targetOffset + length) return !1;
            for (;length--; ) target[targetOffset++] = source[sourceOffset++];
            return !0;
        }, ArrayUtils.insertAt = function(array, index, obj) {
            if (array.push(obj), !(index < 0)) for (var j = array.length - 1; index < j; --j) obj = array[j], 
            array[j] = array[j - 1], array[j - 1] = obj;
        }, ArrayUtils.removeAt = function(array, index) {
            var last = array.length - 1;
            if (last < index) return null;
            for (var obj = array[index], j = index; j < last; ++j) array[j] = array[j + 1];
            return array.length = last, obj;
        }, ArrayUtils.remove = function(array, obj) {
            var index = array.indexOf(obj);
            if (-1 === index) return -1;
            for (var last = array.length - 1, j = index; j < last; ++j) array[j] = array[j + 1];
            return array.length = last, index;
        }, ArrayUtils.removeRange = function(array, index, count, result) {
            void 0 === result && (result = null);
            var last = array.length - count;
            if (last < index && (last = index), null != result) for (var size = index + count > array.length ? array.length : index + count, i = index; i < size; ++i) result[i - index] = array[i];
            for (var j = index; j < last; ++j) array[j] = array[j + count];
            array.length = last;
        }, ArrayUtils.removeAll = function(array, obj) {
            for (var index = 0; -1 != (index = array.indexOf(obj, index)); ) {
                for (var last = array.length - 1, j = index; j < last; ++j) array[j] = array[j + 1];
                array.length = last;
            }
        }, ArrayUtils.unsafeRemoveAt = function(array, index) {
            var last = array.length - 1;
            if (last < index) return null;
            var obj = array[index];
            return array[index] = array[last], array.length = last, obj;
        }, ArrayUtils.unsafeRemove = function(array, obj) {
            var index = array.indexOf(obj);
            if (-1 === index) return -1;
            var last = array.length - 1;
            return array[index] = array[last], array.length = last, index;
        }, ArrayUtils.disturb = function(array) {
            for (var i = array.length - 1; 0 <= i; --i) {
                var upper = i + 1, index = Math.floor(Math.random() * upper) % upper;
                if (i != index) {
                    var temp = array[i];
                    array[i] = array[index], array[index] = temp;
                }
            }
            return array;
        }, ArrayUtils.random = function(array, offset) {
            void 0 === offset && (offset = 0);
            var size = array.length - offset;
            return array[Math.floor(Math.random() * size) % size + offset];
        }, ArrayUtils.randomIndex = function(array, offset) {
            void 0 === offset && (offset = 0);
            var size = array.length - offset;
            return Math.floor(Math.random() * size) % size + offset;
        }, ArrayUtils.reverse = function(array) {
            for (var l = 0, r = array.length - 1; l < r; ++l, --r) {
                var temp = array[l];
                array[l] = array[r], array[r] = temp;
            }
        }, ArrayUtils.removeRepetition = function(array) {
            if (array && !(array.length <= 1)) {
                for (var tempIndex = 1, i = 1; i < array.length; i++) array[i] !== array[i - 1] && (array[tempIndex] = array[i], 
                tempIndex++);
                array.length = tempIndex;
            }
        }, ArrayUtils.binarySearch = function(array, compareFn) {
            for (var low = 0, high = array.length - 1, mid = 0, type = 0; low <= high; ) if (0 < (type = compareFn(array[mid = low + high >> 1], mid))) low = mid + 1; else {
                if (!(type < 0)) return mid;
                high = mid - 1;
            }
            return -1;
        }, ArrayUtils.binarySearchRange = function(array, compareFn) {
            for (var low = 0, high = array.length - 1, left = low + high >> 1; low < high; ) compareFn(array[left], left) <= 0 ? high = left : low = left + 1, 
            left = low + high >> 1;
            if (0 != compareFn(array[left], left)) return null;
            for (var right = (low = 0) + (high = array.length - 1) + 1 >> 1; low < high; ) compareFn(array[right], right) < 0 ? high = right - 1 : low = right, 
            right = low + high + 1 >> 1;
            return [ left, right ];
        }, ArrayUtils;
    }();
    utils.ArrayUtils = ArrayUtils;
}(utils || (utils = {})), function(utils) {
    !function(collections) {
        var Set = function() {
            function Set(list) {
                if (this._list = new Array(), null != list) for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {
                    var value = list_1[_i];
                    this.add(value);
                }
            }
            return Set.prototype.add = function(value) {
                return -1 == this._list.indexOf(value) && (this._list.push(value), !0);
            }, Set.prototype.swap = function(list) {
                var result = this._list;
                return this._list = list, result;
            }, Set.prototype.has = function(value) {
                return -1 != this._list.indexOf(value);
            }, Set.prototype.del = function(value) {
                return -1 != utils.ArrayUtils.remove(this._list, value);
            }, Set.prototype.isEmpty = function() {
                return 0 == this._list.length;
            }, Object.defineProperty(Set.prototype, "size", {
                get: function() {
                    return this._list.length;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(Set.prototype, "values", {
                get: function() {
                    return this._list;
                },
                enumerable: !0,
                configurable: !0
            }), Set.prototype.clear = function() {
                this._list.length = 0;
            }, Set;
        }();
        collections.Set = Set;
    }(utils.collections || (utils.collections = {}));
}(utils || (utils = {})), function(base) {
    !function(assets) {
        var AssetEntry = function() {
            function AssetEntry() {
                this.callback = new utils.collections.Set(), this.status = 0, this.handle = 0, this.cache = 0, 
                this.cost = 0, this.assets = [];
            }
            return AssetEntry.allocEntry = function() {
                var result;
                return null != AssetEntry._freeEntry ? AssetEntry._freeEntry = (result = AssetEntry._freeEntry).res : result = new AssetEntry(), 
                result.res = null, result;
            }, AssetEntry.freeEntry = function(entry) {
                entry.url = "", entry.res = this._freeEntry, entry.callback.clear(), entry.status = 0, 
                entry.handle = 0, entry.cache = 0, entry.cost = 0, entry.args = null;
                for (var _i = 0, _a = entry.assets; _i < _a.length; _i++) {
                    var handle = _a[_i];
                    AssetEntry._handlePool.free(handle);
                }
                entry.assets.length = 0, this._freeEntry = entry;
            }, AssetEntry._handlePool = assets.HandlePool.instance, AssetEntry;
        }();
        assets.AssetEntry = AssetEntry;
        var AssetPoolBase = function() {
            function AssetPoolBase(name, limit, recoverLimit) {
                var _this = this;
                void 0 === recoverLimit && (recoverLimit = 3e4), this.doRecover = function(entry) {}, 
                this.onDestroy = function(url, res) {
                    var entry = _this._successPool[url];
                    entry.handle = 0, _this._recoverQueue.addToQueue(url, entry.cost, _this.onRecover, _this._recoverLimit);
                }, this.onRecover = function(url) {
                    var entry = _this._notifyQueue[url];
                    if (null != entry) {
                        if (!entry.callback.isEmpty()) return void _this._recoverQueue.addToQueue(url, entry.cost, _this.onRecover, _this._recoverLimit);
                        delete _this._notifyQueue[url];
                    } else entry = _this._successPool[url];
                    delete _this._successPool[url], _this.doRecover(entry), AssetEntry.freeEntry(entry);
                }, this._handlePool = assets.HandlePool.instance, this._recoverQueue = new assets.RecoverQueue(name, limit), 
                this._recoverLimit = recoverLimit, this._waitPool = {}, this._successPool = {}, 
                this._failurePool = {}, this._notifyQueue = {}, this._notifyList = [], this._backupQueue = {}, 
                AssetPoolBase._poolQueue.push(this);
            }
            return AssetPoolBase.onUpdate = function() {
                for (var _i = 0, _a = AssetPoolBase._poolQueue; _i < _a.length; _i++) {
                    _a[_i].update();
                }
            }, AssetPoolBase.gc = function(force) {
                for (var _i = 0, _a = AssetPoolBase._poolQueue; _i < _a.length; _i++) {
                    _a[_i].recoverQueue.gc(force);
                }
            }, Object.defineProperty(AssetPoolBase.prototype, "recoverQueue", {
                get: function() {
                    return this._recoverQueue;
                },
                enumerable: !0,
                configurable: !0
            }), AssetPoolBase.prototype.waitingNotify = function(url, callback) {
                var entry = this._successPool[url];
                return null != entry ? entry.callback.has(callback) : null != (entry = this._failurePool[url]) ? entry.callback.has(callback) : null != (entry = this._waitPool[url]) && entry.callback.has(callback);
            }, AssetPoolBase.prototype.findNeedCancelEntry = function(url, callback) {
                var entry = this._successPool[url];
                return null != entry ? (entry.callback.del(callback), null) : null != (entry = this._failurePool[url]) ? (entry.callback.del(callback), 
                null) : null == (entry = this._waitPool[url]) ? null : entry.callback.del(callback) && entry.callback.isEmpty() ? entry : null;
            }, AssetPoolBase.prototype.checkNeedCancel = function(url, callback) {
                var entry = this._successPool[url];
                return null != entry ? (entry.callback.del(callback), !1) : null != (entry = this._failurePool[url]) ? (entry.callback.del(callback), 
                !1) : null != (entry = this._waitPool[url]) && (!!entry.callback.del(callback) && (!!entry.callback.isEmpty() && (delete this._waitPool[url], 
                AssetEntry.freeEntry(entry), !0)));
            }, AssetPoolBase.prototype.checkNeedLoad = function(url, callback, forceTry) {
                var entry = this._successPool[url];
                if (null != entry) return entry.callback.add(callback), this._notifyQueue[url] = entry, 
                null;
                if (null != (entry = this._failurePool[url])) {
                    if (!forceTry) return this._notifyQueue[url] = entry, null;
                    delete this._failurePool[url], delete this._notifyQueue[url], this._waitPool[url] = entry;
                }
                return null == (entry = this._waitPool[url]) && ((entry = AssetEntry.allocEntry()).url = url, 
                entry.res = null, this._waitPool[url] = entry), entry.callback.add(callback), entry;
            }, AssetPoolBase.prototype.onComplete = function(url, res, cost) {
                var entry = this._waitPool[url];
                if (delete this._waitPool[url], entry) {
                    if (entry.res = res, entry.cost = cost, null == res) {
                        for (var _i = 0, _a = entry.assets; _i < _a.length; _i++) {
                            var handle = _a[_i];
                            this._handlePool.free(handle);
                        }
                        entry.assets.length = 0, entry.args = null, entry.status = 0, this._failurePool[url] = entry;
                    } else this._successPool[url] = entry;
                    entry.callback.isEmpty() ? null != res && this._recoverQueue.addToQueue(url, entry.cost, this.onRecover, this._recoverLimit) : this._notifyQueue[url] = entry;
                }
            }, AssetPoolBase.prototype.doNotify = function(url, handle, res, callback) {
                callback(url, handle, res);
            }, AssetPoolBase.prototype.update = function() {
                var temp = this._notifyQueue;
                for (var url in this._notifyQueue = this._backupQueue, this._backupQueue = temp, 
                this._backupQueue) {
                    var entry = this._backupQueue[url], handle = entry.handle, res = entry.res;
                    null != res && (0 == handle ? (this._recoverQueue.removeToQueue(url), handle = entry.handle = this._handlePool.alloc(url, res, this.onDestroy)) : this._handlePool.lock(handle)), 
                    this._notifyList = entry.callback.swap(this._notifyList);
                    for (var _i = 0, _a = this._notifyList; _i < _a.length; _i++) {
                        var callback = _a[_i];
                        this.doNotify(url, handle, res, callback);
                    }
                    this._handlePool.free(entry.handle), this._notifyList.length = 0, delete this._backupQueue[url];
                }
                this._recoverQueue.updateQueue();
            }, AssetPoolBase._poolQueue = new Array(), AssetPoolBase;
        }();
        assets.AssetPoolBase = AssetPoolBase;
    }(base.assets || (base.assets = {}));
}(base || (base = {})), function(base) {
    !function(background) {
        var InitCommand = function() {
            function InitCommand() {
                this.enableCache = !1, this.enableCheck = !1, this.host = "";
            }
            return InitCommand.prototype.type = function() {
                return InitCommand.opcode;
            }, InitCommand.prototype.readTo = function(tuple, args) {
                var offset = 0;
                this.enableCache = tuple[offset++], this.enableCheck = tuple[offset++], this.host = tuple[offset++];
            }, InitCommand.prototype.writeTo = function(args) {
                var result = [];
                return result.push(this.enableCache), result.push(this.enableCheck), result.push(this.host), 
                result;
            }, InitCommand.opcode = 0, InitCommand;
        }();
        background.InitCommand = InitCommand;
        var InitCompleteCommand = function() {
            function InitCompleteCommand() {}
            return InitCompleteCommand.prototype.type = function() {
                return InitCompleteCommand.opcode;
            }, InitCompleteCommand.prototype.readTo = function(tuple, args) {
                var offset = 0;
                this.status = tuple[offset++];
            }, InitCompleteCommand.prototype.writeTo = function(args) {
                var result = [];
                return result.push(this.status), result;
            }, InitCompleteCommand.opcode = 1, InitCompleteCommand;
        }();
        background.InitCompleteCommand = InitCompleteCommand;
        var LoadCompleteCommand = function() {
            function LoadCompleteCommand() {}
            return LoadCompleteCommand.prototype.type = function() {
                return LoadCompleteCommand.opcode;
            }, LoadCompleteCommand.prototype.readTo = function(tuple, args) {
                var offset = 0;
                this.url = tuple[offset++], this.status = tuple[offset++];
                var index = tuple[offset++];
                0 != index && (this.bytes = args[index]);
            }, LoadCompleteCommand.prototype.writeTo = function(args) {
                var result = [];
                return result.push(this.url), result.push(this.status), null != this.bytes ? (result.push(args.length), 
                args.push(this.bytes)) : result.push(0), result;
            }, LoadCompleteCommand.opcode = 3, LoadCompleteCommand;
        }();
        background.LoadCompleteCommand = LoadCompleteCommand;
        var LoadCommand = function() {
            function LoadCommand() {}
            return LoadCommand.prototype.type = function() {
                return LoadCommand.opcode;
            }, LoadCommand.prototype.readTo = function(tuple, args) {
                var offset = 0;
                this.url = tuple[offset++], this.uncompress = tuple[1];
            }, LoadCommand.prototype.writeTo = function(args) {
                var result = [];
                return result.push(this.url), result.push(this.uncompress), result;
            }, LoadCommand.opcode = 2, LoadCommand;
        }();
        background.LoadCommand = LoadCommand;
        var DecodeCommand = function() {
            function DecodeCommand() {}
            return DecodeCommand.prototype.type = function() {
                return DecodeCommand.opcode;
            }, DecodeCommand.prototype.readTo = function(tuple, args) {
                var offset = 0;
                this.url = tuple[offset++], this.uncompress = tuple[offset++];
                var size = tuple[offset++];
                if (0 != size) {
                    var index = tuple[3];
                    this.content = [];
                    for (var limit = index + size; index < limit; ++index) this.content.push(args[index]);
                }
            }, DecodeCommand.prototype.writeTo = function(args) {
                var result = [];
                if (result.push(this.url), result.push(this.uncompress), null != this.content && 0 != this.content.length) {
                    result.push(this.content.length), result.push(args.length);
                    for (var _i = 0, _a = this.content; _i < _a.length; _i++) {
                        var bytes = _a[_i];
                        args.push(bytes);
                    }
                } else result.push(0);
                return result;
            }, DecodeCommand.opcode = 4, DecodeCommand;
        }();
        background.DecodeCommand = DecodeCommand;
        var DecodeCompleteCommand = function() {
            function DecodeCompleteCommand() {}
            return DecodeCompleteCommand.prototype.type = function() {
                return DecodeCompleteCommand.opcode;
            }, DecodeCompleteCommand.prototype.readTo = function(tuple, args) {
                var offset = 0;
                this.url = tuple[offset++];
                var index = tuple[1];
                0 != index && (this.bytes = args[index]);
            }, DecodeCompleteCommand.prototype.writeTo = function(args) {
                var result = [];
                return result.push(this.url), null != this.bytes ? (result.push(args.length), args.push(this.bytes)) : result.push(0), 
                result;
            }, DecodeCompleteCommand.opcode = 5, DecodeCompleteCommand;
        }();
        background.DecodeCompleteCommand = DecodeCompleteCommand;
    }(base.background || (base.background = {}));
}(base || (base = {})), function(base) {
    !function(assets) {
        var LoadCommand = base.background.LoadCommand, LoadCompleteCommand = base.background.LoadCompleteCommand, ArrayUtils = utils.ArrayUtils, Heap = utils.collections.Heap, ResourceEntry = function() {
            function ResourceEntry() {
                this.callback = [], this.type = 0, this.handle = 0, this.cache = 0;
            }
            return ResourceEntry.allocEntry = function() {
                var result;
                return null != ResourceEntry._freeEntry ? ResourceEntry._freeEntry = (result = ResourceEntry._freeEntry).next : result = new ResourceEntry(), 
                result.res = null, result;
            }, ResourceEntry.freeEntry = function(entry) {
                entry.value = 0, entry.pointer = 0, entry.url = "", entry.res = null, entry.callback.length = 0, 
                entry.type = 0, entry.handle = 0, entry.cache = 0, entry.next = this._freeEntry, 
                this._freeEntry = entry;
            }, ResourceEntry.prototype.removeCallback = function(fun) {
                ArrayUtils.remove(this.callback, fun);
            }, ResourceEntry.prototype.addCallback = function(fun) {
                -1 == this.callback.indexOf(fun) && this.callback.push(fun);
            }, ResourceEntry;
        }(), ResourcePool = function() {
            function ResourcePool() {
                var _this = this;
                this.onRequestComplete = function(command) {
                    var status = command.status;
                    200 == status || 0 == status ? _this.onComplete(command.url, 0, command.bytes) : _this.onComplete(command.url, 0, null);
                }, this.onRecover = function(url) {
                    var entry = _this._notifyQueue[url];
                    if (null != entry) {
                        if (0 != entry.callback.length) {
                            var res = entry.res;
                            return void _this._recoverQueue.addToQueue(url, res instanceof ArrayBuffer ? res.byteLength : res.width * res.height * 4, _this.onRecover, _this._recoverLimit);
                        }
                        delete _this._notifyQueue[url];
                    } else entry = _this._successPool[url];
                    delete _this._successPool[url], _this._totalMemorySize -= entry.res.byteLength, 
                    ResourceEntry.freeEntry(entry);
                }, this.onDestroy = function(url, res) {
                    _this._successPool[url].handle = 0, _this._recoverQueue.addToQueue(url, res instanceof ArrayBuffer ? res.byteLength : res.width * res.height * 4, _this.onRecover, _this._recoverLimit);
                }, this._handlePool = assets.HandlePool.instance, this._recoverQueue = new assets.RecoverQueue("ResourcePool", 10485760), 
                this._recoverLimit = 6e4, this._init = !1, this._processLimit = 10, this._realTimeProcessLimit = 6, 
                this._processCount = 0, this._realTimeProcessCount = 0, this._waitPool = {}, this._waitQueue = new Heap(function(l, r) {
                    return l.value < r.value;
                }), this._realTimePool = {}, this._realTimeQueue = [], this._successPool = {}, this._failurePool = {}, 
                this._notifyQueue = {}, this._processQueue = {}, this._notifyList = [], this._backupQueue = {}, 
                this._totalMemorySize = 0;
            }
            return Object.defineProperty(ResourcePool, "instance", {
                get: function() {
                    return ResourcePool._instance;
                },
                enumerable: !0,
                configurable: !0
            }), ResourcePool.prototype.init = function(actor) {
                this._init || (this._init = !0, (this._actor = actor).registerOpcode(LoadCommand.opcode, LoadCommand), 
                actor.registerOpcode(LoadCompleteCommand.opcode, LoadCompleteCommand), actor.addCommandHandler(LoadCompleteCommand.opcode, this.onRequestComplete));
            }, Object.defineProperty(ResourcePool.prototype, "recoverQueue", {
                get: function() {
                    return this._recoverQueue;
                },
                enumerable: !0,
                configurable: !0
            }), ResourcePool.prototype.cancel = function(url, callback) {
                var entry = this._notifyQueue[url];
                if (null == entry) {
                    if (null != (entry = this._waitPool[url])) return entry.removeCallback(callback), 
                    void (0 == entry.callback.length && (delete this._waitPool[url], this._waitQueue.remove(entry), 
                    ResourceEntry.freeEntry(entry)));
                    if (null != (entry = this._realTimePool[url])) return entry.removeCallback(callback), 
                    void (0 == entry.callback.length && (delete this._realTimePool[url], ArrayUtils.remove(this._realTimeQueue, entry), 
                    ResourceEntry.freeEntry(entry)));
                    null == (entry = this._processQueue[url]) || entry.removeCallback(callback);
                } else entry.removeCallback(callback);
            }, ResourcePool.prototype.load = function(url, callback, priority, realTime, forceTry, uncompress) {
                void 0 === priority && (priority = 0), void 0 === realTime && (realTime = !1), void 0 === forceTry && (forceTry = !1), 
                void 0 === uncompress && (uncompress = 0), priority = Date.now() + 1e3 * priority;
                var entry = this._successPool[url];
                if (null != entry) return entry.addCallback(callback), void (this._notifyQueue[url] = entry);
                if (null != (entry = this._failurePool[url])) return entry.addCallback(callback), 
                void (forceTry ? (delete this._notifyQueue[url], delete this._failurePool[url], 
                entry.value = priority, entry.type = uncompress, realTime ? (this._realTimePool[url] = entry, 
                this._realTimeQueue.push(entry)) : (this._waitPool[url] = entry, this._waitQueue.push(entry))) : this._notifyQueue[url] = entry);
                if (null != (entry = this._waitPool[url])) {
                    if (!realTime) return entry.addCallback(callback), void (entry.value > priority && (entry.value = priority, 
                    this._waitQueue.updateElement(entry)));
                    delete this._waitPool[url], this._waitQueue.remove(entry), this._realTimePool[url] = entry, 
                    this._realTimeQueue.push(entry);
                }
                null == (entry = this._realTimePool[url]) && null == (entry = this._processQueue[url]) ? ((entry = ResourceEntry.allocEntry()).url = url, 
                entry.res = null, entry.value = priority, entry.type = uncompress, entry.callback.push(callback), 
                realTime ? (this._realTimePool[url] = entry, this._realTimeQueue.push(entry)) : (this._waitPool[url] = entry, 
                this._waitQueue.push(entry))) : entry.addCallback(callback);
            }, ResourcePool.prototype.update = function() {
                for (var entry, url, uncompress = 0; this._processCount < this._processLimit && this._realTimeProcessCount < this._realTimeProcessLimit && 0 != this._realTimeQueue.length; ) url = (entry = this._realTimeQueue.shift()).url, 
                uncompress = entry.type, entry.type = 1, delete this._realTimePool[url], this.processRequest(entry, uncompress) && (this._processCount++, 
                this._realTimeProcessCount++);
                for (;this._processCount < this._processLimit && !this._waitQueue.isEmtry(); ) url = (entry = this._waitQueue.pop()).url, 
                uncompress = entry.type, entry.type = 0, delete this._waitPool[url], this.processRequest(entry, uncompress) && this._processCount++;
                for (;this._processCount < this._processLimit && 0 != this._realTimeQueue.length; ) url = (entry = this._realTimeQueue.shift()).url, 
                uncompress = entry.type, entry.type = 1, delete this._realTimePool[url], this.processRequest(entry, uncompress) && (this._processCount++, 
                this._realTimeProcessCount++);
                this.notify(), this._recoverQueue.updateQueue(), assets.RecoverQueue.default.updateQueue();
            }, ResourcePool.prototype.processRequest = function(entry, uncompress) {
                var url = entry.url;
                this._processQueue[url] = entry;
                var command = new LoadCommand();
                return command.url = url, command.uncompress = uncompress, this._actor.sendCommand(command), 
                !0;
            }, ResourcePool.prototype.onComplete = function(url, cache, res) {
                var entry = this._processQueue[url];
                delete this._processQueue[url], entry.res = res, entry.cache = cache, this._processCount--, 
                1 == entry.type && this._realTimeProcessCount--, null == res ? this._failurePool[url] = entry : (this._totalMemorySize += res.byteLength, 
                this._successPool[url] = entry), 0 != entry.callback.length ? this._notifyQueue[url] = entry : null != res && this._recoverQueue.addToQueue(url, res instanceof ArrayBuffer ? res.byteLength : res.width * res.height * 4, this.onRecover, this._recoverLimit);
            }, ResourcePool.prototype.notify = function() {
                var temp = this._notifyQueue;
                for (var url in this._notifyQueue = this._backupQueue, this._backupQueue = temp, 
                this._backupQueue) {
                    var entry = this._backupQueue[url], list = entry.callback;
                    entry.callback = this._notifyList, this._notifyList = list;
                    var handle = entry.handle, res = entry.res;
                    null != res && (0 == handle ? (this._recoverQueue.removeToQueue(url), handle = entry.handle = this._handlePool.alloc(url, entry.res, this.onDestroy)) : this._handlePool.lock(handle));
                    for (var _i = 0, _a = this._notifyList; _i < _a.length; _i++) {
                        (0, _a[_i])(url, handle, res);
                    }
                    this._handlePool.free(handle), this._notifyList.length = 0, delete this._backupQueue[url];
                }
            }, ResourcePool._instance = new ResourcePool(), ResourcePool;
        }();
        assets.ResourcePool = ResourcePool;
    }(base.assets || (base.assets = {}));
}(base || (base = {})), function(base) {
    !function(background) {
        var ArrayUtils = utils.ArrayUtils, Actor = function() {
            function Actor(path) {
                var _this = this;
                this.onError = function(ev) {
                    modules.common.GlobalData.recordError(ev.message || ev, ev.error);
                }, this.onMessage = function(message) {
                    var args = message.data;
                    if (0 != args.length) for (var commands = msgpack.decode(new Uint8Array(args[0])), length = commands.length, i = 0; i < length; ++i) {
                        var command = commands[i], type = command[0], opcode = new _this._opcodes[type]();
                        opcode.readTo(command[1], args);
                        var handlers = _this._opcodeHandlers[type];
                        if (null != handlers) for (var i_1 = 0, length_1 = handlers.length; i_1 < length_1; ++i_1) handlers[i_1](opcode);
                    }
                }, this.onUpdate = function() {
                    if (0 != _this._list.length) {
                        var commandBuffer = msgpack.encode(_this._list).buffer;
                        _this._args[0] = commandBuffer, _this._worker.postMessage(_this._args, _this._args), 
                        _this._args = new Array(1), _this._list.length = 0;
                    }
                }, this._worker = new Worker(path), this._args = new Array(1), this._list = new Array(), 
                this._worker.onmessage = this.onMessage, this._worker.onerror = this.onError, this._opcodeHandlers = [], 
                this._opcodes = [];
            }
            return Actor.prototype.registerOpcode = function(type, command) {
                this._opcodes[type] = command;
            }, Actor.prototype.addCommandHandler = function(type, handler) {
                var handlers = this._opcodeHandlers[type];
                null == handlers && (handlers = new Array(), this._opcodeHandlers[type] = handlers), 
                -1 == handlers.indexOf(handler) && handlers.push(handler);
            }, Actor.prototype.removeCommandHandler = function(type, handler) {
                var handlers = this._opcodeHandlers[type];
                null != handlers && ArrayUtils.remove(handlers, handler);
            }, Actor.prototype.sendCommand = function(command) {
                var tuple = command.writeTo(this._args);
                this._list.push([ command.type(), tuple ]), this.onUpdate();
            }, Actor;
        }();
        background.Actor = Actor;
    }(base.background || (base.background = {}));
}(base || (base = {})), function(base) {
    !function(background) {
        !function(system) {
            var IndexedDBCache = function() {
                function IndexedDBCache() {}
                return IndexedDBCache.openOnSuccess = function(event) {
                    var request = event.target;
                    (IndexedDBCache.db = request.result).objectStoreNames.contains("cache") || IndexedDBCache.db.createObjectStore("cache", {
                        keyPath: "url"
                    }), IndexedDBCache.initCallback(!0);
                }, IndexedDBCache.openOnUpgradeNeeded = function(event) {
                    var request = event.target;
                    (IndexedDBCache.db = request.result).objectStoreNames.contains("cache") || IndexedDBCache.db.createObjectStore("cache", {
                        keyPath: "url"
                    }), IndexedDBCache.initCallback(!0);
                }, IndexedDBCache.openOnError = function(event) {
                    IndexedDBCache.initCallback(!1);
                }, IndexedDBCache.initCache = function(enableCache, callback) {
                    if (IndexedDBCache.enableCache = enableCache) try {
                        var request = indexedDB.open("routine");
                        IndexedDBCache.initCallback = callback, request.onsuccess = IndexedDBCache.openOnSuccess, 
                        request.onupgradeneeded = IndexedDBCache.openOnUpgradeNeeded, request.onerror = IndexedDBCache.openOnError;
                    } catch (e) {
                        e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                        callback(!1);
                    } else callback(!1);
                }, IndexedDBCache.writeCache = function(url, version, buffer) {
                    if (null != IndexedDBCache.db) try {
                        IndexedDBCache.db.transaction("cache", "readwrite").objectStore("cache").put({
                            url: url,
                            version: version,
                            value: buffer
                        });
                    } catch (e) {}
                }, IndexedDBCache.readCache = function(url, callback) {
                    if (null != IndexedDBCache.db) try {
                        var request_1 = IndexedDBCache.db.transaction("cache").objectStore("cache").get(url);
                        request_1.onerror = function(event) {
                            callback(url, 0, null);
                        }, request_1.onsuccess = function(event) {
                            request_1.result ? callback(url, request_1.result.version, request_1.result.value) : callback(url, 0, null);
                        };
                    } catch (e) {
                        e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                        callback(url, 0, null);
                    } else callback(url, 0, null);
                }, IndexedDBCache;
            }();
            system.IndexedDBCache = IndexedDBCache;
        }(background.system || (background.system = {}));
    }(base.background || (base.background = {}));
}(base || (base = {})), function(utils) {
    var StringUtils = function() {
        function StringUtils() {}
        return StringUtils.init = function(wordsTree) {
            StringUtils.codeTable = new Uint32Array(wordsTree[0].buffer);
            for (var bufferList = new Array(wordsTree.length - 1), i = 0; i < bufferList.length; ++i) bufferList[i] = new DataView(wordsTree[i + 1].buffer);
            StringUtils.wordsTrees = bufferList;
            var invalidRegExp = new RegExp("[^一-龥豈-鶴。；，：“”（）、？《》√∴┠┛㈱━┯⊕≡ 囧‖◥☆♂┓↙→※∮↓◣⊥┏、╝┳i╩←︱じ╗╓㊣┗∝·┅○┇●°╬╋﹏★ㄨ↑┷∵╚╔¤№⊙℡↘╰≡う♀╮┨◢︳▃◆◎◤▔♛═§『Θ！ -~]|[\"&'/:;<>\\`卐]", "g");
            StringUtils.invalidRegExp = invalidRegExp, StringUtils.spaceRegExp = /\s+/;
        }, StringUtils.containSpace = function(str) {
            return StringUtils.spaceRegExp.test(str);
        }, StringUtils.find = function(c, buffer, low, high, result) {
            for (var codeTable = StringUtils.codeTable, mid = 0, type = 0; low <= high; ) {
                mid = low + high >> 1;
                var value = buffer.getUint32(5 * mid + 1, !0);
                if (0 < (type = c - codeTable[8191 & value])) low = mid + 1; else {
                    if (!(type < 0)) return result[0] = buffer.getUint8(5 * mid), result[1] = value, 
                    !0;
                    high = mid - 1;
                }
            }
            return !1;
        }, StringUtils.filterSubWords = function(words, start, count, offset, index) {
            for (var bufferList = StringUtils.wordsTrees, lastIndex = -1, result = [ count, 0 ], buffer = bufferList[index], i = start, length_2 = words.length; i < length_2; ++i) {
                var c = words.charCodeAt(i);
                if (!StringUtils.find(c, buffer, offset, offset + result[0] - 1, result)) {
                    if (c < 19968 || 40869 < c) continue;
                    return lastIndex;
                }
                buffer = bufferList[++index];
                var leaf = result[1] / 2147483648 | 0;
                if (!result[0]) return leaf ? ++i : lastIndex;
                leaf && (lastIndex = i + 1), offset = result[1] / 8192 & 262143;
            }
            return lastIndex;
        }, StringUtils.filterWords = function(words, start) {
            var firstWords = StringUtils.wordsTrees[0], c = words.charCodeAt(start++), high = firstWords.byteLength / 5 - 1, result = [ 0, 0 ];
            if (!StringUtils.find(c, firstWords, 0, high, result)) return -1;
            if (!result[0]) return result[1] / 2147483648 | 0 ? start : -1;
            var lastIndex = StringUtils.filterSubWords(words, start, result[0], result[1] / 8192 & 262143, 1);
            return -1 == lastIndex ? result[1] / 2147483648 | 0 ? start : -1 : lastIndex;
        }, StringUtils.isValidWords = function(words) {
            if (StringUtils.invalidRegExp.lastIndex = 0, StringUtils.invalidRegExp.test(words)) return !1;
            for (var i = 0, length_3 = words.length; i < length_3; ++i) {
                if (-1 != StringUtils.filterWords(words.toLowerCase(), i)) return !1;
            }
            return !0;
        }, StringUtils.replaceFilterWords = function(words, value) {
            if (StringUtils.invalidRegExp.lastIndex = 0, words = words.replace(StringUtils.invalidRegExp, ""), 
            StringUtils.wordsTrees && StringUtils.wordsTrees.length) {
                for (var result = [], i = 0, length_4 = words.length; i < length_4; ) {
                    var j = StringUtils.filterWords(words.toLowerCase(), i);
                    -1 != j ? (result.push(words.substring(i, j)), i = j) : ++i;
                }
                for (var _i = 0, result_1 = result; _i < result_1.length; _i++) {
                    var s = result_1[_i];
                    words = words.replace(s, value);
                }
            }
            return words;
        }, StringUtils.endsWith = function(source, searchString) {
            return -1 != source.indexOf(searchString, source.length - searchString.length);
        }, StringUtils;
    }();
    utils.StringUtils = StringUtils;
}(utils || (utils = {})), function(base) {
    !function(background) {
        !function(system) {
            var StringUtils = utils.StringUtils, HttpFileEntry = function() {
                function HttpFileEntry() {}
                return HttpFileEntry.allocEntry = function() {
                    var result;
                    return null != HttpFileEntry._freeEntry ? (result = this._freeEntry, this._freeEntry = this._freeEntry.next) : result = new HttpFileEntry(), 
                    result.live = 0, result.uncompress = 0, result;
                }, HttpFileEntry.freeEntry = function(entry) {
                    entry.callback = null, entry.request = null, (entry.request = null) != entry.dependencyUrls && (entry.dependencyUrls.length = 0), 
                    entry.dependencyBuffers = null, entry.next = this._freeEntry, HttpFileEntry._freeEntry = entry;
                }, HttpFileEntry;
            }(), HttpFileSystem = function() {
                function HttpFileSystem() {}
                return Object.defineProperty(HttpFileSystem, "enableRaw", {
                    get: function() {
                        return this._enableRaw;
                    },
                    enumerable: !0,
                    configurable: !0
                }), HttpFileSystem.init = function(host, enableCheck, enableRaw, callback) {
                    if ("" != host && "/" != host[host.length - 1] && (host += "/"), this._host = host, 
                    this._enableCheck = enableCheck, this._enableRaw = enableRaw, 0 == HttpFileSystem._versionDBStatus) {
                        HttpFileSystem._versionDBStatus = 1;
                        var entry = HttpFileSystem.createEntry("brother.big", 1, function(url, status, buffer) {
                            for (var url_1 in null == buffer && callback(status), HttpFileSystem._enableCheck && (HttpFileSystem._versionPool = msgpack.decode(new Zlib.Inflate(new Uint8Array(buffer)).decompress())), 
                            HttpFileSystem._versionDBStatus = 2, HttpFileSystem._loaderPool) {
                                var entry_1 = HttpFileSystem._loaderPool[url_1];
                                HttpFileSystem.triggerEntry(entry_1);
                            }
                            callback(0);
                        });
                        HttpFileSystem.openEntry(entry);
                    }
                }, HttpFileSystem.fromCache = function(url, version, buffer) {
                    if (null == buffer || HttpFileSystem._versionPool[url] != version) {
                        var entry = HttpFileSystem._loaderPool[url];
                        HttpFileSystem.openEntry(entry);
                    } else HttpFileSystem.onComplete(url, 0, buffer);
                }, HttpFileSystem.triggerEntry = function(entry) {
                    var url = entry.url;
                    null != HttpFileSystem._versionPool[url] ? system.IndexedDBCache.readCache(url, HttpFileSystem.fromCache) : HttpFileSystem.openEntry(entry);
                }, HttpFileSystem.read = function(url, uncompress, callback) {
                    var entry = HttpFileSystem._loaderPool[url];
                    null == entry && (entry = HttpFileSystem.createEntry(url, uncompress, callback), 
                    2 == HttpFileSystem._versionDBStatus && HttpFileSystem.triggerEntry(entry));
                }, HttpFileSystem.createEntry = function(url, uncompress, callback) {
                    var entry = HttpFileEntry.allocEntry();
                    return entry.url = url, entry.uncompress = uncompress, entry.live = HttpFileSystem._liveLimit, 
                    entry.callback = callback, entry.status = 0, HttpFileSystem._loaderPool[url] = entry;
                }, HttpFileSystem.openEntry = function(entry) {
                    if (0 == entry.status) {
                        entry.startTime = Date.now();
                        var url = entry.url;
                        entry.status = 1;
                        var s = url.toLowerCase();
                        if (this._enableRaw || !StringUtils.endsWith(s, ".jpg") && !StringUtils.endsWith(s, ".png")) {
                            var request = entry.request = 0 != HttpFileSystem._processorQueue.length ? HttpFileSystem._processorQueue.pop() : new XMLHttpRequest();
                            request.responseType = "arraybuffer", request.onreadystatechange = function(e) {
                                var request = e.target;
                                if (4 == request.readyState) if (200 == request.status || 0 == request.status && null != request.response && 0 < request.response.byteLength) null != HttpFileSystem._versionPool[url] && system.IndexedDBCache.writeCache(url, HttpFileSystem._versionPool[url], request.response), 
                                HttpFileSystem.onComplete(url, request.status, request.response); else if (0 == --entry.live) HttpFileSystem.onComplete(url, request.status, null); else {
                                    request.abort();
                                    var version_1 = HttpFileSystem._versionPool[url] || Date.now();
                                    request.open("GET", "" + (-1 == url.indexOf(":") ? HttpFileSystem._host : "") + url + "?v=" + version_1), 
                                    request.send();
                                }
                            };
                            version = HttpFileSystem._versionPool[url] || Date.now();
                            request.open("GET", "" + (-1 == url.indexOf(":") ? HttpFileSystem._host : "") + url + "?v=" + version), 
                            request.send();
                        } else {
                            var source_1 = new Image();
                            source_1.crossOrigin = "anonymous", source_1.onload = function(e) {
                                source_1.onload = source_1.onerror = null, HttpFileSystem.onComplete(url, 200, source_1);
                            }, source_1.onerror = function() {
                                source_1.onload = source_1.onerror = null, HttpFileSystem.onComplete(url, 404, null);
                            };
                            var version = HttpFileSystem._versionPool[url] || Date.now();
                            source_1.src = "" + (-1 == url.indexOf(":") ? HttpFileSystem._host : "") + url + "?v=" + version;
                        }
                    }
                }, HttpFileSystem.onComplete = function(url, status, buffer) {
                    var entry = HttpFileSystem._loaderPool[url];
                    delete HttpFileSystem._loaderPool[url];
                    var callback = entry.callback;
                    null != entry.request && (entry.request.abort(), HttpFileSystem._processorQueue.push(entry.request)), 
                    callback(url, buffer ? 200 : 404, buffer, entry.dependencyBuffers), HttpFileEntry.freeEntry(entry);
                }, HttpFileSystem._processorQueue = new Array(), HttpFileSystem._liveLimit = 3, 
                HttpFileSystem._loaderPool = {}, HttpFileSystem._versionPool = {}, HttpFileSystem._versionDBStatus = 0, 
                HttpFileSystem;
            }();
            system.HttpFileSystem = HttpFileSystem;
        }(background.system || (background.system = {}));
    }(base.background || (base.background = {}));
}(base || (base = {})), function(base) {
    !function(background) {
        var HttpFileSystem = base.background.system.HttpFileSystem, IndexedDBCache = base.background.system.IndexedDBCache, ArrayUtils = utils.ArrayUtils, StringUtils = utils.StringUtils, ForwardActor = function() {
            function ForwardActor(core) {
                var _this = this;
                this._core = core, this._forwardHandlers = [], core.registerOpcode(background.DecodeCommand.opcode, background.DecodeCommand), 
                core.registerOpcode(background.DecodeCompleteCommand.opcode, background.DecodeCompleteCommand), 
                core.addCommandHandler(background.DecodeCompleteCommand.opcode, function(command) {
                    null == command.bytes && console.error("解析图片" + command.url + "出错，当前图片为交错类型！"), 
                    _this.onComplete(command.url, null == command.bytes ? -1 : 0, command.bytes);
                });
            }
            return ForwardActor.prototype.registerOpcode = function(type, command) {
                this._core.registerOpcode(type, command);
            }, ForwardActor.prototype.addCommandHandler = function(type, handler) {
                if (background.LoadCompleteCommand.opcode == type) {
                    var handlers = this._forwardHandlers;
                    if (-1 != handlers.indexOf(handler)) return;
                    handlers.push(handler);
                } else this._core.addCommandHandler(type, handler);
            }, ForwardActor.prototype.removeCommandHandler = function(type, handler) {
                if (background.LoadCompleteCommand.opcode == type) {
                    var handlers = this._forwardHandlers;
                    ArrayUtils.remove(handlers, handler);
                } else this._core.removeCommandHandler(type, handler);
            }, ForwardActor.prototype.sendCommand = function(command) {
                var _this = this;
                if (command.type() == background.LoadCommand.opcode) {
                    var loadCommand = command, uncompress_1 = loadCommand.uncompress;
                    HttpFileSystem.read(loadCommand.url, uncompress_1, function(url, status, buffer, args) {
                        if (null != buffer) switch (uncompress_1) {
                          case 1:
                            var command_1 = new background.DecodeCommand();
                            return command_1.url = url, command_1.uncompress = uncompress_1, command_1.content = [ buffer ], 
                            void _this._core.sendCommand(command_1);

                          default:
                            var name_1 = url.toLowerCase();
                            if (HttpFileSystem.enableRaw && (StringUtils.endsWith(name_1, ".png") || StringUtils.endsWith(name_1, ".jpg")) || StringUtils.endsWith(name_1, ".til")) {
                                var command_2 = new background.DecodeCommand();
                                return command_2.url = url, command_2.uncompress = uncompress_1, command_2.content = [ buffer ], 
                                void _this._core.sendCommand(command_2);
                            }
                        } else if (null != args && 0 != args.length) {
                            var command_3 = new background.DecodeCommand();
                            return command_3.url = url, command_3.uncompress = uncompress_1, command_3.content = args, 
                            void _this._core.sendCommand(command_3);
                        }
                        _this.onComplete(url, status, buffer);
                    });
                } else command.type() == background.InitCommand.opcode && this.initSystem(command), 
                this._core.sendCommand(command);
            }, ForwardActor.prototype.initSystem = function(command) {
                var enableCheck = command.enableCheck, host = command.host;
                IndexedDBCache.initCache(command.enableCache, function(success) {
                    HttpFileSystem.init(host, enableCheck, success, function(status) {});
                });
            }, ForwardActor.prototype.onComplete = function(url, status, buffer) {
                var command = new background.LoadCompleteCommand();
                command.url = url, command.status = status, command.bytes = buffer;
                for (var handlers = this._forwardHandlers, i = 0, length_5 = handlers.length; i < length_5; ++i) handlers[i](command);
            }, ForwardActor;
        }();
        background.ForwardActor = ForwardActor;
    }(base.background || (base.background = {}));
}(base || (base = {})), function(utils) {
    var ByteStream = function() {
        function ByteStream() {}
        return ByteStream.prototype.bytesAvailable = function() {
            return this.length - this.cursor;
        }, ByteStream.prototype.getUint8 = function() {
            return this.input[this.cursor++];
        }, ByteStream.prototype.getUint16 = function() {
            var result = this.view.getUint16(this.cursor, this.littleEndian);
            return this.cursor += 2, result;
        }, ByteStream.prototype.getUint32 = function() {
            var result = this.view.getUint32(this.cursor, this.littleEndian);
            return this.cursor += 4, result;
        }, ByteStream.prototype.getUTF = function(size) {
            for (var result = new Array(size), i = 0; i < size; ++i) result[i] = String.fromCharCode(this.input[this.cursor++]);
            return result.join("");
        }, ByteStream.prototype.getBytes = function(size) {
            var result = new Uint8Array(this.input.buffer, this.input.byteOffset + this.cursor, size);
            return this.cursor += size, result;
        }, ByteStream.prototype.skip = function(size) {
            this.cursor += size;
        }, ByteStream.prototype.open = function(input, littleEndian) {
            void 0 === littleEndian && (littleEndian = !1), this.cursor = 0, this.length = input.byteLength, 
            this.input = input, this.view = new DataView(input.buffer), this.littleEndian = littleEndian;
        }, ByteStream.prototype.close = function() {
            this.input = null, this.view = null;
        }, ByteStream;
    }();
    utils.ByteStream = ByteStream;
}(utils || (utils = {})), function(base) {
    !function(background) {
        !function(routine) {
            var ByteStream = utils.ByteStream, PngFileEntry = function() {
                function PngFileEntry() {
                    this.segments = [];
                }
                return PngFileEntry.allocEntry = function() {
                    var result;
                    return null != PngFileEntry._freeEntry ? (result = this._freeEntry, this._freeEntry = this._freeEntry.next) : result = new PngFileEntry(), 
                    result;
                }, PngFileEntry.freeEntry = function(entry) {
                    entry.next = this._freeEntry, (PngFileEntry._freeEntry = entry).palette = null, 
                    entry.segments.length = 0, entry.transparency = null;
                }, PngFileEntry;
            }(), PngDecoder = function() {
                function PngDecoder() {}
                return PngDecoder.init = function() {
                    PngDecoder.sectionHandlers = {
                        IHDR: PngDecoder.handlerIHDR,
                        PLTE: PngDecoder.handlerPLTE,
                        IDAT: PngDecoder.handlerIDAT,
                        tRNS: PngDecoder.handlerTRNS
                    };
                }, PngDecoder.handlerIHDR = function(entry, stream, chunkSize) {
                    entry.width = stream.getUint32(), entry.height = stream.getUint32(), entry.bits = stream.getUint8(), 
                    entry.colorType = stream.getUint8(), entry.compressionMethod = stream.getUint8(), 
                    entry.filterMethod = stream.getUint8(), entry.interlaceMethod = stream.getUint8();
                }, PngDecoder.handlerPLTE = function(entry, stream, chunkSize) {
                    entry.palette = stream.getBytes(chunkSize);
                }, PngDecoder.handlerIDAT = function(entry, stream, chunkSize) {
                    entry.segments.push(stream.getBytes(chunkSize));
                }, PngDecoder.handlerTRNS = function(entry, stream, chunkSize) {
                    entry.transparency = stream.getBytes(chunkSize);
                }, PngDecoder.handlerICCP = function(entry, stream, chunkSize) {
                    for (var pos = stream.cursor, codes = [], code = stream.getUint8(); codes.push(String.fromCharCode(code)), 
                    0 != (code = stream.getUint8()); ) ;
                    codes.join(""), stream.getUint8();
                    var length = chunkSize - (stream.cursor - pos);
                    stream.getBytes(length);
                }, PngDecoder.decodePalette = function(entry) {
                    for (var palette = entry.palette, transparency = entry.transparency, length = palette.length, result = new Uint8Array(length / 3 * 4), offset = 0, cursor = 0, size = transparency.byteLength, index = 0; offset < length; ) result[cursor++] = palette[offset++], 
                    result[cursor++] = palette[offset++], result[cursor++] = palette[offset++], result[cursor++] = index < size ? transparency[index++] : 255;
                    return result;
                }, PngDecoder.mergeSegments = function(segments) {
                    for (var byteLength = 0, _i = 0, segments_1 = segments; _i < segments_1.length; _i++) {
                        byteLength += (segment = segments_1[_i]).byteLength;
                    }
                    for (var bytes = new Uint8Array(byteLength), offset = 0, _a = 0, segments_2 = segments; _a < segments_2.length; _a++) {
                        var segment = segments_2[_a];
                        bytes.set(segment, offset), offset += segment.length;
                    }
                    return new Zlib.Inflate(bytes).decompress();
                }, PngDecoder.calcPixelBytes = function(entry) {
                    var channels = 3;
                    return 4 & entry.colorType && (channels = 4), 3 == entry.colorType && entry.transparency && (channels = 4), 
                    channels;
                }, PngDecoder.calcIndexBytes = function(entry) {
                    var channels = 1;
                    switch (entry.colorType) {
                      case 2:
                        channels = 3;
                        break;

                      case 4:
                        channels = 2;
                        break;

                      case 6:
                        channels = 4;
                    }
                    return 7 + channels * entry.bits >> 3;
                }, PngDecoder.decodePixels = function(entry) {
                    return 0 == entry.interlaceMethod ? this.notInterlaceMethod(entry) : null;
                }, PngDecoder.notInterlaceMethod = function(entry) {
                    for (var bytes = PngDecoder.mergeSegments(entry.segments), length = bytes.byteLength, height = entry.height, pixelBytes = PngDecoder.calcIndexBytes(entry), rowBytes = Math.floor((length - height) / height), rowOffset = rowBytes + 1, i = 0, cursor = 0, a = 0, b = 0, c = 0, p = 0, pa = 0, pb = 0, pc = 0, pr = 0; cursor < length; ) switch (bytes[cursor++]) {
                      case 0:
                        cursor += rowBytes;
                        break;

                      case 1:
                        for (cursor += pixelBytes, i = pixelBytes; i < rowBytes; ++i, ++cursor) bytes[cursor] = (bytes[cursor] + bytes[cursor - pixelBytes]) % 256;
                        break;

                      case 2:
                        if (1 != cursor) for (i = 0; i < rowBytes; ++i, ++cursor) bytes[cursor] = (bytes[cursor] + bytes[cursor - rowOffset]) % 256;
                        break;

                      case 3:
                        if (1 == cursor) for (cursor += pixelBytes, i = pixelBytes; i < rowBytes; ++i, ++cursor) bytes[cursor] = (bytes[cursor] + (bytes[cursor - pixelBytes] >> 1)) % 256; else {
                            for (i = 0; i < pixelBytes; ++i, ++cursor) bytes[cursor] = (bytes[cursor] + (bytes[cursor - rowOffset] >> 1)) % 256;
                            for (i = pixelBytes; i < rowBytes; ++i, ++cursor) bytes[cursor] = (bytes[cursor] + (bytes[cursor - pixelBytes] + bytes[cursor - rowOffset] >> 1)) % 256;
                        }
                        break;

                      case 4:
                        if (1 == pixelBytes) if (1 == cursor) for (a = bytes[cursor++], i = 1; i < rowBytes; ++i, 
                        ++cursor) pr = 0 < a ? a : 0, a = bytes[cursor] = (bytes[cursor] + pr) % 256; else for ((pa = p = b = bytes[cursor - rowOffset]) < 0 && (pa = -pa), 
                        (pc = p) < 0 && (pc = -pc), pr = p <= 0 ? 0 : 0 <= pc ? b : 0, a = bytes[cursor] = bytes[cursor] + pr, 
                        cursor++, i = 1; i < rowBytes; ++i, ++cursor) (pa = (p = a + (b = bytes[cursor - rowOffset]) - (c = bytes[cursor - rowOffset - 1])) - a) < 0 && (pa = -pa), 
                        (pb = p - b) < 0 && (pb = -pb), (pc = p - c) < 0 && (pc = -pc), pr = pa <= pb && pa <= pc ? a : pb <= pc ? b : c, 
                        a = bytes[cursor] = (bytes[cursor] + pr) % 256; else if (1 == cursor) for (cursor += pixelBytes, 
                        b = c = 0, i = pixelBytes; i < rowBytes; ++i, ++cursor) (pa = (p = (a = bytes[cursor - pixelBytes]) + b - c) - a) < 0 && (pa = -pa), 
                        (pb = p - b) < 0 && (pb = -pb), (pc = p - c) < 0 && (pc = -pc), pr = pa <= pb && pa <= pc ? a : pb <= pc ? b : c, 
                        bytes[cursor] = (bytes[cursor] + pr) % 256; else {
                            for (i = 0; i < pixelBytes; ++i, ++cursor) (pa = (p = (a = 0) + (b = bytes[cursor - rowOffset]) - (c = 0)) - a) < 0 && (pa = -pa), 
                            (pb = p - b) < 0 && (pb = -pb), (pc = p - c) < 0 && (pc = -pc), pr = pa <= pb && pa <= pc ? a : pb <= pc ? b : c, 
                            bytes[cursor] = (bytes[cursor] + pr) % 256;
                            for (i = pixelBytes; i < rowBytes; ++i, ++cursor) (pa = (p = (a = bytes[cursor - pixelBytes]) + (b = bytes[cursor - rowOffset]) - (c = bytes[cursor - rowOffset - pixelBytes])) - a) < 0 && (pa = -pa), 
                            (pb = p - b) < 0 && (pb = -pb), (pc = p - c) < 0 && (pc = -pc), pr = pa <= pb && pa <= pc ? a : pb <= pc ? b : c, 
                            bytes[cursor] = (bytes[cursor] + pr) % 256;
                        }
                        break;

                      default:
                        console.log("解析出错：" + entry.width + ", " + entry.height + ", " + pixelBytes), console.log(bytes.byteLength);
                    }
                    return bytes;
                }, PngDecoder.decode = function(data) {
                    var entry = PngFileEntry.allocEntry(), stream = new ByteStream();
                    for (stream.open(data), stream.skip(8); 0 < stream.bytesAvailable(); ) {
                        var chunkSize = stream.getUint32(), section = stream.getUTF(4), handler = PngDecoder.sectionHandlers[section];
                        null != handler ? handler(entry, stream, chunkSize) : stream.skip(chunkSize);
                        stream.getUint32();
                    }
                    stream.close();
                    var pixels = PngDecoder.decodePixels(entry);
                    if (null == pixels) return null;
                    var cursor = 0, offset = 0, width = entry.width, height = entry.height, buffer = new ArrayBuffer(width * height * PngDecoder.calcPixelBytes(entry) + 8), result = new Uint8Array(buffer, 8), view = new DataView(buffer, 0, 8);
                    switch (view.setUint32(0, width), view.setUint32(4, height), entry.colorType) {
                      case 3:
                        PngDecoder.fromPalette(entry, pixels, result);
                        break;

                      case 2:
                        switch (entry.bits) {
                          case 8:
                            for (var y = 0; y < height; ++y) {
                                offset++;
                                for (var x = 0; x < width; ++x) result[cursor++] = pixels[offset++], result[cursor++] = pixels[offset++], 
                                result[cursor++] = pixels[offset++];
                            }
                            break;

                          case 16:
                            for (y = 0; y < height; ++y) {
                                offset++;
                                for (x = 0; x < width; ++x) result[cursor++] = (pixels[offset] << 8 | pixels[offset + 1]) / 65535 * 255, 
                                offset += 2, result[cursor++] = (pixels[offset] << 8 | pixels[offset + 1]) / 65535 * 255, 
                                offset += 2, result[cursor++] = (pixels[offset] << 8 | pixels[offset + 1]) / 65535 * 255, 
                                offset += 2;
                            }
                        }
                        break;

                      case 6:
                        switch (entry.bits) {
                          case 8:
                            for (y = 0; y < height; ++y) {
                                offset++;
                                for (x = 0; x < width; ++x) result[cursor++] = pixels[offset++], result[cursor++] = pixels[offset++], 
                                result[cursor++] = pixels[offset++], result[cursor++] = pixels[offset++];
                            }
                            break;

                          case 16:
                            for (y = 0; y < height; ++y) {
                                offset++;
                                for (x = 0; x < width; ++x) result[cursor++] = (pixels[offset] << 8 | pixels[offset + 1]) / 65535 * 255, 
                                offset += 2, result[cursor++] = (pixels[offset] << 8 | pixels[offset + 1]) / 65535 * 255, 
                                offset += 2, result[cursor++] = (pixels[offset] << 8 | pixels[offset + 1]) / 65535 * 255, 
                                offset += 2, result[cursor++] = (pixels[offset] << 8 | pixels[offset + 1]) / 65535 * 255, 
                                offset += 2;
                            }
                        }
                        break;

                      default:
                        console.error("未支持的类型：" + entry.colorType + ", " + entry.bits);
                    }
                    return PngFileEntry.freeEntry(entry), buffer;
                }, PngDecoder.fromPalette = function(entry, pixels, result) {
                    var cursor = 0, offset = 0, width = entry.width, height = entry.height, palette = entry.palette;
                    if (null != entry.transparency) switch (palette = PngDecoder.decodePalette(entry), 
                    entry.bits) {
                      case 1:
                        for (var y = 0; y < height; ++y) {
                            offset++;
                            for (var x = 0; x < width; ++x) {
                                var index = 4 * (1 & pixels[offset + (x >> 3)]);
                                result[cursor++] = palette[index], result[cursor++] = palette[index + 1], result[cursor++] = palette[index + 2], 
                                result[cursor++] = palette[index + 3];
                            }
                            offset += width + 7 >> 3;
                        }
                        break;

                      case 2:
                        for (y = 0; y < height; ++y) {
                            offset++;
                            for (x = 0; x < width; ++x) {
                                index = 4 * (3 & pixels[offset + (x >> 2)]);
                                result[cursor++] = palette[index], result[cursor++] = palette[index + 1], result[cursor++] = palette[index + 2], 
                                result[cursor++] = palette[index + 3];
                            }
                            offset += width + 3 >> 2;
                        }
                        break;

                      case 4:
                        for (y = 0; y < height; ++y) {
                            offset++;
                            for (x = 0; x < width; ++x) {
                                index = 4 * (15 & pixels[offset + (x >> 1)]);
                                result[cursor++] = palette[index], result[cursor++] = palette[index + 1], result[cursor++] = palette[index + 2], 
                                result[cursor++] = palette[index + 3];
                            }
                            offset += width + 1 >> 1;
                        }
                        break;

                      case 8:
                        for (y = 0; y < height; ++y) {
                            offset++;
                            for (x = 0; x < width; ++x) {
                                index = 4 * pixels[offset++];
                                result[cursor++] = palette[index], result[cursor++] = palette[index + 1], result[cursor++] = palette[index + 2], 
                                result[cursor++] = palette[index + 3];
                            }
                        }
                    } else switch (entry.bits) {
                      case 1:
                        for (y = 0; y < height; ++y) {
                            offset++;
                            for (x = 0; x < width; ++x) {
                                index = 3 * (1 & pixels[offset + (x >> 3)]);
                                result[cursor++] = palette[index], result[cursor++] = palette[index + 1], result[cursor++] = palette[index + 2];
                            }
                            offset += width + 7 >> 3;
                        }
                        break;

                      case 2:
                        for (y = 0; y < height; ++y) {
                            offset++;
                            for (x = 0; x < width; ++x) {
                                index = 3 * (3 & pixels[offset + (x >> 2)]);
                                result[cursor++] = palette[index], result[cursor++] = palette[index + 1], result[cursor++] = palette[index + 2];
                            }
                            offset += width + 3 >> 2;
                        }
                        break;

                      case 4:
                        for (y = 0; y < height; ++y) {
                            offset++;
                            for (x = 0; x < width; ++x) {
                                index = 3 * (15 & pixels[offset + (x >> 1)]);
                                result[cursor++] = palette[index], result[cursor++] = palette[index + 1], result[cursor++] = palette[index + 2];
                            }
                            offset += width + 1 >> 1;
                        }
                        break;

                      case 8:
                        for (y = 0; y < height; ++y) {
                            offset++;
                            for (x = 0; x < width; ++x) {
                                index = 3 * pixels[offset++];
                                result[cursor++] = palette[index], result[cursor++] = palette[index + 1], result[cursor++] = palette[index + 2];
                            }
                        }
                    }
                }, PngDecoder.sectionHandlers = {}, PngDecoder;
            }();
            routine.PngDecoder = PngDecoder;
        }(background.routine || (background.routine = {}));
    }(base.background || (base.background = {}));
}(base || (base = {}));

var DNLMarkerError = function() {
    function DNLMarkerError(message, scanLines) {
        this.message = message, this.scanLines = scanLines;
    }
    return (DNLMarkerError.prototype = new Error()).name = "DNLMarkerError", DNLMarkerError.constructor = DNLMarkerError;
}(), EOIMarkerError = function() {
    function EOIMarkerError(message) {
        this.message = message;
    }
    return (EOIMarkerError.prototype = new Error()).name = "EOIMarkerError", EOIMarkerError.constructor = EOIMarkerError;
}(), JpegImage = function() {
    var dctZigZag = new Uint8Array([ 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63 ]), dctCos1 = 4017, dctSin1 = 799, dctCos3 = 3406, dctSin3 = 2276, dctCos6 = 1567, dctSin6 = 3784, dctSqrt2 = 5793, dctSqrt1d2 = 2896;
    function JpegImage(_a) {
        var _b = void 0 === _a ? {} : _a, _c = _b.decodeTransform, decodeTransform = void 0 === _c ? null : _c, _d = _b.colorTransform, colorTransform = void 0 === _d ? -1 : _d;
        this._decodeTransform = decodeTransform, this._colorTransform = colorTransform;
    }
    function buildHuffmanTable(codeLengths, values) {
        for (var i, j, k = 0, code = [], length = 16; 0 < length && !codeLengths[length - 1]; ) length--;
        code.push({
            children: [],
            index: 0
        });
        var q, p = code[0];
        for (i = 0; i < length; i++) {
            for (j = 0; j < codeLengths[i]; j++) {
                for ((p = code.pop()).children[p.index] = values[k]; 0 < p.index; ) p = code.pop();
                for (p.index++, code.push(p); code.length <= i; ) code.push(q = {
                    children: [],
                    index: 0
                }), p.children[p.index] = q.children, p = q;
                k++;
            }
            i + 1 < length && (code.push(q = {
                children: [],
                index: 0
            }), p.children[p.index] = q.children, p = q);
        }
        return code[0].children;
    }
    function getBlockBufferOffset(component, row, col) {
        return 64 * ((component.blocksPerLine + 1) * row + col);
    }
    function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker) {
        void 0 === parseDNLMarker && (parseDNLMarker = !1);
        var mcusPerLine = frame.mcusPerLine, progressive = frame.progressive, startOffset = offset, bitsData = 0, bitsCount = 0;
        function readBit() {
            if (0 < bitsCount) return bitsData >> --bitsCount & 1;
            if (255 === (bitsData = data[offset++])) {
                var nextByte = data[offset++];
                if (nextByte) {
                    if (220 === nextByte && parseDNLMarker) {
                        offset += 2;
                        var scanLines = data[offset++] << 8 | data[offset++];
                        if (0 < scanLines && scanLines !== frame.scanLines) throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
                    } else if (217 === nextByte) throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
                    throw new Error("unexpected marker " + (bitsData << 8 | nextByte).toString(16));
                }
            }
            return bitsData >>> (bitsCount = 7);
        }
        function decodeHuffman(tree) {
            for (var node = tree; ;) {
                if ("number" == typeof (node = node[readBit()])) return node;
                if ("object" != typeof node) throw new Error("invalid huffman sequence");
            }
        }
        function receive(length) {
            for (var n = 0; 0 < length; ) n = n << 1 | readBit(), length--;
            return n;
        }
        function receiveAndExtend(length) {
            if (1 === length) return 1 === readBit() ? 1 : -1;
            var n = receive(length);
            return 1 << length - 1 <= n ? n : n + (-1 << length) + 1;
        }
        var eobrun = 0;
        var successiveACNextValue, successiveACState = 0;
        function decodeMcu(component, decode, mcu, row, col) {
            var mcuCol = mcu % mcusPerLine;
            decode(component, getBlockBufferOffset(component, (mcu / mcusPerLine | 0) * component.v + row, mcuCol * component.h + col));
        }
        function decodeBlock(component, decode, mcu) {
            decode(component, getBlockBufferOffset(component, mcu / component.blocksPerLine | 0, mcu % component.blocksPerLine));
        }
        var component, i, j, k, n, decodeFn, componentsLength = components.length;
        decodeFn = progressive ? 0 === spectralStart ? 0 === successivePrev ? function(component, offset) {
            var t = decodeHuffman(component.huffmanTableDC), diff = 0 === t ? 0 : receiveAndExtend(t) << successive;
            component.blockData[offset] = component.pred += diff;
        } : function(component, offset) {
            component.blockData[offset] |= readBit() << successive;
        } : 0 === successivePrev ? function(component, offset) {
            if (0 < eobrun) eobrun--; else for (var k = spectralStart, e = spectralEnd; k <= e; ) {
                var rs = decodeHuffman(component.huffmanTableAC), s = 15 & rs, r = rs >> 4;
                if (0 != s) {
                    var z = dctZigZag[k += r];
                    component.blockData[offset + z] = receiveAndExtend(s) * (1 << successive), k++;
                } else {
                    if (r < 15) {
                        eobrun = receive(r) + (1 << r) - 1;
                        break;
                    }
                    k += 16;
                }
            }
        } : function(component, offset) {
            for (var s, rs, k = spectralStart, e = spectralEnd, r = 0; k <= e; ) {
                var offsetZ = offset + dctZigZag[k], sign = component.blockData[offsetZ] < 0 ? -1 : 1;
                switch (successiveACState) {
                  case 0:
                    if (r = (rs = decodeHuffman(component.huffmanTableAC)) >> 4, 0 == (s = 15 & rs)) successiveACState = r < 15 ? (eobrun = receive(r) + (1 << r), 
                    4) : (r = 16, 1); else {
                        if (1 != s) throw new Error("invalid ACn encoding");
                        successiveACNextValue = receiveAndExtend(s), successiveACState = r ? 2 : 3;
                    }
                    continue;

                  case 1:
                  case 2:
                    component.blockData[offsetZ] ? component.blockData[offsetZ] += sign * (readBit() << successive) : 0 == --r && (successiveACState = 2 === successiveACState ? 3 : 0);
                    break;

                  case 3:
                    component.blockData[offsetZ] ? component.blockData[offsetZ] += sign * (readBit() << successive) : (component.blockData[offsetZ] = successiveACNextValue << successive, 
                    successiveACState = 0);
                    break;

                  case 4:
                    component.blockData[offsetZ] && (component.blockData[offsetZ] += sign * (readBit() << successive));
                }
                k++;
            }
            4 === successiveACState && 0 == --eobrun && (successiveACState = 0);
        } : function(component, offset) {
            var t = decodeHuffman(component.huffmanTableDC), diff = 0 === t ? 0 : receiveAndExtend(t);
            component.blockData[offset] = component.pred += diff;
            for (var k = 1; k < 64; ) {
                var rs = decodeHuffman(component.huffmanTableAC), s = 15 & rs, r = rs >> 4;
                if (0 != s) {
                    var z = dctZigZag[k += r];
                    component.blockData[offset + z] = receiveAndExtend(s), k++;
                } else {
                    if (r < 15) break;
                    k += 16;
                }
            }
        };
        var fileMarker, mcuExpected, h, v, mcu = 0;
        for (mcuExpected = 1 === componentsLength ? components[0].blocksPerLine * components[0].blocksPerColumn : mcusPerLine * frame.mcusPerColumn; mcu < mcuExpected; ) {
            var mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
            for (i = 0; i < componentsLength; i++) components[i].pred = 0;
            if (eobrun = 0, 1 === componentsLength) for (component = components[0], n = 0; n < mcuToRead; n++) decodeBlock(component, decodeFn, mcu), 
            mcu++; else for (n = 0; n < mcuToRead; n++) {
                for (i = 0; i < componentsLength; i++) for (h = (component = components[i]).h, v = component.v, 
                j = 0; j < v; j++) for (k = 0; k < h; k++) decodeMcu(component, decodeFn, mcu, j, k);
                mcu++;
            }
            bitsCount = 0, (fileMarker = findNextFileMarker(data, offset)) && fileMarker.invalid && (warn("decodeScan - unexpected MCU data, current marker is: " + fileMarker.invalid), 
            offset = fileMarker.offset);
            var marker = fileMarker && fileMarker.marker;
            if (!marker || marker <= 65280) throw new Error("marker was not found");
            if (!(65488 <= marker && marker <= 65495)) break;
            offset += 2;
        }
        return (fileMarker = findNextFileMarker(data, offset)) && fileMarker.invalid && (warn("decodeScan - unexpected Scan data, current marker is: " + fileMarker.invalid), 
        offset = fileMarker.offset), offset - startOffset;
    }
    function quantizeAndInverse(component, blockBufferOffset, p) {
        var v0, v1, v2, v3, v4, v5, v6, v7, p0, p1, p2, p3, p4, p5, p6, p7, t, qt = component.quantizationTable, blockData = component.blockData;
        if (!qt) throw new Error("missing required Quantization Table.");
        for (var row = 0; row < 64; row += 8) p0 = blockData[blockBufferOffset + row], p1 = blockData[blockBufferOffset + row + 1], 
        p2 = blockData[blockBufferOffset + row + 2], p3 = blockData[blockBufferOffset + row + 3], 
        p4 = blockData[blockBufferOffset + row + 4], p5 = blockData[blockBufferOffset + row + 5], 
        p6 = blockData[blockBufferOffset + row + 6], p7 = blockData[blockBufferOffset + row + 7], 
        p0 *= qt[row], 0 != (p1 | p2 | p3 | p4 | p5 | p6 | p7) ? (p1 *= qt[row + 1], p2 *= qt[row + 2], 
        p3 *= qt[row + 3], p4 *= qt[row + 4], p5 *= qt[row + 5], p6 *= qt[row + 6], p7 *= qt[row + 7], 
        v1 = (v0 = (v0 = dctSqrt2 * p0 + 128 >> 8) + (v1 = dctSqrt2 * p4 + 128 >> 8) + 1 >> 1) - v1, 
        t = (v2 = p2) * dctSin6 + (v3 = p6) * dctCos6 + 128 >> 8, v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8, 
        v6 = (v4 = (v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8) + (v6 = p5 << 4) + 1 >> 1) - v6, 
        v5 = (v7 = (v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8) + (v5 = p3 << 4) + 1 >> 1) - v5, 
        v3 = (v0 = v0 + (v3 = t) + 1 >> 1) - v3, v2 = (v1 = v1 + v2 + 1 >> 1) - v2, t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12, 
        v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12, v7 = t, t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12, 
        v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12, v6 = t, p[row] = v0 + v7, p[row + 7] = v0 - v7, 
        p[row + 1] = v1 + v6, p[row + 6] = v1 - v6, p[row + 2] = v2 + v5, p[row + 5] = v2 - v5, 
        p[row + 3] = v3 + v4, p[row + 4] = v3 - v4) : (t = dctSqrt2 * p0 + 512 >> 10, p[row] = t, 
        p[row + 1] = t, p[row + 2] = t, p[row + 3] = t, p[row + 4] = t, p[row + 5] = t, 
        p[row + 6] = t, p[row + 7] = t);
        for (var col = 0; col < 8; ++col) p0 = p[col], 0 != ((p1 = p[col + 8]) | (p2 = p[col + 16]) | (p3 = p[col + 24]) | (p4 = p[col + 32]) | (p5 = p[col + 40]) | (p6 = p[col + 48]) | (p7 = p[col + 56])) ? (v1 = (v0 = 4112 + ((v0 = dctSqrt2 * p0 + 2048 >> 12) + (v1 = dctSqrt2 * p4 + 2048 >> 12) + 1 >> 1)) - v1, 
        t = (v2 = p2) * dctSin6 + (v3 = p6) * dctCos6 + 2048 >> 12, v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12, 
        v3 = t, v6 = (v4 = (v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12) + (v6 = p5) + 1 >> 1) - v6, 
        v5 = (v7 = (v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12) + (v5 = p3) + 1 >> 1) - v5, 
        t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12, v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12, 
        v7 = t, t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12, v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12, 
        p0 = (p0 = (v0 = v0 + v3 + 1 >> 1) + v7) < 16 ? 0 : 4080 <= p0 ? 255 : p0 >> 4, 
        p1 = (p1 = (v1 = v1 + v2 + 1 >> 1) + (v6 = t)) < 16 ? 0 : 4080 <= p1 ? 255 : p1 >> 4, 
        p2 = (p2 = (v2 = v1 - v2) + v5) < 16 ? 0 : 4080 <= p2 ? 255 : p2 >> 4, p3 = (p3 = (v3 = v0 - v3) + v4) < 16 ? 0 : 4080 <= p3 ? 255 : p3 >> 4, 
        p4 = (p4 = v3 - v4) < 16 ? 0 : 4080 <= p4 ? 255 : p4 >> 4, p5 = (p5 = v2 - v5) < 16 ? 0 : 4080 <= p5 ? 255 : p5 >> 4, 
        p6 = (p6 = v1 - v6) < 16 ? 0 : 4080 <= p6 ? 255 : p6 >> 4, p7 = (p7 = v0 - v7) < 16 ? 0 : 4080 <= p7 ? 255 : p7 >> 4, 
        blockData[blockBufferOffset + col] = p0, blockData[blockBufferOffset + col + 8] = p1, 
        blockData[blockBufferOffset + col + 16] = p2, blockData[blockBufferOffset + col + 24] = p3, 
        blockData[blockBufferOffset + col + 32] = p4, blockData[blockBufferOffset + col + 40] = p5, 
        blockData[blockBufferOffset + col + 48] = p6, blockData[blockBufferOffset + col + 56] = p7) : (t = (t = dctSqrt2 * p0 + 8192 >> 14) < -2040 ? 0 : 2024 <= t ? 255 : t + 2056 >> 4, 
        blockData[blockBufferOffset + col] = t, blockData[blockBufferOffset + col + 8] = t, 
        blockData[blockBufferOffset + col + 16] = t, blockData[blockBufferOffset + col + 24] = t, 
        blockData[blockBufferOffset + col + 32] = t, blockData[blockBufferOffset + col + 40] = t, 
        blockData[blockBufferOffset + col + 48] = t, blockData[blockBufferOffset + col + 56] = t);
    }
    function buildComponentData(frame, component) {
        for (var blocksPerLine = component.blocksPerLine, blocksPerColumn = component.blocksPerColumn, computationBuffer = new Int16Array(64), blockRow = 0; blockRow < blocksPerColumn; blockRow++) for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
            quantizeAndInverse(component, getBlockBufferOffset(component, blockRow, blockCol), computationBuffer);
        }
        return component.blockData;
    }
    function findNextFileMarker(data, currentPos, startPos) {
        function peekUint16(pos) {
            return data[pos] << 8 | data[pos + 1];
        }
        void 0 === startPos && (startPos = currentPos);
        var maxPos = data.length - 1, newPos = startPos < currentPos ? startPos : currentPos;
        if (maxPos <= currentPos) return null;
        var currentMarker = peekUint16(currentPos);
        if (65472 <= currentMarker && currentMarker <= 65534) return {
            invalid: null,
            marker: currentMarker,
            offset: currentPos
        };
        for (var newMarker = peekUint16(newPos); !(65472 <= newMarker && newMarker <= 65534); ) {
            if (++newPos >= maxPos) return null;
            newMarker = peekUint16(newPos);
        }
        return {
            invalid: currentMarker.toString(16),
            marker: newMarker,
            offset: newPos
        };
    }
    return JpegImage.prototype = {
        width: 0,
        height: 0,
        parse: function(data, _a) {
            var _b = (void 0 === _a ? {} : _a).dnlScanLines, dnlScanLines = void 0 === _b ? null : _b;
            function readUint16() {
                var value = data[offset] << 8 | data[offset + 1];
                return offset += 2, value;
            }
            function readDataBlock() {
                var length = readUint16(), endOffset = offset + length - 2, fileMarker = findNextFileMarker(data, endOffset, offset);
                fileMarker && fileMarker.invalid && (warn("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid), 
                endOffset = fileMarker.offset);
                var array = data.subarray(offset, endOffset);
                return offset += array.length, array;
            }
            function prepareComponents(frame) {
                for (var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH), mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV), i = 0; i < frame.components.length; i++) {
                    component = frame.components[i];
                    var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH), blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV), blocksPerLineForMcu = mcusPerLine * component.h, blocksBufferSize = 64 * (mcusPerColumn * component.v) * (1 + blocksPerLineForMcu);
                    component.blockData = new Int16Array(blocksBufferSize), component.blocksPerLine = blocksPerLine, 
                    component.blocksPerColumn = blocksPerColumn;
                }
                frame.mcusPerLine = mcusPerLine, frame.mcusPerColumn = mcusPerColumn;
            }
            var frame, resetInterval, offset = 0, jfif = null, adobe = null, numSOSMarkers = 0, quantizationTables = [], huffmanTablesAC = [], huffmanTablesDC = [], fileMarker = readUint16();
            if (65496 !== fileMarker) throw new Error("SOI not found");
            fileMarker = readUint16();
            markerLoop: for (;65497 !== fileMarker; ) {
                var i, j, l;
                switch (fileMarker) {
                  case 65504:
                  case 65505:
                  case 65506:
                  case 65507:
                  case 65508:
                  case 65509:
                  case 65510:
                  case 65511:
                  case 65512:
                  case 65513:
                  case 65514:
                  case 65515:
                  case 65516:
                  case 65517:
                  case 65518:
                  case 65519:
                  case 65534:
                    var appData = readDataBlock();
                    65504 === fileMarker && 74 === appData[0] && 70 === appData[1] && 73 === appData[2] && 70 === appData[3] && 0 === appData[4] && (jfif = {
                        version: {
                            major: appData[5],
                            minor: appData[6]
                        },
                        densityUnits: appData[7],
                        xDensity: appData[8] << 8 | appData[9],
                        yDensity: appData[10] << 8 | appData[11],
                        thumbWidth: appData[12],
                        thumbHeight: appData[13],
                        thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
                    }), 65518 === fileMarker && 65 === appData[0] && 100 === appData[1] && 111 === appData[2] && 98 === appData[3] && 101 === appData[4] && (adobe = {
                        version: appData[5] << 8 | appData[6],
                        flags0: appData[7] << 8 | appData[8],
                        flags1: appData[9] << 8 | appData[10],
                        transformCode: appData[11]
                    });
                    break;

                  case 65499:
                    for (var quantizationTablesEnd = readUint16() + offset - 2; offset < quantizationTablesEnd; ) {
                        var quantizationTableSpec = data[offset++], tableData = new Uint16Array(64);
                        if (quantizationTableSpec >> 4 == 0) for (j = 0; j < 64; j++) tableData[dctZigZag[j]] = data[offset++]; else {
                            if (quantizationTableSpec >> 4 != 1) throw new Error("DQT - invalid table spec");
                            for (j = 0; j < 64; j++) tableData[dctZigZag[j]] = readUint16();
                        }
                        quantizationTables[15 & quantizationTableSpec] = tableData;
                    }
                    break;

                  case 65472:
                  case 65473:
                  case 65474:
                    if (frame) throw new Error("Only single frame JPEGs supported");
                    readUint16(), (frame = {}).extended = 65473 === fileMarker, frame.progressive = 65474 === fileMarker, 
                    frame.precision = data[offset++];
                    var sofScanLines = readUint16();
                    frame.scanLines = dnlScanLines || sofScanLines, frame.samplesPerLine = readUint16(), 
                    frame.components = [], frame.componentIds = {};
                    var componentId, componentsCount = data[offset++], maxH = 0, maxV = 0;
                    for (i = 0; i < componentsCount; i++) {
                        componentId = data[offset];
                        var h = data[offset + 1] >> 4, v = 15 & data[offset + 1];
                        maxH < h && (maxH = h), maxV < v && (maxV = v);
                        var qId = data[offset + 2];
                        l = frame.components.push({
                            h: h,
                            v: v,
                            quantizationId: qId,
                            quantizationTable: null
                        }), frame.componentIds[componentId] = l - 1, offset += 3;
                    }
                    frame.maxH = maxH, frame.maxV = maxV, prepareComponents(frame);
                    break;

                  case 65476:
                    var huffmanLength = readUint16();
                    for (i = 2; i < huffmanLength; ) {
                        var huffmanTableSpec = data[offset++], codeLengths = new Uint8Array(16), codeLengthSum = 0;
                        for (j = 0; j < 16; j++, offset++) codeLengthSum += codeLengths[j] = data[offset];
                        var huffmanValues = new Uint8Array(codeLengthSum);
                        for (j = 0; j < codeLengthSum; j++, offset++) huffmanValues[j] = data[offset];
                        i += 17 + codeLengthSum, (huffmanTableSpec >> 4 == 0 ? huffmanTablesDC : huffmanTablesAC)[15 & huffmanTableSpec] = buildHuffmanTable(codeLengths, huffmanValues);
                    }
                    break;

                  case 65501:
                    readUint16(), resetInterval = readUint16();
                    break;

                  case 65498:
                    var parseDNLMarker = 1 == ++numSOSMarkers && !dnlScanLines;
                    readUint16();
                    var component, selectorsCount = data[offset++], components = [];
                    for (i = 0; i < selectorsCount; i++) {
                        var componentIndex = frame.componentIds[data[offset++]];
                        component = frame.components[componentIndex];
                        var tableSpec = data[offset++];
                        component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4], component.huffmanTableAC = huffmanTablesAC[15 & tableSpec], 
                        components.push(component);
                    }
                    var spectralStart = data[offset++], spectralEnd = data[offset++], successiveApproximation = data[offset++];
                    try {
                        var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, 15 & successiveApproximation, parseDNLMarker);
                        offset += processed;
                    } catch (ex) {
                        ex = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(ex);
                        if (ex instanceof DNLMarkerError) return warn(ex.message + " -- attempting to re-parse the JPEG image."), 
                        this.parse(data, {
                            dnlScanLines: ex.scanLines
                        });
                        if (ex instanceof EOIMarkerError) {
                            warn(ex.message + " -- ignoring the rest of the image data.");
                            break markerLoop;
                        }
                        throw ex;
                    }
                    break;

                  case 65500:
                    offset += 4;
                    break;

                  case 65535:
                    255 !== data[offset] && offset--;
                    break;

                  default:
                    if (255 === data[offset - 3] && 192 <= data[offset - 2] && data[offset - 2] <= 254) {
                        offset -= 3;
                        break;
                    }
                    var nextFileMarker = findNextFileMarker(data, offset - 2);
                    if (nextFileMarker && nextFileMarker.invalid) {
                        warn("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid), 
                        offset = nextFileMarker.offset;
                        break;
                    }
                    throw new Error("unknown marker " + fileMarker.toString(16));
                }
                fileMarker = readUint16();
            }
            for (this.width = frame.samplesPerLine, this.height = frame.scanLines, this.jfif = jfif, 
            this.adobe = adobe, this.components = [], i = 0; i < frame.components.length; i++) {
                var quantizationTable = quantizationTables[(component = frame.components[i]).quantizationId];
                quantizationTable && (component.quantizationTable = quantizationTable), this.components.push({
                    output: buildComponentData(0, component),
                    scaleX: component.h / frame.maxH,
                    scaleY: component.v / frame.maxV,
                    blocksPerLine: component.blocksPerLine,
                    blocksPerColumn: component.blocksPerColumn
                });
            }
            this.numComponents = this.components.length;
        },
        _getLinearizedBlockData: function(width, height, reserved, alphaChannel) {
            void 0 === reserved && (reserved = 0), void 0 === alphaChannel && (alphaChannel = null);
            var component, componentScaleX, componentScaleY, blocksPerScanline, x, y, i, j, k, index, output, scaleX = this.width / width, scaleY = this.height / height, offset = 0, numComponents = this.components.length, rowBytes = width * numComponents, needAlpha = null != alphaChannel;
            3 == numComponents && (rowBytes = needAlpha ? 4 * width : 4 * (rowBytes + 3 >> 2));
            var dataLength = rowBytes * height, result = new ArrayBuffer(dataLength + reserved), data = new Uint8ClampedArray(result, reserved), xScaleBlockOffset = new Uint32Array(width), step = needAlpha ? 4 : numComponents;
            for (i = 0; i < numComponents; i++) {
                for (componentScaleX = (component = this.components[i]).scaleX * scaleX, componentScaleY = component.scaleY * scaleY, 
                output = component.output, blocksPerScanline = component.blocksPerLine + 1 << 3, 
                x = 0; x < width; x++) j = 0 | x * componentScaleX, xScaleBlockOffset[x] = (4294967288 & j) << 3 | 7 & j;
                for (y = 0; y < height; y++) for (index = blocksPerScanline * (4294967288 & (j = 0 | y * componentScaleY)) | (7 & j) << 3, 
                offset = rowBytes * y + i, x = 0; x < width; x++, offset += step) data[offset] = output[index + xScaleBlockOffset[x]];
            }
            if (needAlpha) for (offset = 3, k = y = 0; y < height; y++) for (x = 0; x < width; x++, 
            offset += 4) data[offset] = alphaChannel[k++];
            var transform = this._decodeTransform;
            if (4 !== numComponents || transform || (transform = new Int32Array([ -256, 255, -256, 255, -256, 255, -256, 255 ])), 
            transform) if (3 == numComponents && needAlpha) for (i = 0; i < dataLength; ) {
                for (k = j = 0; j < numComponents; j++, i++, k += 2) data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
                i++;
            } else for (i = 0; i < dataLength; ) for (k = j = 0; j < numComponents; j++, i++, 
            k += 2) data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
            return data;
        },
        get _isColorConversionNeeded() {
            return this.adobe ? !!this.adobe.transformCode : 3 === this.numComponents ? 0 !== this._colorTransform : 1 === this._colorTransform;
        },
        _convertYccToRgb: function(data, needAlpha, width, height) {
            for (var Y, Cb, Cr, step = needAlpha ? 4 : 3, rowBytes = 4 * (width * step + 3 >> 2), i = 0, y = 0; y < height; ++y) {
                i = rowBytes * y;
                for (var x = 0; x < width; ++x) Y = data[i], Cb = data[i + 1], Cr = data[i + 2], 
                data[i] = Y - 179.456 + 1.402 * Cr, data[i + 1] = Y + 135.459 - .344 * Cb - .714 * Cr, 
                data[i + 2] = Y - 226.816 + 1.772 * Cb, i += step;
            }
            return data;
        },
        _convertYcckToRgb: function(data) {
            for (var Y, Cb, Cr, k, offset = 0, i = 0, length = data.length; i < length; i += 4) Y = data[i], 
            Cb = data[i + 1], Cr = data[i + 2], k = data[i + 3], data[offset++] = Cb * (-660635669420364e-19 * Cb + .000437130475926232 * Cr - 54080610064599e-18 * Y + .00048449797120281 * k - .154362151871126) - 122.67195406894 + Cr * (-.000957964378445773 * Cr + .000817076911346625 * Y - .00477271405408747 * k + 1.53380253221734) + Y * (.000961250184130688 * Y - .00266257332283933 * k + .48357088451265) + k * (-.000336197177618394 * k + .484791561490776), 
            data[offset++] = 107.268039397724 + Cb * (219927104525741e-19 * Cb - .000640992018297945 * Cr + .000659397001245577 * Y + .000426105652938837 * k - .176491792462875) + Cr * (-.000778269941513683 * Cr + .00130872261408275 * Y + .000770482631801132 * k - .151051492775562) + Y * (.00126935368114843 * Y - .00265090189010898 * k + .25802910206845) + k * (-.000318913117588328 * k - .213742400323665), 
            data[offset++] = Cb * (-.000570115196973677 * Cb - 263409051004589e-19 * Cr + .0020741088115012 * Y - .00288260236853442 * k + .814272968359295) - 20.810012546947 + Cr * (-153496057440975e-19 * Cr - .000132689043961446 * Y + .000560833691242812 * k - .195152027534049) + Y * (.00174418132927582 * Y - .00255243321439347 * k + .116935020465145) + k * (-.000343531996510555 * k + .24165260232407);
            return data.subarray(0, offset);
        },
        _convertYcckToCmyk: function(data) {
            for (var Y, Cb, Cr, i = 0, length = data.length; i < length; i += 4) Y = data[i], 
            Cb = data[i + 1], Cr = data[i + 2], data[i] = 434.456 - Y - 1.402 * Cr, data[i + 1] = 119.541 - Y + .344 * Cb + .714 * Cr, 
            data[i + 2] = 481.816 - Y - 1.772 * Cb;
            return data;
        },
        _convertCmykToRgb: function(data) {
            for (var c, m, y, k, offset = 0, i = 0, length = data.length; i < length; i += 4) c = data[i] * (1 / 255), 
            m = data[i + 1] * (1 / 255), y = data[i + 2] * (1 / 255), k = data[i + 3] * (1 / 255), 
            data[offset++] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k - 285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y - 17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) - k * (21.86122147463605 * k + 189.48180835922747), 
            data[offset++] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k - 79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) - k * (20.737325471181034 * k + 187.80453709719578), 
            data[offset++] = 255 + c * (.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - .23883238689178934 * k - 14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (.03296041114873217 * y + 115.60384449646641 * k - 193.58209356861505) - k * (22.33816807309886 * k + 180.12613974708367);
            return data.subarray(0, offset);
        },
        getData: function(width, height, forceRGB, reserved, alphaChannel) {
            if (void 0 === forceRGB && (forceRGB = !1), void 0 === reserved && (reserved = 0), 
            void 0 === alphaChannel && (alphaChannel = null), 4 < this.numComponents) throw new Error("Unsupported color mode");
            var data = this._getLinearizedBlockData(width, height, reserved, alphaChannel);
            if (1 === this.numComponents && forceRGB) {
                var x, y, offset, rowBytes = 4 * (3 * width + 3 >> 2), rgbData = new Uint8ClampedArray(rowBytes * height), i = 0;
                for (y = 0; y < height; ++y) for (offset = y * rowBytes, x = 0; x < width; ++x) {
                    var grayColor = data[i++];
                    rgbData[offset++] = grayColor, rgbData[offset++] = grayColor, rgbData[offset++] = grayColor;
                }
                return rgbData;
            }
            if (3 === this.numComponents && this._isColorConversionNeeded) return this._convertYccToRgb(data, null != alphaChannel, width, height);
            if (4 === this.numComponents) {
                if (this._isColorConversionNeeded) return forceRGB ? this._convertYcckToRgb(data) : this._convertYcckToCmyk(data);
                if (forceRGB) return this._convertCmykToRgb(data);
            }
            return data;
        }
    }, JpegImage;
}(), base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, base, net, utils, utils, utils, utils, utils, utils, utils, utils, utils;

!function(base) {
    !function(background) {
        !function(routine) {
            !function(system) {
                var FileDecodeSystem = function() {
                    function FileDecodeSystem() {}
                    return FileDecodeSystem.init = function() {
                        routine.PngDecoder.init();
                    }, FileDecodeSystem.inflateBuffer = function(buffer) {
                        var data = new Zlib.Inflate(new Uint8Array(buffer)).decompress();
                        return data.buffer.slice(data.byteOffset, data.byteLength);
                    }, FileDecodeSystem.decodeImage = function(stream, alphaChannel) {
                        if (void 0 === alphaChannel && (alphaChannel = null), this.isPng(stream)) return routine.PngDecoder.decode(stream);
                        var p = new JpegImage();
                        p.parse(stream);
                        var w = p.width, h = p.height, data = p.getData(w, h, !0, 8, alphaChannel), view = new DataView(data.buffer);
                        return view.setUint32(0, w), view.setUint32(4, h), data.buffer;
                    }, FileDecodeSystem.isPng = function(buffer) {
                        for (var header = FileDecodeSystem.PngHeader, i = 0; i < 8; ++i) if (buffer[i] != header[i]) return !1;
                        return !0;
                    }, FileDecodeSystem.PngHeader = new Uint8Array([ 137, 80, 78, 71, 13, 10, 26, 10 ]), 
                    FileDecodeSystem;
                }();
                system.FileDecodeSystem = FileDecodeSystem;
            }(routine.system || (routine.system = {}));
        }(background.routine || (background.routine = {}));
    }(base.background || (base.background = {}));
}(base || (base = {})), function(base) {
    !function(background) {
        !function(routine) {
            var FileDecodeSystem = base.background.routine.system.FileDecodeSystem, ArrayUtils = utils.ArrayUtils, ByteStream = utils.ByteStream, RoutineActor = function() {
                function RoutineActor() {
                    var _this = this;
                    this.onUpdate = function() {
                        if (0 != _this._list.length) {
                            for (var _i = 0, _a = _this._list; _i < _a.length; _i++) {
                                var command = _a[_i], handlers = _this._opcodeHandlers[command.type()];
                                if (null != handlers) for (var i = 0, length_6 = handlers.length; i < length_6; ++i) handlers[i](command);
                            }
                            _this._list.length = 0;
                        }
                    }, this._args = new Array(1), this._list = [], this._opcodeHandlers = [], this._opcodes = [], 
                    FileDecodeSystem.init();
                    var actor = this;
                    actor.registerOpcode(background.DecodeCommand.opcode, background.DecodeCommand), 
                    actor.registerOpcode(background.DecodeCompleteCommand.opcode, background.DecodeCompleteCommand), 
                    actor.addCommandHandler(background.InitCommand.opcode, function(_) {
                        var command = new background.InitCompleteCommand();
                        command.status = 0, actor.sendCommand(command);
                    }), actor.addCommandHandler(background.DecodeCommand.opcode, function(command) {
                        var buffer, url = command.url, uncompress = command.uncompress, content = command.content;
                        switch (uncompress) {
                          case 1:
                            buffer = FileDecodeSystem.inflateBuffer(content[0]);
                            break;

                          default:
                            var name_2 = url.toLowerCase();
                            if (name_2.lastIndexOf(".png") == name_2.length - 4 || name_2.lastIndexOf(".jpg") == name_2.length - 4) buffer = FileDecodeSystem.decodeImage(new Uint8Array(content[0])); else if (name_2.lastIndexOf(".til") == name_2.length - 4) {
                                var stream = new ByteStream();
                                stream.open(new Uint8Array(content[0])), stream.getUint16();
                                var alpha = stream.getBytes(stream.getUint32());
                                stream.getUint16(), buffer = FileDecodeSystem.decodeImage(stream.getBytes(stream.getUint32()), new Zlib.Inflate(alpha).decompress());
                            }
                        }
                        var result = new background.DecodeCompleteCommand();
                        result.url = url, result.bytes = buffer, actor.sendCommand(result);
                    });
                }
                return RoutineActor.prototype.registerOpcode = function(type, command) {
                    this._opcodes[type] = command;
                }, RoutineActor.prototype.addCommandHandler = function(type, handler) {
                    var handlers = this._opcodeHandlers[type];
                    null == handlers && (handlers = new Array(), this._opcodeHandlers[type] = handlers), 
                    -1 == handlers.indexOf(handler) && handlers.push(handler);
                }, RoutineActor.prototype.removeCommandHandler = function(type, handler) {
                    var handlers = this._opcodeHandlers[type];
                    null != handlers && ArrayUtils.remove(handlers, handler);
                }, RoutineActor.prototype.sendCommand = function(command) {
                    0 == this._list.length && setTimeout(this.onUpdate, 0), this._list.push(command);
                }, RoutineActor;
            }();
            routine.RoutineActor = RoutineActor;
        }(background.routine || (background.routine = {}));
    }(base.background || (base.background = {}));
}(base || (base = {})), function(base) {
    !function(ecs) {
        var EventDispatcher = Laya.EventDispatcher, MessageDispatcher = function() {
            function MessageDispatcher() {
                this._core = new EventDispatcher();
            }
            return MessageDispatcher.prototype.hasListener = function(type) {
                return this._core.hasListener(type);
            }, MessageDispatcher.prototype.publish = function(type) {
                for (var args = [], _i = 1; _i < arguments.length; _i++) args[_i - 1] = arguments[_i];
                return this._core.event(type, args);
            }, MessageDispatcher.prototype.on = function(type, caller, listener) {
                return this._core.on(type, caller, listener), this;
            }, MessageDispatcher.prototype.once = function(type, caller, listener) {
                return this._core.once(type, caller, listener), this;
            }, MessageDispatcher.prototype.off = function(type, caller, listener, onceOnly) {
                return this._core.off(type, caller, listener, onceOnly), this;
            }, MessageDispatcher.prototype.offAll = function(type) {
                return this._core.offAll(type), this;
            }, MessageDispatcher;
        }();
        ecs.MessageDispatcher = MessageDispatcher;
    }(base.ecs || (base.ecs = {}));
}(base || (base = {})), function(base) {
    !function(ecs) {
        function EntityComponent(owner) {
            this.owner = owner;
        }
        ecs.EntityComponent = EntityComponent;
    }(base.ecs || (base.ecs = {}));
}(base || (base = {})), function(base) {
    !function(ecs) {
        var Dictionary = Laya.Dictionary, Entity = function(_super) {
            function Entity() {
                var _this = _super.call(this) || this;
                return _this._components = new Dictionary(), _this._isEnter = !1, _this._isValid = !0, 
                _this;
            }
            return __extends(Entity, _super), Object.defineProperty(Entity.prototype, "isEnter", {
                get: function() {
                    return this._isEnter;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(Entity.prototype, "isValid", {
                get: function() {
                    return this._isEnter && this._isValid;
                },
                enumerable: !0,
                configurable: !0
            }), Entity.prototype.enter = function() {
                if (!this._isEnter) {
                    this._isEnter = !0;
                    for (var _i = 0, values_1 = this._components.values; _i < values_1.length; _i++) {
                        values_1[_i].setup();
                    }
                }
            }, Entity.prototype.leave = function() {
                if (this._isEnter) {
                    this._isEnter = !1;
                    for (var _i = 0, values_2 = this._components.values; _i < values_2.length; _i++) {
                        values_2[_i].teardown();
                    }
                }
            }, Entity.prototype.update = function() {
                if (this._isEnter) for (var _i = 0, values_3 = this._components.values; _i < values_3.length; _i++) {
                    var c = values_3[_i];
                    null != c.update && c.update();
                }
            }, Entity.prototype.destory = function() {
                if (this._isValid = !1, null != this._components) {
                    var values = this._components.values;
                    if (this._isEnter) for (var _i = 0, values_4 = values; _i < values_4.length; _i++) {
                        values_4[_i].teardown();
                    }
                    for (var _a = 0, values_5 = values; _a < values_5.length; _a++) {
                        values_5[_a].destory();
                    }
                    this._components.clear(), this._components = null, this._isEnter = !1;
                }
                this.offAll();
            }, Entity.prototype.addComponent = function(spawner) {
                for (var args = [], _i = 1; _i < arguments.length; _i++) args[_i - 1] = arguments[_i];
                var c = this._components.get(spawner);
                if (null != c) throw new Error();
                return c = new (spawner.bind.apply(spawner, __spreadArrays([ void 0, this ], args)))(), 
                this._components.set(spawner, c), this._isEnter && c.setup(), c;
            }, Entity.prototype.getComponent = function(spawner) {
                return this._components.get(spawner);
            }, Entity.prototype.removeComponent = function(spawner) {
                var c = this._components.get(spawner);
                return null != c && (this._isEnter && c.teardown(), c.destory(), this._components.remove(spawner)), 
                null != c;
            }, Entity;
        }(ecs.MessageDispatcher);
        ecs.Entity = Entity;
    }(base.ecs || (base.ecs = {}));
}(base || (base = {})), function(base) {
    !function(materials) {
        var ResourcePool = base.assets.ResourcePool, MaterialInitializer = function() {
            function MaterialInitializer() {}
            return MaterialInitializer.declareShader = function(name, attributeMap, uniformMap) {
                MaterialInitializer._declareShaders["res/shader/" + name] = [ name, attributeMap, uniformMap ];
            }, MaterialInitializer.setup = function(callback) {
                switch (this._step) {
                  case 0:
                    MaterialInitializer._step = 1, null != callback && MaterialInitializer._callbacks.push(callback);
                    function onComplete_1(url, handle, buffer) {
                        if (--counter_1, null != buffer) {
                            var bytes = new Laya.Byte(buffer);
                            cache_1[url] = bytes.readUTFBytes();
                        }
                        if (!(0 < counter_1)) {
                            MaterialInitializer._step = 2;
                            var declareShaders = MaterialInitializer._declareShaders;
                            for (var path in declareShaders) {
                                var args = declareShaders[path];
                                Laya.ShaderCompile3D.add(Laya.Shader3D.nameKey.add(args[0]), cache_1[path + ".vert"], cache_1[path + ".frag"], args[1], args[2]);
                            }
                            for (var _i = 0, _a = MaterialInitializer._callbacks; _i < _a.length; _i++) {
                                (0, _a[_i])();
                            }
                            MaterialInitializer._declareShaders = null, MaterialInitializer._callbacks.length = 0;
                        }
                    }
                    var counter_1 = 0, cache_1 = {};
                    ResourcePool.instance.load("assets/vf.obj", function(url, handle, buffer) {
                        var t = msgpack.decode(new Uint8Array(buffer));
                        for (var key in t) cache_1[key] = t[key];
                        onComplete_1(url, 0, null);
                    }, 0, !1, !1, 1);
                    break;

                  case 1:
                    null != callback && MaterialInitializer._callbacks.push(callback);
                    break;

                  case 2:
                    null != callback && callback();
                }
            }, MaterialInitializer._step = 0, MaterialInitializer._callbacks = [], MaterialInitializer._declareShaders = {}, 
            MaterialInitializer;
        }();
        materials.MaterialInitializer = MaterialInitializer;
    }(base.materials || (base.materials = {}));
}(base || (base = {})), function(base) {
    !function(materials) {
        var BaseMaterial = Laya.BaseMaterial, Matrix4x4 = Laya.Matrix4x4, CustomMaterial = function(_super) {
            function CustomMaterial(shaderName) {
                var _this = _super.call(this) || this;
                return _this.setShaderName(shaderName), _this.enableAlphaBlend = !1, _this.colorMatrix = Matrix4x4.DEFAULT, 
                _this.completeCreate(), _this;
            }
            return __extends(CustomMaterial, _super), Object.defineProperty(CustomMaterial.prototype, "colorMatrix", {
                get: function() {
                    return this._getMatrix4x4(9);
                },
                set: function(value) {
                    this._setMatrix4x4(9, value);
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(CustomMaterial.prototype, "enableAlphaBlend", {
                get: function() {
                    return this._enableAlphaBlend;
                },
                set: function(value) {
                    this._enableAlphaBlend != value && ((this._enableAlphaBlend = value) ? (this.blend = BaseMaterial.BLEND_ENABLE_ALL, 
                    this.blendEquation = BaseMaterial.BLENDEQUATION_ADD, this.srcBlend = BaseMaterial.BLENDPARAM_SRC_ALPHA, 
                    this.dstBlend = BaseMaterial.BLENDPARAM_ONE_MINUS_SRC_ALPHA, this.renderQueue = BaseMaterial.RENDERQUEUE_TRANSPARENT, 
                    this.depthWrite = !1) : (this.blend = BaseMaterial.BLEND_DISABLE, this.renderQueue = BaseMaterial.RENDERQUEUE_OPAQUE, 
                    this.depthWrite = !0));
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(CustomMaterial.prototype, "diffuseTexture", {
                get: function() {
                    return this._getTexture(1);
                },
                set: function(value) {
                    this._setTexture(1, value);
                },
                enumerable: !0,
                configurable: !0
            }), CustomMaterial.prototype._removeReference = function() {
                _super.prototype._removeReference.call(this), this.referenceCount <= 0 && this.destroy();
            }, CustomMaterial;
        }(Laya.BaseMaterial), AvatarMaterial = function(_super) {
            function AvatarMaterial() {
                return _super.call(this, "avatar_shader") || this;
            }
            return __extends(AvatarMaterial, _super), AvatarMaterial;
        }(materials.CustomMaterial = CustomMaterial);
        materials.AvatarMaterial = AvatarMaterial;
        var AvatarSkinnedMaterial = function(_super) {
            function AvatarSkinnedMaterial() {
                return _super.call(this, "avatar_skinned_shader") || this;
            }
            return __extends(AvatarSkinnedMaterial, _super), AvatarSkinnedMaterial;
        }(CustomMaterial);
        materials.AvatarSkinnedMaterial = AvatarSkinnedMaterial, materials.MaterialInitializer.declareShader("avatar_shader", {
            a_Position: Laya.VertexElementUsage.POSITION0,
            a_Texcoord: Laya.VertexElementUsage.TEXTURECOORDINATE0
        }, {
            u_MvpMatrix: [ Laya.Sprite3D.MVPMATRIX, Laya.Shader3D.PERIOD_SPRITE ],
            u_Texture0: [ 1, Laya.Shader3D.PERIOD_MATERIAL ],
            u_AlphaTestValue: [ Laya.BaseMaterial.ALPHATESTVALUE, Laya.Shader3D.PERIOD_MATERIAL ],
            u_ColorMatrix: [ 9, Laya.Shader3D.PERIOD_MATERIAL ]
        }), materials.MaterialInitializer.declareShader("avatar_skinned_shader", {
            a_Position: Laya.VertexElementUsage.POSITION0,
            a_Texcoord: Laya.VertexElementUsage.TEXTURECOORDINATE0,
            a_BoneWeights: Laya.VertexElementUsage.BLENDWEIGHT0,
            a_BoneIndices: Laya.VertexElementUsage.BLENDINDICES0
        }, {
            u_MvpMatrix: [ Laya.Sprite3D.MVPMATRIX, Laya.Shader3D.PERIOD_SPRITE ],
            u_Bones: [ 0, Laya.Shader3D.PERIOD_RENDERELEMENT ],
            u_Texture0: [ 1, Laya.Shader3D.PERIOD_MATERIAL ],
            u_AlphaTestValue: [ Laya.BaseMaterial.ALPHATESTVALUE, Laya.Shader3D.PERIOD_MATERIAL ],
            u_ColorMatrix: [ 9, Laya.Shader3D.PERIOD_MATERIAL ]
        });
    }(base.materials || (base.materials = {}));
}(base || (base = {})), function(base) {
    !function(materials) {
        var BaseMaterial = Laya.BaseMaterial, VertexElementUsage = Laya.VertexElementUsage, BatchAtlasMaterial = function(_super) {
            function BatchAtlasMaterial() {
                var _this = _super.call(this) || this;
                return _this.setShaderName("batch_atlas_shader"), _this.blend = BaseMaterial.BLEND_ENABLE_ALL, 
                _this.blendEquation = BaseMaterial.BLENDEQUATION_ADD, _this.srcBlend = BaseMaterial.BLENDPARAM_SRC_ALPHA, 
                _this.dstBlend = BaseMaterial.BLENDPARAM_ONE_MINUS_SRC_ALPHA, _this.renderQueue = BaseMaterial.RENDERQUEUE_TRANSPARENT, 
                _this.depthWrite = !1, _this;
            }
            return __extends(BatchAtlasMaterial, _super), Object.defineProperty(BatchAtlasMaterial.prototype, "diffuseTexture", {
                get: function() {
                    return this._getTexture(1);
                },
                set: function(value) {
                    this._setTexture(1, value);
                },
                enumerable: !0,
                configurable: !0
            }), BatchAtlasMaterial;
        }(Laya.BaseMaterial);
        materials.BatchAtlasMaterial = BatchAtlasMaterial;
        var MultiTextureMaterial = function(_super) {
            function MultiTextureMaterial(enableBlend) {
                void 0 === enableBlend && (enableBlend = !1);
                var _this = _super.call(this) || this;
                enableBlend && (_this.blend = BaseMaterial.BLEND_ENABLE_ALL, _this.blendEquation = BaseMaterial.BLENDEQUATION_ADD, 
                _this.srcBlend = BaseMaterial.BLENDPARAM_SRC_ALPHA, _this.dstBlend = BaseMaterial.BLENDPARAM_ONE_MINUS_SRC_ALPHA, 
                _this.renderQueue = BaseMaterial.RENDERQUEUE_TRANSPARENT, _this.depthWrite = !1), 
                null == MultiTextureMaterial.NullTexture && ((MultiTextureMaterial.NullTexture = new Laya.SolidColorTexture2D(new Laya.Vector4(0, 0, 0, 0))).lock = !0), 
                _this.setShaderName("multi_texture_shader"), _this.offsetMatrix = new Float32Array(128), 
                _this._discardArray = new Float32Array(8);
                for (var tilingOffset = new Float32Array(32), offset = 0, i = 0; i < 8; ++i) _this.setTextureAt(1 + i, MultiTextureMaterial.NullTexture), 
                _this._discardArray[i] = 1, tilingOffset[offset++] = 1, tilingOffset[offset++] = 1, 
                tilingOffset[offset++] = 0, tilingOffset[offset++] = 0;
                return _this.tilingOffset = tilingOffset, _this._setBuffer(10, _this._discardArray), 
                _this._setBuffer(9, _this.offsetMatrix), _this._setBuffer(11, _this.tilingOffset), 
                _this;
            }
            return __extends(MultiTextureMaterial, _super), MultiTextureMaterial.prototype.setTextureAt = function(index, value) {
                this._discardArray[index - 1] = null == value ? 1 : 0, null == value && (value = MultiTextureMaterial.NullTexture), 
                this._setTexture(index, value);
            }, MultiTextureMaterial.prototype.getTextureAt = function(index) {
                return this._getTexture(index);
            }, MultiTextureMaterial;
        }(BaseMaterial);
        materials.MultiTextureMaterial = MultiTextureMaterial;
        var LiteralAtlasMaterial = function(_super) {
            function LiteralAtlasMaterial() {
                var _this = _super.call(this) || this;
                return _this.setShaderName("literal_atlas_shader"), _this.blend = BaseMaterial.BLEND_ENABLE_ALL, 
                _this.blendEquation = BaseMaterial.BLENDEQUATION_ADD, _this.srcBlend = BaseMaterial.BLENDPARAM_SRC_ALPHA, 
                _this.dstBlend = BaseMaterial.BLENDPARAM_ONE_MINUS_SRC_ALPHA, _this.renderQueue = BaseMaterial.RENDERQUEUE_TRANSPARENT, 
                _this.depthWrite = !1, _this;
            }
            return __extends(LiteralAtlasMaterial, _super), Object.defineProperty(LiteralAtlasMaterial.prototype, "diffuseTexture", {
                get: function() {
                    return this._getTexture(1);
                },
                set: function(value) {
                    this._setTexture(1, value);
                },
                enumerable: !0,
                configurable: !0
            }), LiteralAtlasMaterial;
        }(BaseMaterial);
        materials.LiteralAtlasMaterial = LiteralAtlasMaterial, materials.MaterialInitializer.declareShader("literal_atlas_shader", {
            a_Position: VertexElementUsage.POSITION0,
            a_Args: VertexElementUsage.NORMAL0,
            a_Texcoord: VertexElementUsage.TEXTURECOORDINATE0
        }, {
            u_MvpMatrix: [ Laya.Sprite3D.MVPMATRIX, Laya.Shader3D.PERIOD_SPRITE ],
            u_LiteralParams: [ 0, Laya.Shader3D.PERIOD_RENDERELEMENT ],
            u_Texture0: [ 1, Laya.Shader3D.PERIOD_MATERIAL ]
        }), materials.MaterialInitializer.declareShader("batch_atlas_shader", {
            a_Position: VertexElementUsage.POSITION0,
            a_Args: VertexElementUsage.NORMAL0,
            a_Texcoord: VertexElementUsage.TEXTURECOORDINATE0
        }, {
            u_MvpMatrix: [ Laya.Sprite3D.MVPMATRIX, Laya.Shader3D.PERIOD_SPRITE ],
            u_OffsetMatrix: [ 0, Laya.Shader3D.PERIOD_RENDERELEMENT ],
            u_Texture0: [ 1, Laya.Shader3D.PERIOD_MATERIAL ]
        }), materials.MaterialInitializer.declareShader("multi_texture_shader", {
            a_Position: VertexElementUsage.POSITION0,
            a_Args: VertexElementUsage.NORMAL0
        }, {
            u_MvpMatrix: [ Laya.Sprite3D.MVPMATRIX, Laya.Shader3D.PERIOD_SPRITE ],
            u_OffsetMatrix: [ 9, Laya.Shader3D.PERIOD_MATERIAL ],
            u_Discard: [ 10, Laya.Shader3D.PERIOD_MATERIAL ],
            u_TilingOffset: [ 11, Laya.Shader3D.PERIOD_MATERIAL ],
            u_Texture0: [ 1, Laya.Shader3D.PERIOD_MATERIAL ],
            u_Texture1: [ 2, Laya.Shader3D.PERIOD_MATERIAL ],
            u_Texture2: [ 3, Laya.Shader3D.PERIOD_MATERIAL ],
            u_Texture3: [ 4, Laya.Shader3D.PERIOD_MATERIAL ],
            u_Texture4: [ 5, Laya.Shader3D.PERIOD_MATERIAL ],
            u_Texture5: [ 6, Laya.Shader3D.PERIOD_MATERIAL ],
            u_Texture6: [ 7, Laya.Shader3D.PERIOD_MATERIAL ],
            u_Texture7: [ 8, Laya.Shader3D.PERIOD_MATERIAL ]
        }), materials.MaterialInitializer.declareShader("custom_particle_shader", {
            a_CornerTextureCoordinate: 17,
            a_MeshPosition: 0,
            a_MeshColor: 1,
            a_MeshTextureCoordinate: 2,
            a_ShapePositionStartLifeTime: 30,
            a_DirectionTime: 32,
            a_StartColor: 19,
            a_EndColor: 23,
            a_StartSize: 20,
            a_StartRotation0: 22,
            a_StartSpeed: 31,
            a_Random0: 34,
            a_Random1: 35,
            a_SimulationWorldPostion: 36,
            a_SimulationWorldRotation: 37
        }, {
            u_texture: [ 1, 1 ],
            u_Tintcolor: [ 2, 1 ],
            u_TilingOffset: [ 3, 1 ],
            u_PeriodX: [ 12, 1 ],
            u_MoveSpeedX: [ 13, 1 ],
            u_MoveSpeedY: [ 14, 1 ],
            u_WorldPosition: [ 0, 2 ],
            u_WorldRotation: [ 1, 2 ],
            u_PositionScale: [ 4, 2 ],
            u_SizeScale: [ 5, 2 ],
            u_ScalingMode: [ 6, 2 ],
            u_Gravity: [ 7, 2 ],
            u_ThreeDStartRotation: [ 8, 2 ],
            u_StretchedBillboardLengthScale: [ 9, 2 ],
            u_StretchedBillboardSpeedScale: [ 10, 2 ],
            u_SimulationSpace: [ 11, 2 ],
            u_CurrentTime: [ 12, 2 ],
            u_ColorOverLifeGradientAlphas: [ 22, 2 ],
            u_ColorOverLifeGradientColors: [ 23, 2 ],
            u_MaxColorOverLifeGradientAlphas: [ 24, 2 ],
            u_MaxColorOverLifeGradientColors: [ 25, 2 ],
            u_VOLVelocityConst: [ 13, 2 ],
            u_VOLVelocityGradientX: [ 14, 2 ],
            u_VOLVelocityGradientY: [ 15, 2 ],
            u_VOLVelocityGradientZ: [ 16, 2 ],
            u_VOLVelocityConstMax: [ 17, 2 ],
            u_VOLVelocityGradientMaxX: [ 18, 2 ],
            u_VOLVelocityGradientMaxY: [ 19, 2 ],
            u_VOLVelocityGradientMaxZ: [ 20, 2 ],
            u_VOLSpaceType: [ 21, 2 ],
            u_SOLSizeGradient: [ 26, 2 ],
            u_SOLSizeGradientX: [ 27, 2 ],
            u_SOLSizeGradientY: [ 28, 2 ],
            u_SOLSizeGradientZ: [ 29, 2 ],
            u_SOLSizeGradientMax: [ 30, 2 ],
            u_SOLSizeGradientMaxX: [ 31, 2 ],
            u_SOLSizeGradientMaxY: [ 32, 2 ],
            u_SOLSizeGradientMaxZ: [ 33, 2 ],
            u_ROLAngularVelocityConst: [ 34, 2 ],
            u_ROLAngularVelocityConstSeprarate: [ 35, 2 ],
            u_ROLAngularVelocityGradient: [ 36, 2 ],
            u_ROLAngularVelocityGradientX: [ 37, 2 ],
            u_ROLAngularVelocityGradientY: [ 38, 2 ],
            u_ROLAngularVelocityGradientZ: [ 39, 2 ],
            u_ROLAngularVelocityGradientW: [ 40, 2 ],
            u_ROLAngularVelocityConstMax: [ 41, 2 ],
            u_ROLAngularVelocityConstMaxSeprarate: [ 42, 2 ],
            u_ROLAngularVelocityGradientMax: [ 43, 2 ],
            u_ROLAngularVelocityGradientMaxX: [ 44, 2 ],
            u_ROLAngularVelocityGradientMaxY: [ 45, 2 ],
            u_ROLAngularVelocityGradientMaxZ: [ 46, 2 ],
            u_ROLAngularVelocityGradientMaxW: [ 47, 2 ],
            u_TSACycles: [ 48, 2 ],
            u_TSASubUVLength: [ 49, 2 ],
            u_TSAGradientUVs: [ 50, 2 ],
            u_TSAMaxGradientUVs: [ 51, 2 ],
            u_CameraPosition: [ 0, 3 ],
            u_CameraDirection: [ 5, 3 ],
            u_CameraUp: [ 6, 3 ],
            u_View: [ 1, 3 ],
            u_Projection: [ 2, 3 ],
            u_FogStart: [ 1, 4 ],
            u_FogRange: [ 2, 4 ],
            u_FogColor: [ 0, 4 ]
        });
    }(base.materials || (base.materials = {}));
}(base || (base = {})), function(base) {
    !function(mesh) {
        var Byte = Laya.Byte, IndexBuffer3D = Laya.IndexBuffer3D, VertexBuffer3D = Laya.VertexBuffer3D, VertexDeclaration = Laya.VertexDeclaration, VertexElement = Laya.VertexElement, VertexElementFormat = Laya.VertexElementFormat, VertexElementUsage = Laya.VertexElementUsage, WebGLContext = Laya.WebGLContext, ArrayUtils = utils.ArrayUtils, SkeletonClip = function() {
            function SkeletonClip(skeleton, data) {
                this._skeleton = skeleton, this._dummyMatrixs = {}, this._animationData = data;
            }
            return SkeletonClip.prototype.getDummyMatrix = function(index, key, result) {
                var tuple = this._skeleton.dummyJoints[key];
                if (!tuple) return result;
                var matrixs = this._dummyMatrixs[key];
                matrixs || (this._dummyMatrixs[key] = matrixs = new Array(this._animationData.numFrames));
                var matrix = matrixs[index];
                return matrix || (matrixs[index] = matrix = this._animationData.getDummyMatrix(index, this._skeleton, tuple[0], tuple[1])), 
                result.elements.set(matrix), result;
            }, SkeletonClip;
        }();
        mesh.SkeletonClip = SkeletonClip;
        var Skeleton = function() {
            function Skeleton(boneParentIndexs, inverseBindPoses, boneNames, mountPoints) {
                if (this.boneParentIndexs = boneParentIndexs, this.inverseBindPoses = inverseBindPoses, 
                mountPoints) {
                    for (var name_3 in this.dummyJoints = {}, mountPoints) {
                        var tuple = mountPoints[name_3];
                        this.dummyJoints[name_3] = [ boneNames.indexOf(tuple[0]), tuple[1] ];
                    }
                    this.keys = [], this.values = [];
                }
            }
            return Skeleton.prototype.getSkeletonClip = function(data) {
                if (!this.dummyJoints) return null;
                var index = this.keys.indexOf(data);
                return -1 == index && (this.keys.push(data), this.values.push(new SkeletonClip(this, data)), 
                index = this.values.length - 1), this.values[index];
            }, Skeleton;
        }();
        mesh.Skeleton = Skeleton;
        var MeshData = function() {
            function MeshData() {}
            return MeshData.prototype.destroy = function() {
                this.geometryOffsets = null;
                for (var _i = 0, _a = this.vb; _i < _a.length; _i++) {
                    var vb = _a[_i];
                    vb.lock = !1, vb.destroy();
                }
                this.vb = null;
                for (var _b = 0, _c = this.ib; _b < _c.length; _b++) {
                    var ib = _c[_b];
                    ib.lock = !1, ib.destroy();
                }
                this.ib = null;
            }, MeshData.create = function(buffer) {
                MeshData.mesh = new MeshData();
                for (var bytes = new Byte(buffer); bytes.bytesAvailable; ) {
                    var chunkType = bytes.getUint16(), chunkSize = bytes.getUint32();
                    switch (chunkType) {
                      case 0:
                        MeshData.parseMesh(bytes, chunkSize);
                        break;

                      default:
                        bytes.pos += chunkSize;
                    }
                }
                var result = MeshData.mesh;
                return MeshData.mesh = null, MeshData.boneParentIndexs && (result.skeleton = new Skeleton(MeshData.boneParentIndexs, MeshData.inverseBindPoses, MeshData.boneNames, MeshData.mountPoints)), 
                MeshData.boneParentIndexs = null, MeshData.inverseBindPoses = null, MeshData.boneNames = null, 
                MeshData.mountPoints = null, result;
            }, MeshData.parseMesh = function(bytes, size) {
                for (var limit = bytes.pos + size; bytes.pos < limit; ) {
                    var chunkType = bytes.getUint16(), chunkSize = bytes.getUint32();
                    switch (chunkType) {
                      case 256:
                        MeshData.parseGeometry(bytes, chunkSize);
                        break;

                      case 512:
                        MeshData.parseSkeleton(bytes, chunkSize);
                        break;

                      default:
                        bytes.pos += chunkSize;
                    }
                }
            }, MeshData.parseGeometry = function(bytes, size) {
                for (var limit = bytes.pos + size; bytes.pos < limit; ) {
                    var chunkType = bytes.getUint16(), chunkSize = bytes.getUint32();
                    switch (chunkType) {
                      case 257:
                        MeshData.parseSubGeometry(bytes, chunkSize);
                        break;

                      case 258:
                        MeshData.parseGeometryAttributes(bytes, chunkSize);
                        break;

                      default:
                        bytes.pos += chunkSize;
                    }
                }
            }, MeshData.parseSkeleton = function(bytes, size) {
                for (var limit = bytes.pos + size; bytes.pos < limit; ) {
                    var chunkType = bytes.getUint16(), chunkSize = bytes.getUint32();
                    switch (chunkType) {
                      case 513:
                        MeshData.parseSkeletonJoint(bytes, chunkSize);
                        break;

                      case 514:
                        MeshData.parseSkeletonAttributes(bytes, chunkSize);
                        break;

                      default:
                        bytes.pos += chunkSize;
                    }
                }
            }, MeshData.parseSubGeometry = function(bytes, size) {
                for (var count = bytes.getUint16(), vbs = new Array(count), ibs = new Array(count), i = 0; i < count; ++i) {
                    var flags = bytes.getUint8(), blendWeights = bytes.getUint8(), vertexDeclaration = 12;
                    0 != (2 & flags) && (vertexDeclaration += 8), 0 != (4 & flags) && (vertexDeclaration += 2 * blendWeights * 4);
                    var vertexCount = bytes.getUint32(), vertexData = new Float32Array(bytes.buffer.slice(bytes.pos, bytes.pos + vertexCount * vertexDeclaration));
                    bytes.pos += vertexCount * vertexDeclaration;
                    var vertexBuffer = VertexBuffer3D.create(MeshData.vertexDeclarations[blendWeights], vertexCount, WebGLContext.STATIC_DRAW, !0);
                    vertexBuffer.setData(vertexData), vertexBuffer.lock = !0, vbs[i] = vertexBuffer;
                    var indexCount = bytes.getUint32(), indexData = new Uint16Array(bytes.buffer.slice(bytes.pos, bytes.pos + 2 * indexCount));
                    bytes.pos += 2 * indexCount;
                    var indexBuffer = IndexBuffer3D.create(IndexBuffer3D.INDEXTYPE_USHORT, indexCount, WebGLContext.STATIC_DRAW, !0);
                    indexBuffer.setData(indexData), indexBuffer.lock = !0, ibs[i] = indexBuffer;
                }
                MeshData.mesh.vb = vbs, MeshData.mesh.ib = ibs;
            }, MeshData.parseGeometryAttributes = function(bytes, size) {
                var limit = bytes.pos + size;
                for (MeshData.mesh.geometryOffsets = {}; bytes.pos < limit; ) {
                    var key = bytes.readUTFString(), type = bytes.getUint8(), length_7 = bytes.getUint32();
                    switch (type) {
                      case 32:
                        var name_4 = bytes.readUTFString();
                        MeshData.mesh.geometryOffsets[key] = [ name_4, MeshData.readMatrix4x4(bytes) ];
                        break;

                      default:
                        bytes.pos += length_7;
                    }
                }
            }, MeshData.parseSkeletonJoint = function(bytes, size) {
                var numJoints = bytes.getUint16(), boneIndexs = new Uint8Array(bytes.buffer.slice(bytes.pos, bytes.pos + numJoints));
                bytes.pos += numJoints;
                for (var boneNames = new Array(numJoints), i = 0; i < numJoints; ++i) boneNames[i] = bytes.readUTFString();
                var inverseBindPosesData = new Float32Array(bytes.buffer.slice(bytes.pos, bytes.pos + 16 * numJoints * 4));
                bytes.pos += 16 * numJoints * 4, MeshData.boneParentIndexs = boneIndexs, MeshData.boneNames = boneNames, 
                MeshData.inverseBindPoses = inverseBindPosesData;
            }, MeshData.parseSkeletonAttributes = function(bytes, size) {
                MeshData.mountPoints = {};
                for (var limit = bytes.pos + size; bytes.pos < limit; ) {
                    var key = bytes.readUTFString(), type = bytes.getUint8(), length_8 = bytes.getUint32();
                    switch (type) {
                      case 32:
                        var name_5 = bytes.readUTFString();
                        MeshData.mountPoints[key] = [ name_5, MeshData.readMatrix4x4(bytes) ];
                        break;

                      default:
                        bytes.pos += length_8;
                    }
                }
            }, MeshData.readMatrix4x4 = function(bytes) {
                var result = new Float32Array(16);
                return result[0] = bytes.getFloat32(), result[1] = bytes.getFloat32(), result[2] = bytes.getFloat32(), 
                result[3] = 0, result[4] = bytes.getFloat32(), result[5] = bytes.getFloat32(), result[6] = bytes.getFloat32(), 
                result[7] = 0, result[8] = bytes.getFloat32(), result[9] = bytes.getFloat32(), result[10] = bytes.getFloat32(), 
                result[11] = 0, result[12] = bytes.getFloat32(), result[13] = bytes.getFloat32(), 
                result[14] = bytes.getFloat32(), result[15] = 1, result;
            }, MeshData.vertexDeclarations = [ new VertexDeclaration(20, [ new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.POSITION0), new VertexElement(12, VertexElementFormat.Vector2, VertexElementUsage.TEXTURECOORDINATE0) ]), new VertexDeclaration(28, [ new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.POSITION0), new VertexElement(12, VertexElementFormat.Vector2, VertexElementUsage.TEXTURECOORDINATE0), new VertexElement(20, VertexElementFormat.Single, VertexElementUsage.BLENDWEIGHT0), new VertexElement(24, VertexElementFormat.Single, VertexElementUsage.BLENDINDICES0) ]), new VertexDeclaration(36, [ new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.POSITION0), new VertexElement(12, VertexElementFormat.Vector2, VertexElementUsage.TEXTURECOORDINATE0), new VertexElement(20, VertexElementFormat.Vector2, VertexElementUsage.BLENDWEIGHT0), new VertexElement(28, VertexElementFormat.Vector2, VertexElementUsage.BLENDINDICES0) ]), new VertexDeclaration(44, [ new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.POSITION0), new VertexElement(12, VertexElementFormat.Vector2, VertexElementUsage.TEXTURECOORDINATE0), new VertexElement(20, VertexElementFormat.Vector3, VertexElementUsage.BLENDWEIGHT0), new VertexElement(32, VertexElementFormat.Vector3, VertexElementUsage.BLENDINDICES0) ]), new VertexDeclaration(52, [ new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.POSITION0), new VertexElement(12, VertexElementFormat.Vector2, VertexElementUsage.TEXTURECOORDINATE0), new VertexElement(20, VertexElementFormat.Vector4, VertexElementUsage.BLENDWEIGHT0), new VertexElement(36, VertexElementFormat.Vector4, VertexElementUsage.BLENDINDICES0) ]) ], 
            MeshData;
        }();
        mesh.MeshData = MeshData;
        var AnimationData = function() {
            function AnimationData() {}
            return AnimationData.prototype.getSkinnedData = function(index, skeleton, matrices) {
                this.toGlobalMatrices(index, skeleton), ArrayUtils.copy(this.matrices, index * this.numJoints * 12, matrices, 0, matrices.length);
            }, AnimationData.prototype.toGlobalMatrices = function(index, skeleton) {
                this.flags[index] || (this.toGlobalPose(index, skeleton.boneParentIndexs), this.toMatrices(index, skeleton.inverseBindPoses), 
                this.flags[index] = 1);
            }, AnimationData.prototype.getDummyMatrix = function(frame, skeleton, index, matrix) {
                return this.toGlobalMatrices(frame, skeleton), this.createAffineTransformation(frame, index, matrix);
            }, AnimationData.prototype.createAffineTransformation = function(frame, index, matrix) {
                var oe = new Float32Array(16), joints = this.frames, offset = frame * this.numJoints * 7 + 7 * index, x = joints[3 + offset + 0], y = joints[3 + offset + 1], z = joints[3 + offset + 2], w = joints[3 + offset + 3], x2 = x + x, y2 = y + y, z2 = z + z, xx = x * x2, xy = x * y2, xz = x * z2, yy = y * y2, yz = y * z2, zz = z * z2, wx = w * x2, wy = w * y2, wz = w * z2;
                oe[0] = 1 * (1 - (yy + zz)), oe[1] = 1 * (xy + wz), oe[2] = 1 * (xz - wy), oe[3] = 0, 
                oe[4] = 1 * (xy - wz), oe[5] = 1 * (1 - (xx + zz)), oe[6] = 1 * (yz + wx), oe[7] = 0, 
                oe[8] = 1 * (xz + wy), oe[9] = 1 * (yz - wx), oe[10] = 1 * (1 - (xx + yy)), oe[11] = 0, 
                oe[12] = joints[0 + offset], oe[13] = joints[1 + offset], oe[14] = joints[2 + offset], 
                oe[15] = 1;
                for (var b = matrix, i = 0; i < 4; i++) {
                    var ai0 = oe[i], ai1 = oe[i + 4], ai2 = oe[i + 8], ai3 = oe[i + 12];
                    oe[i] = ai0 * b[0] + ai1 * b[1] + ai2 * b[2] + ai3 * b[3], oe[i + 4] = ai0 * b[4] + ai1 * b[5] + ai2 * b[6] + ai3 * b[7], 
                    oe[i + 8] = ai0 * b[8] + ai1 * b[9] + ai2 * b[10] + ai3 * b[11], oe[i + 12] = ai0 * b[12] + ai1 * b[13] + ai2 * b[14] + ai3 * b[15];
                }
                return oe;
            }, AnimationData.prototype.toGlobalPose = function(index, parentIndexs) {
                for (var parentIndex, x1, y1, z1, w1, x2, y2, z2, w2, x3, y3, z3, globalPoses = this.frames, joints = this.frames, baseOffset = 7 * this.numJoints * index, i = 0, numJoints = this.numJoints; i < numJoints; ++i) {
                    var offset = baseOffset + 7 * i, q = 3 + offset, t = offset;
                    if ((parentIndex = parentIndexs[i] - 1) < 0) globalPoses[0 + t] = joints[0 + t], 
                    globalPoses[1 + t] = joints[1 + t], globalPoses[2 + t] = joints[2 + t], globalPoses[0 + q] = joints[0 + q], 
                    globalPoses[1 + q] = joints[1 + q], globalPoses[2 + q] = joints[2 + q], globalPoses[3 + q] = joints[3 + q]; else {
                        var parentPose = baseOffset + 7 * parentIndex, qr = 3 + parentPose, tr = offset;
                        x2 = globalPoses[qr + 0], y2 = globalPoses[qr + 1], z2 = globalPoses[qr + 2], w2 = globalPoses[qr + 3], 
                        w1 = -x2 * (x3 = joints[tr + 0]) - y2 * (y3 = joints[tr + 1]) - z2 * (z3 = joints[tr + 2]), 
                        x1 = w2 * x3 + y2 * z3 - z2 * y3, y1 = w2 * y3 - x2 * z3 + z2 * x3, z1 = w2 * z3 + x2 * y3 - y2 * x3, 
                        tr = parentPose, globalPoses[0 + t] = -w1 * x2 + x1 * w2 - y1 * z2 + z1 * y2 + globalPoses[tr + 0], 
                        globalPoses[1 + t] = -w1 * y2 + x1 * z2 + y1 * w2 - z1 * x2 + globalPoses[tr + 1], 
                        globalPoses[2 + t] = -w1 * z2 - x1 * y2 + y1 * x2 + z1 * w2 + globalPoses[tr + 2], 
                        x1 = globalPoses[qr + 0], y1 = globalPoses[qr + 1], z1 = globalPoses[qr + 2], w1 = globalPoses[qr + 3], 
                        x2 = joints[(qr = 3 + offset) + 0], y2 = joints[qr + 1], z2 = joints[qr + 2], w2 = joints[qr + 3], 
                        globalPoses[3 + q] = w1 * w2 - x1 * x2 - y1 * y2 - z1 * z2, globalPoses[0 + q] = w1 * x2 + x1 * w2 + y1 * z2 - z1 * y2, 
                        globalPoses[1 + q] = w1 * y2 - x1 * z2 + y1 * w2 + z1 * x2, globalPoses[2 + q] = w1 * z2 + x1 * y2 - y1 * x2 + z1 * w2;
                    }
                }
            }, AnimationData.prototype.toMatrices = function(index, inverseBindPoses) {
                for (var ox, oy, oz, ow, xy2, xz2, xw2, yz2, yw2, zw2, n11, n12, n13, n21, n22, n23, n31, n32, n33, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, t, joints = inverseBindPoses, numJoints = this.numJoints, mtxOffset = index * numJoints * 12, matrices = this.matrices, poseJoints = this.frames, indexOffset = 0, baseOffset = 7 * this.numJoints * index, i = 0; i < numJoints; ++i) {
                    var offset = baseOffset + 7 * i, quat = 3 + offset, vec = offset;
                    xy2 = (t = 2 * (ox = poseJoints[0 + quat])) * (oy = poseJoints[1 + quat]), xz2 = t * (oz = poseJoints[2 + quat]), 
                    xw2 = t * (ow = poseJoints[3 + quat]), (t = 2 * oy) * oz, t * ow, yz2 = 2 * oy * oz, 
                    yw2 = 2 * oy * ow, zw2 = 2 * oz * ow, n11 = (t = (ox *= ox) - (oy *= oy)) - (oz *= oz) + (ow *= ow), 
                    n12 = xy2 - zw2, n13 = xz2 + yw2, n21 = xy2 + zw2, n22 = -t - oz + ow, n23 = yz2 - xw2, 
                    n31 = xz2 - yw2, n32 = yz2 + xw2, n33 = -ox - oy + oz + ow, m11 = joints[(indexOffset = 16 * i) + 0], 
                    m12 = joints[indexOffset + 4], m13 = joints[indexOffset + 8], m14 = joints[indexOffset + 12], 
                    m21 = joints[indexOffset + 1], m22 = joints[indexOffset + 5], m23 = joints[indexOffset + 9], 
                    m24 = joints[indexOffset + 13], m31 = joints[indexOffset + 2], m32 = joints[indexOffset + 6], 
                    m33 = joints[indexOffset + 10], m34 = joints[indexOffset + 14], matrices[mtxOffset++] = n11 * m11 + n12 * m21 + n13 * m31, 
                    matrices[mtxOffset++] = n11 * m12 + n12 * m22 + n13 * m32, matrices[mtxOffset++] = n11 * m13 + n12 * m23 + n13 * m33, 
                    matrices[mtxOffset++] = n11 * m14 + n12 * m24 + n13 * m34 + poseJoints[0 + vec], 
                    matrices[mtxOffset++] = n21 * m11 + n22 * m21 + n23 * m31, matrices[mtxOffset++] = n21 * m12 + n22 * m22 + n23 * m32, 
                    matrices[mtxOffset++] = n21 * m13 + n22 * m23 + n23 * m33, matrices[mtxOffset++] = n21 * m14 + n22 * m24 + n23 * m34 + poseJoints[1 + vec], 
                    matrices[mtxOffset++] = n31 * m11 + n32 * m21 + n33 * m31, matrices[mtxOffset++] = n31 * m12 + n32 * m22 + n33 * m32, 
                    matrices[mtxOffset++] = n31 * m13 + n32 * m23 + n33 * m33, matrices[mtxOffset++] = n31 * m14 + n32 * m24 + n33 * m34 + poseJoints[2 + vec];
                }
            }, AnimationData.prototype.destroy = function() {
                this.name = "", this.frames = null;
            }, AnimationData.create = function(buffer) {
                for (var result = AnimationData.animationData = new AnimationData(), bytes = new Byte(buffer); bytes.bytesAvailable; ) {
                    var chunkType = bytes.getUint16(), chunkSize = bytes.getUint32();
                    switch (chunkType) {
                      case 4096:
                        AnimationData.parseAnimation(bytes, chunkSize);
                        break;

                      default:
                        bytes.pos += chunkSize;
                    }
                }
                return AnimationData.animationData = null, result;
            }, AnimationData.parseAnimationClip = function(bytes, size) {
                var block = AnimationData.animationData;
                block.name = bytes.readUTFString(), block.framerate = bytes.getUint16();
                var numFrames = block.numFrames = bytes.getUint16(), numJoints = block.numJoints = bytes.getUint16();
                block.flags = new Uint8Array(numFrames), block.matrices = new Float32Array(numFrames * numJoints * 12), 
                block.frames = bytes.getFloat32Array(bytes.pos, 7 * numJoints * 4 * numFrames);
            }, AnimationData.parseAnimation = function(bytes, size) {
                for (var limit = bytes.pos + size; bytes.pos < limit; ) {
                    var chunkType = bytes.getUint16(), chunkSize = bytes.getUint32();
                    switch (chunkType) {
                      case 4097:
                        AnimationData.parseAnimationClip(bytes, chunkSize);
                        break;

                      default:
                        bytes.pos += chunkSize;
                    }
                }
            }, AnimationData;
        }();
        mesh.AnimationData = AnimationData;
    }(base.mesh || (base.mesh = {}));
}(base || (base = {})), function(base) {
    !function(mesh) {
        var ResourcePool = base.assets.ResourcePool, AnimationDataPool = function(_super) {
            function AnimationDataPool() {
                var _this = _super.call(this, "AnimationDataPool", 10485760) || this;
                return _this.onResourceComplete = function(url, handle, res) {
                    if (null == res) _this.onComplete(url, null, 0); else {
                        var animation = mesh.AnimationData.create(res);
                        _this.onComplete(url, animation, res.byteLength);
                    }
                }, _this;
            }
            return __extends(AnimationDataPool, _super), Object.defineProperty(AnimationDataPool, "instance", {
                get: function() {
                    return AnimationDataPool._instance;
                },
                enumerable: !0,
                configurable: !0
            }), AnimationDataPool.prototype.load = function(url, callback) {
                var entry = this.checkNeedLoad(url, callback, !1);
                null != entry && 0 == entry.status && (entry.status = 1, ResourcePool.instance.load(url, this.onResourceComplete, 0, !1, !1, 1));
            }, AnimationDataPool.prototype.cancel = function(url, callback) {
                var entry = this.findNeedCancelEntry(url, callback);
                null != entry && (ResourcePool.instance.cancel(url, this.onResourceComplete), delete this._waitPool[url], 
                base.assets.AssetEntry.freeEntry(entry));
            }, AnimationDataPool._instance = new AnimationDataPool(), AnimationDataPool;
        }(base.assets.AssetPoolBase);
        mesh.AnimationDataPool = AnimationDataPool;
    }(base.mesh || (base.mesh = {}));
}(base || (base = {})), function(base) {
    !function(mesh) {
        var StringUtils = utils.StringUtils, AvatarDataPool = function(_super) {
            function AvatarDataPool() {
                return _super.call(this, "AvatarDataPool", 10485760) || this;
            }
            return __extends(AvatarDataPool, _super), Object.defineProperty(AvatarDataPool, "instance", {
                get: function() {
                    return AvatarDataPool._instance;
                },
                enumerable: !0,
                configurable: !0
            }), AvatarDataPool.prototype.load = function(url, callback) {
                var entry = this.checkNeedLoad(url, callback, !1);
                if (null != entry && 0 == entry.status) {
                    var config = this.entityPack[url];
                    if (!config) return void this.onComplete(url, null, 0);
                    this.initEntryArgs(entry, config), entry.status = 1;
                }
            }, AvatarDataPool.prototype.initEntryArgs = function(entry, config) {
                function callback(url, handle, res) {
                    var args = entry.args;
                    0 == handle ? (_this.clearLoading(args), _this.onComplete(entry.url, null, 0)) : (args.loading.del(url), 
                    entry.assets.push(handle), args.cache[url] = _this._handlePool.lock(handle), args.loading.isEmpty() && _this.onResourceComplete(entry.url));
                }
                var _this = this, args = {
                    loading: new utils.collections.Set(),
                    onComplete: callback,
                    cache: {}
                }, path = config.geometry[0][0];
                mesh.MeshDataPool.instance.load(path, callback), args.loading.add(path);
                var group = config.group;
                if (group) for (var name_6 in group) {
                    var partGroup = group[name_6];
                    for (var alias in partGroup) for (var _i = 0, actions_1 = partGroup[alias]; _i < actions_1.length; _i++) {
                        var action = actions_1[_i];
                        mesh.AnimationDataPool.instance.load(action[0], callback), args.loading.add(action[0]);
                    }
                }
                var children = config.children;
                if (children) for (var _a = 0, children_1 = children; _a < children_1.length; _a++) {
                    var path_1 = children_1[_a].geometry[0][0];
                    mesh.MeshDataPool.instance.load(path_1, callback), args.loading.add(path_1);
                }
                entry.args = args;
            }, AvatarDataPool.prototype.clearLoading = function(args) {
                for (var _i = 0, _a = args.loading.values; _i < _a.length; _i++) {
                    var url = _a[_i];
                    StringUtils.endsWith(url, ".mbd") ? mesh.MeshDataPool.instance.cancel(url, args.onComplete) : StringUtils.endsWith(url, ".abd") && mesh.AnimationDataPool.instance.cancel(url, args.onComplete);
                }
                args.loading.clear();
            }, AvatarDataPool.prototype.cancel = function(url, callback) {
                var entry = this.findNeedCancelEntry(url, callback);
                null != entry && (this.clearLoading(entry.args), delete this._waitPool[url], base.assets.AssetEntry.freeEntry(entry));
            }, AvatarDataPool.prototype.onResourceComplete = function(url) {
                var args = this._waitPool[url].args;
                this.onComplete(url, {
                    config: this.entityPack[url],
                    res: args.cache
                }, 1);
            }, AvatarDataPool._instance = new AvatarDataPool(), AvatarDataPool;
        }(base.assets.AssetPoolBase);
        mesh.AvatarDataPool = AvatarDataPool;
    }(base.mesh || (base.mesh = {}));
}(base || (base = {})), function(base) {
    !function(mesh) {
        var BoundBox = Laya.BoundBox, BoundSphere = Laya.BoundSphere, IndexBuffer3D = Laya.IndexBuffer3D, PrimitiveMesh = Laya.PrimitiveMesh, Stat = Laya.Stat, Vector3 = Laya.Vector3, VertexBuffer3D = Laya.VertexBuffer3D, VertexPositionNormal = Laya.VertexPositionNormal, WebGL = Laya.WebGL, WebGLContext = Laya.WebGLContext, ArrayUtils = utils.ArrayUtils, BatchMesh = function(_super) {
            function BatchMesh(capacity) {
                void 0 === capacity && (capacity = 600);
                var _this = _super.call(this) || this;
                return _this._elements = [], _this._size = 0, _this._capacity = capacity, _this._batchData = new Float32Array(_this._capacity), 
                _this._numberVertices = 0, _this._numberIndices = 0, _this._offsetMatrix = new Float32Array(480), 
                _this._positions = [], _this.recreateResource(), _this._generateBoundingObject(), 
                _this._needUpdate = !1, _this;
            }
            return __extends(BatchMesh, _super), BatchMesh.prototype._getVertexBuffer = function(index) {
                return void 0 === index && (index = 0), this.checkBuffer(), 0 === index ? this._vertexBuffer : null;
            }, BatchMesh.prototype._getIndexBuffer = function() {
                return this.checkBuffer(), this._indexBuffer;
            }, BatchMesh.prototype.checkBuffer = function() {
                this._needUpdate && (this._needUpdate = !1, this._size > this._capacity ? (this._capacity = Math.floor(1.5 * this._size), 
                this.recreateResource()) : (this.fillVertices(), this._vertexBuffer.setData(this._batchData, 0, 0, 24 * this._size)));
            }, BatchMesh.prototype.fillVertices = function() {
                for (var offset = 0, count = this._elements.length, i = 0; i < count; ++i) for (var element = this._elements[i], id = i % 30, uvs = element.uvs, size = element.uvs.length >> 2, vertices = this._batchData, index = 0, width = element.width, halfHeight = element.height >> 1, xOffset = -size / 2 * element.width, j = 0; j < size; ++j) {
                    var uOffset = uvs[index++], vOffset = uvs[index++], uScale = uvs[index++], vScale = uvs[index++], left = xOffset + j * width;
                    vertices[offset++] = left, vertices[offset++] = halfHeight, vertices[offset++] = 0, 
                    vertices[offset++] = uOffset, vertices[offset++] = vOffset, vertices[offset++] = id, 
                    vertices[offset++] = left + width, vertices[offset++] = halfHeight, vertices[offset++] = 0, 
                    vertices[offset++] = 1 * uScale + uOffset, vertices[offset++] = vOffset, vertices[offset++] = id, 
                    vertices[offset++] = left, vertices[offset++] = -halfHeight, vertices[offset++] = 0, 
                    vertices[offset++] = uOffset, vertices[offset++] = 1 * vScale + vOffset, vertices[offset++] = id, 
                    vertices[offset++] = left + width, vertices[offset++] = -halfHeight, vertices[offset++] = 0, 
                    vertices[offset++] = 1 * uScale + uOffset, vertices[offset++] = 1 * vScale + vOffset, 
                    vertices[offset++] = id;
                }
            }, BatchMesh.prototype.addElement = function(element) {
                var size = element.uvs.length >> 2;
                this._elements.push(element), this._size += size, this._needUpdate = !0;
            }, BatchMesh.prototype.removeElement = function(element) {
                if (-1 != ArrayUtils.remove(this._elements, element)) {
                    var size = element.uvs.length >> 2;
                    this._size -= size, this._needUpdate = !0;
                }
            }, BatchMesh.prototype.clear = function() {
                this._size = 0, this._elements.length = 0;
            }, BatchMesh.prototype._getPositions = function() {
                this.checkBuffer();
                for (var positionElement, vertices = [], vertexElements = this._vertexBuffer.vertexDeclaration.getVertexElements(), j = 0; j < vertexElements.length; j++) {
                    var vertexElement = vertexElements[j];
                    if ("vector3" === vertexElement.elementFormat && 0 === vertexElement.elementUsage) {
                        positionElement = vertexElement;
                        break;
                    }
                }
                var verticesData = this._vertexBuffer.getData();
                for (j = 0; j < verticesData.length; j += this._vertexBuffer.vertexDeclaration.vertexStride / 4) {
                    var offset = j + positionElement.offset / 4, position = new Vector3(verticesData[offset + 0], verticesData[offset + 1], verticesData[offset + 2]);
                    vertices.push(position);
                }
                return vertices;
            }, BatchMesh.prototype.recreateResource = function() {
                this.disposeResource(), this._numberVertices = 4 * this._capacity, this._numberIndices = 6 * this._capacity;
                var vertexDeclaration = VertexPositionNormal.vertexDeclaration, vertexFloatStride = vertexDeclaration.vertexStride / 4, vertices = new Float32Array(this._numberVertices * vertexFloatStride);
                this._batchData = vertices;
                for (var indices = new Uint16Array(this._numberIndices), offset = 0, i = 0; i < this._capacity; ++i) indices[offset++] = 4 * i + 0, 
                indices[offset++] = 4 * i + 1, indices[offset++] = 4 * i + 2, indices[offset++] = 4 * i + 3, 
                indices[offset++] = 4 * i + 2, indices[offset++] = 4 * i + 1;
                this.fillVertices(), this._vertexBuffer = new VertexBuffer3D(vertexDeclaration, this._numberVertices, WebGLContext.DYNAMIC_DRAW, !0), 
                this._vertexBuffer._addReference(), this._indexBuffer = new IndexBuffer3D(IndexBuffer3D.INDEXTYPE_USHORT, this._numberIndices, WebGLContext.STATIC_DRAW, !0), 
                this._indexBuffer._addReference(), this._vertexBuffer.setData(vertices), this._indexBuffer.setData(indices), 
                this.memorySize = 2 * (this._vertexBuffer._byteLength + this._indexBuffer._byteLength), 
                this.completeCreate();
            }, BatchMesh.prototype._beforeRender = function(state) {
                return 0 != this._elements.length && _super.prototype._beforeRender.call(this, state);
            }, BatchMesh.prototype._render = function(state) {
                for (var renderElement = state.renderElement, numberIndices = 0, offsetIndices = 0, count = 0, i = 0; i < this._elements.length; ++i) {
                    var literal = this._elements[i];
                    numberIndices += 6 * (literal.uvs.length >> 2), this._offsetMatrix.set(literal.matrix.elements, 16 * count), 
                    30 == ++count && (this.doRender(renderElement, state, numberIndices, offsetIndices), 
                    offsetIndices += 2 * numberIndices, count = numberIndices = 0);
                }
                0 != count && this.doRender(renderElement, state, numberIndices, offsetIndices);
            }, BatchMesh.prototype.doRender = function(renderElement, state, numberIndices, offsetIndices) {
                renderElement._shaderValue.setValue(0, this._offsetMatrix), state._shader.uploadRenderElementUniforms(renderElement._shaderValue.data), 
                WebGL.mainContext.drawElements(4, numberIndices, 5123, offsetIndices), Stat.drawCall++, 
                Stat.trianglesFaces += numberIndices / 3;
            }, BatchMesh.prototype._generateBoundingObject = function() {
                this._boundingSphere = new BoundSphere(Vector3.ZERO, 1), this._boundingBox = new BoundBox(Vector3.ZERO, Vector3.ONE);
            }, BatchMesh;
        }(PrimitiveMesh);
        mesh.BatchMesh = BatchMesh;
        var BatchLiteralhMesh = function(_super) {
            function BatchLiteralhMesh(capacity) {
                void 0 === capacity && (capacity = 1200);
                var _this = _super.call(this) || this;
                return _this._elements = [], _this._size = 0, _this._capacity = capacity, _this._batchData = new Float32Array(_this._capacity), 
                _this._numberVertices = 0, _this._numberIndices = 0, _this._offsetMatrix = new Float32Array(480), 
                _this._positions = [], _this.recreateResource(), _this._generateBoundingObject(), 
                _this._needUpdate = !1, _this;
            }
            return __extends(BatchLiteralhMesh, _super), BatchLiteralhMesh.prototype._getVertexBuffer = function(index) {
                return void 0 === index && (index = 0), this.checkBuffer(), 0 === index ? this._vertexBuffer : null;
            }, BatchLiteralhMesh.prototype._getIndexBuffer = function() {
                return this.checkBuffer(), this._indexBuffer;
            }, BatchLiteralhMesh.prototype.checkBuffer = function() {
                this._needUpdate && (this._needUpdate = !1, this._size > this._capacity ? (this._capacity = Math.floor(1.5 * this._size), 
                this.recreateResource()) : (this.fillVertices(), this._vertexBuffer.setData(this._batchData, 0, 0, 24 * this._size)));
            }, BatchLiteralhMesh.prototype.fillVertices = function() {
                for (var offset = 0, count = this._elements.length, i = 0; i < count; ++i) {
                    for (var element = this._elements[i], id = i % 60, uvs = element.uvs, size = element.uvs.length >> 2, vertices = this._batchData, index = 0, elementWidth = 0, sizes = element.sizes, j = 0; j < size; ++j) elementWidth += sizes[2 * j];
                    var left = -(elementWidth >> 1);
                    for (j = 0; j < size; ++j) {
                        var width = sizes[2 * j], halfHeight = sizes[2 * j + 1] >> 1, uOffset = uvs[index++], vOffset = uvs[index++], uScale = uvs[index++], vScale = uvs[index++];
                        vertices[offset++] = left, vertices[offset++] = halfHeight, vertices[offset++] = 0, 
                        vertices[offset++] = uOffset, vertices[offset++] = vOffset, vertices[offset++] = id, 
                        vertices[offset++] = left + width, vertices[offset++] = halfHeight, vertices[offset++] = 0, 
                        vertices[offset++] = 1 * uScale + uOffset, vertices[offset++] = vOffset, vertices[offset++] = id, 
                        vertices[offset++] = left, vertices[offset++] = -halfHeight, vertices[offset++] = 0, 
                        vertices[offset++] = uOffset, vertices[offset++] = 1 * vScale + vOffset, vertices[offset++] = id, 
                        vertices[offset++] = left + width, vertices[offset++] = -halfHeight, vertices[offset++] = 0, 
                        vertices[offset++] = 1 * uScale + uOffset, vertices[offset++] = 1 * vScale + vOffset, 
                        vertices[offset++] = id, left += width;
                    }
                }
            }, BatchLiteralhMesh.prototype.addElement = function(element) {
                var size = element.uvs.length >> 2;
                this._elements.push(element), this._size += size, this._needUpdate = !0;
            }, BatchLiteralhMesh.prototype.removeElement = function(element) {
                if (-1 != ArrayUtils.remove(this._elements, element)) {
                    var size = element.uvs.length >> 2;
                    this._size -= size, this._needUpdate = !0;
                }
            }, BatchLiteralhMesh.prototype.clear = function() {
                this._size = 0, this._elements.length = 0;
            }, BatchLiteralhMesh.prototype._getPositions = function() {
                this.checkBuffer();
                for (var positionElement, vertices = [], vertexElements = this._vertexBuffer.vertexDeclaration.getVertexElements(), j = 0; j < vertexElements.length; j++) {
                    var vertexElement = vertexElements[j];
                    if ("vector3" === vertexElement.elementFormat && 0 === vertexElement.elementUsage) {
                        positionElement = vertexElement;
                        break;
                    }
                }
                var verticesData = this._vertexBuffer.getData();
                for (j = 0; j < verticesData.length; j += this._vertexBuffer.vertexDeclaration.vertexStride / 4) {
                    var ofset = j + positionElement.offset / 4, position = new Vector3(verticesData[ofset + 0], verticesData[ofset + 1], verticesData[ofset + 2]);
                    vertices.push(position);
                }
                return vertices;
            }, BatchLiteralhMesh.prototype.recreateResource = function() {
                this.disposeResource(), this._numberVertices = 4 * this._capacity, this._numberIndices = 6 * this._capacity;
                var vertexDeclaration = VertexPositionNormal.vertexDeclaration, vertexFloatStride = vertexDeclaration.vertexStride / 4, vertices = new Float32Array(this._numberVertices * vertexFloatStride);
                this._batchData = vertices;
                for (var indices = new Uint16Array(this._numberIndices), offset = 0, i = 0; i < this._capacity; ++i) indices[offset++] = 4 * i + 0, 
                indices[offset++] = 4 * i + 1, indices[offset++] = 4 * i + 2, indices[offset++] = 4 * i + 3, 
                indices[offset++] = 4 * i + 2, indices[offset++] = 4 * i + 1;
                this.fillVertices(), this._vertexBuffer = new VertexBuffer3D(vertexDeclaration, this._numberVertices, WebGLContext.DYNAMIC_DRAW, !0), 
                this._vertexBuffer._addReference(), this._indexBuffer = new IndexBuffer3D(IndexBuffer3D.INDEXTYPE_USHORT, this._numberIndices, WebGLContext.STATIC_DRAW, !0), 
                this._indexBuffer._addReference(), this._vertexBuffer.setData(vertices), this._indexBuffer.setData(indices), 
                this.memorySize = 2 * (this._vertexBuffer._byteLength + this._indexBuffer._byteLength), 
                this.completeCreate();
            }, BatchLiteralhMesh.prototype._beforeRender = function(state) {
                return 0 != this._elements.length && _super.prototype._beforeRender.call(this, state);
            }, BatchLiteralhMesh.prototype._render = function(state) {
                for (var renderElement = state.renderElement, numberIndices = 0, offsetIndices = 0, count = 0, i = 0; i < this._elements.length; ++i) {
                    var literal = this._elements[i];
                    numberIndices += 6 * (literal.uvs.length >> 2), this._offsetMatrix.set(literal.scale.elements, 8 * count), 
                    this._offsetMatrix[8 * count + 3] = literal.alpha, this._offsetMatrix.set(literal.offset.elements, 8 * count + 4), 
                    60 == ++count && (this.doRender(renderElement, state, numberIndices, offsetIndices), 
                    offsetIndices += 2 * numberIndices, count = numberIndices = 0);
                }
                0 != count && this.doRender(renderElement, state, numberIndices, offsetIndices);
            }, BatchLiteralhMesh.prototype.doRender = function(renderElement, state, numberIndices, offsetIndices) {
                renderElement._shaderValue.setValue(0, this._offsetMatrix), state._shader.uploadRenderElementUniforms(renderElement._shaderValue.data), 
                WebGL.mainContext.drawElements(4, numberIndices, 5123, offsetIndices), Stat.drawCall++, 
                Stat.trianglesFaces += numberIndices / 3;
            }, BatchLiteralhMesh.prototype._generateBoundingObject = function() {
                this._boundingSphere = new BoundSphere(Vector3.ZERO, 1), this._boundingBox = new BoundBox(Vector3.ZERO, Vector3.ONE);
            }, BatchLiteralhMesh;
        }(PrimitiveMesh);
        mesh.BatchLiteralhMesh = BatchLiteralhMesh;
    }(base.mesh || (base.mesh = {}));
}(base || (base = {})), function(base) {
    !function(mesh) {
        var GeometryMesh = function(_super) {
            function GeometryMesh(vb, ib) {
                var _this = _super.call(this) || this;
                return _this._indexBuffer = ib, _this._indexBuffer._addReference(), _this._vertexBuffer = vb, 
                _this._vertexBuffer._addReference(), _this._numberVertices = vb.vertexCount, _this._numberIndices = ib.indexCount, 
                _this._generateBoundingObject(), _this.completeCreate(), _this;
            }
            return __extends(GeometryMesh, _super), GeometryMesh.prototype._generateBoundingObject = function() {}, 
            GeometryMesh.prototype._removeReference = function() {
                _super.prototype._removeReference.call(this), this.referenceCount <= 0 && this.destroy();
            }, GeometryMesh;
        }(Laya.PrimitiveMesh), SkinnedGeometryMesh = function(_super) {
            function SkinnedGeometryMesh(vb, ib, numJoint) {
                for (var _this = _super.call(this, vb, ib) || this, skinnedData = new Float32Array(12 * numJoint), j = 0, i = 0; i < numJoint; ++i) skinnedData[j++] = 1, 
                skinnedData[j++] = 0, skinnedData[j++] = 0, skinnedData[j++] = 0, skinnedData[j++] = 0, 
                skinnedData[j++] = 1, skinnedData[j++] = 0, skinnedData[j++] = 0, skinnedData[j++] = 0, 
                skinnedData[j++] = 0, skinnedData[j++] = 1, skinnedData[j++] = 0;
                return _this.skinnedData = skinnedData, _this;
            }
            return __extends(SkinnedGeometryMesh, _super), SkinnedGeometryMesh.prototype._render = function(state) {
                var renderElement = state.renderElement;
                renderElement._shaderValue.setValue(0, this.skinnedData), state._shader.uploadRenderElementUniforms(renderElement._shaderValue.data), 
                _super.prototype._render.call(this, state);
            }, SkinnedGeometryMesh;
        }(mesh.GeometryMesh = GeometryMesh);
        mesh.SkinnedGeometryMesh = SkinnedGeometryMesh;
    }(base.mesh || (base.mesh = {}));
}(base || (base = {})), function(base) {
    !function(textures) {
        var RecoverQueue = base.assets.RecoverQueue, Resource = Laya.Resource, ResourcePool = base.assets.ResourcePool, NullTexture = new Laya.SolidColorTexture2D(new Laya.Vector4(0, 0, 0, 0));
        NullTexture.lock = !0;
        var LayaTexture2D = function(_super) {
            function LayaTexture2D(priority) {
                var _this = _super.call(this) || this;
                return _this.onResourceComplete = function(url, handle, buffer) {
                    if (_this._isComplete = !0, !buffer) return _this.event("error"), void console.log("Load failure: " + url);
                    if (buffer instanceof ArrayBuffer) {
                        var view = new DataView(buffer);
                        _this.resetResource(new Uint8Array(buffer, 8), view.getUint32(0), view.getUint32(4));
                    } else _this.resetResource(buffer, buffer.width, buffer.height);
                }, _this._isComplete = !1, _this._priority = priority, _this._isRecover = !1, _this;
            }
            return __extends(LayaTexture2D, _super), LayaTexture2D.load = function(url, priority, args) {
                void 0 === priority && (priority = 0), void 0 === args && (args = null);
                var cache = Resource.getResourceByURL(url);
                if (null != cache) return cache;
                var result = new LayaTexture2D(priority);
                return null != args && (args.wrapModeU && (result._wrapModeU = args.wrapModeU), 
                args.wrapModeV && (result._wrapModeV = args.wrapModeV)), result._loaded = !1, result._setUrl(url), 
                Laya.loader.cacheRes(url, result), ResourcePool.instance.load(url, result.onResourceComplete, priority), 
                result;
            }, LayaTexture2D.prototype.resetResource = function(buffer, w, h) {
                this._buffer = buffer, this._width = w, this._height = h, this._mipmap = !1, this._magFifter = 9728, 
                this._minFifter = 9728, this._size = new Laya.Size(this._width, this._height), this._type = 3553, 
                buffer instanceof Uint8Array ? this._format = this._buffer.byteLength / (w * h) == 4 ? 6408 : 6407 : this._format = -1 == buffer.src.indexOf(".jpg") ? 6408 : 6407, 
                this._endLoaded(), this.activeResource(), this._buffer = null;
            }, LayaTexture2D.prototype.recreateResource = function() {
                this._buffer && (this.createWebGlTexture(), this.completeCreate());
            }, LayaTexture2D.prototype.createWebGlTexture = function() {
                var w = this._width, h = this._height, isPot = Laya.Arith.isPOT(w, h), wrapModeU = 0 == this._wrapModeU && isPot ? 10497 : 33071, wrapModeV = 0 == this._wrapModeV && isPot ? 10497 : 33071;
                this.memorySize = isPot ? w * h * 4 * (1 + 1 / 3) : w * h * 4, this._source = textures.TexturePool.createWebGlTexture(this._type, this._format, this._minFifter, this._magFifter, wrapModeU, wrapModeV, this._width, this._height, this._buffer);
            }, LayaTexture2D.prototype.disposeResource = function() {
                this._source && (textures.TexturePool.cacheTexture(this._source), this._source = null, 
                this._buffer = null, this.memorySize = 0);
            }, LayaTexture2D.prototype._addReference = function() {
                this._isRecover && (this._isRecover = !1, RecoverQueue.default.removeToQueue(this.url), 
                this._isComplete || ResourcePool.instance.load(this.url, this.onResourceComplete, this._priority)), 
                _super.prototype._addReference.call(this);
            }, LayaTexture2D.prototype._removeReference = function() {
                _super.prototype._removeReference.call(this), this.referenceCount <= 0 && (this._isComplete || ResourcePool.instance.cancel(this.url, this.onResourceComplete), 
                this._isRecover = !0, RecoverQueue.default.addToQueue(this.url, this.width * this.height * 4, function(url) {
                    var cache = Resource.getResourceByURL(url);
                    null != cache && cache.destroy();
                }, 3e5));
            }, LayaTexture2D.prototype.destroy = function() {
                this._isComplete || ResourcePool.instance.cancel(this.url, this.onResourceComplete), 
                _super.prototype.destroy.call(this);
            }, Object.defineProperty(LayaTexture2D.prototype, "defaulteTexture", {
                get: function() {
                    return NullTexture;
                },
                enumerable: !0,
                configurable: !0
            }), LayaTexture2D;
        }(Laya.BaseTexture);
        textures.LayaTexture2D = LayaTexture2D;
    }(base.textures || (base.textures = {}));
}(base || (base = {})), function(base) {
    var mesh_1, HandlePool, ArrayUtils, LwjsAvatar;
    mesh_1 = base.mesh || (base.mesh = {}), HandlePool = base.assets.HandlePool, ArrayUtils = utils.ArrayUtils, 
    LwjsAvatar = function(_super) {
        function LwjsAvatar() {
            var _this = _super.call(this) || this;
            return _this.onResourceComplete = function(url, handle, res) {
                if (0 != handle) {
                    HandlePool.instance.lock(handle), _this._handle = handle;
                    var config = res.config, cache = res.res;
                    _this.parseCustomProps(config, "main", cache);
                    var children = config.children;
                    if (null != children) for (var i = 0, length_9 = children.length; i < length_9; ++i) {
                        var element = children[i], child = new LwjsAvatar();
                        child._loaded = !0, child.parseCustomProps(element, element.name, cache), _this.bindTo(element.parent[1], child), 
                        _this._partChildren[element.name] = child;
                    }
                    _this._animation && (_this._animation.mounts = _this._mounts), _this.active = !0, 
                    _this._loaded = !0, _this.event(Laya.Event.HIERARCHY_LOADED, _this);
                }
            }, _this._mounts = [], _this._handle = 0, _this;
        }
        return __extends(LwjsAvatar, _super), LwjsAvatar.load = function(url) {
            var av = new LwjsAvatar();
            return av._setUrl(url), av.active = !1, av._loaded = !1, mesh_1.AvatarDataPool.instance.load(url, av.onResourceComplete), 
            av;
        }, LwjsAvatar.prototype.destroy = function(destroyChild) {
            void 0 === destroyChild && (destroyChild = !0), 0 != this._handle ? (HandlePool.instance.free(this._handle), 
            this._handle = 0) : mesh_1.AvatarDataPool.instance.cancel(this.url, this.onResourceComplete), 
            _super.prototype.destroy.call(this, destroyChild);
        }, Object.defineProperty(LwjsAvatar.prototype, "partChildren", {
            get: function() {
                return this._partChildren;
            },
            enumerable: !0,
            configurable: !0
        }), LwjsAvatar.prototype.bindTo = function(name, child) {
            for (var _i = 0, _a = this._mounts; _i < _a.length; _i++) {
                if ((tuple = _a[_i])[1] == child) return void (tuple[0] = name);
            }
            var tuple;
            if ((this._mounts.push([ name, child ]), this.addChild(child), null != this._geometryOffsets) && null != (tuple = this._geometryOffsets[name])) {
                var maxtrix = child.transform.localMatrix;
                maxtrix.elements.set(tuple[1]), child.transform.localMatrix = maxtrix;
            }
        }, LwjsAvatar.prototype.unbindTo = function(child) {
            for (var i = 0, size = this._mounts.length; i < size; ++i) {
                if (this._mounts[i][1] == child) return ArrayUtils.removeAt(this._mounts, i), void this.removeChild(child);
            }
        }, LwjsAvatar.prototype.unbindAll = function() {
            for (var i = 0, size = this._mounts.length; i < size; ++i) this.removeChild(this._mounts[i][1]);
            this._mounts.length = 0;
        }, Object.defineProperty(LwjsAvatar.prototype, "animation", {
            get: function() {
                return this._animation;
            },
            enumerable: !0,
            configurable: !0
        }), LwjsAvatar.prototype.parseCustomProps = function(config, part, res) {
            this.name = config.name;
            var geometry, material, mesh = res[config.geometry[0][0]];
            if (null == mesh.skeleton) geometry = new mesh_1.GeometryMesh(mesh.vb[0], mesh.ib[0]), 
            material = new base.materials.AvatarMaterial(); else {
                var skinnedGeometry = new mesh_1.SkinnedGeometryMesh(mesh.vb[0], mesh.ib[0], mesh.skeleton.boneParentIndexs.length);
                material = new base.materials.AvatarSkinnedMaterial(), this._animation = new mesh_1.SkeletonAnimation(mesh, skinnedGeometry), 
                geometry = skinnedGeometry;
            }
            if (this._geometryOffsets = mesh.geometryOffsets, null != this._geometryOffsets) for (var _i = 0, _a = this._mounts; _i < _a.length; _i++) {
                var mount = _a[_i], tuple = this._geometryOffsets[mount[0]];
                if (null != tuple) {
                    var maxtrix = mount[1].transform.localMatrix;
                    maxtrix.elements.set(tuple[1]), mount[1].transform.localMatrix = maxtrix;
                }
            }
            var textureUrl = config.geometry[0][2][0];
            material.diffuseTexture = base.textures.LayaTexture2D.load(textureUrl), material.cull = Laya.BaseMaterial.CULL_FRONT, 
            this.meshRender.sharedMaterials = [ material ], this.meshFilter.sharedMesh = geometry;
            var group = config.group;
            for (var name_7 in group) {
                var partGroup = group[name_7];
                if (partGroup) {
                    var action = partGroup[part];
                    action && this._animation.addClip(name_7, res[action[0][0]]);
                }
            }
        }, LwjsAvatar;
    }(Laya.MeshSprite3D), mesh_1.LwjsAvatar = LwjsAvatar;
}(base || (base = {})), function(base) {
    var mesh_2, AssetEntry, AssetPoolBase, ResourcePool, MeshDataPool;
    mesh_2 = base.mesh || (base.mesh = {}), AssetEntry = base.assets.AssetEntry, AssetPoolBase = base.assets.AssetPoolBase, 
    ResourcePool = base.assets.ResourcePool, MeshDataPool = function(_super) {
        function MeshDataPool() {
            var _this = _super.call(this, "MeshDataPool", 5242880) || this;
            return _this.doRecover = function(entry) {
                entry.res.destroy();
            }, _this.onResourceComplete = function(url, handle, res) {
                if (null == res) _this.onComplete(url, null, 0); else {
                    var mesh_3 = mesh_2.MeshData.create(res);
                    _this.onComplete(url, mesh_3, res.byteLength);
                }
            }, _this;
        }
        return __extends(MeshDataPool, _super), Object.defineProperty(MeshDataPool, "instance", {
            get: function() {
                return MeshDataPool._instance;
            },
            enumerable: !0,
            configurable: !0
        }), MeshDataPool.prototype.load = function(url, callback) {
            var entry = this.checkNeedLoad(url, callback, !1);
            null != entry && 0 == entry.status && (entry.status = 1, ResourcePool.instance.load(url, this.onResourceComplete, 0, !1, !1, 1));
        }, MeshDataPool.prototype.cancel = function(url, callback) {
            var entry = this.findNeedCancelEntry(url, callback);
            null != entry && (ResourcePool.instance.cancel(url, this.onResourceComplete), delete this._waitPool[url], 
            AssetEntry.freeEntry(entry));
        }, MeshDataPool._instance = new MeshDataPool(), MeshDataPool;
    }(AssetPoolBase), mesh_2.MeshDataPool = MeshDataPool;
}(base || (base = {})), function(base) {
    !function(mesh) {
        var AnimationClip = function() {
            function AnimationClip(name, clip, skeleton, skinnedData, children) {
                this._clip = clip, this._name = name, this._progress = -1, this._cursor = 0, this._skinnedData = skinnedData, 
                this._children = children, this._skeleton = skeleton, this._skeletonClip = skeleton.getSkeletonClip(clip);
            }
            return AnimationClip.prototype.reset = function() {
                this._progress = 0, this._cursor = 0, this._clip.getSkinnedData(this._cursor, this._skeleton, this._skinnedData), 
                this.updateAttachment();
            }, Object.defineProperty(AnimationClip.prototype, "mounts", {
                get: function() {
                    return this._children;
                },
                set: function(value) {
                    this._children != value && (this._children = value, this.updateAttachment());
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(AnimationClip.prototype, "duration", {
                get: function() {
                    return this._clip.numFrames * this._clip.framerate;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(AnimationClip.prototype, "progress", {
                get: function() {
                    return this._progress;
                },
                set: function(value) {
                    var numFrames = this._clip.numFrames, rate = (this._progress = value) - Math.floor(value), index = 0 == rate && 0 != value ? numFrames - 1 : Math.floor(rate * numFrames);
                    this._cursor != index && (this._cursor = index, this._clip.getSkinnedData(this._cursor, this._skeleton, this._skinnedData), 
                    this.updateAttachment());
                },
                enumerable: !0,
                configurable: !0
            }), AnimationClip.prototype.updateAttachment = function() {
                if (this._children && this._skeletonClip) for (var t = void 0, _i = 0, _a = this._children; _i < _a.length; _i++) {
                    var tuple = _a[_i];
                    (t = tuple[1].transform).localMatrix = this._skeletonClip.getDummyMatrix(this._cursor, tuple[0], t.localMatrix);
                }
            }, AnimationClip;
        }();
        mesh.AnimationClip = AnimationClip;
        var SkeletonAnimation = function() {
            function SkeletonAnimation(data, geometry) {
                this._skinnedData = geometry.skinnedData, this._skeleton = data.skeleton, this._clips = {};
            }
            return Object.defineProperty(SkeletonAnimation.prototype, "mounts", {
                get: function() {
                    return this._mounts;
                },
                set: function(value) {
                    if (this._mounts != value) for (var key in this._mounts = value, this._clips) this._clips[key].mounts = value;
                },
                enumerable: !0,
                configurable: !0
            }), SkeletonAnimation.prototype.addClip = function(name, clip) {
                this._clips[name] = new AnimationClip(name, clip, this._skeleton, this._skinnedData, this._mounts);
            }, SkeletonAnimation.prototype.getAnimationClip = function(name) {
                return this._clips[name];
            }, SkeletonAnimation;
        }();
        mesh.SkeletonAnimation = SkeletonAnimation;
    }(base.mesh || (base.mesh = {}));
}(base || (base = {})), function(base) {
    !function(mesh) {
        var IndexBuffer3D = Laya.IndexBuffer3D, PrimitiveMesh = Laya.PrimitiveMesh, VertexBuffer3D = Laya.VertexBuffer3D, VertexPositionNormal = Laya.VertexPositionNormal, WebGLContext = Laya.WebGLContext, TileAtlasMesh = function(_super) {
            function TileAtlasMesh(width, height) {
                var _this = _super.call(this) || this;
                return _this._size = 0, _this._capacity = 8, _this._width = width, _this._height = height, 
                _this.activeResource(), _this._positions = _this._getPositions(), _this._generateBoundingObject(), 
                _this;
            }
            return __extends(TileAtlasMesh, _super), TileAtlasMesh.prototype.reset = function(width, height) {
                this._width === width && this._height === height || (this._width = width, this._height = height, 
                this.releaseResource(), this.activeResource());
            }, TileAtlasMesh.prototype.recreateResource = function() {
                this.disposeResource();
                var halfW = this._width >> 1, halfH = this._height >> 1;
                this._numberVertices = 4 * this._capacity, this._numberIndices = 6 * this._capacity;
                for (var vertexDeclaration = VertexPositionNormal.vertexDeclaration, vertexFloatStride = vertexDeclaration.vertexStride / 4, vertices = new Float32Array(this._numberVertices * vertexFloatStride), indices = new Uint16Array(this._numberIndices), offset = 0, index = 0, i = 0; i < this._capacity; ++i) vertices[index++] = -halfW, 
                vertices[index++] = halfH, vertices[index++] = 0, vertices[index++] = 0, vertices[index++] = 0, 
                vertices[index++] = i, vertices[index++] = halfW, vertices[index++] = halfH, vertices[index++] = 0, 
                vertices[index++] = 1, vertices[index++] = 0, vertices[index++] = i, vertices[index++] = -halfW, 
                vertices[index++] = -halfH, vertices[index++] = 0, vertices[index++] = 0, vertices[index++] = 1, 
                vertices[index++] = i, vertices[index++] = halfW, vertices[index++] = -halfH, vertices[index++] = 0, 
                vertices[index++] = 1, vertices[index++] = 1, vertices[index++] = i, indices[offset++] = 4 * i + 0, 
                indices[offset++] = 4 * i + 1, indices[offset++] = 4 * i + 2, indices[offset++] = 4 * i + 3, 
                indices[offset++] = 4 * i + 2, indices[offset++] = 4 * i + 1;
                this._vertexBuffer = new VertexBuffer3D(vertexDeclaration, this._numberVertices, WebGLContext.STATIC_DRAW, !0), 
                this._vertexBuffer._addReference(), this._indexBuffer = new IndexBuffer3D(IndexBuffer3D.INDEXTYPE_USHORT, this._numberIndices, WebGLContext.STATIC_DRAW, !0), 
                this._indexBuffer._addReference(), this._vertexBuffer.setData(vertices), this._indexBuffer.setData(indices), 
                this.memorySize = 2 * (this._vertexBuffer._byteLength + this._indexBuffer._byteLength), 
                this.completeCreate();
            }, TileAtlasMesh;
        }(PrimitiveMesh);
        mesh.TileAtlasMesh = TileAtlasMesh;
    }(base.mesh || (base.mesh = {}));
}(base || (base = {})), function(base) {
    !function(particle) {
        !function(snowflake) {
            var BaseMaterial = Laya.BaseMaterial, Vector4 = Laya.Vector4, Resource = Laya.Resource, SnowflakeParticleMaterial = function(_super) {
                function SnowflakeParticleMaterial() {
                    var _this = _super.call(this) || this;
                    return _this.setShaderName("custom_particle_shader"), _this.renderMode = 6, _this;
                }
                return __extends(SnowflakeParticleMaterial, _super), SnowflakeParticleMaterial.load = function(url) {
                    var cache = Resource.getResourceByURL(url);
                    return null != cache ? cache : Laya.loader.create(url, null, null, SnowflakeParticleMaterial);
                }, SnowflakeParticleMaterial._parseSnowflakeParticleMaterial = function(textureMap, material, json) {
                    var customProps = json.customProps, diffuseTexture = customProps.diffuseTexture.texture2D;
                    diffuseTexture && (material.diffuseTexture = Laya.Loader.getRes(textureMap[diffuseTexture]));
                    var tintColorValue = customProps.tintColor;
                    tintColorValue && (material.tintColor = new Vector4(tintColorValue[0], tintColorValue[1], tintColorValue[2], tintColorValue[3]));
                }, Object.defineProperty(SnowflakeParticleMaterial, "defaultMaterial", {
                    get: function() {
                        return null != this._defaultMaterial && (this._defaultMaterial = new SnowflakeParticleMaterial()), 
                        this._defaultMaterial;
                    },
                    enumerable: !0,
                    configurable: !0
                }), SnowflakeParticleMaterial.prototype.onAsynLoaded = function(url, data, params) {
                    var jsonData = data[0];
                    if (jsonData.version) _super.prototype.onAsynLoaded.call(this, url, data, params); else {
                        var textureMap = data[1], props = jsonData.props;
                        for (var prop in props) this[prop] = props[prop];
                        SnowflakeParticleMaterial._parseSnowflakeParticleMaterial(textureMap, this, jsonData), 
                        this._endLoaded();
                    }
                    this.completeCreate();
                }, Object.defineProperty(SnowflakeParticleMaterial.prototype, "renderMode", {
                    set: function(value) {
                        switch (value) {
                          case 1:
                            this.renderQueue = 2e3, this.depthWrite = !0, this.cull = 2, this.blend = 0, this.alphaTest = !1, 
                            this._removeShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          case 2:
                            this.renderQueue = 2e3, this.depthWrite = !0, this.cull = 0, this.blend = 0, this.alphaTest = !1, 
                            this._removeShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          case 3:
                            this.depthWrite = !0, this.cull = 2, this.blend = 0, this.renderQueue = 2e3, this.alphaTest = !0, 
                            this._removeShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          case 4:
                            this.renderQueue = 2e3, this.depthWrite = !0, this.cull = 0, this.blend = 0, this.alphaTest = !0, 
                            this._removeShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          case 13:
                            this.renderQueue = 3e3, this.depthWrite = !0, this.cull = 2, this.blend = 1, this.srcBlend = 770, 
                            this.dstBlend = 771, this.alphaTest = !1, this._removeShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          case 14:
                            this.renderQueue = 3e3, this.depthWrite = !0, this.cull = 0, this.blend = 1, this.srcBlend = 770, 
                            this.dstBlend = 771, this.alphaTest = !1, this._removeShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          case 15:
                            this.renderQueue = 3e3, this.depthWrite = !0, this.cull = 2, this.blend = 1, this.srcBlend = 770, 
                            this.dstBlend = 1, this.alphaTest = !1, this._addShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          case 16:
                            this.renderQueue = 3e3, this.depthWrite = !0, this.cull = 0, this.blend = 1, this.srcBlend = 770, 
                            this.dstBlend = 1, this.alphaTest = !1, this._addShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          case 5:
                            this.renderQueue = 3e3, this.depthWrite = !1, this.cull = 2, this.blend = 1, this.srcBlend = 770, 
                            this.dstBlend = 771, this.alphaTest = !1, this._removeShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          case 6:
                            this.renderQueue = 3e3, this.depthWrite = !1, this.cull = 0, this.blend = 1, this.srcBlend = 770, 
                            this.dstBlend = 771, this.alphaTest = !1, this._removeShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          case 7:
                            this.renderQueue = 3e3, this.depthWrite = !1, this.cull = 2, this.blend = 1, this.srcBlend = 770, 
                            this.dstBlend = 1, this.alphaTest = !1, this._addShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          case 8:
                            this.renderQueue = 3e3, this.depthWrite = !1, this.cull = 0, this.blend = 1, this.srcBlend = 770, 
                            this.dstBlend = 1, this.alphaTest = !1, this._addShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          case 9:
                            this.renderQueue = 3e3, this.depthTest = 513, this.cull = 2, this.blend = 1, this.srcBlend = 770, 
                            this.dstBlend = 771, this.alphaTest = !1, this._removeShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          case 10:
                            this.renderQueue = 3e3, this.depthTest = 513, this.cull = 0, this.blend = 1, this.srcBlend = 770, 
                            this.dstBlend = 771, this.alphaTest = !1, this._removeShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          case 11:
                            this.renderQueue = 3e3, this.depthTest = 513, this.cull = 2, this.blend = 1, this.srcBlend = 770, 
                            this.dstBlend = 1, this.alphaTest = !1, this._addShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          case 12:
                            this.renderQueue = 3e3, this.depthTest = 513, this.cull = 0, this.blend = 1, this.srcBlend = 770, 
                            this.dstBlend = 1, this.alphaTest = !1, this._addShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG);
                            break;

                          default:
                            throw new Error("Material:renderMode value error.");
                        }
                    },
                    enumerable: !0,
                    configurable: !0
                }), Object.defineProperty(SnowflakeParticleMaterial.prototype, "tintColor", {
                    get: function() {
                        return this._getColor(2);
                    },
                    set: function(value) {
                        value ? this._addShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_TINTCOLOR) : this._removeShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_TINTCOLOR), 
                        this._setColor(2, value);
                    },
                    enumerable: !0,
                    configurable: !0
                }), Object.defineProperty(SnowflakeParticleMaterial.prototype, "tilingOffset", {
                    get: function() {
                        return this._getColor(3);
                    },
                    set: function(value) {
                        if (value) {
                            var valueE = value.elements;
                            1 != valueE[0] || 1 != valueE[1] || 0 != valueE[2] || 0 != valueE[3] ? this._addShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_TILINGOFFSET) : this._removeShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_TILINGOFFSET);
                        } else this._removeShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_TILINGOFFSET);
                        this._setColor(3, value);
                    },
                    enumerable: !0,
                    configurable: !0
                }), Object.defineProperty(SnowflakeParticleMaterial.prototype, "diffuseTexture", {
                    get: function() {
                        return this._getTexture(1);
                    },
                    set: function(value) {
                        value ? this._addShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_DIFFUSEMAP) : this._removeShaderDefine(SnowflakeParticleMaterial.SHADERDEFINE_DIFFUSEMAP), 
                        this._setTexture(1, value);
                    },
                    enumerable: !0,
                    configurable: !0
                }), Object.defineProperty(SnowflakeParticleMaterial.prototype, "periodX", {
                    get: function() {
                        return this._getNumber(12);
                    },
                    set: function(value) {
                        this._setNumber(12, value);
                    },
                    enumerable: !0,
                    configurable: !0
                }), Object.defineProperty(SnowflakeParticleMaterial.prototype, "moveSpeedX", {
                    get: function() {
                        return this._getNumber(13);
                    },
                    set: function(value) {
                        this._setNumber(13, value);
                    },
                    enumerable: !0,
                    configurable: !0
                }), Object.defineProperty(SnowflakeParticleMaterial.prototype, "moveSpeedY", {
                    get: function() {
                        return this._getNumber(14);
                    },
                    set: function(value) {
                        this._setNumber(14, value);
                    },
                    enumerable: !0,
                    configurable: !0
                }), SnowflakeParticleMaterial.RENDERMODE_OPAQUE = 1, SnowflakeParticleMaterial.RENDERMODE_OPAQUEDOUBLEFACE = 2, 
                SnowflakeParticleMaterial.RENDERMODE_CUTOUT = 3, SnowflakeParticleMaterial.RENDERMODE_CUTOUTDOUBLEFACE = 4, 
                SnowflakeParticleMaterial.RENDERMODE_TRANSPARENT = 13, SnowflakeParticleMaterial.RENDERMODE_TRANSPARENTDOUBLEFACE = 14, 
                SnowflakeParticleMaterial.RENDERMODE_ADDTIVE = 15, SnowflakeParticleMaterial.RENDERMODE_ADDTIVEDOUBLEFACE = 16, 
                SnowflakeParticleMaterial.RENDERMODE_DEPTHREAD_TRANSPARENT = 5, SnowflakeParticleMaterial.RENDERMODE_DEPTHREAD_TRANSPARENTDOUBLEFACE = 6, 
                SnowflakeParticleMaterial.RENDERMODE_DEPTHREAD_ADDTIVE = 7, SnowflakeParticleMaterial.RENDERMODE_DEPTHREAD_ADDTIVEDOUBLEFACE = 8, 
                SnowflakeParticleMaterial.RENDERMODE_NONDEPTH_TRANSPARENT = 9, SnowflakeParticleMaterial.RENDERMODE_NONDEPTH_TRANSPARENTDOUBLEFACE = 10, 
                SnowflakeParticleMaterial.RENDERMODE_NONDEPTH_ADDTIVE = 11, SnowflakeParticleMaterial.RENDERMODE_NONDEPTH_ADDTIVEDOUBLEFACE = 12, 
                SnowflakeParticleMaterial.SHADERDEFINE_DIFFUSEMAP = 0, SnowflakeParticleMaterial.SHADERDEFINE_TINTCOLOR = 0, 
                SnowflakeParticleMaterial.SHADERDEFINE_TILINGOFFSET = 0, SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG = 0, 
                SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEMASK = 0, SnowflakeParticleMaterial;
            }(BaseMaterial);
            snowflake.SnowflakeParticleMaterial = SnowflakeParticleMaterial;
        }(particle.snowflake || (particle.snowflake = {}));
    }(base.particle || (base.particle = {}));
}(base || (base = {})), function(base) {
    !function(mesh) {
        var AssetEntry = base.assets.AssetEntry, AssetPoolBase = base.assets.AssetPoolBase, SnowflakeParticleMaterial = base.particle.snowflake.SnowflakeParticleMaterial, LayaTexture2D = base.textures.LayaTexture2D, ResourcePool = base.assets.ResourcePool, ParticleMaterialPool = function(_super) {
            function ParticleMaterialPool() {
                var _this = _super.call(this, "ParticleMaterialPool", 10) || this;
                return _this.onConfigComplete = function(url, handle, res) {
                    if (res) {
                        var bytes = new Laya.Byte(res), data = JSON.parse(bytes.readUTFBytes());
                        Laya.Loader.preLoadedMap[url] = data, _this.onMaterilLmatLoaded(url, data);
                    }
                }, _this.onTextureDestroy = function(url, res) {
                    delete _this._textureCache[url], res._removeReference();
                }, _this.doRecover = function(entry) {
                    entry.res.destroy();
                }, _this.onResourceComplete = function(url, res) {
                    null == res ? _this.onComplete(url, null, 0) : _this.onComplete(url, res, 1);
                }, _this._textureCache = {}, _this;
            }
            return __extends(ParticleMaterialPool, _super), Object.defineProperty(ParticleMaterialPool, "instance", {
                get: function() {
                    return ParticleMaterialPool._instance;
                },
                enumerable: !0,
                configurable: !0
            }), ParticleMaterialPool.prototype.load = function(url, callback) {
                var entry = this.checkNeedLoad(url, callback, !1);
                if (null != entry && 0 == entry.status) {
                    entry.status = 1;
                    var data = Laya.Loader.preLoadedMap[url];
                    data ? (data instanceof Uint8Array && (data = msgpack.decode(data)), this.onMaterilLmatLoaded(url, data)) : ResourcePool.instance.load(url, this.onConfigComplete, 60);
                }
            }, ParticleMaterialPool.prototype.onMaterilLmatLoaded = function(url, res) {
                var formatSubUrl, entry = this._waitPool[url], materialBasePath = Laya.URL.getPath(url), urls = [], urlMap = {}, customProps = res.customProps, version = res.version;
                if (version) switch (version) {
                  case "LAYAMATERIAL:01":
                  case "LAYAMATERIAL:02":
                    var textures_1 = res.props.textures;
                    if (textures_1) for (var i = 0, n = textures_1.length; i < n; i++) {
                        var tex = textures_1[i], path = tex.path;
                        if (path) {
                            var extenIndex = path.length - 4;
                            path.indexOf(".exr") != extenIndex && path.indexOf(".EXR") != extenIndex || (path = path.substr(0, extenIndex) + ".png"), 
                            formatSubUrl = Laya3D.formatRelativePath(materialBasePath, path), urls.push({
                                url: formatSubUrl,
                                params: tex.params
                            }), urlMap[path] = formatSubUrl;
                        }
                    }
                    break;

                  default:
                    throw new Error("Laya3D:unkonwn version.");
                } else {
                    var diffuseTexture = customProps.diffuseTexture.texture2D;
                    if (diffuseTexture && (formatSubUrl = Laya3D._getMaterialTexturePath(diffuseTexture, null, materialBasePath), 
                    urls.push(formatSubUrl), urlMap[diffuseTexture] = formatSubUrl), customProps.normalTexture) {
                        var normalTexture = customProps.normalTexture.texture2D;
                        normalTexture && (formatSubUrl = Laya3D._getMaterialTexturePath(normalTexture, null, materialBasePath), 
                        urls.push(formatSubUrl), urlMap[normalTexture] = formatSubUrl);
                    }
                    if (customProps.specularTexture) {
                        var specularTexture = customProps.specularTexture.texture2D;
                        specularTexture && (formatSubUrl = Laya3D._getMaterialTexturePath(specularTexture, null, materialBasePath), 
                        urls.push(formatSubUrl), urlMap[specularTexture] = formatSubUrl);
                    }
                    if (customProps.emissiveTexture) {
                        var emissiveTexture = customProps.emissiveTexture.texture2D;
                        emissiveTexture && (formatSubUrl = Laya3D._getMaterialTexturePath(emissiveTexture, null, materialBasePath), 
                        urls.push(formatSubUrl), urlMap[emissiveTexture] = formatSubUrl);
                    }
                    if (customProps.ambientTexture) {
                        var ambientTexture = customProps.ambientTexture.texture2D;
                        ambientTexture && (formatSubUrl = Laya3D._getMaterialTexturePath(ambientTexture, null, materialBasePath), 
                        urls.push(formatSubUrl), urlMap[ambientTexture] = formatSubUrl);
                    }
                    if (customProps.reflectTexture) {
                        var reflectTexture = customProps.reflectTexture.texture2D;
                        reflectTexture && (formatSubUrl = Laya3D._getMaterialTexturePath(reflectTexture, null, materialBasePath), 
                        urls.push(formatSubUrl), urlMap[reflectTexture] = formatSubUrl);
                    }
                }
                for (var _i = 0, urls_1 = urls; _i < urls_1.length; _i++) {
                    var info = urls_1[_i], params = null, url_2 = info;
                    "string" != typeof info && (url_2 = info.url, params = info.params);
                    var handle = this._textureCache[url_2];
                    if (0 == handle || null == handle) {
                        var texture = LayaTexture2D.load(url_2, 600, params);
                        texture._addReference(), this._textureCache[url_2] = handle = this._handlePool.alloc(url_2, texture, this.onTextureDestroy);
                    } else this._handlePool.lock(handle);
                    entry.assets.push(handle);
                }
                var material = new SnowflakeParticleMaterial();
                material.onAsynLoaded(url, [ res, urlMap ], null), material._setUrl(url), Laya.loader.cacheRes(url, material), 
                this.onResourceComplete(url, material);
            }, ParticleMaterialPool.prototype.cancel = function(url, callback) {
                var entry = this.findNeedCancelEntry(url, callback);
                null != entry && (ResourcePool.instance.cancel(url, this.onConfigComplete), delete this._waitPool[url], 
                AssetEntry.freeEntry(entry));
            }, ParticleMaterialPool._instance = new ParticleMaterialPool(), ParticleMaterialPool;
        }(AssetPoolBase);
        mesh.ParticleMaterialPool = ParticleMaterialPool;
    }(base.mesh || (base.mesh = {}));
}(base || (base = {})), function(base) {
    !function(mesh) {
        var AssetEntry = base.assets.AssetEntry, ParticleMeshPool = function(_super) {
            function ParticleMeshPool() {
                var _this = _super.call(this, "ParticleMeshPool", 10) || this;
                return _this.doRecover = function(entry) {
                    entry.res.destroy();
                }, _this.onResourceComplete = function(url, res) {
                    null == res ? _this.onComplete(url, null, 0) : _this.onComplete(url, res, 1);
                }, _this;
            }
            return __extends(ParticleMeshPool, _super), Object.defineProperty(ParticleMeshPool, "instance", {
                get: function() {
                    return ParticleMeshPool._instance;
                },
                enumerable: !0,
                configurable: !0
            }), ParticleMeshPool.prototype.load = function(url, callback) {
                var entry = this.checkNeedLoad(url, callback, !1);
                if (null != entry && 0 == entry.status) {
                    entry.status = 1;
                    var res = Laya.Mesh.load(url);
                    (entry.res = res).loaded ? this.onResourceComplete(url, res) : res.once(Laya.Event.LOADED, this, this.onResourceComplete, [ url, res ]);
                }
            }, ParticleMeshPool.prototype.cancel = function(url, callback) {
                var entry = this.findNeedCancelEntry(url, callback);
                null != entry && (entry.res.off(Laya.Event.LOADED, this, this.onResourceComplete), 
                delete this._waitPool[url], AssetEntry.freeEntry(entry));
            }, ParticleMeshPool._instance = new ParticleMeshPool(), ParticleMeshPool;
        }(base.assets.AssetPoolBase);
        mesh.ParticleMeshPool = ParticleMeshPool;
    }(base.mesh || (base.mesh = {}));
}(base || (base = {})), function(base) {
    !function(particle) {
        !function(snowflake) {
            var Matrix4x4 = Laya.Matrix4x4, Quaternion = Laya.Quaternion, Sprite3D = Laya.Sprite3D, Vector3 = Laya.Vector3, ParticleMaterialPool = base.mesh.ParticleMaterialPool, HandlePool = base.assets.HandlePool, ParticleMeshPool = base.mesh.ParticleMeshPool, ResourcePool = base.assets.ResourcePool, StringUtils = utils.StringUtils, SnowflakeParticleBundle = function(_super) {
                function SnowflakeParticleBundle() {
                    var _this = _super.call(this) || this;
                    return _this.onResourceComplete = function(url, handle, buffer) {
                        var config = JSON.parse(new Laya.Byte(buffer).readUTFBytes());
                        _this.parseConfig(config);
                    }, _this.onBundleComplete = function(url, handle, res) {
                        if (_this._entry && (HandlePool.instance.lock(handle), _this._assets.push(handle), 
                        !(0 < --_this._entry.counter))) {
                            for (var elements = _this._entry.elements, innerResouMap = _this._entry.innerResouMap, i = 0, length_10 = elements.length; i < length_10; ++i) {
                                var element = elements[i], node = new snowflake.SnowflakeParticle3D();
                                node.name = element[1].props ? element[1].props.name : _this.name + "#" + i, node.init(element[0], innerResouMap, element[1]), 
                                _this.addChild(node);
                            }
                            _this._entry = null, _this._loaded = !0, _this.event(Laya.Event.HIERARCHY_LOADED, _this);
                        }
                    }, _this._assets = [], _this;
                }
                return __extends(SnowflakeParticleBundle, _super), SnowflakeParticleBundle.load = function(url) {
                    var result = new SnowflakeParticleBundle();
                    result._loaded = !1, result._setUrl(url);
                    var config = SnowflakeParticleBundle.config[url];
                    return config instanceof Uint8Array && (config = msgpack.decode(config)), null != config ? result.parseConfig(config) : ResourcePool.instance.load(url, result.onResourceComplete), 
                    result;
                }, Object.defineProperty(SnowflakeParticleBundle.prototype, "status", {
                    get: function() {
                        return this._status;
                    },
                    enumerable: !0,
                    configurable: !0
                }), SnowflakeParticleBundle.prototype.play = function() {
                    this._status = 0;
                }, SnowflakeParticleBundle.prototype.stop = function() {
                    this._status = 1;
                }, SnowflakeParticleBundle.prototype.pause = function() {
                    this._status = 2;
                }, SnowflakeParticleBundle.prototype.resume = function() {
                    this._status = 0;
                }, SnowflakeParticleBundle.prototype.parseConfig = function(config) {
                    var elements = [];
                    if ("Sprite3D" == config.type) {
                        config.props ? (this.isStatic = config.props.isStatic, this.name = config.props.name) : (this.isStatic = !1, 
                        this.name = this.url);
                        for (var _i = 0, _a = config.child; _i < _a.length; _i++) {
                            var child = _a[_i];
                            this.combineMatrix(null, child, elements);
                        }
                    }
                    this.loadDependency(elements);
                }, SnowflakeParticleBundle.prototype.loadDependency = function(elements) {
                    this._entry = {
                        counter: 0,
                        elements: elements,
                        innerResouMap: {}
                    };
                    for (var path, url, innerResouMap = this._entry.innerResouMap, root = "assets/particle/", counter = 0, _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
                        var customProps = elements_1[_i][1].customProps;
                        customProps.material && (url = root + (path = customProps.material.path), null == innerResouMap[path] && (innerResouMap[path] = url, 
                        ++counter, ParticleMaterialPool.instance.load(url, this.onBundleComplete))), customProps.materialPath && (url = root + (path = customProps.materialPath), 
                        null == innerResouMap[path] && (innerResouMap[path] = url, ++counter, ParticleMaterialPool.instance.load(url, this.onBundleComplete))), 
                        customProps.texturePath && (url = root + (path = customProps.texturePath), null == innerResouMap[path] && (innerResouMap[path] = url, 
                        ++counter, ParticleMaterialPool.instance.load(url, this.onBundleComplete))), customProps.meshPath && (url = root + (path = customProps.meshPath), 
                        null == innerResouMap[path] && (innerResouMap[path] = url, ++counter, ParticleMeshPool.instance.load(url, this.onBundleComplete)));
                    }
                    this._entry.counter = counter;
                }, SnowflakeParticleBundle.prototype.combineMatrix = function(parent, config, result) {
                    var matrix = this.extractMatrix(config.customProps);
                    if (null != parent && Matrix4x4.multiply(parent, matrix, matrix), "MyShuriKenParticle3D" != config.type && null != config.type || result.push([ matrix, config ]), 
                    config.child) for (var _i = 0, _a = config.child; _i < _a.length; _i++) {
                        var child = _a[_i];
                        this.combineMatrix(matrix, child, result);
                    }
                }, SnowflakeParticleBundle.prototype.extractMatrix = function(props) {
                    var matrix = new Matrix4x4();
                    if (props) {
                        var translate = new Vector3(0, 0, 0), rotation = new Quaternion(0, 0, 0, 1), scale = new Vector3(1, 1, 1);
                        if (props.translate) {
                            translate.elements.set(props.translate);
                            var elements = translate.elements;
                            elements[0] *= 100, elements[1] *= 100, elements[2] *= 100;
                        }
                        props.rotation && rotation.elements.set(props.rotation), props.scale && scale.elements.set(props.scale), 
                        Matrix4x4.createAffineTransformation(translate, rotation, scale, matrix);
                    } else matrix.identity();
                    return matrix;
                }, SnowflakeParticleBundle.prototype.destroy = function(destroyChild) {
                    this.removeSelf(), this.offAll(), this.timer.clearAll(this), particle.ParticlePool.instance.destoryParticle(this);
                }, SnowflakeParticleBundle.prototype.dispose = function() {
                    if (null != this._entry) {
                        var innerResouMap = this._entry.innerResouMap;
                        for (var key in innerResouMap) {
                            var url = innerResouMap[key];
                            StringUtils.endsWith(url, ".lmat") ? ParticleMaterialPool.instance.cancel(url, this.onBundleComplete) : StringUtils.endsWith(url, ".lm") && ParticleMeshPool.instance.cancel(url, this.onBundleComplete);
                        }
                        this._entry = null;
                    } else this.loaded || ResourcePool.instance.cancel(this.url, this.onResourceComplete);
                    if (this._assets) {
                        for (var _i = 0, _a = this._assets; _i < _a.length; _i++) {
                            var handle = _a[_i];
                            HandlePool.instance.free(handle);
                        }
                        this._assets = null;
                    }
                    _super.prototype.destroy.call(this, !0);
                }, SnowflakeParticleBundle.config = {}, SnowflakeParticleBundle;
            }(Sprite3D);
            snowflake.SnowflakeParticleBundle = SnowflakeParticleBundle;
        }(particle.snowflake || (particle.snowflake = {}));
    }(base.particle || (base.particle = {}));
}(base || (base = {})), function(base) {
    !function(particle) {
        var SnowflakeParticleBundle = base.particle.snowflake.SnowflakeParticleBundle, Heap = utils.collections.Heap, ParticlePool = function() {
            function ParticlePool() {
                this._cache = {}, this._cacheTime = 6e4, this._cacheQueue = new Heap(function(l, r) {
                    return l.timeout < r.timeout;
                }), Laya.timer.loop(1e3, this, this.doRecover);
            }
            return Object.defineProperty(ParticlePool, "instance", {
                get: function() {
                    return null == this._instance && (this._instance = new ParticlePool()), this._instance;
                },
                enumerable: !0,
                configurable: !0
            }), ParticlePool.prototype.doRecover = function() {
                for (var now = Date.now(), q = this._cacheQueue; !q.isEmtry(); ) {
                    var e = q.top;
                    if (e.timeout > now && q.size < 20) break;
                    q.pop(), delete this._cache[e.url];
                    for (var _i = 0, _a = e.bundles; _i < _a.length; _i++) {
                        _a[_i].dispose();
                    }
                }
            }, ParticlePool.prototype.loadParticle = function(url) {
                var entry = this._cache[url];
                if (null == entry || 0 == entry.bundles.length) return SnowflakeParticleBundle.load(url);
                entry.timeout = Date.now() + this._cacheTime, this._cacheQueue.updateElement(entry);
                var result = entry.bundles.pop(), matrix = result.transform.localMatrix;
                return matrix.identity(), result.transform.localMatrix = matrix, (matrix = result.transform.worldMatrix).identity(), 
                result.transform.worldMatrix = matrix, result;
            }, ParticlePool.prototype.destoryParticle = function(bundle) {
                var url = bundle.url, entry = this._cache[url];
                null == entry ? (this._cache[url] = entry = {
                    url: url,
                    pointer: 0,
                    timeout: Date.now() + this._cacheTime,
                    bundles: [ bundle ]
                }, this._cacheQueue.push(entry)) : (entry.timeout = Date.now() + this._cacheTime, 
                this._cacheQueue.updateElement(entry), entry.bundles.push(bundle));
            }, ParticlePool;
        }();
        particle.ParticlePool = ParticlePool;
    }(base.particle || (base.particle = {}));
}(base || (base = {})), function(base) {
    !function(particle) {
        !function(snowflake) {
            var RenderableSprite3D = Laya.RenderableSprite3D, Vector3 = Laya.Vector3, RenderElement = Laya.RenderElement, Vector2 = Laya.Vector2, TextureSheetAnimation = Laya.TextureSheetAnimation, StartFrame = Laya.StartFrame, FrameOverTime = Laya.FrameOverTime, RotationOverLifetime = Laya.RotationOverLifetime, GradientAngularVelocity = Laya.GradientAngularVelocity, SizeOverLifetime = Laya.SizeOverLifetime, GradientSize = Laya.GradientSize, ColorOverLifetime = Laya.ColorOverLifetime, Vector4 = Laya.Vector4, GradientColor = Laya.GradientColor, VelocityOverLifetime = Laya.VelocityOverLifetime, GradientVelocity = Laya.GradientVelocity, CircleShape = Laya.CircleShape, Loader = Laya.Loader, Texture2D = Laya.Texture2D, Burst = Laya.Burst, SphereShape = Laya.SphereShape, HemisphereShape = Laya.HemisphereShape, ConeShape = Laya.ConeShape, BoxShape = Laya.BoxShape, SnowflakeParticle3D = function(_super) {
                function SnowflakeParticle3D(material) {
                    var _this = _super.call(this) || this;
                    return _this._render = new snowflake.SnowflakeParticleRender(_this), _this._render.on(Laya.Event.MATERIAL_CHANGED, _this, _this._onMaterialChanged), 
                    _this._geometryFilter = new snowflake.SnowflakeParticleSystem(_this), _this._createRenderElement(0), 
                    material && (_this._render.sharedMaterial = material), _this;
                }
                return __extends(SnowflakeParticle3D, _super), SnowflakeParticle3D.load = function(url) {
                    return Laya.loader.create(url, null, null, SnowflakeParticle3D);
                }, SnowflakeParticle3D.prototype.init = function(matrix, innerResouMap, nodeData) {
                    this._parseBaseCustomProps(nodeData.customProps), this._parseCustomProps(this, innerResouMap, nodeData.customProps, nodeData), 
                    this._parseCustomComponent(this, innerResouMap, []), this.transform.localMatrix = matrix;
                }, SnowflakeParticle3D.prototype._createRenderElement = function(index) {
                    var element = this._render._renderElements[index] = new RenderElement();
                    element._render = this._render;
                    var material = this._render.sharedMaterials[index];
                    material || (material = snowflake.SnowflakeParticleMaterial.defaultMaterial), element._mainSortID = 0, 
                    element._sprite3D = this, element.renderObj = this.particleSystem, element._material = material;
                }, SnowflakeParticle3D.prototype._onMaterialChanged = function(particleRender, index, material) {
                    var elements = particleRender._renderElements;
                    index < elements.length && (elements[index]._material = material || snowflake.SnowflakeParticleMaterial.defaultMaterial);
                }, SnowflakeParticle3D.prototype._clearSelfRenderObjects = function() {
                    this.scene.removeFrustumCullingObject(this._render);
                }, SnowflakeParticle3D.prototype._addSelfRenderObjects = function() {
                    this.scene.addFrustumCullingObject(this._render);
                }, SnowflakeParticle3D.prototype._parseCustomProps = function(rootNode, innerResouMap, customProps, nodeData) {
                    var material, anglelToRad = Math.PI / 180, i = 0, n = 0, particleRender = this.particleRender, materialData = customProps.material;
                    if (materialData) material = Loader.getRes(innerResouMap[materialData.path]); else {
                        var materialPath = customProps.materialPath;
                        materialPath ? material = Loader.getRes(innerResouMap[materialPath]) : (material = new snowflake.SnowflakeParticleMaterial()).diffuseTexture = innerResouMap ? Loader.getRes(innerResouMap[customProps.texturePath]) : Texture2D.load(customProps.texturePath);
                    }
                    particleRender.sharedMaterial = material;
                    var meshPath = customProps.meshPath;
                    meshPath && (particleRender.mesh = Loader.getRes(innerResouMap[meshPath])), particleRender.renderMode = null == customProps.renderMode ? 4 : customProps.renderMode, 
                    particleRender.stretchedBillboardCameraSpeedScale = customProps.stretchedBillboardCameraSpeedScale || 0, 
                    particleRender.stretchedBillboardSpeedScale = customProps.stretchedBillboardSpeedScale || 0, 
                    particleRender.stretchedBillboardLengthScale = null == customProps.stretchedBillboardLengthScale ? 2 : customProps.stretchedBillboardLengthScale, 
                    particleRender.sortingFudge = customProps.sortingFudge || 0;
                    var particleSystem = this.particleSystem;
                    particleSystem.isPerformanceMode = null == customProps.isPerformanceMode || customProps.isPerformanceMode, 
                    particleSystem.duration = null == customProps.duration ? 1 : customProps.duration, 
                    particleSystem.looping = customProps.looping || !1, particleSystem.prewarm = customProps.prewarm || !1, 
                    particleSystem.startDelayType = customProps.startDelayType || 0, particleSystem.startDelay = customProps.startDelay || 0, 
                    particleSystem.startDelayMin = customProps.startDelayMin || 0, particleSystem.startDelayMax = customProps.startDelayMax || 0, 
                    particleSystem.startLifetimeType = customProps.startLifetimeType || 0, particleSystem.startLifetimeConstant = null == customProps.startLifetimeConstant ? 1 : customProps.startLifetimeConstant, 
                    customProps.startLifetimeGradient && (particleSystem.startLifeTimeGradient = snowflake.SnowflakeParticleUtils._initStartLife(customProps.startLifetimeGradient)), 
                    particleSystem.startLifetimeConstantMin = customProps.startLifetimeConstantMin || 0, 
                    particleSystem.startLifetimeConstantMax = null == customProps.startLifetimeConstantMax ? 1 : customProps.startLifetimeConstantMax, 
                    customProps.startLifetimeGradientMin && (particleSystem.startLifeTimeGradientMin = snowflake.SnowflakeParticleUtils._initStartLife(customProps.startLifetimeGradientMin)), 
                    customProps.startLifetimeGradientMax && (particleSystem.startLifeTimeGradientMax = snowflake.SnowflakeParticleUtils._initStartLife(customProps.startLifetimeGradientMax)), 
                    particleSystem.startSpeedType = customProps.startSpeedType || 0, particleSystem.startSpeedConstant = 100 * (customProps.startSpeedConstant || 0), 
                    particleSystem.startSpeedConstantMin = 100 * (customProps.startSpeedConstantMin || 0), 
                    particleSystem.startSpeedConstantMax = 100 * (customProps.startSpeedConstantMax || 0), 
                    particleSystem.threeDStartSize = customProps.threeDStartSize || !1, particleSystem.startSizeType = customProps.startSizeType || 0, 
                    particleSystem.startSizeConstant = null == customProps.startSizeConstant ? 12 : customProps.startSizeConstant;
                    var startSizeConstantSeparateArray = customProps.startSizeConstantSeparate, startSizeConstantSeparateElement = particleSystem.startSizeConstantSeparate.elements;
                    startSizeConstantSeparateArray ? (startSizeConstantSeparateElement[0] = startSizeConstantSeparateArray[0], 
                    startSizeConstantSeparateElement[1] = startSizeConstantSeparateArray[1], startSizeConstantSeparateElement[2] = startSizeConstantSeparateArray[2]) : (startSizeConstantSeparateElement[0] = 12, 
                    startSizeConstantSeparateElement[1] = 1, startSizeConstantSeparateElement[2] = 1), 
                    particleSystem.startSizeConstantMin = customProps.startSizeConstantMin || 0, particleSystem.startSizeConstantMax = null == customProps.startSizeConstantMax ? 12 : customProps.startSizeConstantMax;
                    var startSizeConstantMinSeparateArray = customProps.startSizeConstantMinSeparate, startSizeConstantMinSeparateElement = particleSystem.startSizeConstantMinSeparate.elements;
                    startSizeConstantMinSeparateArray ? (startSizeConstantMinSeparateElement[0] = startSizeConstantMinSeparateArray[0], 
                    startSizeConstantMinSeparateElement[1] = startSizeConstantMinSeparateArray[1], startSizeConstantMinSeparateElement[2] = startSizeConstantMinSeparateArray[2]) : startSizeConstantMinSeparateElement.fill(0);
                    var startSizeConstantMaxSeparateArray = customProps.startSizeConstantMaxSeparate, startSizeConstantMaxSeparateElement = particleSystem.startSizeConstantMaxSeparate.elements;
                    startSizeConstantMaxSeparateArray ? (startSizeConstantMaxSeparateElement[0] = startSizeConstantMaxSeparateArray[0], 
                    startSizeConstantMaxSeparateElement[1] = startSizeConstantMaxSeparateArray[1], startSizeConstantMaxSeparateElement[2] = startSizeConstantMaxSeparateArray[2]) : (startSizeConstantMaxSeparateElement[0] = 12, 
                    startSizeConstantMaxSeparateElement[1] = 1, startSizeConstantMaxSeparateElement[2] = 1), 
                    particleSystem.threeDStartRotation = customProps.threeDStartRotation || !1, particleSystem.startRotationType = customProps.startRotationType || 0, 
                    particleSystem.startRotationConstant = (customProps.startRotationConstant || 0) * anglelToRad;
                    var startRotationConstantSeparateArray = customProps.startRotationConstantSeparate, startRotationConstantSeparateElement = particleSystem.startRotationConstantSeparate.elements;
                    startRotationConstantSeparateArray ? (startRotationConstantSeparateElement[0] = startRotationConstantSeparateArray[0] * anglelToRad, 
                    startRotationConstantSeparateElement[1] = startRotationConstantSeparateArray[1] * anglelToRad, 
                    startRotationConstantSeparateElement[2] = startRotationConstantSeparateArray[2] * anglelToRad) : startRotationConstantSeparateElement.fill(0), 
                    particleSystem.startRotationConstantMin = (customProps.startRotationConstantMin || 0) * anglelToRad, 
                    particleSystem.startRotationConstantMax = (customProps.startRotationConstantMax || 0) * anglelToRad;
                    var startRotationConstantMinSeparateArray = customProps.startRotationConstantMinSeparate, startRotationConstantMinSeparateElement = particleSystem.startRotationConstantMinSeparate.elements;
                    startRotationConstantMinSeparateArray ? (startRotationConstantMinSeparateElement[0] = startRotationConstantMinSeparateArray[0] * anglelToRad, 
                    startRotationConstantMinSeparateElement[1] = startRotationConstantMinSeparateArray[1] * anglelToRad, 
                    startRotationConstantMinSeparateElement[2] = startRotationConstantMinSeparateArray[2] * anglelToRad) : startRotationConstantMinSeparateElement.fill(0);
                    var startRotationConstantMaxSeparateArray = customProps.startRotationConstantMaxSeparate, startRotationConstantMaxSeparateElement = particleSystem.startRotationConstantMaxSeparate.elements;
                    startRotationConstantMaxSeparateArray ? (startRotationConstantMaxSeparateElement[0] = startRotationConstantMaxSeparateArray[0] * anglelToRad, 
                    startRotationConstantMaxSeparateElement[1] = startRotationConstantMaxSeparateArray[1] * anglelToRad, 
                    startRotationConstantMaxSeparateElement[2] = startRotationConstantMaxSeparateArray[2] * anglelToRad) : startRotationConstantMaxSeparateElement.fill(0), 
                    particleSystem.randomizeRotationDirection = customProps.randomizeRotationDirection || 0, 
                    particleSystem.startColorType = customProps.startColorType || 0;
                    var startColorConstantArray = customProps.startColorConstant, startColorConstantElement = particleSystem.startColorConstant.elements;
                    startColorConstantArray ? (startColorConstantElement[0] = startColorConstantArray[0], 
                    startColorConstantElement[1] = startColorConstantArray[1], startColorConstantElement[2] = startColorConstantArray[2], 
                    startColorConstantElement[3] = startColorConstantArray[3]) : startColorConstantElement.fill(1);
                    var startColorConstantMinArray = customProps.startColorConstantMin, startColorConstantMinElement = particleSystem.startColorConstantMin.elements;
                    startColorConstantMinArray ? (startColorConstantMinElement[0] = startColorConstantMinArray[0], 
                    startColorConstantMinElement[1] = startColorConstantMinArray[1], startColorConstantMinElement[2] = startColorConstantMinArray[2], 
                    startColorConstantMinElement[3] = startColorConstantMinArray[3]) : startColorConstantMinElement.fill(0);
                    var startColorConstantMaxArray = customProps.startColorConstantMax, startColorConstantMaxElement = particleSystem.startColorConstantMax.elements;
                    startColorConstantMaxArray ? (startColorConstantMaxElement[0] = startColorConstantMaxArray[0], 
                    startColorConstantMaxElement[1] = startColorConstantMaxArray[1], startColorConstantMaxElement[2] = startColorConstantMaxArray[2], 
                    startColorConstantMaxElement[3] = startColorConstantMaxArray[3]) : startColorConstantMaxElement.fill(1), 
                    particleSystem.gravityModifier = customProps.gravityModifier || 0, particleSystem.simulationSpace = null == customProps.simulationSpace ? 1 : customProps.simulationSpace, 
                    particleSystem.scaleMode = null == customProps.scaleMode ? 1 : customProps.scaleMode, 
                    particleSystem.playOnAwake = null == customProps.playOnAwake || customProps.playOnAwake, 
                    particleSystem.maxParticles = null == customProps.maxParticles ? 1 : customProps.maxParticles;
                    var autoRandomSeed = customProps.autoRandomSeed;
                    null != autoRandomSeed && (particleSystem.autoRandomSeed = autoRandomSeed);
                    var randomSeed = customProps.randomSeed;
                    null != randomSeed && (particleSystem.randomSeed[0] = randomSeed);
                    var emissionData = customProps.emission, emission = particleSystem.emission;
                    if (emissionData) {
                        emission.emissionRate = null == emissionData.emissionRate ? 0 : emissionData.emissionRate;
                        var burstsData = emissionData.bursts;
                        if (burstsData) for (i = 0, n = burstsData.length; i < n; i++) {
                            var brust = burstsData[i];
                            emission.addBurst(new Burst(brust.time, brust.min, brust.max));
                        }
                        emission.enbale = null == emissionData.enable || emissionData.enable;
                    } else emission.enbale = !1;
                    var shapeData = customProps.shape;
                    if (shapeData) {
                        var shape = void 0;
                        switch (null == shapeData.shapeType ? 2 : shapeData.shapeType) {
                          case 0:
                            var sphereShape = void 0;
                            shape = sphereShape = new SphereShape(), sphereShape.radius = 100 * (null == shapeData.sphereRadius ? 1 : shapeData.sphereRadius), 
                            sphereShape.emitFromShell = shapeData.sphereEmitFromShell || !1, sphereShape.randomDirection = 0 != (shapeData.sphereRandomDirection || 0);
                            break;

                          case 1:
                            var hemiSphereShape = void 0;
                            shape = hemiSphereShape = new HemisphereShape(), hemiSphereShape.radius = 100 * (null == shapeData.hemiSphereRadius ? 1 : shapeData.hemiSphereRadius), 
                            hemiSphereShape.emitFromShell = shapeData.hemiSphereEmitFromShell || !1, hemiSphereShape.randomDirection = 0 != (shapeData.hemiSphereRandomDirection || 0);
                            break;

                          case 2:
                            var coneShape = void 0;
                            shape = coneShape = new ConeShape(), coneShape.angle = (shapeData.coneAngle || 0) * anglelToRad, 
                            coneShape.radius = 100 * (null == shapeData.coneRadius ? 1 : shapeData.coneRadius), 
                            coneShape.length = 100 * (null == shapeData.coneLength ? 5 : shapeData.coneLength), 
                            coneShape.emitType = shapeData.coneEmitType || 0, coneShape.randomDirection = 0 != (shapeData.coneRandomDirection || 0);
                            break;

                          case 3:
                            var boxShape = void 0;
                            shape = boxShape = new BoxShape(), boxShape.x = 100 * (null == shapeData.boxX ? 1 : shapeData.boxX), 
                            boxShape.y = 100 * (null == shapeData.boxY ? 1 : shapeData.boxY), boxShape.z = 100 * (null == shapeData.boxZ ? 1 : shapeData.boxZ), 
                            boxShape.randomDirection = 0 != (shapeData.boxRandomDirection || 0);
                            break;

                          case 7:
                          default:
                            var circleShape = void 0;
                            shape = circleShape = new CircleShape(), circleShape.radius = 100 * (null == shapeData.circleRadius ? 1 : shapeData.circleRadius), 
                            circleShape.arc = (null == shapeData.circleArc ? 360 : shapeData.circleArc) * anglelToRad, 
                            circleShape.emitFromEdge = shapeData.circleEmitFromEdge || !1, circleShape.randomDirection = 0 != (shapeData.circleRandomDirection || 0);
                        }
                        shape.enable = null == shapeData.enable || shapeData.enable, particleSystem.shape = shape;
                    }
                    var velocityOverLifetimeData = customProps.velocityOverLifetime;
                    if (velocityOverLifetimeData) {
                        var velocityData = velocityOverLifetimeData.velocity, velocity = void 0;
                        switch (type = null == velocityData.type ? 3 : velocityData.type) {
                          case 0:
                            var constantData = velocityData.constant;
                            velocity = GradientVelocity.createByConstant(constantData ? new Vector3(constantData[0], constantData[1], constantData[2]) : new Vector3(0, 0, 0));
                            break;

                          case 1:
                            velocity = GradientVelocity.createByGradient(snowflake.SnowflakeParticleUtils._initParticleVelocity(velocityData.gradientX), snowflake.SnowflakeParticleUtils._initParticleVelocity(velocityData.gradientY), snowflake.SnowflakeParticleUtils._initParticleVelocity(velocityData.gradientZ));
                            break;

                          case 2:
                            var constantMinData = velocityData.constantMin, constantMaxData = velocityData.constantMax;
                            velocity = GradientVelocity.createByRandomTwoConstant(constantMinData ? new Vector3(constantMinData[0], constantMinData[1], constantMinData[2]) : new Vector3(0, 0, 0), constantMaxData ? new Vector3(constantMaxData[0], constantMaxData[1], constantMaxData[2]) : new Vector3(0, 0, 0));
                            break;

                          case 3:
                            velocity = GradientVelocity.createByRandomTwoGradient(snowflake.SnowflakeParticleUtils._initParticleVelocity(velocityData.gradientXMin), snowflake.SnowflakeParticleUtils._initParticleVelocity(velocityData.gradientXMax), snowflake.SnowflakeParticleUtils._initParticleVelocity(velocityData.gradientYMin), snowflake.SnowflakeParticleUtils._initParticleVelocity(velocityData.gradientYMax), snowflake.SnowflakeParticleUtils._initParticleVelocity(velocityData.gradientZMin), snowflake.SnowflakeParticleUtils._initParticleVelocity(velocityData.gradientZMax));
                        }
                        var velocityOverLifetime = new VelocityOverLifetime(velocity);
                        velocityOverLifetime.space = velocityOverLifetimeData.space || 0, velocityOverLifetime.enbale = null == velocityOverLifetimeData.enable || velocityOverLifetimeData.enable, 
                        particleSystem.velocityOverLifetime = velocityOverLifetime;
                    }
                    var colorOverLifetimeData = customProps.colorOverLifetime;
                    if (colorOverLifetimeData) {
                        var colorData = colorOverLifetimeData.color, color = void 0;
                        switch (type = null == colorData.type ? 1 : colorData.type) {
                          case 0:
                            var constColorData = colorData.constant;
                            color = GradientColor.createByConstant(constColorData ? new Vector4(constColorData[0], constColorData[1], constColorData[2], constColorData[3]) : new Vector4(0, 0, 0, 0));
                            break;

                          case 1:
                            color = GradientColor.createByGradient(snowflake.SnowflakeParticleUtils._initParticleColor(colorData.gradient));
                            break;

                          case 2:
                            var minConstColorData = colorData.constantMin, maxConstColorData = colorData.constantMax;
                            color = GradientColor.createByRandomTwoConstant(minConstColorData ? new Vector4(minConstColorData[0], minConstColorData[1], minConstColorData[2], minConstColorData[3]) : new Vector4(0, 0, 0, 0), maxConstColorData ? new Vector4(maxConstColorData[0], maxConstColorData[1], maxConstColorData[2], maxConstColorData[3]) : new Vector4(0, 0, 0, 0));
                            break;

                          case 3:
                            color = GradientColor.createByRandomTwoGradient(snowflake.SnowflakeParticleUtils._initParticleColor(colorData.gradientMin), snowflake.SnowflakeParticleUtils._initParticleColor(colorData.gradientMax));
                        }
                        var colorOverLifetime = new ColorOverLifetime(color);
                        colorOverLifetime.enbale = null == colorOverLifetimeData.enable || colorOverLifetimeData.enable, 
                        particleSystem.colorOverLifetime = colorOverLifetime;
                    }
                    var sizeOverLifetimeData = customProps.sizeOverLifetime;
                    if (sizeOverLifetimeData) {
                        var sizeData = sizeOverLifetimeData.size, size = void 0, type = sizeData.type || 0, separateAxes = sizeData.separateAxes || !1;
                        switch (type) {
                          case 0:
                            size = separateAxes ? GradientSize.createByGradientSeparate(snowflake.SnowflakeParticleUtils._initParticleSize(sizeData.gradientX), snowflake.SnowflakeParticleUtils._initParticleSize(sizeData.gradientY), snowflake.SnowflakeParticleUtils._initParticleSize(sizeData.gradientZ)) : GradientSize.createByGradient(snowflake.SnowflakeParticleUtils._initParticleSize(sizeData.gradient));
                            break;

                          case 1:
                            if (separateAxes) {
                                var constantMinSeparateData = sizeData.constantMinSeparate, constantMaxSeparateData = sizeData.constantMaxSeparate;
                                size = GradientSize.createByRandomTwoConstantSeparate(constantMinSeparateData ? new Vector3(constantMinSeparateData[0], constantMinSeparateData[1], constantMinSeparateData[2]) : new Vector3(0, 0, 0), constantMaxSeparateData ? new Vector3(constantMaxSeparateData[0], constantMaxSeparateData[1], constantMaxSeparateData[2]) : new Vector3(0, 0, 0));
                            } else size = GradientSize.createByRandomTwoConstant(sizeData.constantMin || 0, sizeData.constantMax || 0);
                            break;

                          case 2:
                            size = separateAxes ? GradientSize.createByRandomTwoGradientSeparate(snowflake.SnowflakeParticleUtils._initParticleSize(sizeData.gradientXMin), snowflake.SnowflakeParticleUtils._initParticleSize(sizeData.gradientYMin), snowflake.SnowflakeParticleUtils._initParticleSize(sizeData.gradientZMin), snowflake.SnowflakeParticleUtils._initParticleSize(sizeData.gradientXMax), snowflake.SnowflakeParticleUtils._initParticleSize(sizeData.gradientYMax), snowflake.SnowflakeParticleUtils._initParticleSize(sizeData.gradientZMax)) : GradientSize.createByRandomTwoGradient(snowflake.SnowflakeParticleUtils._initParticleSize(sizeData.gradientMin), snowflake.SnowflakeParticleUtils._initParticleSize(sizeData.gradientMax));
                        }
                        var sizeOverLifetime = new SizeOverLifetime(size);
                        sizeOverLifetime.enbale = null == sizeOverLifetimeData.enable || sizeOverLifetimeData.enable, 
                        particleSystem.sizeOverLifetime = sizeOverLifetime;
                    }
                    var rotationOverLifetimeData = customProps.rotationOverLifetime;
                    if (rotationOverLifetimeData) {
                        var angularVelocityData = rotationOverLifetimeData.angularVelocity, angularVelocity = void 0;
                        type = angularVelocityData.type || 0, separateAxes = angularVelocityData.separateAxes || !1;
                        switch (type) {
                          case 0:
                            separateAxes || (angularVelocity = GradientAngularVelocity.createByConstant((null == angularVelocityData.constant ? 360 : angularVelocityData.constant) * anglelToRad));
                            break;

                          case 1:
                            angularVelocity = separateAxes ? GradientAngularVelocity.createByGradientSeparate(snowflake.SnowflakeParticleUtils._initParticleRotation(angularVelocityData.gradientX), snowflake.SnowflakeParticleUtils._initParticleRotation(angularVelocityData.gradientY), snowflake.SnowflakeParticleUtils._initParticleRotation(angularVelocityData.gradientZ), null) : GradientAngularVelocity.createByGradient(snowflake.SnowflakeParticleUtils._initParticleRotation(angularVelocityData.gradient));
                            break;

                          case 2:
                            if (separateAxes) {
                                var minSep = angularVelocityData.constantMinSeparate, maxSep = angularVelocityData.constantMaxSeparate;
                                angularVelocity = GradientAngularVelocity.createByRandomTwoConstantSeparate(minSep ? new Vector3(minSep[0] * anglelToRad, minSep[1] * anglelToRad, minSep[2] * anglelToRad) : new Vector3(0, 0, 0), maxSep ? new Vector3(maxSep[0] * anglelToRad, maxSep[1] * anglelToRad, maxSep[2] * anglelToRad) : new Vector3(0, 0, 360 * anglelToRad));
                            } else angularVelocity = GradientAngularVelocity.createByRandomTwoConstant((angularVelocityData.constantMin || 0) * anglelToRad, (null == angularVelocityData.constantMax ? 360 : angularVelocityData.constantMax) * anglelToRad);
                            break;

                          case 3:
                            separateAxes || (angularVelocity = GradientAngularVelocity.createByRandomTwoGradient(snowflake.SnowflakeParticleUtils._initParticleRotation(angularVelocityData.gradientMin), snowflake.SnowflakeParticleUtils._initParticleRotation(angularVelocityData.gradientMax)));
                        }
                        var rotationOverLifetime = new RotationOverLifetime(angularVelocity);
                        rotationOverLifetime.enbale = null == rotationOverLifetimeData.enable || rotationOverLifetimeData.enable, 
                        particleSystem.rotationOverLifetime = rotationOverLifetime;
                    }
                    var textureSheetAnimationData = customProps.textureSheetAnimation;
                    if (textureSheetAnimationData) {
                        var frameData = textureSheetAnimationData.frame, frameOverTime = void 0;
                        switch (frameData.type) {
                          case 0:
                            frameOverTime = FrameOverTime.createByConstant(frameData.constant);
                            break;

                          case 1:
                            frameOverTime = FrameOverTime.createByOverTime(snowflake.SnowflakeParticleUtils._initParticleFrame(frameData.overTime));
                            break;

                          case 2:
                            frameOverTime = FrameOverTime.createByRandomTwoConstant(frameData.constantMin, frameData.constantMax);
                            break;

                          case 3:
                            frameOverTime = FrameOverTime.createByRandomTwoOverTime(snowflake.SnowflakeParticleUtils._initParticleFrame(frameData.overTimeMin), snowflake.SnowflakeParticleUtils._initParticleFrame(frameData.overTimeMax));
                        }
                        var startFrameData = textureSheetAnimationData.startFrame, startFrame = void 0;
                        switch (startFrameData.type) {
                          case 0:
                            startFrame = StartFrame.createByConstant(startFrameData.constant);
                            break;

                          case 1:
                            startFrame = StartFrame.createByRandomTwoConstant(startFrameData.constantMin, startFrameData.constantMax);
                        }
                        var textureSheetAnimation = new TextureSheetAnimation(frameOverTime, startFrame);
                        textureSheetAnimation.enable = null == textureSheetAnimationData.enable || textureSheetAnimationData.enable;
                        var tilesData = textureSheetAnimationData.tiles;
                        textureSheetAnimation.tiles = tilesData ? new Vector2(tilesData[0], tilesData[1]) : new Vector2(4, 2), 
                        textureSheetAnimation.type = textureSheetAnimationData.type || 0, textureSheetAnimation.randomRow = null == textureSheetAnimationData.randomRow || textureSheetAnimationData.randomRow;
                        var rowIndex = textureSheetAnimationData.rowIndex;
                        null !== rowIndex && (textureSheetAnimation.rowIndex = rowIndex), textureSheetAnimation.cycles = null == textureSheetAnimationData.cycles ? 1 : textureSheetAnimationData.cycles, 
                        particleSystem.textureSheetAnimation = textureSheetAnimation;
                    }
                }, SnowflakeParticle3D.prototype._activeHierarchy = function() {
                    _super.prototype._activeHierarchy.call(this), this.particleSystem.playOnAwake && this.particleSystem.play();
                }, SnowflakeParticle3D.prototype._inActiveHierarchy = function() {
                    _super.prototype._inActiveHierarchy.call(this), this.particleSystem.isAlive && this.particleSystem.simulate(0, !0);
                }, SnowflakeParticle3D.prototype.cloneTo = function(destObject) {
                    var destSnowflakeParticle3D = destObject, destParticleSystem = destSnowflakeParticle3D.particleSystem;
                    this.particleSystem.cloneTo(destParticleSystem);
                    var destParticleRender = destSnowflakeParticle3D.particleRender, particleRender = this.particleRender;
                    destParticleRender.sharedMaterials = particleRender.sharedMaterials, destParticleRender.enable = particleRender.enable, 
                    destParticleRender.renderMode = particleRender.renderMode, destParticleRender.mesh = particleRender.mesh, 
                    destParticleRender.stretchedBillboardCameraSpeedScale = particleRender.stretchedBillboardCameraSpeedScale, 
                    destParticleRender.stretchedBillboardSpeedScale = particleRender.stretchedBillboardSpeedScale, 
                    destParticleRender.stretchedBillboardLengthScale = particleRender.stretchedBillboardLengthScale, 
                    destParticleRender.sortingFudge = particleRender.sortingFudge, _super.prototype.cloneTo.call(this, destObject);
                }, SnowflakeParticle3D.prototype.destroy = function(destroyChild) {
                    void 0 === destroyChild && (destroyChild = !0), void 0 === destroyChild && (destroyChild = !0), 
                    this.destroyed || (_super.prototype.destroy.call(this, destroyChild), this._geometryFilter._destroy(), 
                    this._geometryFilter = null);
                }, Object.defineProperty(SnowflakeParticle3D.prototype, "particleSystem", {
                    get: function() {
                        return this._geometryFilter;
                    },
                    enumerable: !0,
                    configurable: !0
                }), Object.defineProperty(SnowflakeParticle3D.prototype, "particleRender", {
                    get: function() {
                        return this._render;
                    },
                    enumerable: !0,
                    configurable: !0
                }), SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_BILLBOARD = 0, SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_STRETCHEDBILLBOARD = 0, 
                SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_HORIZONTALBILLBOARD = 0, SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_VERTICALBILLBOARD = 0, 
                SnowflakeParticle3D.SHADERDEFINE_COLOROVERLIFETIME = 0, SnowflakeParticle3D.SHADERDEFINE_RANDOMCOLOROVERLIFETIME = 0, 
                SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMECONSTANT = 0, SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMECURVE = 0, 
                SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMERANDOMCONSTANT = 0, SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMERANDOMCURVE = 0, 
                SnowflakeParticle3D.SHADERDEFINE_TEXTURESHEETANIMATIONCURVE = 0, SnowflakeParticle3D.SHADERDEFINE_TEXTURESHEETANIMATIONRANDOMCURVE = 0, 
                SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIME = 0, SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMESEPERATE = 0, 
                SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMECONSTANT = 0, SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMECURVE = 0, 
                SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMERANDOMCONSTANTS = 0, SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMERANDOMCURVES = 0, 
                SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMECURVE = 0, SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMECURVESEPERATE = 0, 
                SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMERANDOMCURVES = 0, SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMERANDOMCURVESSEPERATE = 0, 
                SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_MESH = 0, SnowflakeParticle3D.SHADERDEFINE_SHAPE = 0, 
                SnowflakeParticle3D.WORLDPOSITION = 0, SnowflakeParticle3D.WORLDROTATION = 1, SnowflakeParticle3D.POSITIONSCALE = 4, 
                SnowflakeParticle3D.SIZESCALE = 5, SnowflakeParticle3D.SCALINGMODE = 6, SnowflakeParticle3D.GRAVITY = 7, 
                SnowflakeParticle3D.THREEDSTARTROTATION = 8, SnowflakeParticle3D.STRETCHEDBILLBOARDLENGTHSCALE = 9, 
                SnowflakeParticle3D.STRETCHEDBILLBOARDSPEEDSCALE = 10, SnowflakeParticle3D.SIMULATIONSPACE = 11, 
                SnowflakeParticle3D.CURRENTTIME = 12, SnowflakeParticle3D.VOLVELOCITYCONST = 13, 
                SnowflakeParticle3D.VOLVELOCITYGRADIENTX = 14, SnowflakeParticle3D.VOLVELOCITYGRADIENTY = 15, 
                SnowflakeParticle3D.VOLVELOCITYGRADIENTZ = 16, SnowflakeParticle3D.VOLVELOCITYCONSTMAX = 17, 
                SnowflakeParticle3D.VOLVELOCITYGRADIENTXMAX = 18, SnowflakeParticle3D.VOLVELOCITYGRADIENTYMAX = 19, 
                SnowflakeParticle3D.VOLVELOCITYGRADIENTZMAX = 20, SnowflakeParticle3D.VOLSPACETYPE = 21, 
                SnowflakeParticle3D.COLOROVERLIFEGRADIENTALPHAS = 22, SnowflakeParticle3D.COLOROVERLIFEGRADIENTCOLORS = 23, 
                SnowflakeParticle3D.MAXCOLOROVERLIFEGRADIENTALPHAS = 24, SnowflakeParticle3D.MAXCOLOROVERLIFEGRADIENTCOLORS = 25, 
                SnowflakeParticle3D.SOLSIZEGRADIENT = 26, SnowflakeParticle3D.SOLSIZEGRADIENTX = 27, 
                SnowflakeParticle3D.SOLSIZEGRADIENTY = 28, SnowflakeParticle3D.SOLSizeGradientZ = 29, 
                SnowflakeParticle3D.SOLSizeGradientMax = 30, SnowflakeParticle3D.SOLSIZEGRADIENTXMAX = 31, 
                SnowflakeParticle3D.SOLSIZEGRADIENTYMAX = 32, SnowflakeParticle3D.SOLSizeGradientZMAX = 33, 
                SnowflakeParticle3D.ROLANGULARVELOCITYCONST = 34, SnowflakeParticle3D.ROLANGULARVELOCITYCONSTSEPRARATE = 35, 
                SnowflakeParticle3D.ROLANGULARVELOCITYGRADIENT = 36, SnowflakeParticle3D.ROLANGULARVELOCITYGRADIENTX = 37, 
                SnowflakeParticle3D.ROLANGULARVELOCITYGRADIENTY = 38, SnowflakeParticle3D.ROLANGULARVELOCITYGRADIENTZ = 39, 
                SnowflakeParticle3D.ROLANGULARVELOCITYGRADIENTW = 40, SnowflakeParticle3D.ROLANGULARVELOCITYCONSTMAX = 41, 
                SnowflakeParticle3D.ROLANGULARVELOCITYCONSTMAXSEPRARATE = 42, SnowflakeParticle3D.ROLANGULARVELOCITYGRADIENTMAX = 43, 
                SnowflakeParticle3D.ROLANGULARVELOCITYGRADIENTXMAX = 44, SnowflakeParticle3D.ROLANGULARVELOCITYGRADIENTYMAX = 45, 
                SnowflakeParticle3D.ROLANGULARVELOCITYGRADIENTZMAX = 46, SnowflakeParticle3D.ROLANGULARVELOCITYGRADIENTWMAX = 47, 
                SnowflakeParticle3D.TEXTURESHEETANIMATIONCYCLES = 48, SnowflakeParticle3D.TEXTURESHEETANIMATIONSUBUVLENGTH = 49, 
                SnowflakeParticle3D.TEXTURESHEETANIMATIONGRADIENTUVS = 50, SnowflakeParticle3D.TEXTURESHEETANIMATIONGRADIENTMAXUVS = 51, 
                SnowflakeParticle3D;
            }(RenderableSprite3D);
            snowflake.SnowflakeParticle3D = SnowflakeParticle3D;
        }(particle.snowflake || (particle.snowflake = {}));
    }(base.particle || (base.particle = {}));
}(base || (base = {})), function(base) {
    !function(particle) {
        !function(snowflake) {
            var MathUtil = Laya.MathUtil, Vector3 = Laya.Vector3, SnowflakeParticleData = function() {
                function SnowflakeParticleData() {}
                return SnowflakeParticleData.create = function(particleSystem, particleRender, transform) {
                    var autoRandomSeed = particleSystem.autoRandomSeed, rand = particleSystem._rand, randomSeeds = particleSystem._randomSeeds;
                    switch (particleSystem.startColorType) {
                      case 0:
                        var constantStartColorE = particleSystem.startColorConstant.elements;
                        SnowflakeParticleData.startColor[0] = constantStartColorE[0], SnowflakeParticleData.startColor[1] = constantStartColorE[1], 
                        SnowflakeParticleData.startColor[2] = constantStartColorE[2], SnowflakeParticleData.startColor[3] = constantStartColorE[3];
                        break;

                      case 2:
                        autoRandomSeed ? MathUtil.lerpVector4(particleSystem.startColorConstantMin.elements, particleSystem.startColorConstantMax.elements, Math.random(), SnowflakeParticleData.startColor) : (rand.seed = randomSeeds[3], 
                        MathUtil.lerpVector4(particleSystem.startColorConstantMin.elements, particleSystem.startColorConstantMax.elements, rand.getFloat(), SnowflakeParticleData.startColor), 
                        randomSeeds[3] = rand.seed);
                    }
                    var colorOverLifetime = particleSystem.colorOverLifetime;
                    if (colorOverLifetime && colorOverLifetime.enbale) {
                        var color = colorOverLifetime.color;
                        switch (color.type) {
                          case 0:
                            SnowflakeParticleData.startColor[0] = SnowflakeParticleData.startColor[0] * color.constant.x, 
                            SnowflakeParticleData.startColor[1] = SnowflakeParticleData.startColor[1] * color.constant.y, 
                            SnowflakeParticleData.startColor[2] = SnowflakeParticleData.startColor[2] * color.constant.z, 
                            SnowflakeParticleData.startColor[3] = SnowflakeParticleData.startColor[3] * color.constant.w;
                            break;

                          case 2:
                            var colorRandom = NaN;
                            autoRandomSeed ? colorRandom = Math.random() : (rand.seed = randomSeeds[10], colorRandom = rand.getFloat(), 
                            randomSeeds[10] = rand.seed);
                            var minConstantColor = color.constantMin, maxConstantColor = color.constantMax;
                            SnowflakeParticleData.startColor[0] = SnowflakeParticleData.startColor[0] * MathUtil.lerp(minConstantColor.x, maxConstantColor.x, colorRandom), 
                            SnowflakeParticleData.startColor[1] = SnowflakeParticleData.startColor[1] * MathUtil.lerp(minConstantColor.y, maxConstantColor.y, colorRandom), 
                            SnowflakeParticleData.startColor[2] = SnowflakeParticleData.startColor[2] * MathUtil.lerp(minConstantColor.z, maxConstantColor.z, colorRandom), 
                            SnowflakeParticleData.startColor[3] = SnowflakeParticleData.startColor[3] * MathUtil.lerp(minConstantColor.w, maxConstantColor.w, colorRandom);
                        }
                    }
                    var particleSize = SnowflakeParticleData.startSize;
                    switch (particleSystem.startSizeType) {
                      case 0:
                        if (particleSystem.threeDStartSize) {
                            var startSizeConstantSeparate = particleSystem.startSizeConstantSeparate;
                            particleSize[0] = startSizeConstantSeparate.x, particleSize[1] = startSizeConstantSeparate.y, 
                            particleSize[2] = startSizeConstantSeparate.z;
                        } else particleSize[0] = particleSize[1] = particleSize[2] = particleSystem.startSizeConstant;
                        break;

                      case 2:
                        if (particleSystem.threeDStartSize) {
                            var startSizeConstantMinSeparate = particleSystem.startSizeConstantMinSeparate, startSizeConstantMaxSeparate = particleSystem.startSizeConstantMaxSeparate;
                            autoRandomSeed ? (particleSize[0] = MathUtil.lerp(startSizeConstantMinSeparate.x, startSizeConstantMaxSeparate.x, Math.random()), 
                            particleSize[1] = MathUtil.lerp(startSizeConstantMinSeparate.y, startSizeConstantMaxSeparate.y, Math.random()), 
                            particleSize[2] = MathUtil.lerp(startSizeConstantMinSeparate.z, startSizeConstantMaxSeparate.z, Math.random())) : (rand.seed = randomSeeds[4], 
                            particleSize[0] = MathUtil.lerp(startSizeConstantMinSeparate.x, startSizeConstantMaxSeparate.x, rand.getFloat()), 
                            particleSize[1] = MathUtil.lerp(startSizeConstantMinSeparate.y, startSizeConstantMaxSeparate.y, rand.getFloat()), 
                            particleSize[2] = MathUtil.lerp(startSizeConstantMinSeparate.z, startSizeConstantMaxSeparate.z, rand.getFloat()), 
                            randomSeeds[4] = rand.seed);
                        } else autoRandomSeed ? particleSize[0] = particleSize[1] = particleSize[2] = MathUtil.lerp(particleSystem.startSizeConstantMin, particleSystem.startSizeConstantMax, Math.random()) : (rand.seed = randomSeeds[4], 
                        particleSize[0] = particleSize[1] = particleSize[2] = MathUtil.lerp(particleSystem.startSizeConstantMin, particleSystem.startSizeConstantMax, rand.getFloat()), 
                        randomSeeds[4] = rand.seed);
                    }
                    var sizeOverLifetime = particleSystem.sizeOverLifetime;
                    if (sizeOverLifetime && sizeOverLifetime.enbale && 1 === sizeOverLifetime.size.type) {
                        var size = sizeOverLifetime.size;
                        if (size.separateAxes) autoRandomSeed ? (particleSize[0] = particleSize[0] * MathUtil.lerp(size.constantMinSeparate.x, size.constantMaxSeparate.x, Math.random()), 
                        particleSize[1] = particleSize[1] * MathUtil.lerp(size.constantMinSeparate.y, size.constantMaxSeparate.y, Math.random()), 
                        particleSize[2] = particleSize[2] * MathUtil.lerp(size.constantMinSeparate.z, size.constantMaxSeparate.z, Math.random())) : (rand.seed = randomSeeds[11], 
                        particleSize[0] = particleSize[0] * MathUtil.lerp(size.constantMinSeparate.x, size.constantMaxSeparate.x, rand.getFloat()), 
                        particleSize[1] = particleSize[1] * MathUtil.lerp(size.constantMinSeparate.y, size.constantMaxSeparate.y, rand.getFloat()), 
                        particleSize[2] = particleSize[2] * MathUtil.lerp(size.constantMinSeparate.z, size.constantMaxSeparate.z, rand.getFloat()), 
                        randomSeeds[11] = rand.seed); else {
                            var randomSize = NaN;
                            autoRandomSeed ? randomSize = MathUtil.lerp(size.constantMin, size.constantMax, Math.random()) : (rand.seed = randomSeeds[11], 
                            randomSize = MathUtil.lerp(size.constantMin, size.constantMax, rand.getFloat()), 
                            randomSeeds[11] = rand.seed), particleSize[0] = particleSize[0] * randomSize, particleSize[1] = particleSize[1] * randomSize, 
                            particleSize[2] = particleSize[2] * randomSize;
                        }
                    }
                    var renderMode = particleRender.renderMode;
                    if (1 !== renderMode) switch (particleSystem.startRotationType) {
                      case 0:
                        if (particleSystem.threeDStartRotation) {
                            var startRotationConstantSeparate = particleSystem.startRotationConstantSeparate, randomRotationE = SnowflakeParticleData._tempVector30.elements;
                            snowflake.SnowflakeParticleUtils._randomInvertRoationArray(startRotationConstantSeparate.elements, randomRotationE, particleSystem.randomizeRotationDirection, autoRandomSeed ? null : rand, randomSeeds), 
                            SnowflakeParticleData.startRotation[0] = randomRotationE[0], SnowflakeParticleData.startRotation[1] = randomRotationE[1], 
                            SnowflakeParticleData.startRotation[2] = 4 !== renderMode ? -randomRotationE[2] : randomRotationE[2];
                        } else SnowflakeParticleData.startRotation[0] = snowflake.SnowflakeParticleUtils._randomInvertRoation(particleSystem.startRotationConstant, particleSystem.randomizeRotationDirection, autoRandomSeed ? null : rand, randomSeeds);
                        break;

                      case 2:
                        if (particleSystem.threeDStartRotation) {
                            var startRotationConstantMinSeparate = particleSystem.startRotationConstantMinSeparate, startRotationConstantMaxSeparate = particleSystem.startRotationConstantMaxSeparate, lerpRoationE = SnowflakeParticleData._tempVector30.elements;
                            autoRandomSeed ? (lerpRoationE[0] = MathUtil.lerp(startRotationConstantMinSeparate.x, startRotationConstantMaxSeparate.x, Math.random()), 
                            lerpRoationE[1] = MathUtil.lerp(startRotationConstantMinSeparate.y, startRotationConstantMaxSeparate.y, Math.random()), 
                            lerpRoationE[2] = MathUtil.lerp(startRotationConstantMinSeparate.z, startRotationConstantMaxSeparate.z, Math.random())) : (rand.seed = randomSeeds[5], 
                            lerpRoationE[0] = MathUtil.lerp(startRotationConstantMinSeparate.x, startRotationConstantMaxSeparate.x, rand.getFloat()), 
                            lerpRoationE[1] = MathUtil.lerp(startRotationConstantMinSeparate.y, startRotationConstantMaxSeparate.y, rand.getFloat()), 
                            lerpRoationE[2] = MathUtil.lerp(startRotationConstantMinSeparate.z, startRotationConstantMaxSeparate.z, rand.getFloat()), 
                            randomSeeds[5] = rand.seed), snowflake.SnowflakeParticleUtils._randomInvertRoationArray(lerpRoationE, lerpRoationE, particleSystem.randomizeRotationDirection, autoRandomSeed ? null : rand, randomSeeds), 
                            SnowflakeParticleData.startRotation[0] = lerpRoationE[0], SnowflakeParticleData.startRotation[1] = lerpRoationE[1], 
                            SnowflakeParticleData.startRotation[2] = 4 !== renderMode ? -lerpRoationE[2] : lerpRoationE[2];
                        } else autoRandomSeed ? SnowflakeParticleData.startRotation[0] = snowflake.SnowflakeParticleUtils._randomInvertRoation(MathUtil.lerp(particleSystem.startRotationConstantMin, particleSystem.startRotationConstantMax, Math.random()), particleSystem.randomizeRotationDirection, autoRandomSeed ? null : rand, randomSeeds) : (rand.seed = randomSeeds[5], 
                        SnowflakeParticleData.startRotation[0] = snowflake.SnowflakeParticleUtils._randomInvertRoation(MathUtil.lerp(particleSystem.startRotationConstantMin, particleSystem.startRotationConstantMax, rand.getFloat()), particleSystem.randomizeRotationDirection, autoRandomSeed ? null : rand, randomSeeds), 
                        randomSeeds[5] = rand.seed);
                    }
                    switch (particleSystem.startLifetimeType) {
                      case 0:
                        SnowflakeParticleData.startLifeTime = particleSystem.startLifetimeConstant;
                        break;

                      case 1:
                        SnowflakeParticleData.startLifeTime = snowflake.SnowflakeParticleUtils._getStartLifetimeFromGradient(particleSystem.startLifeTimeGradient, particleSystem.emissionTime);
                        break;

                      case 2:
                        autoRandomSeed ? SnowflakeParticleData.startLifeTime = MathUtil.lerp(particleSystem.startLifetimeConstantMin, particleSystem.startLifetimeConstantMax, Math.random()) : (rand.seed = randomSeeds[7], 
                        SnowflakeParticleData.startLifeTime = MathUtil.lerp(particleSystem.startLifetimeConstantMin, particleSystem.startLifetimeConstantMax, rand.getFloat()), 
                        randomSeeds[7] = rand.seed);
                        break;

                      case 3:
                        var emissionTime = particleSystem.emissionTime;
                        autoRandomSeed ? SnowflakeParticleData.startLifeTime = MathUtil.lerp(snowflake.SnowflakeParticleUtils._getStartLifetimeFromGradient(particleSystem.startLifeTimeGradientMin, emissionTime), snowflake.SnowflakeParticleUtils._getStartLifetimeFromGradient(particleSystem.startLifeTimeGradientMax, emissionTime), Math.random()) : (rand.seed = randomSeeds[7], 
                        SnowflakeParticleData.startLifeTime = MathUtil.lerp(snowflake.SnowflakeParticleUtils._getStartLifetimeFromGradient(particleSystem.startLifeTimeGradientMin, emissionTime), snowflake.SnowflakeParticleUtils._getStartLifetimeFromGradient(particleSystem.startLifeTimeGradientMax, emissionTime), rand.getFloat()), 
                        randomSeeds[7] = rand.seed);
                    }
                    switch (particleSystem.startSpeedType) {
                      case 0:
                        SnowflakeParticleData.startSpeed = particleSystem.startSpeedConstant;
                        break;

                      case 2:
                        autoRandomSeed ? SnowflakeParticleData.startSpeed = MathUtil.lerp(particleSystem.startSpeedConstantMin, particleSystem.startSpeedConstantMax, Math.random()) : (rand.seed = randomSeeds[8], 
                        SnowflakeParticleData.startSpeed = MathUtil.lerp(particleSystem.startSpeedConstantMin, particleSystem.startSpeedConstantMax, rand.getFloat()), 
                        randomSeeds[8] = rand.seed);
                    }
                    var textureSheetAnimation = particleSystem.textureSheetAnimation;
                    if (textureSheetAnimation && textureSheetAnimation.enable) {
                        var title = textureSheetAnimation.tiles, titleX = title.x, titleY = title.y, subU = 1 / titleX, subV = 1 / titleY, startFrameCount = 0, startFrame = textureSheetAnimation.startFrame;
                        switch (startFrame.type) {
                          case 0:
                            startFrameCount = startFrame.constant;
                            break;

                          case 1:
                            autoRandomSeed ? startFrameCount = MathUtil.lerp(startFrame.constantMin, startFrame.constantMax, Math.random()) : (rand.seed = randomSeeds[14], 
                            startFrameCount = MathUtil.lerp(startFrame.constantMin, startFrame.constantMax, rand.getFloat()), 
                            randomSeeds[14] = rand.seed);
                        }
                        var frame = textureSheetAnimation.frame;
                        switch (frame.type) {
                          case 0:
                            startFrameCount += frame.constant;
                            break;

                          case 2:
                            autoRandomSeed ? startFrameCount += MathUtil.lerp(frame.constantMin, frame.constantMax, Math.random()) : (rand.seed = randomSeeds[15], 
                            startFrameCount += MathUtil.lerp(frame.constantMin, frame.constantMax, rand.getFloat()), 
                            randomSeeds[15] = rand.seed);
                        }
                        var startRow = 0;
                        switch (textureSheetAnimation.type) {
                          case 0:
                            startRow = Math.floor(startFrameCount / titleX);
                            break;

                          case 1:
                            textureSheetAnimation.randomRow ? autoRandomSeed ? startRow = Math.floor(Math.random() * titleY) : (rand.seed = randomSeeds[13], 
                            startRow = Math.floor(rand.getFloat() * titleY), randomSeeds[13] = rand.seed) : startRow = textureSheetAnimation.rowIndex;
                        }
                        var startCol = Math.floor(startFrameCount % titleX);
                        (startUVInfo = SnowflakeParticleData.startUVInfo)[0] = subU, startUVInfo[1] = subV, 
                        startUVInfo[2] = startCol * subU, startUVInfo[3] = startRow * subV;
                    } else {
                        var startUVInfo;
                        (startUVInfo = SnowflakeParticleData.startUVInfo)[0] = 1, startUVInfo[1] = 1, startUVInfo[2] = 0, 
                        startUVInfo[3] = 0;
                    }
                    switch (particleSystem.simulationSpace) {
                      case 0:
                        SnowflakeParticleData.simulationWorldPostion.set(transform.position.elements), SnowflakeParticleData.simulationWorldRotation.set(transform.rotation.elements);
                        break;

                      case 1:
                        break;

                      default:
                        throw new Error("SnowflakeParticleMaterial: SimulationSpace value is invalid.");
                    }
                }, SnowflakeParticleData.startLifeTime = NaN, SnowflakeParticleData.startSpeed = NaN, 
                SnowflakeParticleData._tempVector30 = new Vector3(), SnowflakeParticleData.startColor = new Float32Array(4), 
                SnowflakeParticleData.startSize = new Float32Array(3), SnowflakeParticleData.startRotation = new Float32Array(3), 
                SnowflakeParticleData.startUVInfo = new Float32Array(4), SnowflakeParticleData.simulationWorldPostion = new Float32Array(3), 
                SnowflakeParticleData.simulationWorldRotation = new Float32Array(4), SnowflakeParticleData;
            }();
            snowflake.SnowflakeParticleData = SnowflakeParticleData;
        }(particle.snowflake || (particle.snowflake = {}));
    }(base.particle || (base.particle = {}));
}(base || (base = {})), function(base) {
    !function(particle) {
        !function(snowflake) {
            var SnowflakeParticleRender = function(_super) {
                function SnowflakeParticleRender(owner) {
                    var _this = _super.call(this, owner) || this;
                    return _this._finalGravity = new Laya.Vector3(), _this._tempRotationMatrix = new Laya.Matrix4x4(), 
                    _this._defaultBoundBox = new Laya.BoundBox(new Laya.Vector3(), new Laya.Vector3()), 
                    _this._renderMode = -1, _this._mesh = null, _this.stretchedBillboardCameraSpeedScale = 0, 
                    _this.stretchedBillboardLengthScale = 0, _this.stretchedBillboardLengthScale = 1, 
                    _this;
                }
                return __extends(SnowflakeParticleRender, _super), SnowflakeParticleRender.prototype._calculateBoundingBox = function() {
                    var elements = this._boundingBox.min.elements;
                    elements[0] = -Number.MAX_VALUE, elements[1] = -Number.MAX_VALUE, elements[2] = -Number.MAX_VALUE, 
                    (elements = this._boundingBox.max.elements)[0] = Number.MAX_VALUE, elements[1] = Number.MAX_VALUE, 
                    elements[2] = Number.MAX_VALUE;
                }, SnowflakeParticleRender.prototype._calculateBoundingSphere = function() {
                    var oriBoundSphere = this._owner.particleSystem._boundingSphere, maxScale = NaN, transform = this._owner.transform, scaleE = transform.scale.elements, scaleX = Math.abs(scaleE[0]), scaleY = Math.abs(scaleE[1]), scaleZ = Math.abs(scaleE[2]);
                    maxScale = scaleY <= scaleX && scaleZ <= scaleX ? scaleX : scaleZ <= scaleY ? scaleY : scaleZ, 
                    Laya.Vector3.transformCoordinate(oriBoundSphere.center, transform.worldMatrix, this._boundingSphere.center), 
                    this._boundingSphere.radius = oriBoundSphere.radius * maxScale;
                }, SnowflakeParticleRender.prototype._renderUpdate = function(projectionView) {
                    var particleSystem = this._owner.particleSystem;
                    if (!Laya.stage.isVisibility || !particleSystem.isAlive) return !1;
                    var transform = this._owner.transform;
                    switch (particleSystem.simulationSpace) {
                      case 0:
                        break;

                      case 1:
                        this._setShaderValueColor(0, transform.position), this._setShaderValueColor(1, transform.rotation);
                        break;

                      default:
                        throw new Error("SnowflakeParticleMaterial: SimulationSpace value is invalid.");
                    }
                    switch (particleSystem.scaleMode) {
                      case 0:
                        var scale = transform.scale;
                        this._setShaderValueColor(4, scale), this._setShaderValueColor(5, scale);
                        break;

                      case 1:
                        var localScale = transform.localScale;
                        this._setShaderValueColor(4, localScale), this._setShaderValueColor(5, localScale);
                        break;

                      case 2:
                        this._setShaderValueColor(4, transform.scale), this._setShaderValueColor(5, Laya.Vector3.ONE);
                    }
                    var finalGravityE = this._finalGravity.elements, gravityE = SnowflakeParticleRender.gravity.elements, gravityModifier = particleSystem.gravityModifier;
                    return finalGravityE[0] = gravityE[0] * gravityModifier, finalGravityE[1] = gravityE[1] * gravityModifier, 
                    finalGravityE[2] = gravityE[2] * gravityModifier, this._setShaderValueBuffer(7, finalGravityE), 
                    this._setShaderValueInt(11, particleSystem.simulationSpace), this._setShaderValueBool(8, particleSystem.threeDStartRotation), 
                    this._setShaderValueInt(6, particleSystem.scaleMode), this._setShaderValueInt(9, this.stretchedBillboardLengthScale), 
                    this._setShaderValueInt(10, this.stretchedBillboardSpeedScale), this._setShaderValueNumber(12, particleSystem._currentTime), 
                    Laya3D.debugMode && this._renderRenderableBoundBox(), !0;
                }, SnowflakeParticleRender.prototype._destroy = function() {
                    _super.prototype._destroy.call(this), this._mesh && (this._mesh._removeReference(), 
                    this._mesh = null);
                }, Object.defineProperty(SnowflakeParticleRender.prototype, "boundingBox", {
                    get: function() {
                        return this._owner.particleSystem.isAlive ? (this._boundingBoxNeedChange && (this._calculateBoundingBox(), 
                        this._boundingBoxNeedChange = !1), this._boundingBox) : this._defaultBoundBox;
                    },
                    enumerable: !0,
                    configurable: !0
                }), Object.defineProperty(SnowflakeParticleRender.prototype, "renderMode", {
                    get: function() {
                        return this._renderMode;
                    },
                    set: function(value) {
                        if (this._renderMode !== value) {
                            switch (this._renderMode) {
                              case 0:
                                this._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_BILLBOARD);
                                break;

                              case 1:
                                this._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_STRETCHEDBILLBOARD);
                                break;

                              case 2:
                                this._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_HORIZONTALBILLBOARD);
                                break;

                              case 3:
                                this._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_VERTICALBILLBOARD);
                                break;

                              case 4:
                                this._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_MESH);
                            }
                            switch (this._renderMode = value) {
                              case 0:
                                this._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_BILLBOARD);
                                break;

                              case 1:
                                this._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_STRETCHEDBILLBOARD);
                                break;

                              case 2:
                                this._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_HORIZONTALBILLBOARD);
                                break;

                              case 3:
                                this._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_VERTICALBILLBOARD);
                                break;

                              case 4:
                                this._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_MESH);
                                break;

                              default:
                                throw new Error("SnowflakeParticleRender: unknown renderMode Value.");
                            }
                            this._owner.particleSystem._initBufferDatas();
                        }
                    },
                    enumerable: !0,
                    configurable: !0
                }), Object.defineProperty(SnowflakeParticleRender.prototype, "mesh", {
                    get: function() {
                        return this._mesh;
                    },
                    set: function(value) {
                        this._mesh !== value && (this._mesh && this._mesh._removeReference(), (this._mesh = value) && value._addReference(), 
                        this._owner.particleSystem._initBufferDatas());
                    },
                    enumerable: !0,
                    configurable: !0
                }), SnowflakeParticleRender.gravity = new Laya.Vector3(0, -9.81, 0), SnowflakeParticleRender;
            }(Laya.BaseRender);
            snowflake.SnowflakeParticleRender = SnowflakeParticleRender;
        }(particle.snowflake || (particle.snowflake = {}));
    }(base.particle || (base.particle = {}));
}(base || (base = {})), function(base) {
    var particle_1;
    (function(snowflake) {
        var VertexBuffer3D = Laya.VertexBuffer3D, IndexBuffer3D = Laya.IndexBuffer3D, Emission = Laya.Emission, GradientDataNumber = Laya.GradientDataNumber, Rand = Laya.Rand, Vector3 = Laya.Vector3, Vector4 = Laya.Vector4, Vector2 = Laya.Vector2, Stat = Laya.Stat, MathUtil = Laya.MathUtil, VertexShurikenParticleMesh = Laya.VertexShurikenParticleMesh, VertexShurikenParticleBillboard = Laya.VertexShurikenParticleBillboard, WebGL = Laya.WebGL, SnowflakeParticleSystem = function(_super) {
            function SnowflakeParticleSystem(owner) {
                var _this = _super.call(this) || this;
                return _this._drawCounter = NaN, _this._uvLength = new Vector2(), _this._firstActiveElement = 0, 
                _this._firstNewElement = 0, _this._firstFreeElement = 0, _this._firstRetiredElement = 0, 
                _this._owner = owner, _this._ownerRender = owner.particleRender, _this._boundingBoxCorners = new Array(8), 
                _this._boundingSphere = new Laya.BoundSphere(new Vector3(), Number.MAX_VALUE), _this._boundingBox = new Laya.BoundBox(new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE), new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE)), 
                _this._currentTime = 0, _this._isEmitting = !1, _this._isPlaying = !1, _this._isPaused = !1, 
                _this._burstsIndex = 0, _this._frameRateTime = 0, _this._emissionTime = 0, _this._totalDelayTime = 0, 
                _this._simulateUpdate = !1, _this._bufferMaxParticles = 1, _this.duration = 5, _this.looping = !0, 
                _this.prewarm = !1, _this.startDelayType = 0, _this.startDelay = 0, _this.startDelayMin = 0, 
                _this.startDelayMax = 0, _this._startLifetimeType = 0, _this._startLifetimeConstant = 5, 
                _this._startLifeTimeGradient = new GradientDataNumber(), _this._startLifetimeConstantMin = 0, 
                _this._startLifetimeConstantMax = 5, _this._startLifeTimeGradientMin = new GradientDataNumber(), 
                _this._startLifeTimeGradientMax = new GradientDataNumber(), _this._maxStartLifetime = 5, 
                _this.startSpeedType = 0, _this.startSpeedConstant = 5, _this.startSpeedConstantMin = 0, 
                _this.startSpeedConstantMax = 5, _this.threeDStartSize = !1, _this.startSizeType = 0, 
                _this.startSizeConstant = 1, _this.startSizeConstantSeparate = new Vector3(1, 1, 1), 
                _this.startSizeConstantMin = 0, _this.startSizeConstantMax = 1, _this.startSizeConstantMinSeparate = new Vector3(0, 0, 0), 
                _this.startSizeConstantMaxSeparate = new Vector3(1, 1, 1), _this.threeDStartRotation = !1, 
                _this.startRotationType = 0, _this.startRotationConstant = 0, _this.startRotationConstantSeparate = new Vector3(0, 0, 0), 
                _this.startRotationConstantMin = 0, _this.startRotationConstantMax = 0, _this.startRotationConstantMinSeparate = new Vector3(0, 0, 0), 
                _this.startRotationConstantMaxSeparate = new Vector3(0, 0, 0), _this.randomizeRotationDirection = 0, 
                _this.startColorType = 0, _this.startColorConstant = new Vector4(1, 1, 1, 1), _this.startColorConstantMin = new Vector4(1, 1, 1, 1), 
                _this.startColorConstantMax = new Vector4(1, 1, 1, 1), _this.gravityModifier = 0, 
                _this.simulationSpace = 1, _this.scaleMode = 0, _this.playOnAwake = !0, _this._rand = new Rand(0), 
                _this.autoRandomSeed = !0, _this.randomSeed = new Uint32Array(1), _this._randomSeeds = new Uint32Array(SnowflakeParticleSystem._RANDOMOFFSET.length), 
                _this.isPerformanceMode = !0, _this._emission = new Emission(), _this._emission.enbale = !0, 
                _this._owner.on("activeinhierarchychanged", _this, _this._onOwnerActiveHierarchyChanged), 
                _this;
            }
            return __extends(SnowflakeParticleSystem, _super), SnowflakeParticleSystem.prototype._getVertexBuffer = function(index) {
                return void 0 === index && (index = 0), 0 === index ? this._vertexBuffer : null;
            }, SnowflakeParticleSystem.prototype._getIndexBuffer = function() {
                return this._indexBuffer;
            }, SnowflakeParticleSystem.prototype._generateBoundingSphere = function() {
                var centerE = this._boundingSphere.center.elements;
                centerE[0] = 0, centerE[1] = 0, centerE[2] = 0, this._boundingSphere.radius = Number.MAX_VALUE;
            }, SnowflakeParticleSystem.prototype._generateBoundingBox = function() {
                var particleRender = this._owner.particleRender, boundMin = this._boundingBox.min, boundMax = this._boundingBox.max, i = 0, n = 0, maxStartLifeTime = NaN;
                switch (this.startLifetimeType) {
                  case 0:
                    maxStartLifeTime = this.startLifetimeConstant;
                    break;

                  case 1:
                    maxStartLifeTime = -Number.MAX_VALUE;
                    var startLifeTimeGradient = this.startLifeTimeGradient;
                    for (i = 0, n = startLifeTimeGradient.gradientCount; i < n; i++) maxStartLifeTime = Math.max(maxStartLifeTime, startLifeTimeGradient.getValueByIndex(i));
                    break;

                  case 2:
                    maxStartLifeTime = Math.max(this.startLifetimeConstantMin, this.startLifetimeConstantMax);
                    break;

                  case 3:
                    maxStartLifeTime = -Number.MAX_VALUE;
                    var startLifeTimeGradientMin = this.startLifeTimeGradientMin;
                    for (i = 0, n = startLifeTimeGradientMin.gradientCount; i < n; i++) maxStartLifeTime = Math.max(maxStartLifeTime, startLifeTimeGradientMin.getValueByIndex(i));
                    var startLifeTimeGradientMax = this.startLifeTimeGradientMax;
                    for (i = 0, n = startLifeTimeGradientMax.gradientCount; i < n; i++) maxStartLifeTime = Math.max(maxStartLifeTime, startLifeTimeGradientMax.getValueByIndex(i));
                }
                var minPosition, maxPosition, minDirection, maxDirection, minStartSpeed = NaN, maxStartSpeed = NaN;
                switch (this.startSpeedType) {
                  case 0:
                    minStartSpeed = maxStartSpeed = this.startSpeedConstant;
                    break;

                  case 1:
                    break;

                  case 2:
                    minStartSpeed = this.startLifetimeConstantMin, maxStartSpeed = this.startLifetimeConstantMax;
                }
                this._shape && this._shape.enable || (minPosition = maxPosition = Vector3.ZERO, 
                minDirection = Vector3.ZERO, maxDirection = Vector3.UnitZ);
                var positionScale, velocityScale, startMinVelocity = new Vector3(minDirection.x * minStartSpeed, minDirection.y * minStartSpeed, minDirection.z * minStartSpeed), startMaxVelocity = new Vector3(maxDirection.x * maxStartSpeed, maxDirection.y * maxStartSpeed, maxDirection.z * maxStartSpeed);
                if (this._velocityOverLifetime && this._velocityOverLifetime.enbale) {
                    var velocity = this._velocityOverLifetime.velocity;
                    switch (velocity.type) {
                      case 0:
                        velocity.constant;
                        break;

                      case 1:
                        new Vector3(velocity.gradientX.getAverageValue(), velocity.gradientY.getAverageValue(), velocity.gradientZ.getAverageValue());
                        break;

                      case 2:
                        velocity.constantMin, velocity.constantMax;
                        break;

                      case 3:
                        new Vector3(velocity.gradientXMin.getAverageValue(), velocity.gradientYMin.getAverageValue(), velocity.gradientZMin.getAverageValue()), 
                        new Vector3(velocity.gradientXMax.getAverageValue(), velocity.gradientYMax.getAverageValue(), velocity.gradientZMax.getAverageValue());
                    }
                }
                var minStratPosition, maxStratPosition, transform = this._owner.transform, worldPosition = transform.position, sizeScale = SnowflakeParticleSystem._tempVector39, sizeScaleE = sizeScale.elements, renderMode = particleRender.renderMode;
                switch (this.scaleMode) {
                  case 0:
                    var scale = transform.scale;
                    positionScale = scale, sizeScaleE[0] = scale.x, sizeScaleE[1] = scale.z, sizeScaleE[2] = scale.y, 
                    1 === renderMode && (velocityScale = scale);
                    break;

                  case 1:
                    var localScale = transform.localScale;
                    positionScale = localScale, sizeScaleE[0] = localScale.x, sizeScaleE[1] = localScale.z, 
                    sizeScaleE[2] = localScale.y, 1 === renderMode && (velocityScale = localScale);
                    break;

                  case 2:
                    positionScale = transform.scale, sizeScaleE[0] = sizeScaleE[1] = sizeScaleE[2] = 1, 
                    1 === renderMode && (velocityScale = Vector3.ONE);
                }
                switch (this._velocityOverLifetime && this._velocityOverLifetime.enbale || (minStratPosition = new Vector3(startMinVelocity.x * maxStartLifeTime, startMinVelocity.y * maxStartLifeTime, startMinVelocity.z * maxStartLifeTime), 
                maxStratPosition = new Vector3(startMaxVelocity.x * maxStartLifeTime, startMaxVelocity.y * maxStartLifeTime, startMaxVelocity.z * maxStartLifeTime), 
                2 != this.scaleMode ? (Vector3.add(minPosition, minStratPosition, boundMin), Vector3.multiply(positionScale, boundMin, boundMin), 
                Vector3.add(maxPosition, maxStratPosition, boundMax), Vector3.multiply(positionScale, boundMax, boundMax)) : (Vector3.multiply(positionScale, minPosition, boundMin), 
                Vector3.add(boundMin, minStratPosition, boundMin), Vector3.multiply(positionScale, maxPosition, boundMax), 
                Vector3.add(boundMax, maxStratPosition, boundMax))), this.simulationSpace) {
                  case 0:
                    break;

                  case 1:
                    Vector3.add(boundMin, worldPosition, boundMin), Vector3.add(boundMax, worldPosition, boundMax);
                }
                var maxSize = NaN, maxSizeY = NaN;
                switch (this.startSizeType) {
                  case 0:
                    if (this.threeDStartSize) {
                        var startSizeConstantSeparate = this.startSizeConstantSeparate;
                        maxSize = Math.max(startSizeConstantSeparate.x, startSizeConstantSeparate.y), 1 === renderMode && (maxSizeY = startSizeConstantSeparate.y);
                    } else maxSize = this.startSizeConstant, 1 === renderMode && (maxSizeY = this.startSizeConstant);
                    break;

                  case 1:
                    break;

                  case 2:
                    if (this.threeDStartSize) {
                        var startSizeConstantMaxSeparate = this.startSizeConstantMaxSeparate;
                        maxSize = Math.max(startSizeConstantMaxSeparate.x, startSizeConstantMaxSeparate.y), 
                        1 === renderMode && (maxSizeY = startSizeConstantMaxSeparate.y);
                    } else maxSize = this.startSizeConstantMax, 1 === renderMode && (maxSizeY = this.startSizeConstantMax);
                }
                this._sizeOverLifetime && this._sizeOverLifetime.enbale && (maxSize *= this._sizeOverLifetime.size.getMaxSizeInGradient());
                var threeDMaxSize = SnowflakeParticleSystem._tempVector30, threeDMaxSizeE = threeDMaxSize.elements, rotSize = NaN, nonRotSize = NaN;
                switch (renderMode) {
                  case 0:
                    rotSize = maxSize * SnowflakeParticleSystem.halfKSqrtOf2, Vector3.scale(sizeScale, maxSize, threeDMaxSize), 
                    Vector3.subtract(boundMin, threeDMaxSize, boundMin), Vector3.add(boundMax, threeDMaxSize, boundMax);
                    break;

                  case 1:
                    var maxStretchPosition = SnowflakeParticleSystem._tempVector31, maxStretchVelocity = SnowflakeParticleSystem._tempVector32, minStretchVelocity = SnowflakeParticleSystem._tempVector33, minStretchPosition = SnowflakeParticleSystem._tempVector34;
                    this._velocityOverLifetime && this._velocityOverLifetime.enbale || (Vector3.multiply(velocityScale, startMaxVelocity, maxStretchVelocity), 
                    Vector3.multiply(velocityScale, startMinVelocity, minStretchVelocity));
                    var sizeStretch = maxSizeY * particleRender.stretchedBillboardLengthScale, maxStretchLength = Vector3.scalarLength(maxStretchVelocity) * particleRender.stretchedBillboardSpeedScale + sizeStretch, minStretchLength = Vector3.scalarLength(minStretchVelocity) * particleRender.stretchedBillboardSpeedScale + sizeStretch, norMaxStretchVelocity = SnowflakeParticleSystem._tempVector35, norMinStretchVelocity = SnowflakeParticleSystem._tempVector36;
                    Vector3.normalize(maxStretchVelocity, norMaxStretchVelocity), Vector3.scale(norMaxStretchVelocity, maxStretchLength, minStretchPosition), 
                    Vector3.subtract(maxStratPosition, minStretchPosition, minStretchPosition), Vector3.normalize(minStretchVelocity, norMinStretchVelocity), 
                    Vector3.scale(norMinStretchVelocity, minStretchLength, maxStretchPosition), Vector3.add(minStratPosition, maxStretchPosition, maxStretchPosition), 
                    rotSize = maxSize * SnowflakeParticleSystem.halfKSqrtOf2, Vector3.scale(sizeScale, rotSize, threeDMaxSize);
                    var halfNorMaxStretchVelocity = SnowflakeParticleSystem._tempVector37, halfNorMinStretchVelocity = SnowflakeParticleSystem._tempVector38;
                    Vector3.scale(norMaxStretchVelocity, .5, halfNorMaxStretchVelocity), Vector3.scale(norMinStretchVelocity, .5, halfNorMinStretchVelocity), 
                    Vector3.multiply(halfNorMaxStretchVelocity, sizeScale, halfNorMaxStretchVelocity), 
                    Vector3.multiply(halfNorMinStretchVelocity, sizeScale, halfNorMinStretchVelocity), 
                    Vector3.add(boundMin, halfNorMinStretchVelocity, boundMin), Vector3.min(boundMin, minStretchPosition, boundMin), 
                    Vector3.subtract(boundMin, threeDMaxSize, boundMin), Vector3.subtract(boundMax, halfNorMaxStretchVelocity, boundMax), 
                    Vector3.max(boundMax, maxStretchPosition, boundMax), Vector3.add(boundMax, threeDMaxSize, boundMax);
                    break;

                  case 2:
                    nonRotSize = .5 * (maxSize *= Math.cos(.7853981633974483)), threeDMaxSizeE[0] = sizeScale.x * nonRotSize, 
                    threeDMaxSizeE[1] = sizeScale.z * nonRotSize, Vector3.subtract(boundMin, threeDMaxSize, boundMin), 
                    Vector3.add(boundMax, threeDMaxSize, boundMax);
                    break;

                  case 3:
                    nonRotSize = .5 * (maxSize *= Math.cos(.7853981633974483)), Vector3.scale(sizeScale, nonRotSize, threeDMaxSize), 
                    Vector3.subtract(boundMin, threeDMaxSize, boundMin), Vector3.add(boundMax, threeDMaxSize, boundMax);
                }
                this._boundingBox.getCorners(this._boundingBoxCorners);
            }, SnowflakeParticleSystem.prototype._updateEmission = function() {
                if (Laya.stage.isVisibility && this.isAlive) if (this._simulateUpdate) this._simulateUpdate = !1; else {
                    var elapsedTime = this._startUpdateLoopCount === Stat.loopCount || this._isPaused ? 0 : Laya.timer.delta / 1e3;
                    elapsedTime = Math.min(SnowflakeParticleSystem._maxElapsedTime, elapsedTime), this._updateParticles(elapsedTime);
                }
            }, SnowflakeParticleSystem.prototype._updateParticles = function(elapsedTime) {
                (4 !== this._ownerRender.renderMode || this._ownerRender.mesh) && (this._currentTime += elapsedTime, 
                this._retireActiveParticles(), this._freeRetiredParticles(), this._totalDelayTime += elapsedTime, 
                this._totalDelayTime < this._playStartDelay || this._emission.enbale && this._isEmitting && !this._isPaused && this._advanceTime(elapsedTime, this._currentTime));
            }, SnowflakeParticleSystem.prototype._updateParticlesSimulationRestart = function(time) {
                this._firstActiveElement = 0, this._firstNewElement = 0, this._firstFreeElement = 0, 
                this._firstRetiredElement = 0, this._burstsIndex = 0, this._frameRateTime = time, 
                this._emissionTime = 0, this._totalDelayTime = 0;
                var delayTime = this._currentTime = time;
                delayTime < this._playStartDelay ? this._totalDelayTime = delayTime : this._emission.enbale && this._advanceTime(time, time);
            }, SnowflakeParticleSystem.prototype._addUpdateEmissionToTimer = function() {
                Laya.timer.frameLoop(1, this, this._updateEmission);
            }, SnowflakeParticleSystem.prototype._removeUpdateEmissionToTimer = function() {
                Laya.timer.clear(this, this._updateEmission);
            }, SnowflakeParticleSystem.prototype._onOwnerActiveHierarchyChanged = function(active) {
                this._owner.displayedInStage && active ? this._addUpdateEmissionToTimer() : this._removeUpdateEmissionToTimer();
            }, SnowflakeParticleSystem.prototype._retireActiveParticles = function() {
                for (;this._firstActiveElement != this._firstNewElement; ) {
                    var index = this._firstActiveElement * this._floatCountPerVertex * this._vertexStride, timeIndex = index + this._timeIndex;
                    if (this._currentTime - this._vertices[timeIndex] + 1e-4 < this._vertices[index + this._startLifeTimeIndex]) break;
                    this._vertices[timeIndex] = this._drawCounter, this._firstActiveElement++, this._firstActiveElement >= this._bufferMaxParticles && (this._firstActiveElement = 0);
                }
            }, SnowflakeParticleSystem.prototype._freeRetiredParticles = function() {
                for (;this._firstRetiredElement != this._firstActiveElement; ) {
                    var age = this._drawCounter - this._vertices[this._firstRetiredElement * this._floatCountPerVertex * this._vertexStride + this._timeIndex];
                    if (this.isPerformanceMode && age < 3) break;
                    this._firstRetiredElement++, this._firstRetiredElement >= this._bufferMaxParticles && (this._firstRetiredElement = 0);
                }
            }, SnowflakeParticleSystem.prototype._burst = function(fromTime, toTime) {
                for (var totalEmitCount = 0, bursts = this._emission._bursts, n = bursts.length; this._burstsIndex < n; this._burstsIndex++) {
                    var burst = bursts[this._burstsIndex], burstTime = burst.time;
                    if (!(fromTime <= burstTime && burstTime < toTime)) break;
                    var emitCount = 0;
                    this.autoRandomSeed ? emitCount = MathUtil.lerp(burst.minCount, burst.maxCount, Math.random()) : (this._rand.seed = this._randomSeeds[0], 
                    emitCount = MathUtil.lerp(burst.minCount, burst.maxCount, this._rand.getFloat()), 
                    this._randomSeeds[0] = this._rand.seed), totalEmitCount += emitCount;
                }
                return totalEmitCount;
            }, SnowflakeParticleSystem.prototype._advanceTime = function(elapsedTime, emitTime) {
                var i = 0, lastEmissionTime = this._emissionTime;
                this._emissionTime += elapsedTime;
                var totalEmitCount = 0;
                if (this._emissionTime > this.duration) {
                    if (!this.looping) {
                        for (totalEmitCount = Math.min(this.maxParticles - this.aliveParticleCount, totalEmitCount), 
                        i = 0; i < totalEmitCount; i++) this.emit(emitTime);
                        return this._isPlaying = !1, void this.stop();
                    }
                    totalEmitCount += this._burst(lastEmissionTime, this._emissionTime), this._emissionTime -= this.duration, 
                    this.event("complete"), this._burstsIndex = 0, totalEmitCount += this._burst(0, this._emissionTime);
                } else totalEmitCount += this._burst(lastEmissionTime, this._emissionTime);
                for (totalEmitCount = Math.min(this.maxParticles - this.aliveParticleCount, totalEmitCount), 
                i = 0; i < totalEmitCount; i++) this.emit(emitTime);
                var emissionRate = this.emission.emissionRate;
                if (0 < emissionRate) {
                    var minEmissionTime = 1 / emissionRate;
                    for (this._frameRateTime += minEmissionTime, this._frameRateTime = this._currentTime - (this._currentTime - this._frameRateTime) % this._maxStartLifetime; this._frameRateTime <= emitTime && this.emit(this._frameRateTime); ) this._frameRateTime += minEmissionTime;
                    this._frameRateTime = Math.floor(emitTime / minEmissionTime) * minEmissionTime;
                }
            }, SnowflakeParticleSystem.prototype._initBufferDatas = function() {
                this._vertexBuffer && (this._vertexBuffer.destroy(), this._indexBuffer.destroy());
                var render = this._ownerRender, renderMode = render.renderMode;
                if (-1 !== renderMode && 0 < this.maxParticles) {
                    var indices = void 0, i = 0, j = 0, m = 0, indexOffset = 0, perPartOffset = 0, vertexDeclaration = void 0, mesh_4 = render.mesh;
                    if (4 === renderMode) {
                        if (mesh_4) {
                            if (1 < mesh_4._vertexBuffers.length) throw new Error("SnowflakeParticleSystem: submesh Count mesh be One or all subMeshes have the same vertexDeclaration.");
                            vertexDeclaration = VertexShurikenParticleMesh.vertexDeclaration, this._floatCountPerVertex = vertexDeclaration.vertexStride / 4, 
                            this._startLifeTimeIndex = 12, this._timeIndex = 16, this._vertexStride = mesh_4._vertexBuffers[0].vertexCount;
                            var totalVertexCount = this._bufferMaxParticles * this._vertexStride, lastVBVertexCount = totalVertexCount % 65535;
                            if (1 < Math.floor(totalVertexCount / 65535) + 1) throw new Error("SnowflakeParticleSystem:the maxParticleCount multiply mesh vertexCount is large than 65535.");
                            this._vertexBuffer = VertexBuffer3D.create(vertexDeclaration, lastVBVertexCount, 35048), 
                            this._vertices = new Float32Array(this._floatCountPerVertex * lastVBVertexCount), 
                            this._indexStride = mesh_4._indexBuffer.indexCount;
                            var indexDatas = mesh_4._indexBuffer.getData(), indexCount = this._bufferMaxParticles * this._indexStride;
                            for (this._indexBuffer = IndexBuffer3D.create("ushort", indexCount, 35044), indices = new Uint16Array(indexCount), 
                            i = indexOffset = 0; i < this._bufferMaxParticles; i++) {
                                var indexValueOffset = i * this._vertexStride;
                                for (j = 0, m = indexDatas.length; j < m; j++) indices[indexOffset++] = indexValueOffset + indexDatas[j];
                            }
                            this._indexBuffer.setData(indices);
                        }
                    } else {
                        for (vertexDeclaration = VertexShurikenParticleBillboard.vertexDeclaration, this._floatCountPerVertex = vertexDeclaration.vertexStride / 4, 
                        this._startLifeTimeIndex = 7, this._timeIndex = 11, this._vertexStride = 4, this._vertexBuffer = VertexBuffer3D.create(vertexDeclaration, this._bufferMaxParticles * this._vertexStride, 35048), 
                        this._vertices = new Float32Array(this._floatCountPerVertex * this._bufferMaxParticles * this._vertexStride), 
                        i = 0; i < this._bufferMaxParticles; i++) perPartOffset = i * this._floatCountPerVertex * this._vertexStride, 
                        this._vertices[perPartOffset] = -.5, this._vertices[perPartOffset + 1] = -.5, this._vertices[perPartOffset + 2] = 0, 
                        this._vertices[perPartOffset + 3] = 1, perPartOffset += this._floatCountPerVertex, 
                        this._vertices[perPartOffset] = .5, this._vertices[perPartOffset + 1] = -.5, this._vertices[perPartOffset + 2] = 1, 
                        this._vertices[perPartOffset + 3] = 1, perPartOffset += this._floatCountPerVertex, 
                        this._vertices[perPartOffset] = .5, this._vertices[perPartOffset + 1] = .5, this._vertices[perPartOffset + 2] = 1, 
                        this._vertices[perPartOffset + 3] = 0, perPartOffset += this._floatCountPerVertex, 
                        this._vertices[perPartOffset] = -.5, this._vertices[perPartOffset + 1] = .5, this._vertices[perPartOffset + 2] = 0, 
                        this._vertices[perPartOffset + 3] = 0;
                        for (this._indexStride = 6, this._indexBuffer = IndexBuffer3D.create("ushort", 6 * this._bufferMaxParticles, 35044), 
                        indices = new Uint16Array(6 * this._bufferMaxParticles), i = 0; i < this._bufferMaxParticles; i++) {
                            indexOffset = 6 * i;
                            var firstVertex = i * this._vertexStride, secondVertex = 2 + firstVertex;
                            indices[indexOffset++] = firstVertex, indices[indexOffset++] = secondVertex, indices[indexOffset++] = 1 + firstVertex, 
                            indices[indexOffset++] = firstVertex, indices[indexOffset++] = 3 + firstVertex, 
                            indices[indexOffset++] = secondVertex;
                        }
                        this._indexBuffer.setData(indices);
                    }
                }
            }, SnowflakeParticleSystem.prototype._destroy = function() {
                _super.prototype._destroy.call(this), this._removeUpdateEmissionToTimer(), this._vertexBuffer && this._vertexBuffer.destroy(), 
                this._indexBuffer && this._indexBuffer.destroy(), this._emission && this._emission._destroy(), 
                this._owner = null, this._vertices = null, this._vertexBuffer = null, this._indexBuffer = null, 
                this._emission = null, this._shape = null, this.startLifeTimeGradient = null, this.startLifeTimeGradientMin = null, 
                this.startLifeTimeGradientMax = null, this.startSizeConstantSeparate = null, this.startSizeConstantMinSeparate = null, 
                this.startSizeConstantMaxSeparate = null, this.startRotationConstantSeparate = null, 
                this.startRotationConstantMinSeparate = null, this.startRotationConstantMaxSeparate = null, 
                this.startColorConstant = null, this.startColorConstantMin = null, this.startColorConstantMax = null, 
                this._velocityOverLifetime = null, this._colorOverLifetime = null, this._sizeOverLifetime = null, 
                this._rotationOverLifetime = null, this._textureSheetAnimation = null;
            }, SnowflakeParticleSystem.prototype.emit = function(time) {
                var position = SnowflakeParticleSystem._tempPosition, direction = SnowflakeParticleSystem._tempDirection;
                if (this._shape && this._shape.enable) this.autoRandomSeed ? this._shape.generatePositionAndDirection(position, direction) : this._shape.generatePositionAndDirection(position, direction, this._rand, this._randomSeeds); else {
                    var positionE = position.elements, directionE = direction.elements;
                    positionE[0] = positionE[1] = positionE[2] = 0, directionE[0] = directionE[1] = 0, 
                    directionE[2] = 1;
                }
                return this.addParticle(position, direction, time);
            }, SnowflakeParticleSystem.prototype.addParticle = function(position, direction, time) {
                Vector3.normalize(direction, direction);
                var nextFreeParticle = this._firstFreeElement + 1;
                if (nextFreeParticle >= this._bufferMaxParticles && (nextFreeParticle = 0), nextFreeParticle === this._firstRetiredElement) return !1;
                if (snowflake.SnowflakeParticleData.create(this, this._ownerRender, this._owner.transform), 
                this._currentTime - time >= snowflake.SnowflakeParticleData.startLifeTime) return !0;
                var randomVelocityX = NaN, randomVelocityY = NaN, randomVelocityZ = NaN, needRandomVelocity = this._velocityOverLifetime && this._velocityOverLifetime.enbale;
                if (needRandomVelocity) {
                    var velocityType = this._velocityOverLifetime.velocity.type;
                    2 === velocityType || 3 === velocityType ? this.autoRandomSeed ? (randomVelocityX = Math.random(), 
                    randomVelocityY = Math.random(), randomVelocityZ = Math.random()) : (this._rand.seed = this._randomSeeds[9], 
                    randomVelocityX = this._rand.getFloat(), randomVelocityY = this._rand.getFloat(), 
                    randomVelocityZ = this._rand.getFloat(), this._randomSeeds[9] = this._rand.seed) : needRandomVelocity = !1;
                } else needRandomVelocity = !1;
                var randomColor = NaN, needRandomColor = this._colorOverLifetime && this._colorOverLifetime.enbale;
                needRandomColor && 3 === this._colorOverLifetime.color.type ? this.autoRandomSeed ? randomColor = Math.random() : (this._rand.seed = this._randomSeeds[10], 
                randomColor = this._rand.getFloat(), this._randomSeeds[10] = this._rand.seed) : needRandomColor = !1;
                var randomSize = NaN, needRandomSize = this._sizeOverLifetime && this._sizeOverLifetime.enbale;
                needRandomSize && 3 === this._sizeOverLifetime.size.type ? this.autoRandomSeed ? randomSize = Math.random() : (this._rand.seed = this._randomSeeds[11], 
                randomSize = this._rand.getFloat(), this._randomSeeds[11] = this._rand.seed) : needRandomSize = !1;
                var randomRotation = NaN, needRandomRotation = this._rotationOverLifetime && this._rotationOverLifetime.enbale;
                if (needRandomRotation) {
                    var rotationType = this._rotationOverLifetime.angularVelocity.type;
                    2 === rotationType || 3 === rotationType ? this.autoRandomSeed ? randomRotation = Math.random() : (this._rand.seed = this._randomSeeds[12], 
                    randomRotation = this._rand.getFloat(), this._randomSeeds[12] = this._rand.seed) : needRandomRotation = !1;
                } else needRandomRotation = !1;
                var randomTextureAnimation = NaN, needRandomTextureAnimation = this._textureSheetAnimation && this._textureSheetAnimation.enable;
                needRandomTextureAnimation && 3 === this._textureSheetAnimation.frame.type ? this.autoRandomSeed ? randomTextureAnimation = Math.random() : (this._rand.seed = this._randomSeeds[15], 
                randomTextureAnimation = this._rand.getFloat(), this._randomSeeds[15] = this._rand.seed) : needRandomTextureAnimation = !1;
                var meshVertices, startIndex = this._firstFreeElement * this._floatCountPerVertex * this._vertexStride, startUVInfo = snowflake.SnowflakeParticleData.startUVInfo, subU = startUVInfo[0], subV = startUVInfo[1], startU = startUVInfo[2], startV = startUVInfo[3], positionE = position.elements, directionE = direction.elements, meshVertexStride = 0, meshPosOffset = 0, meshCorOffset = 0, meshUVOffset = 0, meshVertexIndex = 0, render = this._ownerRender;
                if (4 === render.renderMode) {
                    var meshVB = render.mesh._vertexBuffers[0];
                    meshVertices = meshVB.getData();
                    var meshVertexDeclaration = meshVB.vertexDeclaration;
                    meshPosOffset = meshVertexDeclaration.getVertexElementByUsage(0).offset / 4;
                    var colorElement = meshVertexDeclaration.getVertexElementByUsage(1);
                    meshCorOffset = colorElement ? colorElement.offset / 4 : -1;
                    var uvElement = meshVertexDeclaration.getVertexElementByUsage(2);
                    meshUVOffset = uvElement ? uvElement.offset / 4 : -1, meshVertexStride = meshVertexDeclaration.vertexStride / 4, 
                    meshVertexIndex = 0;
                } else {
                    this._vertices[2 + startIndex] = startU, this._vertices[3 + startIndex] = startV + subV;
                    var secondOffset = startIndex + this._floatCountPerVertex;
                    this._vertices[secondOffset + 2] = startU + subU, this._vertices[secondOffset + 3] = startV + subV;
                    var thirdOffset = secondOffset + this._floatCountPerVertex;
                    this._vertices[thirdOffset + 2] = startU + subU, this._vertices[thirdOffset + 3] = startV;
                    var fourthOffset = thirdOffset + this._floatCountPerVertex;
                    this._vertices[fourthOffset + 2] = startU, this._vertices[fourthOffset + 3] = startV;
                }
                for (var i = startIndex, n = startIndex + this._floatCountPerVertex * this._vertexStride; i < n; i += this._floatCountPerVertex) {
                    var offset = 0;
                    if (4 === render.renderMode) {
                        offset = i;
                        var vertexOffset = meshVertexStride * meshVertexIndex++, meshOffset = vertexOffset + meshPosOffset;
                        this._vertices[offset++] = meshVertices[meshOffset++], this._vertices[offset++] = meshVertices[meshOffset++], 
                        this._vertices[offset++] = meshVertices[meshOffset], -1 === meshCorOffset ? (this._vertices[offset++] = 1, 
                        this._vertices[offset++] = 1, this._vertices[offset++] = 1, this._vertices[offset++] = 1) : (meshOffset = vertexOffset + meshCorOffset, 
                        this._vertices[offset++] = meshVertices[meshOffset++], this._vertices[offset++] = meshVertices[meshOffset++], 
                        this._vertices[offset++] = meshVertices[meshOffset++], this._vertices[offset++] = meshVertices[meshOffset]), 
                        -1 === meshUVOffset ? (this._vertices[offset++] = 0, this._vertices[offset++] = 0) : (meshOffset = vertexOffset + meshUVOffset, 
                        this._vertices[offset++] = startU + meshVertices[meshOffset++] * subU, this._vertices[offset++] = startV + meshVertices[meshOffset] * subV);
                    } else offset = i + 4;
                    switch (this._vertices[offset++] = positionE[0], this._vertices[offset++] = positionE[1], 
                    this._vertices[offset++] = positionE[2], this._vertices[offset++] = snowflake.SnowflakeParticleData.startLifeTime, 
                    this._vertices[offset++] = directionE[0], this._vertices[offset++] = directionE[1], 
                    this._vertices[offset++] = directionE[2], this._vertices[offset++] = time, this._vertices[offset++] = snowflake.SnowflakeParticleData.startColor[0], 
                    this._vertices[offset++] = snowflake.SnowflakeParticleData.startColor[1], this._vertices[offset++] = snowflake.SnowflakeParticleData.startColor[2], 
                    this._vertices[offset++] = snowflake.SnowflakeParticleData.startColor[3], this._vertices[offset++] = snowflake.SnowflakeParticleData.startSize[0], 
                    this._vertices[offset++] = snowflake.SnowflakeParticleData.startSize[1], this._vertices[offset++] = snowflake.SnowflakeParticleData.startSize[2], 
                    this._vertices[offset++] = snowflake.SnowflakeParticleData.startRotation[0], this._vertices[offset++] = snowflake.SnowflakeParticleData.startRotation[1], 
                    this._vertices[offset++] = snowflake.SnowflakeParticleData.startRotation[2], this._vertices[offset++] = snowflake.SnowflakeParticleData.startSpeed, 
                    needRandomColor && (this._vertices[offset + 1] = randomColor), needRandomSize && (this._vertices[offset + 2] = randomSize), 
                    needRandomRotation && (this._vertices[offset + 3] = randomRotation), needRandomTextureAnimation && (this._vertices[offset + 4] = randomTextureAnimation), 
                    needRandomVelocity && (this._vertices[offset + 5] = 100 * randomVelocityX, this._vertices[offset + 6] = 100 * randomVelocityY, 
                    this._vertices[offset + 7] = 100 * randomVelocityZ), this.simulationSpace) {
                      case 0:
                        offset += 8, this._vertices[offset++] = snowflake.SnowflakeParticleData.simulationWorldPostion[0], 
                        this._vertices[offset++] = snowflake.SnowflakeParticleData.simulationWorldPostion[1], 
                        this._vertices[offset++] = snowflake.SnowflakeParticleData.simulationWorldPostion[2], 
                        this._vertices[offset++] = snowflake.SnowflakeParticleData.simulationWorldRotation[0], 
                        this._vertices[offset++] = snowflake.SnowflakeParticleData.simulationWorldRotation[1], 
                        this._vertices[offset++] = snowflake.SnowflakeParticleData.simulationWorldRotation[2], 
                        this._vertices[offset++] = snowflake.SnowflakeParticleData.simulationWorldRotation[3];
                        break;

                      case 1:
                        break;

                      default:
                        throw new Error("SnowflakeParticleMaterial: SimulationSpace value is invalid.");
                    }
                }
                return this._firstFreeElement = nextFreeParticle, !0;
            }, SnowflakeParticleSystem.prototype.addNewParticlesToVertexBuffer = function() {
                var start = 0;
                this._firstNewElement < this._firstFreeElement ? (start = this._firstNewElement * this._vertexStride * this._floatCountPerVertex, 
                this._vertexBuffer.setData(this._vertices, start, start, (this._firstFreeElement - this._firstNewElement) * this._vertexStride * this._floatCountPerVertex)) : (start = this._firstNewElement * this._vertexStride * this._floatCountPerVertex, 
                this._vertexBuffer.setData(this._vertices, start, start, (this._bufferMaxParticles - this._firstNewElement) * this._vertexStride * this._floatCountPerVertex), 
                0 < this._firstFreeElement && this._vertexBuffer.setData(this._vertices, 0, 0, this._firstFreeElement * this._vertexStride * this._floatCountPerVertex)), 
                this._firstNewElement = this._firstFreeElement;
            }, SnowflakeParticleSystem.prototype._beforeRender = function(state) {
                return this._firstNewElement != this._firstFreeElement && this.addNewParticlesToVertexBuffer(), 
                this._drawCounter++, this._firstActiveElement != this._firstFreeElement && (this._vertexBuffer._bind(), 
                this._indexBuffer._bind(), !0);
            }, SnowflakeParticleSystem.prototype._render = function(state) {
                var indexCount = 0, gl = WebGL.mainContext;
                this._firstActiveElement < this._firstFreeElement ? (indexCount = (this._firstFreeElement - this._firstActiveElement) * this._indexStride, 
                gl.drawElements(4, indexCount, 5123, 2 * this._firstActiveElement * this._indexStride), 
                Stat.trianglesFaces += indexCount / 3, Stat.drawCall++) : (indexCount = (this._bufferMaxParticles - this._firstActiveElement) * this._indexStride, 
                gl.drawElements(4, indexCount, 5123, 2 * this._firstActiveElement * this._indexStride), 
                Stat.trianglesFaces += indexCount / 3, Stat.drawCall++, 0 < this._firstFreeElement && (indexCount = this._firstFreeElement * this._indexStride, 
                gl.drawElements(4, indexCount, 5123, 0), Stat.trianglesFaces += indexCount / 3, 
                Stat.drawCall++));
            }, SnowflakeParticleSystem.prototype.play = function() {
                if (this._burstsIndex = 0, this._isEmitting = !0, this._isPlaying = !0, this._isPaused = !1, 
                this._emissionTime = 0, this._totalDelayTime = 0, !this.autoRandomSeed) for (var i = 0, n = this._randomSeeds.length; i < n; i++) this._randomSeeds[i] = this.randomSeed[0] + SnowflakeParticleSystem._RANDOMOFFSET[i];
                switch (this.startDelayType) {
                  case 0:
                    this._playStartDelay = this.startDelay;
                    break;

                  case 1:
                    this.autoRandomSeed ? this._playStartDelay = MathUtil.lerp(this.startDelayMin, this.startDelayMax, Math.random()) : (this._rand.seed = this._randomSeeds[2], 
                    this._playStartDelay = MathUtil.lerp(this.startDelayMin, this.startDelayMax, this._rand.getFloat()), 
                    this._randomSeeds[2] = this._rand.seed);
                    break;

                  default:
                    throw new Error("Utils3D: startDelayType is invalid.");
                }
                this._frameRateTime = this._currentTime + this._playStartDelay, this._startUpdateLoopCount = Stat.loopCount, 
                this.event("played");
            }, SnowflakeParticleSystem.prototype.pause = function() {
                this._isPaused = !0, this.event("paused");
            }, SnowflakeParticleSystem.prototype.simulate = function(time, restart) {
                void 0 === restart && (restart = !0), this._simulateUpdate = !0, restart ? this._updateParticlesSimulationRestart(time) : (this._isPaused = !1, 
                this._updateParticles(time)), this.pause();
            }, SnowflakeParticleSystem.prototype.stop = function() {
                this._burstsIndex = 0, this._isEmitting = !1, this._emissionTime = 0, this.event("stopped");
            }, SnowflakeParticleSystem.prototype.cloneTo = function(destObject) {
                var dest = destObject;
                dest.duration = this.duration, dest.looping = this.looping, dest.prewarm = this.prewarm, 
                dest.startDelayType = this.startDelayType, dest.startDelay = this.startDelay, dest.startDelayMin = this.startDelayMin, 
                dest.startDelayMax = this.startDelayMax, dest._maxStartLifetime = this._maxStartLifetime, 
                dest.startLifetimeType = this.startLifetimeType, dest.startLifetimeConstant = this.startLifetimeConstant, 
                this.startLifeTimeGradient.cloneTo(dest.startLifeTimeGradient), dest.startLifetimeConstantMin = this.startLifetimeConstantMin, 
                dest.startLifetimeConstantMax = this.startLifetimeConstantMax, this.startLifeTimeGradientMin.cloneTo(dest.startLifeTimeGradientMin), 
                this.startLifeTimeGradientMax.cloneTo(dest.startLifeTimeGradientMax), dest.startSpeedType = this.startSpeedType, 
                dest.startSpeedConstant = this.startSpeedConstant, dest.startSpeedConstantMin = this.startSpeedConstantMin, 
                dest.startSpeedConstantMax = this.startSpeedConstantMax, dest.threeDStartSize = this.threeDStartSize, 
                dest.startSizeType = this.startSizeType, dest.startSizeConstant = this.startSizeConstant, 
                this.startSizeConstantSeparate.cloneTo(dest.startSizeConstantSeparate), dest.startSizeConstantMin = this.startSizeConstantMin, 
                dest.startSizeConstantMax = this.startSizeConstantMax, this.startSizeConstantMinSeparate.cloneTo(dest.startSizeConstantMinSeparate), 
                this.startSizeConstantMaxSeparate.cloneTo(dest.startSizeConstantMaxSeparate), dest.threeDStartRotation = this.threeDStartRotation, 
                dest.startRotationType = this.startRotationType, dest.startRotationConstant = this.startRotationConstant, 
                this.startRotationConstantSeparate.cloneTo(dest.startRotationConstantSeparate), 
                dest.startRotationConstantMin = this.startRotationConstantMin, dest.startRotationConstantMax = this.startRotationConstantMax, 
                this.startRotationConstantMinSeparate.cloneTo(dest.startRotationConstantMinSeparate), 
                this.startRotationConstantMaxSeparate.cloneTo(dest.startRotationConstantMaxSeparate), 
                dest.randomizeRotationDirection = this.randomizeRotationDirection, dest.startColorType = this.startColorType, 
                this.startColorConstant.cloneTo(dest.startColorConstant), this.startColorConstantMin.cloneTo(dest.startColorConstantMin), 
                this.startColorConstantMax.cloneTo(dest.startColorConstantMax), dest.gravityModifier = this.gravityModifier, 
                dest.simulationSpace = this.simulationSpace, dest.scaleMode = this.scaleMode, dest.playOnAwake = this.playOnAwake, 
                dest.maxParticles = this.maxParticles, this._emission && (dest._emission = this._emission.clone()), 
                this.shape && (dest.shape = this.shape.clone()), this.velocityOverLifetime && (dest.velocityOverLifetime = this.velocityOverLifetime.clone()), 
                this.colorOverLifetime && (dest.colorOverLifetime = this.colorOverLifetime.clone()), 
                this.sizeOverLifetime && (dest.sizeOverLifetime = this.sizeOverLifetime.clone()), 
                this.rotationOverLifetime && (dest.rotationOverLifetime = this.rotationOverLifetime.clone()), 
                this.textureSheetAnimation && (dest.textureSheetAnimation = this.textureSheetAnimation.clone()), 
                dest.isPerformanceMode = this.isPerformanceMode, dest._isEmitting = this._isEmitting, 
                dest._isPlaying = this._isPlaying, dest._isPaused = this._isPaused, dest._playStartDelay = this._playStartDelay, 
                dest._frameRateTime = this._frameRateTime, dest._emissionTime = this._emissionTime, 
                dest._totalDelayTime = this._totalDelayTime, dest._burstsIndex = this._burstsIndex;
            }, SnowflakeParticleSystem.prototype.clone = function() {
                var dest = new SnowflakeParticleSystem(null);
                return this.cloneTo(dest), dest;
            }, SnowflakeParticleSystem.prototype._getVertexBuffers = function() {
                return null;
            }, Object.defineProperty(SnowflakeParticleSystem.prototype, "maxParticles", {
                get: function() {
                    return this._bufferMaxParticles - 1;
                },
                set: function(value) {
                    var newMaxParticles = value + 1;
                    newMaxParticles !== this._bufferMaxParticles && (this._bufferMaxParticles = newMaxParticles, 
                    this._initBufferDatas());
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "isEmitting", {
                get: function() {
                    return this._isEmitting;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "isAlive", {
                get: function() {
                    return this._isPlaying || 0 < this.aliveParticleCount;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "shape", {
                get: function() {
                    return this._shape;
                },
                set: function(value) {
                    this._shape !== value && (value && value.enable ? this._ownerRender._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_SHAPE) : this._ownerRender._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_SHAPE), 
                    this._shape = value);
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "rotationOverLifetime", {
                get: function() {
                    return this._rotationOverLifetime;
                },
                set: function(value) {
                    var render = this._ownerRender;
                    if (value) {
                        var rotation = value.angularVelocity;
                        if (!rotation) return;
                        var rotationSeparate = rotation.separateAxes, rotationType = rotation.type;
                        if (value.enbale) switch (rotationSeparate ? render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMESEPERATE) : render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIME), 
                        rotationType) {
                          case 0:
                            render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMECONSTANT);
                            break;

                          case 1:
                            render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMECURVE);
                            break;

                          case 2:
                            render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMERANDOMCONSTANTS);
                            break;

                          case 3:
                            render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMERANDOMCURVES);
                        } else render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIME), 
                        render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMESEPERATE), 
                        render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMECONSTANT), 
                        render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMECURVE), 
                        render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMERANDOMCONSTANTS), 
                        render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMERANDOMCURVES);
                        switch (rotationType) {
                          case 0:
                            rotationSeparate ? render._setShaderValueColor(35, rotation.constantSeparate) : render._setShaderValueNumber(34, rotation.constant);
                            break;

                          case 1:
                            rotationSeparate ? (render._setShaderValueBuffer(37, rotation.gradientX._elements), 
                            render._setShaderValueBuffer(38, rotation.gradientY._elements), render._setShaderValueBuffer(39, rotation.gradientZ._elements)) : render._setShaderValueBuffer(36, rotation.gradient._elements);
                            break;

                          case 2:
                            rotationSeparate ? (render._setShaderValueColor(35, rotation.constantMinSeparate), 
                            render._setShaderValueColor(42, rotation.constantMaxSeparate)) : (render._setShaderValueNumber(34, rotation.constantMin), 
                            render._setShaderValueNumber(41, rotation.constantMax));
                            break;

                          case 3:
                            rotationSeparate ? (render._setShaderValueBuffer(37, rotation.gradientXMin._elements), 
                            render._setShaderValueBuffer(44, rotation.gradientXMax._elements), render._setShaderValueBuffer(38, rotation.gradientYMin._elements), 
                            render._setShaderValueBuffer(45, rotation.gradientYMax._elements), render._setShaderValueBuffer(39, rotation.gradientZMin._elements), 
                            render._setShaderValueBuffer(46, rotation.gradientZMax._elements), render._setShaderValueBuffer(40, rotation.gradientWMin._elements), 
                            render._setShaderValueBuffer(47, rotation.gradientWMax._elements)) : (render._setShaderValueBuffer(36, rotation.gradientMin._elements), 
                            render._setShaderValueBuffer(43, rotation.gradientMax._elements));
                        }
                    } else render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIME), 
                    render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMESEPERATE), 
                    render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMECONSTANT), 
                    render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMECURVE), 
                    render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMERANDOMCONSTANTS), 
                    render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMERANDOMCURVES), 
                    render._setShaderValueColor(35, null), render._setShaderValueColor(42, null), render._setShaderValueNumber(34, void 0), 
                    render._setShaderValueNumber(41, void 0), render._setShaderValueBuffer(37, null), 
                    render._setShaderValueBuffer(44, null), render._setShaderValueBuffer(38, null), 
                    render._setShaderValueBuffer(45, null), render._setShaderValueBuffer(39, null), 
                    render._setShaderValueBuffer(46, null), render._setShaderValueBuffer(40, null), 
                    render._setShaderValueBuffer(47, null), render._setShaderValueBuffer(36, null), 
                    render._setShaderValueBuffer(43, null);
                    this._rotationOverLifetime = value;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "emission", {
                get: function() {
                    return this._emission;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "emissionTime", {
                get: function() {
                    return this._emissionTime > this.duration ? this.duration : this._emissionTime;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "aliveParticleCount", {
                get: function() {
                    return this._firstNewElement >= this._firstRetiredElement ? this._firstNewElement - this._firstRetiredElement : this._bufferMaxParticles - this._firstRetiredElement + this._firstNewElement;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "isPlaying", {
                get: function() {
                    return this._isPlaying;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "isPaused", {
                get: function() {
                    return this._isPaused;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "startLifetimeType", {
                get: function() {
                    return this._startLifetimeType;
                },
                set: function(value) {
                    var i = 0, n = 0;
                    switch (this.startLifetimeType) {
                      case 0:
                        this._maxStartLifetime = this.startLifetimeConstant;
                        break;

                      case 1:
                        this._maxStartLifetime = -Number.MAX_VALUE;
                        var startLifeTimeGradient = this.startLifeTimeGradient;
                        for (i = 0, n = startLifeTimeGradient.gradientCount; i < n; i++) this._maxStartLifetime = Math.max(this._maxStartLifetime, startLifeTimeGradient.getValueByIndex(i));
                        break;

                      case 2:
                        this._maxStartLifetime = Math.max(this.startLifetimeConstantMin, this.startLifetimeConstantMax);
                        break;

                      case 3:
                        this._maxStartLifetime = -Number.MAX_VALUE;
                        var startLifeTimeGradientMin = this.startLifeTimeGradientMin;
                        for (i = 0, n = startLifeTimeGradientMin.gradientCount; i < n; i++) this._maxStartLifetime = Math.max(this._maxStartLifetime, startLifeTimeGradientMin.getValueByIndex(i));
                        var startLifeTimeGradientMax = this.startLifeTimeGradientMax;
                        for (i = 0, n = startLifeTimeGradientMax.gradientCount; i < n; i++) this._maxStartLifetime = Math.max(this._maxStartLifetime, startLifeTimeGradientMax.getValueByIndex(i));
                    }
                    this._startLifetimeType = value;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "_originalBoundingSphere", {
                get: function() {
                    return this._boundingSphere;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "startLifetimeConstant", {
                get: function() {
                    return this._startLifetimeConstant;
                },
                set: function(value) {
                    0 === this._startLifetimeType && (this._maxStartLifetime = value), this._startLifetimeConstant = value;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "startLifetimeConstantMin", {
                get: function() {
                    return this._startLifetimeConstantMin;
                },
                set: function(value) {
                    2 === this._startLifetimeType && (this._maxStartLifetime = Math.max(value, this._startLifetimeConstantMax)), 
                    this._startLifetimeConstantMin = value;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "startLifeTimeGradient", {
                get: function() {
                    return this._startLifeTimeGradient;
                },
                set: function(value) {
                    if (1 === this._startLifetimeType) {
                        this._maxStartLifetime = -Number.MAX_VALUE;
                        for (var i = 0, n = value.gradientCount; i < n; i++) this._maxStartLifetime = Math.max(this._maxStartLifetime, value.getValueByIndex(i));
                    }
                    this._startLifeTimeGradient = value;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "startLifetimeConstantMax", {
                get: function() {
                    return this._startLifetimeConstantMax;
                },
                set: function(value) {
                    2 === this._startLifetimeType && (this._maxStartLifetime = Math.max(this._startLifetimeConstantMin, value)), 
                    this._startLifetimeConstantMax = value;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "startLifeTimeGradientMin", {
                get: function() {
                    return this._startLifeTimeGradientMin;
                },
                set: function(value) {
                    if (3 === this._startLifetimeType) {
                        var i = 0, n = 0;
                        for (this._maxStartLifetime = -Number.MAX_VALUE, i = 0, n = value.gradientCount; i < n; i++) this._maxStartLifetime = Math.max(this._maxStartLifetime, value.getValueByIndex(i));
                        for (i = 0, n = this._startLifeTimeGradientMax.gradientCount; i < n; i++) this._maxStartLifetime = Math.max(this._maxStartLifetime, this._startLifeTimeGradientMax.getValueByIndex(i));
                    }
                    this._startLifeTimeGradientMin = value;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "startLifeTimeGradientMax", {
                get: function() {
                    return this._startLifeTimeGradientMax;
                },
                set: function(value) {
                    if (3 === this._startLifetimeType) {
                        var i = 0, n = 0;
                        for (this._maxStartLifetime = -Number.MAX_VALUE, i = 0, n = this._startLifeTimeGradientMin.gradientCount; i < n; i++) this._maxStartLifetime = Math.max(this._maxStartLifetime, this._startLifeTimeGradientMin.getValueByIndex(i));
                        for (i = 0, n = value.gradientCount; i < n; i++) this._maxStartLifetime = Math.max(this._maxStartLifetime, value.getValueByIndex(i));
                    }
                    this._startLifeTimeGradientMax = value;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "velocityOverLifetime", {
                get: function() {
                    return this._velocityOverLifetime;
                },
                set: function(value) {
                    var render = this._ownerRender;
                    if (value) {
                        var velocity = value.velocity, velocityType = velocity.type;
                        if (value.enbale) switch (velocityType) {
                          case 0:
                            render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMECONSTANT);
                            break;

                          case 1:
                            render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMECURVE);
                            break;

                          case 2:
                            render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMERANDOMCONSTANT);
                            break;

                          case 3:
                            render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMERANDOMCURVE);
                        } else render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMECONSTANT), 
                        render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMECURVE), 
                        render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMERANDOMCONSTANT), 
                        render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMERANDOMCURVE);
                        switch (velocityType) {
                          case 0:
                            render._setShaderValueColor(13, velocity.constant);
                            break;

                          case 1:
                            render._setShaderValueBuffer(14, velocity.gradientX._elements), render._setShaderValueBuffer(15, velocity.gradientY._elements), 
                            render._setShaderValueBuffer(16, velocity.gradientZ._elements);
                            break;

                          case 2:
                            render._setShaderValueColor(13, velocity.constantMin), render._setShaderValueColor(17, velocity.constantMax);
                            break;

                          case 3:
                            render._setShaderValueBuffer(14, velocity.gradientXMin._elements), render._setShaderValueBuffer(18, velocity.gradientXMax._elements), 
                            render._setShaderValueBuffer(15, velocity.gradientYMin._elements), render._setShaderValueBuffer(19, velocity.gradientYMax._elements), 
                            render._setShaderValueBuffer(16, velocity.gradientZMin._elements), render._setShaderValueBuffer(20, velocity.gradientZMax._elements);
                        }
                        render._setShaderValueInt(21, value.space);
                    } else render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMECONSTANT), 
                    render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMECURVE), 
                    render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMERANDOMCONSTANT), 
                    render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMERANDOMCURVE), 
                    render._setShaderValueColor(13, null), render._setShaderValueBuffer(14, null), render._setShaderValueBuffer(15, null), 
                    render._setShaderValueBuffer(16, null), render._setShaderValueColor(13, null), render._setShaderValueColor(17, null), 
                    render._setShaderValueBuffer(14, null), render._setShaderValueBuffer(18, null), 
                    render._setShaderValueBuffer(15, null), render._setShaderValueBuffer(19, null), 
                    render._setShaderValueBuffer(16, null), render._setShaderValueBuffer(20, null), 
                    render._setShaderValueInt(21, void 0);
                    this._velocityOverLifetime = value;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "colorOverLifetime", {
                get: function() {
                    return this._colorOverLifetime;
                },
                set: function(value) {
                    var render = this._ownerRender;
                    if (value) {
                        var color = value.color;
                        if (value.enbale) switch (color.type) {
                          case 1:
                            render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_COLOROVERLIFETIME);
                            break;

                          case 3:
                            render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_RANDOMCOLOROVERLIFETIME);
                        } else render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_COLOROVERLIFETIME), 
                        render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_RANDOMCOLOROVERLIFETIME);
                        switch (color.type) {
                          case 1:
                            var gradientColor = color.gradient;
                            render._setShaderValueBuffer(22, gradientColor._alphaElements), render._setShaderValueBuffer(23, gradientColor._rgbElements);
                            break;

                          case 3:
                            var minGradientColor = color.gradientMin, maxGradientColor = color.gradientMax;
                            render._setShaderValueBuffer(22, minGradientColor._alphaElements), render._setShaderValueBuffer(23, minGradientColor._rgbElements), 
                            render._setShaderValueBuffer(24, maxGradientColor._alphaElements), render._setShaderValueBuffer(25, maxGradientColor._rgbElements);
                        }
                    } else render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_COLOROVERLIFETIME), 
                    render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_RANDOMCOLOROVERLIFETIME), 
                    render._setShaderValueBuffer(22, null), render._setShaderValueBuffer(23, null), 
                    render._setShaderValueBuffer(24, null), render._setShaderValueBuffer(25, null);
                    this._colorOverLifetime = value;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "sizeOverLifetime", {
                get: function() {
                    return this._sizeOverLifetime;
                },
                set: function(value) {
                    var render = this._ownerRender;
                    if (value) {
                        var size = value.size, sizeSeparate = size.separateAxes, sizeType = size.type;
                        if (value.enbale) switch (sizeType) {
                          case 0:
                            sizeSeparate ? render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMECURVESEPERATE) : render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMECURVE);
                            break;

                          case 2:
                            sizeSeparate ? render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMERANDOMCURVESSEPERATE) : render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMERANDOMCURVES);
                        } else render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMECURVE), 
                        render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMECURVESEPERATE), 
                        render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMERANDOMCURVES), 
                        render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMERANDOMCURVESSEPERATE);
                        switch (sizeType) {
                          case 0:
                            sizeSeparate ? (render._setShaderValueBuffer(27, size.gradientX._elements), render._setShaderValueBuffer(28, size.gradientY._elements), 
                            render._setShaderValueBuffer(29, size.gradientZ._elements)) : render._setShaderValueBuffer(26, size.gradient._elements);
                            break;

                          case 2:
                            sizeSeparate ? (render._setShaderValueBuffer(27, size.gradientXMin._elements), render._setShaderValueBuffer(31, size.gradientXMax._elements), 
                            render._setShaderValueBuffer(28, size.gradientYMin._elements), render._setShaderValueBuffer(32, size.gradientYMax._elements), 
                            render._setShaderValueBuffer(29, size.gradientZMin._elements), render._setShaderValueBuffer(33, size.gradientZMax._elements)) : (render._setShaderValueBuffer(26, size.gradientMin._elements), 
                            render._setShaderValueBuffer(30, size.gradientMax._elements));
                        }
                    } else render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMECURVE), 
                    render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMECURVESEPERATE), 
                    render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMERANDOMCURVES), 
                    render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMERANDOMCURVESSEPERATE), 
                    render._setShaderValueBuffer(27, null), render._setShaderValueBuffer(31, null), 
                    render._setShaderValueBuffer(28, null), render._setShaderValueBuffer(32, null), 
                    render._setShaderValueBuffer(29, null), render._setShaderValueBuffer(33, null), 
                    render._setShaderValueBuffer(26, null), render._setShaderValueBuffer(30, null);
                    this._sizeOverLifetime = value;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "textureSheetAnimation", {
                get: function() {
                    return this._textureSheetAnimation;
                },
                set: function(value) {
                    var render = this._ownerRender;
                    if (value) {
                        var frameOverTime = value.frame, textureAniType = frameOverTime.type;
                        if (value.enable) switch (textureAniType) {
                          case 1:
                            render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_TEXTURESHEETANIMATIONCURVE);
                            break;

                          case 3:
                            render._addShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_TEXTURESHEETANIMATIONRANDOMCURVE);
                        } else render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_TEXTURESHEETANIMATIONCURVE), 
                        render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_TEXTURESHEETANIMATIONRANDOMCURVE);
                        if (1 === textureAniType || 3 === textureAniType) {
                            render._setShaderValueInt(48, value.cycles);
                            var title = value.tiles, _uvLengthE = this._uvLength.elements;
                            _uvLengthE[0] = 1 / title.x, _uvLengthE[1] = 1 / title.y, render._setShaderValueVector2(49, this._uvLength);
                        }
                        switch (textureAniType) {
                          case 1:
                            render._setShaderValueBuffer(50, frameOverTime.frameOverTimeData._elements);
                            break;

                          case 3:
                            render._setShaderValueBuffer(50, frameOverTime.frameOverTimeDataMin._elements), 
                            render._setShaderValueBuffer(51, frameOverTime.frameOverTimeDataMax._elements);
                        }
                    } else render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_TEXTURESHEETANIMATIONCURVE), 
                    render._removeShaderDefine(snowflake.SnowflakeParticle3D.SHADERDEFINE_TEXTURESHEETANIMATIONRANDOMCURVE), 
                    render._setShaderValueInt(48, void 0), render._setShaderValueVector2(49, null), 
                    render._setShaderValueBuffer(50, null), render._setShaderValueBuffer(51, null);
                    this._textureSheetAnimation = value;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "_vertexBufferCount", {
                get: function() {
                    return 1;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "triangleCount", {
                get: function() {
                    return this._indexBuffer ? this._indexBuffer.indexCount / 3 : 0;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "_originalBoundingBox", {
                get: function() {
                    return this._boundingBox;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(SnowflakeParticleSystem.prototype, "_originalBoundingBoxCorners", {
                get: function() {
                    return this._boundingBoxCorners;
                },
                enumerable: !0,
                configurable: !0
            }), SnowflakeParticleSystem.halfKSqrtOf2 = .71, SnowflakeParticleSystem._RANDOMOFFSET = new Uint32Array([ 592910910, 3276756734, 322376503, 306581307, 1793934638, 3737431713, 2527743459, 2368504881, 4085612399, 3774601268, 326370691, 1494990940, 1089181156, 3159510623, 2941263940, 2786374529, 271901988, 4233252447 ]), 
            SnowflakeParticleSystem._maxElapsedTime = 1 / 3, SnowflakeParticleSystem._tempVector30 = new Vector3(), 
            SnowflakeParticleSystem._tempVector31 = new Vector3(), SnowflakeParticleSystem._tempVector32 = new Vector3(), 
            SnowflakeParticleSystem._tempVector33 = new Vector3(), SnowflakeParticleSystem._tempVector34 = new Vector3(), 
            SnowflakeParticleSystem._tempVector35 = new Vector3(), SnowflakeParticleSystem._tempVector36 = new Vector3(), 
            SnowflakeParticleSystem._tempVector37 = new Vector3(), SnowflakeParticleSystem._tempVector38 = new Vector3(), 
            SnowflakeParticleSystem._tempVector39 = new Vector3(), SnowflakeParticleSystem._tempPosition = new Vector3(), 
            SnowflakeParticleSystem._tempDirection = new Vector3(), SnowflakeParticleSystem;
        }(Laya.GeometryFilter);
        snowflake.SnowflakeParticleSystem = SnowflakeParticleSystem;
    })((particle_1 = base.particle || (base.particle = {})).snowflake || (particle_1.snowflake = {}));
}(base || (base = {})), function(base) {
    !function(particle) {
        !function(snowflake) {
            var GradientDataNumber = Laya.GradientDataNumber, GradientDataColor = Laya.GradientDataColor, Vector3 = Laya.Vector3, GradientDataInt = Laya.GradientDataInt, MathUtil = Laya.MathUtil, SnowflakeParticleUtils = function() {
                function SnowflakeParticleUtils() {}
                return SnowflakeParticleUtils.init = function() {
                    if (!this._isInit) {
                        this._isInit = !0, Laya.AnimationNode.registerAnimationNodeProperty("particleRender.sharedMaterial.tilingOffset", SnowflakeParticleUtils._getParticleRenderSharedMaterialTilingOffset, SnowflakeParticleUtils._setParticleRenderSharedMaterialTilingOffset);
                        var shaderCompile = Laya.ShaderCompile3D.get("custom_particle_shader");
                        snowflake.SnowflakeParticleMaterial.SHADERDEFINE_DIFFUSEMAP = shaderCompile.registerMaterialDefine("DIFFUSEMAP"), 
                        snowflake.SnowflakeParticleMaterial.SHADERDEFINE_TINTCOLOR = shaderCompile.registerMaterialDefine("TINTCOLOR"), 
                        snowflake.SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEFOG = shaderCompile.registerMaterialDefine("ADDTIVEFOG"), 
                        snowflake.SnowflakeParticleMaterial.SHADERDEFINE_TILINGOFFSET = shaderCompile.registerMaterialDefine("TILINGOFFSET"), 
                        snowflake.SnowflakeParticleMaterial.SHADERDEFINE_ADDTIVEMASK = shaderCompile.registerMaterialDefine("ADDTIVEMASK"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_BILLBOARD = shaderCompile.registerSpriteDefine("SPHERHBILLBOARD"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_STRETCHEDBILLBOARD = shaderCompile.registerSpriteDefine("STRETCHEDBILLBOARD"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_HORIZONTALBILLBOARD = shaderCompile.registerSpriteDefine("HORIZONTALBILLBOARD"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_VERTICALBILLBOARD = shaderCompile.registerSpriteDefine("VERTICALBILLBOARD"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_COLOROVERLIFETIME = shaderCompile.registerSpriteDefine("COLOROVERLIFETIME"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_RANDOMCOLOROVERLIFETIME = shaderCompile.registerSpriteDefine("RANDOMCOLOROVERLIFETIME"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMECONSTANT = shaderCompile.registerSpriteDefine("VELOCITYOVERLIFETIMECONSTANT"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMECURVE = shaderCompile.registerSpriteDefine("VELOCITYOVERLIFETIMECURVE"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMERANDOMCONSTANT = shaderCompile.registerSpriteDefine("VELOCITYOVERLIFETIMERANDOMCONSTANT"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_VELOCITYOVERLIFETIMERANDOMCURVE = shaderCompile.registerSpriteDefine("VELOCITYOVERLIFETIMERANDOMCURVE"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_TEXTURESHEETANIMATIONCURVE = shaderCompile.registerSpriteDefine("TEXTURESHEETANIMATIONCURVE"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_TEXTURESHEETANIMATIONRANDOMCURVE = shaderCompile.registerSpriteDefine("TEXTURESHEETANIMATIONRANDOMCURVE"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIME = shaderCompile.registerSpriteDefine("ROTATIONOVERLIFETIME"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMESEPERATE = shaderCompile.registerSpriteDefine("ROTATIONOVERLIFETIMESEPERATE"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMECONSTANT = shaderCompile.registerSpriteDefine("ROTATIONOVERLIFETIMECONSTANT"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMECURVE = shaderCompile.registerSpriteDefine("ROTATIONOVERLIFETIMECURVE"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMERANDOMCONSTANTS = shaderCompile.registerSpriteDefine("ROTATIONOVERLIFETIMERANDOMCONSTANTS"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_ROTATIONOVERLIFETIMERANDOMCURVES = shaderCompile.registerSpriteDefine("ROTATIONOVERLIFETIMERANDOMCURVES"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMECURVE = shaderCompile.registerSpriteDefine("SIZEOVERLIFETIMECURVE"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMECURVESEPERATE = shaderCompile.registerSpriteDefine("SIZEOVERLIFETIMECURVESEPERATE"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMERANDOMCURVES = shaderCompile.registerSpriteDefine("SIZEOVERLIFETIMERANDOMCURVES"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_SIZEOVERLIFETIMERANDOMCURVESSEPERATE = shaderCompile.registerSpriteDefine("SIZEOVERLIFETIMERANDOMCURVESSEPERATE"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_RENDERMODE_MESH = shaderCompile.registerSpriteDefine("RENDERMODE_MESH"), 
                        snowflake.SnowflakeParticle3D.SHADERDEFINE_SHAPE = shaderCompile.registerSpriteDefine("SHAPE");
                    }
                }, SnowflakeParticleUtils.precompileShaderWithCreate = function() {
                    var shaderCompile = Laya.ShaderCompile3D.get("custom_particle_shader");
                    shaderCompile.precompileShaderWithShaderDefine(1, 69214344, 14), shaderCompile.precompileShaderWithShaderDefine(1, 69206152, 14), 
                    shaderCompile.precompileShaderWithShaderDefine(1, 2097288, 14), shaderCompile.precompileShaderWithShaderDefine(193, 36208768, 14), 
                    shaderCompile.precompileShaderWithShaderDefine(1, 136, 14), shaderCompile.precompileShaderWithShaderDefine(193, 33554560, 14), 
                    shaderCompile.precompileShaderWithShaderDefine(193, 33554432, 46), shaderCompile.precompileShaderWithShaderDefine(1, 75501704, 14), 
                    shaderCompile.precompileShaderWithShaderDefine(193, 35815552, 6), shaderCompile.precompileShaderWithShaderDefine(1, 69206160, 14), 
                    shaderCompile.precompileShaderWithShaderDefine(193, 35651712, 14), shaderCompile.precompileShaderWithShaderDefine(193, 35651712, 6), 
                    shaderCompile.precompileShaderWithShaderDefine(193, 35815552, 14), shaderCompile.precompileShaderWithShaderDefine(193, 33718400, 14), 
                    shaderCompile.precompileShaderWithShaderDefine(1, 67285128, 14), shaderCompile.precompileShaderWithShaderDefine(1, 67276936, 14), 
                    shaderCompile.precompileShaderWithShaderDefine(193, 35815552, 30), shaderCompile.precompileShaderWithShaderDefine(193, 33554432, 14), 
                    shaderCompile.precompileShaderWithShaderDefine(1, 69210256, 14), shaderCompile.precompileShaderWithShaderDefine(1, 69218448, 6), 
                    shaderCompile.precompileShaderWithShaderDefine(1, 69214344, 6), shaderCompile.precompileShaderWithShaderDefine(1, 69771400, 14), 
                    shaderCompile.precompileShaderWithShaderDefine(193, 33718400, 6), shaderCompile.precompileShaderWithShaderDefine(193, 35815552, 22);
                }, SnowflakeParticleUtils.precompileShaderWithGame = function() {}, SnowflakeParticleUtils._initStartLife = function(gradientData) {
                    for (var gradient = new GradientDataNumber(), startLifetimesData = gradientData.startLifetimes, i = 0, n = startLifetimesData.length; i < n; i++) {
                        var valueData = startLifetimesData[i];
                        gradient.add(valueData.key, valueData.value);
                    }
                    return gradient;
                }, SnowflakeParticleUtils._initParticleVelocity = function(gradientData) {
                    for (var gradient = new GradientDataNumber(), velocitysData = gradientData.velocitys, i = 0, n = velocitysData.length; i < n; i++) {
                        var valueData = velocitysData[i];
                        gradient.add(valueData.key, valueData.value);
                    }
                    return gradient;
                }, SnowflakeParticleUtils._initParticleColor = function(gradientColorData) {
                    var gradientColor = new GradientDataColor(), alphasData = gradientColorData.alphas, i = 0, n = 0;
                    for (i = 0, n = alphasData.length; i < n; i++) {
                        var alphaData = alphasData[i];
                        gradientColor.addAlpha(alphaData.key, alphaData.value);
                    }
                    var rgbsData = gradientColorData.rgbs;
                    for (i = 0, n = rgbsData.length; i < n; i++) {
                        var rgbData = rgbsData[i], rgbValue = rgbData.value;
                        gradientColor.addRGB(rgbData.key, new Vector3(rgbValue[0], rgbValue[1], rgbValue[2]));
                    }
                    return gradientColor;
                }, SnowflakeParticleUtils._initParticleSize = function(gradientSizeData) {
                    for (var gradientSize = new GradientDataNumber(), sizesData = gradientSizeData.sizes, i = 0, n = sizesData.length; i < n; i++) {
                        var valueData = sizesData[i];
                        gradientSize.add(valueData.key, valueData.value);
                    }
                    return gradientSize;
                }, SnowflakeParticleUtils._initParticleRotation = function(gradientData) {
                    for (var gradient = new GradientDataNumber(), angularVelocitysData = gradientData.angularVelocitys, i = 0, n = angularVelocitysData.length; i < n; i++) {
                        var valueData = angularVelocitysData[i];
                        gradient.add(valueData.key, valueData.value / 180 * Math.PI);
                    }
                    return gradient;
                }, SnowflakeParticleUtils._initParticleFrame = function(overTimeFramesData) {
                    for (var overTimeFrame = new GradientDataInt(), framesData = overTimeFramesData.frames, i = 0, n = framesData.length; i < n; i++) {
                        var frameData = framesData[i];
                        overTimeFrame.add(frameData.key, frameData.value);
                    }
                    return overTimeFrame;
                }, SnowflakeParticleUtils._getStartLifetimeFromGradient = function(startLifeTimeGradient, emissionTime) {
                    for (var i = 1, n = startLifeTimeGradient.gradientCount; i < n; i++) {
                        var key = startLifeTimeGradient.getKeyByIndex(i);
                        if (emissionTime <= key) {
                            var lastKey = startLifeTimeGradient.getKeyByIndex(i - 1), age = (emissionTime - lastKey) / (key - lastKey);
                            return MathUtil.lerp(startLifeTimeGradient.getValueByIndex(i - 1), startLifeTimeGradient.getValueByIndex(i), age);
                        }
                    }
                    throw new Error("SnowflakeParticleData: can't get value foam startLifeTimeGradient.");
                }, SnowflakeParticleUtils._randomInvertRoationArray = function(rotatonE, outE, randomizeRotationDirection, rand, randomSeeds) {
                    var randDic = NaN;
                    rand ? (rand.seed = randomSeeds[6], randDic = rand.getFloat(), randomSeeds[6] = rand.seed) : randDic = Math.random(), 
                    randDic < randomizeRotationDirection ? (outE[0] = -rotatonE[0], outE[1] = -rotatonE[1], 
                    outE[2] = -rotatonE[2]) : (outE[0] = rotatonE[0], outE[1] = rotatonE[1], outE[2] = rotatonE[2]);
                }, SnowflakeParticleUtils._randomInvertRoation = function(rotaton, randomizeRotationDirection, rand, randomSeeds) {
                    var randDic = NaN;
                    return rand ? (rand.seed = randomSeeds[6], randDic = rand.getFloat(), randomSeeds[6] = rand.seed) : randDic = Math.random(), 
                    randDic < randomizeRotationDirection && (rotaton = -rotaton), rotaton;
                }, SnowflakeParticleUtils._getParticleRenderSharedMaterialTilingOffset = function(animationNode, sprite3D) {
                    var material;
                    if (animationNode) {
                        var entity = animationNode.transform._entity;
                        return entity ? (material = entity.owner.particleRender.sharedMaterial).tilingOffset.elements : null;
                    }
                    return (material = sprite3D.particleRender.sharedMaterial).tilingOffset || (material.tilingOffset = new Laya.Vector4()), 
                    material.tilingOffset.elements;
                }, SnowflakeParticleUtils._setParticleRenderSharedMaterialTilingOffset = function(animationNode, sprite3D, value) {
                    var material, tilingOffset;
                    if (animationNode) {
                        var entity = animationNode.transform._entity;
                        entity && ((tilingOffset = (material = entity.owner.particleRender.material).tilingOffset).elements = value, 
                        material.tilingOffset = tilingOffset);
                    } else (tilingOffset = (material = sprite3D.particleRender.material).tilingOffset) || (tilingOffset = new Laya.Vector4()), 
                    tilingOffset.elements = value, material.tilingOffset = tilingOffset;
                }, SnowflakeParticleUtils._isInit = !1, SnowflakeParticleUtils;
            }();
            snowflake.SnowflakeParticleUtils = SnowflakeParticleUtils;
        }(particle.snowflake || (particle.snowflake = {}));
    }(base.particle || (base.particle = {}));
}(base || (base = {})), function(base) {
    !function(textures) {
        var Byte = Laya.Byte, Resource = Laya.Resource, ResourcePool = base.assets.ResourcePool, DDSPixelFormat = function() {}, DDSCaps2 = function() {
            this.reserved = 8;
        }, DDSFileHeader = function() {
            this.reserved1 = 44, this.reserved2 = 4;
        };
        function color_scale(color, s) {
            return 16777216 * ((color >>> 24 & 255) * s & 255) + 65536 * ((color >>> 16 & 255) * s & 255) + 256 * ((color >>> 8 & 255) * s & 255) + ((255 & color) * s & 255);
        }
        function color_add(c1, c2) {
            var a = c1 >>> 24 & 255, r = c1 >>> 16 & 255, g = c1 >>> 8 & 255, b = 255 & c1;
            return 255 < (a += c2 >>> 24 & 255) && (a = 255), 255 < (r += c2 >>> 16 & 255) && (r = 255), 
            255 < (g += c2 >>> 8 & 255) && (g = 255), 255 < (b += 255 & c2) && (b = 255), 16777216 * a + 65536 * r + 256 * g + b;
        }
        function getDXTFormat(fourcc) {
            if (5527620 != (16777215 & fourcc)) return 6;
            var type = (fourcc >> 24) - "0".charCodeAt(0);
            return 1 <= type && type <= 5 ? type : 6;
        }
        function BLOCKNUM(value) {
            return value + 3 >> 2;
        }
        var DDSParser = function() {
            function DDSParser() {
                this._mipCount = 1, this._blockSize = 0, this._status = 0, this._currentMip = -1, 
                this._mipWidth = 0, this._mipHeight = 0, this._blockWidth = 0, this._blockHeight = 0, 
                this._blockX = 0, this._blockY = 0, this._format = 0, this._dataPointer = 0, this._resultPointer = 0, 
                this._tempColor = new Uint32Array(4), this._header = new DDSFileHeader();
            }
            return Object.defineProperty(DDSParser.prototype, "result", {
                get: function() {
                    return this._result;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(DDSParser.prototype, "hander", {
                get: function() {
                    return this._header;
                },
                enumerable: !0,
                configurable: !0
            }), DDSParser.prototype.reset = function(buffer) {
                if (this._bytes = new Byte(buffer), this._bytes.endian = Byte.LITTLE_ENDIAN, this._header.magic = this._bytes.getUint32(), 
                this._header.size = this._bytes.getUint32(), this._header.flags = this._bytes.getUint32(), 
                this._header.height = this._bytes.getUint32(), this._header.width = this._bytes.getUint32(), 
                this._header.pitchOrLinearSize = this._bytes.getUint32(), this._header.depth = this._bytes.getUint32(), 
                this._header.mipMapCount = this._bytes.getUint32(), this._header.ddpfPixelFormat = new DDSPixelFormat(), 
                this._bytes.pos += this._header.reserved1, this._header.ddpfPixelFormat.size = this._bytes.getUint32(), 
                this._header.ddpfPixelFormat.flags = this._bytes.getUint32(), this._header.ddpfPixelFormat.fourCC = this._bytes.getUint32(), 
                this._header.ddpfPixelFormat.rgbBitCount = this._bytes.getUint32(), this._header.ddpfPixelFormat.rBitMask = this._bytes.getUint32(), 
                this._header.ddpfPixelFormat.gBitMask = this._bytes.getUint32(), this._header.ddpfPixelFormat.bBitMask = this._bytes.getUint32(), 
                this._header.ddpfPixelFormat.rgbaBitMask = this._bytes.getUint32(), this._header.ddsCaps = new DDSCaps2(), 
                this._header.ddsCaps.caps1 = this._bytes.getUint32(), this._header.ddsCaps.caps2 = this._bytes.getUint32(), 
                this._bytes.pos += this._header.ddsCaps.reserved, this._bytes.pos += this._header.reserved2, 
                542327876 != this._header.magic) throw new Error("");
                if (!function(header) {
                    if (!(1 & header.flags && 2 & header.flags && 4 & header.flags && 4096 & header.flags && 524288 & header.flags)) return !1;
                    if (!(4 & header.ddpfPixelFormat.flags)) return !1;
                    var fmt = getDXTFormat(header.ddpfPixelFormat.fourCC);
                    return (1 == fmt || 3 == fmt || 5 == fmt) && !(512 & header.ddsCaps.caps2 || 2097152 & header.ddsCaps.caps2);
                }(this._header)) throw Error("");
                this._mipCount = 1;
                for (var width = this._header.width, height = this._header.height, totalSize = 0, i = 0; i < this._mipCount; i++) totalSize += width * height * 4, 
                width = Math.max(1, width >> 1), height = Math.max(1, height >> 1);
                this._result = new Byte(new ArrayBuffer(totalSize)), this._result.endian = Byte.BIG_ENDIAN, 
                this._format = getDXTFormat(this._header.ddpfPixelFormat.fourCC), this._blockSize = function(fmt) {
                    return 1 == fmt ? 8 : 16;
                }(this._format), this._colorBuffer = new Uint32Array(16), this._alphaBuffer = new Uint32Array(16), 
                this._currentMip = 0, this._mipWidth = Math.max(1, this._header.width), this._mipHeight = Math.max(1, this._header.height), 
                this._dataPointer = this._bytes.pos, this._resultPointer = this._result.pos, this._blockWidth = Math.max(1, BLOCKNUM(this._mipWidth)), 
                this._blockHeight = Math.max(1, BLOCKNUM(this._mipHeight)), this._blockY = 0, this._blockX = 0, 
                this._status = 2;
            }, DDSParser.prototype.decodeAlphaDXT3 = function(pblk) {
                for (var position = pblk.pos, i = 0, row = 0; row < 4; ++row) {
                    pblk.pos = position + 2 * row;
                    for (var d = pblk.getUint16(), col = 0; col < 4; ++col) {
                        var alpha = 17 * (15 & d);
                        this._alphaBuffer[i++] = alpha, d >>= 4;
                    }
                }
                pblk.pos = position + 8;
            }, DDSParser.prototype.decodeAlphaDXT5 = function(pblk) {
                var alphas = new Uint32Array(8);
                alphas[0] = pblk.getUint8(), alphas[1] = pblk.getUint8(), alphas[0] > alphas[1] ? (alphas[2] = (6 * alphas[0] + 1 * alphas[1] + 3) / 7, 
                alphas[3] = (5 * alphas[0] + 2 * alphas[1] + 3) / 7, alphas[4] = (4 * alphas[0] + 3 * alphas[1] + 3) / 7, 
                alphas[5] = (3 * alphas[0] + 4 * alphas[1] + 3) / 7, alphas[6] = (2 * alphas[0] + 5 * alphas[1] + 3) / 7, 
                alphas[7] = (1 * alphas[0] + 6 * alphas[1] + 3) / 7) : (alphas[2] = (4 * alphas[0] + 1 * alphas[1] + 2) / 5, 
                alphas[3] = (3 * alphas[0] + 2 * alphas[1] + 2) / 5, alphas[4] = (2 * alphas[0] + 3 * alphas[1] + 2) / 5, 
                alphas[5] = (1 * alphas[0] + 4 * alphas[1] + 2) / 5, alphas[6] = 0, alphas[7] = 255);
                for (var position = pblk.pos, i = 0; i < 16; i++) {
                    var row = i >> 2;
                    pblk.pos = position + 3 * (row >> 1);
                    var off = i % 8 * 3, idx = (pblk.getInt32() & 7 << off) >> off;
                    this._alphaBuffer[i] = alphas[idx];
                }
                pblk.pos = position + 6;
            }, DDSParser.prototype.decodeOneBlock = function(pblk, size, fmt) {
                for (var i = 0; i < this._alphaBuffer.length; ++i) this._alphaBuffer[i] = 255;
                2 == fmt || 3 == fmt ? this.decodeAlphaDXT3(pblk) : 4 != fmt && 5 != fmt || this.decodeAlphaDXT5(pblk);
                var colors = this._tempColor, f3colorMode = !1, _color0 = pblk.getInt16(), _color1 = pblk.getInt16();
                _color1 <= _color0 || 1 != fmt ? (colors[0] = 4278190080 | (63488 & _color0) << 8 | (2016 & _color0) << 5 | (31 & _color0) << 3, 
                colors[1] = 4278190080 | (63488 & _color1) << 8 | (2016 & _color1) << 5 | (31 & _color1) << 3, 
                colors[2] = color_add(color_scale(colors[0], 2 / 3), color_scale(colors[1], 1 / 3)), 
                colors[3] = color_add(color_scale(colors[0], 1 / 3), color_scale(colors[1], 2 / 3))) : (colors[0] = 4278190080 | (63488 & _color0) << 8 | (1984 & _color0) << 5 | (63 & _color0) << 3, 
                colors[1] = 4278190080 | (63488 & _color1) << 8 | (1984 & _color1) << 5 | (63 & _color1) << 3, 
                colors[2] = color_add(color_scale(colors[0], .5), color_scale(colors[1], .5)), f3colorMode = !(colors[3] = 0));
                var row, off, idx, position = pblk.pos;
                if (f3colorMode) for (i = 0; i < 16; i++) row = i >> 2, off = i % 4 << 1, idx = (pblk._getUInt8(position + row) & 3 << off) >> off, 
                this._colorBuffer[i] = 3 == idx ? 0 : (16777215 & colors[idx]) << 8 | this._alphaBuffer[i]; else for (i = 0; i < 16; i++) row = i >> 2, 
                off = i % 4 << 1, idx = (pblk._getUInt8(position + row) & 3 << off) >> off, this._colorBuffer[i] = (16777215 & colors[idx]) << 8 | this._alphaBuffer[i];
                return !0;
            }, DDSParser.prototype.parseCurrent = function() {
                if (this._blockX >= this._blockWidth && (this._blockX = 0, ++this._blockY, this._blockY >= this._blockHeight)) this._status = 1; else {
                    this._bytes.pos = this._dataPointer + (this._blockY * this._blockWidth + this._blockX) * this._blockSize, 
                    this.decodeOneBlock(this._bytes, this._blockSize, this._format);
                    var x, y, j, k, offsetX = this._blockX << 2, offsetY = this._blockY << 2, limitY = 4 + offsetY;
                    limitY > this._mipHeight && (limitY = this._mipHeight);
                    var limitX = 4 + offsetX;
                    limitX > this._mipWidth && (limitX = this._mipWidth);
                    var pos = this._resultPointer + this._mipWidth * offsetY;
                    for (y = offsetY, j = 0; y < limitY; ++y, j += 4, pos += this._mipWidth) for (this._result.pos = pos + offsetX << 2, 
                    x = offsetX, k = j; x < limitX; ++x, ++k) this._result.writeUint32(this._colorBuffer[k]);
                    ++this._blockX;
                }
            }, DDSParser.prototype.parseNextMIP = function() {
                ++this._currentMip < this._mipCount ? (this._bytes.pos = this._dataPointer + Math.max(1, BLOCKNUM(this._mipWidth)) * Math.max(1, BLOCKNUM(this._mipHeight)) * this._blockSize, 
                this._result.pos = this._resultPointer + this._mipWidth * this._mipHeight * 4, this._mipWidth = Math.max(1, this._header.width >> this._currentMip), 
                this._mipHeight = Math.max(1, this._header.height >> this._currentMip), this._dataPointer = this._bytes.pos, 
                this._resultPointer = this._result.pos, this._blockWidth = Math.max(1, BLOCKNUM(this._mipWidth)), 
                this._blockHeight = Math.max(1, BLOCKNUM(this._mipHeight)), this._blockY = 0, this._blockX = 0, 
                this._status = 2) : this._status = 3;
            }, DDSParser.prototype.proceedParsing = function() {
                for (;3 != this._status; ) 2 == this._status ? this.parseCurrent() : 1 == this._status && this.parseNextMIP();
                this._bytes.clear();
            }, DDSParser;
        }(), DDSTexture2D = function(_super) {
            function DDSTexture2D() {
                var _this = _super.call(this) || this;
                return _this.onResourceComplete = function(url, handle, buffer) {
                    var parser = DDSTexture2D.parser;
                    parser.reset(buffer), parser.proceedParsing();
                    var info = parser.hander;
                    _this._buffer = parser.result.buffer, _this._width = info.width, _this._height = info.height, 
                    _this._mipmap = !1, _this._magFifter = Laya.WebGLContext.LINEAR, _this._minFifter = Laya.WebGLContext.LINEAR, 
                    _this._size = new Laya.Size(_this._width, _this._height), _this.activeResource(), 
                    _this._endLoaded();
                }, _this._waitDestroy = !1, _this._timeout = null, _this;
            }
            return __extends(DDSTexture2D, _super), DDSTexture2D.load = function(url) {
                var cache = Resource.getResourceByURL(url);
                if (null != cache) return cache._waitDestroy = !1, cache;
                var result = new DDSTexture2D();
                return result._loaded = !1, result._setUrl(url), ResourcePool.instance.load(url, result.onResourceComplete), 
                result;
            }, DDSTexture2D.prototype.destroy = function() {
                if (!this._waitDestroy) return this._waitDestroy = !0, void (this._timeout = Date.now() + 18e4);
                this._timeout > Date.now() || _super.prototype.destroy.call(this);
            }, DDSTexture2D.parser = new DDSParser(), DDSTexture2D;
        }(Laya.DataTexture2D);
        textures.DDSTexture2D = DDSTexture2D;
    }(base.textures || (base.textures = {}));
}(base || (base = {})), function(base) {
    !function(textures) {
        var AssetEntry = base.assets.AssetEntry, AssetPoolBase = base.assets.AssetPoolBase, WebGLContext = Laya.WebGLContext, ResourcePool = base.assets.ResourcePool, BufferTexture = function(_super) {
            function BufferTexture(buffer) {
                var _this = _super.call(this) || this;
                if (buffer instanceof ArrayBuffer) {
                    var view = new DataView(buffer);
                    _this.resetResource(new Uint8Array(buffer, 8), view.getUint32(0), view.getUint32(4));
                } else _this.resetResource(buffer, buffer.width, buffer.height);
                return _this;
            }
            return __extends(BufferTexture, _super), BufferTexture.prototype.resetResource = function(buffer, w, h) {
                this._buffer = buffer, this._width = w, this._height = h, this._mipmap = !1, this._magFifter = 9728, 
                this._minFifter = 9728, this._size = new Laya.Size(this._width, this._height), this._type = 3553, 
                buffer instanceof Uint8Array ? this._format = this._buffer.byteLength / (w * h) == 4 ? 6408 : 6407 : this._format = -1 == buffer.src.indexOf(".jpg") ? 6408 : 6407, 
                this._endLoaded(), this.activeResource(), this._buffer = null;
            }, BufferTexture.prototype.recreateResource = function() {
                this._buffer && (this.createWebGlTexture(), this.completeCreate());
            }, BufferTexture.prototype.createWebGlTexture = function() {
                var w = this._width, h = this._height, isPot = Laya.Arith.isPOT(w, h), wrapModeU = 0 == this._wrapModeU && isPot ? 10497 : 33071, wrapModeV = 0 == this._wrapModeV && isPot ? 10497 : 33071;
                this.memorySize = isPot ? w * h * 4 * (1 + 1 / 3) : w * h * 4, this._source = TexturePool.createWebGlTexture(this._type, this._format, this._minFifter, this._magFifter, wrapModeU, wrapModeV, this._width, this._height, this._buffer);
            }, BufferTexture.prototype.disposeResource = function() {
                this._source && (TexturePool.cacheTexture(this._source), this._source = null, this._buffer = null, 
                this.memorySize = 0);
            }, BufferTexture;
        }(Laya.BaseTexture), TexturePool = function(_super) {
            function TexturePool() {
                var _this = _super.call(this, "TexturePool", 33554432, 3e5) || this;
                return _this.doRecover = function(entry) {
                    entry.res.destroy();
                }, _this.onResourceComplete = function(url, handle, buffer) {
                    if (null == buffer) _this.onComplete(url, null, 0); else {
                        var res = new BufferTexture(buffer);
                        _this.onComplete(url, res, res.width * res.height * 4);
                    }
                }, _this;
            }
            return __extends(TexturePool, _super), Object.defineProperty(TexturePool, "instance", {
                get: function() {
                    return TexturePool._instance;
                },
                enumerable: !0,
                configurable: !0
            }), TexturePool.prototype.load = function(url, callback, priority) {
                void 0 === priority && (priority = 0);
                var entry = this.checkNeedLoad(url, callback, !1);
                entry && 0 == entry.status && (entry.status = 1, ResourcePool.instance.load(url, this.onResourceComplete, priority));
            }, TexturePool.prototype.cancel = function(url, callback) {
                var entry = this.findNeedCancelEntry(url, callback);
                null != entry && (ResourcePool.instance.cancel(url, this.onResourceComplete), delete this._waitPool[url], 
                AssetEntry.freeEntry(entry));
            }, TexturePool.findCacheTexture = function() {
                return null;
            }, TexturePool.cacheTexture = function(res) {
                Laya.WebGL.mainContext.deleteTexture(res);
            }, TexturePool.createWebGlTexture = function(type, format, minFifter, magFifter, wrapModeU, wrapModeV, w, h, buffer) {
                var preTarget = WebGLContext.curBindTexTarget, preTexture = WebGLContext.curBindTexValue, gl = Laya.WebGL.mainContext, glTexture = this.findCacheTexture() || gl.createTexture();
                return WebGLContext.bindTexture(gl, type, glTexture), buffer instanceof Uint8Array ? gl.texImage2D(type, 0, format, w, h, 0, format, 5121, buffer) : gl.texImage2D(type, 0, format, format, 5121, buffer), 
                Laya.Arith.isPOT(w, h) || (wrapModeV = wrapModeU = 33071), -1 !== minFifter || (minFifter = 9729), 
                -1 !== magFifter || (magFifter = 9729), gl.texParameteri(type, 10241, minFifter), 
                gl.texParameteri(type, 10240, magFifter), gl.texParameteri(type, 10242, wrapModeU), 
                gl.texParameteri(type, 10243, wrapModeV), preTarget && preTexture && WebGLContext.bindTexture(gl, preTarget, preTexture), 
                glTexture;
            }, TexturePool._instance = new TexturePool(), TexturePool.cache = [], TexturePool;
        }(AssetPoolBase);
        textures.TexturePool = TexturePool;
    }(base.textures || (base.textures = {}));
}(base || (base = {})), function(net) {
    var Channel = function() {
        function Channel() {
            var _this = this;
            this.onMessage = function(event) {
                var data = event.data, stream = new DataView(data), offset = 0;
                stream.getUint16(offset, !0);
                offset += 2;
                var opcode = stream.getUint32(offset, !0);
                offset += 4;
                var handler = _this._handlers[opcode];
                if (null != handler) {
                    var tuple = null;
                    if (data.byteLength > offset) {
                        var bytes = new Uint8Array(data, offset);
                        tuple = msgpack.decode(bytes);
                    }
                    handler.call(null, tuple);
                }
            }, this._handlers = [];
        }
        return Object.defineProperty(Channel, "instance", {
            get: function() {
                return Channel._instance;
            },
            enumerable: !0,
            configurable: !0
        }), Channel.prototype.open = function(url, caller, onOpen, onClose, onError) {
            this._socket = new WebSocket(url), this._socket.binaryType = "arraybuffer", this._socket.onmessage = this.onMessage, 
            this._socket.onopen = onOpen.bind(caller), this._socket.onclose = onClose.bind(caller), 
            this._socket.onerror = onError.bind(caller);
        }, Channel.prototype.subscribe = function(opcode, caller, handler) {
            if (this._handlers[opcode]) throw new Error("同一条协议不可以侦听两次：" + opcode);
            return this._handlers[opcode] = handler.bind(caller), this;
        }, Channel.prototype.publish = function(opcode, tuple) {
            var content = null, size = 0;
            null != tuple && (size = (content = msgpack.encode(tuple)).byteLength);
            var buffer = new Uint8Array(6 + size), stream = new DataView(buffer.buffer), offset = 0;
            return stream.setUint16(offset, buffer.byteLength, !0), offset += 2, stream.setUint32(offset, opcode, !0), 
            offset += 4, null != content && buffer.set(content, offset), this._socket.send(buffer), 
            this;
        }, Channel._instance = new Channel(), Channel;
    }();
    net.Channel = Channel;
}(net || (net = {})), function(utils) {
    var MathUtils = function() {
        function MathUtils() {}
        return MathUtils.ceilPowerOfTwo = function(current) {
            return current--, current |= current >> 1, current |= current >> 2, current |= current >> 4, 
            current |= current >> 8, current |= current >> 16, ++current;
        }, MathUtils.bezier = function(p0, p1, p2, t) {
            1 < t ? t = 1 : t < 0 && (t = 0);
            var dt = 1 - t;
            return dt * dt * p0 + 2 * t * dt * p1 + t * t * p2;
        }, MathUtils.lerp = function(lower, upper, t) {
            return 1 < t ? t = 1 : t < 0 && (t = 0), lower * (1 - t) + upper * t;
        }, MathUtils;
    }();
    utils.MathUtils = MathUtils;
}(utils || (utils = {})), function(utils) {
    var TableUtils = function() {
        function TableUtils() {}
        return TableUtils.keys = function(table, array) {
            for (var key in null == array ? array = [] : array.length = 0, table) array.push(key);
            return array;
        }, TableUtils.values = function(table, array) {
            for (var key in null == array ? array = [] : array.length = 0, table) array.push(table[key]);
            return array;
        }, TableUtils.entries = function(table, array) {
            for (var key in null == array ? array = [] : array.length = 0, table) array.push([ key, table[key] ]);
            return array;
        }, TableUtils.isEmpty = function(table) {
            for (var key in table) return !1;
            return !0;
        }, TableUtils.clear = function(table) {
            for (var key in table) delete table[key];
        }, TableUtils;
    }();
    utils.TableUtils = TableUtils;
}(utils || (utils = {})), function(utils) {
    var TraceUtils = function() {
        function TraceUtils() {}
        return TraceUtils.reset = function() {
            for (var args = [], _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
            TraceUtils._resetTime = TraceUtils._lastUpdateTime = Date.now(), TraceUtils._order = 0, 
            console.log.apply(console, __spreadArrays([ TraceUtils._order++ + ":" + TraceUtils._resetTime ], args));
        }, TraceUtils.trace = function() {
            for (var args = [], _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
            var now = Date.now(), delta = now - TraceUtils._lastUpdateTime;
            TraceUtils._lastUpdateTime = now, console.log.apply(console, __spreadArrays([ TraceUtils._order++ + ":" + delta + ":" + (now - TraceUtils._resetTime) ], args));
        }, TraceUtils._resetTime = 0, TraceUtils._lastUpdateTime = 0, TraceUtils._order = 0, 
        TraceUtils;
    }();
    utils.TraceUtils = TraceUtils;
}(utils || (utils = {})), function(utils) {
    !function(collections) {
        var Point = Laya.Point, OffsetList = [ -1, -1, 5, 0, 0, -1, 3, 1, 1, -1, 5, 2, -1, 0, 4, 3, 1, 0, 4, 5, -1, 1, 5, 6, 0, 1, 3, 7, 1, 1, 5, 8 ], AStar = function() {
            function AStar() {
                this._open = [], this._closeID = 0, this._openID = 0;
            }
            return AStar.prototype.reset = function(mapData, width, height, cellWidth, cellHeight, bridgeInfo) {
                this._limitX = width / cellWidth, this._limitY = height / cellHeight;
                var index, x, y, limit = this._limitY * this._limitX;
                this._map = new Uint32Array(6 * limit), this._data = mapData, this._closeID = 0;
                this._openID = 0;
                var mapElements = this._map;
                for (y = 0; y < this._limitY; ++y) for (index = this._limitX * y * 6, x = 0; x < this._limitX; ++x) mapElements[index + 0] = 65536 * x + y, 
                mapElements[index + 5] = 0, index += 6;
            }, AStar.prototype.findReplacer = function(startX, startY, endX, endY, motion, auth) {
                var offset = this._limitX * endY + endX, index = 6 * offset, value = this._data[offset];
                if (!(motion < (112 & value) >> 4 || auth < (15 & value))) return index;
                for (var x, y, limit, cursor, minHNode = 4294967295, minH = 4294967295, rangeX = [ 0, 0 ], rangeY = [ 0, 0 ], h = 0, radius = 1; 4294967295 === minHNode; ) {
                    for (rangeX[0] = endX - radius, rangeX[1] = endX + radius, rangeY[0] = endY - radius, 
                    rangeY[1] = endY + radius, cursor = 0; cursor < 2; ++cursor) if (!((y = rangeY[cursor]) < 0 || y >= this._limitY)) for (limit = rangeX[1] < this._limitX ? rangeX[1] : this._limitX, 
                    x = 0 < rangeX[0] ? rangeX[0] : 0; x < limit; ++x) index = 6 * (offset = this._limitX * y + x), 
                    motion < (112 & (value = this._data[offset])) >> 4 || auth < (15 & value) || (h = 3 * Math.abs(startY - y) + 4 * Math.abs(startX - x)) < minH && (minH = h, 
                    minHNode = index);
                    for (rangeY[0] += 1, rangeY[1] -= 1, cursor = 0; cursor < 2; ++cursor) if (!((x = rangeX[cursor]) < 0 || x >= this._limitX)) for (limit = rangeY[1] < this._limitY ? rangeY[1] : this._limitY, 
                    y = 0 < rangeY[0] ? rangeY[0] : 0; y < limit; ++y) index = 6 * (this._limitX * y + x), 
                    motion < (112 & (value = this._data[offset])) >> 4 || auth < (15 & value) || (h = 3 * Math.abs(startY - y) + 4 * Math.abs(startX - x)) < minH && (minH = h, 
                    minHNode = index);
                    ++radius;
                }
                return minHNode;
            }, AStar.prototype.find = function(startX, startY, endX, endY, motion, auth, result) {
                void 0 === motion && (motion = 5), void 0 === auth && (auth = 0), void 0 === result && (result = null), 
                this._open.length = 0, this._closeID = this._openID + 1, this._openID = this._openID + 2;
                var counter = 0, node = this.findReplacer(startX, startY, startX, startY, motion, auth), p = this._map[node + 0];
                startX = p / 65536 | 0, startY = 65535 & p, node = this.findReplacer(startX, startY, endX, endY, motion, auth), 
                endX = (p = this._map[node + 0]) / 65536 | 0, endY = 65535 & p;
                for (var offset, child, parent, value, g, i, end = 6 * (this._limitX * endY + endX), minHNode = this.pushToOpen(startX, startY, 0, 3 * Math.abs(endY - startY) + 4 * Math.abs(endX - startX), 4294967295), len = OffsetList.length, col = endX, row = endY, x = startX, y = startY; 0 != this._open.length; ) {
                    if (3e4 <= ++counter) return this.buildPath(minHNode, result);
                    if ((node = this.popFromOpen()) === end) return this.buildPath(node, result);
                    for (col = (p = this._map[node + 0]) / 65536 | 0, row = 65535 & p, 4294967295 != (parent = this._map[node + 3]) && (x = (p = this._map[parent + 0]) / 65536 | 0, 
                    y = 65535 & p), i = 0; i < len; i += 4) (x = col + OffsetList[i]) < 0 || x >= this._limitX || (y = row + OffsetList[i + 1]) < 0 || y >= this._limitY || (child = 6 * (offset = this._limitX * y + x), 
                    motion < (112 & (value = this._data[offset])) >> 4 || auth < (15 & value) || this._map[child + 5] !== this._closeID && (g = this._map[node + 1] + OffsetList[i + 2], 
                    this._map[child + 5] === this._openID ? g < this._map[child + 1] && (this._map[child + 3] = node, 
                    this._map[child + 1] = g, this.shiftUp(this._map[child + 4], child)) : (offset = this._limitX * y + x, 
                    child = this.pushToOpen(x, y, g, 3 * Math.abs(endY - y) + 4 * Math.abs(endX - x), node), 
                    this._map[child + 2] < this._map[minHNode + 2] && (minHNode = child))));
                }
                return this.buildPath(minHNode, result);
            }, AStar.prototype.pushToOpen = function(x, y, g, h, parent) {
                var index = 6 * (this._limitX * y + x);
                return this._map[3 + index] = parent, this._map[1 + index] = g, this._map[2 + index] = h, 
                this._map[5 + index] = this._openID, this._open.push(index), this.shiftUp(this._open.length - 1, index), 
                index;
            }, AStar.prototype.popFromOpen = function() {
                var result = this._open[0], value = this._open.pop();
                return 0 != this._open.length && this.shiftDown(0, value), this._map[result + 5] = this._closeID, 
                result;
            }, AStar.prototype.shiftDown = function(i, e) {
                for (var v, l = 1 + (i << 1), r = l + 1, count = this._open.length, f = this._map[e + 1] + this._map[e + 2]; l < count && (v = this._open[l], 
                r < count && this._map[v + 1] + this._map[v + 2] > this._map[this._open[r] + 1] + this._map[this._open[r] + 2] && (v = this._open[r], 
                l = r), !(f < this._map[v + 1] + this._map[v + 2])); ) this._map[v + 4] = i, this._open[i] = v, 
                r = (l = 1 + ((i = l) << 1)) + 1;
                this._map[e + 4] = i, this._open[i] = e;
            }, AStar.prototype.shiftUp = function(i, e) {
                for (var v, p = i - 1 >> 1, f = this._map[e + 1] + this._map[e + 2]; 0 != i && (v = this._open[p], 
                !(this._map[v + 1] + this._map[v + 2] <= f)); ) this._map[v + 4] = i, this._open[i] = v, 
                p = (i = p) - 1 >> 1;
                this._map[e + 4] = i, this._open[i] = e;
            }, AStar.prototype.buildPath = function(node, result) {
                if (null == result && (result = []), result.length = 0, 4294967295 === node || 4294967295 === this._map[node + 3]) return result;
                var p = this._map[node + 0], start = new Point(p / 65536 | 0, 65535 & p);
                node = this._map[node + 3], result.push(start), p = this._map[node + 0];
                var target, end = new Point(p / 65536 | 0, 65535 & p);
                for (node = this._map[node + 3]; 4294967295 != node; ) p = this._map[node + 0], 
                target = new Point(p / 65536 | 0, 65535 & p), 0 != this.direction(start, end, target) && (result.push(end), 
                start = end), end = target, node, node = this._map[node + 3];
                return result;
            }, AStar.prototype.direction = function(start, end, target) {
                return (start.x - target.x) * (end.y - target.y) - (end.x - target.x) * (start.y - target.y);
            }, AStar;
        }();
        collections.AStar = AStar;
    }(utils.collections || (utils.collections = {}));
}(utils || (utils = {})), function(utils) {
    utils.collections || (utils.collections = {});
}(utils || (utils = {})), function(utils) {
    !function(collections) {
        var List = function() {
            function List() {
                this._head = null, this._size = 0;
            }
            return List.allocNode = function() {
                var result = List._free;
                return result ? List._free = result.next : result = {}, result.next = null, result;
            }, List.freeNode = function(e) {
                e.element = null, e.next = List._free, List._free = e;
            }, List.prototype.shift = function() {
                var node = this._head;
                if (!node) return null;
                var e = node.element;
                return this._head = node.next, List.freeNode(node), --this._size, e;
            }, List.prototype.unshift = function(e) {
                var node = List.allocNode();
                node.element = e, node.next = this._head, this._head = node, ++this._size;
            }, List.prototype.clear = function() {
                for (var next = this._head; next; ) {
                    var node = next;
                    next = next.next, List.freeNode(node);
                }
            }, Object.defineProperty(List.prototype, "isEmpty", {
                get: function() {
                    return !this._head;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(List.prototype, "size", {
                get: function() {
                    return this._size;
                },
                enumerable: !0,
                configurable: !0
            }), List.prototype.swap = function(list) {
                var head = this._head;
                this._head = list._head, list._head = head;
                var size = this._size;
                this._size = list._size, list._size = size;
            }, List;
        }();
        collections.List = List;
    }(utils.collections || (utils.collections = {}));
}(utils || (utils = {})), function(utils) {
    !function(collections) {
        var Queue = function() {
            function Queue(capacity) {
                void 0 === capacity && (capacity = 8), this._capacity = utils.MathUtils.ceilPowerOfTwo(8 < capacity ? capacity : 8), 
                this._list = new Array(this._capacity), this._front = 0, this._rear = 0, this._size = 0;
            }
            return Queue.prototype.expand = function() {
                this._capacity *= 2;
                var temp = this._list;
                this._list = new Array(this._capacity);
                var cursor = 0;
                if (this._front >= this._rear) {
                    for (var limit = temp.length, i = this._front; i < limit; ++i) this._list[cursor++] = temp[i];
                    for (i = 0; i < this._rear; ++i) this._list[cursor++] = temp[i];
                } else for (i = this._front; i < this._rear; ++i) this._list[cursor++] = temp[i];
                this._front = 0, this._rear = cursor;
            }, Queue.prototype.push = function(value) {
                this._size == this._capacity && this.expand(), this._list[this._rear] = value, this._rear = (this._rear + 1) % this._capacity, 
                this._size++;
            }, Queue.prototype.pull = function() {
                if (this.isEmpty()) return null;
                var result = this._list[this._front];
                return this._front = (this._front + 1) % this._capacity, this._size--, result;
            }, Queue.prototype.isEmpty = function() {
                return 0 == this._size;
            }, Object.defineProperty(Queue.prototype, "front", {
                get: function() {
                    return this.isEmpty() ? null : this._list[this._front];
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(Queue.prototype, "size", {
                get: function() {
                    return this._size;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(Queue.prototype, "capacity", {
                get: function() {
                    return this._capacity;
                },
                enumerable: !0,
                configurable: !0
            }), Queue;
        }();
        collections.Queue = Queue;
    }(utils.collections || (utils.collections = {}));
}(utils || (utils = {})), function(utils) {
    !function(collections) {
        var Slots = function() {
            function Slots(initialSize) {
                void 0 === initialSize && (initialSize = 256), initialSize = utils.MathUtils.ceilPowerOfTwo(initialSize), 
                this._slots = new Array(initialSize), this._count = 0, this._freeSlot = null;
            }
            return Object.defineProperty(Slots.prototype, "count", {
                get: function() {
                    return this._count;
                },
                enumerable: !0,
                configurable: !0
            }), Slots.prototype.get = function(handle) {
                var slot = this.findEntry(handle);
                return null == slot ? null : slot.res;
            }, Slots.prototype.has = function(handle) {
                return null != this.findEntry(handle);
            }, Slots.prototype.alloc = function(res) {
                if (null == res) return 0;
                if (this._count == this._slots.length) {
                    if (65536 < 2 * this._count) throw Error("Slots overflow!");
                    this._slots.length = 2 * this._count;
                }
                var slot;
                if (null != this._freeSlot) {
                    ++this._count;
                    var next = (slot = this._freeSlot).next;
                    this._freeSlot = -1 != next ? this._slots[next] : null;
                } else (slot = Object.create(null)).handle = 65536 | this._count, this._slots[this._count++] = slot;
                return slot.next = -1, slot.res = res, slot.handle;
            }, Slots.prototype.free = function(handle) {
                var slot = this.findEntry(handle);
                if (null == slot) return null;
                var res = slot.res, magic = slot.handle / 65536 | 0;
                return magic = 65535 == magic ? 1 : magic + 1, slot.handle = 65536 * magic + (65535 & slot.handle), 
                slot.next = null == this._freeSlot ? -1 : 65535 & this._freeSlot.handle, slot.res = null, 
                this._freeSlot = slot, --this._count, res;
            }, Slots.prototype.findEntry = function(handle) {
                var index = 65535 & handle;
                if (index >= this._slots.length) return null;
                var slot = this._slots[index];
                return null == slot || null == slot.res || slot.handle != handle ? null : slot;
            }, Slots;
        }();
        collections.Slots = Slots;
    }(utils.collections || (utils.collections = {}));
}(utils || (utils = {})), function(utils) {
    !function(tween_1) {
        var easing, interpolation;
        !function(easing) {
            !function(linear) {
                linear.None = function(k) {
                    return k;
                };
            }(easing.linear || (easing.linear = {})), function(quadratic) {
                quadratic.In = function(k) {
                    return k * k;
                }, quadratic.Out = function(k) {
                    return k * (2 - k);
                }, quadratic.InOut = function(k) {
                    return (k *= 2) < 1 ? .5 * k * k : -.5 * (--k * (k - 2) - 1);
                };
            }(easing.quadratic || (easing.quadratic = {})), function(cubic) {
                cubic.In = function(k) {
                    return k * k * k;
                }, cubic.Out = function(k) {
                    return --k * k * k + 1;
                }, cubic.InOut = function(k) {
                    return (k *= 2) < 1 ? .5 * k * k * k : .5 * ((k -= 2) * k * k + 2);
                };
            }(easing.cubic || (easing.cubic = {})), function(quartic) {
                quartic.In = function(k) {
                    return k * k * k * k;
                }, quartic.Out = function(k) {
                    return 1 - --k * k * k * k;
                }, quartic.InOut = function(k) {
                    return (k *= 2) < 1 ? .5 * k * k * k * k : -.5 * ((k -= 2) * k * k * k - 2);
                };
            }(easing.quartic || (easing.quartic = {})), function(quintic) {
                quintic.In = function(k) {
                    return k * k * k * k * k;
                }, quintic.Out = function(k) {
                    return --k * k * k * k * k + 1;
                }, quintic.InOut = function(k) {
                    return (k *= 2) < 1 ? .5 * k * k * k * k * k : .5 * ((k -= 2) * k * k * k * k + 2);
                };
            }(easing.quintic || (easing.quintic = {})), function(sinusoidal) {
                sinusoidal.In = function(k) {
                    return 1 - Math.cos(k * Math.PI / 2);
                }, sinusoidal.Out = function(k) {
                    return Math.sin(k * Math.PI / 2);
                }, sinusoidal.InOut = function(k) {
                    return .5 * (1 - Math.cos(Math.PI * k));
                };
            }(easing.sinusoidal || (easing.sinusoidal = {})), function(exponential) {
                exponential.In = function(k) {
                    return 0 === k ? 0 : Math.pow(1024, k - 1);
                }, exponential.Out = function(k) {
                    return 1 === k ? 1 : 1 - Math.pow(2, -10 * k);
                }, exponential.InOut = function(k) {
                    return 0 === k ? 0 : 1 === k ? 1 : (k *= 2) < 1 ? .5 * Math.pow(1024, k - 1) : .5 * (2 - Math.pow(2, -10 * (k - 1)));
                };
            }(easing.exponential || (easing.exponential = {})), function(circular) {
                circular.In = function(k) {
                    return 1 - Math.sqrt(1 - k * k);
                }, circular.Out = function(k) {
                    return Math.sqrt(1 - --k * k);
                }, circular.InOut = function(k) {
                    return (k *= 2) < 1 ? -.5 * (Math.sqrt(1 - k * k) - 1) : .5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
                };
            }(easing.circular || (easing.circular = {})), function(elastic) {
                elastic.In = function(k) {
                    return 0 === k ? 0 : 1 === k ? 1 : -Math.pow(2, 10 * (k - 1)) * Math.sin(5 * (k - 1.1) * Math.PI);
                }, elastic.Out = function(k) {
                    return 0 === k ? 0 : 1 === k ? 1 : Math.pow(2, -10 * k) * Math.sin(5 * (k - .1) * Math.PI) + 1;
                }, elastic.InOut = function(k) {
                    return 0 === k ? 0 : 1 === k ? 1 : (k *= 2) < 1 ? -.5 * Math.pow(2, 10 * (k - 1)) * Math.sin(5 * (k - 1.1) * Math.PI) : .5 * Math.pow(2, -10 * (k - 1)) * Math.sin(5 * (k - 1.1) * Math.PI) + 1;
                };
            }(easing.elastic || (easing.elastic = {})), function(back) {
                back.In = function(k) {
                    var s = 1.70158;
                    return k * k * ((1 + s) * k - s);
                }, back.Out = function(k) {
                    var s = 1.70158;
                    return --k * k * ((1 + s) * k + s) + 1;
                }, back.InOut = function(k) {
                    var s = 2.5949095;
                    return (k *= 2) < 1 ? k * k * ((1 + s) * k - s) * .5 : .5 * ((k -= 2) * k * ((1 + s) * k + s) + 2);
                };
            }(easing.back || (easing.back = {})), function(bounce) {
                function In(k) {
                    return Out(1 - k);
                }
                function Out(k) {
                    return k < 1 / 2.75 ? 7.5625 * k * k : k < 2 / 2.75 ? 7.5625 * (k -= 1.5 / 2.75) * k + .75 : k < 2.5 / 2.75 ? 7.5625 * (k -= 2.25 / 2.75) * k + .9375 : 7.5625 * (k -= 2.625 / 2.75) * k + .984375;
                }
                bounce.In = In, bounce.Out = Out, bounce.InOut = function(k) {
                    return k < .5 ? .5 * In(2 * k) : .5 * Out(2 * k - 1) + .5;
                };
            }(easing.bounce || (easing.bounce = {}));
        }(easing = tween_1.easing || (tween_1.easing = {})), function(interpolation) {
            function helperLinear(p0, p1, t) {
                return (p1 - p0) * t + p0;
            }
            function helperBernstein(n, i) {
                var fc = helperFactorial;
                return fc(n) / fc(i) / fc(n - i);
            }
            interpolation.Linear = function(v, k) {
                var m = v.length - 1, f = m * k, i = Math.floor(f), fn = helperLinear;
                return k < 0 ? fn(v[0], v[1], f) : 1 < k ? fn(v[m], v[m - 1], m - f) : fn(v[i], v[m < i + 1 ? m : i + 1], f - i);
            }, interpolation.Bezier = function(v, k) {
                for (var b = 0, n = v.length - 1, pw = Math.pow, bn = helperBernstein, i = 0; i <= n; i++) b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i);
                return b;
            }, interpolation.CatmullRom = function(v, k) {
                var m = v.length - 1, f = m * k, i = Math.floor(f), fn = helperCatmullRom;
                return v[0] === v[m] ? (k < 0 && (i = Math.floor(f = m * (1 + k))), fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i)) : k < 0 ? v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]) : 1 < k ? v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]) : fn(v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2], f - i);
            };
            var a = [ 1 ];
            function helperFactorial(n) {
                if (a[n]) return a[n];
                for (var s = 1, i = n; 1 < i; i--) s *= i;
                return a[n] = s;
            }
            function helperCatmullRom(p0, p1, p2, p3, t) {
                var v0 = .5 * (p2 - p0), v1 = .5 * (p3 - p1), t2 = t * t;
                return (2 * p1 - 2 * p2 + v0 + v1) * (t * t2) + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
            }
        }(interpolation = tween_1.interpolation || (tween_1.interpolation = {}));
        var TweenGroup = function() {
            function TweenGroup() {
                this._tweens = {}, this._tweensAddedDuringUpdate = {}, TweenGroup.groups.push(this);
            }
            return TweenGroup.prototype.getAll = function() {
                var _this = this;
                return Object.keys(this._tweens).map(function(key) {
                    return _this._tweens[key];
                });
            }, TweenGroup.prototype.removeAll = function() {
                var tweens = this._tweens;
                for (var id in this._tweens = {}, this._tweensAddedDuringUpdate = {}, tweens) tweens[id] && tweens[id].stop();
            }, TweenGroup.prototype.destroy = function() {
                this.removeAll(), utils.ArrayUtils.remove(TweenGroup.groups, this);
            }, TweenGroup.prototype.add = function(tween) {
                this._tweens[tween.key()] = tween, this._tweensAddedDuringUpdate[tween.key()] = tween;
            }, TweenGroup.prototype.remove = function(tween) {
                delete this._tweens[tween.key()], delete this._tweensAddedDuringUpdate[tween.key()];
            }, TweenGroup.prototype.update = function(time, preserve) {
                var tweenIds = Object.keys(this._tweens);
                if (0 === tweenIds.length) return !1;
                for (time = void 0 !== time ? time : Date.now(); 0 < tweenIds.length; ) {
                    this._tweensAddedDuringUpdate = {};
                    for (var i = 0; i < tweenIds.length; i++) {
                        var tween_2 = this._tweens[tweenIds[i]];
                        tween_2 && !tween_2.update(time) && (preserve || delete this._tweens[tweenIds[i]]);
                    }
                    tweenIds = Object.keys(this._tweensAddedDuringUpdate);
                }
                return !0;
            }, TweenGroup.groups = [], TweenGroup;
        }();
        tween_1.TweenGroup = TweenGroup;
        var TweenJS = function() {
            function TweenJS(object, group) {
                this._id = TweenJS.nextId().toString(), this._object = object, this._valuesStart = {}, 
                this._valuesEnd = {}, this._valuesStartRepeat = {}, this._duration = 0, this._repeat = 0, 
                this._repeatDelayTime = void 0, this._yoyo = !1, this._isPlaying = !1, this._reversed = !1, 
                this._delayTime = 0, this._startTime = 0, this._easingFunction = easing.linear.None, 
                this._interpolationFunction = interpolation.Linear, this._chainedTweens = [], this._onStartCallback = null, 
                this._onStartCallbackFired = !1, this._onUpdateCallback = null, this._onCompleteCallback = null, 
                this._onStopCallback = null, this._group = group || TweenJS.defaultGroup, this._combine = !1, 
                this._chainRunning = !1, this._count = 0;
            }
            return TweenJS.nextId = function() {
                return ++TweenJS.id;
            }, TweenJS.update = function(time, preserve) {
                for (var i = TweenGroup.groups.length - 1; 0 <= i; --i) TweenGroup.groups[i].update(time, preserve);
            }, TweenJS.create = function(object, group) {
                return new TweenJS(object, group);
            }, TweenJS.recover = function(tween) {
                tween.stop();
            }, Object.defineProperty(TweenJS.prototype, "object", {
                get: function() {
                    return this._object;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(TweenJS.prototype, "property", {
                get: function() {
                    return this._valuesEnd;
                },
                enumerable: !0,
                configurable: !0
            }), Object.defineProperty(TweenJS.prototype, "duration", {
                get: function() {
                    return this._duration;
                },
                enumerable: !0,
                configurable: !0
            }), TweenJS.prototype.key = function() {
                return this._id;
            }, Object.defineProperty(TweenJS.prototype, "isPlaying", {
                get: function() {
                    return this._isPlaying;
                },
                enumerable: !0,
                configurable: !0
            }), TweenJS.prototype.to = function(properties, duration) {
                return this._valuesEnd = properties, void 0 !== duration && (this._duration = duration), 
                this;
            }, TweenJS.prototype.start = function() {
                if (this._isPlaying) return this;
                for (var property in this._group.add(this), this._count = 0, this._isPlaying = !0, 
                this._onStartCallbackFired = !1, this._startTime = Date.now() + this._delayTime, 
                this._chainRunning = !1, this._valuesEnd) {
                    if (this._valuesEnd[property] instanceof Array) {
                        if (0 === this._valuesEnd[property].length) continue;
                        this._valuesEnd[property] = [ this._object[property] ].concat(this._valuesEnd[property]);
                    }
                    void 0 !== this._object[property] && (this._valuesStart[property] = this._object[property], 
                    this._valuesStart[property] instanceof Array == !1 && (this._valuesStart[property] *= 1), 
                    this._valuesStartRepeat[property] = this._valuesStart[property] || 0);
                }
                return this;
            }, TweenJS.prototype.stop = function() {
                return this._isPlaying && (this._group.remove(this), this._isPlaying = !1, this._onStopCallback && this._onStopCallback(this._object, this._valuesEnd), 
                this.stopChainedTweens()), this;
            }, TweenJS.prototype.end = function() {
                return this.update(this._startTime + this._duration), this;
            }, TweenJS.prototype.stopChainedTweens = function() {
                if (this._chainRunning) {
                    for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) this._chainedTweens[i].stop();
                    this._chainRunning = !1;
                }
                return this;
            }, TweenJS.prototype.combine = function(enable) {
                return this._combine = enable, this;
            }, TweenJS.prototype.delay = function(amount) {
                return this._delayTime = amount, this;
            }, TweenJS.prototype.repeat = function(times) {
                return this._repeat = times, this;
            }, TweenJS.prototype.repeatDelay = function(amount) {
                return this._repeatDelayTime = amount, this;
            }, TweenJS.prototype.yoyo = function(enable) {
                return this._yoyo = enable, this;
            }, TweenJS.prototype.easing = function(easing) {
                return this._easingFunction = easing, this;
            }, TweenJS.prototype.interpolation = function(interpolation) {
                return this._interpolationFunction = interpolation, this;
            }, TweenJS.prototype.chain = function() {
                for (var tweens = [], _i = 0; _i < arguments.length; _i++) tweens[_i] = arguments[_i];
                return this._chainedTweens = tweens, this;
            }, TweenJS.prototype.onStart = function(callback) {
                return this._onStartCallback = callback, this;
            }, TweenJS.prototype.onStop = function(callback) {
                return this._onStopCallback = callback, this;
            }, TweenJS.prototype.onUpdate = function(callback) {
                return this._onUpdateCallback = callback, this;
            }, TweenJS.prototype.onRepeat = function(callback) {
                return this._onRepeatCallback = callback, this;
            }, TweenJS.prototype.onComplete = function(callback) {
                return this._onCompleteCallback = callback, this;
            }, TweenJS.prototype.update = function(time) {
                if (time < this._startTime) return !0;
                !1 === this._onStartCallbackFired && (this._onStartCallback && this._onStartCallback(this._object, this._valuesEnd), 
                this._onStartCallbackFired = !0);
                var elapsed = 0 === this._duration ? 1 : (time - this._startTime) / this._duration;
                elapsed = 1 < elapsed ? 1 : elapsed;
                var value = 1;
                if (!this._chainRunning) for (var property in value = this._easingFunction(elapsed), 
                this._valuesEnd) if (void 0 !== this._valuesStart[property]) {
                    var start = this._valuesStart[property] || 0, end = this._valuesEnd[property];
                    end instanceof Array ? this._object[property] = this._interpolationFunction(end, value) : ("string" == typeof end && (end = "+" === end.charAt(0) || "-" === end.charAt(0) ? start + parseFloat(end) : parseFloat(end)), 
                    "number" == typeof end && (this._object[property] = start + (end - start) * value));
                }
                if (this._onUpdateCallback && this._onUpdateCallback(this._object, value), 1 === elapsed && this._isPlaying) if (this._repeat > this._count++) {
                    for (var property in this._valuesStartRepeat) {
                        if ("string" == typeof this._valuesEnd[property] && (this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property])), 
                        this._yoyo) {
                            var tmp = this._valuesStartRepeat[property];
                            this._valuesStartRepeat[property] = this._valuesEnd[property], this._valuesEnd[property] = tmp;
                        }
                        this._valuesStart[property] = this._valuesStartRepeat[property];
                    }
                    this._yoyo && (this._reversed = !this._reversed), void 0 !== this._repeatDelayTime ? this._startTime = time + this._repeatDelayTime : this._startTime = time + this._delayTime, 
                    this._onRepeatCallback && this._onRepeatCallback(this._object, this._valuesEnd);
                } else {
                    if (this._combine && this._chainRunning) {
                        var isComplete = !0;
                        for (i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) if (this._chainedTweens[i].isPlaying) {
                            isComplete = !1;
                            break;
                        }
                        this._chainRunning = !isComplete;
                    } else {
                        for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) this._chainedTweens[i].start();
                        this._chainRunning = !0;
                    }
                    this._combine && this._chainRunning || (this._isPlaying = !1, null !== this._onCompleteCallback && this._onCompleteCallback(this._object, this._valuesEnd));
                }
                return this._isPlaying;
            }, TweenJS.defaultGroup = new TweenGroup(), TweenJS.id = 0, TweenJS;
        }();
        tween_1.TweenJS = TweenJS;
    }(utils.tween || (utils.tween = {}));
}(utils || (utils = {})), window.__extends = __extends, window.__assign = __assign, 
window.__rest = __rest, window.__decorate = __decorate, window.__param = __param, 
window.__metadata = __metadata, window.__awaiter = __awaiter, window.__generator = __generator, 
window.__exportStar = __exportStar, window.__values = __values, window.__read = __read, 
window.__spread = __spread, window.__spreadArrays = __spreadArrays, window.__await = __await, 
window.__asyncGenerator = __asyncGenerator, window.__asyncDelegator = __asyncDelegator, 
window.__asyncValues = __asyncValues, window.__makeTemplateObject = __makeTemplateObject, 
window.__importStar = __importStar, window.__importDefault = __importDefault, window.utils = utils, 
window.base = base, window.net = net, window.StringUtils = utils.StringUtils, window.TraceUtils = utils.TraceUtils, 
window.ResourcePool = base.assets.ResourcePool, window.ArrayUtils = utils.ArrayUtils, 
window.TweenJS = utils.tween.TweenJS, window.AssetPoolBase = base.assets.AssetPoolBase, 
window.selectServerView = {
    versions: {
        "loading.js": Date.now(),
        "login/btn_xfy_qf_0.png": 2,
        "login/btn_xfy_fwq.png": 2,
        "login/image_xfy_ct.png": 2,
        "login/image_xfy_fm.png": 2,
        "login/image_xfy_wh.png": 2,
        "login/image_xfy_bg2.jpg": 3,
        "login/image_qqdtlz_bg06.jpg": 2,
        "login/btn_xfy_xq.png": 2,
        "login/image_xfy_xfbg.png": 2,
        "login/btn_xfy_dlyx.png": 3,
        "login/btn_tongyong_13.png": 2,
        "login/image_common_zz.png": 2,
        "login/panel_xfy_gxbg.png": 2,
        "login/btn_xfy_gg.png": 2,
        "login/btn_xfy_qhc.png": 2,
        "login/image_xfy_bg1.jpg": 2,
        "login/image_xfy_bg0.jpg": 2,
        "login/image_xfy_bg.png": 2,
        "login/image_xfy_bg12.jpg": 2,
        "login/image_loading_bg0.jpg": 1,
        "login/image_xfy_fcm.png": 2
    },
    bg: null,
    stateImg: null,
    serverName: null,
    changeServerImg: null,
    changeServerName: null,
    leftItems: null,
    rightItems: null,
    leftDiv: null,
    rightDiv: null,
    serverListDiv: null,
    selectedLeftItem: null,
    cdn: "",
    tipsLabel: null,
    tipsTop: 600,
    frameId: 0,
    ggBtn: null,
    switchGroupCon: null,
    switchGroupDiv: null,
    alertCon: null,
    alertTitle: null,
    alertContent: null,
    repairBtn: null,
    serverCon: null,
    background: null,
    bg1Con: null,
    agePanel: null,
    ageBtn: null,
    alertContentDiv: null,
    alertYesBtn: null,
    alertNoBtn: null,
    userAgreement: "",
    privacyPolicy: "",
    antiAddictionTxt: "",
    updateNoticeVer: "",
    updateNotice: "",
    opened: !1,
    privacySelected: !1,
    isGray: !1,
    isInitGray: !1,
    createElement: function(tagName, style, id) {
        var e = document.createElement(tagName);
        return id && (e.id = id), e.style.cssText = style, e;
    },
    loadScriptFromUrl: function(url, onComplete) {
        var script = window.document.createElement("script");
        script.type = "text/javascript", script.src = this.formatUrl(url), script.onload = onComplete.bind(this), 
        document.body.appendChild(script);
    },
    createImageElement: function(src, style, id) {
        var e = this.createElement("img", style, id), v = this.versions[src];
        return src && (e.src = v ? "" + this.cdn + src + "?v=" + v : "" + this.cdn + src), 
        e;
    },
    formatUrl: function(url) {
        var v = this.versions[url];
        return v ? "" + this.cdn + url + "?v=" + v : "" + this.cdn + url;
    },
    appendCopyright: function(div) {
        var texts = [ "抵制不良游戏,拒绝盗版游戏。注意自我保护,谨防受骗上当。", "适度游戏益脑,沉迷游戏伤身。合理安排时间,享受健康生活。", "审批文号：国新出审[2019]3602号,著作权人：成都玖壹叁零网络科技有限公司,", "出版单位：上海同济大学电子音像出版社有限公司,出版物号：ISBN 978-7-498-07182-8" ];
        511045 === tparams.package && (texts[2] = "审批文号：新广出审[2014]1245号,著作权人：上海甲游网络科技有限公司", 
        texts[3] = "出版单位：杭州群游科技有限公司,出版物号：ISBN 978-7-89988-123-1"), tparams.control && tparams.control.miniGameCopyright1 && "" != tparams.control.miniGameCopyright1 && (texts[2] = tparams.control.miniGameCopyright1), 
        tparams.control && tparams.control.miniGameCopyright2 && "" != tparams.control.miniGameCopyright2 && (texts[3] = tparams.control.miniGameCopyright2);
        var styles = [ "position:absolute;left:0px;top:1180px;width:720px;text-align:center;color:#a298d0;font-size:20px;font-family:'SimHei';", "position:absolute;left:0px;top:1204px;width:720px;text-align:center;color:#a298d0;font-size:20px;font-family:'SimHei';", "position:absolute;left:0px;top:1240px;width:720px;text-align:center;color:#a298d0;font-size:16px;font-family:'SimHei';", "position:absolute;left:0px;top:1260px;width:720px;text-align:center;color:#a298d0;font-size:16px;font-family:'SimHei';" ];
        1 === tparams.control.ageTip && (texts.push("适龄提示：本游戏适合18周岁以上者参与"), styles.push("position:absolute;left:0px;top:960px;width:720px;text-align:center;color:#a298d0;font-size:20px;font-family:'SimHei';"));
        for (var i = 0, length_1 = texts.length; i < length_1; ++i) {
            var label = this.createElement("label", styles[i]);
            label.innerText = texts[i], div.appendChild(label);
        }
    },
    getStateUrl: function(status) {
        var str = "";
        return 2 === status ? str = "login/image_xfy_ct.png" : 1 === status ? str = "login/image_xfy_fm.png" : -1 === status && (str = "login/image_xfy_wh.png"), 
        str;
    },
    selectServer: function(server) {
        this.serverName.innerText = server.name, this.stateImg.src = this.formatUrl(this.getStateUrl(server.status)), 
        tparams.cdn = server.cdn || "", tparams.selectedServer = server;
    },
    createLeftItem: function(serverInfo) {
        var div = this.createElement("div", "position:absolute;width:192px;height:76px;"), stateImg = this.createImageElement("login/btn_xfy_qf_0.png", "position:absolute;");
        div.appendChild(stateImg);
        var label = this.createElement("label", "position:absolute;top:22px;width:192px;height:32px;line-height:32px;text-align:center;color:#010101;font-size:28px;font-family:'SimHei';pointer-events:none;");
        return div.appendChild(label), label.innerText = serverInfo[1], div;
    },
    createRightItem: function(server) {
        var div = this.createElement("div", "position:absolute;width:381px;height:66px;");
        div.appendChild(this.createImageElement("login/btn_xfy_fwq.png", "position:absolute;"));
        var stateImg = this.createImageElement(this.getStateUrl(server.status), "position:absolute;left:18px;top:16px;pointer-events:none;");
        div.appendChild(stateImg);
        var serverName = this.createElement("label", "position:absolute;left:80px;top:18px;color:#000000;line-height:30px;font-size:30px;font-family:'SimHei';pointer-events:none;");
        return div.appendChild(serverName), serverName.innerText = server.name, div;
    },
    clearItems: function(items) {
        if (items && 0 < items.length) {
            for (var i = 0, len = items.length; i < len; i++) items[i].remove();
            items.length = 0;
        }
    },
    refreshServerList: function() {
        var _this = this;
        this.clearItems(this.leftItems);
        var infos = tparams.serverZoneNames;
        if (infos && 0 !== infos.length) {
            this.leftItems = this.leftItems || [];
            function _loop_1(i, len) {
                var div = this_1.createLeftItem(infos[i]);
                this_1.leftDiv.appendChild(div), div.style.top = 76 * i + "px", div.onclick = function() {
                    _this.selectServerList(infos[i][0], div);
                }, this_1.leftItems[i] = div;
            }
            for (var this_1 = this, i = 0, len = infos.length; i < len; i++) _loop_1(i);
            this.selectServerList(-1, this.leftItems[0]);
        }
    },
    selectServerList: function(zone, leftItem) {
        this.selectedLeftItem && (this.selectedLeftItem.getElementsByTagName("img")[0].src = this.formatUrl("login/btn_xfy_qf_0.png")), 
        this.selectedLeftItem = leftItem, this.selectedLeftItem.getElementsByTagName("img")[0].src = this.formatUrl("login/btn_xfy_qf_1.png"), 
        this.clearItems(this.rightItems), tparams.serverZones && this.refreshRightItems(zone);
    },
    refreshRightItems: function(zone) {
        var _this = this, arr = tparams.serverZones[zone];
        if (arr) {
            this.rightItems = this.rightItems || [];
            function _loop_2(i, len) {
                var div = this_2.createRightItem(arr[i]);
                this_2.rightDiv.appendChild(div), div.style.top = 66 * i + "px", (this_2.rightItems[i] = div).onclick = function() {
                    -1 !== arr[i].status ? (_this.selectServer(arr[i]), _this.serverListDiv.style.visibility = "hidden") : _this.noticeTip("当前服务器正在维护中", "#ff3e3e");
                };
            }
            for (var this_2 = this, i = 0, len = arr.length; i < len; i++) _loop_2(i);
        } else getZoneServer(zone);
    },
    noticeTip: function(str, color) {
        this.frameId && (window.cancelAnimationFrame(this.frameId), this.tipsTop = 600), 
        this.frameId = window.requestAnimationFrame(this.tweenTips.bind(this)), this.tipsLabel.innerText = str, 
        this.tipsLabel.style.color = color;
    },
    tweenTips: function() {
        if (this.tipsTop < 100) return this.tipsTop = 600, void (this.tipsLabel.style.visibility = "hidden");
        this.tipsLabel.style.visibility = "visible", this.tipsLabel.style.top = (this.tipsTop < 500 ? 500 : this.tipsTop) + "px", 
        this.frameId = window.requestAnimationFrame(this.tweenTips.bind(this)), this.tipsTop = this.tipsTop - 10;
    },
    gotoLoadingJs: function(isNew) {
        void 0 === isNew && (isNew = !1), -1 !== tparams.selectedServer.status ? (this.close(), 
        window.onMiniGame ? window.enterGame() : this.loadScriptFromUrl("loading.js", function(e) {
            enterGame();
        })) : isNew ? alert("当前服务器正在维护中") : this.noticeTip("当前服务器正在维护中", "#ff3e3e");
    },
    openAlert: function(title, content, showBtn) {
        void 0 === showBtn && (showBtn = !1), this.alertCon.style.visibility = "visible", 
        this.alertTitle.innerText = title, this.alertContent.innerHTML = content, document.getElementById("alertContentDiv").scrollTop = 0, 
        this.alertContentDiv.style.height = showBtn ? "830px" : "910px", this.alertYesBtn && (this.alertYesBtn.style.visibility = showBtn ? "visible" : "hidden"), 
        this.alertNoBtn && (this.alertNoBtn.style.visibility = showBtn ? "visible" : "hidden");
    },
    closeAlert: function() {
        this.alertCon.style.visibility = "hidden", this.alertYesBtn && (this.alertYesBtn.style.visibility = "hidden"), 
        this.alertNoBtn && (this.alertNoBtn.style.visibility = "hidden");
    },
    openUpdateNotice: function() {
        var _this = this;
        this.updateNotice ? this.openAlert("更新公告", this.updateNotice) : getNotice(function(data) {
            _this.updateNotice = tparams.notice.contents = data.contents, _this.updateNotice && _this.openAlert("更新公告", _this.updateNotice);
        });
    },
    openPrivacyPolicy: function() {
        var _this = this, xyTitle = "changxiang" == tparams.channel ? "用户协议与隐私政策" : "隐私政策", privacyNum = tparams.control.privacyNum;
        this.privacyPolicy ? this.openAlert(xyTitle, this.privacyPolicy, tparams.control.privacyAlertButton) : sendXHR(this.cdn + "login/privacy_policy_" + privacyNum, null, function(data) {
            _this.privacyPolicy = data, _this.openAlert(xyTitle, _this.privacyPolicy, tparams.control.privacyAlertButton);
        }, "text");
    },
    openUserAgreement: function() {
        var _this = this, agreementNum = tparams.control.agreementNum || 0;
        this.userAgreement ? this.openAlert("用户注册服务协议", this.userAgreement) : sendXHR(this.cdn + "login/user_agreement_" + agreementNum, null, function(data) {
            _this.userAgreement = data, _this.openAlert("用户注册服务协议", _this.userAgreement);
        }, "text");
    },
    openAntiAddition: function() {
        var _this = this, antiAddictionNum = tparams.control.AntiAddictionNum || 0;
        this.antiAddictionTxt ? this.openAlert("防沉迷", this.antiAddictionTxt) : sendXHR(this.cdn + "login/anti_addiction_" + antiAddictionNum, null, function(data) {
            _this.antiAddictionTxt = data, _this.openAlert("防沉迷", _this.antiAddictionTxt);
        }, "text");
    },
    getFullScreenBg: function() {
        var t = null;
        tparams.control && (1 === tparams.control.fullScreenBg && (t = this.createImageElement("login/full_screen_bg.jpg", "position: absolute;", "background")));
        return t;
    },
    initGray: function() {
        var date = new Date();
        2022 !== date.getFullYear() || date.getUTCMonth() + 1 !== 12 || 6 < date.getUTCDate() ? this.isGray = !1 : this.isGray = !0, 
        this.isInitGray = !0;
    },
    showBg: function() {
        this.cdn = tparams.cdn, this.background = this.getFullScreenBg(), this.background && document.body.appendChild(this.background), 
        this.isInitGray || this.initGray(), this.isGray ? document.body.style.cssText = "position:fixed;margin:0;overflow:hidden;overflow-x:hidden;overflow-y:hidden;background-color:#000000;filter:grayscale(1);" : document.body.style.cssText = "position:fixed;margin:0;overflow:hidden;overflow-x:hidden;overflow-y:hidden;background-color:#000000;", 
        console.warn("show-isGray", this.isGray, document.body.style.cssText), this.serverCon = this.createElement("div", "position:absolute;height:1280px;width:720px;visibility:visible", "serverCon"), 
        this.background ? (this.bg1Con = this.createElement("div", "position:absolute;height:1280px;width:720px;visibility:visible", "bg1Con"), 
        this.bg1Con.appendChild(this.createImageElement("login/image_xfy_bg.png", "position: absolute;left:0px;top:26px;", "bg1")), 
        document.body.appendChild(this.bg1Con)) : this.serverCon.appendChild(this.createImageElement("login/image_xfy_bg" + (tparams.control && tparams.control.bg || "0") + ".jpg", "position: absolute;left:-120px;top:50%;transform:translateY(-50%);")), 
        document.body.appendChild(this.serverCon), this.zoom(), window.addEventListener("resize", this.zoom);
    },
    initChangeServer: function() {
        var _this = this;
        if (1 == tparams.control.packageSwitchGroup && tparams.otherGroup && tparams.otherGroup.length) {
            if (!this.changeServerImg) {
                this.changeServerImg = this.createImageElement("login/btn_xfy_02.png", "position: absolute;left:140px;top:910px;"), 
                this.switchGroupCon = this.createElement("div", "position:absolute;height:1280px;width:720px;visibility:hidden", "switchGroupCon"), 
                this.switchGroupDiv = this.createElement("div", "left:110px;top:400px;position:absolute;height:500px;width:500px;", "switchGroupDiv");
                var len = tparams.otherGroup.length, img = this.createImageElement("login/btn_xfy_zsxq_dk.png", "position: absolute;left:124px;top:" + (502 - 42 * len) + "px;height:" + (42 * len + 12) + "px;width:256px");
                this.switchGroupDiv.appendChild(img), this.serverCon.appendChild(this.switchGroupCon), 
                this.switchGroupCon.appendChild(this.switchGroupDiv), this.serverCon.appendChild(this.changeServerImg);
                for (var i = 0; i < tparams.otherGroup.length; i++) this.createServerItem(i, tparams.otherGroup[i]);
                this.changeServerImg.onclick = function(event) {
                    event.stopPropagation(), 1 == tparams.control.packageSwitchGroup && tparams.otherGroup && tparams.otherGroup.length && (_this.switchGroupCon.style.visibility = "visible" == _this.switchGroupCon.style.visibility ? "hidden" : "visible");
                }, this.switchGroupCon.onclick = function() {
                    _this.switchGroupCon.style.visibility = "hidden";
                };
            }
            this.changeServerName || (this.changeServerName = this.createElement("label", "position:absolute;left:203px;top:918px;width:300px;height:35px;line-height:34px;text-align:center;color:#000000;font-size:30px;font-family:'SimHei';pointer-events:none;"), 
            this.serverCon.appendChild(this.changeServerName)), this.changeServerName.innerText = "切换专区";
        } else this.changeServerImg && this.changeServerImg.remove(), this.changeServerName && this.changeServerName.remove();
    },
    createServerItem: function(index, group) {
        var _this = this, img = this.createImageElement("login/btn_xfy_zsxq_zsq.png", "position: absolute;left:128px;top:" + (468 - 40 * index) + "px;");
        img.onclick = function(event) {
            event.stopPropagation();
            var self = _this;
            packageGroupSwitch(group.other_group_id, function() {
                self.switchGroupCon.style.visibility = "hidden";
            });
        };
        var lable = this.createElement("label", "position:absolute;left:100px;top:" + (468 - 40 * index) + "px;width:300px;height:38px;line-height:38px;text-align:center;color:#000000;font-size:26px;font-family:'SimHei';pointer-events:none;");
        lable.innerText = group.other_group_name, this.switchGroupDiv.appendChild(img), 
        this.switchGroupDiv.appendChild(lable);
    },
    updatePrivacySelectImg: function(img, selected) {
        img.src = this.formatUrl(selected ? "login/checkbox_common_gxk1.png" : "login/checkbox_common_gxk0.png");
    },
    changePrivacySelected: function(img, selected) {
        this.privacySelected = selected, window.localStorage && window.localStorage.setItem("privacy_selected", selected ? "1" : "0"), 
        1 == tparams.control.privacyButton && this.updatePrivacySelectImg(img, selected);
    },
    loginHandler: function() {
        tparams.banStatus ? alert("您的账号已被封禁！") : !tparams.control.privacyAlertButton || this.privacySelected ? 1 != tparams.control.privacyButton || this.privacySelected ? (this.cdn = tparams.cdn, 
        this.gotoLoadingJs(!1)) : this.noticeTip("请阅读并同意隐私政策", "#ff3e3e") : this.openPrivacyPolicy();
    },
    open: function() {
        var _this = this;
        if (!this.opened) {
            if (window.onMiniGame = -1 < window.navigator.userAgent.indexOf("MiniGame") || -1 < window.navigator.userAgent.indexOf("MiniGame") && -1 < window.navigator.userAgent.indexOf("OPPO") || -1 < window.navigator.userAgent.indexOf("VVGame"), 
            this.opened = !0, tparams.preCdn = tparams.cdn, tparams.notice && (this.updateNoticeVer = tparams.notice.version), 
            1 === tparams.newregister || tparams.autoLogin) return window.localStorage && window.localStorage.setItem("update_notice_ver", this.updateNoticeVer), 
            tparams.cdn = this.cdn = tparams.selectedServer.cdn, void this.gotoLoadingJs(!0);
            if (window.onMiniGame) window.modules.login.LoginModel.instance.selectedServer = tparams.selectedServer, 
            window.enterGame(); else {
                this.cdn = tparams.cdn;
                var style = document.createElement("style");
                style.innerText = "p{text-indent:2em}", document.body.appendChild(style), this.serverCon || this.showBg();
                var serverCon = this.serverCon, selectImg = this.createImageElement("login/btn_xfy_xq.png", "position: absolute;left:103px;top:986px;");
                serverCon.appendChild(selectImg), selectImg.onclick = function() {
                    tparams.hasReq || (tparams.hasReq = !0, req_server_list()), _this.serverListDiv.style.visibility = "visible";
                }, this.initChangeServer();
                var off = 1 == tparams.control.privacyButton ? 1060 : 1083, loginBtn = this.createImageElement("login/btn_xfy_dlyx.png", "position: absolute;left:220px;top:" + off + "px;");
                serverCon.appendChild(loginBtn), loginBtn.onclick = this.loginHandler.bind(this), 
                this.stateImg = this.createImageElement("", "position: absolute;left:123px;top:1004px;pointer-events:none;"), 
                serverCon.appendChild(this.stateImg), this.serverName = this.createElement("label", "position:absolute;left:203px;top:1005px;width:300px;height:35px;line-height:34px;text-align:center;color:#000000;font-size:32px;font-family:'SimHei';pointer-events:none;"), 
                serverCon.appendChild(this.serverName);
                var privacySelectImg_1, label = this.createElement("label", "position:absolute;left:517px;top:1005px;height:35px;line-height:34px;text-align:left;color:#000000;font-size:32px;font-family:'SimHei';pointer-events:none;");
                if (label.innerText = "换区>", serverCon.appendChild(label), this.selectServer(tparams.selectedServer), 
                this.privacySelected = !!window.localStorage && "1" == window.localStorage.getItem("privacy_selected"), 
                1 == tparams.control.privacyButton) {
                    privacySelectImg_1 = this.createImageElement("", "position: absolute;left:123px;top:1142px;"), 
                    serverCon.appendChild(privacySelectImg_1);
                    var privacySelectTxt = this.createElement("span", "position: absolute;left:160px;top:1150px;");
                    serverCon.appendChild(privacySelectTxt), privacySelectTxt.innerHTML = '<label style="text-align:center;color:#a298d0;font-size:20px;font-family:\'SimHei\';">我已经详细阅读并同意<label id="agreementLabel" style="text-align:center;color:#0ECF09;font-size:20px;font-family:\'SimHei\';text-decoration:underline;">游戏用户手册</label>和<label id="privacyLabel" style="text-align:center;color:#0ECF09;font-size:20px;font-family:\'SimHei\';text-decoration:underline;">隐私协议</label></label></label>', 
                    document.getElementById("agreementLabel").onclick = this.openUserAgreement.bind(this), 
                    document.getElementById("privacyLabel").onclick = this.openPrivacyPolicy.bind(this), 
                    this.updatePrivacySelectImg(privacySelectImg_1, this.privacySelected), privacySelectImg_1.onclick = function() {
                        _this.changePrivacySelected(privacySelectImg_1, !_this.privacySelected);
                    };
                }
                if (tparams.package && -1 < [ 510714, 510491, 511634, 511635, 511631 ].indexOf(tparams.package) || tparams.control && tparams.control.privacyAgreesTips && 1 === tparams.control.privacyAgreesTips) {
                    var privacyTips = this.createElement("label", "position:absolute;left:118px;top:945px;width:500px;height:35px;line-height:34px;text-align:center;color:#a298d0;font-size:24px;font-family:'SimHei';pointer-events:none;");
                    serverCon.appendChild(privacyTips), privacyTips.innerText = "登录即同意隐私政策";
                }
                this.serverListDiv = this.createElement("div", "position:absolute;left:-120px;top:-140px;width:960px;height:1560px;visibility:hidden", "serverList"), 
                this.serverListDiv.appendChild(this.createImageElement("login/image_xfy_xfbg.png", "position: absolute;left:128px;top:227px;"));
                var closeBtn = this.createImageElement("login/btn_tongyong_13.png", "position: absolute;left:763px;top:254px;");
                this.serverListDiv.appendChild(closeBtn), closeBtn.onclick = function() {
                    _this.serverListDiv.style.visibility = "hidden";
                };
                var leftCon = this.createElement("div", "position:absolute;left:174px;top:340px;width:192px;height:932px;overflow:hidden;", "leftCon");
                this.serverListDiv.appendChild(leftCon), this.leftDiv = this.createElement("div", "position:absolute;left:0px;top:0px;width:210px;height:932px;overflow-y:auto;", "leftDiv"), 
                leftCon.appendChild(this.leftDiv);
                var rightCon = this.createElement("div", "position:absolute;left:400px;top:340px;width:381px;height:932px;overflow:hidden;", "rightCon");
                this.serverListDiv.appendChild(rightCon), this.rightDiv = this.createElement("div", "position:absolute;left:0px;top:0px;width:400px;height:932px;overflow-y:auto;", "rightDiv"), 
                rightCon.appendChild(this.rightDiv), this.tipsLabel = this.createElement("label", "position:absolute;left:0px;top:680px;width:720px;height:35px;line-height:34px;text-align:center;color:#ff3e3e;font-size:32px;font-family:'SimHei';pointer-events:none;visibility:hidden;"), 
                this.appendCopyright(serverCon), this.alertCon = this.createElement("div", "position:absolute;left:0px;top:0px;width:720px;height:1280px;visibility:hidden;", "alertCon"), 
                this.alertCon.appendChild(this.createImageElement("login/image_common_zz.png", "position: absolute;left:-120px;top:-140px;width:960px;height:1560px;opacity:0.7;", "bg")), 
                this.alertCon.appendChild(this.createImageElement("login/panel_xfy_gxbg.png", "position: absolute;left:29px;top:95px;width:662px;height:1090px;")), 
                this.alertTitle = this.createElement("label", "position:absolute;left:210px;top:146px;width:300px;height:35px;line-height:34px;text-align:center;color:#344a6f;font-size:32px;font-family:'SimHei';pointer-events:none;"), 
                this.alertCon.appendChild(this.alertTitle), this.alertContentDiv = this.createElement("div", "position:absolute;left:84px;top:210px;width:560px;height:910px;overflow-y:auto;overflow-x:hidden;", "alertContentDiv"), 
                this.alertCon.appendChild(this.alertContentDiv), this.alertContent = this.createElement("div", "position:absolute;left:2px;top:0px;width:544px;line-height:28px;color:#3a5385;font-size:26px;font-family:'SimHei';pointer-events:none;", "alertContent"), 
                this.alertContentDiv.appendChild(this.alertContent);
                var alertCloseBtn = this.createImageElement("login/btn_tongyong_13.png", "position: absolute;left:638px;top:110px;");
                this.alertCon.appendChild(alertCloseBtn), alertCloseBtn.onclick = this.closeAlert.bind(this), 
                tparams.control.privacyAlertButton && (this.alertYesBtn = this.createImageElement("login/btn_common_ty.png", "position: absolute;left:410px;top:1060px;visibility:hidden;"), 
                this.alertCon.appendChild(this.alertYesBtn), this.alertYesBtn.onclick = function() {
                    _this.changePrivacySelected(privacySelectImg_1, !0), _this.loginHandler();
                }, this.alertNoBtn = this.createImageElement("login/btn_common_nty.png", "position: absolute;left:150px;top:1060px;visibility:hidden;"), 
                this.alertCon.appendChild(this.alertNoBtn), this.alertNoBtn.onclick = function() {
                    _this.changePrivacySelected(privacySelectImg_1, !1), _this.closeAlert();
                });
                var clickEmpty = this.createElement("label", "position:absolute;left:180px;top:1180px;width:360px;height:35px;line-height:34px;text-align:center;color:#ffffff;font-size:28px;font-family:'SimHei';pointer-events:none;text-shadow: 0 1px 3px #797daf, 1px 0 3px #797daf, -1px 0 3px #797daf, 0 -1px 3px #797daf;");
                clickEmpty.innerText = "点击空白处退出", this.alertCon.appendChild(clickEmpty), this.alertCon.onclick = function(event) {
                    "bg" === event.target.id && _this.closeAlert();
                };
                var btnY = 60;
                this.repairBtn = this.createImageElement("login/btn_xfy_qhc.png", "position: absolute;left:620px;top:" + btnY + "px;"), 
                serverCon.appendChild(this.repairBtn), btnY += 110, this.repairBtn.onclick = function() {
                    if (window.indexedDB) try {
                        var delReq = window.indexedDB.deleteDatabase("routine");
                        delReq.onsuccess = function() {
                            _this.noticeTip("修复成功", "#50ff28");
                        }, delReq.onerror = function() {
                            _this.noticeTip("修复失败", "#ff3e3e");
                        };
                    } catch (e) {
                        e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
                        _this.noticeTip("修复失败!", "#ff3e3e");
                    } else _this.noticeTip("清理成功", "#50ff28");
                }, this.ggBtn = this.createImageElement("login/btn_xfy_gg.png", "position: absolute;left:620px;top:" + btnY + "px;"), 
                serverCon.appendChild(this.ggBtn), btnY += 110, this.ggBtn.onclick = this.openUpdateNotice.bind(this);
                var privacyNum = tparams.control.privacyNum;
                if (0 < privacyNum) {
                    var xyUrl = "changxiang" == tparams.channel ? "login/btn_xfy_yhxyyyszc.png" : "login/btn_xfy_ys.png";
                    this.xyBtn = this.createImageElement(xyUrl, "position: absolute;left:620px;top:" + btnY + "px;"), 
                    serverCon.appendChild(this.xyBtn), btnY += 110, this.xyBtn.onclick = this.openPrivacyPolicy.bind(this), 
                    "changxiang" == tparams.channel ? this.openPrivacyPolicy() : tparams.control.privacyAlert && tparams.isNewregister && this.openPrivacyPolicy();
                }
                0 < (tparams.control.agreementNum || 0) && (this.yhBtn = this.createImageElement("login/btn_xfy_xy.png", "position: absolute;left:620px;top:" + btnY + "px;"), 
                serverCon.appendChild(this.yhBtn), btnY += 110, this.yhBtn.onclick = this.openUserAgreement.bind(this)), 
                0 < (tparams.control.AntiAddictionNum || 0) && (this.antiAddictionBtn = this.createImageElement("login/btn_xfy_fcm.png", "position: absolute;left:620px;top:" + btnY + "px;"), 
                serverCon.appendChild(this.antiAddictionBtn), btnY += 110, this.antiAddictionBtn.onclick = this.openAntiAddition.bind(this)), 
                tparams.control.ageTipsIcon && (this.ageBtn = this.createImageElement("./login/image_age.png", "position: absolute;left:10px;top:133px;"), 
                this.ageBtn.onclick = function() {
                    _this.openAlert("适龄提示", "1)本游戏是一款玩法简单的仙侠类型的游戏,适用于年满16周岁及以上的用户,建议未成年人在家长监护下使用游戏产品。<br><br>\n                2)本游戏基于架空的故事背景和仙侠世界观,剧情简单且积极向上,没有基于真实历史和现实事件的改编内容,游戏中有基于文字的陌生人社交系统。<br><br>\n                3)本游戏中有用户实名认证系统,认证为未成年人的用户将接受以下管理:<br><br>\n                4）本游戏将大好山河景色融入游戏场景,让大家增强对祖国山河的热爱。人物设计、背景音乐等创作融入了中国神话故事元素,有助于传播中华传统文化。游戏设有组队模式,并设有大型团队任务和比赛,需要玩家互相配合完成比赛,有助于培养玩家的团队协作能力。<br><br>\n                游戏中部分玩法和道具需要付费。未满8周岁的用户不能付费；8周岁以上未满16周岁的未成年人用户,单次充值金额不得超过50元人民币,每月充值金额累计不得超过200元人民币；16周岁以上的未成年人用户,单次充值金额不得超过100元人民币,每月充值金额累计不得超过400元人民币。<br><br>\n                未成年人用户每日22点到次日8点不得使用,法定节假日每天不得使用超过3小时,其他时间每天不得使用超过1.5小时。<br>");
                }, serverCon.appendChild(this.ageBtn)), 0 < privacyNum && "changxiang" == tparams.channel || window.localStorage && window.localStorage.getItem("update_notice_ver") === this.updateNoticeVer || (window.localStorage && window.localStorage.setItem("update_notice_ver", this.updateNoticeVer), 
                this.openUpdateNotice()), serverCon.appendChild(this.serverListDiv), serverCon.appendChild(this.alertCon), 
                serverCon.appendChild(this.tipsLabel);
            }
        }
    },
    zoom: function() {
        var initW = window.innerWidth || document.body.clientWidth, initH = window.innerHeight || document.body.clientHeight;
        initW > screen.availWidth && (initW = screen.availWidth);
        var zoomW = initW / 720, zoomH = initH / 1280, zoom = zoomW < zoomH ? zoomW : zoomH;
        this.serverCon.style.webkitTransform = "scale(" + zoom + ")", this.serverCon.style.left = .5 * (initW - 720) + "px", 
        this.serverCon.style.top = .5 * (initH - 1280) + "px", this.bg1Con && (this.bg1Con.style.webkitTransform = "scale(" + zoom + ")", 
        this.bg1Con.style.left = .5 * (initW - 720) + "px", this.bg1Con.style.top = .5 * (initH - 1280) + "px"), 
        zoom = (zoomH = initH / 1280) < (zoomW = initW / 1920) ? zoomW : zoomH, this.background && (this.background.style.webkitTransform = "scale(" + zoom + ")", 
        this.background.style.left = .5 * (initW - 1920) + "px", this.background.style.top = .5 * (initH - 1280) + "px");
    },
    close: function() {
        window.onMiniGame || (window.removeEventListener("resize", this.zoom), this.serverCon && this.serverCon.remove()), 
        window.selectServerView = null;
    }
}, window.aaaaFlag = {}, window.aaaaFlag.compiled = 1, function() {
    var A = void 0, a = window;
    function e(e, t) {
        var r, i = e.split("."), n = a;
        i[0] in n || !n.execScript || n.execScript("var " + i[0]);
        for (;i.length && (r = i.shift()); ) i.length || t === A ? n = n[r] ? n[r] : n[r] = {} : n[r] = t;
    }
    var F = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array && "undefined" != typeof DataView;
    function S(e) {
        var t, r, i, n, a, o, s, l, d, h, f = e.length, p = 0, c = Number.POSITIVE_INFINITY;
        for (l = 0; l < f; ++l) e[l] > p && (p = e[l]), e[l] < c && (c = e[l]);
        for (t = 1 << p, r = new (F ? Uint32Array : Array)(t), i = 1, n = 0, a = 2; i <= p; ) {
            for (l = 0; l < f; ++l) if (e[l] === i) {
                for (s = n, d = o = 0; d < i; ++d) o = o << 1 | 1 & s, s >>= 1;
                for (h = i << 16 | l, d = o; d < t; d += a) r[d] = h;
                ++n;
            }
            ++i, n <<= 1, a <<= 1;
        }
        return [ r, p, c ];
    }
    function n(e, t) {
        switch (this.g = [], this.h = 32768, this.d = this.f = this.a = this.l = 0, this.input = F ? new Uint8Array(e) : e, 
        this.m = !1, this.i = E, this.r = !1, (t || (t = {}, 0)) && (t.index && (this.a = t.index), 
        t.bufferSize && (this.h = t.bufferSize), t.bufferType && (this.i = t.bufferType), 
        t.resize && (this.r = t.resize)), this.i) {
          case I:
            this.b = 32768, this.c = new (F ? Uint8Array : Array)(32768 + this.h + 258);
            break;

          case E:
            this.b = 0, this.c = new (F ? Uint8Array : Array)(this.h), this.e = this.z, this.n = this.v, 
            this.j = this.w;
            break;

          default:
            throw Error("invalid inflate mode");
        }
    }
    var I = 0, E = 1, t = I, r = E;
    n.prototype.k = function() {
        for (;!this.m; ) {
            var e = k(this, 3);
            switch (1 & e && (this.m = !0), e >>>= 1) {
              case 0:
                var t = this.input, r = this.a, i = this.c, n = this.b, a = t.length, o = A, s = i.length, l = A;
                if (this.d = this.f = 0, a <= r + 1) throw Error("invalid uncompressed block header: LEN");
                if (o = t[r++] | t[r++] << 8, a <= r + 1) throw Error("invalid uncompressed block header: NLEN");
                if (o === ~(t[r++] | t[r++] << 8)) throw Error("invalid uncompressed block header: length verify");
                if (r + o > t.length) throw Error("input buffer is broken");
                switch (this.i) {
                  case I:
                    for (;n + o > i.length; ) {
                        if (o -= l = s - n, F) i.set(t.subarray(r, r + l), n), n += l, r += l; else for (;l--; ) i[n++] = t[r++];
                        this.b = n, i = this.e(), n = this.b;
                    }
                    break;

                  case E:
                    for (;n + o > i.length; ) i = this.e({
                        p: 2
                    });
                    break;

                  default:
                    throw Error("invalid inflate mode");
                }
                if (F) i.set(t.subarray(r, r + o), n), n += o, r += o; else for (;o--; ) i[n++] = t[r++];
                this.a = r, this.b = n, this.c = i;
                break;

              case 1:
                this.j(U, _);
                break;

              case 2:
                var d, h, f, p, c = k(this, 5) + 257, u = k(this, 5) + 1, g = k(this, 4) + 4, w = new (F ? Uint8Array : Array)(P.length), m = A, y = A, b = A, v = A, x = A;
                for (x = 0; x < g; ++x) w[P[x]] = k(this, 3);
                if (!F) for (x = g, g = w.length; x < g; ++x) w[P[x]] = 0;
                for (d = S(w), m = new (F ? Uint8Array : Array)(c + u), x = 0, p = c + u; x < p; ) switch (y = B(this, d), 
                y) {
                  case 16:
                    for (v = 3 + k(this, 2); v--; ) m[x++] = b;
                    break;

                  case 17:
                    for (v = 3 + k(this, 3); v--; ) m[x++] = 0;
                    b = 0;
                    break;

                  case 18:
                    for (v = 11 + k(this, 7); v--; ) m[x++] = 0;
                    b = 0;
                    break;

                  default:
                    b = m[x++] = y;
                }
                h = S(F ? m.subarray(0, c) : m.slice(0, c)), f = S(F ? m.subarray(c) : m.slice(c)), 
                this.j(h, f);
                break;

              default:
                throw Error("unknown BTYPE: " + e);
            }
        }
        return this.n();
    };
    var i, o, s = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ], P = F ? new Uint16Array(s) : s, l = [ 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 ], d = F ? new Uint16Array(l) : l, h = [ 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 ], f = F ? new Uint8Array(h) : h, p = [ 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 ], c = F ? new Uint16Array(p) : p, u = [ 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 ], g = F ? new Uint8Array(u) : u, w = new (F ? Uint8Array : Array)(288);
    for (i = 0, o = w.length; i < o; ++i) w[i] = i <= 143 ? 8 : i <= 255 ? 9 : i <= 279 ? 7 : 8;
    var m, y, U = S(w), b = new (F ? Uint8Array : Array)(30);
    for (m = 0, y = b.length; m < y; ++m) b[m] = 5;
    var _ = S(b);
    function k(e, t) {
        for (var r, i = e.f, n = e.d, a = e.input, o = e.a, s = a.length; n < t; ) {
            if (s <= o) throw Error("input buffer is broken");
            i |= a[o++] << n, n += 8;
        }
        return r = i & (1 << t) - 1, e.f = i >>> t, e.d = n - t, e.a = o, r;
    }
    function B(e, t) {
        for (var r, i, n = e.f, a = e.d, o = e.input, s = e.a, l = o.length, d = t[0], h = t[1]; a < h && !(l <= s); ) n |= o[s++] << a, 
        a += 8;
        if (a < (i = (r = d[n & (1 << h) - 1]) >>> 16)) throw Error("invalid code length: " + i);
        return e.f = n >> i, e.d = a - i, e.a = s, 65535 & r;
    }
    function v(e, t) {
        var r, i;
        switch (this.input = e, this.a = 0, (t || (t = {}, 0)) && (t.index && (this.a = t.index), 
        t.verify && (this.A = t.verify)), r = e[this.a++], i = e[this.a++], 15 & r) {
          case x:
            this.method = x;
            break;

          default:
            throw Error("unsupported compression method");
        }
        if (0 != ((r << 8) + i) % 31) throw Error("invalid fcheck flag:" + ((r << 8) + i) % 31);
        if (32 & i) throw Error("fdict flag is not supported");
        this.q = new n(e, {
            index: this.a,
            bufferSize: t.bufferSize,
            bufferType: t.bufferType,
            resize: t.resize
        });
    }
    n.prototype.j = function(e, t) {
        var r = this.c, i = this.b;
        this.o = e;
        for (var n, a, o, s, l = r.length - 258; 256 !== (n = B(this, e)); ) if (n < 256) l <= i && (this.b = i, 
        r = this.e(), i = this.b), r[i++] = n; else for (s = d[a = n - 257], 0 < f[a] && (s += k(this, f[a])), 
        n = B(this, t), o = c[n], 0 < g[n] && (o += k(this, g[n])), l <= i && (this.b = i, 
        r = this.e(), i = this.b); s--; ) r[i] = r[i++ - o];
        for (;8 <= this.d; ) this.d -= 8, this.a--;
        this.b = i;
    }, n.prototype.w = function(e, t) {
        var r = this.c, i = this.b;
        this.o = e;
        for (var n, a, o, s, l = r.length; 256 !== (n = B(this, e)); ) if (n < 256) l <= i && (l = (r = this.e()).length), 
        r[i++] = n; else for (s = d[a = n - 257], 0 < f[a] && (s += k(this, f[a])), n = B(this, t), 
        o = c[n], 0 < g[n] && (o += k(this, g[n])), l < i + s && (l = (r = this.e()).length); s--; ) r[i] = r[i++ - o];
        for (;8 <= this.d; ) this.d -= 8, this.a--;
        this.b = i;
    }, n.prototype.e = function() {
        var e, t, r = new (F ? Uint8Array : Array)(this.b - 32768), i = this.b - 32768, n = this.c;
        if (F) r.set(n.subarray(32768, r.length)); else for (e = 0, t = r.length; e < t; ++e) r[e] = n[e + 32768];
        if (this.g.push(r), this.l += r.length, F) n.set(n.subarray(i, 32768 + i)); else for (e = 0; e < 32768; ++e) n[e] = n[i + e];
        return this.b = 32768, n;
    }, n.prototype.z = function(e) {
        var t, r, i, n = this.input.length / this.a + 1 | 0, a = this.input, o = this.c;
        return e && ("number" == typeof e.p && (n = e.p), "number" == typeof e.u && (n += e.u)), 
        r = n < 2 ? (i = (a.length - this.a) / this.o[2] / 2 * 258 | 0) < o.length ? o.length + i : o.length << 1 : o.length * n, 
        F ? (t = new Uint8Array(r)).set(o) : t = o, this.c = t;
    }, n.prototype.n = function() {
        var e, t, r, i, n, a = 0, o = this.c, s = this.g, l = new (F ? Uint8Array : Array)(this.l + (this.b - 32768));
        if (0 === s.length) return F ? this.c.subarray(32768, this.b) : this.c.slice(32768, this.b);
        for (t = 0, r = s.length; t < r; ++t) for (i = 0, n = (e = s[t]).length; i < n; ++i) l[a++] = e[i];
        for (t = 32768, r = this.b; t < r; ++t) l[a++] = o[t];
        return this.g = [], this.buffer = l;
    }, n.prototype.v = function() {
        var e, t = this.b;
        return F ? this.r ? (e = new Uint8Array(t)).set(this.c.subarray(0, t)) : e = this.c.subarray(0, t) : (this.c.length > t && (this.c.length = t), 
        e = this.c), this.buffer = e;
    }, v.prototype.k = function() {
        var e, t, r = this.input;
        if (e = this.q.k(), this.a = this.q.a, this.A) {
            t = (r[this.a++] << 24 | r[this.a++] << 16 | r[this.a++] << 8 | r[this.a++]) >>> 0;
            var i = e;
            if ("string" == typeof i) {
                var n, a, o = i.split("");
                for (n = 0, a = o.length; n < a; n++) o[n] = (255 & o[n].charCodeAt(0)) >>> 0;
                i = o;
            }
            for (var s, l = 1, d = 0, h = i.length, f = 0; 0 < h; ) {
                for (h -= s = 1024 < h ? 1024 : h; d += l += i[f++], --s; ) ;
                l %= 65521, d %= 65521;
            }
            if (t != (d << 16 | l) >>> 0) throw Error("invalid adler-32 checksum");
        }
        return e;
    };
    var x = 8;
    e("Zlib.Inflate", v), e("Zlib.Inflate.prototype.decompress", v.prototype.k);
    var T, M, L, C, j = {
        ADAPTIVE: r,
        BLOCK: t
    };
    if (Object.keys) T = Object.keys(j); else for (M in T = [], L = 0, j) T[L++] = M;
    for (L = 0, C = T.length; L < C; ++L) e("Zlib.Inflate.BufferType." + (M = T[L]), j[M]);
}.call(this), function() {
    var c = [], u = new Uint8Array(8), g = new DataView(u.buffer);
    function e(e) {
        var i = 4294967296, n = new Uint8Array(128), a = 0;
        return o(e), n.subarray(0, a);
        function o(e) {
            switch (typeof e) {
              case "undefined":
                t();
                break;

              case "boolean":
                s(e ? 195 : 194);
                break;

              case "number":
                !function(e) {
                    if (isFinite(e) && Math.floor(e) === e) if (0 <= e && e <= 127) s(e); else if (e < 0 && -32 <= e) s(e); else if (0 < e && e <= 255) l([ 204, e ]); else if (-128 <= e && e <= 127) l([ 208, e ]); else if (0 < e && e <= 65535) l([ 205, e >>> 8, e ]); else if (-32768 <= e && e <= 32767) l([ 209, e >>> 8, e ]); else if (0 < e && e <= 4294967295) l([ 206, e >>> 24, e >>> 16, e >>> 8, e ]); else if (-2147483648 <= e && e <= 2147483647) l([ 210, e >>> 24, e >>> 16, e >>> 8, e ]); else if (0 < e && e <= 0x10000000000000000) {
                        var t = e / i, r = e % i;
                        l([ 211, t >>> 24, t >>> 16, t >>> 8, t, r >>> 24, r >>> 16, r >>> 8, r ]);
                    } else -0x8000000000000000 <= e && e <= 0x8000000000000000 ? (s(211), d(e)) : l(e < 0 ? [ 211, 128, 0, 0, 0, 0, 0, 0, 0 ] : [ 207, 255, 255, 255, 255, 255, 255, 255, 255 ]); else g.setFloat64(0, e), 
                    s(203), l(u);
                }(e);
                break;

              case "string":
                !function(e) {
                    var t = function(e) {
                        for (var t = !0, r = e.length, i = 0; i < r; i++) if (127 < e.charCodeAt(i)) {
                            t = !1;
                            break;
                        }
                        for (var n = 0, a = new Uint8Array(e.length * (t ? 1 : 4)), o = 0; o !== r; o++) {
                            var s = e.charCodeAt(o);
                            if (s < 128) a[n++] = s; else {
                                if (s < 2048) a[n++] = s >> 6 | 192; else {
                                    if (55295 < s && s < 56320) {
                                        if (++o >= r) throw new Error("UTF-8 encode: incomplete surrogate pair");
                                        var l = e.charCodeAt(o);
                                        if (l < 56320 || 57343 < l) throw new Error("UTF-8 encode: second surrogate character 0x" + l.toString(16) + " at index " + o + " out of range");
                                        s = 65536 + ((1023 & s) << 10) + (1023 & l), a[n++] = s >> 18 | 240, a[n++] = s >> 12 & 63 | 128;
                                    } else a[n++] = s >> 12 | 224;
                                    a[n++] = s >> 6 & 63 | 128;
                                }
                                a[n++] = 63 & s | 128;
                            }
                        }
                        return t ? a : a.subarray(0, n);
                    }(e), r = t.length;
                    r <= 31 ? s(160 + r) : l(r <= 255 ? [ 217, r ] : r <= 65535 ? [ 218, r >>> 8, r ] : [ 219, r >>> 24, r >>> 16, r >>> 8, r ]), 
                    l(t);
                }(e);
                break;

              case "object":
                null === e ? t() : e instanceof Date ? function(e) {
                    var t = e.getTime() / 1e3;
                    if (0 === e.getMilliseconds() && 0 <= t && t < 4294967296) l([ 214, 255, t >>> 24, t >>> 16, t >>> 8, t ]); else if (0 <= t && t < 17179869184) l([ 215, 255, (r = 1e6 * e.getMilliseconds()) >>> 22, r >>> 14, r >>> 6, r << 2 >>> 0 | t / i, t >>> 24, t >>> 16, t >>> 8, t ]); else {
                        var r;
                        l([ 199, 12, 255, (r = 1e6 * e.getMilliseconds()) >>> 24, r >>> 16, r >>> 8, r ]), 
                        d(t);
                    }
                }(e) : Array.isArray(e) ? r(e) : e instanceof Uint8Array || e instanceof Uint8ClampedArray ? function(e) {
                    var t = e.length;
                    l(t <= 255 ? [ 196, t ] : t <= 65535 ? [ 197, t >>> 8, t ] : [ 198, t >>> 24, t >>> 16, t >>> 8, t ]), 
                    l(e);
                }(e) : e instanceof Int8Array || e instanceof Int16Array || e instanceof Uint16Array || e instanceof Int32Array || e instanceof Uint32Array || e instanceof Float32Array || e instanceof Float64Array ? r(e) : function(e) {
                    var t = 0;
                    for (var r in e) t++;
                    for (var r in t <= 15 ? s(128 + t) : l(t <= 65535 ? [ 222, t >>> 8, t ] : [ 223, t >>> 24, t >>> 16, t >>> 8, t ]), 
                    e) o(r), o(e[r]);
                }(e);
            }
        }
        function t() {
            s(192);
        }
        function r(e) {
            var t = e.length;
            t <= 15 ? s(144 + t) : l(t <= 65535 ? [ 220, t >>> 8, t ] : [ 221, t >>> 24, t >>> 16, t >>> 8, t ]);
            for (var r = 0; r < t; r++) o(e[r]);
        }
        function s(e) {
            if (n.length < a + 1) {
                for (var t = 2 * n.length; t < a + 1; ) t *= 2;
                var r = new Uint8Array(t);
                r.set(n), n = r;
            }
            n[a] = e, a++;
        }
        function l(e) {
            if (n.length < a + e.length) {
                for (var t = 2 * n.length; t < a + e.length; ) t *= 2;
                var r = new Uint8Array(t);
                r.set(n), n = r;
            }
            n.set(e, a), a += e.length;
        }
        function d(e) {
            var t, r;
            r = 0 <= e ? (t = e / i, e % i) : (e++, t = ~(t = Math.abs(e) / i), ~(r = Math.abs(e) % i)), 
            l([ t >>> 24, t >>> 16, t >>> 8, t, r >>> 24, r >>> 16, r >>> 8, r ]);
        }
    }
    function t(n) {
        var a = 4294967296, o = 0;
        if (n instanceof ArrayBuffer && (n = new Uint8Array(n)), "object" != typeof n || void 0 === n.length) throw new Error("Invalid argument type: Expected a byte array (Array or Uint8Array) to deserialize.");
        if (!n.length) throw new Error("Invalid argument: The byte array to deserialize is empty.");
        n instanceof Uint8Array || (n = new Uint8Array(n));
        var e = s();
        return n.length, e;
        function s() {
            var e = n[o++];
            if (0 <= e && e <= 127) return e;
            if (128 <= e && e <= 143) return r(e - 128);
            if (144 <= e && e <= 159) return i(e - 144);
            if (160 <= e && e <= 191) return f(e - 160);
            if (192 === e) return null;
            if (193 === e) throw new Error("Invalid byte code 0xc1 found.");
            if (194 === e) return !1;
            if (195 === e) return !0;
            if (196 === e) return h(-1, 1);
            if (197 === e) return h(-1, 2);
            if (198 === e) return h(-1, 4);
            if (199 === e) return p(-1, 1);
            if (200 === e) return p(-1, 2);
            if (201 === e) return p(-1, 4);
            if (202 === e) return t(4);
            if (203 === e) return t(8);
            if (204 === e) return d(1);
            if (205 === e) return d(2);
            if (206 === e) return d(4);
            if (207 === e) return d(8);
            if (208 === e) return l(1);
            if (209 === e) return l(2);
            if (210 === e) return l(4);
            if (211 === e) return l(8);
            if (212 === e) return p(1);
            if (213 === e) return p(2);
            if (214 === e) return p(4);
            if (215 === e) return p(8);
            if (216 === e) return p(16);
            if (217 === e) return f(-1, 1);
            if (218 === e) return f(-1, 2);
            if (219 === e) return f(-1, 4);
            if (220 === e) return i(-1, 2);
            if (221 === e) return i(-1, 4);
            if (222 === e) return r(-1, 2);
            if (223 === e) return r(-1, 4);
            if (224 <= e && e <= 255) return e - 256;
            throw new Error("Invalid byte value '" + e + "' at index " + (o - 1) + " in the MessagePack binary data (length " + n.length + "): Expecting a range of 0 to 255. This is not a byte array.");
        }
        function l(e) {
            for (var t = 0, r = !0; 0 < e--; ) if (r) {
                var i = n[o++];
                t += 127 & i, 128 & i && (t -= 128), r = !1;
            } else t *= 256, t += n[o++];
            return t;
        }
        function d(e) {
            for (var t = 0; 0 < e--; ) t *= 256, t += n[o++];
            return t;
        }
        function t(e) {
            for (var t = 0; t < e; ++t) u[t] = n[o++];
            return 4 === e ? g.getFloat32(0) : g.getFloat64(0);
        }
        function h(e, t) {
            e < 0 && (e = d(t));
            var r = new Uint8Array(e);
            return r.set(n.subarray(o, o + e)), o += e, r;
        }
        function r(e, t) {
            e < 0 && (e = d(t));
            for (var r = {}; 0 < e--; ) r[s()] = s();
            return r;
        }
        function i(e, t) {
            e < 0 && (e = d(t));
            for (var r = new Array(e), i = 0; 0 < e--; ) r[i++] = s();
            return r;
        }
        function f(e, t) {
            e < 0 && (e = d(t));
            var r = o;
            return o += e, function(e, t, r) {
                c.length = 0;
                var i = t;
                for (r += t; i < r; ) {
                    var n = e[i++];
                    if (127 < n) if (191 < n && n < 224) {
                        if (r <= i) throw new Error("UTF-8 decode: incomplete 2-byte sequence");
                        n = (31 & n) << 6 | 63 & e[i++];
                    } else if (223 < n && n < 240) {
                        if (r <= i + 1) throw new Error("UTF-8 decode: incomplete 3-byte sequence");
                        n = (15 & n) << 12 | (63 & e[i++]) << 6 | 63 & e[i++];
                    } else {
                        if (!(239 < n && n < 248)) throw new Error("UTF-8 decode: unknown multibyte start 0x" + n.toString(16) + " at index " + (i - 1));
                        if (r <= i + 2) throw new Error("UTF-8 decode: incomplete 4-byte sequence");
                        n = (7 & n) << 18 | (63 & e[i++]) << 12 | (63 & e[i++]) << 6 | 63 & e[i++];
                    }
                    if (n <= 65535) c.push(n); else {
                        if (!(n <= 1114111)) throw new Error("UTF-8 decode: code point 0x" + n.toString(16) + " exceeds UTF-16 reach");
                        n -= 65536, c.push(n >> 10 | 55296), c.push(1023 & n | 56320);
                    }
                }
                var a = String.fromCharCode.apply(String, c);
                return c.length = 0, a;
            }(n, r, e);
        }
        function p(e, t) {
            e < 0 && (e = d(t));
            var r = d(1), i = h(e);
            switch (r) {
              case 255:
                return function(e) {
                    if (4 === e.length) {
                        var t = (e[0] << 24 >>> 0) + (e[1] << 16 >>> 0) + (e[2] << 8 >>> 0) + e[3];
                        return new Date(1e3 * t);
                    }
                    if (8 === e.length) {
                        var r = (e[0] << 22 >>> 0) + (e[1] << 14 >>> 0) + (e[2] << 6 >>> 0) + (e[3] >>> 2);
                        return t = (3 & e[3]) * a + (e[4] << 24 >>> 0) + (e[5] << 16 >>> 0) + (e[6] << 8 >>> 0) + e[7], 
                        new Date(1e3 * t + r / 1e6);
                    }
                    if (12 !== e.length) throw new Error("Invalid data length for a date value.");
                    return r = (e[0] << 24 >>> 0) + (e[1] << 16 >>> 0) + (e[2] << 8 >>> 0) + e[3], o -= 8, 
                    t = l(8), new Date(1e3 * t + r / 1e6);
                }(i);
            }
            return {
                type: r,
                data: i
            };
        }
    }
    var r = {
        serialize: e,
        deserialize: t,
        encode: e,
        decode: t
    };
    "object" == typeof module && module && "object" == typeof gmodule.exports ? gmodule.exports = r : window[window.msgpackJsName || "msgpack"] = r, 
    window.msgpack = r;
}();

var versions = {}, resVer = 0, codeVer = 0, loadingView = {
    bg: null,
    progressBg1: null,
    progressBar1: null,
    progressBg2: null,
    progressBar2: null,
    proLabel: null,
    proLabel1: null,
    proLabel2: null,
    createElement: function(e, t, r) {
        var i = document.createElement(e);
        return r && (i.id = r), i.style.cssText = t, i;
    },
    createImageElement: function(e, t, r, i) {
        void 0 === i && (i = !1);
        var n = this.createElement("img", t, r), a = versions[e], o = i && tparams.preCdn ? tparams.preCdn + "login/" : tparams.cdn;
        return n.src = a ? "" + o + e + "?v=" + a : "" + o + e, n;
    },
    appendProgress: function(e) {
        for (var t = [ [ "progress_jz_jdt2_0.png", "position:absolute;left:0px;top:0px;width:720px;height:56px;", "progressBg1" ], [ "progress_jz_jdt_1.png", "position:absolute;left:60px;top:20px;width:596px;height:16px;", "progressBar1" ], [ "progress_jz_jdt1_0.png", "position:absolute;left:0px;top:50px;width:720px;height:56px;", "progressBg2" ], [ "progress_jz_jdt_1.png", "position:absolute;left:60px;top:70px;width:596px;height:16px;", "progressBar2" ] ], r = 0, i = t.length; r < i; ++r) this[(o = t[r])[2]] = e.appendChild(this.createImageElement.apply(this, o));
        for (var n = [ [ "proLabel", "position:absolute;left:10px;top:-18px;width:700px;text-align:center;color:#FFF8D7;font-size:24px;font-family:'SimHei';text-shadow: 0 1px 3px #A56A3E, 1px 0 3px #A56A3E, -1px 0 3px #A56A3E, 0 -1px 3px #A56A3E" ], [ "proLabel1", "position:absolute;left:10px;top:17px;width:700px;text-align:center;color:#FFFFFF;font-size:22px;font-family:'SimHei';text-shadow: 0 1px 3px #430B51, 1px 0 3px #430B51, -1px 0 3px #430B51, 0 -1px 3px #430B51" ], [ "proLabel2", "position:absolute;left:10px;top:67px;width:700px;text-align:center;color:#FFFFFF;font-size:22px;font-family:'SimHei';text-shadow: 0 1px 3px #430B51, 1px 0 3px #430B51, -1px 0 3px #430B51, 0 -1px 3px #430B51" ] ], a = (r = 0, 
        n.length); r < a; ++r) {
            var o;
            this[(o = n[r])[0]] = e.appendChild(this.createElement("label", o[1], o[0]));
        }
    },
    appendCopyright: function(e) {
        var t = [ "首次加载耗时较长，再等等就好了哦~", "抵制不良游戏，拒绝盗版游戏。注意自我保护，谨防受骗上当。", "适度游戏益脑，沉迷游戏伤身。合理安排时间，享受健康生活。", "本公司积极履行《网络游戏行业防沉迷自律公约》", "审批文号：国新出审[2019]3602号，著作权人：成都玖壹叁零网络科技有限公司，", "出版单位：上海同济大学电子音像出版社有限公司，出版物号：ISBN 978-7-498-07182-8", "游戏版本：" + resVer + "." + codeVer ];
        511045 === tparams.package && (t[4] = "审批文号：新广出审[2014]1245号，著作权人：上海甲游网络科技有限公司", 
        t[5] = "出版单位：杭州群游科技有限公司，出版物号：ISBN 978-7-89988-123-1"), tparams.control.miniGameCopyright1 && "" != tparams.control.miniGameCopyright1 && (t[4] = tparams.control.miniGameCopyright1), 
        tparams.control.miniGameCopyright2 && "" != tparams.control.miniGameCopyright2 && (t[5] = tparams.control.miniGameCopyright2);
        for (var r = [ "position:absolute;left:0px;top:90px;width:720px;text-align:center;color:#FFACAC;font-size:20px;font-family:'SimHei';", "position:absolute;left:0px;top:120px;width:720px;text-align:center;color:#eaf8ff;font-size:20px;font-family:'SimHei';", "position:absolute;left:0px;top:144px;width:720px;text-align:center;color:#eaf8ff;font-size:20px;font-family:'SimHei';", "position:absolute;left:0px;top:171px;width:720px;text-align:center;color:#eaf8ff;font-size:20px;font-family:'SimHei';visibility:" + (1 == tparams.control.showAppoint ? "visible" : "hidden"), "position:absolute;left:0px;top:198px;width:720px;text-align:center;color:#eaf8ff;font-size:16px;font-family:'SimHei';", "position:absolute;left:0px;top:218px;width:720px;text-align:center;color:#eaf8ff;font-size:16px;font-family:'SimHei';", "position:absolute;left:0px;top:238px;width:720px;text-align:center;color:#eaf8ff;font-size:16px;font-family:'SimHei';" ], i = 0, n = t.length; i < n; ++i) {
            var a = this.createElement("label", r[i]);
            a.innerText = t[i], e.appendChild(a);
        }
    },
    appendProgressDiv: function(e) {
        var t = this.createElement("div", "position:absolute;width:720px;heigh:100px;bottom:260px;", "proDiv");
        this.appendProgress(t), this.appendCopyright(t), e.appendChild(t);
    },
    changeBackground: function() {
        var e = "image_loading_bg_2.jpg", t = versions[e];
        this.bg.src = t ? tparams.cdn + e + "?v=" + t : tparams.cdn + e;
    },
    removeScrollDiv: function() {
        var e = document.getElementById("con");
        e && e.remove(), (e = document.getElementById("background")) && e.remove(), (e = document.getElementById("bg1Con")) && e.remove();
    },
    init: function() {
        document.body.style.cssText = "position:fixed;margin:0;overflow:hidden;overflow-x:hidden;overflow-y:hidden;background-color:#000000;";
        var a = this.createElement("div", "position:absolute;height:1280px;width:720px;visibility:visible", "con");
        tparams.control && tparams.control.fullScreenBg || (this.bg = this.createImageElement("image_loading_bg" + (tparams.control && tparams.control.bg || "0") + ".jpg", "position: absolute;left:-120px;top:50%;transform:translateY(-50%);", "loadingBg", !0), 
        a.appendChild(this.bg)), this.appendProgressDiv(a), document.body.appendChild(a), 
        document.body.addEventListener("touchmove", function(e) {
            e.preventDefault();
        });
        var o = document.getElementById("background"), s = document.getElementById("bg1Con");
        function e() {
            var e = window.innerWidth || document.body.clientWidth, t = window.innerHeight || document.body.clientHeight;
            e > screen.availWidth && (e = screen.availWidth);
            var r = e / 720, i = t / 1280, n = r < i ? r : i;
            a.style.webkitTransform = "scale(" + n + ")", a.style.left = .5 * (e - 720) + "px", 
            a.style.top = .5 * (t - 1280) + "px", s && (s.style.webkitTransform = "scale(" + n + ")", 
            s.style.left = .5 * (e - 720) + "px", s.style.top = .5 * (t - 1280) + "px"), n = (i = t / 1280) < (r = e / 1920) ? r : i, 
            o && (o.style.webkitTransform = "scale(" + n + ")", o.style.left = .5 * (e - 1920) + "px", 
            o.style.top = .5 * (t - 1280) + "px");
        }
        e(), window.addEventListener("resize", e);
    }
};

window.nameGenerator = {
    familyNames: [ "赵", "蒋", "孔", "柏", "鲁", "滕", "皮", "和", "米", "熊", "席", "梅", "樊", "经", "郁", "程", "甄", "井", "车", "宁", "景", "印", "卓", "闻", "冉", "边", "柴", "向", "都", "欧", "晁", "曾", "查", "万俟", "澹台", "", "钟离", "寸", "翠", "富察", "税", "泰", "求", "旁", "禾", "冒", "悟", "苟", "佼", "旷", "叔", "焉", "肇", "徭", "郯", "锁", "磨", "同", "卷", "斯", "户", "寒", "揭", "弥", "塔", "腾", "濯", "驹", "鲜", "门", "载", "修", "五", "丘", "让", "零", "励", "原", "竹", "南宫", "后", "百里", "壤驷", "鲜于", "公良", "钱", "沈", "曹", "水", "韦", "鲍", "殷", "卞", "穆", "贝", "纪", "季", "盛", "胡", "房", "单", "嵇", "段", "侯", "仇", "詹", "宿", "蔺", "莘", "宰", "扈", "瞿", "古", "耿", "勾", "毋", "司马", "公冶", "宇文", "贰", "狂", "费莫", "荤", "秘", "羽", "崇", "保", "宏", "随", "玄", "遇", "圣", "戏", "资", "蛮", "邗", "钟", "完", "闭", "少", "祈", "阿", "琦", "潮", "沐", "骑", "粟", "盈", "声", "信", "令", "义", "尧", "谌", "粘", "考", "百", "赏", "况", "钦", "乐正", "锺离", "孙", "韩", "严", "窦", "昌", "史", "齐", "萧", "明", "舒", "麻", "林", "凌", "裘", "杭", "邢", "家", "富", "宓", "栾", "束", "白", "屠", "郦", "燕", "阎", "易", "满", "沃", "敖", "沙", "荆", "上官", "宗政", "长孙", "皇", "辟", "蹇", "靖", "亥", "用", "栋", "功", "类", "乘", "偶", "御", "可", "合", "汗", "机", "瓮", "止", "谬", "丹", "才", "析", "素", "闪", "镜", "茂", "貊", "栗", "庆", "漫", "闽", "将", "礼", "依", "招", "萨", "妫", "福", "伯", "亢", "鄢", "漆雕", "盖", "开", "李", "杨", "华", "章", "马", "唐", "毕", "康", "尹", "臧", "屈", "强", "刁", "霍", "缪", "洪", "滑", "封", "巫", "蓬", "暴", "龙", "怀", "蒙", "翟", "雍", "冀", "充", "慎", "弘", "利", "融", "乜", "红", "欧阳", "濮阳", "慕容", "侨", "典", "称", "绪", "绍", "占", "告", "委", "抄", "庚", "卯", "裔", "前", "夫", "智", "仍", "孛", "剑", "盘", "弭", "戢", "表", "无", "桥", "赤", "长", "始", "似", "英", "虎", "豆", "喜", "犁", "北", "旗", "慈", "犹", "续", "邝", "纳", "言", "佴", "缑", "汝", "公西", "逯", "光", "周", "朱", "金", "云", "苗", "费", "郝", "伍", "姚", "计", "项", "贾", "锺", "虞", "包", "裴", "芮", "乌", "全", "甘", "叶", "蒲", "池", "谭", "却", "僪", "慕", "戈", "匡", "蔚", "冷", "养", "游", "夏侯", "淳于", "司徒", "彤", "良", "诺", "愈", "以", "真", "休", "钊", "定", "务", "俟", "延", "由", "仆", "尔", "九", "乾", "铎", "刀", "睢", "赧", "聊", "书", "板", "紫", "僧", "星", "澄", "兰", "肥", "帛", "及", "力", "守", "军", "孝", "介", "达", "覃", "泉", "第五", "佘", "帅", "法", "巫马", "库", "频", "化", "敏", "友", "植", "咎", "镇", "凭", "衷", "帖", "隋", "斛", "疏", "冼", "浮", "源", "学", "斐", "青", "隐", "南", "潭", "檀", "鹿", "官", "普", "贸", "坚", "行", "理", "承", "忻", "辜", "老", "佟", "牟", "微生", "闫", "端木", "郏", "瑞", "郑", "尤", "陶", "潘", "花", "岑", "安", "元", "湛", "成", "董", "娄", "邱", "支", "应", "左", "荣", "储", "巴", "班", "历", "司", "从", "阳", "劳", "桑", "尚", "茹", "庾", "文", "夔", "辛", "须", "权", "闻人", "太叔", "召", "端", "芒", "多", "牢", "森", "翦", "谏", "嬴", "莱", "捷", "答", "环", "塞", "藩", "悉", "哀", "罕", "蒿", "玉", "牵", "种", "顿", "姓", "愚", "独", "柔", "仙", "天", "謇", "藤", "雀", "布", "建", "勤", "勇", "奉", "伦", "市", "六", "初", "清", "爱", "商", "羊舌", "楚", "逢", "眭", "王", "许", "姜", "葛", "方", "薛", "常", "卜", "汪", "戴", "梁", "危", "骆", "柯", "宗", "石", "翁", "靳", "弓", "仰", "戎", "韶", "鄂", "逄", "桂", "农", "习", "终", "寇", "隆", "阚", "丰", "逮", "东方", "申屠", "有", "赫", "苦", "繁", "买", "斋", "闾", "锐", "呼", "校", "拱", "乙", "矫", "敛", "邸", "进", "刑", "洛", "茆", "线", "浑", "涂", "说", "吾", "本", "千", "刚", "隽", "接", "纵", "枝", "野", "衣", "营", "革", "汉", "敬", "卿", "所", "鄞", "楼", "德", "年", "西门", "海", "晋", "子车", "阴", "泥", "冯", "何", "戚", "奚", "俞", "雷", "乐", "顾", "祁", "谈", "杜", "江", "高", "昝", "丁", "崔", "荀", "汲", "牧", "秋", "祖", "郜", "索", "胥", "姬", "濮", "温", "宦", "暨", "广", "师", "那", "巢", "盍", "赫连", "公孙", "舜", "实", "其", "戊", "但", "释", "漆", "皋", "大", "么", "兆", "允", "赛", "受", "府", "笃", "俎", "淦", "菅", "针", "恽", "肖", "次", "寻", "性", "诗", "奇", "宇", "波", "渠", "检", "禽", "藏", "巨", "改", "练", "恭", "问", "苑", "战", "城", "卑", "笪", "东门", "归", "谷梁", "督", "薄", "运", "陈", "吕", "谢", "范", "任", "贺", "于", "孟", "毛", "宋", "阮", "童", "夏", "管", "宣", "吉", "羊", "邴", "隗", "仲", "武", "黎", "咸", "能", "申", "牛", "别", "艾", "居", "禄", "巩", "简", "关", "益", "皇甫", "仲孙", "甫", "京", "朴", "巧", "奕", "贵", "闳", "威", "抗", "丑", "甲", "昔", "泷", "掌", "厚", "仵", "洋", "苌", "箕", "势", "己", "错", "展", "雪", "嘉", "拜", "祭", "碧", "奈", "生", "飞", "宝", "望", "兴", "尉", "仪", "永", "杞", "迟", "区", "过", "谯", "左丘", "呼延", "宰父", "仉", "厉", "摩", "褚", "施", "邹", "彭", "袁", "倪", "时", "平", "禹", "茅", "蓝", "颜", "蔡", "卢", "贲", "钮", "於", "糜", "山", "伊", "符", "蓟", "籍", "苍", "扶", "寿", "庄", "鱼", "衡", "阙", "厍", "饶", "蒯", "桓", "尉迟", "令狐", "丛", "集", "中", "回", "枚", "姒", "代", "在", "昂", "祢", "丙", "留", "侍", "袭", "首", "仁", "圭", "邶", "树", "庹", "世", "泣", "念", "出", "霜", "扬", "佛", "酒", "速", "风", "折", "节", "钞", "希", "亓", "士", "母", "辉", "剧", "候", "局", "麦", "哈", "梁丘", "南门", "夹谷", "司寇", "稽", "伟", "卫", "张", "喻", "郎", "柳", "汤", "傅", "狄", "庞", "闵", "郭", "田", "莫", "邓", "龚", "惠", "松", "谷", "宫", "刘", "溥", "赖", "双", "堵", "通", "晏", "容", "步", "东", "聂", "空", "相", "公", "公羊", "轩辕", "岳", "象", "夕", "毓", "撒", "朋", "贯", "歧", "律", "畅", "尾", "度", "衅", "员", "业", "夷", "郸", "桐", "绳", "仝", "潜", "夙", "不", "烟", "善", "陀", "淡", "禚", "春", "登", "宜", "银", "道", "睦", "旅", "堂", "位", "第", "宛", "台", "曲", "墨", "琴", "东郭", "拓跋", "亓官", "闾丘", "铁" ],
    symbols: [ "℡", "°", "i", "◤", "♛", "じ", "▃", "╋", "﹏", "☆", "╮", "╰", "う", "━", "※", "∝", "★", "≡", "╩", "╓", "╗", "╚", "◥", "¤", "№", "§", "∮", "√", "◆", "▔", "◢", "◣", "、", "·", "╝", "╔", "╬", "═", "┠", "┨", "┯", "┷", "┏", "┓", "┗", "┛", "┳", "⊥", "『", "↑", "↓", "→", "←", "↘", "↙", "♀", "♂", "┇", "┅", "∵", "∴", "‖", "︱", "︳", "囧", "⊙", "●", "○", "⊕", "◎", "Θ" ],
    commonPrefix: [ "囚心", "路人", "北眼", "心刺", "曾将", "够钟", "灼热", "闭关", "荒年", "放生", "凉薄", "放弃", "逆光", "疲惫", "指忘", "拥有", "像你", "悬崖", "裸钻", "顾忌", "毁梦", "念你", "鈊疼", "神经", "隐藏", "暖伴", "揪心", "猫九", "兲蛋", "陌忘", "刺痛", "溺爱", "柠檬", "奢望", "怨我", "断爱", "浅亡", "梦你", "矫情", "落墨", "沉世", "静谧", "忆白", "奢求", "归处", "七眠", "怪癖", "怀抱", "北海", "归人", "浪屿", "倔强", "旧城", "微酒", "搁浅", "淡别", "淡网", "苦酒", "酒客", "刺青", "闷热", "强挽", "浪咖", "平庸", "寄曲", "耳熟", "半醉", "绺欢", "闹巷", "远思", "厌烦", "荒途", "带刺", "心稳", "落潮", "逞笑", "孤友", "秋暮", "固执", "难挨", "伪善", "配角", "热水", "迎夏", "梦魇", "懦弱", "爱惜", "北觅", "东寻", "戒躁", "消逝", "过客", "无畏", "长安", "心抑", "现实", "拒丧", "魇九", "另类", "旧故", "难处", "深腻", "寒潮", "听孤", "薄荷", "幼稚", "清晓", "风尘", "诉说", "舌味", "自赎", "亵渎", "辞取", "纵行", "凉墨", "善变", "哑巴", "贪生", "砒霜", "寡言", "忘羡", "偏执", "败类", "任性", "大牌", "识趣", "无憾", "取悦", "沉醉", "普通", "皆叹", "惦念", "微笑", "夜声", "若久", "強荵", "爱笑", "放手", "邂逅", "玩家", "九夜", "芈妖", "血煞", "良辰", "君赋", "抬举", "闲云", "念旧", "清明", "河图", "玩具", "悲凉", "孤者", "柠凉", "卷鬓", "热吻", "笑脸", "散落", "厌世", "贪世", "世俗", "倒带", "叛逆", "脆弱", "孤身", "孤刺", "禁锢", "深碍", "遣心", "丑态", "游魂", "情丝", "依赖", "空城", "浪潮", "转角", "独瘾", "皱眉", "囚鸟", "烫嘴", "断点", "衬心", "妄念", "夏末", "猫弦", "情伤", "救赎", "失意", "傀儡", "痞爺", "啊呸", "默念", "孤傲", "孤城", "葬訫", "孤岛", "墨凉", "陌路", "彼岸", "初遇", "余醉", "深巷", "青稚", "情殇", "纪年", "嫑脸", "顾念", "墨残", "凉城", "墨染", "浅夏", "藍調", "孤痞", "孤寡", "孤心", "怣梦", "余欢", "錯過", "残忆", "失語", "槿城", "殇泪", "呆橘", "腻歪", "死撑", "凉心", "陌殇", "葬爱", "北暖", "倾寒", "青冢", "暮雨", "绝戀", "蔸蔸", "累勒", "菰犭虫", "无心", "墨痕", "木兮", "陌然", "浅歌" ],
    manPrefix: [ "难酬", "乞讨", "狗带", "热欲", "对手", "抽离", "贪新", "蜜酒", "体味", "爱囚", "无碍", "荣光", "利刃", "认怂", "刃白", "拂扇", "侠骨", "烟海", "话梗", "对味", "命硬", "烟徒", "犊子", "乞丐", "驼背", "魔王", "绅士", "狂神", "单杀", "孽徒", "逆战", "亡屍", "雅痞" ],
    manSuffix: [ "玮桦", "嘉明", "禹锡", "智涛", "磊贯", "嘉恩", "启儒", "帆松", "荣衡", "锡杭", "成炫", "颖禹", "鹏儒", "亮尧", "清瑄", "烽狄", "衡龙", "梁羲", "经崴", "思彬", "帆少", "善颖", "少靖", "兆威", "仲盛", "道道", "谦瀚", "金树", "旭伟", "鹏航", "杭喜", "锡河", "以飞", "秋海", "广振", "衡民", "正滨", "钧清", "宸靖", "腾镇", "绍龙", "朗杭", "景坤", "宏刚", "泽广", "兆澄", "衡林", "隽盛", "卫杰", "海升", "廷宇", "金喜", "熙雷", "健栋", "道宸", "恒元", "品中", "俊宗", "权敬", "炫奕", "敬辰", "喜飞", "以枫", "城麟", "君伊", "朗玮", "雷子", "隆克", "荣敬", "建钢", "林瀚", "诚敬", "威春", "基键", "威成", "旭国", "嘉彬", "衡渝", "彪弘", "锋友", "杰渝", "树鸿", "震谦", "宏平", "岳才", "宏新", "羲若", "思泰", "群祥", "仁建", "以儒", "滨禹", "钢顺", "桂畅", "然峰", "锦楚", "昌皓", "汉群", "斌春", "麟广", "逸振", "雨军", "良杭", "仁格", "利坤", "杰禹", "田熙", "宥峰", "炎峰", "信俊", "威尧", "希峻", "然阳", "光阳", "廷颂", "晨宸", "楠宸", "学绍", "言青", "金琛", "迅贤", "迅鑫", "熙钧", "汉正", "若佳", "勤城", "锦杭", "泽毅", "信贯", "浩勇", "君威", "尧力", "铭勇", "骏旭", "信炎", "靖仲", "宸尧", "绍霆", "彪森", "光锡", "敬诚", "经羲", "廷劲", "翰生", "腾岩", "兴信", "青烽", "健裕", "辰畅", "以曦", "弘广", "若敬", "森亦", "汉寒", "大新", "学思", "鹏立", "迅坤", "锌宁", "宸宸", "毅旭", "翔翔", "润炎", "钧桂", "宏百", "骏成", "泽恒", "承德", "颖新", "森伊", "仁雷", "梁朋", "超昌", "晏铭", "楚朗", "炎然", "霏琛", "雷善", "雷君", "梁臣", "榕茂", "畅心", "畅慧", "学浚", "威绍", "武翔", "聪升", "健锦", "蓝江", "汉利", "澄田", "奕明", "森建", "凯炎", "司弘", "国宁", "颂春", "俊畅", "伦翔", "元曦", "克顺", "蓝宇", "炎敬", "品聪", "楠泽", "祥朝", "汉瑄", "弘彪", "楠颂", "青纶", "庆辉", "山绍", "君建", "安云", "智宇", "峰启", "浩宏", "才聪", "朋元", "楠朋", "彪勤", "嘉家", "侨蓝", "颂楠", "恩伟", "才亮", "田锌", "力杉", "颂希", "锋振", "茂河", "曦健", "言皓", "承树", "楚嘉", "泰刚", "林浩", "群彪", "同松", "祖贤", "雷威", "升恒", "天慧", "成健", "骏颖", "达秋", "洋奕", "秦腾", "钧源", "成鸣", "龙才", "慧恒", "敬顺", "逸纯", "骏奕", "金栋", "良品", "平嘉", "生锦", "中哲", "俊阳", "畅亚", "澄驰", "哲江", "京鑫", "劲才", "鹏栋", "虹聪", "广权", "宥帆", "利翰", "帆恩", "臣彬", "彪成", "波烽", "烽经", "飞绍", "品杰", "彪天", "霆伟", "喜曦", "利恒", "子大", "飞翔", "宏经", "庆以", "超春", "旭亦", "坚云", "博森", "岳世", "山启", "道田", "学梁", "光国", "权西", "伟京", "鸿松", "启旭", "青康", "皇基", "利大", "兆皇", "伦朗", "纯彬", "言学", "兆刚", "民贤", "家基", "豪斌", "狄杰", "豪盛", "慧皓", "志渝", "臣信", "冠翰", "少劲", "庆烽", "若然", "瀚锋", "浩林", "梁经", "宇骏", "隽喜", "宏炎", "金宗", "经子", "敬学", "润郴", "瀚辰", "廷嘉", "卫源", "润文", "光基", "伦茂", "田栋", "家成", "中经", "彬平", "良鹏", "霖永", "树仁", "颂杜", "浩锌", "汉秦", "杉曦", "百山", "恩生", "德泽", "聪峰", "剑楚", "正寒", "树华", "剑劲", "仁岳", "虹劲", "思世", "卫恩", "思绍", "绍杉", "然凌", "昌君", "雨广", "玮隽", "澄蓝", "桂阳", "翔风", "树朋", "云谦", "逸俊", "靖蓝", "鸣以", "克钢", "思钧", "曦树", "熙彬", "茂云", "希维", "寒东", "亮澄", "百谦", "博颖", "豪星", "宇聪", "纯康", "磊崴", "仁青", "鸣广", "星颂", "朗卓", "谦坚", "信杉", "琛朋", "纯炎", "广刚", "振若", "亚尊", "汉隽", "云群", "力雷", "良伦", "锋霆", "品麟", "麟刚", "鸿伟", "茂骏", "宇嘉", "平凯", "贤森", "雷道", "尊广", "镇元", "伟麟", "海元", "帆雨", "彦健", "友隽", "卓军", "威维", "弘锌", "元钧", "震尧", "迅嘉", "涛健", "格凌", "皇祖", "齐盛", "信钧", "光隆", "昌宇", "春子", "心仁", "凯国", "品霖", "冠传", "武志", "振祥", "经智", "信若", "廷波", "以聪", "德颂", "云崴", "雷锡", "正钢", "德晏", "仲润", "绍旭", "军蓝", "霏朋", "西奕", "彦元", "宏城", "然臣", "康俊", "翰飞", "灿桂", "华泽", "钧哲", "驹乐", "秦才", "凌正", "翔聪", "祖庆", "风杉", "熙群", "凌劲", "廷成", "利义", "禹翔", "民锌", "敬锦", "力祥", "波泽", "力驹", "玮亚", "学昌", "博田", "道哲", "寒永", "仁云", "剑迅", "田廷", "勤宏", "信青", "儒秋", "子建", "佳秋", "亮鹏", "林腾", "崴成", "臣星", "杰亦", "世品", "超峰", "茂基", "毅信", "司羲", "凌茂", "希权", "达以", "以元", "磊宸", "泽康", "田涛", "源隆", "京友", "震洋", "东剑", "榕亚", "键渝", "磊彬", "锋威", "朗成", "波峰", "榕武", "曦宥", "青伦", "恒贯", "世才", "佑曦", "弘桂", "裕青", "郴榕", "力佳", "奕隽", "汉弘", "坤宇", "磊雨", "霏麟", "新钢", "嘉朗", "明志", "健达", "宏源", "清豪", "雷雄", "纶祥", "世元", "浩嘉", "劲宇", "格茂", "仲钧", "品诚", "梁升", "斌航", "平百", "驰伦", "品江", "勇佳", "迅刚", "泽迅", "宏中", "亮飞", "武树", "浩武", "维林", "元友", "杰楚", "权乐", "海基", "兆汉", "浩朝", "祖滨", "楠齐", "亮隽", "键大", "瑄奕", "光桂", "武刚", "春达", "梁虹", "利琛", "亦国", "宁玮", "成畅", "大军", "瑄隽", "世宸", "岳成", "铭鸣", "迅旭", "骏超", "宇云", "松狄", "庆杉", "恒郴", "波键", "家泽", "亚宏", "冠伦", "虹贤", "泽青", "基亚", "世琛", "靖天", "金东", "圣华", "博恩", "克宇", "朋安", "克威", "杰哲", "驰子", "建城", "言鸿", "麟思", "少琛", "劲海", "东勇", "润栋", "朝狄", "禹克", "秋翔", "平圣", "树琛", "逸源", "以纯", "强皇", "恩朝", "狄雷", "维瑄", "百德", "锋彬", "基亦", "侨基", "心秦", "驹畅", "武皇", "鸿志", "天文", "旭武", "皇斌", "寒西", "宏聪", "宇金", "刚群", "尊曦", "学宇", "奇滨", "光良", "俊康", "杰维", "西翦", "翰刚", "雄麟", "瀚钢", "奕尧", "景驹", "希金", "品强", "天鹏", "贯学", "东俊", "麟大", "凯敬", "宇阳", "晏毅", "若绍", "锦超", "阳中", "宗伊", "浚坤", "锌瑄", "明翰", "传光", "群永", "正梁", "顺冠", "嘉浩", "以桂", "飞城", "麟同", "信广", "廷西", "锡义", "喜才", "才康", "岩诚", "岩春", "田西", "佳锦", "希哲", "建琛", "纶驹", "诚磊", "鸿儒", "森钧", "光品", "奕键", "迅克", "云京", "光逸", "桦乐", "浩康", "国卫", "羲飞", "涛凌", "纶承", "宗同", "狄同", "尊斌", "翦磊", "仁盛", "承仲", "航羲", "渝翦", "麟柏", "斌生", "光钧", "志雨", "言隽", "伦凌", "裕世", "翔以", "亦君", "健豪", "羲品", "利国", "春百", "亮旭", "朝兆", "海伟", "鸣炎", "启鸣", "强铭", "帆民", "荣梁", "岳畅", "弘圣", "亚峻", "毅司", "成传", "聪尊", "家源", "天翦", "君鸣", "熙金", "信生", "晨明", "同杉", "承豪", "西尊", "安皓", "以恩", "朗宗", "栋驹", "谦玮", "汉新", "心镇", "朋杉", "崴武", "隆宥", "雷飞", "霏皓", "言盛", "云维", "尧祥", "大经", "斌杜", "隽凯", "勤以", "豪豪", "道键", "力以", "兴德", "伦敬", "嘉旭", "华晏", "维聪", "振纯", "剑振", "航伊", "伟山", "剑利", "源杉", "岩卫", "仲鑫", "同泽", "以达", "琛正", "广民", "浩世", "喜武", "儒瀚", "羲宇", "源杰", "俊祥", "春传", "钢泽", "杉力", "麟震", "才百", "鸿兆", "翰杜", "旭俊", "杜辉", "敬桦", "旭坤", "纯翔", "侨力", "安润", "雷经", "国宇", "顺佳", "升海", "宁秦", "文百", "涛天", "成新", "义少", "品鸣", "华瀚", "文崴", "彪雄", "坤侨", "寒河", "亚景", "维蓝", "博辰", "清仲", "若贯", "凯宸", "家达", "凯翦", "希熙", "弘儒", "汉锌", "楚启", "若林", "杭禹", "蓝弘", "彪树", "健洋", "涛翔", "腾辉", "仁森", "斌虹", "皓臣", "灿琛", "平华", "家华", "帆衡", "浚玮", "品建", "哲斌", "茂剑", "泽嘉", "奕勇", "毅迅", "学恩", "乐源", "彬伊", "恒奇", "世天", "友雨", "超启", "锦恩", "春纯", "乐桦", "镇建", "仁群", "奕志", "雄隆", "臣崴", "田卫", "以迅", "劲凯", "伊彬", "明杜", "朋渝", "润劲", "翦宏", "雷东", "秦寒", "楚佑", "栋泽", "佑秋", "海京", "卫力", "熙勤", "京玮", "诚泰", "正楚", "阳树", "友澄", "禹祥", "仁希", "贤百", "锋少", "岩彬", "兴腾", "心顺", "龙伊", "阳勤", "中豪", "格键", "峰智", "树中", "宇中", "伟林", "儒彦", "子伟", "铭群", "滨友", "江毅", "靖盛", "灿维", "明羲", "喜劲", "庆玮", "锋霏", "源东", "楚龙", "洋栋", "凌汉", "辉侨", "齐松", "绍海", "乐裕", "东克", "辉宸", "彬超", "泽坤", "绍云", "鹏亮", "逸鹏", "虹祖", "树林", "熙晨", "仁刚", "嘉伊", "桦钧", "皇泽", "清元", "世贤", "正霏", "嘉洋", "航宇", "哲友", "汉盛", "霖国", "杜郴", "亦迅", "华伦", "玉琛", "恩郴", "承田", "达炎", "翦瀚", "亚谦", "力翔", "超尊", "烽泽", "同劲", "健桦", "兴羲", "风裕", "滨乐", "天克", "诚卫", "宗道", "嘉志", "司品", "司狄", "贯民", "言锦", "亚同", "品钢", "启彬", "杰大", "金儒", "雷磊", "驹卫", "贯航", "源谦", "桂生", "景言", "泰畅", "凯峰", "昌嘉", "炫涛", "琛浩", "雄磊", "润迅", "伟坚", "宁浩", "瑄卫", "亮若", "源辰", "颂江", "威颂", "松键", "朗信", "皓司", "鸣泽", "雷洋", "奇树", "伦成", "超纶", "民震", "雨琛", "杰君", "威喜", "阳源", "畅雷", "云峻", "冠郴", "廷皇", "达晏", "然城", "刚博", "兆希", "祥勇", "协然", "生鹏", "然宸", "军鹏", "君思", "俊东", "旭道", "云渝", "朝源", "喜广", "杰雷", "岳辉", "振霆", "威朗", "源波", "松仲", "靖松", "军启", "武虹", "炎剑", "刚峰", "雄岩", "梁军", "瀚炎", "协霆", "榕华", "伊晨", "达岳", "晨咏", "友梁", "金杉", "勇斌", "亦盛", "道世", "朗朗", "冠群", "弘浩", "迅安", "敬翦", "青广", "良良", "松同", "光田", "凯彪", "辰成", "奇茂", "绍平", "亦恩", "祥宏", "中枫", "岩迅", "齐思", "霖驹", "毅翰", "金炫", "河正", "友平", "佑纯", "刚子", "栋力", "伊鸿", "渝帆", "廷彦", "家良", "铭龙", "劲宏", "杭杭", "炎辉", "森生", "岳康", "朗旭", "佳兆", "鸿俊", "谦蓝", "磊镇", "廷晨", "源蓝", "少剑", "朋梁", "道广", "贤雨", "霏锋", "靖维", "冠升", "青峻", "浩狄", "滨洋", "绍钢", "琛群", "清鑫", "泽铭", "楚颂", "梁辰", "隆滨", "靖威", "达祥", "逸靖", "山喜", "灿栋", "然慧", "靖翦", "峰刚", "利瑄", "剑梁", "秋皓", "伦田", "洋树", "颖曦", "勇恩", "杰昌", "树咏", "齐昌", "震昌", "伟梁", "以信", "奕旭", "贯朋", "东宇", "杭业", "纶崴", "麟佳", "霖鑫", "润诚", "景颖", "骏楚", "国尊", "鸿信", "麟森", "汉西", "瀚光", "磊豪", "辰力", "新勇", "心达", "友航", "锡彬", "金迅", "晏俊", "力青", "百品", "勇武", "顺荣", "京尊", "平霆", "恩安", "俊启", "隽元", "阳友", "平杰", "泽亚", "聪齐", "鹏君", "格衡", "业隽", "纶林", "雷乐", "盛秦", "磊烽", "滨雨", "协嘉", "力超", "霆宇", "风民", "亦东", "达佳", "秦翔", "业彦" ],
    womanPrefix: [ "槿栀", "素颜", "眼眸", "薄姬", "大妞", "妤梦", "湉晨", "妩媚", "涟漪", "旖旎", "南笙", "沧颜", "凝眸", "花逝", "颜汐", "浅沫", "琉璃", "春野", "棠绾", "南音", "初柚", "倩影", "烈女", "泪眼", "莺语", "清悦", "温婉", "挽发", "情愫", "浊泪", "浅笑", "流苏", "晴栀", "槿城", "花葬", "夏墨", "余笙", "鎖惢", "旧梦", "喵喵", "心奴", "浅梦", "清樱", "柠栀", "冷眸", "冷颜" ],
    womanSuffix: [ "碧莹", "笑凌", "南汐", "希菲", "雨瑶", "蕾盈", "雪如", "桂映", "颖嘉", "颖滢", "彤月", "婷姬", "萱琪", "勤香", "舒晶", "毓碧", "向姬", "采菁", "素洁", "琼涵", "卉映", "美儿", "寒念", "雨娇", "青澜", "岚桦", "语绮", "可馨", "诗卿", "怡聪", "清雁", "飞淑", "露丹", "馨友", "佩柔", "乐凌", "雅筠", "忆梵", "锦寒", "婵寒", "雪菲", "贤海", "瑾丽", "红迎", "淑睿", "诗馨", "丽琦", "影汐", "雪馥", "宜妍", "宛素", "艺雨", "影凌", "安妍", "咏雪", "雪松", "乐蕾", "凌凡", "璐舒", "可倩", "阳香", "枫雅", "婵艺", "雯思", "艺婷", "梵友", "融阳", "苇红", "丽梦", "颖婷", "萱诗", "咏晓", "雅静", "艺华", "容惠", "雪夏", "凡南", "瑶嘉", "月蓓", "风松", "莺艺", "迎叶", "娜英", "绮萱", "芹雨", "欣华", "筠霜", "娜双", "玉馨", "欣阳", "雯茗", "安宛", "娇英", "娴安", "洁月", "熙瑶", "平雪", "菱含", "婷宇", "姬儿", "翠菡", "清烁", "婉姣", "萱梵", "菲琳", "晓颖", "萱琦", "红蕊", "菱汐", "婉小", "青滢", "代容", "佩艺", "燕静", "颖婵", "涵易", "欢思", "香荔", "月凡", "雪翠", "媚伊", "聪丝", "娜锦", "彩寒", "娇寒", "松舒", "香颖", "芹萱", "晓兰", "平勤", "凌媚", "爽融", "岚菲", "秀丹", "小沫", "柔婵", "蓝忆", "婷瑾", "含儿", "娇雅", "思毓", "依曼", "琳洋", "佳清", "采蕊", "玲晶", "霜含", "媚琼", "菱阳", "瑗婷", "沫寒", "蕊霜", "黛涵", "彩萱", "若舒", "夏毓", "姬美", "欢仪", "媚晴", "蕊菲", "蕊如", "夏苛", "晶璧", "丽馥", "琦凌", "美玉", "聪慧", "瑶雅", "新瑶", "怜素", "晶蓝", "雯兰", "雯雪", "涵新", "瑶菲", "莹晓", "婷菱", "咏南", "贤汐", "玉萱", "晶华", "惠清", "蓝聪", "绮容", "友欢", "莎友", "霜雅", "彤碧", "蓝澜", "馨初", "琰瑞", "凡盈", "佩丝", "文妍", "芳媚", "南蕊", "瑶盼", "瑞沛", "亦初", "冰蕊", "夏熙", "晶曼", "玉汐", "洁柔", "逸初", "芬晴", "宛菡", "菲盈", "瑾瑞", "熙玉", "妍菲", "琬晓", "贤亦", "瑾飞", "涵桂", "风秀", "风沫", "雯菱", "筠琦", "萱静", "念荷", "玉依", "琪淑", "盈玉", "梦咏", "静淑", "毓睿", "慕瑶", "羽翠", "涵菱", "嘉文", "娜琼", "咏洋", "霞碧", "华欢", "采园", "希莎", "书雨", "娇玉", "寒欣", "以乐", "代颖", "映元", "初清", "希琪", "念璧", "亦丹", "馨贤", "念沫", "怡婉", "馥锦", "红雪", "娇琪", "涵雁", "迎熙", "亦乐", "茗彤", "笑柳", "迎静", "玲仪", "飞涵", "聪茗", "琳慕", "舒艺", "婕姣", "风雪", "涵华", "梦雪", "园霞", "荷慧", "燕雨", "珊妮", "莹汐", "露慕", "南瑶", "宜惠", "含亦", "诗瑶", "荔妍", "雅璐", "瑗聪", "蕾熙", "小媚", "儿颖", "巧玲", "慧笑", "文新", "勤蓝", "晶平", "茗叶", "静书", "珊华", "香希", "凡荔", "芙婷", "瑶静", "洋海", "曼叶", "卿惠", "初菡", "雨荔", "滢慧", "贝婷", "宇瑞", "梦锦", "婷迎", "代馨", "冰笑", "妮岚", "姬汐", "澜琰", "妙珊", "慧贤", "南婉", "骅菁", "小念", "夏贤", "安珊", "苑琰", "馨小", "倩琳", "寒风", "希怜", "洋睿", "迎羽", "霞莉", "莎清", "怜琳", "以勤", "飞梦", "娴琼", "婕念", "聪萱", "叶水", "婷凡", "蓝飘", "馨璐", "柔莉", "佩忆", "艺莹", "静露", "宛汐", "娇芬", "芳蕾", "桂叶", "妍如", "映馨", "咏骅", "思夏", "琳怜", "瑾萱", "风叶", "秀诗", "丹璧", "彤珊", "逸锦", "淑芹", "婷翠", "锦聪", "姣熙", "惜眉", "睿璧", "贤娅", "飞风", "素宛", "蓝易", "贝芹", "初骅", "芳雁", "璐妙", "婉露", "娅瑶", "芬亦", "华岚", "欢怜", "丝秀", "眉荔", "易乐", "水琪", "琳雪", "伊姣", "巧雪", "娅玉", "黛蓝", "晴霜", "露香", "飞华", "英瑶", "晶怜", "凡迎", "琳莎", "巧白", "双宛", "仪容", "晓惠", "佳儿", "影涵", "仪儿", "青宝", "菱秀", "逸娇", "诗羽", "霜欣", "丽娜", "桦桂", "琬枫", "容聪", "岚卿", "琪希", "逸语", "冰卉", "菁阳", "荷雨", "菲丹", "娅彦", "媚汐", "琳夏", "叶平", "菡红", "仪毓", "姬怡", "容英", "影风", "欣怡", "香妍", "娴怜", "苇芬", "沛青", "蕊忆", "霜艺", "晓晴", "柳素", "芳蓝", "筠白", "筠静", "菡夏", "妍莎", "海蓝", "娅晴", "彤莎", "玉媚", "勤红", "琴佩", "颖骅", "菱海", "影代", "沫瑶", "烁琴", "晓璧", "诗梦", "妍苛", "霜南", "怡燕", "梦璧", "希佩", "代晶", "羽彤", "宝柳", "冬凡", "梦容", "如荔", "南嘉", "美友", "苇以", "岚彦", "凡冰", "蓝欢", "叶宛", "惠婵", "淑采", "姣蕾", "菁毓", "霜芙", "小诗", "海阳", "英念", "琬熙", "贤佩", "红菲", "慕姣", "采莹", "彤萱", "沛雪", "素菲", "瑞迎", "聪风", "寒桦", "霞仪", "玉冬", "风彤", "莺珊", "儿儿", "佳琬", "语晓", "飞蓓", "诗晴", "蓉茜", "霜华", "琳小", "莺丹", "雅娜", "叶璐", "翠笑", "贤雪", "卿语", "希容", "凌素", "香含", "蓝贤", "儿雪", "伊丽", "艺风", "惠易", "逸宇", "逸梦", "洋仪", "瑞怜", "亦佳", "飘佩", "燕瑶", "骅绮", "宛欣", "芙聪", "雨书", "琼芳", "亦念", "琴笑", "翠宇", "琴融", "翠薇", "若怡", "枫丹", "初翠", "语静", "雅小", "妮柔", "惜文", "曼小", "萱莺", "宜佩", "易晶", "卿友", "萱红", "安红", "琪黛", "蓝枫", "珊仪", "荷萱", "萱滢", "双梦", "香易", "馨雪", "飘雅", "风冰", "蕾琦", "怜冰", "晴松", "桦素", "宇夏", "娜美", "燕琳", "慧艺", "黛烁", "影菡", "莎露", "婵苛", "柳姣", "婷盼", "琴琼", "梦欣", "玉荔", "柔诗", "曼红", "妙香", "桂凡", "寒友", "寒晶", "代桃", "文骅", "贤白", "宇倩", "茜馥", "蓓琪", "可雁", "如颖", "采笑", "莺蓉", "凌海", "清娴", "菲容", "薇骅", "涵梵", "影芙", "盼青", "馥露", "曼怜", "安凡", "玲柔", "妍仪", "苛柳", "绮琴", "冬汐", "雅文", "蓉初", "黛念", "霞苑", "映贝", "涵舒", "涵琰", "雁雯", "妮凡", "彦融", "荔颖", "睿苛", "菡盼", "芳晶", "黛媛", "雨桂", "卉晶", "馨琦", "凌笑", "安若", "蕊锦", "芳雪", "翠桃", "卿馨", "怡采", "冬涵", "夏雪", "玲珊", "初蓉", "友娜", "双萱", "萱玉", "如瑶", "慧爽", "若秀", "飞叶", "蕾爽", "英柳", "如婵", "秀若", "彩烁", "念忆", "霞晴", "骅芙", "芳英", "叶代", "舒宛", "宛瑶", "茗贝", "艺琪", "雁小", "宝菲", "瑶梦", "娇语", "迎玉", "菡乐", "芹怜", "沛美", "聪涵", "琰佳", "如雅", "霞代", "慧瑶", "宝媚", "苛蓉", "红颖", "蓝烁", "芹依", "爽雁", "雪桂", "以绮", "黛飞", "雪华", "苛水", "琦菡", "丹婷", "娴黛", "友凌", "婕惠", "菁翠", "丝菡", "婕枫", "汐友", "毓琰", "涵荔", "含娜", "琦映", "蕊慧", "燕芳", "飘叶", "滢菁", "松洁", "水灵", "娇雅", "馨骅", "梦姬", "萱菡", "水巧", "夏馨", "茗琦", "霞澜", "友丹", "睿馨", "瑾晴", "丝卿", "琼宇", "岚双", "桃淑", "芳萱", "希小", "巧娅", "惠宇", "飞菱", "琪岚", "欣蓝", "冰芙", "蕾如", "琼可", "妙亦", "梵毓", "桃可", "枫荷", "黛冬", "岚蓉", "月洁", "巧彤", "曼芙", "爽雅", "沛枫", "仪雪", "岚丽", "希碧", "英雨", "卿锦", "芹诗", "雯菁", "琪丝", "松蕾", "芬若", "芹绮", "梦勤", "雨骅", "翠亦", "蓉媚", "咏雅", "芙容", "艺南", "英彦", "曼娜", "亦燕", "颖夏", "怜苇", "慧盼", "冰荷", "芙瑾", "绮萱", "水曼", "燕惠", "儿飘", "宜菲", "倩绮", "青宛", "霞芹", "妮彩", "菲蓝", "影洁", "晶蕊", "嘉霞", "聪苑", "友莹", "姬琳", "双雪", "熙媚", "洋玉", "苇菡", "舒舒", "沛诗", "雅代", "琪夏", "夏灵", "熙静", "娅苛", "沫霞", "宝聪", "容娅", "骅冬", "芹盼", "慕岚", "澜冬", "瑶仪", "南琳", "彩乐", "惜菲", "新慧", "宛雅", "雅蕊", "映安", "沛汐", "松秀", "南沛", "迎飞", "彤采", "颖露", "梦雨", "香嘉", "乐舒", "琰惜", "苛沫", "琳南", "燕荔", "丹慕", "莉若", "迎诗", "洋馨", "蕾贤", "念婷", "园思", "贤颖", "欣柳", "素儿", "雁婉", "苛婕", "飘霞", "诗伊", "翠汐", "采倩", "柳晶", "筠玛", "蕊希", "华琳", "馥凌", "黛友", "惜采", "冬艺", "秀锦", "妙娅", "忆茗", "宇儿", "蕊丹", "荔锦", "慕琳", "婉如", "聪艺", "桦滢", "晴南", "霞菡", "荷莺", "毓芳", "琴筠", "希叶", "月雪", "蕊媚", "沛薇", "咏柔", "雅飘", "佩如", "琰夏", "婵汐", "雯琳", "含贝", "娅涵", "馨水", "桂婵", "水馨", "飘贤", "莉影", "馥菱", "馨锦", "锦菲", "蓉琴", "凌沫", "晶涵", "岚爽", "馨嘉", "琼琦", "秀姣", "寒桂", "菁洋", "儿毓", "娴爽", "荷素", "笑蓓", "以莎", "菲洋", "涵婕", "希桂", "宜雪", "凡寒", "荷妙", "莉逸", "琴茜", "雪静", "瑶晶", "桦灵", "素美", "茜芹", "爽依", "嘉红", "佩月", "诗宛", "茜素", "妍丽", "彦小", "瑗飞", "颖羽", "烁水", "娇咏", "青阳", "琼亦", "琦贤", "新玉", "含玲", "晓静", "蓝苑", "蓉希", "叶慧", "清诗", "玛丽", "阳影", "凌彤", "丹书", "琪语", "妮艺", "妮蓝", "兰卿", "如怡", "盼菁", "宛兰", "娜宜", "枫莹", "阳舒", "枫忆", "以烁", "毓晶", "霜素", "夏菲", "丝雪", "迎雅", "冰芬", "梦盼", "沫惠", "爽伊", "夏茗", "雪洁", "宛汐", "熙卉", "语婵", "霞冬", "毓萱", "汐含", "婉涵", "宜熙", "菲如", "颖苛", "玉月", "雪瑗", "香华", "宇如", "琬蓉", "彤婉", "瑶夏", "清雪", "玲易", "锦妙", "秀慧", "烁静", "菲小", "文岚", "熙珊", "盼兰", "映珊", "茜蓝", "可瑞", "澜彤", "菱艺", "忆园", "冰碧", "妍惠", "曼若", "娇黛", "雅蓉", "琬冰", "梵海", "雅莎", "梦彤", "贤安", "容依", "梦宜", "雅婉", "洁婉", "慧咏", "思熙", "婵媚", "诗素", "晴婵", "莎岚", "玉荷", "荷绮", "欢叶", "羽忆", "柳清", "海玉", "雨佳", "新冰", "依筠", "乐念", "静菡", "荷芬", "盼宛", "玉雯", "菁婷", "滢妮", "勤素", "伊勤", "羽霞", "艺丝", "容妍", "洁梵", "素思", "娅香", "佳秀", "希馨", "采晓", "冰平", "黛梵", "寒梦", "向冬", "瑞宛", "岚茜", "晓玲", "乐霜", "柳熙", "怜玲", "玲琳", "骅馥", "娅青", "卉清", "易涵", "兰蕾", "灵依", "咏黛", "瑞聪", "希媚", "桦羽", "玉巧", "小飞", "以婉", "欢蕊", "锦芬", "飞香", "素佩", "红书", "如宛", "馨清", "文沛", "晓苛", "婷卉", "初红", "桦沫", "莎梦", "琰华", "珊苛", "伊兰", "友影", "茗姬", "瑞晓", "琳丹", "娇菁", "汐雯", "婉飘", "菲玛", "碧静", "翠琼", "聪红", "嘉曼", "佳英", "琪梦", "笑颖", "睿雨", "希芙", "瑗芹", "蓓含", "丝曼", "易华", "宜媚", "桦琳", "伊薇", "宇碧", "逸婕", "忆涵", "元以", "沛南", "燕慕", "丹惠", "琳婕", "瑾影", "若晓", "苇慕", "瑾婵", "向咏", "羽玛", "宜雅", "阳容", "婵英", "蓉若", "瑶红", "元琪", "欢雪", "雪白", "清梦", "希静", "夏蓉", "玉盼", "茗思", "华娴", "新妍", "枫雨", "雪娴", "绮桃", "玉容", "思逸", "忆姣", "琴卉", "媚怡", "萱慕", "迎洋", "叶沛", "苇睿", "梵书", "宇芳", "芹希", "美书", "静芙", "雪莎", "梵柳", "琪露", "琪玉", "怡佳", "婷骅", "含晶", "曼露", "怜迎", "馥芙", "妙绮", "念筠", "澜笑", "慧希", "逸元", "如沫", "绮南", "念佳", "嘉瑾", "霜宜", "盼涵", "含彦", "汐海", "娜儿", "琪瑗", "蓝璐", "烁彤", "菲安", "骅睿", "怜儿", "松雅", "含菁", "乐兰", "茗珊", "惠霜", "艺羽", "姬冰", "沫桦", "娇琳", "梦彩", "亦涵", "娅绮", "彤欣", "瑶菲", "菁琰", "彦贤", "丝媚", "茜英", "文蓓", "夏怜", "怜菱", "莎冬", "霜菡", "璧岚", "碧艺", "芳冬", "以新", "薇蓝", "亦菲", "乐芬", "沛芳", "妙松", "娴华", "莎宇", "熙蓓" ],
    descs: [ "渡劫成功晋升天仙", "领取了88888元宝礼包", "渡劫成功晋升玄仙", "渡劫成功晋升仙君", "渡劫成功晋升地仙", "领取了99999元宝礼包" ],
    familyArr: new Array(2),
    symbolArr: new Array(3),
    tops: [ 112, 140, 168, 196, 224 ],
    items: new Array(),
    destroyed: !1,
    destory: function() {
        this.destroyed || (this.destroyed = !0, this.familyNames.length = 0, this.familyNames = null, 
        this.symbols.length = 0, this.symbols = null, this.commonPrefix.length = 0, this.commonPrefix = null, 
        this.manPrefix.length = 0, this.manPrefix = null, this.manSuffix.length = 0, this.manSuffix = null, 
        this.womanPrefix.length = 0, this.womanPrefix = null, this.womanSuffix.length = 0, 
        this.womanSuffix = null, this.descs.length = 0, this.descs = null, this.familyArr.length = 0, 
        this.familyArr = null, this.symbolArr.length = 0, this.symbolArr = null, this.tops.length = 0, 
        this.tops = null, this.items.length = 0, this.items = null);
    }
};

var bootstrap = {
    step: 0,
    start: 0,
    routine: "",
    scriptCount: 0,
    db: null,
    scriptQueue: new Array(),
    libraryAsset: null,
    mainAsset: null,
    loadScriptFromUrl: function(e, t) {
        var r = window.document.createElement("script");
        r.type = "text/javascript", r.src = e, r.onload = t.bind(this), document.body.appendChild(r);
    },
    loadScriptFromMemory: function(e, t) {
        var r = this, i = URL.createObjectURL(new Blob([ e ]));
        this.loadScriptFromUrl(i, function(e) {
            URL.revokeObjectURL(i), t.call(r, e);
        });
    },
    openRequest: function(e, t, r) {
        var i = this, n = new XMLHttpRequest();
        return n.responseType = t, n.onreadystatechange = function(e) {
            var t = e.target;
            4 == t.readyState && (200 == t.status || 0 == t.status && null != t.response && t.response.byteLength, 
            r.call(i, e));
        }, n.open("GET", e), n.send(), n;
    },
    loadAsset: function(r, i) {
        if (window.aaaaFlag.loadAsset = 1, null == r) i.call(this, r); else {
            var n = this;
            if (this.db) {
                var e = this.db.transaction("cache").objectStore("cache").get(r.url);
                e.onsuccess = function(e) {
                    var t = e.target.result;
                    t && t.version == r.v ? (r.status = 2, r.response = t.value, i.call(n, r)) : n.loadByRequest(r, i);
                }, e.onerror = function(e) {
                    n.loadByRequest(r, i);
                };
            } else n.loadByRequest(r, i);
        }
        window.aaaaFlag.loadAsset = 2;
    },
    loadByRequest: function(r, i) {
        window.aaaaFlag.loadByRequest = 1;
        var n = this;
        window.aaaaFlag.assetUrl = r.url + "?v=" + r.v, window.aaaaFlag.assetType = r.type, 
        this.openRequest(r.url + "?v=" + r.v, "js" == r.type ? "text" : "arraybuffer", function(e) {
            if (r.status = 2, r.response = e.target.response, i.call(n, r), n.db) {
                var t = {
                    url: r.url,
                    version: r.v,
                    value: r.response
                };
                n.db.transaction("cache", "readwrite").objectStore("cache").put(t);
            }
        }), window.aaaaFlag.loadByRequest = 2;
    },
    onLoadComplete: function() {
        window.aaaaFlag.onLoadComplete = 1, this.step = 3, console.log("引导加载完成......", Date.now() - this.start, Date.now()), 
        record_step(2, 0), window.onMiniGame || window.showProgressInterface(3, 3, 1, "初始化中。。。");
        var e = modules.common.PlatParams;
        e.platform = tparams.channel, e.account = tparams.account, e.userId = tparams.userId, 
        e.serverId = tparams.serverId, e.cdn = tparams.cdn, e.data = tparams.data, e.package = tparams.package ? parseInt(tparams.package) : 0, 
        e.newRegister = tparams.newregister, e.isNoCreate = tparams.is_no_create ? parseInt(tparams.is_no_create) : 0, 
        e.isYyb = tparams.is_yyb ? parseInt(tparams.is_yyb) : 0, e.groupId = tparams.group_id ? parseInt(tparams.group_id) : 0, 
        e.openid = tparams.qqOpenId, e.openkey = tparams.qqOpenKey, e.control = tparams.control, 
        modules.login.LoginModel.instance.selectedServer = tparams.selectedServer, e.configs = tparams.selectedServer.configs;
        var t = this.routine;
        this.scriptQueue.length = 0, this.scriptQueue = null, this.routine = null, this.libraryAsset = null, 
        this.mainAsset = null, setTimeout(function() {
            window.onMiniGame ? new window.Main(tparams.userId, null) : new Main(tparams.userId, t);
        }, 0), window.aaaaFlag.onLoadComplete = 2;
    },
    loadMainAsset: function() {
        if (window.aaaaFlag.loadMainAsset = 1, 2 == this.step) if (null != this.mainAsset) {
            if (window.aaaaFlag.mainParse = 0, 2 == this.mainAsset.status) {
                window.aaaaFlag.mainParse = 1, window.showProgressInterface(2, 3, .5, "加载主程序。。。"), 
                window.aaaaFlag.mainParse = 2, window.aaaaFlag.mainLen = this.mainAsset.response ? this.mainAsset.response.byteLength : this.mainAsset.response;
                var e = new Zlib.Inflate(new Uint8Array(this.mainAsset.response)).decompress();
                window.aaaaFlag.mainParse = 3;
                var t = msgpack.decode(e);
                window.aaaaFlag.mainParse = 4, this.routine = URL.createObjectURL(new Blob([ t.pop(), "var var" + (65536 * Math.random() | 0) + " = " + Math.random() + ";" ])), 
                window.aaaaFlag.mainParse = 5, this.loadScriptFromMemory(t.pop(), this.onLoadComplete), 
                window.aaaaFlag.mainParse = 6;
            }
        } else window.aaaaFlag.mainParse = 7, this.onLoadComplete();
        window.aaaaFlag.loadMainAsset = 2;
    },
    loadLibraryAsset: function() {
        window.aaaaFlag.loadLibraryAsset = 1;
        var t = this;
        if (1 == this.step) if (null != this.libraryAsset) {
            if (2 == this.libraryAsset.status) {
                this.loadAsset(this.mainAsset, this.loadMainAsset);
                var e = new Zlib.Inflate(new Uint8Array(this.libraryAsset.response)).decompress(), r = msgpack.decode(e), i = r.length, n = function() {
                    if (window.showProgressInterface(1, 3, (i - r.length) / i, "加载代码库。。。"), 0 == r.length) return t.step = 2, 
                    void t.loadMainAsset();
                    var e = r.shift();
                    t.loadScriptFromMemory(e, n);
                };
                n();
            }
        } else this.step = 2, this.loadAsset(this.mainAsset, this.loadMainAsset);
        window.aaaaFlag.loadLibraryAsset = 2;
    },
    loadScriptQueue: function() {
        if (window.aaaaFlag.loadScriptQueue = 1, window.showProgressInterface(0, 3, this.scriptCount ? (this.scriptCount - this.scriptQueue.length) / this.scriptCount : 1, "加载工具库。。。"), 
        0 != this.scriptQueue.length) {
            var e = this.scriptQueue.shift();
            this.loadScriptFromUrl(e.url + "?v=" + e.v, this.loadScriptQueue);
        } else this.step = 1, this.loadLibraryAsset();
        window.aaaaFlag.loadScriptQueue = 2;
    },
    init: function() {
        window.aaaaFlag.bootInit = 1, this.start = Date.now();
        var i = tparams.cdn;
        if ("" != i && "/" != i[i.length - 1] && (i += "/"), tparams.cdn = i, record_step(1, 0), 
        window.onMiniGame) this.onLoadComplete(); else {
            var n = Date.now();
            this.mainAsset = function(e, t) {
                var r = versions[e];
                return {
                    url: "" + i + e,
                    v: r || n,
                    type: t,
                    desc: "",
                    status: 0
                };
            }("assets/ss.obj", "binary"), this.scriptCount = this.scriptQueue.length, window.updateTotalProgress(-1), 
            window.indexedDB && setTimeout(this.initDB.bind(this), 100), window.aaaaFlag.bootInit = 2;
        }
    },
    startLoad: function() {
        window.aaaaFlag.startLoad = 1, this.loadScriptQueue(), window.aaaaFlag.startLoad = 2;
    },
    initDB: function() {
        if (window.aaaaFlag.initDB = 1, !window.onMiniGame && window.indexedDB) try {
            var t = window.indexedDB.open("routine"), r = this;
            t.onerror = function(e) {
                console.log(e), r.startLoad();
            }, t.onupgradeneeded = function(e) {
                r.db = t.result, t.result.createObjectStore("cache", {
                    keyPath: "url"
                });
            }, t.onsuccess = function(e) {
                r.db = t.result, r.startLoad();
            };
        } catch (e) {
            e = VM2_INTERNAL_STATE_DO_NOT_USE_OR_PROGRAM_WILL_FAIL.handleException(e);
            this.startLoad();
        } else this.startLoad();
        window.aaaaFlag.initDB = 2;
    }
}, totalPer = 0;

window.showProgressInterface = function(e, t, r, i) {
    if (window.aaaaFlag.showProgressInterface = 1, window.onMiniGame) {
        if (window.enterFlag) return;
        window.WindowManager.instance.open(1265, [ e, t, r, i ]);
    } else {
        if (loadingView) {
            var n = 596 * r, a = e / t;
            loadingView.progressBar1.style.width = (596 * a).toString(), loadingView.proLabel1.innerText = (100 * a >> 0) + "%", 
            loadingView.progressBar2.style.width = (596 < n ? 596 : n).toString(), loadingView.proLabel.innerText = i, 
            loadingView.proLabel2.innerText = (100 * r >> 0) + "%";
        }
        window.aaaaFlag.showProgressInterface = 2;
    }
};

var loadingPer = 0, loadingTimeStamp = 0, requestAnimationFrameId = 0;

function utf8_to_b64(e) {
    return window.btoa(unescape(encodeURIComponent(e)));
}

window.updateTotalProgress = function(e) {
    if ((loadingView || window.onMiniGame) && (!window.onMiniGame || !window.enterFlag)) {
        if (-1 === e) return window.cancelAnimationFrame(requestAnimationFrameId), loadingTimeStamp = -1, 
        loadingPer = 0, void (requestAnimationFrameId = window.requestAnimationFrame(window.updateTotalProgress));
        if (-2 !== e) {
            -1 === loadingTimeStamp && (loadingTimeStamp = e);
            var t = e - loadingTimeStamp;
            loadingTimeStamp = e, loadingPer < totalPer && (loadingPer = totalPer), loadingPer < .3 ? loadingPer += (.02 * Math.random() + .01) / (300 * Math.random() + 200) * t : loadingPer < .6 ? loadingPer += (.15 * Math.random() + .01) / (400 * Math.random() + 400) * t : loadingPer < .9 ? loadingPer += (.01 * Math.random() + .01) / (600 * Math.random() + 600) * t : loadingPer < 1 && (loadingPer += 1e-4 * t), 
            .9999 < loadingPer && (loadingPer = .9999), window.onMiniGame ? window.WindowManager.instance.open(1265, [ -1, -1, loadingPer, null ]) : (loadingView.progressBar1.style.width = (596 * loadingPer).toString(), 
            loadingView.proLabel1.innerText = (100 * loadingPer).toFixed(2) + "%"), loadingPer < .9999 && (requestAnimationFrameId = window.requestAnimationFrame(window.updateTotalProgress));
        } else window.cancelAnimationFrame(requestAnimationFrameId);
    }
}, window.firstEnterGameScene = function() {
    window.aaaaFlag.firstEnterGameScene = 1, window.onMiniGame && (window.enterFlag = !0), 
    bootstrap = null, window.nameGenerator && (window.nameGenerator.destory(), window.nameGenerator = null), 
    requestAnimationFrameId && (window.cancelAnimationFrame(requestAnimationFrameId), 
    requestAnimationFrameId = 0), window.onMiniGame ? window.WindowManager.instance.close(1265) : loadingView && (loadingView.removeScrollDiv(), 
    loadingView = null), window.aaaaFlag.firstEnterGameScene = 2;
}, window.reqRecordError = function(e) {
    var t = "0", r = window.modules;
    r && r.login && r.login.LoginModel.instance.selectedServer && (t = r.login.LoginModel.instance.selectedServer.server_id || "0");
    var i = new XMLHttpRequest();
    i.open("GET", tparams.backstage + utf8_to_b64("game/error/" + t + "/" + tparams.account + "/" + encodeURIComponent(e))), 
    i.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), i.send();
}, window.onerror = function(e, t, r, i, n) {
    n && window.reqRecordError(tparams.account + ": \n" + e + "\n" + (n.stack || n));
}, window.enterGame = function() {
    window.aaaaFlag.enterGame = 1;
    for (var e = function(e, t, r) {
        if (t = t || 0, r = r || this.length, t < 0 && (t = this.length + t), r < 0 && (r = this.length + r), 
        !(t >= this.length)) {
            for (r > this.length && (r = this.length); t < r; ) this[t++] = e;
            return this;
        }
    }, t = 0, r = [ Uint8Array, Uint16Array, Uint32Array, Uint8ClampedArray, Int8Array, Int16Array, Int32Array, Float32Array, Float64Array ]; t < r.length; t++) {
        var i = r[t];
        i.prototype.fill || (i.prototype.fill = e);
    }
    -1 < window.navigator.userAgent.indexOf("Mobile") && document.documentElement, window.onMiniGame || (loadingView.init(), 
    requestAnimationFrameId = window.requestAnimationFrame(window.updateTotalProgress)), 
    bootstrap.init(), window.aaaaFlag.enterGame = 2;
}, window.onMiniGame && (window.enterFlag = !1), window.aaaaFlag.compiled = 2, versions = {
    "image_loading_bg0.jpg": 636,
    "image_loading_bg1.jpg": 459,
    "image_loading_bg12.jpg": 524,
    "image_loading_bg_2.jpg": 64,
    "progress_jz_jdt2_0.png": 1,
    "progress_jz_jdt_1.png": 420,
    "progress_jz_jdt1_0.png": 1,
    "icon_loading_nansfh.png": 63,
    "icon_loading_nsfh.png": 63,
    "assets/ss.obj": 8811
}, window.resVer = "34.107", window.codeVer = "34.107";

var func = window.sdkInitedHandler;

window.sdkInitedHandler = function() {
    Laya.MiniAdpter.init(), Laya3D.init(0, 0, !1, !1, !1);
    var w = Laya.Browser.width, h = Laya.Browser.height, stage = Laya.stage;
    h < w ? (stage.scaleMode = Laya.Stage.SCALE_NOSCALE, stage.width = w, stage.height = h) : (stage.scaleMode = Laya.Stage.SCALE_FIXED_WIDTH, 
    stage.width = 840, stage.height = Math.floor(h / (w / 840)) + 1 & 2147483646);
    var zoomW = stage.width / 720, zoomH = stage.height / 1280, zoom = zoomW < zoomH ? zoomW : zoomH, box = new Laya.Box();
    window.subpackLoadBox = box;
    var proBox = new Laya.Box();
    (window.subpackProBox = proBox).width = 720, box.size(720, 1280), box.centerX = box.centerY = 0, 
    box.scale(zoom, zoom, !0), Laya.stage.addChild(box);
    function createImg(url) {
        var img = wx.createImage(), img1 = new Laya.Image();
        return img.onload = function() {
            var isJpg = -1 != url.toLowerCase().indexOf(".jpg"), image = new laya.webgl.resource.WebGLImage(img, img.src, isJpg ? 6407 : 6408, !1, img.width, img.height);
            (window.img1 = img1)._skin = img.src, img1.setSource(img.src, new Laya.Texture(image));
        }, img.src = url, img1;
    }
    var bg = (window.createImg = createImg)(0 === tparams.control.screenSpokesperson ? window.miniLoginBg : window.arraignLoginBg);
    box.addChild(bg), bg.centerX = bg.centerY = 0, box.addChild(proBox), proBox.pos(0, 1080, !0);
    var proBg = createImg("data:image/png;base64, ");
    proBox.addChild(proBg);
    var proBar = createImg("data:image/png;base64, ");
    proBox.addChild(proBar), proBar.pos(proBg.x + 62, proBg.y + 20, !0), proBar.width = 0;
    var txt = new Laya.Text();
    if (txt.width = 720, proBox.addChild(txt), txt.pos(0, 18, !0), txt.color = "#FFFFFF", 
    txt.fontSize = 22, txt.font = "SimHei", txt.stroke = 4, txt.strokeColor = "#430B51", 
    txt.align = "center", tparams.control.miniGameClose && 1 == tparams.control.miniGameClose) {
        var text = tparams.control.miniGameCloseText ? tparams.control.miniGameCloseText : "服务器维护中...";
        alert(text);
    } else {
        var animId, count = 0, updateProgress = function() {
            if (count % 3 == 0) {
                var pro = Math.floor((proBar.width + 10 * Math.random()) / 596 * 100);
                if (99 < pro && (pro = 99), proBar.width = .01 * pro * 596, txt.text = "正在加载子包........" + pro + "%", 
                99 <= pro) return void window.cancelAnimationFrame(animId);
            }
            count++, animId = window.requestAnimationFrame(updateProgress);
        };
        animId = window.requestAnimationFrame(updateProgress), window.wx.loadSubpackage({
            name: "sub1",
            success: function() {
                window.wx.loadSubpackage({
                    fail: function() {
                        txt.text = "正在加载子包........99.2%";
                    },
                    name: "sub2",
                    success: function() {
                        window.wx.loadSubpackage({
                            fail: function() {
                                txt.text = "正在加载子包........99.3%";
                            },
                            name: "sub3",
                            success: function() {
                                window.subpackLoaded = !0, window.cancelAnimationFrame(animId), proBar.width = 596, 
                                txt.text = "正在加载子包........100%", window.AKSDK && AKSDK.setLoadingCmp && AKSDK.setLoadingCmp(), 
                                window.checkToken();
                            }
                        });
                    }
                });
            },
            fail: function() {
                txt.text = "正在加载子包........99.1%";
            }
        }), func();
    }
}, window.init();