/*!!**
 * EIMMODEL V1.0.0
 * A WebGL-based 3D Viewer for threejs
 * http://www.i3vsoft.com/
 * Built on 2021-2-25 7:24:06 PM
 * commitHash 2611d22d

 * Copyright 2021, 广州君和信息技术有限公司
 ***/
!function(A, e) {
    "object" == typeof exports && "undefined" != typeof module ? e(exports) : "function" == typeof define && define.amd ? define(["exports"], e) : e((A = A || self).EIMMODEL = {})
}(this, (function(A) {
    "use strict";
    console.log("EIMMODEL Version: 1.0.0");
    var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {};
    !function(A, e) {
        A(e = {
            exports: {}
        }, e.exports)
    }((function(A) {
        !function(e, t) {
            var i = function() {
                function A(A) {
                    return "[object Array]" === Object.prototype.toString.call(A)
                }
                function e(A, e) {
                    for (var t in e)
                        e.hasOwnProperty(t) && (A[t] = e[t])
                }
                function t(A) {
                    if (!(this instanceof t))
                        throw new TypeError(this + "is not a promise");
                    if ("function" != typeof A)
                        throw new TypeError("Promise resolver " + A + " is not a function");
                    var e = new i;
                    this._resolver = e;
                    try {
                        A((function(A) {
                            e.resolve(A)
                        }
                        ), (function(A) {
                            e.reject(A)
                        }
                        ))
                    } catch (A) {
                        e.reject(A)
                    }
                }
                function i() {
                    this._callbacks = [],
                    this._errbacks = [],
                    this._status = "pending",
                    this._result = null
                }
                return e(t.prototype, {
                    then: function(A, e) {
                        var i, o, n = new this.constructor((function(A, e) {
                            i = A,
                            o = e
                        }
                        ));
                        return this._resolver._addCallbacks("function" == typeof A ? t._makeCallback(n, i, o, A) : i, "function" == typeof e ? t._makeCallback(n, i, o, e) : o),
                        n
                    },
                    catch: function(A) {
                        return this.then(void 0, A)
                    }
                }),
                t._makeCallback = function(A, e, t, i) {
                    return function(o) {
                        var n;
                        try {
                            n = i(o)
                        } catch (A) {
                            return void t(A)
                        }
                        n !== A ? e(n) : t(new TypeError("Cannot resolve a promise with itself"))
                    }
                }
                ,
                t.resolve = function(A) {
                    return A && A.constructor === this ? A : new this((function(e) {
                        e(A)
                    }
                    ))
                }
                ,
                t.reject = function(A) {
                    var e = new this((function() {}
                    ));
                    return e._resolver._result = A,
                    e._resolver._status = "rejected",
                    e
                }
                ,
                t.all = function(e) {
                    var t = this;
                    return new t((function(i, o) {
                        if (A(e)) {
                            var n = e.length
                              , r = 0
                              , a = e.length
                              , s = [];
                            if (1 > a)
                                return i(s);
                            for (; a > r; r++)
                                t.resolve(e[r]).then(l(r), o)
                        } else
                            o(new TypeError("Promise.all expects an array of values or promises"));
                        function l(A) {
                            return function(e) {
                                s[A] = e,
                                --n || i(s)
                            }
                        }
                    }
                    ))
                }
                ,
                t.race = function(e) {
                    var t = this;
                    return new t((function(i, o) {
                        if (A(e))
                            for (var n = 0, r = e.length; r > n; n++)
                                t.resolve(e[n]).then(i, o);
                        else
                            o(new TypeError("Promise.race expects an array of values or promises"))
                    }
                    ))
                }
                ,
                t.async = "undefined" != typeof setImmediate ? function(A) {
                    setImmediate(A)
                }
                : "undefined" != typeof process && process.nextTick ? process.nextTick : function(A) {
                    setTimeout(A, 0)
                }
                ,
                e(i.prototype, {
                    fulfill: function(A) {
                        var e = this._status;
                        "pending" !== e && "accepted" !== e || (this._result = A,
                        this._status = "fulfilled"),
                        "fulfilled" === this._status && (this._notify(this._callbacks, this._result),
                        this._callbacks = [],
                        this._errbacks = null)
                    },
                    reject: function(A) {
                        var e = this._status;
                        "pending" !== e && "accepted" !== e || (this._result = A,
                        this._status = "rejected"),
                        "rejected" === this._status && (this._notify(this._errbacks, this._result),
                        this._callbacks = null,
                        this._errbacks = [])
                    },
                    resolve: function(A) {
                        "pending" === this._status && (this._status = "accepted",
                        this._value = A,
                        (this._callbacks && this._callbacks.length || this._errbacks && this._errbacks.length) && this._unwrap(this._value))
                    },
                    _unwrap: function(A) {
                        var e, t = this, i = !1;
                        if (!A || "object" != typeof A && "function" != typeof A)
                            t.fulfill(A);
                        else
                            try {
                                "function" == typeof (e = A.then) ? e.call(A, (function(A) {
                                    i || (i = !0,
                                    t._unwrap(A))
                                }
                                ), (function(A) {
                                    i || (i = !0,
                                    t.reject(A))
                                }
                                )) : t.fulfill(A)
                            } catch (A) {
                                i || t.reject(A)
                            }
                    },
                    _addCallbacks: function(A, e) {
                        var t = this._callbacks
                          , i = this._errbacks;
                        switch (t && t.push(A),
                        i && i.push(e),
                        this._status) {
                        case "accepted":
                            this._unwrap(this._value);
                            break;
                        case "fulfilled":
                            this.fulfill(this._result);
                            break;
                        case "rejected":
                            this.reject(this._result)
                        }
                    },
                    _notify: function(A, e) {
                        A.length && t.async((function() {
                            var t, i;
                            for (t = 0,
                            i = A.length; i > t; ++t)
                                A[t](e)
                        }
                        ))
                    }
                }),
                t.Resolver = i,
                t
            }();
            A && (A.exports = i),
            (e = e || self).PromisePolyfill = i,
            e.Promise || (e.Promise = i)
        }(e)
    }
    ));
    void 0 === Number.EPSILON && (Number.EPSILON = Math.pow(2, -52)),
    void 0 === Number.isInteger && (Number.isInteger = function(A) {
        return "number" == typeof A && isFinite(A) && Math.floor(A) === A
    }
    ),
    void 0 === Math.sign && (Math.sign = function(A) {
        return 0 > A ? -1 : A > 0 ? 1 : +A
    }
    ),
    "name"in Function.prototype == !1 && Object.defineProperty(Function.prototype, "name", {
        get: function() {
            return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]
        }
    }),
    void 0 === Object.assign && (Object.assign = function(A) {
        if (null == A)
            throw new TypeError("Cannot convert undefined or null to object");
        for (var e = Object(A), t = 1; arguments.length > t; t++) {
            var i = arguments[t];
            if (null != i)
                for (var o in i)
                    Object.prototype.hasOwnProperty.call(i, o) && (e[o] = i[o])
        }
        return e
    }
    );
    var t = {
        LEFT: 0,
        MIDDLE: 1,
        RIGHT: 2,
        ROTATE: 0,
        DOLLY: 1,
        PAN: 2
    };
    function i() {}
    Object.assign(i.prototype, {
        addEventListener: function(A, e) {
            void 0 === this._listeners && (this._listeners = {});
            var t = this._listeners;
            void 0 === t[A] && (t[A] = []),
            -1 === t[A].indexOf(e) && t[A].push(e)
        },
        hasEventListener: function(A, e) {
            if (void 0 === this._listeners)
                return !1;
            var t = this._listeners;
            return void 0 !== t[A] && -1 !== t[A].indexOf(e)
        },
        removeEventListener: function(A, e) {
            if (void 0 !== this._listeners) {
                var t = this._listeners[A];
                if (void 0 !== t) {
                    var i = t.indexOf(e);
                    -1 !== i && t.splice(i, 1)
                }
            }
        },
        dispatchEvent: function(A) {
            if (void 0 !== this._listeners) {
                var e = this._listeners[A.type];
                if (void 0 !== e) {
                    A.target = this;
                    for (var t = e.slice(0), i = 0, o = t.length; o > i; i++)
                        t[i].call(this, A)
                }
            }
        }
    });
    for (var o = [], n = 0; 256 > n; n++)
        o[n] = (16 > n ? "0" : "") + n.toString(16);
    var r, a = {
        DEG2RAD: Math.PI / 180,
        RAD2DEG: 180 / Math.PI,
        generateUUID: function() {
            var A = 4294967295 * Math.random() | 0
              , e = 4294967295 * Math.random() | 0
              , t = 4294967295 * Math.random() | 0
              , i = 4294967295 * Math.random() | 0;
            return (o[255 & A] + o[A >> 8 & 255] + o[A >> 16 & 255] + o[A >> 24 & 255] + "-" + o[255 & e] + o[e >> 8 & 255] + "-" + o[e >> 16 & 15 | 64] + o[e >> 24 & 255] + "-" + o[63 & t | 128] + o[t >> 8 & 255] + "-" + o[t >> 16 & 255] + o[t >> 24 & 255] + o[255 & i] + o[i >> 8 & 255] + o[i >> 16 & 255] + o[i >> 24 & 255]).toUpperCase()
        },
        clamp: function(A, e, t) {
            return Math.max(e, Math.min(t, A))
        },
        euclideanModulo: function(A, e) {
            return (A % e + e) % e
        },
        mapLinear: function(A, e, t, i, o) {
            return i + (A - e) * (o - i) / (t - e)
        },
        lerp: function(A, e, t) {
            return (1 - t) * A + t * e
        },
        smoothstep: function(A, e, t) {
            return A > e ? t > A ? (A = (A - e) / (t - e)) * A * (3 - 2 * A) : 1 : 0
        },
        smootherstep: function(A, e, t) {
            return A > e ? t > A ? (A = (A - e) / (t - e)) * A * A * (A * (6 * A - 15) + 10) : 1 : 0
        },
        randInt: function(A, e) {
            return A + Math.floor(Math.random() * (e - A + 1))
        },
        randFloat: function(A, e) {
            return A + Math.random() * (e - A)
        },
        randFloatSpread: function(A) {
            return A * (.5 - Math.random())
        },
        degToRad: function(A) {
            return A * a.DEG2RAD
        },
        radToDeg: function(A) {
            return A * a.RAD2DEG
        },
        isPowerOfTwo: function(A) {
            return 0 == (A & A - 1) && 0 !== A
        },
        ceilPowerOfTwo: function(A) {
            return Math.pow(2, Math.ceil(Math.log(A) / Math.LN2))
        },
        floorPowerOfTwo: function(A) {
            return Math.pow(2, Math.floor(Math.log(A) / Math.LN2))
        },
        setQuaternionFromProperEuler: function(A, e, t, i, o) {
            var n = Math.cos
              , r = Math.sin
              , a = n(t / 2)
              , s = r(t / 2)
              , l = n((e + i) / 2)
              , c = r((e + i) / 2)
              , h = n((e - i) / 2)
              , d = r((e - i) / 2)
              , p = n((i - e) / 2)
              , g = r((i - e) / 2);
            "XYX" === o ? A.set(a * c, s * h, s * d, a * l) : "YZY" === o ? A.set(s * d, a * c, s * h, a * l) : "ZXZ" === o ? A.set(s * h, s * d, a * c, a * l) : "XZX" === o ? A.set(a * c, s * g, s * p, a * l) : "YXY" === o ? A.set(s * p, a * c, s * g, a * l) : "ZYZ" === o ? A.set(s * g, s * p, a * c, a * l) : console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.")
        }
    };
    function s(A, e) {
        this.x = A || 0,
        this.y = e || 0
    }
    function l() {
        this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1],
        arguments.length > 0 && console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")
    }
    Object.defineProperties(s.prototype, {
        width: {
            get: function() {
                return this.x
            },
            set: function(A) {
                this.x = A
            }
        },
        height: {
            get: function() {
                return this.y
            },
            set: function(A) {
                this.y = A
            }
        }
    }),
    Object.assign(s.prototype, {
        isVector2: !0,
        set: function(A, e) {
            return this.x = A,
            this.y = e,
            this
        },
        setScalar: function(A) {
            return this.x = A,
            this.y = A,
            this
        },
        setX: function(A) {
            return this.x = A,
            this
        },
        setY: function(A) {
            return this.y = A,
            this
        },
        setComponent: function(A, e) {
            switch (A) {
            case 0:
                this.x = e;
                break;
            case 1:
                this.y = e;
                break;
            default:
                throw new Error("index is out of range: " + A)
            }
            return this
        },
        getComponent: function(A) {
            switch (A) {
            case 0:
                return this.x;
            case 1:
                return this.y;
            default:
                throw new Error("index is out of range: " + A)
            }
        },
        clone: function() {
            return new this.constructor(this.x,this.y)
        },
        copy: function(A) {
            return this.x = A.x,
            this.y = A.y,
            this
        },
        add: function(A, e) {
            return void 0 !== e ? (console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),
            this.addVectors(A, e)) : (this.x += A.x,
            this.y += A.y,
            this)
        },
        addScalar: function(A) {
            return this.x += A,
            this.y += A,
            this
        },
        addVectors: function(A, e) {
            return this.x = A.x + e.x,
            this.y = A.y + e.y,
            this
        },
        addScaledVector: function(A, e) {
            return this.x += A.x * e,
            this.y += A.y * e,
            this
        },
        sub: function(A, e) {
            return void 0 !== e ? (console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
            this.subVectors(A, e)) : (this.x -= A.x,
            this.y -= A.y,
            this)
        },
        subScalar: function(A) {
            return this.x -= A,
            this.y -= A,
            this
        },
        subVectors: function(A, e) {
            return this.x = A.x - e.x,
            this.y = A.y - e.y,
            this
        },
        multiply: function(A) {
            return this.x *= A.x,
            this.y *= A.y,
            this
        },
        multiplyScalar: function(A) {
            return this.x *= A,
            this.y *= A,
            this
        },
        divide: function(A) {
            return this.x /= A.x,
            this.y /= A.y,
            this
        },
        divideScalar: function(A) {
            return this.multiplyScalar(1 / A)
        },
        applyMatrix3: function(A) {
            var e = this.x
              , t = this.y
              , i = A.elements;
            return this.x = i[0] * e + i[3] * t + i[6],
            this.y = i[1] * e + i[4] * t + i[7],
            this
        },
        min: function(A) {
            return this.x = Math.min(this.x, A.x),
            this.y = Math.min(this.y, A.y),
            this
        },
        max: function(A) {
            return this.x = Math.max(this.x, A.x),
            this.y = Math.max(this.y, A.y),
            this
        },
        clamp: function(A, e) {
            return this.x = Math.max(A.x, Math.min(e.x, this.x)),
            this.y = Math.max(A.y, Math.min(e.y, this.y)),
            this
        },
        clampScalar: function(A, e) {
            return this.x = Math.max(A, Math.min(e, this.x)),
            this.y = Math.max(A, Math.min(e, this.y)),
            this
        },
        clampLength: function(A, e) {
            var t = this.length();
            return this.divideScalar(t || 1).multiplyScalar(Math.max(A, Math.min(e, t)))
        },
        floor: function() {
            return this.x = Math.floor(this.x),
            this.y = Math.floor(this.y),
            this
        },
        ceil: function() {
            return this.x = Math.ceil(this.x),
            this.y = Math.ceil(this.y),
            this
        },
        round: function() {
            return this.x = Math.round(this.x),
            this.y = Math.round(this.y),
            this
        },
        roundToZero: function() {
            return this.x = 0 > this.x ? Math.ceil(this.x) : Math.floor(this.x),
            this.y = 0 > this.y ? Math.ceil(this.y) : Math.floor(this.y),
            this
        },
        negate: function() {
            return this.x = -this.x,
            this.y = -this.y,
            this
        },
        dot: function(A) {
            return this.x * A.x + this.y * A.y
        },
        cross: function(A) {
            return this.x * A.y - this.y * A.x
        },
        lengthSq: function() {
            return this.x * this.x + this.y * this.y
        },
        length: function() {
            return Math.sqrt(this.x * this.x + this.y * this.y)
        },
        manhattanLength: function() {
            return Math.abs(this.x) + Math.abs(this.y)
        },
        normalize: function() {
            return this.divideScalar(this.length() || 1)
        },
        angle: function() {
            return Math.atan2(-this.y, -this.x) + Math.PI
        },
        distanceTo: function(A) {
            return Math.sqrt(this.distanceToSquared(A))
        },
        distanceToSquared: function(A) {
            var e = this.x - A.x
              , t = this.y - A.y;
            return e * e + t * t
        },
        manhattanDistanceTo: function(A) {
            return Math.abs(this.x - A.x) + Math.abs(this.y - A.y)
        },
        setLength: function(A) {
            return this.normalize().multiplyScalar(A)
        },
        lerp: function(A, e) {
            return this.x += (A.x - this.x) * e,
            this.y += (A.y - this.y) * e,
            this
        },
        lerpVectors: function(A, e, t) {
            return this.subVectors(e, A).multiplyScalar(t).add(A)
        },
        equals: function(A) {
            return A.x === this.x && A.y === this.y
        },
        fromArray: function(A, e) {
            return void 0 === e && (e = 0),
            this.x = A[e],
            this.y = A[e + 1],
            this
        },
        toArray: function(A, e) {
            return void 0 === A && (A = []),
            void 0 === e && (e = 0),
            A[e] = this.x,
            A[e + 1] = this.y,
            A
        },
        fromBufferAttribute: function(A, e, t) {
            return void 0 !== t && console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),
            this.x = A.getX(e),
            this.y = A.getY(e),
            this
        },
        rotateAround: function(A, e) {
            var t = Math.cos(e)
              , i = Math.sin(e)
              , o = this.x - A.x
              , n = this.y - A.y;
            return this.x = o * t - n * i + A.x,
            this.y = o * i + n * t + A.y,
            this
        }
    }),
    Object.assign(l.prototype, {
        isMatrix3: !0,
        set: function(A, e, t, i, o, n, r, a, s) {
            var l = this.elements;
            return l[0] = A,
            l[1] = i,
            l[2] = r,
            l[3] = e,
            l[4] = o,
            l[5] = a,
            l[6] = t,
            l[7] = n,
            l[8] = s,
            this
        },
        identity: function() {
            return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1),
            this
        },
        clone: function() {
            return (new this.constructor).fromArray(this.elements)
        },
        copy: function(A) {
            var e = this.elements
              , t = A.elements;
            return e[0] = t[0],
            e[1] = t[1],
            e[2] = t[2],
            e[3] = t[3],
            e[4] = t[4],
            e[5] = t[5],
            e[6] = t[6],
            e[7] = t[7],
            e[8] = t[8],
            this
        },
        extractBasis: function(A, e, t) {
            return A.setFromMatrix3Column(this, 0),
            e.setFromMatrix3Column(this, 1),
            t.setFromMatrix3Column(this, 2),
            this
        },
        setFromMatrix4: function(A) {
            var e = A.elements;
            return this.set(e[0], e[4], e[8], e[1], e[5], e[9], e[2], e[6], e[10]),
            this
        },
        multiply: function(A) {
            return this.multiplyMatrices(this, A)
        },
        premultiply: function(A) {
            return this.multiplyMatrices(A, this)
        },
        multiplyMatrices: function(A, e) {
            var t = A.elements
              , i = e.elements
              , o = this.elements
              , n = t[0]
              , r = t[3]
              , a = t[6]
              , s = t[1]
              , l = t[4]
              , c = t[7]
              , h = t[2]
              , d = t[5]
              , p = t[8]
              , g = i[0]
              , u = i[3]
              , f = i[6]
              , m = i[1]
              , C = i[4]
              , y = i[7]
              , v = i[2]
              , I = i[5]
              , E = i[8];
            return o[0] = n * g + r * m + a * v,
            o[3] = n * u + r * C + a * I,
            o[6] = n * f + r * y + a * E,
            o[1] = s * g + l * m + c * v,
            o[4] = s * u + l * C + c * I,
            o[7] = s * f + l * y + c * E,
            o[2] = h * g + d * m + p * v,
            o[5] = h * u + d * C + p * I,
            o[8] = h * f + d * y + p * E,
            this
        },
        multiplyScalar: function(A) {
            var e = this.elements;
            return e[0] *= A,
            e[3] *= A,
            e[6] *= A,
            e[1] *= A,
            e[4] *= A,
            e[7] *= A,
            e[2] *= A,
            e[5] *= A,
            e[8] *= A,
            this
        },
        determinant: function() {
            var A = this.elements
              , e = A[0]
              , t = A[1]
              , i = A[2]
              , o = A[3]
              , n = A[4]
              , r = A[5]
              , a = A[6]
              , s = A[7]
              , l = A[8];
            return e * n * l - e * r * s - t * o * l + t * r * a + i * o * s - i * n * a
        },
        getInverse: function(A, e) {
            void 0 !== e && console.warn("THREE.Matrix3: .getInverse() can no longer be configured to throw on degenerate.");
            var t = A.elements
              , i = this.elements
              , o = t[0]
              , n = t[1]
              , r = t[2]
              , a = t[3]
              , s = t[4]
              , l = t[5]
              , c = t[6]
              , h = t[7]
              , d = t[8]
              , p = d * s - l * h
              , g = l * c - d * a
              , u = h * a - s * c
              , f = o * p + n * g + r * u;
            if (0 === f)
                return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0);
            var m = 1 / f;
            return i[0] = p * m,
            i[1] = (r * h - d * n) * m,
            i[2] = (l * n - r * s) * m,
            i[3] = g * m,
            i[4] = (d * o - r * c) * m,
            i[5] = (r * a - l * o) * m,
            i[6] = u * m,
            i[7] = (n * c - h * o) * m,
            i[8] = (s * o - n * a) * m,
            this
        },
        transpose: function() {
            var A, e = this.elements;
            return A = e[1],
            e[1] = e[3],
            e[3] = A,
            A = e[2],
            e[2] = e[6],
            e[6] = A,
            A = e[5],
            e[5] = e[7],
            e[7] = A,
            this
        },
        getNormalMatrix: function(A) {
            return this.setFromMatrix4(A).getInverse(this).transpose()
        },
        transposeIntoArray: function(A) {
            var e = this.elements;
            return A[0] = e[0],
            A[1] = e[3],
            A[2] = e[6],
            A[3] = e[1],
            A[4] = e[4],
            A[5] = e[7],
            A[6] = e[2],
            A[7] = e[5],
            A[8] = e[8],
            this
        },
        setUvTransform: function(A, e, t, i, o, n, r) {
            var a = Math.cos(o)
              , s = Math.sin(o);
            this.set(t * a, t * s, -t * (a * n + s * r) + n + A, -i * s, i * a, -i * (-s * n + a * r) + r + e, 0, 0, 1)
        },
        scale: function(A, e) {
            var t = this.elements;
            return t[0] *= A,
            t[3] *= A,
            t[6] *= A,
            t[1] *= e,
            t[4] *= e,
            t[7] *= e,
            this
        },
        rotate: function(A) {
            var e = Math.cos(A)
              , t = Math.sin(A)
              , i = this.elements
              , o = i[0]
              , n = i[3]
              , r = i[6]
              , a = i[1]
              , s = i[4]
              , l = i[7];
            return i[0] = e * o + t * a,
            i[3] = e * n + t * s,
            i[6] = e * r + t * l,
            i[1] = -t * o + e * a,
            i[4] = -t * n + e * s,
            i[7] = -t * r + e * l,
            this
        },
        translate: function(A, e) {
            var t = this.elements;
            return t[0] += A * t[2],
            t[3] += A * t[5],
            t[6] += A * t[8],
            t[1] += e * t[2],
            t[4] += e * t[5],
            t[7] += e * t[8],
            this
        },
        equals: function(A) {
            for (var e = this.elements, t = A.elements, i = 0; 9 > i; i++)
                if (e[i] !== t[i])
                    return !1;
            return !0
        },
        fromArray: function(A, e) {
            void 0 === e && (e = 0);
            for (var t = 0; 9 > t; t++)
                this.elements[t] = A[t + e];
            return this
        },
        toArray: function(A, e) {
            void 0 === A && (A = []),
            void 0 === e && (e = 0);
            var t = this.elements;
            return A[e] = t[0],
            A[e + 1] = t[1],
            A[e + 2] = t[2],
            A[e + 3] = t[3],
            A[e + 4] = t[4],
            A[e + 5] = t[5],
            A[e + 6] = t[6],
            A[e + 7] = t[7],
            A[e + 8] = t[8],
            A
        }
    });
    var c = {
        getDataURL: function(A) {
            var e;
            if ("undefined" == typeof HTMLCanvasElement)
                return A.src;
            if (A instanceof HTMLCanvasElement)
                e = A;
            else {
                void 0 === r && (r = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas")),
                r.width = A.width,
                r.height = A.height;
                var t = r.getContext("2d");
                A instanceof ImageData ? t.putImageData(A, 0, 0) : t.drawImage(A, 0, 0, A.width, A.height),
                e = r
            }
            return e.width > 2048 || e.height > 2048 ? e.toDataURL("image/jpeg", .6) : e.toDataURL("image/png")
        }
    }
      , h = 0;
    function d(A, e, t, i, o, n, r, c, p, g) {
        Object.defineProperty(this, "id", {
            value: h++
        }),
        this.uuid = a.generateUUID(),
        this.name = "",
        this.image = void 0 !== A ? A : d.DEFAULT_IMAGE,
        this.mipmaps = [],
        this.mapping = void 0 !== e ? e : d.DEFAULT_MAPPING,
        this.wrapS = void 0 !== t ? t : 1001,
        this.wrapT = void 0 !== i ? i : 1001,
        this.magFilter = void 0 !== o ? o : 1006,
        this.minFilter = void 0 !== n ? n : 1008,
        this.anisotropy = void 0 !== p ? p : 1,
        this.format = void 0 !== r ? r : 1023,
        this.internalFormat = null,
        this.type = void 0 !== c ? c : 1009,
        this.offset = new s(0,0),
        this.repeat = new s(1,1),
        this.center = new s(0,0),
        this.rotation = 0,
        this.matrixAutoUpdate = !0,
        this.matrix = new l,
        this.generateMipmaps = !0,
        this.premultiplyAlpha = !1,
        this.flipY = !0,
        this.unpackAlignment = 4,
        this.encoding = void 0 !== g ? g : 3e3,
        this.version = 0,
        this.onUpdate = null
    }
    function p(A, e, t, i) {
        this.x = A || 0,
        this.y = e || 0,
        this.z = t || 0,
        this.w = void 0 !== i ? i : 1
    }
    function g(A, e, t) {
        this.width = A,
        this.height = e,
        this.scissor = new p(0,0,A,e),
        this.scissorTest = !1,
        this.viewport = new p(0,0,A,e),
        this.texture = new d(void 0,(t = t || {}).mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),
        this.texture.image = {},
        this.texture.image.width = A,
        this.texture.image.height = e,
        this.texture.generateMipmaps = void 0 !== t.generateMipmaps && t.generateMipmaps,
        this.texture.minFilter = void 0 !== t.minFilter ? t.minFilter : 1006,
        this.depthBuffer = void 0 === t.depthBuffer || t.depthBuffer,
        this.stencilBuffer = void 0 === t.stencilBuffer || t.stencilBuffer,
        this.depthTexture = void 0 !== t.depthTexture ? t.depthTexture : null
    }
    function u(A, e, t) {
        g.call(this, A, e, t),
        this.samples = 4
    }
    function f(A, e, t, i) {
        this._x = A || 0,
        this._y = e || 0,
        this._z = t || 0,
        this._w = void 0 !== i ? i : 1
    }
    d.DEFAULT_IMAGE = void 0,
    d.DEFAULT_MAPPING = 300,
    d.prototype = Object.assign(Object.create(i.prototype), {
        constructor: d,
        isTexture: !0,
        updateMatrix: function() {
            this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y)
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            return this.name = A.name,
            this.image = A.image,
            this.mipmaps = A.mipmaps.slice(0),
            this.mapping = A.mapping,
            this.wrapS = A.wrapS,
            this.wrapT = A.wrapT,
            this.magFilter = A.magFilter,
            this.minFilter = A.minFilter,
            this.anisotropy = A.anisotropy,
            this.format = A.format,
            this.internalFormat = A.internalFormat,
            this.type = A.type,
            this.offset.copy(A.offset),
            this.repeat.copy(A.repeat),
            this.center.copy(A.center),
            this.rotation = A.rotation,
            this.matrixAutoUpdate = A.matrixAutoUpdate,
            this.matrix.copy(A.matrix),
            this.generateMipmaps = A.generateMipmaps,
            this.premultiplyAlpha = A.premultiplyAlpha,
            this.flipY = A.flipY,
            this.unpackAlignment = A.unpackAlignment,
            this.encoding = A.encoding,
            this
        },
        toJSON: function(A) {
            var e = void 0 === A || "string" == typeof A;
            if (!e && void 0 !== A.textures[this.uuid])
                return A.textures[this.uuid];
            var t = {
                metadata: {
                    version: 4.5,
                    type: "Texture",
                    generator: "Texture.toJSON"
                },
                uuid: this.uuid,
                name: this.name,
                mapping: this.mapping,
                repeat: [this.repeat.x, this.repeat.y],
                offset: [this.offset.x, this.offset.y],
                center: [this.center.x, this.center.y],
                rotation: this.rotation,
                wrap: [this.wrapS, this.wrapT],
                format: this.format,
                type: this.type,
                encoding: this.encoding,
                minFilter: this.minFilter,
                magFilter: this.magFilter,
                anisotropy: this.anisotropy,
                flipY: this.flipY,
                premultiplyAlpha: this.premultiplyAlpha,
                unpackAlignment: this.unpackAlignment
            };
            if (void 0 !== this.image) {
                var i = this.image;
                if (void 0 === i.uuid && (i.uuid = a.generateUUID()),
                !e && void 0 === A.images[i.uuid]) {
                    var o;
                    if (Array.isArray(i)) {
                        o = [];
                        for (var n = 0, r = i.length; r > n; n++)
                            o.push(c.getDataURL(i[n]))
                    } else
                        o = c.getDataURL(i);
                    A.images[i.uuid] = {
                        uuid: i.uuid,
                        url: o
                    }
                }
                t.image = i.uuid
            }
            return e || (A.textures[this.uuid] = t),
            t
        },
        dispose: function() {
            this.dispatchEvent({
                type: "dispose"
            })
        },
        transformUv: function(A) {
            if (300 !== this.mapping)
                return A;
            if (A.applyMatrix3(this.matrix),
            0 > A.x || A.x > 1)
                switch (this.wrapS) {
                case 1e3:
                    A.x = A.x - Math.floor(A.x);
                    break;
                case 1001:
                    A.x = 0 > A.x ? 0 : 1;
                    break;
                case 1002:
                    A.x = 1 === Math.abs(Math.floor(A.x) % 2) ? Math.ceil(A.x) - A.x : A.x - Math.floor(A.x)
                }
            if (0 > A.y || A.y > 1)
                switch (this.wrapT) {
                case 1e3:
                    A.y = A.y - Math.floor(A.y);
                    break;
                case 1001:
                    A.y = 0 > A.y ? 0 : 1;
                    break;
                case 1002:
                    A.y = 1 === Math.abs(Math.floor(A.y) % 2) ? Math.ceil(A.y) - A.y : A.y - Math.floor(A.y)
                }
            return this.flipY && (A.y = 1 - A.y),
            A
        }
    }),
    Object.defineProperty(d.prototype, "needsUpdate", {
        set: function(A) {
            !0 === A && this.version++
        }
    }),
    Object.defineProperties(p.prototype, {
        width: {
            get: function() {
                return this.z
            },
            set: function(A) {
                this.z = A
            }
        },
        height: {
            get: function() {
                return this.w
            },
            set: function(A) {
                this.w = A
            }
        }
    }),
    Object.assign(p.prototype, {
        isVector4: !0,
        set: function(A, e, t, i) {
            return this.x = A,
            this.y = e,
            this.z = t,
            this.w = i,
            this
        },
        setScalar: function(A) {
            return this.x = A,
            this.y = A,
            this.z = A,
            this.w = A,
            this
        },
        setX: function(A) {
            return this.x = A,
            this
        },
        setY: function(A) {
            return this.y = A,
            this
        },
        setZ: function(A) {
            return this.z = A,
            this
        },
        setW: function(A) {
            return this.w = A,
            this
        },
        setComponent: function(A, e) {
            switch (A) {
            case 0:
                this.x = e;
                break;
            case 1:
                this.y = e;
                break;
            case 2:
                this.z = e;
                break;
            case 3:
                this.w = e;
                break;
            default:
                throw new Error("index is out of range: " + A)
            }
            return this
        },
        getComponent: function(A) {
            switch (A) {
            case 0:
                return this.x;
            case 1:
                return this.y;
            case 2:
                return this.z;
            case 3:
                return this.w;
            default:
                throw new Error("index is out of range: " + A)
            }
        },
        clone: function() {
            return new this.constructor(this.x,this.y,this.z,this.w)
        },
        copy: function(A) {
            return this.x = A.x,
            this.y = A.y,
            this.z = A.z,
            this.w = void 0 !== A.w ? A.w : 1,
            this
        },
        add: function(A, e) {
            return void 0 !== e ? (console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),
            this.addVectors(A, e)) : (this.x += A.x,
            this.y += A.y,
            this.z += A.z,
            this.w += A.w,
            this)
        },
        addScalar: function(A) {
            return this.x += A,
            this.y += A,
            this.z += A,
            this.w += A,
            this
        },
        addVectors: function(A, e) {
            return this.x = A.x + e.x,
            this.y = A.y + e.y,
            this.z = A.z + e.z,
            this.w = A.w + e.w,
            this
        },
        addScaledVector: function(A, e) {
            return this.x += A.x * e,
            this.y += A.y * e,
            this.z += A.z * e,
            this.w += A.w * e,
            this
        },
        sub: function(A, e) {
            return void 0 !== e ? (console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
            this.subVectors(A, e)) : (this.x -= A.x,
            this.y -= A.y,
            this.z -= A.z,
            this.w -= A.w,
            this)
        },
        subScalar: function(A) {
            return this.x -= A,
            this.y -= A,
            this.z -= A,
            this.w -= A,
            this
        },
        subVectors: function(A, e) {
            return this.x = A.x - e.x,
            this.y = A.y - e.y,
            this.z = A.z - e.z,
            this.w = A.w - e.w,
            this
        },
        multiplyScalar: function(A) {
            return this.x *= A,
            this.y *= A,
            this.z *= A,
            this.w *= A,
            this
        },
        applyMatrix4: function(A) {
            var e = this.x
              , t = this.y
              , i = this.z
              , o = this.w
              , n = A.elements;
            return this.x = n[0] * e + n[4] * t + n[8] * i + n[12] * o,
            this.y = n[1] * e + n[5] * t + n[9] * i + n[13] * o,
            this.z = n[2] * e + n[6] * t + n[10] * i + n[14] * o,
            this.w = n[3] * e + n[7] * t + n[11] * i + n[15] * o,
            this
        },
        divideScalar: function(A) {
            return this.multiplyScalar(1 / A)
        },
        setAxisAngleFromQuaternion: function(A) {
            this.w = 2 * Math.acos(A.w);
            var e = Math.sqrt(1 - A.w * A.w);
            return 1e-4 > e ? (this.x = 1,
            this.y = 0,
            this.z = 0) : (this.x = A.x / e,
            this.y = A.y / e,
            this.z = A.z / e),
            this
        },
        setAxisAngleFromRotationMatrix: function(A) {
            var e, t, i, o, n = A.elements, r = n[0], a = n[4], s = n[8], l = n[1], c = n[5], h = n[9], d = n[2], p = n[6], g = n[10];
            if (.01 > Math.abs(a - l) && .01 > Math.abs(s - d) && .01 > Math.abs(h - p)) {
                if (.1 > Math.abs(a + l) && .1 > Math.abs(s + d) && .1 > Math.abs(h + p) && .1 > Math.abs(r + c + g - 3))
                    return this.set(1, 0, 0, 0),
                    this;
                e = Math.PI;
                var u = (r + 1) / 2
                  , f = (c + 1) / 2
                  , m = (g + 1) / 2
                  , C = (a + l) / 4
                  , y = (s + d) / 4
                  , v = (h + p) / 4;
                return u > f && u > m ? .01 > u ? (t = 0,
                i = .707106781,
                o = .707106781) : (i = C / (t = Math.sqrt(u)),
                o = y / t) : f > m ? .01 > f ? (t = .707106781,
                i = 0,
                o = .707106781) : (t = C / (i = Math.sqrt(f)),
                o = v / i) : .01 > m ? (t = .707106781,
                i = .707106781,
                o = 0) : (t = y / (o = Math.sqrt(m)),
                i = v / o),
                this.set(t, i, o, e),
                this
            }
            var I = Math.sqrt((p - h) * (p - h) + (s - d) * (s - d) + (l - a) * (l - a));
            return .001 > Math.abs(I) && (I = 1),
            this.x = (p - h) / I,
            this.y = (s - d) / I,
            this.z = (l - a) / I,
            this.w = Math.acos((r + c + g - 1) / 2),
            this
        },
        min: function(A) {
            return this.x = Math.min(this.x, A.x),
            this.y = Math.min(this.y, A.y),
            this.z = Math.min(this.z, A.z),
            this.w = Math.min(this.w, A.w),
            this
        },
        max: function(A) {
            return this.x = Math.max(this.x, A.x),
            this.y = Math.max(this.y, A.y),
            this.z = Math.max(this.z, A.z),
            this.w = Math.max(this.w, A.w),
            this
        },
        clamp: function(A, e) {
            return this.x = Math.max(A.x, Math.min(e.x, this.x)),
            this.y = Math.max(A.y, Math.min(e.y, this.y)),
            this.z = Math.max(A.z, Math.min(e.z, this.z)),
            this.w = Math.max(A.w, Math.min(e.w, this.w)),
            this
        },
        clampScalar: function(A, e) {
            return this.x = Math.max(A, Math.min(e, this.x)),
            this.y = Math.max(A, Math.min(e, this.y)),
            this.z = Math.max(A, Math.min(e, this.z)),
            this.w = Math.max(A, Math.min(e, this.w)),
            this
        },
        clampLength: function(A, e) {
            var t = this.length();
            return this.divideScalar(t || 1).multiplyScalar(Math.max(A, Math.min(e, t)))
        },
        floor: function() {
            return this.x = Math.floor(this.x),
            this.y = Math.floor(this.y),
            this.z = Math.floor(this.z),
            this.w = Math.floor(this.w),
            this
        },
        ceil: function() {
            return this.x = Math.ceil(this.x),
            this.y = Math.ceil(this.y),
            this.z = Math.ceil(this.z),
            this.w = Math.ceil(this.w),
            this
        },
        round: function() {
            return this.x = Math.round(this.x),
            this.y = Math.round(this.y),
            this.z = Math.round(this.z),
            this.w = Math.round(this.w),
            this
        },
        roundToZero: function() {
            return this.x = 0 > this.x ? Math.ceil(this.x) : Math.floor(this.x),
            this.y = 0 > this.y ? Math.ceil(this.y) : Math.floor(this.y),
            this.z = 0 > this.z ? Math.ceil(this.z) : Math.floor(this.z),
            this.w = 0 > this.w ? Math.ceil(this.w) : Math.floor(this.w),
            this
        },
        negate: function() {
            return this.x = -this.x,
            this.y = -this.y,
            this.z = -this.z,
            this.w = -this.w,
            this
        },
        dot: function(A) {
            return this.x * A.x + this.y * A.y + this.z * A.z + this.w * A.w
        },
        lengthSq: function() {
            return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w
        },
        length: function() {
            return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w)
        },
        manhattanLength: function() {
            return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w)
        },
        normalize: function() {
            return this.divideScalar(this.length() || 1)
        },
        setLength: function(A) {
            return this.normalize().multiplyScalar(A)
        },
        lerp: function(A, e) {
            return this.x += (A.x - this.x) * e,
            this.y += (A.y - this.y) * e,
            this.z += (A.z - this.z) * e,
            this.w += (A.w - this.w) * e,
            this
        },
        lerpVectors: function(A, e, t) {
            return this.subVectors(e, A).multiplyScalar(t).add(A)
        },
        equals: function(A) {
            return A.x === this.x && A.y === this.y && A.z === this.z && A.w === this.w
        },
        fromArray: function(A, e) {
            return void 0 === e && (e = 0),
            this.x = A[e],
            this.y = A[e + 1],
            this.z = A[e + 2],
            this.w = A[e + 3],
            this
        },
        toArray: function(A, e) {
            return void 0 === A && (A = []),
            void 0 === e && (e = 0),
            A[e] = this.x,
            A[e + 1] = this.y,
            A[e + 2] = this.z,
            A[e + 3] = this.w,
            A
        },
        fromBufferAttribute: function(A, e, t) {
            return void 0 !== t && console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),
            this.x = A.getX(e),
            this.y = A.getY(e),
            this.z = A.getZ(e),
            this.w = A.getW(e),
            this
        }
    }),
    g.prototype = Object.assign(Object.create(i.prototype), {
        constructor: g,
        isWebGLRenderTarget: !0,
        setSize: function(A, e) {
            this.width === A && this.height === e || (this.width = A,
            this.height = e,
            this.texture.image.width = A,
            this.texture.image.height = e,
            this.dispose()),
            this.viewport.set(0, 0, A, e),
            this.scissor.set(0, 0, A, e)
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            return this.width = A.width,
            this.height = A.height,
            this.viewport.copy(A.viewport),
            this.texture = A.texture.clone(),
            this.depthBuffer = A.depthBuffer,
            this.stencilBuffer = A.stencilBuffer,
            this.depthTexture = A.depthTexture,
            this
        },
        dispose: function() {
            this.dispatchEvent({
                type: "dispose"
            })
        }
    }),
    u.prototype = Object.assign(Object.create(g.prototype), {
        constructor: u,
        isWebGLMultisampleRenderTarget: !0,
        copy: function(A) {
            return g.prototype.copy.call(this, A),
            this.samples = A.samples,
            this
        }
    }),
    Object.assign(f, {
        slerp: function(A, e, t, i) {
            return t.copy(A).slerp(e, i)
        },
        slerpFlat: function(A, e, t, i, o, n, r) {
            var a = t[i + 0]
              , s = t[i + 1]
              , l = t[i + 2]
              , c = t[i + 3]
              , h = o[n + 0]
              , d = o[n + 1]
              , p = o[n + 2]
              , g = o[n + 3];
            if (c !== g || a !== h || s !== d || l !== p) {
                var u = 1 - r
                  , f = a * h + s * d + l * p + c * g
                  , m = 0 > f ? -1 : 1
                  , C = 1 - f * f;
                if (C > Number.EPSILON) {
                    var y = Math.sqrt(C)
                      , v = Math.atan2(y, f * m);
                    u = Math.sin(u * v) / y,
                    r = Math.sin(r * v) / y
                }
                var I = r * m;
                if (a = a * u + h * I,
                s = s * u + d * I,
                l = l * u + p * I,
                c = c * u + g * I,
                u === 1 - r) {
                    var E = 1 / Math.sqrt(a * a + s * s + l * l + c * c);
                    a *= E,
                    s *= E,
                    l *= E,
                    c *= E
                }
            }
            A[e] = a,
            A[e + 1] = s,
            A[e + 2] = l,
            A[e + 3] = c
        }
    }),
    Object.defineProperties(f.prototype, {
        x: {
            get: function() {
                return this._x
            },
            set: function(A) {
                this._x = A,
                this._onChangeCallback()
            }
        },
        y: {
            get: function() {
                return this._y
            },
            set: function(A) {
                this._y = A,
                this._onChangeCallback()
            }
        },
        z: {
            get: function() {
                return this._z
            },
            set: function(A) {
                this._z = A,
                this._onChangeCallback()
            }
        },
        w: {
            get: function() {
                return this._w
            },
            set: function(A) {
                this._w = A,
                this._onChangeCallback()
            }
        }
    }),
    Object.assign(f.prototype, {
        isQuaternion: !0,
        set: function(A, e, t, i) {
            return this._x = A,
            this._y = e,
            this._z = t,
            this._w = i,
            this._onChangeCallback(),
            this
        },
        clone: function() {
            return new this.constructor(this._x,this._y,this._z,this._w)
        },
        copy: function(A) {
            return this._x = A.x,
            this._y = A.y,
            this._z = A.z,
            this._w = A.w,
            this._onChangeCallback(),
            this
        },
        setFromEuler: function(A, e) {
            if (!A || !A.isEuler)
                throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");
            var t = A._x
              , i = A._y
              , o = A._z
              , n = A.order
              , r = Math.cos
              , a = Math.sin
              , s = r(t / 2)
              , l = r(i / 2)
              , c = r(o / 2)
              , h = a(t / 2)
              , d = a(i / 2)
              , p = a(o / 2);
            return "XYZ" === n ? (this._x = h * l * c + s * d * p,
            this._y = s * d * c - h * l * p,
            this._z = s * l * p + h * d * c,
            this._w = s * l * c - h * d * p) : "YXZ" === n ? (this._x = h * l * c + s * d * p,
            this._y = s * d * c - h * l * p,
            this._z = s * l * p - h * d * c,
            this._w = s * l * c + h * d * p) : "ZXY" === n ? (this._x = h * l * c - s * d * p,
            this._y = s * d * c + h * l * p,
            this._z = s * l * p + h * d * c,
            this._w = s * l * c - h * d * p) : "ZYX" === n ? (this._x = h * l * c - s * d * p,
            this._y = s * d * c + h * l * p,
            this._z = s * l * p - h * d * c,
            this._w = s * l * c + h * d * p) : "YZX" === n ? (this._x = h * l * c + s * d * p,
            this._y = s * d * c + h * l * p,
            this._z = s * l * p - h * d * c,
            this._w = s * l * c - h * d * p) : "XZY" === n && (this._x = h * l * c - s * d * p,
            this._y = s * d * c - h * l * p,
            this._z = s * l * p + h * d * c,
            this._w = s * l * c + h * d * p),
            !1 !== e && this._onChangeCallback(),
            this
        },
        setFromAxisAngle: function(A, e) {
            var t = e / 2
              , i = Math.sin(t);
            return this._x = A.x * i,
            this._y = A.y * i,
            this._z = A.z * i,
            this._w = Math.cos(t),
            this._onChangeCallback(),
            this
        },
        setFromRotationMatrix: function(A) {
            var e, t = A.elements, i = t[0], o = t[4], n = t[8], r = t[1], a = t[5], s = t[9], l = t[2], c = t[6], h = t[10], d = i + a + h;
            return d > 0 ? (e = .5 / Math.sqrt(d + 1),
            this._w = .25 / e,
            this._x = (c - s) * e,
            this._y = (n - l) * e,
            this._z = (r - o) * e) : i > a && i > h ? (e = 2 * Math.sqrt(1 + i - a - h),
            this._w = (c - s) / e,
            this._x = .25 * e,
            this._y = (o + r) / e,
            this._z = (n + l) / e) : a > h ? (e = 2 * Math.sqrt(1 + a - i - h),
            this._w = (n - l) / e,
            this._x = (o + r) / e,
            this._y = .25 * e,
            this._z = (s + c) / e) : (e = 2 * Math.sqrt(1 + h - i - a),
            this._w = (r - o) / e,
            this._x = (n + l) / e,
            this._y = (s + c) / e,
            this._z = .25 * e),
            this._onChangeCallback(),
            this
        },
        setFromUnitVectors: function(A, e) {
            var t = A.dot(e) + 1;
            return 1e-6 > t ? (t = 0,
            Math.abs(A.x) > Math.abs(A.z) ? (this._x = -A.y,
            this._y = A.x,
            this._z = 0,
            this._w = t) : (this._x = 0,
            this._y = -A.z,
            this._z = A.y,
            this._w = t)) : (this._x = A.y * e.z - A.z * e.y,
            this._y = A.z * e.x - A.x * e.z,
            this._z = A.x * e.y - A.y * e.x,
            this._w = t),
            this.normalize()
        },
        angleTo: function(A) {
            return 2 * Math.acos(Math.abs(a.clamp(this.dot(A), -1, 1)))
        },
        rotateTowards: function(A, e) {
            var t = this.angleTo(A);
            if (0 === t)
                return this;
            var i = Math.min(1, e / t);
            return this.slerp(A, i),
            this
        },
        inverse: function() {
            return this.conjugate()
        },
        conjugate: function() {
            return this._x *= -1,
            this._y *= -1,
            this._z *= -1,
            this._onChangeCallback(),
            this
        },
        dot: function(A) {
            return this._x * A._x + this._y * A._y + this._z * A._z + this._w * A._w
        },
        lengthSq: function() {
            return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w
        },
        length: function() {
            return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w)
        },
        normalize: function() {
            var A = this.length();
            return 0 === A ? (this._x = 0,
            this._y = 0,
            this._z = 0,
            this._w = 1) : (this._x = this._x * (A = 1 / A),
            this._y = this._y * A,
            this._z = this._z * A,
            this._w = this._w * A),
            this._onChangeCallback(),
            this
        },
        multiply: function(A, e) {
            return void 0 !== e ? (console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),
            this.multiplyQuaternions(A, e)) : this.multiplyQuaternions(this, A)
        },
        premultiply: function(A) {
            return this.multiplyQuaternions(A, this)
        },
        multiplyQuaternions: function(A, e) {
            var t = A._x
              , i = A._y
              , o = A._z
              , n = A._w
              , r = e._x
              , a = e._y
              , s = e._z
              , l = e._w;
            return this._x = t * l + n * r + i * s - o * a,
            this._y = i * l + n * a + o * r - t * s,
            this._z = o * l + n * s + t * a - i * r,
            this._w = n * l - t * r - i * a - o * s,
            this._onChangeCallback(),
            this
        },
        slerp: function(A, e) {
            if (0 === e)
                return this;
            if (1 === e)
                return this.copy(A);
            var t = this._x
              , i = this._y
              , o = this._z
              , n = this._w
              , r = n * A._w + t * A._x + i * A._y + o * A._z;
            if (0 > r ? (this._w = -A._w,
            this._x = -A._x,
            this._y = -A._y,
            this._z = -A._z,
            r = -r) : this.copy(A),
            r >= 1)
                return this._w = n,
                this._x = t,
                this._y = i,
                this._z = o,
                this;
            var a = 1 - r * r;
            if (Number.EPSILON >= a) {
                var s = 1 - e;
                return this._w = s * n + e * this._w,
                this._x = s * t + e * this._x,
                this._y = s * i + e * this._y,
                this._z = s * o + e * this._z,
                this.normalize(),
                this._onChangeCallback(),
                this
            }
            var l = Math.sqrt(a)
              , c = Math.atan2(l, r)
              , h = Math.sin((1 - e) * c) / l
              , d = Math.sin(e * c) / l;
            return this._w = n * h + this._w * d,
            this._x = t * h + this._x * d,
            this._y = i * h + this._y * d,
            this._z = o * h + this._z * d,
            this._onChangeCallback(),
            this
        },
        equals: function(A) {
            return A._x === this._x && A._y === this._y && A._z === this._z && A._w === this._w
        },
        fromArray: function(A, e) {
            return void 0 === e && (e = 0),
            this._x = A[e],
            this._y = A[e + 1],
            this._z = A[e + 2],
            this._w = A[e + 3],
            this._onChangeCallback(),
            this
        },
        toArray: function(A, e) {
            return void 0 === A && (A = []),
            void 0 === e && (e = 0),
            A[e] = this._x,
            A[e + 1] = this._y,
            A[e + 2] = this._z,
            A[e + 3] = this._w,
            A
        },
        fromBufferAttribute: function(A, e) {
            return this._x = A.getX(e),
            this._y = A.getY(e),
            this._z = A.getZ(e),
            this._w = A.getW(e),
            this
        },
        _onChange: function(A) {
            return this._onChangeCallback = A,
            this
        },
        _onChangeCallback: function() {}
    });
    var m = new y
      , C = new f;
    function y(A, e, t) {
        this.x = A || 0,
        this.y = e || 0,
        this.z = t || 0
    }
    Object.assign(y.prototype, {
        isVector3: !0,
        set: function(A, e, t) {
            return this.x = A,
            this.y = e,
            this.z = t,
            this
        },
        setScalar: function(A) {
            return this.x = A,
            this.y = A,
            this.z = A,
            this
        },
        setX: function(A) {
            return this.x = A,
            this
        },
        setY: function(A) {
            return this.y = A,
            this
        },
        setZ: function(A) {
            return this.z = A,
            this
        },
        setComponent: function(A, e) {
            switch (A) {
            case 0:
                this.x = e;
                break;
            case 1:
                this.y = e;
                break;
            case 2:
                this.z = e;
                break;
            default:
                throw new Error("index is out of range: " + A)
            }
            return this
        },
        getComponent: function(A) {
            switch (A) {
            case 0:
                return this.x;
            case 1:
                return this.y;
            case 2:
                return this.z;
            default:
                throw new Error("index is out of range: " + A)
            }
        },
        clone: function() {
            return new this.constructor(this.x,this.y,this.z)
        },
        copy: function(A) {
            return this.x = A.x,
            this.y = A.y,
            this.z = A.z,
            this
        },
        add: function(A, e) {
            return void 0 !== e ? (console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),
            this.addVectors(A, e)) : (this.x += A.x,
            this.y += A.y,
            this.z += A.z,
            this)
        },
        addScalar: function(A) {
            return this.x += A,
            this.y += A,
            this.z += A,
            this
        },
        addVectors: function(A, e) {
            return this.x = A.x + e.x,
            this.y = A.y + e.y,
            this.z = A.z + e.z,
            this
        },
        addScaledVector: function(A, e) {
            return this.x += A.x * e,
            this.y += A.y * e,
            this.z += A.z * e,
            this
        },
        sub: function(A, e) {
            return void 0 !== e ? (console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
            this.subVectors(A, e)) : (this.x -= A.x,
            this.y -= A.y,
            this.z -= A.z,
            this)
        },
        subScalar: function(A) {
            return this.x -= A,
            this.y -= A,
            this.z -= A,
            this
        },
        subVectors: function(A, e) {
            return this.x = A.x - e.x,
            this.y = A.y - e.y,
            this.z = A.z - e.z,
            this
        },
        multiply: function(A, e) {
            return void 0 !== e ? (console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),
            this.multiplyVectors(A, e)) : (this.x *= A.x,
            this.y *= A.y,
            this.z *= A.z,
            this)
        },
        multiplyScalar: function(A) {
            return this.x *= A,
            this.y *= A,
            this.z *= A,
            this
        },
        multiplyVectors: function(A, e) {
            return this.x = A.x * e.x,
            this.y = A.y * e.y,
            this.z = A.z * e.z,
            this
        },
        applyEuler: function(A) {
            return A && A.isEuler || console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),
            this.applyQuaternion(C.setFromEuler(A))
        },
        applyAxisAngle: function(A, e) {
            return this.applyQuaternion(C.setFromAxisAngle(A, e))
        },
        applyMatrix3: function(A) {
            var e = this.x
              , t = this.y
              , i = this.z
              , o = A.elements;
            return this.x = o[0] * e + o[3] * t + o[6] * i,
            this.y = o[1] * e + o[4] * t + o[7] * i,
            this.z = o[2] * e + o[5] * t + o[8] * i,
            this
        },
        applyNormalMatrix: function(A) {
            return this.applyMatrix3(A).normalize()
        },
        applyMatrix4: function(A) {
            var e = this.x
              , t = this.y
              , i = this.z
              , o = A.elements
              , n = 1 / (o[3] * e + o[7] * t + o[11] * i + o[15]);
            return this.x = (o[0] * e + o[4] * t + o[8] * i + o[12]) * n,
            this.y = (o[1] * e + o[5] * t + o[9] * i + o[13]) * n,
            this.z = (o[2] * e + o[6] * t + o[10] * i + o[14]) * n,
            this
        },
        applyQuaternion: function(A) {
            var e = this.x
              , t = this.y
              , i = this.z
              , o = A.x
              , n = A.y
              , r = A.z
              , a = A.w
              , s = a * e + n * i - r * t
              , l = a * t + r * e - o * i
              , c = a * i + o * t - n * e
              , h = -o * e - n * t - r * i;
            return this.x = s * a + h * -o + l * -r - c * -n,
            this.y = l * a + h * -n + c * -o - s * -r,
            this.z = c * a + h * -r + s * -n - l * -o,
            this
        },
        project: function(A) {
            return this.applyMatrix4(A.matrixWorldInverse).applyMatrix4(A.projectionMatrix)
        },
        unproject: function(A) {
            return this.applyMatrix4(A.projectionMatrixInverse).applyMatrix4(A.matrixWorld)
        },
        transformDirection: function(A) {
            var e = this.x
              , t = this.y
              , i = this.z
              , o = A.elements;
            return this.x = o[0] * e + o[4] * t + o[8] * i,
            this.y = o[1] * e + o[5] * t + o[9] * i,
            this.z = o[2] * e + o[6] * t + o[10] * i,
            this.normalize()
        },
        divide: function(A) {
            return this.x /= A.x,
            this.y /= A.y,
            this.z /= A.z,
            this
        },
        divideScalar: function(A) {
            return this.multiplyScalar(1 / A)
        },
        min: function(A) {
            return this.x = Math.min(this.x, A.x),
            this.y = Math.min(this.y, A.y),
            this.z = Math.min(this.z, A.z),
            this
        },
        max: function(A) {
            return this.x = Math.max(this.x, A.x),
            this.y = Math.max(this.y, A.y),
            this.z = Math.max(this.z, A.z),
            this
        },
        clamp: function(A, e) {
            return this.x = Math.max(A.x, Math.min(e.x, this.x)),
            this.y = Math.max(A.y, Math.min(e.y, this.y)),
            this.z = Math.max(A.z, Math.min(e.z, this.z)),
            this
        },
        clampScalar: function(A, e) {
            return this.x = Math.max(A, Math.min(e, this.x)),
            this.y = Math.max(A, Math.min(e, this.y)),
            this.z = Math.max(A, Math.min(e, this.z)),
            this
        },
        clampLength: function(A, e) {
            var t = this.length();
            return this.divideScalar(t || 1).multiplyScalar(Math.max(A, Math.min(e, t)))
        },
        floor: function() {
            return this.x = Math.floor(this.x),
            this.y = Math.floor(this.y),
            this.z = Math.floor(this.z),
            this
        },
        ceil: function() {
            return this.x = Math.ceil(this.x),
            this.y = Math.ceil(this.y),
            this.z = Math.ceil(this.z),
            this
        },
        round: function() {
            return this.x = Math.round(this.x),
            this.y = Math.round(this.y),
            this.z = Math.round(this.z),
            this
        },
        roundToZero: function() {
            return this.x = 0 > this.x ? Math.ceil(this.x) : Math.floor(this.x),
            this.y = 0 > this.y ? Math.ceil(this.y) : Math.floor(this.y),
            this.z = 0 > this.z ? Math.ceil(this.z) : Math.floor(this.z),
            this
        },
        negate: function() {
            return this.x = -this.x,
            this.y = -this.y,
            this.z = -this.z,
            this
        },
        dot: function(A) {
            return this.x * A.x + this.y * A.y + this.z * A.z
        },
        lengthSq: function() {
            return this.x * this.x + this.y * this.y + this.z * this.z
        },
        length: function() {
            return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z)
        },
        manhattanLength: function() {
            return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z)
        },
        normalize: function() {
            return this.divideScalar(this.length() || 1)
        },
        setLength: function(A) {
            return this.normalize().multiplyScalar(A)
        },
        lerp: function(A, e) {
            return this.x += (A.x - this.x) * e,
            this.y += (A.y - this.y) * e,
            this.z += (A.z - this.z) * e,
            this
        },
        lerpVectors: function(A, e, t) {
            return this.subVectors(e, A).multiplyScalar(t).add(A)
        },
        cross: function(A, e) {
            return void 0 !== e ? (console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),
            this.crossVectors(A, e)) : this.crossVectors(this, A)
        },
        crossVectors: function(A, e) {
            var t = A.x
              , i = A.y
              , o = A.z
              , n = e.x
              , r = e.y
              , a = e.z;
            return this.x = i * a - o * r,
            this.y = o * n - t * a,
            this.z = t * r - i * n,
            this
        },
        projectOnVector: function(A) {
            var e = A.lengthSq();
            if (0 === e)
                return this.set(0, 0, 0);
            var t = A.dot(this) / e;
            return this.copy(A).multiplyScalar(t)
        },
        projectOnPlane: function(A) {
            return m.copy(this).projectOnVector(A),
            this.sub(m)
        },
        reflect: function(A) {
            return this.sub(m.copy(A).multiplyScalar(2 * this.dot(A)))
        },
        angleTo: function(A) {
            var e = Math.sqrt(this.lengthSq() * A.lengthSq());
            if (0 === e)
                return Math.PI / 2;
            var t = this.dot(A) / e;
            return Math.acos(a.clamp(t, -1, 1))
        },
        distanceTo: function(A) {
            return Math.sqrt(this.distanceToSquared(A))
        },
        distanceToSquared: function(A) {
            var e = this.x - A.x
              , t = this.y - A.y
              , i = this.z - A.z;
            return e * e + t * t + i * i
        },
        manhattanDistanceTo: function(A) {
            return Math.abs(this.x - A.x) + Math.abs(this.y - A.y) + Math.abs(this.z - A.z)
        },
        setFromSpherical: function(A) {
            return this.setFromSphericalCoords(A.radius, A.phi, A.theta)
        },
        setFromSphericalCoords: function(A, e, t) {
            var i = Math.sin(e) * A;
            return this.x = i * Math.sin(t),
            this.y = Math.cos(e) * A,
            this.z = i * Math.cos(t),
            this
        },
        setFromCylindrical: function(A) {
            return this.setFromCylindricalCoords(A.radius, A.theta, A.y)
        },
        setFromCylindricalCoords: function(A, e, t) {
            return this.x = A * Math.sin(e),
            this.y = t,
            this.z = A * Math.cos(e),
            this
        },
        setFromMatrixPosition: function(A) {
            var e = A.elements;
            return this.x = e[12],
            this.y = e[13],
            this.z = e[14],
            this
        },
        setFromMatrixScale: function(A) {
            var e = this.setFromMatrixColumn(A, 0).length()
              , t = this.setFromMatrixColumn(A, 1).length()
              , i = this.setFromMatrixColumn(A, 2).length();
            return this.x = e,
            this.y = t,
            this.z = i,
            this
        },
        setFromMatrixColumn: function(A, e) {
            return this.fromArray(A.elements, 4 * e)
        },
        setFromMatrix3Column: function(A, e) {
            return this.fromArray(A.elements, 3 * e)
        },
        equals: function(A) {
            return A.x === this.x && A.y === this.y && A.z === this.z
        },
        fromArray: function(A, e) {
            return void 0 === e && (e = 0),
            this.x = A[e],
            this.y = A[e + 1],
            this.z = A[e + 2],
            this
        },
        toArray: function(A, e) {
            return void 0 === A && (A = []),
            void 0 === e && (e = 0),
            A[e] = this.x,
            A[e + 1] = this.y,
            A[e + 2] = this.z,
            A
        },
        fromBufferAttribute: function(A, e, t) {
            return void 0 !== t && console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),
            this.x = A.getX(e),
            this.y = A.getY(e),
            this.z = A.getZ(e),
            this
        }
    });
    var v = new y
      , I = new M
      , E = new y(0,0,0)
      , B = new y(1,1,1)
      , x = new y
      , S = new y
      , w = new y;
    function M() {
        this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
        arguments.length > 0 && console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")
    }
    Object.assign(M.prototype, {
        isMatrix4: !0,
        set: function(A, e, t, i, o, n, r, a, s, l, c, h, d, p, g, u) {
            var f = this.elements;
            return f[0] = A,
            f[4] = e,
            f[8] = t,
            f[12] = i,
            f[1] = o,
            f[5] = n,
            f[9] = r,
            f[13] = a,
            f[2] = s,
            f[6] = l,
            f[10] = c,
            f[14] = h,
            f[3] = d,
            f[7] = p,
            f[11] = g,
            f[15] = u,
            this
        },
        identity: function() {
            return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1),
            this
        },
        clone: function() {
            return (new M).fromArray(this.elements)
        },
        copy: function(A) {
            var e = this.elements
              , t = A.elements;
            return e[0] = t[0],
            e[1] = t[1],
            e[2] = t[2],
            e[3] = t[3],
            e[4] = t[4],
            e[5] = t[5],
            e[6] = t[6],
            e[7] = t[7],
            e[8] = t[8],
            e[9] = t[9],
            e[10] = t[10],
            e[11] = t[11],
            e[12] = t[12],
            e[13] = t[13],
            e[14] = t[14],
            e[15] = t[15],
            this
        },
        copyPosition: function(A) {
            var e = this.elements
              , t = A.elements;
            return e[12] = t[12],
            e[13] = t[13],
            e[14] = t[14],
            this
        },
        extractBasis: function(A, e, t) {
            return A.setFromMatrixColumn(this, 0),
            e.setFromMatrixColumn(this, 1),
            t.setFromMatrixColumn(this, 2),
            this
        },
        makeBasis: function(A, e, t) {
            return this.set(A.x, e.x, t.x, 0, A.y, e.y, t.y, 0, A.z, e.z, t.z, 0, 0, 0, 0, 1),
            this
        },
        extractRotation: function(A) {
            var e = this.elements
              , t = A.elements
              , i = 1 / v.setFromMatrixColumn(A, 0).length()
              , o = 1 / v.setFromMatrixColumn(A, 1).length()
              , n = 1 / v.setFromMatrixColumn(A, 2).length();
            return e[0] = t[0] * i,
            e[1] = t[1] * i,
            e[2] = t[2] * i,
            e[3] = 0,
            e[4] = t[4] * o,
            e[5] = t[5] * o,
            e[6] = t[6] * o,
            e[7] = 0,
            e[8] = t[8] * n,
            e[9] = t[9] * n,
            e[10] = t[10] * n,
            e[11] = 0,
            e[12] = 0,
            e[13] = 0,
            e[14] = 0,
            e[15] = 1,
            this
        },
        makeRotationFromEuler: function(A) {
            A && A.isEuler || console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");
            var e = this.elements
              , t = A.x
              , i = A.y
              , o = A.z
              , n = Math.cos(t)
              , r = Math.sin(t)
              , a = Math.cos(i)
              , s = Math.sin(i)
              , l = Math.cos(o)
              , c = Math.sin(o);
            if ("XYZ" === A.order) {
                var h = n * l
                  , d = n * c
                  , p = r * l
                  , g = r * c;
                e[0] = a * l,
                e[4] = -a * c,
                e[8] = s,
                e[1] = d + p * s,
                e[5] = h - g * s,
                e[9] = -r * a,
                e[2] = g - h * s,
                e[6] = p + d * s,
                e[10] = n * a
            } else if ("YXZ" === A.order) {
                var u = a * c
                  , f = s * l;
                e[0] = (m = a * l) + (C = s * c) * r,
                e[4] = f * r - u,
                e[8] = n * s,
                e[1] = n * c,
                e[5] = n * l,
                e[9] = -r,
                e[2] = u * r - f,
                e[6] = C + m * r,
                e[10] = n * a
            } else if ("ZXY" === A.order) {
                var m, C;
                u = a * c,
                f = s * l;
                e[0] = (m = a * l) - (C = s * c) * r,
                e[4] = -n * c,
                e[8] = f + u * r,
                e[1] = u + f * r,
                e[5] = n * l,
                e[9] = C - m * r,
                e[2] = -n * s,
                e[6] = r,
                e[10] = n * a
            } else if ("ZYX" === A.order) {
                h = n * l,
                d = n * c,
                p = r * l,
                g = r * c;
                e[0] = a * l,
                e[4] = p * s - d,
                e[8] = h * s + g,
                e[1] = a * c,
                e[5] = g * s + h,
                e[9] = d * s - p,
                e[2] = -s,
                e[6] = r * a,
                e[10] = n * a
            } else if ("YZX" === A.order) {
                var y = n * a
                  , v = n * s
                  , I = r * a
                  , E = r * s;
                e[0] = a * l,
                e[4] = E - y * c,
                e[8] = I * c + v,
                e[1] = c,
                e[5] = n * l,
                e[9] = -r * l,
                e[2] = -s * l,
                e[6] = v * c + I,
                e[10] = y - E * c
            } else if ("XZY" === A.order) {
                y = n * a,
                v = n * s,
                I = r * a,
                E = r * s;
                e[0] = a * l,
                e[4] = -c,
                e[8] = s * l,
                e[1] = y * c + E,
                e[5] = n * l,
                e[9] = v * c - I,
                e[2] = I * c - v,
                e[6] = r * l,
                e[10] = E * c + y
            }
            return e[3] = 0,
            e[7] = 0,
            e[11] = 0,
            e[12] = 0,
            e[13] = 0,
            e[14] = 0,
            e[15] = 1,
            this
        },
        makeRotationFromQuaternion: function(A) {
            return this.compose(E, A, B)
        },
        lookAt: function(A, e, t) {
            var i = this.elements;
            return w.subVectors(A, e),
            0 === w.lengthSq() && (w.z = 1),
            w.normalize(),
            x.crossVectors(t, w),
            0 === x.lengthSq() && (1 === Math.abs(t.z) ? w.x += 1e-4 : w.z += 1e-4,
            w.normalize(),
            x.crossVectors(t, w)),
            x.normalize(),
            S.crossVectors(w, x),
            i[0] = x.x,
            i[4] = S.x,
            i[8] = w.x,
            i[1] = x.y,
            i[5] = S.y,
            i[9] = w.y,
            i[2] = x.z,
            i[6] = S.z,
            i[10] = w.z,
            this
        },
        multiply: function(A, e) {
            return void 0 !== e ? (console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),
            this.multiplyMatrices(A, e)) : this.multiplyMatrices(this, A)
        },
        premultiply: function(A) {
            return this.multiplyMatrices(A, this)
        },
        multiplyMatrices: function(A, e) {
            var t = A.elements
              , i = e.elements
              , o = this.elements
              , n = t[0]
              , r = t[4]
              , a = t[8]
              , s = t[12]
              , l = t[1]
              , c = t[5]
              , h = t[9]
              , d = t[13]
              , p = t[2]
              , g = t[6]
              , u = t[10]
              , f = t[14]
              , m = t[3]
              , C = t[7]
              , y = t[11]
              , v = t[15]
              , I = i[0]
              , E = i[4]
              , B = i[8]
              , x = i[12]
              , S = i[1]
              , w = i[5]
              , M = i[9]
              , b = i[13]
              , U = i[2]
              , F = i[6]
              , K = i[10]
              , Q = i[14]
              , R = i[3]
              , T = i[7]
              , k = i[11]
              , D = i[15];
            return o[0] = n * I + r * S + a * U + s * R,
            o[4] = n * E + r * w + a * F + s * T,
            o[8] = n * B + r * M + a * K + s * k,
            o[12] = n * x + r * b + a * Q + s * D,
            o[1] = l * I + c * S + h * U + d * R,
            o[5] = l * E + c * w + h * F + d * T,
            o[9] = l * B + c * M + h * K + d * k,
            o[13] = l * x + c * b + h * Q + d * D,
            o[2] = p * I + g * S + u * U + f * R,
            o[6] = p * E + g * w + u * F + f * T,
            o[10] = p * B + g * M + u * K + f * k,
            o[14] = p * x + g * b + u * Q + f * D,
            o[3] = m * I + C * S + y * U + v * R,
            o[7] = m * E + C * w + y * F + v * T,
            o[11] = m * B + C * M + y * K + v * k,
            o[15] = m * x + C * b + y * Q + v * D,
            this
        },
        multiplyScalar: function(A) {
            var e = this.elements;
            return e[0] *= A,
            e[4] *= A,
            e[8] *= A,
            e[12] *= A,
            e[1] *= A,
            e[5] *= A,
            e[9] *= A,
            e[13] *= A,
            e[2] *= A,
            e[6] *= A,
            e[10] *= A,
            e[14] *= A,
            e[3] *= A,
            e[7] *= A,
            e[11] *= A,
            e[15] *= A,
            this
        },
        determinant: function() {
            var A = this.elements
              , e = A[0]
              , t = A[4]
              , i = A[8]
              , o = A[12]
              , n = A[1]
              , r = A[5]
              , a = A[9]
              , s = A[13]
              , l = A[2]
              , c = A[6]
              , h = A[10]
              , d = A[14];
            return A[3] * (+o * a * c - i * s * c - o * r * h + t * s * h + i * r * d - t * a * d) + A[7] * (+e * a * d - e * s * h + o * n * h - i * n * d + i * s * l - o * a * l) + A[11] * (+e * s * c - e * r * d - o * n * c + t * n * d + o * r * l - t * s * l) + A[15] * (-i * r * l - e * a * c + e * r * h + i * n * c - t * n * h + t * a * l)
        },
        transpose: function() {
            var A, e = this.elements;
            return A = e[1],
            e[1] = e[4],
            e[4] = A,
            A = e[2],
            e[2] = e[8],
            e[8] = A,
            A = e[6],
            e[6] = e[9],
            e[9] = A,
            A = e[3],
            e[3] = e[12],
            e[12] = A,
            A = e[7],
            e[7] = e[13],
            e[13] = A,
            A = e[11],
            e[11] = e[14],
            e[14] = A,
            this
        },
        setPosition: function(A, e, t) {
            var i = this.elements;
            return A.isVector3 ? (i[12] = A.x,
            i[13] = A.y,
            i[14] = A.z) : (i[12] = A,
            i[13] = e,
            i[14] = t),
            this
        },
        getInverse: function(A, e) {
            void 0 !== e && console.warn("THREE.Matrix4: .getInverse() can no longer be configured to throw on degenerate.");
            var t = this.elements
              , i = A.elements
              , o = i[0]
              , n = i[1]
              , r = i[2]
              , a = i[3]
              , s = i[4]
              , l = i[5]
              , c = i[6]
              , h = i[7]
              , d = i[8]
              , p = i[9]
              , g = i[10]
              , u = i[11]
              , f = i[12]
              , m = i[13]
              , C = i[14]
              , y = i[15]
              , v = p * C * h - m * g * h + m * c * u - l * C * u - p * c * y + l * g * y
              , I = f * g * h - d * C * h - f * c * u + s * C * u + d * c * y - s * g * y
              , E = d * m * h - f * p * h + f * l * u - s * m * u - d * l * y + s * p * y
              , B = f * p * c - d * m * c - f * l * g + s * m * g + d * l * C - s * p * C
              , x = o * v + n * I + r * E + a * B;
            if (0 === x)
                return this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
            var S = 1 / x;
            return t[0] = v * S,
            t[1] = (m * g * a - p * C * a - m * r * u + n * C * u + p * r * y - n * g * y) * S,
            t[2] = (l * C * a - m * c * a + m * r * h - n * C * h - l * r * y + n * c * y) * S,
            t[3] = (p * c * a - l * g * a - p * r * h + n * g * h + l * r * u - n * c * u) * S,
            t[4] = I * S,
            t[5] = (d * C * a - f * g * a + f * r * u - o * C * u - d * r * y + o * g * y) * S,
            t[6] = (f * c * a - s * C * a - f * r * h + o * C * h + s * r * y - o * c * y) * S,
            t[7] = (s * g * a - d * c * a + d * r * h - o * g * h - s * r * u + o * c * u) * S,
            t[8] = E * S,
            t[9] = (f * p * a - d * m * a - f * n * u + o * m * u + d * n * y - o * p * y) * S,
            t[10] = (s * m * a - f * l * a + f * n * h - o * m * h - s * n * y + o * l * y) * S,
            t[11] = (d * l * a - s * p * a - d * n * h + o * p * h + s * n * u - o * l * u) * S,
            t[12] = B * S,
            t[13] = (d * m * r - f * p * r + f * n * g - o * m * g - d * n * C + o * p * C) * S,
            t[14] = (f * l * r - s * m * r - f * n * c + o * m * c + s * n * C - o * l * C) * S,
            t[15] = (s * p * r - d * l * r + d * n * c - o * p * c - s * n * g + o * l * g) * S,
            this
        },
        scale: function(A) {
            var e = this.elements
              , t = A.x
              , i = A.y
              , o = A.z;
            return e[0] *= t,
            e[4] *= i,
            e[8] *= o,
            e[1] *= t,
            e[5] *= i,
            e[9] *= o,
            e[2] *= t,
            e[6] *= i,
            e[10] *= o,
            e[3] *= t,
            e[7] *= i,
            e[11] *= o,
            this
        },
        getMaxScaleOnAxis: function() {
            var A = this.elements;
            return Math.sqrt(Math.max(A[0] * A[0] + A[1] * A[1] + A[2] * A[2], A[4] * A[4] + A[5] * A[5] + A[6] * A[6], A[8] * A[8] + A[9] * A[9] + A[10] * A[10]))
        },
        makeTranslation: function(A, e, t) {
            return this.set(1, 0, 0, A, 0, 1, 0, e, 0, 0, 1, t, 0, 0, 0, 1),
            this
        },
        makeRotationX: function(A) {
            var e = Math.cos(A)
              , t = Math.sin(A);
            return this.set(1, 0, 0, 0, 0, e, -t, 0, 0, t, e, 0, 0, 0, 0, 1),
            this
        },
        makeRotationY: function(A) {
            var e = Math.cos(A)
              , t = Math.sin(A);
            return this.set(e, 0, t, 0, 0, 1, 0, 0, -t, 0, e, 0, 0, 0, 0, 1),
            this
        },
        makeRotationZ: function(A) {
            var e = Math.cos(A)
              , t = Math.sin(A);
            return this.set(e, -t, 0, 0, t, e, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1),
            this
        },
        makeRotationAxis: function(A, e) {
            var t = Math.cos(e)
              , i = Math.sin(e)
              , o = 1 - t
              , n = A.x
              , r = A.y
              , a = A.z
              , s = o * n
              , l = o * r;
            return this.set(s * n + t, s * r - i * a, s * a + i * r, 0, s * r + i * a, l * r + t, l * a - i * n, 0, s * a - i * r, l * a + i * n, o * a * a + t, 0, 0, 0, 0, 1),
            this
        },
        makeScale: function(A, e, t) {
            return this.set(A, 0, 0, 0, 0, e, 0, 0, 0, 0, t, 0, 0, 0, 0, 1),
            this
        },
        makeShear: function(A, e, t) {
            return this.set(1, e, t, 0, A, 1, t, 0, A, e, 1, 0, 0, 0, 0, 1),
            this
        },
        compose: function(A, e, t) {
            var i = this.elements
              , o = e._x
              , n = e._y
              , r = e._z
              , a = e._w
              , s = o + o
              , l = n + n
              , c = r + r
              , h = o * s
              , d = o * l
              , p = o * c
              , g = n * l
              , u = n * c
              , f = r * c
              , m = a * s
              , C = a * l
              , y = a * c
              , v = t.x
              , I = t.y
              , E = t.z;
            return i[0] = (1 - (g + f)) * v,
            i[1] = (d + y) * v,
            i[2] = (p - C) * v,
            i[3] = 0,
            i[4] = (d - y) * I,
            i[5] = (1 - (h + f)) * I,
            i[6] = (u + m) * I,
            i[7] = 0,
            i[8] = (p + C) * E,
            i[9] = (u - m) * E,
            i[10] = (1 - (h + g)) * E,
            i[11] = 0,
            i[12] = A.x,
            i[13] = A.y,
            i[14] = A.z,
            i[15] = 1,
            this
        },
        decompose: function(A, e, t) {
            var i = this.elements
              , o = v.set(i[0], i[1], i[2]).length()
              , n = v.set(i[4], i[5], i[6]).length()
              , r = v.set(i[8], i[9], i[10]).length();
            0 > this.determinant() && (o = -o),
            A.x = i[12],
            A.y = i[13],
            A.z = i[14],
            I.copy(this);
            var a = 1 / o
              , s = 1 / n
              , l = 1 / r;
            return I.elements[0] *= a,
            I.elements[1] *= a,
            I.elements[2] *= a,
            I.elements[4] *= s,
            I.elements[5] *= s,
            I.elements[6] *= s,
            I.elements[8] *= l,
            I.elements[9] *= l,
            I.elements[10] *= l,
            e.setFromRotationMatrix(I),
            t.x = o,
            t.y = n,
            t.z = r,
            this
        },
        makePerspective: function(A, e, t, i, o, n) {
            void 0 === n && console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");
            var r = this.elements
              , a = 2 * o / (t - i)
              , s = (e + A) / (e - A)
              , l = (t + i) / (t - i)
              , c = -(n + o) / (n - o)
              , h = -2 * n * o / (n - o);
            return r[0] = 2 * o / (e - A),
            r[4] = 0,
            r[8] = s,
            r[12] = 0,
            r[1] = 0,
            r[5] = a,
            r[9] = l,
            r[13] = 0,
            r[2] = 0,
            r[6] = 0,
            r[10] = c,
            r[14] = h,
            r[3] = 0,
            r[7] = 0,
            r[11] = -1,
            r[15] = 0,
            this
        },
        makeOrthographic: function(A, e, t, i, o, n) {
            var r = this.elements
              , a = 1 / (e - A)
              , s = 1 / (t - i)
              , l = 1 / (n - o)
              , c = (e + A) * a
              , h = (t + i) * s
              , d = (n + o) * l;
            return r[0] = 2 * a,
            r[4] = 0,
            r[8] = 0,
            r[12] = -c,
            r[1] = 0,
            r[5] = 2 * s,
            r[9] = 0,
            r[13] = -h,
            r[2] = 0,
            r[6] = 0,
            r[10] = -2 * l,
            r[14] = -d,
            r[3] = 0,
            r[7] = 0,
            r[11] = 0,
            r[15] = 1,
            this
        },
        equals: function(A) {
            for (var e = this.elements, t = A.elements, i = 0; 16 > i; i++)
                if (e[i] !== t[i])
                    return !1;
            return !0
        },
        fromArray: function(A, e) {
            void 0 === e && (e = 0);
            for (var t = 0; 16 > t; t++)
                this.elements[t] = A[t + e];
            return this
        },
        toArray: function(A, e) {
            void 0 === A && (A = []),
            void 0 === e && (e = 0);
            var t = this.elements;
            return A[e] = t[0],
            A[e + 1] = t[1],
            A[e + 2] = t[2],
            A[e + 3] = t[3],
            A[e + 4] = t[4],
            A[e + 5] = t[5],
            A[e + 6] = t[6],
            A[e + 7] = t[7],
            A[e + 8] = t[8],
            A[e + 9] = t[9],
            A[e + 10] = t[10],
            A[e + 11] = t[11],
            A[e + 12] = t[12],
            A[e + 13] = t[13],
            A[e + 14] = t[14],
            A[e + 15] = t[15],
            A
        }
    });
    var b = new M
      , U = new f;
    function F(A, e, t, i) {
        this._x = A || 0,
        this._y = e || 0,
        this._z = t || 0,
        this._order = i || F.DefaultOrder
    }
    function K() {
        this.mask = 1
    }
    F.RotationOrders = ["XYZ", "YZX", "ZXY", "XZY", "YXZ", "ZYX"],
    F.DefaultOrder = "XYZ",
    Object.defineProperties(F.prototype, {
        x: {
            get: function() {
                return this._x
            },
            set: function(A) {
                this._x = A,
                this._onChangeCallback()
            }
        },
        y: {
            get: function() {
                return this._y
            },
            set: function(A) {
                this._y = A,
                this._onChangeCallback()
            }
        },
        z: {
            get: function() {
                return this._z
            },
            set: function(A) {
                this._z = A,
                this._onChangeCallback()
            }
        },
        order: {
            get: function() {
                return this._order
            },
            set: function(A) {
                this._order = A,
                this._onChangeCallback()
            }
        }
    }),
    Object.assign(F.prototype, {
        isEuler: !0,
        set: function(A, e, t, i) {
            return this._x = A,
            this._y = e,
            this._z = t,
            this._order = i || this._order,
            this._onChangeCallback(),
            this
        },
        clone: function() {
            return new this.constructor(this._x,this._y,this._z,this._order)
        },
        copy: function(A) {
            return this._x = A._x,
            this._y = A._y,
            this._z = A._z,
            this._order = A._order,
            this._onChangeCallback(),
            this
        },
        setFromRotationMatrix: function(A, e, t) {
            var i = a.clamp
              , o = A.elements
              , n = o[0]
              , r = o[4]
              , s = o[8]
              , l = o[1]
              , c = o[5]
              , h = o[9]
              , d = o[2]
              , p = o[6]
              , g = o[10];
            return "XYZ" === (e = e || this._order) ? (this._y = Math.asin(i(s, -1, 1)),
            .9999999 > Math.abs(s) ? (this._x = Math.atan2(-h, g),
            this._z = Math.atan2(-r, n)) : (this._x = Math.atan2(p, c),
            this._z = 0)) : "YXZ" === e ? (this._x = Math.asin(-i(h, -1, 1)),
            .9999999 > Math.abs(h) ? (this._y = Math.atan2(s, g),
            this._z = Math.atan2(l, c)) : (this._y = Math.atan2(-d, n),
            this._z = 0)) : "ZXY" === e ? (this._x = Math.asin(i(p, -1, 1)),
            .9999999 > Math.abs(p) ? (this._y = Math.atan2(-d, g),
            this._z = Math.atan2(-r, c)) : (this._y = 0,
            this._z = Math.atan2(l, n))) : "ZYX" === e ? (this._y = Math.asin(-i(d, -1, 1)),
            .9999999 > Math.abs(d) ? (this._x = Math.atan2(p, g),
            this._z = Math.atan2(l, n)) : (this._x = 0,
            this._z = Math.atan2(-r, c))) : "YZX" === e ? (this._z = Math.asin(i(l, -1, 1)),
            .9999999 > Math.abs(l) ? (this._x = Math.atan2(-h, c),
            this._y = Math.atan2(-d, n)) : (this._x = 0,
            this._y = Math.atan2(s, g))) : "XZY" === e ? (this._z = Math.asin(-i(r, -1, 1)),
            .9999999 > Math.abs(r) ? (this._x = Math.atan2(p, c),
            this._y = Math.atan2(s, n)) : (this._x = Math.atan2(-h, g),
            this._y = 0)) : console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: " + e),
            this._order = e,
            !1 !== t && this._onChangeCallback(),
            this
        },
        setFromQuaternion: function(A, e, t) {
            return b.makeRotationFromQuaternion(A),
            this.setFromRotationMatrix(b, e, t)
        },
        setFromVector3: function(A, e) {
            return this.set(A.x, A.y, A.z, e || this._order)
        },
        reorder: function(A) {
            return U.setFromEuler(this),
            this.setFromQuaternion(U, A)
        },
        equals: function(A) {
            return A._x === this._x && A._y === this._y && A._z === this._z && A._order === this._order
        },
        fromArray: function(A) {
            return this._x = A[0],
            this._y = A[1],
            this._z = A[2],
            void 0 !== A[3] && (this._order = A[3]),
            this._onChangeCallback(),
            this
        },
        toArray: function(A, e) {
            return void 0 === A && (A = []),
            void 0 === e && (e = 0),
            A[e] = this._x,
            A[e + 1] = this._y,
            A[e + 2] = this._z,
            A[e + 3] = this._order,
            A
        },
        toVector3: function(A) {
            return A ? A.set(this._x, this._y, this._z) : new y(this._x,this._y,this._z)
        },
        _onChange: function(A) {
            return this._onChangeCallback = A,
            this
        },
        _onChangeCallback: function() {}
    }),
    Object.assign(K.prototype, {
        set: function(A) {
            this.mask = 1 << A | 0
        },
        enable: function(A) {
            this.mask |= 1 << A | 0
        },
        enableAll: function() {
            this.mask = -1
        },
        toggle: function(A) {
            this.mask ^= 1 << A | 0
        },
        disable: function(A) {
            this.mask &= ~(1 << A | 0)
        },
        disableAll: function() {
            this.mask = 0
        },
        test: function(A) {
            return 0 != (this.mask & A.mask)
        }
    });
    var Q = 0
      , R = new y
      , T = new f
      , k = new M
      , D = new y
      , L = new y
      , N = new y
      , O = new f
      , V = new y(1,0,0)
      , G = new y(0,1,0)
      , P = new y(0,0,1)
      , q = {
        type: "added"
    }
      , j = {
        type: "removed"
    };
    function H() {
        Object.defineProperty(this, "id", {
            value: Q++
        }),
        this.uuid = a.generateUUID(),
        this.name = "",
        this.type = "Object3D",
        this.parent = null,
        this.children = [],
        this.up = H.DefaultUp.clone();
        var A = new y
          , e = new F
          , t = new f
          , i = new y(1,1,1);
        e._onChange((function() {
            t.setFromEuler(e, !1)
        }
        )),
        t._onChange((function() {
            e.setFromQuaternion(t, void 0, !1)
        }
        )),
        Object.defineProperties(this, {
            position: {
                configurable: !0,
                enumerable: !0,
                value: A
            },
            rotation: {
                configurable: !0,
                enumerable: !0,
                value: e
            },
            quaternion: {
                configurable: !0,
                enumerable: !0,
                value: t
            },
            scale: {
                configurable: !0,
                enumerable: !0,
                value: i
            },
            modelViewMatrix: {
                value: new M
            },
            normalMatrix: {
                value: new l
            }
        }),
        this.matrix = new M,
        this.matrixWorld = new M,
        this.matrixAutoUpdate = H.DefaultMatrixAutoUpdate,
        this.matrixWorldNeedsUpdate = !1,
        this.layers = new K,
        this.visible = !0,
        this.castShadow = !1,
        this.receiveShadow = !1,
        this.frustumCulled = !0,
        this.renderOrder = 0,
        this.userData = {}
    }
    function Y() {
        H.call(this),
        this.type = "Scene",
        this.background = null,
        this.environment = null,
        this.fog = null,
        this.overrideMaterial = null,
        this.autoUpdate = !0,
        "undefined" != typeof __THREE_DEVTOOLS__ && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{
            detail: this
        }))
    }
    H.DefaultUp = new y(0,1,0),
    H.DefaultMatrixAutoUpdate = !0,
    H.prototype = Object.assign(Object.create(i.prototype), {
        constructor: H,
        isObject3D: !0,
        onBeforeRender: function() {},
        onAfterRender: function() {},
        applyMatrix4: function(A) {
            this.matrixAutoUpdate && this.updateMatrix(),
            this.matrix.premultiply(A),
            this.matrix.decompose(this.position, this.quaternion, this.scale)
        },
        applyQuaternion: function(A) {
            return this.quaternion.premultiply(A),
            this
        },
        setRotationFromAxisAngle: function(A, e) {
            this.quaternion.setFromAxisAngle(A, e)
        },
        setRotationFromEuler: function(A) {
            this.quaternion.setFromEuler(A, !0)
        },
        setRotationFromMatrix: function(A) {
            this.quaternion.setFromRotationMatrix(A)
        },
        setRotationFromQuaternion: function(A) {
            this.quaternion.copy(A)
        },
        rotateOnAxis: function(A, e) {
            return T.setFromAxisAngle(A, e),
            this.quaternion.multiply(T),
            this
        },
        rotateOnWorldAxis: function(A, e) {
            return T.setFromAxisAngle(A, e),
            this.quaternion.premultiply(T),
            this
        },
        rotateX: function(A) {
            return this.rotateOnAxis(V, A)
        },
        rotateY: function(A) {
            return this.rotateOnAxis(G, A)
        },
        rotateZ: function(A) {
            return this.rotateOnAxis(P, A)
        },
        translateOnAxis: function(A, e) {
            return R.copy(A).applyQuaternion(this.quaternion),
            this.position.add(R.multiplyScalar(e)),
            this
        },
        translateX: function(A) {
            return this.translateOnAxis(V, A)
        },
        translateY: function(A) {
            return this.translateOnAxis(G, A)
        },
        translateZ: function(A) {
            return this.translateOnAxis(P, A)
        },
        localToWorld: function(A) {
            return A.applyMatrix4(this.matrixWorld)
        },
        worldToLocal: function(A) {
            return A.applyMatrix4(k.getInverse(this.matrixWorld))
        },
        lookAt: function(A, e, t) {
            A.isVector3 ? D.copy(A) : D.set(A, e, t);
            var i = this.parent;
            this.updateWorldMatrix(!0, !1),
            L.setFromMatrixPosition(this.matrixWorld),
            this.isCamera || this.isLight ? k.lookAt(L, D, this.up) : k.lookAt(D, L, this.up),
            this.quaternion.setFromRotationMatrix(k),
            i && (k.extractRotation(i.matrixWorld),
            T.setFromRotationMatrix(k),
            this.quaternion.premultiply(T.inverse()))
        },
        add: function(A) {
            if (arguments.length > 1) {
                for (var e = 0; arguments.length > e; e++)
                    this.add(arguments[e]);
                return this
            }
            return A === this ? (console.error("THREE.Object3D.add: object can't be added as a child of itself.", A),
            this) : (A && A.isObject3D ? (null !== A.parent && A.parent.remove(A),
            A.parent = this,
            this.children.push(A),
            A.dispatchEvent(q)) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", A),
            this)
        },
        remove: function(A) {
            if (arguments.length > 1) {
                for (var e = 0; arguments.length > e; e++)
                    this.remove(arguments[e]);
                return this
            }
            var t = this.children.indexOf(A);
            return -1 !== t && (A.parent = null,
            this.children.splice(t, 1),
            A.dispatchEvent(j)),
            this
        },
        attach: function(A) {
            return this.updateWorldMatrix(!0, !1),
            k.getInverse(this.matrixWorld),
            null !== A.parent && (A.parent.updateWorldMatrix(!0, !1),
            k.multiply(A.parent.matrixWorld)),
            A.applyMatrix4(k),
            A.updateWorldMatrix(!1, !1),
            this.add(A),
            this
        },
        getObjectById: function(A) {
            return this.getObjectByProperty("id", A)
        },
        getObjectByName: function(A) {
            return this.getObjectByProperty("name", A)
        },
        getObjectByProperty: function(A, e) {
            if (this[A] === e)
                return this;
            for (var t = 0, i = this.children.length; i > t; t++) {
                var o = this.children[t].getObjectByProperty(A, e);
                if (void 0 !== o)
                    return o
            }
        },
        getWorldPosition: function(A) {
            return void 0 === A && (console.warn("THREE.Object3D: .getWorldPosition() target is now required"),
            A = new y),
            this.updateMatrixWorld(!0),
            A.setFromMatrixPosition(this.matrixWorld)
        },
        getWorldQuaternion: function(A) {
            return void 0 === A && (console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),
            A = new f),
            this.updateMatrixWorld(!0),
            this.matrixWorld.decompose(L, A, N),
            A
        },
        getWorldScale: function(A) {
            return void 0 === A && (console.warn("THREE.Object3D: .getWorldScale() target is now required"),
            A = new y),
            this.updateMatrixWorld(!0),
            this.matrixWorld.decompose(L, O, A),
            A
        },
        getWorldDirection: function(A) {
            void 0 === A && (console.warn("THREE.Object3D: .getWorldDirection() target is now required"),
            A = new y),
            this.updateMatrixWorld(!0);
            var e = this.matrixWorld.elements;
            return A.set(e[8], e[9], e[10]).normalize()
        },
        raycast: function() {},
        traverse: function(A) {
            A(this);
            for (var e = this.children, t = 0, i = e.length; i > t; t++)
                e[t].traverse(A)
        },
        traverseVisible: function(A) {
            if (!1 !== this.visible) {
                A(this);
                for (var e = this.children, t = 0, i = e.length; i > t; t++)
                    e[t].traverseVisible(A)
            }
        },
        traverseAncestors: function(A) {
            var e = this.parent;
            null !== e && (A(e),
            e.traverseAncestors(A))
        },
        updateMatrix: function() {
            this.matrix.compose(this.position, this.quaternion, this.scale),
            this.matrixWorldNeedsUpdate = !0
        },
        updateMatrixWorld: function(A) {
            this.matrixAutoUpdate && this.updateMatrix(),
            (this.matrixWorldNeedsUpdate || A) && (null === this.parent ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix),
            this.matrixWorldNeedsUpdate = !1,
            A = !0);
            for (var e = this.children, t = 0, i = e.length; i > t; t++)
                e[t].updateMatrixWorld(A)
        },
        updateWorldMatrix: function(A, e) {
            var t = this.parent;
            if (!0 === A && null !== t && t.updateWorldMatrix(!0, !1),
            this.matrixAutoUpdate && this.updateMatrix(),
            null === this.parent ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix),
            !0 === e)
                for (var i = this.children, o = 0, n = i.length; n > o; o++)
                    i[o].updateWorldMatrix(!1, !0)
        },
        toJSON: function(A) {
            var e = void 0 === A || "string" == typeof A
              , t = {};
            e && (A = {
                geometries: {},
                materials: {},
                textures: {},
                images: {},
                shapes: {}
            },
            t.metadata = {
                version: 4.5,
                type: "Object",
                generator: "Object3D.toJSON"
            });
            var i = {};
            function o(e, t) {
                return void 0 === e[t.uuid] && (e[t.uuid] = t.toJSON(A)),
                t.uuid
            }
            if (i.uuid = this.uuid,
            i.type = this.type,
            "" !== this.name && (i.name = this.name),
            !0 === this.castShadow && (i.castShadow = !0),
            !0 === this.receiveShadow && (i.receiveShadow = !0),
            !1 === this.visible && (i.visible = !1),
            !1 === this.frustumCulled && (i.frustumCulled = !1),
            0 !== this.renderOrder && (i.renderOrder = this.renderOrder),
            "{}" !== JSON.stringify(this.userData) && (i.userData = this.userData),
            i.layers = this.layers.mask,
            i.matrix = this.matrix.toArray(),
            !1 === this.matrixAutoUpdate && (i.matrixAutoUpdate = !1),
            this.isInstancedMesh && (i.type = "InstancedMesh",
            i.count = this.count,
            i.instanceMatrix = this.instanceMatrix.toJSON()),
            this.isMesh || this.isLine || this.isPoints) {
                i.geometry = o(A.geometries, this.geometry);
                var n = this.geometry.parameters;
                if (void 0 !== n && void 0 !== n.shapes) {
                    var r = n.shapes;
                    if (Array.isArray(r))
                        for (var a = 0, s = r.length; s > a; a++) {
                            o(A.shapes, r[a])
                        }
                    else
                        o(A.shapes, r)
                }
            }
            if (void 0 !== this.material)
                if (Array.isArray(this.material)) {
                    var l = [];
                    for (a = 0,
                    s = this.material.length; s > a; a++)
                        l.push(o(A.materials, this.material[a]));
                    i.material = l
                } else
                    i.material = o(A.materials, this.material);
            if (this.children.length > 0) {
                i.children = [];
                for (a = 0; this.children.length > a; a++)
                    i.children.push(this.children[a].toJSON(A).object)
            }
            if (e) {
                var c = g(A.geometries)
                  , h = g(A.materials)
                  , d = g(A.textures)
                  , p = g(A.images);
                r = g(A.shapes);
                c.length > 0 && (t.geometries = c),
                h.length > 0 && (t.materials = h),
                d.length > 0 && (t.textures = d),
                p.length > 0 && (t.images = p),
                r.length > 0 && (t.shapes = r)
            }
            return t.object = i,
            t;
            function g(A) {
                var e = [];
                for (var t in A) {
                    var i = A[t];
                    delete i.metadata,
                    e.push(i)
                }
                return e
            }
        },
        clone: function(A) {
            return (new this.constructor).copy(this, A)
        },
        copy: function(A, e) {
            if (void 0 === e && (e = !0),
            this.name = A.name,
            this.up.copy(A.up),
            this.position.copy(A.position),
            this.quaternion.copy(A.quaternion),
            this.scale.copy(A.scale),
            this.matrix.copy(A.matrix),
            this.matrixWorld.copy(A.matrixWorld),
            this.matrixAutoUpdate = A.matrixAutoUpdate,
            this.matrixWorldNeedsUpdate = A.matrixWorldNeedsUpdate,
            this.layers.mask = A.layers.mask,
            this.visible = A.visible,
            this.castShadow = A.castShadow,
            this.receiveShadow = A.receiveShadow,
            this.frustumCulled = A.frustumCulled,
            this.renderOrder = A.renderOrder,
            this.userData = JSON.parse(JSON.stringify(A.userData)),
            !0 === e)
                for (var t = 0; A.children.length > t; t++) {
                    this.add(A.children[t].clone())
                }
            return this
        }
    }),
    Y.prototype = Object.assign(Object.create(H.prototype), {
        constructor: Y,
        isScene: !0,
        copy: function(A, e) {
            return H.prototype.copy.call(this, A, e),
            null !== A.background && (this.background = A.background.clone()),
            null !== A.environment && (this.environment = A.environment.clone()),
            null !== A.fog && (this.fog = A.fog.clone()),
            null !== A.overrideMaterial && (this.overrideMaterial = A.overrideMaterial.clone()),
            this.autoUpdate = A.autoUpdate,
            this.matrixAutoUpdate = A.matrixAutoUpdate,
            this
        },
        toJSON: function(A) {
            var e = H.prototype.toJSON.call(this, A);
            return null !== this.background && (e.object.background = this.background.toJSON(A)),
            null !== this.environment && (e.object.environment = this.environment.toJSON(A)),
            null !== this.fog && (e.object.fog = this.fog.toJSON()),
            e
        },
        dispose: function() {
            this.dispatchEvent({
                type: "dispose"
            })
        }
    });
    var W = [new y, new y, new y, new y, new y, new y, new y, new y]
      , J = new y
      , z = new aA
      , Z = new y
      , X = new y
      , _ = new y
      , AA = new y
      , eA = new y
      , tA = new y
      , iA = new y
      , oA = new y
      , nA = new y
      , rA = new y;
    function aA(A, e) {
        this.min = void 0 !== A ? A : new y(1 / 0,1 / 0,1 / 0),
        this.max = void 0 !== e ? e : new y(-1 / 0,-1 / 0,-1 / 0)
    }
    function sA(A, e, t, i, o) {
        var n, r;
        for (n = 0,
        r = A.length - 3; r >= n; n += 3) {
            rA.fromArray(A, n);
            var a = o.x * Math.abs(rA.x) + o.y * Math.abs(rA.y) + o.z * Math.abs(rA.z)
              , s = e.dot(rA)
              , l = t.dot(rA)
              , c = i.dot(rA);
            if (Math.max(-Math.max(s, l, c), Math.min(s, l, c)) > a)
                return !1
        }
        return !0
    }
    Object.assign(aA.prototype, {
        isBox3: !0,
        set: function(A, e) {
            return this.min.copy(A),
            this.max.copy(e),
            this
        },
        setFromArray: function(A) {
            for (var e = 1 / 0, t = 1 / 0, i = 1 / 0, o = -1 / 0, n = -1 / 0, r = -1 / 0, a = 0, s = A.length; s > a; a += 3) {
                var l = A[a]
                  , c = A[a + 1]
                  , h = A[a + 2];
                e > l && (e = l),
                t > c && (t = c),
                i > h && (i = h),
                l > o && (o = l),
                c > n && (n = c),
                h > r && (r = h)
            }
            return this.min.set(e, t, i),
            this.max.set(o, n, r),
            this
        },
        setFromBufferAttribute: function(A) {
            for (var e = 1 / 0, t = 1 / 0, i = 1 / 0, o = -1 / 0, n = -1 / 0, r = -1 / 0, a = 0, s = A.count; s > a; a++) {
                var l = A.getX(a)
                  , c = A.getY(a)
                  , h = A.getZ(a);
                e > l && (e = l),
                t > c && (t = c),
                i > h && (i = h),
                l > o && (o = l),
                c > n && (n = c),
                h > r && (r = h)
            }
            return this.min.set(e, t, i),
            this.max.set(o, n, r),
            this
        },
        setFromPoints: function(A) {
            this.makeEmpty();
            for (var e = 0, t = A.length; t > e; e++)
                this.expandByPoint(A[e]);
            return this
        },
        setFromCenterAndSize: function(A, e) {
            var t = J.copy(e).multiplyScalar(.5);
            return this.min.copy(A).sub(t),
            this.max.copy(A).add(t),
            this
        },
        setFromObject: function(A) {
            return this.makeEmpty(),
            this.expandByObject(A)
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            return this.min.copy(A.min),
            this.max.copy(A.max),
            this
        },
        makeEmpty: function() {
            return this.min.x = this.min.y = this.min.z = 1 / 0,
            this.max.x = this.max.y = this.max.z = -1 / 0,
            this
        },
        isEmpty: function() {
            return this.min.x > this.max.x || this.min.y > this.max.y || this.min.z > this.max.z
        },
        getCenter: function(A) {
            return void 0 === A && (console.warn("THREE.Box3: .getCenter() target is now required"),
            A = new y),
            this.isEmpty() ? A.set(0, 0, 0) : A.addVectors(this.min, this.max).multiplyScalar(.5)
        },
        getSize: function(A) {
            return void 0 === A && (console.warn("THREE.Box3: .getSize() target is now required"),
            A = new y),
            this.isEmpty() ? A.set(0, 0, 0) : A.subVectors(this.max, this.min)
        },
        expandByPoint: function(A) {
            return this.min.min(A),
            this.max.max(A),
            this
        },
        expandByVector: function(A) {
            return this.min.sub(A),
            this.max.add(A),
            this
        },
        expandByScalar: function(A) {
            return this.min.addScalar(-A),
            this.max.addScalar(A),
            this
        },
        expandByObject: function(A) {
            A.updateWorldMatrix(!1, !1);
            var e = A.geometry;
            void 0 !== e && (null === e.boundingBox && e.computeBoundingBox(),
            z.copy(e.boundingBox),
            z.applyMatrix4(A.matrixWorld),
            this.union(z));
            for (var t = A.children, i = 0, o = t.length; o > i; i++)
                this.expandByObject(t[i]);
            return this
        },
        containsPoint: function(A) {
            return !(this.min.x > A.x || A.x > this.max.x || this.min.y > A.y || A.y > this.max.y || this.min.z > A.z || A.z > this.max.z)
        },
        containsBox: function(A) {
            return !(this.min.x > A.min.x || A.max.x > this.max.x || this.min.y > A.min.y || A.max.y > this.max.y || this.min.z > A.min.z || A.max.z > this.max.z)
        },
        getParameter: function(A, e) {
            return void 0 === e && (console.warn("THREE.Box3: .getParameter() target is now required"),
            e = new y),
            e.set((A.x - this.min.x) / (this.max.x - this.min.x), (A.y - this.min.y) / (this.max.y - this.min.y), (A.z - this.min.z) / (this.max.z - this.min.z))
        },
        intersectsBox: function(A) {
            return !(this.min.x > A.max.x || A.min.x > this.max.x || this.min.y > A.max.y || A.min.y > this.max.y || this.min.z > A.max.z || A.min.z > this.max.z)
        },
        intersectsSphere: function(A) {
            return this.clampPoint(A.center, J),
            J.distanceToSquared(A.center) <= A.radius * A.radius
        },
        intersectsPlane: function(A) {
            var e, t;
            return A.normal.x > 0 ? (e = A.normal.x * this.min.x,
            t = A.normal.x * this.max.x) : (e = A.normal.x * this.max.x,
            t = A.normal.x * this.min.x),
            A.normal.y > 0 ? (e += A.normal.y * this.min.y,
            t += A.normal.y * this.max.y) : (e += A.normal.y * this.max.y,
            t += A.normal.y * this.min.y),
            A.normal.z > 0 ? (e += A.normal.z * this.min.z,
            t += A.normal.z * this.max.z) : (e += A.normal.z * this.max.z,
            t += A.normal.z * this.min.z),
            -A.constant >= e && t >= -A.constant
        },
        intersectsTriangle: function(A) {
            if (this.isEmpty())
                return !1;
            this.getCenter(iA),
            oA.subVectors(this.max, iA),
            Z.subVectors(A.a, iA),
            X.subVectors(A.b, iA),
            _.subVectors(A.c, iA),
            AA.subVectors(X, Z),
            eA.subVectors(_, X),
            tA.subVectors(Z, _);
            var e = [0, -AA.z, AA.y, 0, -eA.z, eA.y, 0, -tA.z, tA.y, AA.z, 0, -AA.x, eA.z, 0, -eA.x, tA.z, 0, -tA.x, -AA.y, AA.x, 0, -eA.y, eA.x, 0, -tA.y, tA.x, 0];
            return !!sA(e, Z, X, _, oA) && (!!sA(e = [1, 0, 0, 0, 1, 0, 0, 0, 1], Z, X, _, oA) && (nA.crossVectors(AA, eA),
            sA(e = [nA.x, nA.y, nA.z], Z, X, _, oA)))
        },
        clampPoint: function(A, e) {
            return void 0 === e && (console.warn("THREE.Box3: .clampPoint() target is now required"),
            e = new y),
            e.copy(A).clamp(this.min, this.max)
        },
        distanceToPoint: function(A) {
            return J.copy(A).clamp(this.min, this.max).sub(A).length()
        },
        getBoundingSphere: function(A) {
            return void 0 === A && console.error("THREE.Box3: .getBoundingSphere() target is now required"),
            this.getCenter(A.center),
            A.radius = .5 * this.getSize(J).length(),
            A
        },
        intersect: function(A) {
            return this.min.max(A.min),
            this.max.min(A.max),
            this.isEmpty() && this.makeEmpty(),
            this
        },
        union: function(A) {
            return this.min.min(A.min),
            this.max.max(A.max),
            this
        },
        applyMatrix4: function(A) {
            return this.isEmpty() || (W[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(A),
            W[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(A),
            W[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(A),
            W[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(A),
            W[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(A),
            W[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(A),
            W[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(A),
            W[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(A),
            this.setFromPoints(W)),
            this
        },
        translate: function(A) {
            return this.min.add(A),
            this.max.add(A),
            this
        },
        equals: function(A) {
            return A.min.equals(this.min) && A.max.equals(this.max)
        }
    });
    var lA = new aA;
    function cA(A, e) {
        this.center = void 0 !== A ? A : new y,
        this.radius = void 0 !== e ? e : 0
    }
    Object.assign(cA.prototype, {
        set: function(A, e) {
            return this.center.copy(A),
            this.radius = e,
            this
        },
        setFromPoints: function(A, e) {
            var t = this.center;
            void 0 !== e ? t.copy(e) : lA.setFromPoints(A).getCenter(t);
            for (var i = 0, o = 0, n = A.length; n > o; o++)
                i = Math.max(i, t.distanceToSquared(A[o]));
            return this.radius = Math.sqrt(i),
            this
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            return this.center.copy(A.center),
            this.radius = A.radius,
            this
        },
        empty: function() {
            return 0 >= this.radius
        },
        containsPoint: function(A) {
            return A.distanceToSquared(this.center) <= this.radius * this.radius
        },
        distanceToPoint: function(A) {
            return A.distanceTo(this.center) - this.radius
        },
        intersectsSphere: function(A) {
            var e = this.radius + A.radius;
            return A.center.distanceToSquared(this.center) <= e * e
        },
        intersectsBox: function(A) {
            return A.intersectsSphere(this)
        },
        intersectsPlane: function(A) {
            return Math.abs(A.distanceToPoint(this.center)) <= this.radius
        },
        clampPoint: function(A, e) {
            var t = this.center.distanceToSquared(A);
            return void 0 === e && (console.warn("THREE.Sphere: .clampPoint() target is now required"),
            e = new y),
            e.copy(A),
            t > this.radius * this.radius && (e.sub(this.center).normalize(),
            e.multiplyScalar(this.radius).add(this.center)),
            e
        },
        getBoundingBox: function(A) {
            return void 0 === A && (console.warn("THREE.Sphere: .getBoundingBox() target is now required"),
            A = new aA),
            A.set(this.center, this.center),
            A.expandByScalar(this.radius),
            A
        },
        applyMatrix4: function(A) {
            return this.center.applyMatrix4(A),
            this.radius = this.radius * A.getMaxScaleOnAxis(),
            this
        },
        translate: function(A) {
            return this.center.add(A),
            this
        },
        equals: function(A) {
            return A.center.equals(this.center) && A.radius === this.radius
        }
    });
    var hA = new y
      , dA = new y
      , pA = new y
      , gA = new y
      , uA = new y
      , fA = new y
      , mA = new y;
    function CA(A, e) {
        this.origin = void 0 !== A ? A : new y,
        this.direction = void 0 !== e ? e : new y(0,0,-1)
    }
    Object.assign(CA.prototype, {
        set: function(A, e) {
            return this.origin.copy(A),
            this.direction.copy(e),
            this
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            return this.origin.copy(A.origin),
            this.direction.copy(A.direction),
            this
        },
        at: function(A, e) {
            return void 0 === e && (console.warn("THREE.Ray: .at() target is now required"),
            e = new y),
            e.copy(this.direction).multiplyScalar(A).add(this.origin)
        },
        lookAt: function(A) {
            return this.direction.copy(A).sub(this.origin).normalize(),
            this
        },
        recast: function(A) {
            return this.origin.copy(this.at(A, hA)),
            this
        },
        closestPointToPoint: function(A, e) {
            void 0 === e && (console.warn("THREE.Ray: .closestPointToPoint() target is now required"),
            e = new y),
            e.subVectors(A, this.origin);
            var t = e.dot(this.direction);
            return 0 > t ? e.copy(this.origin) : e.copy(this.direction).multiplyScalar(t).add(this.origin)
        },
        distanceToPoint: function(A) {
            return Math.sqrt(this.distanceSqToPoint(A))
        },
        distanceSqToPoint: function(A) {
            var e = hA.subVectors(A, this.origin).dot(this.direction);
            return 0 > e ? this.origin.distanceToSquared(A) : (hA.copy(this.direction).multiplyScalar(e).add(this.origin),
            hA.distanceToSquared(A))
        },
        distanceSqToSegment: function(A, e, t, i) {
            dA.copy(A).add(e).multiplyScalar(.5),
            pA.copy(e).sub(A).normalize(),
            gA.copy(this.origin).sub(dA);
            var o, n, r, a, s = .5 * A.distanceTo(e), l = -this.direction.dot(pA), c = gA.dot(this.direction), h = -gA.dot(pA), d = gA.lengthSq(), p = Math.abs(1 - l * l);
            if (p > 0)
                if (n = l * c - h,
                a = s * p,
                0 > (o = l * h - c))
                    n > -a ? n > a ? r = -(o = Math.max(0, -(l * s + c))) * o + (n = o > 0 ? s : Math.min(Math.max(-s, -h), s)) * (n + 2 * h) + d : (o = 0,
                    r = (n = Math.min(Math.max(-s, -h), s)) * (n + 2 * h) + d) : r = -(o = Math.max(0, -(-l * s + c))) * o + (n = o > 0 ? -s : Math.min(Math.max(-s, -h), s)) * (n + 2 * h) + d;
                else if (n < -a)
                    n = -s,
                    r = -(o = Math.max(0, -(l * n + c))) * o + n * (n + 2 * h) + d;
                else if (a < n)
                    n = s,
                    r = -(o = Math.max(0, -(l * n + c))) * o + n * (n + 2 * h) + d;
                else {
                    var g = 1 / p;
                    r = (o *= g) * (o + l * (n *= g) + 2 * c) + n * (l * o + n + 2 * h) + d
                }
            else
                n = l > 0 ? -s : s,
                r = -(o = Math.max(0, -(l * n + c))) * o + n * (n + 2 * h) + d;
            return t && t.copy(this.direction).multiplyScalar(o).add(this.origin),
            i && i.copy(pA).multiplyScalar(n).add(dA),
            r
        },
        intersectSphere: function(A, e) {
            hA.subVectors(A.center, this.origin);
            var t = hA.dot(this.direction)
              , i = hA.dot(hA) - t * t
              , o = A.radius * A.radius;
            if (i > o)
                return null;
            var n = Math.sqrt(o - i)
              , r = t - n
              , a = t + n;
            return 0 > r && 0 > a ? null : this.at(0 > r ? a : r, e)
        },
        intersectsSphere: function(A) {
            return this.distanceSqToPoint(A.center) <= A.radius * A.radius
        },
        distanceToPlane: function(A) {
            var e = A.normal.dot(this.direction);
            if (0 === e)
                return 0 === A.distanceToPoint(this.origin) ? 0 : null;
            var t = -(this.origin.dot(A.normal) + A.constant) / e;
            return 0 > t ? null : t
        },
        intersectPlane: function(A, e) {
            var t = this.distanceToPlane(A);
            return null === t ? null : this.at(t, e)
        },
        intersectsPlane: function(A) {
            var e = A.distanceToPoint(this.origin);
            return 0 === e || 0 > A.normal.dot(this.direction) * e
        },
        intersectBox: function(A, e) {
            var t, i, o, n, r, a, s = 1 / this.direction.x, l = 1 / this.direction.y, c = 1 / this.direction.z, h = this.origin;
            return 0 > s ? (t = (A.max.x - h.x) * s,
            i = (A.min.x - h.x) * s) : (t = (A.min.x - h.x) * s,
            i = (A.max.x - h.x) * s),
            0 > l ? (o = (A.max.y - h.y) * l,
            n = (A.min.y - h.y) * l) : (o = (A.min.y - h.y) * l,
            n = (A.max.y - h.y) * l),
            t > n || o > i ? null : ((o > t || t != t) && (t = o),
            (i > n || i != i) && (i = n),
            0 > c ? (r = (A.max.z - h.z) * c,
            a = (A.min.z - h.z) * c) : (r = (A.min.z - h.z) * c,
            a = (A.max.z - h.z) * c),
            t > a || r > i ? null : ((r > t || t != t) && (t = r),
            (i > a || i != i) && (i = a),
            0 > i ? null : this.at(0 > t ? i : t, e)))
        },
        intersectsBox: function(A) {
            return null !== this.intersectBox(A, hA)
        },
        intersectTriangle: function(A, e, t, i, o) {
            uA.subVectors(e, A),
            fA.subVectors(t, A),
            mA.crossVectors(uA, fA);
            var n, r = this.direction.dot(mA);
            if (r > 0) {
                if (i)
                    return null;
                n = 1
            } else {
                if (r >= 0)
                    return null;
                n = -1,
                r = -r
            }
            gA.subVectors(this.origin, A);
            var a = n * this.direction.dot(fA.crossVectors(gA, fA));
            if (0 > a)
                return null;
            var s = n * this.direction.dot(uA.cross(gA));
            if (0 > s)
                return null;
            if (a + s > r)
                return null;
            var l = -n * gA.dot(mA);
            return 0 > l ? null : this.at(l / r, o)
        },
        applyMatrix4: function(A) {
            return this.origin.applyMatrix4(A),
            this.direction.transformDirection(A),
            this
        },
        equals: function(A) {
            return A.origin.equals(this.origin) && A.direction.equals(this.direction)
        }
    });
    var yA = new y
      , vA = new y
      , IA = new l;
    function EA(A, e) {
        this.normal = void 0 !== A ? A : new y(1,0,0),
        this.constant = void 0 !== e ? e : 0
    }
    Object.assign(EA.prototype, {
        isPlane: !0,
        set: function(A, e) {
            return this.normal.copy(A),
            this.constant = e,
            this
        },
        setComponents: function(A, e, t, i) {
            return this.normal.set(A, e, t),
            this.constant = i,
            this
        },
        setFromNormalAndCoplanarPoint: function(A, e) {
            return this.normal.copy(A),
            this.constant = -e.dot(this.normal),
            this
        },
        setFromCoplanarPoints: function(A, e, t) {
            var i = yA.subVectors(t, e).cross(vA.subVectors(A, e)).normalize();
            return this.setFromNormalAndCoplanarPoint(i, A),
            this
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            return this.normal.copy(A.normal),
            this.constant = A.constant,
            this
        },
        normalize: function() {
            var A = 1 / this.normal.length();
            return this.normal.multiplyScalar(A),
            this.constant *= A,
            this
        },
        negate: function() {
            return this.constant *= -1,
            this.normal.negate(),
            this
        },
        distanceToPoint: function(A) {
            return this.normal.dot(A) + this.constant
        },
        distanceToSphere: function(A) {
            return this.distanceToPoint(A.center) - A.radius
        },
        projectPoint: function(A, e) {
            return void 0 === e && (console.warn("THREE.Plane: .projectPoint() target is now required"),
            e = new y),
            e.copy(this.normal).multiplyScalar(-this.distanceToPoint(A)).add(A)
        },
        intersectLine: function(A, e) {
            void 0 === e && (console.warn("THREE.Plane: .intersectLine() target is now required"),
            e = new y);
            var t = A.delta(yA)
              , i = this.normal.dot(t);
            if (0 === i)
                return 0 === this.distanceToPoint(A.start) ? e.copy(A.start) : void 0;
            var o = -(A.start.dot(this.normal) + this.constant) / i;
            return 0 > o || o > 1 ? void 0 : e.copy(t).multiplyScalar(o).add(A.start)
        },
        intersectsLine: function(A) {
            var e = this.distanceToPoint(A.start)
              , t = this.distanceToPoint(A.end);
            return 0 > e && t > 0 || 0 > t && e > 0
        },
        intersectsBox: function(A) {
            return A.intersectsPlane(this)
        },
        intersectsSphere: function(A) {
            return A.intersectsPlane(this)
        },
        coplanarPoint: function(A) {
            return void 0 === A && (console.warn("THREE.Plane: .coplanarPoint() target is now required"),
            A = new y),
            A.copy(this.normal).multiplyScalar(-this.constant)
        },
        applyMatrix4: function(A, e) {
            var t = e || IA.getNormalMatrix(A)
              , i = this.coplanarPoint(yA).applyMatrix4(A)
              , o = this.normal.applyMatrix3(t).normalize();
            return this.constant = -i.dot(o),
            this
        },
        translate: function(A) {
            return this.constant -= A.dot(this.normal),
            this
        },
        equals: function(A) {
            return A.normal.equals(this.normal) && A.constant === this.constant
        }
    });
    var BA = new y
      , xA = new y
      , SA = new y
      , wA = new y
      , MA = new y
      , bA = new y
      , UA = new y
      , FA = new y
      , KA = new y
      , QA = new y;
    function RA(A, e, t) {
        this.a = void 0 !== A ? A : new y,
        this.b = void 0 !== e ? e : new y,
        this.c = void 0 !== t ? t : new y
    }
    Object.assign(RA, {
        getNormal: function(A, e, t, i) {
            void 0 === i && (console.warn("THREE.Triangle: .getNormal() target is now required"),
            i = new y),
            i.subVectors(t, e),
            BA.subVectors(A, e),
            i.cross(BA);
            var o = i.lengthSq();
            return o > 0 ? i.multiplyScalar(1 / Math.sqrt(o)) : i.set(0, 0, 0)
        },
        getBarycoord: function(A, e, t, i, o) {
            BA.subVectors(i, e),
            xA.subVectors(t, e),
            SA.subVectors(A, e);
            var n = BA.dot(BA)
              , r = BA.dot(xA)
              , a = BA.dot(SA)
              , s = xA.dot(xA)
              , l = xA.dot(SA)
              , c = n * s - r * r;
            if (void 0 === o && (console.warn("THREE.Triangle: .getBarycoord() target is now required"),
            o = new y),
            0 === c)
                return o.set(-2, -1, -1);
            var h = 1 / c
              , d = (s * a - r * l) * h
              , p = (n * l - r * a) * h;
            return o.set(1 - d - p, p, d)
        },
        containsPoint: function(A, e, t, i) {
            return RA.getBarycoord(A, e, t, i, wA),
            wA.x >= 0 && wA.y >= 0 && 1 >= wA.x + wA.y
        },
        getUV: function(A, e, t, i, o, n, r, a) {
            return this.getBarycoord(A, e, t, i, wA),
            a.set(0, 0),
            a.addScaledVector(o, wA.x),
            a.addScaledVector(n, wA.y),
            a.addScaledVector(r, wA.z),
            a
        },
        isFrontFacing: function(A, e, t, i) {
            return BA.subVectors(t, e),
            xA.subVectors(A, e),
            0 > BA.cross(xA).dot(i)
        }
    }),
    Object.assign(RA.prototype, {
        set: function(A, e, t) {
            return this.a.copy(A),
            this.b.copy(e),
            this.c.copy(t),
            this
        },
        setFromPointsAndIndices: function(A, e, t, i) {
            return this.a.copy(A[e]),
            this.b.copy(A[t]),
            this.c.copy(A[i]),
            this
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            return this.a.copy(A.a),
            this.b.copy(A.b),
            this.c.copy(A.c),
            this
        },
        getArea: function() {
            return BA.subVectors(this.c, this.b),
            xA.subVectors(this.a, this.b),
            .5 * BA.cross(xA).length()
        },
        getMidpoint: function(A) {
            return void 0 === A && (console.warn("THREE.Triangle: .getMidpoint() target is now required"),
            A = new y),
            A.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3)
        },
        getNormal: function(A) {
            return RA.getNormal(this.a, this.b, this.c, A)
        },
        getPlane: function(A) {
            return void 0 === A && (console.warn("THREE.Triangle: .getPlane() target is now required"),
            A = new EA),
            A.setFromCoplanarPoints(this.a, this.b, this.c)
        },
        getBarycoord: function(A, e) {
            return RA.getBarycoord(A, this.a, this.b, this.c, e)
        },
        getUV: function(A, e, t, i, o) {
            return RA.getUV(A, this.a, this.b, this.c, e, t, i, o)
        },
        containsPoint: function(A) {
            return RA.containsPoint(A, this.a, this.b, this.c)
        },
        isFrontFacing: function(A) {
            return RA.isFrontFacing(this.a, this.b, this.c, A)
        },
        intersectsBox: function(A) {
            return A.intersectsTriangle(this)
        },
        closestPointToPoint: function(A, e) {
            void 0 === e && (console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),
            e = new y);
            var t, i, o = this.a, n = this.b, r = this.c;
            MA.subVectors(n, o),
            bA.subVectors(r, o),
            FA.subVectors(A, o);
            var a = MA.dot(FA)
              , s = bA.dot(FA);
            if (0 >= a && 0 >= s)
                return e.copy(o);
            KA.subVectors(A, n);
            var l = MA.dot(KA)
              , c = bA.dot(KA);
            if (l >= 0 && l >= c)
                return e.copy(n);
            var h = a * c - l * s;
            if (0 >= h && a >= 0 && 0 >= l)
                return t = a / (a - l),
                e.copy(o).addScaledVector(MA, t);
            QA.subVectors(A, r);
            var d = MA.dot(QA)
              , p = bA.dot(QA);
            if (p >= 0 && p >= d)
                return e.copy(r);
            var g = d * s - a * p;
            if (0 >= g && s >= 0 && 0 >= p)
                return i = s / (s - p),
                e.copy(o).addScaledVector(bA, i);
            var u = l * p - d * c;
            if (0 >= u && c - l >= 0 && d - p >= 0)
                return UA.subVectors(r, n),
                i = (c - l) / (c - l + (d - p)),
                e.copy(n).addScaledVector(UA, i);
            var f = 1 / (u + g + h);
            return t = g * f,
            i = h * f,
            e.copy(o).addScaledVector(MA, t).addScaledVector(bA, i)
        },
        equals: function(A) {
            return A.a.equals(this.a) && A.b.equals(this.b) && A.c.equals(this.c)
        }
    });
    var TA = {
        aliceblue: 15792383,
        antiquewhite: 16444375,
        aqua: 65535,
        aquamarine: 8388564,
        azure: 15794175,
        beige: 16119260,
        bisque: 16770244,
        black: 0,
        blanchedalmond: 16772045,
        blue: 255,
        blueviolet: 9055202,
        brown: 10824234,
        burlywood: 14596231,
        cadetblue: 6266528,
        chartreuse: 8388352,
        chocolate: 13789470,
        coral: 16744272,
        cornflowerblue: 6591981,
        cornsilk: 16775388,
        crimson: 14423100,
        cyan: 65535,
        darkblue: 139,
        darkcyan: 35723,
        darkgoldenrod: 12092939,
        darkgray: 11119017,
        darkgreen: 25600,
        darkgrey: 11119017,
        darkkhaki: 12433259,
        darkmagenta: 9109643,
        darkolivegreen: 5597999,
        darkorange: 16747520,
        darkorchid: 10040012,
        darkred: 9109504,
        darksalmon: 15308410,
        darkseagreen: 9419919,
        darkslateblue: 4734347,
        darkslategray: 3100495,
        darkslategrey: 3100495,
        darkturquoise: 52945,
        darkviolet: 9699539,
        deeppink: 16716947,
        deepskyblue: 49151,
        dimgray: 6908265,
        dimgrey: 6908265,
        dodgerblue: 2003199,
        firebrick: 11674146,
        floralwhite: 16775920,
        forestgreen: 2263842,
        fuchsia: 16711935,
        gainsboro: 14474460,
        ghostwhite: 16316671,
        gold: 16766720,
        goldenrod: 14329120,
        gray: 8421504,
        green: 32768,
        greenyellow: 11403055,
        grey: 8421504,
        honeydew: 15794160,
        hotpink: 16738740,
        indianred: 13458524,
        indigo: 4915330,
        ivory: 16777200,
        khaki: 15787660,
        lavender: 15132410,
        lavenderblush: 16773365,
        lawngreen: 8190976,
        lemonchiffon: 16775885,
        lightblue: 11393254,
        lightcoral: 15761536,
        lightcyan: 14745599,
        lightgoldenrodyellow: 16448210,
        lightgray: 13882323,
        lightgreen: 9498256,
        lightgrey: 13882323,
        lightpink: 16758465,
        lightsalmon: 16752762,
        lightseagreen: 2142890,
        lightskyblue: 8900346,
        lightslategray: 7833753,
        lightslategrey: 7833753,
        lightsteelblue: 11584734,
        lightyellow: 16777184,
        lime: 65280,
        limegreen: 3329330,
        linen: 16445670,
        magenta: 16711935,
        maroon: 8388608,
        mediumaquamarine: 6737322,
        mediumblue: 205,
        mediumorchid: 12211667,
        mediumpurple: 9662683,
        mediumseagreen: 3978097,
        mediumslateblue: 8087790,
        mediumspringgreen: 64154,
        mediumturquoise: 4772300,
        mediumvioletred: 13047173,
        midnightblue: 1644912,
        mintcream: 16121850,
        mistyrose: 16770273,
        moccasin: 16770229,
        navajowhite: 16768685,
        navy: 128,
        oldlace: 16643558,
        olive: 8421376,
        olivedrab: 7048739,
        orange: 16753920,
        orangered: 16729344,
        orchid: 14315734,
        palegoldenrod: 15657130,
        palegreen: 10025880,
        paleturquoise: 11529966,
        palevioletred: 14381203,
        papayawhip: 16773077,
        peachpuff: 16767673,
        peru: 13468991,
        pink: 16761035,
        plum: 14524637,
        powderblue: 11591910,
        purple: 8388736,
        rebeccapurple: 6697881,
        red: 16711680,
        rosybrown: 12357519,
        royalblue: 4286945,
        saddlebrown: 9127187,
        salmon: 16416882,
        sandybrown: 16032864,
        seagreen: 3050327,
        seashell: 16774638,
        sienna: 10506797,
        silver: 12632256,
        skyblue: 8900331,
        slateblue: 6970061,
        slategray: 7372944,
        slategrey: 7372944,
        snow: 16775930,
        springgreen: 65407,
        steelblue: 4620980,
        tan: 13808780,
        teal: 32896,
        thistle: 14204888,
        tomato: 16737095,
        turquoise: 4251856,
        violet: 15631086,
        wheat: 16113331,
        white: 16777215,
        whitesmoke: 16119285,
        yellow: 16776960,
        yellowgreen: 10145074
    }
      , kA = {
        h: 0,
        s: 0,
        l: 0
    }
      , DA = {
        h: 0,
        s: 0,
        l: 0
    };
    function LA(A, e, t) {
        return void 0 === e && void 0 === t ? this.set(A) : this.setRGB(A, e, t)
    }
    function NA(A, e, t) {
        return 0 > t && (t += 1),
        t > 1 && (t -= 1),
        1 / 6 > t ? A + 6 * (e - A) * t : .5 > t ? e : 2 / 3 > t ? A + 6 * (e - A) * (2 / 3 - t) : A
    }
    function OA(A) {
        return .04045 > A ? .0773993808 * A : Math.pow(.9478672986 * A + .0521327014, 2.4)
    }
    function VA(A) {
        return .0031308 > A ? 12.92 * A : 1.055 * Math.pow(A, .41666) - .055
    }
    function GA(A, e, t, i, o, n) {
        this.a = A,
        this.b = e,
        this.c = t,
        this.normal = i && i.isVector3 ? i : new y,
        this.vertexNormals = Array.isArray(i) ? i : [],
        this.color = o && o.isColor ? o : new LA,
        this.vertexColors = Array.isArray(o) ? o : [],
        this.materialIndex = void 0 !== n ? n : 0
    }
    Object.assign(LA.prototype, {
        isColor: !0,
        r: 1,
        g: 1,
        b: 1,
        set: function(A) {
            return A && A.isColor ? this.copy(A) : "number" == typeof A ? this.setHex(A) : "string" == typeof A && this.setStyle(A),
            this
        },
        setScalar: function(A) {
            return this.r = A,
            this.g = A,
            this.b = A,
            this
        },
        setHex: function(A) {
            return A = Math.floor(A),
            this.r = (A >> 16 & 255) / 255,
            this.g = (A >> 8 & 255) / 255,
            this.b = (255 & A) / 255,
            this
        },
        setRGB: function(A, e, t) {
            return this.r = A,
            this.g = e,
            this.b = t,
            this
        },
        setHSL: function(A, e, t) {
            if (A = a.euclideanModulo(A, 1),
            e = a.clamp(e, 0, 1),
            t = a.clamp(t, 0, 1),
            0 === e)
                this.r = this.g = this.b = t;
            else {
                var i = t > .5 ? t + e - t * e : t * (1 + e)
                  , o = 2 * t - i;
                this.r = NA(o, i, A + 1 / 3),
                this.g = NA(o, i, A),
                this.b = NA(o, i, A - 1 / 3)
            }
            return this
        },
        setStyle: function(A) {
            function e(e) {
                void 0 !== e && 1 > parseFloat(e) && console.warn("THREE.Color: Alpha component of " + A + " will be ignored.")
            }
            var t;
            if (t = /^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(A)) {
                var i, o = t[2];
                switch (t[1]) {
                case "rgb":
                case "rgba":
                    if (i = /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))
                        return this.r = Math.min(255, parseInt(i[1], 10)) / 255,
                        this.g = Math.min(255, parseInt(i[2], 10)) / 255,
                        this.b = Math.min(255, parseInt(i[3], 10)) / 255,
                        e(i[5]),
                        this;
                    if (i = /^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))
                        return this.r = Math.min(100, parseInt(i[1], 10)) / 100,
                        this.g = Math.min(100, parseInt(i[2], 10)) / 100,
                        this.b = Math.min(100, parseInt(i[3], 10)) / 100,
                        e(i[5]),
                        this;
                    break;
                case "hsl":
                case "hsla":
                    if (i = /^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)) {
                        var n = parseFloat(i[1]) / 360
                          , r = parseInt(i[2], 10) / 100
                          , a = parseInt(i[3], 10) / 100;
                        return e(i[5]),
                        this.setHSL(n, r, a)
                    }
                }
            } else if (t = /^\#([A-Fa-f0-9]+)$/.exec(A)) {
                var s = t[1]
                  , l = s.length;
                if (3 === l)
                    return this.r = parseInt(s.charAt(0) + s.charAt(0), 16) / 255,
                    this.g = parseInt(s.charAt(1) + s.charAt(1), 16) / 255,
                    this.b = parseInt(s.charAt(2) + s.charAt(2), 16) / 255,
                    this;
                if (6 === l)
                    return this.r = parseInt(s.charAt(0) + s.charAt(1), 16) / 255,
                    this.g = parseInt(s.charAt(2) + s.charAt(3), 16) / 255,
                    this.b = parseInt(s.charAt(4) + s.charAt(5), 16) / 255,
                    this
            }
            return A && A.length > 0 ? this.setColorName(A) : this
        },
        setColorName: function(A) {
            var e = TA[A];
            return void 0 !== e ? this.setHex(e) : console.warn("THREE.Color: Unknown color " + A),
            this
        },
        clone: function() {
            return new this.constructor(this.r,this.g,this.b)
        },
        copy: function(A) {
            return this.r = A.r,
            this.g = A.g,
            this.b = A.b,
            this
        },
        copyGammaToLinear: function(A, e) {
            return void 0 === e && (e = 2),
            this.r = Math.pow(A.r, e),
            this.g = Math.pow(A.g, e),
            this.b = Math.pow(A.b, e),
            this
        },
        copyLinearToGamma: function(A, e) {
            void 0 === e && (e = 2);
            var t = e > 0 ? 1 / e : 1;
            return this.r = Math.pow(A.r, t),
            this.g = Math.pow(A.g, t),
            this.b = Math.pow(A.b, t),
            this
        },
        convertGammaToLinear: function(A) {
            return this.copyGammaToLinear(this, A),
            this
        },
        convertLinearToGamma: function(A) {
            return this.copyLinearToGamma(this, A),
            this
        },
        copySRGBToLinear: function(A) {
            return this.r = OA(A.r),
            this.g = OA(A.g),
            this.b = OA(A.b),
            this
        },
        copyLinearToSRGB: function(A) {
            return this.r = VA(A.r),
            this.g = VA(A.g),
            this.b = VA(A.b),
            this
        },
        convertSRGBToLinear: function() {
            return this.copySRGBToLinear(this),
            this
        },
        convertLinearToSRGB: function() {
            return this.copyLinearToSRGB(this),
            this
        },
        getHex: function() {
            return 255 * this.r << 16 ^ 255 * this.g << 8 ^ 255 * this.b << 0
        },
        getHexString: function() {
            return ("000000" + this.getHex().toString(16)).slice(-6)
        },
        getHSL: function(A) {
            void 0 === A && (console.warn("THREE.Color: .getHSL() target is now required"),
            A = {
                h: 0,
                s: 0,
                l: 0
            });
            var e, t, i = this.r, o = this.g, n = this.b, r = Math.max(i, o, n), a = Math.min(i, o, n), s = (a + r) / 2;
            if (a === r)
                e = 0,
                t = 0;
            else {
                var l = r - a;
                switch (t = s > .5 ? l / (2 - r - a) : l / (r + a),
                r) {
                case i:
                    e = (o - n) / l + (n > o ? 6 : 0);
                    break;
                case o:
                    e = (n - i) / l + 2;
                    break;
                case n:
                    e = (i - o) / l + 4
                }
                e /= 6
            }
            return A.h = e,
            A.s = t,
            A.l = s,
            A
        },
        getStyle: function() {
            return "rgb(" + (255 * this.r | 0) + "," + (255 * this.g | 0) + "," + (255 * this.b | 0) + ")"
        },
        offsetHSL: function(A, e, t) {
            return this.getHSL(kA),
            kA.h += A,
            kA.s += e,
            kA.l += t,
            this.setHSL(kA.h, kA.s, kA.l),
            this
        },
        add: function(A) {
            return this.r += A.r,
            this.g += A.g,
            this.b += A.b,
            this
        },
        addColors: function(A, e) {
            return this.r = A.r + e.r,
            this.g = A.g + e.g,
            this.b = A.b + e.b,
            this
        },
        addScalar: function(A) {
            return this.r += A,
            this.g += A,
            this.b += A,
            this
        },
        sub: function(A) {
            return this.r = Math.max(0, this.r - A.r),
            this.g = Math.max(0, this.g - A.g),
            this.b = Math.max(0, this.b - A.b),
            this
        },
        multiply: function(A) {
            return this.r *= A.r,
            this.g *= A.g,
            this.b *= A.b,
            this
        },
        multiplyScalar: function(A) {
            return this.r *= A,
            this.g *= A,
            this.b *= A,
            this
        },
        lerp: function(A, e) {
            return this.r += (A.r - this.r) * e,
            this.g += (A.g - this.g) * e,
            this.b += (A.b - this.b) * e,
            this
        },
        lerpHSL: function(A, e) {
            this.getHSL(kA),
            A.getHSL(DA);
            var t = a.lerp(kA.h, DA.h, e)
              , i = a.lerp(kA.s, DA.s, e)
              , o = a.lerp(kA.l, DA.l, e);
            return this.setHSL(t, i, o),
            this
        },
        equals: function(A) {
            return A.r === this.r && A.g === this.g && A.b === this.b
        },
        fromArray: function(A, e) {
            return void 0 === e && (e = 0),
            this.r = A[e],
            this.g = A[e + 1],
            this.b = A[e + 2],
            this
        },
        toArray: function(A, e) {
            return void 0 === A && (A = []),
            void 0 === e && (e = 0),
            A[e] = this.r,
            A[e + 1] = this.g,
            A[e + 2] = this.b,
            A
        },
        toJSON: function() {
            return this.getHex()
        }
    }),
    LA.NAMES = TA,
    Object.assign(GA.prototype, {
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            this.a = A.a,
            this.b = A.b,
            this.c = A.c,
            this.normal.copy(A.normal),
            this.color.copy(A.color),
            this.materialIndex = A.materialIndex;
            for (var e = 0, t = A.vertexNormals.length; t > e; e++)
                this.vertexNormals[e] = A.vertexNormals[e].clone();
            for (e = 0,
            t = A.vertexColors.length; t > e; e++)
                this.vertexColors[e] = A.vertexColors[e].clone();
            return this
        }
    });
    var PA = 0;
    function qA() {
        Object.defineProperty(this, "id", {
            value: PA++
        }),
        this.uuid = a.generateUUID(),
        this.name = "",
        this.type = "Material",
        this.fog = !0,
        this.blending = 1,
        this.side = 0,
        this.flatShading = !1,
        this.vertexColors = !1,
        this.opacity = 1,
        this.transparent = !1,
        this.blendSrc = 204,
        this.blendDst = 205,
        this.blendEquation = 100,
        this.blendSrcAlpha = null,
        this.blendDstAlpha = null,
        this.blendEquationAlpha = null,
        this.depthFunc = 3,
        this.depthTest = !0,
        this.depthWrite = !0,
        this.stencilWriteMask = 255,
        this.stencilFunc = 519,
        this.stencilRef = 0,
        this.stencilFuncMask = 255,
        this.stencilFail = 7680,
        this.stencilZFail = 7680,
        this.stencilZPass = 7680,
        this.stencilWrite = !1,
        this.clippingPlanes = null,
        this.clipIntersection = !1,
        this.clipShadows = !1,
        this.shadowSide = null,
        this.colorWrite = !0,
        this.precision = null,
        this.polygonOffset = !1,
        this.polygonOffsetFactor = 0,
        this.polygonOffsetUnits = 0,
        this.dithering = !1,
        this.alphaTest = 0,
        this.premultipliedAlpha = !1,
        this.visible = !0,
        this.toneMapped = !0,
        this.userData = {},
        this.version = 0
    }
    function jA(A) {
        qA.call(this),
        this.type = "MeshBasicMaterial",
        this.color = new LA(16777215),
        this.map = null,
        this.lightMap = null,
        this.lightMapIntensity = 1,
        this.aoMap = null,
        this.aoMapIntensity = 1,
        this.specularMap = null,
        this.alphaMap = null,
        this.envMap = null,
        this.combine = 0,
        this.reflectivity = 1,
        this.refractionRatio = .98,
        this.wireframe = !1,
        this.wireframeLinewidth = 1,
        this.wireframeLinecap = "round",
        this.wireframeLinejoin = "round",
        this.skinning = !1,
        this.morphTargets = !1,
        this.setValues(A)
    }
    qA.prototype = Object.assign(Object.create(i.prototype), {
        constructor: qA,
        isMaterial: !0,
        onBeforeCompile: function() {},
        setValues: function(A) {
            if (void 0 !== A)
                for (var e in A) {
                    var t = A[e];
                    if (void 0 !== t)
                        if ("shading" !== e) {
                            var i = this[e];
                            void 0 !== i ? i && i.isColor ? i.set(t) : i && i.isVector3 && t && t.isVector3 ? i.copy(t) : this[e] = t : console.warn("THREE." + this.type + ": '" + e + "' is not a property of this material.")
                        } else
                            console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."),
                            this.flatShading = 1 === t;
                    else
                        console.warn("THREE.Material: '" + e + "' parameter is undefined.")
                }
        },
        toJSON: function(A) {
            var e = void 0 === A || "string" == typeof A;
            e && (A = {
                textures: {},
                images: {}
            });
            var t = {
                metadata: {
                    version: 4.5,
                    type: "Material",
                    generator: "Material.toJSON"
                }
            };
            function i(A) {
                var e = [];
                for (var t in A) {
                    var i = A[t];
                    delete i.metadata,
                    e.push(i)
                }
                return e
            }
            if (t.uuid = this.uuid,
            t.type = this.type,
            "" !== this.name && (t.name = this.name),
            this.color && this.color.isColor && (t.color = this.color.getHex()),
            void 0 !== this.roughness && (t.roughness = this.roughness),
            void 0 !== this.metalness && (t.metalness = this.metalness),
            this.sheen && this.sheen.isColor && (t.sheen = this.sheen.getHex()),
            this.emissive && this.emissive.isColor && (t.emissive = this.emissive.getHex()),
            this.emissiveIntensity && 1 !== this.emissiveIntensity && (t.emissiveIntensity = this.emissiveIntensity),
            this.specular && this.specular.isColor && (t.specular = this.specular.getHex()),
            void 0 !== this.shininess && (t.shininess = this.shininess),
            void 0 !== this.clearcoat && (t.clearcoat = this.clearcoat),
            void 0 !== this.clearcoatRoughness && (t.clearcoatRoughness = this.clearcoatRoughness),
            this.clearcoatMap && this.clearcoatMap.isTexture && (t.clearcoatMap = this.clearcoatMap.toJSON(A).uuid),
            this.clearcoatRoughnessMap && this.clearcoatRoughnessMap.isTexture && (t.clearcoatRoughnessMap = this.clearcoatRoughnessMap.toJSON(A).uuid),
            this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (t.clearcoatNormalMap = this.clearcoatNormalMap.toJSON(A).uuid,
            t.clearcoatNormalScale = this.clearcoatNormalScale.toArray()),
            this.map && this.map.isTexture && (t.map = this.map.toJSON(A).uuid),
            this.matcap && this.matcap.isTexture && (t.matcap = this.matcap.toJSON(A).uuid),
            this.alphaMap && this.alphaMap.isTexture && (t.alphaMap = this.alphaMap.toJSON(A).uuid),
            this.lightMap && this.lightMap.isTexture && (t.lightMap = this.lightMap.toJSON(A).uuid),
            this.aoMap && this.aoMap.isTexture && (t.aoMap = this.aoMap.toJSON(A).uuid,
            t.aoMapIntensity = this.aoMapIntensity),
            this.bumpMap && this.bumpMap.isTexture && (t.bumpMap = this.bumpMap.toJSON(A).uuid,
            t.bumpScale = this.bumpScale),
            this.normalMap && this.normalMap.isTexture && (t.normalMap = this.normalMap.toJSON(A).uuid,
            t.normalMapType = this.normalMapType,
            t.normalScale = this.normalScale.toArray()),
            this.displacementMap && this.displacementMap.isTexture && (t.displacementMap = this.displacementMap.toJSON(A).uuid,
            t.displacementScale = this.displacementScale,
            t.displacementBias = this.displacementBias),
            this.roughnessMap && this.roughnessMap.isTexture && (t.roughnessMap = this.roughnessMap.toJSON(A).uuid),
            this.metalnessMap && this.metalnessMap.isTexture && (t.metalnessMap = this.metalnessMap.toJSON(A).uuid),
            this.emissiveMap && this.emissiveMap.isTexture && (t.emissiveMap = this.emissiveMap.toJSON(A).uuid),
            this.specularMap && this.specularMap.isTexture && (t.specularMap = this.specularMap.toJSON(A).uuid),
            this.envMap && this.envMap.isTexture && (t.envMap = this.envMap.toJSON(A).uuid,
            t.reflectivity = this.reflectivity,
            t.refractionRatio = this.refractionRatio,
            void 0 !== this.combine && (t.combine = this.combine),
            void 0 !== this.envMapIntensity && (t.envMapIntensity = this.envMapIntensity)),
            this.gradientMap && this.gradientMap.isTexture && (t.gradientMap = this.gradientMap.toJSON(A).uuid),
            void 0 !== this.size && (t.size = this.size),
            void 0 !== this.sizeAttenuation && (t.sizeAttenuation = this.sizeAttenuation),
            1 !== this.blending && (t.blending = this.blending),
            !0 === this.flatShading && (t.flatShading = this.flatShading),
            0 !== this.side && (t.side = this.side),
            this.vertexColors && (t.vertexColors = !0),
            1 > this.opacity && (t.opacity = this.opacity),
            !0 === this.transparent && (t.transparent = this.transparent),
            t.depthFunc = this.depthFunc,
            t.depthTest = this.depthTest,
            t.depthWrite = this.depthWrite,
            t.stencilWrite = this.stencilWrite,
            t.stencilWriteMask = this.stencilWriteMask,
            t.stencilFunc = this.stencilFunc,
            t.stencilRef = this.stencilRef,
            t.stencilFuncMask = this.stencilFuncMask,
            t.stencilFail = this.stencilFail,
            t.stencilZFail = this.stencilZFail,
            t.stencilZPass = this.stencilZPass,
            this.rotation && 0 !== this.rotation && (t.rotation = this.rotation),
            !0 === this.polygonOffset && (t.polygonOffset = !0),
            0 !== this.polygonOffsetFactor && (t.polygonOffsetFactor = this.polygonOffsetFactor),
            0 !== this.polygonOffsetUnits && (t.polygonOffsetUnits = this.polygonOffsetUnits),
            this.linewidth && 1 !== this.linewidth && (t.linewidth = this.linewidth),
            void 0 !== this.dashSize && (t.dashSize = this.dashSize),
            void 0 !== this.gapSize && (t.gapSize = this.gapSize),
            void 0 !== this.scale && (t.scale = this.scale),
            !0 === this.dithering && (t.dithering = !0),
            this.alphaTest > 0 && (t.alphaTest = this.alphaTest),
            !0 === this.premultipliedAlpha && (t.premultipliedAlpha = this.premultipliedAlpha),
            !0 === this.wireframe && (t.wireframe = this.wireframe),
            this.wireframeLinewidth > 1 && (t.wireframeLinewidth = this.wireframeLinewidth),
            "round" !== this.wireframeLinecap && (t.wireframeLinecap = this.wireframeLinecap),
            "round" !== this.wireframeLinejoin && (t.wireframeLinejoin = this.wireframeLinejoin),
            !0 === this.morphTargets && (t.morphTargets = !0),
            !0 === this.morphNormals && (t.morphNormals = !0),
            !0 === this.skinning && (t.skinning = !0),
            !1 === this.visible && (t.visible = !1),
            !1 === this.toneMapped && (t.toneMapped = !1),
            "{}" !== JSON.stringify(this.userData) && (t.userData = this.userData),
            e) {
                var o = i(A.textures)
                  , n = i(A.images);
                o.length > 0 && (t.textures = o),
                n.length > 0 && (t.images = n)
            }
            return t
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            this.name = A.name,
            this.fog = A.fog,
            this.blending = A.blending,
            this.side = A.side,
            this.flatShading = A.flatShading,
            this.vertexColors = A.vertexColors,
            this.opacity = A.opacity,
            this.transparent = A.transparent,
            this.blendSrc = A.blendSrc,
            this.blendDst = A.blendDst,
            this.blendEquation = A.blendEquation,
            this.blendSrcAlpha = A.blendSrcAlpha,
            this.blendDstAlpha = A.blendDstAlpha,
            this.blendEquationAlpha = A.blendEquationAlpha,
            this.depthFunc = A.depthFunc,
            this.depthTest = A.depthTest,
            this.depthWrite = A.depthWrite,
            this.stencilWriteMask = A.stencilWriteMask,
            this.stencilFunc = A.stencilFunc,
            this.stencilRef = A.stencilRef,
            this.stencilFuncMask = A.stencilFuncMask,
            this.stencilFail = A.stencilFail,
            this.stencilZFail = A.stencilZFail,
            this.stencilZPass = A.stencilZPass,
            this.stencilWrite = A.stencilWrite;
            var e = A.clippingPlanes
              , t = null;
            if (null !== e) {
                var i = e.length;
                t = new Array(i);
                for (var o = 0; o !== i; ++o)
                    t[o] = e[o].clone()
            }
            return this.clippingPlanes = t,
            this.clipIntersection = A.clipIntersection,
            this.clipShadows = A.clipShadows,
            this.shadowSide = A.shadowSide,
            this.colorWrite = A.colorWrite,
            this.precision = A.precision,
            this.polygonOffset = A.polygonOffset,
            this.polygonOffsetFactor = A.polygonOffsetFactor,
            this.polygonOffsetUnits = A.polygonOffsetUnits,
            this.dithering = A.dithering,
            this.alphaTest = A.alphaTest,
            this.premultipliedAlpha = A.premultipliedAlpha,
            this.visible = A.visible,
            this.toneMapped = A.toneMapped,
            this.userData = JSON.parse(JSON.stringify(A.userData)),
            this
        },
        dispose: function() {
            this.dispatchEvent({
                type: "dispose"
            })
        }
    }),
    Object.defineProperty(qA.prototype, "needsUpdate", {
        set: function(A) {
            !0 === A && this.version++
        }
    }),
    (jA.prototype = Object.create(qA.prototype)).constructor = jA,
    jA.prototype.isMeshBasicMaterial = !0,
    jA.prototype.copy = function(A) {
        return qA.prototype.copy.call(this, A),
        this.color.copy(A.color),
        this.map = A.map,
        this.lightMap = A.lightMap,
        this.lightMapIntensity = A.lightMapIntensity,
        this.aoMap = A.aoMap,
        this.aoMapIntensity = A.aoMapIntensity,
        this.specularMap = A.specularMap,
        this.alphaMap = A.alphaMap,
        this.envMap = A.envMap,
        this.combine = A.combine,
        this.reflectivity = A.reflectivity,
        this.refractionRatio = A.refractionRatio,
        this.wireframe = A.wireframe,
        this.wireframeLinewidth = A.wireframeLinewidth,
        this.wireframeLinecap = A.wireframeLinecap,
        this.wireframeLinejoin = A.wireframeLinejoin,
        this.skinning = A.skinning,
        this.morphTargets = A.morphTargets,
        this
    }
    ;
    var HA = new y;
    function YA(A, e, t) {
        if (Array.isArray(A))
            throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");
        this.name = "",
        this.array = A,
        this.itemSize = e,
        this.count = void 0 !== A ? A.length / e : 0,
        this.normalized = !0 === t,
        this.usage = 35044,
        this.updateRange = {
            offset: 0,
            count: -1
        },
        this.version = 0
    }
    function WA(A, e, t) {
        YA.call(this, new Int8Array(A), e, t)
    }
    function JA(A, e, t) {
        YA.call(this, new Uint8Array(A), e, t)
    }
    function zA(A, e, t) {
        YA.call(this, new Uint8ClampedArray(A), e, t)
    }
    function ZA(A, e, t) {
        YA.call(this, new Int16Array(A), e, t)
    }
    function XA(A, e, t) {
        YA.call(this, new Uint16Array(A), e, t)
    }
    function _A(A, e, t) {
        YA.call(this, new Int32Array(A), e, t)
    }
    function $A(A, e, t) {
        YA.call(this, new Uint32Array(A), e, t)
    }
    function Ae(A, e, t) {
        YA.call(this, new Float32Array(A), e, t)
    }
    function ee(A, e, t) {
        YA.call(this, new Float64Array(A), e, t)
    }
    function te() {
        this.vertices = [],
        this.normals = [],
        this.colors = [],
        this.uvs = [],
        this.uvs2 = [],
        this.groups = [],
        this.morphTargets = {},
        this.skinWeights = [],
        this.skinIndices = [],
        this.boundingBox = null,
        this.boundingSphere = null,
        this.verticesNeedUpdate = !1,
        this.normalsNeedUpdate = !1,
        this.colorsNeedUpdate = !1,
        this.uvsNeedUpdate = !1,
        this.groupsNeedUpdate = !1
    }
    function ie(A) {
        if (0 === A.length)
            return -1 / 0;
        for (var e = A[0], t = 1, i = A.length; i > t; ++t)
            A[t] > e && (e = A[t]);
        return e
    }
    Object.defineProperty(YA.prototype, "needsUpdate", {
        set: function(A) {
            !0 === A && this.version++
        }
    }),
    Object.assign(YA.prototype, {
        isBufferAttribute: !0,
        onUploadCallback: function() {},
        setUsage: function(A) {
            return this.usage = A,
            this
        },
        copy: function(A) {
            return this.name = A.name,
            this.array = new A.array.constructor(A.array),
            this.itemSize = A.itemSize,
            this.count = A.count,
            this.normalized = A.normalized,
            this.usage = A.usage,
            this
        },
        copyAt: function(A, e, t) {
            A *= this.itemSize,
            t *= e.itemSize;
            for (var i = 0, o = this.itemSize; o > i; i++)
                this.array[A + i] = e.array[t + i];
            return this
        },
        copyArray: function(A) {
            return this.array.set(A),
            this
        },
        copyColorsArray: function(A) {
            for (var e = this.array, t = 0, i = 0, o = A.length; o > i; i++) {
                var n = A[i];
                void 0 === n && (console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined", i),
                n = new LA),
                e[t++] = n.r,
                e[t++] = n.g,
                e[t++] = n.b
            }
            return this
        },
        copyVector2sArray: function(A) {
            for (var e = this.array, t = 0, i = 0, o = A.length; o > i; i++) {
                var n = A[i];
                void 0 === n && (console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined", i),
                n = new s),
                e[t++] = n.x,
                e[t++] = n.y
            }
            return this
        },
        copyVector3sArray: function(A) {
            for (var e = this.array, t = 0, i = 0, o = A.length; o > i; i++) {
                var n = A[i];
                void 0 === n && (console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined", i),
                n = new y),
                e[t++] = n.x,
                e[t++] = n.y,
                e[t++] = n.z
            }
            return this
        },
        copyVector4sArray: function(A) {
            for (var e = this.array, t = 0, i = 0, o = A.length; o > i; i++) {
                var n = A[i];
                void 0 === n && (console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined", i),
                n = new p),
                e[t++] = n.x,
                e[t++] = n.y,
                e[t++] = n.z,
                e[t++] = n.w
            }
            return this
        },
        applyMatrix3: function(A) {
            for (var e = 0, t = this.count; t > e; e++)
                HA.x = this.getX(e),
                HA.y = this.getY(e),
                HA.z = this.getZ(e),
                HA.applyMatrix3(A),
                this.setXYZ(e, HA.x, HA.y, HA.z);
            return this
        },
        applyMatrix4: function(A) {
            for (var e = 0, t = this.count; t > e; e++)
                HA.x = this.getX(e),
                HA.y = this.getY(e),
                HA.z = this.getZ(e),
                HA.applyMatrix4(A),
                this.setXYZ(e, HA.x, HA.y, HA.z);
            return this
        },
        applyNormalMatrix: function(A) {
            for (var e = 0, t = this.count; t > e; e++)
                HA.x = this.getX(e),
                HA.y = this.getY(e),
                HA.z = this.getZ(e),
                HA.applyNormalMatrix(A),
                this.setXYZ(e, HA.x, HA.y, HA.z);
            return this
        },
        transformDirection: function(A) {
            for (var e = 0, t = this.count; t > e; e++)
                HA.x = this.getX(e),
                HA.y = this.getY(e),
                HA.z = this.getZ(e),
                HA.transformDirection(A),
                this.setXYZ(e, HA.x, HA.y, HA.z);
            return this
        },
        set: function(A, e) {
            return void 0 === e && (e = 0),
            this.array.set(A, e),
            this
        },
        getX: function(A) {
            return this.array[A * this.itemSize]
        },
        setX: function(A, e) {
            return this.array[A * this.itemSize] = e,
            this
        },
        getY: function(A) {
            return this.array[A * this.itemSize + 1]
        },
        setY: function(A, e) {
            return this.array[A * this.itemSize + 1] = e,
            this
        },
        getZ: function(A) {
            return this.array[A * this.itemSize + 2]
        },
        setZ: function(A, e) {
            return this.array[A * this.itemSize + 2] = e,
            this
        },
        getW: function(A) {
            return this.array[A * this.itemSize + 3]
        },
        setW: function(A, e) {
            return this.array[A * this.itemSize + 3] = e,
            this
        },
        setXY: function(A, e, t) {
            return this.array[(A *= this.itemSize) + 0] = e,
            this.array[A + 1] = t,
            this
        },
        setXYZ: function(A, e, t, i) {
            return this.array[(A *= this.itemSize) + 0] = e,
            this.array[A + 1] = t,
            this.array[A + 2] = i,
            this
        },
        setXYZW: function(A, e, t, i, o) {
            return this.array[(A *= this.itemSize) + 0] = e,
            this.array[A + 1] = t,
            this.array[A + 2] = i,
            this.array[A + 3] = o,
            this
        },
        onUpload: function(A) {
            return this.onUploadCallback = A,
            this
        },
        clone: function() {
            return new this.constructor(this.array,this.itemSize).copy(this)
        },
        toJSON: function() {
            return {
                itemSize: this.itemSize,
                type: this.array.constructor.name,
                array: Array.prototype.slice.call(this.array),
                normalized: this.normalized
            }
        }
    }),
    (WA.prototype = Object.create(YA.prototype)).constructor = WA,
    (JA.prototype = Object.create(YA.prototype)).constructor = JA,
    (zA.prototype = Object.create(YA.prototype)).constructor = zA,
    (ZA.prototype = Object.create(YA.prototype)).constructor = ZA,
    (XA.prototype = Object.create(YA.prototype)).constructor = XA,
    (_A.prototype = Object.create(YA.prototype)).constructor = _A,
    ($A.prototype = Object.create(YA.prototype)).constructor = $A,
    (Ae.prototype = Object.create(YA.prototype)).constructor = Ae,
    (ee.prototype = Object.create(YA.prototype)).constructor = ee,
    Object.assign(te.prototype, {
        computeGroups: function(A) {
            for (var e, t = [], i = void 0, o = A.faces, n = 0; o.length > n; n++) {
                var r = o[n];
                r.materialIndex !== i && (i = r.materialIndex,
                void 0 !== e && (e.count = 3 * n - e.start,
                t.push(e)),
                e = {
                    start: 3 * n,
                    materialIndex: i
                })
            }
            void 0 !== e && (e.count = 3 * n - e.start,
            t.push(e)),
            this.groups = t
        },
        fromGeometry: function(A) {
            var e, t = A.faces, i = A.vertices, o = A.faceVertexUvs, n = o[0] && o[0].length > 0, r = o[1] && o[1].length > 0, a = A.morphTargets, l = a.length;
            if (l > 0) {
                e = [];
                for (var c = 0; l > c; c++)
                    e[c] = {
                        name: a[c].name,
                        data: []
                    };
                this.morphTargets.position = e
            }
            var h, d = A.morphNormals, p = d.length;
            if (p > 0) {
                h = [];
                for (c = 0; p > c; c++)
                    h[c] = {
                        name: d[c].name,
                        data: []
                    };
                this.morphTargets.normal = h
            }
            var g = A.skinIndices
              , u = A.skinWeights
              , f = g.length === i.length
              , m = u.length === i.length;
            i.length > 0 && 0 === t.length && console.error("THREE.DirectGeometry: Faceless geometries are not supported.");
            for (c = 0; t.length > c; c++) {
                var C = t[c];
                this.vertices.push(i[C.a], i[C.b], i[C.c]);
                var y = C.vertexNormals;
                if (3 === y.length)
                    this.normals.push(y[0], y[1], y[2]);
                else {
                    var v = C.normal;
                    this.normals.push(v, v, v)
                }
                var I, E = C.vertexColors;
                if (3 === E.length)
                    this.colors.push(E[0], E[1], E[2]);
                else {
                    var B = C.color;
                    this.colors.push(B, B, B)
                }
                if (!0 === n)
                    void 0 !== (I = o[0][c]) ? this.uvs.push(I[0], I[1], I[2]) : (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ", c),
                    this.uvs.push(new s, new s, new s));
                if (!0 === r)
                    void 0 !== (I = o[1][c]) ? this.uvs2.push(I[0], I[1], I[2]) : (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ", c),
                    this.uvs2.push(new s, new s, new s));
                for (var x = 0; l > x; x++) {
                    var S = a[x].vertices;
                    e[x].data.push(S[C.a], S[C.b], S[C.c])
                }
                for (x = 0; p > x; x++) {
                    var w = d[x].vertexNormals[c];
                    h[x].data.push(w.a, w.b, w.c)
                }
                f && this.skinIndices.push(g[C.a], g[C.b], g[C.c]),
                m && this.skinWeights.push(u[C.a], u[C.b], u[C.c])
            }
            return this.computeGroups(A),
            this.verticesNeedUpdate = A.verticesNeedUpdate,
            this.normalsNeedUpdate = A.normalsNeedUpdate,
            this.colorsNeedUpdate = A.colorsNeedUpdate,
            this.uvsNeedUpdate = A.uvsNeedUpdate,
            this.groupsNeedUpdate = A.groupsNeedUpdate,
            null !== A.boundingSphere && (this.boundingSphere = A.boundingSphere.clone()),
            null !== A.boundingBox && (this.boundingBox = A.boundingBox.clone()),
            this
        }
    });
    var oe = 1
      , ne = new M
      , re = new H
      , ae = new y
      , se = new aA
      , le = new aA
      , ce = new y;
    function he() {
        Object.defineProperty(this, "id", {
            value: oe += 2
        }),
        this.uuid = a.generateUUID(),
        this.name = "",
        this.type = "BufferGeometry",
        this.index = null,
        this.attributes = {},
        this.morphAttributes = {},
        this.morphTargetsRelative = !1,
        this.groups = [],
        this.boundingBox = null,
        this.boundingSphere = null,
        this.drawRange = {
            start: 0,
            count: 1 / 0
        },
        this.userData = {}
    }
    he.prototype = Object.assign(Object.create(i.prototype), {
        constructor: he,
        isBufferGeometry: !0,
        getIndex: function() {
            return this.index
        },
        setIndex: function(A) {
            this.index = Array.isArray(A) ? new (ie(A) > 65535 ? $A : XA)(A,1) : A
        },
        getAttribute: function(A) {
            return this.attributes[A]
        },
        setAttribute: function(A, e) {
            return this.attributes[A] = e,
            this
        },
        deleteAttribute: function(A) {
            return delete this.attributes[A],
            this
        },
        addGroup: function(A, e, t) {
            this.groups.push({
                start: A,
                count: e,
                materialIndex: void 0 !== t ? t : 0
            })
        },
        clearGroups: function() {
            this.groups = []
        },
        setDrawRange: function(A, e) {
            this.drawRange.start = A,
            this.drawRange.count = e
        },
        applyMatrix4: function(A) {
            var e = this.attributes.position;
            void 0 !== e && (e.applyMatrix4(A),
            e.needsUpdate = !0);
            var t = this.attributes.normal;
            if (void 0 !== t) {
                var i = (new l).getNormalMatrix(A);
                t.applyNormalMatrix(i),
                t.needsUpdate = !0
            }
            var o = this.attributes.tangent;
            return void 0 !== o && (o.transformDirection(A),
            o.needsUpdate = !0),
            null !== this.boundingBox && this.computeBoundingBox(),
            null !== this.boundingSphere && this.computeBoundingSphere(),
            this
        },
        rotateX: function(A) {
            return ne.makeRotationX(A),
            this.applyMatrix4(ne),
            this
        },
        rotateY: function(A) {
            return ne.makeRotationY(A),
            this.applyMatrix4(ne),
            this
        },
        rotateZ: function(A) {
            return ne.makeRotationZ(A),
            this.applyMatrix4(ne),
            this
        },
        translate: function(A, e, t) {
            return ne.makeTranslation(A, e, t),
            this.applyMatrix4(ne),
            this
        },
        scale: function(A, e, t) {
            return ne.makeScale(A, e, t),
            this.applyMatrix4(ne),
            this
        },
        lookAt: function(A) {
            return re.lookAt(A),
            re.updateMatrix(),
            this.applyMatrix4(re.matrix),
            this
        },
        center: function() {
            return this.computeBoundingBox(),
            this.boundingBox.getCenter(ae).negate(),
            this.translate(ae.x, ae.y, ae.z),
            this
        },
        setFromObject: function(A) {
            var e = A.geometry;
            if (A.isPoints || A.isLine) {
                var t = new Ae(3 * e.vertices.length,3)
                  , i = new Ae(3 * e.colors.length,3);
                if (this.setAttribute("position", t.copyVector3sArray(e.vertices)),
                this.setAttribute("color", i.copyColorsArray(e.colors)),
                e.lineDistances && e.lineDistances.length === e.vertices.length) {
                    var o = new Ae(e.lineDistances.length,1);
                    this.setAttribute("lineDistance", o.copyArray(e.lineDistances))
                }
                null !== e.boundingSphere && (this.boundingSphere = e.boundingSphere.clone()),
                null !== e.boundingBox && (this.boundingBox = e.boundingBox.clone())
            } else
                A.isMesh && e && e.isGeometry && this.fromGeometry(e);
            return this
        },
        setFromPoints: function(A) {
            for (var e = [], t = 0, i = A.length; i > t; t++) {
                var o = A[t];
                e.push(o.x, o.y, o.z || 0)
            }
            return this.setAttribute("position", new Ae(e,3)),
            this
        },
        updateFromObject: function(A) {
            var e, t = A.geometry;
            if (A.isMesh) {
                var i = t.__directGeometry;
                if (!0 === t.elementsNeedUpdate && (i = void 0,
                t.elementsNeedUpdate = !1),
                void 0 === i)
                    return this.fromGeometry(t);
                i.verticesNeedUpdate = t.verticesNeedUpdate,
                i.normalsNeedUpdate = t.normalsNeedUpdate,
                i.colorsNeedUpdate = t.colorsNeedUpdate,
                i.uvsNeedUpdate = t.uvsNeedUpdate,
                i.groupsNeedUpdate = t.groupsNeedUpdate,
                t.verticesNeedUpdate = !1,
                t.normalsNeedUpdate = !1,
                t.colorsNeedUpdate = !1,
                t.uvsNeedUpdate = !1,
                t.groupsNeedUpdate = !1,
                t = i
            }
            return !0 === t.verticesNeedUpdate && (void 0 !== (e = this.attributes.position) && (e.copyVector3sArray(t.vertices),
            e.needsUpdate = !0),
            t.verticesNeedUpdate = !1),
            !0 === t.normalsNeedUpdate && (void 0 !== (e = this.attributes.normal) && (e.copyVector3sArray(t.normals),
            e.needsUpdate = !0),
            t.normalsNeedUpdate = !1),
            !0 === t.colorsNeedUpdate && (void 0 !== (e = this.attributes.color) && (e.copyColorsArray(t.colors),
            e.needsUpdate = !0),
            t.colorsNeedUpdate = !1),
            t.uvsNeedUpdate && (void 0 !== (e = this.attributes.uv) && (e.copyVector2sArray(t.uvs),
            e.needsUpdate = !0),
            t.uvsNeedUpdate = !1),
            t.lineDistancesNeedUpdate && (void 0 !== (e = this.attributes.lineDistance) && (e.copyArray(t.lineDistances),
            e.needsUpdate = !0),
            t.lineDistancesNeedUpdate = !1),
            t.groupsNeedUpdate && (t.computeGroups(A.geometry),
            this.groups = t.groups,
            t.groupsNeedUpdate = !1),
            this
        },
        fromGeometry: function(A) {
            return A.__directGeometry = (new te).fromGeometry(A),
            this.fromDirectGeometry(A.__directGeometry)
        },
        fromDirectGeometry: function(A) {
            var e = new Float32Array(3 * A.vertices.length);
            if (this.setAttribute("position", new YA(e,3).copyVector3sArray(A.vertices)),
            A.normals.length > 0) {
                var t = new Float32Array(3 * A.normals.length);
                this.setAttribute("normal", new YA(t,3).copyVector3sArray(A.normals))
            }
            if (A.colors.length > 0) {
                var i = new Float32Array(3 * A.colors.length);
                this.setAttribute("color", new YA(i,3).copyColorsArray(A.colors))
            }
            if (A.uvs.length > 0) {
                var o = new Float32Array(2 * A.uvs.length);
                this.setAttribute("uv", new YA(o,2).copyVector2sArray(A.uvs))
            }
            if (A.uvs2.length > 0) {
                var n = new Float32Array(2 * A.uvs2.length);
                this.setAttribute("uv2", new YA(n,2).copyVector2sArray(A.uvs2))
            }
            for (var r in this.groups = A.groups,
            A.morphTargets) {
                for (var a = [], s = A.morphTargets[r], l = 0, c = s.length; c > l; l++) {
                    var h = s[l]
                      , d = new Ae(3 * h.data.length,3);
                    d.name = h.name,
                    a.push(d.copyVector3sArray(h.data))
                }
                this.morphAttributes[r] = a
            }
            if (A.skinIndices.length > 0) {
                var p = new Ae(4 * A.skinIndices.length,4);
                this.setAttribute("skinIndex", p.copyVector4sArray(A.skinIndices))
            }
            if (A.skinWeights.length > 0) {
                var g = new Ae(4 * A.skinWeights.length,4);
                this.setAttribute("skinWeight", g.copyVector4sArray(A.skinWeights))
            }
            return null !== A.boundingSphere && (this.boundingSphere = A.boundingSphere.clone()),
            null !== A.boundingBox && (this.boundingBox = A.boundingBox.clone()),
            this
        },
        computeBoundingBox: function() {
            null === this.boundingBox && (this.boundingBox = new aA);
            var A = this.attributes.position
              , e = this.morphAttributes.position;
            if (void 0 !== A) {
                if (this.boundingBox.setFromBufferAttribute(A),
                e)
                    for (var t = 0, i = e.length; i > t; t++) {
                        se.setFromBufferAttribute(e[t]),
                        this.morphTargetsRelative ? (ce.addVectors(this.boundingBox.min, se.min),
                        this.boundingBox.expandByPoint(ce),
                        ce.addVectors(this.boundingBox.max, se.max),
                        this.boundingBox.expandByPoint(ce)) : (this.boundingBox.expandByPoint(se.min),
                        this.boundingBox.expandByPoint(se.max))
                    }
            } else
                this.boundingBox.makeEmpty();
            (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) && console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this)
        },
        computeBoundingSphere: function() {
            null === this.boundingSphere && (this.boundingSphere = new cA);
            var A = this.attributes.position
              , e = this.morphAttributes.position;
            if (A) {
                var t = this.boundingSphere.center;
                if (se.setFromBufferAttribute(A),
                e)
                    for (var i = 0, o = e.length; o > i; i++) {
                        le.setFromBufferAttribute(r = e[i]),
                        this.morphTargetsRelative ? (ce.addVectors(se.min, le.min),
                        se.expandByPoint(ce),
                        ce.addVectors(se.max, le.max),
                        se.expandByPoint(ce)) : (se.expandByPoint(le.min),
                        se.expandByPoint(le.max))
                    }
                se.getCenter(t);
                var n = 0;
                for (i = 0,
                o = A.count; o > i; i++)
                    ce.fromBufferAttribute(A, i),
                    n = Math.max(n, t.distanceToSquared(ce));
                if (e)
                    for (i = 0,
                    o = e.length; o > i; i++)
                        for (var r, a = this.morphTargetsRelative, s = 0, l = (r = e[i]).count; l > s; s++)
                            ce.fromBufferAttribute(r, s),
                            a && (ae.fromBufferAttribute(A, s),
                            ce.add(ae)),
                            n = Math.max(n, t.distanceToSquared(ce));
                this.boundingSphere.radius = Math.sqrt(n),
                isNaN(this.boundingSphere.radius) && console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this)
            }
        },
        computeFaceNormals: function() {},
        computeVertexNormals: function() {
            var A = this.index
              , e = this.attributes;
            if (e.position) {
                var t = e.position.array;
                if (void 0 === e.normal)
                    this.setAttribute("normal", new YA(new Float32Array(t.length),3));
                else
                    for (var i = e.normal.array, o = 0, n = i.length; n > o; o++)
                        i[o] = 0;
                var r, a, s, l = e.normal.array, c = new y, h = new y, d = new y, p = new y, g = new y;
                if (A) {
                    var u = A.array;
                    for (o = 0,
                    n = A.count; n > o; o += 3)
                        a = 3 * u[o + 1],
                        s = 3 * u[o + 2],
                        c.fromArray(t, r = 3 * u[o + 0]),
                        h.fromArray(t, a),
                        d.fromArray(t, s),
                        p.subVectors(d, h),
                        g.subVectors(c, h),
                        p.cross(g),
                        l[r] += p.x,
                        l[r + 1] += p.y,
                        l[r + 2] += p.z,
                        l[a] += p.x,
                        l[a + 1] += p.y,
                        l[a + 2] += p.z,
                        l[s] += p.x,
                        l[s + 1] += p.y,
                        l[s + 2] += p.z
                } else
                    for (o = 0,
                    n = t.length; n > o; o += 9)
                        c.fromArray(t, o),
                        h.fromArray(t, o + 3),
                        d.fromArray(t, o + 6),
                        p.subVectors(d, h),
                        g.subVectors(c, h),
                        p.cross(g),
                        l[o] = p.x,
                        l[o + 1] = p.y,
                        l[o + 2] = p.z,
                        l[o + 3] = p.x,
                        l[o + 4] = p.y,
                        l[o + 5] = p.z,
                        l[o + 6] = p.x,
                        l[o + 7] = p.y,
                        l[o + 8] = p.z;
                this.normalizeNormals(),
                e.normal.needsUpdate = !0
            }
        },
        merge: function(A, e) {
            if (A && A.isBufferGeometry) {
                void 0 === e && (e = 0,
                console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));
                var t = this.attributes;
                for (var i in t)
                    if (void 0 !== A.attributes[i])
                        for (var o = t[i].array, n = A.attributes[i], r = n.array, a = n.itemSize * e, s = Math.min(r.length, o.length - a), l = 0, c = a; s > l; l++,
                        c++)
                            o[c] = r[l];
                return this
            }
            console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.", A)
        },
        normalizeNormals: function() {
            for (var A = this.attributes.normal, e = 0, t = A.count; t > e; e++)
                ce.x = A.getX(e),
                ce.y = A.getY(e),
                ce.z = A.getZ(e),
                ce.normalize(),
                A.setXYZ(e, ce.x, ce.y, ce.z)
        },
        toNonIndexed: function() {
            function A(A, e) {
                for (var t = A.array, i = A.itemSize, o = new t.constructor(e.length * i), n = 0, r = 0, a = 0, s = e.length; s > a; a++) {
                    n = e[a] * i;
                    for (var l = 0; i > l; l++)
                        o[r++] = t[n++]
                }
                return new YA(o,i)
            }
            if (null === this.index)
                return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),
                this;
            var e = new he
              , t = this.index.array
              , i = this.attributes;
            for (var o in i) {
                var n = A(i[o], t);
                e.setAttribute(o, n)
            }
            var r = this.morphAttributes;
            for (o in r) {
                for (var a = [], s = r[o], l = 0, c = s.length; c > l; l++) {
                    n = A(s[l], t);
                    a.push(n)
                }
                e.morphAttributes[o] = a
            }
            e.morphTargetsRelative = this.morphTargetsRelative;
            for (var h = this.groups, d = (l = 0,
            h.length); d > l; l++) {
                var p = h[l];
                e.addGroup(p.start, p.count, p.materialIndex)
            }
            return e
        },
        toJSON: function() {
            var A = {
                metadata: {
                    version: 4.5,
                    type: "BufferGeometry",
                    generator: "BufferGeometry.toJSON"
                }
            };
            if (A.uuid = this.uuid,
            A.type = this.type,
            "" !== this.name && (A.name = this.name),
            Object.keys(this.userData).length > 0 && (A.userData = this.userData),
            void 0 !== this.parameters) {
                var e = this.parameters;
                for (var t in e)
                    void 0 !== e[t] && (A[t] = e[t]);
                return A
            }
            A.data = {
                attributes: {}
            };
            var i = this.index;
            null !== i && (A.data.index = {
                type: i.array.constructor.name,
                array: Array.prototype.slice.call(i.array)
            });
            var o = this.attributes;
            for (var t in o) {
                var n = (d = o[t]).toJSON();
                "" !== d.name && (n.name = d.name),
                A.data.attributes[t] = n
            }
            var r = {}
              , a = !1;
            for (var t in this.morphAttributes) {
                for (var s = this.morphAttributes[t], l = [], c = 0, h = s.length; h > c; c++) {
                    var d;
                    n = (d = s[c]).toJSON();
                    "" !== d.name && (n.name = d.name),
                    l.push(n)
                }
                l.length > 0 && (r[t] = l,
                a = !0)
            }
            a && (A.data.morphAttributes = r,
            A.data.morphTargetsRelative = this.morphTargetsRelative);
            var p = this.groups;
            p.length > 0 && (A.data.groups = JSON.parse(JSON.stringify(p)));
            var g = this.boundingSphere;
            return null !== g && (A.data.boundingSphere = {
                center: g.center.toArray(),
                radius: g.radius
            }),
            A
        },
        clone: function() {
            return (new he).copy(this)
        },
        copy: function(A) {
            var e, t, i;
            this.index = null,
            this.attributes = {},
            this.morphAttributes = {},
            this.groups = [],
            this.boundingBox = null,
            this.boundingSphere = null,
            this.name = A.name;
            var o = A.index;
            null !== o && this.setIndex(o.clone());
            var n = A.attributes;
            for (e in n) {
                this.setAttribute(e, n[e].clone())
            }
            var r = A.morphAttributes;
            for (e in r) {
                var a = []
                  , s = r[e];
                for (t = 0,
                i = s.length; i > t; t++)
                    a.push(s[t].clone());
                this.morphAttributes[e] = a
            }
            this.morphTargetsRelative = A.morphTargetsRelative;
            var l = A.groups;
            for (t = 0,
            i = l.length; i > t; t++) {
                var c = l[t];
                this.addGroup(c.start, c.count, c.materialIndex)
            }
            var h = A.boundingBox;
            null !== h && (this.boundingBox = h.clone());
            var d = A.boundingSphere;
            return null !== d && (this.boundingSphere = d.clone()),
            this.drawRange.start = A.drawRange.start,
            this.drawRange.count = A.drawRange.count,
            this.userData = A.userData,
            this
        },
        dispose: function() {
            this.dispatchEvent({
                type: "dispose"
            })
        }
    });
    var de = new M
      , pe = new CA
      , ge = new cA
      , ue = new y
      , fe = new y
      , me = new y
      , Ce = new y
      , ye = new y
      , ve = new y
      , Ie = new y
      , Ee = new y
      , Be = new y
      , xe = new s
      , Se = new s
      , we = new s
      , Me = new y
      , be = new y;
    function Ue(A, e) {
        H.call(this),
        this.type = "Mesh",
        this.geometry = void 0 !== A ? A : new he,
        this.material = void 0 !== e ? e : new jA,
        this.updateMorphTargets()
    }
    function Fe(A, e, t, i, o, n, r, a) {
        if (null === (1 === e.side ? i.intersectTriangle(r, n, o, !0, a) : i.intersectTriangle(o, n, r, 2 !== e.side, a)))
            return null;
        be.copy(a),
        be.applyMatrix4(A.matrixWorld);
        var s = t.ray.origin.distanceTo(be);
        return t.near > s || s > t.far ? null : {
            distance: s,
            point: be.clone(),
            object: A
        }
    }
    function Ke(A, e, t, i, o, n, r, a, l, c, h, d) {
        ue.fromBufferAttribute(o, c),
        fe.fromBufferAttribute(o, h),
        me.fromBufferAttribute(o, d);
        var p = A.morphTargetInfluences;
        if (e.morphTargets && n && p) {
            Ie.set(0, 0, 0),
            Ee.set(0, 0, 0),
            Be.set(0, 0, 0);
            for (var g = 0, u = n.length; u > g; g++) {
                var f = p[g]
                  , m = n[g];
                0 !== f && (Ce.fromBufferAttribute(m, c),
                ye.fromBufferAttribute(m, h),
                ve.fromBufferAttribute(m, d),
                r ? (Ie.addScaledVector(Ce, f),
                Ee.addScaledVector(ye, f),
                Be.addScaledVector(ve, f)) : (Ie.addScaledVector(Ce.sub(ue), f),
                Ee.addScaledVector(ye.sub(fe), f),
                Be.addScaledVector(ve.sub(me), f)))
            }
            ue.add(Ie),
            fe.add(Ee),
            me.add(Be)
        }
        var C = Fe(A, e, t, i, ue, fe, me, Me);
        if (C) {
            a && (xe.fromBufferAttribute(a, c),
            Se.fromBufferAttribute(a, h),
            we.fromBufferAttribute(a, d),
            C.uv = RA.getUV(Me, ue, fe, me, xe, Se, we, new s)),
            l && (xe.fromBufferAttribute(l, c),
            Se.fromBufferAttribute(l, h),
            we.fromBufferAttribute(l, d),
            C.uv2 = RA.getUV(Me, ue, fe, me, xe, Se, we, new s));
            var y = new GA(c,h,d);
            RA.getNormal(ue, fe, me, y.normal),
            C.face = y
        }
        return C
    }
    Ue.prototype = Object.assign(Object.create(H.prototype), {
        constructor: Ue,
        isMesh: !0,
        copy: function(A) {
            return H.prototype.copy.call(this, A),
            void 0 !== A.morphTargetInfluences && (this.morphTargetInfluences = A.morphTargetInfluences.slice()),
            void 0 !== A.morphTargetDictionary && (this.morphTargetDictionary = Object.assign({}, A.morphTargetDictionary)),
            this
        },
        updateMorphTargets: function() {
            var A, e, t, i = this.geometry;
            if (i.isBufferGeometry) {
                var o = i.morphAttributes
                  , n = Object.keys(o);
                if (n.length > 0) {
                    var r = o[n[0]];
                    if (void 0 !== r)
                        for (this.morphTargetInfluences = [],
                        this.morphTargetDictionary = {},
                        A = 0,
                        e = r.length; e > A; A++)
                            t = r[A].name || String(A),
                            this.morphTargetInfluences.push(0),
                            this.morphTargetDictionary[t] = A
                }
            } else {
                var a = i.morphTargets;
                void 0 !== a && a.length > 0 && console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")
            }
        },
        raycast: function(A, e) {
            var t, i = this.geometry, o = this.material, n = this.matrixWorld;
            if (void 0 !== o && (null === i.boundingSphere && i.computeBoundingSphere(),
            ge.copy(i.boundingSphere),
            ge.applyMatrix4(n),
            !1 !== A.ray.intersectsSphere(ge) && (de.getInverse(n),
            pe.copy(A.ray).applyMatrix4(de),
            null === i.boundingBox || !1 !== pe.intersectsBox(i.boundingBox))))
                if (i.isBufferGeometry) {
                    var r, a, l, c, h, d, p, g, u, f = i.index, m = i.attributes.position, C = i.morphAttributes.position, y = i.morphTargetsRelative, v = i.attributes.uv, I = i.attributes.uv2, E = i.groups, B = i.drawRange;
                    if (null !== f)
                        if (Array.isArray(o)) {
                            for (c = 0,
                            d = E.length; d > c; c++)
                                if (u = o[(g = E[c]).materialIndex])
                                    for (h = Math.max(g.start, B.start),
                                    p = Math.min(g.start + g.count, B.start + B.count); p > h; h += 3)
                                        r = f.getX(h),
                                        a = f.getX(h + 1),
                                        l = f.getX(h + 2),
                                        (t = Ke(this, u, A, pe, m, C, y, v, I, r, a, l)) && (t.faceIndex = Math.floor(h / 3),
                                        t.face.materialIndex = g.materialIndex,
                                        e.push(t))
                        } else
                            for (c = Math.max(0, B.start),
                            d = Math.min(f.count, B.start + B.count); d > c; c += 3)
                                r = f.getX(c),
                                a = f.getX(c + 1),
                                l = f.getX(c + 2),
                                (t = Ke(this, o, A, pe, m, C, y, v, I, r, a, l)) && (t.faceIndex = Math.floor(c / 3),
                                e.push(t));
                    else if (void 0 !== m)
                        if (Array.isArray(o))
                            for (c = 0,
                            d = E.length; d > c; c++)
                                for (u = o[(g = E[c]).materialIndex],
                                h = Math.max(g.start, B.start),
                                p = Math.min(g.start + g.count, B.start + B.count); p > h; h += 3)
                                    (t = Ke(this, u, A, pe, m, C, y, v, I, r = h, a = h + 1, l = h + 2)) && (t.faceIndex = Math.floor(h / 3),
                                    t.face.materialIndex = g.materialIndex,
                                    e.push(t));
                        else
                            for (c = Math.max(0, B.start),
                            d = Math.min(m.count, B.start + B.count); d > c; c += 3)
                                (t = Ke(this, o, A, pe, m, C, y, v, I, r = c, a = c + 1, l = c + 2)) && (t.faceIndex = Math.floor(c / 3),
                                e.push(t))
                } else if (i.isGeometry) {
                    var x, S, w, M, b = Array.isArray(o), U = i.vertices, F = i.faces, K = i.faceVertexUvs[0];
                    K.length > 0 && (M = K);
                    for (var Q = 0, R = F.length; R > Q; Q++) {
                        var T = F[Q]
                          , k = b ? o[T.materialIndex] : o;
                        if (void 0 !== k && (t = Fe(this, k, A, pe, x = U[T.a], S = U[T.b], w = U[T.c], Me))) {
                            if (M && M[Q]) {
                                var D = M[Q];
                                xe.copy(D[0]),
                                Se.copy(D[1]),
                                we.copy(D[2]),
                                t.uv = RA.getUV(Me, x, S, w, xe, Se, we, new s)
                            }
                            t.face = T,
                            t.faceIndex = Q,
                            e.push(t)
                        }
                    }
                }
        },
        clone: function() {
            return new this.constructor(this.geometry,this.material).copy(this)
        }
    });
    var Qe = 0
      , Re = new M
      , Te = new H
      , ke = new y;
    function De() {
        Object.defineProperty(this, "id", {
            value: Qe += 2
        }),
        this.uuid = a.generateUUID(),
        this.name = "",
        this.type = "Geometry",
        this.vertices = [],
        this.colors = [],
        this.faces = [],
        this.faceVertexUvs = [[]],
        this.morphTargets = [],
        this.morphNormals = [],
        this.skinWeights = [],
        this.skinIndices = [],
        this.lineDistances = [],
        this.boundingBox = null,
        this.boundingSphere = null,
        this.elementsNeedUpdate = !1,
        this.verticesNeedUpdate = !1,
        this.uvsNeedUpdate = !1,
        this.normalsNeedUpdate = !1,
        this.colorsNeedUpdate = !1,
        this.lineDistancesNeedUpdate = !1,
        this.groupsNeedUpdate = !1
    }
    De.prototype = Object.assign(Object.create(i.prototype), {
        constructor: De,
        isGeometry: !0,
        applyMatrix4: function(A) {
            for (var e = (new l).getNormalMatrix(A), t = 0, i = this.vertices.length; i > t; t++) {
                this.vertices[t].applyMatrix4(A)
            }
            for (t = 0,
            i = this.faces.length; i > t; t++) {
                var o = this.faces[t];
                o.normal.applyMatrix3(e).normalize();
                for (var n = 0, r = o.vertexNormals.length; r > n; n++)
                    o.vertexNormals[n].applyMatrix3(e).normalize()
            }
            return null !== this.boundingBox && this.computeBoundingBox(),
            null !== this.boundingSphere && this.computeBoundingSphere(),
            this.verticesNeedUpdate = !0,
            this.normalsNeedUpdate = !0,
            this
        },
        rotateX: function(A) {
            return Re.makeRotationX(A),
            this.applyMatrix4(Re),
            this
        },
        rotateY: function(A) {
            return Re.makeRotationY(A),
            this.applyMatrix4(Re),
            this
        },
        rotateZ: function(A) {
            return Re.makeRotationZ(A),
            this.applyMatrix4(Re),
            this
        },
        translate: function(A, e, t) {
            return Re.makeTranslation(A, e, t),
            this.applyMatrix4(Re),
            this
        },
        scale: function(A, e, t) {
            return Re.makeScale(A, e, t),
            this.applyMatrix4(Re),
            this
        },
        lookAt: function(A) {
            return Te.lookAt(A),
            Te.updateMatrix(),
            this.applyMatrix4(Te.matrix),
            this
        },
        fromBufferGeometry: function(A) {
            var e = this
              , t = null !== A.index ? A.index.array : void 0
              , i = A.attributes;
            if (void 0 === i.position)
                return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),
                this;
            var o = i.position.array
              , n = void 0 !== i.normal ? i.normal.array : void 0
              , r = void 0 !== i.color ? i.color.array : void 0
              , a = void 0 !== i.uv ? i.uv.array : void 0
              , l = void 0 !== i.uv2 ? i.uv2.array : void 0;
            void 0 !== l && (this.faceVertexUvs[1] = []);
            for (var c = 0; o.length > c; c += 3)
                e.vertices.push((new y).fromArray(o, c)),
                void 0 !== r && e.colors.push((new LA).fromArray(r, c));
            function h(A, t, i, o) {
                var c = void 0 === r ? [] : [e.colors[A].clone(), e.colors[t].clone(), e.colors[i].clone()]
                  , h = new GA(A,t,i,void 0 === n ? [] : [(new y).fromArray(n, 3 * A), (new y).fromArray(n, 3 * t), (new y).fromArray(n, 3 * i)],c,o);
                e.faces.push(h),
                void 0 !== a && e.faceVertexUvs[0].push([(new s).fromArray(a, 2 * A), (new s).fromArray(a, 2 * t), (new s).fromArray(a, 2 * i)]),
                void 0 !== l && e.faceVertexUvs[1].push([(new s).fromArray(l, 2 * A), (new s).fromArray(l, 2 * t), (new s).fromArray(l, 2 * i)])
            }
            var d = A.groups;
            if (d.length > 0)
                for (c = 0; d.length > c; c++)
                    for (var p = d[c], g = p.start, u = g, f = g + p.count; f > u; u += 3)
                        void 0 !== t ? h(t[u], t[u + 1], t[u + 2], p.materialIndex) : h(u, u + 1, u + 2, p.materialIndex);
            else if (void 0 !== t)
                for (c = 0; t.length > c; c += 3)
                    h(t[c], t[c + 1], t[c + 2]);
            else
                for (c = 0; o.length / 3 > c; c += 3)
                    h(c, c + 1, c + 2);
            return this.computeFaceNormals(),
            null !== A.boundingBox && (this.boundingBox = A.boundingBox.clone()),
            null !== A.boundingSphere && (this.boundingSphere = A.boundingSphere.clone()),
            this
        },
        center: function() {
            return this.computeBoundingBox(),
            this.boundingBox.getCenter(ke).negate(),
            this.translate(ke.x, ke.y, ke.z),
            this
        },
        normalize: function() {
            this.computeBoundingSphere();
            var A = this.boundingSphere.center
              , e = this.boundingSphere.radius
              , t = 0 === e ? 1 : 1 / e
              , i = new M;
            return i.set(t, 0, 0, -t * A.x, 0, t, 0, -t * A.y, 0, 0, t, -t * A.z, 0, 0, 0, 1),
            this.applyMatrix4(i),
            this
        },
        computeFaceNormals: function() {
            for (var A = new y, e = new y, t = 0, i = this.faces.length; i > t; t++) {
                var o = this.faces[t]
                  , n = this.vertices[o.a]
                  , r = this.vertices[o.b];
                A.subVectors(this.vertices[o.c], r),
                e.subVectors(n, r),
                A.cross(e),
                A.normalize(),
                o.normal.copy(A)
            }
        },
        computeVertexNormals: function(A) {
            var e, t, i, o, n, r;
            for (void 0 === A && (A = !0),
            r = new Array(this.vertices.length),
            e = 0,
            t = this.vertices.length; t > e; e++)
                r[e] = new y;
            if (A) {
                var a, s, l = new y, c = new y;
                for (i = 0,
                o = this.faces.length; o > i; i++)
                    a = this.vertices[(n = this.faces[i]).a],
                    l.subVectors(this.vertices[n.c], s = this.vertices[n.b]),
                    c.subVectors(a, s),
                    l.cross(c),
                    r[n.a].add(l),
                    r[n.b].add(l),
                    r[n.c].add(l)
            } else
                for (this.computeFaceNormals(),
                i = 0,
                o = this.faces.length; o > i; i++)
                    r[(n = this.faces[i]).a].add(n.normal),
                    r[n.b].add(n.normal),
                    r[n.c].add(n.normal);
            for (e = 0,
            t = this.vertices.length; t > e; e++)
                r[e].normalize();
            for (i = 0,
            o = this.faces.length; o > i; i++) {
                var h = (n = this.faces[i]).vertexNormals;
                3 === h.length ? (h[0].copy(r[n.a]),
                h[1].copy(r[n.b]),
                h[2].copy(r[n.c])) : (h[0] = r[n.a].clone(),
                h[1] = r[n.b].clone(),
                h[2] = r[n.c].clone())
            }
            this.faces.length > 0 && (this.normalsNeedUpdate = !0)
        },
        computeFlatVertexNormals: function() {
            var A, e, t;
            for (this.computeFaceNormals(),
            A = 0,
            e = this.faces.length; e > A; A++) {
                var i = (t = this.faces[A]).vertexNormals;
                3 === i.length ? (i[0].copy(t.normal),
                i[1].copy(t.normal),
                i[2].copy(t.normal)) : (i[0] = t.normal.clone(),
                i[1] = t.normal.clone(),
                i[2] = t.normal.clone())
            }
            this.faces.length > 0 && (this.normalsNeedUpdate = !0)
        },
        computeMorphNormals: function() {
            var A, e, t, i, o;
            for (t = 0,
            i = this.faces.length; i > t; t++)
                for ((o = this.faces[t]).__originalFaceNormal ? o.__originalFaceNormal.copy(o.normal) : o.__originalFaceNormal = o.normal.clone(),
                o.__originalVertexNormals || (o.__originalVertexNormals = []),
                A = 0,
                e = o.vertexNormals.length; e > A; A++)
                    o.__originalVertexNormals[A] ? o.__originalVertexNormals[A].copy(o.vertexNormals[A]) : o.__originalVertexNormals[A] = o.vertexNormals[A].clone();
            var n = new De;
            for (n.faces = this.faces,
            A = 0,
            e = this.morphTargets.length; e > A; A++) {
                if (!this.morphNormals[A]) {
                    this.morphNormals[A] = {},
                    this.morphNormals[A].faceNormals = [],
                    this.morphNormals[A].vertexNormals = [];
                    var r = this.morphNormals[A].faceNormals
                      , a = this.morphNormals[A].vertexNormals;
                    for (t = 0,
                    i = this.faces.length; i > t; t++)
                        s = new y,
                        l = {
                            a: new y,
                            b: new y,
                            c: new y
                        },
                        r.push(s),
                        a.push(l)
                }
                var s, l, c = this.morphNormals[A];
                for (n.vertices = this.morphTargets[A].vertices,
                n.computeFaceNormals(),
                n.computeVertexNormals(),
                t = 0,
                i = this.faces.length; i > t; t++)
                    l = c.vertexNormals[t],
                    (s = c.faceNormals[t]).copy((o = this.faces[t]).normal),
                    l.a.copy(o.vertexNormals[0]),
                    l.b.copy(o.vertexNormals[1]),
                    l.c.copy(o.vertexNormals[2])
            }
            for (t = 0,
            i = this.faces.length; i > t; t++)
                (o = this.faces[t]).normal = o.__originalFaceNormal,
                o.vertexNormals = o.__originalVertexNormals
        },
        computeBoundingBox: function() {
            null === this.boundingBox && (this.boundingBox = new aA),
            this.boundingBox.setFromPoints(this.vertices)
        },
        computeBoundingSphere: function() {
            null === this.boundingSphere && (this.boundingSphere = new cA),
            this.boundingSphere.setFromPoints(this.vertices)
        },
        merge: function(A, e, t) {
            if (A && A.isGeometry) {
                var i, o = this.vertices.length, n = this.vertices, r = A.vertices, a = this.faces, s = A.faces, c = this.colors, h = A.colors;
                void 0 === t && (t = 0),
                void 0 !== e && (i = (new l).getNormalMatrix(e));
                for (var d = 0, p = r.length; p > d; d++) {
                    var g = r[d].clone();
                    void 0 !== e && g.applyMatrix4(e),
                    n.push(g)
                }
                for (d = 0,
                p = h.length; p > d; d++)
                    c.push(h[d].clone());
                for (d = 0,
                p = s.length; p > d; d++) {
                    var u, f, m = s[d], C = m.vertexNormals, y = m.vertexColors;
                    (u = new GA(m.a + o,m.b + o,m.c + o)).normal.copy(m.normal),
                    void 0 !== i && u.normal.applyMatrix3(i).normalize();
                    for (var v = 0, I = C.length; I > v; v++)
                        f = C[v].clone(),
                        void 0 !== i && f.applyMatrix3(i).normalize(),
                        u.vertexNormals.push(f);
                    u.color.copy(m.color);
                    for (v = 0,
                    I = y.length; I > v; v++)
                        u.vertexColors.push(y[v].clone());
                    u.materialIndex = m.materialIndex + t,
                    a.push(u)
                }
                for (d = 0,
                p = A.faceVertexUvs.length; p > d; d++) {
                    var E = A.faceVertexUvs[d];
                    void 0 === this.faceVertexUvs[d] && (this.faceVertexUvs[d] = []);
                    for (v = 0,
                    I = E.length; I > v; v++) {
                        for (var B = E[v], x = [], S = 0, w = B.length; w > S; S++)
                            x.push(B[S].clone());
                        this.faceVertexUvs[d].push(x)
                    }
                }
            } else
                console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.", A)
        },
        mergeMesh: function(A) {
            A && A.isMesh ? (A.matrixAutoUpdate && A.updateMatrix(),
            this.merge(A.geometry, A.matrix)) : console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.", A)
        },
        mergeVertices: function() {
            var A, e, t, i, o, n, r, a, s = {}, l = [], c = [], h = Math.pow(10, 4);
            for (t = 0,
            i = this.vertices.length; i > t; t++)
                A = this.vertices[t],
                void 0 === s[e = Math.round(A.x * h) + "_" + Math.round(A.y * h) + "_" + Math.round(A.z * h)] ? (s[e] = t,
                l.push(this.vertices[t]),
                c[t] = l.length - 1) : c[t] = c[s[e]];
            var d = [];
            for (t = 0,
            i = this.faces.length; i > t; t++) {
                (o = this.faces[t]).a = c[o.a],
                o.b = c[o.b],
                o.c = c[o.c],
                n = [o.a, o.b, o.c];
                for (var p = 0; 3 > p; p++)
                    if (n[p] === n[(p + 1) % 3]) {
                        d.push(t);
                        break
                    }
            }
            for (t = d.length - 1; t >= 0; t--) {
                var g = d[t];
                for (this.faces.splice(g, 1),
                r = 0,
                a = this.faceVertexUvs.length; a > r; r++)
                    this.faceVertexUvs[r].splice(g, 1)
            }
            var u = this.vertices.length - l.length;
            return this.vertices = l,
            u
        },
        setFromPoints: function(A) {
            this.vertices = [];
            for (var e = 0, t = A.length; t > e; e++) {
                var i = A[e];
                this.vertices.push(new y(i.x,i.y,i.z || 0))
            }
            return this
        },
        sortFacesByMaterialIndex: function() {
            for (var A = this.faces, e = A.length, t = 0; e > t; t++)
                A[t]._id = t;
            A.sort((function(A, e) {
                return A.materialIndex - e.materialIndex
            }
            ));
            var i, o, n = this.faceVertexUvs[0], r = this.faceVertexUvs[1];
            n && n.length === e && (i = []),
            r && r.length === e && (o = []);
            for (t = 0; e > t; t++) {
                var a = A[t]._id;
                i && i.push(n[a]),
                o && o.push(r[a])
            }
            i && (this.faceVertexUvs[0] = i),
            o && (this.faceVertexUvs[1] = o)
        },
        toJSON: function() {
            var A = {
                metadata: {
                    version: 4.5,
                    type: "Geometry",
                    generator: "Geometry.toJSON"
                }
            };
            if (A.uuid = this.uuid,
            A.type = this.type,
            "" !== this.name && (A.name = this.name),
            void 0 !== this.parameters) {
                var e = this.parameters;
                for (var t in e)
                    void 0 !== e[t] && (A[t] = e[t]);
                return A
            }
            for (var i = [], o = 0; this.vertices.length > o; o++) {
                var n = this.vertices[o];
                i.push(n.x, n.y, n.z)
            }
            var r = []
              , a = []
              , s = {}
              , l = []
              , c = {}
              , h = []
              , d = {};
            for (o = 0; this.faces.length > o; o++) {
                var p = this.faces[o]
                  , g = void 0 !== this.faceVertexUvs[0][o]
                  , u = p.normal.length() > 0
                  , f = p.vertexNormals.length > 0
                  , m = 1 !== p.color.r || 1 !== p.color.g || 1 !== p.color.b
                  , C = p.vertexColors.length > 0
                  , y = 0;
                if (y = B(y, 0, 0),
                y = B(y, 1, !0),
                y = B(y, 2, !1),
                y = B(y, 3, g),
                y = B(y, 4, u),
                y = B(y, 5, f),
                y = B(y, 6, m),
                y = B(y, 7, C),
                r.push(y),
                r.push(p.a, p.b, p.c),
                r.push(p.materialIndex),
                g) {
                    var v = this.faceVertexUvs[0][o];
                    r.push(w(v[0]), w(v[1]), w(v[2]))
                }
                if (u && r.push(x(p.normal)),
                f) {
                    var I = p.vertexNormals;
                    r.push(x(I[0]), x(I[1]), x(I[2]))
                }
                if (m && r.push(S(p.color)),
                C) {
                    var E = p.vertexColors;
                    r.push(S(E[0]), S(E[1]), S(E[2]))
                }
            }
            function B(A, e, t) {
                return t ? A | 1 << e : A & ~(1 << e)
            }
            function x(A) {
                var e = A.x.toString() + A.y.toString() + A.z.toString();
                return void 0 !== s[e] || (s[e] = a.length / 3,
                a.push(A.x, A.y, A.z)),
                s[e]
            }
            function S(A) {
                var e = A.r.toString() + A.g.toString() + A.b.toString();
                return void 0 !== c[e] || (c[e] = l.length,
                l.push(A.getHex())),
                c[e]
            }
            function w(A) {
                var e = A.x.toString() + A.y.toString();
                return void 0 !== d[e] || (d[e] = h.length / 2,
                h.push(A.x, A.y)),
                d[e]
            }
            return A.data = {},
            A.data.vertices = i,
            A.data.normals = a,
            l.length > 0 && (A.data.colors = l),
            h.length > 0 && (A.data.uvs = [h]),
            A.data.faces = r,
            A
        },
        clone: function() {
            return (new De).copy(this)
        },
        copy: function(A) {
            var e, t, i, o, n, r;
            this.vertices = [],
            this.colors = [],
            this.faces = [],
            this.faceVertexUvs = [[]],
            this.morphTargets = [],
            this.morphNormals = [],
            this.skinWeights = [],
            this.skinIndices = [],
            this.lineDistances = [],
            this.boundingBox = null,
            this.boundingSphere = null,
            this.name = A.name;
            var a = A.vertices;
            for (e = 0,
            t = a.length; t > e; e++)
                this.vertices.push(a[e].clone());
            var s = A.colors;
            for (e = 0,
            t = s.length; t > e; e++)
                this.colors.push(s[e].clone());
            var l = A.faces;
            for (e = 0,
            t = l.length; t > e; e++)
                this.faces.push(l[e].clone());
            for (e = 0,
            t = A.faceVertexUvs.length; t > e; e++) {
                var c = A.faceVertexUvs[e];
                for (void 0 === this.faceVertexUvs[e] && (this.faceVertexUvs[e] = []),
                i = 0,
                o = c.length; o > i; i++) {
                    var h = c[i]
                      , d = [];
                    for (n = 0,
                    r = h.length; r > n; n++) {
                        d.push(h[n].clone())
                    }
                    this.faceVertexUvs[e].push(d)
                }
            }
            var p = A.morphTargets;
            for (e = 0,
            t = p.length; t > e; e++) {
                var g = {};
                if (g.name = p[e].name,
                void 0 !== p[e].vertices)
                    for (g.vertices = [],
                    i = 0,
                    o = p[e].vertices.length; o > i; i++)
                        g.vertices.push(p[e].vertices[i].clone());
                if (void 0 !== p[e].normals)
                    for (g.normals = [],
                    i = 0,
                    o = p[e].normals.length; o > i; i++)
                        g.normals.push(p[e].normals[i].clone());
                this.morphTargets.push(g)
            }
            var u = A.morphNormals;
            for (e = 0,
            t = u.length; t > e; e++) {
                var f = {};
                if (void 0 !== u[e].vertexNormals)
                    for (f.vertexNormals = [],
                    i = 0,
                    o = u[e].vertexNormals.length; o > i; i++) {
                        var m = u[e].vertexNormals[i]
                          , C = {};
                        C.a = m.a.clone(),
                        C.b = m.b.clone(),
                        C.c = m.c.clone(),
                        f.vertexNormals.push(C)
                    }
                if (void 0 !== u[e].faceNormals)
                    for (f.faceNormals = [],
                    i = 0,
                    o = u[e].faceNormals.length; o > i; i++)
                        f.faceNormals.push(u[e].faceNormals[i].clone());
                this.morphNormals.push(f)
            }
            var y = A.skinWeights;
            for (e = 0,
            t = y.length; t > e; e++)
                this.skinWeights.push(y[e].clone());
            var v = A.skinIndices;
            for (e = 0,
            t = v.length; t > e; e++)
                this.skinIndices.push(v[e].clone());
            var I = A.lineDistances;
            for (e = 0,
            t = I.length; t > e; e++)
                this.lineDistances.push(I[e]);
            var E = A.boundingBox;
            null !== E && (this.boundingBox = E.clone());
            var B = A.boundingSphere;
            return null !== B && (this.boundingSphere = B.clone()),
            this.elementsNeedUpdate = A.elementsNeedUpdate,
            this.verticesNeedUpdate = A.verticesNeedUpdate,
            this.uvsNeedUpdate = A.uvsNeedUpdate,
            this.normalsNeedUpdate = A.normalsNeedUpdate,
            this.colorsNeedUpdate = A.colorsNeedUpdate,
            this.lineDistancesNeedUpdate = A.lineDistancesNeedUpdate,
            this.groupsNeedUpdate = A.groupsNeedUpdate,
            this
        },
        dispose: function() {
            this.dispatchEvent({
                type: "dispose"
            })
        }
    });
    class Le extends De {
        constructor(A, e, t, i, o, n) {
            super(),
            this.type = "BoxGeometry",
            this.parameters = {
                width: A,
                height: e,
                depth: t,
                widthSegments: i,
                heightSegments: o,
                depthSegments: n
            },
            this.fromBufferGeometry(new Ne(A,e,t,i,o,n)),
            this.mergeVertices()
        }
    }
    class Ne extends he {
        constructor(A, e, t, i, o, n) {
            super(),
            this.type = "BoxBufferGeometry",
            this.parameters = {
                width: A,
                height: e,
                depth: t,
                widthSegments: i,
                heightSegments: o,
                depthSegments: n
            };
            var r = this;
            A = A || 1,
            e = e || 1,
            t = t || 1,
            i = Math.floor(i) || 1,
            o = Math.floor(o) || 1,
            n = Math.floor(n) || 1;
            var a = []
              , s = []
              , l = []
              , c = []
              , h = 0
              , d = 0;
            function p(A, e, t, i, o, n, p, g, u, f, m) {
                var C, v, I = n / u, E = p / f, B = n / 2, x = p / 2, S = g / 2, w = u + 1, M = f + 1, b = 0, U = 0, F = new y;
                for (v = 0; M > v; v++) {
                    var K = v * E - x;
                    for (C = 0; w > C; C++) {
                        F[A] = (C * I - B) * i,
                        F[e] = K * o,
                        F[t] = S,
                        s.push(F.x, F.y, F.z),
                        F[A] = 0,
                        F[e] = 0,
                        F[t] = g > 0 ? 1 : -1,
                        l.push(F.x, F.y, F.z),
                        c.push(C / u),
                        c.push(1 - v / f),
                        b += 1
                    }
                }
                for (v = 0; f > v; v++)
                    for (C = 0; u > C; C++) {
                        var Q = h + C + w * (v + 1)
                          , R = h + (C + 1) + w * (v + 1)
                          , T = h + (C + 1) + w * v;
                        a.push(h + C + w * v, Q, T),
                        a.push(Q, R, T),
                        U += 6
                    }
                r.addGroup(d, U, m),
                d += U,
                h += b
            }
            p("z", "y", "x", -1, -1, t, e, A, n, o, 0),
            p("z", "y", "x", 1, -1, t, e, -A, n, o, 1),
            p("x", "z", "y", 1, 1, A, t, e, i, n, 2),
            p("x", "z", "y", 1, -1, A, t, -e, i, n, 3),
            p("x", "y", "z", 1, -1, A, e, t, i, o, 4),
            p("x", "y", "z", -1, -1, A, e, -t, i, o, 5),
            this.setIndex(a),
            this.setAttribute("position", new Ae(s,3)),
            this.setAttribute("normal", new Ae(l,3)),
            this.setAttribute("uv", new Ae(c,2))
        }
    }
    function Oe(A) {
        var e = {};
        for (var t in A)
            for (var i in e[t] = {},
            A[t]) {
                var o = A[t][i];
                e[t][i] = o && (o.isColor || o.isMatrix3 || o.isMatrix4 || o.isVector2 || o.isVector3 || o.isVector4 || o.isTexture) ? o.clone() : Array.isArray(o) ? o.slice() : o
            }
        return e
    }
    function Ve(A) {
        for (var e = {}, t = 0; A.length > t; t++) {
            var i = Oe(A[t]);
            for (var o in i)
                e[o] = i[o]
        }
        return e
    }
    var Ge = {
        clone: Oe,
        merge: Ve
    };
    function Pe(A) {
        qA.call(this),
        this.type = "ShaderMaterial",
        this.defines = {},
        this.uniforms = {},
        this.vertexShader = "void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
        this.fragmentShader = "void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",
        this.linewidth = 1,
        this.wireframe = !1,
        this.wireframeLinewidth = 1,
        this.fog = !1,
        this.lights = !1,
        this.clipping = !1,
        this.skinning = !1,
        this.morphTargets = !1,
        this.morphNormals = !1,
        this.extensions = {
            derivatives: !1,
            fragDepth: !1,
            drawBuffers: !1,
            shaderTextureLOD: !1
        },
        this.defaultAttributeValues = {
            color: [1, 1, 1],
            uv: [0, 0],
            uv2: [0, 0]
        },
        this.index0AttributeName = void 0,
        this.uniformsNeedUpdate = !1,
        void 0 !== A && (void 0 !== A.attributes && console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),
        this.setValues(A))
    }
    function qe() {
        H.call(this),
        this.type = "Camera",
        this.matrixWorldInverse = new M,
        this.projectionMatrix = new M,
        this.projectionMatrixInverse = new M
    }
    function je(A, e, t, i) {
        qe.call(this),
        this.type = "PerspectiveCamera",
        this.fov = void 0 !== A ? A : 50,
        this.zoom = 1,
        this.near = void 0 !== t ? t : .1,
        this.far = void 0 !== i ? i : 2e3,
        this.focus = 10,
        this.aspect = void 0 !== e ? e : 1,
        this.view = null,
        this.filmGauge = 35,
        this.filmOffset = 0,
        this.updateProjectionMatrix()
    }
    (Pe.prototype = Object.create(qA.prototype)).constructor = Pe,
    Pe.prototype.isShaderMaterial = !0,
    Pe.prototype.copy = function(A) {
        return qA.prototype.copy.call(this, A),
        this.fragmentShader = A.fragmentShader,
        this.vertexShader = A.vertexShader,
        this.uniforms = Oe(A.uniforms),
        this.defines = Object.assign({}, A.defines),
        this.wireframe = A.wireframe,
        this.wireframeLinewidth = A.wireframeLinewidth,
        this.lights = A.lights,
        this.clipping = A.clipping,
        this.skinning = A.skinning,
        this.morphTargets = A.morphTargets,
        this.morphNormals = A.morphNormals,
        this.extensions = A.extensions,
        this
    }
    ,
    Pe.prototype.toJSON = function(A) {
        var e = qA.prototype.toJSON.call(this, A);
        for (var t in e.uniforms = {},
        this.uniforms) {
            var i = this.uniforms[t].value;
            e.uniforms[t] = i && i.isTexture ? {
                type: "t",
                value: i.toJSON(A).uuid
            } : i && i.isColor ? {
                type: "c",
                value: i.getHex()
            } : i && i.isVector2 ? {
                type: "v2",
                value: i.toArray()
            } : i && i.isVector3 ? {
                type: "v3",
                value: i.toArray()
            } : i && i.isVector4 ? {
                type: "v4",
                value: i.toArray()
            } : i && i.isMatrix3 ? {
                type: "m3",
                value: i.toArray()
            } : i && i.isMatrix4 ? {
                type: "m4",
                value: i.toArray()
            } : {
                value: i
            }
        }
        Object.keys(this.defines).length > 0 && (e.defines = this.defines),
        e.vertexShader = this.vertexShader,
        e.fragmentShader = this.fragmentShader;
        var o = {};
        for (var n in this.extensions)
            !0 === this.extensions[n] && (o[n] = !0);
        return Object.keys(o).length > 0 && (e.extensions = o),
        e
    }
    ,
    qe.prototype = Object.assign(Object.create(H.prototype), {
        constructor: qe,
        isCamera: !0,
        copy: function(A, e) {
            return H.prototype.copy.call(this, A, e),
            this.matrixWorldInverse.copy(A.matrixWorldInverse),
            this.projectionMatrix.copy(A.projectionMatrix),
            this.projectionMatrixInverse.copy(A.projectionMatrixInverse),
            this
        },
        getWorldDirection: function(A) {
            void 0 === A && (console.warn("THREE.Camera: .getWorldDirection() target is now required"),
            A = new y),
            this.updateMatrixWorld(!0);
            var e = this.matrixWorld.elements;
            return A.set(-e[8], -e[9], -e[10]).normalize()
        },
        updateMatrixWorld: function(A) {
            H.prototype.updateMatrixWorld.call(this, A),
            this.matrixWorldInverse.getInverse(this.matrixWorld)
        },
        updateWorldMatrix: function(A, e) {
            H.prototype.updateWorldMatrix.call(this, A, e),
            this.matrixWorldInverse.getInverse(this.matrixWorld)
        },
        clone: function() {
            return (new this.constructor).copy(this)
        }
    }),
    je.prototype = Object.assign(Object.create(qe.prototype), {
        constructor: je,
        isPerspectiveCamera: !0,
        copy: function(A, e) {
            return qe.prototype.copy.call(this, A, e),
            this.fov = A.fov,
            this.zoom = A.zoom,
            this.near = A.near,
            this.far = A.far,
            this.focus = A.focus,
            this.aspect = A.aspect,
            this.view = null === A.view ? null : Object.assign({}, A.view),
            this.filmGauge = A.filmGauge,
            this.filmOffset = A.filmOffset,
            this
        },
        setFocalLength: function(A) {
            var e = .5 * this.getFilmHeight() / A;
            this.fov = 2 * a.RAD2DEG * Math.atan(e),
            this.updateProjectionMatrix()
        },
        getFocalLength: function() {
            var A = Math.tan(.5 * a.DEG2RAD * this.fov);
            return .5 * this.getFilmHeight() / A
        },
        getEffectiveFOV: function() {
            return 2 * a.RAD2DEG * Math.atan(Math.tan(.5 * a.DEG2RAD * this.fov) / this.zoom)
        },
        getFilmWidth: function() {
            return this.filmGauge * Math.min(this.aspect, 1)
        },
        getFilmHeight: function() {
            return this.filmGauge / Math.max(this.aspect, 1)
        },
        setViewOffset: function(A, e, t, i, o, n) {
            this.aspect = A / e,
            null === this.view && (this.view = {
                enabled: !0,
                fullWidth: 1,
                fullHeight: 1,
                offsetX: 0,
                offsetY: 0,
                width: 1,
                height: 1
            }),
            this.view.enabled = !0,
            this.view.fullWidth = A,
            this.view.fullHeight = e,
            this.view.offsetX = t,
            this.view.offsetY = i,
            this.view.width = o,
            this.view.height = n,
            this.updateProjectionMatrix()
        },
        clearViewOffset: function() {
            null !== this.view && (this.view.enabled = !1),
            this.updateProjectionMatrix()
        },
        updateProjectionMatrix: function() {
            var A = this.near
              , e = A * Math.tan(.5 * a.DEG2RAD * this.fov) / this.zoom
              , t = 2 * e
              , i = this.aspect * t
              , o = -.5 * i
              , n = this.view;
            if (null !== this.view && this.view.enabled) {
                var r = n.fullWidth
                  , s = n.fullHeight;
                o += n.offsetX * i / r,
                e -= n.offsetY * t / s,
                i *= n.width / r,
                t *= n.height / s
            }
            var l = this.filmOffset;
            0 !== l && (o += A * l / this.getFilmWidth()),
            this.projectionMatrix.makePerspective(o, o + i, e, e - t, A, this.far),
            this.projectionMatrixInverse.getInverse(this.projectionMatrix)
        },
        toJSON: function(A) {
            var e = H.prototype.toJSON.call(this, A);
            return e.object.fov = this.fov,
            e.object.zoom = this.zoom,
            e.object.near = this.near,
            e.object.far = this.far,
            e.object.focus = this.focus,
            e.object.aspect = this.aspect,
            null !== this.view && (e.object.view = Object.assign({}, this.view)),
            e.object.filmGauge = this.filmGauge,
            e.object.filmOffset = this.filmOffset,
            e
        }
    });
    function He(A, e, t, i) {
        H.call(this),
        this.type = "CubeCamera";
        var o = new je(90,1,A,e);
        o.up.set(0, -1, 0),
        o.lookAt(new y(1,0,0)),
        this.add(o);
        var n = new je(90,1,A,e);
        n.up.set(0, -1, 0),
        n.lookAt(new y(-1,0,0)),
        this.add(n);
        var r = new je(90,1,A,e);
        r.up.set(0, 0, 1),
        r.lookAt(new y(0,1,0)),
        this.add(r);
        var a = new je(90,1,A,e);
        a.up.set(0, 0, -1),
        a.lookAt(new y(0,-1,0)),
        this.add(a);
        var s = new je(90,1,A,e);
        s.up.set(0, -1, 0),
        s.lookAt(new y(0,0,1)),
        this.add(s);
        var l = new je(90,1,A,e);
        l.up.set(0, -1, 0),
        l.lookAt(new y(0,0,-1)),
        this.add(l),
        this.renderTarget = new Ye(t,i = i || {
            format: 1022,
            magFilter: 1006,
            minFilter: 1006
        }),
        this.renderTarget.texture.name = "CubeCamera",
        this.update = function(A, e) {
            null === this.parent && this.updateMatrixWorld();
            var t = A.getRenderTarget()
              , i = this.renderTarget
              , c = i.texture.generateMipmaps;
            i.texture.generateMipmaps = !1,
            A.setRenderTarget(i, 0),
            A.render(e, o),
            A.setRenderTarget(i, 1),
            A.render(e, n),
            A.setRenderTarget(i, 2),
            A.render(e, r),
            A.setRenderTarget(i, 3),
            A.render(e, a),
            A.setRenderTarget(i, 4),
            A.render(e, s),
            i.texture.generateMipmaps = c,
            A.setRenderTarget(i, 5),
            A.render(e, l),
            A.setRenderTarget(t)
        }
        ,
        this.clear = function(A, e, t, i) {
            for (var o = A.getRenderTarget(), n = this.renderTarget, r = 0; 6 > r; r++)
                A.setRenderTarget(n, r),
                A.clear(e, t, i);
            A.setRenderTarget(o)
        }
    }
    function Ye(A, e, t) {
        Number.isInteger(e) && (console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),
        e = t),
        g.call(this, A, A, e)
    }
    function We(A, e, t, i, o, n, r, a, s, l, c, h) {
        d.call(this, null, n, r, a, s, l, i, o, c, h),
        this.image = {
            data: A || null,
            width: e || 1,
            height: t || 1
        },
        this.magFilter = void 0 !== s ? s : 1003,
        this.minFilter = void 0 !== l ? l : 1003,
        this.generateMipmaps = !1,
        this.flipY = !1,
        this.unpackAlignment = 1,
        this.needsUpdate = !0
    }
    (He.prototype = Object.create(H.prototype)).constructor = He,
    (Ye.prototype = Object.create(g.prototype)).constructor = Ye,
    Ye.prototype.isWebGLCubeRenderTarget = !0,
    Ye.prototype.fromEquirectangularTexture = function(A, e) {
        this.texture.type = e.type,
        this.texture.format = e.format,
        this.texture.encoding = e.encoding;
        var t = new Y
          , i = {
            uniforms: {
                tEquirect: {
                    value: null
                }
            },
            vertexShader: ["varying vec3 vWorldDirection;", "vec3 transformDirection( in vec3 dir, in mat4 matrix ) {", "\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );", "}", "void main() {", "\tvWorldDirection = transformDirection( position, modelMatrix );", "\t#include <begin_vertex>", "\t#include <project_vertex>", "}"].join("\n"),
            fragmentShader: ["uniform sampler2D tEquirect;", "varying vec3 vWorldDirection;", "#define RECIPROCAL_PI 0.31830988618", "#define RECIPROCAL_PI2 0.15915494", "void main() {", "\tvec3 direction = normalize( vWorldDirection );", "\tvec2 sampleUV;", "\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;", "\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;", "\tgl_FragColor = texture2D( tEquirect, sampleUV );", "}"].join("\n")
        }
          , o = new Pe({
            type: "CubemapFromEquirect",
            uniforms: Oe(i.uniforms),
            vertexShader: i.vertexShader,
            fragmentShader: i.fragmentShader,
            side: 1,
            blending: 0
        });
        o.uniforms.tEquirect.value = e;
        var n = new Ue(new Ne(5,5,5),o);
        t.add(n);
        var r = new He(1,10,1);
        return r.renderTarget = this,
        r.renderTarget.texture.name = "CubeCameraTexture",
        r.update(A, t),
        n.geometry.dispose(),
        n.material.dispose(),
        this
    }
    ,
    (We.prototype = Object.create(d.prototype)).constructor = We,
    We.prototype.isDataTexture = !0;
    var Je = new cA
      , ze = new y;
    function Ze(A, e, t, i, o, n) {
        this.planes = [void 0 !== A ? A : new EA, void 0 !== e ? e : new EA, void 0 !== t ? t : new EA, void 0 !== i ? i : new EA, void 0 !== o ? o : new EA, void 0 !== n ? n : new EA]
    }
    Object.assign(Ze.prototype, {
        set: function(A, e, t, i, o, n) {
            var r = this.planes;
            return r[0].copy(A),
            r[1].copy(e),
            r[2].copy(t),
            r[3].copy(i),
            r[4].copy(o),
            r[5].copy(n),
            this
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            for (var e = this.planes, t = 0; 6 > t; t++)
                e[t].copy(A.planes[t]);
            return this
        },
        setFromProjectionMatrix: function(A) {
            var e = this.planes
              , t = A.elements
              , i = t[0]
              , o = t[1]
              , n = t[2]
              , r = t[3]
              , a = t[4]
              , s = t[5]
              , l = t[6]
              , c = t[7]
              , h = t[8]
              , d = t[9]
              , p = t[10]
              , g = t[11]
              , u = t[12]
              , f = t[13]
              , m = t[14]
              , C = t[15];
            return e[0].setComponents(r - i, c - a, g - h, C - u).normalize(),
            e[1].setComponents(r + i, c + a, g + h, C + u).normalize(),
            e[2].setComponents(r + o, c + s, g + d, C + f).normalize(),
            e[3].setComponents(r - o, c - s, g - d, C - f).normalize(),
            e[4].setComponents(r - n, c - l, g - p, C - m).normalize(),
            e[5].setComponents(r + n, c + l, g + p, C + m).normalize(),
            this
        },
        intersectsObject: function(A) {
            var e = A.geometry;
            return null === e.boundingSphere && e.computeBoundingSphere(),
            Je.copy(e.boundingSphere).applyMatrix4(A.matrixWorld),
            this.intersectsSphere(Je)
        },
        intersectsSprite: function(A) {
            return Je.center.set(0, 0, 0),
            Je.radius = .7071067811865476,
            Je.applyMatrix4(A.matrixWorld),
            this.intersectsSphere(Je)
        },
        intersectsSphere: function(A) {
            for (var e = this.planes, t = A.center, i = -A.radius, o = 0; 6 > o; o++) {
                if (i > e[o].distanceToPoint(t))
                    return !1
            }
            return !0
        },
        intersectsBox: function(A) {
            for (var e = this.planes, t = 0; 6 > t; t++) {
                var i = e[t];
                if (ze.x = i.normal.x > 0 ? A.max.x : A.min.x,
                ze.y = i.normal.y > 0 ? A.max.y : A.min.y,
                ze.z = i.normal.z > 0 ? A.max.z : A.min.z,
                0 > i.distanceToPoint(ze))
                    return !1
            }
            return !0
        },
        containsPoint: function(A) {
            for (var e = this.planes, t = 0; 6 > t; t++)
                if (0 > e[t].distanceToPoint(A))
                    return !1;
            return !0
        }
    });
    var Xe = {
        common: {
            diffuse: {
                value: new LA(15658734)
            },
            opacity: {
                value: 1
            },
            map: {
                value: null
            },
            uvTransform: {
                value: new l
            },
            uv2Transform: {
                value: new l
            },
            alphaMap: {
                value: null
            }
        },
        specularmap: {
            specularMap: {
                value: null
            }
        },
        envmap: {
            envMap: {
                value: null
            },
            flipEnvMap: {
                value: -1
            },
            reflectivity: {
                value: 1
            },
            refractionRatio: {
                value: .98
            },
            maxMipLevel: {
                value: 0
            }
        },
        aomap: {
            aoMap: {
                value: null
            },
            aoMapIntensity: {
                value: 1
            }
        },
        lightmap: {
            lightMap: {
                value: null
            },
            lightMapIntensity: {
                value: 1
            }
        },
        emissivemap: {
            emissiveMap: {
                value: null
            }
        },
        bumpmap: {
            bumpMap: {
                value: null
            },
            bumpScale: {
                value: 1
            }
        },
        normalmap: {
            normalMap: {
                value: null
            },
            normalScale: {
                value: new s(1,1)
            }
        },
        displacementmap: {
            displacementMap: {
                value: null
            },
            displacementScale: {
                value: 1
            },
            displacementBias: {
                value: 0
            }
        },
        roughnessmap: {
            roughnessMap: {
                value: null
            }
        },
        metalnessmap: {
            metalnessMap: {
                value: null
            }
        },
        gradientmap: {
            gradientMap: {
                value: null
            }
        },
        fog: {
            fogDensity: {
                value: 25e-5
            },
            fogNear: {
                value: 1
            },
            fogFar: {
                value: 2e3
            },
            fogColor: {
                value: new LA(16777215)
            }
        },
        lights: {
            ambientLightColor: {
                value: []
            },
            lightProbe: {
                value: []
            },
            directionalLights: {
                value: [],
                properties: {
                    direction: {},
                    color: {}
                }
            },
            directionalLightShadows: {
                value: [],
                properties: {
                    shadowBias: {},
                    shadowRadius: {},
                    shadowMapSize: {}
                }
            },
            directionalShadowMap: {
                value: []
            },
            directionalShadowMatrix: {
                value: []
            },
            spotLights: {
                value: [],
                properties: {
                    color: {},
                    position: {},
                    direction: {},
                    distance: {},
                    coneCos: {},
                    penumbraCos: {},
                    decay: {}
                }
            },
            spotLightShadows: {
                value: [],
                properties: {
                    shadowBias: {},
                    shadowRadius: {},
                    shadowMapSize: {}
                }
            },
            spotShadowMap: {
                value: []
            },
            spotShadowMatrix: {
                value: []
            },
            pointLights: {
                value: [],
                properties: {
                    color: {},
                    position: {},
                    decay: {},
                    distance: {}
                }
            },
            pointLightShadows: {
                value: [],
                properties: {
                    shadowBias: {},
                    shadowRadius: {},
                    shadowMapSize: {},
                    shadowCameraNear: {},
                    shadowCameraFar: {}
                }
            },
            pointShadowMap: {
                value: []
            },
            pointShadowMatrix: {
                value: []
            },
            hemisphereLights: {
                value: [],
                properties: {
                    direction: {},
                    skyColor: {},
                    groundColor: {}
                }
            },
            rectAreaLights: {
                value: [],
                properties: {
                    color: {},
                    position: {},
                    width: {},
                    height: {}
                }
            }
        },
        points: {
            diffuse: {
                value: new LA(15658734)
            },
            opacity: {
                value: 1
            },
            size: {
                value: 1
            },
            scale: {
                value: 1
            },
            map: {
                value: null
            },
            alphaMap: {
                value: null
            },
            uvTransform: {
                value: new l
            }
        },
        sprite: {
            diffuse: {
                value: new LA(15658734)
            },
            opacity: {
                value: 1
            },
            center: {
                value: new s(.5,.5)
            },
            rotation: {
                value: 0
            },
            map: {
                value: null
            },
            alphaMap: {
                value: null
            },
            uvTransform: {
                value: new l
            }
        }
    };
    function _e() {
        var A = null
          , e = !1
          , t = null;
        function i(o, n) {
            !1 !== e && (t(o, n),
            A.requestAnimationFrame(i))
        }
        return {
            start: function() {
                !0 !== e && null !== t && (A.requestAnimationFrame(i),
                e = !0)
            },
            stop: function() {
                e = !1
            },
            setAnimationLoop: function(A) {
                t = A
            },
            setContext: function(e) {
                A = e
            }
        }
    }
    function $e(A, e) {
        var t = e.isWebGL2
          , i = new WeakMap;
        return {
            get: function(A) {
                return A.isInterleavedBufferAttribute && (A = A.data),
                i.get(A)
            },
            remove: function(e) {
                e.isInterleavedBufferAttribute && (e = e.data);
                var t = i.get(e);
                t && (A.deleteBuffer(t.buffer),
                i.delete(e))
            },
            update: function(e, o) {
                e.isInterleavedBufferAttribute && (e = e.data);
                var n = i.get(e);
                void 0 === n ? i.set(e, function(e, t) {
                    var i = e.array
                      , o = e.usage
                      , n = A.createBuffer();
                    A.bindBuffer(t, n),
                    A.bufferData(t, i, o),
                    e.onUploadCallback();
                    var r = 5126;
                    return i instanceof Float32Array ? r = 5126 : i instanceof Float64Array ? console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.") : i instanceof Uint16Array ? r = 5123 : i instanceof Int16Array ? r = 5122 : i instanceof Uint32Array ? r = 5125 : i instanceof Int32Array ? r = 5124 : i instanceof Int8Array ? r = 5120 : i instanceof Uint8Array && (r = 5121),
                    {
                        buffer: n,
                        type: r,
                        bytesPerElement: i.BYTES_PER_ELEMENT,
                        version: e.version
                    }
                }(e, o)) : e.version > n.version && (!function(e, i, o) {
                    var n = i.array
                      , r = i.updateRange;
                    A.bindBuffer(o, e),
                    -1 === r.count ? A.bufferSubData(o, 0, n) : (t ? A.bufferSubData(o, r.offset * n.BYTES_PER_ELEMENT, n, r.offset, r.count) : A.bufferSubData(o, r.offset * n.BYTES_PER_ELEMENT, n.subarray(r.offset, r.offset + r.count)),
                    r.count = -1)
                }(n.buffer, e, o),
                n.version = e.version)
            }
        }
    }
    function At(A, e, t, i) {
        De.call(this),
        this.type = "PlaneGeometry",
        this.parameters = {
            width: A,
            height: e,
            widthSegments: t,
            heightSegments: i
        },
        this.fromBufferGeometry(new et(A,e,t,i)),
        this.mergeVertices()
    }
    function et(A, e, t, i) {
        he.call(this),
        this.type = "PlaneBufferGeometry",
        this.parameters = {
            width: A,
            height: e,
            widthSegments: t,
            heightSegments: i
        };
        var o, n, r = (A = A || 1) / 2, a = (e = e || 1) / 2, s = Math.floor(t) || 1, l = Math.floor(i) || 1, c = s + 1, h = l + 1, d = A / s, p = e / l, g = [], u = [], f = [], m = [];
        for (n = 0; h > n; n++) {
            var C = n * p - a;
            for (o = 0; c > o; o++) {
                u.push(o * d - r, -C, 0),
                f.push(0, 0, 1),
                m.push(o / s),
                m.push(1 - n / l)
            }
        }
        for (n = 0; l > n; n++)
            for (o = 0; s > o; o++) {
                var y = o + c * (n + 1)
                  , v = o + 1 + c * (n + 1)
                  , I = o + 1 + c * n;
                g.push(o + c * n, y, I),
                g.push(y, v, I)
            }
        this.setIndex(g),
        this.setAttribute("position", new Ae(u,3)),
        this.setAttribute("normal", new Ae(f,3)),
        this.setAttribute("uv", new Ae(m,2))
    }
    (At.prototype = Object.create(De.prototype)).constructor = At,
    (et.prototype = Object.create(he.prototype)).constructor = et;
    var tt = {
        alphamap_fragment: "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",
        alphamap_pars_fragment: "#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",
        alphatest_fragment: "#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",
        aomap_fragment: "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",
        aomap_pars_fragment: "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",
        begin_vertex: "vec3 transformed = vec3( position );",
        beginnormal_vertex: "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",
        bsdfs: "vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE  = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS  = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha  = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",
        bumpmap_pars_fragment: "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",
        clipping_planes_fragment: "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",
        clipping_planes_pars_fragment: "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",
        clipping_planes_pars_vertex: "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",
        clipping_planes_vertex: "#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",
        color_fragment: "#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",
        color_pars_fragment: "#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",
        color_pars_vertex: "#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",
        color_vertex: "#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",
        common: "#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n  return m[ 2 ][ 3 ] == - 1.0;\n}",
        cube_uv_reflection_fragment: "#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n    vec3 absDirection = abs(direction);\n    float face = -1.0;\n    if (absDirection.x > absDirection.z) {\n      if (absDirection.x > absDirection.y)\n        face = direction.x > 0.0 ? 0.0 : 3.0;\n      else\n        face = direction.y > 0.0 ? 1.0 : 4.0;\n    } else {\n      if (absDirection.z > absDirection.y)\n        face = direction.z > 0.0 ? 2.0 : 5.0;\n      else\n        face = direction.y > 0.0 ? 1.0 : 4.0;\n    }\n    return face;\n}\nvec2 getUV(vec3 direction, float face) {\n    vec2 uv;\n    if (face == 0.0) {\n      uv = vec2(-direction.z, direction.y) / abs(direction.x);\n    } else if (face == 1.0) {\n      uv = vec2(direction.x, -direction.z) / abs(direction.y);\n    } else if (face == 2.0) {\n      uv = direction.xy / abs(direction.z);\n    } else if (face == 3.0) {\n      uv = vec2(direction.z, direction.y) / abs(direction.x);\n    } else if (face == 4.0) {\n      uv = direction.xz / abs(direction.y);\n    } else {\n      uv = vec2(-direction.x, direction.y) / abs(direction.z);\n    }\n    return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n  float face = getFace(direction);\n  float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n  mipInt = max(mipInt, cubeUV_minMipLevel);\n  float faceSize = exp2(mipInt);\n  float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n  vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n  vec2 f = fract(uv);\n  uv += 0.5 - f;\n  if (face > 2.0) {\n    uv.y += faceSize;\n    face -= 3.0;\n  }\n  uv.x += face * faceSize;\n  if(mipInt < cubeUV_maxMipLevel){\n    uv.y += 2.0 * cubeUV_maxTileSize;\n  }\n  uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n  uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n  uv *= texelSize;\n  vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n  uv.x += texelSize;\n  vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n  uv.y += texelSize;\n  vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n  uv.x -= texelSize;\n  vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n  vec3 tm = mix(tl, tr, f.x);\n  vec3 bm = mix(bl, br, f.x);\n  return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n  float mip = 0.0;\n  if (roughness >= r1) {\n    mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n  } else if (roughness >= r4) {\n    mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n  } else if (roughness >= r5) {\n    mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n  } else if (roughness >= r6) {\n    mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n  } else {\n    mip = -2.0 * log2(1.16 * roughness);  }\n  return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n  float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n  float mipF = fract(mip);\n  float mipInt = floor(mip);\n  vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n  if (mipF == 0.0) {\n    return vec4(color0, 1.0);\n  } else {\n    vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n    return vec4(mix(color0, color1, mipF), 1.0);\n  }\n}\n#endif",
        defaultnormal_vertex: "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",
        displacementmap_pars_vertex: "#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",
        displacementmap_vertex: "#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",
        emissivemap_fragment: "#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",
        emissivemap_pars_fragment: "#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",
        encodings_fragment: "gl_FragColor = linearToOutputTexel( gl_FragColor );",
        encodings_pars_fragment: "\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value )  {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",
        envmap_fragment: "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\t\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t}  else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",
        envmap_common_pars_fragment: "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",
        envmap_pars_fragment: "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",
        envmap_pars_vertex: "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",
        envmap_physical_pars_fragment: "#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t  vec3 reflectVec = reflect( -viewDir, normal );\n\t\t  reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t  vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",
        envmap_vertex: "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) { \n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",
        fog_vertex: "#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",
        fog_pars_vertex: "#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",
        fog_fragment: "#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",
        fog_pars_fragment: "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",
        gradientmap_pars_fragment: "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",
        lightmap_fragment: "#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",
        lightmap_pars_fragment: "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",
        lights_lambert_vertex: "vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",
        lights_pars_begin: "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight  ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",
        lights_toon_fragment: "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",
        lights_toon_pars_fragment: "varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",
        lights_phong_fragment: "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",
        lights_phong_pars_fragment: "varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",
        lights_physical_fragment: "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",
        lights_physical_pars_fragment: "struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3(    0, 1,    0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",
        lights_fragment_begin: "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",
        lights_fragment_maps: "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",
        lights_fragment_end: "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",
        logdepthbuf_fragment: "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",
        logdepthbuf_pars_fragment: "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",
        logdepthbuf_pars_vertex: "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",
        logdepthbuf_vertex: "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",
        map_fragment: "#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",
        map_pars_fragment: "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",
        map_particle_fragment: "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",
        map_particle_pars_fragment: "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",
        metalnessmap_fragment: "float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",
        metalnessmap_pars_fragment: "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",
        morphnormal_vertex: "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",
        morphtarget_pars_vertex: "#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",
        morphtarget_vertex: "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",
        normal_fragment_begin: "#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",
        normal_fragment_maps: "#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",
        normalmap_pars_fragment: "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",
        clearcoat_normal_fragment_begin: "#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",
        clearcoat_normal_fragment_maps: "#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",
        clearcoat_pars_fragment: "#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",
        packing: "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256.,  256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",
        premultiplied_alpha_fragment: "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",
        project_vertex: "vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",
        dithering_fragment: "#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",
        dithering_pars_fragment: "#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",
        roughnessmap_fragment: "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",
        roughnessmap_pars_fragment: "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",
        shadowmap_pars_fragment: "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t  f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t  f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",
        shadowmap_pars_vertex: "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",
        shadowmap_vertex: "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",
        shadowmask_pars_fragment: "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",
        skinbase_vertex: "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",
        skinning_pars_vertex: "#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",
        skinning_vertex: "#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",
        skinnormal_vertex: "#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",
        specularmap_fragment: "float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",
        specularmap_pars_fragment: "#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",
        tonemapping_fragment: "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",
        tonemapping_pars_fragment: "#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",
        uv_pars_fragment: "#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",
        uv_pars_vertex: "#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",
        uv_vertex: "#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",
        uv2_pars_fragment: "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",
        uv2_pars_vertex: "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",
        uv2_vertex: "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",
        worldpos_vertex: "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",
        background_frag: "uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",
        background_vert: "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",
        cube_frag: "#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",
        cube_vert: "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",
        depth_frag: "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",
        depth_vert: "#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",
        distanceRGBA_frag: "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",
        distanceRGBA_vert: "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",
        equirect_frag: "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",
        equirect_vert: "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",
        linedashed_frag: "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",
        linedashed_vert: "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",
        meshbasic_frag: "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",
        meshbasic_vert: "#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_ENVMAP\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",
        meshlambert_frag: "uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
        meshlambert_vert: "#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",
        meshmatcap_frag: "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",
        meshmatcap_vert: "#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",
        meshtoon_frag: "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
        meshtoon_vert: "#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",
        meshphong_frag: "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
        meshphong_vert: "#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",
        meshphysical_frag: "#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <lights_physical_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",
        meshphysical_vert: "#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",
        normal_frag: "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",
        normal_vert: "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",
        points_frag: "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",
        points_vert: "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",
        shadow_frag: "uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",
        shadow_vert: "#include <fog_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",
        sprite_frag: "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",
        sprite_vert: "uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}"
    }
      , it = {
        basic: {
            uniforms: Ve([Xe.common, Xe.specularmap, Xe.envmap, Xe.aomap, Xe.lightmap, Xe.fog]),
            vertexShader: tt.meshbasic_vert,
            fragmentShader: tt.meshbasic_frag
        },
        lambert: {
            uniforms: Ve([Xe.common, Xe.specularmap, Xe.envmap, Xe.aomap, Xe.lightmap, Xe.emissivemap, Xe.fog, Xe.lights, {
                emissive: {
                    value: new LA(0)
                }
            }]),
            vertexShader: tt.meshlambert_vert,
            fragmentShader: tt.meshlambert_frag
        },
        phong: {
            uniforms: Ve([Xe.common, Xe.specularmap, Xe.envmap, Xe.aomap, Xe.lightmap, Xe.emissivemap, Xe.bumpmap, Xe.normalmap, Xe.displacementmap, Xe.fog, Xe.lights, {
                emissive: {
                    value: new LA(0)
                },
                specular: {
                    value: new LA(1118481)
                },
                shininess: {
                    value: 30
                }
            }]),
            vertexShader: tt.meshphong_vert,
            fragmentShader: tt.meshphong_frag
        },
        standard: {
            uniforms: Ve([Xe.common, Xe.envmap, Xe.aomap, Xe.lightmap, Xe.emissivemap, Xe.bumpmap, Xe.normalmap, Xe.displacementmap, Xe.roughnessmap, Xe.metalnessmap, Xe.fog, Xe.lights, {
                emissive: {
                    value: new LA(0)
                },
                roughness: {
                    value: .5
                },
                metalness: {
                    value: .5
                },
                envMapIntensity: {
                    value: 1
                }
            }]),
            vertexShader: tt.meshphysical_vert,
            fragmentShader: tt.meshphysical_frag
        },
        toon: {
            uniforms: Ve([Xe.common, Xe.specularmap, Xe.aomap, Xe.lightmap, Xe.emissivemap, Xe.bumpmap, Xe.normalmap, Xe.displacementmap, Xe.gradientmap, Xe.fog, Xe.lights, {
                emissive: {
                    value: new LA(0)
                },
                specular: {
                    value: new LA(1118481)
                },
                shininess: {
                    value: 30
                }
            }]),
            vertexShader: tt.meshtoon_vert,
            fragmentShader: tt.meshtoon_frag
        },
        matcap: {
            uniforms: Ve([Xe.common, Xe.bumpmap, Xe.normalmap, Xe.displacementmap, Xe.fog, {
                matcap: {
                    value: null
                }
            }]),
            vertexShader: tt.meshmatcap_vert,
            fragmentShader: tt.meshmatcap_frag
        },
        points: {
            uniforms: Ve([Xe.points, Xe.fog]),
            vertexShader: tt.points_vert,
            fragmentShader: tt.points_frag
        },
        dashed: {
            uniforms: Ve([Xe.common, Xe.fog, {
                scale: {
                    value: 1
                },
                dashSize: {
                    value: 1
                },
                totalSize: {
                    value: 2
                }
            }]),
            vertexShader: tt.linedashed_vert,
            fragmentShader: tt.linedashed_frag
        },
        depth: {
            uniforms: Ve([Xe.common, Xe.displacementmap]),
            vertexShader: tt.depth_vert,
            fragmentShader: tt.depth_frag
        },
        normal: {
            uniforms: Ve([Xe.common, Xe.bumpmap, Xe.normalmap, Xe.displacementmap, {
                opacity: {
                    value: 1
                }
            }]),
            vertexShader: tt.normal_vert,
            fragmentShader: tt.normal_frag
        },
        sprite: {
            uniforms: Ve([Xe.sprite, Xe.fog]),
            vertexShader: tt.sprite_vert,
            fragmentShader: tt.sprite_frag
        },
        background: {
            uniforms: {
                uvTransform: {
                    value: new l
                },
                t2D: {
                    value: null
                }
            },
            vertexShader: tt.background_vert,
            fragmentShader: tt.background_frag
        },
        cube: {
            uniforms: Ve([Xe.envmap, {
                opacity: {
                    value: 1
                }
            }]),
            vertexShader: tt.cube_vert,
            fragmentShader: tt.cube_frag
        },
        equirect: {
            uniforms: {
                tEquirect: {
                    value: null
                }
            },
            vertexShader: tt.equirect_vert,
            fragmentShader: tt.equirect_frag
        },
        distanceRGBA: {
            uniforms: Ve([Xe.common, Xe.displacementmap, {
                referencePosition: {
                    value: new y
                },
                nearDistance: {
                    value: 1
                },
                farDistance: {
                    value: 1e3
                }
            }]),
            vertexShader: tt.distanceRGBA_vert,
            fragmentShader: tt.distanceRGBA_frag
        },
        shadow: {
            uniforms: Ve([Xe.lights, Xe.fog, {
                color: {
                    value: new LA(0)
                },
                opacity: {
                    value: 1
                }
            }]),
            vertexShader: tt.shadow_vert,
            fragmentShader: tt.shadow_frag
        }
    };
    function ot(A, e, t, i) {
        var o, n, r = new LA(0), a = 0, s = null, l = 0, c = null;
        function h(A, t) {
            e.buffers.color.setClear(A.r, A.g, A.b, t, i)
        }
        return {
            getClearColor: function() {
                return r
            },
            setClearColor: function(A, e) {
                r.set(A),
                h(r, a = void 0 !== e ? e : 1)
            },
            getClearAlpha: function() {
                return a
            },
            setClearAlpha: function(A) {
                h(r, a = A)
            },
            render: function(e, i, d, p) {
                var g = i.background
                  , u = A.xr
                  , f = u.getSession && u.getSession();
                if (f && "additive" === f.environmentBlendMode && (g = null),
                null === g ? h(r, a) : g && g.isColor && (h(g, 1),
                p = !0),
                (A.autoClear || p) && A.clear(A.autoClearColor, A.autoClearDepth, A.autoClearStencil),
                g && (g.isCubeTexture || g.isWebGLCubeRenderTarget || 306 === g.mapping)) {
                    void 0 === n && ((n = new Ue(new Ne(1,1,1),new Pe({
                        type: "BackgroundCubeMaterial",
                        uniforms: Oe(it.cube.uniforms),
                        vertexShader: it.cube.vertexShader,
                        fragmentShader: it.cube.fragmentShader,
                        side: 1,
                        depthTest: !1,
                        depthWrite: !1,
                        fog: !1
                    }))).geometry.deleteAttribute("normal"),
                    n.geometry.deleteAttribute("uv"),
                    n.onBeforeRender = function(A, e, t) {
                        this.matrixWorld.copyPosition(t.matrixWorld)
                    }
                    ,
                    Object.defineProperty(n.material, "envMap", {
                        get: function() {
                            return this.uniforms.envMap.value
                        }
                    }),
                    t.update(n));
                    var m = g.isWebGLCubeRenderTarget ? g.texture : g;
                    n.material.uniforms.envMap.value = m,
                    n.material.uniforms.flipEnvMap.value = m.isCubeTexture ? -1 : 1,
                    s === g && l === m.version && c === A.toneMapping || (n.material.needsUpdate = !0,
                    s = g,
                    l = m.version,
                    c = A.toneMapping),
                    e.unshift(n, n.geometry, n.material, 0, 0, null)
                } else
                    g && g.isTexture && (void 0 === o && ((o = new Ue(new et(2,2),new Pe({
                        type: "BackgroundMaterial",
                        uniforms: Oe(it.background.uniforms),
                        vertexShader: it.background.vertexShader,
                        fragmentShader: it.background.fragmentShader,
                        side: 0,
                        depthTest: !1,
                        depthWrite: !1,
                        fog: !1
                    }))).geometry.deleteAttribute("normal"),
                    Object.defineProperty(o.material, "map", {
                        get: function() {
                            return this.uniforms.t2D.value
                        }
                    }),
                    t.update(o)),
                    o.material.uniforms.t2D.value = g,
                    !0 === g.matrixAutoUpdate && g.updateMatrix(),
                    o.material.uniforms.uvTransform.value.copy(g.matrix),
                    s === g && l === g.version && c === A.toneMapping || (o.material.needsUpdate = !0,
                    s = g,
                    l = g.version,
                    c = A.toneMapping),
                    e.unshift(o, o.geometry, o.material, 0, 0, null))
            }
        }
    }
    function nt(A, e, t, i) {
        var o, n = i.isWebGL2;
        this.setMode = function(A) {
            o = A
        }
        ,
        this.render = function(e, i) {
            A.drawArrays(o, e, i),
            t.update(i, o)
        }
        ,
        this.renderInstances = function(i, r, a, s) {
            if (0 !== s) {
                var l, c;
                if (n)
                    l = A,
                    c = "drawArraysInstanced";
                else if (c = "drawArraysInstancedANGLE",
                null === (l = e.get("ANGLE_instanced_arrays")))
                    return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
                l[c](o, r, a, s),
                t.update(a, o, s)
            }
        }
    }
    function rt(A, e, t) {
        var i;
        function o(e) {
            if ("highp" === e) {
                if (A.getShaderPrecisionFormat(35633, 36338).precision > 0 && A.getShaderPrecisionFormat(35632, 36338).precision > 0)
                    return "highp";
                e = "mediump"
            }
            return "mediump" === e && A.getShaderPrecisionFormat(35633, 36337).precision > 0 && A.getShaderPrecisionFormat(35632, 36337).precision > 0 ? "mediump" : "lowp"
        }
        var n = "undefined" != typeof WebGL2RenderingContext && A instanceof WebGL2RenderingContext || "undefined" != typeof WebGL2ComputeRenderingContext && A instanceof WebGL2ComputeRenderingContext
          , r = void 0 !== t.precision ? t.precision : "highp"
          , a = o(r);
        a !== r && (console.warn("THREE.WebGLRenderer:", r, "not supported, using", a, "instead."),
        r = a);
        var s = !0 === t.logarithmicDepthBuffer
          , l = A.getParameter(34930)
          , c = A.getParameter(35660)
          , h = A.getParameter(3379)
          , d = A.getParameter(34076)
          , p = A.getParameter(34921)
          , g = A.getParameter(36347)
          , u = A.getParameter(36348)
          , f = A.getParameter(36349)
          , m = c > 0
          , C = n || !!e.get("OES_texture_float");
        return {
            isWebGL2: n,
            getMaxAnisotropy: function() {
                if (void 0 !== i)
                    return i;
                var t = e.get("EXT_texture_filter_anisotropic");
                return i = null !== t ? A.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0
            },
            getMaxPrecision: o,
            precision: r,
            logarithmicDepthBuffer: s,
            maxTextures: l,
            maxVertexTextures: c,
            maxTextureSize: h,
            maxCubemapSize: d,
            maxAttributes: p,
            maxVertexUniforms: g,
            maxVaryings: u,
            maxFragmentUniforms: f,
            vertexTextures: m,
            floatFragmentTextures: C,
            floatVertexTextures: m && C,
            maxSamples: n ? A.getParameter(36183) : 0
        }
    }
    function at() {
        var A = this
          , e = null
          , t = 0
          , i = !1
          , o = !1
          , n = new EA
          , r = new l
          , a = {
            value: null,
            needsUpdate: !1
        };
        function s() {
            a.value !== e && (a.value = e,
            a.needsUpdate = t > 0),
            A.numPlanes = t,
            A.numIntersection = 0
        }
        function c(e, t, i, o) {
            var s = null !== e ? e.length : 0
              , l = null;
            if (0 !== s) {
                if (l = a.value,
                !0 !== o || null === l) {
                    var c = i + 4 * s
                      , h = t.matrixWorldInverse;
                    r.getNormalMatrix(h),
                    (null === l || c > l.length) && (l = new Float32Array(c));
                    for (var d = 0, p = i; d !== s; ++d,
                    p += 4)
                        n.copy(e[d]).applyMatrix4(h, r),
                        n.normal.toArray(l, p),
                        l[p + 3] = n.constant
                }
                a.value = l,
                a.needsUpdate = !0
            }
            return A.numPlanes = s,
            A.numIntersection = 0,
            l
        }
        this.uniform = a,
        this.numPlanes = 0,
        this.numIntersection = 0,
        this.init = function(A, o, n) {
            var r = 0 !== A.length || o || 0 !== t || i;
            return i = o,
            e = c(A, n, 0),
            t = A.length,
            r
        }
        ,
        this.beginShadows = function() {
            o = !0,
            c(null)
        }
        ,
        this.endShadows = function() {
            o = !1,
            s()
        }
        ,
        this.setState = function(A, n, r, l, h, d) {
            if (!i || null === A || 0 === A.length || o && !r)
                o ? c(null) : s();
            else {
                var p = o ? 0 : t
                  , g = 4 * p
                  , u = h.clippingState || null;
                a.value = u,
                u = c(A, l, g, d);
                for (var f = 0; f !== g; ++f)
                    u[f] = e[f];
                h.clippingState = u,
                this.numIntersection = n ? this.numPlanes : 0,
                this.numPlanes += p
            }
        }
    }
    function st(A) {
        var e = {};
        return {
            get: function(t) {
                if (void 0 !== e[t])
                    return e[t];
                var i;
                switch (t) {
                case "WEBGL_depth_texture":
                    i = A.getExtension("WEBGL_depth_texture") || A.getExtension("MOZ_WEBGL_depth_texture") || A.getExtension("WEBKIT_WEBGL_depth_texture");
                    break;
                case "EXT_texture_filter_anisotropic":
                    i = A.getExtension("EXT_texture_filter_anisotropic") || A.getExtension("MOZ_EXT_texture_filter_anisotropic") || A.getExtension("WEBKIT_EXT_texture_filter_anisotropic");
                    break;
                case "WEBGL_compressed_texture_s3tc":
                    i = A.getExtension("WEBGL_compressed_texture_s3tc") || A.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || A.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");
                    break;
                case "WEBGL_compressed_texture_pvrtc":
                    i = A.getExtension("WEBGL_compressed_texture_pvrtc") || A.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");
                    break;
                default:
                    i = A.getExtension(t)
                }
                return null === i && console.warn("THREE.WebGLRenderer: " + t + " extension not supported."),
                e[t] = i,
                i
            }
        }
    }
    function lt(A, e, t) {
        var i = new WeakMap
          , o = new WeakMap;
        function n(A) {
            var r = A.target
              , a = i.get(r);
            for (var s in null !== a.index && e.remove(a.index),
            a.attributes)
                e.remove(a.attributes[s]);
            r.removeEventListener("dispose", n),
            i.delete(r);
            var l = o.get(a);
            l && (e.remove(l),
            o.delete(a)),
            t.memory.geometries--
        }
        function r(A) {
            var t = []
              , i = A.index
              , n = A.attributes.position
              , r = 0;
            if (null !== i) {
                r = i.version;
                for (var a = 0, s = (l = i.array).length; s > a; a += 3) {
                    t.push(c = l[a + 0], h = l[a + 1], h, d = l[a + 2], d, c)
                }
            } else {
                var l;
                r = n.version;
                for (a = 0,
                s = (l = n.array).length / 3 - 1; s > a; a += 3) {
                    var c, h, d;
                    t.push(c = a + 0, h = a + 1, h, d = a + 2, d, c)
                }
            }
            var p = new (ie(t) > 65535 ? $A : XA)(t,1);
            p.version = r,
            e.update(p, 34963);
            var g = o.get(A);
            g && e.remove(g),
            o.set(A, p)
        }
        return {
            get: function(A, e) {
                var o = i.get(e);
                return o || (e.addEventListener("dispose", n),
                e.isBufferGeometry ? o = e : e.isGeometry && (void 0 === e._bufferGeometry && (e._bufferGeometry = (new he).setFromObject(A)),
                o = e._bufferGeometry),
                i.set(e, o),
                t.memory.geometries++,
                o)
            },
            update: function(A) {
                var t = A.index
                  , i = A.attributes;
                for (var o in null !== t && e.update(t, 34963),
                i)
                    e.update(i[o], 34962);
                var n = A.morphAttributes;
                for (var o in n)
                    for (var r = n[o], a = 0, s = r.length; s > a; a++)
                        e.update(r[a], 34962)
            },
            getWireframeAttribute: function(A) {
                var e = o.get(A);
                if (e) {
                    var t = A.index;
                    null !== t && t.version > e.version && r(A)
                } else
                    r(A);
                return o.get(A)
            }
        }
    }
    function ct(A, e, t, i) {
        var o, n, r, a = i.isWebGL2;
        this.setMode = function(A) {
            o = A
        }
        ,
        this.setIndex = function(A) {
            n = A.type,
            r = A.bytesPerElement
        }
        ,
        this.render = function(e, i) {
            A.drawElements(o, i, n, e * r),
            t.update(i, o)
        }
        ,
        this.renderInstances = function(i, s, l, c) {
            if (0 !== c) {
                var h, d;
                if (a)
                    h = A,
                    d = "drawElementsInstanced";
                else if (d = "drawElementsInstancedANGLE",
                null === (h = e.get("ANGLE_instanced_arrays")))
                    return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");
                h[d](o, l, n, s * r, c),
                t.update(l, o, c)
            }
        }
    }
    function ht(A) {
        var e = {
            frame: 0,
            calls: 0,
            triangles: 0,
            points: 0,
            lines: 0
        };
        return {
            memory: {
                geometries: 0,
                textures: 0
            },
            render: e,
            programs: null,
            autoReset: !0,
            reset: function() {
                e.frame++,
                e.calls = 0,
                e.triangles = 0,
                e.points = 0,
                e.lines = 0
            },
            update: function(A, t, i) {
                switch (i = i || 1,
                e.calls++,
                t) {
                case 4:
                    e.triangles += i * (A / 3);
                    break;
                case 1:
                    e.lines += i * (A / 2);
                    break;
                case 3:
                    e.lines += i * (A - 1);
                    break;
                case 2:
                    e.lines += i * A;
                    break;
                case 0:
                    e.points += i * A;
                    break;
                default:
                    console.error("THREE.WebGLInfo: Unknown draw mode:", t)
                }
            }
        }
    }
    function dt(A, e) {
        return Math.abs(e[1]) - Math.abs(A[1])
    }
    function pt(A) {
        var e = {}
          , t = new Float32Array(8);
        return {
            update: function(i, o, n, r) {
                var a = i.morphTargetInfluences
                  , s = void 0 === a ? 0 : a.length
                  , l = e[o.id];
                if (void 0 === l) {
                    l = [];
                    for (var c = 0; s > c; c++)
                        l[c] = [c, 0];
                    e[o.id] = l
                }
                var h = n.morphTargets && o.morphAttributes.position
                  , d = n.morphNormals && o.morphAttributes.normal;
                for (c = 0; s > c; c++) {
                    0 !== (g = l[c])[1] && (h && o.deleteAttribute("morphTarget" + c),
                    d && o.deleteAttribute("morphNormal" + c))
                }
                for (c = 0; s > c; c++) {
                    (g = l[c])[0] = c,
                    g[1] = a[c]
                }
                l.sort(dt);
                var p = 0;
                for (c = 0; 8 > c; c++) {
                    var g;
                    if (g = l[c]) {
                        var u = g[0]
                          , f = g[1];
                        if (f) {
                            h && o.setAttribute("morphTarget" + c, h[u]),
                            d && o.setAttribute("morphNormal" + c, d[u]),
                            t[c] = f,
                            p += f;
                            continue
                        }
                    }
                    t[c] = 0
                }
                var m = o.morphTargetsRelative ? 1 : 1 - p;
                r.getUniforms().setValue(A, "morphTargetBaseInfluence", m),
                r.getUniforms().setValue(A, "morphTargetInfluences", t)
            }
        }
    }
    function gt(A, e, t, i) {
        var o = new WeakMap;
        return {
            update: function(A) {
                var n = i.render.frame
                  , r = A.geometry
                  , a = e.get(A, r);
                return o.get(a) !== n && (r.isGeometry && a.updateFromObject(A),
                e.update(a),
                o.set(a, n)),
                A.isInstancedMesh && t.update(A.instanceMatrix, 34962),
                a
            },
            dispose: function() {
                o = new WeakMap
            }
        }
    }
    function ut(A, e, t, i, o, n, r, a, s, l) {
        d.call(this, A = void 0 !== A ? A : [], e = void 0 !== e ? e : 301, t, i, o, n, r = void 0 !== r ? r : 1022, a, s, l),
        this.flipY = !1
    }
    function ft(A, e, t, i) {
        d.call(this, null),
        this.image = {
            data: A || null,
            width: e || 1,
            height: t || 1,
            depth: i || 1
        },
        this.magFilter = 1003,
        this.minFilter = 1003,
        this.wrapR = 1001,
        this.generateMipmaps = !1,
        this.flipY = !1,
        this.needsUpdate = !0
    }
    function mt(A, e, t, i) {
        d.call(this, null),
        this.image = {
            data: A || null,
            width: e || 1,
            height: t || 1,
            depth: i || 1
        },
        this.magFilter = 1003,
        this.minFilter = 1003,
        this.wrapR = 1001,
        this.generateMipmaps = !1,
        this.flipY = !1,
        this.needsUpdate = !0
    }
    it.physical = {
        uniforms: Ve([it.standard.uniforms, {
            clearcoat: {
                value: 0
            },
            clearcoatMap: {
                value: null
            },
            clearcoatRoughness: {
                value: 0
            },
            clearcoatRoughnessMap: {
                value: null
            },
            clearcoatNormalScale: {
                value: new s(1,1)
            },
            clearcoatNormalMap: {
                value: null
            },
            sheen: {
                value: new LA(0)
            },
            transparency: {
                value: 0
            }
        }]),
        vertexShader: tt.meshphysical_vert,
        fragmentShader: tt.meshphysical_frag
    },
    (ut.prototype = Object.create(d.prototype)).constructor = ut,
    ut.prototype.isCubeTexture = !0,
    Object.defineProperty(ut.prototype, "images", {
        get: function() {
            return this.image
        },
        set: function(A) {
            this.image = A
        }
    }),
    (ft.prototype = Object.create(d.prototype)).constructor = ft,
    ft.prototype.isDataTexture2DArray = !0,
    (mt.prototype = Object.create(d.prototype)).constructor = mt,
    mt.prototype.isDataTexture3D = !0;
    var Ct = new d
      , yt = new ft
      , vt = new mt
      , It = new ut
      , Et = []
      , Bt = []
      , xt = new Float32Array(16)
      , St = new Float32Array(9)
      , wt = new Float32Array(4);
    function Mt(A, e, t) {
        var i = A[0];
        if (0 >= i || i > 0)
            return A;
        var o = e * t
          , n = Et[o];
        if (void 0 === n && (n = new Float32Array(o),
        Et[o] = n),
        0 !== e) {
            i.toArray(n, 0);
            for (var r = 1, a = 0; r !== e; ++r)
                A[r].toArray(n, a += t)
        }
        return n
    }
    function bt(A, e) {
        if (A.length !== e.length)
            return !1;
        for (var t = 0, i = A.length; i > t; t++)
            if (A[t] !== e[t])
                return !1;
        return !0
    }
    function Ut(A, e) {
        for (var t = 0, i = e.length; i > t; t++)
            A[t] = e[t]
    }
    function Ft(A, e) {
        var t = Bt[e];
        void 0 === t && (t = new Int32Array(e),
        Bt[e] = t);
        for (var i = 0; i !== e; ++i)
            t[i] = A.allocateTextureUnit();
        return t
    }
    function Kt(A, e) {
        var t = this.cache;
        t[0] !== e && (A.uniform1f(this.addr, e),
        t[0] = e)
    }
    function Qt(A, e) {
        var t = this.cache;
        if (void 0 !== e.x)
            t[0] === e.x && t[1] === e.y || (A.uniform2f(this.addr, e.x, e.y),
            t[0] = e.x,
            t[1] = e.y);
        else {
            if (bt(t, e))
                return;
            A.uniform2fv(this.addr, e),
            Ut(t, e)
        }
    }
    function Rt(A, e) {
        var t = this.cache;
        if (void 0 !== e.x)
            t[0] === e.x && t[1] === e.y && t[2] === e.z || (A.uniform3f(this.addr, e.x, e.y, e.z),
            t[0] = e.x,
            t[1] = e.y,
            t[2] = e.z);
        else if (void 0 !== e.r)
            t[0] === e.r && t[1] === e.g && t[2] === e.b || (A.uniform3f(this.addr, e.r, e.g, e.b),
            t[0] = e.r,
            t[1] = e.g,
            t[2] = e.b);
        else {
            if (bt(t, e))
                return;
            A.uniform3fv(this.addr, e),
            Ut(t, e)
        }
    }
    function Tt(A, e) {
        var t = this.cache;
        if (void 0 !== e.x)
            t[0] === e.x && t[1] === e.y && t[2] === e.z && t[3] === e.w || (A.uniform4f(this.addr, e.x, e.y, e.z, e.w),
            t[0] = e.x,
            t[1] = e.y,
            t[2] = e.z,
            t[3] = e.w);
        else {
            if (bt(t, e))
                return;
            A.uniform4fv(this.addr, e),
            Ut(t, e)
        }
    }
    function kt(A, e) {
        var t = this.cache
          , i = e.elements;
        if (void 0 === i) {
            if (bt(t, e))
                return;
            A.uniformMatrix2fv(this.addr, !1, e),
            Ut(t, e)
        } else {
            if (bt(t, i))
                return;
            wt.set(i),
            A.uniformMatrix2fv(this.addr, !1, wt),
            Ut(t, i)
        }
    }
    function Dt(A, e) {
        var t = this.cache
          , i = e.elements;
        if (void 0 === i) {
            if (bt(t, e))
                return;
            A.uniformMatrix3fv(this.addr, !1, e),
            Ut(t, e)
        } else {
            if (bt(t, i))
                return;
            St.set(i),
            A.uniformMatrix3fv(this.addr, !1, St),
            Ut(t, i)
        }
    }
    function Lt(A, e) {
        var t = this.cache
          , i = e.elements;
        if (void 0 === i) {
            if (bt(t, e))
                return;
            A.uniformMatrix4fv(this.addr, !1, e),
            Ut(t, e)
        } else {
            if (bt(t, i))
                return;
            xt.set(i),
            A.uniformMatrix4fv(this.addr, !1, xt),
            Ut(t, i)
        }
    }
    function Nt(A, e, t) {
        var i = this.cache
          , o = t.allocateTextureUnit();
        i[0] !== o && (A.uniform1i(this.addr, o),
        i[0] = o),
        t.safeSetTexture2D(e || Ct, o)
    }
    function Ot(A, e, t) {
        var i = this.cache
          , o = t.allocateTextureUnit();
        i[0] !== o && (A.uniform1i(this.addr, o),
        i[0] = o),
        t.setTexture2DArray(e || yt, o)
    }
    function Vt(A, e, t) {
        var i = this.cache
          , o = t.allocateTextureUnit();
        i[0] !== o && (A.uniform1i(this.addr, o),
        i[0] = o),
        t.setTexture3D(e || vt, o)
    }
    function Gt(A, e, t) {
        var i = this.cache
          , o = t.allocateTextureUnit();
        i[0] !== o && (A.uniform1i(this.addr, o),
        i[0] = o),
        t.safeSetTextureCube(e || It, o)
    }
    function Pt(A, e) {
        var t = this.cache;
        t[0] !== e && (A.uniform1i(this.addr, e),
        t[0] = e)
    }
    function qt(A, e) {
        var t = this.cache;
        bt(t, e) || (A.uniform2iv(this.addr, e),
        Ut(t, e))
    }
    function jt(A, e) {
        var t = this.cache;
        bt(t, e) || (A.uniform3iv(this.addr, e),
        Ut(t, e))
    }
    function Ht(A, e) {
        var t = this.cache;
        bt(t, e) || (A.uniform4iv(this.addr, e),
        Ut(t, e))
    }
    function Yt(A, e) {
        var t = this.cache;
        t[0] !== e && (A.uniform1ui(this.addr, e),
        t[0] = e)
    }
    function Wt(A, e) {
        A.uniform1fv(this.addr, e)
    }
    function Jt(A, e) {
        A.uniform1iv(this.addr, e)
    }
    function zt(A, e) {
        A.uniform2iv(this.addr, e)
    }
    function Zt(A, e) {
        A.uniform3iv(this.addr, e)
    }
    function Xt(A, e) {
        A.uniform4iv(this.addr, e)
    }
    function _t(A, e) {
        var t = Mt(e, this.size, 2);
        A.uniform2fv(this.addr, t)
    }
    function $t(A, e) {
        var t = Mt(e, this.size, 3);
        A.uniform3fv(this.addr, t)
    }
    function Ai(A, e) {
        var t = Mt(e, this.size, 4);
        A.uniform4fv(this.addr, t)
    }
    function ei(A, e) {
        var t = Mt(e, this.size, 4);
        A.uniformMatrix2fv(this.addr, !1, t)
    }
    function ti(A, e) {
        var t = Mt(e, this.size, 9);
        A.uniformMatrix3fv(this.addr, !1, t)
    }
    function ii(A, e) {
        var t = Mt(e, this.size, 16);
        A.uniformMatrix4fv(this.addr, !1, t)
    }
    function oi(A, e, t) {
        var i = e.length
          , o = Ft(t, i);
        A.uniform1iv(this.addr, o);
        for (var n = 0; n !== i; ++n)
            t.safeSetTexture2D(e[n] || Ct, o[n])
    }
    function ni(A, e, t) {
        var i = e.length
          , o = Ft(t, i);
        A.uniform1iv(this.addr, o);
        for (var n = 0; n !== i; ++n)
            t.safeSetTextureCube(e[n] || It, o[n])
    }
    function ri(A, e, t) {
        this.id = A,
        this.addr = t,
        this.cache = [],
        this.setValue = function(A) {
            switch (A) {
            case 5126:
                return Kt;
            case 35664:
                return Qt;
            case 35665:
                return Rt;
            case 35666:
                return Tt;
            case 35674:
                return kt;
            case 35675:
                return Dt;
            case 35676:
                return Lt;
            case 5124:
            case 35670:
                return Pt;
            case 35667:
            case 35671:
                return qt;
            case 35668:
            case 35672:
                return jt;
            case 35669:
            case 35673:
                return Ht;
            case 5125:
                return Yt;
            case 35678:
            case 36198:
            case 36298:
            case 36306:
            case 35682:
                return Nt;
            case 35679:
            case 36299:
            case 36307:
                return Vt;
            case 35680:
            case 36300:
            case 36308:
            case 36293:
                return Gt;
            case 36289:
            case 36303:
            case 36311:
            case 36292:
                return Ot
            }
        }(e.type)
    }
    function ai(A, e, t) {
        this.id = A,
        this.addr = t,
        this.cache = [],
        this.size = e.size,
        this.setValue = function(A) {
            switch (A) {
            case 5126:
                return Wt;
            case 35664:
                return _t;
            case 35665:
                return $t;
            case 35666:
                return Ai;
            case 35674:
                return ei;
            case 35675:
                return ti;
            case 35676:
                return ii;
            case 5124:
            case 35670:
                return Jt;
            case 35667:
            case 35671:
                return zt;
            case 35668:
            case 35672:
                return Zt;
            case 35669:
            case 35673:
                return Xt;
            case 35678:
            case 36198:
            case 36298:
            case 36306:
            case 35682:
                return oi;
            case 35680:
            case 36300:
            case 36308:
            case 36293:
                return ni
            }
        }(e.type)
    }
    function si(A) {
        this.id = A,
        this.seq = [],
        this.map = {}
    }
    ai.prototype.updateCache = function(A) {
        var e = this.cache;
        A instanceof Float32Array && e.length !== A.length && (this.cache = new Float32Array(A.length)),
        Ut(e, A)
    }
    ,
    si.prototype.setValue = function(A, e, t) {
        for (var i = this.seq, o = 0, n = i.length; o !== n; ++o) {
            var r = i[o];
            r.setValue(A, e[r.id], t)
        }
    }
    ;
    var li = /([\w\d_]+)(\])?(\[|\.)?/g;
    function ci(A, e) {
        A.seq.push(e),
        A.map[e.id] = e
    }
    function hi(A, e, t) {
        var i = A.name
          , o = i.length;
        for (li.lastIndex = 0; ; ) {
            var n = li.exec(i)
              , r = n[1]
              , a = n[3];
            if ("]" === n[2] && (r |= 0),
            void 0 === a || "[" === a && li.lastIndex + 2 === o) {
                ci(t, void 0 === a ? new ri(r,A,e) : new ai(r,A,e));
                break
            }
            var s = t.map[r];
            void 0 === s && ci(t, s = new si(r)),
            t = s
        }
    }
    function di(A, e) {
        this.seq = [],
        this.map = {};
        for (var t = A.getProgramParameter(e, 35718), i = 0; t > i; ++i) {
            var o = A.getActiveUniform(e, i);
            hi(o, A.getUniformLocation(e, o.name), this)
        }
    }
    function pi(A, e, t) {
        var i = A.createShader(e);
        return A.shaderSource(i, t),
        A.compileShader(i),
        i
    }
    di.prototype.setValue = function(A, e, t, i) {
        var o = this.map[e];
        void 0 !== o && o.setValue(A, t, i)
    }
    ,
    di.prototype.setOptional = function(A, e, t) {
        var i = e[t];
        void 0 !== i && this.setValue(A, t, i)
    }
    ,
    di.upload = function(A, e, t, i) {
        for (var o = 0, n = e.length; o !== n; ++o) {
            var r = e[o]
              , a = t[r.id];
            !1 !== a.needsUpdate && r.setValue(A, a.value, i)
        }
    }
    ,
    di.seqWithValue = function(A, e) {
        for (var t = [], i = 0, o = A.length; i !== o; ++i) {
            var n = A[i];
            n.id in e && t.push(n)
        }
        return t
    }
    ;
    var gi = 0;
    function ui(A) {
        switch (A) {
        case 3e3:
            return ["Linear", "( value )"];
        case 3001:
            return ["sRGB", "( value )"];
        case 3002:
            return ["RGBE", "( value )"];
        case 3004:
            return ["RGBM", "( value, 7.0 )"];
        case 3005:
            return ["RGBM", "( value, 16.0 )"];
        case 3006:
            return ["RGBD", "( value, 256.0 )"];
        case 3007:
            return ["Gamma", "( value, float( GAMMA_FACTOR ) )"];
        case 3003:
            return ["LogLuv", "( value )"];
        default:
            throw new Error("unsupported encoding: " + A)
        }
    }
    function fi(A, e, t) {
        var i = A.getShaderParameter(e, 35713)
          , o = A.getShaderInfoLog(e).trim();
        return i && "" === o ? "" : "THREE.WebGLShader: gl.getShaderInfoLog() " + t + "\n" + o + function(A) {
            for (var e = A.split("\n"), t = 0; e.length > t; t++)
                e[t] = t + 1 + ": " + e[t];
            return e.join("\n")
        }(A.getShaderSource(e))
    }
    function mi(A, e) {
        var t = ui(e);
        return "vec4 " + A + "( vec4 value ) { return " + t[0] + "ToLinear" + t[1] + "; }"
    }
    function Ci(A, e) {
        var t;
        switch (e) {
        case 1:
            t = "Linear";
            break;
        case 2:
            t = "Reinhard";
            break;
        case 3:
            t = "Uncharted2";
            break;
        case 4:
            t = "OptimizedCineon";
            break;
        case 5:
            t = "ACESFilmic";
            break;
        default:
            throw new Error("unsupported toneMapping: " + e)
        }
        return "vec3 " + A + "( vec3 color ) { return " + t + "ToneMapping( color ); }"
    }
    function yi(A) {
        return "" !== A
    }
    function vi(A, e) {
        return A.replace(/NUM_DIR_LIGHTS/g, e.numDirLights).replace(/NUM_SPOT_LIGHTS/g, e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g, e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, e.numPointLights).replace(/NUM_HEMI_LIGHTS/g, e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g, e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, e.numPointLightShadows)
    }
    function Ii(A, e) {
        return A.replace(/NUM_CLIPPING_PLANES/g, e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, e.numClippingPlanes - e.numClipIntersection)
    }
    var Ei = /^[ \t]*#include +<([\w\d./]+)>/gm;
    function Bi(A) {
        return A.replace(Ei, xi)
    }
    function xi(A, e) {
        var t = tt[e];
        if (void 0 === t)
            throw new Error("Can not resolve #include <" + e + ">");
        return Bi(t)
    }
    var Si = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g
      , wi = /#pragma unroll_loop_start[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}[\s]+?#pragma unroll_loop_end/g;
    function Mi(A) {
        return A.replace(wi, Ui).replace(Si, bi)
    }
    function bi(A, e, t, i) {
        return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),
        Ui(A, e, t, i)
    }
    function Ui(A, e, t, i) {
        for (var o = "", n = parseInt(e); n < parseInt(t); n++)
            o += i.replace(/\[ i \]/g, "[ " + n + " ]").replace(/UNROLLED_LOOP_INDEX/g, n);
        return o
    }
    function Fi(A) {
        var e = "precision " + A.precision + " float;\nprecision " + A.precision + " int;";
        return "highp" === A.precision ? e += "\n#define HIGH_PRECISION" : "mediump" === A.precision ? e += "\n#define MEDIUM_PRECISION" : "lowp" === A.precision && (e += "\n#define LOW_PRECISION"),
        e
    }
    function Ki(A, e, t) {
        var i, o, n, r, a, s = A.getContext(), l = t.defines, c = t.vertexShader, h = t.fragmentShader, d = function(A) {
            var e = "SHADOWMAP_TYPE_BASIC";
            return 1 === A.shadowMapType ? e = "SHADOWMAP_TYPE_PCF" : 2 === A.shadowMapType ? e = "SHADOWMAP_TYPE_PCF_SOFT" : 3 === A.shadowMapType && (e = "SHADOWMAP_TYPE_VSM"),
            e
        }(t), p = function(A) {
            var e = "ENVMAP_TYPE_CUBE";
            if (A.envMap)
                switch (A.envMapMode) {
                case 301:
                case 302:
                    e = "ENVMAP_TYPE_CUBE";
                    break;
                case 306:
                case 307:
                    e = "ENVMAP_TYPE_CUBE_UV";
                    break;
                case 303:
                case 304:
                    e = "ENVMAP_TYPE_EQUIREC";
                    break;
                case 305:
                    e = "ENVMAP_TYPE_SPHERE"
                }
            return e
        }(t), g = function(A) {
            var e = "ENVMAP_MODE_REFLECTION";
            if (A.envMap)
                switch (A.envMapMode) {
                case 302:
                case 304:
                    e = "ENVMAP_MODE_REFRACTION"
                }
            return e
        }(t), u = function(A) {
            var e = "ENVMAP_BLENDING_NONE";
            if (A.envMap)
                switch (A.combine) {
                case 0:
                    e = "ENVMAP_BLENDING_MULTIPLY";
                    break;
                case 1:
                    e = "ENVMAP_BLENDING_MIX";
                    break;
                case 2:
                    e = "ENVMAP_BLENDING_ADD"
                }
            return e
        }(t), f = A.gammaFactor > 0 ? A.gammaFactor : 1, m = t.isWebGL2 ? "" : function(A) {
            return [A.extensionDerivatives || A.envMapCubeUV || A.bumpMap || A.tangentSpaceNormalMap || A.clearcoatNormalMap || A.flatShading || "physical" === A.shaderID ? "#extension GL_OES_standard_derivatives : enable" : "", (A.extensionFragDepth || A.logarithmicDepthBuffer) && A.rendererExtensionFragDepth ? "#extension GL_EXT_frag_depth : enable" : "", A.extensionDrawBuffers && A.rendererExtensionDrawBuffers ? "#extension GL_EXT_draw_buffers : require" : "", (A.extensionShaderTextureLOD || A.envMap) && A.rendererExtensionShaderTextureLod ? "#extension GL_EXT_shader_texture_lod : enable" : ""].filter(yi).join("\n")
        }(t), C = function(A) {
            var e = [];
            for (var t in A) {
                var i = A[t];
                !1 !== i && e.push("#define " + t + " " + i)
            }
            return e.join("\n")
        }(l), y = s.createProgram();
        if (t.isRawShaderMaterial ? ((i = [C].filter(yi).join("\n")).length > 0 && (i += "\n"),
        (o = [m, C].filter(yi).join("\n")).length > 0 && (o += "\n")) : (i = [Fi(t), "#define SHADER_NAME " + t.shaderName, C, t.instancing ? "#define USE_INSTANCING" : "", t.supportsVertexTextures ? "#define VERTEX_TEXTURES" : "", "#define GAMMA_FACTOR " + f, "#define MAX_BONES " + t.maxBones, t.useFog && t.fog ? "#define USE_FOG" : "", t.useFog && t.fogExp2 ? "#define FOG_EXP2" : "", t.map ? "#define USE_MAP" : "", t.envMap ? "#define USE_ENVMAP" : "", t.envMap ? "#define " + g : "", t.lightMap ? "#define USE_LIGHTMAP" : "", t.aoMap ? "#define USE_AOMAP" : "", t.emissiveMap ? "#define USE_EMISSIVEMAP" : "", t.bumpMap ? "#define USE_BUMPMAP" : "", t.normalMap ? "#define USE_NORMALMAP" : "", t.normalMap && t.objectSpaceNormalMap ? "#define OBJECTSPACE_NORMALMAP" : "", t.normalMap && t.tangentSpaceNormalMap ? "#define TANGENTSPACE_NORMALMAP" : "", t.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", t.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", t.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", t.displacementMap && t.supportsVertexTextures ? "#define USE_DISPLACEMENTMAP" : "", t.specularMap ? "#define USE_SPECULARMAP" : "", t.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", t.metalnessMap ? "#define USE_METALNESSMAP" : "", t.alphaMap ? "#define USE_ALPHAMAP" : "", t.vertexTangents ? "#define USE_TANGENT" : "", t.vertexColors ? "#define USE_COLOR" : "", t.vertexUvs ? "#define USE_UV" : "", t.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "", t.flatShading ? "#define FLAT_SHADED" : "", t.skinning ? "#define USE_SKINNING" : "", t.useVertexTexture ? "#define BONE_TEXTURE" : "", t.morphTargets ? "#define USE_MORPHTARGETS" : "", t.morphNormals && !1 === t.flatShading ? "#define USE_MORPHNORMALS" : "", t.doubleSided ? "#define DOUBLE_SIDED" : "", t.flipSided ? "#define FLIP_SIDED" : "", t.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", t.shadowMapEnabled ? "#define " + d : "", t.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "", t.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", t.logarithmicDepthBuffer && t.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "", "uniform mat4 modelMatrix;", "uniform mat4 modelViewMatrix;", "uniform mat4 projectionMatrix;", "uniform mat4 viewMatrix;", "uniform mat3 normalMatrix;", "uniform vec3 cameraPosition;", "uniform bool isOrthographic;", "#ifdef USE_INSTANCING", " attribute mat4 instanceMatrix;", "#endif", "attribute vec3 position;", "attribute vec3 normal;", "attribute vec2 uv;", "#ifdef USE_TANGENT", "\tattribute vec4 tangent;", "#endif", "#ifdef USE_COLOR", "\tattribute vec3 color;", "#endif", "#ifdef USE_MORPHTARGETS", "\tattribute vec3 morphTarget0;", "\tattribute vec3 morphTarget1;", "\tattribute vec3 morphTarget2;", "\tattribute vec3 morphTarget3;", "\t#ifdef USE_MORPHNORMALS", "\t\tattribute vec3 morphNormal0;", "\t\tattribute vec3 morphNormal1;", "\t\tattribute vec3 morphNormal2;", "\t\tattribute vec3 morphNormal3;", "\t#else", "\t\tattribute vec3 morphTarget4;", "\t\tattribute vec3 morphTarget5;", "\t\tattribute vec3 morphTarget6;", "\t\tattribute vec3 morphTarget7;", "\t#endif", "#endif", "#ifdef USE_SKINNING", "\tattribute vec4 skinIndex;", "\tattribute vec4 skinWeight;", "#endif", "\n"].filter(yi).join("\n"),
        o = [m, Fi(t), "#define SHADER_NAME " + t.shaderName, C, t.alphaTest ? "#define ALPHATEST " + t.alphaTest + (t.alphaTest % 1 ? "" : ".0") : "", "#define GAMMA_FACTOR " + f, t.useFog && t.fog ? "#define USE_FOG" : "", t.useFog && t.fogExp2 ? "#define FOG_EXP2" : "", t.map ? "#define USE_MAP" : "", t.matcap ? "#define USE_MATCAP" : "", t.envMap ? "#define USE_ENVMAP" : "", t.envMap ? "#define " + p : "", t.envMap ? "#define " + g : "", t.envMap ? "#define " + u : "", t.lightMap ? "#define USE_LIGHTMAP" : "", t.aoMap ? "#define USE_AOMAP" : "", t.emissiveMap ? "#define USE_EMISSIVEMAP" : "", t.bumpMap ? "#define USE_BUMPMAP" : "", t.normalMap ? "#define USE_NORMALMAP" : "", t.normalMap && t.objectSpaceNormalMap ? "#define OBJECTSPACE_NORMALMAP" : "", t.normalMap && t.tangentSpaceNormalMap ? "#define TANGENTSPACE_NORMALMAP" : "", t.clearcoatMap ? "#define USE_CLEARCOATMAP" : "", t.clearcoatRoughnessMap ? "#define USE_CLEARCOAT_ROUGHNESSMAP" : "", t.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", t.specularMap ? "#define USE_SPECULARMAP" : "", t.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", t.metalnessMap ? "#define USE_METALNESSMAP" : "", t.alphaMap ? "#define USE_ALPHAMAP" : "", t.sheen ? "#define USE_SHEEN" : "", t.vertexTangents ? "#define USE_TANGENT" : "", t.vertexColors ? "#define USE_COLOR" : "", t.vertexUvs ? "#define USE_UV" : "", t.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "", t.gradientMap ? "#define USE_GRADIENTMAP" : "", t.flatShading ? "#define FLAT_SHADED" : "", t.doubleSided ? "#define DOUBLE_SIDED" : "", t.flipSided ? "#define FLIP_SIDED" : "", t.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", t.shadowMapEnabled ? "#define " + d : "", t.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "", t.physicallyCorrectLights ? "#define PHYSICALLY_CORRECT_LIGHTS" : "", t.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", t.logarithmicDepthBuffer && t.rendererExtensionFragDepth ? "#define USE_LOGDEPTHBUF_EXT" : "", (t.extensionShaderTextureLOD || t.envMap) && t.rendererExtensionShaderTextureLod ? "#define TEXTURE_LOD_EXT" : "", "uniform mat4 viewMatrix;", "uniform vec3 cameraPosition;", "uniform bool isOrthographic;", 0 !== t.toneMapping ? "#define TONE_MAPPING" : "", 0 !== t.toneMapping ? tt.tonemapping_pars_fragment : "", 0 !== t.toneMapping ? Ci("toneMapping", t.toneMapping) : "", t.dithering ? "#define DITHERING" : "", t.outputEncoding || t.mapEncoding || t.matcapEncoding || t.envMapEncoding || t.emissiveMapEncoding || t.lightMapEncoding ? tt.encodings_pars_fragment : "", t.mapEncoding ? mi("mapTexelToLinear", t.mapEncoding) : "", t.matcapEncoding ? mi("matcapTexelToLinear", t.matcapEncoding) : "", t.envMapEncoding ? mi("envMapTexelToLinear", t.envMapEncoding) : "", t.emissiveMapEncoding ? mi("emissiveMapTexelToLinear", t.emissiveMapEncoding) : "", t.lightMapEncoding ? mi("lightMapTexelToLinear", t.lightMapEncoding) : "", t.outputEncoding ? (n = "linearToOutputTexel",
        r = t.outputEncoding,
        a = ui(r),
        "vec4 " + n + "( vec4 value ) { return LinearTo" + a[0] + a[1] + "; }") : "", t.depthPacking ? "#define DEPTH_PACKING " + t.depthPacking : "", "\n"].filter(yi).join("\n")),
        c = Ii(c = vi(c = Bi(c), t), t),
        h = Ii(h = vi(h = Bi(h), t), t),
        c = Mi(c),
        h = Mi(h),
        t.isWebGL2 && !t.isRawShaderMaterial) {
            var v = !1
              , I = /^\s*#version\s+300\s+es\s*\n/;
            t.isShaderMaterial && null !== c.match(I) && null !== h.match(I) && (v = !0,
            c = c.replace(I, ""),
            h = h.replace(I, "")),
            i = ["#version 300 es\n", "#define attribute in", "#define varying out", "#define texture2D texture"].join("\n") + "\n" + i,
            o = ["#version 300 es\n", "#define varying in", v ? "" : "out highp vec4 pc_fragColor;", v ? "" : "#define gl_FragColor pc_fragColor", "#define gl_FragDepthEXT gl_FragDepth", "#define texture2D texture", "#define textureCube texture", "#define texture2DProj textureProj", "#define texture2DLodEXT textureLod", "#define texture2DProjLodEXT textureProjLod", "#define textureCubeLodEXT textureLod", "#define texture2DGradEXT textureGrad", "#define texture2DProjGradEXT textureProjGrad", "#define textureCubeGradEXT textureGrad"].join("\n") + "\n" + o
        }
        var E, B, x = o + h, S = pi(s, 35633, i + c), w = pi(s, 35632, x);
        if (s.attachShader(y, S),
        s.attachShader(y, w),
        void 0 !== t.index0AttributeName ? s.bindAttribLocation(y, 0, t.index0AttributeName) : !0 === t.morphTargets && s.bindAttribLocation(y, 0, "position"),
        s.linkProgram(y),
        A.debug.checkShaderErrors) {
            var M = s.getProgramInfoLog(y).trim()
              , b = s.getShaderInfoLog(S).trim()
              , U = s.getShaderInfoLog(w).trim()
              , F = !0
              , K = !0;
            if (!1 === s.getProgramParameter(y, 35714)) {
                F = !1;
                var Q = fi(s, S, "vertex")
                  , R = fi(s, w, "fragment");
                console.error("THREE.WebGLProgram: shader error: ", s.getError(), "35715", s.getProgramParameter(y, 35715), "gl.getProgramInfoLog", M, Q, R)
            } else
                "" !== M ? console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()", M) : "" !== b && "" !== U || (K = !1);
            K && (this.diagnostics = {
                runnable: F,
                programLog: M,
                vertexShader: {
                    log: b,
                    prefix: i
                },
                fragmentShader: {
                    log: U,
                    prefix: o
                }
            })
        }
        return s.detachShader(y, S),
        s.detachShader(y, w),
        s.deleteShader(S),
        s.deleteShader(w),
        this.getUniforms = function() {
            return void 0 === E && (E = new di(s,y)),
            E
        }
        ,
        this.getAttributes = function() {
            return void 0 === B && (B = function(A, e) {
                for (var t = {}, i = A.getProgramParameter(e, 35721), o = 0; i > o; o++) {
                    var n = A.getActiveAttrib(e, o).name;
                    t[n] = A.getAttribLocation(e, n)
                }
                return t
            }(s, y)),
            B
        }
        ,
        this.destroy = function() {
            s.deleteProgram(y),
            this.program = void 0
        }
        ,
        this.name = t.shaderName,
        this.id = gi++,
        this.cacheKey = e,
        this.usedTimes = 1,
        this.program = y,
        this.vertexShader = S,
        this.fragmentShader = w,
        this
    }
    function Qi(A, e, t) {
        var i = []
          , o = t.isWebGL2
          , n = t.logarithmicDepthBuffer
          , r = t.floatVertexTextures
          , a = t.precision
          , s = t.maxVertexUniforms
          , l = t.vertexTextures
          , c = {
            MeshDepthMaterial: "depth",
            MeshDistanceMaterial: "distanceRGBA",
            MeshNormalMaterial: "normal",
            MeshBasicMaterial: "basic",
            MeshLambertMaterial: "lambert",
            MeshPhongMaterial: "phong",
            MeshToonMaterial: "toon",
            MeshStandardMaterial: "physical",
            MeshPhysicalMaterial: "physical",
            MeshMatcapMaterial: "matcap",
            LineBasicMaterial: "basic",
            LineDashedMaterial: "dashed",
            PointsMaterial: "points",
            ShadowMaterial: "shadow",
            SpriteMaterial: "sprite"
        }
          , h = ["precision", "isWebGL2", "supportsVertexTextures", "outputEncoding", "instancing", "map", "mapEncoding", "matcap", "matcapEncoding", "envMap", "envMapMode", "envMapEncoding", "envMapCubeUV", "lightMap", "lightMapEncoding", "aoMap", "emissiveMap", "emissiveMapEncoding", "bumpMap", "normalMap", "objectSpaceNormalMap", "tangentSpaceNormalMap", "clearcoatMap", "clearcoatRoughnessMap", "clearcoatNormalMap", "displacementMap", "specularMap", "roughnessMap", "metalnessMap", "gradientMap", "alphaMap", "combine", "vertexColors", "vertexTangents", "vertexUvs", "uvsVertexOnly", "fog", "useFog", "fogExp2", "flatShading", "sizeAttenuation", "logarithmicDepthBuffer", "skinning", "maxBones", "useVertexTexture", "morphTargets", "morphNormals", "maxMorphTargets", "maxMorphNormals", "premultipliedAlpha", "numDirLights", "numPointLights", "numSpotLights", "numHemiLights", "numRectAreaLights", "numDirLightShadows", "numPointLightShadows", "numSpotLightShadows", "shadowMapEnabled", "shadowMapType", "toneMapping", "physicallyCorrectLights", "alphaTest", "doubleSided", "flipSided", "numClippingPlanes", "numClipIntersection", "depthPacking", "dithering", "sheen"];
        function d(A) {
            var e;
            return A ? A.isTexture ? e = A.encoding : A.isWebGLRenderTarget && (console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),
            e = A.texture.encoding) : e = 3e3,
            e
        }
        this.getParameters = function(i, h, p, g, u, f, m) {
            var C = g.fog
              , y = i.envMap || (i.isMeshStandardMaterial ? g.environment : null)
              , v = c[i.type]
              , I = m.isSkinnedMesh ? function(A) {
                var e = A.skeleton.bones;
                if (r)
                    return 1024;
                var t = Math.floor((s - 20) / 4)
                  , i = Math.min(t, e.length);
                return e.length > i ? (console.warn("THREE.WebGLRenderer: Skeleton has " + e.length + " bones. This GPU supports " + i + "."),
                0) : i
            }(m) : 0;
            null !== i.precision && (a = t.getMaxPrecision(i.precision)) !== i.precision && console.warn("THREE.WebGLProgram.getParameters:", i.precision, "not supported, using", a, "instead.");
            var E = function(A, e) {
                var t;
                if (e) {
                    var i = it[e];
                    t = {
                        name: A.type,
                        uniforms: Ge.clone(i.uniforms),
                        vertexShader: i.vertexShader,
                        fragmentShader: i.fragmentShader
                    }
                } else
                    t = {
                        name: A.type,
                        uniforms: A.uniforms,
                        vertexShader: A.vertexShader,
                        fragmentShader: A.fragmentShader
                    };
                return t
            }(i, v);
            i.onBeforeCompile(E, A);
            var B = A.getRenderTarget();
            return {
                isWebGL2: o,
                shaderID: v,
                shaderName: E.name,
                uniforms: E.uniforms,
                vertexShader: E.vertexShader,
                fragmentShader: E.fragmentShader,
                defines: i.defines,
                isRawShaderMaterial: i.isRawShaderMaterial,
                isShaderMaterial: i.isShaderMaterial,
                precision: a,
                instancing: !0 === m.isInstancedMesh,
                supportsVertexTextures: l,
                outputEncoding: null !== B ? d(B.texture) : A.outputEncoding,
                map: !!i.map,
                mapEncoding: d(i.map),
                matcap: !!i.matcap,
                matcapEncoding: d(i.matcap),
                envMap: !!y,
                envMapMode: y && y.mapping,
                envMapEncoding: d(y),
                envMapCubeUV: !!y && (306 === y.mapping || 307 === y.mapping),
                lightMap: !!i.lightMap,
                lightMapEncoding: d(i.lightMap),
                aoMap: !!i.aoMap,
                emissiveMap: !!i.emissiveMap,
                emissiveMapEncoding: d(i.emissiveMap),
                bumpMap: !!i.bumpMap,
                normalMap: !!i.normalMap,
                objectSpaceNormalMap: 1 === i.normalMapType,
                tangentSpaceNormalMap: 0 === i.normalMapType,
                clearcoatMap: !!i.clearcoatMap,
                clearcoatRoughnessMap: !!i.clearcoatRoughnessMap,
                clearcoatNormalMap: !!i.clearcoatNormalMap,
                displacementMap: !!i.displacementMap,
                roughnessMap: !!i.roughnessMap,
                metalnessMap: !!i.metalnessMap,
                specularMap: !!i.specularMap,
                alphaMap: !!i.alphaMap,
                gradientMap: !!i.gradientMap,
                sheen: !!i.sheen,
                combine: i.combine,
                vertexTangents: i.normalMap && i.vertexTangents,
                vertexColors: i.vertexColors,
                vertexUvs: !!(i.map || i.bumpMap || i.normalMap || i.specularMap || i.alphaMap || i.emissiveMap || i.roughnessMap || i.metalnessMap || i.clearcoatMap || i.clearcoatRoughnessMap || i.clearcoatNormalMap || i.displacementMap),
                uvsVertexOnly: !(i.map || i.bumpMap || i.normalMap || i.specularMap || i.alphaMap || i.emissiveMap || i.roughnessMap || i.metalnessMap || i.clearcoatNormalMap || !i.displacementMap),
                fog: !!C,
                useFog: i.fog,
                fogExp2: C && C.isFogExp2,
                flatShading: i.flatShading,
                sizeAttenuation: i.sizeAttenuation,
                logarithmicDepthBuffer: n,
                skinning: i.skinning && I > 0,
                maxBones: I,
                useVertexTexture: r,
                morphTargets: i.morphTargets,
                morphNormals: i.morphNormals,
                maxMorphTargets: A.maxMorphTargets,
                maxMorphNormals: A.maxMorphNormals,
                numDirLights: h.directional.length,
                numPointLights: h.point.length,
                numSpotLights: h.spot.length,
                numRectAreaLights: h.rectArea.length,
                numHemiLights: h.hemi.length,
                numDirLightShadows: h.directionalShadowMap.length,
                numPointLightShadows: h.pointShadowMap.length,
                numSpotLightShadows: h.spotShadowMap.length,
                numClippingPlanes: u,
                numClipIntersection: f,
                dithering: i.dithering,
                shadowMapEnabled: A.shadowMap.enabled && p.length > 0,
                shadowMapType: A.shadowMap.type,
                toneMapping: i.toneMapped ? A.toneMapping : 0,
                physicallyCorrectLights: A.physicallyCorrectLights,
                premultipliedAlpha: i.premultipliedAlpha,
                alphaTest: i.alphaTest,
                doubleSided: 2 === i.side,
                flipSided: 1 === i.side,
                depthPacking: void 0 !== i.depthPacking && i.depthPacking,
                index0AttributeName: i.index0AttributeName,
                extensionDerivatives: i.extensions && i.extensions.derivatives,
                extensionFragDepth: i.extensions && i.extensions.fragDepth,
                extensionDrawBuffers: i.extensions && i.extensions.drawBuffers,
                extensionShaderTextureLOD: i.extensions && i.extensions.shaderTextureLOD,
                rendererExtensionFragDepth: o || null !== e.get("EXT_frag_depth"),
                rendererExtensionDrawBuffers: o || null !== e.get("WEBGL_draw_buffers"),
                rendererExtensionShaderTextureLod: o || null !== e.get("EXT_shader_texture_lod"),
                onBeforeCompile: i.onBeforeCompile
            }
        }
        ,
        this.getProgramCacheKey = function(e) {
            var t = [];
            if (e.shaderID ? t.push(e.shaderID) : (t.push(e.fragmentShader),
            t.push(e.vertexShader)),
            void 0 !== e.defines)
                for (var i in e.defines)
                    t.push(i),
                    t.push(e.defines[i]);
            if (void 0 === e.isRawShaderMaterial) {
                for (var o = 0; h.length > o; o++)
                    t.push(e[h[o]]);
                t.push(A.outputEncoding),
                t.push(A.gammaFactor)
            }
            return t.push(e.onBeforeCompile.toString()),
            t.join()
        }
        ,
        this.acquireProgram = function(e, t) {
            for (var o, n = 0, r = i.length; r > n; n++) {
                var a = i[n];
                if (a.cacheKey === t) {
                    ++(o = a).usedTimes;
                    break
                }
            }
            return void 0 === o && (o = new Ki(A,t,e),
            i.push(o)),
            o
        }
        ,
        this.releaseProgram = function(A) {
            if (0 == --A.usedTimes) {
                var e = i.indexOf(A);
                i[e] = i[i.length - 1],
                i.pop(),
                A.destroy()
            }
        }
        ,
        this.programs = i
    }
    function Ri() {
        var A = new WeakMap;
        return {
            get: function(e) {
                var t = A.get(e);
                return void 0 === t && A.set(e, t = {}),
                t
            },
            remove: function(e) {
                A.delete(e)
            },
            update: function(e, t, i) {
                A.get(e)[t] = i
            },
            dispose: function() {
                A = new WeakMap
            }
        }
    }
    function Ti(A, e) {
        return A.groupOrder !== e.groupOrder ? A.groupOrder - e.groupOrder : A.renderOrder !== e.renderOrder ? A.renderOrder - e.renderOrder : A.program !== e.program ? A.program.id - e.program.id : A.material.id !== e.material.id ? A.material.id - e.material.id : A.z !== e.z ? A.z - e.z : A.id - e.id
    }
    function ki(A, e) {
        return A.groupOrder !== e.groupOrder ? A.groupOrder - e.groupOrder : A.renderOrder !== e.renderOrder ? A.renderOrder - e.renderOrder : A.z !== e.z ? e.z - A.z : A.id - e.id
    }
    function Di() {
        var A = []
          , e = 0
          , t = []
          , i = []
          , o = {
            id: -1
        };
        function n(t, i, n, r, a, s) {
            var l = A[e];
            return void 0 === l ? A[e] = l = {
                id: t.id,
                object: t,
                geometry: i,
                material: n,
                program: n.program || o,
                groupOrder: r,
                renderOrder: t.renderOrder,
                z: a,
                group: s
            } : (l.id = t.id,
            l.object = t,
            l.geometry = i,
            l.material = n,
            l.program = n.program || o,
            l.groupOrder = r,
            l.renderOrder = t.renderOrder,
            l.z = a,
            l.group = s),
            e++,
            l
        }
        return {
            opaque: t,
            transparent: i,
            init: function() {
                e = 0,
                t.length = 0,
                i.length = 0
            },
            push: function(A, e, o, r, a, s) {
                var l = n(A, e, o, r, a, s);
                (!0 === o.transparent ? i : t).push(l)
            },
            unshift: function(A, e, o, r, a, s) {
                var l = n(A, e, o, r, a, s);
                (!0 === o.transparent ? i : t).unshift(l)
            },
            finish: function() {
                for (var t = e, i = A.length; i > t; t++) {
                    var o = A[t];
                    if (null === o.id)
                        break;
                    o.id = null,
                    o.object = null,
                    o.geometry = null,
                    o.material = null,
                    o.program = null,
                    o.group = null
                }
            },
            sort: function(A, e) {
                t.length > 1 && t.sort(A || Ti),
                i.length > 1 && i.sort(e || ki)
            }
        }
    }
    function Li() {
        var A = new WeakMap;
        function e(t) {
            var i = t.target;
            i.removeEventListener("dispose", e),
            A.delete(i)
        }
        return {
            get: function(t, i) {
                var o, n = A.get(t);
                return void 0 === n ? (o = new Di,
                A.set(t, new WeakMap),
                A.get(t).set(i, o),
                t.addEventListener("dispose", e)) : void 0 === (o = n.get(i)) && (o = new Di,
                n.set(i, o)),
                o
            },
            dispose: function() {
                A = new WeakMap
            }
        }
    }
    function Ni() {
        var A = {};
        return {
            get: function(e) {
                if (void 0 !== A[e.id])
                    return A[e.id];
                var t;
                switch (e.type) {
                case "DirectionalLight":
                    t = {
                        direction: new y,
                        color: new LA
                    };
                    break;
                case "SpotLight":
                    t = {
                        position: new y,
                        direction: new y,
                        color: new LA,
                        distance: 0,
                        coneCos: 0,
                        penumbraCos: 0,
                        decay: 0
                    };
                    break;
                case "PointLight":
                    t = {
                        position: new y,
                        color: new LA,
                        distance: 0,
                        decay: 0
                    };
                    break;
                case "HemisphereLight":
                    t = {
                        direction: new y,
                        skyColor: new LA,
                        groundColor: new LA
                    };
                    break;
                case "RectAreaLight":
                    t = {
                        color: new LA,
                        position: new y,
                        halfWidth: new y,
                        halfHeight: new y
                    }
                }
                return A[e.id] = t,
                t
            }
        }
    }
    var Oi = 0;
    function Vi(A, e) {
        return (e.castShadow ? 1 : 0) - (A.castShadow ? 1 : 0)
    }
    function Gi() {
        for (var A, e = new Ni, t = (A = {},
        {
            get: function(e) {
                if (void 0 !== A[e.id])
                    return A[e.id];
                var t;
                switch (e.type) {
                case "DirectionalLight":
                case "SpotLight":
                    t = {
                        shadowBias: 0,
                        shadowRadius: 1,
                        shadowMapSize: new s
                    };
                    break;
                case "PointLight":
                    t = {
                        shadowBias: 0,
                        shadowRadius: 1,
                        shadowMapSize: new s,
                        shadowCameraNear: 1,
                        shadowCameraFar: 1e3
                    }
                }
                return A[e.id] = t,
                t
            }
        }), i = {
            version: 0,
            hash: {
                directionalLength: -1,
                pointLength: -1,
                spotLength: -1,
                rectAreaLength: -1,
                hemiLength: -1,
                numDirectionalShadows: -1,
                numPointShadows: -1,
                numSpotShadows: -1
            },
            ambient: [0, 0, 0],
            probe: [],
            directional: [],
            directionalShadow: [],
            directionalShadowMap: [],
            directionalShadowMatrix: [],
            spot: [],
            spotShadow: [],
            spotShadowMap: [],
            spotShadowMatrix: [],
            rectArea: [],
            point: [],
            pointShadow: [],
            pointShadowMap: [],
            pointShadowMatrix: [],
            hemi: []
        }, o = 0; 9 > o; o++)
            i.probe.push(new y);
        var n = new y
          , r = new M
          , a = new M;
        return {
            setup: function(A, o, s) {
                for (var l = 0, c = 0, h = 0, d = 0; 9 > d; d++)
                    i.probe[d].set(0, 0, 0);
                var p = 0
                  , g = 0
                  , u = 0
                  , f = 0
                  , m = 0
                  , C = 0
                  , y = 0
                  , v = 0
                  , I = s.matrixWorldInverse;
                A.sort(Vi),
                d = 0;
                for (var E = A.length; E > d; d++) {
                    var B = A[d]
                      , x = B.color
                      , S = B.intensity
                      , w = B.distance
                      , M = B.shadow && B.shadow.map ? B.shadow.map.texture : null;
                    if (B.isAmbientLight)
                        l += x.r * S,
                        c += x.g * S,
                        h += x.b * S;
                    else if (B.isLightProbe)
                        for (var b = 0; 9 > b; b++)
                            i.probe[b].addScaledVector(B.sh.coefficients[b], S);
                    else if (B.isDirectionalLight) {
                        if ((K = e.get(B)).color.copy(B.color).multiplyScalar(B.intensity),
                        K.direction.setFromMatrixPosition(B.matrixWorld),
                        n.setFromMatrixPosition(B.target.matrixWorld),
                        K.direction.sub(n),
                        K.direction.transformDirection(I),
                        B.castShadow) {
                            var U = B.shadow;
                            (F = t.get(B)).shadowBias = U.bias,
                            F.shadowRadius = U.radius,
                            F.shadowMapSize = U.mapSize,
                            i.directionalShadow[p] = F,
                            i.directionalShadowMap[p] = M,
                            i.directionalShadowMatrix[p] = B.shadow.matrix,
                            C++
                        }
                        i.directional[p] = K,
                        p++
                    } else if (B.isSpotLight) {
                        if ((K = e.get(B)).position.setFromMatrixPosition(B.matrixWorld),
                        K.position.applyMatrix4(I),
                        K.color.copy(x).multiplyScalar(S),
                        K.distance = w,
                        K.direction.setFromMatrixPosition(B.matrixWorld),
                        n.setFromMatrixPosition(B.target.matrixWorld),
                        K.direction.sub(n),
                        K.direction.transformDirection(I),
                        K.coneCos = Math.cos(B.angle),
                        K.penumbraCos = Math.cos(B.angle * (1 - B.penumbra)),
                        K.decay = B.decay,
                        B.castShadow) {
                            U = B.shadow;
                            (F = t.get(B)).shadowBias = U.bias,
                            F.shadowRadius = U.radius,
                            F.shadowMapSize = U.mapSize,
                            i.spotShadow[u] = F,
                            i.spotShadowMap[u] = M,
                            i.spotShadowMatrix[u] = B.shadow.matrix,
                            v++
                        }
                        i.spot[u] = K,
                        u++
                    } else if (B.isRectAreaLight) {
                        (K = e.get(B)).color.copy(x).multiplyScalar(S),
                        K.position.setFromMatrixPosition(B.matrixWorld),
                        K.position.applyMatrix4(I),
                        a.identity(),
                        r.copy(B.matrixWorld),
                        r.premultiply(I),
                        a.extractRotation(r),
                        K.halfWidth.set(.5 * B.width, 0, 0),
                        K.halfHeight.set(0, .5 * B.height, 0),
                        K.halfWidth.applyMatrix4(a),
                        K.halfHeight.applyMatrix4(a),
                        i.rectArea[f] = K,
                        f++
                    } else if (B.isPointLight) {
                        if ((K = e.get(B)).position.setFromMatrixPosition(B.matrixWorld),
                        K.position.applyMatrix4(I),
                        K.color.copy(B.color).multiplyScalar(B.intensity),
                        K.distance = B.distance,
                        K.decay = B.decay,
                        B.castShadow) {
                            var F;
                            U = B.shadow;
                            (F = t.get(B)).shadowBias = U.bias,
                            F.shadowRadius = U.radius,
                            F.shadowMapSize = U.mapSize,
                            F.shadowCameraNear = U.camera.near,
                            F.shadowCameraFar = U.camera.far,
                            i.pointShadow[g] = F,
                            i.pointShadowMap[g] = M,
                            i.pointShadowMatrix[g] = B.shadow.matrix,
                            y++
                        }
                        i.point[g] = K,
                        g++
                    } else if (B.isHemisphereLight) {
                        var K;
                        (K = e.get(B)).direction.setFromMatrixPosition(B.matrixWorld),
                        K.direction.transformDirection(I),
                        K.direction.normalize(),
                        K.skyColor.copy(B.color).multiplyScalar(S),
                        K.groundColor.copy(B.groundColor).multiplyScalar(S),
                        i.hemi[m] = K,
                        m++
                    }
                }
                i.ambient[0] = l,
                i.ambient[1] = c,
                i.ambient[2] = h;
                var Q = i.hash;
                Q.directionalLength === p && Q.pointLength === g && Q.spotLength === u && Q.rectAreaLength === f && Q.hemiLength === m && Q.numDirectionalShadows === C && Q.numPointShadows === y && Q.numSpotShadows === v || (i.directional.length = p,
                i.spot.length = u,
                i.rectArea.length = f,
                i.point.length = g,
                i.hemi.length = m,
                i.directionalShadow.length = C,
                i.directionalShadowMap.length = C,
                i.pointShadow.length = y,
                i.pointShadowMap.length = y,
                i.spotShadow.length = v,
                i.spotShadowMap.length = v,
                i.directionalShadowMatrix.length = C,
                i.pointShadowMatrix.length = y,
                i.spotShadowMatrix.length = v,
                Q.directionalLength = p,
                Q.pointLength = g,
                Q.spotLength = u,
                Q.rectAreaLength = f,
                Q.hemiLength = m,
                Q.numDirectionalShadows = C,
                Q.numPointShadows = y,
                Q.numSpotShadows = v,
                i.version = Oi++)
            },
            state: i
        }
    }
    function Pi() {
        var A = new Gi
          , e = []
          , t = [];
        return {
            init: function() {
                e.length = 0,
                t.length = 0
            },
            state: {
                lightsArray: e,
                shadowsArray: t,
                lights: A
            },
            setupLights: function(i) {
                A.setup(e, t, i)
            },
            pushLight: function(A) {
                e.push(A)
            },
            pushShadow: function(A) {
                t.push(A)
            }
        }
    }
    function qi() {
        var A = new WeakMap;
        function e(t) {
            var i = t.target;
            i.removeEventListener("dispose", e),
            A.delete(i)
        }
        return {
            get: function(t, i) {
                var o;
                return !1 === A.has(t) ? (o = new Pi,
                A.set(t, new WeakMap),
                A.get(t).set(i, o),
                t.addEventListener("dispose", e)) : !1 === A.get(t).has(i) ? (o = new Pi,
                A.get(t).set(i, o)) : o = A.get(t).get(i),
                o
            },
            dispose: function() {
                A = new WeakMap
            }
        }
    }
    function ji(A) {
        qA.call(this),
        this.type = "MeshDepthMaterial",
        this.depthPacking = 3200,
        this.skinning = !1,
        this.morphTargets = !1,
        this.map = null,
        this.alphaMap = null,
        this.displacementMap = null,
        this.displacementScale = 1,
        this.displacementBias = 0,
        this.wireframe = !1,
        this.wireframeLinewidth = 1,
        this.fog = !1,
        this.setValues(A)
    }
    function Hi(A) {
        qA.call(this),
        this.type = "MeshDistanceMaterial",
        this.referencePosition = new y,
        this.nearDistance = 1,
        this.farDistance = 1e3,
        this.skinning = !1,
        this.morphTargets = !1,
        this.map = null,
        this.alphaMap = null,
        this.displacementMap = null,
        this.displacementScale = 1,
        this.displacementBias = 0,
        this.fog = !1,
        this.setValues(A)
    }
    (ji.prototype = Object.create(qA.prototype)).constructor = ji,
    ji.prototype.isMeshDepthMaterial = !0,
    ji.prototype.copy = function(A) {
        return qA.prototype.copy.call(this, A),
        this.depthPacking = A.depthPacking,
        this.skinning = A.skinning,
        this.morphTargets = A.morphTargets,
        this.map = A.map,
        this.alphaMap = A.alphaMap,
        this.displacementMap = A.displacementMap,
        this.displacementScale = A.displacementScale,
        this.displacementBias = A.displacementBias,
        this.wireframe = A.wireframe,
        this.wireframeLinewidth = A.wireframeLinewidth,
        this
    }
    ,
    (Hi.prototype = Object.create(qA.prototype)).constructor = Hi,
    Hi.prototype.isMeshDistanceMaterial = !0,
    Hi.prototype.copy = function(A) {
        return qA.prototype.copy.call(this, A),
        this.referencePosition.copy(A.referencePosition),
        this.nearDistance = A.nearDistance,
        this.farDistance = A.farDistance,
        this.skinning = A.skinning,
        this.morphTargets = A.morphTargets,
        this.map = A.map,
        this.alphaMap = A.alphaMap,
        this.displacementMap = A.displacementMap,
        this.displacementScale = A.displacementScale,
        this.displacementBias = A.displacementBias,
        this
    }
    ;
    function Yi(A, e, t) {
        var i = new Ze
          , o = new s
          , n = new s
          , r = new p
          , a = []
          , l = []
          , c = {}
          , h = {
            0: 1,
            1: 0,
            2: 2
        }
          , d = new Pe({
            defines: {
                SAMPLE_RATE: 2 / 8,
                HALF_SAMPLE_RATE: 1 / 8
            },
            uniforms: {
                shadow_pass: {
                    value: null
                },
                resolution: {
                    value: new s
                },
                radius: {
                    value: 4
                }
            },
            vertexShader: "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",
            fragmentShader: "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n  float mean = 0.0;\n  float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy  ) / resolution ) );\n  for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n    #ifdef HORIZONAL_PASS\n      vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n      mean += distribution.x;\n      squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n    #else\n      float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0,  i )  * radius ) / resolution ) );\n      mean += depth;\n      squared_mean += depth * depth;\n    #endif\n  }\n  mean = mean * HALF_SAMPLE_RATE;\n  squared_mean = squared_mean * HALF_SAMPLE_RATE;\n  float std_dev = sqrt( squared_mean - mean * mean );\n  gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"
        })
          , u = d.clone();
        u.defines.HORIZONAL_PASS = 1;
        var f = new he;
        f.setAttribute("position", new YA(new Float32Array([-1, -1, .5, 3, -1, .5, -1, 3, .5]),3));
        var m = new Ue(f,d)
          , C = this;
        function y(t, i) {
            var o = e.update(m);
            d.uniforms.shadow_pass.value = t.map.texture,
            d.uniforms.resolution.value = t.mapSize,
            d.uniforms.radius.value = t.radius,
            A.setRenderTarget(t.mapPass),
            A.clear(),
            A.renderBufferDirect(i, null, o, d, m, null),
            u.uniforms.shadow_pass.value = t.mapPass.texture,
            u.uniforms.resolution.value = t.mapSize,
            u.uniforms.radius.value = t.radius,
            A.setRenderTarget(t.map),
            A.clear(),
            A.renderBufferDirect(i, null, o, u, m, null)
        }
        function v(A, e, t) {
            var i = A << 0 | e << 1 | t << 2
              , o = a[i];
            return void 0 === o && (o = new ji({
                depthPacking: 3201,
                morphTargets: A,
                skinning: e
            }),
            a[i] = o),
            o
        }
        function I(A, e, t) {
            var i = A << 0 | e << 1 | t << 2
              , o = l[i];
            return void 0 === o && (o = new Hi({
                morphTargets: A,
                skinning: e
            }),
            l[i] = o),
            o
        }
        function E(e, t, i, o, n, r) {
            var a = e.geometry
              , s = null
              , l = v
              , d = e.customDepthMaterial;
            if (!0 === i.isPointLight && (l = I,
            d = e.customDistanceMaterial),
            void 0 === d) {
                var p = !1;
                !0 === t.morphTargets && (!0 === a.isBufferGeometry ? p = a.morphAttributes && a.morphAttributes.position && a.morphAttributes.position.length > 0 : !0 === a.isGeometry && (p = a.morphTargets && a.morphTargets.length > 0));
                var g = !1;
                !0 === e.isSkinnedMesh && (!0 === t.skinning ? g = !0 : console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:", e)),
                s = l(p, g, !0 === e.isInstancedMesh)
            } else
                s = d;
            if (A.localClippingEnabled && !0 === t.clipShadows && 0 !== t.clippingPlanes.length) {
                var u = s.uuid
                  , f = t.uuid
                  , m = c[u];
                void 0 === m && (c[u] = m = {});
                var C = m[f];
                void 0 === C && (C = s.clone(),
                m[f] = C),
                s = C
            }
            return s.visible = t.visible,
            s.wireframe = t.wireframe,
            s.side = 3 === r ? null !== t.shadowSide ? t.shadowSide : t.side : null !== t.shadowSide ? t.shadowSide : h[t.side],
            s.clipShadows = t.clipShadows,
            s.clippingPlanes = t.clippingPlanes,
            s.clipIntersection = t.clipIntersection,
            s.wireframeLinewidth = t.wireframeLinewidth,
            s.linewidth = t.linewidth,
            !0 === i.isPointLight && !0 === s.isMeshDistanceMaterial && (s.referencePosition.setFromMatrixPosition(i.matrixWorld),
            s.nearDistance = o,
            s.farDistance = n),
            s
        }
        function B(t, o, n, r, a) {
            if (!1 !== t.visible) {
                if (t.layers.test(o.layers) && (t.isMesh || t.isLine || t.isPoints) && (t.castShadow || t.receiveShadow && 3 === a) && (!t.frustumCulled || i.intersectsObject(t))) {
                    t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse, t.matrixWorld);
                    var s = e.update(t)
                      , l = t.material;
                    if (Array.isArray(l))
                        for (var c = s.groups, h = 0, d = c.length; d > h; h++) {
                            var p = c[h]
                              , g = l[p.materialIndex];
                            if (g && g.visible && g.opacity > .9) {
                                var u = E(t, g, r, n.near, n.far, a);
                                A.renderBufferDirect(n, null, s, u, t, p)
                            }
                        }
                    else if (l.visible && l.opacity > .9) {
                        u = E(t, l, r, n.near, n.far, a);
                        A.renderBufferDirect(n, null, s, u, t, null)
                    }
                }
                for (var f = t.children, m = 0, C = f.length; C > m; m++)
                    B(f[m], o, n, r, a)
            }
        }
        this.enabled = !1,
        this.autoUpdate = !0,
        this.needsUpdate = !1,
        this.type = 1,
        this.render = function(e, a, s) {
            if (!1 !== C.enabled && (!1 !== C.autoUpdate || !1 !== C.needsUpdate) && 0 !== e.length) {
                var l = A.getRenderTarget()
                  , c = A.getActiveCubeFace()
                  , h = A.getActiveMipmapLevel()
                  , d = A.state;
                d.setBlending(0),
                d.buffers.color.setClear(1, 1, 1, 1),
                d.buffers.depth.setTest(!0),
                d.setScissorTest(!1);
                for (var p = 0, u = e.length; u > p; p++) {
                    var f = e[p]
                      , m = f.shadow;
                    if (void 0 !== m) {
                        o.copy(m.mapSize);
                        var v, I = m.getFrameExtents();
                        if (o.multiply(I),
                        n.copy(m.mapSize),
                        (o.x > t || o.y > t) && (console.warn("THREE.WebGLShadowMap:", f, "has shadow exceeding max texture size, reducing"),
                        o.x > t && (n.x = Math.floor(t / I.x),
                        o.x = n.x * I.x,
                        m.mapSize.x = n.x),
                        o.y > t && (n.y = Math.floor(t / I.y),
                        o.y = n.y * I.y,
                        m.mapSize.y = n.y)),
                        null === m.map && !m.isPointLightShadow && 3 === this.type)
                            m.map = new g(o.x,o.y,v = {
                                minFilter: 1006,
                                magFilter: 1006,
                                format: 1023
                            }),
                            m.map.texture.name = f.name + ".shadowMap",
                            m.mapPass = new g(o.x,o.y,v),
                            m.camera.updateProjectionMatrix();
                        if (null === m.map)
                            m.map = new g(o.x,o.y,v = {
                                minFilter: 1003,
                                magFilter: 1003,
                                format: 1023
                            }),
                            m.map.texture.name = f.name + ".shadowMap",
                            m.camera.updateProjectionMatrix();
                        A.setRenderTarget(m.map),
                        A.clear();
                        for (var E = m.getViewportCount(), x = 0; E > x; x++) {
                            var S = m.getViewport(x);
                            r.set(n.x * S.x, n.y * S.y, n.x * S.z, n.y * S.w),
                            d.viewport(r),
                            m.updateMatrices(f, x),
                            i = m.getFrustum(),
                            B(a, s, m.camera, f, this.type)
                        }
                        m.isPointLightShadow || 3 !== this.type || y(m, s)
                    } else
                        console.warn("THREE.WebGLShadowMap:", f, "has no shadow.")
                }
                C.needsUpdate = !1,
                A.setRenderTarget(l, c, h)
            }
        }
    }
    function Wi(A, e, t) {
        var i = t.isWebGL2;
        var o = new function() {
            var e = !1
              , t = new p
              , i = null
              , o = new p(0,0,0,0);
            return {
                setMask: function(t) {
                    i === t || e || (A.colorMask(t, t, t, t),
                    i = t)
                },
                setLocked: function(A) {
                    e = A
                },
                setClear: function(e, i, n, r, a) {
                    !0 === a && (e *= r,
                    i *= r,
                    n *= r),
                    t.set(e, i, n, r),
                    !1 === o.equals(t) && (A.clearColor(e, i, n, r),
                    o.copy(t))
                },
                reset: function() {
                    e = !1,
                    i = null,
                    o.set(-1, 0, 0, 0)
                }
            }
        }
          , n = new function() {
            var e = !1
              , t = null
              , i = null
              , o = null;
            return {
                setTest: function(A) {
                    A ? O(2929) : V(2929)
                },
                setMask: function(i) {
                    t === i || e || (A.depthMask(i),
                    t = i)
                },
                setFunc: function(e) {
                    if (i !== e) {
                        if (e)
                            switch (e) {
                            case 0:
                                A.depthFunc(512);
                                break;
                            case 1:
                                A.depthFunc(519);
                                break;
                            case 2:
                                A.depthFunc(513);
                                break;
                            case 3:
                                A.depthFunc(515);
                                break;
                            case 4:
                                A.depthFunc(514);
                                break;
                            case 5:
                                A.depthFunc(518);
                                break;
                            case 6:
                                A.depthFunc(516);
                                break;
                            case 7:
                                A.depthFunc(517);
                                break;
                            default:
                                A.depthFunc(515)
                            }
                        else
                            A.depthFunc(515);
                        i = e
                    }
                },
                setLocked: function(A) {
                    e = A
                },
                setClear: function(e) {
                    o !== e && (A.clearDepth(e),
                    o = e)
                },
                reset: function() {
                    e = !1,
                    t = null,
                    i = null,
                    o = null
                }
            }
        }
          , r = new function() {
            var e = !1
              , t = null
              , i = null
              , o = null
              , n = null
              , r = null
              , a = null
              , s = null
              , l = null;
            return {
                setTest: function(A) {
                    e || (A ? O(2960) : V(2960))
                },
                setMask: function(i) {
                    t === i || e || (A.stencilMask(i),
                    t = i)
                },
                setFunc: function(e, t, r) {
                    i === e && o === t && n === r || (A.stencilFunc(e, t, r),
                    i = e,
                    o = t,
                    n = r)
                },
                setOp: function(e, t, i) {
                    r === e && a === t && s === i || (A.stencilOp(e, t, i),
                    r = e,
                    a = t,
                    s = i)
                },
                setLocked: function(A) {
                    e = A
                },
                setClear: function(e) {
                    l !== e && (A.clearStencil(e),
                    l = e)
                },
                reset: function() {
                    e = !1,
                    t = null,
                    i = null,
                    o = null,
                    n = null,
                    r = null,
                    a = null,
                    s = null,
                    l = null
                }
            }
        }
          , a = A.getParameter(34921)
          , s = new Uint8Array(a)
          , l = new Uint8Array(a)
          , c = new Uint8Array(a)
          , h = {}
          , d = null
          , g = null
          , u = null
          , f = null
          , m = null
          , C = null
          , y = null
          , v = null
          , I = null
          , E = !1
          , B = null
          , x = null
          , S = null
          , w = null
          , M = null
          , b = A.getParameter(35661)
          , U = !1
          , F = 0
          , K = A.getParameter(7938);
        -1 !== K.indexOf("WebGL") ? (F = parseFloat(/^WebGL\ ([0-9])/.exec(K)[1]),
        U = F >= 1) : -1 !== K.indexOf("OpenGL ES") && (F = parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(K)[1]),
        U = F >= 2);
        var Q = null
          , R = {}
          , T = new p
          , k = new p;
        function D(e, t, i) {
            var o = new Uint8Array(4)
              , n = A.createTexture();
            A.bindTexture(e, n),
            A.texParameteri(e, 10241, 9728),
            A.texParameteri(e, 10240, 9728);
            for (var r = 0; i > r; r++)
                A.texImage2D(t + r, 0, 6408, 1, 1, 0, 6408, 5121, o);
            return n
        }
        var L = {};
        function N(t, o) {
            (s[t] = 1,
            0 === l[t] && (A.enableVertexAttribArray(t),
            l[t] = 1),
            c[t] !== o) && ((i ? A : e.get("ANGLE_instanced_arrays"))[i ? "vertexAttribDivisor" : "vertexAttribDivisorANGLE"](t, o),
            c[t] = o)
        }
        function O(e) {
            !0 !== h[e] && (A.enable(e),
            h[e] = !0)
        }
        function V(e) {
            !1 !== h[e] && (A.disable(e),
            h[e] = !1)
        }
        L[3553] = D(3553, 3553, 1),
        L[34067] = D(34067, 34069, 6),
        o.setClear(0, 0, 0, 1),
        n.setClear(1),
        r.setClear(0),
        O(2929),
        n.setFunc(3),
        H(!1),
        Y(1),
        O(2884),
        j(0);
        var G = {
            100: 32774,
            101: 32778,
            102: 32779
        };
        if (i)
            G[103] = 32775,
            G[104] = 32776;
        else {
            var P = e.get("EXT_blend_minmax");
            null !== P && (G[103] = P.MIN_EXT,
            G[104] = P.MAX_EXT)
        }
        var q = {
            200: 0,
            201: 1,
            202: 768,
            204: 770,
            210: 776,
            208: 774,
            206: 772,
            203: 769,
            205: 771,
            209: 775,
            207: 773
        };
        function j(e, t, i, o, n, r, a, s) {
            if (0 !== e) {
                if (g || (O(3042),
                g = !0),
                5 === e)
                    n = n || t,
                    r = r || i,
                    a = a || o,
                    t === f && n === y || (A.blendEquationSeparate(G[t], G[n]),
                    f = t,
                    y = n),
                    i === m && o === C && r === v && a === I || (A.blendFuncSeparate(q[i], q[o], q[r], q[a]),
                    m = i,
                    C = o,
                    v = r,
                    I = a),
                    u = e,
                    E = null;
                else if (e !== u || s !== E) {
                    if (100 === f && 100 === y || (A.blendEquation(32774),
                    f = 100,
                    y = 100),
                    s)
                        switch (e) {
                        case 1:
                            A.blendFuncSeparate(1, 771, 1, 771);
                            break;
                        case 2:
                            A.blendFunc(1, 1);
                            break;
                        case 3:
                            A.blendFuncSeparate(0, 0, 769, 771);
                            break;
                        case 4:
                            A.blendFuncSeparate(0, 768, 0, 770);
                            break;
                        default:
                            console.error("THREE.WebGLState: Invalid blending: ", e)
                        }
                    else
                        switch (e) {
                        case 1:
                            A.blendFuncSeparate(770, 771, 1, 771);
                            break;
                        case 2:
                            A.blendFunc(770, 1);
                            break;
                        case 3:
                            A.blendFunc(0, 769);
                            break;
                        case 4:
                            A.blendFunc(0, 768);
                            break;
                        default:
                            console.error("THREE.WebGLState: Invalid blending: ", e)
                        }
                    m = null,
                    C = null,
                    v = null,
                    I = null,
                    u = e,
                    E = s
                }
            } else
                g && (V(3042),
                g = !1)
        }
        function H(e) {
            B !== e && (A.frontFace(e ? 2304 : 2305),
            B = e)
        }
        function Y(e) {
            0 !== e ? (O(2884),
            e !== x && A.cullFace(1 === e ? 1029 : 2 === e ? 1028 : 1032)) : V(2884),
            x = e
        }
        function W(e, t, i) {
            e ? (O(32823),
            w === t && M === i || (A.polygonOffset(t, i),
            w = t,
            M = i)) : V(32823)
        }
        function J(e) {
            void 0 === e && (e = 33984 + b - 1),
            Q !== e && (A.activeTexture(e),
            Q = e)
        }
        return {
            buffers: {
                color: o,
                depth: n,
                stencil: r
            },
            initAttributes: function() {
                for (var A = 0, e = s.length; e > A; A++)
                    s[A] = 0
            },
            enableAttribute: function(A) {
                N(A, 0)
            },
            enableAttributeAndDivisor: N,
            disableUnusedAttributes: function() {
                for (var e = 0, t = l.length; e !== t; ++e)
                    l[e] !== s[e] && (A.disableVertexAttribArray(e),
                    l[e] = 0)
            },
            enable: O,
            disable: V,
            useProgram: function(e) {
                return d !== e && (A.useProgram(e),
                d = e,
                !0)
            },
            setBlending: j,
            setMaterial: function(A, e) {
                2 === A.side ? V(2884) : O(2884);
                var t = 1 === A.side;
                e && (t = !t),
                H(t),
                1 === A.blending && !1 === A.transparent ? j(0) : j(A.blending, A.blendEquation, A.blendSrc, A.blendDst, A.blendEquationAlpha, A.blendSrcAlpha, A.blendDstAlpha, A.premultipliedAlpha),
                n.setFunc(A.depthFunc),
                n.setTest(A.depthTest),
                n.setMask(A.depthWrite),
                o.setMask(A.colorWrite);
                var i = A.stencilWrite;
                r.setTest(i),
                i && (r.setMask(A.stencilWriteMask),
                r.setFunc(A.stencilFunc, A.stencilRef, A.stencilFuncMask),
                r.setOp(A.stencilFail, A.stencilZFail, A.stencilZPass)),
                W(A.polygonOffset, A.polygonOffsetFactor, A.polygonOffsetUnits)
            },
            setFlipSided: H,
            setCullFace: Y,
            setLineWidth: function(e) {
                e !== S && (U && A.lineWidth(e),
                S = e)
            },
            setPolygonOffset: W,
            setScissorTest: function(A) {
                A ? O(3089) : V(3089)
            },
            activeTexture: J,
            bindTexture: function(e, t) {
                null === Q && J();
                var i = R[Q];
                void 0 === i && (R[Q] = i = {
                    type: void 0,
                    texture: void 0
                }),
                i.type === e && i.texture === t || (A.bindTexture(e, t || L[e]),
                i.type = e,
                i.texture = t)
            },
            unbindTexture: function() {
                var e = R[Q];
                void 0 !== e && void 0 !== e.type && (A.bindTexture(e.type, null),
                e.type = void 0,
                e.texture = void 0)
            },
            compressedTexImage2D: function() {
                try {
                    A.compressedTexImage2D.apply(A, arguments)
                } catch (A) {
                    console.error("THREE.WebGLState:", A)
                }
            },
            texImage2D: function() {
                try {
                    A.texImage2D.apply(A, arguments)
                } catch (A) {
                    console.error("THREE.WebGLState:", A)
                }
            },
            texImage3D: function() {
                try {
                    A.texImage3D.apply(A, arguments)
                } catch (A) {
                    console.error("THREE.WebGLState:", A)
                }
            },
            scissor: function(e) {
                !1 === T.equals(e) && (A.scissor(e.x, e.y, e.z, e.w),
                T.copy(e))
            },
            viewport: function(e) {
                !1 === k.equals(e) && (A.viewport(e.x, e.y, e.z, e.w),
                k.copy(e))
            },
            reset: function() {
                for (var e = 0; l.length > e; e++)
                    1 === l[e] && (A.disableVertexAttribArray(e),
                    l[e] = 0);
                h = {},
                Q = null,
                R = {},
                d = null,
                u = null,
                B = null,
                x = null,
                o.reset(),
                n.reset(),
                r.reset()
            }
        }
    }
    function Ji(A, e, t, i, o, n, r) {
        var s, l = o.isWebGL2, c = o.maxTextures, h = o.maxCubemapSize, d = o.maxTextureSize, p = o.maxSamples, g = new WeakMap, u = !1;
        try {
            u = "undefined" != typeof OffscreenCanvas && null !== new OffscreenCanvas(1,1).getContext("2d")
        } catch (A) {}
        function f(A, e) {
            return u ? new OffscreenCanvas(A,e) : document.createElementNS("http://www.w3.org/1999/xhtml", "canvas")
        }
        function m(A, e, t, i) {
            var o = 1;
            if ((A.width > i || A.height > i) && (o = i / Math.max(A.width, A.height)),
            1 > o || !0 === e) {
                if ("undefined" != typeof HTMLImageElement && A instanceof HTMLImageElement || "undefined" != typeof HTMLCanvasElement && A instanceof HTMLCanvasElement || "undefined" != typeof ImageBitmap && A instanceof ImageBitmap) {
                    var n = e ? a.floorPowerOfTwo : Math.floor
                      , r = n(o * A.width)
                      , l = n(o * A.height);
                    void 0 === s && (s = f(r, l));
                    var c = t ? f(r, l) : s;
                    return c.width = r,
                    c.height = l,
                    c.getContext("2d").drawImage(A, 0, 0, r, l),
                    console.warn("THREE.WebGLRenderer: Texture has been resized from (" + A.width + "x" + A.height + ") to (" + r + "x" + l + ")."),
                    c
                }
                return "data"in A && console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + A.width + "x" + A.height + ")."),
                A
            }
            return A
        }
        function C(A) {
            return a.isPowerOfTwo(A.width) && a.isPowerOfTwo(A.height)
        }
        function y(A, e) {
            return A.generateMipmaps && e && 1003 !== A.minFilter && 1006 !== A.minFilter
        }
        function v(e, t, o, n) {
            A.generateMipmap(e),
            i.get(t).__maxMipLevel = Math.log(Math.max(o, n)) * Math.LOG2E
        }
        function I(t, i, o) {
            if (!1 === l)
                return i;
            if (null !== t) {
                if (void 0 !== A[t])
                    return A[t];
                console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '" + t + "'")
            }
            var n = i;
            return 6403 === i && (5126 === o && (n = 33326),
            5131 === o && (n = 33325),
            5121 === o && (n = 33321)),
            6407 === i && (5126 === o && (n = 34837),
            5131 === o && (n = 34843),
            5121 === o && (n = 32849)),
            6408 === i && (5126 === o && (n = 34836),
            5131 === o && (n = 34842),
            5121 === o && (n = 32856)),
            33325 !== n && 33326 !== n && 34842 !== n && 34836 !== n || e.get("EXT_color_buffer_float"),
            n
        }
        function E(A) {
            return 1003 === A || 1004 === A || 1005 === A ? 9728 : 9729
        }
        function B(e) {
            var t = e.target;
            t.removeEventListener("dispose", B),
            function(e) {
                var t = i.get(e);
                if (void 0 === t.__webglInit)
                    return;
                A.deleteTexture(t.__webglTexture),
                i.remove(e)
            }(t),
            t.isVideoTexture && g.delete(t),
            r.memory.textures--
        }
        function x(e) {
            var t = e.target;
            t.removeEventListener("dispose", x),
            function(e) {
                var t = i.get(e)
                  , o = i.get(e.texture);
                if (!e)
                    return;
                void 0 !== o.__webglTexture && A.deleteTexture(o.__webglTexture);
                e.depthTexture && e.depthTexture.dispose();
                if (e.isWebGLCubeRenderTarget)
                    for (var n = 0; 6 > n; n++)
                        A.deleteFramebuffer(t.__webglFramebuffer[n]),
                        t.__webglDepthbuffer && A.deleteRenderbuffer(t.__webglDepthbuffer[n]);
                else
                    A.deleteFramebuffer(t.__webglFramebuffer),
                    t.__webglDepthbuffer && A.deleteRenderbuffer(t.__webglDepthbuffer),
                    t.__webglMultisampledFramebuffer && A.deleteFramebuffer(t.__webglMultisampledFramebuffer),
                    t.__webglColorRenderbuffer && A.deleteRenderbuffer(t.__webglColorRenderbuffer),
                    t.__webglDepthRenderbuffer && A.deleteRenderbuffer(t.__webglDepthRenderbuffer);
                i.remove(e.texture),
                i.remove(e)
            }(t),
            r.memory.textures--
        }
        var S = 0;
        function w(A, e) {
            var o = i.get(A);
            if (A.isVideoTexture && function(A) {
                var e = r.render.frame;
                g.get(A) !== e && (g.set(A, e),
                A.update())
            }(A),
            A.version > 0 && o.__version !== A.version) {
                var n = A.image;
                if (void 0 === n)
                    console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");
                else {
                    if (!1 !== n.complete)
                        return void R(o, A, e);
                    console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")
                }
            }
            t.activeTexture(33984 + e),
            t.bindTexture(3553, o.__webglTexture)
        }
        function M(e, o) {
            if (6 === e.image.length) {
                var r = i.get(e);
                if (e.version > 0 && r.__version !== e.version) {
                    Q(r, e),
                    t.activeTexture(33984 + o),
                    t.bindTexture(34067, r.__webglTexture),
                    A.pixelStorei(37440, e.flipY);
                    for (var a = e && (e.isCompressedTexture || e.image[0].isCompressedTexture), s = e.image[0] && e.image[0].isDataTexture, c = [], d = 0; 6 > d; d++)
                        c[d] = a || s ? s ? e.image[d].image : e.image[d] : m(e.image[d], !1, !0, h);
                    var p, g = c[0], u = C(g) || l, f = n.convert(e.format), E = n.convert(e.type), B = I(e.internalFormat, f, E);
                    if (K(34067, e, u),
                    a) {
                        for (d = 0; 6 > d; d++) {
                            p = c[d].mipmaps;
                            for (var x = 0; p.length > x; x++) {
                                var S = p[x];
                                1023 !== e.format && 1022 !== e.format ? null !== f ? t.compressedTexImage2D(34069 + d, x, B, S.width, S.height, 0, S.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : t.texImage2D(34069 + d, x, B, S.width, S.height, 0, f, E, S.data)
                            }
                        }
                        r.__maxMipLevel = p.length - 1
                    } else {
                        p = e.mipmaps;
                        for (d = 0; 6 > d; d++)
                            if (s) {
                                t.texImage2D(34069 + d, 0, B, c[d].width, c[d].height, 0, f, E, c[d].data);
                                for (x = 0; p.length > x; x++) {
                                    var w = (S = p[x]).image[d].image;
                                    t.texImage2D(34069 + d, x + 1, B, w.width, w.height, 0, f, E, w.data)
                                }
                            } else {
                                t.texImage2D(34069 + d, 0, B, f, E, c[d]);
                                for (x = 0; p.length > x; x++) {
                                    t.texImage2D(34069 + d, x + 1, B, f, E, (S = p[x]).image[d])
                                }
                            }
                        r.__maxMipLevel = p.length
                    }
                    y(e, u) && v(34067, e, g.width, g.height),
                    r.__version = e.version,
                    e.onUpdate && e.onUpdate(e)
                } else
                    t.activeTexture(33984 + o),
                    t.bindTexture(34067, r.__webglTexture)
            }
        }
        function b(A, e) {
            t.activeTexture(33984 + e),
            t.bindTexture(34067, i.get(A).__webglTexture)
        }
        var U = {
            1e3: 10497,
            1001: 33071,
            1002: 33648
        }
          , F = {
            1003: 9728,
            1004: 9984,
            1005: 9986,
            1006: 9729,
            1007: 9985,
            1008: 9987
        };
        function K(t, n, r) {
            r ? (A.texParameteri(t, 10242, U[n.wrapS]),
            A.texParameteri(t, 10243, U[n.wrapT]),
            32879 !== t && 35866 !== t || A.texParameteri(t, 32882, U[n.wrapR]),
            A.texParameteri(t, 10240, F[n.magFilter]),
            A.texParameteri(t, 10241, F[n.minFilter])) : (A.texParameteri(t, 10242, 33071),
            A.texParameteri(t, 10243, 33071),
            32879 !== t && 35866 !== t || A.texParameteri(t, 32882, 33071),
            1001 === n.wrapS && 1001 === n.wrapT || console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),
            A.texParameteri(t, 10240, E(n.magFilter)),
            A.texParameteri(t, 10241, E(n.minFilter)),
            1003 !== n.minFilter && 1006 !== n.minFilter && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter."));
            var a = e.get("EXT_texture_filter_anisotropic");
            if (a) {
                if (1015 === n.type && null === e.get("OES_texture_float_linear"))
                    return;
                if (1016 === n.type && null === (l || e.get("OES_texture_half_float_linear")))
                    return;
                (n.anisotropy > 1 || i.get(n).__currentAnisotropy) && (A.texParameterf(t, a.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(n.anisotropy, o.getMaxAnisotropy())),
                i.get(n).__currentAnisotropy = n.anisotropy)
            }
        }
        function Q(e, t) {
            void 0 === e.__webglInit && (e.__webglInit = !0,
            t.addEventListener("dispose", B),
            e.__webglTexture = A.createTexture(),
            r.memory.textures++)
        }
        function R(e, i, o) {
            var r = 3553;
            i.isDataTexture2DArray && (r = 35866),
            i.isDataTexture3D && (r = 32879),
            Q(e, i),
            t.activeTexture(33984 + o),
            t.bindTexture(r, e.__webglTexture),
            A.pixelStorei(37440, i.flipY),
            A.pixelStorei(37441, i.premultiplyAlpha),
            A.pixelStorei(3317, i.unpackAlignment);
            var a = function(A) {
                return !l && (1001 !== A.wrapS || 1001 !== A.wrapT || 1003 !== A.minFilter && 1006 !== A.minFilter)
            }(i) && !1 === C(i.image)
              , s = m(i.image, a, !1, d)
              , c = C(s) || l
              , h = n.convert(i.format)
              , p = n.convert(i.type)
              , g = I(i.internalFormat, h, p);
            K(r, i, c);
            var u, f = i.mipmaps;
            if (i.isDepthTexture)
                g = 6402,
                l ? g = 1015 === i.type ? 36012 : 1014 === i.type ? 33190 : 1020 === i.type ? 35056 : 33189 : 1015 === i.type && console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),
                1026 === i.format && 6402 === g && 1012 !== i.type && 1014 !== i.type && (console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),
                i.type = 1012,
                p = n.convert(i.type)),
                1027 === i.format && 6402 === g && (g = 34041,
                1020 !== i.type && (console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),
                i.type = 1020,
                p = n.convert(i.type))),
                t.texImage2D(3553, 0, g, s.width, s.height, 0, h, p, null);
            else if (i.isDataTexture)
                if (f.length > 0 && c) {
                    for (var E = 0, B = f.length; B > E; E++)
                        t.texImage2D(3553, E, g, (u = f[E]).width, u.height, 0, h, p, u.data);
                    i.generateMipmaps = !1,
                    e.__maxMipLevel = f.length - 1
                } else
                    t.texImage2D(3553, 0, g, s.width, s.height, 0, h, p, s.data),
                    e.__maxMipLevel = 0;
            else if (i.isCompressedTexture) {
                for (E = 0,
                B = f.length; B > E; E++)
                    u = f[E],
                    1023 !== i.format && 1022 !== i.format ? null !== h ? t.compressedTexImage2D(3553, E, g, u.width, u.height, 0, u.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : t.texImage2D(3553, E, g, u.width, u.height, 0, h, p, u.data);
                e.__maxMipLevel = f.length - 1
            } else if (i.isDataTexture2DArray)
                t.texImage3D(35866, 0, g, s.width, s.height, s.depth, 0, h, p, s.data),
                e.__maxMipLevel = 0;
            else if (i.isDataTexture3D)
                t.texImage3D(32879, 0, g, s.width, s.height, s.depth, 0, h, p, s.data),
                e.__maxMipLevel = 0;
            else if (f.length > 0 && c) {
                for (E = 0,
                B = f.length; B > E; E++)
                    t.texImage2D(3553, E, g, h, p, u = f[E]);
                i.generateMipmaps = !1,
                e.__maxMipLevel = f.length - 1
            } else
                t.texImage2D(3553, 0, g, h, p, s),
                e.__maxMipLevel = 0;
            y(i, c) && v(r, i, s.width, s.height),
            e.__version = i.version,
            i.onUpdate && i.onUpdate(i)
        }
        function T(e, o, r, a) {
            var s = n.convert(o.texture.format)
              , l = n.convert(o.texture.type)
              , c = I(o.texture.internalFormat, s, l);
            t.texImage2D(a, 0, c, o.width, o.height, 0, s, l, null),
            A.bindFramebuffer(36160, e),
            A.framebufferTexture2D(36160, r, a, i.get(o.texture).__webglTexture, 0),
            A.bindFramebuffer(36160, null)
        }
        function k(e, t, i) {
            if (A.bindRenderbuffer(36161, e),
            t.depthBuffer && !t.stencilBuffer) {
                var o = 33189;
                if (i) {
                    var r = t.depthTexture;
                    r && r.isDepthTexture && (1015 === r.type ? o = 36012 : 1014 === r.type && (o = 33190));
                    var a = L(t);
                    A.renderbufferStorageMultisample(36161, a, o, t.width, t.height)
                } else
                    A.renderbufferStorage(36161, o, t.width, t.height);
                A.framebufferRenderbuffer(36160, 36096, 36161, e)
            } else if (t.depthBuffer && t.stencilBuffer) {
                if (i) {
                    a = L(t);
                    A.renderbufferStorageMultisample(36161, a, 35056, t.width, t.height)
                } else
                    A.renderbufferStorage(36161, 34041, t.width, t.height);
                A.framebufferRenderbuffer(36160, 33306, 36161, e)
            } else {
                var s = n.convert(t.texture.format)
                  , l = n.convert(t.texture.type);
                o = I(t.texture.internalFormat, s, l);
                if (i) {
                    a = L(t);
                    A.renderbufferStorageMultisample(36161, a, o, t.width, t.height)
                } else
                    A.renderbufferStorage(36161, o, t.width, t.height)
            }
            A.bindRenderbuffer(36161, null)
        }
        function D(e) {
            var t = i.get(e)
              , o = !0 === e.isWebGLCubeRenderTarget;
            if (e.depthTexture) {
                if (o)
                    throw new Error("target.depthTexture not supported in Cube render targets");
                !function(e, t) {
                    if (t && t.isWebGLCubeRenderTarget)
                        throw new Error("Depth Texture with cube render targets is not supported");
                    if (A.bindFramebuffer(36160, e),
                    !t.depthTexture || !t.depthTexture.isDepthTexture)
                        throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");
                    i.get(t.depthTexture).__webglTexture && t.depthTexture.image.width === t.width && t.depthTexture.image.height === t.height || (t.depthTexture.image.width = t.width,
                    t.depthTexture.image.height = t.height,
                    t.depthTexture.needsUpdate = !0),
                    w(t.depthTexture, 0);
                    var o = i.get(t.depthTexture).__webglTexture;
                    if (1026 === t.depthTexture.format)
                        A.framebufferTexture2D(36160, 36096, 3553, o, 0);
                    else {
                        if (1027 !== t.depthTexture.format)
                            throw new Error("Unknown depthTexture format");
                        A.framebufferTexture2D(36160, 33306, 3553, o, 0)
                    }
                }(t.__webglFramebuffer, e)
            } else if (o) {
                t.__webglDepthbuffer = [];
                for (var n = 0; 6 > n; n++)
                    A.bindFramebuffer(36160, t.__webglFramebuffer[n]),
                    t.__webglDepthbuffer[n] = A.createRenderbuffer(),
                    k(t.__webglDepthbuffer[n], e, !1)
            } else
                A.bindFramebuffer(36160, t.__webglFramebuffer),
                t.__webglDepthbuffer = A.createRenderbuffer(),
                k(t.__webglDepthbuffer, e, !1);
            A.bindFramebuffer(36160, null)
        }
        function L(A) {
            return l && A.isWebGLMultisampleRenderTarget ? Math.min(p, A.samples) : 0
        }
        var N = !1
          , O = !1;
        this.allocateTextureUnit = function() {
            var A = S;
            return c > A || console.warn("THREE.WebGLTextures: Trying to use " + A + " texture units while this GPU supports only " + c),
            S += 1,
            A
        }
        ,
        this.resetTextureUnits = function() {
            S = 0
        }
        ,
        this.setTexture2D = w,
        this.setTexture2DArray = function(A, e) {
            var o = i.get(A);
            A.version > 0 && o.__version !== A.version ? R(o, A, e) : (t.activeTexture(33984 + e),
            t.bindTexture(35866, o.__webglTexture))
        }
        ,
        this.setTexture3D = function(A, e) {
            var o = i.get(A);
            A.version > 0 && o.__version !== A.version ? R(o, A, e) : (t.activeTexture(33984 + e),
            t.bindTexture(32879, o.__webglTexture))
        }
        ,
        this.setTextureCube = M,
        this.setTextureCubeDynamic = b,
        this.setupRenderTarget = function(e) {
            var o = i.get(e)
              , a = i.get(e.texture);
            e.addEventListener("dispose", x),
            a.__webglTexture = A.createTexture(),
            r.memory.textures++;
            var s = !0 === e.isWebGLCubeRenderTarget
              , c = !0 === e.isWebGLMultisampleRenderTarget
              , h = C(e) || l;
            if (!l || 1022 !== e.texture.format || 1015 !== e.texture.type && 1016 !== e.texture.type || (e.texture.format = 1023,
            console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),
            s) {
                o.__webglFramebuffer = [];
                for (var d = 0; 6 > d; d++)
                    o.__webglFramebuffer[d] = A.createFramebuffer()
            } else if (o.__webglFramebuffer = A.createFramebuffer(),
            c)
                if (l) {
                    o.__webglMultisampledFramebuffer = A.createFramebuffer(),
                    o.__webglColorRenderbuffer = A.createRenderbuffer(),
                    A.bindRenderbuffer(36161, o.__webglColorRenderbuffer);
                    var p = n.convert(e.texture.format)
                      , g = n.convert(e.texture.type)
                      , u = I(e.texture.internalFormat, p, g)
                      , f = L(e);
                    A.renderbufferStorageMultisample(36161, f, u, e.width, e.height),
                    A.bindFramebuffer(36160, o.__webglMultisampledFramebuffer),
                    A.framebufferRenderbuffer(36160, 36064, 36161, o.__webglColorRenderbuffer),
                    A.bindRenderbuffer(36161, null),
                    e.depthBuffer && (o.__webglDepthRenderbuffer = A.createRenderbuffer(),
                    k(o.__webglDepthRenderbuffer, e, !0)),
                    A.bindFramebuffer(36160, null)
                } else
                    console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");
            if (s) {
                t.bindTexture(34067, a.__webglTexture),
                K(34067, e.texture, h);
                for (d = 0; 6 > d; d++)
                    T(o.__webglFramebuffer[d], e, 36064, 34069 + d);
                y(e.texture, h) && v(34067, e.texture, e.width, e.height),
                t.bindTexture(34067, null)
            } else
                t.bindTexture(3553, a.__webglTexture),
                K(3553, e.texture, h),
                T(o.__webglFramebuffer, e, 36064, 3553),
                y(e.texture, h) && v(3553, e.texture, e.width, e.height),
                t.bindTexture(3553, null);
            e.depthBuffer && D(e)
        }
        ,
        this.updateRenderTargetMipmap = function(A) {
            var e = A.texture;
            if (y(e, C(A) || l)) {
                var o = A.isWebGLCubeRenderTarget ? 34067 : 3553
                  , n = i.get(e).__webglTexture;
                t.bindTexture(o, n),
                v(o, e, A.width, A.height),
                t.bindTexture(o, null)
            }
        }
        ,
        this.updateMultisampleRenderTarget = function(e) {
            if (e.isWebGLMultisampleRenderTarget)
                if (l) {
                    var t = i.get(e);
                    A.bindFramebuffer(36008, t.__webglMultisampledFramebuffer),
                    A.bindFramebuffer(36009, t.__webglFramebuffer);
                    var o = e.width
                      , n = e.height
                      , r = 16384;
                    e.depthBuffer && (r |= 256),
                    e.stencilBuffer && (r |= 1024),
                    A.blitFramebuffer(0, 0, o, n, 0, 0, o, n, r, 9728),
                    A.bindFramebuffer(36160, t.__webglMultisampledFramebuffer)
                } else
                    console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")
        }
        ,
        this.safeSetTexture2D = function(A, e) {
            A && A.isWebGLRenderTarget && (!1 === N && (console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),
            N = !0),
            A = A.texture),
            w(A, e)
        }
        ,
        this.safeSetTextureCube = function(A, e) {
            A && A.isWebGLCubeRenderTarget && (!1 === O && (console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),
            O = !0),
            A = A.texture),
            A && A.isCubeTexture || Array.isArray(A.image) && 6 === A.image.length ? M(A, e) : b(A, e)
        }
    }
    function zi(A, e, t) {
        var i = t.isWebGL2;
        return {
            convert: function(A) {
                var t;
                if (1009 === A)
                    return 5121;
                if (1017 === A)
                    return 32819;
                if (1018 === A)
                    return 32820;
                if (1019 === A)
                    return 33635;
                if (1010 === A)
                    return 5120;
                if (1011 === A)
                    return 5122;
                if (1012 === A)
                    return 5123;
                if (1013 === A)
                    return 5124;
                if (1014 === A)
                    return 5125;
                if (1015 === A)
                    return 5126;
                if (1016 === A)
                    return i ? 5131 : null !== (t = e.get("OES_texture_half_float")) ? t.HALF_FLOAT_OES : null;
                if (1021 === A)
                    return 6406;
                if (1022 === A)
                    return 6407;
                if (1023 === A)
                    return 6408;
                if (1024 === A)
                    return 6409;
                if (1025 === A)
                    return 6410;
                if (1026 === A)
                    return 6402;
                if (1027 === A)
                    return 34041;
                if (1028 === A)
                    return 6403;
                if (1029 === A)
                    return 36244;
                if (1030 === A)
                    return 33319;
                if (1031 === A)
                    return 33320;
                if (1032 === A)
                    return 36248;
                if (1033 === A)
                    return 36249;
                if (33776 === A || 33777 === A || 33778 === A || 33779 === A) {
                    if (null === (t = e.get("WEBGL_compressed_texture_s3tc")))
                        return null;
                    if (33776 === A)
                        return t.COMPRESSED_RGB_S3TC_DXT1_EXT;
                    if (33777 === A)
                        return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;
                    if (33778 === A)
                        return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;
                    if (33779 === A)
                        return t.COMPRESSED_RGBA_S3TC_DXT5_EXT
                }
                if (35840 === A || 35841 === A || 35842 === A || 35843 === A) {
                    if (null === (t = e.get("WEBGL_compressed_texture_pvrtc")))
                        return null;
                    if (35840 === A)
                        return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
                    if (35841 === A)
                        return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
                    if (35842 === A)
                        return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
                    if (35843 === A)
                        return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
                }
                if (36196 === A)
                    return null !== (t = e.get("WEBGL_compressed_texture_etc1")) ? t.COMPRESSED_RGB_ETC1_WEBGL : null;
                if ((37492 === A || 37496 === A) && null !== (t = e.get("WEBGL_compressed_texture_etc"))) {
                    if (37492 === A)
                        return t.COMPRESSED_RGB8_ETC2;
                    if (37496 === A)
                        return t.COMPRESSED_RGBA8_ETC2_EAC
                }
                return 37808 === A || 37809 === A || 37810 === A || 37811 === A || 37812 === A || 37813 === A || 37814 === A || 37815 === A || 37816 === A || 37817 === A || 37818 === A || 37819 === A || 37820 === A || 37821 === A || 37840 === A || 37841 === A || 37842 === A || 37843 === A || 37844 === A || 37845 === A || 37846 === A || 37847 === A || 37848 === A || 37849 === A || 37850 === A || 37851 === A || 37852 === A || 37853 === A ? null !== (t = e.get("WEBGL_compressed_texture_astc")) ? A : null : 36492 === A ? null !== (t = e.get("EXT_texture_compression_bptc")) ? A : null : 1020 === A ? i ? 34042 : null !== (t = e.get("WEBGL_depth_texture")) ? t.UNSIGNED_INT_24_8_WEBGL : null : void 0
            }
        }
    }
    function Zi(A) {
        je.call(this),
        this.cameras = A || []
    }
    function Xi() {
        H.call(this),
        this.type = "Group"
    }
    function _i(A, e) {
        var t = this
          , i = null
          , o = 1
          , n = null
          , r = "local-floor"
          , a = null
          , s = []
          , l = new Map
          , c = new je;
        c.layers.enable(1),
        c.viewport = new p;
        var h = new je;
        h.layers.enable(2),
        h.viewport = new p;
        var d = new Zi([c, h]);
        d.layers.enable(1),
        d.layers.enable(2);
        var g = null
          , u = null;
        function f(A) {
            var e = l.get(A.inputSource);
            e && (e.targetRay && e.targetRay.dispatchEvent({
                type: A.type
            }),
            e.grip && e.grip.dispatchEvent({
                type: A.type
            }))
        }
        function m() {
            l.forEach((function(A, e) {
                A.targetRay && (A.targetRay.dispatchEvent({
                    type: "disconnected",
                    data: e
                }),
                A.targetRay.visible = !1),
                A.grip && (A.grip.dispatchEvent({
                    type: "disconnected",
                    data: e
                }),
                A.grip.visible = !1)
            }
            )),
            l.clear(),
            A.setFramebuffer(null),
            A.setRenderTarget(A.getRenderTarget()),
            S.stop(),
            t.isPresenting = !1,
            t.dispatchEvent({
                type: "sessionend"
            })
        }
        function C(A) {
            n = A,
            S.setContext(i),
            S.start(),
            t.isPresenting = !0,
            t.dispatchEvent({
                type: "sessionstart"
            })
        }
        function v(A) {
            for (var e = i.inputSources, t = 0; s.length > t; t++)
                l.set(e[t], s[t]);
            for (t = 0; A.removed.length > t; t++) {
                (n = l.get(o = A.removed[t])) && (n.targetRay && n.targetRay.dispatchEvent({
                    type: "disconnected",
                    data: o
                }),
                n.grip && n.grip.dispatchEvent({
                    type: "disconnected",
                    data: o
                }),
                l.delete(o))
            }
            for (t = 0; A.added.length > t; t++) {
                var o, n;
                (n = l.get(o = A.added[t])) && (n.targetRay && n.targetRay.dispatchEvent({
                    type: "connected",
                    data: o
                }),
                n.grip && n.grip.dispatchEvent({
                    type: "connected",
                    data: o
                }))
            }
        }
        this.enabled = !1,
        this.isPresenting = !1,
        this.getController = function(A) {
            var e = s[A];
            return void 0 === e && (s[A] = e = {}),
            void 0 === e.targetRay && (e.targetRay = new Xi,
            e.targetRay.matrixAutoUpdate = !1,
            e.targetRay.visible = !1),
            e.targetRay
        }
        ,
        this.getControllerGrip = function(A) {
            var e = s[A];
            return void 0 === e && (s[A] = e = {}),
            void 0 === e.grip && (e.grip = new Xi,
            e.grip.matrixAutoUpdate = !1,
            e.grip.visible = !1),
            e.grip
        }
        ,
        this.setFramebufferScaleFactor = function(A) {
            o = A,
            1 == t.isPresenting && console.warn("WebXRManager: Cannot change framebuffer scale while presenting VR content")
        }
        ,
        this.setReferenceSpaceType = function(A) {
            r = A
        }
        ,
        this.getReferenceSpace = function() {
            return n
        }
        ,
        this.getSession = function() {
            return i
        }
        ,
        this.setSession = function(A) {
            if (null !== (i = A)) {
                i.addEventListener("select", f),
                i.addEventListener("selectstart", f),
                i.addEventListener("selectend", f),
                i.addEventListener("squeeze", f),
                i.addEventListener("squeezestart", f),
                i.addEventListener("squeezeend", f),
                i.addEventListener("end", m);
                var t = e.getContextAttributes()
                  , n = new XRWebGLLayer(i,e,{
                    antialias: t.antialias,
                    alpha: t.alpha,
                    depth: t.depth,
                    stencil: t.stencil,
                    framebufferScaleFactor: o
                });
                i.updateRenderState({
                    baseLayer: n
                }),
                i.requestReferenceSpace(r).then(C),
                i.addEventListener("inputsourceschange", v)
            }
        }
        ;
        var I = new y
          , E = new y;
        function B(A, e) {
            null === e ? A.matrixWorld.copy(A.matrix) : A.matrixWorld.multiplyMatrices(e.matrixWorld, A.matrix),
            A.matrixWorldInverse.getInverse(A.matrixWorld)
        }
        this.getCamera = function(A) {
            d.near = h.near = c.near = A.near,
            d.far = h.far = c.far = A.far,
            g === d.near && u === d.far || (i.updateRenderState({
                depthNear: d.near,
                depthFar: d.far
            }),
            g = d.near,
            u = d.far);
            var e = A.parent
              , t = d.cameras;
            B(d, e);
            for (var o = 0; t.length > o; o++)
                B(t[o], e);
            A.matrixWorld.copy(d.matrixWorld);
            for (var n = A.children, r = (o = 0,
            n.length); r > o; o++)
                n[o].updateMatrixWorld(!0);
            return function(A, e, t) {
                I.setFromMatrixPosition(e.matrixWorld),
                E.setFromMatrixPosition(t.matrixWorld);
                var i = I.distanceTo(E)
                  , o = e.projectionMatrix.elements
                  , n = t.projectionMatrix.elements
                  , r = o[14] / (o[10] - 1)
                  , a = o[14] / (o[10] + 1)
                  , s = (o[9] + 1) / o[5]
                  , l = (o[9] - 1) / o[5]
                  , c = (o[8] - 1) / o[0]
                  , h = (n[8] + 1) / n[0]
                  , d = r * c
                  , p = r * h
                  , g = i / (-c + h)
                  , u = g * -c;
                e.matrixWorld.decompose(A.position, A.quaternion, A.scale),
                A.translateX(u),
                A.translateZ(g),
                A.matrixWorld.compose(A.position, A.quaternion, A.scale),
                A.matrixWorldInverse.getInverse(A.matrixWorld);
                var f = r + g
                  , m = a + g;
                A.projectionMatrix.makePerspective(d - u, p + (i - u), s * a / m * f, l * a / m * f, f, m)
            }(d, c, h),
            d
        }
        ;
        var x = null;
        var S = new _e;
        S.setAnimationLoop((function(e, t) {
            if (null !== (a = t.getViewerPose(n))) {
                var o = a.views
                  , r = i.renderState.baseLayer;
                A.setFramebuffer(r.framebuffer);
                for (var l = 0; o.length > l; l++) {
                    var c = o[l]
                      , h = r.getViewport(c)
                      , p = d.cameras[l];
                    p.matrix.fromArray(c.transform.matrix),
                    p.projectionMatrix.fromArray(c.projectionMatrix),
                    p.viewport.set(h.x, h.y, h.width, h.height),
                    0 === l && d.matrix.copy(p.matrix)
                }
            }
            var g = i.inputSources;
            for (l = 0; s.length > l; l++) {
                var u = s[l]
                  , f = g[l]
                  , m = null
                  , C = null;
                f && (u.targetRay && null !== (m = t.getPose(f.targetRaySpace, n)) && (u.targetRay.matrix.fromArray(m.transform.matrix),
                u.targetRay.matrix.decompose(u.targetRay.position, u.targetRay.rotation, u.targetRay.scale)),
                u.grip && f.gripSpace && null !== (C = t.getPose(f.gripSpace, n)) && (u.grip.matrix.fromArray(C.transform.matrix),
                u.grip.matrix.decompose(u.grip.position, u.grip.rotation, u.grip.scale))),
                u.targetRay && (u.targetRay.visible = null !== m),
                u.grip && (u.grip.visible = null !== C)
            }
            x && x(e, t)
        }
        )),
        this.setAnimationLoop = function(A) {
            x = A
        }
        ,
        this.dispose = function() {}
    }
    function $i(A) {
        var e = void 0 !== (A = A || {}).canvas ? A.canvas : document.createElementNS("http://www.w3.org/1999/xhtml", "canvas")
          , t = void 0 !== A.context ? A.context : null
          , i = void 0 !== A.alpha && A.alpha
          , o = void 0 === A.depth || A.depth
          , n = void 0 === A.stencil || A.stencil
          , r = void 0 !== A.antialias && A.antialias
          , l = void 0 === A.premultipliedAlpha || A.premultipliedAlpha
          , c = void 0 !== A.preserveDrawingBuffer && A.preserveDrawingBuffer
          , h = void 0 !== A.powerPreference ? A.powerPreference : "default"
          , d = void 0 !== A.failIfMajorPerformanceCaveat && A.failIfMajorPerformanceCaveat
          , g = null
          , u = null;
        this.domElement = e,
        this.debug = {
            checkShaderErrors: !0
        },
        this.autoClear = !0,
        this.autoClearColor = !0,
        this.autoClearDepth = !0,
        this.autoClearStencil = !0,
        this.sortObjects = !0,
        this.clippingPlanes = [],
        this.localClippingEnabled = !1,
        this.gammaFactor = 2,
        this.outputEncoding = 3e3,
        this.physicallyCorrectLights = !1,
        this.toneMapping = 1,
        this.toneMappingExposure = 1,
        this.toneMappingWhitePoint = 1,
        this.maxMorphTargets = 8,
        this.maxMorphNormals = 4;
        var f, m, C, v, I, E, B, x, S, w, b, U, F, K, Q, R, T, k, D = this, L = !1, N = null, O = 0, V = 0, G = null, P = null, q = -1, j = {
            geometry: null,
            program: null,
            wireframe: !1
        }, H = null, W = null, J = new p, z = new p, Z = null, X = e.width, _ = e.height, $ = 1, AA = null, eA = null, tA = new p(0,0,X,_), iA = new p(0,0,X,_), oA = !1, nA = new Ze, rA = new at, aA = !1, sA = !1, lA = new M, cA = new y;
        function hA() {
            return null === G ? $ : 1
        }
        try {
            var dA = {
                alpha: i,
                depth: o,
                stencil: n,
                antialias: r,
                premultipliedAlpha: l,
                preserveDrawingBuffer: c,
                powerPreference: h,
                failIfMajorPerformanceCaveat: d,
                xrCompatible: !0
            };
            if (e.addEventListener("webglcontextlost", fA, !1),
            e.addEventListener("webglcontextrestored", mA, !1),
            null === (f = t || e.getContext("webgl", dA) || e.getContext("experimental-webgl", dA)))
                throw null !== e.getContext("webgl") ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context.");
            void 0 === f.getShaderPrecisionFormat && (f.getShaderPrecisionFormat = function() {
                return {
                    rangeMin: 1,
                    rangeMax: 1,
                    precision: 1
                }
            }
            )
        } catch (A) {
            throw console.error("THREE.WebGLRenderer: " + A.message),
            A
        }
        function pA() {
            m = new st(f),
            !1 === (C = new rt(f,m,A)).isWebGL2 && (m.get("WEBGL_depth_texture"),
            m.get("OES_texture_float"),
            m.get("OES_texture_half_float"),
            m.get("OES_texture_half_float_linear"),
            m.get("OES_standard_derivatives"),
            m.get("OES_element_index_uint"),
            m.get("ANGLE_instanced_arrays")),
            m.get("OES_texture_float_linear"),
            k = new zi(f,m,C),
            (v = new Wi(f,m,C)).scissor(z.copy(iA).multiplyScalar($).floor()),
            v.viewport(J.copy(tA).multiplyScalar($).floor()),
            I = new ht(f),
            E = new Ri,
            B = new Ji(f,m,v,E,C,k,I),
            x = new $e(f,C),
            S = new lt(f,x,I),
            w = new gt(f,S,x,I),
            Q = new pt(f),
            b = new Qi(D,m,C),
            U = new Li,
            F = new qi,
            K = new ot(D,v,w,l),
            R = new nt(f,m,I,C),
            T = new ct(f,m,I,C),
            I.programs = b.programs,
            D.capabilities = C,
            D.extensions = m,
            D.properties = E,
            D.renderLists = U,
            D.state = v,
            D.info = I
        }
        pA();
        var gA = new _i(D,f);
        this.xr = gA;
        var uA = new Yi(D,w,C.maxTextureSize);
        function fA(A) {
            A.preventDefault(),
            console.log("THREE.WebGLRenderer: Context Lost."),
            L = !0
        }
        function mA() {
            console.log("THREE.WebGLRenderer: Context Restored."),
            L = !1,
            pA()
        }
        function CA(A) {
            var e = A.target;
            e.removeEventListener("dispose", CA),
            function(A) {
                yA(A),
                E.remove(A)
            }(e)
        }
        function yA(A) {
            var e = E.get(A).program;
            A.program = void 0,
            void 0 !== e && b.releaseProgram(e)
        }
        this.shadowMap = uA,
        this.getContext = function() {
            return f
        }
        ,
        this.getContextAttributes = function() {
            return f.getContextAttributes()
        }
        ,
        this.forceContextLoss = function() {
            var A = m.get("WEBGL_lose_context");
            A && A.loseContext()
        }
        ,
        this.forceContextRestore = function() {
            var A = m.get("WEBGL_lose_context");
            A && A.restoreContext()
        }
        ,
        this.getPixelRatio = function() {
            return $
        }
        ,
        this.setPixelRatio = function(A) {
            void 0 !== A && ($ = A,
            this.setSize(X, _, !1))
        }
        ,
        this.getSize = function(A) {
            return void 0 === A && (console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),
            A = new s),
            A.set(X, _)
        }
        ,
        this.setSize = function(A, t, i) {
            gA.isPresenting ? console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.") : (X = A,
            _ = t,
            e.width = Math.floor(A * $),
            e.height = Math.floor(t * $),
            !1 !== i && (e.style.width = A + "px",
            e.style.height = t + "px"),
            this.setViewport(0, 0, A, t))
        }
        ,
        this.getDrawingBufferSize = function(A) {
            return void 0 === A && (console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),
            A = new s),
            A.set(X * $, _ * $).floor()
        }
        ,
        this.setDrawingBufferSize = function(A, t, i) {
            X = A,
            _ = t,
            $ = i,
            e.width = Math.floor(A * i),
            e.height = Math.floor(t * i),
            this.setViewport(0, 0, A, t)
        }
        ,
        this.getCurrentViewport = function(A) {
            return void 0 === A && (console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),
            A = new p),
            A.copy(J)
        }
        ,
        this.getViewport = function(A) {
            return A.copy(tA)
        }
        ,
        this.setViewport = function(A, e, t, i) {
            A.isVector4 ? tA.set(A.x, A.y, A.z, A.w) : tA.set(A, e, t, i),
            v.viewport(J.copy(tA).multiplyScalar($).floor())
        }
        ,
        this.getScissor = function(A) {
            return A.copy(iA)
        }
        ,
        this.setScissor = function(A, e, t, i) {
            A.isVector4 ? iA.set(A.x, A.y, A.z, A.w) : iA.set(A, e, t, i),
            v.scissor(z.copy(iA).multiplyScalar($).floor())
        }
        ,
        this.getScissorTest = function() {
            return oA
        }
        ,
        this.setScissorTest = function(A) {
            v.setScissorTest(oA = A)
        }
        ,
        this.setOpaqueSort = function(A) {
            AA = A
        }
        ,
        this.setTransparentSort = function(A) {
            eA = A
        }
        ,
        this.getClearColor = function() {
            return K.getClearColor()
        }
        ,
        this.setClearColor = function() {
            K.setClearColor.apply(K, arguments)
        }
        ,
        this.getClearAlpha = function() {
            return K.getClearAlpha()
        }
        ,
        this.setClearAlpha = function() {
            K.setClearAlpha.apply(K, arguments)
        }
        ,
        this.clear = function(A, e, t) {
            var i = 0;
            (void 0 === A || A) && (i |= 16384),
            (void 0 === e || e) && (i |= 256),
            (void 0 === t || t) && (i |= 1024),
            f.clear(i)
        }
        ,
        this.clearColor = function() {
            this.clear(!0, !1, !1)
        }
        ,
        this.clearDepth = function() {
            this.clear(!1, !0, !1)
        }
        ,
        this.clearStencil = function() {
            this.clear(!1, !1, !0)
        }
        ,
        this.dispose = function() {
            e.removeEventListener("webglcontextlost", fA, !1),
            e.removeEventListener("webglcontextrestored", mA, !1),
            U.dispose(),
            F.dispose(),
            E.dispose(),
            w.dispose(),
            gA.dispose(),
            EA.stop(),
            this.forceContextLoss()
        }
        ,
        this.renderBufferImmediate = function(A, e) {
            v.initAttributes();
            var t = E.get(A);
            A.hasPositions && !t.position && (t.position = f.createBuffer()),
            A.hasNormals && !t.normal && (t.normal = f.createBuffer()),
            A.hasUvs && !t.uv && (t.uv = f.createBuffer()),
            A.hasColors && !t.color && (t.color = f.createBuffer());
            var i = e.getAttributes();
            A.hasPositions && (f.bindBuffer(34962, t.position),
            f.bufferData(34962, A.positionArray, 35048),
            v.enableAttribute(i.position),
            f.vertexAttribPointer(i.position, 3, 5126, !1, 0, 0)),
            A.hasNormals && (f.bindBuffer(34962, t.normal),
            f.bufferData(34962, A.normalArray, 35048),
            v.enableAttribute(i.normal),
            f.vertexAttribPointer(i.normal, 3, 5126, !1, 0, 0)),
            A.hasUvs && (f.bindBuffer(34962, t.uv),
            f.bufferData(34962, A.uvArray, 35048),
            v.enableAttribute(i.uv),
            f.vertexAttribPointer(i.uv, 2, 5126, !1, 0, 0)),
            A.hasColors && (f.bindBuffer(34962, t.color),
            f.bufferData(34962, A.colorArray, 35048),
            v.enableAttribute(i.color),
            f.vertexAttribPointer(i.color, 3, 5126, !1, 0, 0)),
            v.disableUnusedAttributes(),
            f.drawArrays(4, 0, A.count),
            A.count = 0
        }
        ;
        var vA = new Y;
        this.renderBufferDirect = function(A, e, t, i, o, n) {
            null === e && (e = vA);
            var r = o.isMesh && 0 > o.matrixWorld.determinant()
              , a = MA(A, e, i, o);
            v.setMaterial(i, r);
            var s = !1;
            j.geometry === t.id && j.program === a.id && j.wireframe === (!0 === i.wireframe) || (j.geometry = t.id,
            j.program = a.id,
            j.wireframe = !0 === i.wireframe,
            s = !0),
            (i.morphTargets || i.morphNormals) && (Q.update(o, t, i, a),
            s = !0);
            var l = t.index
              , c = t.attributes.position;
            if (null === l) {
                if (void 0 === c || 0 === c.count)
                    return
            } else if (0 === l.count)
                return;
            var h, d = 1;
            !0 === i.wireframe && (l = S.getWireframeAttribute(t),
            d = 2);
            var p = R;
            null !== l && (h = x.get(l),
            (p = T).setIndex(h)),
            s && (!function(A, e, t, i) {
                if (!1 === C.isWebGL2 && (A.isInstancedMesh || e.isInstancedBufferGeometry) && null === m.get("ANGLE_instanced_arrays"))
                    return;
                v.initAttributes();
                var o = e.attributes
                  , n = i.getAttributes()
                  , r = t.defaultAttributeValues;
                for (var a in n) {
                    var s = n[a];
                    if (s >= 0) {
                        var l = o[a];
                        if (void 0 !== l) {
                            var c = l.normalized
                              , h = l.itemSize;
                            if (void 0 === (E = x.get(l)))
                                continue;
                            var d = E.buffer
                              , p = E.type
                              , g = E.bytesPerElement;
                            if (l.isInterleavedBufferAttribute) {
                                var u = l.data
                                  , y = u.stride
                                  , I = l.offset;
                                u && u.isInstancedInterleavedBuffer ? (v.enableAttributeAndDivisor(s, u.meshPerAttribute),
                                void 0 === e.maxInstancedCount && (e.maxInstancedCount = u.meshPerAttribute * u.count)) : v.enableAttribute(s),
                                f.bindBuffer(34962, d),
                                f.vertexAttribPointer(s, h, p, c, y * g, I * g)
                            } else
                                l.isInstancedBufferAttribute ? (v.enableAttributeAndDivisor(s, l.meshPerAttribute),
                                void 0 === e.maxInstancedCount && (e.maxInstancedCount = l.meshPerAttribute * l.count)) : v.enableAttribute(s),
                                f.bindBuffer(34962, d),
                                f.vertexAttribPointer(s, h, p, c, 0, 0)
                        } else if ("instanceMatrix" === a) {
                            var E;
                            if (void 0 === (E = x.get(A.instanceMatrix)))
                                continue;
                            d = E.buffer,
                            p = E.type;
                            v.enableAttributeAndDivisor(s + 0, 1),
                            v.enableAttributeAndDivisor(s + 1, 1),
                            v.enableAttributeAndDivisor(s + 2, 1),
                            v.enableAttributeAndDivisor(s + 3, 1),
                            f.bindBuffer(34962, d),
                            f.vertexAttribPointer(s + 0, 4, p, !1, 64, 0),
                            f.vertexAttribPointer(s + 1, 4, p, !1, 64, 16),
                            f.vertexAttribPointer(s + 2, 4, p, !1, 64, 32),
                            f.vertexAttribPointer(s + 3, 4, p, !1, 64, 48)
                        } else if (void 0 !== r) {
                            var B = r[a];
                            if (void 0 !== B)
                                switch (B.length) {
                                case 2:
                                    f.vertexAttrib2fv(s, B);
                                    break;
                                case 3:
                                    f.vertexAttrib3fv(s, B);
                                    break;
                                case 4:
                                    f.vertexAttrib4fv(s, B);
                                    break;
                                default:
                                    f.vertexAttrib1fv(s, B)
                                }
                        }
                    }
                }
                v.disableUnusedAttributes()
            }(o, t, i, a),
            null !== l && f.bindBuffer(34963, h.buffer));
            var g = null !== l ? l.count : c.count
              , u = t.drawRange.start * d
              , y = t.drawRange.count * d
              , I = null !== n ? n.start * d : 0
              , E = null !== n ? n.count * d : 1 / 0
              , B = Math.max(u, I)
              , w = Math.min(g, u + y, I + E) - 1
              , M = Math.max(0, w - B + 1);
            if (0 !== M) {
                if (o.isMesh)
                    !0 === i.wireframe ? (v.setLineWidth(i.wireframeLinewidth * hA()),
                    p.setMode(1)) : p.setMode(4);
                else if (o.isLine) {
                    var b = i.linewidth;
                    void 0 === b && (b = 1),
                    v.setLineWidth(b * hA()),
                    p.setMode(o.isLineSegments ? 1 : o.isLineLoop ? 2 : 3)
                } else
                    o.isPoints ? p.setMode(0) : o.isSprite && p.setMode(4);
                o.isInstancedMesh ? p.renderInstances(t, B, M, o.count) : t.isInstancedBufferGeometry ? p.renderInstances(t, B, M, t.maxInstancedCount) : p.render(B, M)
            }
        }
        ,
        this.compile = function(A, e) {
            (u = F.get(A, e)).init(),
            A.traverse((function(A) {
                A.isLight && (u.pushLight(A),
                A.castShadow && u.pushShadow(A))
            }
            )),
            u.setupLights(e);
            var t = {};
            A.traverse((function(e) {
                if (e.material)
                    if (Array.isArray(e.material))
                        for (var i = 0; e.material.length > i; i++)
                            e.material[i].uuid in t == !1 && (wA(e.material[i], A, e),
                            t[e.material[i].uuid] = !0);
                    else
                        e.material.uuid in t == !1 && (wA(e.material, A, e),
                        t[e.material.uuid] = !0)
            }
            ))
        }
        ;
        var IA = null;
        var EA = new _e;
        function BA(A, e, t, i) {
            if (!1 !== A.visible) {
                if (A.layers.test(e.layers))
                    if (A.isGroup)
                        t = A.renderOrder;
                    else if (A.isLOD)
                        !0 === A.autoUpdate && A.update(e);
                    else if (A.isLight)
                        u.pushLight(A),
                        A.castShadow && u.pushShadow(A);
                    else if (A.isSprite) {
                        if (!A.frustumCulled || nA.intersectsSprite(A)) {
                            i && cA.setFromMatrixPosition(A.matrixWorld).applyMatrix4(lA);
                            var o = w.update(A);
                            (n = A.material).visible && g.push(A, o, n, t, cA.z, null)
                        }
                    } else if (A.isImmediateRenderObject)
                        i && cA.setFromMatrixPosition(A.matrixWorld).applyMatrix4(lA),
                        g.push(A, null, A.material, t, cA.z, null);
                    else if ((A.isMesh || A.isLine || A.isPoints) && (A.isSkinnedMesh && A.skeleton.frame !== I.render.frame && (A.skeleton.update(),
                    A.skeleton.frame = I.render.frame),
                    !A.frustumCulled || nA.intersectsObject(A))) {
                        i && cA.setFromMatrixPosition(A.matrixWorld).applyMatrix4(lA);
                        o = w.update(A);
                        var n = A.material;
                        if (Array.isArray(n))
                            for (var r = o.groups, a = 0, s = r.length; s > a; a++) {
                                var l = r[a]
                                  , c = n[l.materialIndex];
                                c && c.visible && g.push(A, o, c, t, cA.z, l)
                            }
                        else
                            n.visible && g.push(A, o, n, t, cA.z, null)
                    }
                var h = A.children;
                for (a = 0,
                s = h.length; s > a; a++)
                    BA(h[a], e, t, i)
            }
        }
        function xA(A, e, t, i) {
            for (var o = 0, n = A.length; n > o; o++) {
                var r = A[o]
                  , a = r.object
                  , s = r.geometry
                  , l = void 0 === i ? r.material : i
                  , c = r.group;
                if (t.isArrayCamera) {
                    W = t;
                    for (var h = t.cameras, d = 0, p = h.length; p > d; d++) {
                        var g = h[d];
                        a.layers.test(g.layers) && (v.viewport(J.copy(g.viewport)),
                        u.setupLights(g),
                        SA(a, e, g, s, l, c))
                    }
                } else
                    W = null,
                    SA(a, e, t, s, l, c)
            }
        }
        function SA(A, e, t, i, o, n) {
            if (A.onBeforeRender(D, e, t, i, o, n),
            u = F.get(e, W || t),
            A.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse, A.matrixWorld),
            A.normalMatrix.getNormalMatrix(A.modelViewMatrix),
            A.isImmediateRenderObject) {
                var r = MA(t, e, o, A);
                v.setMaterial(o),
                j.geometry = null,
                j.program = null,
                j.wireframe = !1,
                function(A, e) {
                    A.render((function(A) {
                        D.renderBufferImmediate(A, e)
                    }
                    ))
                }(A, r)
            } else
                D.renderBufferDirect(t, e, i, o, A, n);
            A.onAfterRender(D, e, t, i, o, n),
            u = F.get(e, W || t)
        }
        function wA(A, e, t) {
            var i = E.get(A)
              , o = u.state.lights
              , n = o.state.version
              , r = b.getParameters(A, o.state, u.state.shadowsArray, e, rA.numPlanes, rA.numIntersection, t)
              , a = b.getProgramCacheKey(r)
              , s = i.program
              , l = !0;
            if (void 0 === s)
                A.addEventListener("dispose", CA);
            else if (s.cacheKey !== a)
                yA(A);
            else if (i.lightsStateVersion !== n)
                i.lightsStateVersion = n,
                l = !1;
            else {
                if (void 0 !== r.shaderID)
                    return;
                l = !1
            }
            l && (s = b.acquireProgram(r, a),
            i.program = s,
            i.uniforms = r.uniforms,
            i.environment = A.isMeshStandardMaterial ? e.environment : null,
            i.outputEncoding = D.outputEncoding,
            A.program = s);
            var c = s.getAttributes();
            if (A.morphTargets) {
                A.numSupportedMorphTargets = 0;
                for (var h = 0; D.maxMorphTargets > h; h++)
                    0 > c["morphTarget" + h] || A.numSupportedMorphTargets++
            }
            if (A.morphNormals) {
                A.numSupportedMorphNormals = 0;
                for (h = 0; D.maxMorphNormals > h; h++)
                    0 > c["morphNormal" + h] || A.numSupportedMorphNormals++
            }
            var d = i.uniforms;
            (A.isShaderMaterial || A.isRawShaderMaterial) && !0 !== A.clipping || (i.numClippingPlanes = rA.numPlanes,
            i.numIntersection = rA.numIntersection,
            d.clippingPlanes = rA.uniform),
            i.fog = e.fog,
            i.needsLights = function(A) {
                return A.isMeshLambertMaterial || A.isMeshToonMaterial || A.isMeshPhongMaterial || A.isMeshStandardMaterial || A.isShadowMaterial || A.isShaderMaterial && !0 === A.lights
            }(A),
            i.lightsStateVersion = n,
            i.needsLights && (d.ambientLightColor.value = o.state.ambient,
            d.lightProbe.value = o.state.probe,
            d.directionalLights.value = o.state.directional,
            d.directionalLightShadows.value = o.state.directionalShadow,
            d.spotLights.value = o.state.spot,
            d.spotLightShadows.value = o.state.spotShadow,
            d.rectAreaLights.value = o.state.rectArea,
            d.pointLights.value = o.state.point,
            d.pointLightShadows.value = o.state.pointShadow,
            d.hemisphereLights.value = o.state.hemi,
            d.directionalShadowMap.value = o.state.directionalShadowMap,
            d.directionalShadowMatrix.value = o.state.directionalShadowMatrix,
            d.spotShadowMap.value = o.state.spotShadowMap,
            d.spotShadowMatrix.value = o.state.spotShadowMatrix,
            d.pointShadowMap.value = o.state.pointShadowMap,
            d.pointShadowMatrix.value = o.state.pointShadowMatrix);
            var p = i.program.getUniforms()
              , g = di.seqWithValue(p.seq, d);
            i.uniformsList = g
        }
        function MA(A, e, t, i) {
            B.resetTextureUnits();
            var o = e.fog
              , n = t.isMeshStandardMaterial ? e.environment : null
              , r = E.get(t)
              , s = u.state.lights;
            aA && ((sA || A !== H) && rA.setState(t.clippingPlanes, t.clipIntersection, t.clipShadows, A, r, A === H && t.id === q));
            t.version === r.__version ? void 0 === r.program || t.fog && r.fog !== o || r.environment !== n || r.needsLights && r.lightsStateVersion !== s.state.version ? wA(t, e, i) : void 0 === r.numClippingPlanes || r.numClippingPlanes === rA.numPlanes && r.numIntersection === rA.numIntersection ? r.outputEncoding !== D.outputEncoding && wA(t, e, i) : wA(t, e, i) : (wA(t, e, i),
            r.__version = t.version);
            var l, c, h = !1, d = !1, p = !1, g = r.program, m = g.getUniforms(), y = r.uniforms;
            if (v.useProgram(g.program) && (h = !0,
            d = !0,
            p = !0),
            t.id !== q && (q = t.id,
            d = !0),
            h || H !== A) {
                if (m.setValue(f, "projectionMatrix", A.projectionMatrix),
                C.logarithmicDepthBuffer && m.setValue(f, "logDepthBufFC", 2 / (Math.log(A.far + 1) / Math.LN2)),
                H !== A && (H = A,
                d = !0,
                p = !0),
                t.isShaderMaterial || t.isMeshPhongMaterial || t.isMeshToonMaterial || t.isMeshStandardMaterial || t.envMap) {
                    var I = m.map.cameraPosition;
                    void 0 !== I && I.setValue(f, cA.setFromMatrixPosition(A.matrixWorld))
                }
                (t.isMeshPhongMaterial || t.isMeshToonMaterial || t.isMeshLambertMaterial || t.isMeshBasicMaterial || t.isMeshStandardMaterial || t.isShaderMaterial) && m.setValue(f, "isOrthographic", !0 === A.isOrthographicCamera),
                (t.isMeshPhongMaterial || t.isMeshToonMaterial || t.isMeshLambertMaterial || t.isMeshBasicMaterial || t.isMeshStandardMaterial || t.isShaderMaterial || t.skinning) && m.setValue(f, "viewMatrix", A.matrixWorldInverse)
            }
            if (t.skinning) {
                m.setOptional(f, i, "bindMatrix"),
                m.setOptional(f, i, "bindMatrixInverse");
                var x = i.skeleton;
                if (x)
                    if (C.floatVertexTextures) {
                        if (void 0 === x.boneTexture) {
                            var S = Math.sqrt(4 * x.bones.length);
                            S = a.ceilPowerOfTwo(S),
                            S = Math.max(S, 4);
                            var w = new Float32Array(S * S * 4);
                            w.set(x.boneMatrices);
                            var M = new We(w,S,S,1023,1015);
                            x.boneMatrices = w,
                            x.boneTexture = M,
                            x.boneTextureSize = S
                        }
                        m.setValue(f, "boneTexture", x.boneTexture, B),
                        m.setValue(f, "boneTextureSize", x.boneTextureSize)
                    } else
                        m.setOptional(f, x, "boneMatrices")
            }
            return (d || r.receiveShadow !== i.receiveShadow) && (r.receiveShadow = i.receiveShadow,
            m.setValue(f, "receiveShadow", i.receiveShadow)),
            d && (m.setValue(f, "toneMappingExposure", D.toneMappingExposure),
            m.setValue(f, "toneMappingWhitePoint", D.toneMappingWhitePoint),
            r.needsLights && ((l = y).ambientLightColor.needsUpdate = c = p,
            l.lightProbe.needsUpdate = c,
            l.directionalLights.needsUpdate = c,
            l.directionalLightShadows.needsUpdate = c,
            l.pointLights.needsUpdate = c,
            l.pointLightShadows.needsUpdate = c,
            l.spotLights.needsUpdate = c,
            l.spotLightShadows.needsUpdate = c,
            l.rectAreaLights.needsUpdate = c,
            l.hemisphereLights.needsUpdate = c),
            o && t.fog && function(A, e) {
                A.fogColor.value.copy(e.color),
                e.isFog ? (A.fogNear.value = e.near,
                A.fogFar.value = e.far) : e.isFogExp2 && (A.fogDensity.value = e.density)
            }(y, o),
            t.isMeshBasicMaterial ? bA(y, t) : t.isMeshLambertMaterial ? (bA(y, t),
            function(A, e) {
                e.emissiveMap && (A.emissiveMap.value = e.emissiveMap)
            }(y, t)) : t.isMeshToonMaterial ? (bA(y, t),
            function(A, e) {
                A.specular.value.copy(e.specular),
                A.shininess.value = Math.max(e.shininess, 1e-4),
                e.gradientMap && (A.gradientMap.value = e.gradientMap);
                e.emissiveMap && (A.emissiveMap.value = e.emissiveMap);
                e.bumpMap && (A.bumpMap.value = e.bumpMap,
                A.bumpScale.value = e.bumpScale,
                1 === e.side && (A.bumpScale.value *= -1));
                e.normalMap && (A.normalMap.value = e.normalMap,
                A.normalScale.value.copy(e.normalScale),
                1 === e.side && A.normalScale.value.negate());
                e.displacementMap && (A.displacementMap.value = e.displacementMap,
                A.displacementScale.value = e.displacementScale,
                A.displacementBias.value = e.displacementBias)
            }(y, t)) : t.isMeshPhongMaterial ? (bA(y, t),
            function(A, e) {
                A.specular.value.copy(e.specular),
                A.shininess.value = Math.max(e.shininess, 1e-4),
                e.emissiveMap && (A.emissiveMap.value = e.emissiveMap);
                e.bumpMap && (A.bumpMap.value = e.bumpMap,
                A.bumpScale.value = e.bumpScale,
                1 === e.side && (A.bumpScale.value *= -1));
                e.normalMap && (A.normalMap.value = e.normalMap,
                A.normalScale.value.copy(e.normalScale),
                1 === e.side && A.normalScale.value.negate());
                e.displacementMap && (A.displacementMap.value = e.displacementMap,
                A.displacementScale.value = e.displacementScale,
                A.displacementBias.value = e.displacementBias)
            }(y, t)) : t.isMeshStandardMaterial ? (bA(y, t, n),
            t.isMeshPhysicalMaterial ? function(A, e, t) {
                UA(A, e, t),
                A.reflectivity.value = e.reflectivity,
                A.clearcoat.value = e.clearcoat,
                A.clearcoatRoughness.value = e.clearcoatRoughness,
                e.sheen && A.sheen.value.copy(e.sheen);
                e.clearcoatMap && (A.clearcoatMap.value = e.clearcoatMap);
                e.clearcoatRoughnessMap && (A.clearcoatRoughnessMap.value = e.clearcoatRoughnessMap);
                e.clearcoatNormalMap && (A.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),
                A.clearcoatNormalMap.value = e.clearcoatNormalMap,
                1 === e.side && A.clearcoatNormalScale.value.negate());
                A.transparency.value = e.transparency
            }(y, t, n) : UA(y, t, n)) : t.isMeshMatcapMaterial ? (bA(y, t),
            function(A, e) {
                e.matcap && (A.matcap.value = e.matcap);
                e.bumpMap && (A.bumpMap.value = e.bumpMap,
                A.bumpScale.value = e.bumpScale,
                1 === e.side && (A.bumpScale.value *= -1));
                e.normalMap && (A.normalMap.value = e.normalMap,
                A.normalScale.value.copy(e.normalScale),
                1 === e.side && A.normalScale.value.negate());
                e.displacementMap && (A.displacementMap.value = e.displacementMap,
                A.displacementScale.value = e.displacementScale,
                A.displacementBias.value = e.displacementBias)
            }(y, t)) : t.isMeshDepthMaterial ? (bA(y, t),
            function(A, e) {
                e.displacementMap && (A.displacementMap.value = e.displacementMap,
                A.displacementScale.value = e.displacementScale,
                A.displacementBias.value = e.displacementBias)
            }(y, t)) : t.isMeshDistanceMaterial ? (bA(y, t),
            function(A, e) {
                e.displacementMap && (A.displacementMap.value = e.displacementMap,
                A.displacementScale.value = e.displacementScale,
                A.displacementBias.value = e.displacementBias);
                A.referencePosition.value.copy(e.referencePosition),
                A.nearDistance.value = e.nearDistance,
                A.farDistance.value = e.farDistance
            }(y, t)) : t.isMeshNormalMaterial ? (bA(y, t),
            function(A, e) {
                e.bumpMap && (A.bumpMap.value = e.bumpMap,
                A.bumpScale.value = e.bumpScale,
                1 === e.side && (A.bumpScale.value *= -1));
                e.normalMap && (A.normalMap.value = e.normalMap,
                A.normalScale.value.copy(e.normalScale),
                1 === e.side && A.normalScale.value.negate());
                e.displacementMap && (A.displacementMap.value = e.displacementMap,
                A.displacementScale.value = e.displacementScale,
                A.displacementBias.value = e.displacementBias)
            }(y, t)) : t.isLineBasicMaterial ? (function(A, e) {
                A.diffuse.value.copy(e.color),
                A.opacity.value = e.opacity
            }(y, t),
            t.isLineDashedMaterial && function(A, e) {
                A.dashSize.value = e.dashSize,
                A.totalSize.value = e.dashSize + e.gapSize,
                A.scale.value = e.scale
            }(y, t)) : t.isPointsMaterial ? function(A, e) {
                A.diffuse.value.copy(e.color),
                A.opacity.value = e.opacity,
                A.size.value = e.size * $,
                A.scale.value = .5 * _,
                e.map && (A.map.value = e.map);
                e.alphaMap && (A.alphaMap.value = e.alphaMap);
                var t;
                e.map ? t = e.map : e.alphaMap && (t = e.alphaMap);
                void 0 !== t && (!0 === t.matrixAutoUpdate && t.updateMatrix(),
                A.uvTransform.value.copy(t.matrix))
            }(y, t) : t.isSpriteMaterial ? function(A, e) {
                A.diffuse.value.copy(e.color),
                A.opacity.value = e.opacity,
                A.rotation.value = e.rotation,
                e.map && (A.map.value = e.map);
                e.alphaMap && (A.alphaMap.value = e.alphaMap);
                var t;
                e.map ? t = e.map : e.alphaMap && (t = e.alphaMap);
                void 0 !== t && (!0 === t.matrixAutoUpdate && t.updateMatrix(),
                A.uvTransform.value.copy(t.matrix))
            }(y, t) : t.isShadowMaterial && (y.color.value.copy(t.color),
            y.opacity.value = t.opacity),
            void 0 !== y.ltc_1 && (y.ltc_1.value = Xe.LTC_1),
            void 0 !== y.ltc_2 && (y.ltc_2.value = Xe.LTC_2),
            di.upload(f, r.uniformsList, y, B),
            t.isShaderMaterial && (t.uniformsNeedUpdate = !1)),
            t.isShaderMaterial && !0 === t.uniformsNeedUpdate && (di.upload(f, r.uniformsList, y, B),
            t.uniformsNeedUpdate = !1),
            t.isSpriteMaterial && m.setValue(f, "center", i.center),
            m.setValue(f, "modelViewMatrix", i.modelViewMatrix),
            m.setValue(f, "normalMatrix", i.normalMatrix),
            m.setValue(f, "modelMatrix", i.matrixWorld),
            g
        }
        function bA(A, e, t) {
            A.opacity.value = e.opacity,
            e.color && A.diffuse.value.copy(e.color),
            e.emissive && A.emissive.value.copy(e.emissive).multiplyScalar(e.emissiveIntensity),
            e.map && (A.map.value = e.map),
            e.alphaMap && (A.alphaMap.value = e.alphaMap),
            e.specularMap && (A.specularMap.value = e.specularMap);
            var i, o, n = e.envMap || t;
            n && (A.envMap.value = n,
            A.flipEnvMap.value = n.isCubeTexture ? -1 : 1,
            A.reflectivity.value = e.reflectivity,
            A.refractionRatio.value = e.refractionRatio,
            A.maxMipLevel.value = E.get(n).__maxMipLevel),
            e.lightMap && (A.lightMap.value = e.lightMap,
            A.lightMapIntensity.value = e.lightMapIntensity),
            e.aoMap && (A.aoMap.value = e.aoMap,
            A.aoMapIntensity.value = e.aoMapIntensity),
            e.map ? i = e.map : e.specularMap ? i = e.specularMap : e.displacementMap ? i = e.displacementMap : e.normalMap ? i = e.normalMap : e.bumpMap ? i = e.bumpMap : e.roughnessMap ? i = e.roughnessMap : e.metalnessMap ? i = e.metalnessMap : e.alphaMap ? i = e.alphaMap : e.emissiveMap && (i = e.emissiveMap),
            void 0 !== i && (i.isWebGLRenderTarget && (i = i.texture),
            !0 === i.matrixAutoUpdate && i.updateMatrix(),
            A.uvTransform.value.copy(i.matrix)),
            e.aoMap ? o = e.aoMap : e.lightMap && (o = e.lightMap),
            void 0 !== o && (o.isWebGLRenderTarget && (o = o.texture),
            !0 === o.matrixAutoUpdate && o.updateMatrix(),
            A.uv2Transform.value.copy(o.matrix))
        }
        function UA(A, e, t) {
            A.roughness.value = e.roughness,
            A.metalness.value = e.metalness,
            e.roughnessMap && (A.roughnessMap.value = e.roughnessMap),
            e.metalnessMap && (A.metalnessMap.value = e.metalnessMap),
            e.emissiveMap && (A.emissiveMap.value = e.emissiveMap),
            e.bumpMap && (A.bumpMap.value = e.bumpMap,
            A.bumpScale.value = e.bumpScale,
            1 === e.side && (A.bumpScale.value *= -1)),
            e.normalMap && (A.normalMap.value = e.normalMap,
            A.normalScale.value.copy(e.normalScale),
            1 === e.side && A.normalScale.value.negate()),
            e.displacementMap && (A.displacementMap.value = e.displacementMap,
            A.displacementScale.value = e.displacementScale,
            A.displacementBias.value = e.displacementBias),
            (e.envMap || t) && (A.envMapIntensity.value = e.envMapIntensity)
        }
        EA.setAnimationLoop((function(A) {
            gA.isPresenting || IA && IA(A)
        }
        )),
        "undefined" != typeof window && EA.setContext(window),
        this.setAnimationLoop = function(A) {
            IA = A,
            gA.setAnimationLoop(A),
            EA.start()
        }
        ,
        this.render = function(A, e) {
            var t, i;
            if (void 0 !== arguments[2] && (console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),
            t = arguments[2]),
            void 0 !== arguments[3] && (console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),
            i = arguments[3]),
            e && e.isCamera) {
                if (!L) {
                    j.geometry = null,
                    j.program = null,
                    j.wireframe = !1,
                    q = -1,
                    H = null,
                    !0 === A.autoUpdate && A.updateMatrixWorld(),
                    null === e.parent && e.updateMatrixWorld(),
                    gA.enabled && gA.isPresenting && (e = gA.getCamera(e)),
                    (u = F.get(A, e)).init(),
                    A.onBeforeRender(D, A, e, t || G),
                    lA.multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse),
                    nA.setFromProjectionMatrix(lA),
                    aA = rA.init(this.clippingPlanes, sA = this.localClippingEnabled, e),
                    (g = U.get(A, e)).init(),
                    BA(A, e, 0, D.sortObjects),
                    g.finish(),
                    !0 === D.sortObjects && g.sort(AA, eA),
                    aA && rA.beginShadows();
                    var o = u.state.shadowsArray;
                    uA.render(o, A, e),
                    u.setupLights(e),
                    aA && rA.endShadows(),
                    this.info.autoReset && this.info.reset(),
                    void 0 !== t && this.setRenderTarget(t),
                    K.render(g, A, e, i);
                    var n = g.opaque
                      , r = g.transparent;
                    if (A.overrideMaterial) {
                        var a = A.overrideMaterial;
                        n.length && xA(n, A, e, a),
                        r.length && xA(r, A, e, a)
                    } else
                        n.length && xA(n, A, e),
                        r.length && xA(r, A, e);
                    A.onAfterRender(D, A, e),
                    null !== G && (B.updateRenderTargetMipmap(G),
                    B.updateMultisampleRenderTarget(G)),
                    v.buffers.depth.setTest(!0),
                    v.buffers.depth.setMask(!0),
                    v.buffers.color.setMask(!0),
                    v.setPolygonOffset(!1),
                    g = null,
                    u = null
                }
            } else
                console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")
        }
        ,
        this.setFramebuffer = function(A) {
            N !== A && null === G && f.bindFramebuffer(36160, A),
            N = A
        }
        ,
        this.getActiveCubeFace = function() {
            return O
        }
        ,
        this.getActiveMipmapLevel = function() {
            return V
        }
        ,
        this.getRenderTarget = function() {
            return G
        }
        ,
        this.setRenderTarget = function(A, e, t) {
            G = A,
            O = e,
            V = t,
            A && void 0 === E.get(A).__webglFramebuffer && B.setupRenderTarget(A);
            var i = N
              , o = !1;
            if (A) {
                var n = E.get(A).__webglFramebuffer;
                A.isWebGLCubeRenderTarget ? (i = n[e || 0],
                o = !0) : i = A.isWebGLMultisampleRenderTarget ? E.get(A).__webglMultisampledFramebuffer : n,
                J.copy(A.viewport),
                z.copy(A.scissor),
                Z = A.scissorTest
            } else
                J.copy(tA).multiplyScalar($).floor(),
                z.copy(iA).multiplyScalar($).floor(),
                Z = oA;
            if (P !== i && (f.bindFramebuffer(36160, i),
            P = i),
            v.viewport(J),
            v.scissor(z),
            v.setScissorTest(Z),
            o) {
                var r = E.get(A.texture);
                f.framebufferTexture2D(36160, 36064, 34069 + (e || 0), r.__webglTexture, t || 0)
            }
        }
        ,
        this.readRenderTargetPixels = function(A, e, t, i, o, n, r) {
            if (A && A.isWebGLRenderTarget) {
                var a = E.get(A).__webglFramebuffer;
                if (A.isWebGLCubeRenderTarget && void 0 !== r && (a = a[r]),
                a) {
                    var s = !1;
                    a !== P && (f.bindFramebuffer(36160, a),
                    s = !0);
                    try {
                        var l = A.texture
                          , c = l.format
                          , h = l.type;
                        if (1023 !== c && k.convert(c) !== f.getParameter(35739))
                            return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");
                        if (!(1009 === h || k.convert(h) === f.getParameter(35738) || 1015 === h && (C.isWebGL2 || m.get("OES_texture_float") || m.get("WEBGL_color_buffer_float")) || 1016 === h && m.get(C.isWebGL2 ? "EXT_color_buffer_float" : "EXT_color_buffer_half_float")))
                            return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");
                        36053 === f.checkFramebufferStatus(36160) ? 0 > e || e > A.width - i || 0 > t || t > A.height - o || f.readPixels(e, t, i, o, k.convert(c), k.convert(h), n) : console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")
                    } finally {
                        s && f.bindFramebuffer(36160, P)
                    }
                }
            } else
                console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")
        }
        ,
        this.copyFramebufferToTexture = function(A, e, t) {
            void 0 === t && (t = 0);
            var i = Math.pow(2, -t)
              , o = Math.floor(e.image.width * i)
              , n = Math.floor(e.image.height * i)
              , r = k.convert(e.format);
            B.setTexture2D(e, 0),
            f.copyTexImage2D(3553, t, r, A.x, A.y, o, n, 0),
            v.unbindTexture()
        }
        ,
        this.copyTextureToTexture = function(A, e, t, i) {
            var o = e.image.width
              , n = e.image.height
              , r = k.convert(t.format)
              , a = k.convert(t.type);
            B.setTexture2D(t, 0),
            e.isDataTexture ? f.texSubImage2D(3553, i || 0, A.x, A.y, o, n, r, a, e.image.data) : f.texSubImage2D(3553, i || 0, A.x, A.y, r, a, e.image),
            v.unbindTexture()
        }
        ,
        this.initTexture = function(A) {
            B.setTexture2D(A, 0),
            v.unbindTexture()
        }
        ,
        "undefined" != typeof __THREE_DEVTOOLS__ && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{
            detail: this
        }))
    }
    function Ao(A, e) {
        this.name = "",
        this.color = new LA(A),
        this.density = void 0 !== e ? e : 25e-5
    }
    function eo(A, e, t) {
        this.name = "",
        this.color = new LA(A),
        this.near = void 0 !== e ? e : 1,
        this.far = void 0 !== t ? t : 1e3
    }
    function to(A, e) {
        this.array = A,
        this.stride = e,
        this.count = void 0 !== A ? A.length / e : 0,
        this.usage = 35044,
        this.updateRange = {
            offset: 0,
            count: -1
        },
        this.version = 0
    }
    Zi.prototype = Object.assign(Object.create(je.prototype), {
        constructor: Zi,
        isArrayCamera: !0
    }),
    Xi.prototype = Object.assign(Object.create(H.prototype), {
        constructor: Xi,
        isGroup: !0
    }),
    Object.assign(_i.prototype, i.prototype),
    Object.assign(Ao.prototype, {
        isFogExp2: !0,
        clone: function() {
            return new Ao(this.color,this.density)
        },
        toJSON: function() {
            return {
                type: "FogExp2",
                color: this.color.getHex(),
                density: this.density
            }
        }
    }),
    Object.assign(eo.prototype, {
        isFog: !0,
        clone: function() {
            return new eo(this.color,this.near,this.far)
        },
        toJSON: function() {
            return {
                type: "Fog",
                color: this.color.getHex(),
                near: this.near,
                far: this.far
            }
        }
    }),
    Object.defineProperty(to.prototype, "needsUpdate", {
        set: function(A) {
            !0 === A && this.version++
        }
    }),
    Object.assign(to.prototype, {
        isInterleavedBuffer: !0,
        onUploadCallback: function() {},
        setUsage: function(A) {
            return this.usage = A,
            this
        },
        copy: function(A) {
            return this.array = new A.array.constructor(A.array),
            this.count = A.count,
            this.stride = A.stride,
            this.usage = A.usage,
            this
        },
        copyAt: function(A, e, t) {
            A *= this.stride,
            t *= e.stride;
            for (var i = 0, o = this.stride; o > i; i++)
                this.array[A + i] = e.array[t + i];
            return this
        },
        set: function(A, e) {
            return void 0 === e && (e = 0),
            this.array.set(A, e),
            this
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        onUpload: function(A) {
            return this.onUploadCallback = A,
            this
        }
    });
    var io, oo = new y;
    function no(A, e, t, i) {
        this.data = A,
        this.itemSize = e,
        this.offset = t,
        this.normalized = !0 === i
    }
    function ro(A) {
        qA.call(this),
        this.type = "SpriteMaterial",
        this.color = new LA(16777215),
        this.map = null,
        this.alphaMap = null,
        this.rotation = 0,
        this.sizeAttenuation = !0,
        this.transparent = !0,
        this.setValues(A)
    }
    Object.defineProperties(no.prototype, {
        count: {
            get: function() {
                return this.data.count
            }
        },
        array: {
            get: function() {
                return this.data.array
            }
        }
    }),
    Object.assign(no.prototype, {
        isInterleavedBufferAttribute: !0,
        applyMatrix4: function(A) {
            for (var e = 0, t = this.data.count; t > e; e++)
                oo.x = this.getX(e),
                oo.y = this.getY(e),
                oo.z = this.getZ(e),
                oo.applyMatrix4(A),
                this.setXYZ(e, oo.x, oo.y, oo.z);
            return this
        },
        setX: function(A, e) {
            return this.data.array[A * this.data.stride + this.offset] = e,
            this
        },
        setY: function(A, e) {
            return this.data.array[A * this.data.stride + this.offset + 1] = e,
            this
        },
        setZ: function(A, e) {
            return this.data.array[A * this.data.stride + this.offset + 2] = e,
            this
        },
        setW: function(A, e) {
            return this.data.array[A * this.data.stride + this.offset + 3] = e,
            this
        },
        getX: function(A) {
            return this.data.array[A * this.data.stride + this.offset]
        },
        getY: function(A) {
            return this.data.array[A * this.data.stride + this.offset + 1]
        },
        getZ: function(A) {
            return this.data.array[A * this.data.stride + this.offset + 2]
        },
        getW: function(A) {
            return this.data.array[A * this.data.stride + this.offset + 3]
        },
        setXY: function(A, e, t) {
            return this.data.array[(A = A * this.data.stride + this.offset) + 0] = e,
            this.data.array[A + 1] = t,
            this
        },
        setXYZ: function(A, e, t, i) {
            return this.data.array[(A = A * this.data.stride + this.offset) + 0] = e,
            this.data.array[A + 1] = t,
            this.data.array[A + 2] = i,
            this
        },
        setXYZW: function(A, e, t, i, o) {
            return this.data.array[(A = A * this.data.stride + this.offset) + 0] = e,
            this.data.array[A + 1] = t,
            this.data.array[A + 2] = i,
            this.data.array[A + 3] = o,
            this
        }
    }),
    (ro.prototype = Object.create(qA.prototype)).constructor = ro,
    ro.prototype.isSpriteMaterial = !0,
    ro.prototype.copy = function(A) {
        return qA.prototype.copy.call(this, A),
        this.color.copy(A.color),
        this.map = A.map,
        this.alphaMap = A.alphaMap,
        this.rotation = A.rotation,
        this.sizeAttenuation = A.sizeAttenuation,
        this
    }
    ;
    var ao = new y
      , so = new y
      , lo = new y
      , co = new s
      , ho = new s
      , po = new M
      , go = new y
      , uo = new y
      , fo = new y
      , mo = new s
      , Co = new s
      , yo = new s;
    function vo(A) {
        if (H.call(this),
        this.type = "Sprite",
        void 0 === io) {
            io = new he;
            var e = new to(new Float32Array([-.5, -.5, 0, 0, 0, .5, -.5, 0, 1, 0, .5, .5, 0, 1, 1, -.5, .5, 0, 0, 1]),5);
            io.setIndex([0, 1, 2, 0, 2, 3]),
            io.setAttribute("position", new no(e,3,0,!1)),
            io.setAttribute("uv", new no(e,2,3,!1))
        }
        this.geometry = io,
        this.material = void 0 !== A ? A : new ro,
        this.center = new s(.5,.5)
    }
    function Io(A, e, t, i, o, n) {
        co.subVectors(A, t).addScalar(.5).multiply(i),
        void 0 !== o ? (ho.x = n * co.x - o * co.y,
        ho.y = o * co.x + n * co.y) : ho.copy(co),
        A.copy(e),
        A.x += ho.x,
        A.y += ho.y,
        A.applyMatrix4(po)
    }
    vo.prototype = Object.assign(Object.create(H.prototype), {
        constructor: vo,
        isSprite: !0,
        raycast: function(A, e) {
            null === A.camera && console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),
            so.setFromMatrixScale(this.matrixWorld),
            po.copy(A.camera.matrixWorld),
            this.modelViewMatrix.multiplyMatrices(A.camera.matrixWorldInverse, this.matrixWorld),
            lo.setFromMatrixPosition(this.modelViewMatrix),
            A.camera.isPerspectiveCamera && !1 === this.material.sizeAttenuation && so.multiplyScalar(-lo.z);
            var t, i, o = this.material.rotation;
            0 !== o && (i = Math.cos(o),
            t = Math.sin(o));
            var n = this.center;
            Io(go.set(-.5, -.5, 0), lo, n, so, t, i),
            Io(uo.set(.5, -.5, 0), lo, n, so, t, i),
            Io(fo.set(.5, .5, 0), lo, n, so, t, i),
            mo.set(0, 0),
            Co.set(1, 0),
            yo.set(1, 1);
            var r = A.ray.intersectTriangle(go, uo, fo, !1, ao);
            if (null !== r || (Io(uo.set(-.5, .5, 0), lo, n, so, t, i),
            Co.set(0, 1),
            null !== (r = A.ray.intersectTriangle(go, fo, uo, !1, ao)))) {
                var a = A.ray.origin.distanceTo(ao);
                A.near > a || a > A.far || e.push({
                    distance: a,
                    point: ao.clone(),
                    uv: RA.getUV(ao, go, uo, fo, mo, Co, yo, new s),
                    face: null,
                    object: this
                })
            }
        },
        clone: function() {
            return new this.constructor(this.material).copy(this)
        },
        copy: function(A) {
            return H.prototype.copy.call(this, A),
            void 0 !== A.center && this.center.copy(A.center),
            this
        }
    });
    var Eo = new y
      , Bo = new y;
    function xo() {
        H.call(this),
        this._currentLevel = 0,
        this.type = "LOD",
        Object.defineProperties(this, {
            levels: {
                enumerable: !0,
                value: []
            }
        }),
        this.autoUpdate = !0
    }
    function So(A, e) {
        A && A.isGeometry && console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),
        Ue.call(this, A, e),
        this.type = "SkinnedMesh",
        this.bindMode = "attached",
        this.bindMatrix = new M,
        this.bindMatrixInverse = new M
    }
    xo.prototype = Object.assign(Object.create(H.prototype), {
        constructor: xo,
        isLOD: !0,
        copy: function(A) {
            H.prototype.copy.call(this, A, !1);
            for (var e = A.levels, t = 0, i = e.length; i > t; t++) {
                var o = e[t];
                this.addLevel(o.object.clone(), o.distance)
            }
            return this.autoUpdate = A.autoUpdate,
            this
        },
        addLevel: function(A, e) {
            void 0 === e && (e = 0),
            e = Math.abs(e);
            for (var t = this.levels, i = 0; t.length > i && t[i].distance <= e; i++)
                ;
            return t.splice(i, 0, {
                distance: e,
                object: A
            }),
            this.add(A),
            this
        },
        getCurrentLevel: function() {
            return this._currentLevel
        },
        getObjectForDistance: function(A) {
            var e = this.levels;
            if (e.length > 0) {
                for (var t = 1, i = e.length; i > t && e[t].distance <= A; t++)
                    ;
                return e[t - 1].object
            }
            return null
        },
        raycast: function(A, e) {
            if (this.levels.length > 0) {
                Eo.setFromMatrixPosition(this.matrixWorld);
                var t = A.ray.origin.distanceTo(Eo);
                this.getObjectForDistance(t).raycast(A, e)
            }
        },
        update: function(A) {
            var e = this.levels;
            if (e.length > 1) {
                Eo.setFromMatrixPosition(A.matrixWorld),
                Bo.setFromMatrixPosition(this.matrixWorld);
                var t = Eo.distanceTo(Bo) / A.zoom;
                e[0].object.visible = !0;
                for (var i = 1, o = e.length; o > i && e[i].distance <= t; i++)
                    e[i - 1].object.visible = !1,
                    e[i].object.visible = !0;
                for (this._currentLevel = i - 1; o > i; i++)
                    e[i].object.visible = !1
            }
        },
        toJSON: function(A) {
            var e = H.prototype.toJSON.call(this, A);
            !1 === this.autoUpdate && (e.object.autoUpdate = !1),
            e.object.levels = [];
            for (var t = this.levels, i = 0, o = t.length; o > i; i++) {
                var n = t[i];
                e.object.levels.push({
                    object: n.object.uuid,
                    distance: n.distance
                })
            }
            return e
        }
    }),
    So.prototype = Object.assign(Object.create(Ue.prototype), {
        constructor: So,
        isSkinnedMesh: !0,
        bind: function(A, e) {
            this.skeleton = A,
            void 0 === e && (this.updateMatrixWorld(!0),
            this.skeleton.calculateInverses(),
            e = this.matrixWorld),
            this.bindMatrix.copy(e),
            this.bindMatrixInverse.getInverse(e)
        },
        pose: function() {
            this.skeleton.pose()
        },
        normalizeSkinWeights: function() {
            for (var A = new p, e = this.geometry.attributes.skinWeight, t = 0, i = e.count; i > t; t++) {
                A.x = e.getX(t),
                A.y = e.getY(t),
                A.z = e.getZ(t),
                A.w = e.getW(t);
                var o = 1 / A.manhattanLength();
                o !== 1 / 0 ? A.multiplyScalar(o) : A.set(1, 0, 0, 0),
                e.setXYZW(t, A.x, A.y, A.z, A.w)
            }
        },
        updateMatrixWorld: function(A) {
            Ue.prototype.updateMatrixWorld.call(this, A),
            "attached" === this.bindMode ? this.bindMatrixInverse.getInverse(this.matrixWorld) : "detached" === this.bindMode ? this.bindMatrixInverse.getInverse(this.bindMatrix) : console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode)
        },
        clone: function() {
            return new this.constructor(this.geometry,this.material).copy(this)
        }
    });
    var wo = new M
      , Mo = new M;
    function bo(A, e) {
        if (this.bones = (A = A || []).slice(0),
        this.boneMatrices = new Float32Array(16 * this.bones.length),
        this.frame = -1,
        void 0 === e)
            this.calculateInverses();
        else if (this.bones.length === e.length)
            this.boneInverses = e.slice(0);
        else {
            console.warn("THREE.Skeleton boneInverses is the wrong length."),
            this.boneInverses = [];
            for (var t = 0, i = this.bones.length; i > t; t++)
                this.boneInverses.push(new M)
        }
    }
    function Uo() {
        H.call(this),
        this.type = "Bone"
    }
    Object.assign(bo.prototype, {
        calculateInverses: function() {
            this.boneInverses = [];
            for (var A = 0, e = this.bones.length; e > A; A++) {
                var t = new M;
                this.bones[A] && t.getInverse(this.bones[A].matrixWorld),
                this.boneInverses.push(t)
            }
        },
        pose: function() {
            var A, e, t;
            for (e = 0,
            t = this.bones.length; t > e; e++)
                (A = this.bones[e]) && A.matrixWorld.getInverse(this.boneInverses[e]);
            for (e = 0,
            t = this.bones.length; t > e; e++)
                (A = this.bones[e]) && (A.parent && A.parent.isBone ? (A.matrix.getInverse(A.parent.matrixWorld),
                A.matrix.multiply(A.matrixWorld)) : A.matrix.copy(A.matrixWorld),
                A.matrix.decompose(A.position, A.quaternion, A.scale))
        },
        update: function() {
            for (var A = this.bones, e = this.boneInverses, t = this.boneMatrices, i = this.boneTexture, o = 0, n = A.length; n > o; o++) {
                wo.multiplyMatrices(A[o] ? A[o].matrixWorld : Mo, e[o]),
                wo.toArray(t, 16 * o)
            }
            void 0 !== i && (i.needsUpdate = !0)
        },
        clone: function() {
            return new bo(this.bones,this.boneInverses)
        },
        getBoneByName: function(A) {
            for (var e = 0, t = this.bones.length; t > e; e++) {
                var i = this.bones[e];
                if (i.name === A)
                    return i
            }
        },
        dispose: function() {
            this.boneTexture && (this.boneTexture.dispose(),
            this.boneTexture = void 0)
        }
    }),
    Uo.prototype = Object.assign(Object.create(H.prototype), {
        constructor: Uo,
        isBone: !0
    });
    var Fo = new M
      , Ko = new M
      , Qo = []
      , Ro = new Ue;
    function To(A, e, t) {
        Ue.call(this, A, e),
        this.instanceMatrix = new YA(new Float32Array(16 * t),16),
        this.count = t,
        this.frustumCulled = !1
    }
    function ko(A) {
        qA.call(this),
        this.type = "LineBasicMaterial",
        this.color = new LA(16777215),
        this.linewidth = 1,
        this.linecap = "round",
        this.linejoin = "round",
        this.setValues(A)
    }
    To.prototype = Object.assign(Object.create(Ue.prototype), {
        constructor: To,
        isInstancedMesh: !0,
        getMatrixAt: function(A, e) {
            e.fromArray(this.instanceMatrix.array, 16 * A)
        },
        raycast: function(A, e) {
            var t = this.matrixWorld
              , i = this.count;
            if (Ro.geometry = this.geometry,
            Ro.material = this.material,
            void 0 !== Ro.material)
                for (var o = 0; i > o; o++)
                    this.getMatrixAt(o, Fo),
                    Ko.multiplyMatrices(t, Fo),
                    Ro.matrixWorld = Ko,
                    Ro.raycast(A, Qo),
                    Qo.length > 0 && (Qo[0].instanceId = o,
                    Qo[0].object = this,
                    e.push(Qo[0]),
                    Qo.length = 0)
        },
        setMatrixAt: function(A, e) {
            e.toArray(this.instanceMatrix.array, 16 * A)
        },
        updateMorphTargets: function() {}
    }),
    (ko.prototype = Object.create(qA.prototype)).constructor = ko,
    ko.prototype.isLineBasicMaterial = !0,
    ko.prototype.copy = function(A) {
        return qA.prototype.copy.call(this, A),
        this.color.copy(A.color),
        this.linewidth = A.linewidth,
        this.linecap = A.linecap,
        this.linejoin = A.linejoin,
        this
    }
    ;
    var Do = new y
      , Lo = new y
      , No = new M
      , Oo = new CA
      , Vo = new cA;
    function Go(A, e, t) {
        1 === t && console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),
        H.call(this),
        this.type = "Line",
        this.geometry = void 0 !== A ? A : new he,
        this.material = void 0 !== e ? e : new ko
    }
    Go.prototype = Object.assign(Object.create(H.prototype), {
        constructor: Go,
        isLine: !0,
        computeLineDistances: function() {
            var A = this.geometry;
            if (A.isBufferGeometry)
                if (null === A.index) {
                    for (var e = A.attributes.position, t = [0], i = 1, o = e.count; o > i; i++)
                        Do.fromBufferAttribute(e, i - 1),
                        Lo.fromBufferAttribute(e, i),
                        t[i] = t[i - 1],
                        t[i] += Do.distanceTo(Lo);
                    A.setAttribute("lineDistance", new Ae(t,1))
                } else
                    console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
            else if (A.isGeometry) {
                var n = A.vertices;
                (t = A.lineDistances)[0] = 0;
                for (i = 1,
                o = n.length; o > i; i++)
                    t[i] = t[i - 1],
                    t[i] += n[i - 1].distanceTo(n[i])
            }
            return this
        },
        raycast: function(A, e) {
            var t = this.geometry
              , i = this.matrixWorld
              , o = A.params.Line.threshold;
            if (null === t.boundingSphere && t.computeBoundingSphere(),
            Vo.copy(t.boundingSphere),
            Vo.applyMatrix4(i),
            Vo.radius += o,
            !1 !== A.ray.intersectsSphere(Vo)) {
                No.getInverse(i),
                Oo.copy(A.ray).applyMatrix4(No);
                var n = o / ((this.scale.x + this.scale.y + this.scale.z) / 3)
                  , r = n * n
                  , a = new y
                  , s = new y
                  , l = new y
                  , c = new y
                  , h = this && this.isLineSegments ? 2 : 1;
                if (t.isBufferGeometry) {
                    var d = t.index
                      , p = t.attributes.position.array;
                    if (null !== d)
                        for (var g = d.array, u = 0, f = g.length - 1; f > u; u += h) {
                            var m = g[u + 1];
                            if (a.fromArray(p, 3 * g[u]),
                            s.fromArray(p, 3 * m),
                            r >= Oo.distanceSqToSegment(a, s, c, l)) {
                                c.applyMatrix4(this.matrixWorld);
                                var C = A.ray.origin.distanceTo(c);
                                A.near > C || C > A.far || e.push({
                                    distance: C,
                                    point: l.clone().applyMatrix4(this.matrixWorld),
                                    index: u,
                                    face: null,
                                    faceIndex: null,
                                    object: this
                                })
                            }
                        }
                    else
                        for (u = 0,
                        f = p.length / 3 - 1; f > u; u += h) {
                            if (a.fromArray(p, 3 * u),
                            s.fromArray(p, 3 * u + 3),
                            r >= Oo.distanceSqToSegment(a, s, c, l)) {
                                c.applyMatrix4(this.matrixWorld);
                                C = A.ray.origin.distanceTo(c);
                                A.near > C || C > A.far || e.push({
                                    distance: C,
                                    point: l.clone().applyMatrix4(this.matrixWorld),
                                    index: u,
                                    face: null,
                                    faceIndex: null,
                                    object: this
                                })
                            }
                        }
                } else if (t.isGeometry) {
                    var v = t.vertices
                      , I = v.length;
                    for (u = 0; I - 1 > u; u += h) {
                        if (r >= Oo.distanceSqToSegment(v[u], v[u + 1], c, l)) {
                            c.applyMatrix4(this.matrixWorld);
                            C = A.ray.origin.distanceTo(c);
                            A.near > C || C > A.far || e.push({
                                distance: C,
                                point: l.clone().applyMatrix4(this.matrixWorld),
                                index: u,
                                face: null,
                                faceIndex: null,
                                object: this
                            })
                        }
                    }
                }
            }
        },
        clone: function() {
            return new this.constructor(this.geometry,this.material).copy(this)
        }
    });
    var Po = new y
      , qo = new y;
    function jo(A, e) {
        Go.call(this, A, e),
        this.type = "LineSegments"
    }
    function Ho(A, e) {
        Go.call(this, A, e),
        this.type = "LineLoop"
    }
    function Yo(A) {
        qA.call(this),
        this.type = "PointsMaterial",
        this.color = new LA(16777215),
        this.map = null,
        this.alphaMap = null,
        this.size = 1,
        this.sizeAttenuation = !0,
        this.morphTargets = !1,
        this.setValues(A)
    }
    jo.prototype = Object.assign(Object.create(Go.prototype), {
        constructor: jo,
        isLineSegments: !0,
        computeLineDistances: function() {
            var A = this.geometry;
            if (A.isBufferGeometry)
                if (null === A.index) {
                    for (var e = A.attributes.position, t = [], i = 0, o = e.count; o > i; i += 2)
                        Po.fromBufferAttribute(e, i),
                        qo.fromBufferAttribute(e, i + 1),
                        t[i] = 0 === i ? 0 : t[i - 1],
                        t[i + 1] = t[i] + Po.distanceTo(qo);
                    A.setAttribute("lineDistance", new Ae(t,1))
                } else
                    console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");
            else if (A.isGeometry) {
                var n = A.vertices;
                for (t = A.lineDistances,
                i = 0,
                o = n.length; o > i; i += 2)
                    Po.copy(n[i]),
                    qo.copy(n[i + 1]),
                    t[i] = 0 === i ? 0 : t[i - 1],
                    t[i + 1] = t[i] + Po.distanceTo(qo)
            }
            return this
        }
    }),
    Ho.prototype = Object.assign(Object.create(Go.prototype), {
        constructor: Ho,
        isLineLoop: !0
    }),
    (Yo.prototype = Object.create(qA.prototype)).constructor = Yo,
    Yo.prototype.isPointsMaterial = !0,
    Yo.prototype.copy = function(A) {
        return qA.prototype.copy.call(this, A),
        this.color.copy(A.color),
        this.map = A.map,
        this.alphaMap = A.alphaMap,
        this.size = A.size,
        this.sizeAttenuation = A.sizeAttenuation,
        this.morphTargets = A.morphTargets,
        this
    }
    ;
    var Wo = new M
      , Jo = new CA
      , zo = new cA
      , Zo = new y;
    function Xo(A, e) {
        H.call(this),
        this.type = "Points",
        this.geometry = void 0 !== A ? A : new he,
        this.material = void 0 !== e ? e : new Yo,
        this.updateMorphTargets()
    }
    function _o(A, e, t, i, o, n, r) {
        var a = Jo.distanceSqToPoint(A);
        if (t > a) {
            var s = new y;
            Jo.closestPointToPoint(A, s),
            s.applyMatrix4(i);
            var l = o.ray.origin.distanceTo(s);
            if (o.near > l || l > o.far)
                return;
            n.push({
                distance: l,
                distanceToRay: Math.sqrt(a),
                point: s,
                index: e,
                face: null,
                object: r
            })
        }
    }
    function $o(A, e, t, i, o, n, r, a, s) {
        d.call(this, A, e, t, i, o, n, r, a, s),
        this.format = void 0 !== r ? r : 1022,
        this.minFilter = void 0 !== n ? n : 1006,
        this.magFilter = void 0 !== o ? o : 1006,
        this.generateMipmaps = !1
    }
    function An(A, e, t, i, o, n, r, a, s, l, c, h) {
        d.call(this, null, n, r, a, s, l, i, o, c, h),
        this.image = {
            width: e,
            height: t
        },
        this.mipmaps = A,
        this.flipY = !1,
        this.generateMipmaps = !1
    }
    function en(A, e, t, i, o, n, r, a, s) {
        d.call(this, A, e, t, i, o, n, r, a, s),
        this.needsUpdate = !0
    }
    function tn(A, e, t, i, o, n, r, a, s, l) {
        if (1026 !== (l = void 0 !== l ? l : 1026) && 1027 !== l)
            throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");
        void 0 === t && 1026 === l && (t = 1012),
        void 0 === t && 1027 === l && (t = 1020),
        d.call(this, null, i, o, n, r, a, l, t, s),
        this.image = {
            width: A,
            height: e
        },
        this.magFilter = void 0 !== r ? r : 1003,
        this.minFilter = void 0 !== a ? a : 1003,
        this.flipY = !1,
        this.generateMipmaps = !1
    }
    function on(A) {
        he.call(this),
        this.type = "WireframeGeometry";
        var e, t, i, o, n, r, a, s, l, c, h = [], d = [0, 0], p = {}, g = ["a", "b", "c"];
        if (A && A.isGeometry) {
            var u = A.faces;
            for (e = 0,
            i = u.length; i > e; e++) {
                var f = u[e];
                for (t = 0; 3 > t; t++)
                    a = f[g[t]],
                    s = f[g[(t + 1) % 3]],
                    d[0] = Math.min(a, s),
                    d[1] = Math.max(a, s),
                    void 0 === p[l = d[0] + "," + d[1]] && (p[l] = {
                        index1: d[0],
                        index2: d[1]
                    })
            }
            for (l in p)
                h.push((c = A.vertices[(r = p[l]).index1]).x, c.y, c.z),
                h.push((c = A.vertices[r.index2]).x, c.y, c.z)
        } else if (A && A.isBufferGeometry) {
            var m, C, v, I, E;
            if (c = new y,
            null !== A.index) {
                for (m = A.attributes.position,
                C = A.index,
                0 === (v = A.groups).length && (v = [{
                    start: 0,
                    count: C.count,
                    materialIndex: 0
                }]),
                o = 0,
                n = v.length; n > o; ++o)
                    for (e = E = (I = v[o]).start,
                    i = E + I.count; i > e; e += 3)
                        for (t = 0; 3 > t; t++)
                            a = C.getX(e + t),
                            s = C.getX(e + (t + 1) % 3),
                            d[0] = Math.min(a, s),
                            d[1] = Math.max(a, s),
                            void 0 === p[l = d[0] + "," + d[1]] && (p[l] = {
                                index1: d[0],
                                index2: d[1]
                            });
                for (l in p)
                    c.fromBufferAttribute(m, (r = p[l]).index1),
                    h.push(c.x, c.y, c.z),
                    c.fromBufferAttribute(m, r.index2),
                    h.push(c.x, c.y, c.z)
            } else
                for (e = 0,
                i = (m = A.attributes.position).count / 3; i > e; e++)
                    for (t = 0; 3 > t; t++)
                        c.fromBufferAttribute(m, 3 * e + t),
                        h.push(c.x, c.y, c.z),
                        c.fromBufferAttribute(m, 3 * e + (t + 1) % 3),
                        h.push(c.x, c.y, c.z)
        }
        this.setAttribute("position", new Ae(h,3))
    }
    function nn(A, e, t) {
        De.call(this),
        this.type = "ParametricGeometry",
        this.parameters = {
            func: A,
            slices: e,
            stacks: t
        },
        this.fromBufferGeometry(new rn(A,e,t)),
        this.mergeVertices()
    }
    function rn(A, e, t) {
        he.call(this),
        this.type = "ParametricBufferGeometry",
        this.parameters = {
            func: A,
            slices: e,
            stacks: t
        };
        var i, o, n = [], r = [], a = [], s = [], l = 1e-5, c = new y, h = new y, d = new y, p = new y, g = new y;
        3 > A.length && console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");
        var u = e + 1;
        for (i = 0; t >= i; i++) {
            var f = i / t;
            for (o = 0; e >= o; o++) {
                var m = o / e;
                A(m, f, h),
                r.push(h.x, h.y, h.z),
                0 > m - l ? (A(m + l, f, d),
                p.subVectors(d, h)) : (A(m - l, f, d),
                p.subVectors(h, d)),
                0 > f - l ? (A(m, f + l, d),
                g.subVectors(d, h)) : (A(m, f - l, d),
                g.subVectors(h, d)),
                c.crossVectors(p, g).normalize(),
                a.push(c.x, c.y, c.z),
                s.push(m, f)
            }
        }
        for (i = 0; t > i; i++)
            for (o = 0; e > o; o++) {
                var C = i * u + o + 1
                  , v = (i + 1) * u + o + 1
                  , I = (i + 1) * u + o;
                n.push(i * u + o, C, I),
                n.push(C, v, I)
            }
        this.setIndex(n),
        this.setAttribute("position", new Ae(r,3)),
        this.setAttribute("normal", new Ae(a,3)),
        this.setAttribute("uv", new Ae(s,2))
    }
    function an(A, e, t, i) {
        De.call(this),
        this.type = "PolyhedronGeometry",
        this.parameters = {
            vertices: A,
            indices: e,
            radius: t,
            detail: i
        },
        this.fromBufferGeometry(new sn(A,e,t,i)),
        this.mergeVertices()
    }
    function sn(A, e, t, i) {
        he.call(this),
        this.type = "PolyhedronBufferGeometry",
        this.parameters = {
            vertices: A,
            indices: e,
            radius: t,
            detail: i
        },
        t = t || 1;
        var o = []
          , n = [];
        function r(A, e, t, i) {
            var o, n, r = Math.pow(2, i), s = [];
            for (o = 0; r >= o; o++) {
                s[o] = [];
                var l = A.clone().lerp(t, o / r)
                  , c = e.clone().lerp(t, o / r)
                  , h = r - o;
                for (n = 0; h >= n; n++)
                    s[o][n] = 0 === n && o === r ? l : l.clone().lerp(c, n / h)
            }
            for (o = 0; r > o; o++)
                for (n = 0; 2 * (r - o) - 1 > n; n++) {
                    var d = Math.floor(n / 2);
                    n % 2 == 0 ? (a(s[o][d + 1]),
                    a(s[o + 1][d]),
                    a(s[o][d])) : (a(s[o][d + 1]),
                    a(s[o + 1][d + 1]),
                    a(s[o + 1][d]))
                }
        }
        function a(A) {
            o.push(A.x, A.y, A.z)
        }
        function l(e, t) {
            var i = 3 * e;
            t.x = A[i + 0],
            t.y = A[i + 1],
            t.z = A[i + 2]
        }
        function c(A, e, t, i) {
            0 > i && 1 === A.x && (n[e] = A.x - 1),
            0 === t.x && 0 === t.z && (n[e] = i / 2 / Math.PI + .5)
        }
        function h(A) {
            return Math.atan2(A.z, -A.x)
        }
        !function(A) {
            for (var t = new y, i = new y, o = new y, n = 0; e.length > n; n += 3)
                l(e[n + 0], t),
                l(e[n + 1], i),
                l(e[n + 2], o),
                r(t, i, o, A)
        }(i = i || 0),
        function(A) {
            for (var e = new y, t = 0; o.length > t; t += 3)
                e.x = o[t + 0],
                e.y = o[t + 1],
                e.z = o[t + 2],
                e.normalize().multiplyScalar(A),
                o[t + 0] = e.x,
                o[t + 1] = e.y,
                o[t + 2] = e.z
        }(t),
        function() {
            for (var A = new y, e = 0; o.length > e; e += 3) {
                A.x = o[e + 0],
                A.y = o[e + 1],
                A.z = o[e + 2];
                var t = h(A) / 2 / Math.PI + .5
                  , i = (r = A,
                Math.atan2(-r.y, Math.sqrt(r.x * r.x + r.z * r.z)) / Math.PI + .5);
                n.push(t, 1 - i)
            }
            var r;
            (function() {
                for (var A = new y, e = new y, t = new y, i = new y, r = new s, a = new s, l = new s, d = 0, p = 0; o.length > d; d += 9,
                p += 6) {
                    A.set(o[d + 0], o[d + 1], o[d + 2]),
                    e.set(o[d + 3], o[d + 4], o[d + 5]),
                    t.set(o[d + 6], o[d + 7], o[d + 8]),
                    r.set(n[p + 0], n[p + 1]),
                    a.set(n[p + 2], n[p + 3]),
                    l.set(n[p + 4], n[p + 5]),
                    i.copy(A).add(e).add(t).divideScalar(3);
                    var g = h(i);
                    c(r, p + 0, A, g),
                    c(a, p + 2, e, g),
                    c(l, p + 4, t, g)
                }
            }
            )(),
            function() {
                for (var A = 0; n.length > A; A += 6) {
                    var e = n[A + 0]
                      , t = n[A + 2]
                      , i = n[A + 4]
                      , o = Math.max(e, t, i)
                      , r = Math.min(e, t, i);
                    o > .9 && .1 > r && (.2 > e && (n[A + 0] += 1),
                    .2 > t && (n[A + 2] += 1),
                    .2 > i && (n[A + 4] += 1))
                }
            }()
        }(),
        this.setAttribute("position", new Ae(o,3)),
        this.setAttribute("normal", new Ae(o.slice(),3)),
        this.setAttribute("uv", new Ae(n,2)),
        0 === i ? this.computeVertexNormals() : this.normalizeNormals()
    }
    function ln(A, e) {
        De.call(this),
        this.type = "TetrahedronGeometry",
        this.parameters = {
            radius: A,
            detail: e
        },
        this.fromBufferGeometry(new cn(A,e)),
        this.mergeVertices()
    }
    function cn(A, e) {
        sn.call(this, [1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1], [2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1], A, e),
        this.type = "TetrahedronBufferGeometry",
        this.parameters = {
            radius: A,
            detail: e
        }
    }
    function hn(A, e) {
        De.call(this),
        this.type = "OctahedronGeometry",
        this.parameters = {
            radius: A,
            detail: e
        },
        this.fromBufferGeometry(new dn(A,e)),
        this.mergeVertices()
    }
    function dn(A, e) {
        sn.call(this, [1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1], [0, 2, 4, 0, 4, 3, 0, 3, 5, 0, 5, 2, 1, 2, 5, 1, 5, 3, 1, 3, 4, 1, 4, 2], A, e),
        this.type = "OctahedronBufferGeometry",
        this.parameters = {
            radius: A,
            detail: e
        }
    }
    function pn(A, e) {
        De.call(this),
        this.type = "IcosahedronGeometry",
        this.parameters = {
            radius: A,
            detail: e
        },
        this.fromBufferGeometry(new gn(A,e)),
        this.mergeVertices()
    }
    function gn(A, e) {
        var t = (1 + Math.sqrt(5)) / 2;
        sn.call(this, [-1, t, 0, 1, t, 0, -1, -t, 0, 1, -t, 0, 0, -1, t, 0, 1, t, 0, -1, -t, 0, 1, -t, t, 0, -1, t, 0, 1, -t, 0, -1, -t, 0, 1], [0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11, 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8, 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9, 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1], A, e),
        this.type = "IcosahedronBufferGeometry",
        this.parameters = {
            radius: A,
            detail: e
        }
    }
    function un(A, e) {
        De.call(this),
        this.type = "DodecahedronGeometry",
        this.parameters = {
            radius: A,
            detail: e
        },
        this.fromBufferGeometry(new fn(A,e)),
        this.mergeVertices()
    }
    function fn(A, e) {
        var t = (1 + Math.sqrt(5)) / 2
          , i = 1 / t;
        sn.call(this, [-1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 0, -i, -t, 0, -i, t, 0, i, -t, 0, i, t, -i, -t, 0, -i, t, 0, i, -t, 0, i, t, 0, -t, 0, -i, t, 0, -i, -t, 0, i, t, 0, i], [3, 11, 7, 3, 7, 15, 3, 15, 13, 7, 19, 17, 7, 17, 6, 7, 6, 15, 17, 4, 8, 17, 8, 10, 17, 10, 6, 8, 0, 16, 8, 16, 2, 8, 2, 10, 0, 12, 1, 0, 1, 18, 0, 18, 16, 6, 10, 2, 6, 2, 13, 6, 13, 15, 2, 16, 18, 2, 18, 3, 2, 3, 13, 18, 1, 9, 18, 9, 11, 18, 11, 3, 4, 14, 12, 4, 12, 0, 4, 0, 8, 11, 9, 5, 11, 5, 19, 11, 19, 7, 19, 5, 14, 19, 14, 4, 19, 4, 17, 1, 12, 14, 1, 14, 5, 1, 5, 9], A, e),
        this.type = "DodecahedronBufferGeometry",
        this.parameters = {
            radius: A,
            detail: e
        }
    }
    function mn(A, e, t, i, o, n) {
        De.call(this),
        this.type = "TubeGeometry",
        this.parameters = {
            path: A,
            tubularSegments: e,
            radius: t,
            radialSegments: i,
            closed: o
        },
        void 0 !== n && console.warn("THREE.TubeGeometry: taper has been removed.");
        var r = new Cn(A,e,t,i,o);
        this.tangents = r.tangents,
        this.normals = r.normals,
        this.binormals = r.binormals,
        this.fromBufferGeometry(r),
        this.mergeVertices()
    }
    function Cn(A, e, t, i, o) {
        he.call(this),
        this.type = "TubeBufferGeometry",
        this.parameters = {
            path: A,
            tubularSegments: e,
            radius: t,
            radialSegments: i,
            closed: o
        },
        t = t || 1,
        i = i || 8;
        var n = A.computeFrenetFrames(e = e || 64, o = o || !1);
        this.tangents = n.tangents,
        this.normals = n.normals,
        this.binormals = n.binormals;
        var r, a, l = new y, c = new y, h = new s, d = new y, p = [], g = [], u = [], f = [];
        function m(o) {
            d = A.getPointAt(o / e, d);
            var r = n.normals[o]
              , s = n.binormals[o];
            for (a = 0; i >= a; a++) {
                var h = a / i * Math.PI * 2
                  , u = Math.sin(h)
                  , f = -Math.cos(h);
                c.x = f * r.x + u * s.x,
                c.y = f * r.y + u * s.y,
                c.z = f * r.z + u * s.z,
                c.normalize(),
                g.push(c.x, c.y, c.z),
                l.x = d.x + t * c.x,
                l.y = d.y + t * c.y,
                l.z = d.z + t * c.z,
                p.push(l.x, l.y, l.z)
            }
        }
        !function() {
            for (r = 0; e > r; r++)
                m(r);
            m(!1 === o ? e : 0),
            function() {
                for (r = 0; e >= r; r++)
                    for (a = 0; i >= a; a++)
                        h.x = r / e,
                        h.y = a / i,
                        u.push(h.x, h.y)
            }(),
            function() {
                for (a = 1; e >= a; a++)
                    for (r = 1; i >= r; r++) {
                        var A = (i + 1) * a + (r - 1)
                          , t = (i + 1) * a + r
                          , o = (i + 1) * (a - 1) + r;
                        f.push((i + 1) * (a - 1) + (r - 1), A, o),
                        f.push(A, t, o)
                    }
            }()
        }(),
        this.setIndex(f),
        this.setAttribute("position", new Ae(p,3)),
        this.setAttribute("normal", new Ae(g,3)),
        this.setAttribute("uv", new Ae(u,2))
    }
    function yn(A, e, t, i, o, n, r) {
        De.call(this),
        this.type = "TorusKnotGeometry",
        this.parameters = {
            radius: A,
            tube: e,
            tubularSegments: t,
            radialSegments: i,
            p: o,
            q: n
        },
        void 0 !== r && console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),
        this.fromBufferGeometry(new vn(A,e,t,i,o,n)),
        this.mergeVertices()
    }
    function vn(A, e, t, i, o, n) {
        he.call(this),
        this.type = "TorusKnotBufferGeometry",
        this.parameters = {
            radius: A,
            tube: e,
            tubularSegments: t,
            radialSegments: i,
            p: o,
            q: n
        },
        A = A || 1,
        e = e || .4,
        t = Math.floor(t) || 64,
        i = Math.floor(i) || 8,
        o = o || 2,
        n = n || 3;
        var r, a, s = [], l = [], c = [], h = [], d = new y, p = new y, g = new y, u = new y, f = new y, m = new y, C = new y;
        for (r = 0; t >= r; ++r) {
            var v = r / t * o * Math.PI * 2;
            for (M(v, o, n, A, g),
            M(v + .01, o, n, A, u),
            m.subVectors(u, g),
            C.addVectors(u, g),
            f.crossVectors(m, C),
            C.crossVectors(f, m),
            f.normalize(),
            C.normalize(),
            a = 0; i >= a; ++a) {
                var I = a / i * Math.PI * 2
                  , E = -e * Math.cos(I)
                  , B = e * Math.sin(I);
                d.x = g.x + (E * C.x + B * f.x),
                d.y = g.y + (E * C.y + B * f.y),
                d.z = g.z + (E * C.z + B * f.z),
                l.push(d.x, d.y, d.z),
                p.subVectors(d, g).normalize(),
                c.push(p.x, p.y, p.z),
                h.push(r / t),
                h.push(a / i)
            }
        }
        for (a = 1; t >= a; a++)
            for (r = 1; i >= r; r++) {
                var x = (i + 1) * a + (r - 1)
                  , S = (i + 1) * a + r
                  , w = (i + 1) * (a - 1) + r;
                s.push((i + 1) * (a - 1) + (r - 1), x, w),
                s.push(x, S, w)
            }
        function M(A, e, t, i, o) {
            var n = Math.cos(A)
              , r = Math.sin(A)
              , a = t / e * A
              , s = Math.cos(a);
            o.x = i * (2 + s) * .5 * n,
            o.y = i * (2 + s) * r * .5,
            o.z = i * Math.sin(a) * .5
        }
        this.setIndex(s),
        this.setAttribute("position", new Ae(l,3)),
        this.setAttribute("normal", new Ae(c,3)),
        this.setAttribute("uv", new Ae(h,2))
    }
    function In(A, e, t, i, o) {
        De.call(this),
        this.type = "TorusGeometry",
        this.parameters = {
            radius: A,
            tube: e,
            radialSegments: t,
            tubularSegments: i,
            arc: o
        },
        this.fromBufferGeometry(new En(A,e,t,i,o)),
        this.mergeVertices()
    }
    function En(A, e, t, i, o) {
        he.call(this),
        this.type = "TorusBufferGeometry",
        this.parameters = {
            radius: A,
            tube: e,
            radialSegments: t,
            tubularSegments: i,
            arc: o
        },
        A = A || 1,
        e = e || .4,
        t = Math.floor(t) || 8,
        i = Math.floor(i) || 6,
        o = o || 2 * Math.PI;
        var n, r, a = [], s = [], l = [], c = [], h = new y, d = new y, p = new y;
        for (n = 0; t >= n; n++)
            for (r = 0; i >= r; r++) {
                var g = r / i * o
                  , u = n / t * Math.PI * 2;
                d.x = (A + e * Math.cos(u)) * Math.cos(g),
                d.y = (A + e * Math.cos(u)) * Math.sin(g),
                d.z = e * Math.sin(u),
                s.push(d.x, d.y, d.z),
                h.x = A * Math.cos(g),
                h.y = A * Math.sin(g),
                p.subVectors(d, h).normalize(),
                l.push(p.x, p.y, p.z),
                c.push(r / i),
                c.push(n / t)
            }
        for (n = 1; t >= n; n++)
            for (r = 1; i >= r; r++) {
                var f = (i + 1) * (n - 1) + r - 1
                  , m = (i + 1) * (n - 1) + r
                  , C = (i + 1) * n + r;
                a.push((i + 1) * n + r - 1, f, C),
                a.push(f, m, C)
            }
        this.setIndex(a),
        this.setAttribute("position", new Ae(s,3)),
        this.setAttribute("normal", new Ae(l,3)),
        this.setAttribute("uv", new Ae(c,2))
    }
    Xo.prototype = Object.assign(Object.create(H.prototype), {
        constructor: Xo,
        isPoints: !0,
        raycast: function(A, e) {
            var t = this.geometry
              , i = this.matrixWorld
              , o = A.params.Points.threshold;
            if (null === t.boundingSphere && t.computeBoundingSphere(),
            zo.copy(t.boundingSphere),
            zo.applyMatrix4(i),
            zo.radius += o,
            !1 !== A.ray.intersectsSphere(zo)) {
                Wo.getInverse(i),
                Jo.copy(A.ray).applyMatrix4(Wo);
                var n = o / ((this.scale.x + this.scale.y + this.scale.z) / 3)
                  , r = n * n;
                if (t.isBufferGeometry) {
                    var a = t.index
                      , s = t.attributes.position.array;
                    if (null !== a)
                        for (var l = a.array, c = 0, h = l.length; h > c; c++) {
                            var d = l[c];
                            Zo.fromArray(s, 3 * d),
                            _o(Zo, d, r, i, A, e, this)
                        }
                    else {
                        c = 0;
                        for (var p = s.length / 3; p > c; c++)
                            Zo.fromArray(s, 3 * c),
                            _o(Zo, c, r, i, A, e, this)
                    }
                } else {
                    var g = t.vertices;
                    for (c = 0,
                    p = g.length; p > c; c++)
                        _o(g[c], c, r, i, A, e, this)
                }
            }
        },
        updateMorphTargets: function() {
            var A, e, t, i = this.geometry;
            if (i.isBufferGeometry) {
                var o = i.morphAttributes
                  , n = Object.keys(o);
                if (n.length > 0) {
                    var r = o[n[0]];
                    if (void 0 !== r)
                        for (this.morphTargetInfluences = [],
                        this.morphTargetDictionary = {},
                        A = 0,
                        e = r.length; e > A; A++)
                            t = r[A].name || String(A),
                            this.morphTargetInfluences.push(0),
                            this.morphTargetDictionary[t] = A
                }
            } else {
                var a = i.morphTargets;
                void 0 !== a && a.length > 0 && console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")
            }
        },
        clone: function() {
            return new this.constructor(this.geometry,this.material).copy(this)
        }
    }),
    $o.prototype = Object.assign(Object.create(d.prototype), {
        constructor: $o,
        isVideoTexture: !0,
        update: function() {
            var A = this.image;
            A.HAVE_CURRENT_DATA > A.readyState || (this.needsUpdate = !0)
        }
    }),
    (An.prototype = Object.create(d.prototype)).constructor = An,
    An.prototype.isCompressedTexture = !0,
    (en.prototype = Object.create(d.prototype)).constructor = en,
    en.prototype.isCanvasTexture = !0,
    (tn.prototype = Object.create(d.prototype)).constructor = tn,
    tn.prototype.isDepthTexture = !0,
    (on.prototype = Object.create(he.prototype)).constructor = on,
    (nn.prototype = Object.create(De.prototype)).constructor = nn,
    (rn.prototype = Object.create(he.prototype)).constructor = rn,
    (an.prototype = Object.create(De.prototype)).constructor = an,
    (sn.prototype = Object.create(he.prototype)).constructor = sn,
    (ln.prototype = Object.create(De.prototype)).constructor = ln,
    (cn.prototype = Object.create(sn.prototype)).constructor = cn,
    (hn.prototype = Object.create(De.prototype)).constructor = hn,
    (dn.prototype = Object.create(sn.prototype)).constructor = dn,
    (pn.prototype = Object.create(De.prototype)).constructor = pn,
    (gn.prototype = Object.create(sn.prototype)).constructor = gn,
    (un.prototype = Object.create(De.prototype)).constructor = un,
    (fn.prototype = Object.create(sn.prototype)).constructor = fn,
    (mn.prototype = Object.create(De.prototype)).constructor = mn,
    (Cn.prototype = Object.create(he.prototype)).constructor = Cn,
    Cn.prototype.toJSON = function() {
        var A = he.prototype.toJSON.call(this);
        return A.path = this.parameters.path.toJSON(),
        A
    }
    ,
    (yn.prototype = Object.create(De.prototype)).constructor = yn,
    (vn.prototype = Object.create(he.prototype)).constructor = vn,
    (In.prototype = Object.create(De.prototype)).constructor = In,
    (En.prototype = Object.create(he.prototype)).constructor = En;
    var Bn = function(A, e, t) {
        t = t || 2;
        var i, o, n, r, a, s, l, c = e && e.length, h = c ? e[0] * t : A.length, d = xn(A, 0, h, t, !0), p = [];
        if (!d || d.next === d.prev)
            return p;
        if (c && (d = function(A, e, t, i) {
            var o, n, r, a = [];
            for (o = 0,
            n = e.length; n > o; o++)
                (r = xn(A, e[o] * i, n - 1 > o ? e[o + 1] * i : A.length, i, !1)) === r.next && (r.steiner = !0),
                a.push(Tn(r));
            for (a.sort(Kn),
            o = 0; a.length > o; o++)
                Qn(a[o], t),
                t = Sn(t, t.next);
            return t
        }(A, e, d, t)),
        A.length > 80 * t) {
            i = n = A[0],
            o = r = A[1];
            for (var g = t; h > g; g += t)
                i > (a = A[g]) && (i = a),
                o > (s = A[g + 1]) && (o = s),
                a > n && (n = a),
                s > r && (r = s);
            l = 0 !== (l = Math.max(n - i, r - o)) ? 1 / l : 0
        }
        return wn(d, p, t, i, o, l),
        p
    };
    function xn(A, e, t, i, o) {
        var n, r;
        if (o === function(A, e, t, i) {
            for (var o = 0, n = e, r = t - i; t > n; n += i)
                o += (A[r] - A[n]) * (A[n + 1] + A[r + 1]),
                r = n;
            return o
        }(A, e, t, i) > 0)
            for (n = e; t > n; n += i)
                r = Pn(n, A[n], A[n + 1], r);
        else
            for (n = t - i; n >= e; n -= i)
                r = Pn(n, A[n], A[n + 1], r);
        return r && Nn(r, r.next) && (qn(r),
        r = r.next),
        r
    }
    function Sn(A, e) {
        if (!A)
            return A;
        e || (e = A);
        var t, i = A;
        do {
            if (t = !1,
            i.steiner || !Nn(i, i.next) && 0 !== Ln(i.prev, i, i.next))
                i = i.next;
            else {
                if (qn(i),
                (i = e = i.prev) === i.next)
                    break;
                t = !0
            }
        } while (t || i !== e);return e
    }
    function wn(A, e, t, i, o, n, r) {
        if (A) {
            !r && n && function(A, e, t, i) {
                var o = A;
                do {
                    null === o.z && (o.z = Rn(o.x, o.y, e, t, i)),
                    o.prevZ = o.prev,
                    o.nextZ = o.next,
                    o = o.next
                } while (o !== A);o.prevZ.nextZ = null,
                o.prevZ = null,
                function(A) {
                    var e, t, i, o, n, r, a, s, l = 1;
                    do {
                        for (t = A,
                        A = null,
                        n = null,
                        r = 0; t; ) {
                            for (r++,
                            i = t,
                            a = 0,
                            e = 0; l > e && (a++,
                            i = i.nextZ); e++)
                                ;
                            for (s = l; a > 0 || s > 0 && i; )
                                0 === a || 0 !== s && i && t.z > i.z ? (o = i,
                                i = i.nextZ,
                                s--) : (o = t,
                                t = t.nextZ,
                                a--),
                                n ? n.nextZ = o : A = o,
                                o.prevZ = n,
                                n = o;
                            t = i
                        }
                        n.nextZ = null,
                        l *= 2
                    } while (r > 1)
                }(o)
            }(A, i, o, n);
            for (var a, s, l = A; A.prev !== A.next; )
                if (a = A.prev,
                s = A.next,
                n ? bn(A, i, o, n) : Mn(A))
                    e.push(a.i / t),
                    e.push(A.i / t),
                    e.push(s.i / t),
                    qn(A),
                    A = s.next,
                    l = s.next;
                else if ((A = s) === l) {
                    r ? 1 === r ? wn(A = Un(A, e, t), e, t, i, o, n, 2) : 2 === r && Fn(A, e, t, i, o, n) : wn(Sn(A), e, t, i, o, n, 1);
                    break
                }
        }
    }
    function Mn(A) {
        var e = A.prev
          , t = A
          , i = A.next;
        if (Ln(e, t, i) >= 0)
            return !1;
        for (var o = A.next.next; o !== A.prev; ) {
            if (kn(e.x, e.y, t.x, t.y, i.x, i.y, o.x, o.y) && Ln(o.prev, o, o.next) >= 0)
                return !1;
            o = o.next
        }
        return !0
    }
    function bn(A, e, t, i) {
        var o = A.prev
          , n = A
          , r = A.next;
        if (Ln(o, n, r) >= 0)
            return !1;
        for (var a = o.x > n.x ? o.x > r.x ? o.x : r.x : n.x > r.x ? n.x : r.x, s = o.y > n.y ? o.y > r.y ? o.y : r.y : n.y > r.y ? n.y : r.y, l = Rn(n.x > o.x ? r.x > o.x ? o.x : r.x : r.x > n.x ? n.x : r.x, n.y > o.y ? r.y > o.y ? o.y : r.y : r.y > n.y ? n.y : r.y, e, t, i), c = Rn(a, s, e, t, i), h = A.prevZ, d = A.nextZ; h && h.z >= l && d && c >= d.z; ) {
            if (h !== A.prev && h !== A.next && kn(o.x, o.y, n.x, n.y, r.x, r.y, h.x, h.y) && Ln(h.prev, h, h.next) >= 0)
                return !1;
            if (h = h.prevZ,
            d !== A.prev && d !== A.next && kn(o.x, o.y, n.x, n.y, r.x, r.y, d.x, d.y) && Ln(d.prev, d, d.next) >= 0)
                return !1;
            d = d.nextZ
        }
        for (; h && h.z >= l; ) {
            if (h !== A.prev && h !== A.next && kn(o.x, o.y, n.x, n.y, r.x, r.y, h.x, h.y) && Ln(h.prev, h, h.next) >= 0)
                return !1;
            h = h.prevZ
        }
        for (; d && c >= d.z; ) {
            if (d !== A.prev && d !== A.next && kn(o.x, o.y, n.x, n.y, r.x, r.y, d.x, d.y) && Ln(d.prev, d, d.next) >= 0)
                return !1;
            d = d.nextZ
        }
        return !0
    }
    function Un(A, e, t) {
        var i = A;
        do {
            var o = i.prev
              , n = i.next.next;
            !Nn(o, n) && On(o, i, i.next, n) && Vn(o, n) && Vn(n, o) && (e.push(o.i / t),
            e.push(i.i / t),
            e.push(n.i / t),
            qn(i),
            qn(i.next),
            i = A = n),
            i = i.next
        } while (i !== A);return i
    }
    function Fn(A, e, t, i, o, n) {
        var r = A;
        do {
            for (var a = r.next.next; a !== r.prev; ) {
                if (r.i !== a.i && Dn(r, a)) {
                    var s = Gn(r, a);
                    return r = Sn(r, r.next),
                    s = Sn(s, s.next),
                    wn(r, e, t, i, o, n),
                    void wn(s, e, t, i, o, n)
                }
                a = a.next
            }
            r = r.next
        } while (r !== A)
    }
    function Kn(A, e) {
        return A.x - e.x
    }
    function Qn(A, e) {
        if (e = function(A, e) {
            var t, i = e, o = A.x, n = A.y, r = -1 / 0;
            do {
                if (i.y >= n && n >= i.next.y && i.next.y !== i.y) {
                    var a = i.x + (n - i.y) * (i.next.x - i.x) / (i.next.y - i.y);
                    if (o >= a && a > r) {
                        if (r = a,
                        a === o) {
                            if (n === i.y)
                                return i;
                            if (n === i.next.y)
                                return i.next
                        }
                        t = i.next.x > i.x ? i : i.next
                    }
                }
                i = i.next
            } while (i !== e);if (!t)
                return null;
            if (o === r)
                return t.prev;
            var s, l = t, c = t.x, h = t.y, d = 1 / 0;
            i = t.next;
            for (; i !== l; )
                i.x > o || c > i.x || o === i.x || !kn(h > n ? o : r, n, c, h, h > n ? r : o, n, i.x, i.y) || (s = Math.abs(n - i.y) / (o - i.x),
                (d > s || s === d && i.x > t.x) && Vn(i, A) && (t = i,
                d = s)),
                i = i.next;
            return t
        }(A, e)) {
            var t = Gn(e, A);
            Sn(t, t.next)
        }
    }
    function Rn(A, e, t, i, o) {
        return (A = 1431655765 & ((A = 858993459 & ((A = 252645135 & ((A = 16711935 & ((A = 32767 * (A - t) * o) | A << 8)) | A << 4)) | A << 2)) | A << 1)) | (e = 1431655765 & ((e = 858993459 & ((e = 252645135 & ((e = 16711935 & ((e = 32767 * (e - i) * o) | e << 8)) | e << 4)) | e << 2)) | e << 1)) << 1
    }
    function Tn(A) {
        var e = A
          , t = A;
        do {
            (t.x > e.x || e.x === t.x && t.y > e.y) && (t = e),
            e = e.next
        } while (e !== A);return t
    }
    function kn(A, e, t, i, o, n, r, a) {
        return (o - r) * (e - a) - (A - r) * (n - a) >= 0 && (A - r) * (i - a) - (t - r) * (e - a) >= 0 && (t - r) * (n - a) - (o - r) * (i - a) >= 0
    }
    function Dn(A, e) {
        return A.next.i !== e.i && A.prev.i !== e.i && !function(A, e) {
            var t = A;
            do {
                if (t.i !== A.i && t.next.i !== A.i && t.i !== e.i && t.next.i !== e.i && On(t, t.next, A, e))
                    return !0;
                t = t.next
            } while (t !== A);return !1
        }(A, e) && Vn(A, e) && Vn(e, A) && function(A, e) {
            var t = A
              , i = !1
              , o = (A.x + e.x) / 2
              , n = (A.y + e.y) / 2;
            do {
                t.y > n != t.next.y > n && t.next.y !== t.y && (t.next.x - t.x) * (n - t.y) / (t.next.y - t.y) + t.x > o && (i = !i),
                t = t.next
            } while (t !== A);return i
        }(A, e)
    }
    function Ln(A, e, t) {
        return (e.y - A.y) * (t.x - e.x) - (e.x - A.x) * (t.y - e.y)
    }
    function Nn(A, e) {
        return A.x === e.x && A.y === e.y
    }
    function On(A, e, t, i) {
        return !!(Nn(A, t) && Nn(e, i) || Nn(A, i) && Nn(t, e)) || Ln(A, e, t) > 0 != Ln(A, e, i) > 0 && Ln(t, i, A) > 0 != Ln(t, i, e) > 0
    }
    function Vn(A, e) {
        return 0 > Ln(A.prev, A, A.next) ? Ln(A, e, A.next) >= 0 && Ln(A, A.prev, e) >= 0 : 0 > Ln(A, e, A.prev) || 0 > Ln(A, A.next, e)
    }
    function Gn(A, e) {
        var t = new jn(A.i,A.x,A.y)
          , i = new jn(e.i,e.x,e.y)
          , o = A.next
          , n = e.prev;
        return A.next = e,
        e.prev = A,
        t.next = o,
        o.prev = t,
        i.next = t,
        t.prev = i,
        n.next = i,
        i.prev = n,
        i
    }
    function Pn(A, e, t, i) {
        var o = new jn(A,e,t);
        return i ? (o.next = i.next,
        o.prev = i,
        i.next.prev = o,
        i.next = o) : (o.prev = o,
        o.next = o),
        o
    }
    function qn(A) {
        A.next.prev = A.prev,
        A.prev.next = A.next,
        A.prevZ && (A.prevZ.nextZ = A.nextZ),
        A.nextZ && (A.nextZ.prevZ = A.prevZ)
    }
    function jn(A, e, t) {
        this.i = A,
        this.x = e,
        this.y = t,
        this.prev = null,
        this.next = null,
        this.z = null,
        this.prevZ = null,
        this.nextZ = null,
        this.steiner = !1
    }
    var Hn = {
        area: function(A) {
            for (var e = A.length, t = 0, i = e - 1, o = 0; e > o; i = o++)
                t += A[i].x * A[o].y - A[o].x * A[i].y;
            return .5 * t
        },
        isClockWise: function(A) {
            return 0 > Hn.area(A)
        },
        triangulateShape: function(A, e) {
            var t = []
              , i = []
              , o = [];
            Yn(A),
            Wn(t, A);
            var n = A.length;
            e.forEach(Yn);
            for (var r = 0; e.length > r; r++)
                i.push(n),
                n += e[r].length,
                Wn(t, e[r]);
            var a = Bn(t, i);
            for (r = 0; a.length > r; r += 3)
                o.push(a.slice(r, r + 3));
            return o
        }
    };
    function Yn(A) {
        var e = A.length;
        e > 2 && A[e - 1].equals(A[0]) && A.pop()
    }
    function Wn(A, e) {
        for (var t = 0; e.length > t; t++)
            A.push(e[t].x),
            A.push(e[t].y)
    }
    function Jn(A, e) {
        De.call(this),
        this.type = "ExtrudeGeometry",
        this.parameters = {
            shapes: A,
            options: e
        },
        this.fromBufferGeometry(new zn(A,e)),
        this.mergeVertices()
    }
    function zn(A, e) {
        he.call(this),
        this.type = "ExtrudeBufferGeometry",
        this.parameters = {
            shapes: A,
            options: e
        },
        A = Array.isArray(A) ? A : [A];
        for (var t = this, i = [], o = [], n = 0, r = A.length; r > n; n++) {
            a(A[n])
        }
        function a(A) {
            var n = []
              , r = void 0 !== e.curveSegments ? e.curveSegments : 12
              , a = void 0 !== e.steps ? e.steps : 1
              , l = void 0 !== e.depth ? e.depth : 100
              , c = void 0 === e.bevelEnabled || e.bevelEnabled
              , h = void 0 !== e.bevelThickness ? e.bevelThickness : 6
              , d = void 0 !== e.bevelSize ? e.bevelSize : h - 2
              , p = void 0 !== e.bevelOffset ? e.bevelOffset : 0
              , g = void 0 !== e.bevelSegments ? e.bevelSegments : 3
              , u = e.extrudePath
              , f = void 0 !== e.UVGenerator ? e.UVGenerator : Zn;
            void 0 !== e.amount && (console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),
            l = e.amount);
            var m, C, v, I, E, B, x, S, w = !1;
            u && (m = u.getSpacedPoints(a),
            w = !0,
            c = !1,
            C = u.computeFrenetFrames(a, !1),
            v = new y,
            I = new y,
            E = new y),
            c || (g = 0,
            h = 0,
            d = 0,
            p = 0);
            var M = A.extractPoints(r)
              , b = M.shape
              , U = M.holes;
            if (!Hn.isClockWise(b))
                for (b = b.reverse(),
                x = 0,
                S = U.length; S > x; x++)
                    Hn.isClockWise(B = U[x]) && (U[x] = B.reverse());
            var F = Hn.triangulateShape(b, U)
              , K = b;
            for (x = 0,
            S = U.length; S > x; x++)
                b = b.concat(B = U[x]);
            function Q(A, e, t) {
                return e || console.error("THREE.ExtrudeGeometry: vec does not exist"),
                e.clone().multiplyScalar(t).add(A)
            }
            var R, T, k, D, L, N, O = b.length, V = F.length;
            function G(A, e, t) {
                var i, o, n, r = A.x - e.x, a = A.y - e.y, l = t.x - A.x, c = t.y - A.y, h = r * r + a * a;
                if (Math.abs(r * c - a * l) > Number.EPSILON) {
                    var d = Math.sqrt(h)
                      , p = Math.sqrt(l * l + c * c)
                      , g = e.x - a / d
                      , u = e.y + r / d
                      , f = ((t.x - c / p - g) * c - (t.y + l / p - u) * l) / (r * c - a * l)
                      , m = (i = g + r * f - A.x) * i + (o = u + a * f - A.y) * o;
                    if (2 >= m)
                        return new s(i,o);
                    n = Math.sqrt(m / 2)
                } else {
                    var C = !1;
                    r > Number.EPSILON ? l > Number.EPSILON && (C = !0) : -Number.EPSILON > r ? -Number.EPSILON > l && (C = !0) : Math.sign(a) === Math.sign(c) && (C = !0),
                    C ? (i = -a,
                    o = r,
                    n = Math.sqrt(h)) : (i = r,
                    o = a,
                    n = Math.sqrt(h / 2))
                }
                return new s(i / n,o / n)
            }
            for (var P = [], q = 0, j = K.length, H = j - 1, Y = q + 1; j > q; q++,
            H++,
            Y++)
                H === j && (H = 0),
                Y === j && (Y = 0),
                P[q] = G(K[q], K[H], K[Y]);
            var W, J, z = [], Z = P.concat();
            for (x = 0,
            S = U.length; S > x; x++) {
                for (W = [],
                H = (j = (B = U[x]).length) - 1,
                Y = (q = 0) + 1; j > q; q++,
                H++,
                Y++)
                    H === j && (H = 0),
                    Y === j && (Y = 0),
                    W[q] = G(B[q], B[H], B[Y]);
                z.push(W),
                Z = Z.concat(W)
            }
            for (R = 0; g > R; R++) {
                for (k = R / g,
                D = h * Math.cos(k * Math.PI / 2),
                T = d * Math.sin(k * Math.PI / 2) + p,
                q = 0,
                j = K.length; j > q; q++)
                    _((L = Q(K[q], P[q], T)).x, L.y, -D);
                for (x = 0,
                S = U.length; S > x; x++)
                    for (W = z[x],
                    q = 0,
                    j = (B = U[x]).length; j > q; q++)
                        _((L = Q(B[q], W[q], T)).x, L.y, -D)
            }
            for (T = d + p,
            q = 0; O > q; q++)
                L = c ? Q(b[q], Z[q], T) : b[q],
                w ? (I.copy(C.normals[0]).multiplyScalar(L.x),
                v.copy(C.binormals[0]).multiplyScalar(L.y),
                E.copy(m[0]).add(I).add(v),
                _(E.x, E.y, E.z)) : _(L.x, L.y, 0);
            for (J = 1; a >= J; J++)
                for (q = 0; O > q; q++)
                    L = c ? Q(b[q], Z[q], T) : b[q],
                    w ? (I.copy(C.normals[J]).multiplyScalar(L.x),
                    v.copy(C.binormals[J]).multiplyScalar(L.y),
                    E.copy(m[J]).add(I).add(v),
                    _(E.x, E.y, E.z)) : _(L.x, L.y, l / a * J);
            for (R = g - 1; R >= 0; R--) {
                for (k = R / g,
                D = h * Math.cos(k * Math.PI / 2),
                T = d * Math.sin(k * Math.PI / 2) + p,
                q = 0,
                j = K.length; j > q; q++)
                    _((L = Q(K[q], P[q], T)).x, L.y, l + D);
                for (x = 0,
                S = U.length; S > x; x++)
                    for (W = z[x],
                    q = 0,
                    j = (B = U[x]).length; j > q; q++)
                        L = Q(B[q], W[q], T),
                        w ? _(L.x, L.y + m[a - 1].y, m[a - 1].x + D) : _(L.x, L.y, l + D)
            }
            function X(A, e) {
                var t, i;
                for (q = A.length; --q >= 0; ) {
                    t = q,
                    0 > (i = q - 1) && (i = A.length - 1);
                    var o = 0
                      , n = a + 2 * g;
                    for (o = 0; n > o; o++) {
                        var r = O * o
                          , s = O * (o + 1);
                        AA(e + t + r, e + i + r, e + i + s, e + t + s)
                    }
                }
            }
            function _(A, e, t) {
                n.push(A),
                n.push(e),
                n.push(t)
            }
            function $(A, e, o) {
                eA(A),
                eA(e),
                eA(o);
                var n = i.length / 3
                  , r = f.generateTopUV(t, i, n - 3, n - 2, n - 1);
                tA(r[0]),
                tA(r[1]),
                tA(r[2])
            }
            function AA(A, e, o, n) {
                eA(A),
                eA(e),
                eA(n),
                eA(e),
                eA(o),
                eA(n);
                var r = i.length / 3
                  , a = f.generateSideWallUV(t, i, r - 6, r - 3, r - 2, r - 1);
                tA(a[0]),
                tA(a[1]),
                tA(a[3]),
                tA(a[1]),
                tA(a[2]),
                tA(a[3])
            }
            function eA(A) {
                i.push(n[3 * A + 0]),
                i.push(n[3 * A + 1]),
                i.push(n[3 * A + 2])
            }
            function tA(A) {
                o.push(A.x),
                o.push(A.y)
            }
            !function() {
                var A = i.length / 3;
                if (c) {
                    var e = 0
                      , o = O * e;
                    for (q = 0; V > q; q++)
                        $((N = F[q])[2] + o, N[1] + o, N[0] + o);
                    for (o = O * (e = a + 2 * g),
                    q = 0; V > q; q++)
                        $((N = F[q])[0] + o, N[1] + o, N[2] + o)
                } else {
                    for (q = 0; V > q; q++)
                        $((N = F[q])[2], N[1], N[0]);
                    for (q = 0; V > q; q++)
                        $((N = F[q])[0] + O * a, N[1] + O * a, N[2] + O * a)
                }
                t.addGroup(A, i.length / 3 - A, 0)
            }(),
            function() {
                var A = i.length / 3
                  , e = 0;
                for (X(K, e),
                e += K.length,
                x = 0,
                S = U.length; S > x; x++)
                    X(B = U[x], e),
                    e += B.length;
                t.addGroup(A, i.length / 3 - A, 1)
            }()
        }
        this.setAttribute("position", new Ae(i,3)),
        this.setAttribute("uv", new Ae(o,2)),
        this.computeVertexNormals()
    }
    (Jn.prototype = Object.create(De.prototype)).constructor = Jn,
    Jn.prototype.toJSON = function() {
        var A = De.prototype.toJSON.call(this);
        return Xn(this.parameters.shapes, this.parameters.options, A)
    }
    ,
    (zn.prototype = Object.create(he.prototype)).constructor = zn,
    zn.prototype.toJSON = function() {
        var A = he.prototype.toJSON.call(this);
        return Xn(this.parameters.shapes, this.parameters.options, A)
    }
    ;
    var Zn = {
        generateTopUV: function(A, e, t, i, o) {
            var n = e[3 * i]
              , r = e[3 * i + 1]
              , a = e[3 * o]
              , l = e[3 * o + 1];
            return [new s(e[3 * t],e[3 * t + 1]), new s(n,r), new s(a,l)]
        },
        generateSideWallUV: function(A, e, t, i, o, n) {
            var r = e[3 * t]
              , a = e[3 * t + 1]
              , l = e[3 * t + 2]
              , c = e[3 * i]
              , h = e[3 * i + 1]
              , d = e[3 * i + 2]
              , p = e[3 * o]
              , g = e[3 * o + 1]
              , u = e[3 * o + 2]
              , f = e[3 * n]
              , m = e[3 * n + 1]
              , C = e[3 * n + 2];
            return .01 > Math.abs(a - h) ? [new s(r,1 - l), new s(c,1 - d), new s(p,1 - u), new s(f,1 - C)] : [new s(a,1 - l), new s(h,1 - d), new s(g,1 - u), new s(m,1 - C)]
        }
    };
    function Xn(A, e, t) {
        if (t.shapes = [],
        Array.isArray(A))
            for (var i = 0, o = A.length; o > i; i++) {
                t.shapes.push(A[i].uuid)
            }
        else
            t.shapes.push(A.uuid);
        return void 0 !== e.extrudePath && (t.options.extrudePath = e.extrudePath.toJSON()),
        t
    }
    function _n(A, e) {
        De.call(this),
        this.type = "TextGeometry",
        this.parameters = {
            text: A,
            parameters: e
        },
        this.fromBufferGeometry(new $n(A,e)),
        this.mergeVertices()
    }
    function $n(A, e) {
        var t = (e = e || {}).font;
        if (!t || !t.isFont)
            return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),
            new De;
        var i = t.generateShapes(A, e.size);
        e.depth = void 0 !== e.height ? e.height : 50,
        void 0 === e.bevelThickness && (e.bevelThickness = 10),
        void 0 === e.bevelSize && (e.bevelSize = 8),
        void 0 === e.bevelEnabled && (e.bevelEnabled = !1),
        zn.call(this, i, e),
        this.type = "TextBufferGeometry"
    }
    function Ar(A, e, t, i, o, n, r) {
        De.call(this),
        this.type = "SphereGeometry",
        this.parameters = {
            radius: A,
            widthSegments: e,
            heightSegments: t,
            phiStart: i,
            phiLength: o,
            thetaStart: n,
            thetaLength: r
        },
        this.fromBufferGeometry(new er(A,e,t,i,o,n,r)),
        this.mergeVertices()
    }
    function er(A, e, t, i, o, n, r) {
        he.call(this),
        this.type = "SphereBufferGeometry",
        this.parameters = {
            radius: A,
            widthSegments: e,
            heightSegments: t,
            phiStart: i,
            phiLength: o,
            thetaStart: n,
            thetaLength: r
        },
        A = A || 1,
        e = Math.max(3, Math.floor(e) || 8),
        t = Math.max(2, Math.floor(t) || 6),
        i = void 0 !== i ? i : 0,
        o = void 0 !== o ? o : 2 * Math.PI,
        n = void 0 !== n ? n : 0,
        r = void 0 !== r ? r : Math.PI;
        var a, s, l = Math.min(n + r, Math.PI), c = 0, h = [], d = new y, p = new y, g = [], u = [], f = [], m = [];
        for (s = 0; t >= s; s++) {
            var C = []
              , v = s / t
              , I = 0;
            for (0 == s && 0 == n ? I = .5 / e : s == t && l == Math.PI && (I = -.5 / e),
            a = 0; e >= a; a++) {
                var E = a / e;
                d.x = -A * Math.cos(i + E * o) * Math.sin(n + v * r),
                d.y = A * Math.cos(n + v * r),
                d.z = A * Math.sin(i + E * o) * Math.sin(n + v * r),
                u.push(d.x, d.y, d.z),
                p.copy(d).normalize(),
                f.push(p.x, p.y, p.z),
                m.push(E + I, 1 - v),
                C.push(c++)
            }
            h.push(C)
        }
        for (s = 0; t > s; s++)
            for (a = 0; e > a; a++) {
                var B = h[s][a]
                  , x = h[s + 1][a]
                  , S = h[s + 1][a + 1];
                (0 !== s || n > 0) && g.push(h[s][a + 1], B, S),
                (s !== t - 1 || l < Math.PI) && g.push(B, x, S)
            }
        this.setIndex(g),
        this.setAttribute("position", new Ae(u,3)),
        this.setAttribute("normal", new Ae(f,3)),
        this.setAttribute("uv", new Ae(m,2))
    }
    function tr(A, e, t, i, o, n) {
        De.call(this),
        this.type = "RingGeometry",
        this.parameters = {
            innerRadius: A,
            outerRadius: e,
            thetaSegments: t,
            phiSegments: i,
            thetaStart: o,
            thetaLength: n
        },
        this.fromBufferGeometry(new ir(A,e,t,i,o,n)),
        this.mergeVertices()
    }
    function ir(A, e, t, i, o, n) {
        he.call(this),
        this.type = "RingBufferGeometry",
        this.parameters = {
            innerRadius: A,
            outerRadius: e,
            thetaSegments: t,
            phiSegments: i,
            thetaStart: o,
            thetaLength: n
        },
        A = A || .5,
        e = e || 1,
        o = void 0 !== o ? o : 0,
        n = void 0 !== n ? n : 2 * Math.PI,
        t = void 0 !== t ? Math.max(3, t) : 8;
        var r, a, l, c = [], h = [], d = [], p = [], g = A, u = (e - A) / (i = void 0 !== i ? Math.max(1, i) : 1), f = new y, m = new s;
        for (a = 0; i >= a; a++) {
            for (l = 0; t >= l; l++)
                r = o + l / t * n,
                f.x = g * Math.cos(r),
                f.y = g * Math.sin(r),
                h.push(f.x, f.y, f.z),
                d.push(0, 0, 1),
                m.x = (f.x / e + 1) / 2,
                m.y = (f.y / e + 1) / 2,
                p.push(m.x, m.y);
            g += u
        }
        for (a = 0; i > a; a++) {
            var C = a * (t + 1);
            for (l = 0; t > l; l++) {
                var v = (r = l + C) + t + 1
                  , I = r + t + 2
                  , E = r + 1;
                c.push(r, v, E),
                c.push(v, I, E)
            }
        }
        this.setIndex(c),
        this.setAttribute("position", new Ae(h,3)),
        this.setAttribute("normal", new Ae(d,3)),
        this.setAttribute("uv", new Ae(p,2))
    }
    function or(A, e, t, i) {
        De.call(this),
        this.type = "LatheGeometry",
        this.parameters = {
            points: A,
            segments: e,
            phiStart: t,
            phiLength: i
        },
        this.fromBufferGeometry(new nr(A,e,t,i)),
        this.mergeVertices()
    }
    function nr(A, e, t, i) {
        he.call(this),
        this.type = "LatheBufferGeometry",
        this.parameters = {
            points: A,
            segments: e,
            phiStart: t,
            phiLength: i
        },
        e = Math.floor(e) || 12,
        t = t || 0,
        i = i || 2 * Math.PI,
        i = a.clamp(i, 0, 2 * Math.PI);
        var o, n, r, l = [], c = [], h = [], d = 1 / e, p = new y, g = new s;
        for (n = 0; e >= n; n++) {
            var u = t + n * d * i
              , f = Math.sin(u)
              , m = Math.cos(u);
            for (r = 0; A.length - 1 >= r; r++)
                p.x = A[r].x * f,
                p.y = A[r].y,
                p.z = A[r].x * m,
                c.push(p.x, p.y, p.z),
                g.x = n / e,
                g.y = r / (A.length - 1),
                h.push(g.x, g.y)
        }
        for (n = 0; e > n; n++)
            for (r = 0; A.length - 1 > r; r++) {
                var C = (o = r + n * A.length) + A.length
                  , v = o + A.length + 1
                  , I = o + 1;
                l.push(o, C, I),
                l.push(C, v, I)
            }
        if (this.setIndex(l),
        this.setAttribute("position", new Ae(c,3)),
        this.setAttribute("uv", new Ae(h,2)),
        this.computeVertexNormals(),
        i === 2 * Math.PI) {
            var E = this.attributes.normal.array
              , B = new y
              , x = new y
              , S = new y;
            for (o = e * A.length * 3,
            n = 0,
            r = 0; A.length > n; n++,
            r += 3)
                B.x = E[r + 0],
                B.y = E[r + 1],
                B.z = E[r + 2],
                x.x = E[o + r + 0],
                x.y = E[o + r + 1],
                x.z = E[o + r + 2],
                S.addVectors(B, x).normalize(),
                E[r + 0] = E[o + r + 0] = S.x,
                E[r + 1] = E[o + r + 1] = S.y,
                E[r + 2] = E[o + r + 2] = S.z
        }
    }
    function rr(A, e) {
        De.call(this),
        this.type = "ShapeGeometry",
        "object" == typeof e && (console.warn("THREE.ShapeGeometry: Options parameter has been removed."),
        e = e.curveSegments),
        this.parameters = {
            shapes: A,
            curveSegments: e
        },
        this.fromBufferGeometry(new ar(A,e)),
        this.mergeVertices()
    }
    function ar(A, e) {
        he.call(this),
        this.type = "ShapeBufferGeometry",
        this.parameters = {
            shapes: A,
            curveSegments: e
        },
        e = e || 12;
        var t = []
          , i = []
          , o = []
          , n = []
          , r = 0
          , a = 0;
        if (!1 === Array.isArray(A))
            l(A);
        else
            for (var s = 0; A.length > s; s++)
                l(A[s]),
                this.addGroup(r, a, s),
                r += a,
                a = 0;
        function l(A) {
            var r, s, l, c = i.length / 3, h = A.extractPoints(e), d = h.shape, p = h.holes;
            for (!1 === Hn.isClockWise(d) && (d = d.reverse()),
            r = 0,
            s = p.length; s > r; r++)
                !0 === Hn.isClockWise(l = p[r]) && (p[r] = l.reverse());
            var g = Hn.triangulateShape(d, p);
            for (r = 0,
            s = p.length; s > r; r++)
                d = d.concat(l = p[r]);
            for (r = 0,
            s = d.length; s > r; r++) {
                var u = d[r];
                i.push(u.x, u.y, 0),
                o.push(0, 0, 1),
                n.push(u.x, u.y)
            }
            for (r = 0,
            s = g.length; s > r; r++) {
                var f = g[r];
                t.push(f[0] + c, f[1] + c, f[2] + c),
                a += 3
            }
        }
        this.setIndex(t),
        this.setAttribute("position", new Ae(i,3)),
        this.setAttribute("normal", new Ae(o,3)),
        this.setAttribute("uv", new Ae(n,2))
    }
    function sr(A, e) {
        if (e.shapes = [],
        Array.isArray(A))
            for (var t = 0, i = A.length; i > t; t++) {
                e.shapes.push(A[t].uuid)
            }
        else
            e.shapes.push(A.uuid);
        return e
    }
    function lr(A, e) {
        he.call(this),
        this.type = "EdgesGeometry",
        this.parameters = {
            thresholdAngle: e
        },
        e = void 0 !== e ? e : 1;
        var t, i, o, n, r = [], s = Math.cos(a.DEG2RAD * e), l = [0, 0], c = {}, h = ["a", "b", "c"];
        A.isBufferGeometry ? (n = new De).fromBufferGeometry(A) : n = A.clone(),
        n.mergeVertices(),
        n.computeFaceNormals();
        for (var d = n.vertices, p = n.faces, g = 0, u = p.length; u > g; g++)
            for (var f = p[g], m = 0; 3 > m; m++)
                t = f[h[m]],
                i = f[h[(m + 1) % 3]],
                l[0] = Math.min(t, i),
                l[1] = Math.max(t, i),
                void 0 === c[o = l[0] + "," + l[1]] ? c[o] = {
                    index1: l[0],
                    index2: l[1],
                    face1: g,
                    face2: void 0
                } : c[o].face2 = g;
        for (o in c) {
            var C = c[o];
            if (void 0 === C.face2 || p[C.face1].normal.dot(p[C.face2].normal) <= s) {
                var y = d[C.index1];
                r.push(y.x, y.y, y.z),
                r.push((y = d[C.index2]).x, y.y, y.z)
            }
        }
        this.setAttribute("position", new Ae(r,3))
    }
    function cr(A, e, t, i, o, n, r, a) {
        De.call(this),
        this.type = "CylinderGeometry",
        this.parameters = {
            radiusTop: A,
            radiusBottom: e,
            height: t,
            radialSegments: i,
            heightSegments: o,
            openEnded: n,
            thetaStart: r,
            thetaLength: a
        },
        this.fromBufferGeometry(new hr(A,e,t,i,o,n,r,a)),
        this.mergeVertices()
    }
    function hr(A, e, t, i, o, n, r, a) {
        he.call(this),
        this.type = "CylinderBufferGeometry",
        this.parameters = {
            radiusTop: A,
            radiusBottom: e,
            height: t,
            radialSegments: i,
            heightSegments: o,
            openEnded: n,
            thetaStart: r,
            thetaLength: a
        };
        var l = this;
        A = void 0 !== A ? A : 1,
        e = void 0 !== e ? e : 1,
        t = t || 1,
        i = Math.floor(i) || 8,
        o = Math.floor(o) || 1,
        n = void 0 !== n && n,
        r = void 0 !== r ? r : 0,
        a = void 0 !== a ? a : 2 * Math.PI;
        var c = []
          , h = []
          , d = []
          , p = []
          , g = 0
          , u = []
          , f = t / 2
          , m = 0;
        function C(t) {
            var o, n, u, C = new s, v = new y, I = 0, E = !0 === t ? A : e, B = !0 === t ? 1 : -1;
            for (n = g,
            o = 1; i >= o; o++)
                h.push(0, f * B, 0),
                d.push(0, B, 0),
                p.push(.5, .5),
                g++;
            for (u = g,
            o = 0; i >= o; o++) {
                var x = o / i * a + r
                  , S = Math.cos(x)
                  , w = Math.sin(x);
                v.x = E * w,
                v.y = f * B,
                v.z = E * S,
                h.push(v.x, v.y, v.z),
                d.push(0, B, 0),
                C.x = .5 * S + .5,
                C.y = .5 * w * B + .5,
                p.push(C.x, C.y),
                g++
            }
            for (o = 0; i > o; o++) {
                var M = n + o
                  , b = u + o;
                !0 === t ? c.push(b, b + 1, M) : c.push(b + 1, b, M),
                I += 3
            }
            l.addGroup(m, I, !0 === t ? 1 : 2),
            m += I
        }
        !function() {
            var n, s, C = new y, v = new y, I = 0, E = (e - A) / t;
            for (s = 0; o >= s; s++) {
                var B = []
                  , x = s / o
                  , S = x * (e - A) + A;
                for (n = 0; i >= n; n++) {
                    var w = n / i
                      , M = w * a + r
                      , b = Math.sin(M)
                      , U = Math.cos(M);
                    v.x = S * b,
                    v.y = -x * t + f,
                    v.z = S * U,
                    h.push(v.x, v.y, v.z),
                    C.set(b, E, U).normalize(),
                    d.push(C.x, C.y, C.z),
                    p.push(w, 1 - x),
                    B.push(g++)
                }
                u.push(B)
            }
            for (n = 0; i > n; n++)
                for (s = 0; o > s; s++) {
                    var F = u[s + 1][n]
                      , K = u[s + 1][n + 1]
                      , Q = u[s][n + 1];
                    c.push(u[s][n], F, Q),
                    c.push(F, K, Q),
                    I += 6
                }
            l.addGroup(m, I, 0),
            m += I
        }(),
        !1 === n && (A > 0 && C(!0),
        e > 0 && C(!1)),
        this.setIndex(c),
        this.setAttribute("position", new Ae(h,3)),
        this.setAttribute("normal", new Ae(d,3)),
        this.setAttribute("uv", new Ae(p,2))
    }
    function dr(A, e, t, i, o, n, r) {
        cr.call(this, 0, A, e, t, i, o, n, r),
        this.type = "ConeGeometry",
        this.parameters = {
            radius: A,
            height: e,
            radialSegments: t,
            heightSegments: i,
            openEnded: o,
            thetaStart: n,
            thetaLength: r
        }
    }
    function pr(A, e, t, i, o, n, r) {
        hr.call(this, 0, A, e, t, i, o, n, r),
        this.type = "ConeBufferGeometry",
        this.parameters = {
            radius: A,
            height: e,
            radialSegments: t,
            heightSegments: i,
            openEnded: o,
            thetaStart: n,
            thetaLength: r
        }
    }
    function gr(A, e, t, i) {
        De.call(this),
        this.type = "CircleGeometry",
        this.parameters = {
            radius: A,
            segments: e,
            thetaStart: t,
            thetaLength: i
        },
        this.fromBufferGeometry(new ur(A,e,t,i)),
        this.mergeVertices()
    }
    function ur(A, e, t, i) {
        he.call(this),
        this.type = "CircleBufferGeometry",
        this.parameters = {
            radius: A,
            segments: e,
            thetaStart: t,
            thetaLength: i
        },
        A = A || 1,
        e = void 0 !== e ? Math.max(3, e) : 8,
        t = void 0 !== t ? t : 0,
        i = void 0 !== i ? i : 2 * Math.PI;
        var o, n, r = [], a = [], l = [], c = [], h = new y, d = new s;
        for (a.push(0, 0, 0),
        l.push(0, 0, 1),
        c.push(.5, .5),
        n = 0,
        o = 3; e >= n; n++,
        o += 3) {
            var p = t + n / e * i;
            h.x = A * Math.cos(p),
            h.y = A * Math.sin(p),
            a.push(h.x, h.y, h.z),
            l.push(0, 0, 1),
            d.x = (a[o] / A + 1) / 2,
            d.y = (a[o + 1] / A + 1) / 2,
            c.push(d.x, d.y)
        }
        for (o = 1; e >= o; o++)
            r.push(o, o + 1, 0);
        this.setIndex(r),
        this.setAttribute("position", new Ae(a,3)),
        this.setAttribute("normal", new Ae(l,3)),
        this.setAttribute("uv", new Ae(c,2))
    }
    (_n.prototype = Object.create(De.prototype)).constructor = _n,
    ($n.prototype = Object.create(zn.prototype)).constructor = $n,
    (Ar.prototype = Object.create(De.prototype)).constructor = Ar,
    (er.prototype = Object.create(he.prototype)).constructor = er,
    (tr.prototype = Object.create(De.prototype)).constructor = tr,
    (ir.prototype = Object.create(he.prototype)).constructor = ir,
    (or.prototype = Object.create(De.prototype)).constructor = or,
    (nr.prototype = Object.create(he.prototype)).constructor = nr,
    (rr.prototype = Object.create(De.prototype)).constructor = rr,
    rr.prototype.toJSON = function() {
        var A = De.prototype.toJSON.call(this);
        return sr(this.parameters.shapes, A)
    }
    ,
    (ar.prototype = Object.create(he.prototype)).constructor = ar,
    ar.prototype.toJSON = function() {
        var A = he.prototype.toJSON.call(this);
        return sr(this.parameters.shapes, A)
    }
    ,
    (lr.prototype = Object.create(he.prototype)).constructor = lr,
    (cr.prototype = Object.create(De.prototype)).constructor = cr,
    (hr.prototype = Object.create(he.prototype)).constructor = hr,
    (dr.prototype = Object.create(cr.prototype)).constructor = dr,
    (pr.prototype = Object.create(hr.prototype)).constructor = pr,
    (gr.prototype = Object.create(De.prototype)).constructor = gr,
    (ur.prototype = Object.create(he.prototype)).constructor = ur;
    var fr = Object.freeze({
        __proto__: null,
        WireframeGeometry: on,
        ParametricGeometry: nn,
        ParametricBufferGeometry: rn,
        TetrahedronGeometry: ln,
        TetrahedronBufferGeometry: cn,
        OctahedronGeometry: hn,
        OctahedronBufferGeometry: dn,
        IcosahedronGeometry: pn,
        IcosahedronBufferGeometry: gn,
        DodecahedronGeometry: un,
        DodecahedronBufferGeometry: fn,
        PolyhedronGeometry: an,
        PolyhedronBufferGeometry: sn,
        TubeGeometry: mn,
        TubeBufferGeometry: Cn,
        TorusKnotGeometry: yn,
        TorusKnotBufferGeometry: vn,
        TorusGeometry: In,
        TorusBufferGeometry: En,
        TextGeometry: _n,
        TextBufferGeometry: $n,
        SphereGeometry: Ar,
        SphereBufferGeometry: er,
        RingGeometry: tr,
        RingBufferGeometry: ir,
        PlaneGeometry: At,
        PlaneBufferGeometry: et,
        LatheGeometry: or,
        LatheBufferGeometry: nr,
        ShapeGeometry: rr,
        ShapeBufferGeometry: ar,
        ExtrudeGeometry: Jn,
        ExtrudeBufferGeometry: zn,
        EdgesGeometry: lr,
        ConeGeometry: dr,
        ConeBufferGeometry: pr,
        CylinderGeometry: cr,
        CylinderBufferGeometry: hr,
        CircleGeometry: gr,
        CircleBufferGeometry: ur,
        BoxGeometry: Le,
        BoxBufferGeometry: Ne
    });
    function mr(A) {
        qA.call(this),
        this.type = "ShadowMaterial",
        this.color = new LA(0),
        this.transparent = !0,
        this.setValues(A)
    }
    function Cr(A) {
        Pe.call(this, A),
        this.type = "RawShaderMaterial"
    }
    function yr(A) {
        qA.call(this),
        this.defines = {
            STANDARD: ""
        },
        this.type = "MeshStandardMaterial",
        this.color = new LA(16777215),
        this.roughness = 1,
        this.metalness = 0,
        this.map = null,
        this.lightMap = null,
        this.lightMapIntensity = 1,
        this.aoMap = null,
        this.aoMapIntensity = 1,
        this.emissive = new LA(0),
        this.emissiveIntensity = 1,
        this.emissiveMap = null,
        this.bumpMap = null,
        this.bumpScale = 1,
        this.normalMap = null,
        this.normalMapType = 0,
        this.normalScale = new s(1,1),
        this.displacementMap = null,
        this.displacementScale = 1,
        this.displacementBias = 0,
        this.roughnessMap = null,
        this.metalnessMap = null,
        this.alphaMap = null,
        this.envMap = null,
        this.envMapIntensity = 1,
        this.refractionRatio = .98,
        this.wireframe = !1,
        this.wireframeLinewidth = 1,
        this.wireframeLinecap = "round",
        this.wireframeLinejoin = "round",
        this.skinning = !1,
        this.morphTargets = !1,
        this.morphNormals = !1,
        this.vertexTangents = !1,
        this.setValues(A)
    }
    function vr(A) {
        yr.call(this),
        this.defines = {
            STANDARD: "",
            PHYSICAL: ""
        },
        this.type = "MeshPhysicalMaterial",
        this.clearcoat = 0,
        this.clearcoatMap = null,
        this.clearcoatRoughness = 0,
        this.clearcoatRoughnessMap = null,
        this.clearcoatNormalScale = new s(1,1),
        this.clearcoatNormalMap = null,
        this.reflectivity = .5,
        this.sheen = null,
        this.transparency = 0,
        this.setValues(A)
    }
    function Ir(A) {
        qA.call(this),
        this.type = "MeshPhongMaterial",
        this.color = new LA(16777215),
        this.specular = new LA(1118481),
        this.shininess = 30,
        this.map = null,
        this.lightMap = null,
        this.lightMapIntensity = 1,
        this.aoMap = null,
        this.aoMapIntensity = 1,
        this.emissive = new LA(0),
        this.emissiveIntensity = 1,
        this.emissiveMap = null,
        this.bumpMap = null,
        this.bumpScale = 1,
        this.normalMap = null,
        this.normalMapType = 0,
        this.normalScale = new s(1,1),
        this.displacementMap = null,
        this.displacementScale = 1,
        this.displacementBias = 0,
        this.specularMap = null,
        this.alphaMap = null,
        this.envMap = null,
        this.combine = 0,
        this.reflectivity = 1,
        this.refractionRatio = .98,
        this.wireframe = !1,
        this.wireframeLinewidth = 1,
        this.wireframeLinecap = "round",
        this.wireframeLinejoin = "round",
        this.skinning = !1,
        this.morphTargets = !1,
        this.morphNormals = !1,
        this.setValues(A)
    }
    function Er(A) {
        qA.call(this),
        this.defines = {
            TOON: ""
        },
        this.type = "MeshToonMaterial",
        this.color = new LA(16777215),
        this.specular = new LA(1118481),
        this.shininess = 30,
        this.map = null,
        this.gradientMap = null,
        this.lightMap = null,
        this.lightMapIntensity = 1,
        this.aoMap = null,
        this.aoMapIntensity = 1,
        this.emissive = new LA(0),
        this.emissiveIntensity = 1,
        this.emissiveMap = null,
        this.bumpMap = null,
        this.bumpScale = 1,
        this.normalMap = null,
        this.normalMapType = 0,
        this.normalScale = new s(1,1),
        this.displacementMap = null,
        this.displacementScale = 1,
        this.displacementBias = 0,
        this.specularMap = null,
        this.alphaMap = null,
        this.wireframe = !1,
        this.wireframeLinewidth = 1,
        this.wireframeLinecap = "round",
        this.wireframeLinejoin = "round",
        this.skinning = !1,
        this.morphTargets = !1,
        this.morphNormals = !1,
        this.setValues(A)
    }
    function Br(A) {
        qA.call(this),
        this.type = "MeshNormalMaterial",
        this.bumpMap = null,
        this.bumpScale = 1,
        this.normalMap = null,
        this.normalMapType = 0,
        this.normalScale = new s(1,1),
        this.displacementMap = null,
        this.displacementScale = 1,
        this.displacementBias = 0,
        this.wireframe = !1,
        this.wireframeLinewidth = 1,
        this.fog = !1,
        this.skinning = !1,
        this.morphTargets = !1,
        this.morphNormals = !1,
        this.setValues(A)
    }
    function xr(A) {
        qA.call(this),
        this.type = "MeshLambertMaterial",
        this.color = new LA(16777215),
        this.map = null,
        this.lightMap = null,
        this.lightMapIntensity = 1,
        this.aoMap = null,
        this.aoMapIntensity = 1,
        this.emissive = new LA(0),
        this.emissiveIntensity = 1,
        this.emissiveMap = null,
        this.specularMap = null,
        this.alphaMap = null,
        this.envMap = null,
        this.combine = 0,
        this.reflectivity = 1,
        this.refractionRatio = .98,
        this.wireframe = !1,
        this.wireframeLinewidth = 1,
        this.wireframeLinecap = "round",
        this.wireframeLinejoin = "round",
        this.skinning = !1,
        this.morphTargets = !1,
        this.morphNormals = !1,
        this.setValues(A)
    }
    function Sr(A) {
        qA.call(this),
        this.defines = {
            MATCAP: ""
        },
        this.type = "MeshMatcapMaterial",
        this.color = new LA(16777215),
        this.matcap = null,
        this.map = null,
        this.bumpMap = null,
        this.bumpScale = 1,
        this.normalMap = null,
        this.normalMapType = 0,
        this.normalScale = new s(1,1),
        this.displacementMap = null,
        this.displacementScale = 1,
        this.displacementBias = 0,
        this.alphaMap = null,
        this.skinning = !1,
        this.morphTargets = !1,
        this.morphNormals = !1,
        this.setValues(A)
    }
    function wr(A) {
        ko.call(this),
        this.type = "LineDashedMaterial",
        this.scale = 1,
        this.dashSize = 3,
        this.gapSize = 1,
        this.setValues(A)
    }
    (mr.prototype = Object.create(qA.prototype)).constructor = mr,
    mr.prototype.isShadowMaterial = !0,
    mr.prototype.copy = function(A) {
        return qA.prototype.copy.call(this, A),
        this.color.copy(A.color),
        this
    }
    ,
    (Cr.prototype = Object.create(Pe.prototype)).constructor = Cr,
    Cr.prototype.isRawShaderMaterial = !0,
    (yr.prototype = Object.create(qA.prototype)).constructor = yr,
    yr.prototype.isMeshStandardMaterial = !0,
    yr.prototype.copy = function(A) {
        return qA.prototype.copy.call(this, A),
        this.defines = {
            STANDARD: ""
        },
        this.color.copy(A.color),
        this.roughness = A.roughness,
        this.metalness = A.metalness,
        this.map = A.map,
        this.lightMap = A.lightMap,
        this.lightMapIntensity = A.lightMapIntensity,
        this.aoMap = A.aoMap,
        this.aoMapIntensity = A.aoMapIntensity,
        this.emissive.copy(A.emissive),
        this.emissiveMap = A.emissiveMap,
        this.emissiveIntensity = A.emissiveIntensity,
        this.bumpMap = A.bumpMap,
        this.bumpScale = A.bumpScale,
        this.normalMap = A.normalMap,
        this.normalMapType = A.normalMapType,
        this.normalScale.copy(A.normalScale),
        this.displacementMap = A.displacementMap,
        this.displacementScale = A.displacementScale,
        this.displacementBias = A.displacementBias,
        this.roughnessMap = A.roughnessMap,
        this.metalnessMap = A.metalnessMap,
        this.alphaMap = A.alphaMap,
        this.envMap = A.envMap,
        this.envMapIntensity = A.envMapIntensity,
        this.refractionRatio = A.refractionRatio,
        this.wireframe = A.wireframe,
        this.wireframeLinewidth = A.wireframeLinewidth,
        this.wireframeLinecap = A.wireframeLinecap,
        this.wireframeLinejoin = A.wireframeLinejoin,
        this.skinning = A.skinning,
        this.morphTargets = A.morphTargets,
        this.morphNormals = A.morphNormals,
        this.vertexTangents = A.vertexTangents,
        this
    }
    ,
    (vr.prototype = Object.create(yr.prototype)).constructor = vr,
    vr.prototype.isMeshPhysicalMaterial = !0,
    vr.prototype.copy = function(A) {
        return yr.prototype.copy.call(this, A),
        this.defines = {
            STANDARD: "",
            PHYSICAL: ""
        },
        this.clearcoat = A.clearcoat,
        this.clearcoatMap = A.clearcoatMap,
        this.clearcoatRoughness = A.clearcoatRoughness,
        this.clearcoatRoughnessMap = A.clearcoatRoughnessMap,
        this.clearcoatNormalMap = A.clearcoatNormalMap,
        this.clearcoatNormalScale.copy(A.clearcoatNormalScale),
        this.reflectivity = A.reflectivity,
        this.sheen = A.sheen ? (this.sheen || new LA).copy(A.sheen) : null,
        this.transparency = A.transparency,
        this
    }
    ,
    (Ir.prototype = Object.create(qA.prototype)).constructor = Ir,
    Ir.prototype.isMeshPhongMaterial = !0,
    Ir.prototype.copy = function(A) {
        return qA.prototype.copy.call(this, A),
        this.color.copy(A.color),
        this.specular.copy(A.specular),
        this.shininess = A.shininess,
        this.map = A.map,
        this.lightMap = A.lightMap,
        this.lightMapIntensity = A.lightMapIntensity,
        this.aoMap = A.aoMap,
        this.aoMapIntensity = A.aoMapIntensity,
        this.emissive.copy(A.emissive),
        this.emissiveMap = A.emissiveMap,
        this.emissiveIntensity = A.emissiveIntensity,
        this.bumpMap = A.bumpMap,
        this.bumpScale = A.bumpScale,
        this.normalMap = A.normalMap,
        this.normalMapType = A.normalMapType,
        this.normalScale.copy(A.normalScale),
        this.displacementMap = A.displacementMap,
        this.displacementScale = A.displacementScale,
        this.displacementBias = A.displacementBias,
        this.specularMap = A.specularMap,
        this.alphaMap = A.alphaMap,
        this.envMap = A.envMap,
        this.combine = A.combine,
        this.reflectivity = A.reflectivity,
        this.refractionRatio = A.refractionRatio,
        this.wireframe = A.wireframe,
        this.wireframeLinewidth = A.wireframeLinewidth,
        this.wireframeLinecap = A.wireframeLinecap,
        this.wireframeLinejoin = A.wireframeLinejoin,
        this.skinning = A.skinning,
        this.morphTargets = A.morphTargets,
        this.morphNormals = A.morphNormals,
        this
    }
    ,
    (Er.prototype = Object.create(qA.prototype)).constructor = Er,
    Er.prototype.isMeshToonMaterial = !0,
    Er.prototype.copy = function(A) {
        return qA.prototype.copy.call(this, A),
        this.color.copy(A.color),
        this.specular.copy(A.specular),
        this.shininess = A.shininess,
        this.map = A.map,
        this.gradientMap = A.gradientMap,
        this.lightMap = A.lightMap,
        this.lightMapIntensity = A.lightMapIntensity,
        this.aoMap = A.aoMap,
        this.aoMapIntensity = A.aoMapIntensity,
        this.emissive.copy(A.emissive),
        this.emissiveMap = A.emissiveMap,
        this.emissiveIntensity = A.emissiveIntensity,
        this.bumpMap = A.bumpMap,
        this.bumpScale = A.bumpScale,
        this.normalMap = A.normalMap,
        this.normalMapType = A.normalMapType,
        this.normalScale.copy(A.normalScale),
        this.displacementMap = A.displacementMap,
        this.displacementScale = A.displacementScale,
        this.displacementBias = A.displacementBias,
        this.specularMap = A.specularMap,
        this.alphaMap = A.alphaMap,
        this.wireframe = A.wireframe,
        this.wireframeLinewidth = A.wireframeLinewidth,
        this.wireframeLinecap = A.wireframeLinecap,
        this.wireframeLinejoin = A.wireframeLinejoin,
        this.skinning = A.skinning,
        this.morphTargets = A.morphTargets,
        this.morphNormals = A.morphNormals,
        this
    }
    ,
    (Br.prototype = Object.create(qA.prototype)).constructor = Br,
    Br.prototype.isMeshNormalMaterial = !0,
    Br.prototype.copy = function(A) {
        return qA.prototype.copy.call(this, A),
        this.bumpMap = A.bumpMap,
        this.bumpScale = A.bumpScale,
        this.normalMap = A.normalMap,
        this.normalMapType = A.normalMapType,
        this.normalScale.copy(A.normalScale),
        this.displacementMap = A.displacementMap,
        this.displacementScale = A.displacementScale,
        this.displacementBias = A.displacementBias,
        this.wireframe = A.wireframe,
        this.wireframeLinewidth = A.wireframeLinewidth,
        this.skinning = A.skinning,
        this.morphTargets = A.morphTargets,
        this.morphNormals = A.morphNormals,
        this
    }
    ,
    (xr.prototype = Object.create(qA.prototype)).constructor = xr,
    xr.prototype.isMeshLambertMaterial = !0,
    xr.prototype.copy = function(A) {
        return qA.prototype.copy.call(this, A),
        this.color.copy(A.color),
        this.map = A.map,
        this.lightMap = A.lightMap,
        this.lightMapIntensity = A.lightMapIntensity,
        this.aoMap = A.aoMap,
        this.aoMapIntensity = A.aoMapIntensity,
        this.emissive.copy(A.emissive),
        this.emissiveMap = A.emissiveMap,
        this.emissiveIntensity = A.emissiveIntensity,
        this.specularMap = A.specularMap,
        this.alphaMap = A.alphaMap,
        this.envMap = A.envMap,
        this.combine = A.combine,
        this.reflectivity = A.reflectivity,
        this.refractionRatio = A.refractionRatio,
        this.wireframe = A.wireframe,
        this.wireframeLinewidth = A.wireframeLinewidth,
        this.wireframeLinecap = A.wireframeLinecap,
        this.wireframeLinejoin = A.wireframeLinejoin,
        this.skinning = A.skinning,
        this.morphTargets = A.morphTargets,
        this.morphNormals = A.morphNormals,
        this
    }
    ,
    (Sr.prototype = Object.create(qA.prototype)).constructor = Sr,
    Sr.prototype.isMeshMatcapMaterial = !0,
    Sr.prototype.copy = function(A) {
        return qA.prototype.copy.call(this, A),
        this.defines = {
            MATCAP: ""
        },
        this.color.copy(A.color),
        this.matcap = A.matcap,
        this.map = A.map,
        this.bumpMap = A.bumpMap,
        this.bumpScale = A.bumpScale,
        this.normalMap = A.normalMap,
        this.normalMapType = A.normalMapType,
        this.normalScale.copy(A.normalScale),
        this.displacementMap = A.displacementMap,
        this.displacementScale = A.displacementScale,
        this.displacementBias = A.displacementBias,
        this.alphaMap = A.alphaMap,
        this.skinning = A.skinning,
        this.morphTargets = A.morphTargets,
        this.morphNormals = A.morphNormals,
        this
    }
    ,
    (wr.prototype = Object.create(ko.prototype)).constructor = wr,
    wr.prototype.isLineDashedMaterial = !0,
    wr.prototype.copy = function(A) {
        return ko.prototype.copy.call(this, A),
        this.scale = A.scale,
        this.dashSize = A.dashSize,
        this.gapSize = A.gapSize,
        this
    }
    ;
    var Mr = Object.freeze({
        __proto__: null,
        ShadowMaterial: mr,
        SpriteMaterial: ro,
        RawShaderMaterial: Cr,
        ShaderMaterial: Pe,
        PointsMaterial: Yo,
        MeshPhysicalMaterial: vr,
        MeshStandardMaterial: yr,
        MeshPhongMaterial: Ir,
        MeshToonMaterial: Er,
        MeshNormalMaterial: Br,
        MeshLambertMaterial: xr,
        MeshDepthMaterial: ji,
        MeshDistanceMaterial: Hi,
        MeshBasicMaterial: jA,
        MeshMatcapMaterial: Sr,
        LineDashedMaterial: wr,
        LineBasicMaterial: ko,
        Material: qA
    })
      , br = {
        arraySlice: function(A, e, t) {
            return br.isTypedArray(A) ? new A.constructor(A.subarray(e, void 0 !== t ? t : A.length)) : A.slice(e, t)
        },
        convertArray: function(A, e, t) {
            return !A || !t && A.constructor === e ? A : "number" == typeof e.BYTES_PER_ELEMENT ? new e(A) : Array.prototype.slice.call(A)
        },
        isTypedArray: function(A) {
            return ArrayBuffer.isView(A) && !(A instanceof DataView)
        },
        getKeyframeOrder: function(A) {
            for (var e = A.length, t = new Array(e), i = 0; i !== e; ++i)
                t[i] = i;
            return t.sort((function(e, t) {
                return A[e] - A[t]
            }
            )),
            t
        },
        sortedArray: function(A, e, t) {
            for (var i = A.length, o = new A.constructor(i), n = 0, r = 0; r !== i; ++n)
                for (var a = t[n] * e, s = 0; s !== e; ++s)
                    o[r++] = A[a + s];
            return o
        },
        flattenJSON: function(A, e, t, i) {
            for (var o = 1, n = A[0]; void 0 !== n && void 0 === n[i]; )
                n = A[o++];
            if (void 0 !== n) {
                var r = n[i];
                if (void 0 !== r)
                    if (Array.isArray(r))
                        do {
                            void 0 !== (r = n[i]) && (e.push(n.time),
                            t.push.apply(t, r)),
                            n = A[o++]
                        } while (void 0 !== n);
                    else if (void 0 !== r.toArray)
                        do {
                            void 0 !== (r = n[i]) && (e.push(n.time),
                            r.toArray(t, t.length)),
                            n = A[o++]
                        } while (void 0 !== n);
                    else
                        do {
                            void 0 !== (r = n[i]) && (e.push(n.time),
                            t.push(r)),
                            n = A[o++]
                        } while (void 0 !== n)
            }
        },
        subclip: function(A, e, t, i, o) {
            o = o || 30;
            var n = A.clone();
            n.name = e;
            for (var r = [], a = 0; n.tracks.length > a; ++a) {
                for (var s = n.tracks[a], l = s.getValueSize(), c = [], h = [], d = 0; s.times.length > d; ++d) {
                    var p = s.times[d] * o;
                    if (p >= t && i > p) {
                        c.push(s.times[d]);
                        for (var g = 0; l > g; ++g)
                            h.push(s.values[d * l + g])
                    }
                }
                0 !== c.length && (s.times = br.convertArray(c, s.times.constructor),
                s.values = br.convertArray(h, s.values.constructor),
                r.push(s))
            }
            n.tracks = r;
            var u = 1 / 0;
            for (a = 0; n.tracks.length > a; ++a)
                u > n.tracks[a].times[0] && (u = n.tracks[a].times[0]);
            for (a = 0; n.tracks.length > a; ++a)
                n.tracks[a].shift(-1 * u);
            return n.resetDuration(),
            n
        }
    };
    function Ur(A, e, t, i) {
        this.parameterPositions = A,
        this._cachedIndex = 0,
        this.resultBuffer = void 0 !== i ? i : new e.constructor(t),
        this.sampleValues = e,
        this.valueSize = t
    }
    function Fr(A, e, t, i) {
        Ur.call(this, A, e, t, i),
        this._weightPrev = -0,
        this._offsetPrev = -0,
        this._weightNext = -0,
        this._offsetNext = -0
    }
    function Kr(A, e, t, i) {
        Ur.call(this, A, e, t, i)
    }
    function Qr(A, e, t, i) {
        Ur.call(this, A, e, t, i)
    }
    function Rr(A, e, t, i) {
        if (void 0 === A)
            throw new Error("THREE.KeyframeTrack: track name is undefined");
        if (void 0 === e || 0 === e.length)
            throw new Error("THREE.KeyframeTrack: no keyframes in track named " + A);
        this.name = A,
        this.times = br.convertArray(e, this.TimeBufferType),
        this.values = br.convertArray(t, this.ValueBufferType),
        this.setInterpolation(i || this.DefaultInterpolation)
    }
    function Tr(A, e, t) {
        Rr.call(this, A, e, t)
    }
    function kr(A, e, t, i) {
        Rr.call(this, A, e, t, i)
    }
    function Dr(A, e, t, i) {
        Rr.call(this, A, e, t, i)
    }
    function Lr(A, e, t, i) {
        Ur.call(this, A, e, t, i)
    }
    function Nr(A, e, t, i) {
        Rr.call(this, A, e, t, i)
    }
    function Or(A, e, t, i) {
        Rr.call(this, A, e, t, i)
    }
    function Vr(A, e, t, i) {
        Rr.call(this, A, e, t, i)
    }
    function Gr(A, e, t) {
        this.name = A,
        this.tracks = t,
        this.duration = void 0 !== e ? e : -1,
        this.uuid = a.generateUUID(),
        0 > this.duration && this.resetDuration()
    }
    function Pr(A) {
        if (void 0 === A.type)
            throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");
        var e = function(A) {
            switch (A.toLowerCase()) {
            case "scalar":
            case "double":
            case "float":
            case "number":
            case "integer":
                return Dr;
            case "vector":
            case "vector2":
            case "vector3":
            case "vector4":
                return Vr;
            case "color":
                return kr;
            case "quaternion":
                return Nr;
            case "bool":
            case "boolean":
                return Tr;
            case "string":
                return Or
            }
            throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + A)
        }(A.type);
        if (void 0 === A.times) {
            var t = []
              , i = [];
            br.flattenJSON(A.keys, t, i, "value"),
            A.times = t,
            A.values = i
        }
        return void 0 !== e.parse ? e.parse(A) : new e(A.name,A.times,A.values,A.interpolation)
    }
    Object.assign(Ur.prototype, {
        evaluate: function(A) {
            var e = this.parameterPositions
              , t = this._cachedIndex
              , i = e[t]
              , o = e[t - 1];
            A: {
                e: {
                    var n;
                    t: {
                        i: if (i <= A) {
                            for (var r = t + 2; ; ) {
                                if (void 0 === i) {
                                    if (o > A)
                                        break i;
                                    return this._cachedIndex = t = e.length,
                                    this.afterEnd_(t - 1, A, o)
                                }
                                if (t === r)
                                    break;
                                if (o = i,
                                (i = e[++t]) > A)
                                    break e
                            }
                            n = e.length;
                            break t
                        }
                        if (A >= o)
                            break A;
                        var a = e[1];
                        a > A && (t = 2,
                        o = a);
                        for (r = t - 2; ; ) {
                            if (void 0 === o)
                                return this._cachedIndex = 0,
                                this.beforeStart_(0, A, i);
                            if (t === r)
                                break;
                            if (i = o,
                            A >= (o = e[--t - 1]))
                                break e
                        }
                        n = t,
                        t = 0
                    }
                    for (; n > t; ) {
                        var s = t + n >>> 1;
                        e[s] > A ? n = s : t = s + 1
                    }
                    if (i = e[t],
                    void 0 === (o = e[t - 1]))
                        return this._cachedIndex = 0,
                        this.beforeStart_(0, A, i);
                    if (void 0 === i)
                        return this._cachedIndex = t = e.length,
                        this.afterEnd_(t - 1, o, A)
                }
                this._cachedIndex = t,
                this.intervalChanged_(t, o, i)
            }
            return this.interpolate_(t, o, A, i)
        },
        settings: null,
        DefaultSettings_: {},
        getSettings_: function() {
            return this.settings || this.DefaultSettings_
        },
        copySampleValue_: function(A) {
            for (var e = this.resultBuffer, t = this.sampleValues, i = this.valueSize, o = A * i, n = 0; n !== i; ++n)
                e[n] = t[o + n];
            return e
        },
        interpolate_: function() {
            throw new Error("call to abstract method")
        },
        intervalChanged_: function() {}
    }),
    Object.assign(Ur.prototype, {
        beforeStart_: Ur.prototype.copySampleValue_,
        afterEnd_: Ur.prototype.copySampleValue_
    }),
    Fr.prototype = Object.assign(Object.create(Ur.prototype), {
        constructor: Fr,
        DefaultSettings_: {
            endingStart: 2400,
            endingEnd: 2400
        },
        intervalChanged_: function(A, e, t) {
            var i = this.parameterPositions
              , o = A - 2
              , n = A + 1
              , r = i[o]
              , a = i[n];
            if (void 0 === r)
                switch (this.getSettings_().endingStart) {
                case 2401:
                    o = A,
                    r = 2 * e - t;
                    break;
                case 2402:
                    r = e + i[o = i.length - 2] - i[o + 1];
                    break;
                default:
                    o = A,
                    r = t
                }
            if (void 0 === a)
                switch (this.getSettings_().endingEnd) {
                case 2401:
                    n = A,
                    a = 2 * t - e;
                    break;
                case 2402:
                    n = 1,
                    a = t + i[1] - i[0];
                    break;
                default:
                    n = A - 1,
                    a = e
                }
            var s = .5 * (t - e)
              , l = this.valueSize;
            this._weightPrev = s / (e - r),
            this._weightNext = s / (a - t),
            this._offsetPrev = o * l,
            this._offsetNext = n * l
        },
        interpolate_: function(A, e, t, i) {
            for (var o = this.resultBuffer, n = this.sampleValues, r = this.valueSize, a = A * r, s = a - r, l = this._offsetPrev, c = this._offsetNext, h = this._weightPrev, d = this._weightNext, p = (t - e) / (i - e), g = p * p, u = g * p, f = -h * u + 2 * h * g - h * p, m = (1 + h) * u + (-1.5 - 2 * h) * g + (-.5 + h) * p + 1, C = (-1 - d) * u + (1.5 + d) * g + .5 * p, y = d * u - d * g, v = 0; v !== r; ++v)
                o[v] = f * n[l + v] + m * n[s + v] + C * n[a + v] + y * n[c + v];
            return o
        }
    }),
    Kr.prototype = Object.assign(Object.create(Ur.prototype), {
        constructor: Kr,
        interpolate_: function(A, e, t, i) {
            for (var o = this.resultBuffer, n = this.sampleValues, r = this.valueSize, a = A * r, s = a - r, l = (t - e) / (i - e), c = 1 - l, h = 0; h !== r; ++h)
                o[h] = n[s + h] * c + n[a + h] * l;
            return o
        }
    }),
    Qr.prototype = Object.assign(Object.create(Ur.prototype), {
        constructor: Qr,
        interpolate_: function(A) {
            return this.copySampleValue_(A - 1)
        }
    }),
    Object.assign(Rr, {
        toJSON: function(A) {
            var e, t = A.constructor;
            if (void 0 !== t.toJSON)
                e = t.toJSON(A);
            else {
                e = {
                    name: A.name,
                    times: br.convertArray(A.times, Array),
                    values: br.convertArray(A.values, Array)
                };
                var i = A.getInterpolation();
                i !== A.DefaultInterpolation && (e.interpolation = i)
            }
            return e.type = A.ValueTypeName,
            e
        }
    }),
    Object.assign(Rr.prototype, {
        constructor: Rr,
        TimeBufferType: Float32Array,
        ValueBufferType: Float32Array,
        DefaultInterpolation: 2301,
        InterpolantFactoryMethodDiscrete: function(A) {
            return new Qr(this.times,this.values,this.getValueSize(),A)
        },
        InterpolantFactoryMethodLinear: function(A) {
            return new Kr(this.times,this.values,this.getValueSize(),A)
        },
        InterpolantFactoryMethodSmooth: function(A) {
            return new Fr(this.times,this.values,this.getValueSize(),A)
        },
        setInterpolation: function(A) {
            var e;
            switch (A) {
            case 2300:
                e = this.InterpolantFactoryMethodDiscrete;
                break;
            case 2301:
                e = this.InterpolantFactoryMethodLinear;
                break;
            case 2302:
                e = this.InterpolantFactoryMethodSmooth
            }
            if (void 0 === e) {
                var t = "unsupported interpolation for " + this.ValueTypeName + " keyframe track named " + this.name;
                if (void 0 === this.createInterpolant) {
                    if (A === this.DefaultInterpolation)
                        throw new Error(t);
                    this.setInterpolation(this.DefaultInterpolation)
                }
                return console.warn("THREE.KeyframeTrack:", t),
                this
            }
            return this.createInterpolant = e,
            this
        },
        getInterpolation: function() {
            switch (this.createInterpolant) {
            case this.InterpolantFactoryMethodDiscrete:
                return 2300;
            case this.InterpolantFactoryMethodLinear:
                return 2301;
            case this.InterpolantFactoryMethodSmooth:
                return 2302
            }
        },
        getValueSize: function() {
            return this.values.length / this.times.length
        },
        shift: function(A) {
            if (0 !== A)
                for (var e = this.times, t = 0, i = e.length; t !== i; ++t)
                    e[t] += A;
            return this
        },
        scale: function(A) {
            if (1 !== A)
                for (var e = this.times, t = 0, i = e.length; t !== i; ++t)
                    e[t] *= A;
            return this
        },
        trim: function(A, e) {
            for (var t = this.times, i = t.length, o = 0, n = i - 1; o !== i && A > t[o]; )
                ++o;
            for (; -1 !== n && t[n] > e; )
                --n;
            if (++n,
            0 !== o || n !== i) {
                n > o || (o = (n = Math.max(n, 1)) - 1);
                var r = this.getValueSize();
                this.times = br.arraySlice(t, o, n),
                this.values = br.arraySlice(this.values, o * r, n * r)
            }
            return this
        },
        validate: function() {
            var A = !0
              , e = this.getValueSize();
            e - Math.floor(e) != 0 && (console.error("THREE.KeyframeTrack: Invalid value size in track.", this),
            A = !1);
            var t = this.times
              , i = this.values
              , o = t.length;
            0 === o && (console.error("THREE.KeyframeTrack: Track is empty.", this),
            A = !1);
            for (var n = null, r = 0; r !== o; r++) {
                var a = t[r];
                if ("number" == typeof a && isNaN(a)) {
                    console.error("THREE.KeyframeTrack: Time is not a valid number.", this, r, a),
                    A = !1;
                    break
                }
                if (null !== n && n > a) {
                    console.error("THREE.KeyframeTrack: Out of order keys.", this, r, a, n),
                    A = !1;
                    break
                }
                n = a
            }
            if (void 0 !== i && br.isTypedArray(i)) {
                r = 0;
                for (var s = i.length; r !== s; ++r) {
                    var l = i[r];
                    if (isNaN(l)) {
                        console.error("THREE.KeyframeTrack: Value is not a valid number.", this, r, l),
                        A = !1;
                        break
                    }
                }
            }
            return A
        },
        optimize: function() {
            for (var A = br.arraySlice(this.times), e = br.arraySlice(this.values), t = this.getValueSize(), i = 2302 === this.getInterpolation(), o = 1, n = A.length - 1, r = 1; n > r; ++r) {
                var a = !1
                  , s = A[r];
                if (s !== A[r + 1] && (1 !== r || s !== s[0]))
                    if (i)
                        a = !0;
                    else
                        for (var l = r * t, c = l - t, h = l + t, d = 0; d !== t; ++d) {
                            var p = e[l + d];
                            if (p !== e[c + d] || p !== e[h + d]) {
                                a = !0;
                                break
                            }
                        }
                if (a) {
                    if (r !== o) {
                        A[o] = A[r];
                        var g = r * t
                          , u = o * t;
                        for (d = 0; d !== t; ++d)
                            e[u + d] = e[g + d]
                    }
                    ++o
                }
            }
            if (n > 0) {
                A[o] = A[n];
                for (g = n * t,
                u = o * t,
                d = 0; d !== t; ++d)
                    e[u + d] = e[g + d];
                ++o
            }
            return o !== A.length ? (this.times = br.arraySlice(A, 0, o),
            this.values = br.arraySlice(e, 0, o * t)) : (this.times = A,
            this.values = e),
            this
        },
        clone: function() {
            var A = br.arraySlice(this.times, 0)
              , e = br.arraySlice(this.values, 0)
              , t = new (0,
            this.constructor)(this.name,A,e);
            return t.createInterpolant = this.createInterpolant,
            t
        }
    }),
    Tr.prototype = Object.assign(Object.create(Rr.prototype), {
        constructor: Tr,
        ValueTypeName: "bool",
        ValueBufferType: Array,
        DefaultInterpolation: 2300,
        InterpolantFactoryMethodLinear: void 0,
        InterpolantFactoryMethodSmooth: void 0
    }),
    kr.prototype = Object.assign(Object.create(Rr.prototype), {
        constructor: kr,
        ValueTypeName: "color"
    }),
    Dr.prototype = Object.assign(Object.create(Rr.prototype), {
        constructor: Dr,
        ValueTypeName: "number"
    }),
    Lr.prototype = Object.assign(Object.create(Ur.prototype), {
        constructor: Lr,
        interpolate_: function(A, e, t, i) {
            for (var o = this.resultBuffer, n = this.sampleValues, r = this.valueSize, a = A * r, s = (t - e) / (i - e), l = a + r; a !== l; a += 4)
                f.slerpFlat(o, 0, n, a - r, n, a, s);
            return o
        }
    }),
    Nr.prototype = Object.assign(Object.create(Rr.prototype), {
        constructor: Nr,
        ValueTypeName: "quaternion",
        DefaultInterpolation: 2301,
        InterpolantFactoryMethodLinear: function(A) {
            return new Lr(this.times,this.values,this.getValueSize(),A)
        },
        InterpolantFactoryMethodSmooth: void 0
    }),
    Or.prototype = Object.assign(Object.create(Rr.prototype), {
        constructor: Or,
        ValueTypeName: "string",
        ValueBufferType: Array,
        DefaultInterpolation: 2300,
        InterpolantFactoryMethodLinear: void 0,
        InterpolantFactoryMethodSmooth: void 0
    }),
    Vr.prototype = Object.assign(Object.create(Rr.prototype), {
        constructor: Vr,
        ValueTypeName: "vector"
    }),
    Object.assign(Gr, {
        parse: function(A) {
            for (var e = [], t = A.tracks, i = 1 / (A.fps || 1), o = 0, n = t.length; o !== n; ++o)
                e.push(Pr(t[o]).scale(i));
            return new Gr(A.name,A.duration,e)
        },
        toJSON: function(A) {
            for (var e = [], t = A.tracks, i = {
                name: A.name,
                duration: A.duration,
                tracks: e,
                uuid: A.uuid
            }, o = 0, n = t.length; o !== n; ++o)
                e.push(Rr.toJSON(t[o]));
            return i
        },
        CreateFromMorphTargetSequence: function(A, e, t, i) {
            for (var o = e.length, n = [], r = 0; o > r; r++) {
                var a = []
                  , s = [];
                a.push((r + o - 1) % o, r, (r + 1) % o),
                s.push(0, 1, 0);
                var l = br.getKeyframeOrder(a);
                a = br.sortedArray(a, 1, l),
                s = br.sortedArray(s, 1, l),
                i || 0 !== a[0] || (a.push(o),
                s.push(s[0])),
                n.push(new Dr(".morphTargetInfluences[" + e[r].name + "]",a,s).scale(1 / t))
            }
            return new Gr(A,-1,n)
        },
        findByName: function(A, e) {
            var t = A;
            if (!Array.isArray(A)) {
                t = A.geometry && A.geometry.animations || A.animations
            }
            for (var i = 0; t.length > i; i++)
                if (t[i].name === e)
                    return t[i];
            return null
        },
        CreateClipsFromMorphTargetSequences: function(A, e, t) {
            for (var i = {}, o = /^([\w-]*?)([\d]+)$/, n = 0, r = A.length; r > n; n++) {
                var a = A[n]
                  , s = a.name.match(o);
                if (s && s.length > 1) {
                    var l = i[h = s[1]];
                    l || (i[h] = l = []),
                    l.push(a)
                }
            }
            var c = [];
            for (var h in i)
                c.push(Gr.CreateFromMorphTargetSequence(h, i[h], e, t));
            return c
        },
        parseAnimation: function(A, e) {
            if (!A)
                return console.error("THREE.AnimationClip: No animation in JSONLoader data."),
                null;
            for (var t = function(A, e, t, i, o) {
                if (0 !== t.length) {
                    var n = []
                      , r = [];
                    br.flattenJSON(t, n, r, i),
                    0 !== n.length && o.push(new A(e,n,r))
                }
            }, i = [], o = A.name || "default", n = A.length || -1, r = A.fps || 30, a = A.hierarchy || [], s = 0; a.length > s; s++) {
                var l = a[s].keys;
                if (l && 0 !== l.length)
                    if (l[0].morphTargets) {
                        for (var c = {}, h = 0; l.length > h; h++)
                            if (l[h].morphTargets)
                                for (var d = 0; l[h].morphTargets.length > d; d++)
                                    c[l[h].morphTargets[d]] = -1;
                        for (var p in c) {
                            var g = []
                              , u = [];
                            for (d = 0; d !== l[h].morphTargets.length; ++d) {
                                var f = l[h];
                                g.push(f.time),
                                u.push(f.morphTarget === p ? 1 : 0)
                            }
                            i.push(new Dr(".morphTargetInfluence[" + p + "]",g,u))
                        }
                        n = c.length * (r || 1)
                    } else {
                        var m = ".bones[" + e[s].name + "]";
                        t(Vr, m + ".position", l, "pos", i),
                        t(Nr, m + ".quaternion", l, "rot", i),
                        t(Vr, m + ".scale", l, "scl", i)
                    }
            }
            return 0 === i.length ? null : new Gr(o,n,i)
        }
    }),
    Object.assign(Gr.prototype, {
        resetDuration: function() {
            for (var A = 0, e = 0, t = this.tracks.length; e !== t; ++e) {
                var i = this.tracks[e];
                A = Math.max(A, i.times[i.times.length - 1])
            }
            return this.duration = A,
            this
        },
        trim: function() {
            for (var A = 0; this.tracks.length > A; A++)
                this.tracks[A].trim(0, this.duration);
            return this
        },
        validate: function() {
            for (var A = !0, e = 0; this.tracks.length > e; e++)
                A = A && this.tracks[e].validate();
            return A
        },
        optimize: function() {
            for (var A = 0; this.tracks.length > A; A++)
                this.tracks[A].optimize();
            return this
        },
        clone: function() {
            for (var A = [], e = 0; this.tracks.length > e; e++)
                A.push(this.tracks[e].clone());
            return new Gr(this.name,this.duration,A)
        }
    });
    var qr = {
        enabled: !1,
        files: {},
        add: function(A, e) {
            !1 !== this.enabled && (this.files[A] = e)
        },
        get: function(A) {
            if (!1 !== this.enabled)
                return this.files[A]
        },
        remove: function(A) {
            delete this.files[A]
        },
        clear: function() {
            this.files = {}
        }
    };
    function jr(A, e, t) {
        var i = this
          , o = !1
          , n = 0
          , r = 0
          , a = void 0
          , s = [];
        this.onStart = void 0,
        this.onLoad = A,
        this.onProgress = e,
        this.onError = t,
        this.itemStart = function(A) {
            r++,
            !1 === o && void 0 !== i.onStart && i.onStart(A, n, r),
            o = !0
        }
        ,
        this.itemEnd = function(A) {
            n++,
            void 0 !== i.onProgress && i.onProgress(A, n, r),
            n === r && (o = !1,
            void 0 !== i.onLoad && i.onLoad())
        }
        ,
        this.itemError = function(A) {
            void 0 !== i.onError && i.onError(A)
        }
        ,
        this.resolveURL = function(A) {
            return a ? a(A) : A
        }
        ,
        this.setURLModifier = function(A) {
            return a = A,
            this
        }
        ,
        this.addHandler = function(A, e) {
            return s.push(A, e),
            this
        }
        ,
        this.removeHandler = function(A) {
            var e = s.indexOf(A);
            return -1 !== e && s.splice(e, 2),
            this
        }
        ,
        this.getHandler = function(A) {
            for (var e = 0, t = s.length; t > e; e += 2) {
                var i = s[e]
                  , o = s[e + 1];
                if (i.global && (i.lastIndex = 0),
                i.test(A))
                    return o
            }
            return null
        }
    }
    var Hr = new jr;
    function Yr(A) {
        this.manager = void 0 !== A ? A : Hr,
        this.crossOrigin = "anonymous",
        this.path = "",
        this.resourcePath = ""
    }
    Object.assign(Yr.prototype, {
        load: function() {},
        parse: function() {},
        setCrossOrigin: function(A) {
            return this.crossOrigin = A,
            this
        },
        setPath: function(A) {
            return this.path = A,
            this
        },
        setResourcePath: function(A) {
            return this.resourcePath = A,
            this
        }
    });
    var Wr = {};
    function Jr(A) {
        Yr.call(this, A)
    }
    function zr(A) {
        Yr.call(this, A)
    }
    function Zr(A) {
        Yr.call(this, A)
    }
    function Xr(A) {
        Yr.call(this, A)
    }
    function _r(A) {
        Yr.call(this, A)
    }
    function $r(A) {
        Yr.call(this, A)
    }
    function Aa(A) {
        Yr.call(this, A)
    }
    function ea() {
        this.type = "Curve",
        this.arcLengthDivisions = 200
    }
    function ta(A, e, t, i, o, n, r, a) {
        ea.call(this),
        this.type = "EllipseCurve",
        this.aX = A || 0,
        this.aY = e || 0,
        this.xRadius = t || 1,
        this.yRadius = i || 1,
        this.aStartAngle = o || 0,
        this.aEndAngle = n || 2 * Math.PI,
        this.aClockwise = r || !1,
        this.aRotation = a || 0
    }
    function ia(A, e, t, i, o, n) {
        ta.call(this, A, e, t, t, i, o, n),
        this.type = "ArcCurve"
    }
    function oa() {
        var A = 0
          , e = 0
          , t = 0
          , i = 0;
        function o(o, n, r, a) {
            A = o,
            e = r,
            t = -3 * o + 3 * n - 2 * r - a,
            i = 2 * o - 2 * n + r + a
        }
        return {
            initCatmullRom: function(A, e, t, i, n) {
                o(e, t, n * (t - A), n * (i - e))
            },
            initNonuniformCatmullRom: function(A, e, t, i, n, r, a) {
                var s = (e - A) / n - (t - A) / (n + r) + (t - e) / r
                  , l = (t - e) / r - (i - e) / (r + a) + (i - t) / a;
                o(e, t, s *= r, l *= r)
            },
            calc: function(o) {
                var n = o * o;
                return A + e * o + t * n + i * (n * o)
            }
        }
    }
    Jr.prototype = Object.assign(Object.create(Yr.prototype), {
        constructor: Jr,
        load: function(A, e, t, i) {
            void 0 === A && (A = ""),
            void 0 !== this.path && (A = this.path + A),
            A = this.manager.resolveURL(A);
            var o = this
              , n = qr.get(A);
            if (void 0 !== n)
                return o.manager.itemStart(A),
                setTimeout((function() {
                    e && e(n),
                    o.manager.itemEnd(A)
                }
                ), 0),
                n;
            if (void 0 === Wr[A]) {
                var r = A.match(/^data:(.*?)(;base64)?,(.*)$/);
                if (r) {
                    var a = r[1]
                      , s = !!r[2]
                      , l = r[3];
                    l = decodeURIComponent(l),
                    s && (l = atob(l));
                    try {
                        var c, h = (this.responseType || "").toLowerCase();
                        switch (h) {
                        case "arraybuffer":
                        case "blob":
                            for (var d = new Uint8Array(l.length), p = 0; l.length > p; p++)
                                d[p] = l.charCodeAt(p);
                            c = "blob" === h ? new Blob([d.buffer],{
                                type: a
                            }) : d.buffer;
                            break;
                        case "document":
                            var g = new DOMParser;
                            c = g.parseFromString(l, a);
                            break;
                        case "json":
                            c = JSON.parse(l);
                            break;
                        default:
                            c = l
                        }
                        setTimeout((function() {
                            e && e(c),
                            o.manager.itemEnd(A)
                        }
                        ), 0)
                    } catch (e) {
                        setTimeout((function() {
                            i && i(e),
                            o.manager.itemError(A),
                            o.manager.itemEnd(A)
                        }
                        ), 0)
                    }
                } else {
                    Wr[A] = [],
                    Wr[A].push({
                        onLoad: e,
                        onProgress: t,
                        onError: i
                    });
                    var u = new XMLHttpRequest;
                    for (var f in u.open("GET", A, !0),
                    u.addEventListener("load", (function(e) {
                        var t = this.response
                          , i = Wr[A];
                        if (delete Wr[A],
                        200 === this.status || 0 === this.status) {
                            0 === this.status && console.warn("THREE.FileLoader: HTTP Status 0 received."),
                            qr.add(A, t);
                            for (var n = 0, r = i.length; r > n; n++) {
                                (a = i[n]).onLoad && a.onLoad(t)
                            }
                            o.manager.itemEnd(A)
                        } else {
                            for (n = 0,
                            r = i.length; r > n; n++) {
                                var a;
                                (a = i[n]).onError && a.onError(e)
                            }
                            o.manager.itemError(A),
                            o.manager.itemEnd(A)
                        }
                    }
                    ), !1),
                    u.addEventListener("progress", (function(e) {
                        for (var t = Wr[A], i = 0, o = t.length; o > i; i++) {
                            var n = t[i];
                            n.onProgress && n.onProgress(e)
                        }
                    }
                    ), !1),
                    u.addEventListener("error", (function(e) {
                        var t = Wr[A];
                        delete Wr[A];
                        for (var i = 0, n = t.length; n > i; i++) {
                            var r = t[i];
                            r.onError && r.onError(e)
                        }
                        o.manager.itemError(A),
                        o.manager.itemEnd(A)
                    }
                    ), !1),
                    u.addEventListener("abort", (function(e) {
                        var t = Wr[A];
                        delete Wr[A];
                        for (var i = 0, n = t.length; n > i; i++) {
                            var r = t[i];
                            r.onError && r.onError(e)
                        }
                        o.manager.itemError(A),
                        o.manager.itemEnd(A)
                    }
                    ), !1),
                    void 0 !== this.responseType && (u.responseType = this.responseType),
                    void 0 !== this.withCredentials && (u.withCredentials = this.withCredentials),
                    u.overrideMimeType && u.overrideMimeType(void 0 !== this.mimeType ? this.mimeType : "text/plain"),
                    this.requestHeader)
                        u.setRequestHeader(f, this.requestHeader[f]);
                    u.send(null)
                }
                return o.manager.itemStart(A),
                u
            }
            Wr[A].push({
                onLoad: e,
                onProgress: t,
                onError: i
            })
        },
        setResponseType: function(A) {
            return this.responseType = A,
            this
        },
        setWithCredentials: function(A) {
            return this.withCredentials = A,
            this
        },
        setMimeType: function(A) {
            return this.mimeType = A,
            this
        },
        setRequestHeader: function(A) {
            return this.requestHeader = A,
            this
        }
    }),
    zr.prototype = Object.assign(Object.create(Yr.prototype), {
        constructor: zr,
        load: function(A, e, t, i) {
            var o = this
              , n = new Jr(o.manager);
            n.setPath(o.path),
            n.load(A, (function(A) {
                e(o.parse(JSON.parse(A)))
            }
            ), t, i)
        },
        parse: function(A) {
            for (var e = [], t = 0; A.length > t; t++) {
                var i = Gr.parse(A[t]);
                e.push(i)
            }
            return e
        }
    }),
    Zr.prototype = Object.assign(Object.create(Yr.prototype), {
        constructor: Zr,
        load: function(A, e, t, i) {
            var o = this
              , n = []
              , r = new An;
            r.image = n;
            var a = new Jr(this.manager);
            function s(s) {
                a.load(A[s], (function(A) {
                    var t = o.parse(A, !0);
                    n[s] = {
                        width: t.width,
                        height: t.height,
                        format: t.format,
                        mipmaps: t.mipmaps
                    },
                    6 === (l += 1) && (1 === t.mipmapCount && (r.minFilter = 1006),
                    r.format = t.format,
                    r.needsUpdate = !0,
                    e && e(r))
                }
                ), t, i)
            }
            if (a.setPath(this.path),
            a.setResponseType("arraybuffer"),
            Array.isArray(A))
                for (var l = 0, c = 0, h = A.length; h > c; ++c)
                    s(c);
            else
                a.load(A, (function(A) {
                    var t = o.parse(A, !0);
                    if (t.isCubemap)
                        for (var i = t.mipmaps.length / t.mipmapCount, a = 0; i > a; a++) {
                            n[a] = {
                                mipmaps: []
                            };
                            for (var s = 0; t.mipmapCount > s; s++)
                                n[a].mipmaps.push(t.mipmaps[a * t.mipmapCount + s]),
                                n[a].format = t.format,
                                n[a].width = t.width,
                                n[a].height = t.height
                        }
                    else
                        r.image.width = t.width,
                        r.image.height = t.height,
                        r.mipmaps = t.mipmaps;
                    1 === t.mipmapCount && (r.minFilter = 1006),
                    r.format = t.format,
                    r.needsUpdate = !0,
                    e && e(r)
                }
                ), t, i);
            return r
        }
    }),
    Xr.prototype = Object.assign(Object.create(Yr.prototype), {
        constructor: Xr,
        load: function(A, e, t, i) {
            var o = this
              , n = new We
              , r = new Jr(this.manager);
            return r.setResponseType("arraybuffer"),
            r.setPath(this.path),
            r.load(A, (function(A) {
                var t = o.parse(A);
                t && (void 0 !== t.image ? n.image = t.image : void 0 !== t.data && (n.image.width = t.width,
                n.image.height = t.height,
                n.image.data = t.data),
                n.wrapS = void 0 !== t.wrapS ? t.wrapS : 1001,
                n.wrapT = void 0 !== t.wrapT ? t.wrapT : 1001,
                n.magFilter = void 0 !== t.magFilter ? t.magFilter : 1006,
                n.minFilter = void 0 !== t.minFilter ? t.minFilter : 1006,
                n.anisotropy = void 0 !== t.anisotropy ? t.anisotropy : 1,
                void 0 !== t.format && (n.format = t.format),
                void 0 !== t.type && (n.type = t.type),
                void 0 !== t.mipmaps && (n.mipmaps = t.mipmaps,
                n.minFilter = 1008),
                1 === t.mipmapCount && (n.minFilter = 1006),
                n.needsUpdate = !0,
                e && e(n, t))
            }
            ), t, i),
            n
        }
    }),
    _r.prototype = Object.assign(Object.create(Yr.prototype), {
        constructor: _r,
        load: function(A, e, t, i) {
            void 0 !== this.path && (A = this.path + A),
            A = this.manager.resolveURL(A);
            var o = this
              , n = qr.get(A);
            if (void 0 !== n)
                return o.manager.itemStart(A),
                setTimeout((function() {
                    e && e(n),
                    o.manager.itemEnd(A)
                }
                ), 0),
                n;
            var r = document.createElementNS("http://www.w3.org/1999/xhtml", "img");
            function a() {
                r.removeEventListener("load", a, !1),
                r.removeEventListener("error", s, !1),
                qr.add(A, this),
                e && e(this),
                o.manager.itemEnd(A)
            }
            function s(e) {
                r.removeEventListener("load", a, !1),
                r.removeEventListener("error", s, !1),
                i && i(e),
                o.manager.itemError(A),
                o.manager.itemEnd(A)
            }
            return r.addEventListener("load", a, !1),
            r.addEventListener("error", s, !1),
            "data:" !== A.substr(0, 5) && void 0 !== this.crossOrigin && (r.crossOrigin = this.crossOrigin),
            o.manager.itemStart(A),
            r.src = A,
            r
        }
    }),
    $r.prototype = Object.assign(Object.create(Yr.prototype), {
        constructor: $r,
        load: function(A, e, t, i) {
            var o = new ut
              , n = new _r(this.manager);
            n.setCrossOrigin(this.crossOrigin),
            n.setPath(this.path);
            var r = 0;
            function a(t) {
                n.load(A[t], (function(A) {
                    o.images[t] = A,
                    6 === ++r && (o.needsUpdate = !0,
                    e && e(o))
                }
                ), void 0, i)
            }
            for (var s = 0; A.length > s; ++s)
                a(s);
            return o
        }
    }),
    Aa.prototype = Object.assign(Object.create(Yr.prototype), {
        constructor: Aa,
        load: function(A, e, t, i) {
            var o = new d
              , n = new _r(this.manager);
            return n.setCrossOrigin(this.crossOrigin),
            n.setPath(this.path),
            n.load(A, (function(t) {
                o.image = t;
                var i = A.search(/\.jpe?g($|\?)/i) > 0 || 0 === A.search(/^data\:image\/jpeg/);
                o.format = i ? 1022 : 1023,
                o.needsUpdate = !0,
                void 0 !== e && e(o)
            }
            ), t, i),
            o
        }
    }),
    Object.assign(ea.prototype, {
        getPoint: function() {
            return console.warn("THREE.Curve: .getPoint() not implemented."),
            null
        },
        getPointAt: function(A, e) {
            var t = this.getUtoTmapping(A);
            return this.getPoint(t, e)
        },
        getPoints: function(A) {
            void 0 === A && (A = 5);
            for (var e = [], t = 0; A >= t; t++)
                e.push(this.getPoint(t / A));
            return e
        },
        getSpacedPoints: function(A) {
            void 0 === A && (A = 5);
            for (var e = [], t = 0; A >= t; t++)
                e.push(this.getPointAt(t / A));
            return e
        },
        getLength: function() {
            var A = this.getLengths();
            return A[A.length - 1]
        },
        getLengths: function(A) {
            if (void 0 === A && (A = this.arcLengthDivisions),
            this.cacheArcLengths && this.cacheArcLengths.length === A + 1 && !this.needsUpdate)
                return this.cacheArcLengths;
            this.needsUpdate = !1;
            var e, t, i = [], o = this.getPoint(0), n = 0;
            for (i.push(0),
            t = 1; A >= t; t++)
                n += (e = this.getPoint(t / A)).distanceTo(o),
                i.push(n),
                o = e;
            return this.cacheArcLengths = i,
            i
        },
        updateArcLengths: function() {
            this.needsUpdate = !0,
            this.getLengths()
        },
        getUtoTmapping: function(A, e) {
            var t, i = this.getLengths(), o = 0, n = i.length;
            t = e || A * i[n - 1];
            for (var r, a = 0, s = n - 1; s >= a; )
                if (0 > (r = i[o = Math.floor(a + (s - a) / 2)] - t))
                    a = o + 1;
                else {
                    if (0 >= r) {
                        s = o;
                        break
                    }
                    s = o - 1
                }
            if (i[o = s] === t)
                return o / (n - 1);
            var l = i[o];
            return (o + (t - l) / (i[o + 1] - l)) / (n - 1)
        },
        getTangent: function(A) {
            var e = A - 1e-4
              , t = A + 1e-4;
            0 > e && (e = 0),
            t > 1 && (t = 1);
            var i = this.getPoint(e);
            return this.getPoint(t).clone().sub(i).normalize()
        },
        getTangentAt: function(A) {
            var e = this.getUtoTmapping(A);
            return this.getTangent(e)
        },
        computeFrenetFrames: function(A, e) {
            var t, i, o = new y, n = [], r = [], s = [], l = new y, c = new M;
            for (t = 0; A >= t; t++)
                n[t] = this.getTangentAt(t / A),
                n[t].normalize();
            r[0] = new y,
            s[0] = new y;
            var h = Number.MAX_VALUE
              , d = Math.abs(n[0].x)
              , p = Math.abs(n[0].y)
              , g = Math.abs(n[0].z);
            for (d > h || (h = d,
            o.set(1, 0, 0)),
            p > h || (h = p,
            o.set(0, 1, 0)),
            g > h || o.set(0, 0, 1),
            l.crossVectors(n[0], o).normalize(),
            r[0].crossVectors(n[0], l),
            s[0].crossVectors(n[0], r[0]),
            t = 1; A >= t; t++)
                r[t] = r[t - 1].clone(),
                s[t] = s[t - 1].clone(),
                l.crossVectors(n[t - 1], n[t]),
                l.length() > Number.EPSILON && (l.normalize(),
                i = Math.acos(a.clamp(n[t - 1].dot(n[t]), -1, 1)),
                r[t].applyMatrix4(c.makeRotationAxis(l, i))),
                s[t].crossVectors(n[t], r[t]);
            if (!0 === e)
                for (i = Math.acos(a.clamp(r[0].dot(r[A]), -1, 1)),
                i /= A,
                n[0].dot(l.crossVectors(r[0], r[A])) > 0 && (i = -i),
                t = 1; A >= t; t++)
                    r[t].applyMatrix4(c.makeRotationAxis(n[t], i * t)),
                    s[t].crossVectors(n[t], r[t]);
            return {
                tangents: n,
                normals: r,
                binormals: s
            }
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            return this.arcLengthDivisions = A.arcLengthDivisions,
            this
        },
        toJSON: function() {
            var A = {
                metadata: {
                    version: 4.5,
                    type: "Curve",
                    generator: "Curve.toJSON"
                }
            };
            return A.arcLengthDivisions = this.arcLengthDivisions,
            A.type = this.type,
            A
        },
        fromJSON: function(A) {
            return this.arcLengthDivisions = A.arcLengthDivisions,
            this
        }
    }),
    (ta.prototype = Object.create(ea.prototype)).constructor = ta,
    ta.prototype.isEllipseCurve = !0,
    ta.prototype.getPoint = function(A, e) {
        for (var t = e || new s, i = 2 * Math.PI, o = this.aEndAngle - this.aStartAngle, n = Math.abs(o) < Number.EPSILON; 0 > o; )
            o += i;
        for (; o > i; )
            o -= i;
        Number.EPSILON > o && (o = n ? 0 : i),
        !0 !== this.aClockwise || n || (o === i ? o = -i : o -= i);
        var r = this.aStartAngle + A * o
          , a = this.aX + this.xRadius * Math.cos(r)
          , l = this.aY + this.yRadius * Math.sin(r);
        if (0 !== this.aRotation) {
            var c = Math.cos(this.aRotation)
              , h = Math.sin(this.aRotation)
              , d = a - this.aX
              , p = l - this.aY;
            a = d * c - p * h + this.aX,
            l = d * h + p * c + this.aY
        }
        return t.set(a, l)
    }
    ,
    ta.prototype.copy = function(A) {
        return ea.prototype.copy.call(this, A),
        this.aX = A.aX,
        this.aY = A.aY,
        this.xRadius = A.xRadius,
        this.yRadius = A.yRadius,
        this.aStartAngle = A.aStartAngle,
        this.aEndAngle = A.aEndAngle,
        this.aClockwise = A.aClockwise,
        this.aRotation = A.aRotation,
        this
    }
    ,
    ta.prototype.toJSON = function() {
        var A = ea.prototype.toJSON.call(this);
        return A.aX = this.aX,
        A.aY = this.aY,
        A.xRadius = this.xRadius,
        A.yRadius = this.yRadius,
        A.aStartAngle = this.aStartAngle,
        A.aEndAngle = this.aEndAngle,
        A.aClockwise = this.aClockwise,
        A.aRotation = this.aRotation,
        A
    }
    ,
    ta.prototype.fromJSON = function(A) {
        return ea.prototype.fromJSON.call(this, A),
        this.aX = A.aX,
        this.aY = A.aY,
        this.xRadius = A.xRadius,
        this.yRadius = A.yRadius,
        this.aStartAngle = A.aStartAngle,
        this.aEndAngle = A.aEndAngle,
        this.aClockwise = A.aClockwise,
        this.aRotation = A.aRotation,
        this
    }
    ,
    (ia.prototype = Object.create(ta.prototype)).constructor = ia,
    ia.prototype.isArcCurve = !0;
    var na = new y
      , ra = new oa
      , aa = new oa
      , sa = new oa;
    function la(A, e, t, i) {
        ea.call(this),
        this.type = "CatmullRomCurve3",
        this.points = A || [],
        this.closed = e || !1,
        this.curveType = t || "centripetal",
        this.tension = i || .5
    }
    function ca(A, e, t, i, o) {
        var n = .5 * (i - e)
          , r = .5 * (o - t)
          , a = A * A;
        return (2 * t - 2 * i + n + r) * (A * a) + (-3 * t + 3 * i - 2 * n - r) * a + n * A + t
    }
    function ha(A, e, t, i) {
        return function(A, e) {
            var t = 1 - A;
            return t * t * e
        }(A, e) + function(A, e) {
            return 2 * (1 - A) * A * e
        }(A, t) + function(A, e) {
            return A * A * e
        }(A, i)
    }
    function da(A, e, t, i, o) {
        return function(A, e) {
            var t = 1 - A;
            return t * t * t * e
        }(A, e) + function(A, e) {
            var t = 1 - A;
            return 3 * t * t * A * e
        }(A, t) + function(A, e) {
            return 3 * (1 - A) * A * A * e
        }(A, i) + function(A, e) {
            return A * A * A * e
        }(A, o)
    }
    function pa(A, e, t, i) {
        ea.call(this),
        this.type = "CubicBezierCurve",
        this.v0 = A || new s,
        this.v1 = e || new s,
        this.v2 = t || new s,
        this.v3 = i || new s
    }
    function ga(A, e, t, i) {
        ea.call(this),
        this.type = "CubicBezierCurve3",
        this.v0 = A || new y,
        this.v1 = e || new y,
        this.v2 = t || new y,
        this.v3 = i || new y
    }
    function ua(A, e) {
        ea.call(this),
        this.type = "LineCurve",
        this.v1 = A || new s,
        this.v2 = e || new s
    }
    function fa(A, e) {
        ea.call(this),
        this.type = "LineCurve3",
        this.v1 = A || new y,
        this.v2 = e || new y
    }
    function ma(A, e, t) {
        ea.call(this),
        this.type = "QuadraticBezierCurve",
        this.v0 = A || new s,
        this.v1 = e || new s,
        this.v2 = t || new s
    }
    function Ca(A, e, t) {
        ea.call(this),
        this.type = "QuadraticBezierCurve3",
        this.v0 = A || new y,
        this.v1 = e || new y,
        this.v2 = t || new y
    }
    function ya(A) {
        ea.call(this),
        this.type = "SplineCurve",
        this.points = A || []
    }
    (la.prototype = Object.create(ea.prototype)).constructor = la,
    la.prototype.isCatmullRomCurve3 = !0,
    la.prototype.getPoint = function(A, e) {
        var t, i, o, n, r = e || new y, a = this.points, s = a.length, l = (s - (this.closed ? 0 : 1)) * A, c = Math.floor(l), h = l - c;
        if (this.closed ? c += c > 0 ? 0 : (Math.floor(Math.abs(c) / s) + 1) * s : 0 === h && c === s - 1 && (c = s - 2,
        h = 1),
        this.closed || c > 0 ? t = a[(c - 1) % s] : (na.subVectors(a[0], a[1]).add(a[0]),
        t = na),
        i = a[c % s],
        o = a[(c + 1) % s],
        this.closed || s > c + 2 ? n = a[(c + 2) % s] : (na.subVectors(a[s - 1], a[s - 2]).add(a[s - 1]),
        n = na),
        "centripetal" === this.curveType || "chordal" === this.curveType) {
            var d = "chordal" === this.curveType ? .5 : .25
              , p = Math.pow(t.distanceToSquared(i), d)
              , g = Math.pow(i.distanceToSquared(o), d)
              , u = Math.pow(o.distanceToSquared(n), d);
            1e-4 > g && (g = 1),
            1e-4 > p && (p = g),
            1e-4 > u && (u = g),
            ra.initNonuniformCatmullRom(t.x, i.x, o.x, n.x, p, g, u),
            aa.initNonuniformCatmullRom(t.y, i.y, o.y, n.y, p, g, u),
            sa.initNonuniformCatmullRom(t.z, i.z, o.z, n.z, p, g, u)
        } else
            "catmullrom" === this.curveType && (ra.initCatmullRom(t.x, i.x, o.x, n.x, this.tension),
            aa.initCatmullRom(t.y, i.y, o.y, n.y, this.tension),
            sa.initCatmullRom(t.z, i.z, o.z, n.z, this.tension));
        return r.set(ra.calc(h), aa.calc(h), sa.calc(h)),
        r
    }
    ,
    la.prototype.copy = function(A) {
        ea.prototype.copy.call(this, A),
        this.points = [];
        for (var e = 0, t = A.points.length; t > e; e++) {
            this.points.push(A.points[e].clone())
        }
        return this.closed = A.closed,
        this.curveType = A.curveType,
        this.tension = A.tension,
        this
    }
    ,
    la.prototype.toJSON = function() {
        var A = ea.prototype.toJSON.call(this);
        A.points = [];
        for (var e = 0, t = this.points.length; t > e; e++) {
            A.points.push(this.points[e].toArray())
        }
        return A.closed = this.closed,
        A.curveType = this.curveType,
        A.tension = this.tension,
        A
    }
    ,
    la.prototype.fromJSON = function(A) {
        ea.prototype.fromJSON.call(this, A),
        this.points = [];
        for (var e = 0, t = A.points.length; t > e; e++) {
            var i = A.points[e];
            this.points.push((new y).fromArray(i))
        }
        return this.closed = A.closed,
        this.curveType = A.curveType,
        this.tension = A.tension,
        this
    }
    ,
    (pa.prototype = Object.create(ea.prototype)).constructor = pa,
    pa.prototype.isCubicBezierCurve = !0,
    pa.prototype.getPoint = function(A, e) {
        var t = e || new s
          , i = this.v0
          , o = this.v1
          , n = this.v2
          , r = this.v3;
        return t.set(da(A, i.x, o.x, n.x, r.x), da(A, i.y, o.y, n.y, r.y)),
        t
    }
    ,
    pa.prototype.copy = function(A) {
        return ea.prototype.copy.call(this, A),
        this.v0.copy(A.v0),
        this.v1.copy(A.v1),
        this.v2.copy(A.v2),
        this.v3.copy(A.v3),
        this
    }
    ,
    pa.prototype.toJSON = function() {
        var A = ea.prototype.toJSON.call(this);
        return A.v0 = this.v0.toArray(),
        A.v1 = this.v1.toArray(),
        A.v2 = this.v2.toArray(),
        A.v3 = this.v3.toArray(),
        A
    }
    ,
    pa.prototype.fromJSON = function(A) {
        return ea.prototype.fromJSON.call(this, A),
        this.v0.fromArray(A.v0),
        this.v1.fromArray(A.v1),
        this.v2.fromArray(A.v2),
        this.v3.fromArray(A.v3),
        this
    }
    ,
    (ga.prototype = Object.create(ea.prototype)).constructor = ga,
    ga.prototype.isCubicBezierCurve3 = !0,
    ga.prototype.getPoint = function(A, e) {
        var t = e || new y
          , i = this.v0
          , o = this.v1
          , n = this.v2
          , r = this.v3;
        return t.set(da(A, i.x, o.x, n.x, r.x), da(A, i.y, o.y, n.y, r.y), da(A, i.z, o.z, n.z, r.z)),
        t
    }
    ,
    ga.prototype.copy = function(A) {
        return ea.prototype.copy.call(this, A),
        this.v0.copy(A.v0),
        this.v1.copy(A.v1),
        this.v2.copy(A.v2),
        this.v3.copy(A.v3),
        this
    }
    ,
    ga.prototype.toJSON = function() {
        var A = ea.prototype.toJSON.call(this);
        return A.v0 = this.v0.toArray(),
        A.v1 = this.v1.toArray(),
        A.v2 = this.v2.toArray(),
        A.v3 = this.v3.toArray(),
        A
    }
    ,
    ga.prototype.fromJSON = function(A) {
        return ea.prototype.fromJSON.call(this, A),
        this.v0.fromArray(A.v0),
        this.v1.fromArray(A.v1),
        this.v2.fromArray(A.v2),
        this.v3.fromArray(A.v3),
        this
    }
    ,
    (ua.prototype = Object.create(ea.prototype)).constructor = ua,
    ua.prototype.isLineCurve = !0,
    ua.prototype.getPoint = function(A, e) {
        var t = e || new s;
        return 1 === A ? t.copy(this.v2) : (t.copy(this.v2).sub(this.v1),
        t.multiplyScalar(A).add(this.v1)),
        t
    }
    ,
    ua.prototype.getPointAt = function(A, e) {
        return this.getPoint(A, e)
    }
    ,
    ua.prototype.getTangent = function() {
        return this.v2.clone().sub(this.v1).normalize()
    }
    ,
    ua.prototype.copy = function(A) {
        return ea.prototype.copy.call(this, A),
        this.v1.copy(A.v1),
        this.v2.copy(A.v2),
        this
    }
    ,
    ua.prototype.toJSON = function() {
        var A = ea.prototype.toJSON.call(this);
        return A.v1 = this.v1.toArray(),
        A.v2 = this.v2.toArray(),
        A
    }
    ,
    ua.prototype.fromJSON = function(A) {
        return ea.prototype.fromJSON.call(this, A),
        this.v1.fromArray(A.v1),
        this.v2.fromArray(A.v2),
        this
    }
    ,
    (fa.prototype = Object.create(ea.prototype)).constructor = fa,
    fa.prototype.isLineCurve3 = !0,
    fa.prototype.getPoint = function(A, e) {
        var t = e || new y;
        return 1 === A ? t.copy(this.v2) : (t.copy(this.v2).sub(this.v1),
        t.multiplyScalar(A).add(this.v1)),
        t
    }
    ,
    fa.prototype.getPointAt = function(A, e) {
        return this.getPoint(A, e)
    }
    ,
    fa.prototype.copy = function(A) {
        return ea.prototype.copy.call(this, A),
        this.v1.copy(A.v1),
        this.v2.copy(A.v2),
        this
    }
    ,
    fa.prototype.toJSON = function() {
        var A = ea.prototype.toJSON.call(this);
        return A.v1 = this.v1.toArray(),
        A.v2 = this.v2.toArray(),
        A
    }
    ,
    fa.prototype.fromJSON = function(A) {
        return ea.prototype.fromJSON.call(this, A),
        this.v1.fromArray(A.v1),
        this.v2.fromArray(A.v2),
        this
    }
    ,
    (ma.prototype = Object.create(ea.prototype)).constructor = ma,
    ma.prototype.isQuadraticBezierCurve = !0,
    ma.prototype.getPoint = function(A, e) {
        var t = e || new s
          , i = this.v0
          , o = this.v1
          , n = this.v2;
        return t.set(ha(A, i.x, o.x, n.x), ha(A, i.y, o.y, n.y)),
        t
    }
    ,
    ma.prototype.copy = function(A) {
        return ea.prototype.copy.call(this, A),
        this.v0.copy(A.v0),
        this.v1.copy(A.v1),
        this.v2.copy(A.v2),
        this
    }
    ,
    ma.prototype.toJSON = function() {
        var A = ea.prototype.toJSON.call(this);
        return A.v0 = this.v0.toArray(),
        A.v1 = this.v1.toArray(),
        A.v2 = this.v2.toArray(),
        A
    }
    ,
    ma.prototype.fromJSON = function(A) {
        return ea.prototype.fromJSON.call(this, A),
        this.v0.fromArray(A.v0),
        this.v1.fromArray(A.v1),
        this.v2.fromArray(A.v2),
        this
    }
    ,
    (Ca.prototype = Object.create(ea.prototype)).constructor = Ca,
    Ca.prototype.isQuadraticBezierCurve3 = !0,
    Ca.prototype.getPoint = function(A, e) {
        var t = e || new y
          , i = this.v0
          , o = this.v1
          , n = this.v2;
        return t.set(ha(A, i.x, o.x, n.x), ha(A, i.y, o.y, n.y), ha(A, i.z, o.z, n.z)),
        t
    }
    ,
    Ca.prototype.copy = function(A) {
        return ea.prototype.copy.call(this, A),
        this.v0.copy(A.v0),
        this.v1.copy(A.v1),
        this.v2.copy(A.v2),
        this
    }
    ,
    Ca.prototype.toJSON = function() {
        var A = ea.prototype.toJSON.call(this);
        return A.v0 = this.v0.toArray(),
        A.v1 = this.v1.toArray(),
        A.v2 = this.v2.toArray(),
        A
    }
    ,
    Ca.prototype.fromJSON = function(A) {
        return ea.prototype.fromJSON.call(this, A),
        this.v0.fromArray(A.v0),
        this.v1.fromArray(A.v1),
        this.v2.fromArray(A.v2),
        this
    }
    ,
    (ya.prototype = Object.create(ea.prototype)).constructor = ya,
    ya.prototype.isSplineCurve = !0,
    ya.prototype.getPoint = function(A, e) {
        var t = e || new s
          , i = this.points
          , o = (i.length - 1) * A
          , n = Math.floor(o)
          , r = o - n
          , a = i[0 === n ? n : n - 1]
          , l = i[n]
          , c = i[n > i.length - 2 ? i.length - 1 : n + 1]
          , h = i[n > i.length - 3 ? i.length - 1 : n + 2];
        return t.set(ca(r, a.x, l.x, c.x, h.x), ca(r, a.y, l.y, c.y, h.y)),
        t
    }
    ,
    ya.prototype.copy = function(A) {
        ea.prototype.copy.call(this, A),
        this.points = [];
        for (var e = 0, t = A.points.length; t > e; e++) {
            this.points.push(A.points[e].clone())
        }
        return this
    }
    ,
    ya.prototype.toJSON = function() {
        var A = ea.prototype.toJSON.call(this);
        A.points = [];
        for (var e = 0, t = this.points.length; t > e; e++) {
            A.points.push(this.points[e].toArray())
        }
        return A
    }
    ,
    ya.prototype.fromJSON = function(A) {
        ea.prototype.fromJSON.call(this, A),
        this.points = [];
        for (var e = 0, t = A.points.length; t > e; e++) {
            var i = A.points[e];
            this.points.push((new s).fromArray(i))
        }
        return this
    }
    ;
    var va = Object.freeze({
        __proto__: null,
        ArcCurve: ia,
        CatmullRomCurve3: la,
        CubicBezierCurve: pa,
        CubicBezierCurve3: ga,
        EllipseCurve: ta,
        LineCurve: ua,
        LineCurve3: fa,
        QuadraticBezierCurve: ma,
        QuadraticBezierCurve3: Ca,
        SplineCurve: ya
    });
    function Ia() {
        ea.call(this),
        this.type = "CurvePath",
        this.curves = [],
        this.autoClose = !1
    }
    function Ea(A) {
        Ia.call(this),
        this.type = "Path",
        this.currentPoint = new s,
        A && this.setFromPoints(A)
    }
    function Ba(A) {
        Ea.call(this, A),
        this.uuid = a.generateUUID(),
        this.type = "Shape",
        this.holes = []
    }
    function xa(A, e) {
        H.call(this),
        this.type = "Light",
        this.color = new LA(A),
        this.intensity = void 0 !== e ? e : 1,
        this.receiveShadow = void 0
    }
    function Sa(A, e, t) {
        xa.call(this, A, t),
        this.type = "HemisphereLight",
        this.castShadow = void 0,
        this.position.copy(H.DefaultUp),
        this.updateMatrix(),
        this.groundColor = new LA(e)
    }
    function wa(A) {
        this.camera = A,
        this.bias = 0,
        this.radius = 1,
        this.mapSize = new s(512,512),
        this.map = null,
        this.mapPass = null,
        this.matrix = new M,
        this._frustum = new Ze,
        this._frameExtents = new s(1,1),
        this._viewportCount = 1,
        this._viewports = [new p(0,0,1,1)]
    }
    function Ma() {
        wa.call(this, new je(50,1,.5,500))
    }
    function ba(A, e, t, i, o, n) {
        xa.call(this, A, e),
        this.type = "SpotLight",
        this.position.copy(H.DefaultUp),
        this.updateMatrix(),
        this.target = new H,
        Object.defineProperty(this, "power", {
            get: function() {
                return this.intensity * Math.PI
            },
            set: function(A) {
                this.intensity = A / Math.PI
            }
        }),
        this.distance = void 0 !== t ? t : 0,
        this.angle = void 0 !== i ? i : Math.PI / 3,
        this.penumbra = void 0 !== o ? o : 0,
        this.decay = void 0 !== n ? n : 1,
        this.shadow = new Ma
    }
    function Ua() {
        wa.call(this, new je(90,1,.5,500)),
        this._frameExtents = new s(4,2),
        this._viewportCount = 6,
        this._viewports = [new p(2,1,1,1), new p(0,1,1,1), new p(3,1,1,1), new p(1,1,1,1), new p(3,0,1,1), new p(1,0,1,1)],
        this._cubeDirections = [new y(1,0,0), new y(-1,0,0), new y(0,0,1), new y(0,0,-1), new y(0,1,0), new y(0,-1,0)],
        this._cubeUps = [new y(0,1,0), new y(0,1,0), new y(0,1,0), new y(0,1,0), new y(0,0,1), new y(0,0,-1)]
    }
    function Fa(A, e, t, i) {
        xa.call(this, A, e),
        this.type = "PointLight",
        Object.defineProperty(this, "power", {
            get: function() {
                return 4 * this.intensity * Math.PI
            },
            set: function(A) {
                this.intensity = A / (4 * Math.PI)
            }
        }),
        this.distance = void 0 !== t ? t : 0,
        this.decay = void 0 !== i ? i : 1,
        this.shadow = new Ua
    }
    function Ka(A, e, t, i, o, n) {
        qe.call(this),
        this.type = "OrthographicCamera",
        this.zoom = 1,
        this.view = null,
        this.left = void 0 !== A ? A : -1,
        this.right = void 0 !== e ? e : 1,
        this.top = void 0 !== t ? t : 1,
        this.bottom = void 0 !== i ? i : -1,
        this.near = void 0 !== o ? o : .1,
        this.far = void 0 !== n ? n : 2e3,
        this.updateProjectionMatrix()
    }
    function Qa() {
        wa.call(this, new Ka(-5,5,5,-5,.5,500))
    }
    function Ra(A, e) {
        xa.call(this, A, e),
        this.type = "DirectionalLight",
        this.position.copy(H.DefaultUp),
        this.updateMatrix(),
        this.target = new H,
        this.shadow = new Qa
    }
    function Ta(A, e) {
        xa.call(this, A, e),
        this.type = "AmbientLight",
        this.castShadow = void 0
    }
    function ka(A, e, t, i) {
        xa.call(this, A, e),
        this.type = "RectAreaLight",
        this.width = void 0 !== t ? t : 10,
        this.height = void 0 !== i ? i : 10
    }
    function Da(A) {
        Yr.call(this, A),
        this.textures = {}
    }
    Ia.prototype = Object.assign(Object.create(ea.prototype), {
        constructor: Ia,
        add: function(A) {
            this.curves.push(A)
        },
        closePath: function() {
            var A = this.curves[0].getPoint(0)
              , e = this.curves[this.curves.length - 1].getPoint(1);
            A.equals(e) || this.curves.push(new ua(e,A))
        },
        getPoint: function(A) {
            for (var e = A * this.getLength(), t = this.getCurveLengths(), i = 0; t.length > i; ) {
                if (t[i] >= e) {
                    var o = t[i] - e
                      , n = this.curves[i]
                      , r = n.getLength();
                    return n.getPointAt(0 === r ? 0 : 1 - o / r)
                }
                i++
            }
            return null
        },
        getLength: function() {
            var A = this.getCurveLengths();
            return A[A.length - 1]
        },
        updateArcLengths: function() {
            this.needsUpdate = !0,
            this.cacheLengths = null,
            this.getCurveLengths()
        },
        getCurveLengths: function() {
            if (this.cacheLengths && this.cacheLengths.length === this.curves.length)
                return this.cacheLengths;
            for (var A = [], e = 0, t = 0, i = this.curves.length; i > t; t++)
                e += this.curves[t].getLength(),
                A.push(e);
            return this.cacheLengths = A,
            A
        },
        getSpacedPoints: function(A) {
            void 0 === A && (A = 40);
            for (var e = [], t = 0; A >= t; t++)
                e.push(this.getPoint(t / A));
            return this.autoClose && e.push(e[0]),
            e
        },
        getPoints: function(A) {
            A = A || 12;
            for (var e, t = [], i = 0, o = this.curves; o.length > i; i++)
                for (var n = o[i], r = n.getPoints(n && n.isEllipseCurve ? 2 * A : n && (n.isLineCurve || n.isLineCurve3) ? 1 : n && n.isSplineCurve ? A * n.points.length : A), a = 0; r.length > a; a++) {
                    var s = r[a];
                    e && e.equals(s) || (t.push(s),
                    e = s)
                }
            return this.autoClose && t.length > 1 && !t[t.length - 1].equals(t[0]) && t.push(t[0]),
            t
        },
        copy: function(A) {
            ea.prototype.copy.call(this, A),
            this.curves = [];
            for (var e = 0, t = A.curves.length; t > e; e++) {
                this.curves.push(A.curves[e].clone())
            }
            return this.autoClose = A.autoClose,
            this
        },
        toJSON: function() {
            var A = ea.prototype.toJSON.call(this);
            A.autoClose = this.autoClose,
            A.curves = [];
            for (var e = 0, t = this.curves.length; t > e; e++) {
                A.curves.push(this.curves[e].toJSON())
            }
            return A
        },
        fromJSON: function(A) {
            ea.prototype.fromJSON.call(this, A),
            this.autoClose = A.autoClose,
            this.curves = [];
            for (var e = 0, t = A.curves.length; t > e; e++) {
                var i = A.curves[e];
                this.curves.push((new va[i.type]).fromJSON(i))
            }
            return this
        }
    }),
    Ea.prototype = Object.assign(Object.create(Ia.prototype), {
        constructor: Ea,
        setFromPoints: function(A) {
            this.moveTo(A[0].x, A[0].y);
            for (var e = 1, t = A.length; t > e; e++)
                this.lineTo(A[e].x, A[e].y);
            return this
        },
        moveTo: function(A, e) {
            return this.currentPoint.set(A, e),
            this
        },
        lineTo: function(A, e) {
            var t = new ua(this.currentPoint.clone(),new s(A,e));
            return this.curves.push(t),
            this.currentPoint.set(A, e),
            this
        },
        quadraticCurveTo: function(A, e, t, i) {
            var o = new ma(this.currentPoint.clone(),new s(A,e),new s(t,i));
            return this.curves.push(o),
            this.currentPoint.set(t, i),
            this
        },
        bezierCurveTo: function(A, e, t, i, o, n) {
            var r = new pa(this.currentPoint.clone(),new s(A,e),new s(t,i),new s(o,n));
            return this.curves.push(r),
            this.currentPoint.set(o, n),
            this
        },
        splineThru: function(A) {
            var e = new ya([this.currentPoint.clone()].concat(A));
            return this.curves.push(e),
            this.currentPoint.copy(A[A.length - 1]),
            this
        },
        arc: function(A, e, t, i, o, n) {
            return this.absarc(A + this.currentPoint.x, e + this.currentPoint.y, t, i, o, n),
            this
        },
        absarc: function(A, e, t, i, o, n) {
            return this.absellipse(A, e, t, t, i, o, n),
            this
        },
        ellipse: function(A, e, t, i, o, n, r, a) {
            return this.absellipse(A + this.currentPoint.x, e + this.currentPoint.y, t, i, o, n, r, a),
            this
        },
        absellipse: function(A, e, t, i, o, n, r, a) {
            var s = new ta(A,e,t,i,o,n,r,a);
            if (this.curves.length > 0) {
                var l = s.getPoint(0);
                l.equals(this.currentPoint) || this.lineTo(l.x, l.y)
            }
            this.curves.push(s);
            var c = s.getPoint(1);
            return this.currentPoint.copy(c),
            this
        },
        copy: function(A) {
            return Ia.prototype.copy.call(this, A),
            this.currentPoint.copy(A.currentPoint),
            this
        },
        toJSON: function() {
            var A = Ia.prototype.toJSON.call(this);
            return A.currentPoint = this.currentPoint.toArray(),
            A
        },
        fromJSON: function(A) {
            return Ia.prototype.fromJSON.call(this, A),
            this.currentPoint.fromArray(A.currentPoint),
            this
        }
    }),
    Ba.prototype = Object.assign(Object.create(Ea.prototype), {
        constructor: Ba,
        getPointsHoles: function(A) {
            for (var e = [], t = 0, i = this.holes.length; i > t; t++)
                e[t] = this.holes[t].getPoints(A);
            return e
        },
        extractPoints: function(A) {
            return {
                shape: this.getPoints(A),
                holes: this.getPointsHoles(A)
            }
        },
        copy: function(A) {
            Ea.prototype.copy.call(this, A),
            this.holes = [];
            for (var e = 0, t = A.holes.length; t > e; e++) {
                this.holes.push(A.holes[e].clone())
            }
            return this
        },
        toJSON: function() {
            var A = Ea.prototype.toJSON.call(this);
            A.uuid = this.uuid,
            A.holes = [];
            for (var e = 0, t = this.holes.length; t > e; e++) {
                A.holes.push(this.holes[e].toJSON())
            }
            return A
        },
        fromJSON: function(A) {
            Ea.prototype.fromJSON.call(this, A),
            this.uuid = A.uuid,
            this.holes = [];
            for (var e = 0, t = A.holes.length; t > e; e++) {
                var i = A.holes[e];
                this.holes.push((new Ea).fromJSON(i))
            }
            return this
        }
    }),
    xa.prototype = Object.assign(Object.create(H.prototype), {
        constructor: xa,
        isLight: !0,
        copy: function(A) {
            return H.prototype.copy.call(this, A),
            this.color.copy(A.color),
            this.intensity = A.intensity,
            this
        },
        toJSON: function(A) {
            var e = H.prototype.toJSON.call(this, A);
            return e.object.color = this.color.getHex(),
            e.object.intensity = this.intensity,
            void 0 !== this.groundColor && (e.object.groundColor = this.groundColor.getHex()),
            void 0 !== this.distance && (e.object.distance = this.distance),
            void 0 !== this.angle && (e.object.angle = this.angle),
            void 0 !== this.decay && (e.object.decay = this.decay),
            void 0 !== this.penumbra && (e.object.penumbra = this.penumbra),
            void 0 !== this.shadow && (e.object.shadow = this.shadow.toJSON()),
            e
        }
    }),
    Sa.prototype = Object.assign(Object.create(xa.prototype), {
        constructor: Sa,
        isHemisphereLight: !0,
        copy: function(A) {
            return xa.prototype.copy.call(this, A),
            this.groundColor.copy(A.groundColor),
            this
        }
    }),
    Object.assign(wa.prototype, {
        _projScreenMatrix: new M,
        _lightPositionWorld: new y,
        _lookTarget: new y,
        getViewportCount: function() {
            return this._viewportCount
        },
        getFrustum: function() {
            return this._frustum
        },
        updateMatrices: function(A) {
            var e = this.camera
              , t = this.matrix
              , i = this._projScreenMatrix
              , o = this._lookTarget
              , n = this._lightPositionWorld;
            n.setFromMatrixPosition(A.matrixWorld),
            e.position.copy(n),
            o.setFromMatrixPosition(A.target.matrixWorld),
            e.lookAt(o),
            e.updateMatrixWorld(),
            i.multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse),
            this._frustum.setFromProjectionMatrix(i),
            t.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1),
            t.multiply(e.projectionMatrix),
            t.multiply(e.matrixWorldInverse)
        },
        getViewport: function(A) {
            return this._viewports[A]
        },
        getFrameExtents: function() {
            return this._frameExtents
        },
        copy: function(A) {
            return this.camera = A.camera.clone(),
            this.bias = A.bias,
            this.radius = A.radius,
            this.mapSize.copy(A.mapSize),
            this
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        toJSON: function() {
            var A = {};
            return 0 !== this.bias && (A.bias = this.bias),
            1 !== this.radius && (A.radius = this.radius),
            512 === this.mapSize.x && 512 === this.mapSize.y || (A.mapSize = this.mapSize.toArray()),
            A.camera = this.camera.toJSON(!1).object,
            delete A.camera.matrix,
            A
        }
    }),
    Ma.prototype = Object.assign(Object.create(wa.prototype), {
        constructor: Ma,
        isSpotLightShadow: !0,
        updateMatrices: function(A) {
            var e = this.camera
              , t = 2 * a.RAD2DEG * A.angle
              , i = this.mapSize.width / this.mapSize.height
              , o = A.distance || e.far;
            t === e.fov && i === e.aspect && o === e.far || (e.fov = t,
            e.aspect = i,
            e.far = o,
            e.updateProjectionMatrix()),
            wa.prototype.updateMatrices.call(this, A)
        }
    }),
    ba.prototype = Object.assign(Object.create(xa.prototype), {
        constructor: ba,
        isSpotLight: !0,
        copy: function(A) {
            return xa.prototype.copy.call(this, A),
            this.distance = A.distance,
            this.angle = A.angle,
            this.penumbra = A.penumbra,
            this.decay = A.decay,
            this.target = A.target.clone(),
            this.shadow = A.shadow.clone(),
            this
        }
    }),
    Ua.prototype = Object.assign(Object.create(wa.prototype), {
        constructor: Ua,
        isPointLightShadow: !0,
        updateMatrices: function(A, e) {
            void 0 === e && (e = 0);
            var t = this.camera
              , i = this.matrix
              , o = this._lightPositionWorld
              , n = this._lookTarget
              , r = this._projScreenMatrix;
            o.setFromMatrixPosition(A.matrixWorld),
            t.position.copy(o),
            n.copy(t.position),
            n.add(this._cubeDirections[e]),
            t.up.copy(this._cubeUps[e]),
            t.lookAt(n),
            t.updateMatrixWorld(),
            i.makeTranslation(-o.x, -o.y, -o.z),
            r.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse),
            this._frustum.setFromProjectionMatrix(r)
        }
    }),
    Fa.prototype = Object.assign(Object.create(xa.prototype), {
        constructor: Fa,
        isPointLight: !0,
        copy: function(A) {
            return xa.prototype.copy.call(this, A),
            this.distance = A.distance,
            this.decay = A.decay,
            this.shadow = A.shadow.clone(),
            this
        }
    }),
    Ka.prototype = Object.assign(Object.create(qe.prototype), {
        constructor: Ka,
        isOrthographicCamera: !0,
        copy: function(A, e) {
            return qe.prototype.copy.call(this, A, e),
            this.left = A.left,
            this.right = A.right,
            this.top = A.top,
            this.bottom = A.bottom,
            this.near = A.near,
            this.far = A.far,
            this.zoom = A.zoom,
            this.view = null === A.view ? null : Object.assign({}, A.view),
            this
        },
        setViewOffset: function(A, e, t, i, o, n) {
            null === this.view && (this.view = {
                enabled: !0,
                fullWidth: 1,
                fullHeight: 1,
                offsetX: 0,
                offsetY: 0,
                width: 1,
                height: 1
            }),
            this.view.enabled = !0,
            this.view.fullWidth = A,
            this.view.fullHeight = e,
            this.view.offsetX = t,
            this.view.offsetY = i,
            this.view.width = o,
            this.view.height = n,
            this.updateProjectionMatrix()
        },
        clearViewOffset: function() {
            null !== this.view && (this.view.enabled = !1),
            this.updateProjectionMatrix()
        },
        updateProjectionMatrix: function() {
            var A = (this.right - this.left) / (2 * this.zoom)
              , e = (this.top - this.bottom) / (2 * this.zoom)
              , t = (this.right + this.left) / 2
              , i = (this.top + this.bottom) / 2
              , o = t - A
              , n = t + A
              , r = i + e
              , a = i - e;
            if (null !== this.view && this.view.enabled) {
                var s = (this.right - this.left) / this.view.fullWidth / this.zoom
                  , l = (this.top - this.bottom) / this.view.fullHeight / this.zoom;
                n = (o += s * this.view.offsetX) + s * this.view.width,
                a = (r -= l * this.view.offsetY) - l * this.view.height
            }
            this.projectionMatrix.makeOrthographic(o, n, r, a, this.near, this.far),
            this.projectionMatrixInverse.getInverse(this.projectionMatrix)
        },
        toJSON: function(A) {
            var e = H.prototype.toJSON.call(this, A);
            return e.object.zoom = this.zoom,
            e.object.left = this.left,
            e.object.right = this.right,
            e.object.top = this.top,
            e.object.bottom = this.bottom,
            e.object.near = this.near,
            e.object.far = this.far,
            null !== this.view && (e.object.view = Object.assign({}, this.view)),
            e
        }
    }),
    Qa.prototype = Object.assign(Object.create(wa.prototype), {
        constructor: Qa,
        isDirectionalLightShadow: !0,
        updateMatrices: function(A) {
            wa.prototype.updateMatrices.call(this, A)
        }
    }),
    Ra.prototype = Object.assign(Object.create(xa.prototype), {
        constructor: Ra,
        isDirectionalLight: !0,
        copy: function(A) {
            return xa.prototype.copy.call(this, A),
            this.target = A.target.clone(),
            this.shadow = A.shadow.clone(),
            this
        }
    }),
    Ta.prototype = Object.assign(Object.create(xa.prototype), {
        constructor: Ta,
        isAmbientLight: !0
    }),
    ka.prototype = Object.assign(Object.create(xa.prototype), {
        constructor: ka,
        isRectAreaLight: !0,
        copy: function(A) {
            return xa.prototype.copy.call(this, A),
            this.width = A.width,
            this.height = A.height,
            this
        },
        toJSON: function(A) {
            var e = xa.prototype.toJSON.call(this, A);
            return e.object.width = this.width,
            e.object.height = this.height,
            e
        }
    }),
    Da.prototype = Object.assign(Object.create(Yr.prototype), {
        constructor: Da,
        load: function(A, e, t, i) {
            var o = this
              , n = new Jr(o.manager);
            n.setPath(o.path),
            n.load(A, (function(A) {
                e(o.parse(JSON.parse(A)))
            }
            ), t, i)
        },
        parse: function(A) {
            var e = this.textures;
            function t(A) {
                return void 0 === e[A] && console.warn("THREE.MaterialLoader: Undefined texture", A),
                e[A]
            }
            var i = new Mr[A.type];
            if (void 0 !== A.uuid && (i.uuid = A.uuid),
            void 0 !== A.name && (i.name = A.name),
            void 0 !== A.color && i.color.setHex(A.color),
            void 0 !== A.roughness && (i.roughness = A.roughness),
            void 0 !== A.metalness && (i.metalness = A.metalness),
            void 0 !== A.sheen && (i.sheen = (new LA).setHex(A.sheen)),
            void 0 !== A.emissive && i.emissive.setHex(A.emissive),
            void 0 !== A.specular && i.specular.setHex(A.specular),
            void 0 !== A.shininess && (i.shininess = A.shininess),
            void 0 !== A.clearcoat && (i.clearcoat = A.clearcoat),
            void 0 !== A.clearcoatRoughness && (i.clearcoatRoughness = A.clearcoatRoughness),
            void 0 !== A.fog && (i.fog = A.fog),
            void 0 !== A.flatShading && (i.flatShading = A.flatShading),
            void 0 !== A.blending && (i.blending = A.blending),
            void 0 !== A.combine && (i.combine = A.combine),
            void 0 !== A.side && (i.side = A.side),
            void 0 !== A.opacity && (i.opacity = A.opacity),
            void 0 !== A.transparent && (i.transparent = A.transparent),
            void 0 !== A.alphaTest && (i.alphaTest = A.alphaTest),
            void 0 !== A.depthTest && (i.depthTest = A.depthTest),
            void 0 !== A.depthWrite && (i.depthWrite = A.depthWrite),
            void 0 !== A.colorWrite && (i.colorWrite = A.colorWrite),
            void 0 !== A.stencilWrite && (i.stencilWrite = A.stencilWrite),
            void 0 !== A.stencilWriteMask && (i.stencilWriteMask = A.stencilWriteMask),
            void 0 !== A.stencilFunc && (i.stencilFunc = A.stencilFunc),
            void 0 !== A.stencilRef && (i.stencilRef = A.stencilRef),
            void 0 !== A.stencilFuncMask && (i.stencilFuncMask = A.stencilFuncMask),
            void 0 !== A.stencilFail && (i.stencilFail = A.stencilFail),
            void 0 !== A.stencilZFail && (i.stencilZFail = A.stencilZFail),
            void 0 !== A.stencilZPass && (i.stencilZPass = A.stencilZPass),
            void 0 !== A.wireframe && (i.wireframe = A.wireframe),
            void 0 !== A.wireframeLinewidth && (i.wireframeLinewidth = A.wireframeLinewidth),
            void 0 !== A.wireframeLinecap && (i.wireframeLinecap = A.wireframeLinecap),
            void 0 !== A.wireframeLinejoin && (i.wireframeLinejoin = A.wireframeLinejoin),
            void 0 !== A.rotation && (i.rotation = A.rotation),
            1 !== A.linewidth && (i.linewidth = A.linewidth),
            void 0 !== A.dashSize && (i.dashSize = A.dashSize),
            void 0 !== A.gapSize && (i.gapSize = A.gapSize),
            void 0 !== A.scale && (i.scale = A.scale),
            void 0 !== A.polygonOffset && (i.polygonOffset = A.polygonOffset),
            void 0 !== A.polygonOffsetFactor && (i.polygonOffsetFactor = A.polygonOffsetFactor),
            void 0 !== A.polygonOffsetUnits && (i.polygonOffsetUnits = A.polygonOffsetUnits),
            void 0 !== A.skinning && (i.skinning = A.skinning),
            void 0 !== A.morphTargets && (i.morphTargets = A.morphTargets),
            void 0 !== A.morphNormals && (i.morphNormals = A.morphNormals),
            void 0 !== A.dithering && (i.dithering = A.dithering),
            void 0 !== A.vertexTangents && (i.vertexTangents = A.vertexTangents),
            void 0 !== A.visible && (i.visible = A.visible),
            void 0 !== A.toneMapped && (i.toneMapped = A.toneMapped),
            void 0 !== A.userData && (i.userData = A.userData),
            void 0 !== A.vertexColors && (i.vertexColors = "number" == typeof A.vertexColors ? A.vertexColors > 0 : A.vertexColors),
            void 0 !== A.uniforms)
                for (var o in A.uniforms) {
                    var n = A.uniforms[o];
                    switch (i.uniforms[o] = {},
                    n.type) {
                    case "t":
                        i.uniforms[o].value = t(n.value);
                        break;
                    case "c":
                        i.uniforms[o].value = (new LA).setHex(n.value);
                        break;
                    case "v2":
                        i.uniforms[o].value = (new s).fromArray(n.value);
                        break;
                    case "v3":
                        i.uniforms[o].value = (new y).fromArray(n.value);
                        break;
                    case "v4":
                        i.uniforms[o].value = (new p).fromArray(n.value);
                        break;
                    case "m3":
                        i.uniforms[o].value = (new l).fromArray(n.value);
                    case "m4":
                        i.uniforms[o].value = (new M).fromArray(n.value);
                        break;
                    default:
                        i.uniforms[o].value = n.value
                    }
                }
            if (void 0 !== A.defines && (i.defines = A.defines),
            void 0 !== A.vertexShader && (i.vertexShader = A.vertexShader),
            void 0 !== A.fragmentShader && (i.fragmentShader = A.fragmentShader),
            void 0 !== A.extensions)
                for (var r in A.extensions)
                    i.extensions[r] = A.extensions[r];
            if (void 0 !== A.shading && (i.flatShading = 1 === A.shading),
            void 0 !== A.size && (i.size = A.size),
            void 0 !== A.sizeAttenuation && (i.sizeAttenuation = A.sizeAttenuation),
            void 0 !== A.map && (i.map = t(A.map)),
            void 0 !== A.matcap && (i.matcap = t(A.matcap)),
            void 0 !== A.alphaMap && (i.alphaMap = t(A.alphaMap)),
            void 0 !== A.bumpMap && (i.bumpMap = t(A.bumpMap)),
            void 0 !== A.bumpScale && (i.bumpScale = A.bumpScale),
            void 0 !== A.normalMap && (i.normalMap = t(A.normalMap)),
            void 0 !== A.normalMapType && (i.normalMapType = A.normalMapType),
            void 0 !== A.normalScale) {
                var a = A.normalScale;
                !1 === Array.isArray(a) && (a = [a, a]),
                i.normalScale = (new s).fromArray(a)
            }
            return void 0 !== A.displacementMap && (i.displacementMap = t(A.displacementMap)),
            void 0 !== A.displacementScale && (i.displacementScale = A.displacementScale),
            void 0 !== A.displacementBias && (i.displacementBias = A.displacementBias),
            void 0 !== A.roughnessMap && (i.roughnessMap = t(A.roughnessMap)),
            void 0 !== A.metalnessMap && (i.metalnessMap = t(A.metalnessMap)),
            void 0 !== A.emissiveMap && (i.emissiveMap = t(A.emissiveMap)),
            void 0 !== A.emissiveIntensity && (i.emissiveIntensity = A.emissiveIntensity),
            void 0 !== A.specularMap && (i.specularMap = t(A.specularMap)),
            void 0 !== A.envMap && (i.envMap = t(A.envMap)),
            void 0 !== A.envMapIntensity && (i.envMapIntensity = A.envMapIntensity),
            void 0 !== A.reflectivity && (i.reflectivity = A.reflectivity),
            void 0 !== A.refractionRatio && (i.refractionRatio = A.refractionRatio),
            void 0 !== A.lightMap && (i.lightMap = t(A.lightMap)),
            void 0 !== A.lightMapIntensity && (i.lightMapIntensity = A.lightMapIntensity),
            void 0 !== A.aoMap && (i.aoMap = t(A.aoMap)),
            void 0 !== A.aoMapIntensity && (i.aoMapIntensity = A.aoMapIntensity),
            void 0 !== A.gradientMap && (i.gradientMap = t(A.gradientMap)),
            void 0 !== A.clearcoatMap && (i.clearcoatMap = t(A.clearcoatMap)),
            void 0 !== A.clearcoatRoughnessMap && (i.clearcoatRoughnessMap = t(A.clearcoatRoughnessMap)),
            void 0 !== A.clearcoatNormalMap && (i.clearcoatNormalMap = t(A.clearcoatNormalMap)),
            void 0 !== A.clearcoatNormalScale && (i.clearcoatNormalScale = (new s).fromArray(A.clearcoatNormalScale)),
            i
        },
        setTextures: function(A) {
            return this.textures = A,
            this
        }
    });
    var La = {
        decodeText: function(A) {
            if ("undefined" != typeof TextDecoder)
                return (new TextDecoder).decode(A);
            for (var e = "", t = 0, i = A.length; i > t; t++)
                e += String.fromCharCode(A[t]);
            try {
                return decodeURIComponent(escape(e))
            } catch (A) {
                return e
            }
        },
        extractUrlBase: function(A) {
            var e = A.lastIndexOf("/");
            return -1 === e ? "./" : A.substr(0, e + 1)
        }
    };
    function Na() {
        he.call(this),
        this.type = "InstancedBufferGeometry",
        this.maxInstancedCount = void 0
    }
    function Oa(A, e, t, i) {
        "number" == typeof t && (i = t,
        t = !1,
        console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),
        YA.call(this, A, e, t),
        this.meshPerAttribute = i || 1
    }
    function Va(A) {
        Yr.call(this, A)
    }
    Na.prototype = Object.assign(Object.create(he.prototype), {
        constructor: Na,
        isInstancedBufferGeometry: !0,
        copy: function(A) {
            return he.prototype.copy.call(this, A),
            this.maxInstancedCount = A.maxInstancedCount,
            this
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        toJSON: function() {
            var A = he.prototype.toJSON.call(this);
            return A.maxInstancedCount = this.maxInstancedCount,
            A.isInstancedBufferGeometry = !0,
            A
        }
    }),
    Oa.prototype = Object.assign(Object.create(YA.prototype), {
        constructor: Oa,
        isInstancedBufferAttribute: !0,
        copy: function(A) {
            return YA.prototype.copy.call(this, A),
            this.meshPerAttribute = A.meshPerAttribute,
            this
        },
        toJSON: function() {
            var A = YA.prototype.toJSON.call(this);
            return A.meshPerAttribute = this.meshPerAttribute,
            A.isInstancedBufferAttribute = !0,
            A
        }
    }),
    Va.prototype = Object.assign(Object.create(Yr.prototype), {
        constructor: Va,
        load: function(A, e, t, i) {
            var o = this
              , n = new Jr(o.manager);
            n.setPath(o.path),
            n.load(A, (function(A) {
                e(o.parse(JSON.parse(A)))
            }
            ), t, i)
        },
        parse: function(A) {
            var e = A.isInstancedBufferGeometry ? new Na : new he
              , t = A.data.index;
            if (void 0 !== t) {
                var i = new Ga[t.type](t.array);
                e.setIndex(new YA(i,1))
            }
            var o = A.data.attributes;
            for (var n in o) {
                i = new Ga[(d = o[n]).type](d.array);
                var r = new (d.isInstancedBufferAttribute ? Oa : YA)(i,d.itemSize,d.normalized);
                void 0 !== d.name && (r.name = d.name),
                e.setAttribute(n, r)
            }
            var a = A.data.morphAttributes;
            if (a)
                for (var n in a) {
                    for (var s = a[n], l = [], c = 0, h = s.length; h > c; c++) {
                        var d;
                        r = new YA(i = new Ga[(d = s[c]).type](d.array),d.itemSize,d.normalized);
                        void 0 !== d.name && (r.name = d.name),
                        l.push(r)
                    }
                    e.morphAttributes[n] = l
                }
            A.data.morphTargetsRelative && (e.morphTargetsRelative = !0);
            var p = A.data.groups || A.data.drawcalls || A.data.offsets;
            if (void 0 !== p) {
                c = 0;
                for (var g = p.length; c !== g; ++c) {
                    var u = p[c];
                    e.addGroup(u.start, u.count, u.materialIndex)
                }
            }
            var f = A.data.boundingSphere;
            if (void 0 !== f) {
                var m = new y;
                void 0 !== f.center && m.fromArray(f.center),
                e.boundingSphere = new cA(m,f.radius)
            }
            return A.name && (e.name = A.name),
            A.userData && (e.userData = A.userData),
            e
        }
    });
    var Ga = {
        Int8Array: Int8Array,
        Uint8Array: Uint8Array,
        Uint8ClampedArray: "undefined" != typeof Uint8ClampedArray ? Uint8ClampedArray : Uint8Array,
        Int16Array: Int16Array,
        Uint16Array: Uint16Array,
        Int32Array: Int32Array,
        Uint32Array: Uint32Array,
        Float32Array: Float32Array,
        Float64Array: Float64Array
    };
    function Pa(A) {
        Yr.call(this, A)
    }
    Pa.prototype = Object.assign(Object.create(Yr.prototype), {
        constructor: Pa,
        load: function(A, e, t, i) {
            var o = this
              , n = "" === this.path ? La.extractUrlBase(A) : this.path;
            this.resourcePath = this.resourcePath || n;
            var r = new Jr(o.manager);
            r.setPath(this.path),
            r.load(A, (function(t) {
                var n = null;
                try {
                    n = JSON.parse(t)
                } catch (e) {
                    return void 0 !== i && i(e),
                    void console.error("THREE:ObjectLoader: Can't parse " + A + ".", e.message)
                }
                var r = n.metadata;
                void 0 !== r && void 0 !== r.type && "geometry" !== r.type.toLowerCase() ? o.parse(n, e) : console.error("THREE.ObjectLoader: Can't load " + A)
            }
            ), t, i)
        },
        parse: function(A, e) {
            var t = this.parseShape(A.shapes)
              , i = this.parseGeometries(A.geometries, t)
              , o = this.parseImages(A.images, (function() {
                void 0 !== e && e(a)
            }
            ))
              , n = this.parseTextures(A.textures, o)
              , r = this.parseMaterials(A.materials, n)
              , a = this.parseObject(A.object, i, r);
            return A.animations && (a.animations = this.parseAnimations(A.animations)),
            void 0 !== A.images && 0 !== A.images.length || void 0 !== e && e(a),
            a
        },
        parseShape: function(A) {
            var e = {};
            if (void 0 !== A)
                for (var t = 0, i = A.length; i > t; t++) {
                    var o = (new Ba).fromJSON(A[t]);
                    e[o.uuid] = o
                }
            return e
        },
        parseGeometries: function(A, e) {
            var t = {};
            if (void 0 !== A)
                for (var i = new Va, o = 0, n = A.length; n > o; o++) {
                    var r, a = A[o];
                    switch (a.type) {
                    case "PlaneGeometry":
                    case "PlaneBufferGeometry":
                        r = new fr[a.type](a.width,a.height,a.widthSegments,a.heightSegments);
                        break;
                    case "BoxGeometry":
                    case "BoxBufferGeometry":
                    case "CubeGeometry":
                        r = new fr[a.type](a.width,a.height,a.depth,a.widthSegments,a.heightSegments,a.depthSegments);
                        break;
                    case "CircleGeometry":
                    case "CircleBufferGeometry":
                        r = new fr[a.type](a.radius,a.segments,a.thetaStart,a.thetaLength);
                        break;
                    case "CylinderGeometry":
                    case "CylinderBufferGeometry":
                        r = new fr[a.type](a.radiusTop,a.radiusBottom,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);
                        break;
                    case "ConeGeometry":
                    case "ConeBufferGeometry":
                        r = new fr[a.type](a.radius,a.height,a.radialSegments,a.heightSegments,a.openEnded,a.thetaStart,a.thetaLength);
                        break;
                    case "SphereGeometry":
                    case "SphereBufferGeometry":
                        r = new fr[a.type](a.radius,a.widthSegments,a.heightSegments,a.phiStart,a.phiLength,a.thetaStart,a.thetaLength);
                        break;
                    case "DodecahedronGeometry":
                    case "DodecahedronBufferGeometry":
                    case "IcosahedronGeometry":
                    case "IcosahedronBufferGeometry":
                    case "OctahedronGeometry":
                    case "OctahedronBufferGeometry":
                    case "TetrahedronGeometry":
                    case "TetrahedronBufferGeometry":
                        r = new fr[a.type](a.radius,a.detail);
                        break;
                    case "RingGeometry":
                    case "RingBufferGeometry":
                        r = new fr[a.type](a.innerRadius,a.outerRadius,a.thetaSegments,a.phiSegments,a.thetaStart,a.thetaLength);
                        break;
                    case "TorusGeometry":
                    case "TorusBufferGeometry":
                        r = new fr[a.type](a.radius,a.tube,a.radialSegments,a.tubularSegments,a.arc);
                        break;
                    case "TorusKnotGeometry":
                    case "TorusKnotBufferGeometry":
                        r = new fr[a.type](a.radius,a.tube,a.tubularSegments,a.radialSegments,a.p,a.q);
                        break;
                    case "TubeGeometry":
                    case "TubeBufferGeometry":
                        r = new fr[a.type]((new va[a.path.type]).fromJSON(a.path),a.tubularSegments,a.radius,a.radialSegments,a.closed);
                        break;
                    case "LatheGeometry":
                    case "LatheBufferGeometry":
                        r = new fr[a.type](a.points,a.segments,a.phiStart,a.phiLength);
                        break;
                    case "PolyhedronGeometry":
                    case "PolyhedronBufferGeometry":
                        r = new fr[a.type](a.vertices,a.indices,a.radius,a.details);
                        break;
                    case "ShapeGeometry":
                    case "ShapeBufferGeometry":
                        for (var s = [], l = 0, c = a.shapes.length; c > l; l++) {
                            s.push(e[a.shapes[l]])
                        }
                        r = new fr[a.type](s,a.curveSegments);
                        break;
                    case "ExtrudeGeometry":
                    case "ExtrudeBufferGeometry":
                        for (s = [],
                        l = 0,
                        c = a.shapes.length; c > l; l++) {
                            s.push(e[a.shapes[l]])
                        }
                        var h = a.options.extrudePath;
                        void 0 !== h && (a.options.extrudePath = (new va[h.type]).fromJSON(h)),
                        r = new fr[a.type](s,a.options);
                        break;
                    case "BufferGeometry":
                    case "InstancedBufferGeometry":
                        r = i.parse(a);
                        break;
                    case "Geometry":
                        console.error('THREE.ObjectLoader: Loading "Geometry" is not supported anymore.');
                        break;
                    default:
                        console.warn('THREE.ObjectLoader: Unsupported geometry type "' + a.type + '"');
                        continue
                    }
                    r.uuid = a.uuid,
                    void 0 !== a.name && (r.name = a.name),
                    !0 === r.isBufferGeometry && void 0 !== a.userData && (r.userData = a.userData),
                    t[a.uuid] = r
                }
            return t
        },
        parseMaterials: function(A, e) {
            var t = {}
              , i = {};
            if (void 0 !== A) {
                var o = new Da;
                o.setTextures(e);
                for (var n = 0, r = A.length; r > n; n++) {
                    var a = A[n];
                    if ("MultiMaterial" === a.type) {
                        for (var s = [], l = 0; a.materials.length > l; l++) {
                            var c = a.materials[l];
                            void 0 === t[c.uuid] && (t[c.uuid] = o.parse(c)),
                            s.push(t[c.uuid])
                        }
                        i[a.uuid] = s
                    } else
                        void 0 === t[a.uuid] && (t[a.uuid] = o.parse(a)),
                        i[a.uuid] = t[a.uuid]
                }
            }
            return i
        },
        parseAnimations: function(A) {
            for (var e = [], t = 0; A.length > t; t++) {
                var i = A[t]
                  , o = Gr.parse(i);
                void 0 !== i.uuid && (o.uuid = i.uuid),
                e.push(o)
            }
            return e
        },
        parseImages: function(A, e) {
            var t = this
              , i = {};
            function o(A) {
                return t.manager.itemStart(A),
                n.load(A, (function() {
                    t.manager.itemEnd(A)
                }
                ), void 0, (function() {
                    t.manager.itemError(A),
                    t.manager.itemEnd(A)
                }
                ))
            }
            if (void 0 !== A && A.length > 0) {
                var n = new _r(new jr(e));
                n.setCrossOrigin(this.crossOrigin);
                for (var r = 0, a = A.length; a > r; r++) {
                    var s = A[r]
                      , l = s.url;
                    if (Array.isArray(l)) {
                        i[s.uuid] = [];
                        for (var c = 0, h = l.length; h > c; c++) {
                            var d = l[c]
                              , p = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(d) ? d : t.resourcePath + d;
                            i[s.uuid].push(o(p))
                        }
                    } else {
                        p = /^(\/\/)|([a-z]+:(\/\/)?)/i.test(s.url) ? s.url : t.resourcePath + s.url;
                        i[s.uuid] = o(p)
                    }
                }
            }
            return i
        },
        parseTextures: function(A, e) {
            function t(A, e) {
                return "number" == typeof A ? A : (console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.", A),
                e[A])
            }
            var i = {};
            if (void 0 !== A)
                for (var o = 0, n = A.length; n > o; o++) {
                    var r, a = A[o];
                    void 0 === a.image && console.warn('THREE.ObjectLoader: No "image" specified for', a.uuid),
                    void 0 === e[a.image] && console.warn("THREE.ObjectLoader: Undefined image", a.image),
                    (r = Array.isArray(e[a.image]) ? new ut(e[a.image]) : new d(e[a.image])).needsUpdate = !0,
                    r.uuid = a.uuid,
                    void 0 !== a.name && (r.name = a.name),
                    void 0 !== a.mapping && (r.mapping = t(a.mapping, ja)),
                    void 0 !== a.offset && r.offset.fromArray(a.offset),
                    void 0 !== a.repeat && r.repeat.fromArray(a.repeat),
                    void 0 !== a.center && r.center.fromArray(a.center),
                    void 0 !== a.rotation && (r.rotation = a.rotation),
                    void 0 !== a.wrap && (r.wrapS = t(a.wrap[0], Ha),
                    r.wrapT = t(a.wrap[1], Ha)),
                    void 0 !== a.format && (r.format = a.format),
                    void 0 !== a.type && (r.type = a.type),
                    void 0 !== a.encoding && (r.encoding = a.encoding),
                    void 0 !== a.minFilter && (r.minFilter = t(a.minFilter, Ya)),
                    void 0 !== a.magFilter && (r.magFilter = t(a.magFilter, Ya)),
                    void 0 !== a.anisotropy && (r.anisotropy = a.anisotropy),
                    void 0 !== a.flipY && (r.flipY = a.flipY),
                    void 0 !== a.premultiplyAlpha && (r.premultiplyAlpha = a.premultiplyAlpha),
                    void 0 !== a.unpackAlignment && (r.unpackAlignment = a.unpackAlignment),
                    i[a.uuid] = r
                }
            return i
        },
        parseObject: function(A, e, t) {
            var i;
            function o(A) {
                return void 0 === e[A] && console.warn("THREE.ObjectLoader: Undefined geometry", A),
                e[A]
            }
            function n(A) {
                if (void 0 !== A) {
                    if (Array.isArray(A)) {
                        for (var e = [], i = 0, o = A.length; o > i; i++) {
                            var n = A[i];
                            void 0 === t[n] && console.warn("THREE.ObjectLoader: Undefined material", n),
                            e.push(t[n])
                        }
                        return e
                    }
                    return void 0 === t[A] && console.warn("THREE.ObjectLoader: Undefined material", A),
                    t[A]
                }
            }
            switch (A.type) {
            case "Scene":
                i = new Y,
                void 0 !== A.background && Number.isInteger(A.background) && (i.background = new LA(A.background)),
                void 0 !== A.fog && ("Fog" === A.fog.type ? i.fog = new eo(A.fog.color,A.fog.near,A.fog.far) : "FogExp2" === A.fog.type && (i.fog = new Ao(A.fog.color,A.fog.density)));
                break;
            case "PerspectiveCamera":
                i = new je(A.fov,A.aspect,A.near,A.far),
                void 0 !== A.focus && (i.focus = A.focus),
                void 0 !== A.zoom && (i.zoom = A.zoom),
                void 0 !== A.filmGauge && (i.filmGauge = A.filmGauge),
                void 0 !== A.filmOffset && (i.filmOffset = A.filmOffset),
                void 0 !== A.view && (i.view = Object.assign({}, A.view));
                break;
            case "OrthographicCamera":
                i = new Ka(A.left,A.right,A.top,A.bottom,A.near,A.far),
                void 0 !== A.zoom && (i.zoom = A.zoom),
                void 0 !== A.view && (i.view = Object.assign({}, A.view));
                break;
            case "AmbientLight":
                i = new Ta(A.color,A.intensity);
                break;
            case "DirectionalLight":
                i = new Ra(A.color,A.intensity);
                break;
            case "PointLight":
                i = new Fa(A.color,A.intensity,A.distance,A.decay);
                break;
            case "RectAreaLight":
                i = new ka(A.color,A.intensity,A.width,A.height);
                break;
            case "SpotLight":
                i = new ba(A.color,A.intensity,A.distance,A.angle,A.penumbra,A.decay);
                break;
            case "HemisphereLight":
                i = new Sa(A.color,A.groundColor,A.intensity);
                break;
            case "SkinnedMesh":
                console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");
            case "Mesh":
                i = new Ue(r = o(A.geometry),a = n(A.material));
                break;
            case "InstancedMesh":
                var r = o(A.geometry)
                  , a = n(A.material)
                  , s = A.instanceMatrix;
                (i = new To(r,a,A.count)).instanceMatrix = new YA(new Float32Array(s.array),16);
                break;
            case "LOD":
                i = new xo;
                break;
            case "Line":
                i = new Go(o(A.geometry),n(A.material),A.mode);
                break;
            case "LineLoop":
                i = new Ho(o(A.geometry),n(A.material));
                break;
            case "LineSegments":
                i = new jo(o(A.geometry),n(A.material));
                break;
            case "PointCloud":
            case "Points":
                i = new Xo(o(A.geometry),n(A.material));
                break;
            case "Sprite":
                i = new vo(n(A.material));
                break;
            case "Group":
                i = new Xi;
                break;
            default:
                i = new H
            }
            if (i.uuid = A.uuid,
            void 0 !== A.name && (i.name = A.name),
            void 0 !== A.matrix ? (i.matrix.fromArray(A.matrix),
            void 0 !== A.matrixAutoUpdate && (i.matrixAutoUpdate = A.matrixAutoUpdate),
            i.matrixAutoUpdate && i.matrix.decompose(i.position, i.quaternion, i.scale)) : (void 0 !== A.position && i.position.fromArray(A.position),
            void 0 !== A.rotation && i.rotation.fromArray(A.rotation),
            void 0 !== A.quaternion && i.quaternion.fromArray(A.quaternion),
            void 0 !== A.scale && i.scale.fromArray(A.scale)),
            void 0 !== A.castShadow && (i.castShadow = A.castShadow),
            void 0 !== A.receiveShadow && (i.receiveShadow = A.receiveShadow),
            A.shadow && (void 0 !== A.shadow.bias && (i.shadow.bias = A.shadow.bias),
            void 0 !== A.shadow.radius && (i.shadow.radius = A.shadow.radius),
            void 0 !== A.shadow.mapSize && i.shadow.mapSize.fromArray(A.shadow.mapSize),
            void 0 !== A.shadow.camera && (i.shadow.camera = this.parseObject(A.shadow.camera))),
            void 0 !== A.visible && (i.visible = A.visible),
            void 0 !== A.frustumCulled && (i.frustumCulled = A.frustumCulled),
            void 0 !== A.renderOrder && (i.renderOrder = A.renderOrder),
            void 0 !== A.userData && (i.userData = A.userData),
            void 0 !== A.layers && (i.layers.mask = A.layers),
            void 0 !== A.children)
                for (var l = A.children, c = 0; l.length > c; c++)
                    i.add(this.parseObject(l[c], e, t));
            if ("LOD" === A.type) {
                void 0 !== A.autoUpdate && (i.autoUpdate = A.autoUpdate);
                for (var h = A.levels, d = 0; h.length > d; d++) {
                    var p = h[d]
                      , g = i.getObjectByProperty("uuid", p.object);
                    void 0 !== g && i.addLevel(g, p.distance)
                }
            }
            return i
        }
    });
    var qa, ja = {
        UVMapping: 300,
        CubeReflectionMapping: 301,
        CubeRefractionMapping: 302,
        EquirectangularReflectionMapping: 303,
        EquirectangularRefractionMapping: 304,
        SphericalReflectionMapping: 305,
        CubeUVReflectionMapping: 306,
        CubeUVRefractionMapping: 307
    }, Ha = {
        RepeatWrapping: 1e3,
        ClampToEdgeWrapping: 1001,
        MirroredRepeatWrapping: 1002
    }, Ya = {
        NearestFilter: 1003,
        NearestMipmapNearestFilter: 1004,
        NearestMipmapLinearFilter: 1005,
        LinearFilter: 1006,
        LinearMipmapNearestFilter: 1007,
        LinearMipmapLinearFilter: 1008
    };
    function Wa(A) {
        "undefined" == typeof createImageBitmap && console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),
        "undefined" == typeof fetch && console.warn("THREE.ImageBitmapLoader: fetch() not supported."),
        Yr.call(this, A),
        this.options = void 0
    }
    function Ja() {
        this.type = "ShapePath",
        this.color = new LA,
        this.subPaths = [],
        this.currentPath = null
    }
    function za(A) {
        this.type = "Font",
        this.data = A
    }
    function Za(A, e, t, i, o) {
        var n = o.glyphs[A] || o.glyphs["?"];
        if (n) {
            var r, a, s, l, c, h, d, p, g = new Ja;
            if (n.o)
                for (var u = n._cachedOutline || (n._cachedOutline = n.o.split(" ")), f = 0, m = u.length; m > f; ) {
                    switch (u[f++]) {
                    case "m":
                        r = u[f++] * e + t,
                        a = u[f++] * e + i,
                        g.moveTo(r, a);
                        break;
                    case "l":
                        r = u[f++] * e + t,
                        a = u[f++] * e + i,
                        g.lineTo(r, a);
                        break;
                    case "q":
                        s = u[f++] * e + t,
                        l = u[f++] * e + i,
                        c = u[f++] * e + t,
                        h = u[f++] * e + i,
                        g.quadraticCurveTo(c, h, s, l);
                        break;
                    case "b":
                        s = u[f++] * e + t,
                        l = u[f++] * e + i,
                        c = u[f++] * e + t,
                        h = u[f++] * e + i,
                        d = u[f++] * e + t,
                        p = u[f++] * e + i,
                        g.bezierCurveTo(c, h, d, p, s, l)
                    }
                }
            return {
                offsetX: n.ha * e,
                path: g
            }
        }
        console.error('THREE.Font: character "' + A + '" does not exists in font family ' + o.familyName + ".")
    }
    function Xa(A) {
        Yr.call(this, A)
    }
    Wa.prototype = Object.assign(Object.create(Yr.prototype), {
        constructor: Wa,
        setOptions: function(A) {
            return this.options = A,
            this
        },
        load: function(A, e, t, i) {
            void 0 === A && (A = ""),
            void 0 !== this.path && (A = this.path + A),
            A = this.manager.resolveURL(A);
            var o = this
              , n = qr.get(A);
            if (void 0 !== n)
                return o.manager.itemStart(A),
                setTimeout((function() {
                    e && e(n),
                    o.manager.itemEnd(A)
                }
                ), 0),
                n;
            fetch(A).then((function(A) {
                return A.blob()
            }
            )).then((function(A) {
                return void 0 === o.options ? createImageBitmap(A) : createImageBitmap(A, o.options)
            }
            )).then((function(t) {
                qr.add(A, t),
                e && e(t),
                o.manager.itemEnd(A)
            }
            )).catch((function(e) {
                i && i(e),
                o.manager.itemError(A),
                o.manager.itemEnd(A)
            }
            )),
            o.manager.itemStart(A)
        }
    }),
    Object.assign(Ja.prototype, {
        moveTo: function(A, e) {
            return this.currentPath = new Ea,
            this.subPaths.push(this.currentPath),
            this.currentPath.moveTo(A, e),
            this
        },
        lineTo: function(A, e) {
            return this.currentPath.lineTo(A, e),
            this
        },
        quadraticCurveTo: function(A, e, t, i) {
            return this.currentPath.quadraticCurveTo(A, e, t, i),
            this
        },
        bezierCurveTo: function(A, e, t, i, o, n) {
            return this.currentPath.bezierCurveTo(A, e, t, i, o, n),
            this
        },
        splineThru: function(A) {
            return this.currentPath.splineThru(A),
            this
        },
        toShapes: function(A, e) {
            function t(A) {
                for (var e = [], t = 0, i = A.length; i > t; t++) {
                    var o = A[t]
                      , n = new Ba;
                    n.curves = o.curves,
                    e.push(n)
                }
                return e
            }
            function i(A, e) {
                for (var t = e.length, i = !1, o = t - 1, n = 0; t > n; o = n++) {
                    var r = e[o]
                      , a = e[n]
                      , s = a.x - r.x
                      , l = a.y - r.y;
                    if (Math.abs(l) > Number.EPSILON) {
                        if (0 > l && (r = e[n],
                        s = -s,
                        a = e[o],
                        l = -l),
                        r.y > A.y || A.y > a.y)
                            continue;
                        if (A.y === r.y) {
                            if (A.x === r.x)
                                return !0
                        } else {
                            var c = l * (A.x - r.x) - s * (A.y - r.y);
                            if (0 === c)
                                return !0;
                            if (0 > c)
                                continue;
                            i = !i
                        }
                    } else {
                        if (A.y !== r.y)
                            continue;
                        if (A.x >= a.x && r.x >= A.x || A.x >= r.x && a.x >= A.x)
                            return !0
                    }
                }
                return i
            }
            var o = Hn.isClockWise
              , n = this.subPaths;
            if (0 === n.length)
                return [];
            if (!0 === e)
                return t(n);
            var r, a, s, l = [];
            if (1 === n.length)
                return a = n[0],
                (s = new Ba).curves = a.curves,
                l.push(s),
                l;
            var c = !o(n[0].getPoints());
            c = A ? !c : c;
            var h, d, p = [], g = [], u = [], f = 0;
            g[f] = void 0,
            u[f] = [];
            for (var m = 0, C = n.length; C > m; m++)
                r = o(h = (a = n[m]).getPoints()),
                (r = A ? !r : r) ? (!c && g[f] && f++,
                g[f] = {
                    s: new Ba,
                    p: h
                },
                g[f].s.curves = a.curves,
                c && f++,
                u[f] = []) : u[f].push({
                    h: a,
                    p: h[0]
                });
            if (!g[0])
                return t(n);
            if (g.length > 1) {
                for (var y = !1, v = [], I = 0, E = g.length; E > I; I++)
                    p[I] = [];
                for (I = 0,
                E = g.length; E > I; I++)
                    for (var B = u[I], x = 0; B.length > x; x++) {
                        for (var S = B[x], w = !0, M = 0; g.length > M; M++)
                            i(S.p, g[M].p) && (I !== M && v.push({
                                froms: I,
                                tos: M,
                                hole: x
                            }),
                            w ? (w = !1,
                            p[M].push(S)) : y = !0);
                        w && p[I].push(S)
                    }
                v.length > 0 && (y || (u = p))
            }
            m = 0;
            for (var b = g.length; b > m; m++) {
                l.push(s = g[m].s);
                for (var U = 0, F = (d = u[m]).length; F > U; U++)
                    s.holes.push(d[U].h)
            }
            return l
        }
    }),
    Object.assign(za.prototype, {
        isFont: !0,
        generateShapes: function(A, e) {
            void 0 === e && (e = 100);
            for (var t = [], i = function(A, e, t) {
                for (var i = Array.from ? Array.from(A) : String(A).split(""), o = e / t.resolution, n = (t.boundingBox.yMax - t.boundingBox.yMin + t.underlineThickness) * o, r = [], a = 0, s = 0, l = 0; i.length > l; l++) {
                    var c = i[l];
                    if ("\n" === c)
                        a = 0,
                        s -= n;
                    else {
                        var h = Za(c, o, a, s, t);
                        a += h.offsetX,
                        r.push(h.path)
                    }
                }
                return r
            }(A, e, this.data), o = 0, n = i.length; n > o; o++)
                Array.prototype.push.apply(t, i[o].toShapes());
            return t
        }
    }),
    Xa.prototype = Object.assign(Object.create(Yr.prototype), {
        constructor: Xa,
        load: function(A, e, t, i) {
            var o = this
              , n = new Jr(this.manager);
            n.setPath(this.path),
            n.load(A, (function(A) {
                var t;
                try {
                    t = JSON.parse(A)
                } catch (e) {
                    console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),
                    t = JSON.parse(A.substring(65, A.length - 2))
                }
                var i = o.parse(t);
                e && e(i)
            }
            ), t, i)
        },
        parse: function(A) {
            return new za(A)
        }
    });
    var _a = {
        getContext: function() {
            return void 0 === qa && (qa = new (window.AudioContext || window.webkitAudioContext)),
            qa
        },
        setContext: function(A) {
            qa = A
        }
    };
    function $a(A) {
        Yr.call(this, A)
    }
    function As() {
        this.coefficients = [];
        for (var A = 0; 9 > A; A++)
            this.coefficients.push(new y)
    }
    function es(A, e) {
        xa.call(this, void 0, e),
        this.sh = void 0 !== A ? A : new As
    }
    function ts(A, e, t) {
        es.call(this, void 0, t);
        var i = (new LA).set(A)
          , o = (new LA).set(e)
          , n = new y(i.r,i.g,i.b)
          , r = new y(o.r,o.g,o.b)
          , a = Math.sqrt(Math.PI)
          , s = a * Math.sqrt(.75);
        this.sh.coefficients[0].copy(n).add(r).multiplyScalar(a),
        this.sh.coefficients[1].copy(n).sub(r).multiplyScalar(s)
    }
    function is(A, e) {
        es.call(this, void 0, e);
        var t = (new LA).set(A);
        this.sh.coefficients[0].set(t.r, t.g, t.b).multiplyScalar(2 * Math.sqrt(Math.PI))
    }
    $a.prototype = Object.assign(Object.create(Yr.prototype), {
        constructor: $a,
        load: function(A, e, t, i) {
            var o = new Jr(this.manager);
            o.setResponseType("arraybuffer"),
            o.setPath(this.path),
            o.load(A, (function(A) {
                var t = A.slice(0);
                _a.getContext().decodeAudioData(t, (function(A) {
                    e(A)
                }
                ))
            }
            ), t, i)
        }
    }),
    Object.assign(As.prototype, {
        isSphericalHarmonics3: !0,
        set: function(A) {
            for (var e = 0; 9 > e; e++)
                this.coefficients[e].copy(A[e]);
            return this
        },
        zero: function() {
            for (var A = 0; 9 > A; A++)
                this.coefficients[A].set(0, 0, 0);
            return this
        },
        getAt: function(A, e) {
            var t = A.x
              , i = A.y
              , o = A.z
              , n = this.coefficients;
            return e.copy(n[0]).multiplyScalar(.282095),
            e.addScaledVector(n[1], .488603 * i),
            e.addScaledVector(n[2], .488603 * o),
            e.addScaledVector(n[3], .488603 * t),
            e.addScaledVector(n[4], t * i * 1.092548),
            e.addScaledVector(n[5], i * o * 1.092548),
            e.addScaledVector(n[6], .315392 * (3 * o * o - 1)),
            e.addScaledVector(n[7], t * o * 1.092548),
            e.addScaledVector(n[8], .546274 * (t * t - i * i)),
            e
        },
        getIrradianceAt: function(A, e) {
            var t = A.x
              , i = A.y
              , o = A.z
              , n = this.coefficients;
            return e.copy(n[0]).multiplyScalar(.886227),
            e.addScaledVector(n[1], 1.023328 * i),
            e.addScaledVector(n[2], 1.023328 * o),
            e.addScaledVector(n[3], 1.023328 * t),
            e.addScaledVector(n[4], .858086 * t * i),
            e.addScaledVector(n[5], .858086 * i * o),
            e.addScaledVector(n[6], .743125 * o * o - .247708),
            e.addScaledVector(n[7], .858086 * t * o),
            e.addScaledVector(n[8], .429043 * (t * t - i * i)),
            e
        },
        add: function(A) {
            for (var e = 0; 9 > e; e++)
                this.coefficients[e].add(A.coefficients[e]);
            return this
        },
        addScaledSH: function(A, e) {
            for (var t = 0; 9 > t; t++)
                this.coefficients[t].addScaledVector(A.coefficients[t], e);
            return this
        },
        scale: function(A) {
            for (var e = 0; 9 > e; e++)
                this.coefficients[e].multiplyScalar(A);
            return this
        },
        lerp: function(A, e) {
            for (var t = 0; 9 > t; t++)
                this.coefficients[t].lerp(A.coefficients[t], e);
            return this
        },
        equals: function(A) {
            for (var e = 0; 9 > e; e++)
                if (!this.coefficients[e].equals(A.coefficients[e]))
                    return !1;
            return !0
        },
        copy: function(A) {
            return this.set(A.coefficients)
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        fromArray: function(A, e) {
            void 0 === e && (e = 0);
            for (var t = this.coefficients, i = 0; 9 > i; i++)
                t[i].fromArray(A, e + 3 * i);
            return this
        },
        toArray: function(A, e) {
            void 0 === A && (A = []),
            void 0 === e && (e = 0);
            for (var t = this.coefficients, i = 0; 9 > i; i++)
                t[i].toArray(A, e + 3 * i);
            return A
        }
    }),
    Object.assign(As, {
        getBasisAt: function(A, e) {
            var t = A.x
              , i = A.y
              , o = A.z;
            e[0] = .282095,
            e[1] = .488603 * i,
            e[2] = .488603 * o,
            e[3] = .488603 * t,
            e[4] = 1.092548 * t * i,
            e[5] = 1.092548 * i * o,
            e[6] = .315392 * (3 * o * o - 1),
            e[7] = 1.092548 * t * o,
            e[8] = .546274 * (t * t - i * i)
        }
    }),
    es.prototype = Object.assign(Object.create(xa.prototype), {
        constructor: es,
        isLightProbe: !0,
        copy: function(A) {
            return xa.prototype.copy.call(this, A),
            this.sh.copy(A.sh),
            this.intensity = A.intensity,
            this
        },
        toJSON: function(A) {
            return xa.prototype.toJSON.call(this, A)
        }
    }),
    ts.prototype = Object.assign(Object.create(es.prototype), {
        constructor: ts,
        isHemisphereLightProbe: !0,
        copy: function(A) {
            return es.prototype.copy.call(this, A),
            this
        },
        toJSON: function(A) {
            return es.prototype.toJSON.call(this, A)
        }
    }),
    is.prototype = Object.assign(Object.create(es.prototype), {
        constructor: is,
        isAmbientLightProbe: !0,
        copy: function(A) {
            return es.prototype.copy.call(this, A),
            this
        },
        toJSON: function(A) {
            return es.prototype.toJSON.call(this, A)
        }
    });
    var os = new M
      , ns = new M;
    function rs() {
        this.type = "StereoCamera",
        this.aspect = 1,
        this.eyeSep = .064,
        this.cameraL = new je,
        this.cameraL.layers.enable(1),
        this.cameraL.matrixAutoUpdate = !1,
        this.cameraR = new je,
        this.cameraR.layers.enable(2),
        this.cameraR.matrixAutoUpdate = !1,
        this._cache = {
            focus: null,
            fov: null,
            aspect: null,
            near: null,
            far: null,
            zoom: null,
            eyeSep: null
        }
    }
    function as(A) {
        this.autoStart = void 0 === A || A,
        this.startTime = 0,
        this.oldTime = 0,
        this.elapsedTime = 0,
        this.running = !1
    }
    Object.assign(rs.prototype, {
        update: function(A) {
            var e = this._cache;
            if (e.focus !== A.focus || e.fov !== A.fov || e.aspect !== A.aspect * this.aspect || e.near !== A.near || e.far !== A.far || e.zoom !== A.zoom || e.eyeSep !== this.eyeSep) {
                e.focus = A.focus,
                e.fov = A.fov,
                e.aspect = A.aspect * this.aspect,
                e.near = A.near,
                e.far = A.far,
                e.zoom = A.zoom,
                e.eyeSep = this.eyeSep;
                var t, i, o = A.projectionMatrix.clone(), n = e.eyeSep / 2, r = n * e.near / e.focus, s = e.near * Math.tan(a.DEG2RAD * e.fov * .5) / e.zoom;
                ns.elements[12] = -n,
                os.elements[12] = n,
                o.elements[0] = 2 * e.near / ((i = s * e.aspect + r) - (t = -s * e.aspect + r)),
                o.elements[8] = (i + t) / (i - t),
                this.cameraL.projectionMatrix.copy(o),
                o.elements[0] = 2 * e.near / ((i = s * e.aspect - r) - (t = -s * e.aspect - r)),
                o.elements[8] = (i + t) / (i - t),
                this.cameraR.projectionMatrix.copy(o)
            }
            this.cameraL.matrixWorld.copy(A.matrixWorld).multiply(ns),
            this.cameraR.matrixWorld.copy(A.matrixWorld).multiply(os)
        }
    }),
    Object.assign(as.prototype, {
        start: function() {
            this.startTime = ("undefined" == typeof performance ? Date : performance).now(),
            this.oldTime = this.startTime,
            this.elapsedTime = 0,
            this.running = !0
        },
        stop: function() {
            this.getElapsedTime(),
            this.running = !1,
            this.autoStart = !1
        },
        getElapsedTime: function() {
            return this.getDelta(),
            this.elapsedTime
        },
        getDelta: function() {
            var A = 0;
            if (this.autoStart && !this.running)
                return this.start(),
                0;
            if (this.running) {
                var e = ("undefined" == typeof performance ? Date : performance).now();
                A = (e - this.oldTime) / 1e3,
                this.oldTime = e,
                this.elapsedTime += A
            }
            return A
        }
    });
    var ss = new y
      , ls = new f
      , cs = new y
      , hs = new y;
    function ds() {
        H.call(this),
        this.type = "AudioListener",
        this.context = _a.getContext(),
        this.gain = this.context.createGain(),
        this.gain.connect(this.context.destination),
        this.filter = null,
        this.timeDelta = 0,
        this._clock = new as
    }
    function ps(A) {
        H.call(this),
        this.type = "Audio",
        this.listener = A,
        this.context = A.context,
        this.gain = this.context.createGain(),
        this.gain.connect(A.getInput()),
        this.autoplay = !1,
        this.buffer = null,
        this.detune = 0,
        this.loop = !1,
        this.loopStart = 0,
        this.loopEnd = 0,
        this.offset = 0,
        this.duration = void 0,
        this.playbackRate = 1,
        this.isPlaying = !1,
        this.hasPlaybackControl = !0,
        this.sourceType = "empty",
        this._startedAt = 0,
        this._pausedAt = 0,
        this.filters = []
    }
    ds.prototype = Object.assign(Object.create(H.prototype), {
        constructor: ds,
        getInput: function() {
            return this.gain
        },
        removeFilter: function() {
            return null !== this.filter && (this.gain.disconnect(this.filter),
            this.filter.disconnect(this.context.destination),
            this.gain.connect(this.context.destination),
            this.filter = null),
            this
        },
        getFilter: function() {
            return this.filter
        },
        setFilter: function(A) {
            return null !== this.filter ? (this.gain.disconnect(this.filter),
            this.filter.disconnect(this.context.destination)) : this.gain.disconnect(this.context.destination),
            this.filter = A,
            this.gain.connect(this.filter),
            this.filter.connect(this.context.destination),
            this
        },
        getMasterVolume: function() {
            return this.gain.gain.value
        },
        setMasterVolume: function(A) {
            return this.gain.gain.setTargetAtTime(A, this.context.currentTime, .01),
            this
        },
        updateMatrixWorld: function(A) {
            H.prototype.updateMatrixWorld.call(this, A);
            var e = this.context.listener
              , t = this.up;
            if (this.timeDelta = this._clock.getDelta(),
            this.matrixWorld.decompose(ss, ls, cs),
            hs.set(0, 0, -1).applyQuaternion(ls),
            e.positionX) {
                var i = this.context.currentTime + this.timeDelta;
                e.positionX.linearRampToValueAtTime(ss.x, i),
                e.positionY.linearRampToValueAtTime(ss.y, i),
                e.positionZ.linearRampToValueAtTime(ss.z, i),
                e.forwardX.linearRampToValueAtTime(hs.x, i),
                e.forwardY.linearRampToValueAtTime(hs.y, i),
                e.forwardZ.linearRampToValueAtTime(hs.z, i),
                e.upX.linearRampToValueAtTime(t.x, i),
                e.upY.linearRampToValueAtTime(t.y, i),
                e.upZ.linearRampToValueAtTime(t.z, i)
            } else
                e.setPosition(ss.x, ss.y, ss.z),
                e.setOrientation(hs.x, hs.y, hs.z, t.x, t.y, t.z)
        }
    }),
    ps.prototype = Object.assign(Object.create(H.prototype), {
        constructor: ps,
        getOutput: function() {
            return this.gain
        },
        setNodeSource: function(A) {
            return this.hasPlaybackControl = !1,
            this.sourceType = "audioNode",
            this.source = A,
            this.connect(),
            this
        },
        setMediaElementSource: function(A) {
            return this.hasPlaybackControl = !1,
            this.sourceType = "mediaNode",
            this.source = this.context.createMediaElementSource(A),
            this.connect(),
            this
        },
        setMediaStreamSource: function(A) {
            return this.hasPlaybackControl = !1,
            this.sourceType = "mediaStreamNode",
            this.source = this.context.createMediaStreamSource(A),
            this.connect(),
            this
        },
        setBuffer: function(A) {
            return this.buffer = A,
            this.sourceType = "buffer",
            this.autoplay && this.play(),
            this
        },
        play: function(A) {
            if (void 0 === A && (A = 0),
            !0 !== this.isPlaying) {
                if (!1 !== this.hasPlaybackControl) {
                    this._startedAt = this.context.currentTime + A;
                    var e = this.context.createBufferSource();
                    return e.buffer = this.buffer,
                    e.loop = this.loop,
                    e.loopStart = this.loopStart,
                    e.loopEnd = this.loopEnd,
                    e.onended = this.onEnded.bind(this),
                    e.start(this._startedAt, this._pausedAt + this.offset, this.duration),
                    this.isPlaying = !0,
                    this.source = e,
                    this.setDetune(this.detune),
                    this.setPlaybackRate(this.playbackRate),
                    this.connect()
                }
                console.warn("THREE.Audio: this Audio has no playback control.")
            } else
                console.warn("THREE.Audio: Audio is already playing.")
        },
        pause: function() {
            if (!1 !== this.hasPlaybackControl)
                return !0 === this.isPlaying && (this._pausedAt += Math.max(this.context.currentTime - this._startedAt, 0) * this.playbackRate,
                this.source.stop(),
                this.source.onended = null,
                this.isPlaying = !1),
                this;
            console.warn("THREE.Audio: this Audio has no playback control.")
        },
        stop: function() {
            if (!1 !== this.hasPlaybackControl)
                return this._pausedAt = 0,
                this.source.stop(),
                this.source.onended = null,
                this.isPlaying = !1,
                this;
            console.warn("THREE.Audio: this Audio has no playback control.")
        },
        connect: function() {
            if (this.filters.length > 0) {
                this.source.connect(this.filters[0]);
                for (var A = 1, e = this.filters.length; e > A; A++)
                    this.filters[A - 1].connect(this.filters[A]);
                this.filters[this.filters.length - 1].connect(this.getOutput())
            } else
                this.source.connect(this.getOutput());
            return this
        },
        disconnect: function() {
            if (this.filters.length > 0) {
                this.source.disconnect(this.filters[0]);
                for (var A = 1, e = this.filters.length; e > A; A++)
                    this.filters[A - 1].disconnect(this.filters[A]);
                this.filters[this.filters.length - 1].disconnect(this.getOutput())
            } else
                this.source.disconnect(this.getOutput());
            return this
        },
        getFilters: function() {
            return this.filters
        },
        setFilters: function(A) {
            return A || (A = []),
            !0 === this.isPlaying ? (this.disconnect(),
            this.filters = A,
            this.connect()) : this.filters = A,
            this
        },
        setDetune: function(A) {
            if (this.detune = A,
            void 0 !== this.source.detune)
                return !0 === this.isPlaying && this.source.detune.setTargetAtTime(this.detune, this.context.currentTime, .01),
                this
        },
        getDetune: function() {
            return this.detune
        },
        getFilter: function() {
            return this.getFilters()[0]
        },
        setFilter: function(A) {
            return this.setFilters(A ? [A] : [])
        },
        setPlaybackRate: function(A) {
            if (!1 !== this.hasPlaybackControl)
                return this.playbackRate = A,
                !0 === this.isPlaying && this.source.playbackRate.setTargetAtTime(this.playbackRate, this.context.currentTime, .01),
                this;
            console.warn("THREE.Audio: this Audio has no playback control.")
        },
        getPlaybackRate: function() {
            return this.playbackRate
        },
        onEnded: function() {
            this.isPlaying = !1
        },
        getLoop: function() {
            return !1 === this.hasPlaybackControl ? (console.warn("THREE.Audio: this Audio has no playback control."),
            !1) : this.loop
        },
        setLoop: function(A) {
            if (!1 !== this.hasPlaybackControl)
                return this.loop = A,
                !0 === this.isPlaying && (this.source.loop = this.loop),
                this;
            console.warn("THREE.Audio: this Audio has no playback control.")
        },
        setLoopStart: function(A) {
            return this.loopStart = A,
            this
        },
        setLoopEnd: function(A) {
            return this.loopEnd = A,
            this
        },
        getVolume: function() {
            return this.gain.gain.value
        },
        setVolume: function(A) {
            return this.gain.gain.setTargetAtTime(A, this.context.currentTime, .01),
            this
        }
    });
    var gs = new y
      , us = new f
      , fs = new y
      , ms = new y;
    function Cs(A) {
        ps.call(this, A),
        this.panner = this.context.createPanner(),
        this.panner.panningModel = "HRTF",
        this.panner.connect(this.gain)
    }
    function ys(A, e) {
        this.analyser = A.context.createAnalyser(),
        this.analyser.fftSize = void 0 !== e ? e : 2048,
        this.data = new Uint8Array(this.analyser.frequencyBinCount),
        A.getOutput().connect(this.analyser)
    }
    function vs(A, e, t) {
        this.binding = A,
        this.valueSize = t;
        var i, o = Float64Array;
        switch (e) {
        case "quaternion":
            i = this._slerp;
            break;
        case "string":
        case "bool":
            o = Array,
            i = this._select;
            break;
        default:
            i = this._lerp
        }
        this.buffer = new o(4 * t),
        this._mixBufferRegion = i,
        this.cumulativeWeight = 0,
        this.useCount = 0,
        this.referenceCount = 0
    }
    Cs.prototype = Object.assign(Object.create(ps.prototype), {
        constructor: Cs,
        getOutput: function() {
            return this.panner
        },
        getRefDistance: function() {
            return this.panner.refDistance
        },
        setRefDistance: function(A) {
            return this.panner.refDistance = A,
            this
        },
        getRolloffFactor: function() {
            return this.panner.rolloffFactor
        },
        setRolloffFactor: function(A) {
            return this.panner.rolloffFactor = A,
            this
        },
        getDistanceModel: function() {
            return this.panner.distanceModel
        },
        setDistanceModel: function(A) {
            return this.panner.distanceModel = A,
            this
        },
        getMaxDistance: function() {
            return this.panner.maxDistance
        },
        setMaxDistance: function(A) {
            return this.panner.maxDistance = A,
            this
        },
        setDirectionalCone: function(A, e, t) {
            return this.panner.coneInnerAngle = A,
            this.panner.coneOuterAngle = e,
            this.panner.coneOuterGain = t,
            this
        },
        updateMatrixWorld: function(A) {
            if (H.prototype.updateMatrixWorld.call(this, A),
            !0 !== this.hasPlaybackControl || !1 !== this.isPlaying) {
                this.matrixWorld.decompose(gs, us, fs),
                ms.set(0, 0, 1).applyQuaternion(us);
                var e = this.panner;
                if (e.positionX) {
                    var t = this.context.currentTime + this.listener.timeDelta;
                    e.positionX.linearRampToValueAtTime(gs.x, t),
                    e.positionY.linearRampToValueAtTime(gs.y, t),
                    e.positionZ.linearRampToValueAtTime(gs.z, t),
                    e.orientationX.linearRampToValueAtTime(ms.x, t),
                    e.orientationY.linearRampToValueAtTime(ms.y, t),
                    e.orientationZ.linearRampToValueAtTime(ms.z, t)
                } else
                    e.setPosition(gs.x, gs.y, gs.z),
                    e.setOrientation(ms.x, ms.y, ms.z)
            }
        }
    }),
    Object.assign(ys.prototype, {
        getFrequencyData: function() {
            return this.analyser.getByteFrequencyData(this.data),
            this.data
        },
        getAverageFrequency: function() {
            for (var A = 0, e = this.getFrequencyData(), t = 0; e.length > t; t++)
                A += e[t];
            return A / e.length
        }
    }),
    Object.assign(vs.prototype, {
        accumulate: function(A, e) {
            var t = this.buffer
              , i = this.valueSize
              , o = A * i + i
              , n = this.cumulativeWeight;
            if (0 === n) {
                for (var r = 0; r !== i; ++r)
                    t[o + r] = t[r];
                n = e
            } else {
                this._mixBufferRegion(t, o, 0, e / (n += e), i)
            }
            this.cumulativeWeight = n
        },
        apply: function(A) {
            var e = this.valueSize
              , t = this.buffer
              , i = A * e + e
              , o = this.cumulativeWeight
              , n = this.binding;
            (this.cumulativeWeight = 0,
            1 > o) && this._mixBufferRegion(t, i, 3 * e, 1 - o, e);
            for (var r = e, a = e + e; r !== a; ++r)
                if (t[r] !== t[r + e]) {
                    n.setValue(t, i);
                    break
                }
        },
        saveOriginalState: function() {
            var A = this.buffer
              , e = this.valueSize
              , t = 3 * e;
            this.binding.getValue(A, t);
            for (var i = e, o = t; i !== o; ++i)
                A[i] = A[t + i % e];
            this.cumulativeWeight = 0
        },
        restoreOriginalState: function() {
            this.binding.setValue(this.buffer, 3 * this.valueSize)
        },
        _select: function(A, e, t, i, o) {
            if (i >= .5)
                for (var n = 0; n !== o; ++n)
                    A[e + n] = A[t + n]
        },
        _slerp: function(A, e, t, i) {
            f.slerpFlat(A, e, A, e, A, t, i)
        },
        _lerp: function(A, e, t, i, o) {
            for (var n = 1 - i, r = 0; r !== o; ++r) {
                var a = e + r;
                A[a] = A[a] * n + A[t + r] * i
            }
        }
    });
    var Is = new RegExp("[\\[\\]\\.:\\/]","g")
      , Es = "[^" + "\\[\\]\\.:\\/".replace("\\.", "") + "]"
      , Bs = /((?:WC+[\/:])*)/.source.replace("WC", "[^\\[\\]\\.:\\/]")
      , xs = /(WCOD+)?/.source.replace("WCOD", Es)
      , Ss = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC", "[^\\[\\]\\.:\\/]")
      , ws = /\.(WC+)(?:\[(.+)\])?/.source.replace("WC", "[^\\[\\]\\.:\\/]")
      , Ms = new RegExp("^" + Bs + xs + Ss + ws + "$")
      , bs = ["material", "materials", "bones"];
    function Us(A, e, t) {
        var i = t || Fs.parseTrackName(e);
        this._targetGroup = A,
        this._bindings = A.subscribe_(e, i)
    }
    function Fs(A, e, t) {
        this.path = e,
        this.parsedPath = t || Fs.parseTrackName(e),
        this.node = Fs.findNode(A, this.parsedPath.nodeName) || A,
        this.rootNode = A
    }
    function Ks() {
        this.uuid = a.generateUUID(),
        this._objects = Array.prototype.slice.call(arguments),
        this.nCachedObjects_ = 0;
        var A = {};
        this._indicesByUUID = A;
        for (var e = 0, t = arguments.length; e !== t; ++e)
            A[arguments[e].uuid] = e;
        this._paths = [],
        this._parsedPaths = [],
        this._bindings = [],
        this._bindingsIndicesByPath = {};
        var i = this;
        this.stats = {
            objects: {
                get total() {
                    return i._objects.length
                },
                get inUse() {
                    return this.total - i.nCachedObjects_
                }
            },
            get bindingsPerObject() {
                return i._bindings.length
            }
        }
    }
    function Qs(A, e, t) {
        this._mixer = A,
        this._clip = e,
        this._localRoot = t || null;
        for (var i = e.tracks, o = i.length, n = new Array(o), r = {
            endingStart: 2400,
            endingEnd: 2400
        }, a = 0; a !== o; ++a) {
            var s = i[a].createInterpolant(null);
            n[a] = s,
            s.settings = r
        }
        this._interpolantSettings = r,
        this._interpolants = n,
        this._propertyBindings = new Array(o),
        this._cacheIndex = null,
        this._byClipCacheIndex = null,
        this._timeScaleInterpolant = null,
        this._weightInterpolant = null,
        this.loop = 2201,
        this._loopCount = -1,
        this._startTime = null,
        this.time = 0,
        this.timeScale = 1,
        this._effectiveTimeScale = 1,
        this.weight = 1,
        this._effectiveWeight = 1,
        this.repetitions = 1 / 0,
        this.paused = !1,
        this.enabled = !0,
        this.clampWhenFinished = !1,
        this.zeroSlopeAtStart = !0,
        this.zeroSlopeAtEnd = !0
    }
    function Rs(A) {
        this._root = A,
        this._initMemoryManager(),
        this._accuIndex = 0,
        this.time = 0,
        this.timeScale = 1
    }
    function Ts(A) {
        "string" == typeof A && (console.warn("THREE.Uniform: Type parameter is no longer needed."),
        A = arguments[1]),
        this.value = A
    }
    function ks(A, e, t) {
        to.call(this, A, e),
        this.meshPerAttribute = t || 1
    }
    function Ds(A, e, t, i) {
        this.ray = new CA(A,e),
        this.near = t || 0,
        this.far = i || 1 / 0,
        this.camera = null,
        this.layers = new K,
        this.params = {
            Mesh: {},
            Line: {
                threshold: 1
            },
            LOD: {},
            Points: {
                threshold: 1
            },
            Sprite: {}
        },
        Object.defineProperties(this.params, {
            PointCloud: {
                get: function() {
                    return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),
                    this.Points
                }
            }
        })
    }
    function Ls(A, e) {
        return A.distance - e.distance
    }
    function Ns(A, e, t, i) {
        if (A.layers.test(e.layers) && A.raycast(e, t),
        !0 === i)
            for (var o = A.children, n = 0, r = o.length; r > n; n++)
                Ns(o[n], e, t, !0)
    }
    function Os(A, e, t) {
        return this.radius = void 0 !== A ? A : 1,
        this.phi = void 0 !== e ? e : 0,
        this.theta = void 0 !== t ? t : 0,
        this
    }
    function Vs(A, e, t) {
        return this.radius = void 0 !== A ? A : 1,
        this.theta = void 0 !== e ? e : 0,
        this.y = void 0 !== t ? t : 0,
        this
    }
    Object.assign(Us.prototype, {
        getValue: function(A, e) {
            this.bind();
            var t = this._bindings[this._targetGroup.nCachedObjects_];
            void 0 !== t && t.getValue(A, e)
        },
        setValue: function(A, e) {
            for (var t = this._bindings, i = this._targetGroup.nCachedObjects_, o = t.length; i !== o; ++i)
                t[i].setValue(A, e)
        },
        bind: function() {
            for (var A = this._bindings, e = this._targetGroup.nCachedObjects_, t = A.length; e !== t; ++e)
                A[e].bind()
        },
        unbind: function() {
            for (var A = this._bindings, e = this._targetGroup.nCachedObjects_, t = A.length; e !== t; ++e)
                A[e].unbind()
        }
    }),
    Object.assign(Fs, {
        Composite: Us,
        create: function(A, e, t) {
            return A && A.isAnimationObjectGroup ? new Fs.Composite(A,e,t) : new Fs(A,e,t)
        },
        sanitizeNodeName: function(A) {
            return A.replace(/\s/g, "_").replace(Is, "")
        },
        parseTrackName: function(A) {
            var e = Ms.exec(A);
            if (!e)
                throw new Error("PropertyBinding: Cannot parse trackName: " + A);
            var t = {
                nodeName: e[2],
                objectName: e[3],
                objectIndex: e[4],
                propertyName: e[5],
                propertyIndex: e[6]
            }
              , i = t.nodeName && t.nodeName.lastIndexOf(".");
            if (void 0 !== i && -1 !== i) {
                var o = t.nodeName.substring(i + 1);
                -1 !== bs.indexOf(o) && (t.nodeName = t.nodeName.substring(0, i),
                t.objectName = o)
            }
            if (null === t.propertyName || 0 === t.propertyName.length)
                throw new Error("PropertyBinding: can not parse propertyName from trackName: " + A);
            return t
        },
        findNode: function(A, e) {
            if (!e || "" === e || "." === e || -1 === e || e === A.name || e === A.uuid)
                return A;
            if (A.skeleton) {
                var t = A.skeleton.getBoneByName(e);
                if (void 0 !== t)
                    return t
            }
            if (A.children) {
                var i = function(A) {
                    for (var t = 0; A.length > t; t++) {
                        var o = A[t];
                        if (o.name === e || o.uuid === e)
                            return o;
                        var n = i(o.children);
                        if (n)
                            return n
                    }
                    return null
                }
                  , o = i(A.children);
                if (o)
                    return o
            }
            return null
        }
    }),
    Object.assign(Fs.prototype, {
        _getValue_unavailable: function() {},
        _setValue_unavailable: function() {},
        BindingType: {
            Direct: 0,
            EntireArray: 1,
            ArrayElement: 2,
            HasFromToArray: 3
        },
        Versioning: {
            None: 0,
            NeedsUpdate: 1,
            MatrixWorldNeedsUpdate: 2
        },
        GetterByBindingType: [function(A, e) {
            A[e] = this.node[this.propertyName]
        }
        , function(A, e) {
            for (var t = this.resolvedProperty, i = 0, o = t.length; i !== o; ++i)
                A[e++] = t[i]
        }
        , function(A, e) {
            A[e] = this.resolvedProperty[this.propertyIndex]
        }
        , function(A, e) {
            this.resolvedProperty.toArray(A, e)
        }
        ],
        SetterByBindingTypeAndVersioning: [[function(A, e) {
            this.targetObject[this.propertyName] = A[e]
        }
        , function(A, e) {
            this.targetObject[this.propertyName] = A[e],
            this.targetObject.needsUpdate = !0
        }
        , function(A, e) {
            this.targetObject[this.propertyName] = A[e],
            this.targetObject.matrixWorldNeedsUpdate = !0
        }
        ], [function(A, e) {
            for (var t = this.resolvedProperty, i = 0, o = t.length; i !== o; ++i)
                t[i] = A[e++]
        }
        , function(A, e) {
            for (var t = this.resolvedProperty, i = 0, o = t.length; i !== o; ++i)
                t[i] = A[e++];
            this.targetObject.needsUpdate = !0
        }
        , function(A, e) {
            for (var t = this.resolvedProperty, i = 0, o = t.length; i !== o; ++i)
                t[i] = A[e++];
            this.targetObject.matrixWorldNeedsUpdate = !0
        }
        ], [function(A, e) {
            this.resolvedProperty[this.propertyIndex] = A[e]
        }
        , function(A, e) {
            this.resolvedProperty[this.propertyIndex] = A[e],
            this.targetObject.needsUpdate = !0
        }
        , function(A, e) {
            this.resolvedProperty[this.propertyIndex] = A[e],
            this.targetObject.matrixWorldNeedsUpdate = !0
        }
        ], [function(A, e) {
            this.resolvedProperty.fromArray(A, e)
        }
        , function(A, e) {
            this.resolvedProperty.fromArray(A, e),
            this.targetObject.needsUpdate = !0
        }
        , function(A, e) {
            this.resolvedProperty.fromArray(A, e),
            this.targetObject.matrixWorldNeedsUpdate = !0
        }
        ]],
        getValue: function(A, e) {
            this.bind(),
            this.getValue(A, e)
        },
        setValue: function(A, e) {
            this.bind(),
            this.setValue(A, e)
        },
        bind: function() {
            var A = this.node
              , e = this.parsedPath
              , t = e.objectName
              , i = e.propertyName
              , o = e.propertyIndex;
            if (A || (A = Fs.findNode(this.rootNode, e.nodeName) || this.rootNode,
            this.node = A),
            this.getValue = this._getValue_unavailable,
            this.setValue = this._setValue_unavailable,
            A) {
                if (t) {
                    var n = e.objectIndex;
                    switch (t) {
                    case "materials":
                        if (!A.material)
                            return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.", this);
                        if (!A.material.materials)
                            return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.", this);
                        A = A.material.materials;
                        break;
                    case "bones":
                        if (!A.skeleton)
                            return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.", this);
                        A = A.skeleton.bones;
                        for (var r = 0; A.length > r; r++)
                            if (A[r].name === n) {
                                n = r;
                                break
                            }
                        break;
                    default:
                        if (void 0 === A[t])
                            return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.", this);
                        A = A[t]
                    }
                    if (void 0 !== n) {
                        if (void 0 === A[n])
                            return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.", this, A);
                        A = A[n]
                    }
                }
                var a = A[i];
                if (void 0 !== a) {
                    var s = this.Versioning.None;
                    this.targetObject = A,
                    void 0 !== A.needsUpdate ? s = this.Versioning.NeedsUpdate : void 0 !== A.matrixWorldNeedsUpdate && (s = this.Versioning.MatrixWorldNeedsUpdate);
                    var l = this.BindingType.Direct;
                    if (void 0 !== o) {
                        if ("morphTargetInfluences" === i) {
                            if (!A.geometry)
                                return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.", this);
                            if (A.geometry.isBufferGeometry) {
                                if (!A.geometry.morphAttributes)
                                    return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.", this);
                                for (r = 0; this.node.geometry.morphAttributes.position.length > r; r++)
                                    if (A.geometry.morphAttributes.position[r].name === o) {
                                        o = r;
                                        break
                                    }
                            } else {
                                if (!A.geometry.morphTargets)
                                    return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.", this);
                                for (r = 0; this.node.geometry.morphTargets.length > r; r++)
                                    if (A.geometry.morphTargets[r].name === o) {
                                        o = r;
                                        break
                                    }
                            }
                        }
                        l = this.BindingType.ArrayElement,
                        this.resolvedProperty = a,
                        this.propertyIndex = o
                    } else
                        void 0 !== a.fromArray && void 0 !== a.toArray ? (l = this.BindingType.HasFromToArray,
                        this.resolvedProperty = a) : Array.isArray(a) ? (l = this.BindingType.EntireArray,
                        this.resolvedProperty = a) : this.propertyName = i;
                    this.getValue = this.GetterByBindingType[l],
                    this.setValue = this.SetterByBindingTypeAndVersioning[l][s]
                } else {
                    console.error("THREE.PropertyBinding: Trying to update property for track: " + e.nodeName + "." + i + " but it wasn't found.", A)
                }
            } else
                console.error("THREE.PropertyBinding: Trying to update node for track: " + this.path + " but it wasn't found.")
        },
        unbind: function() {
            this.node = null,
            this.getValue = this._getValue_unbound,
            this.setValue = this._setValue_unbound
        }
    }),
    Object.assign(Fs.prototype, {
        _getValue_unbound: Fs.prototype.getValue,
        _setValue_unbound: Fs.prototype.setValue
    }),
    Object.assign(Ks.prototype, {
        isAnimationObjectGroup: !0,
        add: function() {
            for (var A = this._objects, e = A.length, t = this.nCachedObjects_, i = this._indicesByUUID, o = this._paths, n = this._parsedPaths, r = this._bindings, a = r.length, s = void 0, l = 0, c = arguments.length; l !== c; ++l) {
                var h = arguments[l]
                  , d = h.uuid
                  , p = i[d];
                if (void 0 === p) {
                    p = e++,
                    i[d] = p,
                    A.push(h);
                    for (var g = 0, u = a; g !== u; ++g)
                        r[g].push(new Fs(h,o[g],n[g]))
                } else if (t > p) {
                    s = A[p];
                    var f = --t
                      , m = A[f];
                    i[m.uuid] = p,
                    A[p] = m,
                    i[d] = f,
                    A[f] = h;
                    for (g = 0,
                    u = a; g !== u; ++g) {
                        var C = r[g]
                          , y = C[f]
                          , v = C[p];
                        C[p] = y,
                        void 0 === v && (v = new Fs(h,o[g],n[g])),
                        C[f] = v
                    }
                } else
                    A[p] !== s && console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")
            }
            this.nCachedObjects_ = t
        },
        remove: function() {
            for (var A = this._objects, e = this.nCachedObjects_, t = this._indicesByUUID, i = this._bindings, o = i.length, n = 0, r = arguments.length; n !== r; ++n) {
                var a = arguments[n]
                  , s = a.uuid
                  , l = t[s];
                if (void 0 !== l && l >= e) {
                    var c = e++
                      , h = A[c];
                    t[h.uuid] = l,
                    A[l] = h,
                    t[s] = c,
                    A[c] = a;
                    for (var d = 0, p = o; d !== p; ++d) {
                        var g = i[d]
                          , u = g[c]
                          , f = g[l];
                        g[l] = u,
                        g[c] = f
                    }
                }
            }
            this.nCachedObjects_ = e
        },
        uncache: function() {
            for (var A = this._objects, e = A.length, t = this.nCachedObjects_, i = this._indicesByUUID, o = this._bindings, n = o.length, r = 0, a = arguments.length; r !== a; ++r) {
                var s = arguments[r]
                  , l = s.uuid
                  , c = i[l];
                if (void 0 !== c)
                    if (delete i[l],
                    t > c) {
                        var h = --t
                          , d = A[h]
                          , p = A[C = --e];
                        i[d.uuid] = c,
                        A[c] = d,
                        i[p.uuid] = h,
                        A[h] = p,
                        A.pop();
                        for (var g = 0, u = n; g !== u; ++g) {
                            var f = (y = o[g])[h]
                              , m = y[C];
                            y[c] = f,
                            y[h] = m,
                            y.pop()
                        }
                    } else {
                        var C;
                        i[(p = A[C = --e]).uuid] = c,
                        A[c] = p,
                        A.pop();
                        for (g = 0,
                        u = n; g !== u; ++g) {
                            var y;
                            (y = o[g])[c] = y[C],
                            y.pop()
                        }
                    }
            }
            this.nCachedObjects_ = t
        },
        subscribe_: function(A, e) {
            var t = this._bindingsIndicesByPath
              , i = t[A]
              , o = this._bindings;
            if (void 0 !== i)
                return o[i];
            var n = this._paths
              , r = this._parsedPaths
              , a = this._objects
              , s = this.nCachedObjects_
              , l = new Array(a.length);
            t[A] = i = o.length,
            n.push(A),
            r.push(e),
            o.push(l);
            for (var c = s, h = a.length; c !== h; ++c) {
                l[c] = new Fs(a[c],A,e)
            }
            return l
        },
        unsubscribe_: function(A) {
            var e = this._bindingsIndicesByPath
              , t = e[A];
            if (void 0 !== t) {
                var i = this._paths
                  , o = this._parsedPaths
                  , n = this._bindings
                  , r = n.length - 1
                  , a = n[r];
                e[A[r]] = t,
                n[t] = a,
                n.pop(),
                o[t] = o[r],
                o.pop(),
                i[t] = i[r],
                i.pop()
            }
        }
    }),
    Object.assign(Qs.prototype, {
        play: function() {
            return this._mixer._activateAction(this),
            this
        },
        stop: function() {
            return this._mixer._deactivateAction(this),
            this.reset()
        },
        reset: function() {
            return this.paused = !1,
            this.enabled = !0,
            this.time = 0,
            this._loopCount = -1,
            this._startTime = null,
            this.stopFading().stopWarping()
        },
        isRunning: function() {
            return this.enabled && !this.paused && 0 !== this.timeScale && null === this._startTime && this._mixer._isActiveAction(this)
        },
        isScheduled: function() {
            return this._mixer._isActiveAction(this)
        },
        startAt: function(A) {
            return this._startTime = A,
            this
        },
        setLoop: function(A, e) {
            return this.loop = A,
            this.repetitions = e,
            this
        },
        setEffectiveWeight: function(A) {
            return this.weight = A,
            this._effectiveWeight = this.enabled ? A : 0,
            this.stopFading()
        },
        getEffectiveWeight: function() {
            return this._effectiveWeight
        },
        fadeIn: function(A) {
            return this._scheduleFading(A, 0, 1)
        },
        fadeOut: function(A) {
            return this._scheduleFading(A, 1, 0)
        },
        crossFadeFrom: function(A, e, t) {
            if (A.fadeOut(e),
            this.fadeIn(e),
            t) {
                var i = this._clip.duration
                  , o = A._clip.duration
                  , n = i / o;
                A.warp(1, o / i, e),
                this.warp(n, 1, e)
            }
            return this
        },
        crossFadeTo: function(A, e, t) {
            return A.crossFadeFrom(this, e, t)
        },
        stopFading: function() {
            var A = this._weightInterpolant;
            return null !== A && (this._weightInterpolant = null,
            this._mixer._takeBackControlInterpolant(A)),
            this
        },
        setEffectiveTimeScale: function(A) {
            return this.timeScale = A,
            this._effectiveTimeScale = this.paused ? 0 : A,
            this.stopWarping()
        },
        getEffectiveTimeScale: function() {
            return this._effectiveTimeScale
        },
        setDuration: function(A) {
            return this.timeScale = this._clip.duration / A,
            this.stopWarping()
        },
        syncWith: function(A) {
            return this.time = A.time,
            this.timeScale = A.timeScale,
            this.stopWarping()
        },
        halt: function(A) {
            return this.warp(this._effectiveTimeScale, 0, A)
        },
        warp: function(A, e, t) {
            var i = this._mixer
              , o = i.time
              , n = this._timeScaleInterpolant
              , r = this.timeScale;
            null === n && (n = i._lendControlInterpolant(),
            this._timeScaleInterpolant = n);
            var a = n.parameterPositions
              , s = n.sampleValues;
            return a[0] = o,
            a[1] = o + t,
            s[0] = A / r,
            s[1] = e / r,
            this
        },
        stopWarping: function() {
            var A = this._timeScaleInterpolant;
            return null !== A && (this._timeScaleInterpolant = null,
            this._mixer._takeBackControlInterpolant(A)),
            this
        },
        getMixer: function() {
            return this._mixer
        },
        getClip: function() {
            return this._clip
        },
        getRoot: function() {
            return this._localRoot || this._mixer._root
        },
        _update: function(A, e, t, i) {
            if (this.enabled) {
                var o = this._startTime;
                if (null !== o) {
                    var n = (A - o) * t;
                    if (0 > n || 0 === t)
                        return;
                    this._startTime = null,
                    e = t * n
                }
                e *= this._updateTimeScale(A);
                var r = this._updateTime(e)
                  , a = this._updateWeight(A);
                if (a > 0)
                    for (var s = this._interpolants, l = this._propertyBindings, c = 0, h = s.length; c !== h; ++c)
                        s[c].evaluate(r),
                        l[c].accumulate(i, a)
            } else
                this._updateWeight(A)
        },
        _updateWeight: function(A) {
            var e = 0;
            if (this.enabled) {
                e = this.weight;
                var t = this._weightInterpolant;
                if (null !== t) {
                    var i = t.evaluate(A)[0];
                    e *= i,
                    A > t.parameterPositions[1] && (this.stopFading(),
                    0 === i && (this.enabled = !1))
                }
            }
            return this._effectiveWeight = e,
            e
        },
        _updateTimeScale: function(A) {
            var e = 0;
            if (!this.paused) {
                e = this.timeScale;
                var t = this._timeScaleInterpolant;
                if (null !== t)
                    e *= t.evaluate(A)[0],
                    A > t.parameterPositions[1] && (this.stopWarping(),
                    0 === e ? this.paused = !0 : this.timeScale = e)
            }
            return this._effectiveTimeScale = e,
            e
        },
        _updateTime: function(A) {
            var e = this.time + A
              , t = this._clip.duration
              , i = this.loop
              , o = this._loopCount
              , n = 2202 === i;
            if (0 === A)
                return -1 === o ? e : n && 1 == (1 & o) ? t - e : e;
            if (2200 === i) {
                -1 === o && (this._loopCount = 0,
                this._setEndings(!0, !0, !1));
                A: {
                    if (e < t) {
                        if (e >= 0) {
                            this.time = e;
                            break A
                        }
                        e = 0
                    } else
                        e = t;
                    this.clampWhenFinished ? this.paused = !0 : this.enabled = !1,
                    this.time = e,
                    this._mixer.dispatchEvent({
                        type: "finished",
                        action: this,
                        direction: 0 > A ? -1 : 1
                    })
                }
            } else {
                if (-1 === o && (0 > A ? this._setEndings(0 === this.repetitions, !0, n) : (o = 0,
                this._setEndings(!0, 0 === this.repetitions, n))),
                e >= t || 0 > e) {
                    var r = Math.floor(e / t);
                    e -= t * r,
                    o += Math.abs(r);
                    var a = this.repetitions - o;
                    if (0 < a) {
                        if (1 === a) {
                            var s = 0 > A;
                            this._setEndings(s, !s, n)
                        } else
                            this._setEndings(!1, !1, n);
                        this._loopCount = o,
                        this.time = e,
                        this._mixer.dispatchEvent({
                            type: "loop",
                            action: this,
                            loopDelta: r
                        })
                    } else
                        this.clampWhenFinished ? this.paused = !0 : this.enabled = !1,
                        this.time = e = A > 0 ? t : 0,
                        this._mixer.dispatchEvent({
                            type: "finished",
                            action: this,
                            direction: A > 0 ? 1 : -1
                        })
                } else
                    this.time = e;
                if (n && 1 == (1 & o))
                    return t - e
            }
            return e
        },
        _setEndings: function(A, e, t) {
            var i = this._interpolantSettings;
            t ? (i.endingStart = 2401,
            i.endingEnd = 2401) : (i.endingStart = A ? this.zeroSlopeAtStart ? 2401 : 2400 : 2402,
            i.endingEnd = e ? this.zeroSlopeAtEnd ? 2401 : 2400 : 2402)
        },
        _scheduleFading: function(A, e, t) {
            var i = this._mixer
              , o = i.time
              , n = this._weightInterpolant;
            null === n && (n = i._lendControlInterpolant(),
            this._weightInterpolant = n);
            var r = n.parameterPositions
              , a = n.sampleValues;
            return r[0] = o,
            a[0] = e,
            r[1] = o + A,
            a[1] = t,
            this
        }
    }),
    Rs.prototype = Object.assign(Object.create(i.prototype), {
        constructor: Rs,
        _bindAction: function(A, e) {
            var t = A._localRoot || this._root
              , i = A._clip.tracks
              , o = i.length
              , n = A._propertyBindings
              , r = A._interpolants
              , a = t.uuid
              , s = this._bindingsByRootAndName
              , l = s[a];
            void 0 === l && (s[a] = l = {});
            for (var c = 0; c !== o; ++c) {
                var h = i[c]
                  , d = h.name
                  , p = l[d];
                if (void 0 !== p)
                    n[c] = p;
                else {
                    if (void 0 !== (p = n[c])) {
                        null === p._cacheIndex && (++p.referenceCount,
                        this._addInactiveBinding(p, a, d));
                        continue
                    }
                    ++(p = new vs(Fs.create(t, d, e && e._propertyBindings[c].binding.parsedPath),h.ValueTypeName,h.getValueSize())).referenceCount,
                    this._addInactiveBinding(p, a, d),
                    n[c] = p
                }
                r[c].resultBuffer = p.buffer
            }
        },
        _activateAction: function(A) {
            if (!this._isActiveAction(A)) {
                if (null === A._cacheIndex) {
                    var e = (A._localRoot || this._root).uuid
                      , t = A._clip.uuid
                      , i = this._actionsByClip[t];
                    this._bindAction(A, i && i.knownActions[0]),
                    this._addInactiveAction(A, t, e)
                }
                for (var o = A._propertyBindings, n = 0, r = o.length; n !== r; ++n) {
                    var a = o[n];
                    0 == a.useCount++ && (this._lendBinding(a),
                    a.saveOriginalState())
                }
                this._lendAction(A)
            }
        },
        _deactivateAction: function(A) {
            if (this._isActiveAction(A)) {
                for (var e = A._propertyBindings, t = 0, i = e.length; t !== i; ++t) {
                    var o = e[t];
                    0 == --o.useCount && (o.restoreOriginalState(),
                    this._takeBackBinding(o))
                }
                this._takeBackAction(A)
            }
        },
        _initMemoryManager: function() {
            this._actions = [],
            this._nActiveActions = 0,
            this._actionsByClip = {},
            this._bindings = [],
            this._nActiveBindings = 0,
            this._bindingsByRootAndName = {},
            this._controlInterpolants = [],
            this._nActiveControlInterpolants = 0;
            var A = this;
            this.stats = {
                actions: {
                    get total() {
                        return A._actions.length
                    },
                    get inUse() {
                        return A._nActiveActions
                    }
                },
                bindings: {
                    get total() {
                        return A._bindings.length
                    },
                    get inUse() {
                        return A._nActiveBindings
                    }
                },
                controlInterpolants: {
                    get total() {
                        return A._controlInterpolants.length
                    },
                    get inUse() {
                        return A._nActiveControlInterpolants
                    }
                }
            }
        },
        _isActiveAction: function(A) {
            var e = A._cacheIndex;
            return null !== e && this._nActiveActions > e
        },
        _addInactiveAction: function(A, e, t) {
            var i = this._actions
              , o = this._actionsByClip
              , n = o[e];
            if (void 0 === n)
                n = {
                    knownActions: [A],
                    actionByRoot: {}
                },
                A._byClipCacheIndex = 0,
                o[e] = n;
            else {
                var r = n.knownActions;
                A._byClipCacheIndex = r.length,
                r.push(A)
            }
            A._cacheIndex = i.length,
            i.push(A),
            n.actionByRoot[t] = A
        },
        _removeInactiveAction: function(A) {
            var e = this._actions
              , t = e[e.length - 1]
              , i = A._cacheIndex;
            t._cacheIndex = i,
            e[i] = t,
            e.pop(),
            A._cacheIndex = null;
            var o = A._clip.uuid
              , n = this._actionsByClip
              , r = n[o]
              , a = r.knownActions
              , s = a[a.length - 1]
              , l = A._byClipCacheIndex;
            s._byClipCacheIndex = l,
            a[l] = s,
            a.pop(),
            A._byClipCacheIndex = null,
            delete r.actionByRoot[(A._localRoot || this._root).uuid],
            0 === a.length && delete n[o],
            this._removeInactiveBindingsForAction(A)
        },
        _removeInactiveBindingsForAction: function(A) {
            for (var e = A._propertyBindings, t = 0, i = e.length; t !== i; ++t) {
                var o = e[t];
                0 == --o.referenceCount && this._removeInactiveBinding(o)
            }
        },
        _lendAction: function(A) {
            var e = this._actions
              , t = A._cacheIndex
              , i = this._nActiveActions++
              , o = e[i];
            A._cacheIndex = i,
            e[i] = A,
            o._cacheIndex = t,
            e[t] = o
        },
        _takeBackAction: function(A) {
            var e = this._actions
              , t = A._cacheIndex
              , i = --this._nActiveActions
              , o = e[i];
            A._cacheIndex = i,
            e[i] = A,
            o._cacheIndex = t,
            e[t] = o
        },
        _addInactiveBinding: function(A, e, t) {
            var i = this._bindingsByRootAndName
              , o = i[e]
              , n = this._bindings;
            void 0 === o && (i[e] = o = {}),
            o[t] = A,
            A._cacheIndex = n.length,
            n.push(A)
        },
        _removeInactiveBinding: function(A) {
            var e = this._bindings
              , t = A.binding
              , i = t.rootNode.uuid
              , o = t.path
              , n = this._bindingsByRootAndName
              , r = n[i]
              , a = e[e.length - 1]
              , s = A._cacheIndex;
            a._cacheIndex = s,
            e[s] = a,
            e.pop(),
            delete r[o],
            0 === Object.keys(r).length && delete n[i]
        },
        _lendBinding: function(A) {
            var e = this._bindings
              , t = A._cacheIndex
              , i = this._nActiveBindings++
              , o = e[i];
            A._cacheIndex = i,
            e[i] = A,
            o._cacheIndex = t,
            e[t] = o
        },
        _takeBackBinding: function(A) {
            var e = this._bindings
              , t = A._cacheIndex
              , i = --this._nActiveBindings
              , o = e[i];
            A._cacheIndex = i,
            e[i] = A,
            o._cacheIndex = t,
            e[t] = o
        },
        _lendControlInterpolant: function() {
            var A = this._controlInterpolants
              , e = this._nActiveControlInterpolants++
              , t = A[e];
            return void 0 === t && ((t = new Kr(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer)).__cacheIndex = e,
            A[e] = t),
            t
        },
        _takeBackControlInterpolant: function(A) {
            var e = this._controlInterpolants
              , t = A.__cacheIndex
              , i = --this._nActiveControlInterpolants
              , o = e[i];
            A.__cacheIndex = i,
            e[i] = A,
            o.__cacheIndex = t,
            e[t] = o
        },
        _controlInterpolantsResultBuffer: new Float32Array(1),
        clipAction: function(A, e) {
            var t = e || this._root
              , i = t.uuid
              , o = "string" == typeof A ? Gr.findByName(t, A) : A
              , n = null !== o ? o.uuid : A
              , r = this._actionsByClip[n]
              , a = null;
            if (void 0 !== r) {
                var s = r.actionByRoot[i];
                if (void 0 !== s)
                    return s;
                a = r.knownActions[0],
                null === o && (o = a._clip)
            }
            if (null === o)
                return null;
            var l = new Qs(this,o,e);
            return this._bindAction(l, a),
            this._addInactiveAction(l, n, i),
            l
        },
        existingAction: function(A, e) {
            var t = e || this._root
              , i = t.uuid
              , o = "string" == typeof A ? Gr.findByName(t, A) : A
              , n = this._actionsByClip[o ? o.uuid : A];
            return void 0 !== n && n.actionByRoot[i] || null
        },
        stopAllAction: function() {
            var A = this._actions
              , e = this._nActiveActions
              , t = this._bindings
              , i = this._nActiveBindings;
            this._nActiveActions = 0,
            this._nActiveBindings = 0;
            for (var o = 0; o !== e; ++o)
                A[o].reset();
            for (o = 0; o !== i; ++o)
                t[o].useCount = 0;
            return this
        },
        update: function(A) {
            for (var e = this._actions, t = this._nActiveActions, i = this.time += A *= this.timeScale, o = Math.sign(A), n = this._accuIndex ^= 1, r = 0; r !== t; ++r) {
                e[r]._update(i, A, o, n)
            }
            var a = this._bindings
              , s = this._nActiveBindings;
            for (r = 0; r !== s; ++r)
                a[r].apply(n);
            return this
        },
        setTime: function(A) {
            this.time = 0;
            for (var e = 0; this._actions.length > e; e++)
                this._actions[e].time = 0;
            return this.update(A)
        },
        getRoot: function() {
            return this._root
        },
        uncacheClip: function(A) {
            var e = this._actions
              , t = A.uuid
              , i = this._actionsByClip
              , o = i[t];
            if (void 0 !== o) {
                for (var n = o.knownActions, r = 0, a = n.length; r !== a; ++r) {
                    var s = n[r];
                    this._deactivateAction(s);
                    var l = s._cacheIndex
                      , c = e[e.length - 1];
                    s._cacheIndex = null,
                    s._byClipCacheIndex = null,
                    c._cacheIndex = l,
                    e[l] = c,
                    e.pop(),
                    this._removeInactiveBindingsForAction(s)
                }
                delete i[t]
            }
        },
        uncacheRoot: function(A) {
            var e = A.uuid
              , t = this._actionsByClip;
            for (var i in t) {
                var o = t[i].actionByRoot[e];
                void 0 !== o && (this._deactivateAction(o),
                this._removeInactiveAction(o))
            }
            var n = this._bindingsByRootAndName[e];
            if (void 0 !== n)
                for (var r in n) {
                    var a = n[r];
                    a.restoreOriginalState(),
                    this._removeInactiveBinding(a)
                }
        },
        uncacheAction: function(A, e) {
            var t = this.existingAction(A, e);
            null !== t && (this._deactivateAction(t),
            this._removeInactiveAction(t))
        }
    }),
    Ts.prototype.clone = function() {
        return new Ts(void 0 === this.value.clone ? this.value : this.value.clone())
    }
    ,
    ks.prototype = Object.assign(Object.create(to.prototype), {
        constructor: ks,
        isInstancedInterleavedBuffer: !0,
        copy: function(A) {
            return to.prototype.copy.call(this, A),
            this.meshPerAttribute = A.meshPerAttribute,
            this
        }
    }),
    Object.assign(Ds.prototype, {
        set: function(A, e) {
            this.ray.set(A, e)
        },
        setFromCamera: function(A, e) {
            e && e.isPerspectiveCamera ? (this.ray.origin.setFromMatrixPosition(e.matrixWorld),
            this.ray.direction.set(A.x, A.y, .5).unproject(e).sub(this.ray.origin).normalize(),
            this.camera = e) : e && e.isOrthographicCamera ? (this.ray.origin.set(A.x, A.y, (e.near + e.far) / (e.near - e.far)).unproject(e),
            this.ray.direction.set(0, 0, -1).transformDirection(e.matrixWorld),
            this.camera = e) : console.error("THREE.Raycaster: Unsupported camera type.")
        },
        intersectObject: function(A, e, t) {
            var i = t || [];
            return Ns(A, this, i, e),
            i.sort(Ls),
            i
        },
        intersectObjects: function(A, e, t) {
            var i = t || [];
            if (!1 === Array.isArray(A))
                return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),
                i;
            for (var o = 0, n = A.length; n > o; o++)
                Ns(A[o], this, i, e);
            return i.sort(Ls),
            i
        }
    }),
    Object.assign(Os.prototype, {
        set: function(A, e, t) {
            return this.radius = A,
            this.phi = e,
            this.theta = t,
            this
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            return this.radius = A.radius,
            this.phi = A.phi,
            this.theta = A.theta,
            this
        },
        makeSafe: function() {
            return this.phi = Math.max(1e-6, Math.min(Math.PI - 1e-6, this.phi)),
            this
        },
        setFromVector3: function(A) {
            return this.setFromCartesianCoords(A.x, A.y, A.z)
        },
        setFromCartesianCoords: function(A, e, t) {
            return this.radius = Math.sqrt(A * A + e * e + t * t),
            0 === this.radius ? (this.theta = 0,
            this.phi = 0) : (this.theta = Math.atan2(A, t),
            this.phi = Math.acos(a.clamp(e / this.radius, -1, 1))),
            this
        }
    }),
    Object.assign(Vs.prototype, {
        set: function(A, e, t) {
            return this.radius = A,
            this.theta = e,
            this.y = t,
            this
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            return this.radius = A.radius,
            this.theta = A.theta,
            this.y = A.y,
            this
        },
        setFromVector3: function(A) {
            return this.setFromCartesianCoords(A.x, A.y, A.z)
        },
        setFromCartesianCoords: function(A, e, t) {
            return this.radius = Math.sqrt(A * A + t * t),
            this.theta = Math.atan2(A, t),
            this.y = e,
            this
        }
    });
    var Gs = new s;
    function Ps(A, e) {
        this.min = void 0 !== A ? A : new s(1 / 0,1 / 0),
        this.max = void 0 !== e ? e : new s(-1 / 0,-1 / 0)
    }
    Object.assign(Ps.prototype, {
        set: function(A, e) {
            return this.min.copy(A),
            this.max.copy(e),
            this
        },
        setFromPoints: function(A) {
            this.makeEmpty();
            for (var e = 0, t = A.length; t > e; e++)
                this.expandByPoint(A[e]);
            return this
        },
        setFromCenterAndSize: function(A, e) {
            var t = Gs.copy(e).multiplyScalar(.5);
            return this.min.copy(A).sub(t),
            this.max.copy(A).add(t),
            this
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            return this.min.copy(A.min),
            this.max.copy(A.max),
            this
        },
        makeEmpty: function() {
            return this.min.x = this.min.y = 1 / 0,
            this.max.x = this.max.y = -1 / 0,
            this
        },
        isEmpty: function() {
            return this.min.x > this.max.x || this.min.y > this.max.y
        },
        getCenter: function(A) {
            return void 0 === A && (console.warn("THREE.Box2: .getCenter() target is now required"),
            A = new s),
            this.isEmpty() ? A.set(0, 0) : A.addVectors(this.min, this.max).multiplyScalar(.5)
        },
        getSize: function(A) {
            return void 0 === A && (console.warn("THREE.Box2: .getSize() target is now required"),
            A = new s),
            this.isEmpty() ? A.set(0, 0) : A.subVectors(this.max, this.min)
        },
        expandByPoint: function(A) {
            return this.min.min(A),
            this.max.max(A),
            this
        },
        expandByVector: function(A) {
            return this.min.sub(A),
            this.max.add(A),
            this
        },
        expandByScalar: function(A) {
            return this.min.addScalar(-A),
            this.max.addScalar(A),
            this
        },
        containsPoint: function(A) {
            return !(this.min.x > A.x || A.x > this.max.x || this.min.y > A.y || A.y > this.max.y)
        },
        containsBox: function(A) {
            return !(this.min.x > A.min.x || A.max.x > this.max.x || this.min.y > A.min.y || A.max.y > this.max.y)
        },
        getParameter: function(A, e) {
            return void 0 === e && (console.warn("THREE.Box2: .getParameter() target is now required"),
            e = new s),
            e.set((A.x - this.min.x) / (this.max.x - this.min.x), (A.y - this.min.y) / (this.max.y - this.min.y))
        },
        intersectsBox: function(A) {
            return !(this.min.x > A.max.x || A.min.x > this.max.x || this.min.y > A.max.y || A.min.y > this.max.y)
        },
        clampPoint: function(A, e) {
            return void 0 === e && (console.warn("THREE.Box2: .clampPoint() target is now required"),
            e = new s),
            e.copy(A).clamp(this.min, this.max)
        },
        distanceToPoint: function(A) {
            return Gs.copy(A).clamp(this.min, this.max).sub(A).length()
        },
        intersect: function(A) {
            return this.min.max(A.min),
            this.max.min(A.max),
            this
        },
        union: function(A) {
            return this.min.min(A.min),
            this.max.max(A.max),
            this
        },
        translate: function(A) {
            return this.min.add(A),
            this.max.add(A),
            this
        },
        equals: function(A) {
            return A.min.equals(this.min) && A.max.equals(this.max)
        }
    });
    var qs = new y
      , js = new y;
    function Hs(A, e) {
        this.start = void 0 !== A ? A : new y,
        this.end = void 0 !== e ? e : new y
    }
    function Ys(A) {
        H.call(this),
        this.material = A,
        this.render = function() {}
    }
    Object.assign(Hs.prototype, {
        set: function(A, e) {
            return this.start.copy(A),
            this.end.copy(e),
            this
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            return this.start.copy(A.start),
            this.end.copy(A.end),
            this
        },
        getCenter: function(A) {
            return void 0 === A && (console.warn("THREE.Line3: .getCenter() target is now required"),
            A = new y),
            A.addVectors(this.start, this.end).multiplyScalar(.5)
        },
        delta: function(A) {
            return void 0 === A && (console.warn("THREE.Line3: .delta() target is now required"),
            A = new y),
            A.subVectors(this.end, this.start)
        },
        distanceSq: function() {
            return this.start.distanceToSquared(this.end)
        },
        distance: function() {
            return this.start.distanceTo(this.end)
        },
        at: function(A, e) {
            return void 0 === e && (console.warn("THREE.Line3: .at() target is now required"),
            e = new y),
            this.delta(e).multiplyScalar(A).add(this.start)
        },
        closestPointToPointParameter: function(A, e) {
            qs.subVectors(A, this.start),
            js.subVectors(this.end, this.start);
            var t = js.dot(js)
              , i = js.dot(qs) / t;
            return e && (i = a.clamp(i, 0, 1)),
            i
        },
        closestPointToPoint: function(A, e, t) {
            var i = this.closestPointToPointParameter(A, e);
            return void 0 === t && (console.warn("THREE.Line3: .closestPointToPoint() target is now required"),
            t = new y),
            this.delta(t).multiplyScalar(i).add(this.start)
        },
        applyMatrix4: function(A) {
            return this.start.applyMatrix4(A),
            this.end.applyMatrix4(A),
            this
        },
        equals: function(A) {
            return A.start.equals(this.start) && A.end.equals(this.end)
        }
    }),
    (Ys.prototype = Object.create(H.prototype)).constructor = Ys,
    Ys.prototype.isImmediateRenderObject = !0;
    var Ws = new y;
    function Js(A, e) {
        H.call(this),
        this.light = A,
        this.light.updateMatrixWorld(),
        this.matrix = A.matrixWorld,
        this.matrixAutoUpdate = !1,
        this.color = e;
        for (var t = new he, i = [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, -1, 1], o = 0, n = 1; 32 > o; o++,
        n++) {
            var r = o / 32 * Math.PI * 2
              , a = n / 32 * Math.PI * 2;
            i.push(Math.cos(r), Math.sin(r), 1, Math.cos(a), Math.sin(a), 1)
        }
        t.setAttribute("position", new Ae(i,3));
        var s = new ko({
            fog: !1,
            toneMapped: !1
        });
        this.cone = new jo(t,s),
        this.add(this.cone),
        this.update()
    }
    (Js.prototype = Object.create(H.prototype)).constructor = Js,
    Js.prototype.dispose = function() {
        this.cone.geometry.dispose(),
        this.cone.material.dispose()
    }
    ,
    Js.prototype.update = function() {
        this.light.updateMatrixWorld();
        var A = this.light.distance ? this.light.distance : 1e3
          , e = A * Math.tan(this.light.angle);
        this.cone.scale.set(e, e, A),
        Ws.setFromMatrixPosition(this.light.target.matrixWorld),
        this.cone.lookAt(Ws),
        void 0 !== this.color ? this.cone.material.color.set(this.color) : this.cone.material.color.copy(this.light.color)
    }
    ;
    var zs = new y
      , Zs = new M
      , Xs = new M;
    function _s(A) {
        for (var e = function A(e) {
            var t = [];
            e && e.isBone && t.push(e);
            for (var i = 0; e.children.length > i; i++)
                t.push.apply(t, A(e.children[i]));
            return t
        }(A), t = new he, i = [], o = [], n = new LA(0,0,1), r = new LA(0,1,0), a = 0; e.length > a; a++) {
            var s = e[a];
            s.parent && s.parent.isBone && (i.push(0, 0, 0),
            i.push(0, 0, 0),
            o.push(n.r, n.g, n.b),
            o.push(r.r, r.g, r.b))
        }
        t.setAttribute("position", new Ae(i,3)),
        t.setAttribute("color", new Ae(o,3));
        var l = new ko({
            vertexColors: !0,
            depthTest: !1,
            depthWrite: !1,
            toneMapped: !1,
            transparent: !0
        });
        jo.call(this, t, l),
        this.root = A,
        this.bones = e,
        this.matrix = A.matrixWorld,
        this.matrixAutoUpdate = !1
    }
    function $s(A, e, t) {
        this.light = A,
        this.light.updateMatrixWorld(),
        this.color = t;
        var i = new er(e,4,2)
          , o = new jA({
            wireframe: !0,
            fog: !1,
            toneMapped: !1
        });
        Ue.call(this, i, o),
        this.matrix = this.light.matrixWorld,
        this.matrixAutoUpdate = !1,
        this.update()
    }
    (_s.prototype = Object.create(jo.prototype)).constructor = _s,
    _s.prototype.isSkeletonHelper = !0,
    _s.prototype.updateMatrixWorld = function(A) {
        var e = this.bones
          , t = this.geometry
          , i = t.getAttribute("position");
        Xs.getInverse(this.root.matrixWorld);
        for (var o = 0, n = 0; e.length > o; o++) {
            var r = e[o];
            r.parent && r.parent.isBone && (Zs.multiplyMatrices(Xs, r.matrixWorld),
            zs.setFromMatrixPosition(Zs),
            i.setXYZ(n, zs.x, zs.y, zs.z),
            Zs.multiplyMatrices(Xs, r.parent.matrixWorld),
            zs.setFromMatrixPosition(Zs),
            i.setXYZ(n + 1, zs.x, zs.y, zs.z),
            n += 2)
        }
        t.getAttribute("position").needsUpdate = !0,
        H.prototype.updateMatrixWorld.call(this, A)
    }
    ,
    ($s.prototype = Object.create(Ue.prototype)).constructor = $s,
    $s.prototype.dispose = function() {
        this.geometry.dispose(),
        this.material.dispose()
    }
    ,
    $s.prototype.update = function() {
        void 0 !== this.color ? this.material.color.set(this.color) : this.material.color.copy(this.light.color)
    }
    ;
    var Al = new y
      , el = new LA
      , tl = new LA;
    function il(A, e, t) {
        H.call(this),
        this.light = A,
        this.light.updateMatrixWorld(),
        this.matrix = A.matrixWorld,
        this.matrixAutoUpdate = !1,
        this.color = t;
        var i = new dn(e);
        i.rotateY(.5 * Math.PI),
        this.material = new jA({
            wireframe: !0,
            fog: !1,
            toneMapped: !1
        }),
        void 0 === this.color && (this.material.vertexColors = !0);
        var o = i.getAttribute("position")
          , n = new Float32Array(3 * o.count);
        i.setAttribute("color", new YA(n,3)),
        this.add(new Ue(i,this.material)),
        this.update()
    }
    function ol(A, e, t, i) {
        A = A || 10,
        e = e || 10,
        t = new LA(void 0 !== t ? t : 4473924),
        i = new LA(void 0 !== i ? i : 8947848);
        for (var o = e / 2, n = A / e, r = A / 2, a = [], s = [], l = 0, c = 0, h = -r; e >= l; l++,
        h += n) {
            a.push(-r, 0, h, r, 0, h),
            a.push(h, 0, -r, h, 0, r);
            var d = l === o ? t : i;
            d.toArray(s, c),
            d.toArray(s, c += 3),
            d.toArray(s, c += 3),
            d.toArray(s, c += 3),
            c += 3
        }
        var p = new he;
        p.setAttribute("position", new Ae(a,3)),
        p.setAttribute("color", new Ae(s,3));
        var g = new ko({
            vertexColors: !0,
            toneMapped: !1
        });
        jo.call(this, p, g)
    }
    function nl(A, e, t, i, o, n) {
        A = A || 10,
        e = e || 16,
        t = t || 8,
        i = i || 64,
        o = new LA(void 0 !== o ? o : 4473924),
        n = new LA(void 0 !== n ? n : 8947848);
        var r, a, s, l, c, h, d, p = [], g = [];
        for (l = 0; e >= l; l++)
            s = l / e * (2 * Math.PI),
            r = Math.sin(s) * A,
            a = Math.cos(s) * A,
            p.push(0, 0, 0),
            p.push(r, 0, a),
            g.push((d = 1 & l ? o : n).r, d.g, d.b),
            g.push(d.r, d.g, d.b);
        for (l = 0; t >= l; l++)
            for (d = 1 & l ? o : n,
            h = A - A / t * l,
            c = 0; i > c; c++)
                s = c / i * (2 * Math.PI),
                r = Math.sin(s) * h,
                a = Math.cos(s) * h,
                p.push(r, 0, a),
                g.push(d.r, d.g, d.b),
                s = (c + 1) / i * (2 * Math.PI),
                r = Math.sin(s) * h,
                a = Math.cos(s) * h,
                p.push(r, 0, a),
                g.push(d.r, d.g, d.b);
        var u = new he;
        u.setAttribute("position", new Ae(p,3)),
        u.setAttribute("color", new Ae(g,3));
        var f = new ko({
            vertexColors: !0,
            toneMapped: !1
        });
        jo.call(this, u, f)
    }
    (il.prototype = Object.create(H.prototype)).constructor = il,
    il.prototype.dispose = function() {
        this.children[0].geometry.dispose(),
        this.children[0].material.dispose()
    }
    ,
    il.prototype.update = function() {
        var A = this.children[0];
        if (void 0 !== this.color)
            this.material.color.set(this.color);
        else {
            var e = A.geometry.getAttribute("color");
            el.copy(this.light.color),
            tl.copy(this.light.groundColor);
            for (var t = 0, i = e.count; i > t; t++) {
                var o = i / 2 > t ? el : tl;
                e.setXYZ(t, o.r, o.g, o.b)
            }
            e.needsUpdate = !0
        }
        A.lookAt(Al.setFromMatrixPosition(this.light.matrixWorld).negate())
    }
    ,
    ol.prototype = Object.assign(Object.create(jo.prototype), {
        constructor: ol,
        copy: function(A) {
            return jo.prototype.copy.call(this, A),
            this.geometry.copy(A.geometry),
            this.material.copy(A.material),
            this
        },
        clone: function() {
            return (new this.constructor).copy(this)
        }
    }),
    (nl.prototype = Object.create(jo.prototype)).constructor = nl;
    var rl = new y
      , al = new y
      , sl = new y;
    function ll(A, e, t) {
        H.call(this),
        this.light = A,
        this.light.updateMatrixWorld(),
        this.matrix = A.matrixWorld,
        this.matrixAutoUpdate = !1,
        this.color = t,
        void 0 === e && (e = 1);
        var i = new he;
        i.setAttribute("position", new Ae([-e, e, 0, e, e, 0, e, -e, 0, -e, -e, 0, -e, e, 0],3));
        var o = new ko({
            fog: !1,
            toneMapped: !1
        });
        this.lightPlane = new Go(i,o),
        this.add(this.lightPlane),
        (i = new he).setAttribute("position", new Ae([0, 0, 0, 0, 0, 1],3)),
        this.targetLine = new Go(i,o),
        this.add(this.targetLine),
        this.update()
    }
    (ll.prototype = Object.create(H.prototype)).constructor = ll,
    ll.prototype.dispose = function() {
        this.lightPlane.geometry.dispose(),
        this.lightPlane.material.dispose(),
        this.targetLine.geometry.dispose(),
        this.targetLine.material.dispose()
    }
    ,
    ll.prototype.update = function() {
        rl.setFromMatrixPosition(this.light.matrixWorld),
        al.setFromMatrixPosition(this.light.target.matrixWorld),
        sl.subVectors(al, rl),
        this.lightPlane.lookAt(al),
        void 0 !== this.color ? (this.lightPlane.material.color.set(this.color),
        this.targetLine.material.color.set(this.color)) : (this.lightPlane.material.color.copy(this.light.color),
        this.targetLine.material.color.copy(this.light.color)),
        this.targetLine.lookAt(al),
        this.targetLine.scale.z = sl.length()
    }
    ;
    var cl = new y
      , hl = new qe;
    function dl(A) {
        var e = new he
          , t = new ko({
            color: 16777215,
            vertexColors: !0,
            toneMapped: !1
        })
          , i = []
          , o = []
          , n = {}
          , r = new LA(16755200)
          , a = new LA(16711680)
          , s = new LA(43775)
          , l = new LA(16777215)
          , c = new LA(3355443);
        function h(A, e, t) {
            d(A, t),
            d(e, t)
        }
        function d(A, e) {
            i.push(0, 0, 0),
            o.push(e.r, e.g, e.b),
            void 0 === n[A] && (n[A] = []),
            n[A].push(i.length / 3 - 1)
        }
        h("n1", "n2", r),
        h("n2", "n4", r),
        h("n4", "n3", r),
        h("n3", "n1", r),
        h("f1", "f2", r),
        h("f2", "f4", r),
        h("f4", "f3", r),
        h("f3", "f1", r),
        h("n1", "f1", r),
        h("n2", "f2", r),
        h("n3", "f3", r),
        h("n4", "f4", r),
        h("p", "n1", a),
        h("p", "n2", a),
        h("p", "n3", a),
        h("p", "n4", a),
        h("u1", "u2", s),
        h("u2", "u3", s),
        h("u3", "u1", s),
        h("c", "t", l),
        h("p", "c", c),
        h("cn1", "cn2", c),
        h("cn3", "cn4", c),
        h("cf1", "cf2", c),
        h("cf3", "cf4", c),
        e.setAttribute("position", new Ae(i,3)),
        e.setAttribute("color", new Ae(o,3)),
        jo.call(this, e, t),
        this.camera = A,
        this.camera.updateProjectionMatrix && this.camera.updateProjectionMatrix(),
        this.matrix = A.matrixWorld,
        this.matrixAutoUpdate = !1,
        this.pointMap = n,
        this.update()
    }
    function pl(A, e, t, i, o, n, r) {
        cl.set(o, n, r).unproject(i);
        var a = e[A];
        if (void 0 !== a)
            for (var s = t.getAttribute("position"), l = 0, c = a.length; c > l; l++)
                s.setXYZ(a[l], cl.x, cl.y, cl.z)
    }
    (dl.prototype = Object.create(jo.prototype)).constructor = dl,
    dl.prototype.update = function() {
        var A = this.geometry
          , e = this.pointMap;
        hl.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),
        pl("c", e, A, hl, 0, 0, -1),
        pl("t", e, A, hl, 0, 0, 1),
        pl("n1", e, A, hl, -1, -1, -1),
        pl("n2", e, A, hl, 1, -1, -1),
        pl("n3", e, A, hl, -1, 1, -1),
        pl("n4", e, A, hl, 1, 1, -1),
        pl("f1", e, A, hl, -1, -1, 1),
        pl("f2", e, A, hl, 1, -1, 1),
        pl("f3", e, A, hl, -1, 1, 1),
        pl("f4", e, A, hl, 1, 1, 1),
        pl("u1", e, A, hl, .7, 1.1, -1),
        pl("u2", e, A, hl, -.7, 1.1, -1),
        pl("u3", e, A, hl, 0, 2, -1),
        pl("cf1", e, A, hl, -1, 0, 1),
        pl("cf2", e, A, hl, 1, 0, 1),
        pl("cf3", e, A, hl, 0, -1, 1),
        pl("cf4", e, A, hl, 0, 1, 1),
        pl("cn1", e, A, hl, -1, 0, -1),
        pl("cn2", e, A, hl, 1, 0, -1),
        pl("cn3", e, A, hl, 0, -1, -1),
        pl("cn4", e, A, hl, 0, 1, -1),
        A.getAttribute("position").needsUpdate = !0
    }
    ;
    var gl = new aA;
    function ul(A, e) {
        this.object = A,
        void 0 === e && (e = 16776960);
        var t = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7])
          , i = new Float32Array(24)
          , o = new he;
        o.setIndex(new YA(t,1)),
        o.setAttribute("position", new YA(i,3)),
        jo.call(this, o, new ko({
            color: e,
            toneMapped: !1
        })),
        this.matrixAutoUpdate = !1,
        this.update()
    }
    function fl(A, e) {
        this.type = "Box3Helper",
        this.box = A,
        e = e || 16776960;
        var t = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7])
          , i = new he;
        i.setIndex(new YA(t,1)),
        i.setAttribute("position", new Ae([1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1],3)),
        jo.call(this, i, new ko({
            color: e,
            toneMapped: !1
        })),
        this.geometry.computeBoundingSphere()
    }
    function ml(A, e, t) {
        this.type = "PlaneHelper",
        this.plane = A,
        this.size = void 0 === e ? 1 : e;
        var i = void 0 !== t ? t : 16776960
          , o = new he;
        o.setAttribute("position", new Ae([1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0],3)),
        o.computeBoundingSphere(),
        Go.call(this, o, new ko({
            color: i,
            toneMapped: !1
        }));
        var n = new he;
        n.setAttribute("position", new Ae([1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1],3)),
        n.computeBoundingSphere(),
        this.add(new Ue(n,new jA({
            color: i,
            opacity: .2,
            transparent: !0,
            depthWrite: !1,
            toneMapped: !1
        })))
    }
    (ul.prototype = Object.create(jo.prototype)).constructor = ul,
    ul.prototype.update = function(A) {
        if (void 0 !== A && console.warn("THREE.BoxHelper: .update() has no longer arguments."),
        void 0 !== this.object && gl.setFromObject(this.object),
        !gl.isEmpty()) {
            var e = gl.min
              , t = gl.max
              , i = this.geometry.attributes.position
              , o = i.array;
            o[0] = t.x,
            o[1] = t.y,
            o[2] = t.z,
            o[3] = e.x,
            o[4] = t.y,
            o[5] = t.z,
            o[6] = e.x,
            o[7] = e.y,
            o[8] = t.z,
            o[9] = t.x,
            o[10] = e.y,
            o[11] = t.z,
            o[12] = t.x,
            o[13] = t.y,
            o[14] = e.z,
            o[15] = e.x,
            o[16] = t.y,
            o[17] = e.z,
            o[18] = e.x,
            o[19] = e.y,
            o[20] = e.z,
            o[21] = t.x,
            o[22] = e.y,
            o[23] = e.z,
            i.needsUpdate = !0,
            this.geometry.computeBoundingSphere()
        }
    }
    ,
    ul.prototype.setFromObject = function(A) {
        return this.object = A,
        this.update(),
        this
    }
    ,
    ul.prototype.copy = function(A) {
        return jo.prototype.copy.call(this, A),
        this.object = A.object,
        this
    }
    ,
    ul.prototype.clone = function() {
        return (new this.constructor).copy(this)
    }
    ,
    (fl.prototype = Object.create(jo.prototype)).constructor = fl,
    fl.prototype.updateMatrixWorld = function(A) {
        var e = this.box;
        e.isEmpty() || (e.getCenter(this.position),
        e.getSize(this.scale),
        this.scale.multiplyScalar(.5),
        H.prototype.updateMatrixWorld.call(this, A))
    }
    ,
    (ml.prototype = Object.create(Go.prototype)).constructor = ml,
    ml.prototype.updateMatrixWorld = function(A) {
        var e = -this.plane.constant;
        1e-8 > Math.abs(e) && (e = 1e-8),
        this.scale.set(.5 * this.size, .5 * this.size, e),
        this.children[0].material.side = 0 > e ? 1 : 0,
        this.lookAt(this.plane.normal),
        H.prototype.updateMatrixWorld.call(this, A)
    }
    ;
    var Cl, yl, vl = new y;
    function Il(A, e, t, i, o, n) {
        H.call(this),
        void 0 === A && (A = new y(0,0,1)),
        void 0 === e && (e = new y(0,0,0)),
        void 0 === t && (t = 1),
        void 0 === i && (i = 16776960),
        void 0 === o && (o = .2 * t),
        void 0 === n && (n = .2 * o),
        void 0 === Cl && ((Cl = new he).setAttribute("position", new Ae([0, 0, 0, 0, 1, 0],3)),
        (yl = new hr(0,.5,1,5,1)).translate(0, -.5, 0)),
        this.position.copy(e),
        this.line = new Go(Cl,new ko({
            color: i,
            toneMapped: !1
        })),
        this.line.matrixAutoUpdate = !1,
        this.add(this.line),
        this.cone = new Ue(yl,new jA({
            color: i,
            toneMapped: !1
        })),
        this.cone.matrixAutoUpdate = !1,
        this.add(this.cone),
        this.setDirection(A),
        this.setLength(t, o, n)
    }
    function El(A) {
        var e = [0, 0, 0, A = A || 1, 0, 0, 0, 0, 0, 0, A, 0, 0, 0, 0, 0, 0, A]
          , t = new he;
        t.setAttribute("position", new Ae(e,3)),
        t.setAttribute("color", new Ae([1, 0, 0, 1, .6, 0, 0, 1, 0, .6, 1, 0, 0, 0, 1, 0, .6, 1],3));
        var i = new ko({
            vertexColors: !0,
            toneMapped: !1
        });
        jo.call(this, t, i)
    }
    (Il.prototype = Object.create(H.prototype)).constructor = Il,
    Il.prototype.setDirection = function(A) {
        if (A.y > .99999)
            this.quaternion.set(0, 0, 0, 1);
        else if (-.99999 > A.y)
            this.quaternion.set(1, 0, 0, 0);
        else {
            vl.set(A.z, 0, -A.x).normalize();
            var e = Math.acos(A.y);
            this.quaternion.setFromAxisAngle(vl, e)
        }
    }
    ,
    Il.prototype.setLength = function(A, e, t) {
        void 0 === e && (e = .2 * A),
        void 0 === t && (t = .2 * e),
        this.line.scale.set(1, Math.max(1e-4, A - e), 1),
        this.line.updateMatrix(),
        this.cone.scale.set(t, e, t),
        this.cone.position.y = A,
        this.cone.updateMatrix()
    }
    ,
    Il.prototype.setColor = function(A) {
        this.line.material.color.set(A),
        this.cone.material.color.set(A)
    }
    ,
    Il.prototype.copy = function(A) {
        return H.prototype.copy.call(this, A, !1),
        this.line.copy(A.line),
        this.cone.copy(A.cone),
        this
    }
    ,
    Il.prototype.clone = function() {
        return (new this.constructor).copy(this)
    }
    ,
    (El.prototype = Object.create(jo.prototype)).constructor = El;
    var Bl, xl, Sl, wl, Ml = Math.pow(2, 8), bl = [.125, .215, .35, .446, .526, .582], Ul = 5 + bl.length, Fl = {
        3e3: 0,
        3001: 1,
        3002: 2,
        3004: 3,
        3005: 4,
        3006: 5,
        3007: 6
    }, Kl = new Ka, Ql = (Bl = 20,
    xl = new Float32Array(Bl),
    Sl = new y(0,1,0),
    (wl = new Cr({
        defines: {
            n: Bl
        },
        uniforms: {
            envMap: {
                value: null
            },
            samples: {
                value: 1
            },
            weights: {
                value: xl
            },
            latitudinal: {
                value: !1
            },
            dTheta: {
                value: 0
            },
            mipInt: {
                value: 0
            },
            poleAxis: {
                value: Sl
            },
            inputEncoding: {
                value: Fl[3e3]
            },
            outputEncoding: {
                value: Fl[3e3]
            }
        },
        vertexShader: ec(),
        fragmentShader: `\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n\n${tc()}\n\n#define ENVMAP_TYPE_CUBE_UV\n#include <cube_uv_reflection_fragment>\n\nvec3 getSample(float theta, vec3 axis) {\n\tfloat cosTheta = cos(theta);\n\t// Rodrigues' axis-angle rotation\n\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t+ cross(axis, vOutputDirection) * sin(theta)\n\t\t+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n\treturn bilinearCubeUV(envMap, sampleDirection, mipInt);\n}\n\nvoid main() {\n\tvec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n\tif (all(equal(axis, vec3(0.0))))\n\t\taxis = vec3(vOutputDirection.z, 0.0, - vOutputDirection.x);\n\taxis = normalize(axis);\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb += weights[0] * getSample(0.0, axis);\n\tfor (int i = 1; i < n; i++) {\n\t\tif (i >= samples)\n\t\t\tbreak;\n\t\tfloat theta = dTheta * float(i);\n\t\tgl_FragColor.rgb += weights[i] * getSample(-1.0 * theta, axis);\n\t\tgl_FragColor.rgb += weights[i] * getSample(theta, axis);\n\t}\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,
        blending: 0,
        depthTest: !1,
        depthWrite: !1
    })).type = "SphericalGaussianBlur",
    wl), Rl = null, Tl = null, {_lodPlanes: kl, _sizeLods: Dl, _sigmas: Ll} = function() {
        for (var A = [], e = [], t = [], i = 8, o = 0; Ul > o; o++) {
            var n = Math.pow(2, i);
            e.push(n);
            var r = 1 / n;
            o > 4 ? r = bl[o - 8 + 4 - 1] : 0 == o && (r = 0),
            t.push(r);
            for (var a = 1 / (n - 1), s = -a / 2, l = 1 + a / 2, c = [s, s, l, s, l, l, s, s, l, l, s, l], h = new Float32Array(108), d = new Float32Array(72), p = new Float32Array(36), g = 0; 6 > g; g++) {
                var u = g % 3 * 2 / 3 - 1
                  , f = g > 2 ? 0 : -1;
                h.set([u, f, 0, u + 2 / 3, f, 0, u + 2 / 3, f + 1, 0, u, f, 0, u + 2 / 3, f + 1, 0, u, f + 1, 0], 18 * g),
                d.set(c, 12 * g),
                p.set([g, g, g, g, g, g], 6 * g)
            }
            var m = new he;
            m.setAttribute("position", new YA(h,3)),
            m.setAttribute("uv", new YA(d,2)),
            m.setAttribute("faceIndex", new YA(p,1)),
            A.push(m),
            i > 4 && i--
        }
        return {
            _lodPlanes: A,
            _sizeLods: e,
            _sigmas: t
        }
    }(), Nl = null, Ol = null, Vl = null, Gl = (1 + Math.sqrt(5)) / 2, Pl = 1 / Gl, ql = [new y(1,1,1), new y(-1,1,1), new y(1,1,-1), new y(-1,1,-1), new y(0,Gl,Pl), new y(0,Gl,-Pl), new y(Pl,0,Gl), new y(-Pl,0,Gl), new y(Gl,Pl,0), new y(-Gl,Pl,0)];
    function jl(A) {
        Ol = A,
        Wl(Ql)
    }
    function Hl(A) {
        var e = {
            magFilter: 1003,
            minFilter: 1003,
            generateMipmaps: !1,
            type: A ? A.type : 1009,
            format: A ? A.format : 1023,
            encoding: A ? A.encoding : 3002,
            depthBuffer: !1,
            stencilBuffer: !1
        }
          , t = Jl(e);
        return t.depthBuffer = !A,
        Nl = Jl(e),
        t
    }
    function Yl(A) {
        Nl.dispose(),
        Ol.setRenderTarget(Vl),
        A.scissorTest = !1,
        A.setSize(A.width, A.height)
    }
    function Wl(A) {
        var e = new Y;
        e.add(new Ue(kl[0],A)),
        Ol.compile(e, Kl)
    }
    function Jl(A) {
        var e = new g(3 * Ml,3 * Ml,A);
        return e.texture.mapping = 306,
        e.texture.name = "PMREM.cubeUv",
        e.scissorTest = !0,
        e
    }
    function zl(A, e, t, i, o) {
        A.viewport.set(e, t, i, o),
        A.scissor.set(e, t, i, o)
    }
    function Zl(A) {
        var e = Ol.autoClear;
        Ol.autoClear = !1;
        for (var t = 1; Ul > t; t++) {
            Xl(A, t - 1, t, Math.sqrt(Ll[t] * Ll[t] - Ll[t - 1] * Ll[t - 1]), ql[(t - 1) % ql.length])
        }
        Ol.autoClear = e
    }
    function Xl(A, e, t, i, o) {
        _l(A, Nl, e, t, i, "latitudinal", o),
        _l(Nl, A, t, t, i, "longitudinal", o)
    }
    function _l(A, e, t, i, o, n, r) {
        "latitudinal" !== n && "longitudinal" !== n && console.error("blur direction must be either latitudinal or longitudinal!");
        var a = new Y;
        a.add(new Ue(kl[i],Ql));
        var s = Ql.uniforms
          , l = Dl[t] - 1
          , c = isFinite(o) ? Math.PI / (2 * l) : 2 * Math.PI / 39
          , h = o / c
          , d = isFinite(o) ? 1 + Math.floor(3 * h) : 20;
        d > 20 && console.warn(`sigmaRadians, ${o}, is too large and will clip, as it requested ${d} samples when the maximum is set to 20`);
        for (var p = [], g = 0, u = 0; 20 > u; ++u) {
            var f = u / h
              , m = Math.exp(-f * f / 2);
            p.push(m),
            0 == u ? g += m : d > u && (g += 2 * m)
        }
        for (u = 0; p.length > u; u++)
            p[u] = p[u] / g;
        s.envMap.value = A.texture,
        s.samples.value = d,
        s.weights.value = p,
        s.latitudinal.value = "latitudinal" === n,
        r && (s.poleAxis.value = r),
        s.dTheta.value = c,
        s.mipInt.value = 8 - t,
        s.inputEncoding.value = Fl[A.texture.encoding],
        s.outputEncoding.value = Fl[A.texture.encoding];
        var C = Dl[i];
        zl(e, f = 3 * Math.max(0, Ml - 2 * C), (0 === i ? 0 : 2 * Ml) + 2 * C * (i > 4 ? i - 8 + 4 : 0), 3 * C, 2 * C),
        Ol.setRenderTarget(e),
        Ol.render(a, Kl)
    }
    function $l() {
        var A = new Cr({
            uniforms: {
                envMap: {
                    value: null
                },
                texelSize: {
                    value: new s(1,1)
                },
                inputEncoding: {
                    value: Fl[3e3]
                },
                outputEncoding: {
                    value: Fl[3e3]
                }
            },
            vertexShader: ec(),
            fragmentShader: `\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform vec2 texelSize;\n\n${tc()}\n\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tvec3 outputDirection = normalize(vOutputDirection);\n\tvec2 uv;\n\tuv.y = asin(clamp(outputDirection.y, -1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n\tuv.x = atan(outputDirection.z, outputDirection.x) * RECIPROCAL_PI2 + 0.5;\n\tvec2 f = fract(uv / texelSize - 0.5);\n\tuv -= f * texelSize;\n\tvec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x += texelSize.x;\n\tvec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.y += texelSize.y;\n\tvec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x -= texelSize.x;\n\tvec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tvec3 tm = mix(tl, tr, f.x);\n\tvec3 bm = mix(bl, br, f.x);\n\tgl_FragColor.rgb = mix(tm, bm, f.y);\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,
            blending: 0,
            depthTest: !1,
            depthWrite: !1
        });
        return A.type = "EquirectangularToCubeUV",
        A
    }
    function Ac() {
        var A = new Cr({
            uniforms: {
                envMap: {
                    value: null
                },
                inputEncoding: {
                    value: Fl[3e3]
                },
                outputEncoding: {
                    value: Fl[3e3]
                }
            },
            vertexShader: ec(),
            fragmentShader: `\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n${tc()}\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t`,
            blending: 0,
            depthTest: !1,
            depthWrite: !1
        });
        return A.type = "CubemapToCubeUV",
        A
    }
    function ec() {
        return "\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.x *= -1.0;\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.y *= -1.0;\n\t} else if (face == 5.0) {\n\t\tdirection.xz *= -1.0;\n\t}\n\treturn direction;\n}\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t"
    }
    function tc() {
        return "\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include <encodings_pars_fragment>\n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t"
    }
    jl.prototype = {
        constructor: jl,
        fromScene: function(A, e=0, t=.1, i=100) {
            Vl = Ol.getRenderTarget();
            var o = Hl();
            return function(A, e, t, i) {
                var o = new je(90,1,e,t)
                  , n = [1, 1, 1, 1, -1, 1]
                  , r = [1, 1, -1, -1, -1, 1]
                  , a = Ol.outputEncoding
                  , s = Ol.toneMapping
                  , l = Ol.toneMappingExposure
                  , c = Ol.getClearColor()
                  , h = Ol.getClearAlpha();
                Ol.toneMapping = 1,
                Ol.toneMappingExposure = 1,
                Ol.outputEncoding = 3e3,
                A.scale.z *= -1;
                var d = A.background;
                if (d && d.isColor) {
                    d.convertSRGBToLinear();
                    var p = Math.max(d.r, d.g, d.b)
                      , g = Math.min(Math.max(Math.ceil(Math.log2(p)), -128), 127);
                    d = d.multiplyScalar(Math.pow(2, -g)),
                    Ol.setClearColor(d, (g + 128) / 255),
                    A.background = null
                }
                for (var u = 0; 6 > u; u++) {
                    var f = u % 3;
                    0 == f ? (o.up.set(0, n[u], 0),
                    o.lookAt(r[u], 0, 0)) : 1 == f ? (o.up.set(0, 0, n[u]),
                    o.lookAt(0, r[u], 0)) : (o.up.set(0, n[u], 0),
                    o.lookAt(0, 0, r[u])),
                    zl(i, f * Ml, u > 2 ? Ml : 0, Ml, Ml),
                    Ol.setRenderTarget(i),
                    Ol.render(A, o)
                }
                Ol.toneMapping = s,
                Ol.toneMappingExposure = l,
                Ol.outputEncoding = a,
                Ol.setClearColor(c, h),
                A.scale.z *= -1
            }(A, t, i, o),
            e > 0 && Xl(o, 0, 0, e),
            Zl(o),
            Yl(o),
            o
        },
        fromEquirectangular: function(A) {
            return A.magFilter = 1003,
            A.minFilter = 1003,
            A.generateMipmaps = !1,
            this.fromCubemap(A)
        },
        fromCubemap: function(A) {
            Vl = Ol.getRenderTarget();
            var e = Hl(A);
            return function(A, e) {
                var t = new Y;
                A.isCubeTexture ? null == Tl && (Tl = Ac()) : null == Rl && (Rl = $l());
                var i = A.isCubeTexture ? Tl : Rl;
                t.add(new Ue(kl[0],i));
                var o = i.uniforms;
                o.envMap.value = A,
                A.isCubeTexture || o.texelSize.value.set(1 / A.image.width, 1 / A.image.height);
                o.inputEncoding.value = Fl[A.encoding],
                o.outputEncoding.value = Fl[A.encoding],
                zl(e, 0, 0, 3 * Ml, 2 * Ml),
                Ol.setRenderTarget(e),
                Ol.render(t, Kl)
            }(A, e),
            Zl(e),
            Yl(e),
            e
        },
        compileCubemapShader: function() {
            null == Tl && Wl(Tl = Ac())
        },
        compileEquirectangularShader: function() {
            null == Rl && Wl(Rl = $l())
        },
        dispose: function() {
            Ql.dispose(),
            null != Tl && Tl.dispose(),
            null != Rl && Rl.dispose();
            for (var A = 0; kl.length > A; A++)
                kl[A].dispose()
        }
    };
    function ic(A) {
        console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),
        la.call(this, A),
        this.type = "catmullrom",
        this.closed = !0
    }
    function oc(A) {
        console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),
        la.call(this, A),
        this.type = "catmullrom"
    }
    function nc(A) {
        console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),
        la.call(this, A),
        this.type = "catmullrom"
    }
    ea.create = function(A, e) {
        return console.log("THREE.Curve.create() has been deprecated"),
        A.prototype = Object.create(ea.prototype),
        A.prototype.constructor = A,
        A.prototype.getPoint = e,
        A
    }
    ,
    Object.assign(Ia.prototype, {
        createPointsGeometry: function(A) {
            console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");
            var e = this.getPoints(A);
            return this.createGeometry(e)
        },
        createSpacedPointsGeometry: function(A) {
            console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");
            var e = this.getSpacedPoints(A);
            return this.createGeometry(e)
        },
        createGeometry: function(A) {
            console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");
            for (var e = new De, t = 0, i = A.length; i > t; t++) {
                var o = A[t];
                e.vertices.push(new y(o.x,o.y,o.z || 0))
            }
            return e
        }
    }),
    Object.assign(Ea.prototype, {
        fromPoints: function(A) {
            return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),
            this.setFromPoints(A)
        }
    }),
    ic.prototype = Object.create(la.prototype),
    oc.prototype = Object.create(la.prototype),
    nc.prototype = Object.create(la.prototype),
    Object.assign(nc.prototype, {
        initFromArray: function() {
            console.error("THREE.Spline: .initFromArray() has been removed.")
        },
        getControlPointsArray: function() {
            console.error("THREE.Spline: .getControlPointsArray() has been removed.")
        },
        reparametrizeByArcLength: function() {
            console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")
        }
    }),
    ol.prototype.setColors = function() {
        console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")
    }
    ,
    _s.prototype.update = function() {
        console.error("THREE.SkeletonHelper: update() no longer needs to be called.")
    }
    ,
    Object.assign(Yr.prototype, {
        extractUrlBase: function(A) {
            return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),
            La.extractUrlBase(A)
        }
    }),
    Yr.Handlers = {
        add: function() {
            console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")
        },
        get: function() {
            console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")
        }
    },
    Object.assign(Pa.prototype, {
        setTexturePath: function(A) {
            return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),
            this.setResourcePath(A)
        }
    }),
    Object.assign(Ps.prototype, {
        center: function(A) {
            return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),
            this.getCenter(A)
        },
        empty: function() {
            return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),
            this.isEmpty()
        },
        isIntersectionBox: function(A) {
            return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),
            this.intersectsBox(A)
        },
        size: function(A) {
            return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),
            this.getSize(A)
        }
    }),
    Object.assign(aA.prototype, {
        center: function(A) {
            return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),
            this.getCenter(A)
        },
        empty: function() {
            return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),
            this.isEmpty()
        },
        isIntersectionBox: function(A) {
            return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),
            this.intersectsBox(A)
        },
        isIntersectionSphere: function(A) {
            return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),
            this.intersectsSphere(A)
        },
        size: function(A) {
            return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),
            this.getSize(A)
        }
    }),
    Ze.prototype.setFromMatrix = function(A) {
        return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),
        this.setFromProjectionMatrix(A)
    }
    ,
    Hs.prototype.center = function(A) {
        return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),
        this.getCenter(A)
    }
    ,
    Object.assign(a, {
        random16: function() {
            return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),
            Math.random()
        },
        nearestPowerOfTwo: function(A) {
            return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),
            a.floorPowerOfTwo(A)
        },
        nextPowerOfTwo: function(A) {
            return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),
            a.ceilPowerOfTwo(A)
        }
    }),
    Object.assign(l.prototype, {
        flattenToArrayOffset: function(A, e) {
            return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),
            this.toArray(A, e)
        },
        multiplyVector3: function(A) {
            return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),
            A.applyMatrix3(this)
        },
        multiplyVector3Array: function() {
            console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")
        },
        applyToBufferAttribute: function(A) {
            return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),
            A.applyMatrix3(this)
        },
        applyToVector3Array: function() {
            console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")
        }
    }),
    Object.assign(M.prototype, {
        extractPosition: function(A) {
            return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),
            this.copyPosition(A)
        },
        flattenToArrayOffset: function(A, e) {
            return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),
            this.toArray(A, e)
        },
        getPosition: function() {
            return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),
            (new y).setFromMatrixColumn(this, 3)
        },
        setRotationFromQuaternion: function(A) {
            return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),
            this.makeRotationFromQuaternion(A)
        },
        multiplyToArray: function() {
            console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")
        },
        multiplyVector3: function(A) {
            return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),
            A.applyMatrix4(this)
        },
        multiplyVector4: function(A) {
            return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),
            A.applyMatrix4(this)
        },
        multiplyVector3Array: function() {
            console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")
        },
        rotateAxis: function(A) {
            console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),
            A.transformDirection(this)
        },
        crossVector: function(A) {
            return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),
            A.applyMatrix4(this)
        },
        translate: function() {
            console.error("THREE.Matrix4: .translate() has been removed.")
        },
        rotateX: function() {
            console.error("THREE.Matrix4: .rotateX() has been removed.")
        },
        rotateY: function() {
            console.error("THREE.Matrix4: .rotateY() has been removed.")
        },
        rotateZ: function() {
            console.error("THREE.Matrix4: .rotateZ() has been removed.")
        },
        rotateByAxis: function() {
            console.error("THREE.Matrix4: .rotateByAxis() has been removed.")
        },
        applyToBufferAttribute: function(A) {
            return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),
            A.applyMatrix4(this)
        },
        applyToVector3Array: function() {
            console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")
        },
        makeFrustum: function(A, e, t, i, o, n) {
            return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),
            this.makePerspective(A, e, i, t, o, n)
        }
    }),
    EA.prototype.isIntersectionLine = function(A) {
        return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),
        this.intersectsLine(A)
    }
    ,
    f.prototype.multiplyVector3 = function(A) {
        return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),
        A.applyQuaternion(this)
    }
    ,
    Object.assign(CA.prototype, {
        isIntersectionBox: function(A) {
            return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),
            this.intersectsBox(A)
        },
        isIntersectionPlane: function(A) {
            return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),
            this.intersectsPlane(A)
        },
        isIntersectionSphere: function(A) {
            return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),
            this.intersectsSphere(A)
        }
    }),
    Object.assign(RA.prototype, {
        area: function() {
            return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),
            this.getArea()
        },
        barycoordFromPoint: function(A, e) {
            return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),
            this.getBarycoord(A, e)
        },
        midpoint: function(A) {
            return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),
            this.getMidpoint(A)
        },
        normal: function(A) {
            return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),
            this.getNormal(A)
        },
        plane: function(A) {
            return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),
            this.getPlane(A)
        }
    }),
    Object.assign(RA, {
        barycoordFromPoint: function(A, e, t, i, o) {
            return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),
            RA.getBarycoord(A, e, t, i, o)
        },
        normal: function(A, e, t, i) {
            return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),
            RA.getNormal(A, e, t, i)
        }
    }),
    Object.assign(Ba.prototype, {
        extractAllPoints: function(A) {
            return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),
            this.extractPoints(A)
        },
        extrude: function(A) {
            return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),
            new Jn(this,A)
        },
        makeGeometry: function(A) {
            return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),
            new rr(this,A)
        }
    }),
    Object.assign(s.prototype, {
        fromAttribute: function(A, e, t) {
            return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),
            this.fromBufferAttribute(A, e, t)
        },
        distanceToManhattan: function(A) {
            return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),
            this.manhattanDistanceTo(A)
        },
        lengthManhattan: function() {
            return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),
            this.manhattanLength()
        }
    }),
    Object.assign(y.prototype, {
        setEulerFromRotationMatrix: function() {
            console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")
        },
        setEulerFromQuaternion: function() {
            console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")
        },
        getPositionFromMatrix: function(A) {
            return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),
            this.setFromMatrixPosition(A)
        },
        getScaleFromMatrix: function(A) {
            return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),
            this.setFromMatrixScale(A)
        },
        getColumnFromMatrix: function(A, e) {
            return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),
            this.setFromMatrixColumn(e, A)
        },
        applyProjection: function(A) {
            return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),
            this.applyMatrix4(A)
        },
        fromAttribute: function(A, e, t) {
            return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),
            this.fromBufferAttribute(A, e, t)
        },
        distanceToManhattan: function(A) {
            return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),
            this.manhattanDistanceTo(A)
        },
        lengthManhattan: function() {
            return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),
            this.manhattanLength()
        }
    }),
    Object.assign(p.prototype, {
        fromAttribute: function(A, e, t) {
            return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),
            this.fromBufferAttribute(A, e, t)
        },
        lengthManhattan: function() {
            return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),
            this.manhattanLength()
        }
    }),
    Object.assign(De.prototype, {
        computeTangents: function() {
            console.error("THREE.Geometry: .computeTangents() has been removed.")
        },
        computeLineDistances: function() {
            console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")
        },
        applyMatrix: function(A) {
            return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),
            this.applyMatrix4(A)
        }
    }),
    Object.assign(H.prototype, {
        getChildByName: function(A) {
            return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),
            this.getObjectByName(A)
        },
        renderDepth: function() {
            console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")
        },
        translate: function(A, e) {
            return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),
            this.translateOnAxis(e, A)
        },
        getWorldRotation: function() {
            console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")
        },
        applyMatrix: function(A) {
            return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),
            this.applyMatrix4(A)
        }
    }),
    Object.defineProperties(H.prototype, {
        eulerOrder: {
            get: function() {
                return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),
                this.rotation.order
            },
            set: function(A) {
                console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),
                this.rotation.order = A
            }
        },
        useQuaternion: {
            get: function() {
                console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")
            },
            set: function() {
                console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")
            }
        }
    }),
    Object.assign(Ue.prototype, {
        setDrawMode: function() {
            console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")
        }
    }),
    Object.defineProperties(Ue.prototype, {
        drawMode: {
            get: function() {
                return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),
                0
            },
            set: function() {
                console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")
            }
        }
    }),
    Object.defineProperties(xo.prototype, {
        objects: {
            get: function() {
                return console.warn("THREE.LOD: .objects has been renamed to .levels."),
                this.levels
            }
        }
    }),
    Object.defineProperty(bo.prototype, "useVertexTexture", {
        get: function() {
            console.warn("THREE.Skeleton: useVertexTexture has been removed.")
        },
        set: function() {
            console.warn("THREE.Skeleton: useVertexTexture has been removed.")
        }
    }),
    So.prototype.initBones = function() {
        console.error("THREE.SkinnedMesh: initBones() has been removed.")
    }
    ,
    Object.defineProperty(ea.prototype, "__arcLengthDivisions", {
        get: function() {
            return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),
            this.arcLengthDivisions
        },
        set: function(A) {
            console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),
            this.arcLengthDivisions = A
        }
    }),
    je.prototype.setLens = function(A, e) {
        console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),
        void 0 !== e && (this.filmGauge = e),
        this.setFocalLength(A)
    }
    ,
    Object.defineProperties(xa.prototype, {
        onlyShadow: {
            set: function() {
                console.warn("THREE.Light: .onlyShadow has been removed.")
            }
        },
        shadowCameraFov: {
            set: function(A) {
                console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),
                this.shadow.camera.fov = A
            }
        },
        shadowCameraLeft: {
            set: function(A) {
                console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),
                this.shadow.camera.left = A
            }
        },
        shadowCameraRight: {
            set: function(A) {
                console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),
                this.shadow.camera.right = A
            }
        },
        shadowCameraTop: {
            set: function(A) {
                console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),
                this.shadow.camera.top = A
            }
        },
        shadowCameraBottom: {
            set: function(A) {
                console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),
                this.shadow.camera.bottom = A
            }
        },
        shadowCameraNear: {
            set: function(A) {
                console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),
                this.shadow.camera.near = A
            }
        },
        shadowCameraFar: {
            set: function(A) {
                console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),
                this.shadow.camera.far = A
            }
        },
        shadowCameraVisible: {
            set: function() {
                console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")
            }
        },
        shadowBias: {
            set: function(A) {
                console.warn("THREE.Light: .shadowBias is now .shadow.bias."),
                this.shadow.bias = A
            }
        },
        shadowDarkness: {
            set: function() {
                console.warn("THREE.Light: .shadowDarkness has been removed.")
            }
        },
        shadowMapWidth: {
            set: function(A) {
                console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),
                this.shadow.mapSize.width = A
            }
        },
        shadowMapHeight: {
            set: function(A) {
                console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),
                this.shadow.mapSize.height = A
            }
        }
    }),
    Object.defineProperties(YA.prototype, {
        length: {
            get: function() {
                return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),
                this.array.length
            }
        },
        dynamic: {
            get: function() {
                return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),
                35048 === this.usage
            },
            set: function() {
                console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),
                this.setUsage(35048)
            }
        }
    }),
    Object.assign(YA.prototype, {
        setDynamic: function(A) {
            return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),
            this.setUsage(!0 === A ? 35048 : 35044),
            this
        },
        copyIndicesArray: function() {
            console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")
        },
        setArray: function() {
            console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")
        }
    }),
    Object.assign(he.prototype, {
        addIndex: function(A) {
            console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),
            this.setIndex(A)
        },
        addAttribute: function(A, e) {
            return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),
            e && e.isBufferAttribute || e && e.isInterleavedBufferAttribute ? "index" === A ? (console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),
            this.setIndex(e),
            this) : this.setAttribute(A, e) : (console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),
            this.setAttribute(A, new YA(arguments[1],arguments[2])))
        },
        addDrawCall: function(A, e, t) {
            void 0 !== t && console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),
            console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),
            this.addGroup(A, e)
        },
        clearDrawCalls: function() {
            console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),
            this.clearGroups()
        },
        computeTangents: function() {
            console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")
        },
        computeOffsets: function() {
            console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")
        },
        removeAttribute: function(A) {
            return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),
            this.deleteAttribute(A)
        },
        applyMatrix: function(A) {
            return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),
            this.applyMatrix4(A)
        }
    }),
    Object.defineProperties(he.prototype, {
        drawcalls: {
            get: function() {
                return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),
                this.groups
            }
        },
        offsets: {
            get: function() {
                return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),
                this.groups
            }
        }
    }),
    Object.defineProperties(Ds.prototype, {
        linePrecision: {
            get: function() {
                return console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),
                this.params.Line.threshold
            },
            set: function(A) {
                console.warn("THREE.Raycaster: .linePrecision has been deprecated. Use .params.Line.threshold instead."),
                this.params.Line.threshold = A
            }
        }
    }),
    Object.defineProperties(to.prototype, {
        dynamic: {
            get: function() {
                return console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),
                35048 === this.usage
            },
            set: function(A) {
                console.warn("THREE.InterleavedBuffer: .length has been deprecated. Use .usage instead."),
                this.setUsage(A)
            }
        }
    }),
    Object.assign(to.prototype, {
        setDynamic: function(A) {
            return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),
            this.setUsage(!0 === A ? 35048 : 35044),
            this
        },
        setArray: function() {
            console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")
        }
    }),
    Object.assign(zn.prototype, {
        getArrays: function() {
            console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")
        },
        addShapeList: function() {
            console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")
        },
        addShape: function() {
            console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")
        }
    }),
    Object.defineProperties(Ts.prototype, {
        dynamic: {
            set: function() {
                console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")
            }
        },
        onUpdate: {
            value: function() {
                return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),
                this
            }
        }
    }),
    Object.defineProperties(qA.prototype, {
        wrapAround: {
            get: function() {
                console.warn("THREE.Material: .wrapAround has been removed.")
            },
            set: function() {
                console.warn("THREE.Material: .wrapAround has been removed.")
            }
        },
        overdraw: {
            get: function() {
                console.warn("THREE.Material: .overdraw has been removed.")
            },
            set: function() {
                console.warn("THREE.Material: .overdraw has been removed.")
            }
        },
        wrapRGB: {
            get: function() {
                return console.warn("THREE.Material: .wrapRGB has been removed."),
                new LA
            }
        },
        shading: {
            get: function() {
                console.error("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead.")
            },
            set: function(A) {
                console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead."),
                this.flatShading = 1 === A
            }
        },
        stencilMask: {
            get: function() {
                return console.warn("THREE." + this.type + ": .stencilMask has been removed. Use .stencilFuncMask instead."),
                this.stencilFuncMask
            },
            set: function(A) {
                console.warn("THREE." + this.type + ": .stencilMask has been removed. Use .stencilFuncMask instead."),
                this.stencilFuncMask = A
            }
        }
    }),
    Object.defineProperties(Ir.prototype, {
        metal: {
            get: function() {
                return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),
                !1
            },
            set: function() {
                console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")
            }
        }
    }),
    Object.defineProperties(Pe.prototype, {
        derivatives: {
            get: function() {
                return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),
                this.extensions.derivatives
            },
            set: function(A) {
                console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),
                this.extensions.derivatives = A
            }
        }
    }),
    Object.assign($i.prototype, {
        clearTarget: function(A, e, t, i) {
            console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),
            this.setRenderTarget(A),
            this.clear(e, t, i)
        },
        animate: function(A) {
            console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),
            this.setAnimationLoop(A)
        },
        getCurrentRenderTarget: function() {
            return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),
            this.getRenderTarget()
        },
        getMaxAnisotropy: function() {
            return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),
            this.capabilities.getMaxAnisotropy()
        },
        getPrecision: function() {
            return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),
            this.capabilities.precision
        },
        resetGLState: function() {
            return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),
            this.state.reset()
        },
        supportsFloatTextures: function() {
            return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),
            this.extensions.get("OES_texture_float")
        },
        supportsHalfFloatTextures: function() {
            return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),
            this.extensions.get("OES_texture_half_float")
        },
        supportsStandardDerivatives: function() {
            return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),
            this.extensions.get("OES_standard_derivatives")
        },
        supportsCompressedTextureS3TC: function() {
            return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),
            this.extensions.get("WEBGL_compressed_texture_s3tc")
        },
        supportsCompressedTexturePVRTC: function() {
            return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),
            this.extensions.get("WEBGL_compressed_texture_pvrtc")
        },
        supportsBlendMinMax: function() {
            return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),
            this.extensions.get("EXT_blend_minmax")
        },
        supportsVertexTextures: function() {
            return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),
            this.capabilities.vertexTextures
        },
        supportsInstancedArrays: function() {
            return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),
            this.extensions.get("ANGLE_instanced_arrays")
        },
        enableScissorTest: function(A) {
            console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),
            this.setScissorTest(A)
        },
        initMaterial: function() {
            console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")
        },
        addPrePlugin: function() {
            console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")
        },
        addPostPlugin: function() {
            console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")
        },
        updateShadowMap: function() {
            console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")
        },
        setFaceCulling: function() {
            console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")
        },
        allocTextureUnit: function() {
            console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")
        },
        setTexture: function() {
            console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")
        },
        setTexture2D: function() {
            console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")
        },
        setTextureCube: function() {
            console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")
        },
        getActiveMipMapLevel: function() {
            return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),
            this.getActiveMipmapLevel()
        }
    }),
    Object.defineProperties($i.prototype, {
        shadowMapEnabled: {
            get: function() {
                return this.shadowMap.enabled
            },
            set: function(A) {
                console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),
                this.shadowMap.enabled = A
            }
        },
        shadowMapType: {
            get: function() {
                return this.shadowMap.type
            },
            set: function(A) {
                console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),
                this.shadowMap.type = A
            }
        },
        shadowMapCullFace: {
            get: function() {
                console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")
            },
            set: function() {
                console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")
            }
        },
        context: {
            get: function() {
                return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),
                this.getContext()
            }
        },
        vr: {
            get: function() {
                return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),
                this.xr
            }
        },
        gammaInput: {
            get: function() {
                return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),
                !1
            },
            set: function() {
                console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")
            }
        },
        gammaOutput: {
            get: function() {
                return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),
                !1
            },
            set: function(A) {
                console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),
                this.outputEncoding = !0 === A ? 3001 : 3e3
            }
        }
    }),
    Object.defineProperties(Yi.prototype, {
        cullFace: {
            get: function() {
                console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")
            },
            set: function() {
                console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")
            }
        },
        renderReverseSided: {
            get: function() {
                console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")
            },
            set: function() {
                console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")
            }
        },
        renderSingleSided: {
            get: function() {
                console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")
            },
            set: function() {
                console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")
            }
        }
    }),
    Object.defineProperties(g.prototype, {
        wrapS: {
            get: function() {
                return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),
                this.texture.wrapS
            },
            set: function(A) {
                console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),
                this.texture.wrapS = A
            }
        },
        wrapT: {
            get: function() {
                return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),
                this.texture.wrapT
            },
            set: function(A) {
                console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),
                this.texture.wrapT = A
            }
        },
        magFilter: {
            get: function() {
                return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),
                this.texture.magFilter
            },
            set: function(A) {
                console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),
                this.texture.magFilter = A
            }
        },
        minFilter: {
            get: function() {
                return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),
                this.texture.minFilter
            },
            set: function(A) {
                console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),
                this.texture.minFilter = A
            }
        },
        anisotropy: {
            get: function() {
                return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),
                this.texture.anisotropy
            },
            set: function(A) {
                console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),
                this.texture.anisotropy = A
            }
        },
        offset: {
            get: function() {
                return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),
                this.texture.offset
            },
            set: function(A) {
                console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),
                this.texture.offset = A
            }
        },
        repeat: {
            get: function() {
                return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),
                this.texture.repeat
            },
            set: function(A) {
                console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),
                this.texture.repeat = A
            }
        },
        format: {
            get: function() {
                return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),
                this.texture.format
            },
            set: function(A) {
                console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),
                this.texture.format = A
            }
        },
        type: {
            get: function() {
                return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),
                this.texture.type
            },
            set: function(A) {
                console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),
                this.texture.type = A
            }
        },
        generateMipmaps: {
            get: function() {
                return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),
                this.texture.generateMipmaps
            },
            set: function(A) {
                console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),
                this.texture.generateMipmaps = A
            }
        }
    }),
    Object.defineProperties(ps.prototype, {
        load: {
            value: function(A) {
                console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");
                var e = this;
                return (new $a).load(A, (function(A) {
                    e.setBuffer(A)
                }
                )),
                this
            }
        },
        startTime: {
            set: function() {
                console.warn("THREE.Audio: .startTime is now .play( delay ).")
            }
        }
    }),
    ys.prototype.getData = function() {
        return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),
        this.getFrequencyData()
    }
    ,
    He.prototype.updateCubeMap = function(A, e) {
        return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),
        this.update(A, e)
    }
    ;
    var rc = {
        merge: function(A, e, t) {
            var i;
            console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead."),
            e.isMesh && (e.matrixAutoUpdate && e.updateMatrix(),
            i = e.matrix,
            e = e.geometry),
            A.merge(e, i, t)
        },
        center: function(A) {
            return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),
            A.center()
        }
    };
    c.crossOrigin = void 0,
    c.loadTexture = function(A, e, t, i) {
        console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");
        var o = new Aa;
        o.setCrossOrigin(this.crossOrigin);
        var n = o.load(A, t, void 0, i);
        return e && (n.mapping = e),
        n
    }
    ,
    c.loadTextureCube = function(A, e, t, i) {
        console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");
        var o = new $r;
        o.setCrossOrigin(this.crossOrigin);
        var n = o.load(A, t, void 0, i);
        return e && (n.mapping = e),
        n
    }
    ,
    c.loadCompressedTexture = function() {
        console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")
    }
    ,
    c.loadCompressedTextureCube = function() {
        console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")
    }
    ;
    var ac = {
        createMultiMaterialObject: function() {
            console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")
        },
        detach: function() {
            console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")
        },
        attach: function() {
            console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")
        }
    };
    "undefined" != typeof __THREE_DEVTOOLS__ && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{
        detail: {
            revision: "115"
        }
    }));
    var sc = Object.freeze({
        ACESFilmicToneMapping: 5,
        AddEquation: 100,
        AddOperation: 2,
        AdditiveBlending: 2,
        AlphaFormat: 1021,
        AlwaysDepth: 1,
        AlwaysStencilFunc: 519,
        AmbientLight: Ta,
        AmbientLightProbe: is,
        AnimationClip: Gr,
        AnimationLoader: zr,
        AnimationMixer: Rs,
        AnimationObjectGroup: Ks,
        AnimationUtils: br,
        ArcCurve: ia,
        ArrayCamera: Zi,
        ArrowHelper: Il,
        Audio: ps,
        AudioAnalyser: ys,
        AudioContext: _a,
        AudioListener: ds,
        AudioLoader: $a,
        AxesHelper: El,
        AxisHelper: function(A) {
            return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),
            new El(A)
        },
        BackSide: 1,
        BasicDepthPacking: 3200,
        BasicShadowMap: 0,
        BinaryTextureLoader: function(A) {
            return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),
            new Xr(A)
        },
        Bone: Uo,
        BooleanKeyframeTrack: Tr,
        BoundingBoxHelper: function(A, e) {
            return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),
            new ul(A,e)
        },
        Box2: Ps,
        Box3: aA,
        Box3Helper: fl,
        BoxBufferGeometry: Ne,
        BoxGeometry: Le,
        BoxHelper: ul,
        BufferAttribute: YA,
        BufferGeometry: he,
        BufferGeometryLoader: Va,
        ByteType: 1010,
        Cache: qr,
        Camera: qe,
        CameraHelper: dl,
        CanvasRenderer: function() {
            console.error("THREE.CanvasRenderer has been removed")
        },
        CanvasTexture: en,
        CatmullRomCurve3: la,
        CineonToneMapping: 4,
        CircleBufferGeometry: ur,
        CircleGeometry: gr,
        ClampToEdgeWrapping: 1001,
        Clock: as,
        ClosedSplineCurve3: ic,
        Color: LA,
        ColorKeyframeTrack: kr,
        CompressedTexture: An,
        CompressedTextureLoader: Zr,
        ConeBufferGeometry: pr,
        ConeGeometry: dr,
        CubeCamera: He,
        CubeGeometry: Le,
        CubeReflectionMapping: 301,
        CubeRefractionMapping: 302,
        CubeTexture: ut,
        CubeTextureLoader: $r,
        CubeUVReflectionMapping: 306,
        CubeUVRefractionMapping: 307,
        CubicBezierCurve: pa,
        CubicBezierCurve3: ga,
        CubicInterpolant: Fr,
        CullFaceBack: 1,
        CullFaceFront: 2,
        CullFaceFrontBack: 3,
        CullFaceNone: 0,
        Curve: ea,
        CurvePath: Ia,
        CustomBlending: 5,
        CylinderBufferGeometry: hr,
        CylinderGeometry: cr,
        Cylindrical: Vs,
        DataTexture: We,
        DataTexture2DArray: ft,
        DataTexture3D: mt,
        DataTextureLoader: Xr,
        DecrementStencilOp: 7683,
        DecrementWrapStencilOp: 34056,
        DefaultLoadingManager: Hr,
        DepthFormat: 1026,
        DepthStencilFormat: 1027,
        DepthTexture: tn,
        DirectionalLight: Ra,
        DirectionalLightHelper: ll,
        DirectionalLightShadow: Qa,
        DiscreteInterpolant: Qr,
        DodecahedronBufferGeometry: fn,
        DodecahedronGeometry: un,
        DoubleSide: 2,
        DstAlphaFactor: 206,
        DstColorFactor: 208,
        DynamicBufferAttribute: function(A, e) {
            return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),
            new YA(A,e).setUsage(35048)
        },
        DynamicCopyUsage: 35050,
        DynamicDrawUsage: 35048,
        DynamicReadUsage: 35049,
        EdgesGeometry: lr,
        EdgesHelper: function(A, e) {
            return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),
            new jo(new lr(A.geometry),new ko({
                color: void 0 !== e ? e : 16777215
            }))
        },
        EllipseCurve: ta,
        EqualDepth: 4,
        EqualStencilFunc: 514,
        EquirectangularReflectionMapping: 303,
        EquirectangularRefractionMapping: 304,
        Euler: F,
        EventDispatcher: i,
        ExtrudeBufferGeometry: zn,
        ExtrudeGeometry: Jn,
        Face3: GA,
        Face4: function(A, e, t, i, o, n, r) {
            return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),
            new GA(A,e,t,o,n,r)
        },
        FaceColors: 1,
        FileLoader: Jr,
        FlatShading: 1,
        Float32Attribute: function(A, e) {
            return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),
            new Ae(A,e)
        },
        Float32BufferAttribute: Ae,
        Float64Attribute: function(A, e) {
            return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),
            new ee(A,e)
        },
        Float64BufferAttribute: ee,
        FloatType: 1015,
        Fog: eo,
        FogExp2: Ao,
        Font: za,
        FontLoader: Xa,
        FrontFaceDirectionCCW: 1,
        FrontFaceDirectionCW: 0,
        FrontSide: 0,
        Frustum: Ze,
        GammaEncoding: 3007,
        Geometry: De,
        GeometryUtils: rc,
        GreaterDepth: 6,
        GreaterEqualDepth: 5,
        GreaterEqualStencilFunc: 518,
        GreaterStencilFunc: 516,
        GridHelper: ol,
        Group: Xi,
        HalfFloatType: 1016,
        HemisphereLight: Sa,
        HemisphereLightHelper: il,
        HemisphereLightProbe: ts,
        IcosahedronBufferGeometry: gn,
        IcosahedronGeometry: pn,
        ImageBitmapLoader: Wa,
        ImageLoader: _r,
        ImageUtils: c,
        ImmediateRenderObject: Ys,
        IncrementStencilOp: 7682,
        IncrementWrapStencilOp: 34055,
        InstancedBufferAttribute: Oa,
        InstancedBufferGeometry: Na,
        InstancedInterleavedBuffer: ks,
        InstancedMesh: To,
        Int16Attribute: function(A, e) {
            return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),
            new ZA(A,e)
        },
        Int16BufferAttribute: ZA,
        Int32Attribute: function(A, e) {
            return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),
            new _A(A,e)
        },
        Int32BufferAttribute: _A,
        Int8Attribute: function(A, e) {
            return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),
            new WA(A,e)
        },
        Int8BufferAttribute: WA,
        IntType: 1013,
        InterleavedBuffer: to,
        InterleavedBufferAttribute: no,
        Interpolant: Ur,
        InterpolateDiscrete: 2300,
        InterpolateLinear: 2301,
        InterpolateSmooth: 2302,
        InvertStencilOp: 5386,
        JSONLoader: function() {
            console.error("THREE.JSONLoader has been removed.")
        },
        KeepStencilOp: 7680,
        KeyframeTrack: Rr,
        LOD: xo,
        LatheBufferGeometry: nr,
        LatheGeometry: or,
        Layers: K,
        LensFlare: function() {
            console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")
        },
        LessDepth: 2,
        LessEqualDepth: 3,
        LessEqualStencilFunc: 515,
        LessStencilFunc: 513,
        Light: xa,
        LightProbe: es,
        LightShadow: wa,
        Line: Go,
        Line3: Hs,
        LineBasicMaterial: ko,
        LineCurve: ua,
        LineCurve3: fa,
        LineDashedMaterial: wr,
        LineLoop: Ho,
        LinePieces: 1,
        LineSegments: jo,
        LineStrip: 0,
        LinearEncoding: 3e3,
        LinearFilter: 1006,
        LinearInterpolant: Kr,
        LinearMipMapLinearFilter: 1008,
        LinearMipMapNearestFilter: 1007,
        LinearMipmapLinearFilter: 1008,
        LinearMipmapNearestFilter: 1007,
        LinearToneMapping: 1,
        Loader: Yr,
        LoaderUtils: La,
        LoadingManager: jr,
        LogLuvEncoding: 3003,
        LoopOnce: 2200,
        LoopPingPong: 2202,
        LoopRepeat: 2201,
        LuminanceAlphaFormat: 1025,
        LuminanceFormat: 1024,
        MOUSE: t,
        Material: qA,
        MaterialLoader: Da,
        Math: a,
        MathUtils: a,
        Matrix3: l,
        Matrix4: M,
        MaxEquation: 104,
        Mesh: Ue,
        MeshBasicMaterial: jA,
        MeshDepthMaterial: ji,
        MeshDistanceMaterial: Hi,
        MeshFaceMaterial: function(A) {
            return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),
            A
        },
        MeshLambertMaterial: xr,
        MeshMatcapMaterial: Sr,
        MeshNormalMaterial: Br,
        MeshPhongMaterial: Ir,
        MeshPhysicalMaterial: vr,
        MeshStandardMaterial: yr,
        MeshToonMaterial: Er,
        MinEquation: 103,
        MirroredRepeatWrapping: 1002,
        MixOperation: 1,
        MultiMaterial: function(A) {
            return void 0 === A && (A = []),
            console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),
            A.isMultiMaterial = !0,
            A.materials = A,
            A.clone = function() {
                return A.slice()
            }
            ,
            A
        },
        MultiplyBlending: 4,
        MultiplyOperation: 0,
        NearestFilter: 1003,
        NearestMipMapLinearFilter: 1005,
        NearestMipMapNearestFilter: 1004,
        NearestMipmapLinearFilter: 1005,
        NearestMipmapNearestFilter: 1004,
        NeverDepth: 0,
        NeverStencilFunc: 512,
        NoBlending: 0,
        NoColors: 0,
        NoToneMapping: 0,
        NormalBlending: 1,
        NotEqualDepth: 7,
        NotEqualStencilFunc: 517,
        NumberKeyframeTrack: Dr,
        Object3D: H,
        ObjectLoader: Pa,
        ObjectSpaceNormalMap: 1,
        OctahedronBufferGeometry: dn,
        OctahedronGeometry: hn,
        OneFactor: 201,
        OneMinusDstAlphaFactor: 207,
        OneMinusDstColorFactor: 209,
        OneMinusSrcAlphaFactor: 205,
        OneMinusSrcColorFactor: 203,
        OrthographicCamera: Ka,
        PCFShadowMap: 1,
        PCFSoftShadowMap: 2,
        PMREMGenerator: jl,
        ParametricBufferGeometry: rn,
        ParametricGeometry: nn,
        Particle: function(A) {
            return console.warn("THREE.Particle has been renamed to THREE.Sprite."),
            new vo(A)
        },
        ParticleBasicMaterial: function(A) {
            return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),
            new Yo(A)
        },
        ParticleSystem: function(A, e) {
            return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),
            new Xo(A,e)
        },
        ParticleSystemMaterial: function(A) {
            return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),
            new Yo(A)
        },
        Path: Ea,
        PerspectiveCamera: je,
        Plane: EA,
        PlaneBufferGeometry: et,
        PlaneGeometry: At,
        PlaneHelper: ml,
        PointCloud: function(A, e) {
            return console.warn("THREE.PointCloud has been renamed to THREE.Points."),
            new Xo(A,e)
        },
        PointCloudMaterial: function(A) {
            return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),
            new Yo(A)
        },
        PointLight: Fa,
        PointLightHelper: $s,
        Points: Xo,
        PointsMaterial: Yo,
        PolarGridHelper: nl,
        PolyhedronBufferGeometry: sn,
        PolyhedronGeometry: an,
        PositionalAudio: Cs,
        PropertyBinding: Fs,
        PropertyMixer: vs,
        QuadraticBezierCurve: ma,
        QuadraticBezierCurve3: Ca,
        Quaternion: f,
        QuaternionKeyframeTrack: Nr,
        QuaternionLinearInterpolant: Lr,
        REVISION: "115",
        RGBADepthPacking: 3201,
        RGBAFormat: 1023,
        RGBAIntegerFormat: 1033,
        RGBA_ASTC_10x10_Format: 37819,
        RGBA_ASTC_10x5_Format: 37816,
        RGBA_ASTC_10x6_Format: 37817,
        RGBA_ASTC_10x8_Format: 37818,
        RGBA_ASTC_12x10_Format: 37820,
        RGBA_ASTC_12x12_Format: 37821,
        RGBA_ASTC_4x4_Format: 37808,
        RGBA_ASTC_5x4_Format: 37809,
        RGBA_ASTC_5x5_Format: 37810,
        RGBA_ASTC_6x5_Format: 37811,
        RGBA_ASTC_6x6_Format: 37812,
        RGBA_ASTC_8x5_Format: 37813,
        RGBA_ASTC_8x6_Format: 37814,
        RGBA_ASTC_8x8_Format: 37815,
        RGBA_BPTC_Format: 36492,
        RGBA_ETC2_EAC_Format: 37496,
        RGBA_PVRTC_2BPPV1_Format: 35843,
        RGBA_PVRTC_4BPPV1_Format: 35842,
        RGBA_S3TC_DXT1_Format: 33777,
        RGBA_S3TC_DXT3_Format: 33778,
        RGBA_S3TC_DXT5_Format: 33779,
        RGBDEncoding: 3006,
        RGBEEncoding: 3002,
        RGBEFormat: 1023,
        RGBFormat: 1022,
        RGBIntegerFormat: 1032,
        RGBM16Encoding: 3005,
        RGBM7Encoding: 3004,
        RGB_ETC1_Format: 36196,
        RGB_ETC2_Format: 37492,
        RGB_PVRTC_2BPPV1_Format: 35841,
        RGB_PVRTC_4BPPV1_Format: 35840,
        RGB_S3TC_DXT1_Format: 33776,
        RGFormat: 1030,
        RGIntegerFormat: 1031,
        RawShaderMaterial: Cr,
        Ray: CA,
        Raycaster: Ds,
        RectAreaLight: ka,
        RedFormat: 1028,
        RedIntegerFormat: 1029,
        ReinhardToneMapping: 2,
        RepeatWrapping: 1e3,
        ReplaceStencilOp: 7681,
        ReverseSubtractEquation: 102,
        RingBufferGeometry: ir,
        RingGeometry: tr,
        SRGB8_ALPHA8_ASTC_10x10_Format: 37851,
        SRGB8_ALPHA8_ASTC_10x5_Format: 37848,
        SRGB8_ALPHA8_ASTC_10x6_Format: 37849,
        SRGB8_ALPHA8_ASTC_10x8_Format: 37850,
        SRGB8_ALPHA8_ASTC_12x10_Format: 37852,
        SRGB8_ALPHA8_ASTC_12x12_Format: 37853,
        SRGB8_ALPHA8_ASTC_4x4_Format: 37840,
        SRGB8_ALPHA8_ASTC_5x4_Format: 37841,
        SRGB8_ALPHA8_ASTC_5x5_Format: 37842,
        SRGB8_ALPHA8_ASTC_6x5_Format: 37843,
        SRGB8_ALPHA8_ASTC_6x6_Format: 37844,
        SRGB8_ALPHA8_ASTC_8x5_Format: 37845,
        SRGB8_ALPHA8_ASTC_8x6_Format: 37846,
        SRGB8_ALPHA8_ASTC_8x8_Format: 37847,
        Scene: Y,
        SceneUtils: ac,
        ShaderChunk: tt,
        ShaderLib: it,
        ShaderMaterial: Pe,
        ShadowMaterial: mr,
        Shape: Ba,
        ShapeBufferGeometry: ar,
        ShapeGeometry: rr,
        ShapePath: Ja,
        ShapeUtils: Hn,
        ShortType: 1011,
        Skeleton: bo,
        SkeletonHelper: _s,
        SkinnedMesh: So,
        SmoothShading: 2,
        Sphere: cA,
        SphereBufferGeometry: er,
        SphereGeometry: Ar,
        Spherical: Os,
        SphericalHarmonics3: As,
        SphericalReflectionMapping: 305,
        Spline: nc,
        SplineCurve: ya,
        SplineCurve3: oc,
        SpotLight: ba,
        SpotLightHelper: Js,
        SpotLightShadow: Ma,
        Sprite: vo,
        SpriteMaterial: ro,
        SrcAlphaFactor: 204,
        SrcAlphaSaturateFactor: 210,
        SrcColorFactor: 202,
        StaticCopyUsage: 35046,
        StaticDrawUsage: 35044,
        StaticReadUsage: 35045,
        StereoCamera: rs,
        StreamCopyUsage: 35042,
        StreamDrawUsage: 35040,
        StreamReadUsage: 35041,
        StringKeyframeTrack: Or,
        SubtractEquation: 101,
        SubtractiveBlending: 3,
        TOUCH: {
            ROTATE: 0,
            PAN: 1,
            DOLLY_PAN: 2,
            DOLLY_ROTATE: 3
        },
        TangentSpaceNormalMap: 0,
        TetrahedronBufferGeometry: cn,
        TetrahedronGeometry: ln,
        TextBufferGeometry: $n,
        TextGeometry: _n,
        Texture: d,
        TextureLoader: Aa,
        TorusBufferGeometry: En,
        TorusGeometry: In,
        TorusKnotBufferGeometry: vn,
        TorusKnotGeometry: yn,
        Triangle: RA,
        TriangleFanDrawMode: 2,
        TriangleStripDrawMode: 1,
        TrianglesDrawMode: 0,
        TubeBufferGeometry: Cn,
        TubeGeometry: mn,
        UVMapping: 300,
        Uint16Attribute: function(A, e) {
            return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),
            new XA(A,e)
        },
        Uint16BufferAttribute: XA,
        Uint32Attribute: function(A, e) {
            return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),
            new $A(A,e)
        },
        Uint32BufferAttribute: $A,
        Uint8Attribute: function(A, e) {
            return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),
            new JA(A,e)
        },
        Uint8BufferAttribute: JA,
        Uint8ClampedAttribute: function(A, e) {
            return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),
            new zA(A,e)
        },
        Uint8ClampedBufferAttribute: zA,
        Uncharted2ToneMapping: 3,
        Uniform: Ts,
        UniformsLib: Xe,
        UniformsUtils: Ge,
        UnsignedByteType: 1009,
        UnsignedInt248Type: 1020,
        UnsignedIntType: 1014,
        UnsignedShort4444Type: 1017,
        UnsignedShort5551Type: 1018,
        UnsignedShort565Type: 1019,
        UnsignedShortType: 1012,
        VSMShadowMap: 3,
        Vector2: s,
        Vector3: y,
        Vector4: p,
        VectorKeyframeTrack: Vr,
        Vertex: function(A, e, t) {
            return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),
            new y(A,e,t)
        },
        VertexColors: 2,
        VideoTexture: $o,
        WebGLCubeRenderTarget: Ye,
        WebGLMultisampleRenderTarget: u,
        WebGLRenderTarget: g,
        WebGLRenderTargetCube: function(A, e, t) {
            return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),
            new Ye(A,t)
        },
        WebGLRenderer: $i,
        WebGLUtils: zi,
        WireframeGeometry: on,
        WireframeHelper: function(A, e) {
            return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),
            new jo(new on(A.geometry),new ko({
                color: void 0 !== e ? e : 16777215
            }))
        },
        WrapAroundEnding: 2402,
        XHRLoader: function(A) {
            return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),
            new Jr(A)
        },
        ZeroCurvatureEnding: 2400,
        ZeroFactor: 200,
        ZeroSlopeEnding: 2401,
        ZeroStencilOp: 0,
        sRGBEncoding: 3001
    });
    function lc(A) {
        return (lc = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(A) {
            return typeof A
        }
        : function(A) {
            return A && "function" == typeof Symbol && A.constructor === Symbol && A !== Symbol.prototype ? "symbol" : typeof A
        }
        )(A)
    }
    function cc(A, e) {
        if (!(A instanceof e))
            throw new TypeError("Cannot call a class as a function")
    }
    function hc(A, e) {
        for (var t = 0; e.length > t; t++) {
            var i = e[t];
            i.enumerable = i.enumerable || !1,
            i.configurable = !0,
            "value"in i && (i.writable = !0),
            Object.defineProperty(A, i.key, i)
        }
    }
    function dc(A, e, t) {
        return e && hc(A.prototype, e),
        t && hc(A, t),
        A
    }
    function pc(A, e, t) {
        return e in A ? Object.defineProperty(A, e, {
            value: t,
            enumerable: !0,
            configurable: !0,
            writable: !0
        }) : A[e] = t,
        A
    }
    function gc(A) {
        for (var e = 1; arguments.length > e; e++) {
            var t = null != arguments[e] ? Object(arguments[e]) : {}
              , i = Object.keys(t);
            "function" == typeof Object.getOwnPropertySymbols && (i = i.concat(Object.getOwnPropertySymbols(t).filter((function(A) {
                return Object.getOwnPropertyDescriptor(t, A).enumerable
            }
            )))),
            i.forEach((function(e) {
                pc(A, e, t[e])
            }
            ))
        }
        return A
    }
    function uc(A, e) {
        if ("function" != typeof e && null !== e)
            throw new TypeError("Super expression must either be null or a function");
        A.prototype = Object.create(e && e.prototype, {
            constructor: {
                value: A,
                writable: !0,
                configurable: !0
            }
        }),
        e && mc(A, e)
    }
    function fc(A) {
        return (fc = Object.setPrototypeOf ? Object.getPrototypeOf : function(A) {
            return A.__proto__ || Object.getPrototypeOf(A)
        }
        )(A)
    }
    function mc(A, e) {
        return (mc = Object.setPrototypeOf || function(A, e) {
            return A.__proto__ = e,
            A
        }
        )(A, e)
    }
    function Cc(A, e) {
        return !e || "object" != typeof e && "function" != typeof e ? function(A) {
            if (void 0 === A)
                throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
            return A
        }(A) : e
    }
    function yc(A) {
        return function(A) {
            if (Array.isArray(A)) {
                for (var e = 0, t = new Array(A.length); A.length > e; e++)
                    t[e] = A[e];
                return t
            }
        }(A) || function(A) {
            if (Symbol.iterator in Object(A) || "[object Arguments]" === Object.prototype.toString.call(A))
                return Array.from(A)
        }(A) || function() {
            throw new TypeError("Invalid attempt to spread non-iterable instance")
        }()
    }
    var vc = {
        SceneSize: 1e3,
        getDataFromIndexedDB: !0,
        TextureResRoot: "images/",
        UserControlView: !1,
        FillCavity: !1,
        EnableClippingCaps: !0,
        EnableBoxClippingCaps: !1,
        EnableTextureMapping: !0,
        EnableTextureLoading: !0,
        EnableLightmap: !1,
        EnableTransformAoMap: !0,
        LightmapIntensity: 1,
        ClippingCaps: !1,
        SelectionColor: {
            color: 2205669,
            side: 2,
            opacity: .8,
            transparent: !0
        },
        DisableAntialias: !1,
        EnableDemolishByDClick: !1,
        IsMobile: !1,
        UseWorker: !1,
        ZipResourcePostfix: "",
        HasLayerData: !1,
        Renderer: 1,
        Instance: !0,
        MergeComponent: !1,
        AutoMergeComponent: !0,
        AutoMergeComponentCount: 1e4,
        MaxMergeCount: 1e3,
        MergedTriangleNumberThreshold: 2e7,
        MaxMergedTriangleNumber: 2e7,
        IncrementRender: !1,
        EnableRenderPass: !1,
        LimitFrameTime: 250,
        maxObjectNumInPool: 1e3,
        maxDrawCacheNum: 4e4,
        OctantDepth: 15,
        MaximumDepth: 0,
        TargetDistance: 1e4,
        ConcurrencyRequestCount: 16,
        ShowOctant: !1,
        EnableOctant: !1,
        EnableViewController: !0,
        DirectionalLight: !0,
        LightPreset: 2,
        IBL: !1,
        ToneMapping: 4,
        LightIntensityFactor: 1,
        Hover: !1,
        OcclusionTranslucentEnabled: !1,
        OcclusionOpacity: .5,
        OcclusionDistanceToCamera: 1e3,
        LineSelectRange: 30,
        DrawingStyle: 0,
        DrawingBoardlineEnabled: !0,
        InitWireframeData: !1,
        EnableHitDetection: !1,
        TranslucentDepthDisabled: !1,
        SharedMeshInstanceEnable: !1,
        DataProvider: 0,
        EnableSelectionOutline: !0,
        EnableSelectionByTranslucent: !1,
        EnableSelectionBoundingBox: !1,
        EnableShadow: !1,
        EnableAnimation: !0,
        UseLods: !1,
        AutoPrepare: !0,
        DEBUG: !1,
        WalkingWithGravity: !1,
        WalkingWithViewLock: !1,
        RendererWhenLoad: !1,
        language: "zh-cn",
        LoadComponentOnDemand: !1,
        logarithmicDepthBuffer: !1,
        InfluencedByLight: !0,
        geometricErrorThresholdValue: 80,
        MaximumAvailableMemory: 500,
        DataReduction: !1,
        ConstraintZoom: !1,
        stepLoad: !1,
        useGzip: !1,
        notDepthWriteByTransparent: !1,
        PickingEffect: !0,
        PickingLineWidthEnabled: !0,
        loadBatch: !0,
        MiniMapSize: 1024,
        alphaTest: .5,
        EnableCreateMiniMap: !1,
        MultipleSelectComponents: !0
    }
      , Ic = F.RotationOrders
      , Ec = {
        ORTHOGRAPHIC: "orth",
        PERSPECTIVE: "persp"
    }
      , Bc = {
        elements: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
    }
      , xc = {
        elements: [1, 0, 0, 0, 1, 0, 0, 0, 1]
    }
      , Sc = {
        IfcOpeningElement: !0,
        IfcSpace: !0,
        OST_Rooms: !0,
        "房间": !0
    };
    Object.defineProperties(Sc, {
        "房间": {
            get: function() {
                return Sc.OST_Rooms
            },
            set: function(A) {
                Sc.OST_Rooms = A
            }
        }
    });
    var wc, Mc, bc = new (Proxy || function(A) {
        return A
    }
    )(Sc,{
        deleteProperty: function(A, e) {
            e in A && ("房间" === e && delete A.OST_Rooms,
            delete A[e])
        }
    }), Uc = {
        Keep: 0,
        Home: 135,
        Top: 1,
        Bottom: 2,
        Front: 3,
        Back: 4,
        Right: 5,
        Left: 6,
        TopFrontRight: 135,
        TopFrontLeft: 136,
        TopBackRight: 145,
        TopBackLeft: 146,
        BottomFrontRight: 235,
        BottomFrontLeft: 236,
        BottomBackRight: 245,
        BottomBackLeft: 246,
        TopFront: 13,
        TopBack: 14,
        TopRight: 15,
        TopLeft: 16,
        BottomFront: 23,
        BottomBack: 24,
        BottomRight: 25,
        BottomLeft: 26,
        FrontRight: 35,
        FrontLeft: 36,
        BackRight: 45,
        BackLeft: 46,
        TopToRight: 105,
        TopToLeft: 106,
        TopToFront: 103,
        TopToBack: 104,
        BottomToRight: 205,
        BottomToLeft: 206,
        BottomToFront: 203,
        BottomToBack: 204,
        FrontToTop: 301,
        FrontToBottom: 302,
        FrontToRight: 305,
        FrontToLeft: 306,
        BackToTop: 401,
        BackToBottom: 402,
        BackToRight: 405,
        BackToLeft: 406,
        RightToTop: 501,
        RightToBottom: 502,
        RightToFront: 503,
        RightToBack: 504,
        LeftToTop: 601,
        LeftTopBottom: 602,
        LeftTopFront: 603,
        LeftTopBack: 604
    }, Fc = {
        DirectionalLight: "directional",
        AmbientLight: "ambient",
        PointLight: "point",
        SpotLight: "spot"
    }, Kc = {
        Clear: 0,
        Add: 1,
        Remove: 2
    }, Qc = {
        Geometry: 1,
        Marker3d: 2,
        Room: 3,
        ExternalComponent: 4,
        UnPickable: 0
    }, Rc = {
        ON_LOAD_START: "ON_LOAD_START",
        ON_LOAD_PROGRESS: "ON_LOAD_PROGRESS",
        ON_LOAD_COMPLETE: "ON_LOAD_COMPLETE",
        ON_DEMAND_LOAD_COMPLETE: "ON_DEMAND_LOAD_COMPLETE",
        ON_LOAD_EMPTY_SCENE: "ON_LOAD_EMPTY_SCENE",
        ON_LOAD_CONFIG_FINISH: "ON_LOAD_CONFIG_FINISH",
        ON_LOAD_INVALID_SCENE: "ON_LOAD_INVALID_SCENE",
        ON_LOAD_INVALID_DATA: "ON_LOAD_INVALID_DATA",
        ON_NETWORK_ERROR: "ON_NETWORK_ERROR",
        ACCOUNT_NO_EXIST: "ACCOUNT_NO_EXIST",
        NO_PERMISSION: "NO_PERMISSION",
        ON_LOAD_ERROR: "ON_LOAD_ERROR",
        ON_SELECTION_CHANGED: "ON_SELECTION_CHANGED",
        ON_RECTPICK_ADD: "ON_RECTPICK_ADD",
        ON_RECTPICK_REMOVE: "ON_RECTPICK_REMOVE",
        ON_CLICK_PICK: "ON_CLICK_PICK",
        ON_HOVER_PICK: "ON_HOVER_PICK",
        ON_MEASURE_PICK: "ON_MEASURE_PICK",
        ON_SELECTION_FAILED: "ON_SELECTION_FAILED",
        ON_CLIP_HOVER: "ON_CLIP_HOVER",
        ON_HOVER_SNAP: "ON_HOVER_SNAP",
        ON_CLIP_MOUSE_MOVE: "ON_CLIP_MOUSE_MOVE",
        ON_CLIP_MOUSE_DOWN: "ON_CLIP_MOUSE_DOWN",
        ON_VERSION_NO_MATCH: "ON_VERSION_NO_MATCH",
        ON_VIEWER_RESTORED: "ON_VIEWER_RESTORED",
        ON_CAMERA_HEIGHT_CHANGED: "ON_CAMERA_HEIGHT_CHANGED",
        ON_CAMERA_CHANGED_AND_RENDERED: "ON_CAMERA_CHANGED_AND_RENDERED",
        ON_DATABASE_OPEN: "ON_DATABASE_OPEN",
        ON_DATABASE_CLOSE: "ON_DATABASE_CLOSE",
        ON_DATABASE_ADD: "ON_DATABASE_ADD",
        ON_DATABASE_DELETE: "ON_DATABASE_DELETE",
        ON_DATABASE_CLERA: "ON_DATABASE_CLERA",
        ON_DATABASE_EEEOR: "ON_DATABASE_EEEOR",
        BEFORE_RESETSCENE: "BEFORE_RESETSCENE",
        AFTER_RESETSCENE: "AFTER_RESETSCENE",
        ON_CAMERA_CHANGE: "ON_CAMERA_CHANGE",
        ON_CONTROL_ENTER: "ON_CONTROL_ENTER",
        ON_CONTROL_EXIST: "ON_CONTROL_EXIST",
        ON_POINTERLOCK_EXIST: "ON_POINTERLOCK_EXIST",
        ON_CONTROL_BEGIN: "ON_CONTROL_BEGIN",
        ON_CONTROL_END: "ON_CONTROL_END",
        ON_CONTROL_ZOOM: "ON_CONTROL_ZOOM",
        ON_CONTROL_UPDATEUI: "ON_CONTROL_UPDATEUI",
        ON_CONTROL_KEYDOWN: "ON_CONTROL_KEYDOWN",
        ON_CONTROL_KEYUP: "ON_CONTROL_KEYUP",
        ON_CAMERA_ANIMATION_UPDATE: "ON_CAMERA_ANIMATION_UPDATE",
        ON_MOUSE_DRAGGED: "ON_MOUSE_DRAGGED"
    }, Tc = {
        LOAD_COMPONENT_ERROR: "LOAD_COMPONENT_ERROR",
        LOAD_MATERIAL_ERROR: "LOAD_MATERIAL_ERROR",
        LOAD_GEOMETRY_ERROR: "LOAD_GEOMETRY_ERROR",
        LOAD_COMPONENTNODE_ERROR: "LOAD_COMPONENTNODE_ERROR",
        LOAD_TEXTURE_ERROR: "LOAD_TEXTURE_ERROR",
        LOAD_AXISNET_ERROR: "LOAD_AXISNET_ERROR",
        LOAD_FLOORINFO_ERROR: "LOAD_FLOORINFO_ERROR",
        PARSEFAILE: "PARSEFAILE",
        PARSING: "PARSING",
        IS2D: "IS2D",
        LOAD_ERROR: "LOAD_ERROR",
        SCENE_NOT_CLOSE: "SCENE_NOT_CLOSE",
        SCENE_NOTHING_TO_LOAD: "SCENE_NOTHING_TO_LOAD",
        LOAD_SCENE_ERROR: "LOAD_SCENE_ERROR",
        LOAD_SYMBOL_ERROR: "LOAD_SYMBOL_ERROR",
        LOAD_OCTREEINNER_ERROR: "LOAD_OCTREEINNER_ERROR",
        LOAD_OCTREEOUTER_ERROR: "LOAD_OCTREEOUTER_ERROR",
        LOAD_USERID_ERROR: "LOAD_USERID_ERROR",
        LOAD_USERDATA_ERROR: "LOAD_USERDATA_ERROR",
        LOAD_CAMERA_ERROR: "LOAD_CAMERA_ERROR",
        LOAD_MPK_ERROR: "LOAD_MPK_ERROR",
        LOAD_IBLCONFIG_ERROR: "LOAD_IBLCONFIG_ERROR"
    }, kc = {
        MOUSEPOINT: 0,
        SELECTION: 1,
        CENTER: 2,
        CAMERA: 3
    }, Dc = {
        FILE_VISIBLE: 0,
        FILE_HIDDEN: 1,
        SELECTED: 2,
        VISIBLE: 3,
        HIDDEN: 4,
        TRANSLUCENT: 5,
        TRANSLUCENT_OTHERS: 6,
        WIREFRAME: 7,
        COLORFUL: 8
    }, Lc = {
        Visible: 1,
        HideByIsolate: 2,
        Transparent: 4,
        TransparentByIsolate: 8
    }, Nc = {
        HIDDEN: 0,
        HIDDEN_OTHERS: 1,
        TRANSLUCENT: 2,
        TRANSLUCENT_OTHERS: 3
    }, Oc = {
        TRANSLUCENT: "TRANSLUCENT",
        OPAQUE: "OPAQUE"
    }, Vc = {
        DISABLED: 0,
        TRANSLUCENT: 1,
        HIDDEN: 2
    }, Gc = {
        ORBIT: "orbit",
        PICK: "pick",
        PAN: "pan",
        ZOOM: "zoom",
        FLY: "fly",
        WALK: "walk"
    }, Pc = {
        PICK_BY_RECT: "pickByRect",
        ZOOM_BY_RECT: "zoomByRect",
        CLIP_BY_BOX: "clipByBox",
        CLIP_FILL: "fillClip",
        PICK_BY_MEASURE: "pickByMeasure",
        COMPONENT_TRANSFORM: "componentTransform"
    }, qc = {
        NONE: 0,
        UP: 1,
        DOWN: 2,
        LEFT: 4,
        RIGHT: 8,
        FORWARD: 16,
        BACK: 32
    }, jc = {
        SHADING: 0,
        BOARDLINE: 1,
        SHADINGWITHLINE: 2
    }, Hc = {
        HIDDEN: -1,
        NONE: 0,
        HOVER: 1,
        SELECTED: 2,
        OVERRIDED: 3,
        TRANSPARENT: 4,
        BLINK: 5
    }, Yc = {
        NONE: 0,
        BLINK: 1,
        SELECT: 2
    }, Wc = {
        AUTO: 0,
        DEFAULT: 1,
        MERGED: 2,
        LAYER: 3,
        LAYER_SCENE: 4
    }, Jc = {
        MATCH_RETURN_TRUE: 0,
        MATCH_RETURN_FALSE: 1,
        NOMATCH_RETURN_TRUE: 2,
        NOMATCH_RETURN_FALSE: 3
    }, zc = {
        CLIPPING: -2,
        HIDDEN: -1,
        NONE: 0,
        SELECTED: 1,
        BLINK: 2,
        HOVER: 3,
        TRANSPARENT: 4,
        OVERRIDED: 5
    }, Zc = {
        RVT: "RVT",
        IFC: "IFC",
        I_MODEL: "I-MODEL",
        THREE_DS: "3DS",
        MERGE: "MERGE",
        DAE: "DAE",
        DWG: "DWG",
        OBJ: "OBJ",
        FBX: "FBX"
    }, Xc = {};
    function _c(A, e, t, i) {
        this._x = A || 0,
        this._y = e || 0,
        this._z = t || 0,
        this._w = void 0 !== i ? i : 1
    }
    function $c(A, e, t) {
        this.x = A || 0,
        this.y = e || 0,
        this.z = t || 0
    }
    Xc.clamp = function(A, e, t) {
        return Math.max(e, Math.min(t, A))
    }
    ,
    Xc.euclideanModulo = function(A, e) {
        return (A % e + e) % e
    }
    ,
    Object.assign(_c, {
        slerp: function(A, e, t, i) {
            return t.copy(A).slerp(e, i)
        },
        slerpFlat: function(A, e, t, i, o, n, r) {
            var a = t[i + 0]
              , s = t[i + 1]
              , l = t[i + 2]
              , c = t[i + 3]
              , h = o[n + 0]
              , d = o[n + 1]
              , p = o[n + 2]
              , g = o[n + 3];
            if (c !== g || a !== h || s !== d || l !== p) {
                var u = 1 - r
                  , f = a * h + s * d + l * p + c * g
                  , m = 0 > f ? -1 : 1
                  , C = 1 - f * f;
                if (C > Number.EPSILON) {
                    var y = Math.sqrt(C)
                      , v = Math.atan2(y, f * m);
                    u = Math.sin(u * v) / y,
                    r = Math.sin(r * v) / y
                }
                var I = r * m;
                if (a = a * u + h * I,
                s = s * u + d * I,
                l = l * u + p * I,
                c = c * u + g * I,
                u === 1 - r) {
                    var E = 1 / Math.sqrt(a * a + s * s + l * l + c * c);
                    a *= E,
                    s *= E,
                    l *= E,
                    c *= E
                }
            }
            A[e] = a,
            A[e + 1] = s,
            A[e + 2] = l,
            A[e + 3] = c
        }
    }),
    Object.defineProperties(_c.prototype, {
        x: {
            get: function() {
                return this._x
            },
            set: function(A) {
                this._x = A,
                this._onChangeCallback()
            }
        },
        y: {
            get: function() {
                return this._y
            },
            set: function(A) {
                this._y = A,
                this._onChangeCallback()
            }
        },
        z: {
            get: function() {
                return this._z
            },
            set: function(A) {
                this._z = A,
                this._onChangeCallback()
            }
        },
        w: {
            get: function() {
                return this._w
            },
            set: function(A) {
                this._w = A,
                this._onChangeCallback()
            }
        }
    }),
    Object.assign(_c.prototype, {
        isQuaternion: !0,
        set: function(A, e, t, i) {
            return this._x = A,
            this._y = e,
            this._z = t,
            this._w = i,
            this._onChangeCallback(),
            this
        },
        clone: function() {
            return new this.constructor(this._x,this._y,this._z,this._w)
        },
        copy: function(A) {
            return this._x = A.x,
            this._y = A.y,
            this._z = A.z,
            this._w = A.w,
            this._onChangeCallback(),
            this
        },
        setFromEuler: function(A, e) {
            if (!A || !A.isEuler)
                throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");
            var t = A._x
              , i = A._y
              , o = A._z
              , n = A.order
              , r = Math.cos
              , a = Math.sin
              , s = r(t / 2)
              , l = r(i / 2)
              , c = r(o / 2)
              , h = a(t / 2)
              , d = a(i / 2)
              , p = a(o / 2);
            return "XYZ" === n ? (this._x = h * l * c + s * d * p,
            this._y = s * d * c - h * l * p,
            this._z = s * l * p + h * d * c,
            this._w = s * l * c - h * d * p) : "YXZ" === n ? (this._x = h * l * c + s * d * p,
            this._y = s * d * c - h * l * p,
            this._z = s * l * p - h * d * c,
            this._w = s * l * c + h * d * p) : "ZXY" === n ? (this._x = h * l * c - s * d * p,
            this._y = s * d * c + h * l * p,
            this._z = s * l * p + h * d * c,
            this._w = s * l * c - h * d * p) : "ZYX" === n ? (this._x = h * l * c - s * d * p,
            this._y = s * d * c + h * l * p,
            this._z = s * l * p - h * d * c,
            this._w = s * l * c + h * d * p) : "YZX" === n ? (this._x = h * l * c + s * d * p,
            this._y = s * d * c + h * l * p,
            this._z = s * l * p - h * d * c,
            this._w = s * l * c - h * d * p) : "XZY" === n && (this._x = h * l * c - s * d * p,
            this._y = s * d * c - h * l * p,
            this._z = s * l * p + h * d * c,
            this._w = s * l * c + h * d * p),
            !1 !== e && this._onChangeCallback(),
            this
        },
        setFromAxisAngle: function(A, e) {
            var t = e / 2
              , i = Math.sin(t);
            return this._x = A.x * i,
            this._y = A.y * i,
            this._z = A.z * i,
            this._w = Math.cos(t),
            this._onChangeCallback(),
            this
        },
        setFromRotationMatrix: function(A) {
            var e, t = A.elements, i = t[0], o = t[4], n = t[8], r = t[1], a = t[5], s = t[9], l = t[2], c = t[6], h = t[10], d = i + a + h;
            return d > 0 ? (e = .5 / Math.sqrt(d + 1),
            this._w = .25 / e,
            this._x = (c - s) * e,
            this._y = (n - l) * e,
            this._z = (r - o) * e) : i > a && i > h ? (e = 2 * Math.sqrt(1 + i - a - h),
            this._w = (c - s) / e,
            this._x = .25 * e,
            this._y = (o + r) / e,
            this._z = (n + l) / e) : a > h ? (e = 2 * Math.sqrt(1 + a - i - h),
            this._w = (n - l) / e,
            this._x = (o + r) / e,
            this._y = .25 * e,
            this._z = (s + c) / e) : (e = 2 * Math.sqrt(1 + h - i - a),
            this._w = (r - o) / e,
            this._x = (n + l) / e,
            this._y = (s + c) / e,
            this._z = .25 * e),
            this._onChangeCallback(),
            this
        },
        setFromUnitVectors: function(A, e) {
            var t = A.dot(e) + 1;
            return 1e-6 > t ? (t = 0,
            Math.abs(A.x) > Math.abs(A.z) ? (this._x = -A.y,
            this._y = A.x,
            this._z = 0,
            this._w = t) : (this._x = 0,
            this._y = -A.z,
            this._z = A.y,
            this._w = t)) : (this._x = A.y * e.z - A.z * e.y,
            this._y = A.z * e.x - A.x * e.z,
            this._z = A.x * e.y - A.y * e.x,
            this._w = t),
            this.normalize()
        },
        angleTo: function(A) {
            return 2 * Math.acos(Math.abs(Xc.clamp(this.dot(A), -1, 1)))
        },
        rotateTowards: function(A, e) {
            var t = this.angleTo(A);
            if (0 === t)
                return this;
            var i = Math.min(1, e / t);
            return this.slerp(A, i),
            this
        },
        inverse: function() {
            return this.conjugate()
        },
        conjugate: function() {
            return this._x *= -1,
            this._y *= -1,
            this._z *= -1,
            this._onChangeCallback(),
            this
        },
        dot: function(A) {
            return this._x * A._x + this._y * A._y + this._z * A._z + this._w * A._w
        },
        lengthSq: function() {
            return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w
        },
        length: function() {
            return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w)
        },
        normalize: function() {
            var A = this.length();
            return 0 === A ? (this._x = 0,
            this._y = 0,
            this._z = 0,
            this._w = 1) : (this._x = this._x * (A = 1 / A),
            this._y = this._y * A,
            this._z = this._z * A,
            this._w = this._w * A),
            this._onChangeCallback(),
            this
        },
        multiply: function(A, e) {
            return void 0 !== e ? (console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),
            this.multiplyQuaternions(A, e)) : this.multiplyQuaternions(this, A)
        },
        premultiply: function(A) {
            return this.multiplyQuaternions(A, this)
        },
        multiplyQuaternions: function(A, e) {
            var t = A._x
              , i = A._y
              , o = A._z
              , n = A._w
              , r = e._x
              , a = e._y
              , s = e._z
              , l = e._w;
            return this._x = t * l + n * r + i * s - o * a,
            this._y = i * l + n * a + o * r - t * s,
            this._z = o * l + n * s + t * a - i * r,
            this._w = n * l - t * r - i * a - o * s,
            this._onChangeCallback(),
            this
        },
        slerp: function(A, e) {
            if (0 === e)
                return this;
            if (1 === e)
                return this.copy(A);
            var t = this._x
              , i = this._y
              , o = this._z
              , n = this._w
              , r = n * A._w + t * A._x + i * A._y + o * A._z;
            if (0 > r ? (this._w = -A._w,
            this._x = -A._x,
            this._y = -A._y,
            this._z = -A._z,
            r = -r) : this.copy(A),
            r >= 1)
                return this._w = n,
                this._x = t,
                this._y = i,
                this._z = o,
                this;
            var a = 1 - r * r;
            if (Number.EPSILON >= a) {
                var s = 1 - e;
                return this._w = s * n + e * this._w,
                this._x = s * t + e * this._x,
                this._y = s * i + e * this._y,
                this._z = s * o + e * this._z,
                this.normalize(),
                this._onChangeCallback(),
                this
            }
            var l = Math.sqrt(a)
              , c = Math.atan2(l, r)
              , h = Math.sin((1 - e) * c) / l
              , d = Math.sin(e * c) / l;
            return this._w = n * h + this._w * d,
            this._x = t * h + this._x * d,
            this._y = i * h + this._y * d,
            this._z = o * h + this._z * d,
            this._onChangeCallback(),
            this
        },
        equals: function(A) {
            return A._x === this._x && A._y === this._y && A._z === this._z && A._w === this._w
        },
        fromArray: function(A, e) {
            return void 0 === e && (e = 0),
            this._x = A[e],
            this._y = A[e + 1],
            this._z = A[e + 2],
            this._w = A[e + 3],
            this._onChangeCallback(),
            this
        },
        toArray: function(A, e) {
            return void 0 === A && (A = []),
            void 0 === e && (e = 0),
            A[e] = this._x,
            A[e + 1] = this._y,
            A[e + 2] = this._z,
            A[e + 3] = this._w,
            A
        },
        _onChange: function(A) {
            return this._onChangeCallback = A,
            this
        },
        _onChangeCallback: function() {}
    }),
    Object.assign($c.prototype, {
        isVector3: !0,
        set: function(A, e, t) {
            return this.x = A,
            this.y = e,
            this.z = t,
            this
        },
        setScalar: function(A) {
            return this.x = A,
            this.y = A,
            this.z = A,
            this
        },
        setX: function(A) {
            return this.x = A,
            this
        },
        setY: function(A) {
            return this.y = A,
            this
        },
        setZ: function(A) {
            return this.z = A,
            this
        },
        setComponent: function(A, e) {
            switch (A) {
            case 0:
                this.x = e;
                break;
            case 1:
                this.y = e;
                break;
            case 2:
                this.z = e;
                break;
            default:
                throw new Error("index is out of range: " + A)
            }
            return this
        },
        getComponent: function(A) {
            switch (A) {
            case 0:
                return this.x;
            case 1:
                return this.y;
            case 2:
                return this.z;
            default:
                throw new Error("index is out of range: " + A)
            }
        },
        clone: function() {
            return new this.constructor(this.x,this.y,this.z)
        },
        copy: function(A) {
            return this.x = A.x,
            this.y = A.y,
            this.z = A.z,
            this
        },
        add: function(A, e) {
            return void 0 !== e ? (console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),
            this.addVectors(A, e)) : (this.x += A.x,
            this.y += A.y,
            this.z += A.z,
            this)
        },
        addScalar: function(A) {
            return this.x += A,
            this.y += A,
            this.z += A,
            this
        },
        addVectors: function(A, e) {
            return this.x = A.x + e.x,
            this.y = A.y + e.y,
            this.z = A.z + e.z,
            this
        },
        addScaledVector: function(A, e) {
            return this.x += A.x * e,
            this.y += A.y * e,
            this.z += A.z * e,
            this
        },
        sub: function(A, e) {
            return void 0 !== e ? (console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
            this.subVectors(A, e)) : (this.x -= A.x,
            this.y -= A.y,
            this.z -= A.z,
            this)
        },
        subScalar: function(A) {
            return this.x -= A,
            this.y -= A,
            this.z -= A,
            this
        },
        subVectors: function(A, e) {
            return this.x = A.x - e.x,
            this.y = A.y - e.y,
            this.z = A.z - e.z,
            this
        },
        multiply: function(A, e) {
            return void 0 !== e ? (console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),
            this.multiplyVectors(A, e)) : (this.x *= A.x,
            this.y *= A.y,
            this.z *= A.z,
            this)
        },
        multiplyScalar: function(A) {
            return this.x *= A,
            this.y *= A,
            this.z *= A,
            this
        },
        multiplyVectors: function(A, e) {
            return this.x = A.x * e.x,
            this.y = A.y * e.y,
            this.z = A.z * e.z,
            this
        },
        applyEuler: (Mc = new _c,
        function(A) {
            return A && A.isEuler || console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),
            this.applyQuaternion(Mc.setFromEuler(A))
        }
        ),
        applyAxisAngle: function() {
            var A = new _c;
            return function(e, t) {
                return this.applyQuaternion(A.setFromAxisAngle(e, t))
            }
        }(),
        applyMatrix3: function(A) {
            var e = this.x
              , t = this.y
              , i = this.z
              , o = A.elements;
            return this.x = o[0] * e + o[3] * t + o[6] * i,
            this.y = o[1] * e + o[4] * t + o[7] * i,
            this.z = o[2] * e + o[5] * t + o[8] * i,
            this
        },
        applyMatrix4: function(A) {
            var e = this.x
              , t = this.y
              , i = this.z
              , o = A.elements
              , n = 1 / (o[3] * e + o[7] * t + o[11] * i + o[15]);
            return this.x = (o[0] * e + o[4] * t + o[8] * i + o[12]) * n,
            this.y = (o[1] * e + o[5] * t + o[9] * i + o[13]) * n,
            this.z = (o[2] * e + o[6] * t + o[10] * i + o[14]) * n,
            this
        },
        applyQuaternion: function(A) {
            var e = this.x
              , t = this.y
              , i = this.z
              , o = A.x
              , n = A.y
              , r = A.z
              , a = A.w
              , s = a * e + n * i - r * t
              , l = a * t + r * e - o * i
              , c = a * i + o * t - n * e
              , h = -o * e - n * t - r * i;
            return this.x = s * a + h * -o + l * -r - c * -n,
            this.y = l * a + h * -n + c * -o - s * -r,
            this.z = c * a + h * -r + s * -n - l * -o,
            this
        },
        project: function(A) {
            return this.applyMatrix4(A.matrixWorldInverse).applyMatrix4(A.projectionMatrix)
        },
        unproject: function(A) {
            return this.applyMatrix4(A.projectionMatrixInverse).applyMatrix4(A.matrixWorld)
        },
        transformDirection: function(A) {
            var e = this.x
              , t = this.y
              , i = this.z
              , o = A.elements;
            return this.x = o[0] * e + o[4] * t + o[8] * i,
            this.y = o[1] * e + o[5] * t + o[9] * i,
            this.z = o[2] * e + o[6] * t + o[10] * i,
            this.normalize()
        },
        divide: function(A) {
            return this.x /= A.x,
            this.y /= A.y,
            this.z /= A.z,
            this
        },
        divideScalar: function(A) {
            return this.multiplyScalar(1 / A)
        },
        min: function(A) {
            return this.x = Math.min(this.x, A.x),
            this.y = Math.min(this.y, A.y),
            this.z = Math.min(this.z, A.z),
            this
        },
        max: function(A) {
            return this.x = Math.max(this.x, A.x),
            this.y = Math.max(this.y, A.y),
            this.z = Math.max(this.z, A.z),
            this
        },
        clamp: function(A, e) {
            return this.x = Math.max(A.x, Math.min(e.x, this.x)),
            this.y = Math.max(A.y, Math.min(e.y, this.y)),
            this.z = Math.max(A.z, Math.min(e.z, this.z)),
            this
        },
        clampScalar: function(A, e) {
            return this.x = Math.max(A, Math.min(e, this.x)),
            this.y = Math.max(A, Math.min(e, this.y)),
            this.z = Math.max(A, Math.min(e, this.z)),
            this
        },
        clampLength: function(A, e) {
            var t = this.length();
            return this.divideScalar(t || 1).multiplyScalar(Math.max(A, Math.min(e, t)))
        },
        floor: function() {
            return this.x = Math.floor(this.x),
            this.y = Math.floor(this.y),
            this.z = Math.floor(this.z),
            this
        },
        ceil: function() {
            return this.x = Math.ceil(this.x),
            this.y = Math.ceil(this.y),
            this.z = Math.ceil(this.z),
            this
        },
        round: function() {
            return this.x = Math.round(this.x),
            this.y = Math.round(this.y),
            this.z = Math.round(this.z),
            this
        },
        roundToZero: function() {
            return this.x = 0 > this.x ? Math.ceil(this.x) : Math.floor(this.x),
            this.y = 0 > this.y ? Math.ceil(this.y) : Math.floor(this.y),
            this.z = 0 > this.z ? Math.ceil(this.z) : Math.floor(this.z),
            this
        },
        negate: function() {
            return this.x = -this.x,
            this.y = -this.y,
            this.z = -this.z,
            this
        },
        dot: function(A) {
            return this.x * A.x + this.y * A.y + this.z * A.z
        },
        lengthSq: function() {
            return this.x * this.x + this.y * this.y + this.z * this.z
        },
        length: function() {
            return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z)
        },
        manhattanLength: function() {
            return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z)
        },
        normalize: function() {
            return this.divideScalar(this.length() || 1)
        },
        setLength: function(A) {
            return this.normalize().multiplyScalar(A)
        },
        lerp: function(A, e) {
            return this.x += (A.x - this.x) * e,
            this.y += (A.y - this.y) * e,
            this.z += (A.z - this.z) * e,
            this
        },
        lerpVectors: function(A, e, t) {
            return this.subVectors(e, A).multiplyScalar(t).add(A)
        },
        cross: function(A, e) {
            return void 0 !== e ? (console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),
            this.crossVectors(A, e)) : this.crossVectors(this, A)
        },
        crossVectors: function(A, e) {
            var t = A.x
              , i = A.y
              , o = A.z
              , n = e.x
              , r = e.y
              , a = e.z;
            return this.x = i * a - o * r,
            this.y = o * n - t * a,
            this.z = t * r - i * n,
            this
        },
        projectOnVector: function(A) {
            var e = A.dot(this) / A.lengthSq();
            return this.copy(A).multiplyScalar(e)
        },
        projectOnPlane: (wc = new $c,
        function(A) {
            return wc.copy(this).projectOnVector(A),
            this.sub(wc)
        }
        ),
        reflect: function() {
            var A = new $c;
            return function(e) {
                return this.sub(A.copy(e).multiplyScalar(2 * this.dot(e)))
            }
        }(),
        angleTo: function(A) {
            var e = this.dot(A) / Math.sqrt(this.lengthSq() * A.lengthSq());
            return Math.acos(Xc.clamp(e, -1, 1))
        },
        distanceTo: function(A) {
            return Math.sqrt(this.distanceToSquared(A))
        },
        distanceToSquared: function(A) {
            var e = this.x - A.x
              , t = this.y - A.y
              , i = this.z - A.z;
            return e * e + t * t + i * i
        },
        manhattanDistanceTo: function(A) {
            return Math.abs(this.x - A.x) + Math.abs(this.y - A.y) + Math.abs(this.z - A.z)
        },
        setFromSpherical: function(A) {
            return this.setFromSphericalCoords(A.radius, A.phi, A.theta)
        },
        setFromSphericalCoords: function(A, e, t) {
            var i = Math.sin(e) * A;
            return this.x = i * Math.sin(t),
            this.y = Math.cos(e) * A,
            this.z = i * Math.cos(t),
            this
        },
        setFromCylindrical: function(A) {
            return this.setFromCylindricalCoords(A.radius, A.theta, A.y)
        },
        setFromCylindricalCoords: function(A, e, t) {
            return this.x = A * Math.sin(e),
            this.y = t,
            this.z = A * Math.cos(e),
            this
        },
        setFromMatrixPosition: function(A) {
            var e = A.elements;
            return this.x = e[12],
            this.y = e[13],
            this.z = e[14],
            this
        },
        setFromMatrixScale: function(A) {
            var e = this.setFromMatrixColumn(A, 0).length()
              , t = this.setFromMatrixColumn(A, 1).length()
              , i = this.setFromMatrixColumn(A, 2).length();
            return this.x = e,
            this.y = t,
            this.z = i,
            this
        },
        setFromMatrixColumn: function(A, e) {
            return this.fromArray(A.elements, 4 * e)
        },
        equals: function(A) {
            return A.x === this.x && A.y === this.y && A.z === this.z
        },
        fromArray: function(A, e) {
            return void 0 === e && (e = 0),
            this.x = A[e],
            this.y = A[e + 1],
            this.z = A[e + 2],
            this
        },
        toArray: function(A, e) {
            return void 0 === A && (A = []),
            void 0 === e && (e = 0),
            A[e] = this.x,
            A[e + 1] = this.y,
            A[e + 2] = this.z,
            A
        },
        fromBufferAttribute: function(A, e, t) {
            return void 0 !== t && console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),
            this.x = A.getX(e),
            this.y = A.getY(e),
            this.z = A.getZ(e),
            this
        }
    });
    var Ah = [new $c, new $c, new $c, new $c, new $c, new $c, new $c, new $c]
      , eh = new $c
      , th = new $c
      , ih = new $c
      , oh = new $c
      , nh = new $c
      , rh = new $c
      , ah = new $c
      , sh = new $c
      , lh = new $c
      , ch = new $c
      , hh = new $c;
    function dh(A, e, t, i, o) {
        var n, r = 0;
        for (r = 0,
        n = A.length - 3; n >= r; r += 3) {
            hh.fromArray(A, r);
            var a = o.x * Math.abs(hh.x) + o.y * Math.abs(hh.y) + o.z * Math.abs(hh.z)
              , s = e.dot(hh)
              , l = t.dot(hh)
              , c = i.dot(hh);
            if (Math.max(-Math.max(s, l, c), Math.min(s, l, c)) > a)
                return !1
        }
        return !0
    }
    function ph(A, e) {
        this.min = void 0 !== A ? A : new $c(1 / 0,1 / 0,1 / 0),
        this.max = void 0 !== e ? e : new $c(-1 / 0,-1 / 0,-1 / 0)
    }
    var gh = new ph;
    Object.assign(ph.prototype, {
        isBox3: !0,
        set: function(A, e) {
            return this.min.copy(A),
            this.max.copy(e),
            this
        },
        setFromArray: function(A) {
            for (var e = 1 / 0, t = 1 / 0, i = 1 / 0, o = -1 / 0, n = -1 / 0, r = -1 / 0, a = 0, s = A.length; s > a; a += 3) {
                var l = A[a]
                  , c = A[a + 1]
                  , h = A[a + 2];
                e > l && (e = l),
                t > c && (t = c),
                i > h && (i = h),
                l > o && (o = l),
                c > n && (n = c),
                h > r && (r = h)
            }
            return this.min.set(e, t, i),
            this.max.set(o, n, r),
            this
        },
        toArray: function(A) {
            return void 0 === A && (A = []),
            this.min.toArray(A),
            this.max.toArray(A, 3),
            A
        },
        setFromBufferAttribute: function(A) {
            for (var e = 1 / 0, t = 1 / 0, i = 1 / 0, o = -1 / 0, n = -1 / 0, r = -1 / 0, a = 0, s = A.count; s > a; a += 1) {
                var l = A.getX(a)
                  , c = A.getY(a)
                  , h = A.getZ(a);
                e > l && (e = l),
                t > c && (t = c),
                i > h && (i = h),
                l > o && (o = l),
                c > n && (n = c),
                h > r && (r = h)
            }
            return this.min.set(e, t, i),
            this.max.set(o, n, r),
            this
        },
        setFromPoints: function(A) {
            this.makeEmpty();
            for (var e = 0, t = A.length; t > e; e += 1)
                this.expandByPoint(A[e]);
            return this
        },
        setFromCenterAndSize: function(A, e) {
            var t = eh.copy(e).multiplyScalar(.5);
            return this.min.copy(A).sub(t),
            this.max.copy(A).add(t),
            this
        },
        setFromObject: function(A) {
            return this.makeEmpty(),
            this.expandByObject(A)
        },
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            return this.min.copy(A.min),
            this.max.copy(A.max),
            this
        },
        makeEmpty: function() {
            return this.min.x = this.min.y = this.min.z = 1 / 0,
            this.max.x = this.max.y = this.max.z = -1 / 0,
            this
        },
        isEmpty: function() {
            return this.min.x > this.max.x || this.min.y > this.max.y || this.min.z > this.max.z
        },
        getCenter: function(A) {
            return void 0 === A && (console.warn("THREE.Box3: .getCenter() target is now required"),
            A = new $c),
            this.isEmpty() ? A.set(0, 0, 0) : A.addVectors(this.min, this.max).multiplyScalar(.5)
        },
        getSize: function(A) {
            return void 0 === A && (console.warn("THREE.Box3: .getSize() target is now required"),
            A = new $c),
            this.isEmpty() ? A.set(0, 0, 0) : A.subVectors(this.max, this.min)
        },
        expandByPoint: function(A) {
            return this.min.min(A),
            this.max.max(A),
            this
        },
        expandByVector: function(A) {
            return this.min.sub(A),
            this.max.add(A),
            this
        },
        expandByScalar: function(A) {
            return this.min.addScalar(-A),
            this.max.addScalar(A),
            this
        },
        expandByObject: function(A) {
            A.updateWorldMatrix(!1, !1);
            var e = A.geometry;
            void 0 !== e && (null === e.boundingBox && e.computeBoundingBox(),
            gh.copy(e.boundingBox),
            gh.applyMatrix4(A.matrixWorld),
            this.union(gh));
            for (var t = A.children, i = 0, o = t.length; o > i; i += 1)
                this.expandByObject(t[i]);
            return this
        },
        containsPoint: function(A) {
            return !(this.min.x > A.x || A.x > this.max.x || this.min.y > A.y || A.y > this.max.y || this.min.z > A.z || A.z > this.max.z)
        },
        containsBox: function(A) {
            return !(this.min.x > A.min.x || A.max.x > this.max.x || this.min.y > A.min.y || A.max.y > this.max.y || this.min.z > A.min.z || A.max.z > this.max.z)
        },
        getParameter: function(A, e) {
            return void 0 === e && (console.warn("THREE.Box3: .getParameter() target is now required"),
            e = new $c),
            e.set((A.x - this.min.x) / (this.max.x - this.min.x), (A.y - this.min.y) / (this.max.y - this.min.y), (A.z - this.min.z) / (this.max.z - this.min.z))
        },
        intersectsBox: function(A) {
            return !(this.min.x > A.max.x || A.min.x > this.max.x || this.min.y > A.max.y || A.min.y > this.max.y || this.min.z > A.max.z || A.min.z > this.max.z)
        },
        intersectsSphere: function(A) {
            return this.clampPoint(A.center, eh),
            eh.distanceToSquared(A.center) <= A.radius * A.radius
        },
        intersectsPlane: function(A) {
            var e = null
              , t = null;
            return A.normal.x > 0 ? (e = A.normal.x * this.min.x,
            t = A.normal.x * this.max.x) : (e = A.normal.x * this.max.x,
            t = A.normal.x * this.min.x),
            A.normal.y > 0 ? (e += A.normal.y * this.min.y,
            t += A.normal.y * this.max.y) : (e += A.normal.y * this.max.y,
            t += A.normal.y * this.min.y),
            A.normal.z > 0 ? (e += A.normal.z * this.min.z,
            t += A.normal.z * this.max.z) : (e += A.normal.z * this.max.z,
            t += A.normal.z * this.min.z),
            -A.constant >= e && t >= -A.constant
        },
        intersectsTriangle: function(A) {
            if (this.isEmpty())
                return !1;
            this.getCenter(sh),
            lh.subVectors(this.max, sh),
            th.subVectors(A.a, sh),
            ih.subVectors(A.b, sh),
            oh.subVectors(A.c, sh),
            nh.subVectors(ih, th),
            rh.subVectors(oh, ih),
            ah.subVectors(th, oh);
            var e = [0, -nh.z, nh.y, 0, -rh.z, rh.y, 0, -ah.z, ah.y, nh.z, 0, -nh.x, rh.z, 0, -rh.x, ah.z, 0, -ah.x, -nh.y, nh.x, 0, -rh.y, rh.x, 0, -ah.y, ah.x, 0];
            return !!dh(e, th, ih, oh, lh) && (!!dh(e = [1, 0, 0, 0, 1, 0, 0, 0, 1], th, ih, oh, lh) && (ch.crossVectors(nh, rh),
            dh(e = [ch.x, ch.y, ch.z], th, ih, oh, lh)))
        },
        clampPoint: function(A, e) {
            return void 0 === e && (console.warn("THREE.Box3: .clampPoint() target is now required"),
            e = new $c),
            e.copy(A).clamp(this.min, this.max)
        },
        distanceToPoint: function(A) {
            return eh.copy(A).clamp(this.min, this.max).sub(A).length()
        },
        getBoundingSphere: function(A) {
            return void 0 === A && console.error("THREE.Box3: .getBoundingSphere() target is now required"),
            this.getCenter(A.center),
            A.radius = .5 * this.getSize(eh).length(),
            A
        },
        intersect: function(A) {
            return this.min.max(A.min),
            this.max.min(A.max),
            this.isEmpty() && this.makeEmpty(),
            this
        },
        union: function(A) {
            return this.min.min(A.min),
            this.max.max(A.max),
            this
        },
        applyMatrix4: function(A) {
            return this.isEmpty() || (Ah[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(A),
            Ah[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(A),
            Ah[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(A),
            Ah[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(A),
            Ah[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(A),
            Ah[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(A),
            Ah[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(A),
            Ah[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(A),
            this.setFromPoints(Ah)),
            this
        },
        translate: function(A) {
            return this.min.add(A),
            this.max.add(A),
            this
        },
        equals: function(A) {
            return A.min.equals(this.min) && A.max.equals(this.max)
        }
    });
    var uh = {
        MinusEpsilon: -1e-6,
        byteArr2Int: function(A) {
            return (255 & A[0]) << 24 | (255 & A[1]) << 16 | (255 & A[2]) << 8 | (255 & A[3]) << 0
        },
        int2ByteArr: function(A) {
            var e = [];
            return e[0] = A >> 24,
            e[1] = A >> 16,
            e[2] = A >> 8,
            e[3] = A >> 0,
            e
        },
        isPlainObject: function(A) {
            var e, t;
            return !(!A || "[object Object]" !== Object.prototype.toString.call(A)) && (!(e = Object.getPrototypeOf(A)) || "function" == typeof (t = Object.hasOwnProperty.call(e, "constructor") && e.constructor) && Object.hasOwnProperty.toString.call(t) === Object.hasOwnProperty.toString.call(Object))
        },
        extend: function() {
            var A = null
              , e = null
              , t = null
              , i = null
              , o = null
              , n = null
              , r = arguments[0] || {}
              , a = 1
              , s = arguments.length
              , l = !1;
            for ("boolean" == typeof r && (l = r,
            r = arguments[a] || {},
            a += 1),
            "object" !== lc(r) && "function" === !lc(r) && (r = {}),
            a === s && (r = this,
            a -= 1); s > a; a += 1)
                if (null !== (A = arguments[a]) && void 0 !== (A = arguments[a]))
                    for (e in A)
                        t = r[e],
                        r !== (i = A[e]) && (l && i && (uh.isPlainObject(i) || (o = Array.isArray(i))) ? (o ? (o = !1,
                        n = t && Array.isArray(t) ? t : []) : n = t && uh.isPlainObject(t) ? t : {},
                        r[e] = uh.extend(l, n, i)) : null != i && (r[e] = i));
            return r
        },
        supportWorker: function() {
            return "undefined" != typeof Worker || (console.log("Web Worker is not supported."),
            !1)
        },
        box3FromArray: function(A, e) {
            if (Array.isArray(A)) {
                var t = e || new ph;
                return t.min.fromArray(A, 0),
                t.max.fromArray(A, 3),
                t
            }
            return null
        },
        box3FromArrayRange: function(A, e, t) {
            for (var i = new ph, o = Number(1 / 0), n = Number(1 / 0), r = Number(1 / 0), a = -1 / 0, s = -1 / 0, l = -1 / 0, c = e, h = t; h > c; c += 3) {
                var d = A[c]
                  , p = A[c + 1]
                  , g = A[c + 2];
                o > d && (o = d),
                n > p && (n = p),
                r > g && (r = g),
                d > a && (a = d),
                p > s && (s = p),
                g > l && (l = g)
            }
            return i.min.set(o, n, r),
            i.max.set(a, s, l),
            i
        },
        box3FromObject: function(A, e, t) {
            if (void 0 !== A && void 0 !== e && void 0 !== A.x && void 0 !== A.y && void 0 !== A.z && void 0 !== e.x && void 0 !== e.y && void 0 !== e.z) {
                var i = t || new ph;
                return i.min.set(A.x, A.y, A.z),
                i.max.set(e.x, e.y, e.z),
                i
            }
            return null
        },
        computeBBox: function(A) {
            for (var e = new ph, t = new $c, i = 0, o = A.length; o > i; i += 1)
                t.fromArray(A[i], 0),
                e.expandByPoint(t);
            return e
        },
        mergeBBox: function(A) {
            if (1 > A.length)
                return null;
            for (var e = new ph, t = new $c, i = new $c, o = new ph, n = 0, r = A.length; r > n; n += 1)
                t.set(A[n].max.x, A[n].max.y, A[n].max.z),
                i.set(A[n].min.x, A[n].min.y, A[n].min.z),
                o.set(i, t),
                e.union(o);
            return e
        },
        parseTransform: function(A, e, t) {
            var i = !1;
            if (e.rotation && (A.rotation.fromArray(e.rotation),
            i = !0),
            e.position && (A.position.fromArray(e.position),
            i = !0),
            e.scale && (A.scale.fromArray(e.scale),
            i = !0),
            e.quaternion && (A.quaternion.fromArray(e.quaternion),
            i = !0),
            i && A.updateMatrix(),
            e.matrix && A.matrix.fromArray(e.matrix),
            t) {
                var o = A.matrix.clone();
                o.multiplyMatrices(t, A.matrix),
                A.matrix = o
            }
            A.matrixAutoUpdate = !1,
            void 0 !== A.boundingBox && (A.boundingBox = uh.box3FromArray(e.bbox))
        },
        isEmptyObject: function(A) {
            if (!A)
                return !0;
            if (A.length > 0)
                return !1;
            if (0 === A.length)
                return !0;
            for (var e in A)
                if (A.hasOwnProperty(e))
                    return !1;
            return !0
        },
        isEmptyObjectSimple: function(A) {
            for (var e in A)
                return !1;
            return !0
        },
        isOwnEmptyObject: function(A) {
            for (var e in A)
                if (A.hasOwnProperty(e))
                    return !1;
            return !0
        },
        hexStrToRgb: function(A) {
            var e = A.replace("#", "")
              , t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);
            return t ? {
                r: parseInt(t[1], 16) / 255,
                g: parseInt(t[2], 16) / 255,
                b: parseInt(t[3], 16) / 255
            } : null
        },
        hexToRgb: function(A) {
            var e = {};
            return e.r = (A >> 16 & 255) / 255,
            e.g = (A >> 8 & 255) / 255,
            e.b = (255 & A) / 255,
            e
        },
        getMin: function(A) {
            for (var e = A.length, t = 1 / 0; (e -= 1) >= 0; )
                t = t > A[e] ? A[e] : t;
            return t
        },
        getMax: function(A) {
            for (var e = A.length, t = -1 / 0; (e -= 1) >= 0; )
                t = A[e] > t ? A[e] : t;
            return t
        },
        findRange: function(A, e) {
            if (e < Math.min.apply(null, A))
                return 0;
            if (e > Math.max.apply(null, A))
                return A.length - 1;
            for (var t = 0, i = 0, o = A.length; o > i; i += 1)
                if (A[i] > e) {
                    t = i - 1;
                    break
                }
            return t
        },
        stringToByte: function(A) {
            for (var e = [], t = A.length, i = null, o = 0; t > o; o += 1)
                65536 > (i = A.charCodeAt(o)) || i > 1114111 ? 2048 > i || i > 65535 ? 128 > i || i > 2047 ? e.push(255 & i) : (e.push(i >> 6 & 31 | 192),
                e.push(63 & i | 128)) : (e.push(i >> 12 & 15 | 224),
                e.push(i >> 6 & 63 | 128),
                e.push(63 & i | 128)) : (e.push(i >> 18 & 7 | 240),
                e.push(i >> 12 & 63 | 128),
                e.push(i >> 6 & 63 | 128),
                e.push(63 & i | 128));
            return e
        },
        byteToString: function(A) {
            if ("string" == typeof A)
                return A;
            for (var e = "", t = A, i = 0; t.length > i; i += 1) {
                var o = t[i].toString(2)
                  , n = o.match(/^1+?(?=0)/);
                if (n && 8 === o.length) {
                    for (var r = n[0].length, a = t[i].toString(2).slice(7 - r), s = 1; r > s; s += 1)
                        a += t[s + i].toString(2).slice(2);
                    e += String.fromCharCode(parseInt(a, 2)),
                    i += r - 1
                } else
                    e += String.fromCharCode(t[i])
            }
            return e
        },
        strToBinary: function(A) {
            for (var e = [], t = A.split(""), i = 0; t.length > i; i += 1) {
                0 !== i && e.push(" ");
                var o = t[i].charCodeAt().toString(2);
                e.push(o)
            }
            return e.join("")
        },
        binaryToStr: function(A) {
            for (var e = [], t = A.split(" "), i = 0; t.length > i; i += 1) {
                var o = parseInt(t[i], 2)
                  , n = String.fromCharCode(o);
                e.push(n)
            }
            return e.join("")
        },
        isMirror: function(A) {
            var e = new $c(A[0],A[1],A[2])
              , t = new $c(A[4],A[5],A[6])
              , i = new $c(A[8],A[9],A[10]);
            return 0 > (new $c).crossVectors(e, t).dot(i)
        },
        decodeUTF8: function(A) {
            for (var e = "", t = 0; A.length > t; t += 1)
                e += String.fromCharCode(A[t]);
            return decodeURIComponent(escape(e))
        },
        unique: function(A) {
            for (var e, t = [], i = {}, o = 0; null !== (e = A[o]) && void 0 !== (e = A[o]); o += 1)
                i[e] || (t.push(e),
                i[e] = !0);
            return i = null,
            t
        },
        getValue: function(A, e) {
            var t = e.split(".")
              , i = A;
            return t.map((function(A, e) {
                i = i[A]
            }
            )),
            i
        },
        sortByName: function(A, e, t) {
            t = t || "asc";
            var i = !1;
            e ? e.indexOf(".") > -1 && (i = !0) : e = "name",
            A = A.sort((function(A, o) {
                if (i) {
                    var n = uh.getValue(A, e)
                      , r = uh.getValue(o, e);
                    return "asc" === t ? n.localeCompare(r) : r.localeCompare(n)
                }
                return "asc" === t ? A[e].localeCompare(o[e]) : o[e].localeCompare(A[e])
            }
            ));
            var o = []
              , n = []
              , r = []
              , a = [];
            return A.map((function(A, t) {
                var s = null;
                s = i ? uh.getValue(A, e) : A[e],
                /^[a-zA-Z]*$/.test(s.slice(0, 1)) ? o.push(A) : /^[\u4e00-\u9fa5]*$/.test(s.slice(0, 1)) ? n.push(A) : /^\d+(\.\d+)?$/.test(s.slice(0, 1)) ? r.push(A) : a.push(A)
            }
            )),
            a.concat(r, o, n)
        },
        PointToLineDistance: function(A, e, t, i, o, n) {
            var r = void 0
              , a = void 0
              , s = void 0
              , l = void 0
              , c = Math.sqrt((t - A) * (t - A) + (i - e) * (i - e));
            if (0 === c)
                return [0, {
                    x: t,
                    y: i
                }];
            var h = Math.sqrt((o - A) * (o - A) + (n - e) * (n - e));
            if (0 === h)
                return [0, {
                    x: o,
                    y: n
                }];
            var d = Math.sqrt((t - o) * (t - o) + (i - n) * (i - n));
            if (0 === d)
                return [c, {
                    x: t,
                    y: i
                }];
            if (h > c) {
                if (i === n ? r = o > t ? 0 : Math.PI : ((l = (o - t) / d) - 1 > 1e-5 && (l = 1),
                r = Math.acos(l),
                i > n && (r = 2 * Math.PI - r)),
                (l = (A - t) / c) - 1 > 1e-5 && (l = 1),
                a = Math.acos(l),
                i > e && (a = 2 * Math.PI - a),
                0 > (s = a - r) && (s = -s),
                s > Math.PI && (s = 2 * Math.PI - s),
                s > Math.PI / 2)
                    return [c, {
                        x: t,
                        y: i
                    }];
                if (t === o)
                    return [h * Math.sin(s), {
                        x: t,
                        y: e
                    }];
                if (i === n)
                    return [h * Math.sin(s), {
                        x: A,
                        y: i
                    }];
                var p, g, u = (n - i) / o - t, f = -1 / u, m = e - A * f;
                return g = f * (p = (n - o * u - m) / (f - u)) + m,
                [c * Math.sin(s), {
                    x: p,
                    y: g
                }]
            }
            if (i === n ? r = o > t ? Math.PI : 0 : ((l = (t - o) / d) - 1 > 1e-5 && (l = 1),
            r = Math.acos(l),
            n > i && (r = 2 * Math.PI - r)),
            (l = (A - o) / h) - 1 > 1e-5 && (l = 1),
            a = Math.acos(l),
            n > e && (a = 2 * Math.PI - a),
            0 > (s = a - r) && (s = -s),
            s > Math.PI && (s = 2 * Math.PI - s),
            s > Math.PI / 2)
                return [h, {
                    x: o,
                    y: n
                }];
            if (t === o)
                return [h * Math.sin(s), {
                    x: t,
                    y: e
                }];
            if (i === n)
                return [h * Math.sin(s), {
                    x: A,
                    y: i
                }];
            var C, y, v = (n - i) / o - t, I = -1 / v, E = e - A * I;
            return y = I * (C = (n - o * v - E) / (I - v)) + E,
            [h * Math.sin(s), {
                x: C,
                y: y
            }]
        },
        freezeObject: function(A) {
            return Object.freeze ? Object.freeze(A) : A
        },
        getEncodedId: function(A) {
            return A
        },
        arrayToMap: function(A, e) {
            e = e || {};
            for (var t = 0, i = A.length; i > t; t += 1)
                e[A[t]] = !0;
            return e
        },
        getDifferentialIdxs: function(A, e) {
            var t = null
              , i = {}
              , o = {}
              , n = {};
            if (e)
                if (this.isEmptyObject(A))
                    o = e;
                else {
                    for (t in e)
                        A[t] && (n[t] = !0);
                    if (this.isEmptyObject(n))
                        i = A,
                        o = e;
                    else {
                        for (t in e)
                            n[t] || (o[t] = !0);
                        for (t in A)
                            n[t] || (i[t] = !0)
                    }
                }
            else
                this.isEmptyObject(A) || (i = A);
            return {
                objCurrUsedIdxs: A,
                addIdxs: Object.keys(i),
                removeIdxs: Object.keys(o)
            }
        },
        getCombinedKeyString: function(A, e) {
            return A.join(e = e || "&")
        },
        splitCombinedKeyString: function(A, e) {
            return A.split(e = e || "&")
        },
        getModelKeyFromComponentKey: function(A) {
            return A.split("_")[0]
        },
        isGroupObject: function(A) {
            return !(!A.children || !A.children.length)
        },
        isMeshObject: function(A) {
            return !!(A.isMesh || A.isLine || A.isPoints)
        },
        asyncProcess: function(A, e, t, i, o) {
            requestAnimationFrame(function n(r) {
                var a = r;
                return function() {
                    var r = null
                      , s = null;
                    for (s = a + t > e ? e : a + t,
                    r = a; s > r; r += 1) {
                        i && i(A, r),
                        r === s - 1 && (s !== e ? requestAnimationFrame(n(r + 1)) : o && o(A))
                    }
                }
            }(0))
        },
        hasSimilarProperty: function(A, e) {
            if (!(A instanceof Object && e instanceof Object))
                return !1;
            for (var t in A)
                if (A.hasOwnProperty(t) && !e.hasOwnProperty(t))
                    return !1;
            return !0
        },
        equalsWithEpsilon: function(A, e) {
            var t = Math.abs(A.x - e.x)
              , i = Math.abs(A.y - e.y)
              , o = Math.abs(A.z - e.z);
            return 1e-7 >= t && 1e-7 >= i && 1e-7 >= o
        },
        arrayMax: function(A) {
            if (0 === A.length)
                return -1 / 0;
            for (var e = A[0], t = 1, i = A.length; i > t; t += 1)
                A[t] > e && (e = A[t]);
            return e
        },
        arrayMin: function(A) {
            if (0 === A.length)
                return 1 / 0;
            for (var e = A[0], t = 1, i = A.length; i > t; t += 1)
                e > A[t] && (e = A[t]);
            return e
        },
        ab2str: function(A) {
            return (new TextDecoder).decode(new Uint8Array(A))
        },
        str2ab: function(A) {
            return (new TextEncoder).encode(A).buffer
        }
    };
    uh.createUUID = function() {
        for (var A = [], e = 0; 36 > e; e += 1)
            A[e] = "0123456789abcdef".substr(Math.floor(16 * Math.random()), 1);
        return A[14] = "4",
        A[19] = "0123456789abcdef".substr(3 & A[19] | 8, 1),
        A[8] = A[13] = A[18] = A[23] = "-",
        A.join("")
    }
    ;
    var fh = {
        "zh-cn": {
            YourGraphicsCardDoesNotSeemToSupportWebGL: "您的显卡似乎不支持WebGL",
            YourBrowserDoesNotSeemToSupportWebGL: "您的浏览器似乎不支持WebGL",
            FindOutHowToGetItHere: "您可以在这里查看相关信息",
            SectionBoxLockHint: "请在使用此方法之前调用enableSectionBox。",
            APIAxisLockHint: "The API supports AxisOption.Z only for now."
        },
        en: {
            YourGraphicsCardDoesNotSeemToSupportWebGL: "Your graphics card does not seem to support WebGL",
            YourBrowserDoesNotSeemToSupportWebGL: "Your browser does not seem to support WebGL",
            FindOutHowToGetItHere: "Find out how to get it here",
            SectionBoxLockHint: "Please call enableSectionBox before using this method.",
            APIAxisLockHint: "The API supports AxisOption.Z only for now."
        }
    }
      , mh = {
        getAndroidVersion: function(A) {
            var e = (A = A || navigator.userAgent).match(/Android\s([0-9.]*)/);
            return !!e && e[1]
        },
        isTouchDevice: function() {
            return "undefined" != typeof window && "ontouchstart"in window
        },
        isBrowser: function() {
            return "undefined" != typeof navigator
        },
        isIE11: function() {
            return mh.isBrowser() && Boolean(navigator.userAgent.match(/Edge|Trident\/7\./))
        },
        isIOSDevice: function() {
            return !!mh.isBrowser() && /ip(ad|hone|od)/.test(navigator.userAgent.toLowerCase())
        },
        isAndroidDevice: function() {
            return !!mh.isBrowser() && -1 !== navigator.userAgent.toLowerCase().indexOf("android")
        },
        isMobileDevice: function() {
            return !!mh.isBrowser() && (mh.isIOSDevice() || mh.isAndroidDevice())
        },
        isSafari: function() {
            if (!mh.isBrowser())
                return !1;
            var A = navigator.userAgent.toLowerCase();
            return -1 !== A.indexOf("safari") && -1 === A.indexOf("chrome")
        },
        isFirefox: function() {
            return !!mh.isBrowser() && -1 !== navigator.userAgent.toLowerCase().indexOf("firefox")
        },
        isChrome: function() {
            return !!mh.isBrowser() && -1 !== navigator.userAgent.toLowerCase().indexOf("chrome")
        },
        isMac: function() {
            return !!mh.isBrowser() && -1 !== navigator.userAgent.toLowerCase().indexOf("mac os")
        },
        isLinux: function() {
            return !!mh.isBrowser() && -1 !== navigator.userAgent.toLowerCase().indexOf("linux x86_64")
        },
        isWindows: function() {
            if (!mh.isBrowser())
                return !1;
            var A = navigator.userAgent.toLowerCase();
            return -1 !== A.indexOf("win32") || -1 !== A.indexOf("windows")
        },
        isWindowsPhone: function() {
            var A = navigator.userAgent.toLowerCase();
            return /(?:Windows Phone)/.test(A)
        },
        isSymbian: function() {
            var A = navigator.userAgent.toLowerCase();
            return /(?:SymbianOS)/.test(A) || mh.isWindowsPhone()
        },
        isTablet: function() {
            var A = navigator.userAgent.toLowerCase();
            return /(?:iPad|PlayBook)/.test(A) || mh.isAndroidDevice() && !/(?:Mobile)/.test(A) || mh.isFirefox() && /(?:Tablet)/.test(A)
        },
        isPc: function() {
            return !mh.isMobileDevice() && !mh.isTablet() && !mh.isSymbian()
        },
        isOpera: function() {
            return navigator.userAgent.indexOf("Opera") > -1
        }
    };
    mh.isSafari();
    mh.detectWebGL = function() {
        if (window.WebGLRenderingContext) {
            for (var A = document.createElement("canvas"), e = ["webgl", "experimental-webgl"], t = !1, i = 0; e.length > i; i += 1)
                try {
                    if ((t = A.getContext(e[i])) && "function" == typeof t.getParameter)
                        return 1
                } catch (A) {}
            return 0
        }
        return -1
    }
    ,
    mh.detectWebGL2 = function() {
        if (window.WebGL2RenderingContext) {
            for (var A = document.createElement("canvas"), e = ["webgl2"], t = !1, i = 0; e.length > i; i += 1)
                try {
                    if ((t = A.getContext(e[i])) && "function" == typeof t.getParameter)
                        return 1
                } catch (A) {}
            return 0
        }
        return -1
    }
    ,
    mh.showWebGLMessage = function(A, e, t) {
        var i, o = null, n = null;
        o = void 0 !== (t = t || {}).parent ? t.parent : document.body,
        i = void 0 !== t.id ? t.id : "oldie",
        (n = mh.getWebGLErrorMessage(A, e)).id = i,
        o.appendChild(n)
    }
    ,
    mh.language = function() {
        return (navigator.browserLanguage || navigator.language).toLowerCase()
    }
    ,
    mh.getWebGLErrorMessage = function(A, e) {
        var t = document.createElement("div");
        t.id = "webgl-error-message",
        t.style.fontSize = "16px",
        t.style.fontWeight = "normal",
        t.style.textAlign = "center",
        t.style.background = "#f4c8c8",
        t.style.color = "#000",
        t.style.padding = "1.5em",
        t.style.width = "400px",
        t.style.position = "absolute",
        t.style.left = document.body.clientWidth / 2 - 224 + "px";
        var i = document.body.clientHeight / 2 - 45;
        return 0 > i && (i = 0),
        t.style.top = i + "px",
        e || (e = "zh-cn"),
        0 === A ? t.innerHTML = [' <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">' + fh[e].YourGraphicsCardDoesNotSeemToSupportWebGL + "</a>.<br />", ' <a href="http://get.webgl.org/" style="color:#000">' + fh[e].FindOutHowToGetItHere + "</a>."].join("\n") : -1 === A && (t.innerHTML = ['<a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation" style="color:#000">' + fh[e].YourBrowserDoesNotSeemToSupportWebGL + "</a>.<br/>", '<a href="http://get.webgl.org/" style="color:#000">' + fh[e].FindOutHowToGetItHere + "</a>."].join("\n")),
        t
    }
    ,
    mh.isSupportIndexedDB = function() {
        return window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB
    }
    ,
    mh.isSupportWorker = function() {
        return window.Worker
    }
    ;
    var Ch = {
        DEBUG: 6,
        PERFORMANCE: 5,
        LOG: 4,
        INFO: 3,
        WARNING: 2,
        ERROR: 1,
        NONE: 0
    }
      , yh = {}
      , vh = function(A) {
        yh[A] ? console.warn("Timer '" + A + "' already exists") : yh[A] = Date.now()
    }
      , Ih = function(A) {
        yh[A] ? (console.warn(A + ":", Date.now() - yh[A], "ms"),
        delete yh[A]) : console.warn("Timer '" + A + "' does not exist")
    };
    function Eh() {
        this.level = -1,
        this.setLevel(Ch.LOG)
    }
    Eh.prototype.setLevel = function(A) {
        if (this.level !== A) {
            this.level = A;
            var e = function() {}
              , t = Ch
              , i = this;
            this.debug = t.DEBUG > A ? e : console.debug.bind(console),
            this.trace = t.DEBUG > A ? e : console.trace.bind(console),
            this.assert = t.DEBUG > A ? e : console.assert.bind(console),
            this.count = t.DEBUG > A ? e : console.count.bind(console),
            this.dir = t.DEBUG > A ? e : console.dir.bind(console),
            this.time = t.PERFORMANCE > A ? e : vh,
            this.timeEnd = t.PERFORMANCE > A ? e : Ih,
            this.log = t.LOG > A ? e : console.log.bind(console),
            this.info = t.INFO > A ? e : console.info.bind(console),
            this.warn = t.WARNING > A ? e : console.warn.bind(console),
            this.error = t.ERROR > A ? e : function() {
                if (i.callback) {
                    var A = Array.prototype.slice.call(arguments).join(" ");
                    i.callback({
                        category: "error",
                        message: A
                    }, {
                        adp: !1
                    })
                }
                console.error.apply(console, arguments)
            }
        }
    }
    ;
    var Bh = new Eh
      , xh = {
        splitStr: function(A) {
            return A.trim().split(/\s+/g)
        },
        getClientHeight: function() {
            return document.body.clientHeight && document.documentElement.clientHeight ? document.body.clientHeight < document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight : document.body.clientHeight > document.documentElement.clientHeight ? document.body.clientHeight : document.documentElement.clientHeight
        },
        getClientWidth: function() {
            return document.body.clientWidth && document.documentElement.clientWidth ? document.body.clientWidth < document.documentElement.clientWidth ? document.body.clientWidth : document.documentElement.clientWidth : document.body.clientWidth > document.documentElement.clientWidth ? document.body.clientWidth : document.documentElement.clientWidth
        },
        getDomOffsetToClient: function(A) {
            var e, t = null;
            if (A !== document) {
                var i = (e = A).getBoundingClientRect ? function(A) {
                    var e = A.getBoundingClientRect()
                      , t = document.body
                      , i = document.documentElement
                      , o = e.left - (i.clientLeft || t.clientLeft);
                    return {
                        top: Math.round(e.top - (i.clientTop || t.clientTop)),
                        left: Math.round(o)
                    }
                }(e) : function(A) {
                    for (var e = 0, t = 0; A; )
                        e += A.offsetTop,
                        t += A.offsetLeft,
                        A = A.offsetParent;
                    var i = document.body
                      , o = document.documentElement;
                    return {
                        top: e -= window.pageYOffset || o.scrollTop || i.scrollTop,
                        left: t -= window.pageXOffset || o.scrollLeft || i.scrollLeft
                    }
                }(e);
                t = {
                    width: A.offsetWidth,
                    height: A.offsetHeight,
                    left: i.left,
                    top: i.top
                }
            } else
                t = {
                    width: window.innerWidth,
                    height: window.innerHeight,
                    left: 0,
                    top: 0
                };
            return t
        },
        setClassName: function(A, e) {
            var t = document.getElementById(A);
            t && (t.className = e)
        },
        addClassName: function(A, e) {
            var t = null
              , i = null
              , o = null
              , n = null
              , r = null
              , a = document.getElementById(A);
            if (a && (i = a,
            e && "string" == typeof e && (t = e.split(/\s+/),
            1 === i.nodeType)))
                if (i.className || 1 !== t.length) {
                    for (o = " " + i.className + " ",
                    n = 0,
                    r = t.length; r > n; n += 1)
                        0 > o.indexOf(" " + t[n] + " ") && (o += t[0] + " ");
                    i.className = String.trim(o)
                } else
                    i.className = e
        },
        removeClassName: function(A, e) {
            var t = null
              , i = null
              , o = null
              , n = null
              , r = null
              , a = document.getElementById(A);
            if (a && (o = a,
            e && "string" == typeof e && (t = (e || "").split(/\s+/),
            1 === o.nodeType && o.className))) {
                for (i = (" " + o.className + " ").replace(0, " "),
                n = 0,
                r = t.length; r > n; n += 1)
                    for (; i.indexOf(" " + t[n] + " ") >= 0; )
                        i = i.replace(" " + t[n] + " ", " ");
                o.className = e ? String.trim(i) : ""
            }
        },
        showOrHideElement: function(A, e) {
            var t = document.getElementById(A);
            t && (t.style.display = e ? "" : "none")
        },
        getStyleString: function(A) {
            var e = [];
            for (var t in A) {
                var i = A[t];
                e.push(t),
                e.push(":"),
                e.push(i),
                e.push("; ")
            }
            return e.join("")
        },
        cloneStyle: function(A) {
            var e = {};
            for (var t in A)
                e[t] = A[t];
            return e
        },
        removeStyleAttribute: function(A, e) {
            Array.isArray(e) || (e = [e]),
            e.forEach((function(e) {
                e in A && delete A[e]
            }
            ))
        },
        trimRight: function(A) {
            if (0 === A.length)
                return "";
            for (var e = A.length - 1, t = e; t >= 0; t -= 1)
                if (" " !== A.charAt(t)) {
                    e = t;
                    break
                }
            return A.substr(0, e + 1)
        },
        trimLeft: function(A) {
            if (0 === A.length)
                return "";
            for (var e = 0, t = 0; A.length > t; t += 1)
                if (" " !== A.charAt(t)) {
                    e = t;
                    break
                }
            return A.substr(e)
        },
        trim: function(A) {
            return A.replace(/(^\s*)|(\s*$)/g, "")
        },
        matchesSelector: function(A, e) {
            if (A.matches)
                return A.matches(e);
            if (A.matchesSelector)
                return A.matchesSelector(e);
            if (A.webkitMatchesSelector)
                return A.webkitMatchesSelector(e);
            if (A.msMatchesSelector)
                return A.msMatchesSelector(e);
            if (A.mozMatchesSelector)
                return A.mozMatchesSelector(e);
            if (A.oMatchesSelector)
                return A.oMatchesSelector(e);
            if (A.querySelectorAll) {
                for (var t = (A.document || A.ownerDocument).querySelectorAll(e), i = 0; t[i] && void 0 !== t[i]; )
                    i += 1;
                return !!t[i]
            }
            return !1
        },
        toTranslate3d: function(A, e) {
            return "translate3d(" + A + "px," + e + "px,0)"
        },
        setCursorStyle: function(A, e) {
            var t = null;
            switch (e) {
            case "n":
            case "s":
                t = "ns-resize";
                break;
            case "w":
            case "e":
                t = "ew-resize";
                break;
            case "ne":
            case "sw":
                t = "nesw-resize";
                break;
            case "nw":
            case "se":
                t = "nwse-resize"
            }
            A.style.cursor = t
        },
        css: function(A, e) {
            for (var t = A.getAttribute("style") || "", i = Object.keys(e), o = t.split(";"), n = [], r = 0, a = o.length; a > r; r += 1) {
                "" !== (s = o[r]) ? n.push(s.replace(/:.+/, "")) : o.splice(r, 1)
            }
            for (r = 0,
            a = i.length; a > r; r += 1) {
                var s = i[r]
                  , l = -1;
                o.map((function(A, e) {
                    return A.indexOf(s) > -1 && (l = e),
                    null
                }
                )),
                l > -1 ? o[l] = s + ":" + e[s] : o.push(s + ":" + e[s])
            }
            var c = o.join(";");
            A.setAttribute("style", c + ";")
        },
        append: function(A, e) {
            if ("string" == typeof e) {
                var t = document.createElement("div");
                t.innerHTML = e;
                for (var i = document.createDocumentFragment(); t.firstChild; )
                    i.appendChild(t.firstChild);
                A.appendChild(i)
            } else
                A.appendChild(e)
        },
        scrollTop: function(A, e) {
            var t = A.scrollTop;
            if (t > e)
                var i = setInterval((function() {
                    var t = A.scrollTop
                      , o = Math.floor(-t / 6);
                    A.scrollTop = t = o + t,
                    A.scrollTop > e || (A.scrollTop = A.scrollTop = e,
                    clearTimeout(i))
                }
                ), 20);
            else if (0 === t)
                var o = setInterval((function() {
                    var i = A.scrollTop
                      , n = Math.floor(70);
                    A.scrollTop = i = n + i,
                    t > A.scrollTop && (A.scrollTop = e,
                    clearTimeout(o))
                }
                ), 20);
            else if (e > t)
                var n = setInterval((function() {
                    var i = A.scrollTop
                      , o = Math.floor(i / 6);
                    A.scrollTop = i = o + i,
                    t > A.scrollTop && (A.scrollTop = e,
                    clearTimeout(n))
                }
                ), 20);
            else if (e === t)
                return !1
        },
        closest: function(A, e) {
            if (!A)
                return null;
            for (var t = A.matches || A.webkitMatchesSelector || A.mozMatchesSelector || A.msMatchesSelector; A && !t.call(A, e); )
                A = A.parentElement;
            return A
        },
        addEventListener: function(A, e, t) {
            if (A)
                if (A.length)
                    for (var i = 0; A.length > i; i += 1)
                        A[i].addEventListener(e, (function(A) {
                            t && "function" == typeof t && t(A)
                        }
                        ));
                else
                    A.addEventListener(e, (function(A) {
                        t && "function" == typeof t && t(A)
                    }
                    ))
        },
        remove: function(A) {
            if (A)
                if (A.removeNode = [],
                void 0 !== A.length) {
                    for (var e = A.length, t = 0; e > t; t += 1)
                        A.removeNode.push({
                            parent: A[t].parentNode,
                            inner: A[t].outerHTML,
                            next: A[t].nextSibling
                        });
                    for (t = 0; e > t; t += 1)
                        A[0].parentNode.removeChild(A[0])
                } else
                    A.removeNode.push({
                        parent: A.parentNode,
                        inner: A.outerHTML,
                        next: A.nextSibling
                    }),
                    A.parentNode.removeChild(A)
        },
        getStyleValue: function(A, e) {
            var t = A.ownerDocument.defaultView;
            return t && t.opener || (t = window),
            A.currentStyle ? A.currentStyle[e] : t.getComputedStyle(A)[e]
        },
        isShow: function(A) {
            return "none" !== this.getStyleValue(A, "display")
        },
        getHeight: function(A) {
            if (null != A) {
                if (this.isShow(A)) {
                    if (null != A.style.height && A.style.height.length > 0)
                        return parseFloat(A.style.height);
                    if (parseFloat(this.getStyleValue(A, "height")) > 0)
                        return parseFloat(this.getStyleValue(A, "height"));
                    if (A.offsetHeight > 0) {
                        var e = this.getStyleValue(A, "borderTopWidth")
                          , t = this.getStyleValue(A, "borderBottomWidth")
                          , i = this.getStyleValue(A, "paddingTop")
                          , o = this.getStyleValue(A, "paddingBottom")
                          , n = parseFloat(A.offsetHeight) - parseFloat(e) - parseFloat(t) - parseFloat(i) - parseFloat(o);
                        return parseFloat(n)
                    }
                    return 0
                }
                var r = A.getAttribute("style") || "";
                A.setAttribute("style", r + "visibility:hidden;display:block !important;");
                var a = this.getHeight(A);
                return A.setAttribute("style", r),
                Math.ceil(a)
            }
        },
        getWidth: function(A) {
            if (null != A) {
                if (this.isShow(A)) {
                    if (null != A.style.width && A.style.width.length > 0)
                        return parseFloat(A.style.width);
                    if (parseFloat(this.getStyleValue(A, "width")) > 0)
                        return parseFloat(this.getStyleValue(A, "width"));
                    if (A.offsetWidth > 0) {
                        var e = this.getStyleValue(A, "borderLeftWidth")
                          , t = this.getStyleValue(A, "borderRightWidth")
                          , i = this.getStyleValue(A, "paddingLeft")
                          , o = this.getStyleValue(A, "paddingRight")
                          , n = parseFloat(A.offsetWidth) - parseFloat(e) - parseFloat(t) - parseFloat(i) - parseFloat(o);
                        return parseFloat(n)
                    }
                    return 0
                }
                var r = A.getAttribute("style") || "";
                A.setAttribute("style", r + "visibility:hidden;display:inline-block !important;");
                var a = this.getWidth(A);
                return A.setAttribute("style", r),
                Math.ceil(a)
            }
        },
        outerHeight: function(A, e) {
            var t = A.offsetHeight;
            if (e) {
                var i = A.currentStyle || getComputedStyle(A);
                t += parseInt(i.marginTop, 0) + parseInt(i.marginBottom, 0)
            }
            return t
        },
        outerWidth: function(A, e) {
            var t = A.offsetWidth;
            if (e) {
                var i = A.currentStyle || getComputedStyle(A);
                t += parseInt(i.marginLeft, 0) + parseInt(i.marginRight, 0)
            }
            return t
        },
        isEmptyObject: function(A) {
            var e = null;
            for (e in A)
                return !1;
            return !0
        },
        hasClass: function(A, e) {
            if (A) {
                var t = A.className.match && A.className.match(new RegExp("(\\s|^)" + e + "(\\s|$)"));
                return Boolean(t)
            }
            return !1
        },
        addClass: function(A, e) {
            A && (this.hasClass(A, e) || (A.className += " " + e))
        },
        removeClass: function(A, e) {
            if (this.hasClass(A, e)) {
                var t = new RegExp("(\\s|^)" + e + "(\\s|$)");
                A.className = A.className.replace(t, " ")
            }
        },
        toggleClass: function(A, e) {
            this.hasClass(A, e) ? this.removeClass(A, e) : this.addClass(A, e)
        },
        simulateEvent: function(A, e) {
            var t = document.createEvent("Event");
            t.initEvent(e, !0, !0);
            A.dispatchEvent(t)
        },
        bind: function(A, e, t) {
            A && (A.addEventListener ? A.addEventListener(e, t, !1) : A.attachEvent ? A.attachEvent("on" + e, t) : A["on" + e] = t)
        },
        delegate: function(A, e, t, i) {
            if (A)
                if (A.length)
                    for (var o = 0; A.length > o; o += 1)
                        this.delegateFn(A[o], e, t, i);
                else
                    this.delegateFn(A, e, t, i)
        },
        delegateFn: function(A, e, t, i) {
            var o = this;
            function n(A) {
                var n = (A = A || window.event).target || A.srcElement;
                o.matchSelector(n, e) && i && ("mouseenter" === t || "mouseleave" === t ? o.fixedMouse(A, n) && i.call(n, A) : i.call(n, A))
            }
            t = t.toLowerCase(),
            A.addEventListener ? A.addEventListener("mouseenter" === t ? "mouseover" : "mouseleave" === t ? "mouseout" : t, n) : A.attachEvent("mouseenter" === t ? "onmouseover" : "mouseleave" === t ? "onmouseout" : "on" + t, n)
        },
        matchSelector: function(A, e) {
            return "#" === e.charAt(0) ? A.id === e.slice(1) : "." === e.charAt(0) ? -1 !== (" " + A.className + " ").indexOf(" " + e.slice(1) + " ") : A.tagName.toLowerCase() === e.toLowerCase()
        },
        contains: function(A, e) {
            return A.contains ? A !== e && A.contains(e) : Boolean(16 & A.compareDocumentPosition(e))
        },
        fixedMouse: function(A, e) {
            var t = null
              , i = A.type.toLowerCase();
            if ("mouseover" === i)
                t = A.relatedTarget || A.fromElement;
            else {
                if ("mouseout" !== i)
                    return !0;
                t = A.relatedTarget || A.toElement
            }
            return t && "xul" !== t.prefix && !this.contains(e, t) && t !== e
        },
        fireEvent: function(A, e) {
            var t = null;
            if (A.ownerDocument)
                t = A.ownerDocument;
            else {
                if (9 !== A.nodeType)
                    throw new Error("Invalid node passed to fireEvent: " + A.id);
                t = A
            }
            if (A.dispatchEvent) {
                var i = "";
                switch (e) {
                case "click":
                case "mousedown":
                case "mouseup":
                    i = "MouseEvents";
                    break;
                case "focus":
                case "change":
                case "blur":
                case "select":
                    i = "HTMLEvents";
                    break;
                default:
                    Bh.error("fireEvent: Couldn't find an event class for event '" + e + "'.")
                }
                (o = t.createEvent(i)).initEvent(e, "change" !== e, !0),
                o.synthetic = !0,
                A.dispatchEvent(o, !0)
            } else if (A.fireEvent) {
                var o;
                (o = t.createEventObject()).synthetic = !0,
                A.fireEvent("on" + e, o)
            }
        }
    };
    xh.create = function(A, e) {
        var t = document.createElement(A);
        return t.setAttribute("class", e),
        t
    }
    ;
    xh.createNS = function(A, e) {
        var t = document.createElementNS("http://www.w3.org/2000/svg", A);
        return t.setAttribute("class", e),
        t
    }
    ;
    xh.select = function(A) {
        return A.indexof("#") ? document.getElementById(A.replace("#", "")) : A.indexof(".") ? document.getElementsByClassName(A.replace(".", "")) : document.getElementsByTagName(A)
    }
    ;
    var Sh = function(A) {
        if ("" === A)
            return 0;
        if ("string" == typeof A) {
            if (-1 === A.indexOf("px")) {
                var e = Number(A);
                return isNaN(e) ? 0 : e
            }
            var t = A.split("px")
              , i = Number(t[0]);
            return isNaN(i) ? 0 : i
        }
        return 0
    };
    xh.drag = function(A) {
        var e = mh.isPc()
          , t = Object.assign({
            element: null,
            handle: null,
            axis: "all",
            cursor: "move",
            distance: 0,
            start: null,
            move: null,
            stop: null
        }, A)
          , i = t.element;
        if (!i)
            return !1;
        var o = t.handle || i
          , n = void 0
          , r = !1
          , a = function(A) {
            if (e)
                var o = {
                    x: A.clientX,
                    y: A.clientY
                };
            else
                o = {
                    x: A.touches[0].clientX,
                    y: A.touches[0].clientY
                };
            var a = {
                x: o.x - n.x,
                y: o.y - n.y
            };
            r ? (t.move && t.move(n, o, a),
            n = o,
            function(A) {
                var e = i.offsetLeft
                  , o = i.offsetTop
                  , n = Sh(getComputedStyle(i).marginLeft)
                  , r = Sh(getComputedStyle(i).marginTop)
                  , a = 0 > (e -= n) + A.x ? 0 : e + A.x
                  , s = 0 > (o -= r) + A.y ? 0 : o + A.y;
                switch (t.axis) {
                case "x":
                    i.style.left = a + "px";
                    break;
                case "y":
                    i.style.top = s + "px";
                    break;
                case "all":
                default:
                    i.style.left = a + "px",
                    i.style.top = s + "px"
                }
            }(a)) : r = function(A) {
                return Math.pow(A.x, 2) + Math.pow(A.y, 2) > Math.pow(t.distance, 2) && (t.start && t.start(n),
                !0)
            }(a)
        }
          , s = function(A) {
            var i, r, s = A;
            if (e) {
                if (i = s.button,
                !((r = navigator.userAgent).indexOf("compatible") > -1 && r.indexOf("MSIE") > -1 && !mh.isOpera() ? 1 === i : 0 === i))
                    return;
                n = {
                    x: s.clientX,
                    y: s.clientY
                },
                document.addEventListener("mousemove", a)
            } else
                n = {
                    x: s.touches[0].clientX,
                    y: s.touches[0].clientY
                },
                o.addEventListener("touchmove", a);
            t.start && t.start(n)
        }
          , l = function() {
            r && t.end && t.end(n),
            r = !1,
            document.removeEventListener("mousemove", a),
            o.removeEventListener("touchmove", a)
        };
        e ? (o.style.cursor = t.cursor,
        o.style.userSelect = "none",
        o.addEventListener("mousedown", s),
        document.addEventListener("mouseup", l)) : (o.addEventListener("touchend", l),
        o.addEventListener("touchstart", s))
    }
    ;
    xh.sizable = function(A) {
        var e = Object.assign({
            element: null,
            axis: "all",
            minWidth: 100,
            minHeight: 100,
            distance: 0,
            start: null,
            sizable: null,
            stop: null
        }, A)
          , t = e.element;
        if (!t)
            return !1;
        var i = void 0
          , o = !1
          , n = xh.create("div", "yj-resize")
          , r = void 0
          , a = void 0
          , s = function(A) {
            var n = {
                x: A.clientX,
                y: A.clientY
            }
              , s = {
                x: n.x - i.x,
                y: n.y - i.y
            };
            o ? (e.sizable && e.sizable(i, n, s),
            function(A) {
                var i = t.offsetLeft
                  , o = t.offsetTop
                  , n = e.minWidth > r + A.x ? e.minWidth : r + A.x
                  , s = e.minHeight > a + A.y ? e.minHeight : a + A.y;
                switch (e.resize && e.resize(n, s),
                t.style.left = i + "px",
                t.style.top = o + "px",
                e.axis) {
                case "x":
                    t.style.width = n + "px";
                    break;
                case "y":
                    t.style.height = s + "px";
                    break;
                case "all":
                default:
                    t.style.width = n + "px",
                    t.style.height = s + "px"
                }
            }(s)) : o = function(A) {
                return Math.pow(A.x, 2) + Math.pow(A.y, 2) > Math.pow(e.distance, 2) && (e.start && e.start(i),
                !0)
            }(s)
        }
          , l = function(A) {
            r = t.clientWidth,
            a = t.clientHeight;
            var e, o, n = A;
            (e = n.button,
            (o = navigator.userAgent).indexOf("compatible") > -1 && o.indexOf("MSIE") > -1 && !mh.isOpera() ? 1 === e : 0 === e) && (i = {
                x: n.clientX,
                y: n.clientY
            },
            document.addEventListener("mousemove", s),
            document.addEventListener("touchmove", s))
        }
          , c = function() {
            o && e.end && e.end(i),
            o = !1,
            document.removeEventListener("mousemove", s),
            document.removeEventListener("touchmove", s)
        };
        xh.addClass(t, "yj-sizable"),
        t.appendChild(n),
        n.addEventListener("mousedown", l),
        n.addEventListener("touchstart", l),
        document.addEventListener("mouseup", c),
        document.addEventListener("touchend", c)
    }
    ;
    var wh = function(A) {
        var e = this
          , t = Object.assign({
            element: null,
            min: 0,
            max: 100,
            cur: 50,
            step: 1,
            isShowProgress: !0,
            input: null,
            change: null,
            currentColor: "#11dab7",
            defaultColor: "#999"
        }, A);
        this._opt = t;
        var i = xh.create("div", "yj-range")
          , o = xh.create("input", "yj-input-range");
        e.input = o,
        o.setAttribute("type", "range"),
        o.setAttribute("step", t.step),
        o.setAttribute("min", t.min),
        o.setAttribute("max", t.max),
        o.setAttribute("value", t.cur);
        var n = xh.create("span", "yj-range-min");
        n.innerText = t.min;
        var r = xh.create("span", "yj-range-cur");
        e.cur = r,
        r.innerText = t.cur;
        var a = xh.create("span", "yj-range-max");
        a.innerText = t.max;
        var s = xh.create("span", "yj-range-progress");
        i.appendChild(o),
        t.isShowProgress && (i.appendChild(n),
        i.appendChild(r),
        i.appendChild(a)),
        i.appendChild(s),
        t.element.appendChild(i),
        e.setProgress(t.cur),
        o.addEventListener("input", (function() {
            e.setProgress(this.value),
            t.input && t.input(this.value)
        }
        )),
        o.addEventListener("change", (function() {
            e.setProgress(this.value),
            t.change && t.change(this.value)
        }
        ))
    };
    wh.prototype.setProgress = function(A) {
        var e = this._opt
          , t = this.input
          , i = this.cur
          , o = (A - e.min) / (e.max - e.min) * 100;
        t.value = A,
        t.style.background = "linear-gradient(to right," + e.currentColor + " 0%," + e.currentColor + "  " + o + "%," + e.defaultColor + " " + o + "%, " + e.defaultColor + " 100%)",
        i.innerText = A
    }
    ,
    wh.prototype.reset = function() {
        this.setProgress(this._opt.cur)
    }
    ,
    xh.range = wh;
    var Mh = function(A) {
        this._opt = Object.assign({
            element: null,
            min: 0,
            max: 100,
            from: null,
            to: null,
            step: 1,
            currentColor: "#11dab7",
            defaultColor: "#999",
            change: null
        }, A),
        this._opt.from = this._opt.from || this._opt.min,
        this._opt.to = this._opt.to || this._opt.max,
        this.init()
    };
    Mh.prototype = {
        init: function() {
            var A = xh.create("div", "yj-multiple-range")
              , e = xh.create("div", "yj-range-track")
              , t = xh.create("span", "yj-slider yj-slider-min");
            t.id = "minSlider",
            t.type = "minimum";
            var i = xh.create("span", "yj-slider yj-slider-max");
            i.id = "maxSlider",
            i.type = "maximum",
            this._state = {
                from: this._opt.from,
                to: this._opt.to
            },
            e.style.backgroundColor = this._opt.currentColor,
            A.style.backgroundColor = this._opt.defaultColor,
            A.appendChild(e),
            A.appendChild(t),
            A.appendChild(i),
            this._opt.element.appendChild(A),
            this._track = e,
            this._sliders = {
                min: t,
                max: i
            },
            this._element = A,
            this.bindEvent(),
            this.update(!1)
        },
        bindEvent: function() {
            var A = this
              , e = !1
              , t = null
              , i = null
              , o = function(A) {
                A = A || event;
                i = A.screenX,
                t = this,
                e = !0
            };
            this._sliders.min.addEventListener("mousedown", o),
            this._sliders.max.addEventListener("mousedown", o),
            document.addEventListener("mousemove", (function(o) {
                if (e) {
                    o = o || event;
                    var n = Math.round((o.screenX - i) / A._pix / A._opt.step) * A._opt.step;
                    0 !== n && (i = n * A._pix + i,
                    "minimum" === t.type ? A._state.from += n : A._state.to += n,
                    A.recalculate(t),
                    A.update(!0))
                }
            }
            )),
            document.addEventListener("mouseup", (function() {
                t = null,
                e = !1
            }
            ))
        },
        update: function(A) {
            var e = this._sliders.min.offsetWidth
              , t = this._sliders.max.offsetWidth;
            this._pix || (this._pix = (this._element.offsetWidth - e - t) / (this._opt.max - this._opt.min));
            var i = (this._state.from - this._opt.min) * this._pix
              , o = (this._state.to - this._opt.min) * this._pix + e + t;
            this._track.style.left = i + e / 2 + "px",
            this._track.style.width = o - i - e / 2 - t / 2 + "px",
            this._sliders.min.style.left = i + "px",
            this._sliders.max.style.left = o + "px",
            this._opt.change && A && this._opt.change(this._state)
        },
        recalculate: function(A) {
            this._opt.max > this._state.to || (this._state.to = this._opt.max),
            this._state.from > this._opt.min || (this._state.from = this._opt.min),
            A && ("maximum" === A.type && (this._state.to > this._state.from || (this._state.to = this._state.from)),
            "minimum" === A.type && (this._state.to > this._state.from || (this._state.from = this._state.to)))
        },
        getProgress: function() {
            return this._state
        },
        setProgress: function(A) {
            this._state = A,
            this.recalculate(),
            this.update(!1)
        }
    },
    xh.multipleRange = Mh;
    var bh = function() {
        var A = this;
        Math.randomString = function(A) {
            for (var e = "", t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", i = 0; A > i; i += 1)
                e += t.charAt(Math.floor(Math.random() * t.length));
            return e
        }
        ,
        A.viewport = document.body,
        A.counter = 0,
        A.prompt = function(A, e) {
            return new t(A,e)
        }
        ,
        A.confirm = function(A) {
            return new i(A)
        }
        ,
        A.progress = function(A) {
            return new n(A)
        }
        ,
        A.error = {},
        A.success = {},
        A.warning = {},
        A.info = {},
        A.alert = function(A, e) {
            if (["success", "error", "warning", "info"].indexOf(A) > -1)
                return new o(A,e)
        }
        ,
        A.window = function(A) {
            return new r("window",A)
        }
        ;
        var e = {
            $type: null,
            $el: null,
            $options: null,
            debug: function() {
                this.$options.debug && window.console.debug.apply(window.console, arguments)
            },
            _processInput: function(e) {
                if (Array.isArray(e.buttons)) {
                    for (var t = {}, i = 0; e.buttons.length > i; i += 1)
                        t[e.buttons[i]] = A.base.OPTIONS.buttons[e.buttons[i]];
                    e.buttons = t
                }
                for (var i in e.customBtnClass = e.customBtnClass ? e.customBtnClass : A.base.DEFAULTS.customBtnClass,
                e.buttons)
                    if (e.buttons.hasOwnProperty(i)) {
                        var o = e.buttons[i];
                        (o = uh.extend(!0, {}, A.base.OPTIONS.buttons[i], o)).class || (o.class = e.customBtnClass),
                        e.buttons[i] = o
                    }
                return void 0 === (e = uh.extend(!0, {}, A.base.DEFAULTS, e)).showClass && (e.showClass = A.base.OPTIONS.showClass),
                void 0 === e.hideClass && (e.hideClass = A.base.OPTIONS.hideClass),
                void 0 === e.baseClass && (e.baseClass = A.base.OPTIONS.baseClass),
                void 0 === e.delayToRemove && (e.delayToRemove = A.base.OPTIONS.delayToRemove),
                e.iconClass || (e.iconClass = A.base.OPTIONS.icons[e.iconSource][this.$type]),
                e
            },
            _init: function() {
                var A = this;
                A._createMarkup(),
                A.setTitle(A.$options.title),
                A.$options.draggable && (A.$el.classList.add("draggable"),
                A._enableDrag()),
                A.$options.closeButton && A._addCloseButton(),
                A.$options.closeOnEsc && document.addEventListener("keyup.lobibox", (function(e) {
                    27 === e.which && A.destroy()
                }
                )),
                A.$options.baseClass && A.$el.classList.add(A.$options.baseClass),
                A.$options.showClass && (A.$el.classList.remove(A.$options.hideClass),
                A.$el.classList.add(A.$options.showClass)),
                A.$options.id && A.$el.setAttribute("id", A.$options.id),
                A.$el.dataset.lobibox = A
            },
            _calculatePosition: function(A) {
                var e;
                return e = "top" === A ? 30 : "bottom" === A ? window.outerHeight - xh.outerHeight(this.$el) - 30 : (window.outerHeight - xh.outerHeight(this.$el)) / 2,
                "left:" + (window.outerWidth - xh.outerWidth(this.$el)) / 2 + "px;top:" + e + "px;"
            },
            _createButton: function(A, e) {
                var t = this
                  , i = document.createElement("button")
                  , o = [];
                return e && e.class && (o = e.class.split(" ")),
                o.map((function(A, e) {
                    i.classList.add(A)
                }
                )),
                i.dataset.type = A,
                i.innerHTML = e.text,
                t.$options.callback && "function" == typeof t.$options.callback && i.addEventListener("click", (function(e) {
                    t._onButtonClick(t.$options.buttons[A], A),
                    t.$options.callback(t, this.dataset.type, e)
                }
                )),
                i
            },
            _onButtonClick: function(A, e) {
                ("ok" === e && "prompt" === this.$type && this.isValid() || "prompt" !== this.$type || "ok" !== e) && A && A.closeOnClick && this.destroy()
            },
            _generateButtons: function() {
                var A = [];
                for (var e in this.$options.buttons)
                    if (this.$options.buttons.hasOwnProperty(e)) {
                        var t = this._createButton(e, this.$options.buttons[e]);
                        A.push(t)
                    }
                return A
            },
            _createMarkup: function() {
                var e = this
                  , t = document.createElement("div");
                t.className = "lobibox",
                t.dataset.isModal = e.$options.modal,
                t.dataset.backdrop = !!e.$options.backdrop;
                var i = document.createElement("div");
                i.className = "lobibox-header",
                t.appendChild(i);
                var o = document.createElement("span");
                o.className = "lobibox-title",
                i.appendChild(o);
                var n = document.createElement("div");
                if (n.className = "lobibox-body",
                t.appendChild(n),
                e.$options.buttons && !uh.isEmptyObject(e.$options.buttons)) {
                    var r = document.createElement("div");
                    r.className = "lobibox-footer",
                    e._generateButtons().map((function(A, e) {
                        r.appendChild(A)
                    }
                    )),
                    t.appendChild(r),
                    A.base.OPTIONS.buttonsAlign.indexOf(e.$options.buttonsAlign) > -1 && r.classList.add("text-" + e.$options.buttonsAlign)
                }
                t.classList.add(A.base.OPTIONS.modalClasses[e.$type]),
                e.$el = t
            },
            _setSize: function() {
                var A = this;
                A.setWidth(A.$options.width),
                A.setHeight("auto" === A.$options.height ? xh.outerHeight(A.$el) : A.$options.height)
            },
            _calculateBodyHeight: function(A) {
                var e = this.$el.querySelector(".lobibox-header").outerHeight
                  , t = this.$el.querySelector(".lobibox-footer").outerHeight;
                return A - (e || 0) - (t || 0)
            },
            _addBackdrop: function() {
                if (0 === document.querySelectorAll(".lobibox-backdrop").length) {
                    var e = document.createElement("div");
                    e.className = "lobibox-backdrop",
                    A.viewport.appendChild(e)
                }
            },
            _removeBackdrop: function() {
                for (var A = document.querySelectorAll(".lobibox-backdrop"), e = 0; A.length > e; e += 1)
                    A[e].remove()
            },
            _triggerEvent: function(A) {
                this.$options[A] && "function" == typeof this.$options[A] && this.$options[A](this)
            },
            _calculateWidth: function(A) {
                return (A = Math.min(Math.max(A, this.$options.width), window.outerWidth)) === window.outerWidth && (A -= 2 * this.$options.horizontalOffset),
                A
            },
            _calculateHeight: function(A) {
                return (A = Math.min(Math.max(A, this.$options.height), window.outerHeight)) === window.outerHeight && (A -= 2 * this.$options.verticalOffset),
                A
            },
            _addCloseButton: function() {
                var A = this
                  , e = document.createElement("span");
                e.className = "btn-close",
                e.innerHTML = "&times;",
                A.$el.querySelector(".lobibox-header").appendChild(e),
                e.addEventListener("mousedown", (function(A) {
                    A.stopPropagation()
                }
                )),
                e.addEventListener("click", (function() {
                    A.destroy()
                }
                ))
            },
            _position: function() {
                this._setSize();
                var A = this._calculatePosition();
                this.setPosition(A.left, A.top)
            },
            _isMobileScreen: function() {
                return 768 > window.outerHeight
            },
            _enableDrag: function() {
                var A = this.$el
                  , e = A.querySelector(".lobibox-header");
                e.addEventListener("mousedown", (function(e) {
                    e.preventDefault(),
                    A.setAttribute("offset-left", e.offsetX),
                    A.setAttribute("offset-top", e.offsetY),
                    A.setAttribute("allow-drag", "true")
                }
                )),
                document.addEventListener("mouseup", (function() {
                    A.setAttribute("allow-drag", "false")
                }
                )),
                document.addEventListener("mousemove", (function(e) {
                    if ("true" === A.getAttribute("allow-drag")) {
                        var t = e.clientX
                          , i = e.clientY;
                        0 > i && (i = 5),
                        i > document.body.clientHeight && (i = document.body.clientHeight - 10),
                        0 > t && (t = 5),
                        t > document.body.clientWidth - A.offsetWidth && (t = document.body.clientWidth - A.offsetWidth),
                        A.style.cssText += "left:" + t + "px;top:" + i + "px;"
                    }
                }
                )),
                e.addEventListener("touchstart", (function(e) {
                    var t = A.style.top
                      , i = e.originalEvent.targetTouches[0].clientY;
                    A.setAttribute("offset-left", e.originalEvent.targetTouches[0].clientX - A.style.left),
                    A.setAttribute("offset-top", i - t),
                    A.setAttribute("allow-drag", "true")
                }
                )),
                document.addEventListener("touchend", (function() {
                    A.setAttribute("allow-drag", "false")
                }
                )),
                document.addEventListener("touchmove", (function(e) {
                    if ("true" === A.getAttribute("allow-drag")) {
                        var t = e.originalEvent.targetTouches[0].clientX
                          , i = e.originalEvent.targetTouches[0].clientY;
                        0 > i && (i = 5),
                        i > document.body.clientHeight && (i = document.body.clientHeight - 10),
                        0 > t && (t = 5),
                        t > document.body.clientWidth - A.offsetWidth && (t = document.body.clientWidth - A.offsetWidth),
                        A.style.cssText += "left:" + t + "px;top:" + i + "px;"
                    }
                }
                ))
            },
            _setContent: function(A) {
                return A && ("string" == typeof A && A.constructor == String ? this.$el.querySelector(".lobibox-body").innerHTML = A : this.$el.querySelector(".lobibox-body").appendChild(A)),
                this
            },
            _beforeShow: function() {
                this._triggerEvent("onShow")
            },
            _afterShow: function() {
                var e = this;
                A.counter++,
                e.$el.setAttribute("data-nth", A.counter),
                e.$options.draggable || window.addEventListener("resize.lobibox-" + e.$el.getAttribute("data-nth"), (function() {
                    e.refreshWidth(),
                    e.refreshHeight(),
                    e.$el.style.cssText += "left:50%;top:50%;margin-left:" + -e.$el.width / 2 + "px;margin-top:" + -e.$el.height / 2 + "px;"
                }
                )),
                e._triggerEvent("shown")
            },
            _beforeClose: function() {
                this._triggerEvent("beforeClose")
            },
            _afterClose: function() {
                this.$options.draggable || window.removeEventListener("resize.lobibox-" + this.$el.getAttribute("data-nth")),
                this._triggerEvent("closed")
            },
            _beforeHide: function() {
                this._triggerEvent("beforeHide")
            },
            _afterHide: function() {
                this._triggerEvent("afterHide")
            },
            hide: function() {
                var e = this;
                function t() {
                    e.$el.classList.add("lobibox-hidden");
                    for (var t = document.querySelectorAll(".lobibox"), i = [].slice.call(t), o = 0; i.length > o; o += 1)
                        !0 !== i[o].dataset.isModal && i.splice(o, 1);
                    for (o = 0; i.length > o; o += 1)
                        i[o].classList.contains("lobibox-hidden") && i.splice(o, 1);
                    if (0 === i.length) {
                        var n = document.querySelectorAll(".lobibox-backdrop");
                        for (o = 0; n.length > o; o += 1)
                            A.viewport.removeChild(n[o]);
                        A.viewport.classList.remove(A.base.OPTIONS.bodyClass)
                    }
                    e._afterHide()
                }
                return e._beforeHide(),
                e.$options.hideClass ? (e.$el.classList.remove(e.$options.showClass),
                e.$el.classList.add(e.$options.hideClass),
                setTimeout((function() {
                    t()
                }
                ), e.$options.delayToRemove)) : t(),
                this
            },
            destroy: function() {
                var e = this;
                function t() {
                    e.$el.remove();
                    for (var t = document.querySelectorAll(".lobibox"), i = [].slice.call(t), o = 0; i.length > o; o += 1)
                        "true" !== i[o].dataset.isModal && i.splice(o, 1);
                    if (0 === i.length) {
                        var n = document.querySelectorAll(".lobibox-backdrop");
                        for (o = 0; n.length > o; o += 1)
                            A.viewport.removeChild(n[o]);
                        A.viewport.classList.remove(A.base.OPTIONS.bodyClass)
                    }
                    var r = !1;
                    for (o = 0; i.length > o; o += 1)
                        if ("true" === i[o].dataset.backdrop) {
                            r = !0;
                            break
                        }
                    r || e._removeBackdrop(),
                    e._afterClose()
                }
                return e._beforeClose(),
                e.$options.hideClass ? (xh.removeClass(e.$el, e.$options.showClass),
                xh.addClass(e.$el, e.$options.hideClass),
                setTimeout((function() {
                    t()
                }
                ), e.$options.delayToRemove)) : t(),
                this
            },
            setWidth: function(A) {
                return this.$el.style.cssText += "width:" + this._calculateWidth(A) + "px;",
                this
            },
            refreshWidth: function() {
                this.setWidth(this.$el.style.width)
            },
            refreshHeight: function() {
                this.setHeight(this.$el.style.height)
            },
            setHeight: function(A) {
                var e = this;
                return e.$el.style.cssText += "height:" + e._calculateHeight(A) + "px",
                e.$el.querySelector(".lobibox-body").style.cssText += "height:" + (e.$options.height - 41) + "px",
                e
            },
            setSize: function(A, e) {
                return this.setWidth(A),
                this.setHeight(e),
                this
            },
            setPosition: function(A, e) {
                var t;
                return "number" == typeof A && "number" == typeof e ? t = "left:" + A + "px;top:" + e + "px;" : "string" == typeof A ? t = this._calculatePosition(A) : "object" === lc(A) && (t = "left:" + A.left + "px;top:" + A.top + "px;right:" + A.right + "px;bottom:" + A.bottom + "px;"),
                this.$el.style.cssText += t,
                this
            },
            setTitle: function(A) {
                return this.$el.querySelector(".lobibox-title").innerHTML = A
            },
            getTitle: function() {
                return this.$el.querySelector(".lobibox-title").innerHTML
            },
            show: function() {
                var e = this
                  , t = A.viewport;
                (e._beforeShow(),
                e.$el.classList.remove("lobibox-hidden"),
                t.appendChild(e.$el),
                e.$options.buttons) && e.$el.querySelector(".lobibox-footer").children[0].focus();
                return (e.$options.modal || e.$options.backdrop) && (t.classList.add(A.base.OPTIONS.bodyClass),
                e._addBackdrop()),
                !1 !== e.$options.delay && setTimeout((function() {
                    e.destroy()
                }
                ), e.$options.delay),
                e._afterShow(),
                e
            }
        };
        function t(e, t) {
            this.$input = null,
            this.$type = "prompt",
            "object" == lc(e) ? t = e : this.$promptType = e,
            t = uh.extend(!0, {}, A.prompt.DEFAULT_OPTIONS, t),
            this.$options = this._processInput(t),
            this._init(),
            this.debug(this)
        }
        function i(A) {
            this.$type = "confirm",
            this.$options = this._processInput(A),
            this._init(),
            this.debug(this)
        }
        function o(A, e) {
            this.$type = A,
            this.$options = this._processInput(e),
            this._init(),
            this.debug(this)
        }
        function n(A) {
            this.$type = "progress",
            this.$progressBarElement = null,
            this.$options = this._processInput(A),
            this.$progress = 0,
            this._init(),
            this.debug(this)
        }
        function r(A, e) {
            this.$type = A,
            this.$options = this._processInput(e),
            this._init(),
            this.debug(this)
        }
        A.base = {},
        A.base.OPTIONS = {
            bodyClass: "lobibox-open",
            modalClasses: {
                error: "lobibox-error",
                success: "lobibox-success",
                info: "lobibox-info",
                warning: "lobibox-warning",
                confirm: "lobibox-confirm",
                progress: "lobibox-progress",
                prompt: "lobibox-prompt",
                default: "lobibox-default",
                window: "lobibox-window"
            },
            buttonsAlign: ["left", "center", "right"],
            buttons: {
                ok: {
                    class: "lobibox-btn lobibox-btn-default",
                    text: "OK",
                    closeOnClick: !0
                },
                cancel: {
                    class: "lobibox-btn lobibox-btn-cancel",
                    text: "Cancel",
                    closeOnClick: !0
                },
                yes: {
                    class: "lobibox-btn lobibox-btn-yes",
                    text: "确定",
                    closeOnClick: !0
                },
                no: {
                    class: "lobibox-btn lobibox-btn-no",
                    text: "取消",
                    closeOnClick: !0
                }
            },
            icons: {
                bootstrap: {
                    confirm: "glyphicon glyphicon-question-sign",
                    success: "glyphicon glyphicon-ok-sign",
                    error: "glyphicon glyphicon-remove-sign",
                    warning: "glyphicon glyphicon-exclamation-sign",
                    info: "glyphicon glyphicon-info-sign"
                },
                fontAwesome: {
                    confirm: "fa fa-question-circle",
                    success: "fa fa-check-circle",
                    error: "fa fa-times-circle",
                    warning: "fa fa-exclamation-circle",
                    info: "fa fa-info-circle"
                }
            }
        },
        A.base.DEFAULTS = {
            horizontalOffset: 5,
            verticalOffset: 5,
            width: 600,
            height: "auto",
            closeButton: !0,
            draggable: !0,
            customBtnClass: "lobibox-btn lobibox-btn-default",
            modal: !1,
            debug: !1,
            buttonsAlign: "center",
            closeOnEsc: !0,
            delayToRemove: 200,
            delay: !1,
            baseClass: "animated-super-fast",
            showClass: "zoomIn",
            hideClass: "zoomOut",
            iconSource: "bootstrap",
            onShow: null,
            shown: null,
            beforeClose: null,
            closed: null
        },
        t.prototype = uh.extend(!0, {}, e, {
            constructor: t,
            _processInput: function(i) {
                var o = e._processInput.call(this, i);
                return o.buttons = {
                    ok: A.base.OPTIONS.buttons.ok,
                    cancel: A.base.OPTIONS.buttons.cancel
                },
                i = uh.extend(!0, {}, o, t.DEFAULT_OPTIONS, i)
            },
            _init: function() {
                e._init.call(this),
                this._setContent(this.$options.content),
                this.show()
            },
            _afterShow: function() {
                var A = this;
                A._setContent(A._createInput())._position(),
                A.$input && A.$input.focus();
                var t = (window.innerHeight - xh.outerHeight(A.$el)) / 2
                  , i = (window.innerWidth - xh.outerWidth(A.$el)) / 2;
                A.setPosition(i, t),
                e._afterShow.call(A)
            },
            _createInput: function() {
                var A, e = this;
                if (e.$options.multiline)
                    e.$input = document.createElement("textarea"),
                    e.$input.setAttribute("rows", e.$options.lines);
                else {
                    if (!e.$promptType)
                        return;
                    e.$input = document.createElement("input"),
                    e.$input.setAttribute("type", "' + me.$promptType + '")
                }
                if (e.$input.classList.add("lobibox-input"),
                "[object Object]" === Object.prototype.toString.call(e.$options.attrs))
                    for (var t in e.$options.attrs)
                        e.$input.setAttribute(t, e.$options.attrs[t]);
                e.$options.value && e.setValue(e.$options.value),
                e.$options.label && ((A = document.createElement("label")).innerHTML = e.$options.label);
                var i = document.createElement("div");
                return e.$options.label && i.appendChild(A),
                i.appendChild(e.$input),
                i
            },
            setValue: function(A) {
                return this.$input.value = A,
                this
            },
            getValue: function() {
                return this.$input.value
            },
            isValid: function() {
                var A = this
                  , e = A.$el.querySelectorAll(".lobibox-input-error-message");
                if (A.$options.required && !A.getValue()) {
                    if (A.$input.classList.add("invalid"),
                    0 === e.length) {
                        var t = document.createElement("p");
                        t.className = "lobibox-input-error-message",
                        t.innerHTML = A.$options.errorMessage,
                        A.$el.querySelector(".lobibox-body").appendChild(t),
                        A._position(),
                        A.$input.focus()
                    }
                    return !1
                }
                A.$input.classList.remove("invalid");
                for (var i = 0; e.length > i; i += 1)
                    e[i].remove();
                return A._position(),
                A.$input.focus(),
                A._removeBackdrop(),
                !0
            },
            _beforePromptShow: function() {
                this._triggerEvent("beforeWindowShow")
            },
            _beforePromptHide: function() {
                this._triggerEvent("beforeWindowHide")
            },
            _afterPromptShow: function() {
                this._triggerEvent("afterWindowShow")
            },
            _afterPromptHide: function() {
                this._triggerEvent("afterWindowHide")
            },
            promptHide: function() {
                return this._beforePromptHide(),
                this.$el.classList.add("hide"),
                this._afterPromptHide(),
                this
            },
            promptShow: function() {
                return this._beforePromptShow(),
                this.$el.classList.remove("hide"),
                this._afterPromptShow(),
                this.$el.style.zIndex = (new Date).getTime() - A.window.startTime,
                this
            }
        }),
        t.DEFAULT_OPTIONS = {
            width: 400,
            attrs: {},
            value: "",
            multiline: !1,
            lines: 3,
            type: "text",
            label: "",
            required: !0,
            errorMessage: "The field is required"
        },
        i.prototype = uh.extend(!0, {}, e, {
            constructor: i,
            _processInput: function(t) {
                var i = e._processInput.call(this, t);
                return i.buttons = {
                    yes: A.base.OPTIONS.buttons.yes,
                    no: A.base.OPTIONS.buttons.no
                },
                t = uh.extend(!0, {}, i, A.confirm.DEFAULTS, t)
            },
            _init: function() {
                e._init.call(this),
                this.show()
            },
            _afterShow: function() {
                var A = this
                  , t = document.createElement("div");
                if (A.$options.iconClass) {
                    var i = document.createElement("div");
                    i.className = "lobibox-icon-wrapper",
                    t.appendChild(i);
                    var o = document.createElement("i");
                    o.className = "lobibox-icon" + A.$options.iconClass,
                    t.appendChild(o)
                }
                var n = document.createElement("div");
                n.className = "lobibox-body-text-wrapper",
                t.appendChild(n);
                var r = document.createElement("span");
                r.className = "lobibox-body-text",
                r.innerHTML = A.$options.msg,
                n.appendChild(r),
                A._setContent(t.innerHTML),
                A._position(),
                e._afterShow.call(A)
            },
            _beforeConfirmShow: function() {
                this._triggerEvent("beforeWindowShow")
            },
            _beforeConfirmHide: function() {
                this._triggerEvent("beforeWindowHide")
            },
            _afterConfirmShow: function() {
                this._triggerEvent("afterWindowShow")
            },
            _afterConfirmHide: function() {
                this._triggerEvent("afterWindowHide")
            },
            confirmHide: function() {
                return this._beforeConfirmHide(),
                this.$el.classList.add("hide"),
                this._afterConfirmHide(),
                this
            },
            confirmShow: function() {
                return this._beforeConfirmShow(),
                this.$el.classList.remove("hide"),
                this._afterConfirmShow(),
                this.$el.style.zIndex = (new Date).getTime() - A.window.startTime,
                this
            }
        }),
        A.confirm.DEFAULTS = {
            title: "Question",
            width: 500
        },
        o.prototype = uh.extend(!0, {}, e, {
            constructor: o,
            _processInput: function(t) {
                var i = e._processInput.call(this, t);
                return i.buttons = {},
                t = uh.extend(!0, {}, i, A.alert.OPTIONS[this.$type], A.alert.DEFAULTS, t)
            },
            _init: function() {
                e._init.call(this),
                this.show()
            },
            _afterShow: function() {
                var A = this
                  , t = document.createElement("div");
                if (A.$options.iconClass) {
                    var i = document.createElement("div");
                    i.className = "lobibox-icon-wrapper",
                    t.appendChild(i);
                    var o = document.createElement("i");
                    o.className = "lobibox-icon" + A.$options.iconClass,
                    t.appendChild(o)
                }
                var n = document.createElement("div");
                n.className = "lobibox-body-text-wrapper",
                t.appendChild(n);
                var r = document.createElement("span");
                r.className = "lobibox-body-text",
                r.innerHTML = A.$options.msg,
                n.appendChild(r),
                A._setContent(t.innerHTML),
                A._setSize();
                var a = (window.innerHeight - xh.outerHeight(A.$el)) / 2
                  , s = (window.innerWidth - xh.outerWidth(A.$el)) / 2;
                A.setPosition(s, a),
                e._afterShow.call(A)
            }
        }),
        A.alert.OPTIONS = {
            warning: {
                title: "Warning"
            },
            info: {
                title: "Information"
            },
            success: {
                title: "Success"
            },
            error: {
                title: "Error"
            }
        },
        A.alert.DEFAULTS = {},
        n.prototype = uh.extend(!0, {}, e, {
            constructor: n,
            _processInput: function(t) {
                var i = e._processInput.call(this, t);
                return t = uh.extend(!0, {}, i, A.progress.DEFAULTS, t)
            },
            _init: function() {
                e._init.call(this),
                this.show()
            },
            _afterShow: function() {
                var A, t = this;
                t.$progressBarElement = t.$options.progressTpl ? t.$options.progressTpl : t._createProgressbar(),
                t.$options.label && ((A = document.createElement("label")).innerHTML = t.$options.label);
                var i = document.createElement("div").appendChild(A);
                i.appendChild(t.$progressBarElement),
                t._setContent(i),
                t._position(),
                e._afterShow.call(t)
            },
            _createProgressbar: function() {
                var A = document.createElement("div");
                A.classList.add("lobibox-progress-bar-wrapper"),
                A.classList.add("lobibox-progress-outer");
                var e = document.createElement("div");
                if (e.classList.add("lobibox-progress-bar"),
                e.classList.add("lobibox-progress-element"),
                A.appendChild(e),
                this.$options.showProgressLabel) {
                    var t = document.createElement("span");
                    t.className = "lobibox-progress-text",
                    t.dataset.role = "progress-text",
                    A.appendChild(t)
                }
                return A
            },
            setProgress: function(A) {
                var e = this;
                if (100 !== e.$progress)
                    return A = Math.min(100, Math.max(0, A)),
                    e.$progress = A,
                    e._triggerEvent("progressUpdated"),
                    100 === e.$progress && e._triggerEvent("progressCompleted"),
                    e.$el.querySelector(".lobibox-progress-element").style.cssText += "width" + A.toFixed(1) + "%",
                    e.$el.querySelector(".lobibox-progress-text").innerHTML = A.toFixed(1) + "%",
                    e
            },
            getProgress: function() {
                return this.$progress
            }
        }),
        A.progress.DEFAULTS = {
            width: 500,
            showProgressLabel: !0,
            label: "",
            progressTpl: !1,
            progressUpdated: null,
            progressCompleted: null
        },
        r.prototype = uh.extend(!0, {}, e, {
            constructor: r,
            _processInput: function(t) {
                var i = e._processInput.call(this, t);
                return t.content && "function" == typeof t.content && (t.content = t.content()),
                t = uh.extend(!0, {}, i, A.window.DEFAULTS, t)
            },
            _init: function() {
                var A = this;
                e._init.call(A),
                A.setContent(A.$options.content),
                A.$options.url && A.$options.autoload ? (A.$options.showAfterLoad || A.show(),
                A.load((function() {
                    A.$options.showAfterLoad && A.show()
                }
                ))) : A.show()
            },
            _afterShow: function() {
                this._position(),
                e._afterShow.call(this)
            },
            _addCloseButton: function() {
                var A = this
                  , e = document.createElement("span");
                e.className = "btn-close",
                e.innerHTML = "&times;",
                A.$el.querySelector(".lobibox-header").appendChild(e),
                e.addEventListener("mousedown", (function(A) {
                    A.stopPropagation()
                }
                )),
                e.addEventListener("click", (function() {
                    A.windowHide()
                }
                ))
            },
            _beforeWindowShow: function() {
                this._triggerEvent("beforeWindowShow")
            },
            _beforeWindowHide: function() {
                this._triggerEvent("beforeWindowHide")
            },
            _afterWindowShow: function() {
                this._triggerEvent("afterWindowShow")
            },
            _afterWindowHide: function() {
                this._triggerEvent("afterWindowHide")
            },
            windowHide: function() {
                return this._beforeWindowHide(),
                this.$el.classList.add("hide"),
                this._afterWindowHide(),
                this
            },
            windowShow: function() {
                return this._beforeWindowShow(),
                this.$el.classList.remove("hide"),
                this._afterWindowShow(),
                this.$el.style.zIndex = (new Date).getTime() - A.window.startTime,
                this
            },
            setParams: function(A) {
                return this.$options.params = A,
                this
            },
            getParams: function() {
                return this.$options.params
            },
            setLoadMethod: function(A) {
                return this.$options.loadMethod = A,
                this
            },
            getLoadMethod: function() {
                return this.$options.loadMethod
            },
            setContent: function(A) {
                return this.$options.content = A,
                this.$el.querySelector(".lobibox-body").innerHTML = "",
                xh.append(this.$el.querySelector(".lobibox-body"), A),
                this
            },
            getContent: function() {
                return this.$options.content
            },
            setUrl: function(A) {
                return this.$options.url = A,
                this
            },
            getUrl: function() {
                return this.$options.url
            },
            load: function(A) {
                var e = this;
                return e.$options.url ? ($.ajax(e.$options.url, {
                    method: e.$options.loadMethod,
                    data: e.$options.params
                }).done((function(t) {
                    e.setContent(t),
                    A && "function" == typeof A && A(t)
                }
                )),
                e) : e
            }
        }),
        A.window.DEFAULTS = {
            width: 480,
            height: 600,
            content: "",
            url: "",
            draggable: !0,
            autoload: !0,
            loadMethod: "GET",
            showAfterLoad: !0,
            params: {}
        },
        A.window.startTime = (new Date).getTime();
        var a = function(e, t) {
            this.$type = null,
            this.$options = null,
            this.$el = null;
            var i = this
              , o = function(A) {
                for (var e = xh.closest(A, ".lb-notify-tabs").childNodes, t = 0; e.length > t; t += 1)
                    "li" == e[t].nodeType && e[t].classList.remove("active");
                A.classList.add("active");
                var i = A.querySelector("a").getAttribute("href")
                  , o = xh.closest(i, ".lb-notify-wrapper").querySelectorAll(".lb-tab-pane");
                for (t = 0; o.length > t; t += 1)
                    o[t].classList.remove("active");
                i.addClass("active")
            }
              , n = function(e) {
                var t = document.createElement("li");
                t.className = A.notify.OPTIONS[i.$type].class;
                var o = document.createElement("a");
                o.setAttribute("href", "#" + e),
                t.appendChild(o);
                var n = document.createElement("i");
                return n.className = "tab-control-icon" + i.$options.icon,
                o.appendChild(n),
                t
            }
              , r = function() {
                var A = document.createElement("div");
                return A.className = "lb-tab-pane",
                A.id = Math.randomString(10),
                A
            }
              , a = function(A) {
                if (i.$options.closable) {
                    var e = document.createElement("span");
                    e.className = "lobibox-close",
                    e.innerHTML = "&times;",
                    A.appendChild(e),
                    e.addEventListener("click", (function() {
                        i.remove()
                    }
                    ))
                }
            }
              , s = function(A) {
                i.$options.closeOnClick && A.click((function() {
                    i.remove()
                }
                ))
            }
              , l = function(A) {
                if (i.$options.delay) {
                    if (i.$options.delayIndicator) {
                        var e = document.createElement("div");
                        e.className = "lobibox-delay-indicator";
                        var t = document.createElement("div");
                        e.appendChild(t),
                        A.appendChild(e)
                    }
                    var o = 0
                      , n = 1e3 / 30
                      , r = (new Date).getTime()
                      , a = setInterval((function() {
                        i.$options.continueDelayOnInactiveTab ? o = (new Date).getTime() - r : o += n;
                        var A = 100 * o / i.$options.delay;
                        if (100 > A || (A = 100,
                        i.remove(),
                        a = clearInterval(a)),
                        i.$options.delayIndicator)
                            for (var t = e.querySelectorAll("div"), s = 0; t.length > s; s += 1)
                                t[s].style.cssText += "width:" + A + "%"
                    }
                    ), n);
                    i.$options.pauseDelayOnHover && (A.addEventListener("mouseenter.lobibox", (function() {
                        n = 0
                    }
                    )),
                    A.addEventListener("mouseleave.lobibox", (function() {
                        n = 1e3 / 30
                    }
                    )))
                }
            }
              , c = function(A) {
                return A = Math.min(window.outerWidth, A)
            };
            this.remove = function() {
                i.$el.classList.remove(i.$options.showClass),
                i.$el.classList.add(i.$options.hideClass);
                var e = i.$el.parentNode
                  , t = xh.closest(e, ".lobibox-notify-wrapper-large") || xh.closest(e, ".lobibox-notify-wrapper");
                if (e) {
                    for (var n = "#" + e.getAttribute("id"), r = t.querySelectorAll(".lb-notify-tabs li"), a = 0; r.length > a; a += 1)
                        r[a].querySelector("a").getAttribute("href") !== n && r.splice(1, a);
                    if (r.length > 0)
                        for (a = 0; r.length > a; a += 1)
                            r[a].classList.remove(A.notify.OPTIONS.class),
                            r[a].classList.add(i.$options.hideClass);
                    return setTimeout((function() {
                        if ("normal" === i.$options.size || "mini" === i.$options.size)
                            i.$el.parentElement.removeChild(i.$el);
                        else if ("large" === i.$options.size) {
                            var t = function(A) {
                                var e = A.prev();
                                return 0 === e.length && (e = A.next()),
                                0 === e.length ? null : e
                            }(r);
                            t && o(t),
                            r.parentElement.removeChild(r),
                            e.parentElement.removeChild(e)
                        }
                        var n = A.notify.list
                          , a = n.indexOf(i);
                        n.splice(a, 1);
                        var s = n[a];
                        s && s.$options.showAfterPrevious && s._init()
                    }
                    ), 500),
                    i
                }
            }
            ,
            i._init = function() {
                var e = function() {
                    var e, t, o, n, r, h = A.notify.OPTIONS, d = document.createElement("div");
                    if (d.classList.add("lobibox-notify"),
                    d.classList.add(h[i.$type].class),
                    d.classList.add(h.class),
                    d.classList.add(i.$options.showClass),
                    (o = document.createElement("div")).className = "lobibox-notify-icon-wrapper",
                    d.appendChild(o),
                    (e = document.createElement("div")).className = "lobibox-notify-icon",
                    o.appendChild(e),
                    t = document.createElement("div"),
                    e.appendChild(t),
                    i.$options.img) {
                        var p = document.createElement("img");
                        p.src = i.$options.img,
                        t.appendChild(p)
                    } else if (i.$options.icon) {
                        var g = document.createElement("div");
                        g.className = "icon-el";
                        var u = document.createElement("i");
                        u.className = i.$options.icon,
                        g.appendChild(u),
                        t.appendChild(g)
                    } else
                        d.classList.add("without-icon");
                    if ((r = document.createElement("div")).className = "lobibox-notify-msg",
                    r.innerHTML = i.$options.msg,
                    !1 !== i.$options.messageHeight && (r.style.cssText += "max-height:" + i.$options.messageHeight + "px;"),
                    (n = document.createElement("div")).className = "lobibox-notify-body",
                    n.appendChild(r),
                    d.appendChild(n),
                    i.$options.title) {
                        var f = document.createElement("div");
                        f.className = "lobibox-notify-title",
                        f.innerHTML = i.$options.title,
                        n.insertBefore(f, r)
                    }
                    return a(d),
                    "normal" !== i.$options.size && "mini" !== i.$options.size || (s(d),
                    l(d)),
                    i.$options.width && (d.style.cssText += "width:" + c(i.$options.width) + "px"),
                    d
                }();
                if ("mini" === i.$options.size && e.classList.add("notify-mini"),
                "string" == typeof i.$options.position) {
                    var t = function() {
                        var e, t = ("large" === i.$options.size ? ".lobibox-notify-wrapper-large" : ".lobibox-notify-wrapper") + "." + i.$options.position.replace(/\s/gi, ".");
                        if (0 !== (e = document.querySelectorAll(t)).length)
                            return e[0];
                        e = document.createElement("div");
                        for (var o = t.split("."), n = 1; o.length > n; n += 1)
                            e.classList.add(o[n]);
                        if (A.viewport.appendChild(e),
                        "large" === i.$options.size) {
                            var r = document.createElement("ul");
                            r.className = "lb-notify-tabs";
                            var a = document.createElement("div");
                            a.className = "lb-notify-wrapper",
                            e.appendChild(r),
                            e.appendChild(a)
                        }
                        return e
                    }();
                    !function(A, e) {
                        if ("normal" === i.$options.size)
                            e.classList.contains("bottom") ? e.insertBefore(A, e.firstChild) : e.appendChild(A);
                        else if ("mini" === i.$options.size)
                            e.classList.contains("bottom") ? e.insertBefore(A, e.firstChild) : e.appendChild(A);
                        else if ("large" === i.$options.size) {
                            var t = r().appendChild(A)
                              , a = n(t.getAttribute("id"));
                            e.querySelector(".lb-notify-wrapper").appendChild(t),
                            e.querySelector(".lb-notify-tabs").appendChild(a),
                            o(a);
                            for (var s = a.querySelectorAll("a"), l = 0; s.length > l; l += 1)
                                s[l].click((function() {
                                    o(a)
                                }
                                ))
                        }
                    }(e, t),
                    t.classList.contains("center") && (t.style.cssText += "margin-left:" + -t.offsetWidth / 2 + "px")
                } else
                    A.viewport.appendChild(e),
                    e.style.cssText += "position:fixed;left:" + i.$options.position.left + "px;top:" + i.$options.position.top + "px;";
                (i.$el = e,
                i.$options.sound) && new Audio(i.$options.sound).play();
                i.$options.rounded && i.$el.classList.add("rounded"),
                i.$el.addEventListener("click", (function(A) {
                    i.$options.onClickUrl && (window.location.href = i.$options.onClickUrl),
                    i.$options.onClick && "function" == typeof i.$options.onClick && i.$options.onClick.call(i, A)
                }
                )),
                i.$el.dataset.lobibox = i
            }
            ,
            this.$type = e,
            this.$options = function(e) {
                return "mini" !== e.size && "large" !== e.size || (e = uh.extend(!0, {}, A.notify.OPTIONS[e.size], e)),
                "mini" !== (e = uh.extend(!0, {}, A.notify.OPTIONS[i.$type], A.notify.DEFAULTS, e)).size && !0 === e.title ? e.title = A.notify.OPTIONS[i.$type].title : "mini" === e.size && !0 === e.title && (e.title = !1),
                !0 === e.icon && (e.icon = A.notify.OPTIONS.icons[e.iconSource][i.$type]),
                !0 === e.sound && (e.sound = A.notify.OPTIONS[i.$type].sound),
                e.sound && (e.sound = e.soundPath + e.sound + e.soundExt),
                e
            }(t),
            i.$options.showAfterPrevious && 0 !== A.notify.list.length || this._init()
        };
        A.notify = function(e, t) {
            if (["default", "info", "warning", "error", "success"].indexOf(e) > -1) {
                var i = new a(e,t);
                return A.notify.list.push(i),
                i
            }
        }
        ,
        A.notify.list = [],
        A.notify.closeAll = function() {
            var e = A.notify.list;
            for (var t in e) {
                e[t].parentNode.removeChild(e[t])
            }
        }
        ,
        A.notify.DEFAULTS = {
            title: !0,
            size: "normal",
            soundPath: "sounds/",
            soundExt: ".ogg",
            showClass: "fadeInDown",
            hideClass: "zoomOut",
            icon: !0,
            msg: "",
            img: null,
            closable: !0,
            hideCloseButton: !1,
            delay: 5e3,
            delayIndicator: !0,
            closeOnClick: !0,
            width: 400,
            sound: !0,
            position: "bottom right",
            iconSource: "bootstrap",
            rounded: !1,
            messageHeight: 60,
            pauseDelayOnHover: !0,
            onClickUrl: null,
            showAfterPrevious: !1,
            continueDelayOnInactiveTab: !0,
            onClick: null
        },
        A.notify.OPTIONS = {
            class: "animated-fast",
            large: {
                width: 500,
                messageHeight: 96
            },
            mini: {
                class: "notify-mini",
                messageHeight: 32
            },
            default: {
                class: "lobibox-notify-default",
                title: "Default",
                sound: !1
            },
            success: {
                class: "lobibox-notify-success",
                title: "Success",
                sound: "sound2"
            },
            error: {
                class: "lobibox-notify-error",
                title: "Error",
                sound: "sound4"
            },
            warning: {
                class: "lobibox-notify-warning",
                title: "Warning",
                sound: "sound5"
            },
            info: {
                class: "lobibox-notify-info",
                title: "Information",
                sound: "sound6"
            },
            icons: {
                bootstrap: {
                    success: "glyphicon glyphicon-ok-sign",
                    error: "glyphicon glyphicon-remove-sign",
                    warning: "glyphicon glyphicon-exclamation-sign",
                    info: "glyphicon glyphicon-info-sign"
                },
                fontAwesome: {
                    success: "fa fa-check-circle",
                    error: "fa fa-times-circle",
                    warning: "fa fa-exclamation-circle",
                    info: "fa fa-info-circle"
                }
            }
        }
    }
      , Uh = 37
      , Fh = 38
      , Kh = 39
      , Qh = 40
      , Rh = 65
      , Th = 68
      , kh = 69
      , Dh = 81
      , Lh = 83
      , Nh = 87
      , Oh = 90
      , Vh = 187
      , Gh = 189
      , Ph = 48
      , qh = 27
      , jh = {
        ReverseWheelDirection: !1,
        MovementSpeedRate: 1,
        WalkSpeedRate: 1,
        RotatePivotMode: kc.MOUSEPOINT,
        NoPan: !1,
        NoRotate: !1,
        NoZoom: !1,
        NoKey: !1,
        LockAxisZ: !1,
        LockAxisZRange: null
    }
      , Hh = function(A, e) {
        this.defaultSetting = {
            colorRects: !0,
            picker: !0,
            colorCode: !0,
            hasOpacity: !0
        },
        this.color = {
            hex: void 0,
            rgb: void 0,
            rgba: void 0,
            hsl: void 0
        },
        this.colorInputDom = A,
        this.element = this.create(e)
    };
    Hh.prototype = {
        constructor: Hh,
        create: function(A) {
            var e = this.defaultSetting;
            A && (e = uh.extend(!0, this.defaultSetting, A));
            var t = document.createElement("div");
            return t.style.cssText += "width:190px;position:absolute;",
            e.colorRects && t.appendChild(this.createRects(!!e.hasOpacity)),
            e.picker && t.appendChild(this.createPicker(!!e.hasOpacity)),
            e.colorCode && t.appendChild(this.createColorCode()),
            t.appendChild(this.createBtn()),
            this.element = t,
            t
        },
        createBtn: function() {
            var A = this
              , e = document.createElement("div")
              , t = document.createElement("button");
            t.className = "btn-yes",
            t.innerHTML = "确定",
            t.style.cssText += "display:inline-block;margin:10px;color:#000;background-color: #FFFFFF;border: 2px solid #FFFFFF;border-radius: 4px; width: 73px;height: 32px;",
            t.addEventListener("click", (function() {
                A.element.style.display = "none"
            }
            ));
            var i = document.createElement("button");
            return i.className = "btn-no",
            i.innerHTML = "取消",
            i.style.cssText += "display:inline-block;margin:10px;color:#000;background-color: #FFFFFF;border: 2px solid #FFFFFF;border-radius: 4px; width: 73px;height: 32px;",
            i.addEventListener("click", (function() {
                A.element.style.display = "none"
            }
            )),
            e.appendChild(t),
            e.appendChild(i),
            e
        },
        createRects: function(A) {
            var e = this
              , t = document.createElement("div");
            t.className = "rectFather",
            t.style.cssText += "width:180px;height:180px;margin-top:10px;margin-left:10px;display:flex;flex-wrap:wrap;align-items:flex-start;";
            for (var i = [], o = ["00", "55", "AA", "FF"], n = 0, r = 0, a = 0, s = "", l = 0; 64 > l; )
                s = "#" + o[n] + o[r] + o[a],
                i[l] = document.createElement("span"),
                i[l].className = "spans" + l,
                i[l].style.cssText += "width:15px;height:15px;margin:1px 2px;border:1px solid #FFFFFF;background-color:" + s + ";",
                i[l].setAttribute("color", s),
                t.appendChild(i[l]),
                (l += 1) % 16 == 0 ? n += 1 : l % 4 == 0 ? (r += 1) > 3 && (r = 0) : (a += 1) > 3 && (a = 0);
            var c = t.querySelectorAll("span");
            return xh.addEventListener(c, "click", (function(t) {
                for (var i = 0; c.length > i; i += 1)
                    c[i].style.cssText += "border:1px solid #FFFFFF;";
                var o = t.target;
                o.style.cssText += "border:2px solid #000000;";
                var n = o.getAttribute("color");
                A ? e.setColor(n, 1) : e.setColor(n),
                t.stopPropagation ? t.stopPropagation() : t.cancelBubble = !0
            }
            )),
            t
        },
        createPicker: function(A) {
            var e = this
              , t = document.createElement("div");
            t.style.cssText += "width:180px;margin-left:10px;";
            var i = document.createElement("span");
            i.className = "colorShow",
            i.style.cssText += "display:block;width:170px;height:30px;border-radius:5px;margin-top:10px;margin-bottom:10px;background-color:#FFFFFF;",
            t.appendChild(i);
            var o = document.createElement("span");
            o.innerHTML = "红 : ",
            o.style.color = "#FF0000";
            var n = document.createElement("input");
            n.type = "range",
            n.className = "redRange",
            n.style.cssText += "background:linear-gradient(#FFFFFF, #FFFFFF) no-repeat, #FF0000;",
            n.setAttribute("step", "1"),
            n.setAttribute("min", "0"),
            n.setAttribute("max", "255"),
            n.setAttribute("value", "255");
            var r = document.createElement("div");
            r.appendChild(o),
            r.appendChild(n),
            t.appendChild(r);
            var a = document.createElement("span");
            a.innerHTML = "绿 : ",
            a.style.color = "#00FF00";
            var s = document.createElement("input");
            s.type = "range",
            s.className = "greenRange",
            s.style.cssText += "background:linear-gradient(#FFFFFF, #FFFFFF) no-repeat, #00FF00;",
            s.setAttribute("step", "1"),
            s.setAttribute("min", "0"),
            s.setAttribute("max", "255"),
            s.setAttribute("value", "255");
            var l = document.createElement("div");
            l.appendChild(a),
            l.appendChild(s),
            t.appendChild(l);
            var c = document.createElement("span");
            c.innerHTML = "蓝 : ",
            c.style.color = "#0000FF";
            var h = document.createElement("input");
            h.type = "range",
            h.className = "blueRange",
            h.style.cssText += "background:linear-gradient(#FFFFFF, #FFFFFF) no-repeat, #0000FF;",
            h.setAttribute("step", "1"),
            h.setAttribute("min", "0"),
            h.setAttribute("max", "255"),
            h.setAttribute("value", "255");
            var d = document.createElement("div");
            d.appendChild(c),
            d.appendChild(h),
            t.appendChild(d);
            var p = t.querySelector(".redRange")
              , g = t.querySelector(".greenRange")
              , u = t.querySelector(".blueRange")
              , f = null;
            if (p.addEventListener("input", (function() {
                var t = "#" + ((1 << 24) + (Number(p.value) << 16) + (Number(g.value) << 8) + Number(u.value)).toString(16).slice(1);
                if (A) {
                    var i = Number(f.value);
                    e.setColor(t, i)
                } else
                    e.setColor(t)
            }
            )),
            g.addEventListener("input", (function() {
                var t = "#" + ((1 << 24) + (Number(p.value) << 16) + (Number(g.value) << 8) + Number(u.value)).toString(16).slice(1);
                if (A) {
                    var i = Number(f.value);
                    e.setColor(t, i)
                } else
                    e.setColor(t)
            }
            )),
            u.addEventListener("input", (function() {
                var t = "#" + ((1 << 24) + (Number(p.value) << 16) + (Number(g.value) << 8) + Number(u.value)).toString(16).slice(1);
                if (A) {
                    var i = Number(f.value);
                    e.setColor(t, i)
                } else
                    e.setColor(t)
            }
            )),
            A) {
                var m = document.createElement("span");
                m.innerHTML = "透明度 : ",
                m.style.color = "#FFFFFF";
                var C = document.createElement("input");
                C.type = "range",
                C.className = "opacityRange",
                C.style.cssText += "width:97px;background:linear-gradient(#FFFFFF, #FFFFFF) no-repeat, #FFFFFF;",
                C.setAttribute("step", "0.01"),
                C.setAttribute("min", "0"),
                C.setAttribute("max", "1"),
                C.setAttribute("value", "1");
                var y = document.createElement("div");
                y.appendChild(m),
                y.appendChild(C),
                t.appendChild(y),
                (f = t.querySelector(".opacityRange")).addEventListener("input", (function() {
                    var A = "#" + ((1 << 24) + (Number(p.value) << 16) + (Number(g.value) << 8) + Number(u.value)).toString(16).slice(1)
                      , t = Number(f.value);
                    e.setColor(A, t)
                }
                ))
            }
            return t
        },
        createColorCode: function() {
            var A = this
              , e = document.createElement("div");
            e.style.cssText += "width:180px;margin-left:10px;";
            var t = document.createElement("input");
            t.className = "colorCode",
            t.type = "text",
            t.style.cssText += "display:block;float:left;width:110px;margin:10px 10px 10px 0;padding-left:3px;",
            t.value = "#ffffff",
            e.appendChild(t);
            var i = document.createElement("span");
            return i.className = "colorCodeBtn",
            i.style.cssText += "display:block;float:left;width:38px;height:21px;border-radius:5px;margin-top:10px;background-color:#FFFFFF;font-size:13px;text-align:center;line-height:21px;cursor:default;",
            i.innerHTML = "HEX",
            i.addEventListener("click", (function(e) {
                var t = e.target.textContent
                  , i = A.element.querySelector(".colorCode").value;
                if (A.element.querySelector(".opacityRange"))
                    var o = Number(A.element.querySelector(".opacityRange").value);
                "HEX" === t ? e.target.innerHTML = "RGB" : "RGB" === t && (e.target.innerHTML = "HEX"),
                A.setColor(i, o)
            }
            )),
            e.appendChild(i),
            e
        },
        colorRgbToHex: function(A) {
            if (A) {
                var e = (A = A.toLowerCase()).replace(/rgba?\(/, "").replace(/\)/, "").replace(/[\s+]/g, "").split(",")
                  , t = parseFloat(e[3] || 1)
                  , i = Math.floor(t * parseInt(e[0], 0) + 255 * (1 - t))
                  , o = Math.floor(t * parseInt(e[1], 0) + 255 * (1 - t))
                  , n = Math.floor(t * parseInt(e[2], 0) + 255 * (1 - t));
                return "#" + ("0" + i.toString(16)).slice(-2) + ("0" + o.toString(16)).slice(-2) + ("0" + n.toString(16)).slice(-2)
            }
            return A
        },
        colorHexToRgb: function(A, e) {
            var t = A.toLowerCase();
            if (t && /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t)) {
                if (4 === t.length) {
                    for (var i = "#", o = 1; 4 > o; o += 1)
                        i += t.slice(o, o + 1).concat(t.slice(o, o + 1));
                    t = i
                }
                for (var n = [], r = 1; 7 > r; r += 2)
                    n.push(parseInt("0x" + t.slice(r, r + 2), 0));
                if (!isNaN(e)) {
                    var a = Number(e);
                    return 0 > a || a > 1 ? t : "rgba(" + n.join(",") + "," + a + ")"
                }
                return "rgb(" + n.join(",") + ")"
            }
            return t
        },
        checkColor: function(A) {
            var e = {};
            if (A) {
                var t = A.toLowerCase();
                t && /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/.test(t) ? (e.color = !0,
                e.hex = !0,
                e.rgb = !1,
                e.hsl = !1,
                e.hexLength = 4 === t.length ? 3 : 6) : t && /^rgb/.test(t) ? (e.color = !0,
                e.hex = !1,
                e.rgb = !0,
                e.hsl = !1) : t && /^hsl/.test(t) ? (e.color = !0,
                e.hex = !1,
                e.rgb = !1,
                e.hsl = !0) : (e.color = !1,
                e.hex = !1,
                e.rgb = !1,
                e.hsl = !1)
            } else
                e.color = !1,
                e.hex = !1,
                e.rgb = !1,
                e.hsl = !1;
            return e
        },
        setColor: function(A, e) {
            var t = this.defaultSetting;
            if (t.picker || t.colorCode) {
                var i = this.checkColor(A);
                if (i.color) {
                    var o = ""
                      , n = ""
                      , r = A.toLowerCase();
                    if (i.hex) {
                        if (3 === i.hexLength) {
                            for (var a = "#", s = 1; 4 > s; s += 1)
                                a += r.slice(s, s + 1).concat(r.slice(s, s + 1));
                            r = a
                        }
                        n = r,
                        o = this.colorHexToRgb(A, e)
                    } else
                        i.rgb && (n = this.colorRgbToHex(A),
                        o = r);
                    if (o) {
                        if (t.picker) {
                            xh.css(this.element.querySelector(".colorShow"), {
                                "background-color": o
                            });
                            var l = this.getRgbNumber(n);
                            3 === l.length && (this.element.querySelector(".redRange").value = l[0],
                            this.element.querySelector(".greenRange").value = l[1],
                            this.element.querySelector(".blueRange").value = l[2],
                            e && (this.element.querySelector(".opacityRange").value = e))
                        }
                        if (t.colorCode) {
                            var c = this.element.querySelector(".colorCode");
                            c.value = n;
                            var h = this.element.querySelector(".colorCodeBtn").textContent;
                            "HEX" === h ? c.value = n : "RGB" === h && (c.value = o)
                        }
                        this.colorInputDom.value = o,
                        xh.simulateEvent(this.colorInputDom, "change")
                    }
                }
            }
        },
        getRgbNumber: function(A) {
            var e = []
              , t = this.checkColor(A);
            if (t.color) {
                var i = A.toLowerCase();
                if (t.hex) {
                    if (3 === t.hexLength) {
                        for (var o = "#", n = 1; 4 > n; n += 1)
                            o += i.slice(n, n + 1).concat(i.slice(n, n + 1));
                        i = o
                    }
                    for (var r = 1; 7 > r; r += 2)
                        e.push(parseInt("0x" + i.slice(r, r + 2), 0))
                }
            }
            return e
        }
    };
    var Yh = {};
    Yh.fullScreen = function(A) {
        if (!A)
            return !1;
        if (A.requestFullscreen)
            A.requestFullscreen();
        else if (A.mozRequestFullScreen)
            A.mozRequestFullScreen();
        else if (A.webkitRequestFullscreen)
            A.webkitRequestFullscreen();
        else {
            if (!A.msRequestFullscreen)
                return !1;
            A.msRequestFullscreen()
        }
    }
    ,
    Yh.exitFullScreen = function() {
        document.exitFullscreen ? document.exitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitCancelFullScreen ? document.webkitCancelFullScreen() : document.msExitFullscreen && document.msExitFullscreen()
    }
    ,
    Yh.onFullScreenChanged = function(A) {
        var e = function() {
            A && A()
        };
        document.onfullscreenchange = e,
        document.onwebkitfullscreenchange = e,
        document.documentElement.onwebkitfullscreenchange = e,
        document.onmozfullscreenchange = e,
        document.onmsfullscreenchange = e
    }
    ,
    Yh.inFullScreen = function() {
        return "webkitIsFullScreen"in document ? Boolean(document.webkitIsFullScreen) : "fullscreenElement"in document ? Boolean(document.fullscreenElement) : "mozFullScreenElement"in document ? Boolean(document.mozFullScreenElement) : "msFullscreenElement"in document ? Boolean(document.msFullscreenElement) : Boolean(document.querySelector(".viewer-fill-browser"))
    }
    ,
    Yh.findFullScreenElement = function() {
        return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement
    }
    ,
    Yh.isFullScreenAvailable = function(A) {
        return A.requestFullscreen || A.mozRequestFullScreen || A.webkitRequestFullscreen || A.msRequestFullscreen
    }
    ;
    var Wh = Yh
      , Jh = {
        aliceblue: 15792383,
        antiquewhite: 16444375,
        aqua: 65535,
        aquamarine: 8388564,
        azure: 15794175,
        beige: 16119260,
        bisque: 16770244,
        black: 0,
        blanchedalmond: 16772045,
        blue: 255,
        blueviolet: 9055202,
        brown: 10824234,
        burlywood: 14596231,
        cadetblue: 6266528,
        chartreuse: 8388352,
        chocolate: 13789470,
        coral: 16744272,
        cornflowerblue: 6591981,
        cornsilk: 16775388,
        crimson: 14423100,
        cyan: 65535,
        darkblue: 139,
        darkcyan: 35723,
        darkgoldenrod: 12092939,
        darkgray: 11119017,
        darkgreen: 25600,
        darkgrey: 11119017,
        darkkhaki: 12433259,
        darkmagenta: 9109643,
        darkolivegreen: 5597999,
        darkorange: 16747520,
        darkorchid: 10040012,
        darkred: 9109504,
        darksalmon: 15308410,
        darkseagreen: 9419919,
        darkslateblue: 4734347,
        darkslategray: 3100495,
        darkslategrey: 3100495,
        darkturquoise: 52945,
        darkviolet: 9699539,
        deeppink: 16716947,
        deepskyblue: 49151,
        dimgray: 6908265,
        dimgrey: 6908265,
        dodgerblue: 2003199,
        firebrick: 11674146,
        floralwhite: 16775920,
        forestgreen: 2263842,
        fuchsia: 16711935,
        gainsboro: 14474460,
        ghostwhite: 16316671,
        gold: 16766720,
        goldenrod: 14329120,
        gray: 8421504,
        green: 32768,
        greenyellow: 11403055,
        grey: 8421504,
        honeydew: 15794160,
        hotpink: 16738740,
        indianred: 13458524,
        indigo: 4915330,
        ivory: 16777200,
        khaki: 15787660,
        lavender: 15132410,
        lavenderblush: 16773365,
        lawngreen: 8190976,
        lemonchiffon: 16775885,
        lightblue: 11393254,
        lightcoral: 15761536,
        lightcyan: 14745599,
        lightgoldenrodyellow: 16448210,
        lightgray: 13882323,
        lightgreen: 9498256,
        lightgrey: 13882323,
        lightpink: 16758465,
        lightsalmon: 16752762,
        lightseagreen: 2142890,
        lightskyblue: 8900346,
        lightslategray: 7833753,
        lightslategrey: 7833753,
        lightsteelblue: 11584734,
        lightyellow: 16777184,
        lime: 65280,
        limegreen: 3329330,
        linen: 16445670,
        magenta: 16711935,
        maroon: 8388608,
        mediumaquamarine: 6737322,
        mediumblue: 205,
        mediumorchid: 12211667,
        mediumpurple: 9662683,
        mediumseagreen: 3978097,
        mediumslateblue: 8087790,
        mediumspringgreen: 64154,
        mediumturquoise: 4772300,
        mediumvioletred: 13047173,
        midnightblue: 1644912,
        mintcream: 16121850,
        mistyrose: 16770273,
        moccasin: 16770229,
        navajowhite: 16768685,
        navy: 128,
        oldlace: 16643558,
        olive: 8421376,
        olivedrab: 7048739,
        orange: 16753920,
        orangered: 16729344,
        orchid: 14315734,
        palegoldenrod: 15657130,
        palegreen: 10025880,
        paleturquoise: 11529966,
        palevioletred: 14381203,
        papayawhip: 16773077,
        peachpuff: 16767673,
        peru: 13468991,
        pink: 16761035,
        plum: 14524637,
        powderblue: 11591910,
        purple: 8388736,
        rebeccapurple: 6697881,
        red: 16711680,
        rosybrown: 12357519,
        royalblue: 4286945,
        saddlebrown: 9127187,
        salmon: 16416882,
        sandybrown: 16032864,
        seagreen: 3050327,
        seashell: 16774638,
        sienna: 10506797,
        silver: 12632256,
        skyblue: 8900331,
        slateblue: 6970061,
        slategray: 7372944,
        slategrey: 7372944,
        snow: 16775930,
        springgreen: 65407,
        steelblue: 4620980,
        tan: 13808780,
        teal: 32896,
        thistle: 14204888,
        tomato: 16737095,
        turquoise: 4251856,
        violet: 15631086,
        wheat: 16113331,
        white: 16777215,
        whitesmoke: 16119285,
        yellow: 16776960,
        yellowgreen: 10145074
    };
    function zh(A, e, t) {
        return 0 > t && (t += 1),
        t > 1 && (t -= 1),
        1 / 6 > t ? A + 6 * (e - A) * t : .5 > t ? e : 2 / 3 > t ? A + 6 * (e - A) * (2 / 3 - t) : A
    }
    var Zh, Xh = function(A, e, t, i) {
        return void 0 === i && void 0 === t ? this.set(A, e) : this.setRGB(A, e, t, i)
    };
    Object.assign(Xh.prototype, {
        isColor: !0,
        r: 1,
        g: 1,
        b: 1,
        a: 1,
        set: function(A, e) {
            return "number" == typeof A ? this.setHex(A) : "string" == typeof A && this.setStyle(A),
            void 0 !== e && this.setAlpha(e),
            this
        },
        setHex: function(A, e) {
            return A = Math.floor(A),
            this.r = (A >> 16 & 255) / 255,
            this.g = (A >> 8 & 255) / 255,
            this.b = (255 & A) / 255,
            this.setAlpha(e),
            this
        },
        setAlpha: function(A) {
            return "number" == typeof A ? (A > 1 && (A = 1),
            0 > A && (A = 0),
            this.a = A) : isNaN(parseFloat(A)) ? this.a = 1 : ((A = parseFloat(A)) > 1 && (A = 1),
            0 > A && (A = 0),
            this.a = A),
            this
        },
        setRGB: function(A, e, t, i) {
            return this.r = A > 1 ? Math.min(255, parseInt(A, 10)) / 255 : A,
            this.g = e > 1 ? Math.min(255, parseInt(e, 10)) / 255 : e,
            this.b = t > 1 ? Math.min(255, parseInt(t, 10)) / 255 : t,
            this.setAlpha(i),
            this
        },
        setHSL: function(A, e, t, i) {
            if (A = Xc.euclideanModulo(A, 1),
            e = Xc.clamp(e, 0, 1),
            t = Xc.clamp(t, 0, 1),
            0 === e)
                this.r = this.g = this.b = t;
            else {
                var o = t > .5 ? t + e - t * e : t * (1 + e)
                  , n = 2 * t - o;
                this.r = zh(n, o, A + 1 / 3),
                this.g = zh(n, o, A),
                this.b = zh(n, o, A - 1 / 3)
            }
            return this.a = i,
            this
        },
        setStyle: function(A) {
            var e = null;
            if (e = /^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(A)) {
                var t = null
                  , i = e[2];
                switch (e[1]) {
                case "rgb":
                case "rgba":
                    if (t = /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))
                        return this.r = Math.min(255, parseInt(t[1], 10)) / 255,
                        this.g = Math.min(255, parseInt(t[2], 10)) / 255,
                        this.b = Math.min(255, parseInt(t[3], 10)) / 255,
                        this.setAlpha(t[5]),
                        this;
                    if (t = /^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i))
                        return this.r = Math.min(100, parseInt(t[1], 10)) / 100,
                        this.g = Math.min(100, parseInt(t[2], 10)) / 100,
                        this.b = Math.min(100, parseInt(t[3], 10)) / 100,
                        this.setAlpha(t[5]),
                        this;
                    break;
                case "hsl":
                case "hsla":
                    if (t = /^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(i)) {
                        var o = parseFloat(t[1]) / 360
                          , n = parseInt(t[2], 10) / 100
                          , r = parseInt(t[3], 10) / 100;
                        return this.setAlpha(t[5]),
                        this.setHSL(o, n, r)
                    }
                }
            } else if (e = /^\#([A-Fa-f0-9]+)$/.exec(A)) {
                var a, s = (a = e[1]).length;
                if (3 === s)
                    return this.r = parseInt(a.charAt(0) + a.charAt(0), 16) / 255,
                    this.g = parseInt(a.charAt(1) + a.charAt(1), 16) / 255,
                    this.b = parseInt(a.charAt(2) + a.charAt(2), 16) / 255,
                    this;
                if (6 === s)
                    return this.r = parseInt(a.charAt(0) + a.charAt(1), 16) / 255,
                    this.g = parseInt(a.charAt(2) + a.charAt(3), 16) / 255,
                    this.b = parseInt(a.charAt(4) + a.charAt(5), 16) / 255,
                    this
            }
            A && A.length > 0 && (void 0 !== (a = Jh[A]) ? this.setHex(a) : Bh.warn("Color: Unknown color " + A));
            return this
        },
        getHex: function() {
            return 255 * this.r << 16 ^ 255 * this.g << 8 ^ 255 * this.b << 0
        },
        getHexString: function() {
            return ("000000" + this.getHex().toString(16)).slice(-6)
        },
        getHSL: function() {
            var A = {
                h: 0,
                s: 0,
                l: 0,
                a: 1
            }
              , e = this.r
              , t = this.g
              , i = this.b
              , o = Math.max(e, t, i)
              , n = Math.min(e, t, i)
              , r = 0
              , a = 0
              , s = (n + o) / 2;
            if (n === o)
                r = 0,
                a = 0;
            else {
                var l = o - n;
                switch (a = s > .5 ? l / (2 - o - n) : l / (o + n),
                o) {
                case e:
                    r = (t - i) / l + (i > t ? 6 : 0);
                    break;
                case t:
                    r = (i - e) / l + 2;
                    break;
                case i:
                    r = (e - t) / l + 4
                }
                r /= 6
            }
            return A.h = r,
            A.s = a,
            A.l = s,
            A.a = this.a,
            A
        },
        getRGB: function() {
            return "rgb(" + (255 * this.r | 0) + "," + (255 * this.g | 0) + "," + (255 * this.b | 0) + ")"
        },
        getRGBA: function() {
            return "rgba(" + (255 * this.r | 0) + "," + (255 * this.g | 0) + "," + (255 * this.b | 0) + "," + this.a + ")"
        },
        getAlpha: function() {
            return this.a
        },
        getStyle: function() {
            return "rgb(" + (255 * this.r | 0) + "," + (255 * this.g | 0) + "," + (255 * this.b | 0) + ")"
        },
        offsetHSL: (Zh = {},
        function(A, e, t) {
            return this.getHSL(Zh),
            Zh.h += A,
            Zh.s += e,
            Zh.l += t,
            this.setHSL(Zh.h, Zh.s, Zh.l),
            this
        }
        ),
        fromArray: function(A, e) {
            return void 0 === e && (e = 0),
            this.r = A[e],
            this.g = A[e + 1],
            this.b = A[e + 2],
            this.a = A[e + 3] || 1,
            this
        },
        toArray: function(A, e) {
            return void 0 === A && (A = []),
            void 0 === e && (e = 0),
            A[e] = this.r,
            A[e + 1] = this.g,
            A[e + 2] = this.b,
            A[e + 3] = this.a,
            A
        },
        toRGBArray: function(A, e) {
            return void 0 === A && (A = []),
            void 0 === e && (e = 0),
            A[e] = 255 * this.r,
            A[e + 1] = 255 * this.g,
            A[e + 2] = 255 * this.b,
            A[e + 3] = 255 * this.a,
            A
        },
        toJSON: function() {
            return this.getHex()
        }
    }),
    Object.defineProperties(Xh.prototype, {
        red: {
            get: function() {
                return this.r
            },
            set: function(A) {
                this.r = A
            }
        },
        green: {
            get: function() {
                return this.g
            },
            set: function(A) {
                this.g = A
            }
        },
        blue: {
            get: function() {
                return this.b
            },
            set: function(A) {
                this.b = A
            }
        },
        alpha: {
            get: function() {
                return this.a
            },
            set: function(A) {
                this.a = A
            }
        },
        opacity: {
            get: function() {
                return this.a
            },
            set: function(A) {
                this.a = A
            }
        }
    });
    var _h = ["uniform bool receiveShadow;", "uniform vec3 ambientLightColor;", "uniform vec3 lightProbe[ 9 ];", "vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {", "    float x = normal.x, y = normal.y, z = normal.z;", "    vec3 result = shCoefficients[ 0 ] * 0.886227;", "    result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;", "    result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;", "    result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;", "    result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;", "    result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;", "    result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );", "    result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;", "    result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );", "    return result;", "}", "vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {", "    vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );", "    vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );", "    return irradiance;", "}", "vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {", "    vec3 irradiance = ambientLightColor;", "    #ifndef PHYSICALLY_CORRECT_LIGHTS", "        irradiance *= PI;", "    #endif", "    return irradiance;", "}", "#if NUM_DIR_LIGHTS > 0", "    struct DirectionalLight {", "        vec3 direction;", "        vec3 color;", "   };", "    uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];", "    #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0", "        struct DirectionalLightShadow {", "            float shadowBias;", "            float shadowRadius;", "            vec2 shadowMapSize;", "        };", "        uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];", "    #endif", "    void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {", "        directLight.color = directionalLight.color;", "        directLight.direction = directionalLight.direction;", "        directLight.visible = true;", "    }", "#endif", "#if NUM_POINT_LIGHTS > 0", "    struct PointLight {", "        vec3 position;", "        vec3 color;", "        float distance;", "        float decay;", "    };", "    uniform PointLight pointLights[ NUM_POINT_LIGHTS ];", "    #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0", "        struct PointLightShadow {", "            float shadowBias;", "            float shadowRadius;", "            vec2 shadowMapSize;", "            float shadowCameraNear;", "            float shadowCameraFar;", "        };", "        uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];", "    #endif", "    void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {", "        vec3 lVector = pointLight.position - geometry.position;", "        directLight.direction = normalize( lVector );", "        float lightDistance = length( lVector );", "        directLight.color = pointLight.color;", "        directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );", "        directLight.visible = ( directLight.color != vec3( 0.0 ) );", "    }", "#endif", "#if NUM_SPOT_LIGHTS > 0", "    struct SpotLight {", "        vec3 position;", "        vec3 direction;", "        vec3 color;", "        float distance;", "        float decay;", "        float coneCos;", "        float penumbraCos;", "    };", "    uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];", "    #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0", "        struct SpotLightShadow {", "            float shadowBias;", "            float shadowRadius;", "            vec2 shadowMapSize;", "        };", "        uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];", "    #endif", "    void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight  ) {", "        vec3 lVector = spotLight.position - geometry.position;", "        directLight.direction = normalize( lVector );", "        float lightDistance = length( lVector );", "        float angleCos = dot( directLight.direction, spotLight.direction );", "        if ( angleCos > spotLight.coneCos ) {", "            float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );", "            directLight.color = spotLight.color;", "            directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );", "            directLight.visible = true;", "        } else {", "            directLight.color = vec3( 0.0 );", "            directLight.visible = false;", "        }", "    }", "#endif", "#if NUM_RECT_AREA_LIGHTS > 0", "    struct RectAreaLight {", "        vec3 color;", "        vec3 position;", "        vec3 halfWidth;", "        vec3 halfHeight;", "    };", "    uniform sampler2D ltcMat;    uniform sampler2D ltcMag;", "    uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];", "#endif", "#if NUM_HEMI_LIGHTS > 0", "    struct HemisphereLight {", "        vec3 direction;", "        vec3 skyColor;", "        vec3 groundColor;", "    };", "    uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];", "    vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {", "        float dotNL = dot( geometry.normal, hemiLight.direction );", "        float hemiDiffuseWeight = 0.5 * dotNL + 0.5;", "        vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );", "        #ifndef PHYSICALLY_CORRECT_LIGHTS", "            irradiance *= PI;", "        #endif", "        return irradiance;", "    }", "#endif", "#if defined( USE_ENVMAP ) && defined( PHYSICAL )", "    vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {", "        vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );", "        #ifdef ENVMAP_TYPE_CUBE", "            vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );", "            #ifdef TEXTURE_LOD_EXT", "                vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );", "            #else", "                vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );", "            #endif", "            envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;", "        #elif defined( ENVMAP_TYPE_CUBE_UV )", "            vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );", "            vec4 envMapColor = textureCubeUV( queryVec, 1.0 );", "        #else", "            vec4 envMapColor = vec4( 0.0 );", "        #endif", "        return PI * envMapColor.rgb * envMapIntensity;", "    }", "    float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {", "        float maxMIPLevelScalar = float( maxMIPLevel );", "        float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );", "        return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );", "    }", "    vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {", "        #ifdef ENVMAP_MODE_REFLECTION", "            vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );", "        #else", "            vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );", "        #endif", "        reflectVec = inverseTransformDirection( reflectVec, viewMatrix );", "        float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );", "        #ifdef ENVMAP_TYPE_CUBE", "            vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );", "            #ifdef TEXTURE_LOD_EXT", "                vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );", "            #else", "                vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );", "            #endif", "            envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;", "        #elif defined( ENVMAP_TYPE_CUBE_UV )", "            vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );", "            vec4 envMapColor = textureCubeUV(queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent));", "        #elif defined( ENVMAP_TYPE_EQUIREC )", "            vec2 sampleUV;", "            sampleUV.y = saturate( reflectVec.y * 0.5 + 0.5 );", "            sampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;", "            #ifdef TEXTURE_LOD_EXT", "                vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );", "            #else", "                vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );", "            #endif", "            envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;", "        #elif defined( ENVMAP_TYPE_SPHERE )", "            vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );", "            #ifdef TEXTURE_LOD_EXT", "                vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );", "            #else", "                vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );", "            #endif", "            envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;", "        #endif", "        return envMapColor.rgb * envMapIntensity;", "    }", "#endif"].join("\n")
      , $h = ["", "GeometricContext geometry;", "geometry.position = - vViewPosition;", "geometry.normal = normal;", "geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );", "#ifdef CLEARCOAT", "geometry.clearcoatNormal = clearcoatNormal;", "#endif", "IncidentLight directLight;", "#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )", "PointLight pointLight;", "#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0", "PointLightShadow pointLightShadow;", "#endif", "#pragma unroll_loop_start", "for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {", "pointLight = pointLights[ i ];", "getPointDirectLightIrradiance( pointLight, geometry, directLight );", "#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )", "pointLightShadow = pointLightShadows[ i ];", "directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;", "#endif", "RE_Direct( directLight, geometry, material, reflectedLight );", "}", "#endif", "#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )", "SpotLight spotLight;", "#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0", "SpotLightShadow spotLightShadow;", "#endif", "#pragma unroll_loop_start", "for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {", "spotLight = spotLights[ i ];", "getSpotDirectLightIrradiance( spotLight, geometry, directLight );", "#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )", "spotLightShadow = spotLightShadows[ i ];", "directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;", "#endif", "RE_Direct( directLight, geometry, material, reflectedLight );", "}", "#pragma unroll_loop_end", "#endif", "#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )", "DirectionalLight directionalLight;", "#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0", "DirectionalLightShadow directionalLightShadow;", "#endif", "#pragma unroll_loop_start", "for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {", "directionalLight = directionalLights[ i ];", "getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );", "#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )", "directionalLightShadow = directionalLightShadows[ i ];", "directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;", "#endif", "RE_Direct( directLight, geometry, material, reflectedLight );", "}", "#pragma unroll_loop_end", "#endif", "#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )", "RectAreaLight rectAreaLight;", "#pragma unroll_loop_start", "for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {", "rectAreaLight = rectAreaLights[ i ];", "RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );", "}", "#pragma unroll_loop_end", "#endif", "#if defined( RE_IndirectDiffuse )", "vec3 iblIrradiance = vec3( 0.0 );", "vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );", "irradiance += getLightProbeIrradiance( lightProbe, geometry );", "#if ( NUM_HEMI_LIGHTS > 0 )", "#pragma unroll_loop_start", "for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {", "irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );", "}", "#pragma unroll_loop_end", "#endif", "#endif", "#if defined( RE_IndirectSpecular )", "vec3 radiance = vec3( 0.0 );", "vec3 clearcoatRadiance = vec3( 0.0 );", "#endif"].join("\n")
      , Ad = ["#ifdef DOUBLE_SIDED", "    float flipNormal = ( float( gl_FrontFacing ) * 2.0 - 1.0 );", "#else", "    float flipNormal = 1.0;", "#endif\n"].join("\n")
      , ed = ["#ifdef FLAT_SHADED", "    vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );", "    vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );", "    vec3 normal = normalize( cross( fdx, fdy ) );", "#else", "    vec3 normal = normalize( vNormal ) * flipNormal;", "#endif", "#ifdef USE_NORMALMAP", "    normal = perturbNormal2Arb( -vViewPosition, normal );", "#elif defined( USE_BUMPMAP )", "    normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );", "#endif", "vec3 geometryNormal = normal;"].join("\n")
      , td = ["GeometricContext geometry;", "geometry.position = - vViewPosition;", "#if NUM_CLIPPING_PLANES == 1", "    if (gl_FrontFacing) geometry.normal = normal;", "    else if (fillFaceClipDistance < 0.0) geometry.normal = -clippingPlanes[0].xyz;", "    else geometry.normal = -normal;", "#else", "    geometry.normal = normal;", "#endif", "geometry.viewDir = normalize( vViewPosition );", "IncidentLight directLight;", "#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )", "    PointLight pointLight;", "    for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {", "        pointLight = pointLights[ i ];", "        getPointDirectLightIrradiance( pointLight, geometry, directLight );", "        #ifdef USE_SHADOWMAP", "        directLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ] ,pointLight.shadowCameraNear, pointLight.shadowCameraFar) : 1.0;", "        #endif", "        RE_Direct( directLight, geometry, material, reflectedLight );", "    }", "#endif", "#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )", "    SpotLight spotLight;", "    for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {", "        spotLight = spotLights[ i ];", "        getSpotDirectLightIrradiance( spotLight, geometry, directLight );", "        #ifdef USE_SHADOWMAP", "        directLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;", "        #endif", "    RE_Direct( directLight, geometry, material, reflectedLight );", "    }", "#endif", "#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )", "    DirectionalLight directionalLight;", "    for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {", "        directionalLight = directionalLights[ i ];", "        getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );", "        #ifdef USE_SHADOWMAP", "        directLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;", "        #endif", "        RE_Direct( directLight, geometry, material, reflectedLight );", "    }", "#endif", "#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )", "    RectAreaLight rectAreaLight;", "    for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {", "        rectAreaLight = rectAreaLights[ i ];", "        RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );", "    }", "#endif", "#if defined( RE_IndirectDiffuse )", "    vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );", "    #ifdef USE_LIGHTMAP", "        vec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;", "        #ifndef PHYSICALLY_CORRECT_LIGHTS", "            lightMapIrradiance *= PI; // factor of PI should not be present; included here to prevent breakage", "        #endif", "        irradiance += lightMapIrradiance;", "    #endif", "    #if ( NUM_HEMI_LIGHTS > 0 )", "        for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {", "            irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );", "        }", "    #endif", "    #if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )", "        irradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, 8 );", "    #endif", "    RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );", "#endif", "#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )", "    vec3 radiance = getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry, Material_BlinnShininessExponent( material ), 8 );", "    #ifndef STANDARD", "        vec3 clearCoatRadiance = getLightProbeIndirectRadiance( /*specularLightProbe,*/ geometry, Material_ClearCoat_BlinnShininessExponent( material ), 8 );", "    #else", "        vec3 clearCoatRadiance = vec3( 0.0 );", "    #endif", "    RE_IndirectSpecular( radiance, clearCoatRadiance, geometry, material, reflectedLight );", "#endif"].join("\n")
      , id = ["#define PHONG", "uniform vec3 diffuse;", "uniform vec3 emissive;", "uniform vec3 specular;", "uniform float shininess;", "uniform float opacity;", "#include <common>", "#include <packing>", "#include <dithering_pars_fragment>", "#include <color_pars_fragment>", "#include <uv_pars_fragment>", "#include <uv2_pars_fragment>", "#include <map_pars_fragment>", "#include <alphamap_pars_fragment>", "#include <aomap_pars_fragment>", "#include <lightmap_pars_fragment>", "#include <emissivemap_pars_fragment>", "#include <envmap_pars_fragment>", "#include <gradientmap_pars_fragment>", "#include <fog_pars_fragment>", "#include <bsdfs>", "#include <lights_pars>", "#include <lights_phong_pars_fragment>", "#include <shadowmap_pars_fragment>", "#include <bumpmap_pars_fragment>", "#include <normalmap_pars_fragment>", "#include <specularmap_pars_fragment>", "#include <logdepthbuf_pars_fragment>", "#include <clipping_planes_pars_fragment>", "void main() {", "    #include <clipping_planes_fragment>", "    vec4 diffuseColor = vec4( diffuse, opacity );", "    ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );", "    vec3 totalEmissiveRadiance = emissive;", "    #include <logdepthbuf_fragment>", "    #include <map_fragment>", "    #include <color_fragment>", "    #include <alphamap_fragment>", "    #include <alphatest_fragment>", "    #include <specularmap_fragment>", "    #include <normal_flip>", "    #include <normal_fragment>", "    #include <emissivemap_fragment>", "   float fillFaceClipDistance = 0.0;", "   #if NUM_CLIPPING_PLANES == 1", "       vec4 plane = clippingPlanes[ 0 ];", "        fillFaceClipDistance = dot( vViewPosition, plane.xyz ) - plane.w;", "   #endif", "    #include <lights_phong_fragment>", "    #include <lights_fillFace_template>", "    #include <aomap_fragment>", "    vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;", "    #include <envmap_fragment>", "    gl_FragColor = vec4( outgoingLight, diffuseColor.a );", "    #include <tonemapping_fragment>", "    #include <encodings_fragment>", "    #include <fog_fragment>", "    #include <premultiplied_alpha_fragment>", "    #include <dithering_fragment>", "}"].join("\n")
      , od = ["#define PHONG", "varying vec3 vViewPosition;", "#ifndef FLAT_SHADED", "varying vec3 vNormal;", "#endif", "#include <common>", "#include <uv_pars_vertex>", "#include <uv2_pars_vertex>", "#include <displacementmap_pars_vertex>", "#include <envmap_pars_vertex>", "#include <color_pars_vertex>", "#include <fog_pars_vertex>", "#include <morphtarget_pars_vertex>", "#include <skinning_pars_vertex>", "#include <shadowmap_pars_vertex>", "#include <logdepthbuf_pars_vertex>", "#include <clipping_planes_pars_vertex>", "void main() {", "#include <uv_vertex>", "#include <uv2_vertex>", "#include <color_vertex>", "#include <beginnormal_vertex>", "#include <morphnormal_vertex>", "#include <skinbase_vertex>", "#include <skinnormal_vertex>", "#include <defaultnormal_vertex>", "#ifndef FLAT_SHADED", "vNormal = normalize( transformedNormal );", "#endif", "#include <begin_vertex>", "#include <displacementmap_vertex>", "#include <morphtarget_vertex>", "#include <skinning_vertex>", "#include <project_vertex>", "#include <logdepthbuf_vertex>", "#include <clipping_planes_vertex>", "vViewPosition = - mvPosition.xyz;", "#include <worldpos_vertex>", "#include <envmap_vertex>", "#include <shadowmap_vertex>", "#include <fog_vertex>", "}"].join("\n")
      , nd = ["#define PHYSICAL", "varying vec3 vViewPosition;", "#ifndef FLAT_SHADED", "varying vec3 vNormal;", "#endif", "#include <common>", "#include <uv_pars_vertex>", "#include <uv2_pars_vertex>", "#include <displacementmap_pars_vertex>", "#include <color_pars_vertex>", "#include <fog_pars_vertex>", "#include <morphtarget_pars_vertex>", "#include <skinning_pars_vertex>", "#include <shadowmap_pars_vertex>", "#include <specularmap_pars_fragment>", "#include <logdepthbuf_pars_vertex>", "#include <clipping_planes_pars_vertex>", "void main() {", "#include <uv_vertex>", "#include <uv2_vertex>", "#include <color_vertex>", "#include <beginnormal_vertex>", "#include <morphnormal_vertex>", "#include <skinbase_vertex>", "#include <skinnormal_vertex>", "#include <defaultnormal_vertex>", "#ifndef FLAT_SHADED", "vNormal = normalize( transformedNormal );", "#endif", "#include <begin_vertex>", "#include <displacementmap_vertex>", "#include <morphtarget_vertex>", "#include <skinning_vertex>", "#include <project_vertex>", "#include <logdepthbuf_vertex>", "#include <clipping_planes_vertex>", "vViewPosition = - mvPosition.xyz;", "#include <worldpos_vertex>", "#include <shadowmap_vertex>", "#include <fog_vertex>", "}"].join("\n")
      , rd = ["#define PHYSICAL", "uniform vec3 diffuse;", "uniform vec3 emissive;", "uniform float roughness;", "uniform float metalness;", "uniform float opacity;", "#ifndef STANDARD", "uniform float clearCoat;", "uniform float clearCoatRoughness;", "#endif", "varying vec3 vViewPosition;", "#ifndef FLAT_SHADED", "varying vec3 vNormal;", "#endif", "#include <common>", "#include <packing>", "#include <dithering_pars_fragment>", "#include <color_pars_fragment>", "#include <uv_pars_fragment>", "#include <uv2_pars_fragment>", "#include <map_pars_fragment>", "#include <alphamap_pars_fragment>", "#include <aomap_pars_fragment>", "#include <lightmap_pars_fragment>", "#include <emissivemap_pars_fragment>", "#include <envmap_pars_fragment>", "#include <fog_pars_fragment>", "#include <bsdfs>", "#include <cube_uv_reflection_fragment>", "#include <lights_pars>", "#include <lights_physical_pars_fragment>", "#include <shadowmap_pars_fragment>", "#include <bumpmap_pars_fragment>", "#include <normalmap_pars_fragment>", "#include <roughnessmap_pars_fragment>", "#include <metalnessmap_pars_fragment>", "#include <logdepthbuf_pars_fragment>", "#include <clipping_planes_pars_fragment>", "void main() {", "#include <clipping_planes_fragment>", "vec4 diffuseColor = vec4( diffuse, opacity );", "vec3 totalEmissiveRadiance = emissive;", "#include <logdepthbuf_fragment>", "#include <map_fragment>", "#include <color_fragment>", "#include <alphamap_fragment>", "#include <alphatest_fragment>", "#include <specularmap_fragment>", "#include <roughnessmap_fragment>", "#include <metalnessmap_fragment>", "#include <normal_flip>", "#include <normal_fragment>", "#include <emissivemap_fragment>", "const mat4 diffuseMatrix = mat4(-0.07425443828105927, -0.05652861297130585, 0.12247831374406815, 0.2297295778989792,", "                               -0.05652860924601555, 0.034799136221408844, -0.08437120914459229, -0.13896968960762024,", "                               0.12247832119464874, -0.08437121659517288, 0.021763987839221954, 0.12510454654693604,", "                               0.2297295778989792, -0.13896968960762024, 0.12510454654693604, 0.6190560460090637);", "const vec3 sunDir = vec3(-0.6632131338119507, 0.5486575961112976, -0.509041428565979);", "vec3 viewDir = normalize( vViewPosition );", "vec4 diffuseDir = diffuseMatrix * vec4(normal, 1.0);", "float diffuseTerm = dot(vec4(normal, 1.0), diffuseDir);", "float nv = max(dot(normal, -viewDir), 0.0);", "float vl = max(dot(viewDir, sunDir), 0.0);", "diffuseTerm = diffuseTerm + (nv * (1.0 - vl)) * 0.8;", "vec3 H = -normalize(sunDir + viewDir);", "float nh = max(dot(normal, H), 0.0);", "float specularTerm = pow(nh, 100.0);", "vec3 color = 1.05 * vec3(0.5, 0.497, 0.49) * (diffuse * diffuseTerm + vec3(specularTerm)) + diffuse * 0.5;", "vec3 outgoingLight = color + totalEmissiveRadiance;", "gl_FragColor = vec4( outgoingLight, diffuseColor.a );", "#include <tonemapping_fragment>", "#include <encodings_fragment>", "#include <fog_fragment>", "#include <premultiplied_alpha_fragment>", "#include <dithering_fragment>", "}"].join("\n")
      , ad = ["#define EIMMODELPHYSICAL", "mat3 transpose2( const in mat3 v ) {\n    mat3 tmp;\n    tmp[0] = vec3(v[0].x, v[1].x, v[2].x);\n    tmp[1] = vec3(v[0].y, v[1].y, v[2].y);\n    tmp[2] = vec3(v[0].z, v[1].z, v[2].z);\n    return tmp;\n}\n", "varying vec3 vViewPosition;", "varying vec3 vWorldPosition;", "#ifndef FLAT_SHADED", "     varying vec3 vNormal;", "     #ifdef USE_TANGENT", "          varying vec3 vTangent;", "          varying vec3 vBitangent;", "     #endif", "#endif", "#ifdef USE_INSTANCE", "   attribute float vState;", "   attribute float vState2;", "   varying float fState;", "   attribute float vMirror;", "   attribute vec4 aColor;", "   varying vec4 vaColor;", "   attribute vec3 mcol0;", "   attribute vec3 mcol1;", "   attribute vec3 mcol2;", "   attribute vec3 mcol3;", "#ifdef INSTANCE_STATE_TERTIARY", "   attribute float vState3;", "#endif", "#endif", "#include <common>", "#include <uv_pars_vertex>", "#include <uv2_pars_vertex>", "#include <displacementmap_pars_vertex>", "#include <color_pars_vertex>", "#include <fog_pars_vertex>", "#include <morphtarget_pars_vertex>", "#include <skinning_pars_vertex>", "#include <shadowmap_pars_vertex>", "#include <specularmap_pars_fragment>", "#include <logdepthbuf_pars_vertex>", "#include <clipping_planes_pars_vertex>", "mat3 inverse_mat3(in mat3 m)", "{", "   float determinant =", "    m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2])", "    - m[1][0] * (m[0][1] * m[2][2] - m[2][1] * m[0][2])", "    + m[2][0] * (m[0][1] * m[1][2] - m[1][1] * m[0][2]);", "    mat3 inverse;", "    inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]);", "    inverse[1][0] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]);", "    inverse[2][0] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]);", "    inverse[0][1] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]);", "    inverse[1][1] = + (m[0][0] * m[2][2] - m[2][0] * m[0][2]);", "    inverse[2][1] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]);", "    inverse[0][2] = + (m[0][1] * m[1][2] - m[1][1] * m[0][2]);", "    inverse[1][2] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]);", "    inverse[2][2] = + (m[0][0] * m[1][1] - m[1][0] * m[0][1]);", "    inverse /= determinant;", "    return inverse;", "}", "void main() {", "   #include <uv_vertex>", "   #ifdef USE_TRANSFORM_AOMAP", "       #if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )", "           vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;", "       #endif", "   #endif ", "   #include <color_vertex>", "   #include <beginnormal_vertex>", "   #include <morphnormal_vertex>", "   #include <skinbase_vertex>", "   #include <skinnormal_vertex>", "   #include <defaultnormal_vertex>", "   #include <begin_vertex>", "#ifdef USE_INSTANCE", "       vaColor = aColor;", "   #ifdef INSTANCE_STATE_SECONDARY", "       fState = vState2;", "   #else", "       fState = vState;", "   #endif", "   #ifdef INSTANCE_STATE_TERTIARY", "       fState = vState3;", "   #endif", "   transformed = vec3(mat4(vec4(mcol0, 0.0),", "                   vec4(mcol1, 0.0),", "                   vec4(mcol2, 0.0),", "                   vec4(mcol3, 1.0)) * vec4(transformed, 1.0));", "   #ifdef USE_INSTANCE_NORMAL", "       mat3 normalMat = mat3(mcol0, mcol1, mcol2);", "       normalMat = inverse_mat3(normalMat);", "       normalMat = transpose2(normalMat);", "       transformedNormal = normalMat * objectNormal;", "       transformedNormal = normalMatrix * transformedNormal;", "   #ifdef FLIP_SIDED", "       transformedNormal = - transformedNormal;", "   #endif", "    transformedNormal = normalize( transformedNormal );", "   #endif", "#endif", "#ifndef FLAT_SHADED", "     vNormal = normalize( transformedNormal );", "     #ifdef USE_TANGENT", "          vTangent = normalize( transformedTangent );", "          vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );", "     #endif", "#endif", "   #include <morphtarget_vertex>", "   #include <skinning_vertex>", "   #include <displacementmap_vertex>", "   #include <project_vertex>", "   #include <logdepthbuf_vertex>", "   #include <clipping_planes_vertex>", "   vViewPosition = - mvPosition.xyz;", "   // 热力图", "   #if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )|| defined(HEATMAPPOINTSCOUNT)", "       vec4 worldPosition = vec4( transformed, 1.0 );", "       #ifdef USE_INSTANCING", "           worldPosition = instanceMatrix * worldPosition;", "       #endif", "       worldPosition = modelMatrix * worldPosition;", "       vWorldPosition = vec3(worldPosition.xyz);", "   #endif", "   #include <shadowmap_vertex>", "   #include <fog_vertex>", "#ifdef USE_INSTANCE", "      if (vMirror <=  - 0.01){", "           vNormal =  vNormal * - 1.0;}", "#endif", "}"].join("\n")
      , sd = ["#define EIMMODELPHYSICAL", "#ifdef PHYSICAL", "     #define REFLECTIVITY", "     #define CLEARCOAT", "     #define TRANSPARENCY", "#endif", "uniform vec3 diffuse;", "uniform vec3 emissive;", "uniform float roughness;", "uniform float metalness;", "uniform float opacity;", "#ifdef TRANSPARENCY", "     uniform float transparency;", "#endif", "#ifdef REFLECTIVITY", "     uniform float reflectivity;", "#endif", "#ifdef CLEARCOAT", "     uniform float clearcoat;", "     uniform float clearcoatRoughness;", "#endif", "#ifdef USE_SHEEN", "     uniform vec3 sheen;", "#endif", "uniform float imageFade;", "varying vec3 vViewPosition;", "varying vec3 vWorldPosition;", "#ifndef FLAT_SHADED", "     varying vec3 vNormal;", "     #ifdef USE_TANGENT", "          varying vec3 vTangent;", "          varying vec3 vBitangent;", "     #endif", "#endif", "#ifdef USE_INSTANCE", "   varying vec4 vaColor;", "   varying float fState;", "#endif", "uniform float shift;", "uniform float A;", "uniform float B;", "uniform float C;", "uniform float D;", "uniform float E;", "uniform float F;", "uniform float scale;", "uniform vec4 blinkColor;", "uniform float colorState;", "#ifdef HEATMAPPOINTSCOUNT", "   uniform float heatmapPoints[HEATMAPPOINTSCOUNT];", "   uniform sampler2D heatmapTexture;", "#endif", "vec3 toneMapCanonFilmic(vec3 color)", "{", "    color *= (1.0 / shift);", "    return (((color * (A * color + C * B)) / (color * (A * color + B) + D * F))) * (1.0 / scale);", "}", "#include <common>", "#include <packing>", "#include <dithering_pars_fragment>", "#include <color_pars_fragment>", "#include <uv_pars_fragment>", "#include <uv2_pars_fragment>", "#include <map_pars_fragment>", "#include <alphamap_pars_fragment>", "#include <aomap_pars_fragment>", "#include <lightmap_pars_fragment>", "#include <emissivemap_pars_fragment>", "#include <bsdfs>", "#include <cube_uv_reflection_fragment>", "#include <envmap_common_pars_fragment>", "#include <envmap_physical_pars_fragment>", "#include <fog_pars_fragment>", "#include <lights_pars_begin>", "#include <lights_physical_pars_fragment>", "#include <shadowmap_pars_fragment>", "#include <bumpmap_pars_fragment>", "#include <normalmap_pars_fragment>", "#include <clearcoat_pars_fragment>", "#include <roughnessmap_pars_fragment>", "#include <metalnessmap_pars_fragment>", "#include <specularmap_pars_fragment>", "#include <logdepthbuf_pars_fragment>", "#include <clipping_planes_pars_fragment>", "vec3 hdrDecode(in vec4 rgbm) {", "const float rgbmScale = 2.82842712;", "vec3 r = rgbm.rgb * (rgbmScale * (1.0 - rgbm.a));", "return r * r;", "}", "vec3 linearToGammaUnreal(in vec3 rgb) {", "    return rgb / (rgb + 0.187) * 1.035 * (0.5 / shift);", "}", "bool floatEqual(in float x, in float y) {", "    return (x >= y - 0.01) && (x <= y + 0.01);", "}", "bool floatNotEqual(in float x, in float y) {", "    return (x <= y - 0.01) || (x >= y + 0.01);", "}", "void main() {", "   #include <clipping_planes_fragment>", "   vec4 diffuseColor = vec4( diffuse, opacity );", "   #ifdef USE_INSTANCE", "       if (floatEqual(fState, -1.0)) ", "           discard;", "       if (floatNotEqual(fState, 0.0)) ", "           diffuseColor = vaColor;", "   #endif", "   vec4 selectedColor = diffuseColor;", "   ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );", "   vec3 totalEmissiveRadiance = emissive;", "   #include <logdepthbuf_fragment>", "   #ifdef USE_MAP", "       vec4 texelColor = texture2D( map, vUv );", "       texelColor = mapTexelToLinear( texelColor );", "       diffuseColor = vec4( mix(diffuseColor.rgb , texelColor.rgb, imageFade),opacity);", "       #ifdef USE_INSTANCE", "           if (floatNotEqual(fState, 0.0)) ", "               diffuseColor = vaColor;", "       #endif", "   #endif", "   #include <color_fragment>", "   #include <alphamap_fragment>", "   #include <alphatest_fragment>", "   #include <specularmap_fragment>", "   #include <roughnessmap_fragment>", "   #include <metalnessmap_fragment>", "float flipNormal = 1.0;", "   #include <normal_fragment_begin>", "   #include <normal_fragment_maps>", "   #include <clearcoat_normal_fragment_begin>", "   #include <clearcoat_normal_fragment_maps>", "   #include <emissivemap_fragment>", "     #include <lights_physical_fragment>", "     #include <lights_fragment_begin>", "     #include <lights_fragment_maps>", "     #include <lights_fragment_end>", "   #include <aomap_fragment>", "vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;", "#ifdef USE_COLORWITHOUTLIGHT", "   gl_FragColor = diffuseColor;", "#else", "     #ifdef TRANSPARENCY", "          diffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );", "     #endif", "   gl_FragColor = vec4( outgoingLight, diffuseColor.a );", "#endif", "#ifdef USE_INSTANCE", "   #ifdef  NOTAFFECTEDBYLIGHT", "       if (floatEqual(fState, 2.0))", "           gl_FragColor = selectedColor;", "   #endif", "    #ifdef USE_MAP", "         if (floatEqual(fState, 3.0))", "             gl_FragColor = vaColor;", "    #endif", "#endif", "#if defined( TONE_MAPPING )", "   #if defined(USE_LIGHTMAP)", "       gl_FragColor.rgb = linearToGammaUnreal(gl_FragColor.rgb );", "   #else", "       gl_FragColor.rgb = toneMapCanonFilmic( gl_FragColor.rgb );", "   #endif", "#endif", "#ifdef USE_INSTANCE", "       if (floatEqual(fState, 5.0) && floatEqual(colorState, 1.0))", "           gl_FragColor = blinkColor;", "#else", "      if (floatEqual(colorState, 1.0))", "         gl_FragColor = blinkColor;", "   #ifdef NOTAFFECTEDBYLIGHT", "       if (floatEqual(colorState, 2.0))", "           gl_FragColor = selectedColor;", "   #endif", "#endif", "#include <encodings_fragment>", "#include <fog_fragment>", "#include <premultiplied_alpha_fragment>", "#include <dithering_fragment>", "#ifdef HEATMAPPOINTSCOUNT", "       float heatvalue = 0.0;", "       for ( int i = 0; i < HEATMAPPOINTSCOUNT; i += 5 ) {", "           float heatpointX = heatmapPoints[i];", "           float heatpointY = heatmapPoints[i + 1];", "           float heatpointZ = heatmapPoints[i + 2];", "           // heatpointIndex保存的是当前热力点的热力值比上（最大热力和最小热力差）", "           // 也就是在热力区间中的百分比位置，为0的时候表示最小热力值，1的时候表示最大热力值", "           // 可以理解为就是热力点中心的热力值，只不过范围是0-1", "           // 热力最大值和最小值分别是所有热力点中热力最大和最小的值", "           float heatpointIndex = heatmapPoints[i + 3];", "           float heatpointRadius = heatmapPoints[i + 4];", "           float dis = distance(vWorldPosition, vec3(heatpointX, heatpointY, heatpointZ));", "           if(dis < heatpointRadius) {", "               float step = dis / heatpointRadius;", "               // 根据距离计算当前片元在当前热力点下的热力值", "               // step表示距离，范围0-1，越小表示距离热力点越近，热力越大，将距离区间0-1和热力区间heatpointIndex-0对应起来", "               float currentvalue = (1.0 - step) * heatpointIndex;", "               // 这里用到了一个颜色叠加的公式，把每个热点对当前片元产生的热力进行叠加，", "               // 没有特殊逻辑，也可以简单相加", "               heatvalue = heatvalue + currentvalue - heatvalue * currentvalue;", "               if (heatvalue > 1.0) {", "                   heatvalue = 1.0;", "                   break;", "               }", "           }", "       }", "       if (heatvalue > 0.0) {", "           vec4 color = texture2D(heatmapTexture, vec2(heatvalue, 0.5));", "           heatvalue = 0.5*heatvalue + 0.5;//使下列因子范围为1-0.5", "           color = vec4( mix(gl_FragColor.rgb, color.rgb, heatvalue),gl_FragColor.a);", "           gl_FragColor = color;", "       }", "#endif", "}"].join("\n");
    tt.lights_pars = _h,
    tt.lights_template = $h,
    tt.normal_flip = Ad,
    tt.normal_fragment = ed,
    tt.meshphong_id_vert = od,
    tt.lights_fillFace_template = td,
    tt.fillFaceFragment = id,
    tt.standardVertex = ad,
    tt.bos3dStandardFragment = sd,
    tt.newStyleVertex = nd,
    tt.newStyleFragment = rd,
    it.fillFacePhong = {
        uniforms: Ge.merge([Xe.common, Xe.aomap, Xe.lightmap, Xe.emissivemap, Xe.bumpmap, Xe.normalmap, Xe.displacementmap, Xe.gradientmap, Xe.fog, Xe.lights, {
            emissive: {
                value: new LA(0)
            },
            specular: {
                value: new LA(1118481)
            },
            shininess: {
                value: 30
            }
        }]),
        vertexShader: tt.meshphong_id_vert,
        fragmentShader: tt.fillFaceFragment
    },
    it.newStyle = {
        vertexShader: tt.newStyleVertex,
        fragmentShader: tt.newStyleFragment
    },
    it.bos3dStandard = {
        vertexShader: tt.standardVertex,
        fragmentShader: tt.bos3dStandardFragment
    };
    var ld = function(A) {
        yr.call(this),
        this.type = "bos3dStandard",
        this.roughness = 1,
        this.metalness = 0,
        this.originRoughness = 1,
        this.originMetalness = 0,
        this.pureColor = 0,
        this.textureColor = 0,
        this.imageFade = 1,
        this.transparentEx = !1,
        this.shift = .5,
        this.A = .64,
        this.B = .03,
        this.C = .02,
        this.D = .54,
        this.E = 0,
        this.F = .81,
        this.scale = .92,
        this.shininess = 30,
        this.specular = new LA(0);
        var e = (new LA).setHex(3330982)
          , t = [e.r, e.g, e.b, 1];
        this.colorState = Yc.NONE,
        this.blinkColor = (new p).fromArray(t),
        this.uniforms = Ge.merge([Xe.common, Xe.specularmap, Xe.envmap, Xe.aomap, Xe.lightmap, Xe.emissivemap, Xe.bumpmap, Xe.normalmap, Xe.displacementmap, Xe.roughnessmap, Xe.metalnessmap, Xe.fog, Xe.lights, {
            emissive: {
                value: new LA(0)
            },
            specular: {
                value: new LA(0)
            },
            roughness: {
                value: .5
            },
            metalness: {
                value: .5
            },
            envMapIntensity: {
                value: 1
            }
        }, {
            shift: {
                value: .5
            },
            A: {
                value: .64
            },
            B: {
                value: .03
            },
            C: {
                value: .02
            },
            D: {
                value: .54
            },
            E: {
                value: 0
            },
            F: {
                value: .81
            },
            scale: {
                value: .92
            },
            colorState: {
                value: 0
            },
            blinkColor: {
                value: (new p).fromArray(t)
            },
            imageFade: {
                value: 1
            },
            heatmapPoints: {
                value: []
            },
            heatmapTexture: {
                value: null
            }
        }]),
        this.vertexShader = tt.standardVertex,
        this.fragmentShader = tt.bos3dStandardFragment,
        this.defaultAttributeValues = {
            color: [1, 1, 1],
            uv: [0, 0],
            uv2: [0, 0]
        },
        void 0 !== A && (void 0 !== A.attributes && Bh.error("IBLMaterial: attributes should now be defined in THREE.BufferGeometry instead."),
        this.setValues(A)),
        this.lights && (this.uniforms = Ge.merge([this.uniforms, Xe.lights])),
        this.refreshUniforms && this.refreshUniforms()
    };
    function cd(A, e) {
        var t = (65535 & A) + (65535 & e);
        return (A >> 16) + (e >> 16) + (t >> 16) << 16 | 65535 & t
    }
    function hd(A, e, t, i, o, n) {
        return cd((r = cd(cd(e, A), cd(i, n))) << (a = o) | r >>> 32 - a, t);
        var r, a
    }
    function dd(A, e, t, i, o, n, r) {
        return hd(e & t | ~e & i, A, e, o, n, r)
    }
    function pd(A, e, t, i, o, n, r) {
        return hd(e & i | t & ~i, A, e, o, n, r)
    }
    function gd(A, e, t, i, o, n, r) {
        return hd(e ^ t ^ i, A, e, o, n, r)
    }
    function ud(A, e, t, i, o, n, r) {
        return hd(t ^ (e | ~i), A, e, o, n, r)
    }
    function fd(A, e) {
        var t, i, o, n, r;
        A[e >> 5] |= 128 << e % 32,
        A[14 + (e + 64 >>> 9 << 4)] = e;
        var a = 1732584193
          , s = -271733879
          , l = -1732584194
          , c = 271733878;
        for (t = 0; A.length > t; t += 16)
            i = a,
            o = s,
            n = l,
            r = c,
            a = dd(a, s, l, c, A[t], 7, -680876936),
            c = dd(c, a, s, l, A[t + 1], 12, -389564586),
            l = dd(l, c, a, s, A[t + 2], 17, 606105819),
            s = dd(s, l, c, a, A[t + 3], 22, -1044525330),
            a = dd(a, s, l, c, A[t + 4], 7, -176418897),
            c = dd(c, a, s, l, A[t + 5], 12, 1200080426),
            l = dd(l, c, a, s, A[t + 6], 17, -1473231341),
            s = dd(s, l, c, a, A[t + 7], 22, -45705983),
            a = dd(a, s, l, c, A[t + 8], 7, 1770035416),
            c = dd(c, a, s, l, A[t + 9], 12, -1958414417),
            l = dd(l, c, a, s, A[t + 10], 17, -42063),
            s = dd(s, l, c, a, A[t + 11], 22, -1990404162),
            a = dd(a, s, l, c, A[t + 12], 7, 1804603682),
            c = dd(c, a, s, l, A[t + 13], 12, -40341101),
            l = dd(l, c, a, s, A[t + 14], 17, -1502002290),
            a = pd(a, s = dd(s, l, c, a, A[t + 15], 22, 1236535329), l, c, A[t + 1], 5, -165796510),
            c = pd(c, a, s, l, A[t + 6], 9, -1069501632),
            l = pd(l, c, a, s, A[t + 11], 14, 643717713),
            s = pd(s, l, c, a, A[t], 20, -373897302),
            a = pd(a, s, l, c, A[t + 5], 5, -701558691),
            c = pd(c, a, s, l, A[t + 10], 9, 38016083),
            l = pd(l, c, a, s, A[t + 15], 14, -660478335),
            s = pd(s, l, c, a, A[t + 4], 20, -405537848),
            a = pd(a, s, l, c, A[t + 9], 5, 568446438),
            c = pd(c, a, s, l, A[t + 14], 9, -1019803690),
            l = pd(l, c, a, s, A[t + 3], 14, -187363961),
            s = pd(s, l, c, a, A[t + 8], 20, 1163531501),
            a = pd(a, s, l, c, A[t + 13], 5, -1444681467),
            c = pd(c, a, s, l, A[t + 2], 9, -51403784),
            l = pd(l, c, a, s, A[t + 7], 14, 1735328473),
            a = gd(a, s = pd(s, l, c, a, A[t + 12], 20, -1926607734), l, c, A[t + 5], 4, -378558),
            c = gd(c, a, s, l, A[t + 8], 11, -2022574463),
            l = gd(l, c, a, s, A[t + 11], 16, 1839030562),
            s = gd(s, l, c, a, A[t + 14], 23, -35309556),
            a = gd(a, s, l, c, A[t + 1], 4, -1530992060),
            c = gd(c, a, s, l, A[t + 4], 11, 1272893353),
            l = gd(l, c, a, s, A[t + 7], 16, -155497632),
            s = gd(s, l, c, a, A[t + 10], 23, -1094730640),
            a = gd(a, s, l, c, A[t + 13], 4, 681279174),
            c = gd(c, a, s, l, A[t], 11, -358537222),
            l = gd(l, c, a, s, A[t + 3], 16, -722521979),
            s = gd(s, l, c, a, A[t + 6], 23, 76029189),
            a = gd(a, s, l, c, A[t + 9], 4, -640364487),
            c = gd(c, a, s, l, A[t + 12], 11, -421815835),
            l = gd(l, c, a, s, A[t + 15], 16, 530742520),
            a = ud(a, s = gd(s, l, c, a, A[t + 2], 23, -995338651), l, c, A[t], 6, -198630844),
            c = ud(c, a, s, l, A[t + 7], 10, 1126891415),
            l = ud(l, c, a, s, A[t + 14], 15, -1416354905),
            s = ud(s, l, c, a, A[t + 5], 21, -57434055),
            a = ud(a, s, l, c, A[t + 12], 6, 1700485571),
            c = ud(c, a, s, l, A[t + 3], 10, -1894986606),
            l = ud(l, c, a, s, A[t + 10], 15, -1051523),
            s = ud(s, l, c, a, A[t + 1], 21, -2054922799),
            a = ud(a, s, l, c, A[t + 8], 6, 1873313359),
            c = ud(c, a, s, l, A[t + 15], 10, -30611744),
            l = ud(l, c, a, s, A[t + 6], 15, -1560198380),
            s = ud(s, l, c, a, A[t + 13], 21, 1309151649),
            a = ud(a, s, l, c, A[t + 4], 6, -145523070),
            c = ud(c, a, s, l, A[t + 11], 10, -1120210379),
            l = ud(l, c, a, s, A[t + 2], 15, 718787259),
            s = ud(s, l, c, a, A[t + 9], 21, -343485551),
            a = cd(a, i),
            s = cd(s, o),
            l = cd(l, n),
            c = cd(c, r);
        return [a, s, l, c]
    }
    function md(A) {
        var e, t = "", i = 32 * A.length;
        for (e = 0; i > e; e += 8)
            t += String.fromCharCode(A[e >> 5] >>> e % 32 & 255);
        return t
    }
    function Cd(A) {
        var e, t = [];
        for (t[(A.length >> 2) - 1] = void 0,
        e = 0; t.length > e; e += 1)
            t[e] = 0;
        var i = 8 * A.length;
        for (e = 0; i > e; e += 8)
            t[e >> 5] |= (255 & A.charCodeAt(e / 8)) << e % 32;
        return t
    }
    function yd(A) {
        var e, t, i = "";
        for (t = 0; A.length > t; t += 1)
            e = A.charCodeAt(t),
            i += "0123456789abcdef".charAt(e >>> 4 & 15) + "0123456789abcdef".charAt(15 & e);
        return i
    }
    function vd(A) {
        return unescape(encodeURIComponent(A))
    }
    function Id(A) {
        return function(A) {
            return md(fd(Cd(A), 8 * A.length))
        }(vd(A))
    }
    function Ed(A, e) {
        return function(A, e) {
            var t, i, o = Cd(A), n = [], r = [];
            for (n[15] = r[15] = void 0,
            o.length > 16 && (o = fd(o, 8 * A.length)),
            t = 0; 16 > t; t += 1)
                n[t] = 909522486 ^ o[t],
                r[t] = 1549556828 ^ o[t];
            return i = fd(n.concat(Cd(e)), 512 + 8 * e.length),
            md(fd(r.concat(i), 640))
        }(vd(A), vd(e))
    }
    function Bd(A, e, t) {
        return e ? t ? Ed(e, A) : yd(Ed(e, A)) : t ? Id(A) : yd(Id(A))
    }
    (ld.prototype = Object.create(yr.prototype)).constructor = ld,
    ld.prototype.destroy = function() {
        yr.prototype.dispose.call(this),
        this.blinkColor = null,
        this.uniforms = null,
        this.defaultAttributeValues = null,
        this.lights = null
    }
    ,
    ld.prototype.copy = function(A) {
        return yr.prototype.copy.call(this, A),
        this.shift = A.shift,
        this.A = A.A,
        this.B = A.B,
        this.C = A.C,
        this.D = A.D,
        this.E = A.E,
        this.F = A.F,
        this.scale = A.scale,
        this.colorState = A.colorState,
        this.blinkColor.copy(A.blinkColor),
        this.imageFade = A.imageFade,
        Object.assign(this.defines, A.defines),
        this
    }
    ,
    ld.prototype.refreshUniforms = function() {
        this.uniforms.shift.value = this.shift,
        this.uniforms.A.value = this.A,
        this.uniforms.B.value = this.B,
        this.uniforms.C.value = this.C,
        this.uniforms.D.value = this.D,
        this.uniforms.E.value = this.E,
        this.uniforms.F.value = this.F,
        this.uniforms.scale.value = this.scale,
        this.uniforms.blinkColor.value.copy(this.blinkColor),
        this.uniforms.colorState.value = this.colorState,
        this.uniforms.imageFade.value = this.imageFade
    }
    ,
    ld.prototype.setBlinkColor = function(A) {
        this.blinkColor.fromArray(A.toArray()),
        this.uniforms.blinkColor.value.copy(this.blinkColor),
        this.uniforms.colorState.value = Yc.BLINK
    }
    ,
    ld.prototype.updateBlinkUniformValue = function(A, e) {
        this.uniforms.colorState.value = A,
        this.uniforms.blinkColor.value.copy(e)
    }
    ,
    ld.prototype.resetBlinkUniformValue = function() {
        this.uniforms.colorState.value = this.colorState,
        this.uniforms.blinkColor.value.copy(this.blinkColor)
    }
    ,
    Object.defineProperties(ld.prototype, {
        transparent: {
            set: function(A) {
                this.transparentEx = A,
                vc.notDepthWriteByTransparent && (this.depthWrite = !A)
            },
            get: function() {
                return this.transparentEx
            }
        }
    });
    var xd = {
        REGULAR: 0,
        FRACTAL: 1,
        DISORDER: 2
    }
      , Sd = {
        type: xd.REGULAR,
        color1: new Xh(0,0,0,1),
        color2: new Xh(255,255,255,1),
        size: 10,
        level: 1,
        phase: 1,
        width: 32,
        height: 32,
        thresholdLow: 0,
        thresholdHigh: 1
    };
    function wd() {
        this.m = 2147483647,
        this.a = 16807,
        this.q = 127773,
        this.r = 2836,
        this.seed = 1,
        this.setSeed = function(A) {
            A > 0 || (A = -A % (this.m - 1) + 1),
            A > this.m - 1 && (A = this.m - 1),
            this.seed = A
        }
        ,
        this.nextLong = function() {
            var A = this.a * (this.seed % this.q) - this.r * Math.floor(this.seed / this.q);
            return A > 0 || (A += this.m),
            this.seed = A,
            A
        }
        ,
        this.next = function() {
            return this.nextLong() / this.m
        }
    }
    function Md(A, e, t) {
        this.width = A,
        this.height = e,
        this.randseed = t,
        this.gradients = new Array(A * e * 2);
        var i = new wd;
        i.setSeed(t);
        for (var o = 0; this.gradients.length > o; o += 2) {
            var n, r, a = i.next() * Math.PI * 2;
            n = Math.sin(a),
            r = Math.cos(a),
            this.gradients[o] = n,
            this.gradients[o + 1] = r
        }
        this.dot = function(A, e, t, i) {
            var o = 2 * (A + e * this.width);
            return this.gradients[o] * t + this.gradients[o + 1] * i
        }
        ,
        this.lerp = function(A, e, t) {
            return A + t * (e - A)
        }
        ,
        this.sCurve = function(A) {
            return A * A * (3 - 2 * A)
        }
        ,
        this.getValue = function(A, e, t, i) {
            var o = Math.floor(A)
              , n = Math.floor(e)
              , r = A - o
              , a = e - n
              , s = o
              , l = n
              , c = o === this.width - 1 ? 0 : o + 1
              , h = n === this.height - 1 ? 0 : n + 1
              , d = this.dot(s, l, r, a)
              , p = this.dot(c, l, r - 1, a)
              , g = this.dot(s, h, r, a - 1)
              , u = this.dot(c, h, r - 1, a - 1)
              , f = this.lerp(d, p, this.sCurve(r))
              , m = this.lerp(g, u, this.sCurve(r));
            return this.lerp(f, m, this.sCurve(a))
        }
    }
    var bd, Ud, Fd = function(A) {
        var e = Object.assign({}, Sd, A);
        switch (e.type) {
        case xd.REGULAR:
            return function(A) {
                var e = 10 * A.width
                  , t = 10 * A.height;
                if (!(A.color1 instanceof Xh))
                    return Bh.warn("color1 不合法"),
                    null;
                if (!(A.color2 instanceof Xh))
                    return Bh.warn("color2 不合法"),
                    null;
                var i = A.color1.toRGBArray()
                  , o = A.color2.toRGBArray()
                  , n = A.thresholdLow
                  , r = A.thresholdHigh
                  , a = 10 * A.size
                  , s = A.phase;
                1 === a && (a = 1.1);
                for (var l = new Array(e * t * 4), c = new Md(Math.ceil(e / a),Math.ceil(t / a),s), h = 0, d = 0, p = 0, g = 0, u = 0, f = 0, m = 0; t > m; m += 1)
                    for (var C = 0; e > C; C += 1) {
                        var y = (c.getValue(C / a, m / a) + 1) / 2;
                        if (y > r)
                            h = o[0],
                            d = o[1],
                            p = o[2];
                        else if (n > y)
                            h = i[0],
                            d = i[1],
                            p = i[2];
                        else if (y >= n && r >= y || n === r) {
                            var v = (y - n) / (r - n || 1);
                            g = o[0] * v,
                            u = o[1] * v,
                            f = o[2] * v,
                            h = i[0] * (v = 1 - v) + g,
                            d = i[1] * v + u,
                            p = i[2] * v + f
                        }
                        var I = 4 * (m * e + C);
                        l[I] = h,
                        l[I + 1] = d,
                        l[I + 2] = p,
                        l[I + 3] = 255
                    }
                var E = document.createElement("canvas");
                E.width = e,
                E.height = t;
                for (var B = E.getContext("2d"), x = B.createImageData(e, t), S = 0, w = e * t * 4; w > S; S += 1)
                    x.data[S] = l[S];
                return B.putImageData(x, 0, 0),
                E.toDataURL()
            }(e);
        case xd.FRACTAL:
            return function(A) {
                var e = 10 * A.width
                  , t = 10 * A.height;
                if (!(A.color1 instanceof Xh))
                    return Bh.warn("color1 不合法"),
                    null;
                if (!(A.color2 instanceof Xh))
                    return Bh.warn("color2 不合法"),
                    null;
                var i = A.color1.toRGBArray()
                  , o = A.color2.toRGBArray()
                  , n = A.thresholdLow
                  , r = A.thresholdHigh
                  , a = 10 * A.size
                  , s = A.phase
                  , l = A.level;
                1 === a && (a = 1.1);
                for (var c = new Array(e * t * 4), h = [], d = a, p = 0, g = l; g > p; p += 1) {
                    var u = new Md(Math.ceil(e / d),Math.ceil(t / d),s);
                    d /= 2,
                    h.push(u)
                }
                for (var f = 0, m = 0, C = 0, y = 0, v = 0, I = 0, E = 0; t > E; E += 1)
                    for (var B = 0; e > B; B += 1) {
                        for (var x = 0, S = a, w = 0, M = l; M > w; w += 1)
                            x += h[w].getValue(B / S, E / S, s) * (l - w),
                            S /= 2;
                        var b = ((x /= l) + 1) / 2;
                        if (b > r)
                            f = o[0],
                            m = o[1],
                            C = o[2];
                        else if (n > b)
                            f = i[0],
                            m = i[1],
                            C = i[2];
                        else if (b >= n && r >= b || n === r) {
                            var U = (b - n) / (r - n || 1);
                            y = o[0] * U,
                            v = o[1] * U,
                            I = o[2] * U,
                            f = i[0] * (U = 1 - U) + y,
                            m = i[1] * U + v,
                            C = i[2] * U + I
                        }
                        var F = 4 * (E * e + B);
                        c[F] = f,
                        c[F + 1] = m,
                        c[F + 2] = C,
                        c[F + 3] = 255
                    }
                var K = document.createElement("canvas");
                K.width = e,
                K.height = t;
                for (var Q = K.getContext("2d"), R = Q.createImageData(e, t), T = 0, k = e * t * 4; k > T; T += 1)
                    R.data[T] = c[T];
                return Q.putImageData(R, 0, 0),
                K.toDataURL()
            }(e);
        case xd.DISORDER:
            return function(A) {
                var e = 10 * A.width
                  , t = 10 * A.height;
                if (!(A.color1 instanceof Xh))
                    return Bh.warn("color1 不合法"),
                    null;
                if (!(A.color2 instanceof Xh))
                    return Bh.warn("color2 不合法"),
                    null;
                var i = A.color1.toRGBArray()
                  , o = A.color2.toRGBArray()
                  , n = A.thresholdLow
                  , r = A.thresholdHigh
                  , a = 10 * A.size
                  , s = A.phase
                  , l = A.level;
                1 === a && (a = 1.1);
                for (var c = new Array(e * t * 4), h = [], d = a, p = 0, g = l; g > p; p += 1) {
                    var u = new Md(Math.ceil(e / d),Math.ceil(t / d),s);
                    d /= 2,
                    h.push(u)
                }
                for (var f = 0, m = 0, C = 0, y = 0, v = 0, I = 0, E = 0; t > E; E += 1)
                    for (var B = 0; e > B; B += 1) {
                        for (var x = 0, S = a, w = 0, M = l; M > w; w += 1)
                            x += h[w].getValue(B / S, E / S, s) * (l - w),
                            S /= 2;
                        x /= l;
                        var b = Math.abs(x) + .05;
                        if (b > r)
                            f = o[0],
                            m = o[1],
                            C = o[2];
                        else if (n > b)
                            f = i[0],
                            m = i[1],
                            C = i[2];
                        else if (b >= n && r >= b || n === r) {
                            var U = (b - n) / (r - n || 1);
                            y = o[0] * U,
                            v = o[1] * U,
                            I = o[2] * U,
                            f = i[0] * (U = 1 - U) + y,
                            m = i[1] * U + v,
                            C = i[2] * U + I
                        }
                        var F = 4 * (E * e + B);
                        c[F] = f,
                        c[F + 1] = m,
                        c[F + 2] = C,
                        c[F + 3] = 255
                    }
                var K = document.createElement("canvas");
                K.width = e,
                K.height = t;
                for (var Q = K.getContext("2d"), R = Q.createImageData(e, t), T = 0, k = e * t * 4; k > T; T += 1)
                    R.data[T] = c[T];
                return Q.putImageData(R, 0, 0),
                K.toDataURL()
            }(e);
        default:
            return Bh.warn("不支持的噪波类型"),
            null
        }
    }, Kd = {
        DefaultMaterial: new Ir({
            color: 255,
            side: 2
        }),
        DefaultWireframeColor: {
            color: new LA(0,0,0),
            opacity: .4
        },
        getDefaultStandardMaterial: (bd = null,
        function() {
            return bd || (bd = new ld({
                color: 0,
                side: 2
            })),
            bd
        }
        ),
        createInstancePhongMaterial: function(A) {
            return A.clone()
        },
        updateBasicMaterial: function(A, e) {
            A.needsUpdate = !0
        },
        setMatrixUniform: function(A) {},
        createPhongMaterial: function(A) {
            var e = new Ir(A);
            return e.type = "FillFacePhong",
            e.uniforms = Ge.merge([it.fillFacePhong.uniforms]),
            e.vertexShader = it.fillFacePhong.vertexShader,
            e.fragmentShader = it.fillFacePhong.fragmentShader,
            e.side = 2,
            e
        },
        createStandardMaterial: function(A) {
            var e = new ld(A);
            return vc.EnableTransformAoMap && (e.defines.USE_TRANSFORM_AOMAP = ""),
            e
        },
        createInstanceMaterial: function(A, e) {
            var t = Kd.createStandardMaterial(A);
            return t.defines.USE_INSTANCE = "",
            e && (t.defines.USE_INSTANCE_NORMAL = ""),
            t.colorState = Yc.BLINK,
            vc.InfluencedByLight || (t.defines.NOTAFFECTEDBYLIGHT = ""),
            t.refreshUniforms(),
            t
        },
        createMaterialByMaterialBufferAndTexture: function(A, e) {
            var t, i, o, n, r, a, l, c, h = Kd.createStandardMaterial();
            if ((h.name = A.name || A.id,
            h.key = A.id,
            A.emissive && h.emissive && (1 === A.emissive[0] && 1 === A.emissive[1] && 1 === A.emissive[2] || h.emissive.setRGB(A.emissive[0], A.emissive[1], A.emissive[2])),
            A.specular && h.specular && h.specular.setRGB(A.specular[0], A.specular[1], A.specular[2]),
            A.color ? h.color.setRGB(A.color[0], A.color[1], A.color[2]) : A.emissive && h.emissive ? h.color.setRGB(0, 0, 0) : h.color.setRGB(.72, .72, .72),
            A.tint && (h.imageFade = void 0 === A.imageFade || 0 > A.imageFade || A.imageFade > 10 ? .5 : A.imageFade,
            h.color.setRGB(A.tint[0], A.tint[1], A.tint[2])),
            A.map && vc.EnableTextureLoading) && ("string" == typeof A.map ? void 0 !== A.mapOffsetY && 0 !== A.mapOffsetY || void 0 !== A.mapOffsetX && 0 !== A.mapOfsfetX || void 0 !== A.mapScaleX && 1 !== A.mapScaleX || void 0 !== A.mapScaleY && 1 !== A.mapScaleY || void 0 !== A.mapWAngle && 0 !== A.mapWAngle ? t = A.mapOffsetX + "_" + A.mapOffsetY + "_" + A.mapScaleX + "_" + A.mapScaleY + "_" + A.mapWAngle + "_" + A.map : e[A.map] ? h.map = e[A.map] : Bh.warn(h.name, " 中map贴图未找到：", A.map) : t = Bd(JSON.stringify(A.map)),
            t))
                if (e[t])
                    h.map = e[t];
                else {
                    var p = new d;
                    if (p.wrapS = p.wrapT = 1e3,
                    "string" == typeof A.map)
                        p.image = e[A.map] && e[A.map].image ? e[A.map].image : null;
                    else {
                        var g = A.map
                          , u = document.createElement("img")
                          , f = Fd({
                            type: Number(g.noise_Type),
                            color1: (new Xh).fromArray(g.noise_Color1),
                            color2: (new Xh).fromArray(g.noise_Color2),
                            size: g.noise_Size,
                            level: g.noise_Levels,
                            phase: g.noise_Phase,
                            width: 32,
                            height: 32,
                            thresholdLow: g.noise_ThresholdLow,
                            thresholdHigh: g.noise_ThresholdHigh
                        });
                        f && (u.src = f,
                        p.image = u)
                    }
                    p.needsUpdate = !0,
                    p.image && (p.offset.x = A.mapOffsetX ? A.mapOffsetX : 0,
                    p.offset.y = A.mapOffsetY ? A.mapOffsetY : 0,
                    p.repeat.x = A.mapScaleX ? A.mapScaleX : 1,
                    p.repeat.y = A.mapScaleY ? A.mapScaleY : 1,
                    p.rotation = A.mapWAngle ? A.mapWAngle : 0,
                    e[t] = p,
                    h.map = p)
                }
            if (A.bumpMap && vc.EnableTextureLoading && ("string" == typeof A.bumpMap ? void 0 !== A.bumpMapOffsetY && 0 !== A.bumpMapOffsetY || void 0 !== A.bumpMapOffsetX && 0 !== A.bumpMapOfsfetX || void 0 !== A.bumpMapScaleX && 1 !== A.bumpMapScaleX || void 0 !== A.bumpMapScaleY && 1 !== A.bumpMapScaleY || void 0 !== A.bumpMapWAngle && 0 !== A.bumpMapWAngle ? i = A.bumpMapOffsetX + "_" + A.bumpMapOffsetY + "_" + A.bumpMapScaleX + "_" + A.bumpMapScaleY + "_" + A.bumpMapWAngle + "_" + A.bumpMap : e[A.bumpMap] ? h.bumpMap = e[A.bumpMap] : Bh.warn(h.name, " 中bumpMap贴图未找到：", A.bumpMap) : i = Bd(JSON.stringify(A.bumpMap)),
            i))
                if (e[i])
                    h.bumpMap = e[i];
                else {
                    var m = new d;
                    if (m.wrapS = m.wrapT = 1e3,
                    "string" == typeof A.bumpMap)
                        m.image = e[A.bumpMap] && e[A.bumpMap].image ? e[A.bumpMap].image : null;
                    else {
                        var C = A.bumpMap
                          , y = document.createElement("img")
                          , v = Fd({
                            type: Number(C.noise_Type),
                            color1: (new Xh).fromArray(C.noise_Color1),
                            color2: (new Xh).fromArray(C.noise_Color2),
                            size: C.noise_Size,
                            level: C.noise_Levels,
                            phase: C.noise_Phase,
                            width: 32,
                            height: 32,
                            thresholdLow: C.noise_ThresholdLow,
                            thresholdHigh: C.noise_ThresholdHigh
                        });
                        v && (y.src = v,
                        m.image = y)
                    }
                    m.needsUpdate = !0,
                    m.image && (m.offset.x = A.bumpMapOffsetX ? A.bumpMapOffsetX : 0,
                    m.offset.y = A.bumpMapOffsetY ? A.bumpMapOffsetY : 0,
                    m.repeat.x = A.bumpMapScaleX ? A.bumpMapScaleX : 1,
                    m.repeat.y = A.bumpMapScaleY ? A.bumpMapScaleY : 1,
                    m.rotation = A.bumpMapWAngle ? A.bumpMapWAngle : 0,
                    e[i] = m,
                    h.bumpMap = m)
                }
            if ((void 0 !== A.bumpScale && (h.bumpScale = A.bumpScale),
            A.aoMap && vc.EnableTextureLoading) && ("string" == typeof A.aoMap ? void 0 !== A.aoMapOffsetY && 0 !== A.aoMapOffsetY || void 0 !== A.aoMapOffsetX && 0 !== A.aoMapOfsfetX || void 0 !== A.aoMapScaleX && 1 !== A.aoMapScaleX || void 0 !== A.aoMapScaleY && 1 !== A.aoMapScaleY || void 0 !== A.aoMapWAngle && 0 !== A.aoMapWAngle ? o = A.aoMapOffsetX + "_" + A.aoMapOffsetY + "_" + A.aoMapScaleX + "_" + A.aoMapScaleY + "_" + A.aoMapWAngle + "_" + A.aoMap : e[A.aoMap] ? h.aoMap = e[A.aoMap] : Bh.warn(h.name, " 中aoMap贴图未找到：", A.aoMap) : o = Bd(JSON.stringify(A.aoMap)),
            o))
                if (e[o])
                    h.aoMap = e[o];
                else {
                    var I = new d;
                    if (I.wrapS = I.wrapT = 1e3,
                    "string" == typeof A.aoMap)
                        I.image = e[A.aoMap] && e[A.aoMap].image ? e[A.aoMap].image : null;
                    else {
                        var E = A.aoMap
                          , B = document.createElement("img")
                          , x = Fd({
                            type: Number(E.noise_Type),
                            color1: (new Xh).fromArray(E.noise_Color1),
                            color2: (new Xh).fromArray(E.noise_Color2),
                            size: E.noise_Size,
                            level: E.noise_Levels,
                            phase: E.noise_Phase,
                            width: 32,
                            height: 32,
                            thresholdLow: E.noise_ThresholdLow,
                            thresholdHigh: E.noise_ThresholdHigh
                        });
                        x && (B.src = x,
                        I.image = B)
                    }
                    I.needsUpdate = !0,
                    I.image && (I.offset.x = A.aoMapOffsetX ? A.aoMapOffsetX : 0,
                    I.offset.y = A.aoMapOffsetY ? A.aoMapOffsetY : 0,
                    I.repeat.x = A.aoMapScaleX ? A.aoMapScaleX : 1,
                    I.repeat.y = A.aoMapScaleY ? A.aoMapScaleY : 1,
                    I.rotation = A.aoMapWAngle ? A.aoMapWAngle : 0,
                    e[o] = I,
                    h.aoMap = I)
                }
            if ((void 0 !== A.aoMapIntensity && (h.aoMapIntensity = A.aoMapIntensity),
            A.normalMap && vc.EnableTextureLoading) && ("string" == typeof A.normalMap ? void 0 !== A.normalMapOffsetY && 0 !== A.normalMapOffsetY || void 0 !== A.normalMapOffsetX && 0 !== A.normalMapOfsfetX || void 0 !== A.normalMapScaleX && 1 !== A.normalMapScaleX || void 0 !== A.normalMapScaleY && 1 !== A.normalMapScaleY || void 0 !== A.normalMapWAngle && 0 !== A.normalMapWAngle ? n = A.normalMapOffsetX + "_" + A.normalMapOffsetY + "_" + A.normalMapScaleX + "_" + A.normalMapScaleY + "_" + A.normalMapWAngle + "_" + A.normalMap : e[A.normalMap] ? h.normalMap = e[A.normalMap] : Bh.warn(h.name, " 中normalMap贴图未找到：", A.normalMap) : n = Bd(JSON.stringify(A.normalMap)),
            n))
                if (e[n])
                    h.normalMap = e[n];
                else {
                    var S = new d;
                    if (S.wrapS = S.wrapT = 1e3,
                    "string" == typeof A.normalMap)
                        S.image = e[A.normalMap] && e[A.normalMap].image ? e[A.normalMap].image : null;
                    else {
                        var w = A.normalMap
                          , M = document.createElement("img")
                          , b = Fd({
                            type: Number(w.noise_Type),
                            color1: (new Xh).fromArray(w.noise_Color1),
                            color2: (new Xh).fromArray(w.noise_Color2),
                            size: w.noise_Size,
                            level: w.noise_Levels,
                            phase: w.noise_Phase,
                            width: 32,
                            height: 32,
                            thresholdLow: w.noise_ThresholdLow,
                            thresholdHigh: w.noise_ThresholdHigh
                        });
                        b && (M.src = b,
                        S.image = M)
                    }
                    S.needsUpdate = !0,
                    S.image && (S.offset.x = A.normalMapOffsetX ? A.normalMapOffsetX : 0,
                    S.offset.y = A.normalMapOffsetY ? A.normalMapOffsetY : 0,
                    S.repeat.x = A.normalMapScaleX ? A.normalMapScaleX : 1,
                    S.repeat.y = A.normalMapScaleY ? A.normalMapScaleY : 1,
                    S.rotation = A.normalMapWAngle ? A.normalMapWAngle : 0,
                    e[n] = S,
                    h.normalMap = S)
                }
            if (void 0 !== A.normalScale && (h.normalScale = (new s).fromArray(A.normalScale)),
            A.alphaMap && vc.EnableTextureLoading) {
                var U;
                if ("string" == typeof A.alphaMap ? void 0 !== A.alphaMapOffsetY && 0 !== A.alphaMapOffsetY || void 0 !== A.alphaMapOffsetX && 0 !== A.alphaMapOfsfetX || void 0 !== A.alphaMapScaleX && 1 !== A.alphaMapScaleX || void 0 !== A.alphaMapScaleY && 1 !== A.alphaMapScaleY || void 0 !== A.alphaMapWAngle && 0 !== A.alphaMapWAngle ? U = A.alphaMapOffsetX + "_" + A.alphaMapOffsetY + "_" + A.alphaMapScaleX + "_" + A.alphaMapScaleY + "_" + A.alphaMapWAngle + "_" + A.alphaMap : e[A.alphaMap] ? h.alphaMap = e[A.alphaMap] : Bh.warn(h.name, " 中alphaMap贴图未找到：", A.alphaMap) : U = Bd(JSON.stringify(A.alphaMap)),
                U)
                    if (e[U])
                        h.alphaMap = e[U];
                    else {
                        var F = new d;
                        if (F.wrapS = F.wrapT = 1e3,
                        "string" == typeof A.alphaMap)
                            F.image = e[A.alphaMap] && e[A.alphaMap].image ? e[A.alphaMap].image : null;
                        else {
                            var K = A.alphaMap
                              , Q = document.createElement("img")
                              , R = Fd({
                                type: Number(K.noise_Type),
                                color1: (new Xh).fromArray(K.noise_Color1),
                                color2: (new Xh).fromArray(K.noise_Color2),
                                size: K.noise_Size,
                                level: K.noise_Levels,
                                phase: K.noise_Phase,
                                width: 32,
                                height: 32,
                                thresholdLow: K.noise_ThresholdLow,
                                thresholdHigh: K.noise_ThresholdHigh
                            });
                            R && (Q.src = R,
                            F.image = Q)
                        }
                        F.needsUpdate = !0,
                        F.image && (F.offset.x = A.alphaMapOffsetX ? A.alphaMapOffsetX : 0,
                        F.offset.y = A.alphaMapOffsetY ? A.alphaMapOffsetY : 0,
                        F.repeat.x = A.alphaMapScaleX ? A.alphaMapScaleX : 1,
                        F.repeat.y = A.alphaMapScaleY ? A.alphaMapScaleY : 1,
                        F.rotation = A.alphaMapWAngle ? A.alphaMapWAngle : 0,
                        e[U] = F,
                        h.alphaMap = F)
                    }
                h.transparent = !0,
                h.alphaTest = Number.isNaN(vc.alphaTest) ? .5 : vc.alphaTest
            }
            if (A.envMap && vc.EnableTextureLoading && ("string" == typeof A.envMap ? void 0 !== A.envMapOffsetY && 0 !== A.envMapOffsetY || void 0 !== A.envMapOffsetX && 0 !== A.envMapOfsfetX || void 0 !== A.envMapScaleX && 1 !== A.envMapScaleX || void 0 !== A.envMapScaleY && 1 !== A.envMapScaleY || void 0 !== A.envMapWAngle && 0 !== A.envMapWAngle ? r = A.envMapOffsetX + "_" + A.envMapOffsetY + "_" + A.envMapScaleX + "_" + A.envMapScaleY + "_" + A.envMapWAngle + "_" + A.envMap : e[A.envMap] ? h.envMap = e[A.envMap] : Bh.warn(h.name, " 中envMap贴图未找到：", A.envMap) : r = Bd(JSON.stringify(A.envMap)),
            r))
                if (e[r])
                    h.envMap = e[r];
                else {
                    var T = new d;
                    if (T.wrapS = T.wrapT = 1e3,
                    "string" == typeof A.envMap)
                        T.image = e[A.envMap] && e[A.envMap].image ? e[A.envMap].image : null;
                    else {
                        var k = A.envMap
                          , D = document.createElement("img")
                          , L = Fd({
                            type: Number(k.noise_Type),
                            color1: (new Xh).fromArray(k.noise_Color1),
                            color2: (new Xh).fromArray(k.noise_Color2),
                            size: k.noise_Size,
                            level: k.noise_Levels,
                            phase: k.noise_Phase,
                            width: 32,
                            height: 32,
                            thresholdLow: k.noise_ThresholdLow,
                            thresholdHigh: k.noise_ThresholdHigh
                        });
                        L && (D.src = L,
                        T.image = D)
                    }
                    T.needsUpdate = !0,
                    T.image && (T.offset.x = A.envMapOffsetX ? A.envMapOffsetX : 0,
                    T.offset.y = A.envMapOffsetY ? A.envMapOffsetY : 0,
                    T.repeat.x = A.envMapScaleX ? A.envMapScaleX : 1,
                    T.repeat.y = A.envMapScaleY ? A.envMapScaleY : 1,
                    T.rotation = A.envMapWAngle ? A.envMapWAngle : 0,
                    e[r] = T,
                    h.envMap = T)
                }
            if (A.lightMap && vc.EnableTextureLoading && ("string" == typeof A.lightMap ? void 0 !== A.lightMapOffsetY && 0 !== A.lightMapOffsetY || void 0 !== A.lightMapOffsetX && 0 !== A.lightMapOfsfetX || void 0 !== A.lightMapScaleX && 1 !== A.lightMapScaleX || void 0 !== A.lightMapScaleY && 1 !== A.lightMapScaleY || void 0 !== A.lightMapWAngle && 0 !== A.lightMapWAngle ? a = A.lightMapOffsetX + "_" + A.lightMapOffsetY + "_" + A.lightMapScaleX + "_" + A.lightMapScaleY + "_" + A.lightMapWAngle + "_" + A.lightMap : e[A.lightMap] ? h.lightMap = e[A.lightMap] : Bh.warn(h.name, " 中lightMap贴图未找到：", A.lightMap) : a = Bd(JSON.stringify(A.lightMap)),
            a))
                if (e[a])
                    h.lightMap = e[a];
                else {
                    var N = new d;
                    if (N.wrapS = N.wrapT = 1e3,
                    "string" == typeof A.lightMap)
                        N.image = e[A.lightMap] && e[A.lightMap].image ? e[A.lightMap].image : null;
                    else {
                        var O = A.lightMap
                          , V = document.createElement("img")
                          , G = Fd({
                            type: Number(O.noise_Type),
                            color1: (new Xh).fromArray(O.noise_Color1),
                            color2: (new Xh).fromArray(O.noise_Color2),
                            size: O.noise_Size,
                            level: O.noise_Levels,
                            phase: O.noise_Phase,
                            width: 32,
                            height: 32,
                            thresholdLow: O.noise_ThresholdLow,
                            thresholdHigh: O.noise_ThresholdHigh
                        });
                        G && (V.src = G,
                        N.image = V)
                    }
                    N.needsUpdate = !0,
                    N.image && (N.offset.x = A.lightMapOffsetX ? A.lightMapOffsetX : 0,
                    N.offset.y = A.lightMapOffsetY ? A.lightMapOffsetY : 0,
                    N.repeat.x = A.lightMapScaleX ? A.lightMapScaleX : 1,
                    N.repeat.y = A.lightMapScaleY ? A.lightMapScaleY : 1,
                    N.rotation = A.lightMapWAngle ? A.lightMapWAngle : 0,
                    e[a] = N,
                    h.lightMap = N)
                }
            if ((void 0 !== A.lightMapIntensity && (h.lightMapIntensity = A.lightMapIntensity),
            A.emissiveMap && vc.EnableTextureLoading) && ("string" == typeof A.emissiveMap ? void 0 !== A.emissiveMapOffsetY && 0 !== A.emissiveMapOffsetY || void 0 !== A.emissiveMapOffsetX && 0 !== A.emissiveMapOfsfetX || void 0 !== A.emissiveMapScaleX && 1 !== A.emissiveMapScaleX || void 0 !== A.emissiveMapScaleY && 1 !== A.emissiveMapScaleY || void 0 !== A.emissiveMapWAngle && 0 !== A.emissiveMapWAngle ? l = A.emissiveMapOffsetX + "_" + A.emissiveMapOffsetY + "_" + A.emissiveMapScaleX + "_" + A.emissiveMapScaleY + "_" + A.emissiveMapWAngle + "_" + A.emissiveMap : e[A.emissiveMap] ? h.emissiveMap = e[A.emissiveMap] : Bh.warn(h.name, " 中emissiveMap贴图未找到：", A.emissiveMap) : l = Bd(JSON.stringify(A.emissiveMap)),
            l))
                if (e[l])
                    h.emissiveMap = e[l];
                else {
                    var P = new d;
                    if (P.wrapS = P.wrapT = 1e3,
                    "string" == typeof A.emissiveMap)
                        P.image = e[A.emissiveMap] && e[A.emissiveMap].image ? e[A.emissiveMap].image : null;
                    else {
                        var q = A.emissiveMap
                          , j = document.createElement("img")
                          , H = Fd({
                            type: Number(q.noise_Type),
                            color1: (new Xh).fromArray(q.noise_Color1),
                            color2: (new Xh).fromArray(q.noise_Color2),
                            size: q.noise_Size,
                            level: q.noise_Levels,
                            phase: q.noise_Phase,
                            width: 32,
                            height: 32,
                            thresholdLow: q.noise_ThresholdLow,
                            thresholdHigh: q.noise_ThresholdHigh
                        });
                        H && (j.src = H,
                        P.image = j)
                    }
                    P.needsUpdate = !0,
                    P.image && (P.offset.x = A.emissiveMapOffsetX ? A.emissiveMapOffsetX : 0,
                    P.offset.y = A.emissiveMapOffsetY ? A.emissiveMapOffsetY : 0,
                    P.repeat.x = A.emissiveMapScaleX ? A.emissiveMapScaleX : 1,
                    P.repeat.y = A.emissiveMapScaleY ? A.emissiveMapScaleY : 1,
                    P.rotation = A.emissiveMapWAngle ? A.emissiveMapWAngle : 0,
                    e[l] = P,
                    h.emissiveMap = P)
                }
            if ((void 0 !== A.emissiveIntensity && (h.emissiveIntensity = A.emissiveIntensity),
            A.specularMap && vc.EnableTextureLoading) && ("string" == typeof A.specularMap ? void 0 !== A.specularMapOffsetY && 0 !== A.specularMapOffsetY || void 0 !== A.specularMapOffsetX && 0 !== A.specularMapOfsfetX || void 0 !== A.specularMapScaleX && 1 !== A.specularMapScaleX || void 0 !== A.specularMapScaleY && 1 !== A.specularMapScaleY || void 0 !== A.specularMapWAngle && 0 !== A.specularMapWAngle ? c = A.specularMapOffsetX + "_" + A.specularMapOffsetY + "_" + A.specularMapScaleX + "_" + A.specularMapScaleY + "_" + A.specularMapWAngle + "_" + A.specularMap : e[A.specularMap] ? h.specularMap = e[A.specularMap] : Bh.warn(h.name, " 中specularMap贴图未找到：", A.specularMap) : c = Bd(JSON.stringify(A.specularMap)),
            c))
                if (e[c])
                    h.specularMap = e[c];
                else {
                    var Y = new d;
                    if (Y.wrapS = Y.wrapT = 1e3,
                    "string" == typeof A.specularMap)
                        Y.image = e[A.specularMap] && e[A.specularMap].image ? e[A.specularMap].image : null;
                    else {
                        var W = A.specularMap
                          , J = document.createElement("img")
                          , z = Fd({
                            type: Number(W.noise_Type),
                            color1: (new Xh).fromArray(W.noise_Color1),
                            color2: (new Xh).fromArray(W.noise_Color2),
                            size: W.noise_Size,
                            level: W.noise_Levels,
                            phase: W.noise_Phase,
                            width: 32,
                            height: 32,
                            thresholdLow: W.noise_ThresholdLow,
                            thresholdHigh: W.noise_ThresholdHigh
                        });
                        z && (J.src = z,
                        Y.image = J)
                    }
                    Y.needsUpdate = !0,
                    Y.image && (Y.offset.x = A.specularMapOffsetX ? A.specularMapOffsetX : 0,
                    Y.offset.y = A.specularMapOffsetY ? A.specularMapOffsetY : 0,
                    Y.repeat.x = A.specularMapScaleX ? A.specularMapScaleX : 1,
                    Y.repeat.y = A.specularMapScaleY ? A.specularMapScaleY : 1,
                    Y.rotation = A.specularMapWAngle ? A.specularMapWAngle : 0,
                    e[c] = Y,
                    h.specularMap = Y)
                }
            return void 0 !== A.shininess && (h.shininess = A.shininess),
            void 0 !== A.opacity && (h.opacity = A.opacity,
            1 > A.opacity && (h.transparent = !0),
            A.opacity > 0 || (h.opacity = .1)),
            h.side = 2,
            h.refreshUniforms && h.refreshUniforms(),
            h
        },
        createNewStyleMaterial: function(A) {
            var e = new yr(A);
            return e.type = "NewStyle",
            e.uniforms = Ge.merge([it.standard.uniforms]),
            e.vertexShader = it.newStyle.vertexShader,
            e.fragmentShader = it.newStyle.fragmentShader,
            e.metalness = 0,
            e
        },
        createHighlightMaterial: function() {
            var A = this.createStandardMaterial(vc.SelectionColor);
            return vc.InfluencedByLight || (A.defines.NOTAFFECTEDBYLIGHT = ""),
            A
        },
        getBlinkMaterial: function(A, e) {
            var t = Kd.getMaterialParameters(A)
              , i = Kd.createStandardMaterial(t);
            return i.blinkColor.copy(e),
            i.colorState = Yc.BLINK,
            i.refreshUniforms(),
            i
        },
        getMaterialParameters: function(A) {
            var e = {};
            return A.hasOwnProperty("color") && (e.color = A.color),
            e.opacity = 1,
            e.transparent = !1,
            A.hasOwnProperty("opacity") && (e.opacity = A.opacity,
            1 > A.opacity && (e.transparent = !0)),
            A.hasOwnProperty("side") && (e.side = A.side),
            A.hasOwnProperty("name") && (e.name = A.name || ""),
            A.hasOwnProperty("emissive") && (e.emissive = A.emissive),
            A.hasOwnProperty("emissiveIntensity") && (e.emissive = A.emissiveIntensity),
            A.hasOwnProperty("specular") && (e.specular = A.specular),
            A.hasOwnProperty("shininess") && (e.shininess = A.shininess),
            A.hasOwnProperty("map") && (e.map = A.map),
            A.hasOwnProperty("aoMap") && (e.aoMap = A.aoMap),
            A.hasOwnProperty("aoMapIntensity") && (e.aoMapIntensity = A.aoMapIntensity),
            A.hasOwnProperty("bumpMap") && (e.bumpMap = A.bumpMap),
            A.hasOwnProperty("bumpScale") && (e.bumpScale = A.bumpScale),
            A.hasOwnProperty("normalMap") && (e.normalMap = A.normalMap),
            A.hasOwnProperty("normalScale") && (e.normalScale = A.normalScale),
            A.hasOwnProperty("alphaMap") && (e.alphaMap = A.alphaMap),
            A.hasOwnProperty("alphaTest") && (e.alphaTest = A.alphaTest),
            A.hasOwnProperty("transparent") && (e.transparent = A.transparent),
            A.hasOwnProperty("emissiveMap") && (e.emissiveMap = A.emissiveMap),
            A.hasOwnProperty("envMap") && (e.envMap = A.envMap),
            A.hasOwnProperty("envMapIntensity") && (e.envMapIntensity = A.envMapIntensity),
            A.hasOwnProperty("roughness") && (e.roughness = A.roughness),
            A.hasOwnProperty("metalness") && (e.metalness = A.metalness),
            A.hasOwnProperty("originRoughness") && (e.originRoughness = A.originRoughness),
            A.hasOwnProperty("originMetalness") && (e.originMetalness = A.originMetalness),
            A.hasOwnProperty("iblProbe") && (e.iblProbe = A.iblProbe),
            A.hasOwnProperty("shift") && (e.shift = A.shift),
            A.hasOwnProperty("wireframe") && (e.wireframe = A.wireframe),
            A.hasOwnProperty("pureColor") && (e.pureColor = A.pureColor),
            A.hasOwnProperty("textureColor") && (e.textureColor = A.textureColor),
            A.hasOwnProperty("imageFade") && (e.imageFade = A.imageFade),
            "bos3d" === A.type && A.hasOwnProperty("lights") && (e.lights = A.lights),
            A.hasOwnProperty("lightMap") && (e.lightMap = A.lightMap),
            A.hasOwnProperty("lightMapIntensity") && (e.lightMapIntensity = A.lightMapIntensity),
            A.hasOwnProperty("viewportSize") && (e.viewportSize = A.viewportSize),
            A.hasOwnProperty("fillMap") && (e.fillMap = A.fillMap),
            e
        },
        nextHighestPowerOfTwo: function(A) {
            A -= 1;
            for (var e = 1; 32 > e; e <<= 1)
                A |= A >> e;
            return A + 1
        },
        ensurePowerOfTwo: function(A) {
            if (0 === A.width || 0 === A.height)
                return A;
            if (!a.isPowerOfTwo(A.width) || !a.isPowerOfTwo(A.height)) {
                var e = document.createElement("canvas");
                return e.width = Kd.nextHighestPowerOfTwo(A.width),
                e.height = Kd.nextHighestPowerOfTwo(A.height),
                e.getContext("2d").drawImage(A, 0, 0, A.width, A.height, 0, 0, e.width, e.height),
                e
            }
            return A
        },
        ensureQuadrate: function(A) {
            var e = A.width
              , t = A.height;
            if (0 === e || 0 === t || a.isPowerOfTwo(e) && a.isPowerOfTwo(t) && e === t)
                return A;
            a.isPowerOfTwo(e) || (e = Kd.nextHighestPowerOfTwo(e)),
            a.isPowerOfTwo(t) || (t = Kd.nextHighestPowerOfTwo(t));
            var i = 0
              , o = 0;
            t > e ? i = .5 * (t - e) : o = .5 * (e - t);
            var n = document.createElement("canvas");
            return n.width = n.height = Math.max(e, t),
            n.getContext("2d").drawImage(A, 0, 0, A.width, A.height, i, o, e, t),
            n
        },
        getRGBAFromColorArray: function(A) {
            var e = A[0]
              , t = A[1]
              , i = A[2]
              , o = A[3];
            return void 0 !== o ? "rgba(" + e + "," + t + "," + i + "," + o + ")" : "rgb(" + e + "," + t + "," + i + ")"
        },
        getRGBAFromArray: function(A) {
            var e = 255 * A[0]
              , t = 255 * A[1]
              , i = 255 * A[2]
              , o = 255 * A[3];
            return void 0 !== o ? "rgba(" + e + "," + t + "," + i + "," + o + ")" : "rgb(" + e + "," + t + "," + i + ")"
        },
        getArrayFromRGBA: function(A) {
            var e = A.split(",")
              , t = parseInt(e[0].split("(")[1], 0) / 255
              , i = parseInt(e[1], 0) / 255
              , o = parseInt(e[2].split(")")[0], 0) / 255;
            return void 0 !== e[3] ? [t, i, o, parseFloat(e[3].split(")")[0])] : [t, i, o]
        },
        getColorArrayFromRGBA: function(A) {
            var e = A.split(",")
              , t = parseInt(e[0].split("(")[1], 0)
              , i = parseInt(e[1], 0)
              , o = parseInt(e[2].split(")")[0], 0);
            return void 0 !== e[3] ? [t, i, o, parseFloat(e[3].split(")")[0])] : [t, i, o]
        },
        getHexStringFromRGB: function(A) {
            return "#" + ("000000" + Kd.getHex(Kd.getArrayFromRGBA(A)).toString(16)).slice(-6)
        },
        getArrayFromColorArray: function(A) {
            return [A[0] / 255, A[1] / 255, A[2] / 255]
        },
        getHexStringFromColorArray: function(A) {
            return "#" + ("000000" + Kd.getHex(Kd.getArrayFromColorArray(A)).toString(16)).slice(-6)
        },
        getHexStringFromArray: function(A) {
            return "#" + ("000000" + Kd.getHex(A).toString(16)).slice(-6)
        },
        getHex: function(A) {
            return 255 * A[0] << 16 ^ 255 * A[1] << 8 ^ 255 * A[2] << 0
        },
        getColorParamsByMaterial: function(A) {
            return {
                rgbaColor: [A.color.r, A.color.g, A.color.b, A.opacity],
                transparent: A.transparent,
                wireframe: A.wireframe
            }
        },
        getHoverColorByColor: function(A) {
            var e = {};
            return e.r = A.r,
            e.g = A.g,
            e.b = A.b,
            e.a = Kd.getHoverOpacity(A.a),
            e
        },
        getHoverOpacity: function(A) {
            return .4 > A ? A + .3 : A - .3
        },
        cloneMaterialBaseOnColor: function(A, e) {
            if (!A.color && !A.diffuse)
                return A;
            var t = A.clone();
            return t.wireframe = e.wireframe,
            t.opacity = e.opacity,
            t.transparent = e.transparent,
            t.color && t.color.isColor && e.color && e.color.isColor && t.color.copy(e.color),
            t.diffuse && t.diffuse.isColor && e.diffuse && e.diffuse.isColor && t.diffuse.copy(e.diffuse),
            t
        }
    }, Qd = function(A, e, t, i, o, n, r, a) {
        this.name = A,
        this.position = e,
        this.target = t,
        this.up = i,
        this.fov = o,
        this.frustumWidth = r,
        this.frustumHeight = a,
        this.version = n
    }, Rd = {
        createCameraInfo: function(A) {
            var e = A.camera
              , t = new Qd(A.getCameraName(),e.position,e.target,e.up);
            return JSON.stringify(t)
        },
        transformCamera: function(A, e) {
            var t = new y
              , i = function(A) {
                return [parseFloat(A[0]), parseFloat(A[1]), parseFloat(A[2])]
            };
            t.fromArray(i(A.position.split(",")));
            var o = new y;
            o.fromArray(i(A.direction.split(",")));
            var n = new y;
            n.fromArray(i(A.up.split(",")));
            var r = new y;
            r.addVectors(t, o),
            t.applyMatrix4(e.rootNode.matrix),
            r.applyMatrix4(e.rootNode.matrix);
            var a = new M;
            return a.makeRotationFromEuler(e.rootNode.rotation),
            n.applyMatrix4(a),
            n.normalize(),
            new Qd(A.name,t,r,n)
        },
        parseCameraInfo: function(A) {
            if (!A)
                return null;
            var e = JSON.parse(A);
            if (!e.hasOwnProperty("position") || !e.hasOwnProperty("target") || !e.hasOwnProperty("up"))
                return null;
            var t = e.name || Ec.PERSPECTIVE
              , i = new y;
            i.x = e.position.x,
            i.y = e.position.y,
            i.z = e.position.z;
            var o = new y;
            o.x = e.target.x,
            o.y = e.target.y,
            o.z = e.target.z;
            var n = new y;
            return n.x = e.up.x,
            n.y = e.up.y,
            n.z = e.up.z,
            new Qd(t,i,o,n,void 0,void 0 === e.version ? 0 : e.version,e.frustumWidth,e.frustumHeight)
        },
        canvasToNormalized: function(A, e, t) {
            var i = {
                x: 0,
                y: 0,
                z: 0
            };
            return i.x = A.x / e * 2 - 1,
            i.y = -A.y / t * 2 + 1,
            i.z = A.z || 0,
            i
        },
        normalizedToCanvas: function(A, e, t) {
            var i = {
                x: 0,
                y: 0,
                z: 0
            };
            return i.x = Math.floor(.5 * (A.x + 1) * e + .5),
            i.y = Math.floor(-.5 * (A.y - 1) * t + .5),
            i.z = A.z || 0,
            i
        },
        drawingToCanvas: function(A, e, t, i) {
            var o = new y(e.x,e.y,e.z);
            return o.project(A),
            this.normalizedToCanvas(o, t, i)
        },
        drawingPointsToCanvas: function(A, e, t, i, o) {
            var n = {}
              , r = (new M).getInverse(A.matrixWorld)
              , a = new y(e.x,e.y,e.z);
            a.applyMatrix4(r);
            var s = new y(t.x,t.y,t.z);
            if (s.applyMatrix4(r),
            a.z > 0 && s.z > 0)
                return null;
            var l = a.clone().sub(s);
            if (l.normalize(),
            a.z > 0)
                a.sub(l.multiplyScalar((a.z + A.near) / l.z));
            else if (s.z > 0) {
                s.sub(l.multiplyScalar((s.z + A.near) / l.z))
            }
            return a.applyMatrix4(A.projectionMatrix),
            s.applyMatrix4(A.projectionMatrix),
            n.start = this.normalizedToCanvas(a, i, o),
            n.end = this.normalizedToCanvas(s, i, o),
            n
        },
        lineIntersectWithRect: function(A, e) {
            if (A && A.start.x === A.end.x && A.start.y === A.end.y)
                return Bh.log("Invalid line."),
                null;
            var t, i = 0;
            A.start.x !== A.end.x && (i = (A.start.y - A.end.y) / (A.start.x - A.end.x));
            var o = []
              , n = e.min
              , r = e.max;
            return n.y > i * n.x + (t = A.start.y - i * A.start.x) || i * n.x + t > r.y || o.push(new s(n.x,i * n.x + t)),
            n.y > i * r.x + t || i * r.x + t > r.y || o.push(new s(r.x,i * r.x + t)),
            0 === i && (o.push(new s(n.x,t)),
            o.push(new s(r.x,t))),
            (n.y - t) / i > n.x && r.x > (n.y - t) / i && o.push(new s((n.y - t) / i,n.y)),
            (r.y - t) / i > n.x && r.x > (r.y - t) / i && o.push(new s((r.y - t) / i,r.y)),
            o
        },
        canvasToDrawing: function(A, e, t, i) {
            var o = this.canvasToNormalized(e, t, i)
              , n = new y(o.x,o.y,o.z);
            return n.unproject(A),
            {
                x: n.x,
                y: n.y,
                z: n.z
            }
        },
        intersectBoxByRay: function(A, e) {
            var t = 0
              , i = 0
              , o = 0
              , n = 0
              , r = 0
              , a = 0
              , s = 1 / A.direction.x
              , l = 1 / A.direction.y
              , c = 1 / A.direction.z
              , h = A.origin;
            return 0 > s ? (t = (e.max.x - h.x) * s,
            i = (e.min.x - h.x) * s) : (t = (e.min.x - h.x) * s,
            i = (e.max.x - h.x) * s),
            0 > l ? (o = (e.max.y - h.y) * l,
            n = (e.min.y - h.y) * l) : (o = (e.min.y - h.y) * l,
            n = (e.max.y - h.y) * l),
            t > n || o > i ? null : ((o > t || isNaN(t)) && (t = o),
            (i > n || isNaN(i)) && (i = n),
            0 > c ? (r = (e.max.z - h.z) * c,
            a = (e.min.z - h.z) * c) : (r = (e.min.z - h.z) * c,
            a = (e.max.z - h.z) * c),
            t > a || r > i ? null : ((r > t || isNaN(t)) && (t = r),
            (i > a || isNaN(i)) && (i = a),
            0 > i ? null : 0 > t ? i : t))
        },
        intersectObject: function(A, e, t, i) {
            if (A.visible) {
                A.raycast(e, t);
                if (!0 === i && A.children)
                    for (var o = A.children, n = 0, r = o.length; r > n; n += 1)
                        Rd.intersectObject(o[n], e, t, !0)
            }
        },
        intersectObjectWithFrustum: (Ud = new aA,
        function(A, e) {
            if (!A.boundingBox || A instanceof Ue) {
                var t = A.geometry;
                null === t.boundingBox && t.computeBoundingBox(),
                Ud.copy(t.boundingBox)
            } else
                Ud.copy(A.boundingBox);
            return Ud.applyMatrix4(A.matrixWorld),
            e.intersectsBox(Ud)
        }
        )
    }, Td = function(A, e, t, i) {
        je.call(this, A, e, t, i),
        this.projectOnWidth = !1
    };
    (Td.prototype = Object.create(je.prototype)).constructor = Td,
    Td.prototype.updateProjectionMatrixByFrustum = function(A, e) {
        var t = this.near
          , i = null
          , o = null
          , n = null
          , r = null;
        this.projectOnWidth ? (o = -.5 * (n = A),
        i = .5 * (r = this.aspect * n)) : (i = .5 * (r = e),
        o = -.5 * (n = this.aspect * r));
        var a = this.view;
        if (null !== a) {
            var s = a.fullWidth
              , l = a.fullHeight;
            o += a.offsetX * n / s,
            i -= a.offsetY * r / l,
            n *= a.width / s,
            r *= a.height / l
        }
        var c = this.filmOffset;
        0 !== c && (o += t * c / this.getFilmWidth()),
        this.projectionMatrix.makePerspective(o, o + n, i, i - r, t, this.far)
    }
    ,
    Td.prototype.setProjectOnWidth = function(A) {
        this.projectOnWidth = A
    }
    ;
    var kd = function(A, e) {
        qe.call(this),
        this.target = new y,
        this.name = A || "",
        this.fov = e.fov,
        this.near = e.near,
        this.far = e.far,
        A === Ec.PERSPECTIVE ? (this.aspect = e.width / e.height,
        this.fov = e.fov,
        this.left = -e.width / 2,
        this.right = e.width / 2,
        this.top = e.height / 2,
        this.bottom = -e.height / 2,
        this.perspectiveCamera = new Td(this.fov,this.aspect,this.near,this.far),
        this.orthoCamera = null,
        this.toPerspective()) : (this.left = e.left,
        this.right = e.right,
        this.top = e.top,
        this.bottom = e.bottom,
        this.fov = 45,
        this.aspect = (this.right - this.left) / (this.top - this.bottom),
        this.orthoCamera = new Ka(this.left,this.right,this.top,this.bottom,this.near,this.far),
        this.perspectiveCamera = null,
        this.orthoCamera.updateProjectionMatrix(),
        this.projectionMatrix = this.orthoCamera.projectionMatrix,
        this.isPerspective = !1),
        this.zoom = e.zoom || 1,
        this.updateProjectionMatrixByFrustum = !1
    };
    (kd.prototype = Object.create(qe.prototype)).constructor = kd,
    kd.prototype.toPerspective = function() {
        null !== this.perspectiveCamera ? this.updateProjectionMatrixByFrustum || (this.perspectiveCamera.aspect = this.aspect,
        this.perspectiveCamera.near = this.near,
        this.perspectiveCamera.far = this.far,
        this.perspectiveCamera.fov = this.fov,
        this.perspectiveCamera.updateProjectionMatrix(),
        this.projectionMatrix = this.perspectiveCamera.projectionMatrix,
        this.projectionMatrixInverse = this.perspectiveCamera.projectionMatrixInverse,
        this.isPerspective = !0,
        this.dirty = !0) : Bh.log("Can not convert to perspective camera because the camera original type is orthographic.")
    }
    ,
    kd.prototype.toOrthographic = function() {
        null === this.orthoCamera && (this.orthoCamera = new Ka(this.left,this.right,this.top,this.bottom,this.near,this.far));
        var A = this.fov
          , e = this.target.clone().sub(this.position).length()
          , t = Math.tan(A * Math.PI / 180 / 2) * e
          , i = t * this.aspect;
        t /= this.zoom,
        this.left = this.orthoCamera.left = -(i /= this.zoom),
        this.right = this.orthoCamera.right = i,
        this.top = this.orthoCamera.top = t,
        this.bottom = this.orthoCamera.bottom = -t,
        this.orthoCamera.near = this.near,
        this.orthoCamera.far = this.far,
        this.orthoCamera.updateProjectionMatrix(),
        this.projectionMatrix = this.orthoCamera.projectionMatrix,
        this.projectionMatrixInverse = this.orthoCamera.projectionMatrixInverse,
        this.isPerspective = !1,
        this.dirty = !0
    }
    ,
    kd.prototype.setSize = function(A, e) {
        this.perspectiveCamera.aspect = A / e,
        this.left = -A / 2,
        this.right = A / 2,
        this.top = e / 2,
        this.bottom = -e / 2,
        this.aspect = A / e,
        this.dirty = !0
    }
    ,
    kd.prototype.setSizeByFrustum = function(A, e) {
        var t = 2 * this.right
          , i = 2 * this.top;
        this.aspect = t / i;
        var o = null;
        A / e > t / i ? (o = i / t,
        this.perspectiveCamera.setProjectOnWidth(!0)) : (o = t / i,
        this.perspectiveCamera.setProjectOnWidth(!1)),
        this.dirty = !0,
        this.isPerspective && (this.perspectiveCamera.aspect = o,
        this.perspectiveCamera.near = this.near,
        this.perspectiveCamera.far = this.far,
        this.perspectiveCamera.fov = this.fov,
        this.perspectiveCamera.updateProjectionMatrixByFrustum(A, e),
        this.projectionMatrix = this.perspectiveCamera.projectionMatrix,
        this.isPerspective = !0,
        this.dirty = !0)
    }
    ,
    kd.prototype.setFov = function(A) {
        this.fov = A,
        this.dirty = !0,
        this.updateProjectionMatrix()
    }
    ,
    kd.prototype.setNearFar = function(A, e) {
        this.near = A,
        this.far = e,
        this.dirty = !0,
        this.updateProjectionMatrix()
    }
    ,
    kd.prototype.updateProjectionMatrix = function() {
        this.isPerspective ? this.toPerspective() : this.toOrthographic()
    }
    ,
    kd.prototype.setLens = function(A, e) {
        void 0 === e && (e = 24);
        var t = 2 * a.radToDeg(Math.atan(e / (2 * A)));
        return this.setFov(t),
        this.dirty = !0,
        t
    }
    ,
    kd.prototype.setZoom = function(A) {
        this.zoom = A,
        this.dirty = !0,
        this.updateProjectionMatrix()
    }
    ,
    kd.prototype.copy = function(A) {
        qe.prototype.copy.call(this, A),
        this.target.copy(A.target),
        this.aspect = A.aspect,
        this.fov = A.fov,
        this.near = A.near,
        this.far = A.far,
        this.left = A.left,
        this.right = A.right,
        this.top = A.top,
        this.bottom = A.bottom,
        this.zoom = A.zoom,
        this.isPerspective = A.isPerspective,
        A.orthoCamera && (this.orthoCamera ? this.orthoCamera.copy(A.orthoCamera) : this.orthoCamera = A.orthoCamera.clone()),
        A.perspectiveCamera && (this.perspectiveCamera ? this.perspectiveCamera.copy(A.perspectiveCamera) : this.perspectiveCamera = A.perspectiveCamera.clone())
    }
    ,
    kd.prototype.isDirty = function() {
        return this.dirty
    }
    ,
    kd.prototype.toFrontView = function() {
        this.rotation.x = 0,
        this.rotation.y = 0,
        this.rotation.z = 0
    }
    ,
    kd.prototype.toBackView = function() {
        this.rotation.x = 0,
        this.rotation.y = Math.PI,
        this.rotation.z = 0
    }
    ,
    kd.prototype.toLeftView = function() {
        this.rotation.x = 0,
        this.rotation.y = -Math.PI / 2,
        this.rotation.z = 0
    }
    ,
    kd.prototype.toRightView = function() {
        this.rotation.x = 0,
        this.rotation.y = Math.PI / 2,
        this.rotation.z = 0
    }
    ,
    kd.prototype.toTopView = function() {
        this.rotation.x = -Math.PI / 2,
        this.rotation.y = 0,
        this.rotation.z = 0
    }
    ,
    kd.prototype.toBottomView = function() {
        this.rotation.x = Math.PI / 2,
        this.rotation.y = 0,
        this.rotation.z = 0
    }
    ;
    var Dd = function(A, e, t, i) {
        this.ray = new CA(A,e),
        this.near = t || 0,
        this.far = i || 1 / 0,
        this.params = {
            Sprite: {},
            Mesh: {},
            Points: {
                threshold: 1
            },
            LOD: {},
            Line: {}
        }
    };
    Dd.prototype = {
        constructor: Dd,
        precision: 1e-4,
        linePrecision: 1,
        descSort: function(A, e) {
            return A.distance - e.distance
        },
        set: function(A, e) {
            this.ray.set(A, e)
        },
        setFromCamera: function(A, e) {
            e instanceof kd ? e.isPerspective ? (this.ray.origin.copy(e.position),
            this.ray.direction.set(A.x, A.y, .5).unproject(e).sub(e.position).normalize()) : (this.ray.origin.set(A.x, A.y, -1).unproject(e),
            this.ray.direction.set(0, 0, -1).transformDirection(e.matrixWorld)) : e instanceof je ? (this.ray.origin.copy(e.position),
            this.ray.direction.set(A.x, A.y, .5).unproject(e).sub(e.position).normalize()) : e instanceof Ka ? (this.ray.origin.set(A.x, A.y, -1).unproject(e),
            this.ray.direction.set(0, 0, -1).transformDirection(e.matrixWorld)) : Bh.error("Raycaster: Unsupported camera type.")
        },
        intersectObject: function(A, e) {
            var t = [];
            return Rd.intersectObject(A, this, t, e),
            t.sort(this.descSort),
            t.length > 0 ? t[0] : null
        },
        intersectObjects: function(A, e) {
            for (var t = [], i = 0, o = A.length; o > i; i += 1)
                Rd.intersectObject(A[i], this, t, e);
            return t.sort(this.descSort),
            t.length > 0 ? t[0] : null
        },
        intersectOctantForNode: function(A, e) {
            var t = this
              , i = new aA;
            !function A(o) {
                var n = null
                  , r = null;
                if (i.set(o.min, o.max),
                t.ray.intersectBox(i) && (e.push(o),
                o.childOctants))
                    for (n = 0,
                    r = o.childOctants.length; r > n; n += 1)
                        A(o.childOctants[n])
            }(A)
        }
    },
    CA.prototype.intersectBoxWithDistance = function(A) {
        var e = null
          , t = null
          , i = null
          , o = null
          , n = null
          , r = null
          , a = 1 / this.direction.x
          , s = 1 / this.direction.y
          , l = 1 / this.direction.z
          , c = this.origin;
        if (0 > a ? (t = (A.max.x - c.x) * a,
        e = (A.min.x - c.x) * a) : (t = (A.min.x - c.x) * a,
        e = (A.max.x - c.x) * a),
        0 > s ? (o = (A.max.y - c.y) * s,
        i = (A.min.y - c.y) * s) : (o = (A.min.y - c.y) * s,
        i = (A.max.y - c.y) * s),
        t > i || o > e)
            return -1;
        if ((o > t || isNaN(t)) && (t = o),
        (e > i || isNaN(e)) && (e = i),
        0 > l ? (r = (A.max.z - c.z) * l,
        n = (A.min.z - c.z) * l) : (r = (A.min.z - c.z) * l,
        n = (A.max.z - c.z) * l),
        t > n || r > e)
            return -1;
        if ((r > t || isNaN(t)) && (t = r),
        (e > n || isNaN(e)) && (e = n),
        0 > e)
            return -1;
        if (0 > t)
            return 0;
        var h = new y;
        this.at(0 > t ? e : t, h);
        var d = h.x - c.x
          , p = h.y - c.y
          , g = h.z - c.z;
        return Math.sqrt(d * d + p * p + g * g)
    }
    ;
    var Ld = function() {}
      , Nd = function() {};
    Nd.prototype = uh.extend(!0, {}, Ld.prototype = {
        constructor: Ld,
        apply: function(A) {
            A.addEventListener = Ld.prototype.addEventListener,
            A.hasEventListener = Ld.prototype.hasEventListener,
            A.removeEventListener = Ld.prototype.removeEventListener,
            A.fireEvent = Ld.prototype.dispatchEvent,
            A.dispatchEvent = Ld.prototype.dispatchEvent
        },
        addEventListener: function(A, e) {
            A && (void 0 === this._listeners && (this._listeners = {}),
            void 0 === this._listeners[A] && (this._listeners[A] = []),
            this._listeners[A].push(e))
        },
        hasEventListener: function(A, e) {
            if (!A)
                return !1;
            if (void 0 === this._listeners)
                return !1;
            var t = this._listeners;
            return void 0 !== t[A] && -1 !== t[A].indexOf(e)
        },
        removeEventListener: function(A, e) {
            if (A && (void 0 === this._listeners && (this._listeners = {}),
            Array.isArray(this._listeners[A])))
                for (var t = this._listeners[A], i = 0, o = t.length; o > i; i += 1)
                    if (t[i] === e) {
                        t.splice(i, 1);
                        break
                    }
        },
        removeAllEventListenerByType: function(A) {
            A && (void 0 === this._listeners && (this._listeners = {}),
            Array.isArray(this._listeners[A]) && this._listeners[A] && (this._listeners[A] = void 0))
        },
        removeAllEventListener: function() {
            for (var A in void 0 === this._listeners && (this._listeners = {}),
            this._listeners)
                if (this._listeners.hasOwnProperty(A))
                    for (var e = this._listeners[A], t = 0, i = e.length; i > t; t += 1)
                        e.splice(t, 1);
            this._listeners = {}
        },
        dispatchEvent: function(A) {
            if (void 0 === this._listeners && (this._listeners = {}),
            "string" == typeof A && (A = {
                type: A
            }),
            !A.target)
                try {
                    A.target = this
                } catch (A) {}
            if (null == A.type)
                throw Bh.trace("事件类型未知."),
                new Error("事件类型未知.");
            if (Array.isArray(this._listeners[A.type]))
                for (var e = this._listeners[A.type].slice(), t = 0; e.length > t; t += 1)
                    e[t].call(this, A)
        },
        fireEvent: function(A) {
            this.dispatchEvent(A)
        }
    }, {
        init: function(A) {
            this.marks = {},
            this.allOids = [],
            this.components = {},
            this.SelectedMark = {},
            this.mouse = new s,
            this.lastX = 0,
            this.lastY = 0,
            this.active = !0,
            this.viewer = A
        },
        addObjectToScene: function(A, e) {
            A && A.id && e && (this.viewer.addExternalObject(A.id, e),
            this.components[A.id] = e,
            this.allOids.push(A.id),
            this.marks[A.id] = A)
        },
        enabled: function() {
            this.mousedown = this.viewer.domElement.addEventListener("mousedown", this.onMouseDown.bind(this), !1),
            this.mouseup = this.viewer.domElement.addEventListener("mouseup", this.onMouseUp.bind(this), !1)
        },
        disabled: function() {
            this.mousedown = this.viewer.domElement.removeEventListener("mousedown", this.onMouseDown.bind(this), !1),
            this.mouseup = this.viewer.domElement.removeEventListener("mouseup", this.onMouseUp.bind(this), !1)
        },
        touchEnabled: function() {
            this.touchstart = document.getElementById(this.viewer.uuid).addEventListener("touchstart", this.onTouchStart.bind(this), !1),
            this.touchend = document.getElementById(this.viewer.uuid).addEventListener("touchend", this.onTouchEnd.bind(this), !1)
        },
        touchDisabled: function() {
            this.touchstart = this.viewer.domElement.removeEventListener("touchstart", this.onTouchStart.bind(this), !1),
            this.touchend = this.viewer.domElement.removeEventListener("touchend", this.onTouchEnd.bind(this), !1)
        },
        onMouseDown: function(A) {
            this.mouse.x = this.lastX = A.clientX,
            this.mouse.y = this.lastY = A.clientY
        },
        onMouseUp: function(A) {
            var e = [A.clientX, A.clientY];
            (e[0] > this.lastX ? 5 > e[0] - this.lastX : 5 > this.lastX - e[0]) && (e[1] > this.lastY ? 5 > e[1] - this.lastY : 5 > this.lastY - e[1]) && (this.mouse.x = this.lastX = e[0],
            this.mouse.y = this.lastY = e[1],
            this.pick("pick"))
        },
        onTouchStart: function(A) {
            this.mouse.x = this.lastX = A.changedTouches[0].clientX,
            this.mouse.y = this.lastY = A.changedTouches[0].clientY
        },
        onTouchEnd: function(A) {
            (A.changedTouches[0].clientX > this.lastX ? 5 > A.changedTouches[0].clientX - this.lastX : 5 > this.lastX - A.changedTouches[0].clientX) && (A.changedTouches[0].clientY > this.lastY ? 5 > A.changedTouches[0].clientY - this.lastY : 5 > this.lastY - A.changedTouches[0].clientY) && (this.mouse.x = this.lastX = A.changedTouches[0].clientX,
            this.mouse.y = this.lastY = A.changedTouches[0].clientY,
            this.pick("pick"))
        },
        pick: function() {
            var A = this.viewer.cameraControl.getIntersectContext(this.mouse)
              , e = new Dd;
            e.setFromCamera(A.mouse, A.camera),
            e.camera = A.camera,
            e._camera = A.camera,
            e.viewportSize = A.viewportSize;
            var t = Object.values(this.components)
              , i = e.intersectObjects(t);
            i ? this.SelectedMark !== i.object ? (this.SelectedMark = i.object,
            this.dispatchEvent({
                type: "updated",
                added: {
                    objects: this.SelectedMark
                }
            })) : (this.dispatchEvent({
                type: "updated",
                removed: {
                    objects: this.SelectedMark
                }
            }),
            this.SelectedMark = {}) : (this.SelectedMark = {},
            this.dispatchEvent({
                type: "updated",
                removed: {
                    objects: this.SelectedMark
                }
            }))
        },
        getClickCoordsWithinElement: function(A) {
            var e = [0, 0];
            if (A) {
                for (var t = A.target, i = 0, o = 0; t.offsetParent; )
                    i += t.offsetLeft,
                    o += t.offsetTop,
                    t = t.offsetParent;
                e[0] = A.pageX - i,
                e[1] = A.pageY - o
            } else
                A = window.event,
                e.x = A.x,
                e.y = A.y;
            return e
        },
        listentoSelectMarks: function(A) {
            var e = this;
            this.addEventListener("updated", (function(t) {
                t.added && e.SelectedMark !== {} ? A(e.SelectedMark.key, e.SelectedMark) : A(null, null)
            }
            ))
        },
        hasTheSameId: function(A) {
            if ("" !== A.id)
                for (var e = 0; this.allOids.length > e; e += 1)
                    if (A.id === this.allOids[e])
                        return {
                            data: "标签id重复"
                        }
        },
        findMark: function(A) {
            return this.components[A]
        },
        idsToArray: function(A) {
            return null == A ? {
                data: "未选中mark"
            } : (Array.isArray(A) || (A = [A]),
            A)
        },
        removeIdAndInfo: function(A) {
            var e = this.allOids.indexOf(A);
            this.allOids.splice(e, 1),
            delete this.marks[A],
            delete this.components[A]
        },
        remove: function(A) {
            if (A = this.idsToArray(A),
            !Array.isArray(A))
                return A;
            for (var e = 0; A.length > e; e += 1)
                this.removeIdAndInfo(A[e]),
                this.viewer.removeExternalObjectByName(A[e]);
            this.viewer.render()
        },
        hide: function(A) {
            if (A = this.idsToArray(A),
            !Array.isArray(A))
                return A;
            for (var e = 0; A.length > e; e += 1) {
                var t = this.findMark(A[e]);
                t && (t.visible = !1)
            }
            this.viewer.render()
        },
        show: function(A) {
            var e = null;
            if (A) {
                A = this.idsToArray(A);
                for (var t = 0; A.length > t; t += 1)
                    (e = this.findMark(A[t])) && (e.visible = !0)
            } else
                for (var i in this.components)
                    (e = this.components[i]) && (e.visible = !0);
            this.viewer.render()
        },
        isolation: function(A) {
            if (this.allOids.length > 0) {
                A = this.idsToArray(A);
                this.show();
                for (var e = this.allOids.concat(), t = 0; A.length > t; t += 1) {
                    var i = A[t];
                    if (-1 === this.allOids.indexOf(i))
                        return {
                            data: "mark不存在"
                        };
                    for (var o = 0; e.length > o; o += 1)
                        if (i === e[o]) {
                            e.splice(o, 1);
                            break
                        }
                }
                var n = null;
                for (o = 0; e.length > o; o += 1)
                    (n = this.findMark(e[o])) && (n.visible = !1);
                this.viewer.render()
            }
        }
    });
    var Od = function(A) {
        this.defaultSettings = {
            id: "",
            mode: "absolute",
            startPosition: [0, 0, 0],
            endPosition: [0, 0],
            color: [255, 0, 0],
            colorLine: [0, 0, 0],
            offset: [0, 0],
            draggable: !0,
            componentId: "",
            domElement: null,
            title: "标签",
            showPoint: !0,
            showLine: !0
        },
        this.initStartPos = {};
        var e = A;
        "function" == typeof A.getViewerImpl && (e = A.getViewerImpl()),
        this.dragging = !1,
        this.init(e),
        this.markState = {};
        var t = this;
        this.showPoint = !0,
        this.showLine = !0,
        e.cameraControl.addEventListener(Rc.ON_CAMERA_CHANGE, (function() {
            t._update()
        }
        ))
    };
    Od.prototype = uh.extend(!0, {}, Nd.prototype, {
        constructor: Od,
        add: function(A, e) {
            var t = document.createElement("div")
              , i = Object.assign({}, this.defaultSettings, A)
              , o = this.hasTheSameId(i);
            if (o)
                return o;
            "" === i.id && (i.id = a.generateUUID()),
            t.id = "label" + i.id,
            this.marks[i.id] = Object.assign({}, i);
            var n = this.viewer.getScreenCoordFromSceneCoord(i.startPosition)
              , r = i.offset
              , s = i.endPosition.concat()
              , l = [];
            ("relativeute" === i.mode ? (s = [n[0] + r[0], n[1] + r[1]],
            i.endPosition = [0, 0]) : i.offset = [0, 0],
            Array.isArray(i.colorLine)) && (i.colorLine = "rgb(" + i.colorLine[0] + "," + i.colorLine[1] + "," + i.colorLine[2] + ")");
            var c = document.createElement("div");
            (c.id = "labelStart" + i.id,
            c.className = "labelStart",
            c.style.cssText = "border:2px solid red; border-radius:5px; -moz-border-radius:5px; height: 4px;width: 4px;position: absolute;margin-left: -3px;margin-top: -3px;top:" + n[1] + "px;left:" + n[0] + "px; background-color: red;",
            t.appendChild(c),
            this.showPoint && i.showPoint || (c.style.display = "none"),
            Array.isArray(i.color)) && (i.color = "rgb(" + i.color[0] + "," + i.color[1] + "," + i.color[2] + ")");
            var h = document.createElement("div");
            h.id = i.id,
            h.className = "labelingDiv",
            h.style.cssText = "border:2px solid " + i.colorLine + ";text-align:center;border-radius:5px;-moz-border-radius:5px;min-width: 66px;position: absolute;width:-webkit-fit-content;width: -moz-fit-content;background-color:" + i.color + ";",
            t.appendChild(h);
            var d = document.createElement("span");
            d.id = "labelTitle" + i.id,
            d.className = "labelTitle",
            d.onmouseover = function() {
                d.style.cursor = "move"
            }
            ,
            d.onmouseout = function() {
                d.style.cursor = "auto"
            }
            ,
            d.style.cssText = "display:block;padding:2%;text-align:center;color: #000000;white-space:nowrap",
            d.innerText = i.title,
            h.appendChild(d),
            0 > s[0] && (s[0] = 5),
            0 > s[1] && (s[1] = 5),
            s[0] > this.viewer.domElement.offsetWidth - h.offsetWidth && (s[0] = this.viewer.domElement.offsetWidth - h.offsetWidth),
            s[1] > this.viewer.domElement.offsetHeight - h.offsetHeight && (s[1] = this.viewer.domElement.offsetHeight - h.offsetHeight),
            h.style.cssText += "left:" + s[0] + "px; top:" + s[1] + "px",
            i.domElement && h.appendChild(i.domElement),
            s[0] > n[0] ? s[1] > n[1] ? (l[0] = s[0],
            l[1] = s[1]) : (l[0] = s[0],
            l[1] = s[1] + h.offsetHeight) : s[1] > n[1] ? (l[0] = s[0] + h.offsetWidth,
            l[1] = s[1]) : (l[0] = s[0] + h.offsetWidth,
            l[1] = s[1] + h.offsetHeight);
            var p = n[0] - l[0]
              , g = n[1] - l[1]
              , u = Math.sqrt(p * p + g * g)
              , f = Math.atan(g / p) / Math.PI * 180;
            p > 0 || (g > 0 ? f += 180 : f -= 180);
            var m = document.createElement("div");
            m.id = "labelLine" + i.id,
            m.className = "labelLine",
            m.style.cssText = " height: 2px;position: absolute;transform-origin: left center;width:" + u + "px;-ms-transform:rotateZ(" + f + "deg);-moz-transform:rotateZ(" + f + "deg);-webkit-transform:rotateZ(" + f + "deg);-o-transform:rotateZ(" + f + "deg);transform:rotateZ(" + f + "deg);left:" + l[0] + "px;top:" + l[1] + "px;background-color:" + i.colorLine + ";",
            t.appendChild(m),
            this.showLine && i.showLine || (m.style.display = "none"),
            this.viewer.domElement.appendChild(t),
            i.draggable && this._enableDrag(h),
            this.allOids.push(i.id),
            this.markState[i.id] = {
                userHide: !1,
                outOfBoundary: !1
            },
            "function" == typeof e && e(i.id)
        },
        enablePoint: function(A) {
            this.showPoint = A,
            this._update()
        },
        enableLine: function(A) {
            this.showLine = A,
            this._update()
        },
        _update: function() {
            for (var A in this.marks) {
                var e = this.viewer.getScreenCoordFromSceneCoord(this.marks[A].startPosition)
                  , t = this.marks[A].endPosition.concat()
                  , i = this.marks[A].offset;
                "relativeute" === this.marks[A].mode && (0 !== t[0] || 0 !== t[1] ? (i = [t[0] - e[0], t[1] - e[1]],
                this.marks[A].endPosition = [0, 0],
                this.marks[A].offset = i) : t = [e[0] + i[0], e[1] + i[1]]);
                var o = [0, 0]
                  , n = document.getElementById(A);
                t[0] > e[0] ? t[1] > e[1] ? (o[0] = t[0],
                o[1] = t[1]) : (o[0] = t[0],
                o[1] = t[1] + n.offsetHeight) : t[1] > e[1] ? (o[0] = t[0] + n.offsetWidth,
                o[1] = t[1]) : (o[0] = t[0] + n.offsetWidth,
                o[1] = t[1] + n.offsetHeight);
                var r = e[0] - o[0]
                  , a = e[1] - o[1]
                  , s = Math.sqrt(r * r + a * a)
                  , l = Math.atan(a / r) / Math.PI * 180;
                r > 0 || (a > 0 ? l += 180 : l -= 180);
                var c = getComputedStyle(this.viewer.domElement)
                  , h = parseInt(c.width, 10)
                  , d = parseInt(c.height, 10);
                0 > e[1] || e[1] > d || 0 > e[0] || e[0] > h ? (this.markState[A].outOfBoundary = !0,
                document.getElementById("labelStart" + A).setCss({
                    display: "none"
                }),
                document.getElementById("labelLine" + A).setCss({
                    display: "none"
                }),
                document.getElementById(A).setCss({
                    display: "none"
                })) : (this.markState[A].outOfBoundary = !1,
                this.dragging || "relativeute" !== this.marks[A].mode || (document.getElementById(A).style.left = t[0] + "px",
                document.getElementById(A).style.top = t[1] + "px"),
                this.markState[A].userHide || (document.getElementById(A).setCss({
                    display: "block"
                }),
                this.showPoint && this.marks[A].showPoint ? document.getElementById("labelStart" + A).style.cssText += ";display:block;top:" + e[1] + "px; left:" + e[0] + "px" : document.getElementById("labelStart" + A).setCss({
                    display: "none"
                }),
                this.showLine && this.marks[A].showLine ? document.getElementById("labelLine" + A).style.cssText += ";display:block;width:" + s + "px;transform-origin: left center;-ms-transform:rotateZ(" + l + "deg);-moz-transform:rotateZ(" + l + "deg);-webkit-transform:rotateZ(" + l + "deg);-o-transform:rotateZ(" + l + "deg);transform:rotateZ(" + l + "deg);left:" + o[0] + "px; top:" + o[1] + "px" : document.getElementById("labelLine" + A).setCss({
                    display: "none"
                })))
            }
        },
        _enableDrag: function(A) {
            var e = this
              , t = A
              , i = A.id
              , o = t.querySelector("#labelTitle" + i)
              , n = this.viewer.domElement
              , r = n.offsetLeft
              , a = n.offsetTop
              , s = this;
            o.addEventListener("mousedown", (function(e) {
                e.preventDefault(),
                s.dragging = !0,
                t.setAttribute("offset-left", e.offsetX),
                t.setAttribute("offset-top", e.offsetY),
                t.setAttribute("allow-drag", "true"),
                [A.style.left, A.style.top]
            }
            )),
            document.addEventListener("mousemove", function(A) {
                if ("true" === t.getAttribute("allow-drag")) {
                    A.preventDefault();
                    var e = A.clientX - parseInt(t.getAttribute("offset-left"), 10) - parseInt(t.style.borderWidth, 10) - r
                      , o = A.clientY - parseInt(t.getAttribute("offset-top"), 10) - parseInt(t.style.borderWidth, 10) - a;
                    0 > o && (o = 5),
                    o > n.offsetHeight - t.offsetHeight && (o = n.offsetHeight - t.offsetHeight),
                    0 > e && (e = 5),
                    e > n.offsetWidth - t.offsetWidth && (e = n.offsetWidth - t.offsetWidth),
                    t.style.cssText += ";left:" + e + "px;top:" + o + "px",
                    this.marks[i].endPosition = [e, o],
                    this._update()
                }
            }
            .bind(this)),
            document.addEventListener("mouseup", (function(A) {
                "true" === t.getAttribute("allow-drag") && (A.preventDefault(),
                t.setAttribute("allow-drag", "false"),
                s.dragging = !1)
            }
            )),
            o.addEventListener("touchstart", (function(e) {
                e.preventDefault();
                var i = parseInt(t.style.left, 10)
                  , o = parseInt(t.style.top, 10)
                  , n = e.targetTouches[0].clientY;
                t.setAttribute("offset-left", e.targetTouches[0].clientX - i),
                t.setAttribute("offset-top", n - o),
                t.setAttribute("allow-drag", "true"),
                [A.style.left, A.style.top]
            }
            )),
            document.addEventListener("touchmove", (function(A) {
                if ("true" === t.getAttribute("allow-drag")) {
                    A.preventDefault();
                    var o = A.targetTouches[0].clientX - parseInt(t.getAttribute("offset-left"), 10) - parseInt(t.style.borderWidth, 10) - r
                      , n = A.targetTouches[0].clientY - parseInt(t.getAttribute("offset-top"), 10) - parseInt(t.style.borderWidth, 10) - a;
                    0 > n && (n = 5),
                    n > e.viewer.domElement.offsetHeight - t.offsetHeight && (n = e.viewer.domElement.offsetHeight - t.offsetHeight),
                    0 > o && (o = 5),
                    o > e.viewer.domElement.offsetWidth - t.offsetWidth && (o = e.viewer.domElement.offsetWidth - t.offsetWidth),
                    t.style.cssText += ";left:" + o + "px;top:" + n + "px",
                    e.marks[i].endPosition = [o, n],
                    e._update()
                }
            }
            )),
            document.addEventListener("touchend", (function(A) {
                "true" === t.getAttribute("allow-drag") && (A.preventDefault(),
                t.setAttribute("allow-drag", "false"))
            }
            ))
        },
        updateMark: function(A, e) {
            if (!this.marks[A])
                return {
                    id: A,
                    data: "该标签不存在"
                };
            var t = Object.assign({}, this.marks[A], e);
            this.marks[A] = Object.assign({}, t);
            var i = this.viewer.getScreenCoordFromSceneCoord(t.startPosition)
              , o = t.offset
              , n = t.endPosition.concat()
              , r = [];
            "relativeute" === t.mode ? (n = [i[0] + o[0], i[1] + o[1]],
            t.endPosition = [0, 0]) : t.offset = [0, 0],
            Array.isArray(t.colorLine) && (t.colorLine = "rgb(" + t.colorLine[0] + "," + t.colorLine[1] + "," + t.colorLine[2] + ")");
            var a = document.getElementById("labelStart" + A);
            a.style.cssText = "border:2px solid red; border-radius:5px; -moz-border-radius:5px; height: 4px;width: 4px;position: absolute;margin-left: -3px;margin-top: -3px;top:" + i[1] + "px;left:" + i[0] + "px;background-color:" + t.colorLine + ";",
            this.showPoint && t.showPoint || (a.style.display = "none"),
            Array.isArray(t.color) && (t.color = "rgb(" + t.color[0] + "," + t.color[1] + "," + t.color[2] + ")");
            var s = document.getElementById(A);
            s.style.cssText = "border:2px solid " + t.colorLine + ";text-align:center;border-radius:5px;-moz-border-radius:5px;min-width: 66px;position: absolute;width:-webkit-fit-content;width: -moz-fit-content;background-color:" + t.color + ";";
            var l = document.getElementById("labelTitle" + A);
            l.innerText = t.title,
            0 > n[0] && (n[0] += 5),
            0 > n[1] && (n[1] += 5),
            n[0] > this.viewer.domElement.offsetWidth - s.offsetWidth && (n[0] = this.viewer.domElement.offsetWidth - s.offsetWidth),
            n[1] > this.viewer.domElement.offsetHeight - s.offsetHeight && (n[1] = this.viewer.domElement.offsetHeight - s.offsetHeight),
            s.style.cssText += "left:" + n[0] + "px; top:" + n[1] + "px";
            var c = l.nextElementSibling || l.nextSibling;
            c && s.removeChild(c),
            t.domElement && s.appendChild(t.domElement),
            t.draggable && this._enableDrag(s),
            n[0] > i[0] ? n[1] > i[1] ? (r[0] = n[0],
            r[1] = n[1]) : (r[0] = n[0],
            r[1] = n[1] + s.offsetHeight) : n[1] > i[1] ? (r[0] = n[0] + s.offsetWidth,
            r[1] = n[1]) : (r[0] = n[0] + s.offsetWidth,
            r[1] = n[1] + s.offsetHeight);
            var h = i[0] - r[0]
              , d = i[1] - r[1]
              , p = Math.sqrt(h * h + d * d)
              , g = Math.atan(d / h) / Math.PI * 180;
            h > 0 || (d > 0 ? g += 180 : g -= 180);
            var u = document.getElementById("labelLine" + A);
            u.style.cssText = "height: 2px;position: absolute;transform-origin: left center;width:" + p + "px;-ms-transform:rotateZ(" + g + "deg);-moz-transform:rotateZ(" + g + "deg);-webkit-transform:rotateZ(" + g + "deg);-o-transform:rotateZ(" + g + "deg);transform:rotateZ(" + g + "deg);left:" + r[0] + "px;top:" + r[1] + "px;background-color:" + t.colorLine + ";",
            this.showLine && t.showLine || (u.style.display = "none")
        },
        updateColor: function(A, e) {
            Array.isArray(A) || (A = [A]);
            for (var t = 0; A.length > t; t += 1) {
                var i = A[t];
                if (!this.marks[i])
                    return {
                        id: i,
                        data: "该标签不存在"
                    };
                Array.isArray(e) ? document.getElementById(i).style.cssText += ";background-color:rgb(" + e[0] + "," + e[1] + "," + e[2] + ")" : document.getElementById(i).style.cssText += ";background-color:" + e,
                this.marks[i].color = e
            }
        },
        updateTitle: function(A, e) {
            Array.isArray(A) || (A = [A]);
            for (var t = 0; A.length > t; t += 1) {
                var i = A[t];
                if (!this.marks[i])
                    return {
                        id: i,
                        data: "该标签不存在"
                    };
                document.getElementById("labelTitle" + i).innerText = e,
                this.marks[i].title = e
            }
        },
        updateDomElement: function(A, e) {
            if (this.marks[A]) {
                var t = document.getElementById(A)
                  , i = t.querySelector(".labelTitle")
                  , o = i.nextElementSibling || i.nextSibling;
                return o && t.removeChild(o),
                e && t.appendChild(e),
                this.marks[A].domElement = e,
                !0
            }
            return {
                id: A,
                data: "该标签不存在"
            }
        },
        remove: function(A) {
            A = this.idsToArray(A);
            for (var e = 0; A.length > e; e += 1) {
                var t = A[e];
                if (!this.marks[t])
                    return {
                        id: t,
                        data: "该标签不存在"
                    };
                this.viewer.domElement.removeChild(document.getElementById("label" + t)),
                delete this.marks[t],
                delete this.markState[t];
                var i = this.allOids.indexOf(t);
                this.allOids.splice(i, 1)
            }
        },
        hide: function(A) {
            A = this.idsToArray(A);
            for (var e = 0; A.length > e; e += 1) {
                var t = A[e];
                if (!this.marks[t])
                    return {
                        id: t,
                        data: "该标签不存在"
                    };
                this.markState[t].userHide = !0,
                this.markState[t].outOfBoundary || (document.getElementById("labelLine" + t).style.display = "none",
                document.getElementById("labelStart" + t).style.display = "none",
                document.getElementById(t).style.display = "none")
            }
        },
        show: function(A) {
            if (A) {
                A = this.idsToArray(A);
                for (var e = 0; A.length > e; e += 1) {
                    if (!this.marks[o = A[e]])
                        return {
                            id: o,
                            data: "该标签不存在"
                        };
                    this.markState[o].userHide = !1,
                    this.markState[o].outOfBoundary || (this.showPoint && this.marks[o].showPoint && (document.getElementById("labelStart" + o).style.display = "block"),
                    this.showLine && this.marks[o].showLine && (document.getElementById("labelLine" + o).style.display = "block"),
                    document.getElementById(o).style.display = "block")
                }
            } else
                for (var t = this.allOids.concat(), i = 0; t.length > i; i += 1) {
                    var o;
                    this.markState[o = t[i]].userHide = !1,
                    this.markState[o].outOfBoundary || (this.showPoint && this.marks[o].showPoint && (document.getElementById("labelStart" + o).style.display = "block"),
                    this.showLine && this.marks[o].showLine && (document.getElementById("labelLine" + o).style.display = "block"),
                    document.getElementById(o).style.display = "block")
                }
        },
        isolation: function(A) {
            if (this.allOids.length > 0) {
                A = this.idsToArray(A),
                this.show();
                for (var e = this.allOids.concat(), t = 0; A.length > t; t += 1) {
                    var i = A[t];
                    if (!this.marks[i])
                        return {
                            data: "mark不存在"
                        };
                    for (var o = 0; e.length > o; o += 1)
                        if (i === e[o]) {
                            e.splice(o, 1);
                            break
                        }
                }
                for (var n = 0; e.length > n; n += 1)
                    document.getElementById("labelLine" + e[n]).style.display = "none",
                    document.getElementById("labelStart" + e[n]).style.display = "none",
                    document.getElementById(e[n]).style.display = "none"
            }
        },
        addEventListener: function(A, e, t) {
            document.getElementById(A).addEventListener(e, t)
        },
        removeEventListener: function(A, e, t) {
            document.getElementById(A).removeEventListener(e, t)
        }
    });
    var Vd = function(A) {
        this.defaultSettings = {
            id: "",
            URL: "",
            side: 2,
            scale: 1,
            width: 1,
            height: 1,
            opacity: 1,
            transparent: !1,
            alwaysVisible: !1,
            useImageSize: !0,
            faceToCamera: !1,
            color: [1, 1, 1],
            emissive: [0, 0, 0],
            position: [0, 0, 0],
            face: "z",
            useFaceMatrix: !0,
            matrix: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
        },
        this.faceMatrix = {
            x: [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1],
            y: [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1],
            z: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
        };
        var e = A;
        "function" == typeof A.getViewerImpl && (e = A.getViewerImpl()),
        this.init(e),
        this.enabled()
    };
    Vd.prototype = uh.extend(!0, {}, Nd.prototype, {
        constructor: Vd,
        add: function(A, e) {
            var t = this
              , i = gc({}, this.defaultSettings, A)
              , o = this.hasTheSameId(i);
            if (o)
                return o;
            var n = 1
              , r = 1
              , a = (new Aa).load(i.URL, (function(A) {
                t.viewer.render()
            }
            ), (function() {}
            ), (function(A) {
                t.dispatchEvent({
                    type: Tc.LOAD_TEXTURE_ERROR,
                    data: "加载材质出错"
                })
            }
            ));
            !0 === i.alwaysVisible && (i.transparent = !0);
            var s = new xr({
                color: new LA(i.color[0],i.color[1],i.color[2]),
                emissive: new LA(i.emissive[0],i.emissive[1],i.emissive[2]),
                map: a,
                depthTest: !i.alwaysVisible,
                side: i.side,
                opacity: i.opacity,
                transparent: i.transparent
            });
            n = i.width ? i.width : s.map.image.width,
            r = i.height ? i.height : s.map.image.height;
            var l = new Ue(new et(1,1,1,1),s)
              , c = new M;
            if (i.matrix && (3 === i.matrix.length ? (c.elements[12] = i.matrix[0],
            c.elements[13] = i.matrix[1],
            c.elements[14] = i.matrix[2]) : c.fromArray(i.matrix)),
            l.applyMatrix4(c),
            i.faceToCamera) {
                var h = new y
                  , d = new y
                  , p = new f;
                l.onBeforeRender = function() {
                    t.viewer.camera.matrixWorld.decompose(h, p, d),
                    l.quaternion.copy(p),
                    l.updateMatrixWorld(!0)
                }
            }
            return l.scale.set(i.scale * n, i.scale * r, 1),
            l.updateMatrixWorld(!0),
            "" !== i.id ? l.key = i.id : (l.key = l.uuid,
            i.id = l.uuid),
            t.addObjectToScene(i, l),
            "function" == typeof e && e(l.key),
            l.componentKey = i.componentKey && Array.isArray(i.componentKey) ? i.componentKey : i.componentKey ? [i.componentKey] : [],
            l
        },
        updateMark: function(A, e) {
            var t = this
              , i = this.findMark(A);
            if (i) {
                i.applyMatrix4((new M).getInverse(i.matrix));
                var o = gc({}, t.marks[A], e)
                  , n = new M;
                if (o.matrix && (3 === o.matrix.length ? (n.elements[12] = o.matrix[0],
                n.elements[13] = o.matrix[1],
                n.elements[14] = o.matrix[2]) : n.fromArray(o.matrix)),
                i.applyMatrix4(n),
                o.faceToCamera) {
                    var r = new y
                      , a = new y
                      , s = new f;
                    i.onBeforeRender = function() {
                        t.viewer.camera.matrixWorld.decompose(r, s, a),
                        i.quaternion.copy(s),
                        i.updateMatrixWorld(!0)
                    }
                } else
                    delete i.onBeforeRender;
                if (i.scale.set(o.scale * o.width, o.scale * o.height, 1),
                i.updateMatrixWorld(!0),
                i.componentKey = o.componentKey && Array.isArray(o.componentKey) ? o.componentKey : o.componentKey ? [o.componentKey] : [],
                t.marks[A] = o,
                e.URL)
                    (new Aa).load(o.URL, (function(A) {
                        !0 === o.alwaysVisible && (o.transparent = !0);
                        var e = new xr({
                            color: new LA(o.color[0],o.color[1],o.color[2]),
                            emissive: new LA(o.emissive[0],o.emissive[1],o.emissive[2]),
                            map: A,
                            depthTest: !o.alwaysVisible,
                            side: o.side,
                            opacity: o.opacity,
                            transparent: o.transparent
                        });
                        i.material = e
                    }
                    ));
                else
                    !0 === o.alwaysVisible && (o.transparent = !0),
                    i.material.depthTest = !o.alwaysVisible,
                    i.material.transparent = o.transparent,
                    i.material.opacity = o.opacity,
                    i.material.side = o.side,
                    i.material.emissive = new LA(o.emissive[0],o.emissive[1],o.emissive[2])
            }
            this.viewer.render()
        }
    });
    var Gd = function(A) {
        this.defaultSettings = {
            id: "",
            url: "",
            width: 1,
            height: 1,
            scale: 1,
            alwaysVisible: !1,
            position: [0, 0, 0],
            componentId: "",
            useImageSize: !0
        };
        var e = A;
        "function" == typeof A.getViewerImpl && (e = A.getViewerImpl()),
        this.init(e),
        this.enabled()
    };
    Gd.prototype = uh.extend(!0, {}, Nd.prototype, {
        constructor: Gd,
        add: function(A, e) {
            var t = this;
            !A.url && A.URL && (A.url = A.URL);
            var i = Object.assign({}, this.defaultSettings, A)
              , o = this.hasTheSameId(i);
            if (o)
                return o;
            var n = 1
              , r = 1;
            (new Aa).load(i.URL || i.url, (function(A) {
                var o = new ro({
                    map: A,
                    color: 16777215,
                    depthTest: !i.alwaysVisible,
                    transparent: i.alwaysVisible
                });
                n = i.useImageSize && o.map && o.map.image && o.map.image.width ? o.map.image.width : i.width,
                r = i.useImageSize && o.map && o.map.image && o.map.image.width ? o.map.image.height : i.height;
                var a = new vo(o);
                a.scale.set(i.scale * n, i.scale * r, 1),
                i.position.isVector3 ? a.position.copy(i.position) : a.position.set(i.position[0], i.position[1], i.position[2]),
                a.updateMatrixWorld(!0),
                "" !== i.id ? a.key = i.id : (a.key = a.uuid,
                i.id = a.uuid),
                t.addObjectToScene(i, a),
                "function" == typeof e && e(a.key)
            }
            ), (function() {}
            ), (function(A) {
                t.dispatchEvent({
                    type: Tc.LOAD_TEXTURE_ERROR,
                    data: "加载材质出错"
                })
            }
            ))
        },
        updateMark: function(A, e, t) {
            var i = this
              , o = this.findMark(A);
            if (o) {
                var n = Object.assign({}, i.marks[A], e)
                  , r = 1
                  , a = 1;
                (new Aa).load(n.URL || n.url, (function(e) {
                    var s = new ro({
                        map: e,
                        color: 16777215,
                        depthTest: !n.alwaysVisible
                    });
                    r = n.useImageSize && s.map && s.map.image && s.map.image.width ? s.map.image.width : n.width,
                    a = n.useImageSize && s.map && s.map.image && s.map.image.width ? s.map.image.height : n.height,
                    o.material = s,
                    o.scale.set(n.scale * r, n.scale * a, 1),
                    n.position.isVector3 ? o.position.copy(n.position) : o.position.set(n.position[0], n.position[1], n.position[2]),
                    o.updateMatrixWorld(),
                    i.viewer.render(),
                    i.marks[A] = n,
                    "function" == typeof t && t(A)
                }
                ), (function() {}
                ), (function(A) {
                    i.dispatchEvent({
                        type: Tc.LOAD_TEXTURE_ERROR,
                        data: "加载材质出错"
                    })
                }
                ))
            }
        },
        resize: function(A, e, t) {
            if (null == A)
                return {
                    data: "未选中mark"
                };
            if (!e || !t)
                return {
                    data: "未指定尺寸"
                };
            Array.isArray(A) || (A = [A]);
            for (var i = null, o = 0; A.length > o; o += 1)
                (i = this.findMark(A[o])) && (i.scale.set(e, t, 1),
                i.updateMatrixWorld(),
                this.viewer.render())
        }
    });
    var Pd = {
        front: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAA8UExURf/////UgCsAAABVqgArgAAAK4DU/wAAAKpVANT//1Wq////1IArAFUAAP//qqr//wAAVdSAK/+qVSuA1JRKhuAAAAEWSURBVHja7ZnbEoIgEEAtK4iu0P//a7dRcYVJZ1jL5pxHd8Y9yAK1VBUAAAAAAAAAAMBUgtnsxz4tzvlknrhcQFcimIbrRcZ8G0vYFcO2SWoRWa2zIYUJeLDd9QKHY5tfdxJ8Jk/3XJiVJhqpS34ZjQKI3j6RYakigAACsFxsfqLl5t+ci2UPpU8CtjuJEUDgzwXc8McRAgiwDBFAgH0AAVYBAgiwD8z75/SXBJrOzdcEQqY/YM08Am3rSgh4oy0Q9au7VpgfLs+y1wbxFxDJXiON7isabmoCIZEo0Ut0agL90b6bkXJeil+cxAL9ZE7UntLFRW8V2ESPLqhWgBDwiV6wqELFm7sRHe26AgAAAAAAAABYFne2vz8kSdzJgQAAAABJRU5ErkJggg==",
        back: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAA/UExURf///1Wq/6pVAAAAVf//qtSAKwBVqgAAACuA1FUAAKr//wAAK4DU/wArgNT///+qVf/UgIArACsAAP//1CtVqjYJRWAAAAEgSURBVHja7ZnpCsIwEAZrNaae8Xr/ZxWRpFGEJrDppzjzr1LouFfJtusAAAAAAAAAAAAAoIb9znsfdM8/HvwLm9XMAoOfIMyQgHLM4/OegNkFBq8VqEyAuUBtAlr1SIVH8ybdLsUCU6GZfUxFFggg0ERgqueatyECCCAgF2ASIvAVAiUHA/dFApfTvwqkI1RQCziRQJracoFeJJDOSOdrI4FP/2ydhX3dekMxJTC0WhlVCziRQJxE5kVQKpDawLoISgXGVUHQCKQL6xwUC6QiMH4fFQuMGz2nmIR5EdiWYbFAdqfTCIw5MA1BuUC2s+slAvmtQSKQcmDaiBUCsS1tJ1GNwDMEvWgUxx9Ur+MYAuH3vQe3UwcAAAAAAADwE9wBUPU3ZdIk2/EAAAAASUVORK5CYII=",
        left: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAA8UExURf//////1IArANT//ysAAKr//wAAVQAAAP/UgABVqgArgNSAK1UAAP//qoDU/wAAK6pVAF6q/yuA1P+qVQ6MhkQAAAEuSURBVHja7ZjJEoIwEAXjCogLwf//Vy1B4sFEQzF5pdV95UDXzCNMxjkAAAAAAAAAAAD4FzaH6k4revv5Ug2sVxqB3X4UOJ5EJWhGgW0tEuhHgeqqDkHnxCFQpbBECJ6vyGQ5IwQQQEAu8PVhKPshTSVSTSW+Eg8Fw1CmLEGvLsEUQ1kJGnUJprlIXwKjsyDk/COdWsBmPM4RMMlhjoBJE7IELJqQJ2DQhDwBgyZkCthfFN9fyPpy01DkRhiGN+ubYkQg/BWtL8uxO7EPMWglAi9NsI1BVODlczEdDeJriTAZmAYxsRfxRUqQWsz0JWKY3Aw1BVKYFBiDaHoWpXdjw9PWyQQen4LoHAgGC3agmbEX8Et2YI6A87VYQLgpRQAB2a4MAAAAAAAAAODnuAFrzi75vcAeswAAAABJRU5ErkJggg==",
        right: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAA/UExURQAAAP//qlUAAAAAVapVAABVqtSAK////wArgNT//6r//4ArAP//1P+qVSuA1FWq/4DU///UgCsAAKpVK1VVAIkZng4AAAE4SURBVHja7dbZEoIwDIXhqEBdwe39n9VlpOiIo6nFo+Pfe8k3zTGpBfExAAAAAAAAAAAAAAAAAAAAAAAAAABSf7gys1oJKOxyGg1gNL7Un8w1gFV7AaWoBbEDaw0gdmA60wCq9gJqzb9gucgUwVcA8bad50UbAAAAfgDwcA29PYXTAN2FNEECKHLt4URAbMDbezgN0DWgDgpA3IKZEugGxGdApgR6AV0AyqAAbLaW7R2SAnCMREdCLCGAGoCn/iCAwrQAV/0BAL76+QHO+rkBrvwNAOipXz4Z1VkBffPno4Dq6pm3VwCuN0AhbcFxA0kAbdXTRzWAqvumBnAOQXkzkD4LOIWgDkLAcRA1QQkIu3XQAu6XEgDJoxQAAABfBWAS/i9ggAMAAAAAAAAAAAAAAAAAAAAAAHAAYMKWUHJ5EqMAAAAASUVORK5CYII=",
        top: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACABAMAAAAxEHz4AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAAAAYUExURf///wAAANSAKwAAVar///+qVSuA1ABVqmCk4p4AAABFSURBVGje7dOxDQAQFEBBkRjg72IgI9i/olSpJCLuBnjdSwkAgLfkmKqAgIDAqcCiC/wb8IKAgIDAzUCJjSbwSwAA4H0D+R0wJ+LbGcwAAAAASUVORK5CYII=",
        bottom: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAA5UExURf///6pVAAAAVar/////1FWq//+qVQAAAABVqoArADwAAP/UgNT/////qgArgIDU/wAAKyuA1NSAKz7z6MUAAADNSURBVHja7dZZEoIwEEVRWg2JOLP/xTqmtBF/LOs1hfdsgGsnJmkaAAAAAAAAAMDkpfyllgACCJhLwGelfmq9ijmiCCDgnwNOFhqwXORsgQH3o9HCAupnLSbgOv5aEBEwfjPpAkoODXgZ/+26VS9BGv5qcYAff68+B/z4u436JPTj73bqu8CP39SX0XD3y2/D8r782oDtfvzM0e2BZ4EFPUjqLmjDXkSHo19+/ZPsUvD490e9CZPxKiaAAAIIIIAAAgiYXgAAAAAAAPiJM0UCIODiZq/rAAAAAElFTkSuQmCC",
        add: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAAG/CAMAAADxZFcvAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABRUExURf////3Xw/vKtf3i1oqPlGms5f/6+EdQWf/IlOPk5faQa0dTlMbIy4pQWcb8/2lweP//y//27P/o5PixlZmPo+Px/2msy4pweOPIlIqs5fSEXoY3FXkAAAXBSURBVHja7dxdcxM3GIDRaNUK2LZQSYW2+f8/tLuZaYbgOLEdb7yvOM+V4YIJOtGXveO7O0nhKr33SZu2jPBmfq2nXFpKKWvTlhG+Kzn1dHXAqbbUarEWvdOK11rOdboe5DIFF0B+N5BMy4SsV/iXas+pGdBbtexfPb/1l2Fq2Ry87XzMecpvmoXVJNzDdMwXz8ZlIUW4m1X1sr2xTw4zezrkXDAZ62wv3Fc1nzsZS7eS7m9NPWsylp6qMdvhZJzOmFrdUrrTnfHkyVVn03DH55vKcICNsTL8GRQZBlBsrhbhe+0DiZKNUXTFMhmhCL1066/d+ERXLLM7fpTDTbUhDrAtZovpqAtqubeYBur5Zy5qMjKRevbBm9m4BFtQDw83zakm/tnGRIw/FU3EgLtiNRHDV354AMPRdID1tLsjRrwrpids3qwJ2dwca8Y62piIUY82EMc62jibxkecPOEWtO+Op/dGI+olo7glDnA+LYevFHZT9KDiAIie+h5gOVX846lzzQCIHnMLfMf4/4UHvwcIIkRBFERBhCiIgiiIEAVREAURoiAKoiBCFERBFESIgiiIgghREAVRECEKoiAKIkRBFERBhCiIgiiIEAVREAVRECEKoiBqLMS29vvpfV6DCBHizRE/QTQTIUKEeNjHtQ+n9+saRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQ4yHWpb/Wftmmv9fOQPxtbaOf5eH/+XUJIkSIryJ+2Q7xG0QzESLEzfpz6Y+1D+P38AvyeQkiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECHEoxLW29mmb/lk7Y6C/rW30s3x9568EgwgRIkSIECHeAHHLdvVF7uXu3YcU4gBBhAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChAgRIkSIECFChLgLxC+n9+8aRIgQIUKEOCDizx5EiIIoiIIIURAFURAhCqIgCiJEQRREQYQoiIIoiBAFURAFEaIgCqIgQhREQRREiIIoiIIIURAFURAhCqIgCqIgQhREQRREiIIoiIIIURAFURAhCqIgCiJEQRREHas92kEMW2I3EmI2GFGbHhGTwYhar4+vLKxhD6XV8RSibl79Tq4ZjujnmuW14Yh+rlnWU8MxAKJNMWTtiZubYviJaD0dAvHpnxSj/MMu+NGQRJ+ITy8cCnLTP1g/HW3CT8TlbwxKsMohYjIVgzU9cxj1QX/0HfFB1sDE3hGPTU/t9o545D7hbBPoVHNk9yuTBTXOqeboR8DJh8NBSi+8T+qJqRi1l64S2bYY+GT6uNTaFiNsiK/c6RPF/Ru+akRx94YnnFwoxjekOIIhxREM16uk0dplpZ/xWdPkwak9lttZLK36jHiH18Oz1S2pe1tKz39TtORuMu5qGtZL3tiuebYz7qTWL356pjYHnD1U+5seCy559tUatz6TzlN540eEJc2eDr/hcWaac7nC+Jfld8HzjDcSnK73dV/lLt33ZH98z31w6nPa4gvbFsk+JW3c1Pu9W7oUrv8AKiG7XScCG+oAAAAASUVORK5CYII=",
        plus: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAAG/BAMAAAA0lLouAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAwUExURf///0dQWYqPlP/6+P3Xw/3i1vvKtePk5faQa0ePy/7x6vm2nfelhopQWYqs5dGJeGZxbd4AAAQxSURBVHja7dhBS9t3GAfwPyQGSbzsuOtewMhhytCLoJVhLwF1K7qDYFdGt8NuuxaEHtZXsNsf1G1UD4O2MNoeCp07dLvsjew1TBPTqEmMgwn9f/t5DklIcvDj8/ye5/ekKERuLLy4V7F4sf1ffM2na+vLGxWL5c7s7cXrAv+YX92rYuXNb2x+ey3k0a3VdlWPV219/fnkbx2ul1XuIc3lZ5O+MnfQrnafrG1MMB4+rv4wuNp4tJkw8PavOI+tr9oJxNpWZ+xRPY4QnkC2xrXMhbIIieaY47iwmnP//Gl0qT5r5xBrI9P1S1kExfyIrlr7IWtVOhzO2KdlFrE5lMbmbtrGO5TGhTKNWL8sms374eLWpWaznUdsXZyNR0VgHF9I4m4i8cJiWOskEuvnVYdFEV6pmXV6oVKbi5nExqBSp4vQGFziDlKJg+n/IJXY6l/ipjqpxEaZfhSL2trZi/1Y4tt+8zqXuN/uPb/KJU73DmOzk0s86zczucL+fpFMLN70do5kYq+l3k8mLmVf305jL30snrTU7mB8kkyc6U6N7WRib9co8ws1OuqnxFY7njgdTWwW8cQCERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERHxfSf+/P2NxnfvAPGLfOLfH9xofPgjIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIuI7RPzoZuPjfxAR/w9iNQIRERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERHxfSc2u7poYj2/RnvETjKx1SUu5hNfRzfT8vRxN5k4k0/c6z5OJRN3uo+NZOKb3onMJ84EXwCmzmzBg7FV9p4fpM+Mfr1Gxlo/m+ndpn+Pi9wWn/dfxfabfrcpilepxIW3xOVU4v347X9wFItiO3kfvpzQqPj8HHEmUlhbOp/RyEodjIzTWE0k3i7HHcyYfrp0ca/6Nb1Oi+JeHvHupcqsxzWcxpBoJY34zVB7SUtj48nweyvpSUxL46gknkzKpLvb05GDvhH0M9VmOfr9x4sxZTpWspVSpn+OvY/O/h5yr9kb/9lBxHH8cumqTxOMRztXfz57XPkc7kxaDD95WOnVsfb12uS/v31nqbrCuYe1a/0j6o8q+jvH3G+L1y/Bz/66u1yxWHn5qBCx8S/INvmwxH9NtQAAAABJRU5ErkJggg==",
        E: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAAG/CAMAAADxZFcvAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAA8UExURf///2lweP3j2P3XxEdwsf/59+P//0dQWYqPlMaPWfvKtfaQa0yPyIrG/fOtkvm6ofeefUdQeKjk//SEXsSGSdUAAAWOSURBVHja7dzLUtswGIBRV6ooOInkkvd/14bplAaSALnrN+dbsepCp7rZngyDpHCVVtuoq1breDW/1HIqKeecdNU2IzyUPLZ8acA6bvxSKdaiG6146WW4x3oxyDTll3/RyN5ecjPw9RIDX1rKAO/WZnFt6XzCZCTvvbKexVhaQdjDdDydsVSzsJ9VtZ20p7XRYaYnxhMmY5kcZ3rbG4+djKVZSfubjDUdRWgadjkZj5lazW7YqeKXJ1eZEEbfGMuCYden1MLwOygyjH+8cbUIUP4MkWF4xTIaoQh9tF6WanxiNCWHmvhH1GJDnO+2WJqxidP+h+FlbTGNdFvcj5iNTKTGfYqTcQm2oO6unL6nmcHZxkSMPxVNxIC74nvEhTEJeEAtjqbhe/dmsbojRpyKbz+58eQ7ZG+egzvWzOBo434R9WgDcV5XRWfT+OfT0dk0aFvH07XRiLop/kf03f4MzqcNYtib4iudDxVncDx11Z/HdV/Bj6eefs8A0Wduge8Y//7w4fcMgghREAVRECEKoiAKIkRBFERBhCiIgiiIEAVREAURoiAKoiBCFERBFESIgiiIgghREAVRECEKoiAKIkRBFERBFESIgnioWutjR61WK4gQIUKECPE+PT09/eqo5XIJESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiB/2c9PDw8PwPYMIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhQoQIESJEiBAhdor40o8Lt1wuH2L8x4B4GPERYnjERzPx9oiX7u82CxEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIc4f0U+gQPQTKGYixLMR/SwYRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECLFDxN+bHq/a8/MzRIgQIUKEGADx+q1WK4gQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIUKECBEiRIgQIX4HREGEKIiCKIgQBVEQBRGiIAqiIAoiREEUREGEKIiCKIgQBVEQBRGiIAqiIEIUREEURIiCKIiCCFEQBVEQIQqiIAoiREEUREGEKIiCKIiCCFEQBVEQIQqiIAoiRHVSerWDGLbMbk6I2WBErUGcE2K1sEZtKrt/CaJuXNmSS4YjZuMW4mg4YrZ9mpkMxwwQbYohS2/c3BTDT0Tr6TwQrafhV9NhaIYk+kTcfganMDf9nceljjbh2p14jjbxJ+KQTcVgjXt2QC/6g03EvccYD1CD74iHpqe6vSMe4KqGJk6Hdr9mQY2zmB58BZy9HI4yDz94OOOLqSAb4kdXiWRbDHwyfT2h2hYjXPM/udNniv0bfmpEsXvDL7xxohjfkOIcDCnOwXCj6KbRZ6Ud8a5pdOvv8o6fjmJJxTvigFeLHUZLamdLaT3+Y7aSqsnY0zTM5ZQtrmSfFHezG06nfj1TSsLYxUo6nfVZ8IbRO8a7z8KxnDmXSl74+OaOk3CcUrnA+JchLXzPeB/BRbvcz32VIa8byNsC1kW+xg+25XWtY9aVG2tdu6VL4foDs7Tqd4OIIHAAAAAASUVORK5CYII=",
        Q: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcQAAAG/CAMAAADxZFcvAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAACcUExURf////aRbP//5WlweP3Xw/3i1kdReEdQWf/6+PvKtajk/2lQWWms5f//y//ksfWPaqhwWYpQWcaPWUePy4rI/+P//0dwqMb////IlOOseEdQlOPk5f/08OPIsMbk9fm3nopwWf/m44qPlP/ky2mPyOPk/4rI5fzbzPeniP7v57fDxqiPeIOsy7Ssn2lwlMaPeIqPeGmPlGlwWcbI5XC3TxwAAAo6SURBVHja7d1rX9pIFMdxAwQSb9FqqbXBGC4mQcRL3/97W0o/ZRVFM7meM/z+z/bB7vYz3545M5NJODgghKhLGEWRT2rNaoRr88uinuvFvV7iklqzGuIDL+lFvaoBUz/MkjjzmIuaiZfFiZv5aa86wSROYvya711xkiRRWEkXdJOMAW0r2WpeTcoS+plLDbY7s7pu5JaqwixmFNtPXJwxTF0IpTAW7I2Rz2JG0KQaFyjGME1Chk7UWtU1LUYvYkUqb6VqVIxe1KMMJRajb7BIidhWCO2MuYsrdJhKBa9vwnyGTKWSNxt5FDEUv7wJMbRAMWNroT69rxBdxkiBYvz5RoQR0pDPdv1hyvjoSLpT0XPY42tZ3OxsiyENUU9bdHctXRkb7ROqFzCZappQP1yhZgkjoyn+R6XoMC7K9hnvz9YyVjX61zYUov5SjClEfV0xpBDVx9u6gBH2GBP182nKHlHjXrH3ho2Tb5V5cxuKjb4FSxsKUenSJgFRf9JXpcjaVP/61Od2lNK8Wp4GjIbWTYbHLtGC9emGLgJR/8qGi4oWrGxY11gwnRL9y1Naot4k/+y45qY3m5bIxW8LQiVaECoRRMJ0SkAkINITCYiE6ZSACCIBkYBIQASRsE8kVCIBEURCTyRUIqESqUQCIgGRgMjChlCJhEokVCKVSKhEQiUSKpFKJCASplMCItMpAZEwnRIQmU4JiAREQk9cJ47j0ejh4WE8fnp66m5luRyPx4vF79+/Z7MZlQgiiCCCuJ3JZLJye3kZmGW5XC4WlnEGIFKJIFKJxfTu7++Pjgbl0u/3F4vv379TiSBSiaYZjUa3t7eDSjOd3tzcUIkggtgy4rMFiFqm07XfoK5Mp1PN3RFECxAdEKnEBtLpdO7vB3Wn37+7u6MSQaQSQbQWcdULj0qfztjeG0G0ANEBEcR68/PnoOkMh/pOcEAEEUQWNp9uLM7OzgZtpN/vHx6CCCKI6/19S4L/HA81OYIIIogg7hZsk3DTGA9BBHGP94kgqq9ECYJ/c319/eMHlQgiiCBqRfz2bSAnw6GKi/4ggggiq9PtXF1dlRv1brf7/Pw83mT1z+XuBVxcXFCJIFKJIGpDPD0teCeq++eF0d2vcHc6nTKvU11eMp02gNgHUdCJab1XYiZ/XhQvsun/IXzTH4AIIogg/p+fptcT+8VegVlfKTdkPD4+BhHEPVnYgKi9Ek9OTs7Pz5u6qH1yYrjfkP6YH0QLEB0QqcRq8s3sAdRwOCy36De/iyX6DBVEEEEE8W8MD76rOUFZt2FLXpUC0QJEB0QQq+mI7Qym4V8eucc2IIJ40PS0Vu0xptGBrdxHUgGI+hGpRCqxfExuKQ6rvpFt+DfoUuidKRBBBBFEwzPMOgbRpCtKPUAFEUQQQTw1OTSp52VBkzsFUl8AB9ECRAdEEJvbX9T2dpLRsY3ITUYAIogg7v10mv+CVI3tyKgxi3yoGIAIIoh7jmiyuq/xsMTo2EjkmQ2IFiC2ubAxmcbqfQpkMq0LfLwfgAgiiHs+nebf6dc9dPkPHUS+qQiiBYgBiFRimeQ/s6z747Hr/T6VCCKVCKJWxPxvQ9V9TmJy/1Tg5VMQQQRxrxc2Rp/GrPsBkMkfRuCH3kC0ANEBkUpsBrHuNkQlgri3lZh/QdjMJ2RyL5UFvlUDIogggggiiCC2vDoF0YJKNHn60wRi7udiVCKIIILIdAoiiCCCSE8EkUoEEUSmUxCpRBCpxLzJfXbK9QwQQQRRVk80+vx2A5euQQQRRBBBLB+Te6e8UAMiiCAqRpT0Qg2IIFq12QfRAkSjt6LkvO7Nd2xABBFEaYgmhySCPkbEpzJBBBFEgYj5v+1WdyfK/yM1df91UtcTQbSgEs1+KErGN8D5SQUQ7ZtOQbQA0eQnFWq87Xli8ks5/H4iiCCCKBDR5Ie2arx8avJ7Cn15B6cg2oHogAhiU0v7Gh/v5/9DDP+c14AIom09EUQrKvHK5NCmnqdAZr8KLfFnoUEEEUR6ouFhST2DmL8ri7wjBSKILSxQ+1WPo9F0LvKhPogggghioXGsdr9t1pAHQpemrW8xQKQSQRSCaPRiTbWDaXJwe/3nqAFEEEEEUTDigdn908ouoea/uS/62BREEEEE8U1bPDNsi4PB3V2Dgtci30oUtNkHEUQQhSAaH9uss1gsihxIr7Y0j4+G/yvRDRFEOxADT8gfxOj24v8HqTc3Rv+X0Sj/jRr5j6BABBFEED+I0VcXX2e5XN58SdnpjEajl5cX4/+61HdoQAQRRBCrPEN9k+fn5/l8xfnrdebz+cPD7e1t4f+q9N0FiLYgOiCC2P4+o86I/PQQiCCCyMIm1+m08UOp2iL15W4QQQSRnpjT8UyCo/SH+YIrEUQ7ENenqGW259UQ3hg+42I6BZFKBNGT+Kdqe5Uq90MZIIIIIojKthp9TY4gWoDogEgl1huz917qcKQSQaQSQbSiEte/Mdri8Y2SxgiiBYgBiFRiM8c3xq+F7ldjDEDUj0glgthYJpPJ/X1bjpcifzURRBDbShzHj4+Pxu9rVzGninYMQAQRRKbTYhmNRi00yHJfIqMSQQQRRNk9cj5/enrqdrtfAHS74/F4Pp/PZoW/0rFmlOnogAhi24gjEJVPp+9Rf21lNpt9dPpzXthR5Mc0HBBBBBHEljIp4Sjw80QgWoAYgAiibseBHY4ggqg6p6dHhR9riWIEEUQQ2WK0z3hagvGYSgQRRBBBrKQxTqf0RBBBBBHEt43xqCjjFEQQWdiACGIlW42Li4u2PxXOdAoiiBIQmU43jt3CmU7b/cFaKtECRCrRglCJFoRKpBIJlUhAJCCCSFjYECqRUIkgEqZTAiJhOqUSCYgERAIiCxtCJRIQCYggEhY2hEokVCKVSKhEQiUSEEEk9ERCJRIQmU4JiAREQk8EkYBI6ImESqQSCZVIQCRMp4RKpBIJlUhAJEynVCIBkYBIQASRsDolVCIBkemUUIkERMJ0SiUSEAmIZFfijR2IapNgpz+9DWLCYGhNFG44GQz9iCkTq9o9fshuH0TSesJXcjHDoTP+K0Sf4dCZNHw1szIcFiDSFFUmfuPGdl/5LpH51IrZdPufiI64W10wYkgUFmK2hcjSRt9O/938ySG48mXNujQZFGXx3iMmlKKy+B8sRnt0RV0dMfpoR8EBqvKOuKs8idg9ov/xzMnaRtGqZlf3i5hQ9UymOx8B9zJGR0eSaHfv49xGR7LPthIJR6g6JtNPp0yftqhhm//Fnr6HonzDL41QFG8Yfb2hR1G6YZ7VJ4r6DVdrVBTVG7LTEBsvMnjW5HNxSmLizOhILQ55Rixwe2j6bzClSptK0wKHom5KMUoqwyQscrAdJilPNaR0w7TwZzLCGEYJydJSty5CN3UZxHbjOn5Y8hGhlwQ+TxnbW874TuJVMP7e6u8C9xlbEoyq+9yXd5AEUY8DgAYT+pGT1PHBtiRIU79Hao6fpgG7dELU5T/XFZ3CKgMgLgAAAABJRU5ErkJggg==",
        downArrow: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAh9JREFUSA21lb0uRUEUhffxEzo3cXkJDyAhUdCT0CkkCk+l0yv0KBQSUXsJf6EgRHHsb86ssc09VyjsZO6eWbPW2rPnnJzbtG07aV20nhofyhkuKeJxLoIw5YRP5d0Iqghbf5nDJb5pJhyQOVlDZAnIRB/+o14d1GJEimgAphOSNRdOJoqeAjVJhokZfuAp+jTsCS/ceEV9YhUja8ATPmLoe8ISTx2wiBuax5wE/IRQISBx47xRBxAVEPtCZjWXdY0VvR6yTJutCzvx3cHijO0cLtt9YX6dUFwVtIMrW7h9t2PnPp2s2WbWJB4dKHSSQdva6u2bne1f24I2PcdTFvNdzJ2LxjkDHxgzEj8WSBtzU7btkxvfXXp8tVNO52QFnBJ7lzb/grlz0dC1byZjz3DbJn8qABNARvj8YecSzk3b+tGKPSDwQYxwFmdtw6/0jj0f4lnsQEUMMwSciiIU806GWcydD+sDBHOnpSIUauiAIiwUpbp3MmI0M2lNuvN8LaG7ET1ALCDjWCydNhoioiu6G3Mt3/S9z6DzwKqL9BrmhwmCeT45rzGGHK7ODnUd/Or/wF/H4Uv3rhtvWn7oyST/1EUSXHcgQbyu387j1RQNDzhWZq61ikVh31x8abVOen0qWEQxJIUEwuAJ0xxur15f0z6xCihHg9p4rD5eUTSSQCcla8ATrkLjirfqAJHIcS5MBhjHUCEwceP8//8PPgE7CQFG2pHOlwAAAABJRU5ErkJggg==",
        upArrow: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAhVJREFUSA2VlTFuFEEQRXswFmQODL4EB0AixEdwTsapyMjhBnYGEgfwJYwdODPC0lCvd15tbc/IQEm9Xf37/1/VPbO70zzPR20Xc0xTDOcFzqniNZcg5tzx58tuBS3C1v/kcIkDzbMANGd2SFbATGzhT+o9wShGZFQDMDtkNhdnJlJPgZGkYWeWD3jGloY98eTWK9oSW4zZAU98ZRh7Yp3nCVjUDfM6dwEfJSwEJLfmkyeAaEDcCs1GLusRS70PWdOxiyR+/NFe3/xqXwDOXrSLT2/bz0irjq2VfoovGqdYbQSWHXfzh3YZwJvF5frsZTuPIreVx16ERbu+Ftht741Zz9U8lNcdjELkJ8ft/ed3vYimy/a+yNh9do35h+/t1c3SuYaYknOa+9/tigbg4hxxoAeggOEm6wkhBhhhyJVEt3d0TG4RGqCR0Bzo8WD4FvVFAASdn9bOx/vmAdci5SRdj4djPEG/87Hz5Y1BbEw84FpkOclpEGw2T0CSx+NV9Fq478W8cuAS8+okj+3rbmt9gjQI9f00tW90x52HgL0ayQ1wf5LQoA2MBuD0wWvKH45gpD1YE5r9Sw7XSH19yICOSv5bjsZGVnp/KqhcjSAa1QBMM2ZzcWYi9f6aCihgHqNi8uBs5cmtV6RhFdTuyW1EXG4aDgVnT4C55JqLaWABOISFyOXWPL/JVagZxBqajVzWI5a6P0EACOseq1UCAAAAAElFTkSuQmCC",
        mouseLeft: "data:image/jpeg;base64, ",
        sxzy: "data:image/png;base64, ",
        wasd: "data:image/png;base64, ",
        fire: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACABAMAAAAxEHz4AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAwUExURUxpce83N/A3N/A3N/E3N+83N/A3N+83N+83N/A3N/A3N/A3N/A3N/E4OPg5Of07O5oTm/gAAAANdFJOUwASa8j1I69UOtmDmOdM2togAAAHLUlEQVRo3rVZbWwURRje2+Z6x/VPawPmoD9OPpWkDYVIINE2UcFGbO8QTDH0R0EEI0hPUhEkJWc4NGj8UQ1+AGmBGCNRoIZIKhGbKGhIzDUpTdDozCZtE3K0s5vQC0k/9s6Z/eje3r2zt4tx/vS2O/PMvM/7vO+8MysI/2Pzv/Put7t377224lDlQ4z2tV59Cst6G1u78z2v41sv3MhlkdGwkn1xZ8LT9Mt7ZcKGynJOlrUfysZv3BsS+EkibN5c5taaNevPSDmGJmVWx1yOf+Rpunicfe704hXHq6qqth1Yua85RyjgaXdmvNSjIqSk3zhuLdnfemWQgiob3SAs7KWTqaeWFcIys9wgiD10/NSeYsL8B6MESZtK8RDcT3uNLgPffUhtU34p4b+vVCTdfovHTgNB8jpHgGNZhEfjfP9QfjJnnQiIUvsfc2J4EOEHfBp8lIDMOcclvi8h6Xe+AZSkdSVYPqyiTISn4EEkvVBK8P79BI9zOtUSNBUvLRQ6zZPgm5CM5NdcSPWEiiZBHi8RfM9VouqAl0AXQCKuom2RDC6BLuAZl/F+kQBLEGU0FncJIGI0WeSILoKfd52yaonUXhiFKfcL0Pgq5LtaxUMesu4lRAqm60ByxANAuYqb7LQQdM/DeMHXWEBjspgV59ZGpD474FTME0AA47v5rJICk0q3AZSO2Sw46xGgWs23oQNQVqn03ZK3aNG7BYJwGU3O/Q57t4ANwhFLV2nvNUiA4HozQ/SgEbjTNieEjrlRoirVw32WOuX4JJqqNK1BnEDsmkw4xoNBQl0en/bWqTgkqWCzQQLV8V1e4kDKWScS7uhICNdzwx5P8wG60APtb4UqRbhzICXioIQJLRxqjL8wgINGQ8bMtcZKgC0kRStEfpTQcNiRzwUgNlquIVviKFgg3qDpEHdzOlQwAGbDZp6ThrRpuJEU1spdauDySk5em9SzUZzrJ63Fha2wGWWEZaUwSTs4gZHQLoRhNYhaDLQRnhOCKX0FTUKZGocjmlnfyd0RQqoOMC6UZU+Cbu5hm8EAgqQyX+NIB0hXhskMx483TWcWtoNa1jNavI0Q0IYB5uNGUAZH47oONRb76hCccuqoBv0pUGqXV+ky0o5M3dQdYNJLkhEhgMBYbGyib00TNjUjOO0yD4oEAgimpg0VzJ3coGlqNADoVUidEW3jYRLCVMshMhyH3syENQqGsYkApb1yMkoBJhIQveM/a8OG95lMQHqtoAAVUCj4etBfuhOlQy0GAJS2QiTNVlEJRYlpeqTT/B3xAFCtWgBisyknKBwnKACQ9I5a5EdosHDdwAWwJDCWEKp1G6D0rAMUm2BGwTBC9GWA70eRckC9UMlLBKNvas7r4AKEdIAYmI1pm9lKRrSQ0Z5GIB2kQSEZVqN7ZfJNbR/nATAlikBx8LERPxtCuT4t9fEAqmksQNFoAqwSZ2O6LjkANRQgwAegIrpvVKUcElk4B1uKNyYDIB0T+4wtjAPQRsYFXwNu5wBMC36zH0dIXWxf1lIzBGAl23lE36CAirsJTOu6461MVcbb5rWxtcXlga4DK0Yq2DOQuKj59Wy6GViJQ/b0MAoVeswBNaSoShTtFOjPgAxErUgqL9ayj0Ujtmxm8Sh1Q0pmQ0WgymO7Yl7ZEbA/2oSoGdJeLBA6JGHjAErKnXTnZ7tYsRBE1QYQIkg6CR68/tTr2SEwpyXy6nIEbe8+o75LAjXOAjUfYJ6KR7gVDqu1xhLA0TYvTYQJeLAuN3ZFUQVUuiCLrSDthE/2SUNB/lQxi4LvurLK8uosXOCY4hqAVBbo3WDZsw4uxc2JkwQqP7bPhUgAvrkKzZlunZ5s7YiZ7hfFOZWyST6t+6FCzWfO6+OdfWcs2Uw/xM17ykpySbBKKXmNYnmfHrvaPQN05dUsdDe+43W8ryHf7jo0G/MIUGE7cFd7t6GT5N98BVvQfY8+GEQzdp969AP1QXfB80lPAJeQPQfQFXm6xxHlQu11EocTKpQKCln3dhsXBBY84PZKlrVXVOmm8B9uJP29wPWnvxERt7dRJ8DJtqjYJQvBXtBcugR5hyuApRxrt/DuzN1egdMlSJ+7YLCDSJzbpQVZNPZ9SYDDKprlXThcJHiyVEwtjCKJ+xVEjJb8xBFoJPgBv8uxLFIcafBfVx2/E/muE6S+7vD+OxUpXziukH2J6ufO/4SMpL+dbdweRTizB+7jv5BFeDJeguVjMsLqJ5AvHt1FX82eK+nnJQpCym9F3/t8HzXQ+TM/uNgxlsgU4Z/Vb9v++cGPUULH97vac5ZItK+c3vt4lc5F1fwjV6IUVZrodxeuvoODtDvOjd367Nr5xSuvsu++tOxTbi9znbJe2qWw78ay2dhw9VTcfdIU5i/vycl5FyBy7td+j5ffrV/fwLmsNn8uO/zsee8FhPDygd2vrj/zx5efrt17aDO3178lRAH9e0KtGQAAAABJRU5ErkJggg==",
        in: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACABAMAAAAxEHz4AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAtUExURUxpcRv7KSD/MBr6KRv6Kxn6KBn6KRr6KRr6KBj3KBr7KRj3KBr6KRr6Khr6KbH1JwQAAAAOdFJOUwCPEO8wd7/PWCCvQN+ffgtVrQAABJxJREFUaN6lWd1LFFEUHwctvwIrCnyRkRIhLCJSKmOwTAr6QNPIyGSp7MOHfdiKPhAxTBBEWYiCoAeJfFQMEgtKAh96kwi0N2Fbd01d79/Q7r2zO3dm7j33zMx50rlzfvs75545555zNU0q+oWOlfsDP/unl79qAUSfe0QKkpma9as+wqlTmWrxo183SDySqcbrfzKJSB5g6V8nEknEMfoVewkJg6AD+oRsKhH0YQJKQgUwz72cfLGve+zL6LUVHuEErF9rv9nUFbejImo/fw7plxb2L91lOFbmbIh2wAGr+ZeeeOKurKeALQd4mzf+o2j1ex7huDQCliz9aoWDZEZ0Wvo3ZL9QYgGk4B94KLfxsPVKROjBGbb4DNqmS4AfD7G1RgMMlF72VkywxLYwOQRHWjFz9Lp3pUjpAAfRiIRbylB+rr1iL5SgDKDRwihUuR4PYz41Jlfoq/9cvjGxBPLvEufXUg8HuVNe05ePOZ7V4AlkKXjdWIr3QE4WPJ8Us2AIC8A2Ys1tQUJDy4QrGpkFH/AA5S7G1IKMgQfQl5z7QC1o9lN9aTBtF/KlqUi2stzUwv/nx4Ks0Po/af1zQBDbqFDY4D/QKn8A5ZwT9JwLknF/ADp1Qtx2gShT6+2qvPKL/tmQ+/OkKHsBRUw7YjthQrKJ2TwfkQMU2bwPnsuKIUyfaYUTMqCbZmQliCsDcVX+TiucAG3+jLwKUqnMLR9VJl85hVJ3UhFnPjkFHSj0OAo5Gze1EBRy8ZPUQlCg2zAbgkKlOg3BFHbxOSUIhVJVIKgolOXW/mrBKeiqSFJSMBGpFKQQVYWiikKNKhRVFHopQMduWKJyChN0wSQoiUgA1rEAaQlABgsgorBAP0csQFq8Q3iAdSMkQExsAtoHAgIUAL0LMek24gJJRMAKJNzJOiYPZYW0ygnQ6rgdggAtDIkQBLQldUIBCej8QS0IgWI1AEiAHc5+BCfAjoqR4ARYaasKToDl26HgBGggJo3gBGgcpUMQoEfsVAgCJaomIQoT0HZ421fN2w3LCbBNgHZRHwQJsPM+PSK9y4mYAkCA+nAdPu4PQgS4NkXacNQDBFintqFoeX6rWp5JOzH4brpM7phZY/dPaKEdzyZ/Zl3zB0Abzy3+yJnxBxDlj6k6Cdh8zzr6J182tDrafxYJfmygYc59SRVEmR9Fk7t2V4eWwgPQKEpzcdpAlN2Hd/y8BQ6GEPWiytNlJluQozDTbUHeBuQw7r1gGMdswFGwxqpDovlaM94DCfHQGjMSNYUjUWsqjIgFNkDfNoRdoKoPtKfjMVkhybTgBtOCbLmTIIzQO+X3JLp1PfYYApgnQMW0huNkj1y/1jpZ34aG3kDBq7P0EwY49JYi5PXl2e98HkF4yXLGVN9VzeQR+jwk7TvAdFyVbGnN6HKutN0pXKBdhbbpst2jnLpp/3rbH/v5XTjSvvGXpNPdY58vjo7sX+QeNhqYfAm0j8oibN+3CfURKad4NZx+Vnpk+k3IrKuNi/X78IeQN4J2NNnlp/qWjbsgkn1n/R0gNP0ld32e8a1OZfTWvYHF00/7l18BwfMfTNVTTzWqIHcAAAAASUVORK5CYII=",
        info: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACABAMAAAAxEHz4AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAwUExURUxpcf7mEf7nEf/kEv3nEP7mEf7mEf/lEP/mEf/lEf/mEf7mEf/mEv/0E//wE//rEpC4kPUAAAAMdFJOUwCX9BLfyrAnUj5ogEU6k00AAAabSURBVGje1VlbbBRVGJ5mE3rhpa1WVKRNGw0K9ELkIvjUG0Rt0ZSIEWiVqpVLWhssqZeXikWrTaxirSQ0sQQJgqQ2EAk+WJMmJEpmZ0IDfdp102a3IWU7mzSaCM7uuuc/c2ZnZ/4zl+2T52mzZ853/sv3/+f8/xEE/vBtHSypq2g8cuFpIZuR/3lJQ12FKIoVDQ1HPqvxunzrmRZFUZJqCkBOKkpszy/eIE63xGOiYciLc7Ufu1+e+3NlxnKASIQPuRUir31RFa1DCuzrdrV++2shER3yYq0bhO1tMZE3lHJnhLy2qGHPJBkGhPh6J4T8d9LrE8FoRWpsiAfTMsWft1/vuxxgmytKY8e1b3t7e0+d6WhSdAjlkC3ACWY/aXrHD2lpn/moTnfM9BWb9c9KbJ+/H850+tarVZoQ8m2+GXLbVE382q8tkx+0aNL513EB+qkB5NhejHP5xQpFiE1w1hdU0Q8CBzkCPkhlkOc5SpRSBWIHuSoWUwT/TnQ6J+ToacaSW19iFOik6OV2MVfQDFL6n0PmtoAF5UifLVE2UkeHERGoAMoDDlw/DvtIVhFy6MQ6x1RJuRK2OGIN3zomJWKoIwro36+4SBiTIMJtk61Pwr8zbrLeSkgQ/sJMiuyCP99wlfMuQbJfyPhvc8C1ACl1ZfKxmmGuSRBgt5W8gx2rrYE5TkSQjF/ny5hdSIKXgqHHV1msABa/adSAUFyyhIivLJTaK3nLQs5S0MHw96/kjzkLBzbT8JJumCdWEJNJ9WkNqq1mTbMbgaZOmzUBFloswE4Eq3WBNks67hCwuAYVFMYdixlhy9eZrdqIBk8K6DYw5i3mhSW/M2JErdTUBaPhX4OCR4xOtH4j/KYD/NWNRj9z5Dj5ZgFJsjrAksXDPuIHv2YEoo//JW8AsKv8R9pbKpIKJ21UoHrPp701j0TdTzZGFAqACQB8NPVT/gcB+E4HiCCnACg+wSSVEBNQKWHcRWbH9ZAmUNIYlrsYE6W1yOwmIvg9FklhLBf5WtldBzuOgQmzbJ9ZNHed1I77GfSAIBtHajRN7+GHSCtYIYSfVkT1pT7qBGk35xBpVpJKaC/nfNDccAmPJO1eU1K34xonV4+qNKI7NUl4RQc31RPd5bVUlbDnekJzg/wUNeZ8NiVNAaVYXhSPZRdVxYvkMKPp6E42AJAS5oUcYoqdWZVlXSTQwZZoKAnCqQE28GsHCacpoSeaTk2mUaYXOzhNvgCAYZULsCYp0xHHAYYAoJ/wCb/86jmRQ1QSBFPCZRVPiC4AiPmmhGIVTbpuAFYAQIueG7MEaFoGQIAAbPj/AyzbBvuXC9AuLpMHy2bi9+SEGssKoEfVo7EwK4BR1SEfOAHQfLAparjweQOgGYmY0nDr9QIwCTlxZdRwY/QG0AZ3F5tzwQEA0voMrTVmswGAM+0mvSzhZ6MDALmZEOU7ucHgAEBCgZzOcEmbyAIAbib19N6NM8kBYEibgeva2iwAurTrYQ7Xj/YAUDeRIh6IEPEOUMBu28AHNKXYA8D18D7TBf3EHmBUt90oz4r2AOl9QZZZrwBAZJoL4bKM1CT2AFCmRNL+wL6xBYC6byH9YerG6A2gy1B+E1KLM94AoFJjIQSlQ3LME8AmY7GaWy2iedEOoDSjlIL+w4wXAKpBfYY8ap8HANozGcuIC2tpZgPQaaomW9EmDh+AnAUZngdWWC60fIDjqikPApvlu24B8qvMEkNut9SXnawVvWgC6IlauHsU/rqf+d058sySGnMvZ5Ist1nUC2/dD9DxUU1s3Hbxx6Ki1RcvmKx7LIDwBpoN8g1XtRIIYK5Vac8oMeECYDiAdbcorDzr4gkHXGC2l2ZZMfG2I8DlKC5r/i7a1u1zWL8FfCsjPY1hQJbW21fBea3cloQmQvxV22KzLMoTgFlXnFtlA9Af4/dENEeI8q2z3PUjCVpH/otPH9M6oBEewleVtEE4N8ZRUHvikCLn0ekRbb2fayb2yCKFH0E0PCdpb0A2/etvtJcgeXqfuR393puK1uCctuG777Eoeyi7/ui7xri8Wq2w1zZbP+c1sz5qItBweAAwfO8PlNQF2f9+B6ZtrNQ7sQkl+cSeA0UPvdWUTL/VSRGnJ4wRyfBcmlCCwaBieHCUwmOO0XYirnJfPKXwFRcJ4xOJh5BwtT6lRSX+6hq/ftZle+bD/YpVCClU3ie4HdtK/LFMiKQSPtztpUc02F71p2p4vp164bzXRtfpjroKNhoPfMqjz38rjJflJpP4HwAAAABJRU5ErkJggg==",
        wall: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAMAAAD04JH5AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABOUExURUxpcf2oAP+oAP2oAP6mAP6oAP+pAP+nAP+tAP2oAP2oAP+vAP+oAP2nAP+nAP2nAP6oAP+pAP+nAP6oAP+qAP+oAP+yAP+uAP+rAP+wAGKXuTAAAAAVdFJOUwCPScm8hTVXCd2aDx/4e5RqFWPuQojXR7cAAAHpSURBVHja7ZrZboMwEEUBsxoaJ0CM/f8/2qosyZO5do2sVPc8R5MTFuvOTLKMENI++kuABebuEsoWFSj0cgFa4AL2eQELBT5RwMQhXOArDqECi6ijcDehAmWcg7VYb0LIFWijCDQUoAAFKEABClAgVMBGygPzKmBF5n0FitlF0WAovdJhAWpAU7HpVI5RrXQTwleOpmLvOyQ0kKAXrdArsJS91/e3AiprcwrgAp7HhIcANB/Qh0AL0Qt3WfMSACckQq6oCkO4y00vgfaB0Oe/v8hqNWCclJP2EACp9Pos3OKc2CpYoIojIClAAQpQgAIUoIC3wG3N+TZSHsj1ITDcEcZyG4aXI8ZJvXI5BBptAfTeOqI94uQua95juUHys3drxs6IrZm3gDl5C9CG5GjNoJdLHgJmKp1IsCWT68dFVyKIOz4lw5rS9udYCVtexxrTcWtGAQpQgAIUoEBygSL11qyw27/pMk8BM0nlorphyH0e7i63IZu3UKqdiBlaw831Fk6FhpB4LGdr9p8FUrfn2NZs/7ffXGBM7qd/eQkMFfSK7yOafXv2N5QwiYdUlU48psspQAEKUIACFKBAaoHwPJA6kDyxKfgpnQkVMDYKb1szT4G4UOCzBMwF6OQCEhaox+YCxjojJDXf4uSKYGN3ygkAAAAASUVORK5CYII=",
        window: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACABAMAAAAxEHz4AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAVUExURUxpcSyV3S2U3SyV3C2U3C2U3S+Z4+9tYbwAAAAGdFJOUwDEcEWk8vaFTOAAAAHnSURBVGje7ZnLVsIwEIaD4QG42K4LR7oOVFyjgmsvNPtKM+//COZCrBsmYwMePeZfkCwyH38n0/Z0wlhSkhav4sSWECXFsmiA8nPpR0mI86NxsN9aSbi24z2ocUgZNC4oN4CRy+YTCDteQRPM/ADe3aT8AsgT4KyAYP0ucYCqg8IBhErEAQRJPAfzkBapkP4MgM/N76roDVjDRlNk2xfAJTwbiuoLWIN2oCl9HejQRhjKqCdAh04tpecuuNATBigAG3rKAAWQYwZoAMQABbDADJCSWCAGyKV8ygC5lJuouxExQC7lqOcBZoBeyhEA1AC5lOMAIxRwCF5CE/lU5oLFObj4i+WQAPCWHCQH53CQAAmQAAmQAAnwg4BtSDscQOkjYQClCISLOgAVm4NUSAnwSwCEpmzkzaRwgIy9GyH2eRDOweycu7DrAMUR0H7r49vvCPc9jwEBMPRrntTn+qFPzJ2nYwd0oMRxNIHWegmy6XqxIUlnd6DzpQNe/eZNXfumCANK03BlPDcfXyXARKxypetHPVQ3krAJ9oL3gu9M41fPJdS6+Fr931B3NYIr12v14tYdslltuCthJRjNgg2yG28DdSLc2eUjI2nmk2b671ldT8zkNoMXYrxePB53a6ujbV4J9v/0Aa21qAtzThtwAAAAAElFTkSuQmCC",
        kitchen: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACABAMAAAAxEHz4AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAqUExURUxpcfTqKvXrKu/vMPXqKfTqKfTqKvTqK/LqKvPnKO/nKPTrK/TqKvTqKgvPVicAAAANdFJOUwCfrxB3x+8wWUAgj9+fNmOEAAADXElEQVRo3u1YzWsTQRRP3ZTdND1YqN4K2oN6ERbBaNFCSls/GxA/EDQLRStWaKBQ9KTgoYKggRx6VMhFEEQQ/ECQgBcPCgumbbb24/0vzm6aNDM7M29eQ724v1NmZt8v8/He772ZVCpBggT/AKcWvw1eqOza3JosQYjb1d3ZjxyBbTTGd2N/pgQ7OEq3z3jQiQ/k9deahvdu+M0fT4kEL0OjrYsL7OdiNJfGPMk+Hf37QrNhT4WtdRJBgVnMuO3mM+oisuKcQ8JVwg4OAQTjYg/kjWyXPhfnfrCvb/L9DvOKreLc1UHEsU8fbDmf6L6PWh5xTGf/ru19t8Qhuz1Urxp471b8o/YUYFN5+Dve/ys+ujMF1XlEO33n/IL19sVhVza/4U/Px4oRwxUpwRs2ct3FjmnJk21xNEU/dnZS2CHDfckA26SfRm7msH8K4qFlefKJKRz9e6z3BMBHQqg1Yp01QrBk2BT2x/sIqvUaYE3o6oWGS9IbcQ1leEARnOMxffHMor2FUfEcHFimauYfrqNHaKO640Od6+iHuzTZr0HAtZ/AIRoB24QK71vEzNMv+I0XuDSCrHAMfoOY+hyA6c62WucU6ANY4ZqrRAILYKNTZYhuwFDism2GTuBzJg55CQKBTSfgCwaLGEvRKWx0RWDzx8hWRPTEtJCeakAsaPcJslqOqSyCnKBpo9yWGKAMUOWjs04j8ARZdgRCg2DkPccq0TahF0QNrNEq0UKs6MvJMrY6OZZAlDAHKLqck9RJHpirGqsl4JrY+V7Sp8JjVqJUZDnfUNozPsgEqACGNY71RV54h5WPibBZr1TFangn2ESDMjPJPgvyqsoHveA1L3Oz8sGHBtezIe0FLFyEPk33hV8EyousFTKsYAVecEnzwRROoL9Is5D4jRCspBIClGAaIdjYWwJ7YiKP5FRiBkoI9oRg7X8gGLk8IIO7rYkoAfeK14GqIYHwikcnOAfdEWRKXRKcDF/xhmVoEayj1dOMq81MegJW7mmLLZTAQV79UII0oroWRtCjeqUyJch2S5BGZB0NJgcptBxMkSzQH2MOWWJUA83qIw15bjrLXHl5QIED4TOci79yaYHWogWEAH0ws32t/Qx+Qe3R2RuV487YsApf51MJEiTYI/wFfnAD3ltxHQAAAAAASUVORK5CYII=",
        livingRoom: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIEAAACABAMAAADe0hfGAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUxpcRQgeBMiehQiexIgeRAggBIieRIiehMjehMiehMjeRMheRMieiZedJ0AAAAMdFJOUwBA748mEHTYYKlQvyvHdt4AAAL1SURBVGje7ZjNaxNBGMY32k3SrYcEQaH0ICJGZQ+lUiu0Bz+IQchBUCJqDoIUkeZQelACe8jNiwdtsRLMwYs3D6JUQbxkYxNj5o9yPnZ2Zmc3OzMbEIrzXHaf3Znfzryzw7wzlmVkZPTvdO+O4K/p1b+1A0C7w3zjS9RLddIFSMvU3xS8VHdJBTAKWp4PvP8hpdKp7y+g3uB7uwcCDZP9S1S2vZn4VdzO0yAU9jXm3yJ/O2hRJC70K6MSo9FSom9Q/4cD5FmZvXf4Urmy5QYeXyv7zzzsu2sh0OcGuAAETeDLouBznljqMSM0hVc+fveAeRy1eZHwmhGWUAi63TDml8jjDeovCP5i9z3qyxlG+ERilOfajJRzo37OY//JfIwwYBGdlMII4yqTzSTviQQyNM66V9nnQuxsxf23Ku1SlPBLd/IagiEYgiEcKQKo7JXUqz9c33FjBJ38IMgnGIGuZ75ilhLmFzRTslfoWjRQAsx5wtrGrY9gW4Vwg5XvCMshXI5UmsDlE32WPPjtNXFBn6ZHuPzXXZZCoEaNPsIVDXVP4bdoobbCla8Rdhuu+f4qujkOn4ylANulg1YLMiH0ZMjo0tQVdfocufVI4NCTA/JkQSUQBVaoTr5YYCmVHc0qklVnXS0S2Amu8z2FULZYGmiTXKoehgG/7SsQwq94eDCWuNQSzrDfMkKP6ymZ4a84ZpNrTwrhM9eeQ33Cz/+DIJsYticjyCYGmgQSwqCcpsVeOuEYUNLydMKCGqEzneAoAdjuKE5AQyXX0Eoh3NcKQxLBeirvww8rlWDlyhJVLQlBS4ZgCIZgCIZwhAj9rIQNShhnBKB8hhDAajYAOo49DHaK/tksCnaMTTCTthNOWPUEdwe5mQB409qahYD3rEU3OyA4f3WewCRxfFlT8F8YXK3Ocv7QE08PhjMTfE2AEzttBufLOlpciRKamf9HzYx8emoaP9NXUyk60fUVOXOpZSEcRAZnVx/wXBjf62VNVS0jowT9BdaXVla6cjkQAAAAAElFTkSuQmCC",
        skyBoxLeft: "data:image/jpeg;base64, ",
        skyBoxRight: "data:image/jpeg;base64, ",
        skyBoxBack: "data:image/jpeg;base64, ",
        skyBoxFront: "data:image/jpeg;base64, ",
        skyBoxUp: "data:image/jpeg;base64, ",
        skyBoxDown: "data:image/jpeg;base64, "
    }
      , qd = new bh
      , jd = function() {
        var A = "Success"
          , e = ""
          , t = ""
          , i = !1
          , o = 0
          , n = null;
        return function(r, a, s) {
            return 5 === r ? document.querySelector(".loading").classList.add("hide") : A = r,
            "error" === r && (i = !1),
            void 0 !== a && (e = a,
            void 0 !== s && (i = s)),
            5e3 > (new Date).getTime() - o ? e !== t && (n = qd.notify(A, {
                size: "mini",
                rounded: !0,
                position: "center top",
                sound: !1,
                delay: i,
                msg: e
            }),
            o = (new Date).getTime(),
            n.$el.childNodes[1].childNodes[0].title = e) : (n = qd.notify(A, {
                size: "mini",
                rounded: !0,
                position: "center top",
                sound: !1,
                delay: i,
                msg: e
            }),
            o = (new Date).getTime(),
            n.$el.childNodes[1].childNodes[0].title = e),
            t = e,
            n
        }
    }()
      , Hd = function(A, e) {
        var t = A.toolId
          , i = A.Flag
          , o = A.viewer
          , n = e.toolbarTop
          , r = function(A) {
            var e = o.viewerImpl.getBoundingBoxByIds([A]);
            return e.max.distanceTo(e.min) / 10
        }
          , a = this;
        this.deleteListener = null,
        this.addListener = null,
        this.updateListener = null,
        this.imageSize = 100;
        var s = qd.window({
            title: "标签",
            id: "markWindow" + t,
            width: 356,
            height: 848,
            closeOnEsc: !1,
            closeButton: !0,
            afterWindowHide: function() {
                var A = document.getElementById("mark" + t);
                i.mark = !1,
                A && (A.style.backgroundColor = "",
                A.querySelector(".yj-icon").className = "yj-icon label-icon"),
                document.getElementById("markColorModal" + t) && (document.getElementById("markColorModal" + t).style.display = "none"),
                o.viewerImpl.cameraControl.dispatchEvent(Rc.ON_CAMERA_CHANGE)
            },
            content: '<div class="mark"><div class="first-floor"><table><tr><td style="font-size: 14px;ling-height:28px ">标签类型:</td><td><select><option value="dom">文字标签</option><option value="sprite">精灵标签</option></select></td></tr></table></div><div class="second-floor dom " style="border: none"><table><tr><td style="font-size: 14px;ling-height:28px ">标签样式:</td></tr><tr><td>标题:</td><td><input class="title" type="text"/></td></tr><tr><td>背景色:</td><td><div style=" width:56px;height:28px;background: rgba(0,0,0,0.20);"><input style="display:none" class="markColorInput"/><div  class="colorRect" style="width: 16px; height: 16px;background-color:#FF0000;display:inline-block;margin:6px;"></div><button class="showColorModal" style="width:28px;height:28px;background-color:rgba(0,0,0,0);display: inline-block;border:none;position: relative;"><img style="position:absolute;left:2px;top:2px;" src=' + Pd.downArrow + ' /></button></div></td></tr><tr><td colspan="2">标签位置(点击模型获取):</td></tr><tr><td><label>X:</label></td><td><input class="startX" type="text"/></td></tr><tr><td><label>Y:</label></td><td><input class="startY" type="text"/></td></tr><tr><td><label>Z:</label></td><td><input class="startZ" type="text"/></td></tr><tr><td>构件:</td><td><input class="component" type="text" disabled/></td></tr><tr><td title="用于添加标签的备注，表现形式为文本编辑框">备注栏数:</td><td><input class="text-tab" type="text"/></td></tr></table></div><div class="second-floor sprite" style="display: none;border: none;"><table><tr><td style="font-size: 14px;ling-height:28px ">标签样式:</td></tr><tr><td>图标选择:</td><td><div class="picture"><div class="chosed-pic" data-chosed-url=' + Pd.fire + " ><img src=" + Pd.fire + ' /><button class="show-pic-list" style="width:28px;height:28px;background-color:rgba(0,0,0,0);display: inline-block;border:none;position: relative;"><img style="position:absolute;left:2px;top:2px;" src=' + Pd.downArrow + ' /></button></div><ul style="display: none;" class="pic-list"><li><img src=' + Pd.fire + " /></li><li><img src=" + Pd.in + " /></li><li><img src=" + Pd.info + " /></li><li><img src=" + Pd.wall + " /></li><li><img src=" + Pd.window + " /></li><li><img src=" + Pd.livingRoom + " /></li><li><img src=" + Pd.kitchen + ' /></li></ul></div></td></tr><tr><td>标签大小:</td><td><input class="size" type="text" placeholder="请输入图标缩放比例(默认为1)"/></td></tr><tr><td  colspan="2">标签位置(点击模型获取):</td></tr><tr><td>X:</td><td><input class="startX" type="text"/></td></tr><tr><td>Y:</td><td><input class="startY" type="text"/></td></tr><tr><td>Z:</td><td><input class="startZ" type="text"/></td></tr><tr><td>构件:</td><td><input class="component" type="text" disabled/></td></tr></table></div><div class="second-floor plane" style="display: none;border: none;"><table><tr><td style="font-size: 14px;ling-height:28px ">标签样式:</td></tr><tr><td>图标选择:</td><td><div class="picture"><div class="chosed-pic" data-chosed-url=' + Pd.fire + " ><img src=" + Pd.fire + ' /><button class="show-pic-list" style="width:28px;height:28px;background-color:rgba(0,0,0,0);display: inline-block;border:none;position: relative;"><img style="position:absolute;left:2px;top:2px;" src=' + Pd.downArrow + ' /></button></div><ul style="display: none;" class="pic-list"><li><img src=' + Pd.fire + " /></li><li><img src=" + Pd.in + " /></li><li><img src=" + Pd.info + " /></li><li><img src=" + Pd.wall + " /></li><li><img src=" + Pd.window + " /></li><li><img src=" + Pd.livingRoom + " /></li><li><img src=" + Pd.kitchen + ' /></li></ul></div></td></tr><tr><td>标签大小:</td><td><input class="size" type="text" placeholder="请输入图标缩放比例(默认为1)"/></td></tr><tr><td  colspan="2">标签位置(点击模型获取):</td></tr><tr><td>X:</td><td><input class="startX" type="text"/></td></tr><tr><td>Y:</td><td><input class="startY" type="text"/></td></tr><tr><td>Z:</td><td><input class="startZ" type="text"/></td></tr><tr><td>构件:</td><td><input class="component" type="text" disabled/></td></tr><tr style=\'display: none\'><td>标签所在面:</td><td class=\'face\'><input type="text"/></td></tr></table></div><div class="third-floor"><button class="addMark" style="margin-right:7px;">添加标签</button><button class="showList" style="margin-left:7px;">展示标签列表</button></div><div class="forth-floor" style="display: none;"><span style="font-size: 14px;ling-height:28px " ">标签列表:</span><div class="tables"><table class="dom"><thead><tr><td colspan="6">文字标签列表</td></tr></thead><tbody></tbody></table><table class="sprite"><thead><tr><td colspan="6">精灵标签列表</td></tr></thead><tbody></tbody></table></div></div></div>'
        });
        s.$el.addClass("markWindow");
        var l = function(A) {
            if (A.intersectInfo) {
                var e = ""
                  , i = function A(e) {
                    if (e.intersectInfo) {
                        o.viewerImpl.modelManager.removeEventListener(Rc.ON_CLICK_PICK, A);
                        var t = o.viewerImpl.camera
                          , i = e.intersectInfo.point.clone()
                          , n = t.position.clone()
                          , r = i.clone().sub(n)
                          , a = r.length()
                          , s = o.viewerImpl.getBoundingBoxByIds([e.intersectInfo.selectedObjectId])
                          , l = new CA(n,i.sub(n).normalize()).intersectBox(s)
                          , c = Math.min(s.max.x - l.x, l.x - s.min.x)
                          , h = Math.min(s.max.y - l.y, l.y - s.min.y)
                          , d = Math.min(s.max.z - l.z, l.z - s.min.z)
                          , p = Math.min(c, h, d);
                        return {
                            point: e.intersectInfo.point,
                            distance: a,
                            face: p === c ? "x" : p === h ? "y" : "z",
                            eye: r,
                            box: s
                        }
                    }
                }(A)
                  , n = document.getElementById("updateMark" + t);
                xh.hasClass(n, "hide") ? (e = s.$el.querySelector(".mark .first-floor select").value,
                s.$el.querySelector(".mark ." + e + " .startX ").value = A.intersectInfo.point.x,
                s.$el.querySelector(".mark ." + e + " .startY ").value = A.intersectInfo.point.y,
                s.$el.querySelector(".mark ." + e + " .startZ ").value = A.intersectInfo.point.z,
                s.$el.querySelector(".mark ." + e + " .component ").value = A.intersectInfo.selectedObjectId,
                "plane" === e && (s.$el.querySelector(".mark ." + e + "  .face ").value = i.face)) : (e = "block" === n.querySelector(".dom").style.display ? "dom" : "block" === n.querySelector(".sprite").style.display ? "sprite" : "plane",
                n.querySelector("." + e + "  .startX ").value = A.intersectInfo.point.x,
                n.querySelector("." + e + "  .startY ").value = A.intersectInfo.point.y,
                n.querySelector("." + e + "  .startZ ").value = A.intersectInfo.point.z,
                n.querySelector("." + e + "  .component ").value = A.intersectInfo.selectedObjectId,
                "plane" === e && (n.querySelector("." + e + "  .face ").value = i.face))
            }
        }
          , c = new Od(o.viewerImpl)
          , h = new Gd(o.viewerImpl)
          , d = new Vd(o.viewerImpl)
          , p = s.$el.querySelector(".mark .dom .markColorInput")
          , g = new Hh(p,{
            hasOpacity: !1
        });
        p.value = "rgb(255,0,0)";
        var u = g.element;
        u.id = "markColorModal" + t,
        u.className = "markColorModal",
        document.getElementById("mark" + t).parentNode.appendChild(u);
        var f = qd.prompt({
            title: "修改标签",
            id: "updateMark" + t,
            width: 356,
            height: 400,
            closeOnEsc: !1,
            closeButton: !1,
            buttons: {
                ok: {
                    class: "lobibox-btn lobibox-btn-default",
                    text: "确定",
                    closeOnClick: !0
                },
                cancel: {
                    class: "lobibox-btn lobibox-btn-cancel",
                    text: "取消",
                    closeOnClick: !0
                }
            },
            content: '<div class="updateMarkPrompt"><div class="dom "><div style="margin-left:10px;"><table><tr><td>标签id:</td><td><input class="markId" type="text" disabled/></td></tr><tr><td>标题:</td><td><input class="title" type="text"/></td></tr><tr><td>背景色:</td><td><div style=" width:56px;height:28px;background: rgba(0,0,0,0.20);"><input style="display:none" class="markColorInput"/><div  class="colorRect" style="width: 16px; height: 16px;background-color:#FF0000;display:inline-block;margin:6px;"></div><button class="showColorModal" style="width:28px;height:28px;background-color:rgba(0,0,0,0);display: inline-block;border:none;outline: none;position: relative;"><img style="position:absolute;left:2px;top:2px;" src=' + Pd.downArrow + ' /></button></div></td></tr><tr><td colspan="2">标签位置(点击模型获取):</td></tr><tr><td><label>X:</label></td><td><input class="startX" type="text"/></td></tr><tr><td><label>Y:</label></td><td><input class="startY" type="text"/></td></tr><tr><td><label>Z:</label></td><td><input class="startZ" type="text"/></td></tr><tr><td>构件:</td><td><input class="component" type="text" disabled/></td></tr><tr><td title="用于添加标签的备注，表现形式为文本编辑框">备注栏数:</td><td><input class="text-tab" type="text"/></td></tr></table></div></div><div class="sprite"><div style="margin-left:10px;"><table><tr><td>标签id:</td><td><input class="markId" type="text" disabled/></td></tr><tr><td>图标选择:</td><td><div class="picture"><div class="chosed-pic" data-chosed-url=' + Pd.fire + "><img src=" + Pd.fire + ' /><button class="show-pic-list" style="width:28px;height:28px;background-color:rgba(0,0,0,0);display: inline-block;border:none;position: relative;"><img style="position:absolute;left:2px;top:2px;" src=' + Pd.downArrow + ' /></button></div><ul style="display: none;" class="pic-list"><li><img src=' + Pd.fire + " /></li><li><img src=" + Pd.in + " /></li><li><img src=" + Pd.info + " /></li><li><img src=" + Pd.wall + " /></li><li><img src=" + Pd.window + " /></li><li><img src=" + Pd.livingRoom + " /></li><li><img src=" + Pd.kitchen + ' /></li></ul></div></td></tr><tr><td>标签大小:</td><td><input class="size" type="text" placeholder="请输入图标缩放比例(默认为1)"/></td></tr></tr><tr><td colspan="2">标签位置(点击模型获取):</td></tr><tr><td>X:</td><td><input class="startX" type="text"/></td></tr><tr><td>Y:</td><td><input class="startY" type="text"/></td></tr><tr><td>Z:</td><td><input class="startZ" type="text"/></td></tr><tr><td>构件:</td><td><input class="component" type="text" disabled/></td></tr></table></div></div><div class="plane"><div style="margin-left:10px;"><table><tr><td>标签id:</td><td><input class="markId" type="text" disabled/></td></tr><tr><td>图标选择:</td><td><div class="picture"><div class="chosed-pic" data-chosed-url=' + Pd.fire + " ><img src=" + Pd.fire + ' /><button class="show-pic-list" style="width:28px;height:28px;background-color:rgba(0,0,0,0);display: inline-block;border:none;position: relative;"><img style="position:absolute;left:2px;top:2px;" src=' + Pd.downArrow + ' /></button></div><ul style="display: none;" class="pic-list"><li><img src=' + Pd.fire + " /></li><li><img src=" + Pd.in + " /></li><li><img src=" + Pd.info + " /></li><li><img src=" + Pd.wall + " /></li><li><img src=" + Pd.window + " /></li><li><img src=" + Pd.livingRoom + " /></li><li><img src=" + Pd.kitchen + ' /></li></ul></div></td></tr><tr><td>标签大小:</td><td><input class="size" type="text" placeholder="请输入图标缩放比例(默认为1)"/></td></tr></tr><tr><td colspan="2">标签位置(点击模型获取):</td></tr><tr><td>X:</td><td><input class="startX" type="text"/></td></tr><tr><td>Y:</td><td><input class="startY" type="text"/></td></tr><tr><td>Z:</td><td><input class="startZ" type="text"/></td></tr><tr><td>构件:</td><td><input class="component" type="text" disabled/></td></tr><tr style=\'display: none\'><td>标签所在面:</td><td class=\'face\'><input type="text"/></td></tr></table></div></div></div>'
        });
        f.setPosition({
            left: o.viewportDiv.offsetWidth - f.width - 5,
            top: 60
        }),
        f.promptHide(),
        f.$el.addClass("updateMark"),
        u.querySelector(".btn-yes").addEventListener("click", (function() {
            var A = document.getElementById("updateMark" + t);
            xh.hasClass(A, "hide") ? s.$el.querySelector(".mark .dom .colorRect").style.backgroundColor = p.value : f.$el.querySelector(".updateMarkPrompt .dom .colorRect").style.backgroundColor = p.value
        }
        ));
        var m = qd.confirm({
            title: "请再次确认:",
            id: "confirm-mark" + t,
            width: 356,
            height: 87,
            closeOnEsc: !1,
            closeButton: !1,
            iconClass: !1,
            msg: "是否要删除此标签？"
        });
        m.setPosition({
            left: (qd.viewport.offsetWidth - m.$options.width) / 2,
            top: 5
        }),
        m.confirmHide(),
        xh.addEventListener(n.querySelector("#mark" + t), "click", (function() {
            i.mark ? (s.windowHide(),
            o.viewerImpl.modelManager.removeEventListener(Rc.ON_CLICK_PICK, l),
            f.promptHide(),
            u.style.display = "none") : (document.getElementById("mark" + t).querySelector(".yj-icon").className = "yj-icon label-icon active",
            i.mark = !i.mark,
            s.windowShow(),
            o.viewerImpl.modelManager.addEventListener(Rc.ON_CLICK_PICK, l))
        }
        ));
        for (var C = s.$el.querySelectorAll(".lobibox .lobibox-body .showColorModal"), v = 0; C.length > v; v += 1)
            C[v].addEventListener("click", (function() {
                u.style.display = "none" === u.style.display ? "block" : "none"
            }
            ));
        for (var I = f.$el.querySelectorAll(".lobibox .lobibox-body .showColorModal"), E = 0; I.length > E; E += 1)
            I[E].addEventListener("click", (function() {
                u.style.display = "none" === u.style.display ? "block" : "none"
            }
            ));
        for (var B = s.$el.querySelectorAll(".lobibox .lobibox-body .picture .chosed-pic"), x = 0; B.length > x; x += 1)
            B[x].addEventListener("click", (function() {
                var A = this.parentElement.lastChild;
                A.style.display = "none" === A.style.display ? "block" : "none"
            }
            ));
        for (var S = s.$el.querySelectorAll(".lobibox .lobibox-body .picture .file-choose span"), w = 0; S.length > w; w += 1)
            S[w].addEventListener("click", (function() {
                this.parentElement.querySelector("input").click()
            }
            ));
        for (var M = s.$el.querySelectorAll(".lobibox .lobibox-body .picture .pic-list li"), b = 0; M.length > b; b += 1)
            M[b].addEventListener("click", (function() {
                var A = this.parentElement.parentElement.querySelector(".chosed-pic")
                  , e = this.querySelector("img").getAttribute("src");
                A.dataset.chosedUrl = e,
                A.querySelector("img").setAttribute("src", e),
                A.parentElement.lastChild.style.display = "none"
            }
            ));
        s.$el.querySelector(".mark .first-floor select").addEventListener("change", (function() {
            for (var A = this.value, e = s.$el.querySelectorAll(".mark .second-floor"), t = 0; e.length > t; t += 1)
                e[t].style.display = "none";
            s.$el.querySelector(".mark  ." + A).style.display = "block",
            u.style.display = "none"
        }
        )),
        s.$el.querySelector(".mark .third-floor .showList").addEventListener("click", (function() {
            var A = s.$el.querySelector(".mark .forth-floor");
            "none" === A.style.display ? (A.style.display = "block",
            this.innerHTML = "隐藏标签列表") : (A.style.display = "none",
            this.innerHTML = "展示标签列表")
        }
        )),
        s.$el.querySelector(".mark .third-floor .addMark").addEventListener("click", (function() {
            u.style.display = "none";
            var A = s.$el.querySelector(".mark .first-floor select").value
              , e = []
              , t = null;
            if ("dom" === A) {
                var i = s.$el.querySelector(".mark .dom .title ").value;
                "" === i && (i = "标签");
                var n = Kd.getColorArrayFromRGBA(s.$el.querySelector(".mark .dom .colorRect").style.backgroundColor)
                  , l = parseInt(s.$el.querySelector(".mark .dom .text-tab ").value, 0)
                  , c = null;
                if (l > 10)
                    return void jd("warning", "备注栏不可超过10个", 5e3);
                if (l > 0) {
                    c = document.createElement("div");
                    for (var h = 0; l > h; h += 1)
                        c.innerHTML += '<input type="text" style="margin:10px 5px;display:block;border:1px solid #000000;"/>'
                }
                var d = s.$el.querySelector(".mark .dom .component ").value;
                if (e[0] = Number(s.$el.querySelector(".mark .dom .startX ").value),
                e[1] = Number(s.$el.querySelector(".mark .dom .startY ").value),
                e[2] = Number(s.$el.querySelector(".mark .dom .startZ ").value),
                isNaN(e[0]) || isNaN(e[1]) || isNaN(e[2]))
                    return void jd("warning", "标签位置错误，无法新建标签", 5e3);
                var p = o.getScreenCoordFromSceneCoord(e);
                t = {
                    title: i,
                    color: n,
                    startPosition: [e[0], e[1], e[2]],
                    endPosition: [p[0] + 100, p[1] - 200],
                    domElement: c,
                    componentId: d
                }
            } else if ("sprite" === A) {
                try {
                    var g = s.$el.querySelector(".mark .sprite .chosed-pic").dataset.chosedUrl
                } catch (A) {
                    return void jd("warning", "未选择标签图标", 5e3)
                }
                var f = Number(s.$el.querySelector(".mark .sprite .size ").value);
                f && f >= 0 || (f = 1);
                var m = s.$el.querySelector(".mark .sprite .component ").value;
                if (m && (a.imageSize = r(m)),
                e[0] = Number(s.$el.querySelector(".mark .sprite .startX ").value),
                e[1] = Number(s.$el.querySelector(".mark .sprite .startY ").value),
                e[2] = Number(s.$el.querySelector(".mark .sprite .startZ ").value),
                isNaN(e[0]) || isNaN(e[1]) || isNaN(e[2]))
                    return void jd("warning", "标签位置错误，无法新建标签", 5e3);
                t = {
                    url: g,
                    scale: f,
                    useImageSize: !1,
                    width: a.imageSize,
                    height: a.imageSize,
                    position: e,
                    alwaysVisible: !0,
                    componentId: m
                }
            } else {
                try {
                    g = s.$el.querySelector(".mark .plane .chosed-pic").dataset.chosedUrl
                } catch (A) {
                    return void a.message("warning", "未选择标签图标", 5e3)
                }
                var C = Number(s.$el.querySelector(".mark .plane .size ").value);
                C && C >= 0 || (C = 1);
                var y = s.$el.querySelector(".mark .plane .component ").value;
                if (y && (a.imageSize = r(y)),
                e[0] = Number(s.$el.querySelector(".mark .plane .startX ").value),
                e[1] = Number(s.$el.querySelector(".mark .plane .startY ").value),
                e[2] = Number(s.$el.querySelector(".mark .plane .startZ ").value),
                isNaN(e[0]) || isNaN(e[1]) || isNaN(e[2]))
                    return void a.message("warning", "标签位置错误，无法新建标签", 5e3);
                var v = s.$el.querySelector(".mark .plane .face").value;
                v || (v = "x"),
                t = {
                    URL: g,
                    scale: C,
                    useImageSize: !1,
                    width: a.imageSize,
                    height: a.imageSize,
                    position: e,
                    alwaysVisible: !0,
                    componentId: y,
                    transparent: !0,
                    face: v,
                    useFaceMatrix: !0
                }
            }
            "function" == typeof a.addListener ? a.addListener(A, t, (function(e, i) {
                e && a.add(A, i || t)
            }
            )) : a.add(A, t)
        }
        )),
        s.$el.querySelector(".forth-floor").addEventListener("click", (function(A) {
            switch (A.target.className) {
            case "deleteMark":
                a.markDelete(A);
                break;
            case "updateMark":
                a.markUpdate(A);
                break;
            case "info":
                if ("聚焦" === A.target.innerText) {
                    var e = ""
                      , i = xh.closest(A.target, "tr")
                      , n = i.querySelector(".id").innerHTML
                      , r = xh.closest(i, "table").className;
                    if ("dom" === r ? e = c.marks[n].componentId : "sprite" === r ? e = h.marks[n].componentId : "plane" === r && (e = d.marks[n].componentId),
                    !e)
                        return void jd("warning", "该标签没有关联构件！", 5e3);
                    for (var s = document.querySelectorAll("#markWindow" + t + " .forth-floor .info"), l = 0; s.length > l; l += 1)
                        s[l].innerText = "聚焦";
                    A.target.innerText = "失焦",
                    function(A) {
                        var e = o.viewerImpl.getBoundingBoxByIds([A]);
                        if (e.min.x !== -1 / 0 && e.min.x !== 1 / 0) {
                            var t = e.getCenter(new y)
                              , i = o.viewerImpl.camera.getWorldDirection()
                              , n = e.max.distanceTo(e.min)
                              , r = new y;
                            r.copy(i),
                            r.setLength(n);
                            var a = new y;
                            a.subVectors(t, r),
                            o.flyTo({
                                position: a,
                                target: t,
                                up: o.viewerImpl.camera.up
                            }, (function() {
                                o.viewerImpl.cameraControl.dispatchEvent(Rc.ON_CAMERA_CHANGE)
                            }
                            )),
                            o.highlightComponentsByKey([A]),
                            o.closeTransparentComponentsByKey([A]),
                            o.transparentOtherComponentsByKey([A])
                        } else
                            jd("warning", "该构件不存在！", 5e3)
                    }(e)
                } else
                    A.target.innerText = "聚焦",
                    o.clearTransparentList(),
                    o.clearHighlightList();
                break;
            default:
                if (xh.hasClass(A.target, "hideOrShow")) {
                    var p = xh.closest(A.target, "tr")
                      , g = p.querySelector(".id").innerHTML
                      , u = xh.closest(p, "table").className
                      , f = null;
                    f = "dom" === u ? c : "sprite" === u ? h : c,
                    xh.hasClass(A.target, "hideMark") ? (f.hide(g),
                    A.target.classList.remove("hideMark"),
                    A.target.classList.add("showMark"),
                    A.target.innerHTML = "显示") : (f.show(g),
                    A.target.classList.remove("showMark"),
                    A.target.classList.add("hideMark"),
                    A.target.innerHTML = "隐藏")
                }
            }
        }
        )),
        s.setPosition({
            left: "",
            right: 5,
            top: 60
        }),
        s.windowHide(),
        this.add = function(A, e) {
            switch (A) {
            case "dom":
                this.addDOMMark(e);
                break;
            case "sprite":
                this.addSpriteMark(e);
                break;
            case "plane":
                this.addPlaneMark(e)
            }
        }
        ,
        this.addDOMMark = function(A) {
            c.add(A, (function(e) {
                s.$el.querySelector(".mark .forth-floor .dom tbody").innerHTML += "<tr markId='" + e + '\'><td class="id" title="' + e + '" width="60px">' + e + '</td><td class="markTitle" title="' + A.title + '" width="60px">' + A.title + '</td><td><button class="info">聚焦</button></td><td><button class="hideOrShow hideMark">隐藏</button></td><td><button class="deleteMark">删除</button></td><td><button class="updateMark">修改</button></td></tr>'
            }
            ))
        }
        ,
        this.addSpriteMark = function(A) {
            h.add(A, (function(e) {
                s.$el.querySelector(".mark .forth-floor .sprite tbody").innerHTML += "<tr markId='" + e + '\'><td class="id" title="' + e + '" width="60px">' + e + '</td><td  class="img" width="60px"><img class="markImg" style="width:18px;height:18px;margin-left:10px;" src="' + A.url + '"/></td><td><button class="info">聚焦</button></td><td><button class="hideOrShow hideMark">隐藏</button></td><td><button class="deleteMark">删除</button></td><td><button class="updateMark">修改</button></td></tr>'
            }
            ))
        }
        ,
        this.addPlaneMark = function(A) {
            d.add(A, (function(e) {
                s.$el.querySelector(".mark .forth-floor .plane tbody").innerHTML += "<tr markId='" + e + '\'><td class="id" title="' + e + '" width="60px">' + e + '</td><td  class="img" width="60px"><img class="markImg" style="width:18px;height:18px;margin-left:10px;" src="' + A.URL + '"/></td><td><button class="info">构件</button></td><td><button class="hideOrShow hideMark">隐藏</button></td><td><button class="deleteMark">删除</button></td><td><button class="updateMark">修改</button></td></tr>'
            }
            ))
        }
        ,
        this.markDelete = function(A) {
            var e = xh.closest(A.target, "tr")
              , i = e.querySelector(".id").innerHTML
              , o = xh.closest(e, "table").className;
            m.confirmShow();
            var n = "";
            "dom" === o ? n = "文字标签" : "sprite" === o ? n = "精灵标签" : "plane" === o && (n = "平面标签"),
            document.querySelector("#confirm-mark" + t + " .lobibox-body-text").innerHTML = "是否要删除编号为[" + i + "]的" + n + "？",
            document.querySelector("#confirm-mark" + t + " .lobibox-btn-yes").onclick = function() {
                "function" == typeof a.deleteListener ? a.deleteListener(o, i, (function(A) {
                    A && a.delete(o, i)
                }
                )) : a.delete(o, i),
                m.confirmHide()
            }
            ,
            document.querySelector("#confirm-mark" + t + " .lobibox-btn-no").onclick = function() {
                m.confirmHide()
            }
        }
        ,
        this.delete = function(A, e) {
            var t = null;
            if ("dom" === A) {
                if (t = c) {
                    t.remove(e);
                    var i = s.$el.querySelector(".mark .forth-floor .dom tbody")
                      , o = document.querySelector("tr[markId='" + e + "']");
                    i.removeChild(o)
                }
            } else if ("sprite" === A) {
                if (t = h) {
                    t.remove(e);
                    var n = s.$el.querySelector(".mark .forth-floor .sprite tbody")
                      , r = document.querySelector("tr[markId='" + e + "']");
                    n.removeChild(r)
                }
            } else if ("plane" === A && (t = d)) {
                t.remove(e);
                var a = s.$el.querySelector(".mark .forth-floor .plane tbody")
                  , l = document.querySelector("tr[markId='" + e + "']");
                a.removeChild(l)
            }
        }
        ,
        this.markUpdate = function(A) {
            var e = xh.closest(A.target, "tr")
              , i = e.querySelector(".id").innerHTML
              , o = xh.closest(e, "table").className;
            f.promptShow();
            var n = document.getElementById("updateMark" + t);
            if (n.style.cssText += "z-index:" + (Number(document.getElementById("markWindow" + t).style.zIndex) + 1),
            "dom" === o) {
                for (var l = n.querySelectorAll(".sprite , .plane"), p = 0; l.length > p; p += 1)
                    l[p].style.display = "none";
                n.querySelector(".dom ").style.display = "block",
                n.querySelector(".dom .markId").value = i,
                n.querySelector(".dom .title").value = c.marks[i].title,
                n.querySelector(".dom .startX").value = c.marks[i].startPosition[0],
                n.querySelector(".dom .startY").value = c.marks[i].startPosition[1],
                n.querySelector(".dom .startZ").value = c.marks[i].startPosition[2],
                n.querySelector(".dom .component").value = c.marks[i].componentId,
                c.marks[i].domElement && (n.querySelector(".dom .text-tab").value = c.marks[i].domElement.querySelectorAll("input").length),
                n.querySelector(".dom .colorRect").style.backgroundColor = Kd.getRGBAFromColorArray(c.marks[i].color),
                n.querySelector(".lobibox-btn-default").onclick = function() {
                    var A = n.querySelector(".dom .title").value;
                    "" === A && (A = "标签");
                    var e = Kd.getColorArrayFromRGBA(n.querySelector(".dom .colorRect").style.backgroundColor)
                      , t = [];
                    if (t[0] = n.querySelector(".dom .startX").value,
                    t[1] = n.querySelector(".dom .startY").value,
                    t[2] = n.querySelector(".dom .startZ").value,
                    isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]))
                        jd("warning", "标签位置无效，无法更新标签", 5e3);
                    else {
                        var r = parseInt(n.querySelector(".dom .text-tab ").value, 0)
                          , s = null;
                        if (10 < r)
                            jd("warning", "备注栏不可超过10个", 5e3);
                        else {
                            if (r > 0) {
                                s = document.createElement("div");
                                for (var l = 0; r > l; l += 1)
                                    s.innerHTML += '<input type="text" style="margin:10px 5px;display:block;border:1px solid #000000;"/>'
                            }
                            var c = {
                                title: A,
                                color: e,
                                startPosition: t,
                                domElement: s,
                                componentId: n.querySelector(".dom .component").value
                            };
                            "function" == typeof a.updateListener ? a.updateListener(o, i, c, (function(A, e) {
                                A && a.update(o, i, e || c)
                            }
                            )) : a.update(o, i, c),
                            f.promptHide(),
                            u.style.display = "none"
                        }
                    }
                }
            } else if ("sprite" === o) {
                for (var g = n.querySelectorAll(".dom , .plane"), m = 0; g.length > m; m += 1)
                    g[m].style.display = "none";
                n.querySelector(".sprite ").style.display = "block",
                n.querySelector(".sprite .markId").value = i,
                n.querySelector(".sprite .picture .chosed-pic").dataset.chosedUrl = h.marks[i].url,
                n.querySelector(".sprite .picture .chosed-pic img").setAttribute("src", h.marks[i].url),
                n.querySelector(".sprite .size").value = h.marks[i].scale,
                n.querySelector(".sprite .startX").value = h.marks[i].position[0],
                n.querySelector(".sprite .startY").value = h.marks[i].position[1],
                n.querySelector(".sprite .startZ").value = h.marks[i].position[2],
                n.querySelector(".sprite .component").value = h.marks[i].componentId,
                n.querySelector(".lobibox-btn-default").onclick = function() {
                    try {
                        var A = n.querySelector(".sprite .picture .chosed-pic").dataset.chosedUrl
                    } catch (A) {
                        return void jd("warning", "未选择标签图标", 5e3)
                    }
                    var e = n.querySelector(".sprite .size").value;
                    e && e >= 0 || (e = 1);
                    var t = [];
                    if (t[0] = Number(n.querySelector(".sprite .startX ").value),
                    t[1] = Number(n.querySelector(".sprite .startY ").value),
                    t[2] = Number(n.querySelector(" .sprite .startZ ").value),
                    isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]))
                        jd("warning", "标签位置无效，无法更新标签", 5e3);
                    else {
                        var s = n.querySelector(".sprite .component").value;
                        s && (a.imageSize = r(s));
                        var l = {
                            url: A,
                            scale: e,
                            position: t,
                            useImageSize: !1,
                            width: a.imageSize,
                            height: a.imageSize,
                            alwaysVisible: !0,
                            componentId: s
                        };
                        "function" == typeof a.updateListener ? a.updateListener(o, i, l, (function(A, e) {
                            A && a.update(o, i, e || l)
                        }
                        )) : a.update(o, i, l),
                        f.promptHide()
                    }
                }
            } else if ("plane" === o) {
                for (var C = n.querySelectorAll(".dom , .sprite"), y = 0; C.length > y; y += 1)
                    C[y].style.display = "none";
                n.querySelector(".plane ").style.display = "block",
                n.querySelector(".plane .markId").value = i,
                n.querySelector(".plane .picture .chosed-pic").dataset.chosedUrl = d.marks[i].URL,
                n.querySelector(".plane .picture .chosed-pic img").setAttribute("src", d.marks[i].URL),
                n.querySelector(".plane .size").value = d.marks[i].scale,
                n.querySelector(".plane .startX").value = d.marks[i].position[0],
                n.querySelector(".plane .startY").value = d.marks[i].position[1],
                n.querySelector(".plane .startZ").value = d.marks[i].position[2],
                n.querySelector(".plane .component").value = d.marks[i].componentId,
                n.querySelector(".plane .face").value = d.marks[i].face,
                n.querySelector(".lobibox-btn-default").onclick = function() {
                    try {
                        var A = n.querySelector(".plane .picture .chosed-pic").dataset.chosedUrl
                    } catch (A) {
                        return void jd("warning", "未选择标签图标", 5e3)
                    }
                    var e = n.querySelector(".plane .size").value;
                    e && e >= 0 || (e = 1);
                    var t = [];
                    if (t[0] = Number(n.querySelector(".plane .startX ").value),
                    t[1] = Number(n.querySelector(".plane .startY ").value),
                    t[2] = Number(n.querySelector(" .plane .startZ ").value),
                    isNaN(t[0]) || isNaN(t[1]) || isNaN(t[2]))
                        jd("warning", "标签位置无效，无法更新标签", 5e3);
                    else {
                        var l = n.querySelector(".plane .component").value;
                        l && (a.imageSize = r(l));
                        var c = s.$el.querySelector(".updateMarkPrompt .plane .face").value;
                        c || (c = "x");
                        var h = {
                            URL: A,
                            scale: e,
                            position: t,
                            useImageSize: !1,
                            width: a.imageSize,
                            height: a.imageSize,
                            alwaysVisible: !0,
                            face: c,
                            componentId: l
                        };
                        "function" == typeof a.updateListener ? a.updateListener(o, i, h, (function(A, e) {
                            A && a.update(o, i, e || h)
                        }
                        )) : a.update(o, i, h),
                        f.promptHide()
                    }
                }
            }
            n.querySelector(".lobibox-btn-cancel").onclick = function() {
                f.promptHide(),
                u.style.display = "none"
            }
        }
        ,
        this.update = function(A, e, t) {
            "dom" === A ? a.updateDOMMark(e, t) : "sprite" === A ? a.updateSpriteMark(e, t) : "plane" === A && a.updatePlaneMark(e, t)
        }
        ,
        this.hide = function(A, e) {
            var t = document.querySelector("tr[markId='" + e + "']");
            if (t) {
                var i = t.querySelector(".hideOrShow");
                i.classList.remove("hideMark"),
                i.classList.add("showMark"),
                i.innerHTML = "显示"
            }
            "dom" === A ? c.hide(e) : "sprite" === A && h.hide(e)
        }
        ,
        this.show = function(A, e) {
            var t = document.querySelector("tr[markId='" + e + "']");
            if (t) {
                var i = t.querySelector(".hideOrShow");
                i.classList.remove("showMark"),
                i.classList.add("hideMark"),
                i.innerHTML = "显示"
            }
            "dom" === A ? c.show(e) : "sprite" === A && h.show(e)
        }
        ,
        this.updateDOMMark = function(A, e) {
            var t = document.querySelector("tr[markId='" + A + "']");
            t && (t.querySelector(".markTitle").innerHTML = e.title,
            t.querySelector(".markTitle").setAttribute("title", e.title)),
            c.updateMark(A, e)
        }
        ,
        this.updateSpriteMark = function(A, e) {
            var t = document.querySelector("tr[markId='" + A + "']");
            t && t.querySelector(".markImg").setAttribute("src", e.url),
            h.updateMark(A, e)
        }
        ,
        this.updatePlaneMark = function(A, e) {
            var t = document.querySelector("tr[markId='" + A + "']");
            t && t.querySelector(".markImg").setAttribute("src", e.URL),
            d.updateMark(A, e)
        }
        ,
        this.getDOMMark = function() {
            return c
        }
        ,
        this.getSpriteMark = function() {
            return h
        }
        ,
        this.getPlaneMark = function() {
            return d
        }
    }
      , Yd = function(A, e, t, i, o) {
        var n = A.toolId
          , r = A.Flag
          , s = A.viewer;
        function l(A, e) {
            A.length > e && s.flyTo(A[e], (function() {
                l(A, e += 1)
            }
            ))
        }
        o.querySelector("#collision" + n).addEventListener("click", (function(A) {
            "walk" === s.viewerImpl.controlManager.control.name && (vc.EnableHitDetection = !vc.EnableHitDetection),
            s.viewerImpl.controlManager.setFocuse()
        }
        )),
        o.querySelector("#gravity" + n).addEventListener("click", (function() {
            "walk" === s.viewerImpl.controlManager.control.name && (vc.WalkingWithGravity = !vc.WalkingWithGravity),
            s.viewerImpl.controlManager.setFocuse()
        }
        ));
        var c = {}
          , h = []
          , d = qd.window({
            title: "漫游路径",
            id: "pathRoam" + n,
            width: 356,
            height: 848,
            closeOnEsc: !1,
            closeButton: !0,
            afterWindowHide: function() {
                var A = document.getElementById("roam" + n);
                r.roam = !1,
                A && (A.style.backgroundColor = "",
                A.querySelector(".yj-icon").className = "yj-icon roam-icon")
            },
            content: '<div class="path-roaming"><div class="first-floor"><button class="addPath" style="width:300px;">展示路径添加面板</button></div><div class="second-floor" style="display:none;border: none"><p style="font-size: 14px;ling-height:30px "><b>Tips</b>:一条路径由多个视角组成，调整场景后点击【保存视角】按钮保存当前视角，保存多个视角后点击【保存路径】按钮完成路径设置。</p><div class="viewList"><table><thead><tr><td>名称</td><td colspan=\'3\'><input  class="name" type="text"/></td></tr></thead><tbody></tbody></table></div><div class="saveBtns"><button class="savePath" >保存路径</button><button class="saveView">保存视角</button></div></div><div class="third-floor"><span style="font-size: 14px;ling-height:28px ">路径列表:</span><div><table class="pathList" style=\'word-wrap: break-word; word-break: break-all;table-layout: fixed;\'><tbody></tbody></table></div></div></div>'
        });
        d.$el.addClass("pathRoam");
        var p = null;
        t.addEventListener("click", (function() {
            if (r.roam)
                return p && p.destroy(),
                document.getElementById("instructions" + n) && s.viewerImpl.domElement.removeChild(document.getElementById("instructions" + n)),
                o.style.display = "none",
                this.style.backgroundColor = "",
                this.querySelector(".yj-icon").className = "yj-icon roam-icon",
                r.roam = !1,
                s.viewerImpl.controlManager.setControlMode(s.viewerImpl, "pick"),
                void (d && d.windowHide && d.windowHide());
            r.measurement && (document.getElementById("measurement" + n).style.backgroundColor = "",
            document.getElementById("measurement" + n).querySelector(".yj-icon").className = "yj-icon measurement-icon",
            jd("info", "漫游模式下将关闭测量功能", 2e3),
            e.exitMeasure && e.exitMeasure()),
            r.sectioning && (document.getElementById("sectioning" + n).style.backgroundColor = "",
            document.getElementById("sectioning" + n).querySelector(".yj-icon").className = "yj-icon sectioning-icon",
            jd("info", "漫游模式下将关闭剖切功能", 2e3),
            s.viewerImpl.controlManager.disableTool(Pc.CLIP_BY_BOX),
            r.sectioning = !1),
            r.multiple && (document.getElementById("multiple" + n).style.backgroundColor = "",
            document.getElementById("multiple" + n).querySelector(".yj-icon").className = "yj-icon multiple-icon",
            jd("info", "漫游模式下将关闭框选功能", 2e3),
            s.viewerImpl.controlManager.disableTool(Pc.PICK_BY_RECT),
            r.multiple = !1),
            s.render(),
            this.style.backgroundColor = "#1f89de",
            this.querySelector(".yj-icon").className = "yj-icon roam-icon active",
            r.roam = !r.roam,
            p = qd.prompt({
                title: "漫游",
                id: "roamChoose" + n,
                width: 356,
                height: 87,
                closeOnEsc: !1,
                closeButton: !1,
                afterWindowHide: function() {
                    var A = document.getElementById("roam" + n);
                    r.roam = !1,
                    A && (A.style.backgroundColor = ""),
                    p.destroy(),
                    p = null
                },
                buttons: {
                    ok: {
                        class: "lobibox-btn lobibox-btn-default",
                        text: "自由漫游",
                        closeOnClick: !0
                    },
                    cancel: {
                        class: "lobibox-btn lobibox-btn-cancel",
                        text: "路径漫游",
                        closeOnClick: !0
                    }
                }
            });
            var A = document.getElementById("roamChoose" + n);
            A.querySelector(".lobibox-body").style.display = "none",
            A.querySelector(".lobibox-btn-default").addEventListener("click", (function() {
                p.destroy(),
                p = null;
                var A = document.createElement("div");
                A.id = "instructions" + n,
                A.style.cssText += "position:absolute;left:0;top:0;width:100%;height:100%;background:rgba(80,80,80,0.3);margin:0;padding:0;",
                A.innerHTML = '<div class="roam"><div style="font-size:40px; width:100%;text-align: center">点击进入沉浸式浏览</div><div class="first-floor"><span>移动方向</span><div><img src=' + Pd.sxzy + "  /><img src=" + Pd.wasd + ' /></div></div><div class="second-floor"><div class="height"><span>高度</span><div><img  class="left" src=' + Pd.Q + ' /><img  class="right" src=' + Pd.E + ' /></div></div><div class="direct"><span>视角</span><div><img  class="center" src=' + Pd.mouseLeft + ' /></div></div><div class="speed"><span>速度</span><div><img  class="left" src=' + Pd.add + ' /><img class="right" src=' + Pd.plus + " /></div></div></div></div>",
                s.viewerImpl.domElement.appendChild(A),
                A.onclick = function() {
                    s.viewerImpl.domElement.removeChild(A),
                    s.viewerImpl.domElement.querySelector(".main-canvas").focus(),
                    s.viewerImpl.controlManager.setControlMode(s.viewerImpl, "walk"),
                    o.style.display = "block"
                }
            }
            )),
            A.querySelector(".lobibox-btn-cancel").addEventListener("click", (function() {
                p.destroy(),
                p = null,
                d.windowShow()
            }
            ))
        }
        )),
        d.$el.querySelector(".path-roaming .first-floor .addPath").addEventListener("click", (function() {
            var A = d.$el.querySelector(".path-roaming .second-floor");
            "none" === A.style.display ? (A.style.display = "block",
            this.innerHTML = "隐藏添加路径面板") : (A.style.display = "none",
            this.innerHTML = "展示添加路径面板")
        }
        )),
        d.$el.querySelector(".path-roaming .second-floor .savePath").addEventListener("click", (function() {
            if (h.length < 1)
                jd("warning", "没有可保存路径", 5e3);
            else {
                var A = d.$el.querySelector(".path-roaming .second-floor .name").value;
                A = A.trim() || xh.trim(A);
                var e = a.generateUUID();
                c[e] = {},
                "" === A && (A = "路径"),
                c[e].name = A,
                c[e].camera = h,
                d.$el.querySelector(".path-roaming .pathList tbody").innerHTML += "<tr data-key=" + e + '><td class="name">' + A + '</td><td><button class="deletePath" data-index>删除</button></td><td><button class="roamPath">漫游</button></td></tr>',
                h = [],
                d.$el.querySelector(".path-roaming .second-floor .viewList .name").value = "",
                d.$el.querySelector(".path-roaming .second-floor .viewList table tbody").innerHTML = ""
            }
        }
        )),
        d.$el.querySelector(".path-roaming .second-floor .saveView").addEventListener("click", (function() {
            var A = {};
            A.position = s.viewerImpl.camera.position.clone(),
            A.target = s.viewerImpl.camera.target.clone(),
            A.up = {
                x: 0,
                y: 0,
                z: 1
            },
            h.push(A);
            var e = h.length;
            d.$el.querySelector(".path-roaming .second-floor .viewList table tbody").innerHTML += "<tr data-index=" + (e - 1) + '><td class="name">视角' + e + '</td><td><button class="deleteView">删除</button></td><td><button class="updateView">修改</button></td><td><button class="checkView">查看</button></td></tr>'
        }
        ));
        var g = qd.confirm({
            title: "请再次确认:",
            id: "confirm-path" + n,
            width: 356,
            height: 87,
            closeOnEsc: !1,
            closeButton: !1,
            iconClass: !1,
            msg: "是否要删除此视角？"
        });
        return g.setPosition({
            left: (qd.viewport.offsetWidth - g.$options.width) / 2,
            top: 5
        }),
        g.confirmHide(),
        d.$el.addEventListener("click", (function(A) {
            if ("deleteView" === A.target.className) {
                var e = (r = xh.closest(A.target, "tr")).dataset.index;
                g.confirmShow(),
                document.querySelector("#confirm-path" + n + " .lobibox-body-text").innerHTML = "是否要删除编号为[" + (Number(e) + 1) + "]的视角？",
                document.querySelector("#confirm-path" + n + " .lobibox-btn-yes").onclick = function() {
                    h.splice(e, 1),
                    d.$el.querySelector(".path-roaming .second-floor .viewList tbody").removeChild(r);
                    for (var A = d.$el.querySelectorAll(".path-roaming .second-floor .viewList tbody tr"), t = 0; A.length > t; t += 1)
                        A[t].dataset.index = t,
                        A[t].querySelector(".name").innerHTML = "视角" + (t + 1);
                    g.confirmHide()
                }
                ,
                document.querySelector("#confirm-path" + n + " .lobibox-btn-no").onclick = function() {
                    g.confirmHide()
                }
            } else if ("updateView" === A.target.className) {
                var t = xh.closest(A.target, "tr").dataset.index;
                g.confirmShow(),
                document.querySelector("#confirm-path" + n + " .lobibox-body-text").innerHTML = "是否要修改编号为[" + (Number(t) + 1) + "]的视角为当前视角？",
                document.querySelector("#confirm-path" + n + " .lobibox-btn-yes").onclick = function() {
                    var A = {};
                    A.position = s.viewerImpl.camera.position.clone(),
                    A.target = s.viewerImpl.camera.target.clone(),
                    A.up = {
                        x: 0,
                        y: 0,
                        z: 1
                    },
                    h[t] = A,
                    g.confirmHide()
                }
                ,
                document.querySelector("#confirm-path" + n + " .lobibox-btn-no").onclick = function() {
                    g.confirmHide()
                }
            } else if ("checkView" === A.target.className) {
                var i = xh.closest(A.target, "tr").dataset.index;
                s.flyTo(h[i])
            } else if ("roamPath" === A.target.className) {
                var o = xh.closest(A.target, "tr").dataset.key;
                l(c[o].camera, 0)
            } else if ("deletePath" === A.target.className) {
                var r, a = (r = xh.closest(A.target, "tr")).dataset.key;
                g.confirmShow(),
                document.querySelector("#confirm-path" + n + " .lobibox-body-text").innerHTML = "是否要删除名称为[" + c[a].name + "]的路径？",
                document.querySelector("#confirm-path" + n + " .lobibox-btn-yes").onclick = function() {
                    d.$el.querySelector(".path-roaming .pathList tbody").removeChild(r),
                    delete c[a],
                    g.confirmHide()
                }
                ,
                document.querySelector("#confirm-path" + n + " .lobibox-btn-no").onclick = function() {
                    g.confirmHide()
                }
            }
        }
        )),
        d
    }
      , Wd = function(A, e, t) {
        var i = this;
        this.lobibox = new bh,
        A ? (this.element = document.getElementById(A),
        this.lobibox.viewport = document.querySelector("#" + A)) : this.element = document,
        this.change = !1;
        var o = function() {
            this.storage = null
        };
        o.prototype = {
            init: function() {
                this.storage = function() {
                    var A = !1;
                    return "object" === lc(window.localStorage) ? A = localStorage : "object" === lc(window.globalStorage) && (A = window.globalStorage),
                    A
                }()
            },
            getStorage: function() {
                return this.storage
            },
            save: function(A, e) {
                var t = this.storage
                  , i = !1;
                return !1 !== t && (i = t.setItem(A, e)),
                i
            },
            load: function(A) {
                var e = this.storage
                  , t = !1;
                return !1 !== e && (t = e.getItem(A)),
                t
            }
        },
        i.model = i.model || {},
        i.model.StorageModel = o;
        !function() {
            var A, e, t, o, n, r, a;
            (n = function() {
                this.name = "Mouse",
                this.option = {},
                this.mouseShape = null,
                this.init = function(A, e) {
                    this.setOption({
                        lineWidth: 1,
                        strokeStyle: A.strokeStyle,
                        radius: Math.ceil(A.lineWidth / 2),
                        opacity: 100
                    }),
                    this.setPoints(e),
                    this.setMouseShape(new i.model.shapeModel.CircleStroke),
                    this.initMouseShape(),
                    this.setImage()
                }
                ,
                this.paint = function(A) {
                    this.getMouseShape().paint(A)
                }
            }
            ).prototype = {
                getName: function() {
                    return this.name
                },
                setOption: function(A) {
                    return "object" === lc(A) ? (uh.extend(!0, this.option, A),
                    this.getOption()) : null
                },
                getOption: function() {
                    return uh.extend(!0, {}, this.option)
                },
                getMouseShape: function() {
                    return this.mouseShape
                },
                setMouseShape: function(A) {
                    return this.mouseShape = A,
                    A
                },
                setPoints: function(A) {
                    this.setOption(A)
                },
                initMouseShape: function() {
                    this.getMouseShape().init(this.getOption())
                },
                setImage: function() {
                    var A = this.getName();
                    return [].map.call(document.querySelectorAll("#canvas-mouse"), (function(e, t) {
                        e.setAttribute("data-mouse", A)
                    }
                    )),
                    !0
                }
            },
            (A = function() {
                this.name = "Cross",
                this.init = function(A, e) {
                    var t = this.getName();
                    this.setOption({
                        length: 10,
                        lineHeight: 1,
                        opacity: 100,
                        strokeStyle: A.strokeStyle,
                        lineJoin: A.lineJoin,
                        lineCap: A.lineCap,
                        shadowOffsetX: A.shadowOffsetX,
                        shadowOffsetY: A.shadowOffsetY,
                        shadowBlur: A.shadowBlur,
                        shadowColor: A.shadowColor
                    }),
                    this.setPoints(e),
                    this.setMouseShape(new i.model.shapeModel[t]),
                    this.initMouseShape(),
                    this.setImage()
                }
                ,
                this.paint = function(A) {
                    this.getMouseShape().paint(A)
                }
            }
            ).prototype = new n,
            (r = function() {
                this.name = "Pen"
            }
            ).prototype = new n,
            (e = function() {
                this.name = "Eraser",
                this.init = function(A, e) {
                    this.setOption({
                        strokeStyle: "#000",
                        opacity: A.opacity,
                        radius: Math.ceil(A.lineWidth / 2, 10),
                        lineJoin: A.lineJoin,
                        lineCap: A.lineCap,
                        shadowOffsetX: A.shadowOffsetX,
                        shadowOffsetY: A.shadowOffsetY,
                        shadowBlur: A.shadowBlur,
                        shadowColor: A.shadowColor
                    }),
                    this.setPoints(e),
                    this.setMouseShape(new i.model.shapeModel.CircleStroke),
                    this.initMouseShape(),
                    this.setImage()
                }
                ,
                this.paint = function(A) {
                    this.getMouseShape().paint(A)
                }
            }
            ).prototype = new n,
            (a = function() {
                this.name = "Text",
                this.init = function(A, e) {
                    this.setImage()
                }
                ,
                this.paint = function(A) {}
            }
            ).prototype = new n,
            (o = function() {
                this.name = "FloodFill",
                this.init = function(A, e) {
                    this.setOption({
                        strokeStyle: "#000",
                        opacity: 90,
                        radius: Math.ceil(A.lineWidth / 2, 10)
                    }),
                    this.setPoints(e),
                    this.setMouseShape(new i.model.shapeModel.CircleStroke),
                    this.initMouseShape(),
                    this.setImage()
                }
                ,
                this.paint = function(A) {
                    this.getMouseShape().paint(A)
                }
            }
            ).prototype = new n,
            (t = function() {
                this.name = "EyeDropper",
                this.init = function(A, e) {
                    this.setOption({
                        strokeStyle: "#000",
                        opacity: 90,
                        radius: Math.ceil(A.lineWidth / 2, 10)
                    }),
                    this.setPoints(e),
                    this.setMouseShape(new i.model.shapeModel.CircleStroke),
                    this.initMouseShape(),
                    this.setImage()
                }
                ,
                this.paint = function(A) {
                    this.getMouseShape().paint(A)
                }
            }
            ).prototype = new n,
            i.model = i.model || {},
            i.model.mouseModel = i.model.mouseModel || {},
            i.model.mouseModel.Mouse = n,
            i.model.mouseModel.Cross = A,
            i.model.mouseModel.Pen = r,
            i.model.mouseModel.Eraser = e,
            i.model.mouseModel.Text = a,
            i.model.mouseModel.FloodFill = o,
            i.model.mouseModel.EyeDropper = t
        }();
        var n = {
            list: [],
            add: function(A) {
                return this.list.push({
                    x: Math.round(A.x),
                    y: Math.round(A.y)
                }),
                this.list
            },
            getStart: function() {
                return this.list[0]
            },
            getEnd: function() {
                return this.list[this.list.length - 1]
            },
            getList: function() {
                return this.list
            },
            init: function() {
                return this.list = [],
                this.list
            }
        };
        i.model = i.model || {},
        i.model.PointList = n;
        (function() {
            var A, e, t, o, n, r, a, s, l, c, h, d, p, g, u, f, m, C, y, v;
            function I(A, e, t, i, o) {
                var n = i / .75 / 2
                  , r = o / 2;
                return A.beginPath(),
                A.moveTo(e, t - r),
                A.bezierCurveTo(e + n, t - r, e + n, t + r, e, t + r),
                A.bezierCurveTo(e - n, t + r, e - n, t - r, e, t - r),
                A.closePath(),
                A
            }
            (m = function() {
                this.name = "Shape",
                this.option = {}
            }
            ).prototype = {
                init: function(A) {
                    this.initOption(A)
                },
                getName: function() {
                    return this.name
                },
                initOption: function(A) {
                    this.option = {},
                    this.setOption(A)
                },
                setOption: function(A) {
                    return uh.extend(!0, this.option, A),
                    this.option
                },
                getOption: function() {
                    return this.option
                },
                repaint: function(A) {
                    this.paint(A)
                },
                setAttributes: function(A) {}
            },
            (c = function() {
                this.name = "FillStroke",
                this.setAttributes = function(A) {
                    var e = this.getOption();
                    A.strokeStyle = e.strokeStyle,
                    A.fillStyle = e.fillStyle,
                    A.lineWidth = e.lineWidth,
                    A.globalAlpha = e.opacity / 100,
                    A.lineJoin = e.lineJoin,
                    A.lineCap = e.lineCap,
                    A.shadowOffsetX = e.shadowOffsetX,
                    A.shadowOffsetY = e.shadowOffsetY,
                    A.shadowBlur = e.shadowBlur,
                    A.shadowColor = e.shadowColor
                }
            }
            ).prototype = new m,
            (p = function() {
                this.name = "Line",
                this.paint = function(A) {
                    var e = this.getOption();
                    A.save(),
                    this.setAttributes(A),
                    A.beginPath(),
                    A.moveTo(e.startX, e.startY),
                    A.lineTo(e.endX, e.endY),
                    A.closePath(),
                    A.stroke(),
                    A.restore()
                }
            }
            ).prototype = new c,
            (o = function() {
                this.name = "CurveClosed",
                this.paint = function(A) {
                    var e = this.getOption().list
                      , t = e[0]
                      , i = e.length
                      , o = 0;
                    for (A.save(),
                    this.setAttributes(A),
                    A.beginPath(),
                    A.moveTo(t.x, t.y); i > o; o += 1)
                        A.lineTo(e[o].x, e[o].y);
                    A.closePath(),
                    A.fill(),
                    A.stroke(),
                    A.restore()
                }
            }
            ).prototype = new c,
            (u = function() {
                this.name = "Rect",
                this.paint = function(A) {
                    var e = this.getOption();
                    A.save(),
                    this.setAttributes(A),
                    A.fillRect(e.left, e.top, e.width, e.height),
                    A.strokeRect(e.left, e.top, e.width, e.height),
                    A.restore()
                }
            }
            ).prototype = new c,
            (A = function() {
                this.name = "Circle",
                this.paint = function(A) {
                    var e = this.getOption();
                    A.save(),
                    this.setAttributes(A),
                    A.beginPath(),
                    A.arc(e.x, e.y, e.radius, 0, 2 * Math.PI, !0),
                    A.closePath(),
                    A.fill(),
                    A.stroke(),
                    A.restore()
                }
            }
            ).prototype = new c,
            (r = function() {
                this.name = "Ellipes",
                this.paint = function(A) {
                    var e = this.getOption()
                      , t = e.x
                      , i = e.y
                      , o = e.width
                      , n = e.height;
                    A.save(),
                    this.setAttributes(A),
                    I(A, t, i, o, n),
                    A.fill(),
                    A.stroke(),
                    A.restore()
                }
            }
            ).prototype = new c,
            (C = function() {
                this.name = "Stroke",
                this.setAttributes = function(A) {
                    var e = this.getOption();
                    A.strokeStyle = e.strokeStyle,
                    A.lineWidth = e.lineWidth,
                    A.globalAlpha = e.opacity / 100,
                    A.lineJoin = e.lineJoin,
                    A.lineCap = e.lineCap,
                    A.shadowOffsetX = e.shadowOffsetX,
                    A.shadowOffsetY = e.shadowOffsetY,
                    A.shadowBlur = e.shadowBlur,
                    A.shadowColor = e.shadowColor
                }
            }
            ).prototype = new m,
            (g = function() {
                this.name = "Pen",
                this.paint = function(A) {
                    var e = this.getOption().list
                      , t = e[0]
                      , i = e.length
                      , o = 0;
                    for (A.save(),
                    this.setAttributes(A),
                    A.beginPath(),
                    A.moveTo(t.x, t.y); i > o; o += 1)
                        A.lineTo(e[o].x, e[o].y);
                    A.stroke(),
                    A.restore()
                }
            }
            ).prototype = new C,
            (n = function() {
                this.name = "CurveClosedStroke",
                this.paint = function(A) {
                    var e = this.getOption().list
                      , t = e[0]
                      , i = e.length
                      , o = 0;
                    for (A.save(),
                    this.setAttributes(A),
                    A.beginPath(),
                    A.moveTo(t.x, t.y); i > o; o += 1)
                        A.lineTo(e[o].x, e[o].y);
                    A.closePath(),
                    A.stroke(),
                    A.restore()
                }
            }
            ).prototype = new C,
            (f = function() {
                this.name = "RectStroke",
                this.paint = function(A) {
                    var e = this.getOption();
                    A.save(),
                    this.setAttributes(A),
                    A.strokeRect(e.left, e.top, e.width, e.height),
                    A.restore()
                }
            }
            ).prototype = new C,
            (e = function() {
                this.name = "CircleStroke",
                this.paint = function(A) {
                    var e = this.getOption();
                    A.save(),
                    this.setAttributes(A),
                    A.beginPath(),
                    A.arc(e.x, e.y, e.radius, 0, 2 * Math.PI, !0),
                    A.closePath(),
                    A.stroke(),
                    A.restore()
                }
            }
            ).prototype = new C,
            (a = function() {
                this.name = "EllipesStroke",
                this.paint = function(A) {
                    var e = this.getOption()
                      , t = e.x
                      , i = e.y
                      , o = e.width
                      , n = e.height;
                    A.save(),
                    this.setAttributes(A),
                    I(A, t, i, o, n),
                    A.stroke(),
                    A.restore()
                }
            }
            ).prototype = new C,
            (s = function() {
                this.name = "Eraser",
                this.paint = function(A) {
                    var e = this.getOption()
                      , t = e.list
                      , i = t[0]
                      , o = t.length
                      , n = 0;
                    for (A.save(),
                    A.strokeStyle = e.color,
                    A.lineWidth = e.lineWidth,
                    A.shadowOffsetX = e.shadowOffsetX,
                    A.shadowOffsetY = e.shadowOffsetY,
                    A.shadowBlur = e.shadowBlur,
                    A.shadowColor = e.shadowColor,
                    A.lineJoin = e.lineJoin,
                    A.lineCap = e.lineCap,
                    A.globalAlpha = e.opacity / 100,
                    A.beginPath(),
                    A.moveTo(i.x, i.y); o > n; n += 1)
                        A.lineTo(t[n].x, t[n].y);
                    A.stroke(),
                    A.restore()
                }
            }
            ).prototype = new m,
            (h = function() {
                this.name = "FloodFill",
                this.paint = function(A) {
                    var e = this.getOption()
                      , t = e.allowance
                      , i = e.fillStyle ? e.fillStyle : "rgba(0,0,0,1)"
                      , o = i.indexOf("(") + 1
                      , n = i.slice(o, -1).split(",")
                      , r = {
                        r: parseInt(n[0], 10),
                        g: parseInt(n[1], 10),
                        b: parseInt(n[2], 10),
                        a: Math.ceil(255 * (n[3] || 1))
                    }
                      , a = e.x
                      , s = e.y
                      , l = e.width
                      , c = e.height
                      , h = A.getImageData(0, 0, l, c)
                      , d = h.data
                      , p = 4 * (l * s + a)
                      , g = d[p]
                      , u = d[p + 1]
                      , f = d[p + 2]
                      , m = d[p + 3] / 255
                      , C = [{
                        x: a,
                        y: s
                    }];
                    try {
                        !function(A, e) {
                            var o = null
                              , n = null
                              , r = null
                              , h = null
                              , p = null
                              , y = null
                              , v = {};
                            for (Bh.time("floodFill"); 0 !== C.length; )
                                y = C.pop(),
                                v[o = 4 * (l * y.y + y.x)] = !0,
                                r = d[o + 1],
                                h = d[o + 2],
                                p = d[o + 3] / 255,
                                ((n = d[o]) !== e.r || r !== e.g || h !== e.b || 255 * p !== e.a) && Math.abs(n - g) < t && Math.abs(r - u) < t && Math.abs(h - f) < t && Math.abs(p - m) < t / 256 && (d[o] = e.r,
                                d[o + 1] = e.g,
                                d[o + 2] = e.b,
                                d[o + 3] = e.a,
                                !v[o - 4] && a > 0 && C.push({
                                    x: y.x - 1,
                                    y: y.y
                                }),
                                !v[o + 4] && l > a && C.push({
                                    x: y.x + 1,
                                    y: y.y
                                }),
                                !v[o - 4 * l] && s > 0 && C.push({
                                    x: y.x,
                                    y: y.y - 1
                                }),
                                !v[o + 4 * l] && c > s && C.push({
                                    x: y.x,
                                    y: y.y + 1
                                }));
                            Bh.timeEnd("floodFill"),
                            y = null,
                            o = null,
                            n = null,
                            r = null,
                            h = null,
                            p = null,
                            i = null
                        }(0, r)
                    } catch (A) {
                        window.console.log(A.message)
                    }
                    d = null,
                    A.save(),
                    A.putImageData(h, 0, 0),
                    A.restore()
                }
            }
            ).prototype = new m,
            (l = function() {
                this.name = "EyeDropper",
                this.paint = function(A) {
                    var e = this.getOption()
                      , t = document.querySelector("#tool-wrap .tool .color")
                      , i = A.getImageData(e.x, e.y, 1, 1).data
                      , o = "rgba(".concat(i[0], ",", i[1], ",", i[2], ",", i[3] / 255, ")");
                    t.value = o,
                    xh.css(document.querySelector("#tool-wrap #colorOperatorDiv"), {
                        "background-color": o
                    })
                }
                ,
                this.repaint = function() {}
            }
            ).prototype = new m,
            (t = function() {
                this.name = "Cross",
                this.paint = function(A) {
                    var e = this.getOption()
                      , t = e.x
                      , i = e.y
                      , o = e.length
                      , n = t - o
                      , r = i
                      , a = t + o
                      , s = i
                      , l = t
                      , c = i - o
                      , h = t
                      , d = i + o;
                    A.save(),
                    A.strokeStyle = e.strokeStyle,
                    A.lineWidth = e.lineWidth,
                    A.shadowOffsetX = e.shadowOffsetX,
                    A.shadowOffsetY = e.shadowOffsetY,
                    A.shadowBlur = e.shadowBlur,
                    A.shadowColor = e.shadowColor,
                    A.lineJoin = e.lineJoin,
                    A.lineCap = e.lineCap,
                    A.globalAlpha = e.opacity / 100,
                    A.beginPath(),
                    A.moveTo(n, r),
                    A.lineTo(a, s),
                    A.moveTo(l, c),
                    A.lineTo(h, d),
                    A.closePath(),
                    A.stroke(),
                    A.restore()
                }
            }
            ).prototype = new m,
            (y = function() {
                this.name = "Text",
                this.setAttributes = function(A) {
                    var e = this.getOption();
                    A.shadowOffsetX = e.shadowOffsetX,
                    A.shadowOffsetY = e.shadowOffsetY,
                    A.shadowBlur = e.shadowBlur,
                    A.shadowColor = e.shadowColor,
                    A.strokeStyle = e.strokeStyle,
                    A.fillStyle = e.fillStyle,
                    A.globalAlpha = e.opacity / 100,
                    A.font = e.italic + " " + e.bold + " " + e.size + "px " + e.family,
                    A.lineWidth = e.border,
                    A.textAlign = e.textAlign
                }
                ,
                this.paint = function(A) {
                    var e = this.getOption()
                      , t = e.x
                      , i = e.y
                      , o = e.text;
                    A.save(),
                    this.setAttributes(A),
                    "string" == typeof o && (o = o.match(/[\n\r]/) ? o.split(/\r\n|\r|\n/g) : [o]);
                    for (var n = 0; o.length > n; n += 1)
                        A.fillText(o[n], t, i + e.size * n),
                        A.strokeText(o[n], t, i + e.size * n);
                    A.restore()
                }
            }
            ).prototype = new m,
            (v = function() {
                this.name = "TextStroke",
                this.paint = function(A) {
                    var e = this.getOption()
                      , t = e.x
                      , i = e.y
                      , o = e.text;
                    A.save(),
                    this.setAttributes(A),
                    A.strokeText(o, t, i),
                    A.restore()
                }
            }
            ).prototype = new y,
            (d = function() {
                this.name = "ImageShape",
                this.paint = function(A) {
                    var e = this.getOption()
                      , t = e.x
                      , i = e.y
                      , o = e.src
                      , n = e.width
                      , r = e.height
                      , a = new Image
                      , s = this;
                    a.src = o,
                    a.onload = function() {
                        A.save(),
                        s.setAttributes(A),
                        A.drawImage(a, t, i, n, r),
                        A.restore()
                    }
                }
            }
            ).prototype = new m,
            (i = i || {}).model = i.model || {},
            i.model.shapeModel = i.model.shapeModel || {},
            i.model.shapeModel.Line = p,
            i.model.shapeModel.CurveClosed = o,
            i.model.shapeModel.Rect = u,
            i.model.shapeModel.Circle = A,
            i.model.shapeModel.Pen = g,
            i.model.shapeModel.CurveClosedStroke = n,
            i.model.shapeModel.RectStroke = f,
            i.model.shapeModel.CircleStroke = e,
            i.model.shapeModel.Eraser = s,
            i.model.shapeModel.FloodFill = h,
            i.model.shapeModel.EyeDropper = l,
            i.model.shapeModel.Cross = t,
            i.model.shapeModel.Ellipes = r,
            i.model.shapeModel.EllipesStroke = a,
            i.model.shapeModel.Text = y,
            i.model.shapeModel.TextStroke = v,
            i.model.shapeModel.ImageShape = d
        }
        )(),
        function() {
            var A, e, t, o, n, r, a, s, l, c, h, d, p, g, u, f, m, C, y;
            (y = function(A) {
                this.name = "Tool",
                this.className = "shape",
                this.mouse = "Mouse",
                this.option = {
                    strokeStyle: "#000",
                    fillStyle: "#000",
                    lineWidth: 1
                },
                void 0 !== A && uh.extend(!0, this.option, A)
            }
            ).prototype = {
                getClassName: function() {
                    return this.className
                },
                getName: function() {
                    return this.name
                },
                setOption: function(A) {
                    return "object" === lc(A) ? (uh.extend(!0, this.option, A),
                    this.getOption()) : null
                },
                getOption: function() {
                    return uh.extend(!0, {}, this.option)
                },
                getMouse: function() {
                    return this.mouse
                }
            },
            (u = function() {
                this.name = "Shape",
                this.mouse = "Cross",
                this.initAttributes = function() {
                    for (var A = document.querySelector("#tool-shape-attribute-panel"), e = A.querySelector(".width").value, t = A.querySelector(".opacity").value, i = document.querySelector("#tool-wrap .tool .color").value, o = A.querySelector(".shadow-offsetx").value, n = A.querySelector(".shadow-offsety").value, r = A.querySelector(".shadow-blur").value, a = A.querySelector(".shadow-color").value, s = A.getElementsByTagName("radio"), l = void 0, c = void 0, h = 0; s.length > h; h += 1)
                        "line-join" === s[h].name && (l = s[h].value),
                        "line-cap" === s[h].name && (c = s[h].value);
                    return this.setOption({
                        lineWidth: e,
                        opacity: t,
                        strokeStyle: i,
                        fillStyle: i,
                        lineJoin: l,
                        lineCap: c,
                        shadowOffsetX: o,
                        shadowOffsetY: n,
                        shadowBlur: r,
                        shadowColor: a
                    })
                }
            }
            ).prototype = new y,
            (h = function() {
                this.name = "Line",
                this.init = function() {
                    this.initAttributes()
                }
                ,
                this.setPoint = function(A) {
                    var e = A.getStart()
                      , t = A.getEnd();
                    return this.setOption({
                        startX: e.x,
                        startY: e.y,
                        endX: t.x,
                        endY: t.y
                    })
                }
            }
            ).prototype = new u,
            (o = function() {
                this.name = "CurveClosed",
                this.init = function() {
                    this.initAttributes()
                }
                ,
                this.setPoint = function(A) {
                    var e = A.getList();
                    return this.option.list = [],
                    this.setOption({
                        list: e
                    })
                }
            }
            ).prototype = new u,
            (p = function() {
                this.name = "Rect",
                this.init = function() {
                    this.initAttributes()
                }
                ,
                this.setPoint = function(A) {
                    var e = A.getStart()
                      , t = A.getEnd()
                      , i = e.x
                      , o = e.y;
                    return this.setOption({
                        left: i,
                        top: o,
                        width: t.x - i,
                        height: t.y - o
                    })
                }
            }
            ).prototype = new u,
            (A = function() {
                this.name = "Circle",
                this.init = function() {
                    this.initAttributes()
                }
                ,
                this.setPoint = function(A) {
                    var e = A.getStart()
                      , t = A.getEnd()
                      , i = (e.x + t.x) / 2
                      , o = (e.y + t.y) / 2
                      , n = Math.abs(Math.sqrt(Math.pow(e.x, 2) + Math.pow(e.y, 2)) - Math.sqrt(Math.pow(t.x, 2) + Math.pow(t.y, 2))) / 2;
                    return this.setOption({
                        x: i,
                        y: o,
                        radius: n
                    })
                }
            }
            ).prototype = new u,
            (r = function() {
                this.name = "Ellipes",
                this.init = function() {
                    this.initAttributes()
                }
                ,
                this.setPoint = function(A) {
                    var e = A.getStart()
                      , t = A.getEnd()
                      , i = (e.x + t.x) / 2
                      , o = (e.y + t.y) / 2
                      , n = Math.abs(e.x - t.x)
                      , r = Math.abs(e.y - t.y);
                    return this.setOption({
                        x: i,
                        y: o,
                        width: n,
                        height: r
                    })
                }
            }
            ).prototype = new u,
            (f = function() {
                this.name = "Stroke",
                this.mouse = "Cross",
                this.initAttributes = function() {
                    for (var A = document.querySelector("#tool-stroke-attribute-panel"), e = A.querySelector(".width").value, t = A.querySelector(".opacity").value, i = document.querySelector("#tool-wrap .tool .color").value, o = A.querySelector(".shadow-offsetx").value, n = A.querySelector(".shadow-offsety").value, r = A.querySelector(".shadow-blur").value, a = A.querySelector(".shadow-color").value, s = A.getElementsByTagName("radio"), l = void 0, c = void 0, h = 0; s.length > h; h += 1)
                        "line-join" === s[h].name && (l = s[h].value),
                        "line-cap" === s[h].name && (c = s[h].value);
                    return this.setOption({
                        lineWidth: e,
                        opacity: t,
                        strokeStyle: i,
                        lineJoin: l,
                        lineCap: c,
                        shadowOffsetX: o,
                        shadowOffsetY: n,
                        shadowBlur: r,
                        shadowColor: a
                    })
                }
            }
            ).prototype = new y,
            (d = function() {
                this.name = "Pen",
                this.mouse = "Pen",
                this.init = function() {
                    this.initAttributes()
                }
                ,
                this.setPoint = function(A) {
                    var e = A.getList();
                    return this.option.list = [],
                    this.setOption({
                        list: e
                    })
                }
            }
            ).prototype = new f,
            (n = function() {
                this.name = "CurveClosedStroke",
                this.mouse = "Cross"
            }
            ).prototype = new d,
            (g = function() {
                this.name = "RectStroke",
                this.init = function() {
                    this.initAttributes()
                }
                ,
                this.setPoint = function(A) {
                    var e = A.getStart()
                      , t = A.getEnd()
                      , i = e.x
                      , o = e.y;
                    return this.setOption({
                        left: i,
                        top: o,
                        width: t.x - i,
                        height: t.y - o
                    })
                }
            }
            ).prototype = new f,
            (e = function() {
                this.name = "CircleStroke",
                this.init = function() {
                    this.initAttributes()
                }
                ,
                this.setPoint = function(A) {
                    var e = A.getStart()
                      , t = A.getEnd()
                      , i = (e.x + t.x) / 2
                      , o = (e.y + t.y) / 2
                      , n = Math.abs(Math.sqrt(Math.pow(e.x, 2) + Math.pow(e.y, 2)) - Math.sqrt(Math.pow(t.x, 2) + Math.pow(t.y, 2))) / 2;
                    return this.setOption({
                        x: i,
                        y: o,
                        radius: n
                    })
                }
            }
            ).prototype = new f,
            (a = function() {
                this.name = "EllipesStroke",
                this.init = function() {
                    this.initAttributes()
                }
                ,
                this.setPoint = function(A) {
                    var e = A.getStart()
                      , t = A.getEnd()
                      , i = (e.x + t.x) / 2
                      , o = (e.y + t.y) / 2
                      , n = Math.abs(e.x - t.x)
                      , r = Math.abs(e.y - t.y);
                    return this.setOption({
                        x: i,
                        y: o,
                        width: n,
                        height: r
                    })
                }
            }
            ).prototype = new f,
            (s = function() {
                this.name = "Eraser",
                this.mouse = "Eraser",
                this.init = function() {
                    for (var A = document.querySelector("#tool-eraser-attribute-panel"), e = A.querySelector(".size") ? A.querySelector(".size").value : void 0, t = A.querySelector(".opacity") ? A.querySelector(".opacity").value : void 0, i = A.querySelector(".shadow-offsetx") ? A.querySelector(".shadow-offsetx").value : void 0, o = A.querySelector(".shadow-offsety") ? A.querySelector(".shadow-offsety").value : void 0, n = A.querySelector(".shadow-blur") ? A.querySelector(".shadow-blur").value : void 0, r = A.querySelector(".shadow-color") ? A.querySelector(".shadow-color").value : void 0, a = A.getElementsByTagName("radio"), s = void 0, l = void 0, c = 0; a.length > c; c += 1)
                        "line-join" === a[c].name && (s = a[c].value),
                        "line-cap" === a[c].name && (l = a[c].value);
                    return this.setOption({
                        opacity: t,
                        lineWidth: e,
                        color: "#fff",
                        shadowOffsetX: i,
                        shadowOffsetY: o,
                        shadowBlur: n,
                        shadowColor: r,
                        lineJoin: s,
                        lineCap: l
                    })
                }
                ,
                this.setPoint = function(A) {
                    var e = A.getList();
                    return this.option.list = [],
                    this.setOption({
                        list: e
                    })
                }
            }
            ).prototype = new y,
            (c = function() {
                this.name = "FloodFill",
                this.mouse = "FloodFill",
                this.init = function() {
                    var A = document.querySelector("#tool-flood-fill-attribute-panel")
                      , e = document.querySelector("#tool-wrap .tool .color").value
                      , t = parseInt(A.querySelector(".allowance").value, 10)
                      , o = i.canvas.currentCanvasContainer.getCanvas()
                      , n = o.getWidth()
                      , r = o.getHeight();
                    return this.setOption({
                        fillStyle: e,
                        width: n,
                        height: r,
                        allowance: t
                    })
                }
                ,
                this.setPoint = function(A) {
                    var e = A.getEnd();
                    return this.setOption({
                        x: e.x,
                        y: e.y
                    })
                }
            }
            ).prototype = new y,
            (l = function() {
                this.name = "EyeDropper",
                this.mouse = "EyeDropper",
                this.init = function() {
                    return this.setOption({})
                }
                ,
                this.setPoint = function(A) {
                    var e = A.getEnd();
                    return this.setOption({
                        x: e.x,
                        y: e.y
                    })
                }
            }
            ).prototype = new y,
            (t = function() {
                this.name = "Cross",
                this.init = function() {
                    return this.setOption({
                        lineWidth: 1,
                        strokeStyle: "#000000",
                        length: 10
                    })
                }
                ,
                this.setPoint = function(A) {
                    var e = A.getEnd();
                    return this.setOption({
                        x: e.x,
                        y: e.y
                    })
                }
            }
            ).prototype = new y,
            (m = function() {
                this.name = "Text",
                this.mouse = "Text",
                this.init = function() {
                    this.initAttributes()
                }
                ,
                this.initAttributes = function() {
                    var A = document.querySelector("#tool-text-attribute-panel")
                      , e = A.querySelector(".opacity").value
                      , t = A.querySelector(".text").value
                      , i = A.querySelector(".size").value
                      , o = A.querySelector(".border").value
                      , n = A.querySelector(".font").value
                      , r = document.querySelector("#tool-wrap .tool .color").value
                      , a = A.querySelector(".shadow-offsetx").value
                      , s = A.querySelector(".shadow-offsety").value
                      , l = A.querySelector(".shadow-blur").value
                      , c = A.querySelector(".shadow-color").value
                      , h = "checked" === A.querySelector(".bold").getAttribute("checked") ? "bold" : ""
                      , d = "checked" === A.querySelector(".italic").getAttribute("checked") ? "italic" : "";
                    return this.setOption({
                        strokeStyle: r,
                        opacity: e,
                        fillStyle: r,
                        text: t,
                        size: i,
                        border: o,
                        family: n,
                        bold: h,
                        italic: d,
                        shadowOffsetX: a,
                        shadowOffsetY: s,
                        shadowBlur: l,
                        shadowColor: c
                    })
                }
                ,
                this.setPoint = function(A) {
                    var e = A.getStart()
                      , t = A.getEnd()
                      , i = e.x;
                    return this.setOption({
                        x: i,
                        y: e.y,
                        textAlign: i > t.x ? "right" : "left"
                    })
                }
            }
            ).prototype = new y,
            (C = function() {
                this.name = "TextStroke"
            }
            ).prototype = new m,
            (i = i || {}).model = i.model || {},
            i.model.toolModel = i.model.toolModel || {},
            i.model.toolModel.Line = h,
            i.model.toolModel.CurveClosed = o,
            i.model.toolModel.Rect = p,
            i.model.toolModel.Circle = A,
            i.model.toolModel.Pen = d,
            i.model.toolModel.CurveClosedStroke = n,
            i.model.toolModel.RectStroke = g,
            i.model.toolModel.CircleStroke = e,
            i.model.toolModel.Eraser = s,
            i.model.toolModel.FloodFill = c,
            i.model.toolModel.EyeDropper = l,
            i.model.toolModel.Cross = t,
            i.model.toolModel.Ellipes = r,
            i.model.toolModel.EllipesStroke = a,
            i.model.toolModel.Text = m,
            i.model.toolModel.TextStroke = C
        }();
        this.init = function() {
            i.initImgDiv(),
            i.initCanvas(),
            i.initTitleDiv(),
            i.initTool(),
            i.initTopTool(),
            i.Index.init(),
            i.Nav.init(),
            i.Tool.init(),
            i.Canvas.init()
        }
        ,
        this.initTool = function() {
            xh.append(i.element, '<div id="tool-wrap" class="tool-wrap" style="\nwidth: 300px;\n    position: absolute;\n    height: 100px;\n    left: 50%;\n    transform: translateX(-50%);\n    bottom: -10px;">\n        <div class="tool-panel" style="    display: flex;">\n            <div class="" style="height: 42px"></div>\n            <div class="shape wrap yj-group">\n                <button class="line yj-but" title="直线" data-tool="shape" data-tool-class="Line"></button>\n                <button class="curve-closed yj-but" title="闭合曲线" data-tool="shape"\n                        data-tool-class="CurveClosed"></button>\n                <button class="rect yj-but" title="矩形" data-tool="shape" data-tool-class="Rect"></button>\n                <button class="circle yj-but" title="圆" data-tool="shape" data-tool-class="Circle"></button>\n                <button class="ellipes yj-but" title="椭圆" data-tool="shape" data-tool-class="Ellipes"></button>\n                <button class="arrow yj-but" title="箭头(未实现)" data-tool="shape" data-tool-class="Arrow"></button>\n                <div id="tool-shape-attribute-panel" class="tool-attribute-panel" title="形状属性面板">\n                    <form>\n                        <fieldset>\n                            <legend>属性</legend>\n                            <label>尺寸：<input class="width" type="range" min="1" max="100" value="1"\n                                             data-attr="lineWidth"/><span>1</span></label>\n                            <label>不透明度：<input class="opacity" type="range" max="100" value="100"\n                                               data-attr="opacity"/><span>100</span></label>\n                        </fieldset>\n                        <fieldset>\n                            <legend>阴影</legend>\n                            <label>阴影水平偏移量：<input class="shadow-offsetx" type="range" min="-10" max="10" value="0"\n                                                  data-attr="shadowOffsetX"/><span>0</span></label>\n                            <label>阴影竖直偏移量：<input class="shadow-offsety" type="range" min="-10" max="10" value="0"\n                                                  data-attr="shadowOffsetY"/><span>0</span></label>\n                            <label>阴影模糊：<input class="shadow-blur" type="range" min="0" max="10" value="0"\n                                               data-attr="shadowBlur"/><span>0</span></label>\n                            <label>阴影颜色：<input class="shadow-color" type="color" data-attr="shadowColor"/></label>\n                        </fieldset>\n                    </form>\n                </div>\n            </div>\n            <div class="stroke wrap yj-group">\n                <button class="pen yj-but" title="铅笔" data-tool="stroke" data-tool-class="Pen"></button>\n                <button class="curve-closed-stroke yj-but" title="闭合曲线" data-tool="stroke"\n                        data-tool-class="CurveClosedStroke"></button>\n                <button class="rect-stroke yj-but" title="矩形" data-tool="stroke" data-tool-class="RectStroke"></button>\n                <button class="circle-stroke yj-but" title="圆形" data-tool="stroke"\n                        data-tool-class="CircleStroke"></button>\n                <button class="ellipes-stroke yj-but" title="椭圆" data-tool="stroke"\n                        data-tool-class="EllipesStroke"></button>\n                <button class="arrow-stroke yj-but" title="箭头(未实现)" data-tool="stroke"\n                        data-tool-class="ArrowStroke"></button>\n                <div id="tool-stroke-attribute-panel" class="tool-attribute-panel" title="轮廓属性面板">\n                    <form>\n                        <fieldset>\n                            <legend>属性</legend>\n                            <label>尺寸：<input class="width" type="range" min="1" max="100" value="1"\n                                             data-attr="lineWidth"/><span>1</span></label>\n                            <label>不透明度：<input class="opacity" type="range" max="100" value="100"\n                                               data-attr="opacity"/><span>100</span></label>\n                        </fieldset>\n                        <fieldset>\n                            <legend>阴影</legend>\n                            <label>阴影水平偏移量：<input class="shadow-offsetx" type="range" min="-10" max="10" value="0"\n                                                  data-attr="shadowOffsetX"/><span>0</span></label>\n                            <label>阴影竖直偏移量：<input class="shadow-offsety" type="range" min="-10" max="10" value="0"\n                                                  data-attr="shadowOffsetY"/><span>0</span></label>\n                            <label>阴影模糊：<input class="shadow-blur" type="range" min="0" max="10" value="0"\n                                               data-attr="shadowBlur"/><span>0</span></label>\n                            <label>阴影颜色：<input class="shadow-color" type="color" data-attr="shadowColor"/></label>\n                        </fieldset>\n                    </form>\n                </div>\n            </div>\n            <div class="eraser wrap">\n                <div id="tool-eraser-attribute-panel" class="tool-attribute-panel" title="橡皮属性面板">\n                    <form>\n                        <fieldset>\n                            <legend>属性</legend>\n                            <label>尺寸：<input class="size" type="range" min="1" max="100" data-attr="lineWidth"\n                                             value="1"/><span>1</span></label>\n                            <label>不透明度：<input class="opacity" type="range" max="100" value="100"\n                                               data-attr="opacity"/><span>100</span></label>\n                        </fieldset>\n                    </form>\n                </div>\n            </div>\n            <div class="flood-fill wrap">\n                <div id="tool-flood-fill-attribute-panel" class="tool-attribute-panel" title="油漆桶属性面板">\n                    <form>\n                        <fieldset>\n                            <legend>属性</legend>\n                            <label>限制：<input class="allowance" type="range" min="1" max="200" data-attr="allowance"\n                                             value="1"/><span>1</span></label>\n                        </fieldset>\n                    </form>\n                </div>\n            </div>\n            <div class="text wrap yj-group">\n                <button class="text yj-but" title="文本" data-tool="text" data-tool-class="Text"></button>\n                <button class="text-stroke yj-but" title="文本轮廓" data-tool="text" data-tool-class="TextStroke"></button>\n                <div id="tool-text-attribute-panel" class="tool-attribute-panel" title="文字属性面板">\n                    <form>\n                        <label>文本: <input class="text" type="text" placeholder="输入要输入的文字" data-attr="text"/></label>\n                        <fieldset>\n                            <legend>属性</legend>\n                            <label>字体:\n                                <select class="font" data-attr="family">\n                                    <option selected="true" class="serif" value="serif">serif</option>\n                                    <option class="sans-serif" value="sans-serif">sans-serif</option>\n                                    <option class="arail" value="Arial">Arial</option>\n                                    <option class="arial-black" value="Arial Black">Arial Black</option>\n                                    <option class="terminal" value="Terminal">Terminal</option>\n                                    <option class="verdana" value="Verdana">Verdana</option>\n                                    <option class="fangzhengshuti" value="方正舒体">方正舒体</option>\n                                    <option class="fangzhengyaoti" value="方正姚体">方正姚体</option>\n                                    <option class="heiti" value="黑体">黑体</option>\n                                    <option class="huawencaiyun" value="华文彩云">华文彩云</option>\n                                    <option class="huawenhupo" value="华文琥珀">华文琥珀</option>\n                                    <option class="huawenxinwei" value="华文新魏">华文新魏</option>\n                                    <option class="huawenzhongsong" value="华文中宋">华文中宋</option>\n                                    <option class="kaiti" value="楷体_GB2312">楷体_GB2312</option>\n                                    <option class="lishu" value="隶书">隶书</option>\n                                    <option class="songti" value="宋体">宋体</option>\n                                    <option class="weiruanyahei" value="微软黑体">微软黑体</option>\n                                    <option class="youyuan" value="幼圆">幼圆</option>\n                                </select>\n                            </label>\n                            <label class="checkbox"><b>粗体:</b>\n                                <input class="bold" type="checkbox" value="bold" data-attr="bold">\n                            </label>\n                            <label class="checkbox"><i>斜体 :</i>\n                                <input class="italic" type="checkbox" value="italic" data-attr="italic">\n                            </label>\n                            <label>字体大小：<input class="size" type="range" min="8" max="100" data-attr="size" value="10"/><span>10</span><span>px</span></label>\n                            <label>边界：<input class="border" type="range" min="1" max="100" data-attr="border"\n                                             value="1"/><span>1</span><span></span></label>\n                            <label>不透明度：<input class="opacity" type="range" max="100" data-attr="opacity"\n                                               value="100"/><span>100</span></label>\n                        </fieldset>\n                        <fieldset>\n                            <legend>阴影</legend>\n                            <label>阴影水平偏移量：<input class="shadow-offsetx" type="range" min="-10" max="10" value="0"\n                                                  data-attr="shadowOffsetX"/><span>0</span></label>\n                            <label>阴影竖直偏移量：<input class="shadow-offsety" type="range" min="-10" max="10" value="0"\n                                                  data-attr="shadowOffsetY"/><span>0</span></label>\n                            <label>阴影模糊：<input class="shadow-blur" type="range" min="0" max="10" value="0"\n                                               data-attr="shadowBlur"/><span>0</span></label>\n                            <label>阴影颜色：<input class="shadow-color" type="color" data-attr="shadowColor"/></label>\n                        </fieldset>\n                    </form>\n                </div>\n            </div>\n        </div>\n        <div class="tool yj-group" style="\n height: 40px;\n    width: 335px;\n    display: flex;\n    margin-top: 3px;">\n            <div class="yj-group" style="    display: flex;\n    margin-left: 0px;">\n                <button class="select  yj-but" title="选择工具(未实现)"></button>\n                <button class="eraser yj-but" title="橡皮擦工具" data-current-tool="Eraser"\n                        data-tool-panel="eraser"></button>\n                <button class="flood-fill yj-but" title="填充工具" data-current-tool="FloodFill"\n                        data-tool-panel="flood-fill"></button>\n                <button class="eye-dropper yj-but" title="吸管工具" data-current-tool="EyeDropper"\n                        data-tool-panel="eye-dropper"></button>\n                <div class="" id="colorModal" style="\n        height: 42px;\n        background: rgba(128,128,128,.8);\n        width: 40px;\n        border-radius: 4px;">\n                    <div class="" style="\n             margin-left: 5px;\n             margin-top: 6px;" title="选择颜色">\n                        <input class="color"/>\n                    </div>\n                </div>\n            </div>\n            <div class="yj-group" style=" display: flex;">\n                <button class="shape active yj-but" title="形状工具" data-current-tool="Line"\n                        data-tool-panel="shape"></button>\n                <button class="stroke yj-but" title="轮廓工具" data-current-tool="Pen" data-tool-panel="stroke"></button>\n                <button class="text yj-but" title="文字工具" data-tool-panel="text" data-current-tool="Text"></button>\n            </div>\n            <div class="yj-group" style=" display: flex;">\n                <button id="nav-file-import-img" class="image yj-but" title="插入图片"></button>\n            </div>\n        </div>\n    </div>')
        }
        ,
        this.initCanvas = function() {
            xh.append(i.element, '    <div class="container-fluid" style="">\n        <canvas width="1900" height="887" class="canvas-paint canvas-negative"></canvas>\n        <canvas width="1900" height="887" class="canvas-paint canvas-layer"></canvas>\n        <canvas width="1900" height="887" class="canvas-paint canvas-buffer"></canvas>\n        <canvas width="1900" height="887" id="canvas-mouse" class="canvas-paint canvas-mouse"></canvas>\n    </div>')
        }
        ,
        this.initTopTool = function() {
            xh.append(i.element, '<div class="tool" style="position: absolute;right: 10px;height: 42px; top: 5px;">\n        <div class="yj-group" style="height: 100%;">\n            <button type="button" id="nav-file-save" class="yj-but save" title="保存(ctrl+s)"></button>\n            <button type="button" id="nav-file-saveAs" class="yj-but saveAs" title="另存为"></button>\n            <button type="button" id="nav-edit-undo" class="yj-but undo" title="撤销(ctrl+z)"></button>\n            <button type="button" id="edit-exit" class="yj-but exit" title="退出"></button>\n        </div>\n    </div>'),
            xh.addEventListener(document.querySelectorAll("#edit-exit"), "click", i.exit)
        }
        ,
        this.initTitleDiv = function() {
            xh.append(i.element, ' <div class=\'postilTitle\'>\n    <div class="postilTitleDiv"><span class="titleText" >文件编号-文件名-版本</span></div>\n    </div>')
        }
        ,
        this.initImgDiv = function() {
            xh.append(i.element, '    <div id="myModal" class="modal hide " tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">\n        <div class="modal-header">\n            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>\n            <h3 id="myModalLabel">保存图片-右键-图片另存为</h3>\n        </div>\n        <div class="modal-body">\n            <p><img id="save-image" src="" style="outline: 1px solid #ff0"></p>\n        </div>\n        <div class="modal-footer">\n            <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>\n        </div>\n    </div>');
            var A = document.querySelector("#myModal");
            xh.addEventListener(A.querySelector(".close"), "click", (function() {
                xh.addClass(A, "hide"),
                xh.remove(document.querySelector(".modal-backdrop"))
            }
            )),
            xh.addEventListener(A.querySelector(".btn"), "click", (function() {
                xh.addClass(A, "hide"),
                xh.remove(document.querySelector(".modal-backdrop"))
            }
            ));
            xh.append(i.element, ' <div id="image-modal" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"\n         aria-hidden="true">\n        <div class="modal-header">\n            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>\n            <h3 id="myModalLabel">导入图片</h3>\n        </div>\n        <div class="modal-body">\n            <form>\n                <fieldset>\n                    <legend>导入图片</legend>\n                    <label><input id="image-modal-file" type="file" accept="image/jpg,image/jpeg,image/png"/></label>\n                </fieldset>\n                <fieldset>\n                    <legend>属性</legend>\n                    <label>x坐标 <input id="image-modal-x" type="number" min="0" max="2000" value="10"/></label>\n                    <label>y坐标 <input id="image-modal-y" type="number" min="0" max="2000" value="10"/></label>\n                    <br>                    <label>宽度 <input id="image-modal-width" type="number" min="0" max="2000" value="800"/></label>\n                    <label>高度 <input id="image-modal-height" type="number" min="0" max="2000" value="600"/></label>\n                </fieldset>\n                <fieldset>\n                    <legend>预览</legend>\n                    <figure>\n                        <img id="image-modal-view"/>\n                    </figure>\n                </fieldset>\n            </form>\n        </div>\n        <div class="modal-footer">\n            <button class="btn but-cancel" data-dismiss="modal" aria-hidden="true">取消</button>\n            <button id="image-modal-ok" class="btn btn-primary" data-dismiss="modal" aria-hidden="true">插入</button>\n        </div>\n    </div>');
            var e = document.querySelector("#image-modal");
            xh.addEventListener(e.querySelector(".close"), "click", (function() {
                xh.addClass(e, "hide"),
                xh.remove(document.querySelector(".modal-backdrop"))
            }
            )),
            xh.addEventListener(e.querySelector(".but-cancel"), "click", (function() {
                xh.addClass(e, "hide"),
                xh.remove(document.querySelector(".modal-backdrop"))
            }
            )),
            xh.addEventListener(e.querySelector(".btn-primary"), "click", (function() {
                xh.addClass(e, "hide"),
                xh.remove(document.querySelector(".modal-backdrop"))
            }
            ))
        }
        ,
        this.setTitle = function(A) {
            [].map.call(document.querySelectorAll(".titleText"), (function(e, t) {
                e.textContent = A
            }
            ))
        }
        ,
        this.getTitle = function() {
            return document.querySelector(".titleText").textContent
        }
        ,
        this.exit = function() {
            i.hide(),
            e.postilExit()
        }
        ,
        this.hide = function() {
            i.element.style.display = "none"
        }
        ,
        this.show = function() {
            i.element.style.display = "block"
        }
        ,
        this.clear = function() {
            i.canvas.mouseCanvasContainer.getCanvas().clear(),
            i.canvas.bufferCanvasContainer.getCanvas().clear(),
            i.canvas.currentCanvasContainer.getCanvas().clear(),
            i.canvas.negativeCanvasContainer.getCanvas().clear(),
            i.change = !1
        }
        ,
        this.updateSize = function(A, e) {
            i.canvas.currentCanvasContainer.getCanvas().updateSize(A, e),
            i.canvas.bufferCanvasContainer.getCanvas().updateSize(A, e),
            i.canvas.mouseCanvasContainer.getCanvas().updateSize(A, e),
            i.canvas.negativeCanvasContainer.getCanvas().updateSize(A, e)
        }
        ,
        this.bindEvent = function() {}
        ,
        this.getCoordsWithinElement = function(A) {
            var e = [0, 0];
            if (A) {
                for (var t = A.target, i = 0, o = 0; t.offsetParent; )
                    i += t.offsetLeft - t.scrollLeft,
                    o += t.offsetTop - t.scrollTop,
                    t = t.offsetParent;
                e[0] = Math.round(A.pageX - i),
                e[1] = Math.round(A.pageY - o)
            } else
                A = window.event,
                e[0] = Math.round(A.x),
                e[0] = Math.round(A.y);
            return e
        }
        ,
        this.Index = {
            init: function() {
                this.bindEvent()
            },
            bindEvent: function() {
                var A = i.element
                  , e = null
                  , t = null;
                xh.bind(A, "keydown", (function(A) {
                    A.ctrlKey && 90 === A.keyCode && (xh.simulateEvent(document.querySelector("#nav-edit-undo"), "click"),
                    A.preventDefault())
                }
                )),
                xh.bind(A, "keydown", (function(A) {
                    A.ctrlKey && 83 === A.keyCode && (xh.simulateEvent(document.querySelector("#nav-file-save"), "click"),
                    A.preventDefault())
                }
                )),
                xh.bind(A, "keydown", (function(A) {
                    A.ctrlKey && 68 === A.keyCode && (xh.simulateEvent(document.querySelector("#nav-edit-clear"), "click"),
                    A.preventDefault())
                }
                )),
                xh.bind(A, "keydown", (function(A) {
                    A.ctrlKey && 69 === A.keyCode && (xh.simulateEvent(document.querySelector("#nav-file-export"), "click"),
                    A.preventDefault())
                }
                )),
                xh.bind(document, "resize", (function(A) {
                    var e = i.canvas
                      , t = e.currentCanvasContainer.getCanvas()
                      , o = e.bufferCanvasContainer.getCanvas()
                      , n = e.mouseCanvasContainer.getCanvas()
                      , r = i.canvas.negativeCanvasContainer.getCanvas();
                    t.updateSize(),
                    o.updateSize(),
                    n.updateSize(),
                    r.updateSize()
                }
                )),
                xh.delegate(i.element, "#negative-modal-file", "change", (function(A) {
                    var t = A.target.files
                      , i = new FileReader;
                    i.readAsDataURL(t[0]),
                    i.onload = function() {
                        var A = document.querySelector("#negative-modal").querySelector("#negative-modal-view");
                        e = i.result,
                        A.setAttribute("src", i.result),
                        xh.bind(A, "load", (function() {
                            var A = document.querySelector("#negative-modal")
                              , e = A.querySelector("#negative-modal-width")
                              , t = A.querySelector("#negative-modal-height");
                            e.value = parseInt(xh.getStyleValue(this, "width"), 0),
                            t.value = parseInt(xh.getStyleValue(this, "height"), 0)
                        }
                        ))
                    }
                }
                )),
                xh.delegate(i.element, "#negative-modal-ok", "click", (function(A) {
                    var t = i.canvas.negativeCanvasContainer.getCanvas()
                      , o = new i.model.shapeModel.ImageShape
                      , n = document.querySelector("#negative-modal")
                      , r = n.querySelector("#negative-modal-x").value
                      , a = n.querySelector("#negative-modal-y").value
                      , s = parseInt(n.querySelector("#negative-modal-width").value, 0)
                      , l = parseInt(n.querySelector("#negative-modal-height").value, 0);
                    o.init({
                        x: r,
                        y: a,
                        width: s,
                        height: l,
                        src: e
                    }),
                    t.paint(o)
                }
                )),
                xh.delegate(i.element, "#image-modal-file", "change", (function(A) {
                    var e = A.target.files
                      , i = new FileReader;
                    i.readAsDataURL(e[0]),
                    i.onload = function() {
                        var A = document.querySelector("#image-modal").querySelector("#image-modal-view");
                        t = i.result,
                        A.setAttribute("src", i.result),
                        xh.bind(A, "load", (function() {
                            var A = document.querySelector("#image-modal")
                              , e = A.querySelector("#image-modal-width")
                              , t = A.querySelector("#image-modal-height");
                            e.value = parseInt(xh.getStyleValue(this, "width"), 0),
                            t.value = parseInt(xh.getStyleValue(this, "height"), 0)
                        }
                        ))
                    }
                }
                )),
                xh.delegate(i.element, "#image-modal-ok", "click", (function(A) {
                    var e = i.canvas.currentCanvasContainer.getCanvas()
                      , o = new i.model.shapeModel.ImageShape
                      , n = document.querySelector("#image-modal")
                      , r = n.querySelector("#image-modal-x").value
                      , a = n.querySelector("#image-modal-y").value
                      , s = parseInt(n.querySelector("#image-modal-width").value, 0)
                      , l = parseInt(n.querySelector("#image-modal-height").value, 0);
                    o.init({
                        x: r,
                        y: a,
                        width: s,
                        height: l,
                        src: t
                    }),
                    e.paint(o)
                }
                ))
            }
        },
        this.Canvas = {
            clickStatus: !1,
            pointList: Object.create(n),
            getPointList: function() {
                return this.pointList
            },
            getClickStatus: function() {
                return this.clickStatus
            },
            setClickStatus: function(A) {
                return this.clickStatus = A = A || !1,
                A
            },
            init: function() {
                var A = document.querySelectorAll(".canvas-negative")[0]
                  , e = new s
                  , t = Object.create(a)
                  , o = document.querySelectorAll(".canvas-layer")[0]
                  , n = new s
                  , r = Object.create(a)
                  , l = document.querySelectorAll(".canvas-buffer")[0]
                  , c = new s
                  , h = Object.create(a)
                  , d = document.querySelectorAll(".canvas-mouse")[0]
                  , p = new s
                  , g = Object.create(a);
                e.init(A, "negativeCanvas"),
                t.init(e),
                i.canvas = i.canvas || {},
                i.canvas.negativeCanvasContainer = t,
                n.init(o, "currentCanvas"),
                r.init(n),
                i.canvas = i.canvas || {},
                i.canvas.currentCanvasContainer = r,
                c.init(l, "bufferCanvas"),
                h.init(c),
                i.canvas = i.canvas || {},
                i.canvas.bufferCanvasContainer = h,
                p.init(d, "mouseCanvas"),
                g.init(p),
                i.canvas = i.canvas || {},
                i.canvas.mouseCanvasContainer = g,
                this.bindEvent()
            },
            bindEvent: function() {
                var A = i.element
                  , e = i.canvas.mouseCanvasContainer.getCanvas()
                  , t = i.canvas.bufferCanvasContainer.getCanvas()
                  , o = i.canvas.currentCanvasContainer.getCanvas()
                  , n = e.getLeft()
                  , r = e.getTop()
                  , a = this
                  , s = i.tool.currentToolContainer.getTool();
                xh.delegate(A, "#canvas-mouse", "mousemove", (function(A) {
                    var o = i.getCoordsWithinElement(A)
                      , n = null
                      , r = null
                      , l = ""
                      , c = null
                      , h = null
                      , d = a.getClickStatus()
                      , p = ""
                      , g = null
                      , u = null;
                    "shape" === s.getClassName() && (n = {
                        x: o[0],
                        y: o[1]
                    },
                    p = s.getMouse(),
                    g = s.getOption(),
                    (u = new i.model.mouseModel[p]).init(g, n),
                    e.clear(),
                    e.paint(u),
                    d && (l = s.getName(),
                    (r = a.getPointList()).add(n),
                    h = s.setPoint(r),
                    "FloodFill" !== (c = new i.model.shapeModel[l]).getName() && (c.init(h),
                    t.clear(),
                    t.paint(c))))
                }
                )),
                xh.delegate(A, "#canvas-mouse", "mousedown", (function(A) {
                    var e = i.getCoordsWithinElement(A)
                      , t = {
                        x: e[0],
                        y: e[1]
                    };
                    a.getPointList();
                    a.getPointList().init(),
                    a.getPointList().add(t),
                    a.setClickStatus(!0)
                }
                )),
                xh.delegate(A, "#canvas-mouse", "mouseup", (function(A) {
                    var e = i.getCoordsWithinElement(A)
                      , n = {
                        x: e[0],
                        y: e[1]
                    }
                      , r = a.getPointList()
                      , l = s.getName()
                      , c = null
                      , h = null;
                    "shape" === s.getClassName() && (a.getPointList().add(n),
                    a.setClickStatus(!1),
                    c = new i.model.shapeModel[l],
                    h = s.setPoint(r),
                    c.init(h),
                    o.paint(c),
                    t.clear())
                }
                )),
                xh.delegate(A, "#canvas-mouse", "mouseleave", (function(A) {
                    e.clear()
                }
                )),
                xh.delegate(A, "#canvas-mouse", "mouseenter", (function(A) {
                    e.clear(),
                    s = i.tool.currentToolContainer.getTool()
                }
                )),
                document.getElementById("canvas-mouse").addEventListener("touchmove", (function(A) {
                    var o = null
                      , l = null
                      , c = ""
                      , h = null
                      , d = null
                      , p = a.getClickStatus()
                      , g = ""
                      , u = null
                      , f = null
                      , m = s.getClassName()
                      , C = A.changedTouches[0];
                    A.preventDefault(),
                    "shape" === m && (o = {
                        x: C.pageX - n,
                        y: C.pageY - r
                    },
                    g = s.getMouse(),
                    u = s.getOption(),
                    (f = new i.model.mouseModel[g]).init(u, o),
                    e.clear(),
                    e.paint(f),
                    p && (c = s.getName(),
                    (l = a.getPointList()).add(o),
                    d = s.setPoint(l),
                    (h = new i.model.shapeModel[c]).init(d),
                    t.clear(),
                    t.paint(h)))
                }
                ), !1),
                document.getElementById("canvas-mouse").addEventListener("touchstart", (function(A) {
                    var e = A.touches[0]
                      , t = {
                        x: e.pageX - n,
                        y: e.pageY - r
                    };
                    a.getPointList();
                    A.preventDefault(),
                    a.getPointList().init(),
                    a.getPointList().add(t),
                    a.setClickStatus(!0)
                }
                ), !1),
                document.getElementById("canvas-mouse").addEventListener("touchend", (function(A) {
                    var e = A.changedTouches[0]
                      , l = {
                        x: e.pageX - n,
                        y: e.pageY - r
                    }
                      , c = a.getPointList()
                      , h = s.getName()
                      , d = null
                      , p = null
                      , g = s.getClassName();
                    A.preventDefault(),
                    "shape" === g && (a.getPointList().add(l),
                    a.setClickStatus(!1),
                    d = new i.model.shapeModel[h],
                    p = s.setPoint(c),
                    d.init(p),
                    o.paint(d),
                    t.clear())
                }
                ), !1)
            }
        },
        this.Nav = {
            init: function() {
                this.bindEvent()
            },
            bindEvent: function() {
                var A = i.element;
                xh.delegate(A, "#nav-file-export", "click", (function(e) {
                    var t = i.canvas.currentCanvasContainer.getCanvas()
                      , o = i.canvas.negativeCanvasContainer.getCanvas()
                      , n = document.createElement("canvas");
                    n.width = t.width,
                    n.height = t.height;
                    var r = n.getContext("2d");
                    r.drawImage(o.getCanvas(), 0, 0),
                    r.drawImage(t.getCanvas(), 0, 0),
                    document.querySelectorAll("#save-image")[0].src = n.toDataURL(),
                    xh.append(A, "<div class='modal-backdrop'></div>"),
                    [].map.call(document.querySelectorAll("#myModal"), (function(A, e) {
                        xh.removeClass(A, "hide")
                    }
                    ))
                }
                )),
                xh.delegate(A, "#nav-file-saveAs", "click", (function(e) {
                    var t = i.canvas.currentCanvasContainer.getCanvas()
                      , o = i.canvas.negativeCanvasContainer.getCanvas()
                      , n = document.createElement("canvas");
                    n.width = t.width,
                    n.height = t.height;
                    var r = n.getContext("2d");
                    r.drawImage(o.getCanvas(), 0, 0),
                    r.drawImage(t.getCanvas(), 0, 0),
                    document.querySelectorAll("#save-image")[0].src = n.toDataURL(),
                    xh.append(A, "<div class='modal-backdrop'></div>"),
                    [].map.call(document.querySelectorAll("#myModal"), (function(A, e) {
                        xh.removeClass(A, "hide")
                    }
                    ))
                }
                )),
                xh.delegate(A, "#nav-file-save", "click", (function(A) {
                    var t = i.canvas.currentCanvasContainer.getCanvas()
                      , o = i.canvas.negativeCanvasContainer.getCanvas();
                    t.save(),
                    o.save();
                    var n = i.lobibox.alert("success", {
                        msg: "保存成功",
                        title: "保存",
                        backdrop: !0,
                        buttons: {
                            yes: {
                                closeOnClick: !1,
                                text: "关闭"
                            }
                        },
                        callback: function(A, t) {
                            A.destroy(),
                            e.postilSave()
                        }
                    })
                      , r = (new Date).getTime() - i.lobibox.alert.startTime;
                    n.$el.style.zIndex = r + 2
                }
                )),
                xh.delegate(A, "#nav-file-open", "click", (function(e) {
                    xh.append(A, "<div class='modal-backdrop'></div>"),
                    [].map.call(document.querySelectorAll("#image-modal"), (function(A, e) {
                        xh.removeClass(A, "hide")
                    }
                    ))
                }
                )),
                xh.delegate(A, "#nav-file-import-img", "click", (function(e) {
                    xh.append(A, "<div class='modal-backdrop'></div>"),
                    [].map.call(document.querySelectorAll("#image-modal"), (function(A, e) {
                        xh.removeClass(A, "hide")
                    }
                    ))
                }
                )),
                xh.delegate(A, "#nav-edit-undo", "click", (function(A) {
                    i.canvas.currentCanvasContainer.getCanvas().undo(),
                    e.undo()
                }
                )),
                xh.delegate(A, "#nav-edit-clear", "click", (function(A) {
                    i.canvas.currentCanvasContainer.getCanvas().clear()
                }
                )),
                xh.delegate(A, "#nav-edit-clear-negative", "click", (function(A) {
                    i.canvas.negativeCanvasContainer.getCanvas().clear()
                }
                )),
                xh.delegate(A, "#nav-edit-convert", "click", (function(A) {
                    i.canvas.currentCanvasContainer.getCanvas().convert()
                }
                )),
                xh.delegate(A, "#nav-edit-flipx", "click", (function(A) {
                    i.canvas.currentCanvasContainer.getCanvas().flipX()
                }
                )),
                xh.delegate(A, "#nav-edit-flipy", "click", (function(A) {
                    i.canvas.currentCanvasContainer.getCanvas().flipY()
                }
                ))
            }
        };
        var r;
        (r = function() {
            this.currentOpenAttributePanel = null,
            this.colorPicker = void 0,
            this.attributePanelWindow = void 0
        }
        ).prototype = {
            init: function() {
                this.bindEvent(),
                this.initAttributePanel(),
                this.initColor(),
                i.tool = i.tool || {},
                i.tool.currentToolContainer = Object.create(i.model.ToolContainerModel),
                i.tool.currentToolContainer.init(new i.model.toolModel.Line)
            },
            initAttributePanel: function() {
                document.querySelector("#tool-wrap");
                var A = document.querySelector("#tool-shape-attribute-panel")
                  , e = document.createElement("div");
                e.className = "tool-attribute-panel-content",
                this.attributePanelWindow = i.lobibox.window({
                    title: "属性面板",
                    width: 334,
                    height: 415,
                    closeOnEsc: !1,
                    closeButton: !0,
                    afterWindowHide: function(A) {},
                    content: e
                }),
                this.attributePanelWindow.setPosition({
                    left: "",
                    right: 35,
                    bottom: 120
                }),
                this.attributePanelWindow.windowHide();
                var t = document.querySelectorAll(".tool-attribute-panel");
                [].map.call(t, (function(A, t) {
                    A.style.display = "none",
                    e.appendChild(A)
                }
                )),
                this.setCurrentAttributePanel(A),
                this.openAttributePanel(A)
            },
            initColor: function() {
                var A = document.querySelector("#tool-wrap .tool .color");
                this.colorPicker = new Hh(A),
                A.style.display = "none";
                var e = A.parentNode;
                xh.append(e, '<div id="colorOperatorDiv"></div>');
                var t = e.querySelector("#colorOperatorDiv")
                  , i = this.colorPicker.element;
                i.id = "toolColorModal",
                i.className = "colorModal",
                i.style.cssText += "margin-left:" + t.offsetLeft + "px;bottom:50px",
                t.addEventListener("click", (function(A) {
                    i.focus(),
                    i.style.display = "block" === i.style.display ? "none" : "block",
                    A.stopPropagation ? A.stopPropagation() : A.cancelBubble = !0
                }
                )),
                document.addEventListener("click", (function(A) {}
                )),
                xh.addEventListener(A, "change", (function(e) {
                    xh.css(t, {
                        "background-color": A.value
                    })
                }
                )),
                A.parentNode.parentNode.appendChild(i)
            },
            openAttributePanel: function(A) {
                document.querySelector("#tool-wrap"),
                document.querySelector(".tool-attribute-panel-content");
                var e = document.querySelectorAll(".tool-attribute-panel")
                  , t = A || this.getCurrentAttributePanel();
                t && ([].map.call(e, (function(A, e) {
                    A.style.display = A.id == t.id ? "block" : "none"
                }
                )),
                this.attributePanelWindow.windowShow())
            },
            getCurrentAttributePanel: function() {
                return this.currentOpenAttributePanel
            },
            setCurrentAttributePanel: function(A) {
                return void 0 !== A && (this.currentOpenAttributePanel = A,
                !0)
            },
            bindEvent: function() {
                var A = document.querySelector("#tool-wrap")
                  , e = this;
                xh.delegate(A.querySelector(".tool"), "button", "click", (function(A) {
                    if ("nav-file-import-img" === this.id)
                        e.attributePanelWindow.$el.style.zIndex = 888;
                    else {
                        var t = document.querySelector("#tool-wrap")
                          , o = this.getAttribute("data-tool-panel")
                          , n = t.querySelector(".tool-panel ." + o)
                          , r = t.querySelectorAll(".tool-panel .wrap")
                          , a = document.querySelector("#tool-" + o + "-attribute-panel")
                          , s = this.getAttribute("data-current-tool");
                        [].map.call(t.querySelectorAll(".tool button.active"), (function(A, e) {
                            xh.removeClass(A, "active")
                        }
                        )),
                        xh.addClass(this, "active");
                        for (var l = 0; r.length > l; l += 1)
                            r[l].style.display = "none";
                        if (n && (n.style.display = "block"),
                        a) {
                            var c = a.getAttribute("title") ? a.getAttribute("title") : "属性面板";
                            i.Tool.attributePanelWindow.setTitle(c)
                        }
                        if (e.setCurrentAttributePanel(a),
                        e.openAttributePanel(a),
                        !s)
                            return;
                        -1 === s.indexOf("Arrow") ? i.tool.currentToolContainer.init(new i.model.toolModel[s]) : console.log("currentTool： 箭头没有原型类实现")
                    }
                }
                )),
                xh.delegate(A.querySelectorAll(".tool-panel .wrap"), "button", "click", (function(A) {
                    var e = this.getAttribute("data-tool")
                      , t = this.getAttribute("data-tool-class")
                      , i = document.querySelector("#tool-wrap .tool button[data-tool-panel='" + e + "']");
                    i.setAttribute("data-current-tool", t),
                    xh.simulateEvent(i, "click")
                }
                )),
                xh.delegate(A, ".color", "change", (function(A) {
                    var e = this.value;
                    i.tool.currentToolContainer.getTool().setOption({
                        fillStyle: e,
                        strokeStyle: e
                    })
                }
                )),
                xh.delegate(document.querySelectorAll(".tool-attribute-panel"), "select", "change", (function(A) {
                    var e = A.target
                      , t = e.getAttribute("data-attr")
                      , o = e.value
                      , n = i.tool.currentToolContainer.getTool()
                      , r = {};
                    r[t] = o,
                    n.setOption(r)
                }
                )),
                [].map.call(i.element.querySelectorAll("input"), (function(A, e) {
                    var t = A.getAttribute("type");
                    "checkbox" !== t && "radio" !== t && xh.addEventListener(A, "change", (function(A) {
                        var e = A.target
                          , t = e.getAttribute("data-attr")
                          , o = e.value
                          , n = i.tool.currentToolContainer.getTool()
                          , r = {}
                          , a = e.parentNode.querySelector("span");
                        a && (a.textContent = o),
                        r[t] = o,
                        n.setOption(r)
                    }
                    ))
                }
                )),
                [].map.call(i.element.querySelectorAll(".tool-attribute-panel input"), (function(A, e) {
                    "checkbox" === A.getAttribute("type") && xh.addEventListener(A, "change", (function(A) {
                        var e = A.target
                          , t = e.getAttribute("data-attr")
                          , o = e.value
                          , n = e.getAttribute("checked")
                          , r = i.tool.currentToolContainer.getTool()
                          , a = {};
                        a[t] = !0 === n ? o : "",
                        r.setOption(a),
                        window.console.log(n)
                    }
                    ))
                }
                )),
                [].map.call(i.element.querySelectorAll(".tool-attribute-panel input"), (function(A, e) {
                    "radio" === A.getAttribute("type") && xh.addEventListener(A, "change", (function(A) {
                        var e = A.target
                          , t = e.attr("data-attr")
                          , o = e.val()
                          , n = i.tool.currentToolContainer.getTool()
                          , r = {};
                        r[t] = o,
                        n.setOption(r)
                    }
                    ))
                }
                ))
            }
        },
        this.Tool = new r;
        var a = {
            canvas: null,
            init: function(A) {
                this.setCanvas(A)
            },
            setCanvas: function(A) {
                return this.canvas = A,
                !0
            },
            getCanvas: function() {
                return this.canvas
            }
        };
        i.model = i.model || {},
        i.model.CanvasContainerModel = a;
        var s = function() {
            this.canvas = null,
            this.documentName = "",
            this.pictureName = "",
            this.name = "Canvas",
            this.shapeList = [],
            this.convertStatus = "source-over",
            this.flipXStatus = !1,
            this.flipYStatus = !1,
            this.width = 1e3,
            this.height = 400,
            this.context2D = null,
            this.top = 0,
            this.left = 0
        };
        s.prototype = {
            init: function(A, e) {
                this.initCanvas(A),
                this.initHeight(),
                this.initWidth(),
                this.initLeft(),
                this.initTop(),
                this.initContext2D(),
                this.initName(e),
                this.load()
            },
            initName: function(A) {
                this.setName(A)
            },
            setName: function(A) {
                this.name = A
            },
            setDocumentName: function(A) {
                this.documentName = A
            },
            setPictureName: function(A) {
                this.pictureName = A
            },
            getDocumentName: function() {
                return this.documentName
            },
            getPictureName: function() {
                return this.pictureName
            },
            getName: function() {
                return this.name
            },
            initCanvas: function(A) {
                this.setCanvas(A)
            },
            setCanvas: function(A) {
                return null != A && (this.canvas = A,
                !0)
            },
            getCanvas: function() {
                return this.canvas
            },
            initContext2D: function() {
                this.setContext2D()
            },
            getContext2D: function() {
                return this.context2D
            },
            setContext2D: function(A) {
                A = A || this.getCanvas().getContext("2d"),
                this.context2D = A
            },
            clearContext: function() {
                var A = this.getHeight()
                  , e = this.getWidth()
                  , t = this.getContext2D();
                return t.clearRect(0, 0, e, A),
                t
            },
            initLeft: function() {
                this.updateLeft()
            },
            updateLeft: function() {
                var A;
                return A = function(A) {
                    for (var e = A.offsetLeft, t = A.offsetParent; null !== t; )
                        e += t.offsetLeft,
                        t = t.offsetParent;
                    return e
                }(this.getCanvas()),
                this.left = A,
                A
            },
            getLeft: function() {
                return this.left
            },
            initTop: function() {
                this.updateTop()
            },
            updateTop: function() {
                var A;
                return A = function(A) {
                    for (var e = A.offsetTop, t = A.offsetParent; null !== t; )
                        e += t.offsetTop,
                        t = t.offsetParent;
                    return e
                }(this.getCanvas()),
                this.top = A,
                A
            },
            getTop: function() {
                return this.top
            },
            updateSize: function(A, e) {
                this.updateHeight(e),
                this.updateWidth(A),
                this.repaint()
            },
            initHeight: function() {
                this.updateHeight()
            },
            updateHeight: function(A) {
                var e = this.getCanvas()
                  , t = parseInt(xh.getStyleValue(e.parentNode, "height"));
                return A && (t = A),
                e.setAttribute("height", t),
                this.setHeight(t)
            },
            setHeight: function(A) {
                return this.height = A = A || 600,
                A
            },
            getHeight: function() {
                return this.height
            },
            initWidth: function() {
                this.updateWidth()
            },
            updateWidth: function(A) {
                var e = this.getCanvas()
                  , t = parseInt(xh.getStyleValue(e.parentNode, "width"));
                return A && (t = A),
                e.setAttribute("width", t),
                this.setWidth(t)
            },
            setWidth: function(A) {
                return this.width = A = A || 600,
                this.width
            },
            getWidth: function() {
                return this.width
            },
            initShapeList: function() {
                this.clearShapeList()
            },
            getShapeList: function() {
                return uh.extend(!0, [], this.shapeList)
            },
            setShapeList: function(A) {
                return this.clearShapeList(),
                uh.extend(!0, this.shapeList, A),
                A
            },
            addShape: function(A) {
                this.shapeList.push(A)
            },
            deleteShape: function() {
                this.shapeList.pop()
            },
            clearShapeList: function() {
                this.shapeList = []
            },
            paint: function(A) {
                this.addShape(A),
                A.paint(this.getContext2D()),
                "negativeCanvas" != this.name && "currentCanvas" != this.name || (i.change = !0)
            },
            repaint: function() {
                var A, e = this.shapeList, t = e.length, o = 0;
                for (A = this.clearContext(); t > o; o += 1)
                    e[o].paint(A);
                t > 0 && ("negativeCanvas" != this.name && "currentCanvas" != this.name || (i.change = !0))
            },
            undo: function() {
                this.deleteShape(),
                this.repaint()
            },
            clear: function() {
                this.clearContext(),
                this.clearShapeList()
            },
            convert: function() {
                var A = this.getContext2D()
                  , e = A.globalCompositeOperation
                  , t = "source-over" === this.convertStatus ? "destination-over" : "source-over";
                this.convertStatus = t,
                A.globalCompositeOperation = t,
                this.repaint(),
                A.globalCompositeOperation = e
            },
            save: function(A) {
                var e = new i.model.StorageModel
                  , t = []
                  , o = this.shapeList
                  , n = o.length
                  , r = 0
                  , a = this.getName()
                  , s = "";
                if (a = a + "-" + this.getDocumentName() + "-" + this.getPictureName(),
                null != A && (a = A),
                e.init(),
                !1 !== e.getStorage()) {
                    for (; n > r; r += 1)
                        t[r] = {
                            name: o[r].getName(),
                            option: o[r].getOption()
                        };
                    s = window.JSON.stringify(t),
                    e.save(a, s)
                }
            },
            load: function(A) {
                var e, t, o = new i.model.StorageModel, n = [], r = 0, a = this.getName(), s = this.getDocumentName(), l = this.getPictureName(), c = this.shapeList;
                if (a = a + "-" + s + "-" + l,
                null != A && (a = A),
                o.init(),
                !1 !== o.getStorage()) {
                    for (t = o.load(a) || "[]",
                    e = (n = window.JSON.parse(t)).length; e > r; r += 1)
                        c[r] = new i.model.shapeModel[n[r].name],
                        c[r].init(n[r].option);
                    this.repaint()
                }
            },
            autoSave: function(A) {
                var e = this;
                window.setInterval((function() {
                    e.save()
                }
                ), A)
            },
            flipX: function() {
                var A = this.getContext2D()
                  , e = this.getWidth();
                A.save(),
                this.flipXStatus ? this.flipXStatus = !1 : (this.flipXStatus = !0,
                A.translate(e, 0),
                A.scale(-1, 1)),
                this.repaint(),
                A.restore()
            },
            flipY: function() {
                var A = this.getContext2D()
                  , e = this.getHeight();
                A.save(),
                this.flipYStatus ? this.flipYStatus = !1 : (this.flipYStatus = !0,
                A.translate(0, e),
                A.scale(1, -1)),
                this.repaint(),
                A.restore()
            }
        },
        i.model = i.model || {},
        i.model.CanvasModel = s;
        (i = i || {}).model = i.model || {},
        i.model.ToolContainerModel = {
            tool: null,
            init: function(A) {
                A.init(),
                this.setTool(A)
            },
            setTool: function(A) {
                return this.tool = A,
                !0
            },
            getTool: function() {
                return this.tool
            }
        }
    }
      , Jd = function(A, e) {
        var t = A.toolId
          , i = A.Flag
          , o = A.viewer
          , n = e.toolbarTop
          , r = this;
        r.viewer = o,
        r.postilInfo = {},
        this.editingPostilObj = void 0,
        this.editingNodeDom = void 0,
        this.postilDelConf = !0,
        this.eventDispatcher = new Ld;
        var a = 0;
        this.deleteListener = null,
        this.addListener = null,
        this.renameListener = null,
        this.updateListener = null,
        this.exitListener = null,
        this.saveListener = null,
        this.openListener = null,
        this.restoreToPostilListener = null;
        var s = document.createElement("div");
        s.className = "postil-content",
        xh.append(s, '<div class="postil"><div class="postil-body"></div></div><div class="labeling-footer"><button class="but-new-create" id="postilAdd' + t + '">新建批注</button></div></div>'),
        r.postilWindow = qd.window({
            title: "批注",
            width: 334,
            height: 688,
            closeOnEsc: !1,
            closeButton: !0,
            afterWindowHide: function() {
                var A = document.getElementById("postil" + t);
                i.postil = !1,
                A && (A.style.backgroundColor = "",
                A.querySelector(".yj-icon").className = "yj-icon postil-icon")
            },
            content: s
        }),
        r.postilWindow.setPosition({
            left: "",
            right: 5,
            top: 60
        }),
        r.postilWindow.windowHide(),
        xh.addEventListener(n.querySelector("#postil" + t), "click", (function(A) {
            if (i.postil)
                A.target.parentNode.style.backgroundColor = "",
                A.target.className = "yj-icon postil-icon active",
                r.postilWindow.windowHide();
            else {
                r.load([]),
                i.postil = !i.postil,
                r.postilWindow.windowShow();
                var e = o.viewerImpl.modelManager.sceneState;
                A.target.parentNode.style.backgroundColor = "#1f89de",
                A.target.className = "yj-icon postil-icon active",
                e.getSelection()
            }
        }
        )),
        xh.append(document.querySelector("body"), '<div id="postilEdit' + t + '"  style="height: 100%;width:100%;overflow: hidden"></div>'),
        document.querySelector("#postilEdit" + t).style.display = "none",
        this.edit = new Wd("postilEdit" + t,this,o,t),
        r.edit.init(),
        xh.addEventListener(r.postilWindow.$el.querySelector(".postil-body"), "click", (function(A) {
            switch (A.target.className) {
            case "postil-node-delete":
                r.postilDelete(A);
                break;
            case "postil-node-img":
                r.postilflyto(A);
                break;
            case "postil-node-button-update":
                r.postilUpdate(A);
                break;
            case "postil-node-button-edit":
                r.postilEdit(A)
            }
        }
        )),
        xh.addEventListener(r.postilWindow.$el.querySelector(".postil-body"), "dblclick", (function(A) {
            switch (A.target.className) {
            case "postil-node-name":
                r.postilRename(A)
            }
        }
        )),
        this.makePostils = function() {
            var A, e, t, i, n, r = o.viewerImpl.modelManager.getModelSnapshotPhoto();
            A = r.imgURL;
            var s = r.width
              , l = r.height
              , c = o.viewerImpl.getSceneState();
            e = c.camera,
            t = c.state,
            i = c.selection.concat(),
            n = c.modelSelection.concat();
            var h = a;
            return a += 1,
            {
                cameraState: e,
                componentState: t,
                highlightComponentsKeys: i,
                highlightModelsKeys: n,
                imageURL: A,
                width: s,
                height: l,
                num: h,
                code: (new Date).getTime().toString(),
                name: "批注" + h
            }
        }
        ,
        this.clear = function() {
            [].map.call(r.postilWindow.$el.querySelectorAll(".postil .postil-body"), (function(A, e) {
                A.innerHTML = ""
            }
            )),
            r.postilInfo = {},
            r.postilDelConf = !0
        }
        ,
        this.load = function(A) {
            Array.isArray(A) && A.forEach((function(A) {
                r.add(A)
            }
            ))
        }
        ,
        xh.addEventListener(r.postilWindow.$el.querySelector("#postilAdd" + t), "click", (function(A) {
            var e = r.makePostils();
            "function" == typeof r.addListener ? r.addListener(e, (function(A, t) {
                A && r.add(t || e)
            }
            )) : r.add(e)
        }
        )),
        this.add = function(A) {
            var e = A.imageURL
              , t = A.width
              , i = A.height
              , o = A.code
              , n = A.name
              , a = A.num;
            if (A.cameraState && A.componentState && e && o && t && i) {
                for (var s = r.postilWindow.$el.querySelectorAll(".postil-node"), l = 0; s.length > l; l += 1)
                    xh.css(s[l], {
                        border: "2px"
                    });
                var c = '<div class="postil-node" code="' + o + '" imgid="' + o + '"  style="margin-bottom:20px;" num="' + a + '"><div class="postil-node-header"><span class="postil-node-name" title="双击以重命名">' + n + '</span><span class="postil-node-delete" title="删除批注">×</span></div><div class="postil-node-body" title="点击以浏览模型批注"><img class="postil-node-img" width="100%" height=' + parseInt(i * (300 / t), 0) + 'px" src="' + e + '"></div><div class="postil-node-footer"><div><button class="postil-node-button-update" yhtype="update" style="right: 70px" title="将当前模型视角更新到此批注">更新</button></div><div><button class="postil-node-button-edit" yhtype="edit" style="right: 22px" title="查看/编辑批注">编辑</button></div></div>';
                [].map.call(r.postilWindow.$el.querySelectorAll(".postil-body"), (function(A, e) {
                    xh.append(A, c)
                }
                )),
                r.postilInfo[o] = A
            }
        }
        ,
        this.postilEdit = function(A) {
            var e = document.querySelector("#postilEdit" + t);
            e.style.display = "block",
            e.style.height = r.viewer.viewerImpl.getDomElement().style.height,
            e.style.width = r.viewer.viewerImpl.getDomElement().style.width;
            var i = A.target.parentNode.parentNode.parentNode.getAttribute("imgid");
            "function" == typeof r.openListener ? r.openListener(i, (function(A) {
                A && r.open(i)
            }
            )) : r.open(i)
        }
        ,
        this.open = function(A) {
            document.querySelector("#postilEdit" + t).style.display = "block";
            var e = r.postilWindow.$el.querySelector("div[imgid='" + A + "']");
            if (e) {
                this.editingNodeDom = e;
                var i = e.querySelector(".postil-node-name").textContent;
                r.editingPostilObj = r.postilInfo[A],
                r.edit.setTitle(i),
                xh.showOrHideElement(o.viewport, !1),
                r.edit.canvas.currentCanvasContainer.getCanvas().setDocumentName(A),
                r.edit.canvas.currentCanvasContainer.getCanvas().setPictureName(A),
                r.edit.canvas.negativeCanvasContainer.getCanvas().setDocumentName(A),
                r.edit.canvas.negativeCanvasContainer.getCanvas().setPictureName(A);
                var n = r.edit.canvas.negativeCanvasContainer.getCanvas()
                  , a = new r.edit.model.shapeModel.ImageShape
                  , s = e.children[1].children[0].naturalWidth
                  , l = e.children[1].children[0].naturalHeight;
                a.init({
                    x: 0,
                    y: 0,
                    width: s,
                    height: l,
                    src: e.children[1].children[0].src
                }),
                r.edit.clear(),
                n.paint(a),
                r.edit.updateSize(s, l)
            }
        }
        ,
        this.postilUpdate = function(A) {
            var e = A.target.parentNode.parentNode.parentNode.getAttribute("imgid")
              , t = r.makePostils();
            "function" == typeof r.updateListener ? r.updateListener(e, t, (function(A, i, o) {
                A && r.update(i || e, o || t)
            }
            )) : r.update(e, t)
        }
        ,
        this.update = function(A, e) {
            var t = r.postilInfo[A];
            t && (t.cameraState = e.cameraState,
            t.componentState = e.componentState,
            t.highlightComponentsKeys = e.highlightComponentsKeys,
            t.highlightModelsKeys = e.highlightModelsKeys,
            t.imageURL = e.imageURL);
            var i = r.postilWindow.$el.querySelector("div[imgid='" + A + "']");
            if (i) {
                var o = i.querySelector(".postil-node-img");
                o && (o.src = e.imageURL)
            }
        }
        ,
        this.postilDelete = function(A) {
            var e = A.target.parentNode.parentNode.getAttribute("imgid");
            if (r.postilDelConf) {
                var t = qd.alert("info", {
                    msg: "删除不可恢复，确认删除？",
                    title: "删除确认",
                    backdrop: !0,
                    buttons: {
                        yes: {
                            closeOnClick: !1,
                            text: "删除并不再提示"
                        },
                        no: {
                            closeOnClick: !1,
                            text: "删除"
                        }
                    },
                    callback: function(A, t) {
                        "no" !== t && "yes" !== t || ("yes" === t && (r.postilDelConf = !1),
                        "function" == typeof r.deleteListener ? r.deleteListener(e, (function(A) {
                            A && r.delete(e)
                        }
                        )) : r.delete(e)),
                        A.destroy()
                    }
                })
                  , i = (new Date).getTime() - qd.window.startTime;
                [].map.call(r.postilWindow.$el.querySelectorAll(".lobibox-backdrop"), (function(A, e) {
                    xh.css(A, {
                        "z-index": i
                    })
                }
                )),
                t.$el.style.zIndex = i + 2
            } else
                "function" == typeof r.deleteListener ? r.deleteListener(e, (function(A) {
                    A && r.delete(e)
                }
                )) : r.delete(e)
        }
        ,
        this.delete = function(A) {
            var e = r.postilWindow.$el.querySelector("div[imgid='" + A + "']");
            e && e.remove(),
            delete r.postilInfo[A]
        }
        ,
        this.postilRename = function(A) {
            o.viewerImpl.cameraControl.enabled = !1;
            var e = A.target
              , t = e.parentNode.parentNode.getAttribute("imgid")
              , i = e.innerText
              , n = document.createElement("input");
            n.type = "text",
            n.value = i,
            e.innerText = "",
            xh.append(e, n),
            n.focus(),
            n.select(),
            n.addEventListener("blur", (function(A) {
                var e = A.target;
                e.removeEventListener("blur", (function() {}
                )),
                e.value !== i && "" !== xh.trim(e.value) ? "function" == typeof r.renameListener ? r.renameListener(t, e.value, (function(A, o) {
                    A ? r.rename(t, o || e.value) : e.parentNode.innerText = i
                }
                )) : r.rename(t, e.value) : e.parentNode.innerText = i,
                n.remove(),
                o.viewerImpl.cameraControl.enabled = !0
            }
            ))
        }
        ,
        this.rename = function(A, e) {
            var t = r.postilWindow.$el.querySelector("div[imgid='" + A + "']");
            if (t) {
                var i = t.querySelector(".postil-node-name");
                i && (i.innerText = e)
            }
            r.postilInfo[A].name = e
        }
        ,
        this.postilflyto = function(A) {
            for (var e = r.postilWindow.$el.querySelectorAll(".postil-node"), t = 0; e.length > t; t += 1)
                xh.css(e[t], {
                    border: "2px"
                });
            var i = A.target.parentNode.parentNode.getAttribute("code");
            "function" == typeof r.restoreToPostilListener ? r.restoreToPostilListener(i, (function(A) {
                r.restoreToPostil(i)
            }
            )) : r.restoreToPostil(i)
        }
        ,
        this.restoreToPostil = function(A) {
            var e = r.postilInfo[A];
            if (e) {
                o.viewerImpl.setSceneState({
                    camera: e.cameraState,
                    state: e.componentState,
                    selection: e.highlightComponentsKeys,
                    modelSelection: e.highlightModelsKeys
                });
                var t = r.postilWindow.$el.querySelector("div[imgid='" + A + "']");
                t && xh.css(t, {
                    border: "2px solid #002553"
                })
            }
        }
        ,
        this.postilSave = function() {
            "function" == typeof r.saveListener ? r.saveListener(this.editingPostilObj.code, (function(A) {
                A && r.save()
            }
            )) : r.save()
        }
        ,
        this.save = function() {
            r.edit.canvas.currentCanvasContainer.getCanvas().save(),
            r.edit.canvas.negativeCanvasContainer.getCanvas().save();
            var A = r.edit.canvas.currentCanvasContainer.getCanvas()
              , e = r.edit.canvas.negativeCanvasContainer.getCanvas()
              , t = document.createElement("canvas");
            t.width = A.width,
            t.height = A.height;
            var i = t.getContext("2d");
            i.drawImage(e.getCanvas(), 0, 0),
            i.drawImage(A.getCanvas(), 0, 0);
            var o = t.toDataURL();
            r.editingPostilObj.imageURL = o,
            this.editingNodeDom.children[1].children[0].setAttribute("src", o),
            r.eventDispatcher.dispatchEvent({
                type: "POSTIL-EDIT-SAVE",
                event: event,
                data: r.editingPostilObj
            })
        }
        ,
        this.undo = function() {
            r.eventDispatcher.dispatchEvent({
                type: "POSTIL-EDIT-UNDO",
                event: event
            })
        }
        ,
        this.postilExit = function() {
            "function" == typeof r.exitListener ? r.exitListener(this.editingPostilObj.code, (function(A) {
                A && r.exit()
            }
            )) : r.exit()
        }
        ,
        this.exit = function() {
            r.edit.canvas.currentCanvasContainer.getCanvas().clear(),
            r.edit.canvas.negativeCanvasContainer.getCanvas().clear(),
            r.edit.canvas.currentCanvasContainer.getCanvas().setDocumentName(""),
            r.edit.canvas.currentCanvasContainer.getCanvas().setPictureName(""),
            r.edit.canvas.negativeCanvasContainer.getCanvas().setDocumentName(""),
            r.edit.canvas.negativeCanvasContainer.getCanvas().setPictureName(""),
            r.clearPostilStorage(),
            r.edit.hide(),
            r.editingPostilObj = void 0,
            document.querySelector("#" + o.viewport).style.display = "block",
            r.eventDispatcher.dispatchEvent({
                type: "POSTIL-EDIT-CLOSE"
            })
        }
        ,
        this.clearPostilStorage = function() {
            for (var A = localStorage.length, e = [], t = 0; A > t; t += 1) {
                var i = localStorage.key(t);
                -1 === i.indexOf("currentCanvas-") && -1 === i.indexOf("negativeCanvas-") || e.push(i)
            }
            e.map((function(A, e) {
                return localStorage.removeItem(A)
            }
            ))
        }
        ,
        this.clearPostilStorage(),
        this.getPostilByKey = function(A) {
            return r.postilInfo ? r.postilInfo[A] : null
        }
        ,
        this.getAllPostil = function() {
            return r.postilInfo ? r.postilInfo : null
        }
    }
      , zd = function(A, e) {
        var t = document.getElementById("svgBar" + e)
          , i = this;
        if (!t) {
            this.svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"),
            this.svg.setAttribute("id", "svgBar" + e),
            this.svg.setAttribute("style", "width: 100%; height: 10px; position:absolute; left: 0; top:0;"),
            A.appendChild(this.svg);
            var o = Number(2).toString()
              , n = A.clientWidth.toString()
              , r = (A.clientWidth - 2).toString();
            this.backBar = document.createElementNS("http://www.w3.org/2000/svg", "line"),
            this.backBar.setAttribute("id", "backBar" + e),
            this.backBar.setAttribute("class", "progressBar"),
            this.backBar.setAttribute("x1", o),
            this.backBar.setAttribute("y1", "1"),
            this.backBar.setAttribute("x2", n),
            this.backBar.setAttribute("y2", "1"),
            this.backBar.setAttribute("stroke", "#CFF9FE"),
            this.backBar.setAttribute("stroke-width", "7"),
            this.backBar.setAttribute("stroke-linecap", "round"),
            this.frontBar = document.createElementNS("http://www.w3.org/2000/svg", "line"),
            this.frontBar.setAttribute("id", "frontBar" + e),
            this.frontBar.setAttribute("class", "progressBar"),
            this.frontBar.setAttribute("x1", o),
            this.frontBar.setAttribute("y1", "1"),
            this.frontBar.setAttribute("x2", n),
            this.frontBar.setAttribute("y2", "1"),
            this.frontBar.setAttribute("stroke", "#58BDFD"),
            this.frontBar.setAttribute("stroke-dasharray", r),
            this.frontBar.setAttribute("stroke-dashoffset", r),
            this.frontBar.setAttribute("stroke-width", "7"),
            this.frontBar.setAttribute("stroke-linecap", "round"),
            this.svg.appendChild(this.backBar),
            this.svg.appendChild(this.frontBar)
        }
        this.setProgressBar = function(A, e) {
            var t = A / e
              , o = r - r * t;
            i.svg.style.display = "",
            i.frontBar.setAttribute("stroke-dashoffset", o.toString()),
            1 > t || setTimeout((function() {
                i.deleteProgressBar()
            }
            ), 500)
        }
        ,
        this.deleteProgressBar = function() {
            document.getElementsByClassName("progressBar");
            i.svg.style.display = "none"
        }
    }
      , Zd = function(A, e) {
        var t = A.toolId
          , i = A.Flag
          , o = A.viewer
          , n = e.toolbarTop
          , r = this
          , a = 0;
        this.snapshotInfo = {},
        this.snapshotDelConf = !0,
        this.deleteListener = null,
        this.addListener = null,
        this.renameListener = null,
        this.updateListener = null,
        this.annotationListener = null,
        this.restoreToSnapshotListener = null;
        var s = document.createElement("div");
        s.className = "snapshot-content",
        xh.append(s, '<button class="snapshot-play">播放模型快照</button><div class="snapshot"><div class="snapshot-body"></div></div><div class="labeling-footer"><button class="but-new-create" id="add' + t + '">新建快照</button></div></div>'),
        this.snapshotWindow = qd.window({
            title: "快照",
            width: 334,
            height: 688,
            closeOnEsc: !1,
            closeButton: !0,
            afterWindowHide: function() {
                var A = document.getElementById("snapshot" + t);
                i.snapshot = !1,
                A && (A.style.backgroundColor = "",
                A.querySelector(".yj-icon").className = "yj-icon snapshot-icon")
            },
            content: s
        }),
        r.snapshotWindow.setPosition({
            left: "",
            right: 5,
            top: 60
        }),
        r.snapshotWindow.windowHide(),
        xh.addEventListener(n.querySelector("#snapshot" + t), "click", (function(A) {
            if (i.snapshot)
                r.snapshotInfo = void 0,
                A.target.parentNode.style.backgroundColor = "",
                A.target.className = "yj-icon snapshot-icon",
                r.snapshotWindow.windowHide();
            else {
                r.load([]),
                i.snapshot = !i.snapshot,
                r.snapshotWindow.windowShow();
                var e = o.viewerImpl.modelManager.sceneState;
                A.target.parentNode.style.backgroundColor = "#1f89de",
                A.target.className = "yj-icon snapshot-icon active",
                e.getSelection()
            }
        }
        )),
        xh.addEventListener(r.snapshotWindow.$el.querySelector("#add" + t), "click", (function(A) {
            var e = r.makeSnapshots();
            "function" == typeof r.addListener ? r.addListener(e, (function(A, t) {
                A && r.add(t || e)
            }
            )) : r.add(e)
        }
        )),
        this.clear = function() {
            [].map.call(r.snapshotWindow.$el.querySelectorAll(".snapshot .snapshot-body"), (function(A, e) {
                A.innerHTML = ""
            }
            )),
            r.snapshotInfo = {},
            r.snapshotDelConf = !0
        }
        ,
        this.load = function(A) {
            Array.isArray(A) && A.forEach((function(A) {
                r.add(A)
            }
            ))
        }
        ,
        this.makeSnapshots = function() {
            var A, e, t, i, n, r = o.viewerImpl.modelManager.getModelSnapshotPhoto();
            A = r.imgURL;
            var s = r.width
              , l = r.height
              , c = o.viewerImpl.getSceneState();
            e = c.camera,
            t = c.state,
            i = c.selection.concat(),
            n = c.modelSelection.concat();
            var h = a;
            return a += 1,
            {
                cameraState: e,
                componentState: t,
                highlightComponentsKeys: i,
                highlightModelsKeys: n,
                imageURL: A,
                width: s,
                height: l,
                num: h,
                code: (new Date).getTime().toString(),
                name: "快照" + h,
                description: "无注释"
            }
        }
        ,
        xh.addEventListener(r.snapshotWindow.$el.querySelector(".snapshot-body"), "click", (function(A) {
            switch (A.target.className) {
            case "snapshot-node-delete":
                r.snapshotsDelete(A);
                break;
            case "snapshot-node-img":
                r.snapshotsflyto(A);
                break;
            case "snapshot-node-annotation":
                r.snapshotsAnnotation(A);
                break;
            case "snapshot-node-button-update":
                r.snapshotUpdate(A)
            }
        }
        )),
        xh.addEventListener(r.snapshotWindow.$el.querySelector(".snapshot-body"), "dblclick", (function(A) {
            switch (A.target.className) {
            case "snapshot-node-name":
                r.snapshotsRename(A)
            }
        }
        )),
        this.add = function(A) {
            var e = A.imageURL
              , t = A.width
              , i = A.height
              , o = A.code
              , n = A.name
              , a = A.num
              , s = A.description;
            if (A.cameraState && A.componentState && e && o && t && i) {
                for (var l = r.snapshotWindow.$el.querySelectorAll(".snapshot-node"), c = 0; l.length > c; c += 1)
                    xh.css(l[c], {
                        border: "2px"
                    });
                var h = '<div class="snapshot-node" code="' + o + '" imgid="' + o + '"  style="margin-bottom:20px;" num="' + a + '"><div class="snapshot-node-header"><span class="snapshot-node-name" title="双击以重命名">' + n + '</span><span class="snapshot-node-delete" title="删除快照">×</span></div><div class="snapshot-node-body" title="点击以浏览模型快照"><img class="snapshot-node-img" width="100%" height=' + parseInt(i * (300 / t), 0) + 'px" src="' + e + '"></div><div class="snapshot-node-footer"><span class="snapshot-node-annotation" title="点击以修改注释">' + s + '</span><button class="snapshot-node-button-update" yhtype="update" title="将当前模型视角更新到此快照">更新</button></div>';
                [].map.call(r.snapshotWindow.$el.querySelectorAll(".snapshot-body"), (function(A, e) {
                    xh.append(A, h)
                }
                )),
                r.snapshotInfo[o] = A
            }
        }
        ,
        this.snapshotsflyto = function(A) {
            for (var e = r.snapshotWindow.$el.querySelectorAll(".snapshot-node"), t = 0; e.length > t; t += 1)
                xh.css(e[t], {
                    border: "2px"
                });
            var i = A.target.parentNode.parentNode.getAttribute("code");
            "function" == typeof r.restoreToSnapshotListener ? r.restoreToSnapshotListener(i, (function(A) {
                r.restoreToSnapshot(i)
            }
            )) : r.restoreToSnapshot(i)
        }
        ,
        this.restoreToSnapshot = function(A) {
            var e = r.snapshotInfo[A];
            if (e) {
                o.viewerImpl.setSceneState({
                    camera: e.cameraState,
                    state: e.componentState,
                    selection: e.highlightComponentsKeys,
                    modelSelection: e.highlightModelsKeys
                });
                var t = r.snapshotWindow.$el.querySelector("div[imgid='" + A + "']");
                t && xh.css(t, {
                    border: "2px solid #002553"
                })
            }
        }
        ,
        this.snapshotsPlay = function() {
            var A = null;
            function e(t) {
                var i = r.snapshotWindow.$el.querySelectorAll(".snapshot-node");
                if (0 !== i.length) {
                    var n, a = i[t].getAttribute("imgid");
                    if (void 0 === r.snapshotInfo[a])
                        i.length > t && e(t + 1);
                    else {
                        for (var s = 0; i.length > s; s += 1)
                            xh.css(i[s], {
                                border: "2px"
                            });
                        xh.css(i[t], {
                            border: "2px solid #002553"
                        }),
                        o.viewerImpl.setSceneState({
                            camera: r.snapshotInfo[a].cameraState,
                            state: r.snapshotInfo[a].componentState,
                            selection: r.snapshotInfo[a].highlightComponentsKeys,
                            modelSelection: r.snapshotInfo[a].highlightModelsKeys
                        }),
                        i.length - 1 > t ? A = setTimeout((n = t + 1,
                        function() {
                            e(n)
                        }
                        ), 1e3) : [].map.call(r.snapshotWindow.$el.querySelectorAll(".snapshot-play"), (function(A, e) {
                            A.innerHTML = "播放模型快照"
                        }
                        ))
                    }
                    i.length > t || [].map.call(r.snapshotWindow.$el.querySelectorAll(".snapshot-play"), (function(A, e) {
                        A.innerText = "播放模型快照"
                    }
                    ))
                } else
                    [].map.call(r.snapshotWindow.$el.querySelectorAll(".snapshot-play"), (function(A, e) {
                        A.innerText = "播放模型快照"
                    }
                    ))
            }
            return function(t) {
                if ("播放模型快照" === t.target.innerText) {
                    t.target.innerText = "停止播放";
                    e(0)
                } else
                    "停止播放" === t.target.innerText && (t.target.innerText = "播放模型快照",
                    A && clearTimeout(A))
            }
        }(),
        xh.addEventListener(r.snapshotWindow.$el.querySelector(".snapshot-play"), "click", (function(A) {
            r.snapshotsPlay(A)
        }
        )),
        this.snapshotsDelete = function(A) {
            var e = A.target.parentNode.parentNode.getAttribute("imgid");
            if (r.snapshotDelConf) {
                var t = qd.alert("info", {
                    msg: "删除不可恢复，确认删除？",
                    title: "删除确认",
                    backdrop: !0,
                    buttons: {
                        yes: {
                            closeOnClick: !1,
                            text: "删除并不再提示"
                        },
                        no: {
                            closeOnClick: !1,
                            text: "删除"
                        }
                    },
                    callback: function(A, t) {
                        "no" !== t && "yes" !== t || ("yes" === t && (r.snapshotDelConf = !1),
                        "function" == typeof r.deleteListener ? r.deleteListener(e, (function(A) {
                            A && r.delete(e)
                        }
                        )) : r.delete(e)),
                        A.destroy()
                    }
                })
                  , i = (new Date).getTime() - qd.window.startTime;
                [].map.call(r.snapshotWindow.$el.querySelectorAll(".lobibox-backdrop"), (function(A, e) {
                    xh.css(A, {
                        "z-index": i
                    })
                }
                )),
                t.$el.style.zIndex = i + 2
            } else
                "function" == typeof r.deleteListener ? r.deleteListener(e, (function(A) {
                    A && r.delete(e)
                }
                )) : r.delete(e)
        }
        ,
        this.delete = function(A) {
            var e = r.snapshotWindow.$el.querySelector("div[imgid='" + A + "']");
            e && e.remove(),
            delete r.snapshotInfo[A]
        }
        ,
        this.snapshotsRename = function(A) {
            o.viewerImpl.cameraControl.enabled = !1;
            var e = A.target
              , t = e.parentNode.parentNode.getAttribute("imgid")
              , i = e.innerText
              , n = document.createElement("input");
            n.type = "text",
            n.value = i,
            e.innerText = "",
            xh.append(e, n),
            n.focus(),
            n.select(),
            n.addEventListener("blur", (function(A) {
                var e = A.target;
                e.removeEventListener("blur", (function() {}
                )),
                e.value !== i && "" !== xh.trim(e.value) ? "function" == typeof r.renameListener ? r.renameListener(t, e.value, (function(A, o) {
                    A ? r.rename(t, o || e.value) : e.parentNode.innerText = i
                }
                )) : r.rename(t, e.value) : e.parentNode.innerText = i,
                n.remove(),
                o.viewerImpl.cameraControl.enabled = !0
            }
            ))
        }
        ,
        this.rename = function(A, e) {
            var t = r.snapshotWindow.$el.querySelector("div[imgid='" + A + "']");
            if (t) {
                var i = t.querySelector(".snapshot-node-name");
                i && (i.innerText = e)
            }
            r.snapshotInfo[A].name = e
        }
        ,
        this.snapshotUpdate = function(A) {
            var e = A.target.parentNode.parentNode.getAttribute("imgid")
              , t = r.makeSnapshots();
            "function" == typeof r.updateListener ? r.updateListener(e, t, (function(A, i, o) {
                A && r.update(i || e, o || t)
            }
            )) : r.update(e, t)
        }
        ,
        this.update = function(A, e) {
            var t = r.snapshotInfo[A];
            t && (t.cameraState = e.cameraState,
            t.componentState = e.componentState,
            t.highlightComponentsKeys = e.highlightComponentsKeys,
            t.highlightModelsKeys = e.highlightModelsKeys,
            t.imageURL = e.imageURL);
            var i = r.snapshotWindow.$el.querySelector("div[imgid='" + A + "']");
            if (i) {
                var o = i.querySelector(".snapshot-node-img");
                o && (o.src = e.imageURL)
            }
        }
        ,
        this.snapshotsAnnotation = function(A) {
            var e = A.target
              , t = e.parentNode.parentNode.getAttribute("imgid")
              , i = e.innerHTML
              , o = qd.prompt("text", {
                title: "添加/修改-注释/说明",
                value: e.innerHTML,
                multiline: !0,
                modal: !0,
                backdrop: !0,
                lines: 6,
                attrs: {
                    placeholder: "无注释"
                },
                buttons: {
                    ok: {
                        class: "btn btn-info",
                        closeOnClick: !1,
                        text: "确定"
                    },
                    cancel: {
                        class: "btn btn-danger",
                        closeOnClick: !1,
                        text: "取消"
                    }
                },
                callback: function(A, n) {
                    if ("ok" === n) {
                        var a = o.getValue();
                        a !== i && "" !== xh.trim(a) ? "function" == typeof r.annotationListener ? r.annotationListener(t, a, (function(A, e, i) {
                            A && r.annotation(e || t, i || a)
                        }
                        )) : r.annotation(t, a) : e.innerHTML = i,
                        A.destroy()
                    } else
                        "cancel" === n && A.destroy()
                }
            })
              , n = (new Date).getTime() - qd.window.startTime;
            [].map.call(r.snapshotWindow.$el.querySelectorAll(".lobibox-backdrop"), (function(A, e) {
                xh.css(A, {
                    "z-index": n
                })
            }
            )),
            o.$el.style.zIndex = n + 2
        }
        ,
        this.annotation = function(A, e) {
            var t = r.snapshotWindow.$el.querySelector("div[imgid='" + A + "']");
            if (t) {
                var i = t.querySelector(".snapshot-node-annotation");
                i && (i.innerText = e)
            }
            r.snapshotInfo[A].description = e
        }
        ,
        this.getSnapshotByKey = function(A) {
            return r.snapshotInfo ? r.snapshotInfo[A] : null
        }
        ,
        this.getAllSnapshot = function() {
            return r.snapshotInfo ? r.snapshotInfo : null
        }
    }
      , Xd = function(A, e) {
        var t = this;
        qd.viewport = document.querySelector("#" + A.viewport),
        A.getViewerImpl().getModelManager().addEventListener(Rc.ON_LOAD_ERROR, (function(A) {
            jd("error", A.message || "加载出现错误", !1)
        }
        )),
        A.getViewerImpl().getModelManager().addEventListener(Rc.ON_LOAD_INVALID_SCENE, (function(A) {
            jd("error", "key为 " + A.modelKey + " 的模型信息不合法", !1)
        }
        )),
        A.getViewerImpl().getModelManager().addEventListener(Rc.ON_NETWORK_ERROR, (function(A) {
            jd("error", A.message || "网络连接错误", !1)
        }
        )),
        A.getViewerImpl().getModelManager().addEventListener(Rc.NO_PERMISSION, (function(A) {
            jd("error", A.message || "权限不足", !1)
        }
        )),
        A.getViewerImpl().getModelManager().addEventListener(Rc.ACCOUNT_NO_EXIST, (function(A) {
            jd("error", A.message || "无法获取账户", !1)
        }
        )),
        A.getViewerImpl().getModelManager().addEventListener(Rc.ON_LOAD_EMPTY_SCENE, (function(A) {
            jd("error", "key为 " + A.modelKey + " 的模型场景为空，请生成场景", !1)
        }
        )),
        A.getViewerImpl().getModelManager().addEventListener(Tc.PARSEFAILE, (function(A) {
            jd("error", "key为 " + A.modelKey + " 的模型解析失败", !1)
        }
        )),
        A.getViewerImpl().getModelManager().addEventListener(Tc.PARSING, (function(A) {
            jd("error", "key为 " + A.modelKey + " 的模型解析中", !1)
        }
        )),
        A.getViewerImpl().getModelManager().addEventListener(Tc.SCENE_NOTHING_TO_LOAD, (function(A) {
            jd("error", "key为 " + A.modelKey + " 的模型没有可加载的内容", !1)
        }
        ));
        var i = A.viewerImpl.uuid
          , o = {
            roam: !1,
            sectioning: !1,
            multiple: !1,
            fullScreen: !1,
            attribute: !1,
            search: !1,
            measurement: !1,
            modelTree: !1,
            treeDataLoad: !1,
            snapshot: !1,
            postil: !1,
            mark: !1
        }
          , n = {
            home: !0,
            fit: !0,
            restore: !0,
            roam: !0,
            multiple: !0,
            transparent: !1,
            hide: !0,
            isolation: !0,
            sectioning: !0,
            modelPartition: !0,
            wireframe: !0,
            color: !0,
            setting: !0,
            modelTree: !1,
            attribute: !0,
            search: !1,
            measurement: !0,
            snapshot: !0,
            postil: !0,
            mark: !0
        }
          , r = {
            Flag: o,
            lobibox: qd,
            toolId: i,
            viewer: A
        };
        this.progressBar = new zd(A.viewerImpl.domElement,i);
        var a = {};
        A.getViewerImpl().modelManager.addEventListener(Rc.ON_LOAD_PROGRESS, (function(A) {
            a[A.progress.modelKey] = [A.progress.total, A.progress.loaded];
            var e = 0
              , i = 0;
            for (var o in a)
                if (a.hasOwnProperty(o)) {
                    var n = a[o];
                    e += n[0],
                    i += n[1]
                }
            t.progressBar.setProgressBar(i, e)
        }
        )),
        A.getViewerImpl().modelManager.addEventListener(Rc.ON_LOAD_COMPLETE, (function(A) {
            delete a[A.modelKey],
            0 === Object.keys(a).length && t.progressBar.setProgressBar(1, 1)
        }
        ));
        A.viewerImpl.getScene();
        this.undoList = [],
        this.redoList = [],
        this.maxUndoListLength = 10;
        var s, l, c, h, d = 0;
        function p(e) {
            var i = t.undoList[e - 1];
            if (i)
                switch (i.type) {
                case "隐藏":
                    A.showComponentsByKey(i.data);
                    break;
                case "隔离":
                    A.closeIsolateComponentsByKey(i.data);
                    break;
                case "修改颜色":
                    A.closeColorfulComponentsByKey(i.data.key);
                    break;
                case "框选添加":
                    A.closeHighlightComponentsByKey(i.data);
                    break;
                case "框选移除":
                    A.highlightComponentsByKey(i.data);
                    break;
                case "修改线框":
                    A.closeWireFrameComponentsByKey(i.data)
                }
        }
        function g(e) {
            var i = t.redoList[e];
            if (i)
                switch (i.type) {
                case "隐藏":
                    A.hideComponentsByKey(i.data);
                    break;
                case "隔离":
                    A.isolateComponentsByKey(i.data);
                    break;
                case "修改颜色":
                    A.colorfulComponentsByKey(i.data.key, i.data.color, i.data.opacity);
                    break;
                case "框选添加":
                    A.highlightComponentsByKey(i.data);
                    break;
                case "框选移除":
                    A.closeHighlightComponentsByKey(i.data);
                    break;
                case "修改线框":
                    A.wireFrameComponentsByKey(i.data)
                }
        }
        function u(A) {
            if (void 0 !== A.target.undoNum) {
                var e = Number(A.target.undoNum);
                1 === e && jd("info", "无法再撤销、重做。请使用ctrl+z或ctrl+shift+z", 3e3),
                isNaN(e) || t.undoOrRedo(e)
            }
        }
        this.className = "Tool",
        this.getToolId = function() {
            return i
        }
        ,
        this.getFlag = function() {
            return o
        }
        ,
        this.createTool = function(e) {
            t.options = uh.extend(!0, {}, n, e);
            var a = document.createElement("div");
            a.id = "my-tool" + i,
            a.className = "yj-tool",
            A.viewerImpl.domElement.appendChild(a),
            this.toolbarTop = a,
            t.toolbar = a;
            var s = document.createElement("div");
            s.className = "yj-group",
            a.appendChild(s);
            var l = document.createElement("div");
            l.className = "homeViewer-div",
            l.id = "homeViewerDiv" + i,
            l.style.display = "flex";
            var c = document.createElement("button");
            c.className = "yj-but",
            c.title = "视图操作",
            c.id = "homeViewer" + i;
            var h = document.createElement("div");
            h.classList.add("yj-icon"),
            h.classList.add("homeViewer-icon"),
            c.appendChild(h);
            var p = document.createElement("div");
            p.className = "viewerModal",
            p.id = "viewerModal" + i,
            l.appendChild(c),
            l.appendChild(p),
            t.options.home && s.appendChild(l),
            c.addEventListener("click", (function(A) {
                "" === p.style.display || "none" === p.style.display ? (DA(),
                p.style.display = "flex") : p.style.display = "none"
            }
            ));
            var g = document.createElement("button");
            g.className = "yj-but",
            g.title = "初始化",
            g.id = "home" + i;
            var u = document.createElement("div");
            u.classList.add("yj-icon"),
            u.classList.add("home-icon"),
            g.appendChild(u),
            t.options.home && p.appendChild(g);
            var f = document.createElement("button");
            f.className = "yj-but",
            f.title = "聚焦",
            f.id = "fit" + i;
            var m = document.createElement("div");
            m.classList.add("yj-icon"),
            m.classList.add("fit-icon"),
            f.appendChild(m),
            t.options.fit && p.appendChild(f);
            var C = document.createElement("button");
            C.className = "yj-but",
            C.title = "复位",
            C.id = "restore" + i;
            var y = document.createElement("div");
            y.classList.add("yj-icon"),
            y.classList.add("restore-icon"),
            C.appendChild(y);
            var v = document.createElement("ul");
            v.className = "restoreModal",
            v.style.cssText += "display: none;",
            v.id = "restoreModal" + i;
            for (var I = 0; 6 > I; I += 1) {
                var E = document.createElement("li");
                E.className = "input-group-addon",
                v.appendChild(E);
                var B = document.createElement("input");
                B.type = "checkbox",
                B.className = 5 === I ? "checkAll" : "check",
                E.appendChild(B);
                var x = document.createElement("label");
                switch (E.appendChild(x),
                I) {
                case 0:
                    B.id = "showSet" + i,
                    x.setAttribute("for", "showSet" + i),
                    x.innerHTML = "复位构件可见设置";
                    break;
                case 1:
                    B.id = "highlightSet" + i,
                    x.setAttribute("for", "highlightSet" + i),
                    x.innerHTML = "复位构件高亮设置";
                    break;
                case 2:
                    B.id = "viewSet" + i,
                    x.setAttribute("for", "viewSet" + i),
                    x.innerHTML = "复位模型视角设置";
                    break;
                case 3:
                    B.id = "wireframeSet" + i,
                    x.setAttribute("for", "wireframeSet" + i),
                    x.innerHTML = "复位构件线框设置";
                    break;
                case 4:
                    B.id = "colorSet" + i,
                    x.setAttribute("for", "colorSet" + i),
                    x.innerHTML = "复位构件颜色设置";
                    break;
                case 5:
                    B.id = "checkAll" + i,
                    x.setAttribute("for", "checkAll" + i),
                    x.innerHTML = "全选";
                    var S = document.createElement("input");
                    S.type = "button",
                    S.id = "reset" + i,
                    S.className = "reset",
                    S.value = "复位选中项",
                    E.appendChild(S)
                }
            }
            var w = document.createElement("ul");
            w.className = "history",
            w.id = "history" + i,
            w.style.cssText += "display: none;";
            var M = document.createElement("span");
            M.innerText = "历史记录",
            M.style.cssText += "color:white",
            w.appendChild(M),
            t.options.restore && (s.appendChild(C),
            s.appendChild(v),
            s.appendChild(w),
            v.style.cssText += "margin-left:" + C.style.left - v.style.width / 2 + "px");
            var b = document.createElement("button");
            b.className = "yj-but",
            b.title = "漫游",
            b.id = "roam" + i;
            var U = document.createElement("div");
            U.classList.add("yj-icon"),
            U.classList.add("roam-icon"),
            b.appendChild(U);
            var F = document.createElement("div");
            F.classList.add("roamModal"),
            F.classList.add("clearfix"),
            F.id = "roamModal" + i,
            F.innerHTML = '<div class="roamDistance"><div><span class="distance-info">提示信息</span></div><div class="subtract">-</div><div class="distanceRangeParent"><input type="range" class="distanceRange" step="0.01" min="0.01" max="2" value="1"/></div><div class="add">+</div></div><div class="roamHeight"><div><span class="height-info">提示信息</span></div><div class="subtract">-</div><div class="heightRangeParent"><input type="range" class="heightRange" step="0.01" min="0" max="1"/></div><div class="add">+</div></div>';
            var K = document.createElement("div");
            K.className = "roamOnOff",
            K.innerHTML = '<div><div class="collisionControl"><span>碰撞:</span><input type="checkbox" id="collision' + i + '" class=\'collision\' name="switch">    <label for="collision' + i + '" class="choose-label"></label></div><div class="gravityControl"><span>重力:</span><input type="checkbox" id="gravity' + i + '" class=\'gravity\' name="switch">    <label for="gravity' + i + '" class="choose-label"></label></div></div>',
            t.options.roam && (s.appendChild(b),
            s.appendChild(F),
            s.appendChild(K),
            F.style.cssText += "margin-left:" + b.style.left - F.style.width / 2 + "px");
            var Q = document.createElement("div");
            Q.className = "yj-group",
            a.appendChild(Q);
            var R = null;
            t.options.multiple && (R = function(A, e) {
                var t = A.toolId
                  , i = A.Flag
                  , o = A.viewer
                  , n = document.createElement("button");
                n.className = "yj-but",
                n.title = "框选",
                n.id = "multiple" + t;
                var r = document.createElement("div");
                r.classList.add("yj-icon"),
                r.classList.add("multiple-icon"),
                n.appendChild(r);
                var a = null;
                return n.addEventListener("click", (function() {
                    if (i.multiple)
                        return this.style.backgroundColor = "",
                        this.querySelector(".yj-icon").className = "yj-icon multiple-icon",
                        i.multiple = !1,
                        a && a.remove(),
                        a = null,
                        void o.viewerImpl.controlManager.disableTool(Pc.PICK_BY_RECT);
                    i.roam && (document.getElementById("roam" + t).style.backgroundColor = "",
                    document.getElementById("roam" + t).querySelector(".yj-icon").className = "yj-icon roam-icon",
                    jd("info", "框选模式下将关闭漫游功能", 2e3),
                    e.exitRoam()),
                    i.measurement && (document.getElementById("measurement" + t).style.backgroundColor = "",
                    document.getElementById("measurement" + t).querySelector(".yj-icon").className = "yj-icon measurement-icon",
                    jd("info", "框选模式下将关闭测量功能", 2e3),
                    e.exitMeasure && e.exitMeasure()),
                    i.sectioning && (document.getElementById("sectioning" + t).style.backgroundColor = "",
                    document.getElementById("sectioning" + t).querySelector(".yj-icon").className = "yj-icon sectioning-icon",
                    jd("info", "框选模式下将关闭剖切功能", 2e3),
                    o.viewerImpl.controlManager.disableTool(Pc.CLIP_BY_BOX),
                    i.sectioning = !1),
                    o.render(),
                    a = jd("info", "按住'Ctrl'键,框选模式为增选;按住'Alt'键,框选模式为减选", 5e3),
                    this.style.backgroundColor = "#1f89de",
                    this.querySelector(".yj-icon").className = "yj-icon multiple-icon active",
                    i.multiple = !i.multiple,
                    o.viewerImpl.controlManager.enableTool(o.viewerImpl, Pc.PICK_BY_RECT)
                }
                )),
                n
            }(r, this),
            Q.appendChild(R));
            var T = document.createElement("button");
            T.className = "yj-but",
            T.title = "构件透明化",
            T.id = "transparent" + i;
            var k = document.createElement("div");
            k.classList.add("yj-icon"),
            k.classList.add("transparent-icon"),
            T.appendChild(k);
            var D = document.createElement("div");
            D.classList.add("transparentModal"),
            D.classList.add("clearfix"),
            D.id = "transparentModal" + i;
            var L = document.createElement("div");
            D.appendChild(L);
            var N = document.createElement("span");
            N.innerHTML = "提示信息",
            N.className = "transparent-info",
            L.appendChild(N),
            (uA = document.createElement("div")).className = "subtract",
            uA.innerHTML = "-",
            D.appendChild(uA);
            var O = document.createElement("div");
            O.className = "transparentRangeParent",
            D.appendChild(O);
            var V = document.createElement("input");
            V.type = "range",
            V.className = "transparentRange",
            V.setAttribute("step", "0.01"),
            V.setAttribute("min", "0"),
            V.setAttribute("max", "1"),
            O.appendChild(V),
            (CA = document.createElement("div")).className = "add",
            CA.innerHTML = "+",
            D.appendChild(CA),
            t.options.transparent && (Q.appendChild(T),
            Q.appendChild(D),
            D.style.cssText += "margin-left:" + T.style.left - D.style.width / 2 + "px");
            var G = document.createElement("div");
            G.className = "toolComponentDiv",
            G.id = "toolComponentDiv" + i,
            G.style.display = "flex";
            var P = document.createElement("button");
            P.className = "yj-but",
            P.title = "构件操作",
            P.id = "toolComponent" + i;
            var q = document.createElement("div");
            q.classList.add("yj-icon"),
            q.classList.add("toolComponent-icon"),
            P.appendChild(q);
            var j = document.createElement("div");
            j.className = "toolComponentModal",
            j.id = "toolComponentModal" + i,
            G.appendChild(P),
            G.appendChild(j),
            Q.appendChild(G),
            P.addEventListener("click", (function(A) {
                "" === j.style.display || "none" === j.style.display ? (DA(),
                j.style.display = "flex") : j.style.display = "none"
            }
            ));
            var H = document.createElement("button");
            H.className = "yj-but",
            H.title = "构件隐藏",
            H.id = "hide" + i;
            var Y = document.createElement("div");
            Y.classList.add("yj-icon"),
            Y.classList.add("hide-icon"),
            H.appendChild(Y),
            t.options.hide && j.appendChild(H);
            var W = document.createElement("button");
            W.className = "yj-but",
            W.title = "构件隔离",
            W.id = "insulate" + i;
            var J = document.createElement("div");
            J.classList.add("yj-icon"),
            J.classList.add("insulate-icon"),
            W.appendChild(J),
            t.options.isolation && j.appendChild(W);
            var z = document.createElement("button");
            z.className = "yj-but",
            z.title = "构件属性",
            z.id = "attribute" + i;
            var Z = document.createElement("div");
            Z.classList.add("yj-icon"),
            Z.classList.add("attribute-icon"),
            z.appendChild(Z),
            t.options.attribute && (j.appendChild(z),
            this.attributeWindow = function(A) {
                var e = A.lobibox
                  , t = A.toolId
                  , i = A.Flag
                  , o = document.createElement("div");
                o.className = "tab-body",
                o.id = "tab-properties" + t;
                var n = document.createElement("table");
                n.classList.add("sx-table"),
                n.classList.add("table-no-top"),
                o.appendChild(n);
                var r = document.createElement("thead");
                n.appendChild(r);
                var a = document.createElement("tbody");
                n.appendChild(a);
                var s = document.createElement("tr");
                s.className = "noprop",
                a.appendChild(s);
                var l = document.createElement("td");
                return l.innerText = "尚未选择构件",
                s.appendChild(l),
                e.window({
                    title: "属性",
                    width: 334,
                    height: 688,
                    closeOnEsc: !1,
                    closeButton: !0,
                    afterWindowHide: function() {
                        var A = document.getElementById("attribute" + t);
                        i.attribute = !1,
                        A && (A.style.backgroundColor = "",
                        A.querySelector(".yj-icon").className = "yj-icon attribute-icon")
                    },
                    content: o
                })
            }(r),
            t.attributeWindow.setPosition({
                left: "",
                right: 5,
                top: 60
            }),
            t.attributeWindow.windowHide(),
            z.addEventListener("click", (function() {
                if (o.attribute)
                    this.style.backgroundColor = "",
                    t.attributeWindow.windowHide();
                else {
                    o.attribute = !o.attribute,
                    this.style.backgroundColor = "#1f89de",
                    this.querySelector(".yj-icon").className = "yj-icon attribute-icon active",
                    t.attributeWindow.windowShow();
                    var e = A.viewerImpl.modelManager.sceneState;
                    e.getSelection() && t.showComponentAttribute(e.getSelection()[0])
                }
            }
            )));
            var X = document.createElement("button");
            X.className = "yj-but",
            X.title = "构件线框化",
            X.id = "wireframe" + i;
            var _ = document.createElement("div");
            _.classList.add("yj-icon"),
            _.classList.add("wireframe-icon"),
            X.appendChild(_),
            t.options.wireframe && j.appendChild(X);
            var $ = document.createElement("button");
            $.className = "yj-but",
            $.title = "构件变色",
            $.id = "color" + i,
            $.style.borderRadius = "0 6px 6px 0";
            var AA = document.createElement("div");
            AA.classList.add("yj-icon"),
            AA.classList.add("color-icon"),
            $.appendChild(AA);
            var eA = document.createElement("input");
            eA.style.cssText += "display:none;",
            eA.className = "toolColorInput",
            $.appendChild(eA);
            var tA = new Hh(eA,{
                hasOpacity: !0
            }).element;
            tA.id = "colorModal" + i,
            tA.className = "colorModal",
            t.options.color && (j.appendChild($),
            Q.appendChild(tA),
            tA.style.cssText += "margin-left:" + $.offsetLeft + "px"),
            tA.querySelector(".btn-yes").addEventListener("click", (function() {
                var e = A.getHighlightComponentsKey()
                  , i = Kd.getHexStringFromRGB(eA.value)
                  , o = Kd.getColorArrayFromRGBA(eA.value)[3];
                t.push({
                    type: "修改颜色",
                    data: {
                        key: e,
                        color: i,
                        opacity: o
                    }
                }),
                A.colorfulComponentsByKey(e, i, o)
            }
            ));
            var iA = document.createElement("button");
            iA.className = "yj-but",
            iA.title = "模型测量",
            iA.id = "measurement" + i;
            var oA = document.createElement("div");
            oA.classList.add("yj-icon"),
            oA.classList.add("measurement-icon"),
            iA.appendChild(oA),
            t.options.measurement && (Q.appendChild(iA),
            iA.addEventListener("click", (function(e) {
                o.measurement ? (o.measurement = !1,
                this.style.backgroundColor = "",
                this.querySelector(".yj-icon").className = "yj-icon measurement-icon",
                A.viewerImpl.controlManager.disableTool(Pc.PICK_BY_MEASURE)) : (o.measurement = !0,
                this.style.backgroundColor = "#1f89de",
                this.querySelector(".yj-icon").className = "yj-icon measurement-icon active",
                A.viewerImpl.controlManager.enableTool(A.viewerImpl, Pc.PICK_BY_MEASURE))
            }
            )));
            var nA = document.createElement("div");
            nA.className = "toolModelDiv",
            nA.id = "toolModelDiv" + i,
            nA.style.display = "flex";
            var rA = document.createElement("button");
            rA.className = "yj-but",
            rA.title = "模型操作",
            rA.id = "toolModel" + i;
            var aA = document.createElement("div");
            aA.classList.add("yj-icon"),
            aA.classList.add("toolModel-icon"),
            rA.appendChild(aA);
            var sA = document.createElement("div");
            sA.className = "toolModelModal",
            sA.id = "toolModelModal" + i,
            nA.appendChild(rA),
            nA.appendChild(sA),
            Q.appendChild(nA),
            rA.addEventListener("click", (function(A) {
                "" === sA.style.display || "none" === sA.style.display ? (DA(),
                sA.style.display = "flex") : sA.style.display = "none"
            }
            ));
            var lA = document.createElement("button");
            lA.className = "yj-but",
            lA.title = "模型剖切",
            lA.id = "sectioning" + i;
            var cA = document.createElement("div");
            cA.classList.add("yj-icon"),
            cA.classList.add("sectioning-icon"),
            lA.appendChild(cA),
            t.options.sectioning && sA.appendChild(lA);
            var hA = document.createElement("button");
            hA.className = "yj-but",
            hA.title = "模型分解",
            hA.id = "modelPartition" + i;
            var dA = document.createElement("div");
            dA.classList.add("yj-icon"),
            dA.classList.add("modelPartition-icon"),
            hA.appendChild(dA);
            var pA = document.createElement("div");
            pA.classList.add("modelPartitionModal"),
            pA.id = "modelPartitionModal" + i,
            pA.style.cssText += "display: none;";
            var gA = document.createElement("div");
            pA.appendChild(gA);
            var uA, fA = document.createElement("span");
            fA.innerHTML = "提示信息",
            fA.className = "modelPartition-info",
            gA.appendChild(fA),
            (uA = document.createElement("div")).className = "subtract",
            uA.innerHTML = "-",
            pA.appendChild(uA);
            var mA = document.createElement("div");
            mA.className = "modelPartitionRangeParent",
            pA.appendChild(mA);
            var CA, yA = document.createElement("input");
            yA.type = "range",
            yA.className = "modelPartitionRange",
            yA.setAttribute("value", "1"),
            yA.setAttribute("name", "points"),
            yA.setAttribute("step", "0.01"),
            yA.setAttribute("min", "1"),
            yA.setAttribute("max", "3"),
            mA.appendChild(yA),
            (CA = document.createElement("div")).className = "add",
            CA.innerHTML = "+",
            pA.appendChild(CA),
            t.options.modelPartition && (sA.appendChild(hA),
            Q.appendChild(pA),
            D.style.cssText += "margin-left:" + hA.style.left - pA.style.width / 2 + "px");
            var vA = document.createElement("div");
            vA.className = "toolPostilDiv",
            vA.id = "toolPostilDiv" + i,
            vA.style.display = "flex",
            (wA = document.createElement("button")).className = "yj-but",
            wA.title = "批注操作",
            wA.id = "toolPostil" + i;
            var IA = document.createElement("div");
            IA.classList.add("yj-icon"),
            IA.classList.add("toolPostil-icon"),
            wA.appendChild(IA);
            var EA = document.createElement("div");
            EA.className = "toolPostilModal",
            EA.id = "toolPostilModal" + i,
            vA.appendChild(wA),
            vA.appendChild(EA),
            Q.appendChild(vA),
            wA.addEventListener("click", (function(A) {
                "" === EA.style.display || "none" === EA.style.display ? (DA(),
                EA.style.display = "flex") : EA.style.display = "none"
            }
            ));
            var BA = document.createElement("button");
            BA.className = "yj-but",
            BA.title = "添加标签",
            BA.id = "mark" + i;
            var xA = document.createElement("div");
            if (xA.classList.add("yj-icon"),
            xA.classList.add("label-icon"),
            BA.appendChild(xA),
            t.options.mark && (EA.appendChild(BA),
            t.mark = new Hd(r,this)),
            t.options.snapshot) {
                xh.append(EA, '<button type="button" class="yj-but" title="快照" id="snapshot' + i + '"><div class="yj-icon snapshot-icon" ></div></button>');
                var SA = document.getElementById("snapshot" + i);
                SA.addEventListener("mouseover", (function(A) {
                    this.style.backgroundColor = "#1f89de"
                }
                )),
                SA.addEventListener("mouseout", (function(A) {
                    o[this.id.split(i)[0]] || (this.style.backgroundColor = "")
                }
                )),
                t.snapshot = new Zd(r,this)
            }
            if (t.options.postil) {
                var wA;
                xh.append(EA, wA = '<button type="button" class="yj-but" title="批注" id="postil' + i + '"><div class="yj-icon postil-icon" ></div></button>');
                var MA = document.getElementById("postil" + i);
                MA.addEventListener("mouseover", (function(A) {
                    this.style.backgroundColor = "#1f89de"
                }
                )),
                MA.addEventListener("mouseout", (function(A) {
                    o[this.id.split(i)[0]] || (this.style.backgroundColor = "")
                }
                )),
                t.postil = new Jd(r,this)
            }
            var bA = document.createElement("div");
            bA.className = "yj-group",
            bA.style.display = "flex",
            bA.style.width = "160px",
            a.appendChild(bA);
            var UA = document.createElement("button");
            UA.className = "yj-but",
            UA.title = "设置",
            UA.id = "set" + i,
            UA.style.borderRadius = "6px";
            var FA = document.createElement("div");
            FA.classList.add("yj-icon"),
            FA.classList.add("set-icon"),
            UA.appendChild(FA);
            var KA = document.createElement("div");
            KA.className = "setModal",
            KA.id = "setModal" + i;
            var QA = document.createElement("div");
            QA.className = "sceneColorDiv",
            QA.title = "选择背景颜色",
            KA.appendChild(QA);
            var RA = document.createElement("button");
            RA.id = "sceneColorSet" + i,
            RA.classList.add("yj-icon"),
            RA.classList.add("sceneColorSet"),
            QA.appendChild(RA);
            var TA = document.createElement("input");
            TA.style.cssText += "display:none;",
            TA.className = "sceneColorInput",
            QA.appendChild(TA);
            var kA = new Hh(TA,{
                hasOpacity: !0
            }).element;
            function DA() {
                v && (v.style.display = "none"),
                D && (D.style.display = "none"),
                pA && (pA.style.display = "none"),
                tA && (tA.style.display = "none"),
                p && (p.style.display = "none"),
                j && (j.style.display = "none"),
                sA && (sA.style.display = "none"),
                EA && (EA.style.display = "none"),
                KA && (KA.style.display = "none"),
                w && (w.style.display = "none")
            }
            kA.id = "sceneColorModal" + i,
            kA.className = "sceneColorModal",
            kA.querySelector(".btn-yes").addEventListener("click", (function() {
                DA();
                var e = Kd.getHexStringFromRGB(TA.value)
                  , t = Kd.getColorArrayFromRGBA(TA.value)[3];
                A.setSceneBackGroundColor(e, t)
            }
            )),
            kA.querySelector(".btn-no").addEventListener("click", (function() {
                DA()
            }
            ));
            var LA = document.createElement("div");
            LA.className = "fullScreenDiv",
            LA.title = "全屏显示",
            KA.appendChild(LA);
            var NA = document.createElement("button");
            function OA(A) {
                A.stopPropagation ? A.stopPropagation() : A.cancelBubble = !0
            }
            NA.classList.add("yj-icon"),
            NA.classList.add("fullScreen"),
            NA.id = "Fullscreen" + i,
            LA.appendChild(NA),
            t.options.setting && (bA.appendChild(UA),
            bA.appendChild(KA),
            KA.appendChild(kA),
            kA.style.cssText += "margin-left:" + (UA.offsetWidth + 5) + "px;"),
            document.addEventListener("click", (function(A) {}
            )),
            document.addEventListener("keydown", (function(A) {
                27 === (A.keyCode ? A.keyCode : A.which) && (o.roam && b.click(),
                o.measurement && document.querySelector("#measurement" + i).click(),
                o.multiple && R && R.click(),
                o.sectioning && lA.click()),
                (A.keyCode ? A.keyCode : A.which) === Oh && (!0 === A.ctrlKey && !0 === A.shiftKey && t.undoOrRedo(d + 1),
                !0 === A.ctrlKey && !1 === A.shiftKey && t.undoOrRedo(d - 1))
            }
            )),
            g.addEventListener("click", (function() {
                t.clearUndoList(),
                A.resetScene()
            }
            )),
            f.addEventListener("click", (function() {
                A.adaptiveSize()
            }
            )),
            C.addEventListener("click", (function(A) {
                "none" === v.style.display && DA(),
                v.addEventListener("click", (function(A) {
                    OA(A)
                }
                )),
                w.addEventListener("click", (function(A) {
                    OA(A)
                }
                )),
                v.style.display = "none" === v.style.display ? "block" : "none",
                w.style.display = "none" === w.style.display ? "block" : "none",
                OA(A)
            }
            )),
            document.getElementById("reset" + i).addEventListener("click", (function() {
                var e = document.getElementById("showSet" + i).checked
                  , t = document.getElementById("highlightSet" + i).checked
                  , o = document.getElementById("viewSet" + i).checked
                  , n = document.getElementById("wireframeSet" + i).checked
                  , r = document.getElementById("colorSet" + i).checked
                  , a = {};
                a.visible = e,
                a.selected = t,
                a.wireframed = n,
                a.colorfully = r,
                a.view = o,
                A.resetScene(a)
            }
            ));
            var VA = document.querySelectorAll("input[type=checkbox].check");
            document.querySelector("input[type=checkbox].checkAll").addEventListener("click", (function() {
                for (var A = 0; VA.length > A; A += 1)
                    VA[A].checked = this.checked
            }
            ));
            for (var GA = 0; VA.length > GA; GA += 1)
                VA[GA].addEventListener("click", (function() {
                    document.querySelector("input[type=checkbox].checkAll").checked = VA.length === document.querySelectorAll("input[type=checkbox].check:checked").length
                }
                ));
            this.pathRoam = Yd(r, this, b, 0, K),
            t.pathRoam.setPosition({
                left: "",
                right: 5,
                top: 60
            }),
            t.pathRoam.windowHide();
            var PA = D.querySelector(".subtract")
              , qA = D.querySelector(".add")
              , jA = D.querySelector(".transparentRange");
            T.addEventListener("click", (function(e) {
                if ("none" === D.style.display && DA(),
                D.addEventListener("click", (function(A) {
                    OA(A)
                }
                )),
                D.style.display = "none" === D.style.display ? "block" : "none",
                1 > A.getHighlightComponentsKey().length)
                    jd("warning", "未选中构件", 2e3),
                    D.style.display = "none";
                else {
                    jA.value = 1,
                    document.querySelector(".transparent-info").innerText = "透明度： " + 100..toFixed(0) + "%"
                }
                OA(e)
            }
            ));
            var HA = mh.isIE11();
            jA.addEventListener(HA ? "change" : "input", (function(e) {
                var t = A.getHighlightComponentsKey();
                document.querySelector(".transparent-info").innerHTML = "透明度： " + (100 * Number(jA.value)).toFixed(0) + "%",
                A.transparentComponentsByKey(t, Number(jA.value), !1)
            }
            )),
            PA.addEventListener("click", (function() {
                var e = Number(jA.value)
                  , t = Number(jA.getAttribute("step"));
                jA.value = e - t;
                var i = A.getHighlightComponentsKey();
                document.querySelector(".transparent-info").innerHTML = "透明度： " + (100 * Number(jA.value)).toFixed(0) + "%",
                A.transparentComponentsByKey(i, Number(jA.value), !1)
            }
            )),
            qA.addEventListener("click", (function() {
                var e = Number(jA.value)
                  , t = Number(jA.getAttribute("step"));
                jA.value = e + t;
                var i = A.getHighlightComponentsKey();
                document.querySelector(".transparent-info").innerHTML = "透明度： " + (100 * Number(jA.value)).toFixed(0) + "%",
                A.transparentComponentsByKey(i, Number(jA.value), !1)
            }
            )),
            H.addEventListener("click", (function() {
                var e = A.getHighlightComponentsKey();
                1 > e.length ? jd("warning", "未选中构件", 2e3) : (t.push({
                    type: "隐藏",
                    data: e
                }),
                A.hideComponentsByKey(e))
            }
            )),
            W.addEventListener("click", (function() {
                var e = A.getHighlightComponentsKey();
                1 > e.length ? jd("warning", "未选中构件", 2e3) : (t.push({
                    type: "隔离",
                    data: e
                }),
                A.isolateComponentsByKey(e))
            }
            ));
            var YA = document.createElement("div");
            YA.className = "section-body";
            var WA = document.createElement("div");
            WA.style.cssText += "color: #ff6700;top: 10px;height: 60px;text-align: center;font-size: 16px;",
            YA.appendChild(WA);
            var JA = document.createElement("span");
            JA.innerHTML = "是否显示剖切框",
            WA.appendChild(JA);
            var zA = document.createElement("input");
            zA.type = "radio",
            zA.name = "UIControl",
            zA.value = 1,
            zA.checked = "checked",
            WA.appendChild(zA);
            var ZA = document.createElement("span");
            ZA.innerHTML = "显示",
            WA.appendChild(ZA);
            var XA = document.createElement("input");
            XA.type = "radio",
            XA.name = "UIControl",
            XA.value = 0,
            XA.checked = "",
            WA.appendChild(XA);
            var _A = document.createElement("span");
            _A.innerHTML = "不显示",
            WA.appendChild(_A);
            var $A = document.createElement("button");
            $A.innerHTML = "确定",
            $A.type = "button",
            $A.style.cssText += "width:80px;height:30px;border-radius:10px;display:block;margin:0 auto;",
            YA.appendChild($A),
            this.sectionWindow = qd.window({
                title: "剖切",
                id: "sectionWindow",
                width: 334,
                height: 405,
                closeOnEsc: !1,
                closeButton: !0,
                afterWindowHide: function() {
                    o.sectioning = !1,
                    document.getElementById("sectioning" + i).style.backgroundColor = "",
                    zA.checked = "checked",
                    XA.checked = "",
                    A.viewerImpl.controlManager.disableTool(Pc.CLIP_BY_BOX),
                    A.render()
                },
                content: YA
            }),
            t.sectionWindow.setPosition({
                left: "",
                right: 5,
                top: 60
            }),
            t.sectionWindow.windowHide(),
            lA.addEventListener("click", (function() {
                if (o.sectioning)
                    return this.style.backgroundColor = "",
                    this.querySelector(".yj-icon").className = "yj-icon sectioning-icon",
                    t.sectionWindow.windowHide(),
                    o.sectioning = !1,
                    void A.disableSectionBox();
                o.multiple && (document.getElementById("multiple" + i).style.backgroundColor = "",
                document.getElementById("multiple" + i).querySelector(".yj-icon").className = "yj-icon multiple-icon",
                jd("info", "剖切模式下将关闭框选功能", 2e3),
                A.viewerImpl.controlManager.disableTool(Pc.PICK_BY_RECT),
                o.multiple = !1),
                o.roam && (document.getElementById("roam" + i).style.backgroundColor = "",
                document.getElementById("roam" + i).querySelector(".yj-icon").className = "yj-icon roam-icon",
                jd("info", "剖切模式下将关闭漫游功能", 2e3),
                t.exitRoam()),
                o.measurement && (document.getElementById("measurement" + i).style.backgroundColor = "",
                document.getElementById("measurement" + i).querySelector(".yj-icon").className = "yj-icon measurement-icon",
                jd("info", "剖切模式下将关闭测量功能", 2e3),
                t.exitMeasure && t.exitMeasure()),
                A.render(),
                this.style.backgroundColor = "#1f89de",
                this.querySelector(".yj-icon").className = "yj-icon sectioning-icon active",
                t.sectionWindow.windowShow(),
                o.sectioning = !o.sectioning,
                A.enableSectionBox(),
                $A.addEventListener("click", (function() {
                    document.querySelector("#sectionWindow input[type=radio]:checked").value > 0 ? A.showSectionBox() : A.hideSectionBox()
                }
                ))
            }
            ));
            var Ae = pA.querySelector(".subtract")
              , ee = pA.querySelector(".add")
              , te = pA.querySelector(".modelPartitionRange");
            hA.addEventListener("click", (function(e) {
                o.roam && (document.getElementById("roam" + i).style.backgroundColor = "",
                jd("info", "模型分解模式下将关闭漫游功能", 2e3),
                t.exitRoam()),
                A.render(),
                pA.addEventListener("click", (function(A) {
                    OA(A)
                }
                )),
                "none" === pA.style.display ? (DA(),
                pA.style.display = "block") : pA.style.display = "none",
                fA.innerText = "离散系数： " + te.value,
                OA(e)
            }
            )),
            te.addEventListener("change", (function(e) {
                document.querySelector(".modelPartition-info").innerText = "离散系数： " + te.value;
                var t = A.getViewerImpl().modelManager.getModelKeys()
                  , i = Number(te.value);
                isNaN(i) || A.modelsExplosion({
                    modelKey: t,
                    coefficientX: i,
                    coefficientY: i,
                    coefficientZ: i
                })
            }
            )),
            Ae.addEventListener("click", (function() {
                var e = te.value
                  , t = Number(te.getAttribute("step"));
                te.value = Number(e) - t,
                document.querySelector(".modelPartition-info").innerText = "离散系数： " + te.value;
                var i = A.getViewerImpl().modelManager.getModelKeys()
                  , o = Number(te.value);
                isNaN(o) || A.modelsExplosion({
                    modelKey: i,
                    coefficientX: o,
                    coefficientY: o,
                    coefficientZ: o
                })
            }
            )),
            ee.addEventListener("click", (function() {
                var e = te.value
                  , t = Number(te.getAttribute("step"));
                te.value = Number(e) + t,
                document.querySelector(".modelPartition-info").innerText = "离散系数： " + te.value;
                var i = A.getViewerImpl().modelManager.getModelKeys()
                  , o = Number(te.value);
                isNaN(o) || A.modelsExplosion({
                    modelKey: i,
                    coefficientX: o,
                    coefficientY: o,
                    coefficientZ: o
                })
            }
            )),
            X.addEventListener("click", (function() {
                var e = A.getHighlightComponentsKey();
                1 > e.length ? jd("warning", "未选中构件", 2e3) : (t.push({
                    type: "修改线框",
                    data: e
                }),
                A.wireFrameComponentsByKey(e, !0))
            }
            )),
            $.addEventListener("click", (function(e) {
                "none" === tA.style.display && DA(),
                tA.addEventListener("click", (function(A) {
                    OA(A)
                }
                )),
                tA.style.display = "none" === tA.style.display ? "block" : "none",
                1 > A.getHighlightComponentsKey().length && (jd("warning", "未选中构件", 2e3),
                tA.style.display = "none"),
                OA(e)
            }
            )),
            UA.addEventListener("click", (function(A) {
                KA.addEventListener("click", (function(A) {
                    OA(A)
                }
                )),
                "" === KA.style.display || "none" === KA.style.display ? (DA(),
                KA.style.display = "flex") : KA.style.display = "none",
                kA.style.display = "none",
                OA(A)
            }
            )),
            RA.addEventListener("click", (function(A) {
                kA.addEventListener("click", (function(A) {
                    OA(A)
                }
                )),
                kA.style.display = "none" === kA.style.display ? "block" : "none",
                OA(A)
            }
            )),
            NA.addEventListener("click", (function(e) {
                DA();
                var t = document.getElementById("Fullscreen" + i);
                o.fullScreen ? (o.fullScreen = !1,
                Wh.exitFullScreen(),
                t.className = "fullScreen",
                t.title = "全屏显示") : (o.fullScreen = !0,
                Wh.fullScreen(A.viewportDiv),
                t.className = "cancelFullScreen",
                t.title = "取消全屏")
            }
            )),
            A.viewportDiv.focus()
        }
        ,
        this.createTool2 = function() {
            var e = document.createElement("div");
            e.id = "my-tool2" + i,
            e.className = "yj-tool2",
            A.viewerImpl.domElement.appendChild(e),
            this.toolbarTop = e;
            var n = document.createElement("div");
            n.className = "yj-group",
            e.appendChild(n);
            var a = document.createElement("button");
            a.className = "yj-but",
            a.title = "模型树",
            a.id = "modelTree" + i;
            var s = document.createElement("div");
            s.classList.add("yj-icon"),
            s.classList.add("modelTree-icon"),
            a.appendChild(s),
            t.options.modelTree && n.appendChild(a);
            var l = document.createElement("button");
            l.className = "yj-but",
            l.title = "查询",
            l.id = "search" + i;
            var c = document.createElement("div");
            c.classList.add("yj-icon"),
            c.classList.add("search-icon"),
            l.appendChild(c);
            var h = document.createElement("div");
            h.className = "yj-group",
            e.appendChild(h);
            var d = document.createElement("button");
            d.className = "yj-but",
            d.title = "添加标签",
            d.id = "mark" + i;
            var p = document.createElement("div");
            p.classList.add("yj-icon"),
            p.classList.add("label-icon"),
            d.appendChild(p),
            t.options.mark && (h.appendChild(d),
            t.mark = new Hd(r,this));
            for (var g = document.querySelectorAll("button"), u = 0; g.length > u; u += 1)
                g[u].addEventListener("mouseover", (function(A) {
                    this.style.backgroundColor = "#1f89de"
                }
                )),
                g[u].addEventListener("mouseout", (function(A) {
                    this.id.split(i).length > 1 && (o[this.id.split(i)[0]] || (this.style.backgroundColor = ""))
                }
                ));
            if (A.viewerImpl.modelManager.addEventListener(Rc.ON_CLICK_PICK, (function(e) {
                o.attribute && (e.intersectInfo ? t.showComponentAttribute(A.viewerImpl.modelManager.sceneState.getSelection()[0]) : t.showComponentAttribute())
            }
            )),
            t.options.snapshot) {
                xh.append(h, '<button type="button" class="yj-but" title="快照" id="snapshot' + i + '"><div class="yj-icon snapshot-icon" ></div></button>');
                var f = document.getElementById("snapshot" + i);
                f.addEventListener("mouseover", (function(A) {
                    this.style.backgroundColor = "#1f89de"
                }
                )),
                f.addEventListener("mouseout", (function(A) {
                    o[this.id.split(i)[0]] || (this.style.backgroundColor = "")
                }
                )),
                t.snapshot = new Zd(r,this)
            }
            if (t.options.postil) {
                xh.append(h, '<button type="button" class="yj-but" title="批注" id="postil' + i + '"><div class="yj-icon postil-icon" ></div></button>');
                var m = document.getElementById("postil" + i);
                m.addEventListener("mouseover", (function(A) {
                    this.style.backgroundColor = "#1f89de"
                }
                )),
                m.addEventListener("mouseout", (function(A) {
                    o[this.id.split(i)[0]] || (this.style.backgroundColor = "")
                }
                )),
                t.postil = new Jd(r,this)
            }
            A.viewportDiv.focus()
        }
        ,
        this.showComponentAttribute = (s = "",
        l = document.getElementById("tab-properties" + i),
        c = function(A, e, t) {
            var i = document.createElement("tr");
            t.parentNode.appendChild(i),
            i.appendChild(document.createElement("td")),
            i.querySelector("td").innerHTML = A;
            var o = document.createElement("td")
              , n = null === e ? "" : e
              , r = document.createElement("span");
            r.classList.add("value"),
            r.classList.add("nonEditable"),
            r.innerHTML = n,
            o.appendChild(r),
            i.appendChild(o)
        }
        ,
        h = function(A, e) {
            var t = document.createElement("tr");
            t.className = "sx-active",
            l.querySelector("table tbody").appendChild(t);
            var i = document.createElement("td");
            for (var o in i.colSpan = 2,
            i.style.fontSize = "14px",
            t.appendChild(i),
            i.appendChild(document.createElement("b")),
            i.firstElementChild.innerHTML = A,
            e)
                c(o, e[o], t)
        }
        ,
        function(e) {
            if (l = document.querySelector("#tab-properties" + i),
            e !== s) {
                if (void 0 === e) {
                    var o = l.querySelectorAll("table tbody tr");
                    l.querySelector("table tbody").removeChild(o[0]),
                    l.querySelector("table tbody").innerHTML = "";
                    var n = document.createElement("tr");
                    n.className = "noprop";
                    var r = document.createElement("td");
                    return r.setAttribute("colspan", "2"),
                    r.innerHTML = "未选中构件",
                    n.appendChild(r),
                    l.querySelector("table tbody").appendChild(n),
                    void (s = e)
                }
                s = e,
                l.querySelector("table tbody").innerHTML = "";
                var a = A.viewerImpl.getModelByComponentKey(s)
                  , d = "";
                a && (d = a.projectKey),
                t.getComponentAttribute({
                    key: s,
                    projectKey: d
                }, (function(A) {
                    if (l.querySelector("table tbody").innerHTML = "",
                    null === A) {
                        var e = document.createElement("tr");
                        e.className = "noprop";
                        var t = document.createElement("td");
                        return t.innerHTML = "没有属性",
                        e.appendChild(t),
                        void l.querySelector("table tbody").appendChild(e)
                    }
                    if (void 0 === A) {
                        var i = document.createElement("tr");
                        i.className = "noprop";
                        var o = document.createElement("td");
                        return o.innerHTML = "属性加载失败",
                        i.appendChild(o),
                        void l.querySelector("table tbody").appendChild(i)
                    }
                    var n = document.createElement("tr");
                    n.className = "noprop";
                    var r = document.createElement("th");
                    n.appendChild(r);
                    var a = document.createElement("span");
                    a.classList.add("value"),
                    a.classList.add("nonEditable"),
                    a.innerHTML = "名称",
                    r.appendChild(a);
                    var s = document.createElement("th");
                    n.appendChild(s);
                    var d = document.createElement("span");
                    d.classList.add("value"),
                    d.classList.add("nonEditable"),
                    d.innerHTML = "值",
                    s.appendChild(d),
                    l.querySelector("table tbody").appendChild(n);
                    var p = A;
                    for (var g in p)
                        "object" === lc(p[g]) ? h(g, p[g]) : "string" == typeof p[g] && c(g, p[g], n)
                }
                ))
            }
        }
        ),
        this.undoOrRedo = function(A) {
            t.maxUndoListLength > A || (A = t.maxUndoListLength),
            0 > A && (A = 0);
            var e = document.querySelectorAll(".history_li");
            if (d > A)
                for (var i = d; i >= A; i -= 1) {
                    p(i + 1);
                    var o = e[i];
                    o && (o.classList.remove("history_redo"),
                    o.classList.add("history_undo"))
                }
            if (A > d)
                for (var n = d; A > n; n += 1) {
                    g(n);
                    var r = e[n];
                    r && (r.classList.remove("history_undo"),
                    r.classList.add("history_redo"))
                }
            d = A
        }
        ,
        this.clearUndoList = function() {
            d = 0,
            t.undoList = [],
            t.redoList = [];
            var A = document.querySelector(".history");
            if (A) {
                A.innerHTML = "";
                var e = document.createElement("span");
                e.innerText = "历史记录",
                e.style.cssText += "color:white",
                A.appendChild(e)
            }
        }
        ,
        this.push = function(A) {
            if (t.undoList.length > d && (t.undoList.splice(d, t.maxUndoListLength),
            t.redoList.splice(d, t.maxUndoListLength)),
            t.maxUndoListLength > t.undoList.length || (t.undoList.shift(),
            t.redoList.shift(),
            d -= 1),
            t.maxUndoListLength - (d += 1),
            t.undoList.push(A),
            t.redoList.push(A),
            t.options.restore) {
                var e = document.querySelector(".history");
                if (e) {
                    e.innerHTML = "";
                    var i = document.createElement("span");
                    i.innerText = "历史记录",
                    i.style.cssText += "color:white",
                    e.appendChild(i);
                    for (var o = 0; d > o; o += 1) {
                        var n = document.createElement("li");
                        n.innerHTML = t.undoList[o].type,
                        n.undoNum = o + 1,
                        n.title = "点击执行撤销或重做",
                        n.className = "history_li history_redo",
                        n.addEventListener("click", u),
                        e.appendChild(n)
                    }
                }
            }
        }
        ,
        A.getViewerImpl().getModelManager().addEventListener(Rc.ON_RECTPICK_ADD, (function(A) {
            A.list && t.push({
                type: "框选添加",
                data: A.list
            })
        }
        )),
        A.getViewerImpl().getModelManager().addEventListener(Rc.ON_RECTPICK_REMOVE, (function(A) {
            A.list && t.push({
                type: "框选移除",
                data: A.list
            })
        }
        )),
        this.getComponentAttribute = function(e, t) {
            A.getComponentsAttributeByKey(e.key, (function(A) {
                A && t(A.attribute)
            }
            ))
        }
        ,
        this.exitMeasure = function() {
            if (o.measurement) {
                var A = document.getElementById("measurement" + i);
                A && xh.fireEvent(A, "click")
            }
        }
        ,
        this.exitRoam = function() {
            if (o.roam) {
                var A = document.getElementById("roam" + i);
                A && (xh.fireEvent(A, "click"),
                o.roam = !1)
            }
        }
    }
      , _d = function(A) {
        return new Promise((function(e, t) {
            var i = Object.assign({
                type: "get",
                cache: !0,
                headers: {
                    "Content-type": "application/x-www-form-urlencoded"
                },
                data: null,
                async: !0,
                success: null,
                error: null,
                beforeSend: null,
                requestQueue: void 0
            }, A)
              , o = null;
            for (var n in (o = window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP")).onreadystatechange = function() {
                if (4 === o.readyState || "4" === o.readyState) {
                    var A = o.status;
                    A >= 200 && 300 > A || 0 === A ? (i.success && i.success(o.response || o.responseText, "" === o.responseType || "document" === o.responseType && o.responseXML),
                    e(o.response || o.responseText, "" === o.responseType || "document" === o.responseType && o.responseXML)) : (i.error && i.error(A, o.response || o.responseText, "" === o.responseType || "document" === o.responseType && o.responseXML),
                    t(A, o.response || o.responseText, "" === o.responseType || "document" === o.responseType && o.responseXML))
                }
            }
            ,
            o.open(i.type, i.url, i.async),
            i.headers)
                o.setRequestHeader(n, i.headers[n]);
            i.responseType && (o.responseType = i.responseType),
            i.requestQueue ? i.requestQueue.addRequest(o, i.data) : i.beforeSend ? i.beforeSend(o, (function() {
                o.send(i.data)
            }
            )) : o.send(i.data)
        }
        ))
    }
      , $d = function() {
        var A = 0
          , e = document.createElement("div");
        function t(A) {
            return e.appendChild(A.dom),
            A
        }
        function i(t) {
            for (var i = 0; e.children.length > i; i++)
                e.children[i].style.display = i === t ? "block" : "none";
            A = t
        }
        e.style.cssText = "position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",
        e.addEventListener("click", (function(t) {
            t.preventDefault(),
            i(++A % e.children.length)
        }
        ), !1);
        var o = (performance || Date).now()
          , n = o
          , r = 0
          , a = t(new $d.Panel("FPS","#0ff","#002"))
          , s = t(new $d.Panel("MS","#0f0","#020"));
        if (self.performance && self.performance.memory)
            var l = t(new $d.Panel("MB","#f08","#201"));
        return i(0),
        {
            REVISION: 16,
            dom: e,
            addPanel: t,
            showPanel: i,
            begin: function() {
                o = (performance || Date).now()
            },
            end: function() {
                r++;
                var A = (performance || Date).now();
                if (s.update(A - o, 200),
                A >= n + 1e3 && (a.update(1e3 * r / (A - n), 100),
                n = A,
                r = 0,
                l)) {
                    var e = performance.memory;
                    l.update(e.usedJSHeapSize / 1048576, e.jsHeapSizeLimit / 1048576)
                }
                return A
            },
            update: function() {
                o = this.end()
            },
            domElement: e,
            setMode: i
        }
    };
    $d.Panel = function(A, e, t) {
        var i = 1 / 0
          , o = 0
          , n = Math.round
          , r = n(window.devicePixelRatio || 1)
          , a = 80 * r
          , s = 48 * r
          , l = 3 * r
          , c = 2 * r
          , h = 3 * r
          , d = 15 * r
          , p = 74 * r
          , g = 30 * r
          , u = document.createElement("canvas");
        u.width = a,
        u.height = s,
        u.style.cssText = "width:80px;height:48px";
        var f = u.getContext("2d");
        return f.font = "bold " + 9 * r + "px Helvetica,Arial,sans-serif",
        f.textBaseline = "top",
        f.fillStyle = t,
        f.fillRect(0, 0, a, s),
        f.fillStyle = e,
        f.fillText(A, l, c),
        f.fillRect(h, d, p, g),
        f.fillStyle = t,
        f.globalAlpha = .9,
        f.fillRect(h, d, p, g),
        {
            dom: u,
            update: function(s, m) {
                i = Math.min(i, s),
                o = Math.max(o, s),
                f.fillStyle = t,
                f.globalAlpha = 1,
                f.fillRect(0, 0, a, d),
                f.fillStyle = e,
                f.fillText(n(s) + " " + A + " (" + n(i) + "-" + n(o) + ")", l, c),
                f.drawImage(u, h + r, d, p - r, g, h, d, p - r, g),
                f.fillRect(h + p - r, d, r, g),
                f.fillStyle = t,
                f.globalAlpha = .9,
                f.fillRect(h + p - r, d, r, n((1 - s / m) * g))
            }
        }
    }
    ;
    var Ap = function(A) {
        this.viewer = A
    };
    Ap.prototype = {
        construtor: Ap,
        destroy: function() {
            this.viewer = null
        },
        update: function(A) {
            var e = this.getControl();
            e && (e.update(A),
            this.viewer.render())
        },
        getControl: function() {
            for (var A = this.viewer.controlManager.tools, e = 0; A.length > e; e += 1)
                if (A[e].getName() === Pc.CLIP_BY_BOX)
                    return A[e];
            return null
        },
        setSectionBox: function(A, e) {
            this.getControl().setSectionBox(A, e)
        },
        toggle: function(A, e) {
            this.getControl().toggle(A, e)
        },
        setVisible: function(A) {
            this.getControl().visible(A)
        },
        setRotatable: function(A) {
            this.getControl().rotatable(A)
        },
        enablePick: function(A) {
            this.getControl().enablePick = A
        },
        saveState: function() {
            return this.getControl().store()
        },
        loadState: function(A) {
            this.getControl().restore(A)
        },
        reset: function() {
            this.viewer.getScene().resetClipPlanes()
        },
        recalculate: function() {
            return this.viewer.getFilter().getVisibleComponentsBbox()
        },
        setProcess: function(A, e) {
            this.getControl().setProcess(A, e)
        },
        getProcess: function(A) {
            return this.getControl().getProcess(A)
        }
    };
    var ep = function(A, e) {
        H.call(this);
        var t = {
            priority: 5,
            pickableType: Qc.UnPickable,
            globalSpace: !1,
            hoverEnabled: !1
        };
        this.name = A;
        var i = uh.extend({}, t, e);
        this.priority = i.priority,
        this.pickableType = i.pickableType,
        this.globalSpace = i.globalSpace,
        this.boundingBox = null,
        this.hoverEnabled = i.hoverEnabled
    };
    (ep.prototype = Object.create(H.prototype)).constructor = ep,
    Object.assign(ep, Ld),
    ep.prototype.removeByName = function(A) {
        for (var e = this.children, t = 0, i = e.length; i > t; t += 1)
            if (e[t].name === A) {
                e.splice(t, 1);
                break
            }
    }
    ,
    ep.prototype.clear = function() {
        this.children.length = 0
    }
    ,
    ep.prototype.isGlobalSpace = function() {
        return this.globalSpace
    }
    ,
    ep.prototype.hasChild = function(A) {
        for (var e = 0, t = this.children.length; t > e; e += 1)
            if (this.children[e].name === A)
                return !0;
        return !1
    }
    ,
    ep.prototype.isPickable = function() {
        return this.pickableType !== Qc.UnPickable
    }
    ;
    var tp = function(A) {
        this.viewer = A,
        this.viewportDIV = A.viewerImpl.getRenderer().domElement.parentElement,
        this.creatSVG = function() {
            document.getElementById("svgid" + this.viewer.getViewerImpl().uuid) || (this.svg = document.createElementNS("http://www.w3.org/2000/svg", "svg"),
            this.svg.setAttribute("id", "svgid" + this.viewer.getViewerImpl().uuid),
            this.svg.setAttribute("style", "width: 100%; height: 100%; position:absolute; left: 0; top:0;"),
            this.viewportDIV.appendChild(this.svg))
        }
        ,
        this.creatRect = function(A) {
            var e = A.data.left
              , t = A.data.top
              , i = A.data.width
              , o = A.data.height
              , n = A.data.visible;
            this.deleteRect(),
            n && (this.rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"),
            this.rect.setAttribute("id", "rectid" + this.viewer.getViewerImpl().uuid),
            this.rect.setAttribute("x", e),
            this.rect.setAttribute("y", t),
            this.rect.setAttribute("width", i),
            this.rect.setAttribute("height", o),
            this.rect.setAttribute("style", "fill:#0DFFB2;stroke-width:2;stroke:rgb(0,255,0);fill-opacity:0.1;stroke-opacity:0.9"),
            this.svg.appendChild(this.rect))
        }
        ,
        this.deleteRect = function() {
            var A = document.getElementById("rectid" + this.viewer.getViewerImpl().uuid);
            A && this.svg.removeChild(A)
        }
        ,
        this.deleteSVG = function() {
            if (this.svg) {
                var A = document.getElementById("rectid" + this.viewer.getViewerImpl().uuid);
                A && this.svg.removeChild(A),
                this.viewportDIV.removeChild(this.svg)
            }
        }
        ,
        this.creatMoveCircle = function(A) {
            var e = A.x
              , t = A.y;
            this.circleMov = document.createElementNS("http://www.w3.org/2000/svg", "circle"),
            this.circleMov.setAttribute("id", "circleMove" + this.viewer.getViewerImpl().uuid),
            this.circleMov.setAttribute("cx", e),
            this.circleMov.setAttribute("cy", t),
            this.circleMov.setAttribute("r", "5"),
            this.circleMov.setAttribute("style", "fill:#500A11;stroke-width:2;stroke:rgb(0,255,0);fill-opacity:0.9;stroke-opacity:0.9"),
            this.svg.appendChild(this.circleMov)
        }
        ,
        this.changeMoveCircleStyle = function(A) {
            var e = document.getElementById("circleMove" + this.viewer.getViewerImpl().uuid);
            e.setAttribute("cx", A[0]),
            e.setAttribute("cy", A[1]),
            e.setAttribute("style", "fill:#00ff00;stroke-width:1;stroke:rgb(60,240,240);fill-opacity:0.9;stroke-opacity:0.9")
        }
        ,
        this.deleteCircle = function() {
            var A = document.getElementById("circleMove" + this.viewer.getViewerImpl().uuid);
            A && this.svg.removeChild(A)
        }
        ,
        this.createMoveLine = function(A, e) {
            var t = A.x
              , i = A.y
              , o = e.x
              , n = e.y;
            this.deleteMoveLine(),
            this.moveline = document.createElementNS("http://www.w3.org/2000/svg", "line"),
            this.moveline.setAttribute("id", "moveLine" + this.viewer.getViewerImpl().uuid),
            this.moveline.setAttribute("class", "moveLine"),
            this.moveline.setAttribute("x1", t),
            this.moveline.setAttribute("y1", i),
            this.moveline.setAttribute("x2", o),
            this.moveline.setAttribute("y2", n),
            this.moveline.setAttribute("stroke", "#0AEA06"),
            this.moveline.setAttribute("stroke-width", "2"),
            this.svg.appendChild(this.moveline)
        }
        ,
        this.deleteMoveLine = function() {
            var A = document.getElementById("moveLine" + this.viewer.getViewerImpl().uuid);
            A && this.svg.removeChild(A)
        }
        ,
        this.creatPickCircle = function(A, e) {
            var t = A.x
              , i = A.y;
            this.circlePic = document.createElementNS("http://www.w3.org/2000/svg", "circle"),
            this.circlePic.setAttribute("id", "circlePick" + this.viewer.getViewerImpl().uuid + e),
            this.circlePic.setAttribute("class", "circlePick"),
            this.circlePic.setAttribute("cx", t),
            this.circlePic.setAttribute("cy", i),
            this.circlePic.setAttribute("r", "5"),
            this.circlePic.setAttribute("style", "fill:#00ff00;stroke-width:1;stroke:rgb(60,240,240);fill-opacity:0.9;stroke-opacity:0.9"),
            this.svg.appendChild(this.circlePic)
        }
        ,
        this.creatLine = function(A, e, t, i) {
            var o = A.x
              , n = A.y
              , r = e.x
              , a = e.y;
            this.line = document.createElementNS("http://www.w3.org/2000/svg", "line"),
            this.line.setAttribute("id", "pickline" + this.viewer.getViewerImpl().uuid + i),
            this.line.setAttribute("class", "pickline"),
            this.line.setAttribute("x1", o),
            this.line.setAttribute("y1", n),
            this.line.setAttribute("x2", r),
            this.line.setAttribute("y2", a),
            this.line.setAttribute("stroke", t),
            this.line.setAttribute("stroke-width", "2"),
            this.svg.appendChild(this.line)
        }
        ,
        this.deleteLineAndCircle = function() {
            for (var A = this.svg.getElementsByClassName("pickline"), e = this.svg.getElementsByClassName("circlePick"); A.length; )
                this.svg.removeChild(A[A.length - 1]);
            for (; e.length; )
                this.svg.removeChild(e[e.length - 1])
        }
    };
    function ip(A, e) {
        var t = A || 0
          , i = e || 0;
        return t === i ? 0 : t > i ? 1 : -1
    }
    function op(A, e) {
        var t = A.split(".").map((function(A) {
            return Number(A) || 0
        }
        ))
          , i = e.split(".").map((function(A) {
            return Number(A) || 0
        }
        ));
        return 0 === (ip(t[0], i[0]) || ip(t[1], i[1]) || ip(t[2], i[2]))
    }
    function np(A, e) {
        var t = A.split(".").map((function(A) {
            return Number(A) || 0
        }
        ))
          , i = e.split(".").map((function(A) {
            return Number(A) || 0
        }
        ));
        return (ip(t[0], i[0]) || ip(t[1], i[1]) || ip(t[2], i[2])) >= 0
    }
    function rp(A, e) {
        var t = A.split(".").map((function(A) {
            return Number(A) || 0
        }
        ))
          , i = e.split(".").map((function(A) {
            return Number(A) || 0
        }
        ));
        return (ip(t[0], i[0]) || ip(t[1], i[1]) || ip(t[2], i[2])) > 0
    }
    function ap(A, e) {
        return !np(A, e)
    }
    function sp(A, e) {
        return !rp(A, e)
    }
    var lp = function(A, e) {
        var i = this;
        this.viewer = A,
        this.preRotationHandle = e,
        this.mouseButtons = {
            LEFT: t.LEFT,
            RIGHT: t.RIGHT
        },
        this.visible = !0,
        this.isAnimationFinish = !0,
        this.pickedColor = 16763094,
        this.width = 0,
        this.height = 0,
        this.isDisable = !1;
        var o = null
          , n = null
          , r = 0
          , a = 1
          , l = 2
          , c = 220
          , h = 150
          , d = 80
          , p = 1
          , g = 2
          , u = 5
          , f = 6
          , m = 3
          , C = 4
          , v = "Home"
          , I = "Bottom"
          , E = "Top"
          , B = "Left"
          , x = "Right"
          , S = "Front"
          , w = "Back"
          , M = "Bottom_Front"
          , b = "Bottom_Back"
          , U = "Bottom_Right"
          , F = "Bottom_Left"
          , K = "Top_Front"
          , Q = "Top_Back"
          , R = "Top_Right"
          , T = "Top_Left"
          , k = "LeftFront"
          , D = "LeftBack"
          , L = "RightFront"
          , N = "RightBack"
          , O = "Bottom_FrontRight"
          , V = "Bottom_FrontLeft"
          , G = "Bottom_BackLeft"
          , P = "Bottom_BackRight"
          , q = "Top_FrontRight"
          , j = "Top_FrontLeft"
          , H = "Top_BackLeft"
          , W = "Top_BackRight"
          , J = new Y
          , z = new Ka(-h / 2,h / 2,h / 2,-h / 2,-h / 2,h / 2)
          , Z = new Dd
          , X = new Xi
          , _ = new Xi
          , $ = new Xi;
        X.add(_),
        X.add($),
        this._cube = X;
        var AA = !1
          , eA = !1
          , tA = new s
          , iA = new s
          , oA = new s
          , nA = new s
          , rA = !1
          , aA = ""
          , sA = null
          , lA = -1
          , cA = !1;
        this.uninit = function() {
            this.removeDomEventListeners(),
            o && (o.removeChild(n.domElement),
            o = null)
        }
        ,
        this.enable = function() {
            o && n && !n.domElement.parentNode && (o.appendChild(n.domElement),
            this.addDomEventListeners())
        }
        ,
        this.disable = function() {
            o && n && n.domElement.parentNode && (this.removeDomEventListeners(),
            o.removeChild(n.domElement))
        }
        ;
        !function() {
            var A = new ko({
                color: 0,
                side: 1
            })
              , e = new De;
            e.vertices.push(new y(-40,40,40), new y(40,40,40));
            var t = new Go(e,A);
            $.add(t);
            var i = new De;
            i.vertices.push(new y(40,40,40), new y(40,40,-40));
            var o = new Go(i,A);
            $.add(o);
            var n = new De;
            n.vertices.push(new y(40,40,-40), new y(-40,40,-40));
            var r = new Go(n,A);
            $.add(r);
            var a = new De;
            a.vertices.push(new y(-40,40,-40), new y(-40,40,40));
            var s = new Go(a,A);
            $.add(s);
            var l = new De;
            l.vertices.push(new y(-40,40,-40), new y(-40,-40,-40));
            var c = new Go(l,A);
            $.add(c);
            var h = new De;
            h.vertices.push(new y(40,40,-40), new y(40,-40,-40));
            var d = new Go(h,A);
            $.add(d);
            var p = new De;
            p.vertices.push(new y(40,40,40), new y(40,-40,40));
            var g = new Go(p,A);
            $.add(g);
            var u = new De;
            u.vertices.push(new y(-40,40,40), new y(-40,-40,40));
            var f = new Go(u,A);
            $.add(f);
            var m = new De;
            m.vertices.push(new y(-40,-40,40), new y(40,-40,40));
            var C = new Go(m,A);
            $.add(C);
            var v = new De;
            v.vertices.push(new y(40,-40,40), new y(40,-40,-40));
            var I = new Go(v,A);
            $.add(I);
            var E = new De;
            E.vertices.push(new y(40,-40,-40), new y(-40,-40,-40));
            var B = new Go(E,A);
            $.add(B);
            var x = new De;
            x.vertices.push(new y(-40,-40,-40), new y(-40,-40,40));
            var S = new Go(x,A);
            $.add(S);
            var w = new Aa;
            w.load(Pd.back, (function(A) {
                var e = new Ue(new et(60,60),new jA({
                    map: A,
                    color: 16777215,
                    side: 2
                }));
                e.position.set(0, 40, 0),
                e.rotation.x = .5 * Math.PI,
                e.name = "Back",
                _.add(e)
            }
            )),
            w.load(Pd.front, (function(A) {
                var e = new Ue(new et(60,60),new jA({
                    map: A,
                    color: 16777215,
                    side: 2
                }));
                e.position.set(0, -40, 0),
                e.rotation.x = .5 * Math.PI,
                e.name = "Front",
                _.add(e)
            }
            )),
            w.load(Pd.left, (function(A) {
                var e = new Ue(new et(60,60),new jA({
                    map: A,
                    color: 16777215,
                    side: 2
                }));
                e.position.set(-40, 0, 0),
                e.rotation.y = .5 * Math.PI,
                e.rotation.x = .5 * Math.PI,
                e.name = "Left",
                _.add(e)
            }
            )),
            w.load(Pd.right, (function(A) {
                var e = new Ue(new et(60,60),new jA({
                    map: A,
                    color: 16777215,
                    side: 2
                }));
                e.position.set(40, 0, 0),
                e.rotation.y = .5 * Math.PI,
                e.rotation.x = .5 * Math.PI,
                e.name = "Right",
                _.add(e)
            }
            )),
            w.load(Pd.top, (function(A) {
                var e = new Ue(new et(60,60),new jA({
                    map: A,
                    color: 16777215,
                    side: 2
                }));
                e.position.set(0, 0, 40),
                e.name = "Top",
                _.add(e)
            }
            )),
            w.load(Pd.bottom, (function(A) {
                var e = new Ue(new et(60,60),new jA({
                    map: A,
                    color: 16777215,
                    side: 2
                }));
                e.position.set(0, 0, -40),
                e.name = "Bottom",
                _.add(e)
            }
            ));
            var M = new Ne(10,60,10)
              , b = new Ue(M,new jA({
                color: 16777215
            }));
            b.position.set(35, 0, 35),
            b.name = "Top_Front",
            _.add(b);
            var U = new Ue(M,new jA({
                color: 16777215
            }));
            U.position.set(35, 0, -35),
            U.name = "Bottom_Front",
            _.add(U);
            var F = new Ue(M,new jA({
                color: 16777215
            }));
            F.position.set(-35, 0, 35),
            F.name = "Top_Back",
            _.add(F);
            var K = new Ue(M,new jA({
                color: 16777215
            }));
            K.position.set(-35, 0, -35),
            K.name = "Bottom_Back",
            _.add(K);
            var Q = new Ne(60,10,10)
              , R = new Ue(Q,new jA({
                color: 16777215
            }));
            R.position.set(0, -35, 35),
            R.name = "Top_Left",
            _.add(R);
            var T = new Ue(Q,new jA({
                color: 16777215
            }));
            T.position.set(0, -35, -35),
            T.name = "Bottom_Left",
            _.add(T);
            var k = new Ue(Q,new jA({
                color: 16777215
            }));
            k.position.set(0, 35, 35),
            k.name = "Top_Right",
            _.add(k);
            var D = new Ue(Q,new jA({
                color: 16777215
            }));
            D.position.set(0, 35, -35),
            D.name = "Bottom_Right",
            _.add(D);
            var L = new Ne(10,10,60)
              , N = new Ue(L,new jA({
                color: 16777215
            }));
            N.position.set(35, -35, 0),
            N.name = "LeftFront",
            _.add(N);
            var O = new Ue(L,new jA({
                color: 16777215
            }));
            O.position.set(35, 35, 0),
            O.name = "RightFront",
            _.add(O);
            var V = new Ue(L,new jA({
                color: 16777215
            }));
            V.position.set(-35, -35, 0),
            V.name = "LeftBack",
            _.add(V);
            var G = new Ue(L,new jA({
                color: 16777215
            }));
            G.position.set(-35, 35, 0),
            G.name = "RightBack",
            _.add(G);
            var P = new Ne(10,10,10)
              , q = new Ue(P,new jA({
                color: 16777215
            }));
            q.position.set(35, -35, 35),
            q.name = "Top_FrontLeft",
            _.add(q);
            var j = new Ue(P,new jA({
                color: 16777215
            }));
            j.position.set(35, -35, -35),
            j.name = "Bottom_FrontLeft",
            _.add(j);
            var H = new Ue(P,new jA({
                color: 16777215
            }));
            H.position.set(35, 35, 35),
            H.name = "Top_FrontRight",
            _.add(H);
            var Y = new Ue(P,new jA({
                color: 16777215
            }));
            Y.position.set(35, 35, -35),
            Y.name = "Bottom_FrontRight",
            _.add(Y);
            var W = new Ue(P,new jA({
                color: 16777215
            }));
            W.position.set(-35, -35, 35),
            W.name = "Top_BackLeft",
            _.add(W);
            var J = new Ue(P,new jA({
                color: 16777215
            }));
            J.position.set(-35, -35, -35),
            J.name = "Bottom_BackLeft",
            _.add(J);
            var z = new Ue(P,new jA({
                color: 16777215
            }));
            z.position.set(-35, 35, 35),
            z.name = "Top_BackRight",
            _.add(z);
            var Z = new Ue(P,new jA({
                color: 16777215
            }));
            Z.name = "Bottom_BackRight",
            Z.position.set(-35, 35, -35),
            _.add(Z)
        }(),
        J.add(X);
        var hA = function(A) {
            eA = A;
            for (var e = A ? .8 : 1, t = X.children, i = 0; t.length > i; i += 1)
                for (var o = t[i].children, n = 0; o.length > n; n += 1)
                    o[n].material.transparent = A,
                    o[n].material.opacity = e
        };
        hA(!1);
        var dA = function() {
            sA && sA.material.color.set(sA.currentColor),
            sA = null
        }
          , pA = function(A) {
            if (void 0 !== o) {
                var e = xh.getDomOffsetToClient(o)
                  , t = new s;
                if (t.x = A.x - e.left,
                t.y = A.y - e.top,
                t.x > 0 && i.width > t.x && t.y > 0 && i.height > t.y)
                    return nA.x = t.x / i.width * 2 - 1,
                    nA.y = -t.y / i.height * 2 + 1,
                    !0
            }
            return !1
        }
          , gA = function() {
            var A = new y(nA.x,nA.y,.5);
            Z.setFromCamera(A, z);
            var e, t = Z.intersectObjects(X.children[0].children);
            t ? sA !== (e = t.object) && (sA && sA.material.color.set(sA.currentColor),
            (sA = e).currentColor = sA.material.color.clone(),
            "" !== sA.name && sA.material.color.set(i.pickedColor)) : dA()
        };
        this.mouseUp = function(A) {
            A.stopPropagation();
            var t = new s(A.clientX,A.clientY)
              , o = pA(t);
            return AA ? (AA = !1,
            iA.set(t.x, t.y),
            oA.subVectors(iA, tA),
            this.preRotationHandle && !this.preRotationHandle() || (this.viewer.viewerImpl.rotateCamera(oA),
            tA.copy(iA))) : o && A.button === i.mouseButtons.LEFT && sA && (lA = -1,
            function(A) {
                var e = -1;
                switch (A) {
                case v:
                    e = Uc.Home;
                    break;
                case E:
                    e = Uc.Top;
                    break;
                case I:
                    e = Uc.Bottom;
                    break;
                case M:
                    e = Uc.BottomFront;
                    break;
                case b:
                    e = Uc.BottomBack;
                    break;
                case U:
                    e = Uc.BottomRight;
                    break;
                case F:
                    e = Uc.BottomLeft;
                    break;
                case O:
                    e = Uc.BottomFrontRight;
                    break;
                case V:
                    e = Uc.BottomFrontLeft;
                    break;
                case G:
                    e = Uc.BottomBackLeft;
                    break;
                case P:
                    e = Uc.BottomBackRight;
                    break;
                case K:
                    e = Uc.TopFront;
                    break;
                case Q:
                    e = Uc.TopBack;
                    break;
                case R:
                    e = Uc.TopRight;
                    break;
                case T:
                    e = Uc.TopLeft;
                    break;
                case q:
                    e = Uc.TopFrontRight;
                    break;
                case j:
                    e = Uc.TopFrontLeft;
                    break;
                case H:
                    e = Uc.TopBackLeft;
                    break;
                case W:
                    e = Uc.TopBackRight;
                    break;
                case S:
                    e = Uc.Front;
                    break;
                case w:
                    e = Uc.Back;
                    break;
                case B:
                    e = Uc.Left;
                    break;
                case x:
                    e = Uc.Right;
                    break;
                case k:
                    e = Uc.FrontLeft;
                    break;
                case D:
                    e = Uc.BackLeft;
                    break;
                case L:
                    e = Uc.FrontRight;
                    break;
                case N:
                    e = Uc.BackRight
                }
                lA = e
            }(sA.name),
            -1 !== lA && (e(lA),
            null != lA && i.viewer.viewerImpl.rotateCameraByViewCubeSide(lA))),
            o
        }
        ,
        this.mouseMove = function(A) {
            A.stopPropagation();
            var e = !1
              , t = new s(A.clientX,A.clientY)
              , i = pA(t);
            if (AA)
                iA.set(t.x, t.y),
                oA.subVectors(iA, tA),
                this.preRotationHandle && !this.preRotationHandle() || (this.viewer.viewerImpl.rotateCamera(oA),
                tA.copy(iA));
            else if (i) {
                if (eA && (hA(!1),
                e = !0),
                gA(),
                sA) {
                    if ("" !== sA.name) {
                        var o = sA.name;
                        aA !== o && (aA = o,
                        rA = !0,
                        e = !0)
                    }
                } else
                    "" !== aA && (aA = "",
                    rA = !1,
                    e = !0);
                e && this.render(),
                cA = !0
            } else
                cA && (cA = !1,
                rA && (dA(),
                rA = !1,
                e = !0),
                e && this.render());
            return i
        }
        ,
        this.mouseDown = function(A) {
            A.preventDefault(),
            A.stopPropagation();
            var e = new s(A.clientX,A.clientY)
              , t = pA(e);
            return t && A.button === i.mouseButtons.LEFT && (AA = !1),
            t
        }
        ,
        this.onMouseDownBinded = this.mouseDown.bind(this),
        this.onMouseMoveBinded = this.mouseMove.bind(this),
        this.onMouseUpBinded = this.mouseUp.bind(this),
        this.addDomEventListeners = function() {
            o && (o.addEventListener("contextmenu", (function(A) {
                A.preventDefault()
            }
            ), !1),
            o.addEventListener("mousedown", this.onMouseDownBinded, !1),
            window.addEventListener("mousemove", this.onMouseMoveBinded, !1),
            o.addEventListener("mouseup", this.onMouseUpBinded, !1))
        }
        ,
        this.removeDomEventListeners = function() {
            o && (o.removeEventListener("contextmenu", (function(A) {
                A.preventDefault()
            }
            ), !1),
            o.removeEventListener("mousedown", this.onMouseDownBinded, !1),
            window.removeEventListener("mousemove", this.onMouseMoveBinded, !1),
            window.removeEventListener("mouseup", this.onMouseUpBinded, !1))
        }
        ;
        var uA = function(A) {
            switch (A) {
            case r:
                i.width = c,
                i.height = c;
                break;
            case a:
                i.width = h,
                i.height = h;
                break;
            case l:
            default:
                i.width = d,
                i.height = d
            }
            o.style.width = i.width + "px",
            o.style.height = i.height + "px"
        };
        this.resize = function(A, e, t) {
            uA(200 > A || t ? l : a),
            n.setSize(this.width, this.height)
        }
        ;
        this.init = function(A) {
            (function(A) {
                A.style.position = "absolute",
                A.style.display = "block",
                A.style.outline = "0",
                A.style.right = "52px",
                A.style.top = "0px",
                A.style.opacity = ".6",
                A.style.display = "flex",
                A.style.webkitTransition = "opacity .2s ease",
                A.style.mozTransition = "opacity .2s ease",
                A.style.msTransform = "opacity .2s ease",
                A.style.oTransform = "opacity .2s ease",
                A.style.transition = "opacity .2s ease"
            }
            )(o = document.createElement("div")),
            A.appendChild(o),
            n = new $i({
                antialias: !0,
                alpha: !0,
                preserveDrawingBuffer: !0
            }),
            o.appendChild(n.domElement),
            this.resize(A.offsetWidth, A.offsetHeight, this.viewer.viewerImpl.isMobile),
            this.addDomEventListeners()
        }
        ;
        var fA = function(A, e, t) {
            return A > e ? t >= A - e : t >= e - A
        };
        this.render = function() {
            if (this.visible && !this.isDisable && n) {
                var A = this.viewer.viewerImpl.getActiveCameraInfo()
                  , e = A.quaternion.clone().inverse();
                this._cube.quaternion.copy(e),
                -1 === lA && (lA = function(A, e) {
                    var t = A.clone();
                    t.normalize();
                    var i = e.clone();
                    if (i.normalize(),
                    fA(t.x, 0, 1e-4) && fA(t.y, -1, 1e-4) && fA(t.z, 0, 1e-4) && fA(i.x, 0, 1e-4) && fA(i.y, 0, 1e-4) && fA(i.z, -1, 1e-4))
                        return p;
                    if (fA(t.x, 0, 1e-4) && fA(t.y, 1, 1e-4) && fA(t.z, 0, 1e-4)) {
                        if (fA(i.x, 0, 1e-4) && fA(i.y, 0, 1e-4) && fA(i.z, 1, 1e-4))
                            return g;
                        if (fA(i.x, 1, 1e-4) && fA(i.y, 0, 1e-4) && fA(i.z, 0, 1e-4))
                            return g
                    }
                    return fA(t.x, 0, 1e-4) && fA(t.y, 0, 1e-4) && fA(t.z, -1, 1e-4) && fA(i.x, 0, 1e-4) && fA(i.y, 1, 1e-4) && fA(i.z, 0, 1e-4) ? u : fA(t.x, 0, 1e-4) && fA(t.y, 0, 1e-4) && fA(t.z, 1, 1e-4) && fA(i.x, 0, 1e-4) && fA(i.y, 1, 1e-4) && fA(i.z, 0, 1e-4) ? f : fA(t.x, -1, 1e-4) && fA(t.y, 0, 1e-4) && fA(t.z, 0, 1e-4) && fA(i.x, 0, 1e-4) && fA(i.y, 1, 1e-4) && fA(i.z, 0, 1e-4) ? m : fA(t.x, 1, 1e-4) && fA(t.y, 0, 1e-4) && fA(t.z, 0, 1e-4) && fA(i.x, 0, 1e-4) && fA(i.y, 1, 1e-4) && fA(i.z, 0, 1e-4) ? C : -1
                }(A.dir, z.up)),
                n.autoClear = !0,
                n.render(J, z)
            }
        }
        ,
        this.destroy = function() {
            n.dispose(),
            this.disable()
        }
    }
      , cp = function(A, e, t, i, o) {
        kd.call(this, Ec.PERSPECTIVE, {
            width: e,
            height: t,
            fov: A,
            near: i,
            far: o
        }),
        this.realUp = this.up.clone(),
        this.target = new y,
        this.dirty = !1,
        this.orthoScale = 1,
        this.positionPlane = new EA,
        this.projScreenMatrix = new M,
        this.viewProjInverse = new M,
        this.tempVector3 = new y,
        this.frustum = new Ze
    };
    (cp.prototype = Object.create(kd.prototype)).constructor = cp,
    cp.prototype._updatePositionPlane = function() {
        this.positionPlane.setFromNormalAndCoplanarPoint(this.getWorldDirection(new y), this.position)
    }
    ,
    cp.prototype._updateFrustum = function() {
        this.frustum.setFromProjectionMatrix(this.projScreenMatrix)
    }
    ,
    cp.prototype.updateMVP = function() {
        this.dirty && (null === this.parent && this.updateMatrixWorld(),
        this.matrixWorldInverse.getInverse(this.matrixWorld),
        this.projScreenMatrix.multiplyMatrices(this.projectionMatrix, this.matrixWorldInverse),
        this.viewProjInverse.getInverse(this.projScreenMatrix),
        this._updateFrustum(),
        this._updatePositionPlane(),
        this.dirty = !1)
    }
    ,
    cp.prototype.getFrustum = function() {
        return this.dirty && this.updateMVP(),
        this.frustum
    }
    ,
    cp.prototype.lookAtEx = function(A, e, t, i) {
        var o = new y;
        o.copy(e),
        void 0 !== i && "number" == typeof i && o.setLength(i),
        this.position.subVectors(A, o),
        this.up.copy(t),
        this.lookAt(A),
        this.realUp.copy(t),
        this.target.copy(A),
        this.dirty = !0
    }
    ,
    cp.prototype.lookAtEXForTargetPositionUp = function(A, e, t) {
        this.position.copy(e),
        this.up = t,
        this.lookAt(A),
        this.realUp = t.clone(),
        this.target = A.clone(),
        this.dirty = !0
    }
    ,
    cp.prototype.clone = function() {
        var A = new cp(2 * this.right,2 * this.top,this.fov,this.near,this.far);
        return A.position.copy(this.position),
        A.quaternion.copy(this.quaternion),
        A.scale.copy(this.scale),
        A.up.copy(this.up),
        A.realUp.copy(this.realUp),
        A.target.copy(this.target),
        A.aspect = this.aspect,
        A.fov = this.fov,
        A.near = this.near,
        A.far = this.far,
        A.left = this.left,
        A.right = this.right,
        A.top = this.top,
        A.bottom = this.bottom,
        A.zoom = this.zoom,
        A.isPerspective = this.isPerspective,
        A.updateProjectionMatrix(),
        A.updateMVP(),
        A
    }
    ,
    cp.prototype.copy = function(A) {
        return kd.prototype.copy.call(this, A),
        this.realUp.copy(A.realUp),
        this.orthoScale = A.orthoScale,
        this.dirty = A.dirty,
        this.updateProjectionMatrix(),
        this.updateMVP(),
        this
    }
    ,
    cp.prototype.setStandardView = function(A, e) {
        var t = null
          , i = null;
        e ? (t = e.getCenter(new y),
        i = e.getSize(new y)) : t = new y(0,0,0);
        var o = vc.SceneSize
          , n = o / 2;
        switch (i || (i = n),
        A) {
        case Uc.ISO:
            var r = new y(-o,o,o)
              , a = new y
              , s = new y(0,0,0);
            a.subVectors(s, r),
            this.lookAtEx(t, a, H.DefaultUp);
            break;
        case Uc.Top:
            this.lookAtEx(t, new y(0,0,-1), new y(0,1,0), i ? i.x : n);
            break;
        case Uc.Bottom:
            this.lookAtEx(t, new y(0,0,1), new y(0,1,0), i ? i.x : n);
            break;
        case Uc.Front:
            this.lookAtEx(t, new y(0,1,0), new y(0,0,1), i ? i.z : n);
            break;
        case Uc.Back:
            this.lookAtEx(t, new y(0,-1,0), new y(0,0,1), i ? i.z : n);
            break;
        case Uc.Right:
            this.lookAtEx(t, new y(-1,0,0), new y(0,0,1), i ? i.y : n);
            break;
        case Uc.Left:
            this.lookAtEx(t, new y(1,0,0), new y(0,0,1), i ? i.y : n);
            break;
        case Uc.FrontRight:
            this.lookAtEx(t, new y(-1,1,0), new y(0,0,1), i ? i.x + i.y : n);
            break;
        case Uc.FrontLeft:
            this.lookAtEx(t, new y(1,1,0), new y(0,0,1), i ? i.x + i.y : n);
            break;
        case Uc.BackLeft:
            this.lookAtEx(t, new y(1,-1,0), new y(0,0,1), i ? i.x + i.y : n);
            break;
        case Uc.BackRight:
            this.lookAtEx(t, new y(-1,-1,0), new y(0,0,1), i ? i.x + i.y : n);
            break;
        case Uc.BottomFront:
            this.lookAtEx(t, new y(0,1,1), new y(0,0,1), i ? i.x + i.z : n);
            break;
        case Uc.BottomBack:
            this.lookAtEx(t, new y(0,-1,1), new y(0,0,1), i ? i.x + i.z : n);
            break;
        case Uc.BottomRight:
            this.lookAtEx(t, new y(-1,0,1), new y(0,0,1), i ? i.y + i.z : n);
            break;
        case Uc.BottomLeft:
            this.lookAtEx(t, new y(1,0,1), new y(0,0,1), i ? i.y + i.z : n);
            break;
        case Uc.BottomFrontRight:
            this.lookAtEx(t, new y(-1,1,1), new y(0,0,1), i ? i.x + i.y + i.z : n);
            break;
        case Uc.BottomFrontLeft:
            this.lookAtEx(t, new y(1,1,1), new y(0,0,1), i ? i.x + i.y + i.z : n);
            break;
        case Uc.BottomBackLeft:
            this.lookAtEx(t, new y(1,-1,1), new y(0,0,1), i ? i.x + i.y + i.z : n);
            break;
        case Uc.BottomBackRight:
            this.lookAtEx(t, new y(-1,-1,1), new y(0,0,1), i ? i.x + i.y + i.z : n);
            break;
        case Uc.TopFront:
            this.lookAtEx(t, new y(0,1,-1), new y(0,0,1), i ? i.x + i.z : n);
            break;
        case Uc.TopBack:
            this.lookAtEx(t, new y(0,-1,-1), new y(0,0,1), i ? i.x + i.z : n);
            break;
        case Uc.TopRight:
            this.lookAtEx(t, new y(-1,0,-1), new y(0,0,1), i ? i.y + i.z : n);
            break;
        case Uc.TopLeft:
            this.lookAtEx(t, new y(1,0,-1), new y(0,0,1), i ? i.y + i.z : n);
            break;
        case Uc.TopFrontRight:
            this.lookAtEx(t, new y(-1,1,-1), new y(0,0,1), i ? i.x + i.y + i.z : n);
            break;
        case Uc.TopFrontLeft:
            this.lookAtEx(t, new y(1,1,-1), new y(0,0,1), i ? i.x + i.y + i.z : n);
            break;
        case Uc.TopBackLeft:
            this.lookAtEx(t, new y(1,-1,-1), new y(0,0,1), i ? i.x + i.y + i.z : n);
            break;
        case Uc.TopBackRight:
            this.lookAtEx(t, new y(-1,-1,-1), new y(0,0,1), i ? i.x + i.y + i.z : n);
            break;
        case Uc.TopToRight:
            this.lookAtEx(t, new y(0,1,0), new y(-1,0,0), n);
            break;
        case Uc.TopToBack:
            this.lookAtEx(t, new y(0,1,0), new y(0,0,1), n);
            break;
        case Uc.TopToLeft:
            this.lookAtEx(t, new y(0,1,0), new y(1,0,0), n);
            break;
        case Uc.TopToFront:
            this.lookAtEx(t, new y(0,1,0), new y(0,0,-1), n);
            break;
        case Uc.BottomToRight:
            this.lookAtEx(t, new y(0,-1,0), new y(-1,0,0), n);
            break;
        case Uc.BottomToBack:
            this.lookAtEx(t, new y(0,-1,0), new y(0,0,-1), n);
            break;
        case Uc.BottomToFront:
            this.lookAtEx(t, new y(0,-1,0), new y(0,0,1), n);
            break;
        case Uc.BottomToLeft:
            this.lookAtEx(t, new y(0,-1,0), new y(1,0,0), n);
            break;
        case Uc.FrontToTop:
            this.lookAtEx(t, new y(0,0,-1), new y(0,-1,0), n);
            break;
        case Uc.FrontToBottom:
            this.lookAtEx(t, new y(0,0,-1), new y(0,1,0), n);
            break;
        case Uc.FrontToLeft:
            this.lookAtEx(t, new y(0,0,-1), new y(1,0,0), n);
            break;
        case Uc.FrontToRight:
            this.lookAtEx(t, new y(0,0,-1), new y(-1,0,0), n);
            break;
        case Uc.RightToTop:
            this.lookAtEx(t, new y(-1,0,0), new y(0,-1,0), n);
            break;
        case Uc.RightToBottom:
            this.lookAtEx(t, new y(-1,0,0), new y(0,1,0), n);
            break;
        case Uc.RightToFront:
            this.lookAtEx(t, new y(-1,0,0), new y(0,0,-1), n);
            break;
        case Uc.RightToBack:
            this.lookAtEx(t, new y(-1,0,0), new y(0,0,1), n);
            break;
        case Uc.BackToTop:
            this.lookAtEx(t, new y(0,0,1), new y(0,-1,0), n);
            break;
        case Uc.BackToBottom:
            this.lookAtEx(t, new y(0,0,1), new y(0,1,0), n);
            break;
        case Uc.BackToLeft:
            this.lookAtEx(t, new y(0,0,1), new y(-1,0,0), n);
            break;
        case Uc.BackToRight:
            this.lookAtEx(t, new y(0,0,1), new y(1,0,0), n);
            break;
        case Uc.LeftToTop:
            this.lookAtEx(t, new y(1,0,0), new y(0,0,-1), n);
            break;
        case Uc.LeftTopBottom:
            this.lookAtEx(t, new y(1,0,0), new y(0,1,0), n);
            break;
        case Uc.LeftTopBack:
            this.lookAtEx(t, new y(1,0,0), new y(0,0,1), n);
            break;
        case Uc.LeftTopFront:
            this.lookAtEx(t, new y(1,0,0), new y(0,0,-1), n);
            break;
        case Uc.Keep:
            break;
        default:
            this.lookAtEx(t, new y(-1,-1,-1), new y(0,0,1), n)
        }
        return this.updateProjectionMatrix(),
        t
    }
    ,
    cp.prototype.zoomToBox = function(A, e, t, i) {
        t = t || 1,
        e = -1 > (e = e || 0) ? -1 : e;
        var o = new aA;
        if (o.copy(A),
        0 !== e) {
            var n = .5 * A.getSize(new y).length()
              , r = new y;
            r.subVectors(o.max, o.min).normalize(),
            r.multiplyScalar(n * e),
            o.expandByVector(r)
        }
        var s = i || this.getWorldDirection(new y)
          , l = this.up
          , c = this.aspect
          , h = a.degToRad(.5 * this.fov)
          , d = o.getSize(new y)
          , p = o.getCenter(new y)
          , g = .5 * d.length() / Math.sin(h) * t
          , u = new y;
        u.copy(s),
        u.setLength(g);
        var f = new y;
        f.subVectors(p, u);
        var m = new y;
        m.crossVectors(s, l),
        m.normalize();
        var C = new y;
        C.crossVectors(s, m),
        C.normalize();
        var v = new EA;
        v.setFromNormalAndCoplanarPoint(m, f);
        var I = new EA;
        I.setFromNormalAndCoplanarPoint(C, f);
        var E = 0
          , B = 0
          , x = 0
          , S = 0
          , w = 0
          , M = [new y, new y, new y, new y, new y, new y, new y, new y];
        M[0].set(o.min.x, o.min.y, o.min.z),
        M[1].set(o.min.x, o.min.y, o.max.z),
        M[2].set(o.min.x, o.max.y, o.min.z),
        M[3].set(o.min.x, o.max.y, o.max.z),
        M[4].set(o.max.x, o.min.y, o.min.z),
        M[5].set(o.max.x, o.min.y, o.max.z),
        M[6].set(o.max.x, o.max.y, o.min.z),
        M[7].set(o.max.x, o.max.y, o.max.z);
        for (var b = 0; 8 > b; b += 1) {
            var U = new y;
            U.subVectors(M[b], f);
            var F = Math.abs(U.dot(s))
              , K = Math.abs(I.distanceToPoint(M[b]))
              , Q = K * c
              , R = Math.abs(v.distanceToPoint(M[b]))
              , T = Math.max(K, R / c)
              , k = Math.max(Q, R);
            T > E && (E = T),
            B && x && B * F / x >= T || (B = T,
            x = F),
            S && w && S * F / w >= k || (S = k,
            w = F)
        }
        var D = S / Math.tan(h) + (g - w)
          , L = B / Math.tan(h) + (g - x)
          , N = 0;
        if (N = 1 > c ? Math.max(D, L) : Math.min(D, L),
        this.near > N) {
            this.near = (N * N + .001 * N) / 16777.216
        }
        if (u.copy(s).normalize().setLength(N),
        f.subVectors(p, u),
        this.position.copy(f),
        this.lookAt(p),
        this.target.copy(p),
        !this.isPerspective) {
            var O = Math.tan(this.fov * Math.PI / 180 / 2) * N;
            this.orthoScale = O / E,
            this.zoom = this.orthoScale
        }
        return this.updateProjectionMatrix(),
        this.dirty = !0,
        p
    }
    ,
    cp.prototype.computeRay = function(A, e, t) {
        var i = new s;
        if (void 0 === t)
            i.x = window.innerWidth,
            i.y = window.innerHeight;
        else {
            var o = t === document ? t.body : t;
            i.x = o.offsetWidth,
            i.y = o.offsetHeight
        }
        var n = new s;
        n.x = A / i.x * 2 - 1,
        n.y = -e / i.y * 2 + 1;
        var r = new CA;
        return this.isPerspective ? (r.origin.copy(this.position),
        r.direction.set(n.x, n.y, .5).unproject(this).sub(this.position).normalize()) : (r.origin.set(n.x, n.y, -1).unproject(this),
        r.direction.set(0, 0, -1).transformDirection(this.matrixWorld)),
        r
    }
    ,
    cp.prototype.screenToWorld = function(A, e, t, i) {
        var o = this.computeRay(A, e, t)
          , n = this.getWorldDirection(new y).normalize()
          , r = new EA(n);
        return r.setFromNormalAndCoplanarPoint(n, i),
        o.intersectPlane(r, i)
    }
    ,
    cp.prototype.getWorldFrustum = function(A) {
        var e = new M
          , t = new Ze
          , i = this.clone()
          , o = this.target
          , n = o.clone().sub(this.position).length()
          , r = new M;
        r.getInverse(A);
        var a = new M;
        a.extractRotation(A);
        var s = new f;
        s.setFromRotationMatrix(a),
        s.inverse(),
        i.position.applyMatrix4(r);
        var l = o.clone();
        l.applyMatrix4(r);
        var c = l.clone().sub(i.position)
          , h = c.length();
        return c.normalize(),
        i.far = this.far * (h / n),
        i.up.applyQuaternion(s).normalize(),
        i.realUp.applyQuaternion(s).normalize(),
        i.updateProjectionMatrix(),
        i.updateMatrixWorld(),
        e.getInverse(i.matrixWorld),
        t.setFromMatrix((new M).multiplyMatrices(i.projectionMatrix, e)),
        i = null,
        t
    }
    ,
    cp.prototype.distanceFromWorldToDrawing = function(A, e) {
        var t = this.position.clone()
          , i = this.target.clone();
        i.subVectors(this.target, this.position),
        i.normalize();
        var o = new M;
        return o.getInverse(A),
        i.add(t).applyMatrix4(o),
        t.applyMatrix4(o),
        i.sub(t),
        i.normalize().multiplyScalar(e),
        i.add(t).applyMatrix4(A),
        i.sub(this.position),
        i.length()
    }
    ,
    cp.drawingToWorld = function(A, e) {
        var t = A.position.clone()
          , i = A.target.clone()
          , o = A.up.clone()
          , n = new M;
        return n.getInverse(e),
        o.add(t),
        o.applyMatrix4(n),
        t.applyMatrix4(n),
        i.applyMatrix4(n),
        o.sub(t),
        o.normalize(),
        {
            position: t,
            target: i,
            up: o
        }
    }
    ,
    cp.worldToDrawing = function(A, e) {
        var t = A.position.clone()
          , i = A.target.clone()
          , o = A.up.clone();
        return o.add(t),
        o.applyMatrix4(e),
        t.applyMatrix4(e),
        i.applyMatrix4(e),
        o.sub(t),
        o.normalize(),
        {
            position: t,
            target: i,
            up: o
        }
    }
    ;
    var hp = function() {
        var A = this
          , e = null
          , t = {}
          , i = {}
          , o = 1e3
          , n = null
          , r = null
          , a = null
          , s = !1
          , l = null
          , c = null
          , h = null;
        this.from = function(A) {
            for (var i in e = A)
                e.hasOwnProperty(i) && (t[i] = e[i]);
            return this
        }
        ,
        this.to = function(A, e) {
            return void 0 !== e && (o = e),
            i = A,
            this
        }
        ,
        this.onStart = function(A) {
            return l = A,
            this
        }
        ,
        this.onUpdate = function(A) {
            return c = A,
            this
        }
        ,
        this.onComplete = function(A) {
            return h = A,
            this
        }
        ,
        this.start = function(A, d) {
            s = !1,
            r && cancelAnimationFrame(r),
            n = Date.now(),
            a = d ? this.linearInterpolateForTargetPostionUp : this.interpolate,
            r = requestAnimationFrame((function d() {
                var p = t
                  , g = i
                  , u = Date.now();
                !1 === s && (null !== l && l(e),
                s = !0);
                var f = (u - n) / o;
                e = a(p, g, f = f > 1 ? 1 : f),
                1 === f ? (cancelAnimationFrame(r),
                null !== h && h(e)) : (r = requestAnimationFrame(d, A),
                null !== c && c(e, f))
            }
            ), A)
        }
        ,
        this.isAngleGreaterThanPi = function(A, e, t) {
            var i = new y;
            return i.crossVectors(A, e),
            0 > i.dot(t)
        }
        ,
        this.conicInterpolate = function(A, e, t, i) {
            var o = -e.angleTo(A) * i
              , n = new y;
            n.crossVectors(e, A).normalize();
            var r = new f;
            r.setFromAxisAngle(n, o),
            t.copy(A),
            t.applyQuaternion(r)
        }
        ,
        this.quaternionInterpolate = function(A, e, t, i, o) {
            var n = new f(A.x,A.y,A.z,1).normalize()
              , r = new f(e.x,e.y,e.z,1).normalize()
              , a = new f(0,0,0,1)
              , s = new f(0,0,0,1)
              , l = new y;
            l.crossVectors(A, t).normalize(),
            a.set(l.x, l.y, l.z, 1).normalize();
            .5 > o ? (f.slerp(n, a, s, 2 * o),
            i.set(s.x, s.y, s.z)) : (f.slerp(a, r, s, 2 * (o - .5)),
            i.set(s.x, s.y, s.z))
        }
        ,
        this.slerpInterpolate = function(A, e, t, i, o, n) {
            var r = A.dot(e);
            r > n ? i.copy(e) : n < Math.abs(r) ? this.quaternionInterpolate(A, e, t, i, o) : this.conicInterpolate(A, e, i, o),
            i.normalize()
        }
        ,
        this.linearInterpolate = function(A, e, t, i, o) {
            if (A.equals(e))
                t.copy(e);
            else {
                var n = new y(1,0,0)
                  , r = new y(0,0,1)
                  , a = new y
                  , s = A.dot(e);
                s > o ? t.copy(e) : -s > o ? (o > Math.abs(A.dot(r)) ? a.crossVectors(A, r).normalize() : a.crossVectors(A, n).normalize(),
                .5 > i ? t.lerpVectors(A, a, 2 * i) : t.lerpVectors(a, e, 2 * (i - .5))) : t.lerpVectors(A, e, i),
                t.normalize()
            }
        }
        ,
        this.linearInterpolatePosition = function(A, e, t, i) {
            t.lerpVectors(A, e, i)
        }
        ,
        this.sphericalInterpolate = function(A, e, t, i, o, n) {
            var r = A.clone().sub(e)
              , a = t.clone().sub(i)
              , s = new Os;
            s.setFromVector3(r);
            var l = new Os;
            l.setFromVector3(a);
            var c = s.theta + (l.theta - s.theta) * n
              , h = s.phi + (l.phi - s.phi) * n
              , d = r.length()
              , p = new Os;
            p.set(d, h, c);
            var g = new y;
            g.setFromSpherical(p),
            o.copy(g).multiplyScalar(-1)
        }
        ,
        this.interpolate = function(e, t, i) {
            var o = new y
              , n = new y
              , r = new y
              , a = new y
              , s = e.animTarget
              , l = e.animUp
              , c = e.animFocal
              , h = t.animTarget
              , d = t.animUp
              , p = t.animFocal;
            return A.sphericalInterpolate(e.animPos, s, t.animPos, h, o, i),
            A.linearInterpolate(l, d, n, i, .9995),
            A.linearInterpolatePosition(s, h, r, i),
            A.linearInterpolatePosition(c, p, a, i),
            {
                animDir: o,
                animUp: n,
                animFocal: a,
                animTarget: r
            }
        }
        ,
        this.linearInterpolateForTargetPostionUp = function(e, t, i) {
            var o = new y
              , n = new y
              , r = new y
              , a = e.animTarget
              , s = e.animPosition
              , l = t.animTarget
              , c = t.animPosition;
            return A.linearInterpolate(e.animUp, t.animUp, n, i, .9995),
            A.linearInterpolatePosition(a, l, r, i),
            A.linearInterpolatePosition(s, c, o, i),
            {
                animPosition: o,
                animUp: n,
                animTarget: r
            }
        }
    }
      , dp = function() {
        var A = 800
          , e = 14
          , t = new hp;
        this.setDuration = function(e) {
            A = e
        }
        ,
        this.getDuration = function() {
            return A
        }
        ,
        this.setFrameTime = function(A) {
            e = A
        }
        ,
        this.setStandardView = function(i, o, n, r, a, s) {
            var l = o.camera
              , c = l.position.clone()
              , h = l.target.clone()
              , d = l.getWorldDirection(new y);
            d.normalize();
            var p = new y;
            p.copy(l.realUp || l.up),
            p.normalize();
            var g = new y(l.position.clone().sub(h).length(),0,0)
              , u = l.setStandardView(i, n);
            u = o.camera.zoomToBox(n, r);
            var f = l.position.clone()
              , m = l.getWorldDirection(new y);
            m.normalize();
            var C = new y;
            C.copy(l.realUp || l.up),
            C.normalize();
            var v = new y(l.position.clone().sub(u).length(),0,0);
            d.equals(m) && p.equals(C) && h.equals(u) && g.equals(v) ? s && s() : (o.getControlManager().setInteractiveState(!1),
            t.from({
                animPos: c,
                animDir: d,
                animUp: p,
                animTarget: h,
                animFocal: g
            }).to({
                animPos: f,
                animDir: m,
                animUp: C,
                animTarget: u,
                animFocal: v
            }, A).onUpdate((function(A) {
                o.camera.lookAtEx(A.animTarget, A.animDir, A.animUp, A.animFocal.x),
                o.cameraControl.update(!0, !0),
                o.controlManager.dispatchEvent({
                    type: Rc.ON_CAMERA_ANIMATION_UPDATE
                }),
                a && a()
            }
            )).onComplete((function() {
                o.camera.lookAtEx(u, m, C, v.x),
                o.cameraControl.update(!0, !0),
                s && s(),
                o.getControlManager().setInteractiveState(!0)
            }
            )).start(e))
        }
        ,
        this.active = function(i, o, n, r, a) {
            var s = n.camera
              , l = new y(i.position.x,i.position.y,i.position.z)
              , c = new y(i.target.x,i.target.y,i.target.z)
              , h = new y(c.distanceTo(l),0,0)
              , d = c.clone().sub(l).normalize()
              , p = new y(i.up.x,i.up.y,i.up.z);
            p.normalize();
            var g = new y(o.position.x,o.position.y,o.position.z)
              , u = new y(o.target.x,o.target.y,o.target.z)
              , f = new y(u.distanceTo(g),0,0)
              , m = u.clone().sub(g).normalize()
              , C = new y(o.up.x,o.up.y,o.up.z);
            C.normalize(),
            d.equals(m) && p.equals(C) && c.equals(u) && h.equals(f) ? a && a() : (n.getControlManager().setInteractiveState(!1),
            t.from({
                animPos: l,
                animDir: d,
                animUp: p,
                animTarget: c,
                animFocal: h
            }).to({
                animPos: g,
                animDir: m,
                animUp: C,
                animTarget: u,
                animFocal: f
            }, A).onUpdate((function(A) {
                var e = A.animTarget;
                s.lookAtEx(e, A.animDir, A.animUp, A.animFocal.x),
                r && r(e)
            }
            )).onComplete((function() {
                s.lookAtEx(u, m, C, f.x),
                r && r(u),
                a && a(),
                n.getControlManager().setInteractiveState(!0)
            }
            )).start(e))
        }
        ,
        this.slerpFlyTo = function(i, o, n, r) {
            var a = o.camera
              , s = a.position.clone()
              , l = a.getWorldDirection(new y)
              , c = new y;
            c.copy(a.realUp || a.up),
            c.normalize();
            var h = a.target.clone()
              , d = new y(a.position.clone().sub(h).length(),0,0)
              , p = (new y).set(i.position.x, i.position.y, i.position.z)
              , g = (new y).set(i.target.x, i.target.y, i.target.z)
              , u = (new y).set(i.up.x, i.up.y, i.up.z)
              , f = g.clone().sub(p)
              , m = new y(f.length(),0,0);
            f.normalize();
            var C = u.normalize();
            l.equals(f) && c.equals(C) && h.equals(g) && d.equals(m) ? r && r() : t.from({
                animPos: s,
                animDir: l,
                animUp: c,
                animTarget: h,
                animFocal: d
            }).to({
                animPos: p,
                animDir: f,
                animUp: C,
                animTarget: g,
                animFocal: m
            }, A).onUpdate((function(A) {
                var e = A.animTarget;
                a.lookAtEx(e, A.animDir, A.animUp, A.animFocal.x),
                n && n(e)
            }
            )).onComplete((function() {
                a.lookAtEx(g, f, C, m.x),
                n && n(g),
                r && r(),
                o.getControlManager().setInteractiveState(!0)
            }
            )).start(e)
        }
        ,
        this.flyTo = this.slerpFlyTo,
        this.linearFlyTo = function(i, o, n, r) {
            var a = o.camera
              , s = new y;
            s.copy(a.realUp || a.up),
            s.normalize();
            var l = a.target.clone()
              , c = a.position.clone()
              , h = (new y).set(i.position.x, i.position.y, i.position.z)
              , d = (new y).set(i.target.x, i.target.y, i.target.z)
              , p = (new y).set(i.up.x, i.up.y, i.up.z).normalize();
            c.equals(h) && s.equals(p) && l.equals(d) ? r && r() : t.from({
                animPosition: c,
                animUp: s,
                animTarget: l
            }).to({
                animPosition: h,
                animUp: p,
                animTarget: d
            }, A).onUpdate((function(A) {
                var e = A.animTarget;
                a.lookAtEXForTargetPositionUp(e, A.animPosition, A.animUp),
                n && n(e)
            }
            )).onComplete((function() {
                a.lookAtEXForTargetPositionUp(d, h, p),
                n && n(d),
                r && r(),
                o.getControlManager().setInteractiveState(!0)
            }
            )).start(e, !0)
        }
        ,
        this.linearActive = function(i, o, n, r, a) {
            var s = n.camera
              , l = (new y).set(i.position.x, i.position.y, i.position.z)
              , c = (new y).set(i.target.x, i.target.y, i.target.z)
              , h = (new y).set(i.up.x, i.up.y, i.up.z);
            h.normalize();
            var d = (new y).set(o.position.x, o.position.y, o.position.z)
              , p = (new y).set(o.target.x, o.target.y, o.target.z)
              , g = (new y).set(o.up.x, o.up.y, o.up.z).normalize();
            l.equals(d) && h.equals(g) && c.equals(p) ? a && a() : t.from({
                animPosition: l,
                animUp: h,
                animTarget: c
            }).to({
                animPosition: d,
                animUp: g,
                animTarget: p
            }, A).onUpdate((function(A) {
                var e = A.animTarget;
                s.lookAtEXForTargetPositionUp(e, A.animPosition, A.animUp),
                r && r(e)
            }
            )).onComplete((function() {
                s.lookAtEXForTargetPositionUp(p, d, g),
                r && r(p),
                a && a(),
                n.getControlManager().setInteractiveState(!0)
            }
            )).start(e, !0)
        }
    }
      , pp = function() {
        this.condition = [{
            type: "IfcWall"
        }, {
            type: "IfcRoof"
        }, {
            type: "IfcWallStandardCase"
        }, {
            type: "IfcDoor"
        }, {
            type: "墙"
        }, {
            type: "门"
        }],
        this.distance = 150,
        this.factor = 1
    };
    pp.prototype.setCondition = function(A) {
        Array.isArray(A) && (this.condition = A)
    }
    ,
    pp.prototype.getCondition = function() {
        return this.condition
    }
    ,
    pp.prototype.getDistance = function() {
        return this.distance
    }
    ,
    pp.prototype.getFactor = function() {
        return this.factor
    }
    ,
    pp.prototype.setDistance = function(A) {
        "number" == typeof A && (this.distance = A)
    }
    ,
    pp.prototype.setFactor = function(A) {
        "number" == typeof A && (this.factor = A)
    }
    ,
    pp.prototype.matchConditions = function(A) {
        var e = this.condition;
        if (0 === e.length)
            return !1;
        for (var t = !0, i = 0, o = e.length; o > i; i += 1) {
            var n = e[i];
            for (var r in n)
                if (!A.hasOwnProperty(r) || A[r] !== n[r]) {
                    t = !1;
                    break
                }
            if (!0 === t)
                break;
            e.length - 1 > i && (t = !0)
        }
        return t
    }
    ,
    pp.prototype.hasCollision = function(A, e) {
        return !!A && (this.matchConditions(A) && this.distance * this.factor >= e)
    }
    ;
    var gp = {
        MODEL: "Model",
        GEOMETRY: "Geometry",
        LINESEGMENTS: "LineSegments",
        INSTANCEGEOMETRY: "InstanceGeometry",
        INSTANCEWIREFRAMEGEOMETRY: "InstanceWireframeGeometry",
        WIREFRAME: "Wireframe",
        MARKER3D: "Marker3D",
        CLIPPLANE: "ClipPlane",
        FILLCLIPPLANE: "FillClipPlane",
        IBLCUBE: "IBLCube",
        CUSTOMPLANE: "CustomPlane",
        PIVOTBALL: "PivotBall",
        MEASUREPICKPOINT: "MeasurePickPoint",
        MEASUREPICKLINE: "MeasurePickLine",
        MEASUREPLANE: "MeasurePlane",
        MEASURELINE: "MeasureLine",
        OCTREENODE: "OctreeNode",
        AREANODE: "AreaNode",
        AXISNET: "AxisNet",
        AXISGRIDMANAGER: "AxisGridManager",
        EXTRUDEBODYMANAGER: "ExtrudeBodyManager",
        EXTERNALSCENEMANAGER: "ExternalSceneManager",
        EXTERNALCOMPONENTMANAGER: "ExternalComponentManager",
        TRANSFORM: "TRANSFORM",
        RECEIVESHADOWPLANE: "ReceiveShadowPlane"
    }
      , up = function() {
        this.scene = null,
        this.camera = null,
        this.octreeRoots = null,
        this.octantMap = null,
        this.mouse = new s
    }
      , fp = function(A) {
        this.raycaster = new Dd,
        this.viewer = A,
        this.filter = A.getFilter(),
        this.recursive = !0,
        this.lastIntersect = null,
        this.highPriorities = [gp.EXTRUDEBODYMANAGER]
    };
    fp.prototype.destroy = function() {
        this.viewer = null,
        this.filter = null,
        this.raycaster = null,
        this.lastIntersect = null,
        this.highPriorities = null
    }
    ,
    fp.prototype.intersectExternalComponent = function(A, e, t, i, o) {
        if (A.visible || o) {
            for (var n = this.raycaster, r = this.filter, a = function A(e) {
                var t = e
                  , i = [];
                if (t.isGroup)
                    for (var o = 0, a = t.children.length; a > o; o += 1) {
                        var s = A(t.children[o]);
                        i = i.concat(s)
                    }
                else
                    r._isPickable({
                        userId: t.key
                    }) && t.raycast(n, i);
                return i
            }, s = {}, l = 0, c = A.children.length; c > l; l += 1) {
                var h = A.children[l]
                  , d = a(h);
                if (d.length > 0) {
                    d.sort((function(A, e) {
                        return A.distance - e.distance
                    }
                    )),
                    d[0].userId = h.key;
                    var p = s[h.key];
                    p ? p.distance > d[0].distance && (s[h.key] = d[0]) : s[h.key] = d[0]
                }
            }
            var g = []
              , u = Object.values(s);
            if (u.length > 0)
                for (var f = 0; u.length > f; f += 1)
                    u[f].distance > t.far || t.near > u[f].distance || this.viewer.clipPoint(u[f].point) || g.push(u[f]);
            return i ? g : (g.sort((function(A, e) {
                return A.distance - e.distance
            }
            )),
            g.length > 0 ? g[0] : null)
        }
    }
    ,
    fp.prototype.defaultIntersect = function(A, e, t, i, o) {
        if (A.visible || o) {
            var n = []
              , r = this.raycaster;
            !function A(e) {
                for (var t = 0, i = e.children.length; i > t; t += 1) {
                    var o = e.children[t];
                    o.isGroup ? A(o) : o.raycast(r, n)
                }
            }(A);
            var a = [];
            if (n.length > 0)
                for (var s = 0; n.length > s; s += 1)
                    n[s].distance > t.far || t.near > n[s].distance || this.viewer.clipPoint(n[s].point) || a.push(n[s]);
            return i ? a : (a.sort((function(A, e) {
                return A.distance - e.distance
            }
            )),
            a.length > 0 ? a[0] : null)
        }
    }
    ,
    fp.prototype.intersectMeshesWithDistance = function(A, e, t, i, o, n, r, a) {
        if (!e || !e.mesh)
            return null;
        var s = 0
          , l = uh.MinusEpsilon
          , c = this.raycaster
          , h = []
          , d = this.filter
          , p = d._hasVisibleFilter()
          , g = d._hasPickableFilter()
          , u = this.viewer.modelManager
          , f = function(A, e) {
            var t = u.isHiddenSourceObjectUserId(A.userId);
            if (e) {
                if (p && !d._isVisible(A) || g && !d._isPickable(A) || t)
                    return !0
            } else if (p && !d._isVisible(A) || t)
                return !0;
            return !1
        };
        !0 === this.byGravity ? i.near = 0 : i.near += l;
        var m = e.info
          , C = e.mesh
          , y = [];
        if (Bh.time("kdNode Pick"),
        o && n && !n.explosioning) {
            var v = []
              , I = new M;
            I.getInverse(n.getModelMatrix());
            var E = c.ray.clone().applyMatrix4(I);
            if (Array.isArray(o))
                for (var B = new M, x = 0; o.length > x; x += 1) {
                    var S = o[x]
                      , w = S.modelKey
                      , b = E;
                    if (w)
                        B.getInverse(n.subModel[w]),
                        b = E.clone().applyMatrix4(B);
                    S.intersect(b, v)
                }
            else
                o.intersect(E, v);
            y = uh.unique(v)
        } else
            y = n.getComponentlist();
        Bh.timeEnd("kdNode Pick");
        var U = Object.keys(n.manager.explosionList);
        if (n && n.manager && U.length > 0 && (y = y.concat(U),
        y = uh.unique(y)),
        Object.keys(u.transformComponent).length > 0) {
            for (var F in u.transformComponent)
                y.push(F);
            y = uh.unique(y)
        }
        var K = this.viewer.modelManager.getMatrixWorldGlobal();
        Bh.time("Box Pick");
        for (var Q = 0, R = y.length; R > Q; Q += 1) {
            var T = m[y[Q]];
            if (T) {
                var k = T[0];
                if (k) {
                    var D = k.boundingBox.clone();
                    if (D.applyMatrix4(n.getModelMatrix()).applyMatrix4(K),
                    (s = c.ray.intersectBoxWithDistance(D)) >= i.near && i.far >= s)
                        for (var L = 0, N = T.length; N > L; L += 1) {
                            var O = T[L];
                            if (!f(O, t)) {
                                var V = C[this.viewer.modelManager.getMeshIdFromOctantMap(O)];
                                if (V)
                                    for (var G = 0, P = V.length; P > G; G += 1)
                                        h.push({
                                            object: V[G],
                                            distance: s,
                                            nodeInfo: O
                                        })
                            }
                        }
                }
            }
        }
        Bh.timeEnd("Box Pick"),
        Bh.time("Ending Pick"),
        h.sort((function(A, e) {
            return A.distance - e.distance
        }
        ));
        for (var q = [], j = 0; h.length > j; j += 1)
            h[j].distance > i.far || i.near > h[j].distance || h[j].object.raycast(c, h[j].nodeInfo, i, this.viewer, q, a);
        return q.sort((function(A, e) {
            return A.distance - e.distance
        }
        )),
        a ? q : (Bh.timeEnd("Ending Pick"),
        q.length > 0 ? q[0] : null)
    }
    ,
    fp.prototype.intersect = function(A, e, t, i) {
        var o = this.raycaster;
        null === e ? o.setFromCamera(A.mouse, A.camera) : o.set(e.origin, e.direction);
        Bh.time("intersect time"),
        o.camera = A.camera,
        o._camera = A.camera,
        o.viewportSize = A.viewportSize;
        var n = new y;
        A.camera.getWorldDirection(n);
        for (var r = n.dot(o.ray.direction), a = {
            near: A.camera.near / Math.abs(r),
            far: A.camera.far / Math.abs(r)
        }, s = null, l = [], c = A.scene.getGroups(), h = 0; c.length > h; h += 1)
            if (c[h].isPickable() && 0 !== c[h].children.length) {
                var d = A.scene.getGroupType(c[h].name)
                  , p = d.groupType
                  , g = d.modelKey;
                if (-1 < this.highPriorities.indexOf(d.groupType))
                    (s = this.defaultIntersect(c[h], t, a, void 0, !0)) && (s.objectType = c[h].pickableType,
                    s.hoverEnabled = c[h].hoverEnabled,
                    l.push(s));
                else if (this.filter._isModelPickable(g)) {
                    switch (p) {
                    case gp.MODEL:
                        var u = this.viewer.modelManager.getModel(g);
                        s = u && u.isDataReady() && u.isVisible() ? this.intersectMeshesWithDistance([], A.octantMap[g], t, a, u.kdTreeNode, u) : null;
                        break;
                    case gp.GEOMETRY:
                        s = vc.MergeComponent ? null : this.intersectMeshesWithDistance(A.octantMap[g], A.octantMap, t, a);
                        break;
                    case gp.EXTERNALCOMPONENTMANAGER:
                        s = this.intersectExternalComponent(c[h], t, a);
                        break;
                    default:
                        s = this.defaultIntersect(c[h], t, a)
                    }
                    s && (s.objectType = c[h].pickableType,
                    s.hoverEnabled = c[h].hoverEnabled,
                    l.push(s))
                }
            }
        l.sort((function(A, e) {
            return A.distance - e.distance
        }
        )),
        Bh.timeEnd("intersect time");
        var f = l.length;
        if (f > 0) {
            l.sort((function(A, e) {
                return A.distance - e.distance
            }
            ));
            for (var m = 0; f > m; m += 1) {
                var C = (s = l[m]).object;
                if (C.geometry)
                    return s.userId = s.userId || C.key,
                    s.modelKey = C.modelKey,
                    this.lastIntersect = s,
                    s
            }
        }
        return this.lastIntersect = {
            intersect: s,
            pickable: t
        },
        null
    }
    ,
    fp.prototype.getObjectsByClientCoordinates = function(A) {
        var e = this.viewer.cameraControl.getIntersectContext(A)
          , t = this.raycaster;
        return t.setFromCamera(e.mouse, e.camera),
        t.camera = e.camera,
        t.viewportSize = e.viewportSize,
        this.getObjectsByRaycaster(e, t)
    }
    ,
    fp.prototype.getObjectsByRaycaster = function(A, e, t) {
        this.raycaster = e;
        for (var i = {
            near: t ? 0 : A.camera.near,
            far: t ? 1 / 0 : A.camera.far
        }, o = [], n = A.scene.getGroups(), r = 0; n.length > r; r += 1)
            if (n[r].isPickable() && 0 !== n[r].children.length) {
                var a = []
                  , s = A.scene.getGroupType(n[r].name);
                switch (s.groupType) {
                case gp.MODEL:
                    var l = s.modelKey
                      , c = this.viewer.modelManager.getModel(l);
                    c && c.isDataReady() && c.isVisible() && (a = this.intersectMeshesWithDistance([], A.octantMap[l], !1, i, c.kdTreeNode, c),
                    o = o.concat(a));
                    break;
                case gp.GEOMETRY:
                    break;
                default:
                    a = this.defaultIntersect(n[r], !1, i, !0),
                    o = o.concat(a)
                }
            }
        return o.sort((function(A, e) {
            return A.distance - e.distance
        }
        )),
        o
    }
    ,
    fp.prototype.hitTest = function(A) {
        var e = this.intersect(A, null, !1);
        return null !== e ? e.point : null
    }
    ,
    fp.prototype.pick = function(A, e) {
        var t = this.intersect(A, null, !0);
        return e && e(t),
        t
    }
    ,
    fp.prototype.getIntersectByRay = function(A, e) {
        return this.intersect(A, e, !0)
    }
    ;
    var mp = function(A, e, t, i) {
        this.viewer = A,
        this.camera = e,
        this.domElement = t,
        this.scene = A.getScene(),
        this.intersector = new fp(A),
        this.enabled = !0,
        this.tempVector3 = new y,
        this.pivot = null,
        this.movementSpeed = 8e-4 * vc.SceneSize,
        this.defaultMovementSpeed = this.movementSpeed,
        this.minMovementSpeed = .01,
        this.noZoom = !1,
        this.minDistance = .1,
        this.maxDistance = e.far - 2 * vc.SceneSize,
        this.defaultThroughOutDistance = .1,
        this.noRotate = !1,
        this.rotateSpeed = 1,
        this.noPan = !1,
        this.keyPanSpeed = 2,
        this.defaultKeyPanSpeed = this.keyPanSpeed,
        this.minKeyPanSpeed = .01,
        this.autoRotate = !0,
        this.autoRotateSpeed = 2,
        this.minDistance = 0,
        this.maxDistance = 1 / 0,
        this.minZoom = 0,
        this.maxZoom = 1 / 0,
        this.enablePolar = !1,
        this.minPolarAngle = 0,
        this.maxPolarAngle = Math.PI,
        this.minAzimuthAngle = -1 / 0,
        this.maxAzimuthAngle = 1 / 0,
        this.enableDamping = !1,
        this.dampingFactor = .25,
        this.enableZoom = !0,
        this.zoomSpeed = 1,
        this.enableRotate = !0,
        this.rotateSpeed = 1,
        this.enablePan = !0,
        this.enablePassThrough = !0,
        this.isDisableRotate = !1,
        this.noKeys = !1,
        this._realManHeight = 1650;
        var o, n, r, l, c, h, d, p = this, g = 1e-6, u = new y(0,0,1), m = new y, C = new f, v = null, I = !1;
        function E(A, e, t) {
            if (null == t)
                return !0;
            var i = t[0]
              , o = t[1];
            if (i >= o)
                return !1;
            var n = p.camera
              , r = n.position;
            e || (e = r.clone());
            var a = n.getWorldDirection(new y)
              , s = n.realUp || n.up
              , l = a.clone().cross(s).normalize()
              , c = (new f).setFromAxisAngle(l, A);
            r.clone().sub(e).normalize();
            var h = a.clone().negate()
              , d = Math.PI - h.angleTo(u.clone())
              , g = h.clone().projectOnPlane(u.clone())
              , m = g.angleTo(u.clone());
            0 > g.x && (m = 2 * Math.PI - m),
            a.applyQuaternion(c).normalize();
            var C = a.clone().negate()
              , v = Math.PI - C.angleTo(u.clone())
              , I = C.clone().projectOnPlane(u.clone())
              , E = I.angleTo(u.clone());
            if (0 > I.x && (E = 2 * Math.PI - E),
            Math.abs(E - m) > .001)
                return !1;
            if (d > i && o > d) {
                if (v > o || i > v)
                    return !1
            } else if ((d > o ? v - d : d - v) > 0)
                return !1;
            return !0
        }
        function B() {
            var A = p.viewer.modelManager.sceneState;
            if (A.hasSelection()) {
                var e = p.viewer.getFilter()
                  , t = p.viewer
                  , i = e.getVisibleComponentSet(A.getSelectionSet())
                  , o = t.getBoundingBoxByIds(i);
                if (o && !o.isEmpty())
                    return o.getCenter()
            }
            return p.pivot ? p.pivot : p.scene.getBoundingBox().getCenter(new y)
        }
        function x(A, e, t, i) {
            var o = new M;
            o.getInverse(e);
            var n = new y(A.position.x,A.position.y,A.position.z)
              , r = n.clone();
            r.applyMatrix4(o);
            var a = new y(t.x,t.y,t.z);
            return a.add(n),
            a.applyMatrix4(o),
            a.sub(r).normalize().multiplyScalar(i),
            a.add(r),
            a.applyMatrix4(e),
            a.sub(n),
            a
        }
        this.collisionManager = new pp,
        this.pivotBallGroup = null,
        this.minDollyDistance = 10,
        this.gravity = 0,
        this.farFactor = 11.4514,
        this.sceneLengthUnitFactor = 1,
        this.destroy = function() {
            this.viewer = null,
            this.camera = null,
            this.domElement = null,
            this.scene = null,
            this.intersector.destroy(),
            this.intersector = null,
            this.collisionManager = null,
            this.pivotBallGroup = null
        }
        ,
        this.isCameraChanging = function() {
            return I
        }
        ,
        this.setCameraChanging = function(A) {
            I = A
        }
        ,
        this.setCamera = function(A) {
            this.camera = A
        }
        ,
        this.getCamera = function() {
            return this.camera.updateMVP(),
            this.camera
        }
        ,
        this.dirtyCamera = function(A) {
            this.camera.dirty = A
        }
        ,
        this.getFrustum = function() {
            return this.camera.getFrustum()
        }
        ,
        this.lockAxisZ = function(A) {
            jh.LockAxisZ = A
        }
        ,
        this.isLockedAxisZ = function() {
            return jh.LockAxisZ
        }
        ,
        this.setLockAxisZRange = function(A) {
            jh.LockAxisZRange = A
        }
        ,
        this.getLockAxisZRange = function() {
            return jh.LockAxisZRange
        }
        ,
        this.getClientSize = function() {
            var A = p.domElement === document ? p.domElement.body : p.domElement;
            return new s(A.clientWidth,A.clientHeight)
        }
        ,
        this.delayHandle = function() {
            this.timeoutId && clearTimeout(this.timeoutId),
            this.timeoutId = setTimeout((function() {
                p.update(!0, !0)
            }
            ), 200),
            this.needUpdateRenderList(!1)
        }
        ,
        this.processRotate = function(A, e) {
            var t = this.getClientSize()
              , i = -2 * Math.PI * A.x / t.x
              , o = -2 * Math.PI * A.y / t.y;
            p.handleRotation(i, o, e)
        }
        ,
        this.handleRotation = function(A, e, t) {
            var i = this.camera
              , o = i.position
              , n = i.target.clone()
              , r = i.getWorldDirection(n)
              , a = n.clone().sub(o).length()
              , s = null
              , l = function(A) {
                var e = null
                  , n = null
                  , s = null
                  , l = new y;
                t ? (n = (e = o.clone().sub(t)).length(),
                e.normalize(),
                s = e.clone().applyQuaternion(A).normalize(),
                i.position.copy(t).add(s.multiplyScalar(n)),
                r.applyQuaternion(A).normalize(),
                l.copy(o).add(r.multiplyScalar(a)),
                i.target.copy(l)) : (r.applyQuaternion(A).normalize(),
                l.copy(o).add(r.multiplyScalar(a)),
                i.target.copy(l))
            }
              , c = i.realUp || i.up
              , h = r.clone().cross(c).normalize().clone().cross(r).normalize();
            i.realUp.copy(h);
            var d = null;
            if (jh.LockAxisZ) {
                if (Math.abs(A) > Math.abs(e))
                    d = u,
                    l(s = (new f).setFromAxisAngle(d, A)),
                    i.realUp.applyQuaternion(s).normalize();
                else if (null != jh.LockAxisZRange && Math.abs(e) > 1e-4) {
                    E(e, t, jh.LockAxisZRange) && (d = r.clone().cross(c).normalize(),
                    l(s = (new f).setFromAxisAngle(d, e)),
                    i.realUp.applyQuaternion(s).normalize(),
                    this.adjustCameraUp())
                }
            } else
                Math.abs(A) < Math.abs(e) ? Math.abs(e) > 1e-4 && (d = r.clone().cross(c).normalize(),
                l(s = (new f).setFromAxisAngle(d, e)),
                i.realUp.applyQuaternion(s).normalize(),
                this.adjustCameraUp()) : (d = i.up.clone().normalize(),
                l(s = (new f).setFromAxisAngle(d, A)),
                i.realUp.applyQuaternion(s).normalize());
            this.dirtyCamera(!0),
            this.setCameraChanging(!0)
        }
        ,
        this.enabledPolar = function(A) {
            jh.LockAxisZ = A
        }
        ,
        this.setMinPolarAngle = function(A) {
            "number" == typeof A && (Array.isArray(jh.LockAxisZRange) || (jh.LockAxisZRange = []),
            jh.LockAxisZRange[0] = A)
        }
        ,
        this.setMaxPolarAngle = function(A) {
            "number" == typeof A && (Array.isArray(jh.LockAxisZRange) || (jh.LockAxisZRange = []),
            jh.LockAxisZRange[1] = A)
        }
        ,
        this.getMinPolarAngle = function() {
            return jh.LockAxisZRange ? jh.LockAxisZRange[0] : null
        }
        ,
        this.getMaxPolarAngle = function() {
            return jh.LockAxisZRange ? jh.LockAxisZRange[1] : null
        }
        ,
        this.adjustCameraForPan = function(A) {
            var e = this.camera;
            e.target.add(A),
            e.position.add(A),
            this.dirtyCamera(!0),
            this.setCameraChanging(!0)
        }
        ,
        this.updateCamera = function() {
            var A = this.camera;
            A.dirty && (A.lookAt(A.target),
            A.updateMVP(),
            this.adjustCameraUp(),
            this.dispatchEvent({
                type: Rc.ON_CAMERA_CHANGE,
                camera: this.camera
            }))
        }
        ,
        this.update = function(A, e) {
            this.updateCamera(),
            this.dispatchEvent({
                type: Rc.ON_CAMERA_CHANGE,
                camera: this.camera
            });
            var t = this.camera;
            A ? (void 0 !== e && this.needUpdateRenderList(e),
            i(),
            m.copy(t.position),
            C.copy(t.quaternion)) : (m.distanceToSquared(t.position) > g || 8 * (1 - C.dot(t.quaternion)) > g) && (i(),
            m.copy(t.position),
            C.copy(t.quaternion))
        }
        ,
        this.updateView = function(A) {
            void 0 !== A && this.needUpdateRenderList(A),
            this.dispatchEvent({
                type: Rc.ON_CAMERA_CHANGE,
                camera: this.camera
            }),
            i()
        }
        ,
        this.updateHighlight = function() {
            this.dispatchEvent({
                type: Rc.ON_CAMERA_CHANGE,
                camera: this.camera
            }),
            i(!0)
        }
        ,
        this.needUpdateRenderList = function(A) {
            this.viewer.controlManager.isUpdateRenderList = A
        }
        ,
        this.pan = function(A, e) {
            var t = p.domElement === document ? p.domElement.body : p.domElement
              , i = new y;
            function o(A) {
                var e = p.camera.matrix.elements;
                i.set(e[0], e[1], e[2]),
                i.multiplyScalar(-A),
                p.camera.target.add(i),
                p.camera.position.add(i)
            }
            function n(A) {
                var e = p.camera.matrix.elements;
                i.set(e[4], e[5], e[6]),
                i.multiplyScalar(A),
                p.camera.target.add(i),
                p.camera.position.add(i)
            }
            if (p.camera.isPerspective) {
                var r = p.camera.position.clone().sub(p.camera.target).length();
                o(2 * A * (r *= Math.tan(p.camera.fov / 2 * Math.PI / 180)) / t.clientHeight),
                n(2 * e * r / t.clientHeight)
            } else
                void 0 !== p.camera.top ? (o(A * (p.camera.right - p.camera.left) / t.clientWidth),
                n(e * (p.camera.top - p.camera.bottom) / t.clientHeight)) : Bh.warn("WARNING: CloudPickEditor.js encountered an unknown camera type - pan disabled.");
            this.dirtyCamera(!0),
            this.setCameraChanging(!0)
        }
        ,
        this.panOnWorld = (o = new y,
        n = new y,
        r = new y,
        function(A, e, t, i) {
            var a = p.getContainerDimensions()
              , s = A.x - a.left
              , l = A.y - a.top;
            o.x = s / a.width,
            o.y = l / a.height,
            l = e.y - a.top,
            n.x = (s = e.x - a.left) / a.width,
            n.y = l / a.height,
            r.subVectors(n, o);
            var c = -r.x * i.x
              , h = r.y * i.y
              , d = p.getWorldRight().multiplyScalar(c)
              , g = p.getWorldUp().multiplyScalar(h);
            t.addVectors(d, g),
            p.dirtyCamera(!0),
            p.setCameraChanging(!0)
        }
        ),
        this.adjustCameraForDolly = function(A, e) {
            var t = A - 1;
            if (t *= this.zoomSpeed,
            Math.abs(t) < g)
                return !1;
            var i = this.camera
              , o = i.position
              , n = this.getWorldEye()
              , r = new y;
            e ? r.subVectors(e, o) : r.copy(n),
            r.multiplyScalar(t);
            var a = r.length();
            i.isPerspective ? this.minDollyDistance > a && r.normalize().multiplyScalar(this.minDollyDistance) : (i.orthoScale *= A,
            i.setZoom(i.orthoScale));
            var s = new y;
            s.addVectors(o, r),
            this._goingToDolly(i, s, t) ? (i.position.copy(s),
            i.target.copy(n.add(s)),
            this.dirtyCamera(!0),
            this.setCameraChanging(!0)) : this.resetCameraToMaximumRange()
        }
        ,
        this._goingToDolly = function(A, e, t) {
            if (!A.isPerspective || !vc.ConstraintZoom)
                return !0;
            var i = this.scene.getBoundingBox();
            if (t > 0)
                return !!A.getFrustum().intersectsBox(i);
            var o = i.getSize(this.tempVector3).length()
              , n = i.getCenter(this.tempVector3)
              , r = .5 * o / Math.tan(a.degToRad(.5 * A.fov)) * this.farFactor;
            return e.distanceTo(n) < r
        }
        ,
        this.dolly = function(A, e, t) {
            var i = new s(A,e)
              , o = this.getIntersectContext(i)
              , n = this.intersector.hitTest(o);
            this.adjustCameraForDolly(t, null !== n ? n : null)
        }
        ,
        this.dollyByPoint = function(A, e, t) {
            var i = this.getTrackingPoint(A, e);
            this.adjustCameraForDolly(t, i)
        }
        ,
        this.endOperation = function() {
            this.intersector.lastIntersect = null
        }
        ,
        this.zoom = function(A, e, t) {
            var i;
            i = 1 + A,
            void 0 === e || void 0 === t ? this.adjustCameraForDolly(i, null) : this.dollyByPoint(e, t, i),
            this.update()
        }
        ,
        this.getContainerDimensions = function() {
            return xh.getDomOffsetToClient(this.domElement)
        }
        ,
        this.computeFrustum = (l = new M,
        c = new M,
        function(A, e, t, i, o, n) {
            var r = this.camera
              , s = r.near * Math.tan(a.degToRad(.5 * r.fov))
              , h = s * r.aspect;
            l.makePerspective(((A - n.left) / n.width * 2 - 1) * h, ((e - n.left) / n.width * 2 - 1) * h, (-(t - n.top) / n.height * 2 + 1) * s, (-(i - n.top) / n.height * 2 + 1) * s, r.near, r.far),
            r.updateMatrixWorld(),
            r.matrixWorldInverse.getInverse(r.matrixWorld),
            c.multiplyMatrices(l, r.matrixWorldInverse),
            o.setFromProjectionMatrix(c)
        }
        ),
        this.screenToCanvas = function(A, e) {
            var t = this.getContainerDimensions();
            return {
                x: A - t.left,
                y: e - t.top
            }
        }
        ,
        this.mapScreenToLocal = function(A, e, t) {
            var i = this.getContainerDimensions();
            t.set(A - i.left, i.height - (e - i.top))
        }
        ,
        this.mapWindowToViewport = function(A, e, t) {
            var i = this.getContainerDimensions()
              , o = t || new s;
            return o.x = (A - i.left) / i.width * 2 - 1,
            o.y = -(e - i.top) / i.height * 2 + 1,
            o
        }
        ,
        this.getCameraName = function() {
            return this.camera === this.viewer.defaultCamera ? this.camera.isPerspective ? Ec.PERSPECTIVE : Ec.ORTHOGRAPHIC : this.camera.name
        }
        ,
        this.getCameraInfo = function() {
            var A = new Qd(this.getCameraName(),this.camera.position,this.camera.target,this.camera.up);
            return JSON.stringify(A)
        }
        ,
        this.isKeepZoom = function(A, e, t) {
            this.dirtyCamera(!0),
            this.setCameraChanging(!0),
            void 0 === e && (e = this.minDistance),
            void 0 === t && (t = this.maxDistance);
            var i = this.camera.position
              , o = this.camera.target
              , n = new y;
            n.copy(i).sub(o);
            var r = n.length() * (2 - A);
            return !(e > r || r > t)
        }
        ,
        this.computeRotation = function() {
            var A = new M;
            A.lookAt(this.camera.position, this.camera.target, this.camera.up);
            var e = new f;
            e.setFromRotationMatrix(A);
            var t = new F;
            return t.setFromQuaternion(e, void 0, !1),
            t
        }
        ,
        this.adjustCameraUp = function() {
            this.camera.realUp.z > 0 ? this.camera.up = new y(0,0,1) : 0 > this.camera.realUp.z ? this.camera.up = new y(0,0,-1) : this.camera.realUp.x > 0 ? this.camera.up = new y(1,0,0) : 0 > this.camera.realUp.x ? this.camera.up = new y(-1,0,0) : this.camera.realUp.y > 0 ? this.camera.up = new y(0,1,0) : 0 > this.camera.realUp.y && (this.camera.up = new y(0,-1,0))
        }
        ,
        this.getWorldEye = function() {
            return this.camera.target.clone().sub(this.camera.position)
        }
        ,
        this.getWorldRight = function() {
            var A = new y
              , e = this.camera.up
              , t = this.getWorldEye();
            return A.crossVectors(t, e),
            0 === A.lengthSq() && (e.z > e.y ? t.y -= 1e-4 : t.z += 1e-4,
            A.crossVectors(t, e)),
            A.normalize()
        }
        ,
        this.getWorldRightByRealUp = function() {
            var A = new y
              , e = this.camera.realUp
              , t = this.getWorldEye();
            return A.crossVectors(t, e),
            0 === A.lengthSq() && (e.z > e.y ? t.y -= 1e-4 : t.z += 1e-4,
            A.crossVectors(t, e)),
            A.normalize()
        }
        ,
        this.getWorldUp = function() {
            var A = this.getWorldRight()
              , e = this.getWorldEye();
            return A.cross(e).normalize()
        }
        ,
        this.getWorldDimension = function(A, e) {
            var t = this.camera.position
              , i = this.getWorldEye().normalize()
              , o = this.getTrackingPoint(A, e).clone().sub(t)
              , n = Math.abs(i.dot(o))
              , r = this.getContainerDimensions()
              , l = r.width / r.height
              , c = 2 * n * Math.tan(a.degToRad(.5 * this.camera.fov));
            return new s(c * l,c)
        }
        ,
        this.getWorldPointFromNearPlane = function(A, e) {
            var t = new y(A,e,0);
            return t.unproject(this.camera),
            t
        }
        ,
        this.getTrackingPoint = function(A, e) {
            var t = new s(A,e)
              , i = this.getIntersectContext(t)
              , o = this.intersector.hitTest(i)
              , n = this.camera.position;
            if (!o) {
                var r = i.mouse
                  , a = this.getWorldEye()
                  , l = a.clone().normalize()
                  , c = this.getWorldPointFromNearPlane(r.x, r.y)
                  , h = new CA;
                if (this.camera.isPerspective)
                    h.origin.copy(n),
                    h.direction.copy(c.clone().sub(n).normalize());
                else {
                    var d = c.clone();
                    d.sub(a),
                    h.origin.copy(d),
                    h.direction.copy(l)
                }
                if (v) {
                    var p = new EA;
                    if (p.setFromNormalAndCoplanarPoint(l, v),
                    o = h.intersectPlane(p, new y)) {
                        var u = o.distanceTo(n);
                        g > u && (o = this.getTrackingPointFromBoundingBox(l, h))
                    } else
                        o = this.getTrackingPointFromBoundingBox(l, h)
                } else
                    o = this.getTrackingPointFromBoundingBox(l, h);
                o || (Bh.log("tracking point is default!"),
                o = c)
            }
            return n.equals(o) && (o = null),
            v = o && o.clone(),
            o
        }
        ,
        this.getTrackingPointFromBoundingBox = function(A, e) {
            return this.viewer.getScene().getTrackingPointFromBoundingBox(A, e)
        }
        ,
        this.setCameraPosition = function(A) {
            var e = this.camera
              , t = this.getWorldEye()
              , i = t.length()
              , o = t.clone();
            o.normalize(),
            o.setLength(i),
            e.position.copy(A),
            e.target.addVectors(e.position, o),
            this.dirtyCamera(!0),
            this.setCameraChanging(!0)
        }
        ,
        this.moveStraight = function(A, e) {
            var t = this.camera.position
              , i = this.camera.target;
            if (e) {
                var o = new y(i.x - t.x,0,i.z - t.z)
                  , n = A / o.length()
                  , r = new y(o.x * n,0,o.z * n);
                t.add(r),
                i.add(r)
            } else {
                var a = i.clone().sub(t);
                this.camera.translateZ(-A),
                i.addVectors(t, a)
            }
            this.dirtyCamera(!0),
            this.setCameraChanging(!0)
        }
        ,
        this.getIntersectContext = function(A) {
            var e = new up;
            return e.scene = p.viewer.getScene(),
            e.camera = this.camera,
            null !== A && this.mapWindowToViewport(A.x, A.y, e.mouse),
            e.viewportSize = p.viewer.getRenderer().getSize(new s),
            e.octantMap = p.viewer.modelManager.octantToObjectMap,
            e
        }
        ,
        this.getLastIntersect = function() {
            return this.intersector.lastIntersect
        }
        ,
        this.calculatePivot = function(A, e) {
            var t = this
              , i = this.viewer
              , o = i.getFilter()
              , n = i.getScene()
              , r = null;
            function a(A) {
                var e = t.getIntersectContext(A)
                  , i = t.intersector.hitTest(e);
                if (i)
                    return i;
                var o = n.getBoundingBox();
                if (n.hasClipPlanes() && n.getClipPlanes().isEnabled()) {
                    var r = n.getClipPlanes().getClipBoundingBox();
                    o.intersect(r)
                } else if (n.hasFillClipPlanes() && n.getFillClipPlane().isEnabled()) {
                    var a = n.getFillClipPlane().getFillClipBoundingBox();
                    o.intersect(a)
                }
                return o.getCenter(new y)
            }
            var s = null
              , l = null;
            switch (A) {
            case kc.SELECTION:
                if (n.hasClipPlanes() && n.getClipPlanes().isEnabled() && (s = n.getClipPlanes().getClipBoundingBox()) && !s.isEmpty() && n.getClipPlanes().isVisible()) {
                    r = s.getCenter();
                    break
                }
                n.hasFillClipPlanes() && n.getFillClipPlane().isEnabled() && (l = n.getFillClipPlane().getFillClipBoundingBox());
                var c = o.getVisibleComponentSet(i.modelManager.sceneState.getSelectionSet(), i)
                  , h = i.getBoundingBoxByIds(c);
                mh.isMobileDevice() || !h || h.isEmpty() ? r = a(e) : (s ? h.intersect(s) : l && h.intersect(l),
                r = h.getCenter(new y));
                break;
            case kc.CENTER:
                r = n.getBoundingBoxWorld().getCenter(new y);
                break;
            case kc.CAMERA:
                r = null;
                break;
            default:
                r = a(e)
            }
            return this.dirtyCamera(!0),
            this.setCameraChanging(!0),
            this.pivot = r,
            r
        }
        ,
        this.touchUpdateRotationInPersonView = function(A, e) {
            this.dirtyCamera(!0),
            this.setCameraChanging(!0);
            var t = this
              , i = this.camera.position
              , o = this.camera.target.clone().sub(i).length()
              , n = this.camera.getWorldDirection(new y)
              , r = this.camera.realUp || this.camera.up
              , a = n.clone().cross(r).normalize()
              , s = a.clone().cross(n).normalize();
            this.camera.realUp.copy(s);
            var l = jh.LockAxisZRange
              , c = null
              , h = null;
            if (Math.abs(A) > Math.abs(e))
                c = u,
                h = A;
            else {
                if (jh.LockAxisZ && !E(e, this.camera.target, l))
                    return;
                c = a;
                var d = new y(0,0,1).clone().cross(r)
                  , p = d.dot(a)
                  , m = Math.asin(d.length());
                0 > p && (m = -m),
                m + e > Math.PI / 4 - g ? e = Math.PI / 4 - g - m : m + e < -Math.PI / 4 + g && (e = -Math.PI / 4 + g - m),
                h = e
            }
            var C, v, I = (new f).setFromAxisAngle(c, h);
            C = I,
            v = new y,
            n.applyQuaternion(C).normalize(),
            v.copy(i).add(n.multiplyScalar(o)),
            t.camera.target.copy(v),
            this.camera.realUp.applyQuaternion(I).normalize()
        }
        ,
        this.touchUpdateRotationInModelView = function(A, e, t) {
            this.dirtyCamera(!0),
            this.setCameraChanging(!0);
            var i = t || this.scene.getBoundingBox().getCenter(new y)
              , o = this.camera.position
              , n = this.camera.target.clone().sub(o).length()
              , r = o.clone().sub(i)
              , a = r.length()
              , s = null
              , l = this.camera.getWorldDirection(new y);
            r.normalize();
            var c = function(A) {
                var e = new y
                  , t = r.clone().applyQuaternion(A).normalize();
                o.copy(i).add(t.multiplyScalar(a)),
                l.applyQuaternion(A).normalize(),
                e.copy(o).add(l.multiplyScalar(n)),
                p.camera.target.copy(e)
            }
              , h = this.camera.realUp || this.camera.up
              , d = l.clone().cross(h).normalize()
              , m = d.clone().cross(l).normalize();
            this.camera.realUp.copy(m);
            var C = null;
            if (jh.LockAxisZ) {
                if (Math.abs(A) > Math.abs(e))
                    C = u,
                    c(s = (new f).setFromAxisAngle(C, A)),
                    this.camera.realUp.applyQuaternion(s).normalize();
                else if (null != jh.LockAxisZRange && Math.abs(e) > 1e-4) {
                    E(e, i, jh.LockAxisZRange) && (C = l.clone().cross(h).normalize(),
                    c(s = (new f).setFromAxisAngle(C, e)),
                    this.camera.realUp.applyQuaternion(s).normalize(),
                    this.adjustCameraUp())
                }
            } else if (Math.abs(A) > Math.abs(e))
                C = this.camera.up.clone().normalize(),
                c(s = (new f).setFromAxisAngle(C, A)),
                this.camera.realUp.applyQuaternion(s).normalize();
            else if (Math.abs(e) > .01) {
                C = l.clone().cross(h).normalize();
                var v = new y(0,1,0).clone().cross(h)
                  , I = v.dot(d)
                  , x = Math.asin(v.length());
                0 > I && (x = -x),
                x + e > Math.PI / 2 - g ? e = Math.PI / 2 - g - x : x + e < -Math.PI / 2 + g && (e = -Math.PI / 2 + g - x),
                c(s = (new f).setFromAxisAngle(C, e)),
                this.camera.realUp.applyQuaternion(s).normalize(),
                this.adjustCameraUp()
            }
            this.pivotBallGroup || function() {
                p.pivotBallGroup = p.scene.getOrCreateGroup(gp.PIVOTBALL, {
                    priority: 10,
                    globalSpace: !1
                });
                var A = new er(15,64,64)
                  , e = new Ue(A,new Ir({
                    color: 16777215,
                    depthTest: !1,
                    opacity: .5,
                    transparent: !0,
                    side: 2
                }))
                  , t = new Ue(A = new er(1,64,64),new Ir({
                    color: 16711680,
                    depthTest: !1,
                    opacity: .5,
                    transparent: !0,
                    side: 2
                }));
                p.pivotBallGroup.add(e),
                p.pivotBallGroup.add(t)
            }(),
            this.pivotBallGroup.visible = !0;
            for (var S = function() {
                var A = p.camera
                  , e = A.position
                  , t = p.camera.target.clone().sub(e);
                t.normalize();
                var i = new EA;
                i.setFromNormalAndCoplanarPoint(t.clone().negate(), B()),
                i.normalize();
                var o = i.distanceToPoint(e) * Math.tan(.5 * A.fov)
                  , n = p.getContainerDimensions();
                return 2 * o / (n.height - n.top)
            }(), w = B(), M = 0; this.pivotBallGroup.children.length > M; M += 1) {
                var b = this.pivotBallGroup.children[M];
                b.position.copy(w),
                b.scale.set(S, S, S),
                b.updateMatrixWorld()
            }
        }
        ,
        this.touchUpdateRotation = function(A, e) {
            var t = this.camera.position;
            this.scene.getBoundingBox().containsPoint(t) ? this.touchUpdateRotationInPersonView(A, e) : this.touchUpdateRotationInModelView(A, e, B())
        }
        ,
        this.clearTouchRotateState = function() {
            this.pivotBallGroup && (this.pivotBallGroup.visible = !1)
        }
        ,
        this.touchEndHandler = function() {
            this.viewer.controlManager.cameraChange = !1,
            this.clearTouchRotateState(),
            this.touchUpdate()
        }
        ,
        this._adjustCameraForDolly = function(A, e) {
            var t = e - 1;
            if (Math.abs(t) < g)
                return !1;
            var i = this.camera
              , o = i.position
              , n = this.getWorldEye()
              , r = new y;
            A ? r.subVectors(A, o) : r.copy(n),
            r.multiplyScalar(t);
            var a = r.length();
            i.isPerspective && this.minDollyDistance > a && r.normalize().multiplyScalar(this.minDollyDistance);
            var s = new y;
            return s.addVectors(o, r),
            i.isPerspective || (i.orthoScale *= e,
            i.setZoom(i.orthoScale)),
            i.position.copy(s),
            i.target.copy(n.add(s)),
            this.dirtyCamera(!0),
            this.setCameraChanging(!0),
            !0
        }
        ,
        this.touchDolly = function(A, e, t) {
            var i = new s(A,e)
              , o = this.getIntersectContext(i)
              , n = this.intersector.hitTest(o);
            this._adjustCameraForDolly(null !== n ? n : null, t)
        }
        ,
        this.touchUpdate = (h = new y,
        d = new f,
        function() {
            var A = new y;
            A.copy(p.camera.up),
            p.camera.up.copy(p.camera.realUp),
            p.camera.lookAt(p.camera.target),
            p.camera.up.copy(A),
            p.camera.updateMVP(),
            (h.distanceToSquared(p.camera.position) > g || 8 * (1 - d.dot(this.camera.quaternion)) > g) && (this.dispatchEvent({
                type: Rc.ON_CAMERA_CHANGE,
                camera: this.camera
            }),
            i(),
            p.dirtyCamera(!1),
            h.copy(p.camera.position),
            d.copy(p.camera.quaternion))
        }
        ),
        this.goTurnForWalk = function(A) {
            var e = this.getCamera()
              , t = e.position
              , i = e.target
              , o = new y(i.x - t.x,i.y - t.y,0)
              , n = Math.cos(A)
              , r = Math.sin(A)
              , a = new y(o.x * n - o.y * r,o.x * r + o.y * n,0);
            i.x = t.x + a.x,
            i.y = t.y + a.y,
            this.dirtyCamera(!0),
            this.setCameraChanging(!0)
        }
        ,
        this.goPitchForWalk = function(A) {
            var e = this.getCamera()
              , t = e.position
              , i = e.target
              , o = i.x - t.x
              , n = i.y - t.y
              , r = new y(Math.sqrt(o * o + n * n),0,i.z - t.z)
              , a = Math.cos(A)
              , s = Math.sin(A)
              , l = new y(r.x * a - r.z * s,0,r.x * s + r.z * a);
            i.z = t.z + l.z,
            this.dirtyCamera(!0),
            this.setCameraChanging(!0)
        }
        ,
        this.goUpDownForWalk = function(A) {
            var e = this.getCamera()
              , t = e.position
              , i = e.target
              , o = new y(0,0,1)
              , n = x(e, this.scene.getMatrixGlobal(), o, A);
            t.z += n.z,
            i.z += n.z,
            this.dirtyCamera(!0),
            this.setCameraChanging(!0)
        }
        ,
        this.stepCameraForWalk = function(A, e) {
            var t = this.getCamera()
              , i = t.position
              , o = t.target
              , n = new y(o.x - i.x,o.y - i.y,0).normalize()
              , r = new y(0,0,1)
              , a = n.clone().cross(r)
              , s = this.scene.getMatrixGlobal()
              , l = null;
            switch (A) {
            case qc.FORWARD:
                (l = x(t, s, n, e)).z = 0;
                break;
            case qc.BACK:
                n.multiplyScalar(-1),
                (l = x(t, s, n, e)).z = 0;
                break;
            case qc.LEFT:
                a.multiplyScalar(-1),
                (l = x(t, s, a, e)).z = 0;
                break;
            case qc.RIGHT:
                (l = x(t, s, a, e)).z = 0
            }
            i.add(l),
            o.add(l),
            this.dirtyCamera(!0),
            this.setCameraChanging(!0)
        }
        ,
        this.hitTestWithGround = function() {
            var A = this.getCamera()
              , e = A.up.clone().multiplyScalar(-1)
              , t = new CA(A.position.clone(),e)
              , i = this.getIntersectContext(null)
              , o = this.intersector.byGravity;
            this.intersector.byGravity = !0;
            var n = this.intersector.intersect(i, t, !1);
            return this.intersector.byGravity = o,
            n
        }
        ,
        this.projectPositionToBottom = function(A) {
            var e = void 0;
            if (A instanceof Array)
                e = new y(A[0],A[1],A[2]);
            else {
                if (!(A instanceof y))
                    return;
                e = A
            }
            this.getCamera();
            var t = new CA(e,new y(0,0,-e.z).normalize())
              , i = this.getIntersectContext(null)
              , o = this.intersector.byGravity;
            this.intersector.byGravity = !0;
            var n = this.intersector.intersect(i, t, !1);
            if (this.intersector.byGravity = o,
            n)
                return n.point
        }
        ,
        this.hitTestForward = function(A) {
            var e = this.getCamera()
              , t = this.getWorldEye();
            t.normalize(),
            t = t.multiplyScalar(A);
            var i = new CA(e.position.clone(),t)
              , o = this.getIntersectContext(null);
            return o.camera.near = -1,
            this.intersector.intersect(o, i, !1)
        }
        ,
        this.hitTestRight = function(A) {
            var e = this.getCamera()
              , t = this.getWorldEye();
            t.normalize();
            var i = t.cross(e.up).normalize();
            i = i.multiplyScalar(A);
            var o = new CA(e.position.clone(),i)
              , n = this.getIntersectContext(null);
            return n.camera.near = -1,
            this.intersector.intersect(n, o, !1)
        }
        ,
        this.computeGravity = function() {
            this.gravity = 0;
            var A = this.hitTestWithGround();
            if (null === A) {
                var e = this.scene.getMatrixGlobal()
                  , t = new M;
                t.getInverse(e);
                var i = this.camera.position.clone();
                i.applyMatrix4(t),
                i.z = this.scene.getBoundingBoxWorld().min.z || 0,
                i.applyMatrix4(e),
                this.distanceToGround = Math.abs(this.camera.position.z - i.z)
            }
            if (void 0 === this.manHeight)
                this.computeManHeight();
            else {
                var o = A ? A.distance - this.manHeight : this.distanceToGround - this.manHeight;
                if (o /= this.scene.getGlobalScaleFactor(),
                .1 > Math.abs(o))
                    return 0;
                this.gravity = o
            }
        }
        ,
        this.computeManHeight = function() {
            if (!this.manHeight) {
                var A = this.hitTestWithGround()
                  , e = this.scene.getMatrixGlobal()
                  , t = new M;
                if (t.getInverse(e),
                null != A) {
                    var i = A.point.clone();
                    i.applyMatrix4(t),
                    i.z += this._realManHeight * this.sceneLengthUnitFactor,
                    i.applyMatrix4(e),
                    this.manHeight = Math.abs(A.point.z - i.z)
                } else {
                    var o = this.camera.position.clone();
                    o.applyMatrix4(t),
                    o.z = 0;
                    var n = o.clone();
                    n.z += this._realManHeight * this.sceneLengthUnitFactor,
                    o.applyMatrix4(e),
                    n.applyMatrix4(e),
                    this.manHeight = Math.abs(n.z - o.z)
                }
            }
        }
        ,
        this.setRealManHeight = function(A) {
            A !== this._realManHeight && (this._realManHeight = A,
            this.manHeight = void 0)
        }
        ,
        this.getRealManHeight = function() {
            return this._realManHeight
        }
        ,
        this.walkWithParallelEye = function() {
            var A = this.camera
              , e = this.getWorldEye().length()
              , t = this.scene.getBoundingBox().getCenter(new y)
              , i = new y;
            i.subVectors(t, A.position);
            var o = i.length();
            i.z = 0,
            i.normalize(),
            i.multiplyScalar(o),
            A.position.subVectors(t, i),
            A.target.addVectors(A.position, i.normalize().multiplyScalar(e));
            var n = new y(0,0,1);
            A.up.copy(n),
            A.realUp.copy(n),
            this.dirtyCamera(!0),
            this.setCameraChanging(!0),
            this.update(!0)
        }
        ,
        this.updateFlyMove = function(A, e) {
            var t = this.camera;
            this.dirtyCamera(!0),
            this.setCameraChanging(!0);
            var i = qc;
            A & i.FORWARD && t.translateZ(-e),
            A & i.BACK && t.translateZ(e),
            A & i.LEFT && t.translateX(-e),
            A & i.RIGHT && t.translateX(e),
            A & i.UP && t.translateY(e),
            A & i.DOWN && t.translateY(-e),
            this.flyOnWorld()
        }
        ,
        this.flyOnWorld = function() {
            var A = this.camera
              , e = A.up.clone();
            A.realUp && A.up.copy(A.realUp),
            A.lookAt(A.target),
            A.realUp && A.up.copy(e),
            this.updateCamera(),
            this.adjustCameraUp(),
            i(),
            this.dirtyCamera(!1),
            m.copy(A.position),
            C.copy(A.quaternion)
        }
        ,
        this.rotateForFly = function(A, e, t, i) {
            var o = this.camera
              , n = o.position
              , r = o.target
              , a = r.clone().sub(n)
              , s = new y(0,1,0)
              , l = o.realUp || o.up
              , c = a.clone().cross(l).normalize();
            if (this.dirtyCamera(!0),
            this.setCameraChanging(!0),
            jh.LockAxisZ && (e = 0),
            0 !== e) {
                var h = (new f).setFromAxisAngle(c, -e)
                  , d = a.clone();
                d.applyQuaternion(h);
                var p = d.angleTo(s);
                t > (p -= .5 * Math.PI) || p > i || a.applyQuaternion(h)
            }
            if (0 !== A) {
                var g = (new f).setFromAxisAngle(s, -A);
                a.applyQuaternion(g)
            }
            r.addVectors(n, a),
            this.flyOnWorld()
        }
        ,
        this.fitAndRotateBySelection = function() {
            var A = this.viewer;
            A.setPointRotateMode(kc.SELECTION),
            A.zoomToSelection()
        }
        ,
        this.flyToPointWithParallelEye = function(A) {
            var e = this.getWorldEye()
              , t = e.length()
              , i = e.clone();
            i.y = 0,
            i.normalize(),
            i.setLength(t);
            var o = new y(0,0,1);
            this.camera.up = o,
            this.camera.realUp = o.clone(),
            this.camera.position.copy(A),
            this.camera.target.addVectors(this.camera.position, i),
            this.update(!0)
        }
        ,
        this.flyToPoint = function(A) {
            var e = this.getWorldEye();
            this.camera.position.copy(A),
            this.camera.target.addVectors(this.camera.position, e),
            this.update(!0)
        }
        ,
        this.setRoamingWalkAbsoluteHeight = function(A) {}
        ,
        this.setCameraHeight = function(A, e) {
            this.cameraAbsoluteHeightEnabled = !1,
            this.cameraRelativeHeight = e,
            void 0 === this.cameraConstraintHeights ? this.cameraConstraintHeights = [] : this.cameraConstraintHeights.length = 0;
            for (var t = 0, i = A.length; i > t; t += 1)
                this.cameraConstraintHeights[t] = A[t]
        }
        ,
        this.setCameraAbsoluteHeight = function(A) {
            this.cameraAbsoluteHeightEnabled = !0,
            this.cameraAbsoluteHeight = A
        }
        ,
        this.updateCameraHeight = function() {
            var A = this.scene
              , e = this.getCamera()
              , t = A.drawingToWorld(e.position)
              , i = t.z
              , o = null
              , n = null;
            if (this.cameraAbsoluteHeightEnabled)
                void 0 === this.cameraAbsoluteHeight && (this.cameraAbsoluteHeight = i),
                o = this.cameraAbsoluteHeight;
            else if (void 0 === this.cameraConstraintHeights)
                o = i;
            else {
                var r = uh.findRange(this.cameraConstraintHeights, i);
                if (o = this.cameraConstraintHeights[r],
                o += this.cameraRelativeHeight,
                this.cameraConstraintHeights.length - 1 > r) {
                    var a = this.cameraConstraintHeights[r + 1];
                    o > a && (o = a)
                }
            }
            o !== i && (n = A.worldToDrawing({
                x: t.x,
                y: t.y,
                z: o
            }),
            this.setCameraPosition(n))
        }
        ,
        this.getRaycaster = function(A, e) {
            var t = new Dd
              , i = new s;
            return this.mapWindowToViewport(A, e, i),
            t.setFromCamera(i, this.camera),
            t
        }
        ,
        this.translateCameraForWalk = function(A, e) {
            var t = this.collisionManager;
            if (0 !== A.x)
                if (!1 === vc.EnableHitDetection)
                    this.stepCameraForWalk(qc.RIGHT, A.x * e);
                else {
                    var i = 1;
                    0 > A.x && (i = -1);
                    var o = this.hitTestRight(i);
                    if (o) {
                        var n = this.viewer.modelManager.getNodeInfosByUserId(o.userId);
                        if (!t.hasCollision({
                            type: n ? n[0].type : null
                        }, o.distance)) {
                            var r = e;
                            Math.abs(e) > o.distance && (r = e > 0 ? o.distance - t.distance * t.factor - .1 * this.sceneLengthUnitFactor : t.distance * t.factor - o.distance + .1 * this.sceneLengthUnitFactor),
                            this.stepCameraForWalk(qc.RIGHT, A.x * r)
                        }
                    } else
                        this.stepCameraForWalk(qc.RIGHT, A.x * e)
                }
            if (0 !== A.y)
                if (!1 === vc.EnableHitDetection)
                    this.stepCameraForWalk(qc.BACK, A.y * e);
                else {
                    var a = 1;
                    A.y > 0 && (a = -1);
                    var s = this.hitTestForward(a);
                    if (s) {
                        var l = this.viewer.modelManager.getNodeInfosByUserId(s.userId);
                        if (!t.hasCollision({
                            type: l ? l[0].type : null
                        }, s.distance)) {
                            var c = e;
                            Math.abs(e) > s.distance && (c = e > 0 ? s.distance - t.distance * t.factor - .1 * this.sceneLengthUnitFactor : t.distance * t.factor - s.distance + .1 * this.sceneLengthUnitFactor),
                            this.stepCameraForWalk(qc.BACK, A.y * c)
                        }
                    } else
                        this.stepCameraForWalk(qc.BACK, A.y * e)
                }
            if (0 !== A.z)
                this.goUpDownForWalk(A.z * e * .5);
            else {
                var h = e;
                if (0 !== this.gravity) {
                    var d = Math.abs(this.gravity);
                    h = d > h ? .2 * d : d
                }
                this.gravity > 0 ? this.goUpDownForWalk(-h) : 0 > this.gravity && this.goUpDownForWalk(h)
            }
        }
        ,
        this.rotateCameraForWalk = function(A, e) {
            0 !== A.x && (this.goPitchForWalk(A.x * Math.PI),
            A.x = 0),
            0 !== A.z && (this.goTurnForWalk(-A.z * Math.PI * e),
            A.z = 0)
        }
        ,
        this.zoomCameraForWalk = function(A) {
            this.adjustCameraForDolly(A, null)
        }
        ,
        this.movePlane = function(A, e, t, i, o) {
            if (void 0 === o) {
                var n = new EA;
                n.setComponents(A.x, A.y, A.z, A.w),
                o = new y,
                n.coplanarPoint(o)
            }
            var r = new y(A.x,A.y,A.z)
              , a = this.camera.getWorldDirection(new y)
              , s = new EA;
            s.setFromNormalAndCoplanarPoint(a, o);
            var l = this.getRaycaster(e.clientX, e.clientY)
              , c = new y
              , h = this.getRaycaster(t.x, t.y)
              , d = new y;
            if (l.ray.intersectPlane(s, c) && h.ray.intersectPlane(s, d)) {
                c.subVectors(c, d),
                c.projectOnVector(r);
                var p = c.length();
                if (0 > c.dot(r) && (p = -p),
                0 !== p)
                    return i && (r.multiplyScalar(p),
                    p = r.x + r.y + r.z),
                    p
            }
            return null
        }
        ,
        this.getZenith = function() {
            var A = this.camera.position
              , e = p.viewer.getBoundingBox().getCenter();
            return A.clone().sub(e.clone()).clone().angleTo(u.clone())
        }
        ,
        this.getAzimuth = function() {
            var A = this.camera.position
              , e = p.viewer.getBoundingBox().getCenter()
              , t = A.clone().sub(e.clone()).clone().projectOnPlane(u.clone())
              , i = t.angleTo(u.clone());
            return 0 > t.x && (i = 360 - i),
            i
        }
        ,
        this.getCurrentRangeofCamera = function() {
            var A = this.camera
              , e = this.viewer.getBoundingBox()
              , t = e.getCenter()
              , i = A.position
              , o = .5 * e.getSize().length() / Math.tan(a.degToRad(.5 * A.fov));
            return t.distanceTo(i) / o
        }
        ,
        this.setMaximalRangeofCamera = function(A) {
            this.farFactor = A || 2
        }
        ,
        this.getMaximalRangeofCamera = function() {
            return this.farFactor
        }
        ,
        this.cameraWithinMaximumRange = function(A) {
            var e = A || this.farFactor;
            return this.getCurrentRangeofCamera() <= e
        }
        ,
        this.resetCameraToMaximumRange = function(A) {
            var e = this.camera
              , t = this.viewer.getBoundingBox()
              , i = t.getCenter()
              , o = e.position
              , n = this.farFactor;
            "number" == typeof A && (n = A);
            var r = (new y).subVectors(i, o)
              , s = .5 * t.getSize().length() / Math.tan(a.degToRad(.5 * e.fov));
            r.setLength(n * s);
            var l = i.clone().sub(r)
              , c = this.getWorldEye();
            this.camera.position.copy(l),
            this.camera.target.copy(c.add(l)),
            this.updateView(!0)
        }
        ,
        this.setZoomSpeed = function(A) {
            "number" == typeof A && A > 0 && (this.zoomSpeed = A)
        }
        ,
        this.getZoomSpeed = function() {
            return this.zoomSpeed
        }
        ,
        this.setZoomOutLimitRate = function(A) {
            "number" == typeof A && A > 0 && (this.farFactor = A)
        }
        ,
        this.getZoomOutLimitRate = function() {
            return this.farFactor
        }
        ,
        this.setSceneUnit = function(A) {
            var e = 1;
            switch (A) {
            case "m":
                e = .001;
                break;
            case "mm":
                e = 1;
                break;
            case "km":
                e = 1e-6;
                break;
            default:
                e = 1
            }
            this.collisionManager.setFactor(e),
            this.sceneLengthUnitFactor = e
        }
    };
    Object.assign(mp.prototype, Ld.prototype);
    var Cp = function() {
        this.duration = 500,
        this._state = null
    };
    Cp.prototype.rotateCameraByViewCubeSide = function(A, e, t, i) {
        var o = A.target.clone()
          , n = e.getCenter(new y)
          , r = A.quaternion.clone()
          , a = A.position.clone()
          , s = this._calculateDistanceAndEuler(t, e)
          , l = (new f).setFromEuler(s.euler).inverse()
          , c = new M;
        c.makeRotationFromQuaternion(l);
        var h = c.elements
          , d = new y(-h[8],-h[9],-h[10]).normalize();
        d.setLength(s.distance);
        var p = n.clone().sub(d);
        if (!a.equals(p) || !r.equals(l)) {
            var g = this._calculatePositionRotateInfo(r, l, a, p);
            this._state && this._state.timerID && (cancelAnimationFrame(this._state.timerID),
            this._state.timerID = void 0),
            this._state = {
                startTime: Date.now(),
                startQuaternion: r,
                endQuaternion: l,
                startPosition: a,
                endPosition: p,
                startTarget: o,
                endTarget: n,
                positionRotateInfo: g,
                onUpdate: i
            },
            this._state.timerID = requestAnimationFrame(this._animate.bind(this))
        }
    }
    ,
    Cp.prototype.cancelAnimation = function() {
        this._state && this._state.timerID && (cancelAnimationFrame(this._state.timerID),
        this._state = void 0)
    }
    ,
    Cp.prototype._animate = function() {
        if (this._state) {
            var A = Date.now()
              , e = this._state
              , t = e.startTarget
              , i = e.endTarget
              , o = e.startQuaternion
              , n = e.endQuaternion
              , r = e.startPosition
              , a = e.endPosition
              , s = e.positionRotateInfo
              , l = Math.min((A - e.startTime) / this.duration, 1);
            l = this._easyOut(l);
            var c = n.clone();
            o.equals(n) || f.slerp(o, n, c, l);
            var h = a;
            r.equals(a) || (h = s ? this._rotatePositionAroundCenter(s, r, a, l) : r.clone().lerp(a, l));
            var d = i.clone();
            t.equals(i) || (d = d.lerpVectors(t, i, l)),
            "function" == typeof this._state.onUpdate && this._state.onUpdate(l, c, h, d),
            1 === l ? (cancelAnimationFrame(this._state.timerID),
            this._state = null) : this._state.timerID = requestAnimationFrame(this._animate.bind(this))
        }
    }
    ,
    Cp.prototype._calculateDistanceAndEuler = function(A, e) {
        var t = -45
          , i = 0
          , o = -135
          , n = 0
          , r = e ? e.getSize(new y) : {
            x: 0,
            y: 0,
            z: 0
        };
        switch (A) {
        case Uc.Home:
            break;
        case Uc.Front:
            t = -90,
            i = 0,
            o = 0;
            break;
        case Uc.Right:
            t = -90,
            i = 0,
            o = -90;
            break;
        case Uc.Back:
            t = -90,
            i = 0,
            o = -180;
            break;
        case Uc.Left:
            t = -90,
            i = 0,
            o = -270;
            break;
        case Uc.Top:
            t = 0,
            i = 0,
            o = 0;
            break;
        case Uc.Bottom:
            t = -180,
            i = 0,
            o = -180;
            break;
        case Uc.TopFront:
            t = -45,
            i = 0,
            o = -90;
            break;
        case Uc.TopRight:
            t = -45,
            i = 0,
            o = -180;
            break;
        case Uc.TopBack:
            t = -45,
            i = 0,
            o = 90;
            break;
        case Uc.TopLeft:
            t = -45,
            i = 0,
            o = 0;
            break;
        case Uc.BottomFront:
            t = -135,
            i = 0,
            o = 270;
            break;
        case Uc.BottomRight:
            t = -135,
            i = 0,
            o = -180;
            break;
        case Uc.BottomBack:
            t = -135,
            i = 0,
            o = 90;
            break;
        case Uc.BottomLeft:
            t = -135,
            i = 0,
            o = 0;
            break;
        case Uc.FrontRight:
            t = -90,
            i = 0,
            o = -135;
            break;
        case Uc.BackRight:
            t = -90,
            i = 0,
            o = -225;
            break;
        case Uc.BackLeft:
            t = -90,
            i = 0,
            o = 45;
            break;
        case Uc.FrontLeft:
            t = -90,
            i = 0,
            o = -45;
            break;
        case Uc.TopFrontRight:
            t = -45,
            i = -0,
            o = -135;
            break;
        case Uc.TopBackRight:
            t = -45,
            i = 0,
            o = -225;
            break;
        case Uc.TopBackLeft:
            t = -45,
            i = 0,
            o = -315;
            break;
        case Uc.TopFrontLeft:
            t = -45,
            i = 0,
            o = -45;
            break;
        case Uc.BottomFrontRight:
            t = -135,
            i = 0,
            o = -135;
            break;
        case Uc.BottomBackRight:
            t = -135,
            i = 0,
            o = -225;
            break;
        case Uc.BottomBackLeft:
            t = -135,
            i = 0,
            o = 45;
            break;
        case Uc.BottomFrontLeft:
            t = -135,
            i = 0,
            o = -45
        }
        var a = Math.PI / 180
          , s = new F(t * a,i * a,o * a);
        return 0 === (n = r.x + r.y + r.z) && (n = vc.SceneSize / 2),
        {
            euler: s,
            distance: n
        }
    }
    ,
    Cp.prototype._easyOut = function(A) {
        return A * (2 - A)
    }
    ,
    Cp.prototype._calculatePositionRotateInfo = function(A, e, t, i) {
        var o = (new f).multiplyQuaternions(e, A.clone().inverse());
        o.normalize();
        var n = new y(o.x,o.y,o.z).normalize()
          , r = 2 * Math.acos(o.w);
        if (0 !== r) {
            var a = null;
            if (r === Math.PI)
                a = (new y).addVectors(t, i).divideScalar(2);
            else {
                var s = (new y).addVectors(t, i)
                  , l = (new y).subVectors(i, t)
                  , c = n.clone().cross(l).normalize()
                  , h = .5 * l.length() / Math.tan(r / 2);
                c.setLength(h),
                a = (new y).addVectors(s.multiplyScalar(.5), c)
            }
            var d = null
              , p = null
              , g = (new y).subVectors(t, a)
              , u = g.length()
              , m = (new y).subVectors(i, t);
            if (r === Math.PI)
                p = -1,
                d = (new y).crossVectors(m, n);
            else {
                var C = (new y).subVectors(i, a);
                p = Math.cos(r),
                p = Math.max(-1, Math.min(1, p)),
                d = C.clone().sub(g.clone().multiplyScalar(p))
            }
            return {
                center: a,
                dot: p,
                vec: d,
                start: g,
                radiusLength: u
            }
        }
    }
    ,
    Cp.prototype._rotatePositionAroundCenter = function(A, e, t, i) {
        if (0 === i)
            return e;
        if (i >= 1)
            return t;
        var o = Math.acos(A.dot) * i
          , n = A.start.clone()
          , r = A.vec.clone().normalize()
          , a = n.multiplyScalar(Math.cos(o))
          , s = r.multiplyScalar(Math.sin(o) * A.radiusLength)
          , l = a.add(s);
        return l.add(A.center),
        l
    }
    ;
    var yp = function(A) {
        this.name = A,
        this._mousePressed = !1
    };
    yp.prototype.getName = function() {
        return this.name
    }
    ,
    yp.prototype.onExit = function() {}
    ,
    yp.prototype.destroy = function() {}
    ,
    yp.prototype.processMouseDown = function(A) {
        return !1
    }
    ,
    yp.prototype.processMouseMove = function(A) {
        return !1
    }
    ,
    yp.prototype.processMouseUp = function(A) {
        return !1
    }
    ,
    yp.prototype.processMouseWheel = function(A) {
        return !1
    }
    ,
    yp.prototype.processMouseDoubleClick = function(A) {
        return !1
    }
    ,
    yp.prototype.processKeyDown = function(A) {
        return !1
    }
    ,
    yp.prototype.processKeyUp = function(A) {
        switch (A.keyCode) {
        case qh:
            this._mousePressed = !1
        }
        return !1
    }
    ,
    yp.prototype.processTouchstart = function(A) {
        return !1
    }
    ,
    yp.prototype.processTouchmove = function(A) {
        return !1
    }
    ,
    yp.prototype.processTouchend = function(A) {
        return !1
    }
    ,
    yp.prototype.processHover = function(A) {
        return !1
    }
    ,
    yp.prototype.onEvent = function(A) {
        var e = !1;
        switch (A.type) {
        case "touchmove":
            e = this.processTouchmove(A);
            break;
        case "touchstart":
            e = this.processTouchstart(A);
            break;
        case "touchend":
            e = this.processTouchend(A);
            break;
        case "keydown":
            e = this.processKeyDown(A);
            break;
        case "keyup":
            e = this.processKeyUp(A);
            break;
        case "mousewheel":
        case "DOMMouseScroll":
            e = this.processMouseWheel(A);
            break;
        case "mousedown":
            this._mousePressed = !0,
            e = this.processMouseDown(A);
            break;
        case "mousemove":
            e = this._mousePressed ? this.processMouseMove(A) : this.processHover(A);
            break;
        case "mouseup":
            this._mousePressed = !1,
            e = this.processMouseUp(A);
            break;
        case "dblclick":
            e = this.processMouseDoubleClick(A)
        }
        return e
    }
    ;
    var vp = function(A) {
        yp.call(this, Pc.CLIP_BY_BOX),
        this.viewer = A,
        this.scene = A.getScene(),
        this.enablePick = !1,
        this.cameraControl = A.cameraControl,
        this.clipStartPoint = new y,
        this.startPt = new s,
        this.onClipBox = !1,
        this.mapLockedBoxFaces = {},
        this.mapBoxFaceIndex = {
            0: "right",
            1: "left",
            2: "top",
            3: "bottom",
            4: "front",
            5: "back"
        };
        for (var e = [], t = 0; 6 > t; t += 1)
            e.push(new EA);
        var i = this.scene.getClipPlanes(!0);
        i.updateClippingParams = function(t) {
            if (0 === t.iClipPlane.value)
                A.getRenderer().clippingPlanes = Object.freeze([]);
            else {
                for (var i = 0, o = t.iClipPlane.value; o > i; i += 1) {
                    var n = t.vClipPlane.value[i]
                      , r = e[i];
                    r.setComponents(-n.x, -n.y, -n.z, -n.w),
                    r.normalize()
                }
                A.getRenderer().clippingPlanes = e,
                this.calculateClipBoundingBox(e)
            }
        }
        ,
        i.init(),
        this.selectIndex = null,
        this.planeDistance = 0,
        this.offsetSpeed = .02,
        this.toggle = function(A, e) {
            i.enable(A, e)
        }
        ,
        this.visible = function(A) {
            i.visible = A
        }
        ,
        this.rotatable = function(A) {
            i.rotatable = A
        }
        ,
        this.store = function() {
            return i.store()
        }
        ,
        this.restore = function(A) {
            i.restore(A)
        }
        ,
        this.reset = function() {
            i.reset()
        }
        ,
        this.pointToScreen = function(A) {
            var e = this.cameraControl.camera
              , t = new M;
            t.multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse);
            var i = new p(A.x,A.y,A.z,1);
            i.applyMatrix4(t);
            var o = new s;
            o.x = (i.x / i.w + 1) / 2,
            o.y = 1 - (i.y / i.w + 1) / 2;
            var n = this.cameraControl.getContainerDimensions();
            return o.x = o.x * n.width + n.left,
            o.y = o.y * n.height + n.top,
            o
        }
        ,
        this.getPlaneDistanceInScreen = function() {
            if (null === this.selectIndex)
                return null;
            if (2 > this.selectIndex) {
                var A = i.center.clone()
                  , e = i.center.clone();
                A.x -= i.cubeSize.x,
                e.x += i.cubeSize.x;
                var t = this.pointToScreen(A)
                  , o = this.pointToScreen(e);
                return t.x - o.x
            }
            var n = i.center.clone()
              , r = i.center.clone();
            r.y -= i.cubeSize.y,
            n.y += i.cubeSize.y;
            var a = this.pointToScreen(r)
              , s = this.pointToScreen(n);
            return a.y - s.y
        }
        ,
        this.getPickPoint = function(A, e) {
            var t = this.cameraControl.camera
              , i = this.cameraControl.getContainerDimensions()
              , o = (A - i.left) / i.width * 2 - 1
              , n = (i.height - (e - i.top)) / i.height * 2 - 1
              , r = new Dd;
            return r.setFromCamera(new s(o,n), t),
            r.ray.intersectPlane(this.plane)
        }
        ,
        this.getSelectIndex = function() {
            return i.selectIndex
        }
        ,
        this._isVisible = function() {
            return i.visible
        }
        ,
        this.isRotate = function() {
            return i.rotatable
        }
        ,
        this.offset = function(A) {
            var e = Math.floor(this.selectIndex / 2);
            i.offset(this.selectIndex, this.selectIndex > 3 ? this.selectIndex % 2 == 1 ? -A * i.cubeSize.getComponent(e) * 2 : A * i.cubeSize.getComponent(e) * 2 : -A * i.cubeSize.getComponent(e) * 2)
        }
        ,
        this.setSectionBox = function(A, e) {
            var t = new aA(new y(A.x,A.y,A.z),new y(e.x,e.y,e.z));
            t.applyMatrix4(this.scene.getMatrixGlobal()),
            i.setSectionBox(t.min, t.max)
        }
        ,
        this.calculateOffsetByBox = function(A, e) {
            var t = new aA(new y(A.x,A.y,A.z),new y(e.x,e.y,e.z));
            t.applyMatrix4(this.scene.getMatrixGlobal()),
            t.setFromCenterAndSize(t.getCenter(), t.getSize().multiplyScalar(this.scene.getExpandScalar())),
            i.calculateOffsetByBox(t.min, t.max)
        }
        ,
        this.moveSectionPlane = function(A, e) {
            i.moveSectionPlane(A, e)
        }
        ,
        this.rotateSectionBox = function(A, e) {
            i.rotateSectionBox(A, e)
        }
        ,
        this.rotate = function(A, e) {
            2 === this.selectIndex || 3 === this.selectIndex ? i.rotX(e / 180 * Math.PI * .1) : i.rotY(A / 180 * Math.PI * .1)
        }
        ,
        this.update = function(A) {
            i.update(A)
        }
        ,
        this.cancelHighLight = function() {
            i.cancelHighLight()
        }
        ,
        this.highLight = function() {
            i.highLight()
        }
        ,
        this.lockBoxFaces = function(A) {
            var e = !0;
            try {
                for (var t, i = A[Symbol.iterator](); !(e = (t = i.next()).done); e = !0) {
                    this.mapLockedBoxFaces[t.value] = !0
                }
            } catch (A) {} finally {
                try {
                    !e && i.return && i.return()
                } catch (A) {}
            }
        }
        ,
        this.unlockBox = function() {
            this.mapLockedBoxFaces = {}
        }
        ,
        this.setProcess = function(A, e) {
            this.mapLockedBoxFaces[A] || i.setProcess(A, e)
        }
        ,
        this.getProcess = function(A) {
            return i.getProcess(A)
        }
    };
    (vp.prototype = Object.create(yp.prototype)).constructor = vp,
    vp.prototype.destroy = function() {
        this.cameraControl = null,
        this.intersectPoint = null,
        this.selectIndex = null,
        this.normal = null,
        this.plane = null,
        this.pickHelper = null,
        this.scene = null,
        this.viewer = null
    }
    ,
    vp.prototype.onExit = function() {
        this.toggle(!1, !1)
    }
    ,
    vp.prototype.processMouseDown = function(A) {
        if (this.startPt.set(A.clientX, A.clientY),
        !this.enablePick && A.button === t.LEFT) {
            var e = this.cameraControl.getRaycaster(A.clientX, A.clientY)
              , i = this.scene.getClipPlanes().hitTest(e)
              , o = this.cameraControl.getIntersectContext(new s(A.clientX,A.clientY))
              , n = this.cameraControl.intersector.intersect(o, null, !0);
            if (null !== n && i.distance >= n.distance)
                return yp.prototype.processMouseDown(this, A);
            if (this.selectIndex = this.getSelectIndex(),
            this.planeDistance = this.getPlaneDistanceInScreen(),
            null !== this.selectIndex)
                return this.highLight(),
                this.cameraControl.needUpdateRenderList(!0),
                this.cameraControl.update(!0),
                this.enablePick = !0,
                this.clipStartPoint = e.ray.at(i.distance, this.clipStartPoint),
                !0
        }
        return yp.prototype.processMouseDown(this, A)
    }
    ,
    vp.prototype.processHover = function(A) {
        if (!this.enablePick) {
            var e = !1
              , t = this.cameraControl.getRaycaster(A.clientX, A.clientY)
              , i = this.scene.getClipPlanes()
              , o = this.getSelectIndex();
            null !== o && this.cancelHighLight();
            i.hitTest(t);
            if (this.selectIndex = this.getSelectIndex(),
            null !== this.selectIndex) {
                if (this.highLight(),
                !this.onClipBox)
                    this.onClipBox = !0,
                    this.cameraControl.viewer.modelManager.dispatchEvent({
                        type: Rc.ON_CLIP_HOVER,
                        onClipBox: !0,
                        event: A
                    });
                e = !0
            } else if (this.onClipBox) {
                this.onClipBox = !1,
                this.cameraControl.viewer.modelManager.dispatchEvent({
                    type: Rc.ON_CLIP_HOVER,
                    onClipBox: !1,
                    event: A
                })
            }
            return this.selectIndex !== o && (this.cameraControl.needUpdateRenderList(!0),
            this.cameraControl.update(!0)),
            e
        }
        return yp.prototype.processHover(this, A)
    }
    ,
    vp.prototype.processMouseUp = function(A) {
        if (A.button === t.LEFT) {
            var e = this.cameraControl.getRaycaster(A.clientX, A.clientY)
              , i = this.scene.getClipPlanes();
            null !== this.getSelectIndex() && (this.cancelHighLight(),
            this.cameraControl.needUpdateRenderList(!0),
            this.cameraControl.update(!0));
            i.hitTest(e);
            if (this.selectIndex = this.getSelectIndex(),
            vc.ClippingCaps = !0,
            null !== this.selectIndex) {
                if (this.highLight(),
                this.cameraControl.needUpdateRenderList(!0),
                this.cameraControl.update(!0),
                !this.onClipBox)
                    this.onClipBox = !0,
                    this.cameraControl.viewer.modelManager.dispatchEvent({
                        type: Rc.ON_CLIP_HOVER,
                        onClipBox: !0,
                        event: A
                    })
            } else if (this.onClipBox) {
                this.onClipBox = !1,
                this.cameraControl.viewer.modelManager.dispatchEvent({
                    type: Rc.ON_CLIP_HOVER,
                    onClipBox: !1,
                    event: A
                })
            }
            if (this.enablePick)
                return this.planeDistance = 0,
                this.enablePick = !1,
                !0
        }
        return yp.prototype.processMouseUp(this, A)
    }
    ,
    vp.prototype.processMouseMove = function(A) {
        if (this.enablePick) {
            if (this.isRotate())
                this.rotate(A.clientX - this.startPt.x, A.clientY - this.startPt.y),
                this.startPt.set(A.clientX, A.clientY);
            else {
                var e = this.mapBoxFaceIndex[this.selectIndex];
                if (this.mapLockedBoxFaces[e])
                    return !0;
                if (!(A.clientX === this.startPt.x && A.clientY === this.startPt.y)) {
                    vc.ClippingCaps = !1;
                    var t = this.scene.getClipPlanes()
                      , i = this.cameraControl.movePlane(t.clipplanes[this.selectIndex], A, this.startPt, !0, this.clipStartPoint);
                    null !== i && t.offset(this.selectIndex, i),
                    this.startPt.set(A.clientX, A.clientY)
                }
                this.cameraControl.viewer.modelManager.dispatchEvent({
                    type: Rc.ON_CLIP_MOUSE_MOVE,
                    draggedFaceName: e
                })
            }
            return this.cameraControl.update(!0),
            !0
        }
        return yp.prototype.processMouseMove(this, A)
    }
    ,
    vp.prototype.processTouchstart = function(A) {
        if (this.startPt.set(A.touches[0].clientX, A.touches[0].clientY),
        this.enablePick)
            return yp.prototype.processTouchstart(this, A);
        var e = this.cameraControl.getRaycaster(A.touches[0].clientX, A.touches[0].clientY);
        return this.scene.getClipPlanes().hitTest(e),
        this.selectIndex = this.getSelectIndex(),
        this.planeDistance = this.getPlaneDistanceInScreen(),
        null !== this.selectIndex ? (this.highLight(),
        this.cameraControl.needUpdateRenderList(!0),
        this.cameraControl.update(!0),
        this.update(),
        !0) : void 0
    }
    ,
    vp.prototype.processTouchmove = function(A) {
        if (null !== this.selectIndex) {
            if (this.isRotate())
                this.rotate(A.touches[0].clientX - this.startPt.x, A.touches[0].clientY - this.startPt.y),
                this.startPt.set(A.touches[0].clientX, A.touches[0].clientY);
            else {
                this.offset((2 > this.selectIndex ? A.touches[0].clientX - this.startPt.x : A.touches[0].clientY - this.startPt.y) / this.planeDistance),
                this.startPt.set(A.touches[0].clientX, A.touches[0].clientY)
            }
            return this.cameraControl.update(!0),
            this.update(),
            !0
        }
        return yp.prototype.processTouchmove(this, A)
    }
    ,
    vp.prototype.processTouchend = function(A) {
        return this.selectIndex = null,
        this.planeDistance = 0,
        this.enablePick && (this.onUpdateUI({
            visible: !1
        }),
        this.startPt.x === A.touches[0].clientX && this.startPt.y === A.touches[0].clientY && this.pickHelper.click(A)),
        this.cameraControl.needUpdateRenderList(!0),
        this.cancelHighLight(),
        this.cameraControl.update(!0),
        this.update(),
        yp.prototype.processTouchend(this, A)
    }
    ;
    var Ip = function(A, e, t) {
        yp.call(this, Pc.COMPONENT_TRANSFORM),
        this._callbackWrapper = void 0,
        this._objectCallbackWrapper = void 0,
        this._cancelCallback = void 0,
        this.transformControl = new Ep(A,e,t),
        this.bindingComponentKey = void 0
    };
    (Ip.prototype = Object.create(yp.prototype)).constructor = Ip,
    Ip.prototype.destroy = function() {
        this.transformControl.destory()
    }
    ,
    Ip.prototype.update = function() {
        this.transformControl.updateMatrixWorld()
    }
    ,
    Ip.prototype.transformComponent = function(A, e, t, i, o) {
        if (A) {
            var n = this.transformControl;
            n.object && A !== n.object && this.cancelTransformComponent(!1),
            this._callbackWrapper && (this.transformControl.removeEventListener("change", this._callbackWrapper),
            this._callbackWrapper = void 0),
            this._objectCallbackWrapper && (this.transformControl.removeEventListener("objectChange", this._objectCallbackWrapper),
            this._objectCallbackWrapper = void 0),
            this._cancelCallback && (this._cancelCallback = void 0),
            this._pauseCallbackWrapper && (this.transformControl.removeEventListener("mouseUp", this._pauseCallbackWrapper),
            this._pauseCallbackWrapper = void 0),
            e && (this._callbackWrapper = function(A) {
                e(A)
            }
            ,
            this.transformControl.addEventListener("change", this._callbackWrapper)),
            t && (this._objectCallbackWrapper = function(A) {
                t(A)
            }
            ,
            this.transformControl.addEventListener("objectChange", this._objectCallbackWrapper)),
            i && (this._cancelCallback = i),
            o && (this._pauseCallbackWrapper = function(A) {
                o(A)
            }
            ,
            this.transformControl.addEventListener("mouseUp", this._pauseCallbackWrapper)),
            this._saveComponentOriginalTransformState(A),
            !0 !== n.showX && (n.showX = !0),
            !0 !== n.showY && (n.showY = !0),
            !0 !== n.showZ && (n.showZ = !0),
            !0 !== n.enabled && (n.enabled = !0),
            n.attach(A)
        }
    }
    ,
    Ip.prototype.cancelTransformComponent = function() {
        var A = this.transformControl.object;
        if (A)
            return this.transformControl.detach(),
            this._callbackWrapper && (this.transformControl.removeEventListener("change", this._callbackWrapper),
            this._callbackWrapper = void 0),
            this._objectCallbackWrapper && (this.transformControl.removeEventListener("objectChange", this._objectCallbackWrapper),
            this._objectCallbackWrapper = void 0),
            this._cancelCallback && (this._cancelCallback(),
            this._cancelCallback = void 0),
            this.bindingComponentKey = void 0,
            A
    }
    ,
    Ip.prototype.switchToTranslateMode = function() {
        this.transformControl.setMode("translate")
    }
    ,
    Ip.prototype.switchToRotateMode = function() {
        this.transformControl.setMode("rotate")
    }
    ,
    Ip.prototype.switchToScaleMode = function() {
        this.transformControl.setMode("scale")
    }
    ,
    Ip.prototype._saveComponentOriginalTransformState = function(A) {
        var e;
        if (A instanceof Array)
            e = A;
        else {
            if (!(A instanceof H))
                return;
            e = [A]
        }
        for (var t = 0, i = e.length; i > t; t += 1) {
            var o = e[t];
            if (!o.userData._originalTransformState) {
                var n = o.position.clone()
                  , r = o.quaternion.clone()
                  , a = o.scale.clone()
                  , s = o.matrix.clone()
                  , l = o.matrixWorld.clone();
                o.userData._originalTransformState = {
                    position: n,
                    quaternion: r,
                    scale: a,
                    matrix: s,
                    matrixWorld: l
                }
            }
        }
    }
    ,
    Ip.prototype.restoreComponentOriginalTransformState = function() {
        if (!this.transformControl.object)
            return !1;
        var A, e = this.transformControl.object;
        if (e instanceof Array)
            A = e;
        else {
            if (!(e instanceof H))
                return !1;
            A = [e]
        }
        for (var t = !1, i = 0, o = A.length; o > i; i += 1) {
            var n = A[i]
              , r = n.userData._originalTransformState;
            r && (n.position.copy(r.position),
            n.quaternion.copy(r.quaternion),
            n.scale.copy(r.scale),
            n.matrix.copy(r.matrix),
            n.matrixWorld.copy(r.matrixWorld),
            this.transformControl.updateMatrixWorld(),
            this.transformControl.dispatchEvent({
                type: "objectChange"
            }),
            t = !0)
        }
        return t
    }
    ,
    Ip.prototype.increaseTransformControlSize = function() {
        var A = this.transformControl;
        if (A.object && A.visible) {
            var e = A.size;
            if (3 > e)
                return A.setSize(e + .1),
                !0
        }
        return !1
    }
    ,
    Ip.prototype.decreaseTransformControlSize = function() {
        var A = this.transformControl;
        if (A.object && A.visible) {
            var e = A.size;
            if (e > .5)
                return A.setSize(e - .1),
                !0
        }
        return !1
    }
    ,
    Ip.prototype.setTransformSpaceToLocalSpace = function() {
        console.log("不再支持")
    }
    ,
    Ip.prototype.setTransformSpaceToWorldSpace = function() {
        console.log("不再支持")
    }
    ,
    Ip.prototype.switchTransformSpace = function() {
        console.log("不再支持")
    }
    ,
    Ip.prototype.showTransformOnAxis = function(A) {
        var e = this.transformControl;
        if (e.object && e.visible) {
            var t = !1;
            switch (A) {
            case "x":
            case "X":
                !0 !== e.showX && (t = !0,
                e.showX = !0);
                break;
            case "y":
            case "Y":
                !0 !== e.showY && (t = !0,
                e.showY = !0);
                break;
            case "z":
            case "Z":
                !0 !== e.showZ && (t = !0,
                e.showZ = !0)
            }
            return t
        }
        return !1
    }
    ,
    Ip.prototype.hideTransformOnAxis = function(A) {
        var e = this.transformControl;
        if (e.object && e.visible) {
            var t = !1;
            switch (A) {
            case "x":
            case "X":
                !1 !== e.showX && (t = !0,
                e.showX = !1);
                break;
            case "y":
            case "Y":
                !1 !== e.showY && (t = !0,
                e.showY = !1);
                break;
            case "z":
            case "Z":
                !1 !== e.showZ && (t = !0,
                e.showZ = !1)
            }
            return t
        }
        return !1
    }
    ,
    Ip.prototype.disableTransform = function() {
        var A = this.transformControl;
        return !(!A.object || !A.visible || !1 === A.enabled) && (A.enabled = !1,
        !0)
    }
    ,
    Ip.prototype.enableTransform = function() {
        var A = this.transformControl;
        return !(!A.object || !A.visible || !0 === A.enabled) && (A.enabled = !0,
        !0)
    }
    ,
    Ip.prototype.processMouseDown = function(A) {
        return !!this.transformControl.enabled && (!!this.transformControl.mouseHover(A) && this.transformControl.mouseDown(A))
    }
    ,
    Ip.prototype.processMouseMove = function(A) {
        return !!this.transformControl.enabled && this.transformControl.mouseMove(A)
    }
    ,
    Ip.prototype.processMouseUp = function(A) {
        return !!this.transformControl.enabled && this.transformControl.mouseUp(A)
    }
    ,
    Ip.prototype.processHover = function(A) {
        return !!this.transformControl.enabled && this.transformControl.mouseHover(A)
    }
    ,
    Ip.onExit = function() {
        this.destroy()
    }
    ;
    var Ep = function(A, e, t) {
        H.call(this),
        t = void 0 !== t ? t : document,
        this.scene = A,
        this.visible = !1;
        var i = new Bp;
        this.add(i);
        var o = new xp;
        this.add(o);
        var n = this;
        N("camera", e),
        N("object", void 0),
        N("enabled", !0),
        N("axis", null),
        N("mode", "translate"),
        N("translationSnap", null),
        N("rotationSnap", null),
        N("space", "world"),
        N("size", 1),
        N("dragging", !1),
        N("showX", !0),
        N("showY", !0),
        N("showZ", !0);
        var r = {
            type: "change"
        }
          , a = {
            type: "mouseDown"
        }
          , s = {
            type: "mouseUp",
            mode: n.mode
        }
          , l = {
            type: "objectChange"
        }
          , c = new Dd
          , h = new y
          , d = new y
          , p = new f
          , g = {
            X: new y(1,0,0),
            Y: new y(0,1,0),
            Z: new y(0,0,1)
        }
          , u = new y
          , m = new y
          , C = new y
          , v = new y
          , I = new y
          , E = new y
          , B = 0
          , x = new y
          , S = new f
          , w = new y
          , b = new y
          , U = new f
          , F = new f
          , K = new y(1,1,1)
          , Q = new y
          , R = new y
          , T = new f
          , k = new f
          , D = new y
          , L = new y;
        function N(A, e) {
            var t = e;
            Object.defineProperty(n, A, {
                get: function() {
                    return void 0 !== t ? t : e
                },
                set: function(e) {
                    t !== e && (t = e,
                    o[A] = e,
                    i[A] = e,
                    n.dispatchEvent({
                        type: A + "-changed",
                        value: e
                    }),
                    n.dispatchEvent(r))
                }
            }),
            n[A] = e,
            o[A] = e,
            i[A] = e
        }
        function O(A) {
            var e = A.changedTouches ? A.changedTouches[0] : A
              , i = t.getBoundingClientRect();
            return {
                x: (e.clientX - i.left) / i.width * 2 - 1,
                y: -(e.clientY - i.top) / i.height * 2 + 1,
                button: A.button
            }
        }
        N("worldPosition", R),
        N("worldPositionStart", Q),
        N("worldQuaternion", T),
        N("cameraPosition", x),
        N("cameraQuaternion", S),
        N("pointStart", u),
        N("pointEnd", m),
        N("rotationAxis", v),
        N("rotationAngle", B),
        N("eye", L),
        this.attach = function(e) {
            e && (this.object !== e && (this.scene.add(this),
            A.componentTransformControl = this,
            this.object = e,
            r.object = e,
            l.object = e,
            this.updateMatrixWorld()),
            this.visible = !0)
        }
        ,
        this.detach = function() {
            this.object && (this.object = void 0,
            r.object = void 0),
            this.parent && this.parent.remove(this),
            this.scene.componentTransformControl = void 0
        }
        ,
        this.destory = function() {
            this.scene.componentTransformControl = void 0,
            this.scene = void 0,
            this.axis = void 0,
            this.camera = void 0
        }
        ,
        this.updateMatrixWorld = function() {
            if (void 0 !== this.object) {
                var A, e = new aA;
                if (this.object instanceof Array)
                    A = this.object;
                else {
                    if (!(this.object instanceof H))
                        return;
                    A = [this.object]
                }
                for (var t = 0, i = A.length; i > t; t += 1) {
                    var o = A[t];
                    if (o.geometry)
                        e.expandByObject(A[t]);
                    else {
                        var n = new y;
                        o.getWorldPosition(n),
                        e.expandByPoint(n)
                    }
                }
                A[0].parent && A[0].parent.matrixWorld.decompose(b, U, K),
                A[0].matrixWorld.decompose(R, T, D),
                e.getCenter(R),
                F.copy(U).inverse(),
                k.copy(T).inverse()
            }
            this.camera.updateMatrixWorld(),
            this.camera.matrixWorld.decompose(x, S, w),
            this.camera instanceof je ? L.copy(x).sub(R).normalize() : this.camera instanceof Ka ? L.copy(x).normalize() : this.camera instanceof kd && (this.camera.isPerspective ? L.copy(x).sub(R).normalize() : L.copy(x).normalize()),
            H.prototype.updateMatrixWorld.call(this)
        }
        ,
        this.mouseHover = function(A) {
            var e = O(A);
            if (void 0 === this.object || !0 === this.dragging || void 0 !== e.button && 0 !== e.button)
                return !1;
            c.setFromCamera(e, this.camera);
            var t, o = c.intersectObjects(i.picker[this.mode].children, !0) || !1;
            return o ? (this.axis = o.object.name,
            t = !0) : (this.axis = null,
            t = !1),
            this.updateMatrixWorld(),
            t
        }
        ,
        this.mouseDown = function(A) {
            var e = O(A);
            if (void 0 === this.object || !0 === this.dragging || void 0 !== e.button && 0 !== e.button)
                return !1;
            if ((0 === e.button || void 0 === e.button) && null !== this.axis) {
                c.setFromCamera(e, this.camera);
                var t = c.intersectObjects([o], !0) || !1;
                return !1 !== t && (t && (Q.copy(R),
                u.copy(t.point).sub(Q)),
                this.dragging = !0,
                a.mode = this.mode,
                this.dispatchEvent(a),
                !0)
            }
        }
        ,
        this.mouseMove = function(A) {
            var e = O(A)
              , t = this.axis
              , i = this.mode
              , n = void 0;
            if (void 0 === this.object || null === t || !1 === this.dragging || void 0 !== e.button && 0 !== e.button)
                return !1;
            c.setFromCamera(e, this.camera);
            var a = c.intersectObjects([o], !0) || !1;
            if (!1 === a)
                return !1;
            if (m.copy(a.point).sub(Q),
            "translate" === i)
                C.copy(m).sub(u),
                -1 === t.indexOf("X") && (C.x = 0),
                -1 === t.indexOf("Y") && (C.y = 0),
                -1 === t.indexOf("Z") && (C.z = 0),
                C.applyQuaternion(F).divide(K),
                0 === C.x && 0 === C.y && 0 === C.z || (n = this._translateCurrentObject(C));
            else if ("scale" === i) {
                if (-1 !== t.search("XYZ")) {
                    var s = m.length() / u.length();
                    0 > m.dot(u) && (s *= -1),
                    d.set(s, s, s)
                } else
                    h.copy(u),
                    d.copy(m),
                    h.applyQuaternion(k),
                    d.applyQuaternion(k),
                    d.divide(h),
                    -1 === t.search("X") && (d.x = 1),
                    -1 === t.search("Y") && (d.y = 1),
                    -1 === t.search("Z") && (d.z = 1);
                1 === d.x && 1 === d.y && 1 === d.z || (n = this._scaleCurrentObject(d))
            } else if ("rotate" === i) {
                C.copy(m).sub(u);
                var y = 20 / R.distanceTo(h.setFromMatrixPosition(this.camera.matrixWorld));
                if ("E" === t ? (v.copy(L),
                B = m.angleTo(u),
                I.copy(u).normalize(),
                E.copy(m).normalize(),
                B *= 0 > E.cross(I).dot(L) ? 1 : -1) : "XYZE" === t ? (v.copy(C).cross(L).normalize(),
                B = C.dot(h.copy(v).cross(this.eye)) * y) : "X" !== t && "Y" !== t && "Z" !== t || (v.copy(g[t]),
                h.copy(g[t]),
                B = C.dot(h.cross(L).normalize()) * y),
                this.rotationAngle = B,
                0 !== B) {
                    var x = new f;
                    v.applyQuaternion(F),
                    x.copy(p.setFromAxisAngle(v, B)),
                    x.normalize(),
                    n = this._rotateCurrentObject(x)
                }
            }
            return n ? (this.updateMatrixWorld(),
            this.dispatchEvent(r),
            l.matrix = n.clone(),
            this.dispatchEvent(l),
            u.copy(m),
            !0) : void 0
        }
        ,
        this.mouseUp = function(A) {
            var e = O(A);
            return (void 0 === e.button || 0 === e.button) && (this.dragging && null !== this.axis && (s.mode = this.mode,
            this.dispatchEvent(s)),
            this.dragging = !1,
            void 0 === e.button && (this.axis = null),
            !0)
        }
        ,
        this.getMode = function() {
            return n.mode
        }
        ,
        this.setMode = function(A) {
            n.mode = A,
            this.updateMatrixWorld()
        }
        ,
        this.setTranslationSnap = function(A) {
            n.translationSnap = A
        }
        ,
        this.setRotationSnap = function(A) {
            n.rotationSnap = A
        }
        ,
        this.setSize = function(A) {
            n.size = A
        }
        ,
        this.setSpace = function(A) {
            n.space = A
        }
        ,
        this.getBoundingBox = function() {
            return i.getBoundingBox()
        }
        ,
        this._scaleCurrentObject = function() {
            var A = new M
              , e = new M
              , t = new M
              , i = new M
              , o = new y;
            return function(n) {
                var r;
                if (this.object instanceof Array)
                    r = this.object;
                else {
                    if (!(this.object instanceof H))
                        return;
                    r = [this.object]
                }
                for (var a = 0, s = r.length; s > a; a += 1) {
                    var l = r[a];
                    l.geometry ? (l.geometry.boundingBox || l.geometry.computeBoundingBox(),
                    l.geometry.boundingBox.getCenter(o),
                    o.applyMatrix4(l.matrix)) : o.copy(l.position),
                    e.makeTranslation(-o.x, -o.y, -o.z),
                    t.makeScale(n.x, n.y, n.z),
                    i.makeTranslation(o.x, o.y, o.z),
                    A.identity(),
                    A.multiply(i),
                    A.multiply(t),
                    A.multiply(e);
                    var c = l.matrixAutoUpdate;
                    l.matrixAutoUpdate = !1,
                    l.applyMatrix4(A),
                    l.updateMatrixWorld(!0),
                    l.matrixAutoUpdate = c
                }
                return A
            }
        }(),
        this._rotateCurrentObject = function() {
            var A = new M
              , e = new M
              , t = new M
              , i = new M
              , o = new y;
            return function(n) {
                var r;
                if (this.object instanceof Array)
                    r = this.object;
                else {
                    if (!(this.object instanceof H))
                        return;
                    r = [this.object]
                }
                for (var a = 0, s = r.length; s > a; a += 1) {
                    var l = r[a];
                    l.geometry ? (l.geometry.boundingBox || l.geometry.computeBoundingBox(),
                    l.geometry.boundingBox.getCenter(o),
                    o.applyMatrix4(l.matrix)) : o.copy(l.position),
                    A.makeTranslation(-o.x, -o.y, -o.z),
                    e.makeRotationFromQuaternion(n),
                    t.makeTranslation(o.x, o.y, o.z),
                    i.identity(),
                    i.multiply(t),
                    i.multiply(e),
                    i.multiply(A);
                    var c = l.matrixAutoUpdate;
                    l.matrixAutoUpdate = !1,
                    l.applyMatrix4(i),
                    l.matrixAutoUpdate = c,
                    l.updateMatrixWorld(!0)
                }
                return i
            }
        }(),
        this._translateCurrentObject = function() {
            var A = new M;
            return function(e) {
                var t;
                if (this.object instanceof Array)
                    t = this.object;
                else {
                    if (!(this.object instanceof H))
                        return;
                    t = [this.object]
                }
                A.makeTranslation(e.x, e.y, e.z);
                for (var i = 0, o = t.length; o > i; i += 1) {
                    var n = t[i]
                      , r = n.matrixAutoUpdate;
                    n.matrixAutoUpdate = !1,
                    n.applyMatrix4(A),
                    n.matrixAutoUpdate = r,
                    n.updateMatrixWorld(!0)
                }
                return A
            }
        }()
    };
    Ep.prototype = Object.assign(Object.create(H.prototype), {
        constructor: Ep,
        isTransformControls: !0
    });
    var Bp = function() {
        H.call(this),
        this.type = "TransformControlsGizmo";
        var A = new jA({
            depthTest: !1,
            depthWrite: !1,
            transparent: !0,
            side: 2,
            fog: !1
        })
          , e = new ko({
            depthTest: !1,
            depthWrite: !1,
            transparent: !0,
            linewidth: 1,
            fog: !1
        })
          , t = A.clone();
        t.opacity = .15;
        var i = A.clone();
        i.opacity = .33;
        var o = A.clone();
        o.color.set(16711680);
        var n = A.clone();
        n.color.set(65280);
        var r = A.clone();
        r.color.set(255);
        var a = A.clone();
        a.opacity = .25;
        var s = a.clone();
        s.color.set(16776960);
        var l = a.clone();
        l.color.set(65535);
        var c = a.clone();
        c.color.set(16711935),
        A.clone().color.set(16776960);
        var h = e.clone();
        h.color.set(16711680);
        var d = e.clone();
        d.color.set(65280);
        var p = e.clone();
        p.color.set(255);
        var g = e.clone();
        g.color.set(65535);
        var u = e.clone();
        u.color.set(16711935);
        var m = e.clone();
        m.color.set(16776960);
        var C = e.clone();
        C.color.set(7895160);
        var v = m.clone();
        v.opacity = .25;
        var I = new hr(0,.05,.2,12,1,!1)
          , E = new Ne(.125,.125,.125)
          , B = new he;
        B.setAttribute("position", new Ae([0, 0, 0, 1, 0, 0],3));
        var x, S = function(A, e) {
            for (var t = new he, i = [], o = 0; 64 * e >= o; ++o)
                i.push(0, Math.cos(o / 32 * Math.PI) * A, Math.sin(o / 32 * Math.PI) * A);
            return t.setAttribute("position", new Ae(i,3)),
            t
        }, w = {
            X: [[new Ue(I,o), [1, 0, 0], [0, 0, -Math.PI / 2], null, "fwd"], [new Ue(I,o), [1, 0, 0], [0, 0, Math.PI / 2], null, "bwd"], [new Go(B,h)]],
            Y: [[new Ue(I,n), [0, 1, 0], null, null, "fwd"], [new Ue(I,n), [0, 1, 0], [Math.PI, 0, 0], null, "bwd"], [new Go(B,d), null, [0, 0, Math.PI / 2]]],
            Z: [[new Ue(I,r), [0, 0, 1], [Math.PI / 2, 0, 0], null, "fwd"], [new Ue(I,r), [0, 0, 1], [-Math.PI / 2, 0, 0], null, "bwd"], [new Go(B,p), null, [0, -Math.PI / 2, 0]]],
            XYZ: [[new Ue(new dn(.1,0),a), [0, 0, 0], [0, 0, 0]]],
            XY: [[new Ue(new et(.295,.295),s), [.15, .15, 0]], [new Go(B,m), [.18, .3, 0], null, [.125, 1, 1]], [new Go(B,m), [.3, .18, 0], [0, 0, Math.PI / 2], [.125, 1, 1]]],
            YZ: [[new Ue(new et(.295,.295),l), [0, .15, .15], [0, Math.PI / 2, 0]], [new Go(B,g), [0, .18, .3], [0, 0, Math.PI / 2], [.125, 1, 1]], [new Go(B,g), [0, .3, .18], [0, -Math.PI / 2, 0], [.125, 1, 1]]],
            XZ: [[new Ue(new et(.295,.295),c), [.15, 0, .15], [-Math.PI / 2, 0, 0]], [new Go(B,u), [.18, 0, .3], null, [.125, 1, 1]], [new Go(B,u), [.3, 0, .18], [0, -Math.PI / 2, 0], [.125, 1, 1]]]
        }, b = {
            X: [[new Ue(new hr(.2,0,1,4,1,!1),t), [.6, 0, 0], [0, 0, -Math.PI / 2]]],
            Y: [[new Ue(new hr(.2,0,1,4,1,!1),t), [0, .6, 0]]],
            Z: [[new Ue(new hr(.2,0,1,4,1,!1),t), [0, 0, .6], [Math.PI / 2, 0, 0]]],
            XYZ: [[new Ue(new dn(.2,0),t)]],
            XY: [[new Ue(new et(.4,.4),t), [.2, .2, 0]]],
            YZ: [[new Ue(new et(.4,.4),t), [0, .2, .2], [0, Math.PI / 2, 0]]],
            XZ: [[new Ue(new et(.4,.4),t), [.2, 0, .2], [-Math.PI / 2, 0, 0]]]
        }, U = {
            START: [[new Ue(new dn(.01,2),i), null, null, null, "helper"]],
            END: [[new Ue(new dn(.01,2),i), null, null, null, "helper"]],
            DELTA: [[new Go((x = new he,
            x.setAttribute("position", new Ae([0, 0, 0, 1, 1, 1],3)),
            x),i), null, null, null, "helper"]],
            X: [[new Go(B,i.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
            Y: [[new Go(B,i.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
            Z: [[new Go(B,i.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
        }, K = {
            X: [[new Go(S(1, .5),h)], [new Ue(new dn(.04,0),o), [0, 0, .99], null, [1, 3, 1]]],
            Y: [[new Go(S(1, .5),d), null, [0, 0, -Math.PI / 2]], [new Ue(new dn(.04,0),n), [0, 0, .99], null, [3, 1, 1]]],
            Z: [[new Go(S(1, .5),p), null, [0, Math.PI / 2, 0]], [new Ue(new dn(.04,0),r), [.99, 0, 0], null, [1, 3, 1]]],
            E: [[new Go(S(1.25, 1),v), null, [0, Math.PI / 2, 0]], [new Ue(new hr(.03,0,.15,4,1,!1),v), [1.17, 0, 0], [0, 0, -Math.PI / 2], [1, 1, .001]], [new Ue(new hr(.03,0,.15,4,1,!1),v), [-1.17, 0, 0], [0, 0, Math.PI / 2], [1, 1, .001]], [new Ue(new hr(.03,0,.15,4,1,!1),v), [0, -1.17, 0], [Math.PI, 0, 0], [1, 1, .001]], [new Ue(new hr(.03,0,.15,4,1,!1),v), [0, 1.17, 0], [0, 0, 0], [1, 1, .001]]],
            XYZE: [[new Go(S(1, 1),C), null, [0, Math.PI / 2, 0]]]
        }, Q = {
            AXIS: [[new Go(B,i.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]]
        }, R = {
            X: [[new Ue(new En(1,.1,4,24),t), [0, 0, 0], [0, -Math.PI / 2, -Math.PI / 2]]],
            Y: [[new Ue(new En(1,.1,4,24),t), [0, 0, 0], [Math.PI / 2, 0, 0]]],
            Z: [[new Ue(new En(1,.1,4,24),t), [0, 0, 0], [0, 0, -Math.PI / 2]]],
            E: [[new Ue(new En(1.25,.1,2,24),t)]],
            XYZE: [[new Ue(new er(.7,10,8),t)]]
        }, T = {
            X: [[new Ue(E,o), [.8, 0, 0], [0, 0, -Math.PI / 2]], [new Go(B,h), null, null, [.8, 1, 1]]],
            Y: [[new Ue(E,n), [0, .8, 0]], [new Go(B,d), null, [0, 0, Math.PI / 2], [.8, 1, 1]]],
            Z: [[new Ue(E,r), [0, 0, .8], [Math.PI / 2, 0, 0]], [new Go(B,p), null, [0, -Math.PI / 2, 0], [.8, 1, 1]]],
            XY: [[new Ue(E,s), [.85, .85, 0], null, [2, 2, .2]], [new Go(B,m), [.855, .98, 0], null, [.125, 1, 1]], [new Go(B,m), [.98, .855, 0], [0, 0, Math.PI / 2], [.125, 1, 1]]],
            YZ: [[new Ue(E,l), [0, .85, .85], null, [.2, 2, 2]], [new Go(B,g), [0, .855, .98], [0, 0, Math.PI / 2], [.125, 1, 1]], [new Go(B,g), [0, .98, .855], [0, -Math.PI / 2, 0], [.125, 1, 1]]],
            XZ: [[new Ue(E,c), [.85, 0, .85], null, [2, .2, 2]], [new Go(B,u), [.855, 0, .98], null, [.125, 1, 1]], [new Go(B,u), [.98, 0, .855], [0, -Math.PI / 2, 0], [.125, 1, 1]]],
            XYZX: [[new Ue(new Ne(.125,.125,.125),a), [1.1, 0, 0]]],
            XYZY: [[new Ue(new Ne(.125,.125,.125),a), [0, 1.1, 0]]],
            XYZZ: [[new Ue(new Ne(.125,.125,.125),a), [0, 0, 1.1]]]
        }, k = {
            X: [[new Ue(new hr(.2,0,.8,4,1,!1),t), [.5, 0, 0], [0, 0, -Math.PI / 2]]],
            Y: [[new Ue(new hr(.2,0,.8,4,1,!1),t), [0, .5, 0]]],
            Z: [[new Ue(new hr(.2,0,.8,4,1,!1),t), [0, 0, .5], [Math.PI / 2, 0, 0]]],
            XY: [[new Ue(E,t), [.85, .85, 0], null, [3, 3, .2]]],
            YZ: [[new Ue(E,t), [0, .85, .85], null, [.2, 3, 3]]],
            XZ: [[new Ue(E,t), [.85, 0, .85], null, [3, .2, 3]]],
            XYZX: [[new Ue(new Ne(.2,.2,.2),t), [1.1, 0, 0]]],
            XYZY: [[new Ue(new Ne(.2,.2,.2),t), [0, 1.1, 0]]],
            XYZZ: [[new Ue(new Ne(.2,.2,.2),t), [0, 0, 1.1]]]
        }, D = {
            X: [[new Go(B,i.clone()), [-1e3, 0, 0], null, [1e6, 1, 1], "helper"]],
            Y: [[new Go(B,i.clone()), [0, -1e3, 0], [0, 0, Math.PI / 2], [1e6, 1, 1], "helper"]],
            Z: [[new Go(B,i.clone()), [0, 0, -1e3], [0, -Math.PI / 2, 0], [1e6, 1, 1], "helper"]]
        }, L = function(A) {
            var e = new H;
            for (var t in A)
                for (var i = A[t].length; i--; ) {
                    var o = A[t][i][0].clone()
                      , n = A[t][i][1]
                      , r = A[t][i][2]
                      , a = A[t][i][3]
                      , s = A[t][i][4];
                    o.name = t,
                    o.tag = s,
                    n && o.position.set(n[0], n[1], n[2]),
                    r && o.rotation.set(r[0], r[1], r[2]),
                    a && o.scale.set(a[0], a[1], a[2]),
                    o.updateMatrix();
                    var l = o.geometry.clone();
                    l.applyMatrix4(o.matrix),
                    o.geometry = l,
                    o.renderOrder = 1 / 0,
                    o.position.set(0, 0, 0),
                    o.rotation.set(0, 0, 0),
                    o.scale.set(1, 1, 1),
                    e.add(o)
                }
            return e
        }, N = new F, O = new y(0,1,0), V = new y(0,0,0), G = new M, P = new f, q = new f, j = new f, Y = new y(1,0,0), W = new y(0,1,0), J = new y(0,0,1);
        this.gizmo = {},
        this.picker = {},
        this.helper = {},
        this.add(this.gizmo.translate = L(w)),
        this.add(this.gizmo.rotate = L(K)),
        this.add(this.gizmo.scale = L(T)),
        this.add(this.picker.translate = L(b)),
        this.add(this.picker.rotate = L(R)),
        this.add(this.picker.scale = L(k)),
        this.add(this.helper.translate = L(U)),
        this.add(this.helper.rotate = L(Q)),
        this.add(this.helper.scale = L(D)),
        this.picker.translate.visible = !1,
        this.picker.rotate.visible = !1,
        this.picker.scale.visible = !1,
        this.updateMatrixWorld = function() {
            var A = this.space;
            "scale" === this.mode && (A = "local");
            var e = "local" === A ? this.worldQuaternion : j;
            this.gizmo.translate.visible = "translate" === this.mode,
            this.gizmo.rotate.visible = "rotate" === this.mode,
            this.gizmo.scale.visible = "scale" === this.mode,
            this.helper.translate.visible = "translate" === this.mode,
            this.helper.rotate.visible = "rotate" === this.mode,
            this.helper.scale.visible = "scale" === this.mode;
            var t = [];
            t = (t = (t = t.concat(this.picker[this.mode].children)).concat(this.gizmo[this.mode].children)).concat(this.helper[this.mode].children);
            for (var i = this.boundingBox ? this.boundingBox.makeEmpty() : new aA, o = 0; t.length > o; o++) {
                var n = t[o];
                n.visible = !0,
                n.rotation.set(0, 0, 0),
                n.position.copy(this.worldPosition);
                var r = this.worldPosition.distanceTo(this.cameraPosition);
                if (n.scale.set(1, 1, 1).multiplyScalar(r * this.size / 7),
                "helper" !== n.tag) {
                    if (n.quaternion.copy(e),
                    "translate" === this.mode || "scale" === this.mode) {
                        "X" !== n.name && "XYZX" !== n.name || Math.abs(O.copy(Y).applyQuaternion(e).dot(this.eye)) > .99 && (n.scale.set(1e-10, 1e-10, 1e-10),
                        n.visible = !1),
                        "Y" !== n.name && "XYZY" !== n.name || Math.abs(O.copy(W).applyQuaternion(e).dot(this.eye)) > .99 && (n.scale.set(1e-10, 1e-10, 1e-10),
                        n.visible = !1),
                        "Z" !== n.name && "XYZZ" !== n.name || Math.abs(O.copy(J).applyQuaternion(e).dot(this.eye)) > .99 && (n.scale.set(1e-10, 1e-10, 1e-10),
                        n.visible = !1),
                        "XY" === n.name && .2 > Math.abs(O.copy(J).applyQuaternion(e).dot(this.eye)) && (n.scale.set(1e-10, 1e-10, 1e-10),
                        n.visible = !1),
                        "YZ" === n.name && .2 > Math.abs(O.copy(Y).applyQuaternion(e).dot(this.eye)) && (n.scale.set(1e-10, 1e-10, 1e-10),
                        n.visible = !1),
                        "XZ" === n.name && .2 > Math.abs(O.copy(W).applyQuaternion(e).dot(this.eye)) && (n.scale.set(1e-10, 1e-10, 1e-10),
                        n.visible = !1),
                        -1 !== n.name.search("X") && (0 > O.copy(Y).applyQuaternion(e).dot(this.eye) ? "fwd" === n.tag ? n.visible = !1 : n.scale.x *= -1 : "bwd" === n.tag && (n.visible = !1)),
                        -1 !== n.name.search("Y") && (0 > O.copy(W).applyQuaternion(e).dot(this.eye) ? "fwd" === n.tag ? n.visible = !1 : n.scale.y *= -1 : "bwd" === n.tag && (n.visible = !1)),
                        -1 !== n.name.search("Z") && (0 > O.copy(J).applyQuaternion(e).dot(this.eye) ? "fwd" === n.tag ? n.visible = !1 : n.scale.z *= -1 : "bwd" === n.tag && (n.visible = !1))
                    } else
                        "rotate" === this.mode && (q.copy(e),
                        O.copy(this.eye).applyQuaternion(P.copy(e).inverse()),
                        -1 !== n.name.search("E") && n.quaternion.setFromRotationMatrix(G.lookAt(this.eye, V, W)),
                        "X" === n.name && (P.setFromAxisAngle(Y, Math.atan2(-O.y, O.z)),
                        P.multiplyQuaternions(q, P),
                        n.quaternion.copy(P)),
                        "Y" === n.name && (P.setFromAxisAngle(W, Math.atan2(O.x, O.z)),
                        P.multiplyQuaternions(q, P),
                        n.quaternion.copy(P)),
                        "Z" === n.name && (P.setFromAxisAngle(J, Math.atan2(O.y, O.x)),
                        P.multiplyQuaternions(q, P),
                        n.quaternion.copy(P)));
                    n.visible = n.visible && (-1 === n.name.indexOf("X") || this.showX),
                    n.visible = n.visible && (-1 === n.name.indexOf("Y") || this.showY),
                    n.visible = n.visible && (-1 === n.name.indexOf("Z") || this.showZ),
                    n.visible = n.visible && (-1 === n.name.indexOf("E") || this.showX && this.showY && this.showZ),
                    n.material._opacity = n.material._opacity || n.material.opacity,
                    n.material._color = n.material._color || n.material.color.clone(),
                    n.material.color.copy(n.material._color),
                    n.material.opacity = n.material._opacity,
                    this.enabled ? this.axis && (n.name === this.axis || this.axis.split("").some((function(A) {
                        return n.name === A
                    }
                    )) ? (n.material.opacity = 1,
                    n.material.color.lerp(new LA(1,1,1), .5)) : (n.material.opacity *= .25,
                    n.material.color.lerp(new LA(1,1,1), .5))) : (n.material.opacity *= .5,
                    n.material.color.lerp(new LA(1,1,1), .5)),
                    i.expandByObject(n)
                } else if (n.visible = !1,
                "AXIS" === n.name)
                    n.position.copy(this.worldPositionStart),
                    n.visible = !!this.axis,
                    "X" === this.axis && (P.setFromEuler(N.set(0, 0, 0)),
                    n.quaternion.copy(e).multiply(P),
                    Math.abs(O.copy(Y).applyQuaternion(e).dot(this.eye)) > .9 && (n.visible = !1)),
                    "Y" === this.axis && (P.setFromEuler(N.set(0, 0, Math.PI / 2)),
                    n.quaternion.copy(e).multiply(P),
                    Math.abs(O.copy(W).applyQuaternion(e).dot(this.eye)) > .9 && (n.visible = !1)),
                    "Z" === this.axis && (P.setFromEuler(N.set(0, Math.PI / 2, 0)),
                    n.quaternion.copy(e).multiply(P),
                    Math.abs(O.copy(J).applyQuaternion(e).dot(this.eye)) > .9 && (n.visible = !1)),
                    "XYZE" === this.axis && (P.setFromEuler(N.set(0, Math.PI / 2, 0)),
                    O.copy(this.rotationAxis),
                    n.quaternion.setFromRotationMatrix(G.lookAt(V, O, W)),
                    n.quaternion.multiply(P),
                    n.visible = this.dragging),
                    "E" === this.axis && (n.visible = !1);
                else if ("START" === n.name)
                    n.position.copy(this.worldPositionStart),
                    n.visible = this.dragging;
                else if ("END" === n.name)
                    n.position.copy(this.worldPosition),
                    n.visible = this.dragging;
                else if ("DELTA" === n.name) {
                    n.position.set(0, 0, 0),
                    n.scale.set(1, 1, 1);
                    var a = n.geometry.getAttribute("position");
                    a.setXYZ(0, this.worldPositionStart.x, this.worldPositionStart.y, this.worldPositionStart.z),
                    a.setXYZ(1, this.worldPosition.x, this.worldPosition.y, this.worldPosition.z),
                    a.needsUpdate = !0,
                    n.visible = this.dragging
                } else
                    n.quaternion.copy(e),
                    n.position.copy(this.dragging ? this.worldPositionStart : this.worldPosition),
                    this.axis && (n.visible = -1 !== this.axis.search(n.name))
            }
            this.boundingBox = i,
            H.prototype.updateMatrixWorld.call(this)
        }
        ,
        this.getBoundingBox = function() {
            return this.boundingBox || this.updateMatrixWorld(),
            this.boundingBox
        }
    };
    Bp.prototype = Object.assign(Object.create(H.prototype), {
        constructor: Bp,
        isTransformControlsGizmo: !0
    });
    var xp = function() {
        Ue.call(this, new et(4,4,2,2), new jA({
            visible: !1,
            wireframe: !0,
            side: 2,
            transparent: !0,
            opacity: .1
        })),
        this.type = "TransformControlsPlane";
        var A = new y(1,0,0)
          , e = new y(0,1,0)
          , t = new y(0,0,1)
          , i = new y
          , o = new y
          , n = new y
          , r = new M
          , a = new f;
        this.updateMatrixWorld = function() {
            var s = this.space;
            switch (this.position.copy(this.worldPosition),
            "scale" === this.mode && (s = "local"),
            A.set(1, 0, 0).applyQuaternion("local" === s ? this.worldQuaternion : a),
            e.set(0, 1, 0).applyQuaternion("local" === s ? this.worldQuaternion : a),
            t.set(0, 0, 1).applyQuaternion("local" === s ? this.worldQuaternion : a),
            n.copy(e),
            this.mode) {
            case "translate":
            case "scale":
                switch (this.axis) {
                case "X":
                    n.copy(this.eye).cross(A),
                    o.copy(A).cross(n);
                    break;
                case "Y":
                    n.copy(this.eye).cross(e),
                    o.copy(e).cross(n);
                    break;
                case "Z":
                    n.copy(this.eye).cross(t),
                    o.copy(t).cross(n);
                    break;
                case "XY":
                    o.copy(t);
                    break;
                case "YZ":
                    o.copy(A);
                    break;
                case "XZ":
                    n.copy(t),
                    o.copy(e);
                    break;
                case "XYZ":
                case "E":
                    o.set(0, 0, 0)
                }
                break;
            case "rotate":
            default:
                o.set(0, 0, 0)
            }
            0 === o.length() ? this.quaternion.copy(this.cameraQuaternion) : (r.lookAt(i.set(0, 0, 0), o, n),
            this.quaternion.setFromRotationMatrix(r));
            var l = this.worldPosition.distanceTo(this.cameraPosition);
            this.scale.set(1, 1, 1).multiplyScalar(l * this.size / 7),
            H.prototype.updateMatrixWorld.call(this)
        }
    };
    xp.prototype = Object.assign(Object.create(Ue.prototype), {
        constructor: xp,
        isTransformControlsPlane: !0
    });
    var Sp = function(A) {
        yp.call(this, Pc.CLIP_FILL),
        this.viewer = A,
        this.scene = A.getScene(),
        this.enablePick = !1,
        this.rotX = !0,
        this.onClipPlane = !1,
        this.cameraControl = A.cameraControl,
        this.startPt = new s,
        this.endPt = new s,
        this.frustum = new Ze,
        this.modelManager = this.cameraControl.viewer.modelManager;
        var e = this.scene.getFillClipPlane();
        e.updateClippingParams = function(e) {
            if (0 === e.iClipPlane.value)
                A.getRenderer().clippingPlanes = Object.freeze([]);
            else {
                var t = [new EA]
                  , i = e.vClipPlane.value[0]
                  , o = t[0];
                o.setComponents(-i.x, -i.y, -i.z, -i.w),
                o.normalize(),
                A.getRenderer().clippingPlanes = t,
                this.renderClipPlane = new EA,
                this.renderClipPlane.setComponents(i.x, i.y, i.z, -i.w),
                this.renderClipPlane.normalize(),
                this.calculateFillClipBoundingBox(o.coplanarPoint(new y))
            }
        }
        ,
        e.init(),
        this.planeDistance = 0,
        this.offsetSpeed = .02,
        this.toggle = function(A, t) {
            e.enable(A, t),
            e.update()
        }
        ,
        this.visible = function(A) {
            e.visible = A,
            e.update()
        }
        ,
        this.rotatable = function(A) {
            e.rotatable = A,
            e.update()
        }
        ,
        this.hit = function() {
            return e.hit
        }
        ,
        this.pointToScreen = function(A) {
            var e = this.cameraControl.camera
              , t = new M;
            t.multiplyMatrices(e.projectionMatrix, e.matrixWorldInverse);
            var i = new p(A.x,A.y,A.z,1);
            i.applyMatrix4(t);
            var o = new s;
            o.x = (i.x / i.w + 1) / 2,
            o.y = 1 - (i.y / i.w + 1) / 2;
            var n = this.cameraControl.getContainerDimensions();
            return o.x = o.x * n.width + n.left,
            o.y = o.y * n.height + n.top,
            o
        }
        ,
        this.getPlaneDistanceInScreen = function() {
            if (null === this.selectIndex)
                return null;
            if (2 > this.selectIndex) {
                var A = e.clipPlanes.center.clone()
                  , t = e.clipPlanes.center.clone();
                A.x -= e.clipPlanes.cubeSize.x,
                t.x += e.clipPlanes.cubeSize.x;
                var i = this.pointToScreen(A)
                  , o = this.pointToScreen(t);
                return i.x - o.x
            }
            var n = e.clipPlanes.center.clone()
              , r = e.clipPlanes.center.clone();
            r.y -= e.clipPlanes.cubeSize.y,
            n.y += e.clipPlanes.cubeSize.y;
            var a = this.pointToScreen(r)
              , s = this.pointToScreen(n);
            return a.y - s.y
        }
        ,
        this.getPickPoint = function(A, e) {
            var t = this.cameraControl.camera
              , i = this.cameraControl.getContainerDimensions()
              , o = (A - i.left) / i.width * 2 - 1
              , n = (i.height - (e - i.top)) / i.height * 2 - 1
              , r = new Dd;
            return r.setFromCamera(new s(o,n), t),
            r.ray.intersectPlane(this.plane)
        }
        ,
        this._isVisible = function() {
            return e.visible
        }
        ,
        this.isRotate = function() {
            return e.rotatable
        }
        ,
        this.offset = function(A) {
            e.offset(A)
        }
        ,
        this.setOffset = function(A) {
            e.setOffset(A)
        }
        ,
        this.rotate = function(A, t) {
            this.rotX ? e.rotX(t / 180 * Math.PI * .1) : e.rotY(A / 180 * Math.PI * .1)
        }
        ,
        this.rotateAngleOffset = function(A, t) {
            e.rotateAngleOffset(A, t)
        }
        ,
        this.setRotateAngle = function(A, t) {
            e.setRotateAngle(A, t)
        }
        ,
        this.getRotateAngle = function() {
            return e.getRotateAngle()
        }
        ,
        this.changeNormal = function(A) {
            e.changeNormal(A)
        }
        ,
        this.update = function(A) {
            e.update(A)
        }
        ,
        this.cancelHighLight = function() {
            e.cancelHighLight()
        }
        ,
        this.highLight = function() {
            e.highLight()
        }
        ,
        this.store = function() {
            return e.store()
        }
        ,
        this.restore = function(A) {
            e.restore(A)
        }
        ,
        this.setProcess = function(A) {
            e.setProcess(A)
        }
        ,
        this.getProcess = function() {
            return e.getProcess()
        }
    };
    (Sp.prototype = Object.create(yp.prototype)).constructor = Sp,
    Sp.prototype.destroy = function() {
        this.cameraControl = null,
        this.normal = null,
        this.plane = null,
        this.pickHelper = null,
        this.scene = null,
        this.viewer = null
    }
    ,
    Sp.prototype.onExit = function() {
        this.toggle(!1, !1)
    }
    ,
    Sp.prototype.processMouseDown = function(A) {
        if (this.startPt.set(A.clientX, A.clientY),
        !this.enablePick && A.button === t.LEFT) {
            var e = this.cameraControl.getRaycaster(A.clientX, A.clientY);
            if (this.scene.getFillClipPlane().hitTest(e),
            this.hit())
                return this.highLight(),
                this.cameraControl.needUpdateRenderList(!0),
                this.cameraControl.update(!0),
                !0
        }
        return yp.prototype.processMouseDown(this, A)
    }
    ,
    Sp.prototype.processMouseUp = function(A) {
        this.planeDistance = 0;
        var e = !1;
        if (this.enablePick && A.button === t.LEFT)
            if (this.startPt.x === A.clientX && this.startPt.y === A.clientY)
                this.pickHelper.click(A);
            else if (A.shiftKey || A.ctrlKey || A.altKey) {
                this.endPt.set(A.clientX, A.clientY);
                var i = Kc.Clear;
                A.ctrlKey ? i = Kc.Add : A.altKey && (i = Kc.Remove);
                var o = this;
                this.scene.pickByRect(this.frustum, i, (function() {
                    o.pickHelper.notifySelectionChanged(null, 0, A)
                }
                )),
                this.cameraControl.updateView(!0),
                e = !0
            }
        var n = this.cameraControl.getRaycaster(A.clientX, A.clientY);
        return this.scene.getFillClipPlane().hitTest(n),
        this.hit() ? (this.highLight(),
        this.cameraControl.needUpdateRenderList(!0),
        this.cameraControl.update(!0),
        this.onClipPlane || (this.onClipPlane = !0,
        this.modelManager.dispatchEvent({
            type: Rc.ON_CLIP_HOVER,
            onClipPlane: !0,
            event: A
        })),
        e = !0) : (this.cancelHighLight(),
        this.cameraControl.needUpdateRenderList(!0),
        this.cameraControl.update(!0),
        this.onClipPlane && (this.onClipPlane = !1,
        this.modelManager.dispatchEvent({
            type: Rc.ON_CLIP_HOVER,
            onClipPlane: !1,
            event: A
        }))),
        e
    }
    ,
    Sp.prototype.processMouseMove = function(A) {
        return this.modelManager.dispatchEvent({
            type: Rc.ON_CLIP_MOUSE_MOVE,
            event: A
        }),
        yp.prototype.processMouseMove(this, A)
    }
    ,
    Sp.prototype.processTouchstart = function(A) {
        if (this.startPt.set(A.touches[0].clientX, A.touches[0].clientY),
        !this.enablePick) {
            var e = this.cameraControl.getRaycaster(A.touches[0].clientX, A.touches[0].clientY);
            this.scene.getFillClipPlane().hitTest(e)
        }
        return this.hit() ? (this.highLight(),
        this.cameraControl.needUpdateRenderList(!0),
        this.cameraControl.update(!0),
        !0) : yp.prototype.processTouchstart(this, A)
    }
    ,
    Sp.prototype.processTouchmove = function(A) {
        if (this.hit()) {
            if (this.isRotate())
                this.rotate(A.touches[0].clientX - this.startPt.x, A.touches[0].clientY - this.startPt.y),
                this.startPt.set(A.touches[0].clientX, A.touches[0].clientY);
            else {
                this.offset(Number(A.touches[0].clientX - this.startPt.x)),
                this.startPt.set(A.touches[0].clientX, A.touches[0].clientY)
            }
            return this.cameraControl.update(!0),
            !0
        }
        return yp.prototype.processTouchmove(this, A)
    }
    ,
    Sp.prototype.processTouchend = function(A) {
        return this.enablePick && (this.onUpdateUI({
            visible: !1
        }),
        this.startPt.x === A.touches[0].clientX && this.startPt.y === A.touches[0].clientY && this.pickHelper.click(A)),
        this.cameraControl.needUpdateRenderList(!0),
        this.cancelHighLight(),
        this.cameraControl.update(!0),
        yp.prototype.processTouchmove(this, A)
    }
    ,
    Sp.prototype.processHover = function(A) {
        if (!this.enablePick) {
            var e = !1
              , t = this.cameraControl.getRaycaster(A.clientX, A.clientY);
            return this.scene.getFillClipPlane().hitTest(t),
            this.hit() ? (this.onClipPlane || (this.highLight(),
            this.cameraControl.needUpdateRenderList(!0),
            this.cameraControl.update(!0),
            this.onClipPlane = !0,
            this.modelManager.dispatchEvent({
                type: Rc.ON_CLIP_HOVER,
                onClipPlane: !0,
                event: A
            })),
            e = !0) : this.onClipPlane ? (this.cancelHighLight(),
            this.cameraControl.needUpdateRenderList(!0),
            this.cameraControl.update(!0),
            this.onClipPlane = !1,
            this.modelManager.dispatchEvent({
                type: Rc.ON_CLIP_HOVER,
                onClipPlane: !1,
                event: A
            })) : this.modelManager.dispatchEvent({
                type: Rc.ON_CLIP_HOVER,
                onClipPlane: !1,
                event: A
            }),
            e
        }
        return yp.prototype.processHover(this, A)
    }
    ;
    var wp = function() {
        this.vertexIndex = new Array(2),
        this.faceIndex = new Array(2)
    }
      , Mp = function(A, e) {
        var t = A.length / 3
          , i = new Array(t)
          , o = new Array(t);
        function n(A, e) {
            var t = i[A]
              , o = i[e];
            return t.x !== o.x ? t.x - o.x : t.y !== o.y ? t.y - o.y : t.z - o.z
        }
        for (var r = 0; t > r; r += 1)
            i[r] = new y(A[3 * r],A[3 * r + 1],A[3 * r + 2]),
            o[r] = r;
        o.sort((function(A, e) {
            var t = n(A, e);
            return 0 === t ? A - e : t
        }
        ));
        var a = {}
          , s = o[0];
        for (r = 1; t > r; r += 1)
            0 === n(s, o[r]) ? a[o[r]] = s : s = o[r];
        var l = new Array(e.length);
        for (r = 0; e.length > r; r += 1)
            l[r] = a.hasOwnProperty(e[r]) ? a[e[r]] : e[r];
        return l
    }
      , bp = function(A, e) {
        function t(A, e) {
            return A - e
        }
        var i = Mp(A, e);
        i.sort(t);
        var o = []
          , n = i[0];
        o.push(n);
        for (var r = 1; i.length > r; r += 1)
            i[r] !== n && o.push(n = i[r]);
        return o.sort(t)
    }
      , Up = function(A, e, t) {
        t = void 0 === t ? Math.PI / 4 : t;
        var i = Mp(A, e)
          , o = i.length
          , n = A.length / 3
          , r = new Array(n + o)
          , a = n
          , s = i.length / 3;
        parseInt(s, 0) !== s && (Bh.error("triangleCount 不是整数"),
        s = parseInt(s, 0));
        for (var l = 0; n > l; l += 1)
            r[l] = -1;
        var c = new Array(o)
          , h = 0;
        for (l = 0; s > l; l += 1)
            for (var d = i[3 * l + 2], p = 0; 3 > p; p += 1) {
                var g = !1
                  , u = i[3 * l + p];
                if (d > u) {
                    g = !0;
                    var f = d;
                    d = u,
                    u = f
                }
                var m = new wp;
                m.vertexIndex[0] = d,
                m.vertexIndex[1] = u,
                m.faceIndex[0] = l,
                m.faceIndex[1] = l;
                var C = r[d];
                if (-1 === C)
                    r[d] = h,
                    c[h] = m,
                    r[a + h] = -1,
                    h += 1;
                else
                    for (; ; ) {
                        if ((E = c[C]).vertexIndex[1] === u) {
                            E.faceIndex[1] = l;
                            break
                        }
                        var v = r[a + C];
                        if (-1 === v) {
                            r[a + C] = h,
                            c[h] = m,
                            r[a + h] = -1,
                            h += 1;
                            break
                        }
                        C = v
                    }
                g || (d = u)
            }
        var I = [];
        for (l = 0; h > l; l += 1) {
            var E;
            if ((E = c[l]).faceIndex[0] === E.faceIndex[1])
                I.push(E.vertexIndex[0]),
                I.push(E.vertexIndex[1]);
            else {
                var B = E.faceIndex[0]
                  , x = i[3 * B]
                  , S = i[3 * B + 1]
                  , w = i[3 * B + 2]
                  , M = new y(A[3 * x],A[3 * x + 1],A[3 * x + 2])
                  , b = new y(A[3 * S],A[3 * S + 1],A[3 * S + 2])
                  , U = new y(A[3 * w],A[3 * w + 1],A[3 * w + 2])
                  , F = M.sub(b)
                  , K = b.sub(U)
                  , Q = F.cross(K);
                Q.normalize();
                var R = E.faceIndex[1];
                S = i[3 * R + 1],
                w = i[3 * R + 2],
                M = new y(A[3 * (x = i[3 * R])],A[3 * x + 1],A[3 * x + 2]),
                b = new y(A[3 * S],A[3 * S + 1],A[3 * S + 2]),
                U = new y(A[3 * w],A[3 * w + 1],A[3 * w + 2]),
                F = M.sub(b),
                K = b.sub(U);
                var T = F.cross(K);
                T.normalize(),
                Math.abs(Q.dot(T)) < t && (I.push(E.vertexIndex[0]),
                I.push(E.vertexIndex[1]))
            }
        }
        return I
    }
      , Fp = function(A, e, t, i, o) {
        for (var n = t.length / 3, r = [], a = 0; n > a; a += 1) {
            var s = t[3 * a]
              , l = new y(e[3 * s],e[3 * s + 1],e[3 * s + 2])
              , c = l.dot(o);
            if (.001 > Math.abs(c - 1)) {
                var h = -new y(A[3 * s],A[3 * s + 1],A[3 * s + 2]).dot(l)
                  , d = Math.abs(i.dot(l) + h);
                3 > Math.abs(d) && r.push(t[3 * a], t[3 * a + 1], t[3 * a + 2])
            }
        }
        return r
    }
      , Kp = new y
      , Qp = new y
      , Rp = new y
      , Tp = new y
      , kp = function(A) {
        this.cameraControl = A,
        this.scene = A.scene,
        this.timerId = null,
        this.lastIntersected = null,
        this.edgeDataMap = null
    };
    kp.prototype = {
        constructor: kp,
        destroy: function() {
            this.cameraControl = null,
            this.scene = null,
            this.lastIntersected = null,
            this.timerId && (clearTimeout(this.timerId),
            this.timerId = null)
        },
        click: function(A, e) {
            var i = this;
            function o() {
                e && !1 === e.pickable && (e = null),
                i.handleMousePick(A, !1, e)
            }
            A.button !== t.RIGHT ? (this.timerId && clearTimeout(this.timerId),
            this.timerId = setTimeout(o, 500)) : o()
        },
        doubleClick: function(A) {
            A.preventDefault(),
            this.timerId && clearTimeout(this.timerId),
            this.handleMousePick(A, !0, null)
        },
        handleMousePick: function(A, e, i) {
            var o = this.cameraControl
              , n = o.viewer.modelManager.sceneState
              , r = new s(A.clientX,A.clientY)
              , a = o.screenToCanvas(A.clientX, A.clientY)
              , l = o.viewer.modelManager;
            function c(t, i) {
                var o = null;
                if (t && t.objectType === Qc.Room) {
                    var n = t.face.contourIndex
                      , r = t.object.geometry.contour;
                    o = n ? {
                        startPoint: r[n.st],
                        endPoint: r[n.ed]
                    } : null
                }
                l.dispatchEvent({
                    type: Rc.ON_CLICK_PICK,
                    event: A,
                    doubleClick: e,
                    canvasPos: {
                        x: a.x,
                        y: a.y
                    },
                    intersectInfo: t ? {
                        selectedObjectId: t.userId,
                        modelKey: t.modelKey,
                        objectType: t.objectType,
                        selectable: i,
                        worldPosition: t.worldPosition,
                        worldBoundingBox: t.worldBoundingBox,
                        point: t.point,
                        index: t.index,
                        innnerDebugging: t.innnerDebugging,
                        object: t.object,
                        normal: t.face ? t.face.normal : null,
                        boundaryPoints: o
                    } : null
                })
            }
            var h = null;
            if (A.button !== t.RIGHT) {
                if (i)
                    i.pickable && (h = i.intersect);
                else {
                    var d = o.getIntersectContext(r);
                    h = o.intersector.pick(d, null)
                }
                if (!h) {
                    var p = n.getSelection();
                    if (A.ctrlKey)
                        return;
                    return p.length > 0 && (n.clearSelection(),
                    o.updateView(!0)),
                    this.setSelectedIdsForOutline(n.getSelection()),
                    void (i && !i.pickable ? ((h = i.intersect).cx = r.x,
                    h.cy = r.y,
                    c(h, !1)) : c(null))
                }
                var g = h.userId;
                if (mh.isMobileDevice() && (o.pivot = h.point),
                this.scene.intersectToWorld(h, o.viewer),
                h.innnerDebugging = A.altKey,
                h.cx = r.x,
                h.cy = r.y,
                this.lastPickedUserId = g,
                h.face && h.face.normal) {
                    var u = h.face.normal;
                    for (var f in u)
                        u[f] = u[f] === -u[f] ? Math.abs(u[f]) : u[f]
                }
                if (A.button !== t.RIGHT)
                    if (e)
                        vc.EnableDemolishByDClick ? (n.setSelection([g]),
                        c(h, !0),
                        o.updateView(!0)) : (n.setSelection([g]),
                        o.fitAndRotateBySelection(),
                        c(h, !0));
                    else {
                        var m = n.getSelection();
                        if (!!vc.MultipleSelectComponents && A.ctrlKey) {
                            var C = m.indexOf(g);
                            -1 === C ? n.addSelection([g]) : (m.splice(C, 1),
                            n.setSelection(m))
                        } else
                            -1 === m.indexOf(g) ? n.setSelection([g]) : n.clearSelection();
                        this.setSelectedIdsForOutline(n.getSelection()),
                        c(h, !0),
                        o.updateView(!0)
                    }
                else
                    c(h, !1)
            } else
                c(h, !1)
        },
        handleShiftMeasure: function(A, e, t) {
            var i = null
              , o = this.cameraControl
              , n = new s(A.clientX,A.clientY)
              , r = o.getIntersectContext(n);
            function a(t, n, r, a, s, l) {
                var c = o.viewer.modelManager;
                if (null !== t) {
                    var h = o.scene.drawingToWorld(t);
                    t.copy(h)
                }
                if (null !== r) {
                    var d = o.scene.drawingToWorld(r[0])
                      , p = o.scene.drawingToWorld(r[1]);
                    r[0].copy(d),
                    r[1].copy(p)
                }
                c.dispatchEvent(i = {
                    type: Rc.ON_MEASURE_PICK,
                    event: A,
                    pick: e,
                    pickPoint: t,
                    isAbsorbPoint: n,
                    pickLine: r,
                    pickPlane: a,
                    userId: s,
                    measureUnit: l
                })
            }
            return o.intersector.pick(r, (function(A) {
                if (A) {
                    var i = ""
                      , n = A.object.modelKey;
                    if (n) {
                        var r = o.viewer.modelManager.getModel(n);
                        r && r.originalLengthUnit && (i = r.originalLengthUnit)
                    }
                    var s = new y;
                    s.subVectors(A.point, t),
                    s.normalize();
                    var l = new y(1,0,0)
                      , c = new y(0,1,0)
                      , h = new y(0,0,1)
                      , d = l.dot(s)
                      , p = c.dot(s)
                      , g = h.dot(s)
                      , u = new y;
                    u.copy(t);
                    .707 > Math.abs(p) ? Math.abs(g) < Math.abs(d) ? u.x = A.point.x : u.z = A.point.z : u.y = A.point.y,
                    e && t.copy(u),
                    a(u, !1, null, !1, A.userId, i)
                } else
                    a(null, !1, null, !1)
            }
            )),
            i
        },
        handleMouseMeasure: function(A, e, t, i) {
            var o = null
              , n = this.cameraControl
              , r = n.scene
              , a = i || Rc.ON_MEASURE_PICK
              , s = this.pickToPoint({
                x: A.clientX,
                y: A.clientY
            }, 5);
            function l(t, i, r, s, l, c, h) {
                var d = n.viewer.modelManager;
                if (null !== t) {
                    var p = n.scene.drawingToWorld(t);
                    t.copy(p)
                }
                if (null !== r) {
                    var g = n.scene.drawingToWorld(r[0])
                      , u = n.scene.drawingToWorld(r[1]);
                    r[0].copy(g),
                    r[1].copy(u)
                }
                (s || e || r || t) && d.dispatchEvent(o = {
                    type: a,
                    event: A,
                    pick: e,
                    pickPoint: t,
                    isAbsorbPoint: i,
                    pickLine: r,
                    pickPlane: s,
                    normal: l,
                    userId: c,
                    measureUnit: h
                })
            }
            return null !== s ? (e && t.copy(s.pickPoint),
            l(s.pickPoint, s.isAbsorbPoint, s.pickLine, s.pickPlane, s.face.normal, s.userId, s.measureUnit)) : (r.hasGroup(gp.MEASUREPICKPLANE) && r.removeGroupByName(gp.MEASUREPICKPLANE),
            l(null, !1, null, !1)),
            o
        },
        handleMouseHover: function(A) {
            var e = this
              , t = this.cameraControl
              , i = t.viewer.modelManager.sceneState;
            if (function() {
                if (!1 === e.scene.hasGroup(gp.AXISGRIDMANAGER))
                    return !1;
                var A = e.scene.getAxisGridManager();
                return 0 !== A.getElements().length && !1 !== A.getIsEnableHover()
            }()) {
                var o = this.scene.getMatrixGlobal()
                  , n = new s(A.clientX,A.clientY)
                  , r = t.getRaycaster(n.x, n.y)
                  , a = this.scene.getAxisGridManager()
                  , l = a.getIntersectPoints(r, o)
                  , c = a.snapOnFloors(l);
                t.viewer.modelManager.dispatchEvent({
                    type: Rc.ON_AXIS_GRID_HOVER,
                    snaps: c
                })
            }
            if (vc.Hover) {
                var h = t.screenToCanvas(A.clientX, A.clientY)
                  , d = new s(A.clientX,A.clientY)
                  , p = t.getIntersectContext(d);
                t.intersector.pick(p, (function(A) {
                    function o(A) {
                        switch (A.objectType) {
                        case Qc.Marker3d:
                            A.object.setAttributeSize(A.index, A.currentSize);
                            break;
                        default:
                            i.clearHover()
                        }
                    }
                    if (A) {
                        var n = vc.Hover || A.hoverEnabled;
                        e.lastIntersected && (e.lastIntersected.userId !== A.userId && o(e.lastIntersected),
                        e.lastIntersected.hoverEnabled && g(null)),
                        n ? (e.lastIntersected && e.lastIntersected.userId === A.userId || (!function(A) {
                            switch (A.objectType) {
                            case Qc.Marker3d:
                                var e = A.object;
                                A.currentSize = e.getAttributeSize(A.index),
                                e.setAttributeSize(A.index, Math.floor(1.5 * A.currentSize));
                                break;
                            default:
                                i.setHoverId(vc.EnableRenderPass ? A.object.originalId : A.userId)
                            }
                        }(A),
                        e.lastIntersected = A),
                        g(A, !0)) : e.lastIntersected = A,
                        t.updateHighlight()
                    } else
                        e.lastIntersected && (o(e.lastIntersected),
                        e.lastIntersected = null,
                        g(null),
                        t.updateHighlight())
                }
                ))
            }
            function g(i, o) {
                var n = t.viewer.modelManager;
                null !== i && e.scene.intersectToWorld(i, t.viewer),
                n.dispatchEvent({
                    type: Rc.ON_HOVER_PICK,
                    event: A,
                    canvasPos: {
                        x: h.x,
                        y: h.y
                    },
                    intersectInfo: i ? {
                        selectedObjectId: i.userId,
                        objectType: i.objectType,
                        selectable: o,
                        modelKey: i.modelKey,
                        worldPosition: i.worldPosition,
                        worldBoundingBox: i.worldBoundingBox,
                        point: i.point,
                        innnerDebugging: i.innnerDebugging,
                        object: i.object
                    } : null
                })
            }
        },
        _canPick: function() {
            return this.cameraControl.viewer.modelManager.hasModelDataReady()
        },
        setSelectedIdsForOutline: function(A) {
            this.cameraControl.viewer.rendererManager.composer && this.cameraControl.viewer.rendererManager.composer.setSelectedIds(A)
        },
        pickToPoint: function(A, e) {
            var t = 0;
            t = void 0 === e ? 25 : e * e;
            var i = this.cameraControl
              , o = i.scene
              , n = new s(A.x,A.y)
              , r = i.getIntersectContext(n)
              , a = i.intersector.pick(r);
            if (a) {
                var l = ""
                  , c = a.object.modelKey
                  , h = null;
                c && (h = i.viewer.modelManager.getModel(c)) && h.originalLengthUnit && (l = h.originalLengthUnit);
                var d = a.point
                  , p = a.object.geometry
                  , g = ((new M).extractRotation(a.object.matrix.clone()),
                a.object.matrixWorld.clone())
                  , u = i.camera.projScreenMatrix
                  , f = r.mouse
                  , m = r.viewportSize
                  , C = null;
                if (null != a.indexInfo && (C = a.indexInfo),
                !p.attributes && !p._bufferGeometry)
                    return null;
                var v = p.attributes ? p : p._bufferGeometry;
                if (!v.index || void 0 === v.attributes.normal)
                    return null;
                var I = v.attributes.position.array
                  , E = v.attributes.normal.array
                  , B = [];
                C || h && h.merged && g.multiply(a.matrix);
                var x = 1 / 0
                  , S = (A = new y,
                [])
                  , w = new y
                  , b = new y
                  , U = w.set(I[3 * a.face.a], I[3 * a.face.a + 1], I[3 * a.face.a + 2]);
                U.applyMatrix4(g);
                var F = b.copy(U);
                F.applyMatrix4(u);
                var K = .5 * (F.x - f.x) * m.width
                  , Q = .5 * (F.y - f.y) * m.height
                  , R = K * K + Q * Q;
                x > R && (x = R,
                A.copy(U)),
                (U = w.set(I[3 * a.face.b], I[3 * a.face.b + 1], I[3 * a.face.b + 2])).applyMatrix4(g),
                (F = b.copy(U)).applyMatrix4(u),
                x > (R = (K = .5 * (F.x - f.x) * m.width) * K + (Q = .5 * (F.y - f.y) * m.height) * Q) && (x = R,
                A.copy(U)),
                (U = w.set(I[3 * a.face.c], I[3 * a.face.c + 1], I[3 * a.face.c + 2])).applyMatrix4(g),
                (F = b.copy(U)).applyMatrix4(u),
                x > (R = (K = .5 * (F.x - f.x) * m.width) * K + (Q = .5 * (F.y - f.y) * m.height) * Q) && (x = R,
                A.copy(U));
                var T = d.clone()
                  , k = !1
                  , D = null
                  , L = !1;
                if (t > x)
                    o.hasGroup(gp.MEASUREPICKPLANE) && o.removeGroupByName(gp.MEASUREPICKPLANE),
                    T = A.clone(),
                    k = !0;
                else {
                    x = 1 / 0;
                    var N = new y
                      , O = new y;
                    A = new y;
                    var V, G = this._getEegeData(a);
                    if (!G)
                        return Bh.error("no edge data"),
                        null;
                    S = G.positionsArray,
                    V = G.edgeIndex;
                    for (var P = 0; V.length > P; P += 2) {
                        Rp.set(S[3 * V[P]], S[3 * V[P] + 1], S[3 * V[P] + 2]),
                        Rp.applyMatrix4(g),
                        Tp.set(S[3 * V[P + 1]], S[3 * V[P + 1] + 1], S[3 * V[P + 1] + 2]),
                        Tp.applyMatrix4(g);
                        var q = this._pointToLine(Rp, Tp, d);
                        (F = q.clone()).applyMatrix4(u),
                        x > (R = (K = .5 * (F.x - f.x) * m.width) * K + (Q = .5 * (F.y - f.y) * m.height) * Q) && (x = R,
                        N.copy(Rp),
                        O.copy(Tp),
                        A.copy(q))
                    }
                    if (S = null,
                    t > x)
                        o.hasGroup(gp.MEASUREPICKPLANE) && o.removeGroupByName(gp.MEASUREPICKPLANE),
                        (D = []).push(N),
                        D.push(O),
                        T = A.clone();
                    else {
                        if (vc.MeasureHighlightPlane) {
                            B = v.index.array;
                            var j = new M;
                            j.getInverse(g);
                            var H = new y(d.x,d.y,d.z);
                            H.applyMatrix4(j);
                            var Y = Fp(I, E, B, H, a.face.normal)
                              , W = new he;
                            W.setIndex(Y),
                            W.setAttribute("position", p.attributes.position, 3),
                            W.setAttribute("normal", p.attributes.normal, 3);
                            var J = Up(I, Y)
                              , z = new he;
                            z.setIndex(J),
                            z.setAttribute("position", p.attributes.position, 3),
                            o.hasGroup(gp.MEASUREPICKPLANE) && o.removeGroupByName(gp.MEASUREPICKPLANE);
                            var Z = o.getOrCreateGroup(gp.MEASUREPICKPLANE, {
                                priority: 1,
                                globalSpace: !0
                            })
                              , X = new Ue(W,new jA({
                                color: 1170103,
                                opacity: .1,
                                transparent: !0
                            }));
                            X.applyMatrix4(a.object.matrix),
                            Z.add(X);
                            var _ = new jo(z,new ko({
                                color: 1170103
                            }));
                            _.applyMatrix4(a.object.matrix),
                            Z.add(_),
                            Z.updateMatrixWorld(!0),
                            i.updateHighlight()
                        }
                        L = !0
                    }
                }
                var $ = {};
                return $.pickPoint = T,
                $.isAbsorbPoint = k,
                $.measureUnit = l,
                $.pickLine = D,
                $.pickPlane = L,
                $.face = a.face,
                $.userId = a.userId,
                $
            }
            return null
        },
        _getEegeData: function(A) {
            var e = A.object.geometry;
            this.edgeDataMap || (this.edgeDataMap = {});
            var t = null;
            null != A.indexInfo && (t = A.indexInfo);
            var i = e.attributes ? e : e._bufferGeometry
              , o = A.nodeId || A.userId;
            return this.edgeDataMap[i.id] ? this.edgeDataMap[i.id].version !== i.attributes.position.version ? (delete this.edgeDataMap[i.id].data,
            this.edgeDataMap[i.id].data[o] = this._getPositionArrayAndEdgeIndex(i, t)) : this.edgeDataMap[i.id].data[o] || (this.edgeDataMap[i.id].data[o] = this._getPositionArrayAndEdgeIndex(i, t)) : (this.edgeDataMap[i.id] = {},
            this.edgeDataMap[i.id].version = i.attributes.position.version,
            this.edgeDataMap[i.id].data = {},
            this.edgeDataMap[i.id].data[o] = this._getPositionArrayAndEdgeIndex(i, t)),
            this.edgeDataMap[i.id].data[o]
        },
        _getPositionArrayAndEdgeIndex: function(A, e) {
            var t = []
              , i = 0
              , o = 0
              , n = []
              , r = []
              , a = A.attributes.position.array
              , s = [];
            if (e) {
                e.positionStart / 3;
                for (var l = uh.getMin((t = A.index.array).slice(i = e.indexStart, o = e.indexStart + e.indexCount)), c = i; o > c; c += 1)
                    r.push(t[c] - l);
                n = a.slice(e.positionStart, e.positionStart + e.positionCount),
                s = Up(n, r)
            } else
                o = (t = bp(A.attributes.position.array, A.index.array)).length,
                n = a,
                s = Up(A.attributes.position.array, A.index.array);
            return {
                positionsArray: n,
                edgeIndex: s
            }
        },
        _pointToLine: function(A, e, t) {
            Kp.subVectors(e, A),
            Qp.subVectors(t, A);
            var i = Kp.dot(Qp);
            if (0 > i)
                return A;
            var o = Kp.dot(Kp);
            if (i > o)
                return e;
            i /= o;
            var n = A.clone();
            return n.addScaledVector(Kp, i),
            n
        }
    };
    var Dp = "http://www.w3.org/2000/svg"
      , Lp = function() {
        var A = document.createElementNS(Dp, "svg")
          , e = function(A, e, t, i) {
            var o = document.createElementNS(Dp, "defs")
              , n = document.createElementNS(Dp, "filter");
            n.id = A,
            n.setAttributeNS(null, "x", "-30%"),
            n.setAttributeNS(null, "y", "-30%"),
            n.setAttributeNS(null, "width", "200%"),
            n.setAttributeNS(null, "height", "200%");
            var r = document.createElementNS(Dp, "feGaussianBlur");
            r.setAttributeNS(null, "in", "SourceAlpha"),
            r.setAttributeNS(null, "stdDeviation", "4");
            var a = document.createElementNS(Dp, "feOffset");
            a.setAttributeNS(null, "result", "offsetblur");
            var s = document.createElementNS(Dp, "feMerge")
              , l = document.createElementNS(Dp, "feMergeNode")
              , c = document.createElementNS(Dp, "feMergeNode");
            return c.setAttributeNS(null, "in", "SourceGraphic"),
            s.appendChild(l),
            s.appendChild(c),
            n.appendChild(r),
            n.appendChild(a),
            n.appendChild(s),
            o.appendChild(n),
            o
        }("drop-shadow");
        return A.appendChild(e),
        A
    }
      , Np = function() {
        return document.createElementNS(Dp, "line")
    }
      , Op = function() {
        return document.createElementNS(Dp, "path")
    }
      , Vp = function(A) {
        var e = document.createElementNS(Dp, "circle");
        return e.setAttributeNS(null, "r", A || 0),
        e.setAttributeNS(null, "fill", "none"),
        e
    }
      , Gp = function() {
        return document.createElementNS(Dp, "text")
    }
      , Pp = function() {
        return document.createElementNS(Dp, "g")
    }
      , qp = function(A, e) {
        var t = Math.pow(A[0] - e[0], 2)
          , i = Math.pow(A[1] - e[1], 2)
          , o = 0;
        return 3 === A.length && 3 === e.length && (o = Math.pow(A[2] - e[2], 2)),
        Math.sqrt(t + i + o)
    }
      , jp = function(A) {
        var e = Math.pow(A[0], 2)
          , t = Math.pow(A[1], 2)
          , i = 0;
        A.length > 2 && (i = Math.pow(A[2], 2));
        var o = Math.sqrt(e + t + i)
          , n = [A[0] / o, A[1] / o];
        return A.length > 2 && n.push(A[2] / o),
        n
    }
      , Hp = function(A, e) {
        var t = 0;
        return A.length > 2 && e.length > 2 && (t = A[2] * e[2]),
        A[0] * e[0] + A[1] * e[1] + t
    }
      , Yp = function(A, e) {
        var t = A[0]
          , i = A[1]
          , o = A[2]
          , n = e[0]
          , r = e[1]
          , a = e[2];
        return [i * a - o * r, o * n - t * a, t * r - i * n]
    }
      , Wp = function(A) {
        return "mm" === A ? 1 : "cm" === A ? 10 : "m" === A ? 1e3 : 1
    }
      , Jp = function(A, e, t, i) {
        var o = Wp(A);
        2 === i ? o *= o : 3 === i && (o *= o * o);
        var n = Wp(e);
        return 2 === i ? n *= n : 3 === i && (n *= n * n),
        t * o / n
    }
      , zp = function(A, e) {
        return !(e.x > A.x + A.width || A.x > e.x + e.width || e.y > A.y + A.height || A.y > e.y + e.height)
    }
      , Zp = function() {
        return "undefined" != typeof window && "ontouchstart"in window
    }
      , Xp = function(A) {
        this.svg = A,
        this.maxPointsNeed = 0,
        this.pickedPoints = [],
        this.svgGroup = Pp(),
        this.svg.appendChild(this.svgGroup),
        this.unitOfModel = void 0,
        this.unitOnUI = void 0,
        this.precision = 3,
        this.adjustOption = void 0,
        this.is3DMode = !1,
        this.isSelected = !1,
        this.onclickCallback = void 0
    };
    Xp.prototype.addPickedPoint = function(A, e, t) {
        return !this.isDone() && (!!A && (this.pickedPoints.push(A),
        e && (this.unitOfModel = this.unitOfModel && this.unitOfModel !== e ? void 0 : e),
        !0))
    }
    ,
    Xp.prototype.getAllPickedPoint = function() {
        return this.pickedPoints
    }
    ,
    Xp.prototype.draw = function(A, e) {}
    ,
    Xp.prototype.adjustWithOption = function(A) {
        this.adjustOption = A,
        A && this.updateTexts()
    }
    ,
    Xp.prototype.unAdjustWithOption = function(A) {
        this.adjustOption = void 0,
        this.updateTexts()
    }
    ,
    Xp.prototype.changeUnit = function(A) {
        A && (this.unitOnUI = A,
        this.updateTexts())
    }
    ,
    Xp.prototype.changePrecision = function(A) {
        this.precision = A,
        A && this.updateTexts()
    }
    ,
    Xp.prototype.updateTexts = function() {}
    ,
    Xp.prototype.isVisible = function() {
        return !!(this.svg && this.svgGroup && this.svgGroup.parentNode)
    }
    ,
    Xp.prototype.remove = function() {
        this.svg && this.svgGroup && this.svgGroup.parentNode && (this.svg.removeChild(this.svgGroup),
        this.onclickCallback = void 0)
    }
    ,
    Xp.prototype.add = function() {
        this.svg && this.svgGroup && this.svg.appendChild(this.svgGroup)
    }
    ,
    Xp.prototype.isDone = function() {
        return this.pickedPoints.length === this.maxPointsNeed
    }
    ,
    Xp.prototype.setClickCallback = function(A) {
        this.onclickCallback = A
    }
    ,
    Xp.prototype.measureResult = function() {}
    ,
    Xp.prototype.createCircle = function() {
        var A = Vp(5);
        return A.setAttributeNS(null, "fill", "#ff9800"),
        A.setAttributeNS(null, "stroke", "#ffffff"),
        A.setAttributeNS(null, "stroke-width", 2),
        A.style.display = "none",
        A
    }
    ,
    Xp.prototype.createLine = function() {
        var A = Np();
        return A.setAttributeNS(null, "stroke-width", 2),
        A.setAttributeNS(null, "stroke", "#ffff00"),
        A.style.display = "none",
        A
    }
    ,
    Xp.prototype.createText = function() {
        var A = Gp();
        return A.style.fontSize = "14",
        A.style.display = "none",
        A.style.textAnchor = "middle",
        A.setAttributeNS(null, "fill", "#ffffff"),
        A
    }
    ,
    Xp.prototype.createPath = function() {
        var A = Op();
        return A.style.display = "none",
        A.setAttributeNS(null, "fill", "none"),
        A.setAttributeNS(null, "stroke", "#0aea06"),
        A
    }
    ,
    Xp.prototype.resultToDisplayOfLength = function(A) {
        var e = A
          , t = this.unitOfModel;
        return this.adjustOption && (e = this.adjustOption.adjustLength(A),
        t = this.adjustOption.unit),
        this.unitOnUI && (t && (e = Jp(t, this.unitOnUI, e, 0)),
        t = this.unitOnUI),
        t || (t = ""),
        e = e.toFixed(this.precision),
        {
            value: Number(e),
            unit: t,
            text: e + t
        }
    }
    ,
    Xp.prototype.setSelected = function(A) {
        return this.isSelected !== A && (this.isSelected = A,
        !0)
    }
    ;
    var _p = function() {
        this.group = Pp(),
        this.group.style.display = "none";
        var A = Op();
        this.textBackground = A,
        this.group.appendChild(A),
        A = Op(),
        this.prefixTextBackground = A,
        this.prefixTextBackground.style.display = "none",
        this.group.appendChild(A);
        var e = Gp();
        e.style.fontSize = "12",
        e.style.textAnchor = "middle",
        e.style.dominantBaseline = "central",
        e.style.cursor = "default",
        e.setAttributeNS(null, "fill", "#ffffff"),
        this.group.appendChild(e),
        this.text = e,
        (e = Gp()).style.fontSize = "12",
        e.style.textAnchor = "middle",
        e.style.dominantBaseline = "central",
        e.style.display = "none",
        e.setAttributeNS(null, "fill", "#ffffff"),
        this.group.appendChild(e),
        this.prefixText = e,
        this.textColor = "#ffffff",
        this.prefixTextColor = "#ffffff",
        this.textBackgroundColor = "#ffffff",
        this.prefixTextBackgroundColor = "blue",
        this.textContent = void 0,
        this.prefixTextContent = void 0,
        this.textPosition = {
            x: 0,
            y: 0
        },
        this.isShowShadow = !1,
        this.onclickCallback = void 0,
        this._onMouseDown = this._onMouseDown.bind(this),
        this._onMouseMove = this._onMouseMove.bind(this),
        this._onMouseUp = this._onMouseUp.bind(this)
    };
    _p.prototype.draw = function(A) {
        if (this.textContent && this.textContent.length) {
            this.group.style.display = "",
            this.text.textContent = this.textContent;
            var e = null;
            this.prefixTextContent ? (this.prefixText.textContent = this.prefixTextContent,
            this.prefixText.style.display = "",
            e = this.prefixText.getBBox()) : (this.prefixText.style.display = "none",
            e = {
                width: 0,
                height: 0
            });
            var t = this.text.getBBox()
              , i = 5 + t.width + 5;
            this.prefixTextContent && this.prefixTextContent.length > 0 && (i = i + 5 + e.width + 5),
            A && (i = Math.max(A, i));
            var o = this.textPosition.x - i / 2
              , n = this.textPosition.y - (5 + t.height + 5) / 2
              , r = function(A, e, t, i, o) {
                return "M" + A + "," + (e + o) + "a" + o + "," + o + " 0 0 1 " + o + "," + -o + "h" + (t - 2 * o) + "a" + o + "," + o + " 0 0 1 " + o + "," + o + "v" + (i - 2 * o) + "a" + o + "," + o + " 0 0 1 " + -o + "," + o + "h" + (2 * o - t) + "a" + o + "," + o + " 0 0 1 " + -o + "," + -o + "v" + (2 * o - i) + "z"
            }(o, n, i, t.height + 10, 5);
            this.textBackground.setAttributeNS(null, "d", r),
            this.textBackground.setAttributeNS(null, "fill", this.textBackgroundColor),
            this.isShowShadow ? this.group.setAttributeNS(null, "filter", "url(#drop-shadow)") : this.group.removeAttributeNS(null, "filter"),
            this.prefixTextContent && this.prefixTextContent.length > 0 ? (r = function(A, e, t, i, o) {
                return "M" + A + "," + (e + o) + "a" + o + "," + o + " 0 0 1 " + o + "," + -o + "h" + (t - o) + "v" + i + "h" + (o - t) + "a" + o + "," + o + " 0 0 1 " + -o + "," + -o + "v" + (2 * o - i) + "z"
            }(o, n, e.width + 10, e.height + 10, 5),
            this.prefixTextBackground.setAttributeNS(null, "d", r),
            this.prefixTextBackground.setAttributeNS(null, "fill", this.prefixTextBackgroundColor),
            this.prefixTextBackground.style.display = "",
            this.prefixText.setAttributeNS(null, "x", o + 5 + e.width / 2),
            this.prefixText.setAttributeNS(null, "y", n + 5 + e.height / 2),
            o = o + (10 + e.width) / 2 + i / 2) : o += i / 2,
            this.text.setAttributeNS(null, "x", o),
            this.text.setAttributeNS(null, "y", n + 5 + t.height / 2),
            this.text.setAttributeNS(null, "fill", this.textColor),
            this.prefixText.setAttributeNS(null, "fill", this.prefixTextColor)
        }
    }
    ,
    _p.prototype.setText = function(A, e) {
        this.textContent = A,
        this.prefixTextContent = e
    }
    ,
    _p.prototype.setPosition = function(A, e) {
        this.textPosition = {
            x: A,
            y: e
        }
    }
    ,
    _p.prototype.hide = function() {
        this.group.style.display = "none"
    }
    ,
    _p.prototype.show = function() {
        this.group.style.display = ""
    }
    ,
    _p.prototype.setClickCallback = function(A) {
        this.onclickCallback = A,
        A ? (this.group.style.cursor = "pointer",
        this.text.style.cursor = "pointer",
        Zp() ? (this.group.addEventListener("touchstart", this._onMouseDown),
        this.group.addEventListener("touchend", this._onMouseUp),
        this.group.addEventListener("touchmove", this._onMouseMove)) : (this.group.addEventListener("mousedown", this._onMouseDown),
        this.group.addEventListener("mouseup", this._onMouseUp),
        this.group.addEventListener("mousemove", this._onMouseMove))) : (this.group.style.cursor = "default",
        this.text.style.cursor = "default",
        Zp() ? (this.group.removeEventListener("touchstart", this._onMouseDown),
        this.group.removeEventListener("touchend", this._onMouseUp),
        this.group.removeEventListener("touchmove", this._onMouseMove)) : (this.group.removeEventListener("mousedown", this._onMouseDown),
        this.group.removeEventListener("mouseup", this._onMouseUp),
        this.group.removeEventListener("mousemove", this._onMouseMove)))
    }
    ,
    _p.prototype._onMouseMove = function(A) {
        A.stopPropagation(),
        A.preventDefault()
    }
    ,
    _p.prototype._onMouseDown = function(A) {
        A.stopPropagation(),
        A.preventDefault()
    }
    ,
    _p.prototype._onMouseUp = function(A) {
        A.stopPropagation(),
        A.preventDefault(),
        this.onclickCallback && this.onclickCallback()
    }
    ;
    var $p = function(A) {
        Xp.call(this, A),
        this.maxPointsNeed = 2,
        this.startCircle = this.createCircle(),
        this.startCircle.setAttributeNS(null, "fill", "#ffffff"),
        this.endCircle = this.createCircle(),
        this.endCircle.setAttributeNS(null, "fill", "#ffffff"),
        this.svgGroup.appendChild(this.startCircle),
        this.svgGroup.appendChild(this.endCircle),
        this.line = this.createLine(),
        this.line.setAttributeNS(null, "stroke", "#ffffff"),
        this.line.setAttributeNS(null, "strokd-width", 2),
        this.svgGroup.appendChild(this.line),
        this.text = new _p,
        this.text.textBackgroundColor = "#ffffff",
        this.text.textColor = "#000000",
        this.svgGroup.appendChild(this.text.group),
        this._distance = void 0
    };
    ($p.prototype = Object.assign(Object.create(Xp.prototype), {
        constructor: $p
    })).addPickedPoint = function(A, e, t) {
        Xp.prototype.addPickedPoint.call(this, A, e, t) && this.isDone() && (this._enableSelect(),
        this._distance = qp(this.pickedPoints[0], this.pickedPoints[1]))
    }
    ,
    $p.prototype.draw = function(A, e) {
        if (this.svgGroup.parentNode) {
            var t = this.pickedPoints;
            if (t.length > 0) {
                A && !this.isDone() && (t = t.concat([A]));
                var i = t;
                if (e) {
                    for (var o = [], n = 0, r = t.length; r > n; n += 1)
                        o[n] = e(t[n]);
                    i = o
                }
                var a = i[0]
                  , s = i.length > 1 ? i[1] : a;
                if (this.startCircle.setAttributeNS(null, "cx", a[0]),
                this.startCircle.setAttributeNS(null, "cy", a[1]),
                this.startCircle.style.display = "",
                this.line.setAttributeNS(null, "x1", a[0]),
                this.line.setAttributeNS(null, "y1", a[1]),
                this.line.setAttributeNS(null, "x2", s[0]),
                this.line.setAttributeNS(null, "y2", s[1]),
                this.line.style.display = "",
                this.text.setPosition((a[0] + s[0]) / 2, (a[1] + s[1]) / 2),
                t.length > 1) {
                    var l = qp(t[0], t[1]);
                    this._distance = l
                }
                2 === this.pickedPoints.length ? (this.endCircle.setAttributeNS(null, "cx", s[0]),
                this.endCircle.setAttributeNS(null, "cy", s[1]),
                this.endCircle.style.display = "") : this.endCircle.style.display = "none",
                this._updateText()
            }
        }
    }
    ,
    $p.prototype.measureResult = function() {
        if (this.isDone()) {
            var A = {};
            if (A.distance = this._distance,
            this.adjustOption) {
                var e = this.resultToDisplayOfLength(this._distance);
                A.unit = e.unit,
                A.value = e.value
            }
            return A
        }
    }
    ,
    $p.prototype.adjustWithOption = function(A) {
        Xp.prototype.adjustWithOption.call(this, A),
        this._updateText(),
        this._disableSelect()
    }
    ,
    $p.prototype.changeUnit = function(A) {
        Xp.prototype.changeUnit.call(this, A),
        A && this._updateText()
    }
    ,
    $p.prototype.changePrecision = function(A) {
        Xp.prototype.changePrecision.call(this, A),
        A && this._updateText()
    }
    ,
    $p.prototype._enableSelect = function() {
        var A = this;
        this.startCircle.onmousedown = function(e) {
            A.isDone() && (A.pickedPoints = A.pickedPoints.slice(1),
            e.stopPropagation(),
            A._disableSelect())
        }
        ,
        this.endCircle.onmousedown = function(e) {
            A.isDone() && (A.pickedPoints = A.pickedPoints.slice(0, 1),
            e.stopPropagation(),
            A._disableSelect())
        }
    }
    ,
    $p.prototype._disableSelect = function() {
        this.startCircle.onmousedown = void 0,
        this.endCircle.onmousedown = void 0
    }
    ,
    $p.prototype._updateText = function() {
        this.isDone() && this._distance && this.adjustOption && (this.text.setText(this.resultToDisplayOfLength(this._distance).text),
        this.text.draw())
    }
    ;
    var Ag = function() {
        this.unit = void 0,
        this.valueBeforeAdjust = void 0,
        this.valueAfterAdjust = void 0
    };
    Ag.prototype.adjustLength = function(A) {
        return this.valueAfterAdjust && this.valueBeforeAdjust ? A * this.valueAfterAdjust / this.valueBeforeAdjust : A
    }
    ,
    Ag.prototype.adjustArea = function(A) {
        return this.valueAfterAdjust && this.valueBeforeAdjust ? A * Math.pow(this.valueAfterAdjust / this.valueBeforeAdjust, 2) : A
    }
    ,
    Ag.prototype.adjustVolume = function(A) {
        return this.valueAfterAdjust && this.valueBeforeAdjust ? A * Math.pow(this.valueAfterAdjust / this.valueBeforeAdjust, 3) : A
    }
    ;
    var eg = function(A) {
        Xp.call(this, A),
        this.maxPointsNeed = 3,
        this._angle = void 0,
        this.circle1 = this.createCircle(),
        this.circle2 = this.createCircle(),
        this.circle3 = this.createCircle(),
        this.svgGroup.appendChild(this.circle1),
        this.svgGroup.appendChild(this.circle2),
        this.svgGroup.appendChild(this.circle3),
        this.line1 = this.createLine(),
        this.line1.setAttributeNS(null, "stroke-width", 2),
        this.svgGroup.appendChild(this.line1),
        this.line2 = this.createLine(),
        this.line2.setAttributeNS(null, "stroke-width", 2),
        this.svgGroup.appendChild(this.line2),
        this.arc = this.createPath(),
        this.svgGroup.appendChild(this.arc),
        this.angleText = new _p,
        this.angleText.textBackgroundColor = "#009bff",
        this.svgGroup.appendChild(this.angleText.group);
        var e = this;
        this.angleText.setClickCallback((function() {
            e.onclickCallback && e.onclickCallback(e)
        }
        ))
    };
    (eg.prototype = Object.assign(Object.create(Xp.prototype), {
        constructor: eg
    })).addPickedPoint = function(A, e, t) {
        if (Xp.prototype.addPickedPoint.call(this, A, e, t) && this.isDone()) {
            var i = this.pickedPoints[0]
              , o = this.pickedPoints[1]
              , n = this.pickedPoints[2]
              , r = (a = [n[0] - o[0], n[1] - o[1], n[2] - o[2]],
            s = jp([i[0] - o[0], i[1] - o[1], i[2] - o[2]]),
            l = jp(a),
            c = Hp(s, l),
            Math.acos(c) / Math.PI * 180);
            this._angle = r
        }
        var a, s, l, c
    }
    ,
    eg.prototype.draw = function(A, e) {
        if (this.svgGroup.parentNode) {
            var t = this.pickedPoints;
            if (t.length > 0) {
                A && !this.isDone() && (t = t.concat([A]));
                var i = t
                  , o = !0;
                if (e) {
                    for (var n = !0, r = [], a = 0, s = t.length; s > a; a += 1)
                        r[a] = e(t[a]),
                        o && r[a][0] > 0 && r[a][0] < parseInt(this.svg.style.width, 10) && r[a][1] > 0 && r[a][1] < parseInt(this.svg.style.height, 10) && (o = !1),
                        void 0 !== r[a][2] && 0 !== r[a][2] || (n = !1);
                    i = r,
                    n && (o = !0)
                }
                if (this.pickedPoints.length >= 1) {
                    var l = i[0]
                      , c = i[1];
                    this.circle1.setAttributeNS(null, "cx", l[0]),
                    this.circle1.setAttributeNS(null, "cy", l[1]),
                    this.circle1.style.display = "",
                    (A || this.pickedPoints.length > 1) && (this.line1.setAttributeNS(null, "x1", l[0]),
                    this.line1.setAttributeNS(null, "y1", l[1]),
                    this.line1.setAttributeNS(null, "x2", c[0]),
                    this.line1.setAttributeNS(null, "y2", c[1]),
                    this.line1.style.display = "")
                }
                if (this.pickedPoints.length >= 2) {
                    var h = i[1]
                      , d = i[2];
                    this.circle2.setAttributeNS(null, "cx", h[0]),
                    this.circle2.setAttributeNS(null, "cy", h[1]),
                    this.circle2.style.display = "",
                    (A || this.pickedPoints.length > 2) && (this.line2.setAttributeNS(null, "x1", h[0]),
                    this.line2.setAttributeNS(null, "y1", h[1]),
                    this.line2.setAttributeNS(null, "x2", d[0]),
                    this.line2.setAttributeNS(null, "y2", d[1]),
                    this.line2.style.display = "")
                }
                if (3 === this.pickedPoints.length) {
                    if (o)
                        return void (this.svgGroup.style.display = "none");
                    this.svgGroup.style.display = "";
                    var p = i[2];
                    this.circle3.setAttributeNS(null, "cx", p[0]),
                    this.circle3.setAttributeNS(null, "cy", p[1]),
                    this.circle3.style.display = "";
                    var g = i[0].slice(0, 2)
                      , u = i[1].slice(0, 2)
                      , f = i[2].slice(0, 2)
                      , m = qp(g, u)
                      , C = qp(u, f)
                      , y = Math.min(Math.min(m, C), 30)
                      , v = jp([g[0] - u[0], g[1] - u[1]])
                      , I = [u[0] + v[0] * y, u[1] + v[1] * y]
                      , E = jp([f[0] - u[0], f[1] - u[1]])
                      , B = [u[0] + E[0] * y, u[1] + E[1] * y]
                      , x = [(I[0] + B[0]) / 2, (I[1] + B[1]) / 2]
                      , S = [x[0] - u[0], x[1] - u[1]]
                      , w = [u[0] + (S = [1.5 * S[0], 1.5 * S[1]])[0], u[1] + S[1]]
                      , M = "M" + I[0] + "," + I[1];
                    M += "Q" + w[0] + "," + w[1],
                    this.arc.setAttributeNS(null, "d", M += " " + B[0] + "," + B[1]),
                    this.arc.style.display = "",
                    this.angleText.setText(this._angle.toFixed(this.precision) + "°"),
                    this.angleText.setPosition(w[0], w[1]),
                    this.angleText.draw()
                }
            }
        }
    }
    ,
    eg.prototype.setSelected = function(A) {
        Xp.prototype.setSelected.call(this, A) && (A ? (this.angleText.isShowShadow = !0,
        this.angleText.textBackgroundColor = "#ffffff",
        this.angleText.textColor = "#009bff",
        this.angleText.draw()) : (this.angleText.isShowShadow = !1,
        this.angleText.textBackgroundColor = "#009bff",
        this.angleText.textColor = "#ffffff",
        this.angleText.draw()))
    }
    ,
    eg.prototype.measureResult = function() {
        return this._angle
    }
    ;
    var tg = function(A) {
        Xp.call(this, A),
        this.path = Op(),
        this.path.setAttributeNS(null, "fill", "none"),
        this.path.setAttributeNS(null, "stroke", "rgb(69,195,69)"),
        this.svgGroup.appendChild(this.path),
        this._isDone = !1,
        this._circles = [],
        this._area = -1,
        this.resultText = new _p,
        this.resultText.textBackgroundColor = "#009bff",
        this.svgGroup.appendChild(this.resultText.group);
        var e = this;
        this.resultText.setClickCallback((function() {
            e.onclickCallback && e.onclickCallback(e)
        }
        ))
    };
    (tg.prototype = Object.assign(Object.create(Xp.prototype), {
        constructor: tg
    })).addPickedPoint = function(A, e, t) {
        if (this._pointCanClosePath(A, t))
            this._isDone = !0,
            this._area = this.is3DMode ? this._calculateArea3D() : this._calculateArea2D();
        else if (Xp.prototype.addPickedPoint.call(this, A, e, t)) {
            var i = this.createCircle();
            this.svgGroup.appendChild(i),
            this._circles.push(i)
        }
    }
    ,
    tg.prototype.isDone = function() {
        return this._isDone
    }
    ,
    tg.prototype.draw = function(A, e) {
        if (this.svgGroup.parentNode) {
            var t = this.pickedPoints;
            if (t.length > 0) {
                if (A && !this.isDone()) {
                    if (this._pointCanClosePath(A, e)) {
                        var i = this.pickedPoints[0];
                        A = [i[0], i[1], i[2]]
                    }
                    t = t.concat([A])
                }
                var o = t
                  , n = !0;
                if (e) {
                    for (var r = !0, a = [], s = 0, l = t.length; l > s; s += 1)
                        a[s] = e(t[s]),
                        n && a[s][0] > 0 && a[s][0] < parseInt(this.svg.style.width, 10) && a[s][1] > 0 && a[s][1] < parseInt(this.svg.style.height, 10) && (n = !1),
                        void 0 !== a[s][2] && 0 !== a[s][2] || (r = !1);
                    o = a,
                    r && (n = !0)
                }
                var c = this._pathString(o);
                if (this.path.setAttributeNS(null, "d", c),
                this.isDone()) {
                    if (n)
                        return void (this.svgGroup.style.display = "none");
                    this.svgGroup.style.display = "",
                    this.path.setAttributeNS(null, "fill", "rgba(69,195,69,0.5)");
                    var h = this._getPointsCenter(this.pickedPoints);
                    e && (h = e(h)),
                    this.resultText.setPosition(h[0], h[1]),
                    this.updateTexts()
                }
                for (var d = 0, p = this._circles.length; p > d; d += 1) {
                    var g = this._circles[d]
                      , u = o[d];
                    g.setAttributeNS(null, "cx", u[0]),
                    g.setAttributeNS(null, "cy", u[1]),
                    g.style.display = ""
                }
            }
        }
    }
    ,
    tg.prototype.measureResult = function() {
        return this._area
    }
    ,
    tg.prototype.updateTexts = function() {
        this.isDone() && (this.resultText.setText(this.resultToDisplayOfArea(this._area).text),
        this.resultText.draw())
    }
    ,
    tg.prototype.setSelected = function(A) {
        Xp.prototype.setSelected.call(this, A) && (A ? (this.resultText.isShowShadow = !0,
        this.resultText.textBackgroundColor = "#ffffff",
        this.resultText.textColor = "#009bff",
        this.resultText.draw()) : (this.resultText.isShowShadow = !1,
        this.resultText.textBackgroundColor = "#009bff",
        this.resultText.textColor = "#ffffff",
        this.resultText.draw()))
    }
    ,
    tg.prototype.resultToDisplayOfArea = function(A) {
        var e = A
          , t = this.unitOfModel;
        return this.adjustOption && (e = this.adjustOption.adjustArea(A),
        t = this.adjustOption.unit),
        this.unitOnUI && (t && (e = Jp(t, this.unitOnUI, e, 2)),
        t = this.unitOnUI),
        t || (t = ""),
        e = e.toFixed(this.precision),
        "mm" === t ? t = "mm²" : "m" === t ? t = "m²" : "cm" === t && (t = "cm²"),
        {
            value: Number(e),
            unit: t,
            text: e + t
        }
    }
    ,
    tg.prototype._pointCanClosePath = function(A, e) {
        if (this.pickedPoints.length > 0) {
            var t = this.pickedPoints[0];
            e && (t = e(t),
            A = e(A));
            var i = A[0] - t[0]
              , o = A[1] - t[1];
            if (200 >= i * i + o * o + 0)
                return !0
        }
        return !1
    }
    ,
    tg.prototype._pathString = function(A) {
        if (!A || 0 === A.length)
            return "";
        for (var e = "M" + A[0][0] + " " + A[0][1], t = 1, i = A.length; i > t; t += 1)
            e = e + "L" + A[t][0] + " " + A[t][1];
        return this.isDone() && (e += "Z"),
        e
    }
    ,
    tg.prototype._calculateArea2D = function() {
        if (this.isDone() && this.pickedPoints.length >= 3) {
            for (var A = this.pickedPoints, e = this.pickedPoints[0], t = [], i = 1, o = A.length; o > i; i += 1)
                t.push([A[i][0] - e[0], A[i][1] - e[1]]);
            for (var n = 0, r = 0, a = t.length; a - 1 > r; r += 1) {
                var s = t[r]
                  , l = t[r + 1];
                n += s[0] * l[1] - s[1] * l[0]
            }
            return Math.abs(n / 2)
        }
        return 0
    }
    ,
    tg.prototype._calculateArea3D = function() {
        if (this.isDone() && this.pickedPoints.length >= 3) {
            for (var A = this.pickedPoints, e = this.pickedPoints[0], t = jp(Yp([this.pickedPoints[1][0] - e[0], this.pickedPoints[1][1] - e[1], this.pickedPoints[1][2] - e[2]], [this.pickedPoints[2][0] - e[0], this.pickedPoints[2][1] - e[1], this.pickedPoints[2][2] - e[2]])), i = 0, o = 1, n = A.length; n > o; o += 1) {
                i += Hp(Yp([this.pickedPoints[o - 1][0] - e[0], this.pickedPoints[o - 1][1] - e[1], this.pickedPoints[o - 1][2] - e[2]], [this.pickedPoints[o][0] - e[0], this.pickedPoints[o][1] - e[1], this.pickedPoints[o][2] - e[2]]), t)
            }
            return Math.abs(i / 2)
        }
        return 0
    }
    ,
    tg.prototype._getPointsCenter = function(A) {
        var e = A.length;
        return [A.reduce((function(A, e) {
            return A + e[0]
        }
        ), 0) / e, A.reduce((function(A, e) {
            return A + e[1]
        }
        ), 0) / e, A.reduce((function(A, e) {
            return A + e[2]
        }
        ), 0) / e]
    }
    ,
    tg.prototype._crossProduct = function(A, e) {
        var t = A[0]
          , i = A[1]
          , o = A[2]
          , n = e[0]
          , r = e[1]
          , a = e[2];
        return [i * a - o * r, o * n - t * a, t * r - i * n]
    }
    ;
    var ig = function(A, e, t) {
        Xp.call(this, A),
        this.maxPointsNeed = 2,
        this.isMobile = e,
        this.number = t,
        this._drawPoints = [],
        this.startCircle = this.createCircle(),
        this.endCircle = this.createCircle(),
        this.svgGroup.appendChild(this.startCircle),
        this.svgGroup.appendChild(this.endCircle),
        this.distanceLine = this.createLine(),
        this.svgGroup.appendChild(this.distanceLine),
        this.deltaXLine = this.createLine(),
        this.deltaXLine.setAttributeNS(null, "stroke", "#ec4545"),
        this.deltaXLine.setAttributeNS(null, "stroke-dasharray", "6,4"),
        this.isMobile || this.svgGroup.appendChild(this.deltaXLine),
        this.deltaYLine = this.createLine(),
        this.deltaYLine.setAttributeNS(null, "stroke", "#45c345"),
        this.deltaYLine.setAttributeNS(null, "stroke-dasharray", "6,4"),
        this.isMobile || this.svgGroup.appendChild(this.deltaYLine),
        this.deltaZLine = this.createLine(),
        this.deltaZLine.setAttributeNS(null, "stroke", "#5757da"),
        this.deltaZLine.setAttributeNS(null, "stroke-dasharray", "6,4"),
        this.isMobile || this.svgGroup.appendChild(this.deltaZLine),
        this.deltaXText = new _p,
        this.deltaXText.textColor = "#ec4545",
        this.deltaXText.prefixTextBackgroundColor = "#ec4545",
        this.svgGroup.appendChild(this.deltaXText.group),
        this.deltaYText = new _p,
        this.deltaYText.textColor = "#45c345",
        this.deltaYText.prefixTextBackgroundColor = "#45c345",
        this.svgGroup.appendChild(this.deltaYText.group),
        this.deltaZText = new _p,
        this.deltaZText.textColor = "#5757da",
        this.deltaZText.prefixTextBackgroundColor = "#5757da",
        this.svgGroup.appendChild(this.deltaZText.group),
        this.distanceText = new _p,
        this.distanceText.textBackgroundColor = "#009bff";
        var i = this;
        this.distanceText.setClickCallback((function() {
            i.onclickCallback && i.onclickCallback(i)
        }
        )),
        this.svgGroup.appendChild(this.distanceText.group),
        this._distance = void 0,
        this._deltaXDistance = void 0,
        this._deltaYDistance = void 0,
        this._deltaZDistance = void 0
    };
    (ig.prototype = Object.assign(Object.create(Xp.prototype), {
        constructor: ig
    })).addPickedPoint = function(A, e, t) {
        if (Xp.prototype.addPickedPoint.call(this, A, e, t) && (this._drawPoints.push(A),
        this.isDone())) {
            if (3 === A.length) {
                var i = [];
                i[0] = this.pickedPoints[1][0],
                i[1] = this.pickedPoints[0][1],
                i[2] = this.pickedPoints[1][2];
                var o = [];
                o[0] = this.pickedPoints[1][0],
                o[1] = this.pickedPoints[0][1],
                o[2] = this.pickedPoints[0][2],
                this._drawPoints.push(i),
                this._drawPoints.push(o)
            }
            this._distance = qp(this._drawPoints[0], this._drawPoints[1]),
            this._deltaYDistance = qp(this._drawPoints[1], this._drawPoints[2]),
            this._deltaZDistance = qp(this._drawPoints[2], this._drawPoints[3]),
            this._deltaXDistance = qp(this._drawPoints[3], this._drawPoints[0]),
            this.updateTexts()
        }
    }
    ,
    ig.prototype.draw = function(A, e) {
        if (this.svgGroup.parentNode) {
            var t = this._drawPoints;
            if (t.length > 0) {
                A && !this.isDone() && (t = t.concat([A]));
                var i = t
                  , o = !0;
                if (e) {
                    for (var n = !0, r = [], a = 0, s = t.length; s > a; a += 1)
                        r[a] = e(t[a]),
                        o && r[a][0] > 0 && r[a][0] < parseInt(this.svg.style.width, 10) && r[a][1] > 0 && r[a][1] < parseInt(this.svg.style.height, 10) && (o = !1),
                        void 0 !== r[a][2] && 0 !== r[a][2] || (n = !1);
                    i = r,
                    n && (o = !0)
                }
                var l = i[0]
                  , c = i.length > 1 ? i[1] : l;
                if (this.startCircle.setAttributeNS(null, "cx", l[0]),
                this.startCircle.setAttributeNS(null, "cy", l[1]),
                this.startCircle.style.display = "",
                this.distanceLine.setAttributeNS(null, "x1", l[0]),
                this.distanceLine.setAttributeNS(null, "y1", l[1]),
                this.distanceLine.setAttributeNS(null, "x2", c[0]),
                this.distanceLine.setAttributeNS(null, "y2", c[1]),
                this.distanceLine.style.display = "",
                2 > t.length)
                    return;
                if (this.distanceText.setPosition((l[0] + c[0]) / 2, (l[1] + c[1]) / 2),
                !this.isDone()) {
                    var h = qp(t[0], t[1]);
                    this._distance = h
                }
                if (4 === t.length) {
                    if (o)
                        return void (this.svgGroup.style.display = "none");
                    this.svgGroup.style.display = "",
                    this.isSelected ? (this.distanceText.isShowShadow = !0,
                    this.distanceText.textBackgroundColor = "#ffffff",
                    this.distanceText.textColor = "#009bff") : (this.distanceText.isShowShadow = !1,
                    this.distanceText.textBackgroundColor = "#009bff",
                    this.distanceText.textColor = "#ffffff"),
                    this.distanceText.draw(),
                    this.endCircle.style.display = "",
                    this.deltaYLine.style.display = "",
                    this.deltaXLine.style.display = "",
                    this.deltaZLine.style.display = "",
                    this.endCircle.setAttributeNS(null, "cx", c[0]),
                    this.endCircle.setAttributeNS(null, "cy", c[1]);
                    var d = i[2]
                      , p = i[3];
                    this.deltaYLine.setAttributeNS(null, "x1", c[0]),
                    this.deltaYLine.setAttributeNS(null, "y1", c[1]),
                    this.deltaYLine.setAttributeNS(null, "x2", d[0]),
                    this.deltaYLine.setAttributeNS(null, "y2", d[1]),
                    this.deltaYText.setPosition((d[0] + c[0]) / 2, (d[1] + c[1]) / 2),
                    this.deltaZLine.setAttributeNS(null, "x1", d[0]),
                    this.deltaZLine.setAttributeNS(null, "y1", d[1]),
                    this.deltaZLine.setAttributeNS(null, "x2", p[0]),
                    this.deltaZLine.setAttributeNS(null, "y2", p[1]),
                    this.deltaZText.setPosition((d[0] + p[0]) / 2, (d[1] + p[1]) / 2),
                    this.deltaXLine.setAttributeNS(null, "x1", p[0]),
                    this.deltaXLine.setAttributeNS(null, "y1", p[1]),
                    this.deltaXLine.setAttributeNS(null, "x2", l[0]),
                    this.deltaXLine.setAttributeNS(null, "y2", l[1]),
                    this.deltaXText.setPosition((p[0] + l[0]) / 2, (p[1] + l[1]) / 2),
                    this.isSelected && (this.isMobile || (this.deltaXText.draw(),
                    this.deltaYText.draw(),
                    this.deltaZText.draw()),
                    this.layoutResultText())
                }
            }
        }
    }
    ,
    ig.prototype.layoutResultText = function() {
        for (var A = this.distanceText.group.getBBox(), e = this.deltaXText.group.getBBox(), t = this.deltaYText.group.getBBox(), i = this.deltaZText.group.getBBox(), o = [e, t, i], n = !1, r = 0; o.length > r; r += 1)
            if (zp(A, o[r])) {
                n = !0;
                break
            }
        if (n || (n = zp(e, t)),
        n || (n = zp(e, i)),
        n || (n = zp(t, i)),
        n) {
            var a = Math.max(A.width, e.width, t.width, i.width)
              , s = A.x + A.width / 2
              , l = A.y + A.height + 8;
            return this.deltaXText.setPosition(s, l + e.height / 2),
            this.deltaYText.setPosition(s, (l += e.height) + t.height / 2),
            this.deltaZText.setPosition(s, (l += t.height) + i.height / 2),
            this.isMobile || (this.deltaXText.draw(a),
            this.deltaYText.draw(a),
            this.deltaZText.draw(a)),
            this.distanceText.draw(a),
            n
        }
    }
    ,
    ig.prototype.measureResult = function() {
        if (this._distance)
            return [this._distance, this._deltaXDistance, this._deltaYDistance, this._deltaZDistance]
    }
    ,
    ig.prototype.updateTexts = function() {
        this._distance && (this.distanceText.setText(this.isMobile ? "线段" + this.number + ": " + this.resultToDisplayOfLength(this._distance).text : this.resultToDisplayOfLength(this._distance).text, void 0),
        this.distanceText.draw(),
        this.isDone() && (0 !== this._deltaXDistance && this.deltaXText.setText(this.resultToDisplayOfLength(this._deltaXDistance).text, "X"),
        0 !== this._deltaYDistance && this.deltaYText.setText(this.resultToDisplayOfLength(this._deltaYDistance).text, "Y"),
        0 !== this._deltaZDistance && this.deltaZText.setText(this.resultToDisplayOfLength(this._deltaZDistance).text, "Z"),
        this.isSelected && !this.isMobile && (this.deltaXText.draw(),
        this.deltaYText.draw(),
        this.deltaZText.draw())))
    }
    ,
    ig.prototype.setSelected = function(A) {
        Xp.prototype.setSelected.call(this, A) && (A ? (this.distanceText.isShowShadow = !0,
        this.distanceText.textBackgroundColor = "#ffffff",
        this.distanceText.textColor = "#009bff",
        this.isMobile || (this.deltaXText.draw(),
        this.deltaYText.draw(),
        this.deltaZText.draw()),
        this.distanceText.draw(),
        this.layoutResultText()) : (this.deltaXText.hide(),
        this.deltaYText.hide(),
        this.deltaZText.hide(),
        this.distanceText.isShowShadow = !1,
        this.distanceText.textBackgroundColor = "#009bff",
        this.distanceText.textColor = "#ffffff",
        this.distanceText.draw()))
    }
    ;
    var og = function(A) {
        Xp.call(this, A),
        this.maxPointsNeed = 2,
        this.startCircle = this.createCircle(),
        this.endCircle = this.createCircle(),
        this.svgGroup.appendChild(this.startCircle),
        this.svgGroup.appendChild(this.endCircle),
        this.distanceLine = this.createLine(),
        this.svgGroup.appendChild(this.distanceLine),
        this.distanceText = new _p,
        this.distanceText.textBackgroundColor = "#009bff",
        this.svgGroup.appendChild(this.distanceText.group);
        var e = this;
        this.distanceText.setClickCallback((function() {
            e.onclickCallback && e.onclickCallback(e)
        }
        )),
        this.pickedComponentKeys = [],
        this._distance = void 0
    };
    (og.prototype = Object.assign(Object.create(Xp.prototype), {
        constructor: og
    })).setData = function(A, e, t) {
        this.pickedPoints = A,
        this._distance = e,
        t && (this.unitOfModel = this.unitOfModel && this.unitOfModel !== t ? void 0 : t)
    }
    ,
    og.prototype.draw = function(A, e) {
        if (this.svgGroup.parentNode && this.isDone()) {
            var t = this.pickedPoints;
            if (e) {
                for (var i = [], o = 0, n = t.length; n > o; o += 1)
                    i[o] = e(t[o]);
                t = i
            }
            var r = t[0]
              , a = t[1];
            this.startCircle.setAttributeNS(null, "cx", r[0]),
            this.startCircle.setAttributeNS(null, "cy", r[1]),
            this.startCircle.style.display = "",
            this.endCircle.setAttributeNS(null, "cx", a[0]),
            this.endCircle.setAttributeNS(null, "cy", a[1]),
            this.endCircle.style.display = "",
            this.distanceLine.setAttributeNS(null, "x1", r[0]),
            this.distanceLine.setAttributeNS(null, "y1", r[1]),
            this.distanceLine.setAttributeNS(null, "x2", a[0]),
            this.distanceLine.setAttributeNS(null, "y2", a[1]),
            this.distanceLine.style.display = "",
            this.distanceText.setPosition((r[0] + a[0]) / 2, (r[1] + a[1]) / 2),
            this.updateTexts()
        }
    }
    ,
    og.prototype.measureResult = function() {
        if (void 0 !== this._distance)
            return this._distance
    }
    ,
    og.prototype.updateTexts = function() {
        void 0 !== this._distance && (this.distanceText.setText(this.resultToDisplayOfLength(this._distance).text, void 0),
        this.distanceText.draw())
    }
    ,
    og.prototype.setSelected = function(A) {
        Xp.prototype.setSelected.call(this, A) && (A ? (this.distanceText.isShowShadow = !0,
        this.distanceText.textBackgroundColor = "#ffffff",
        this.distanceText.textColor = "#009bff",
        this.distanceText.draw()) : (this.distanceText.isShowShadow = !1,
        this.distanceText.textBackgroundColor = "#009bff",
        this.distanceText.textColor = "#ffffff",
        this.distanceText.draw()))
    }
    ;
    var ng = function(A) {
        Xp.call(this, A),
        this.maxPointsNeed = 2;
        var e = Np();
        e.setAttributeNS(null, "stroke-width", "2"),
        e.setAttributeNS(null, "stroke", "#0aea06"),
        this.svgGroup.appendChild(e),
        this._line = e,
        this.distanceText = new _p,
        this.distanceText.textBackgroundColor = "#009bff",
        this.svgGroup.appendChild(this.distanceText.group)
    };
    (ng.prototype = Object.assign(Object.create(Xp.prototype), {
        constructor: ng
    })).setData = function(A, e) {
        A && e && (this._points = [A, e])
    }
    ,
    ng.prototype.draw = function(A, e) {
        if (2 === this._points.length) {
            var t = e(this._points[0])
              , i = e(this._points[1]);
            this._line.setAttributeNS(null, "x1", t[0]),
            this._line.setAttributeNS(null, "y1", t[1]),
            this._line.setAttributeNS(null, "x2", i[0]),
            this._line.setAttributeNS(null, "y2", i[1]),
            this.distanceText.setPosition((t[0] + i[0]) / 2, (t[1] + i[1]) / 2);
            var o = qp(this._points[0], this._points[1]);
            this.distanceText.setText(this.resultToDisplayOfLength(o).text, void 0),
            this.distanceText.draw()
        }
    }
    ;
    var rg, ag, sg = function(A, e) {
        this.x = A || 0,
        this.y = e || 0
    };
    Object.defineProperties(sg.prototype, {
        width: {
            get: function() {
                return this.x
            },
            set: function(A) {
                this.x = A
            }
        },
        height: {
            get: function() {
                return this.y
            },
            set: function(A) {
                this.y = A
            }
        }
    }),
    Object.assign(sg.prototype, {
        isVector2: !0,
        set: function(A, e) {
            return this.x = A,
            this.y = e,
            this
        },
        setScalar: function(A) {
            return this.x = A,
            this.y = A,
            this
        },
        setX: function(A) {
            return this.x = A,
            this
        },
        setY: function(A) {
            return this.y = A,
            this
        },
        setComponent: function(A, e) {
            switch (A) {
            case 0:
                this.x = e;
                break;
            case 1:
                this.y = e;
                break;
            default:
                throw new Error("index is out of range: " + A)
            }
            return this
        },
        getComponent: function(A) {
            switch (A) {
            case 0:
                return this.x;
            case 1:
                return this.y;
            default:
                throw new Error("index is out of range: " + A)
            }
        },
        clone: function() {
            return new this.constructor(this.x,this.y)
        },
        copy: function(A) {
            return this.x = A.x,
            this.y = A.y,
            this
        },
        add: function(A, e) {
            return void 0 !== e ? (console.warn("Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),
            this.addVectors(A, e)) : (this.x += A.x,
            this.y += A.y,
            this)
        },
        addScalar: function(A) {
            return this.x += A,
            this.y += A,
            this
        },
        addVectors: function(A, e) {
            return this.x = A.x + e.x,
            this.y = A.y + e.y,
            this
        },
        addScaledVector: function(A, e) {
            return this.x += A.x * e,
            this.y += A.y * e,
            this
        },
        sub: function(A, e) {
            return void 0 !== e ? (console.warn("Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),
            this.subVectors(A, e)) : (this.x -= A.x,
            this.y -= A.y,
            this)
        },
        subScalar: function(A) {
            return this.x -= A,
            this.y -= A,
            this
        },
        subVectors: function(A, e) {
            return this.x = A.x - e.x,
            this.y = A.y - e.y,
            this
        },
        multiply: function(A) {
            return this.x *= A.x,
            this.y *= A.y,
            this
        },
        multiplyScalar: function(A) {
            return this.x *= A,
            this.y *= A,
            this
        },
        divide: function(A) {
            return this.x /= A.x,
            this.y /= A.y,
            this
        },
        divideScalar: function(A) {
            return this.multiplyScalar(1 / A)
        },
        applyMatrix3: function(A) {
            var e = this.x
              , t = this.y
              , i = A.elements;
            return this.x = i[0] * e + i[3] * t + i[6],
            this.y = i[1] * e + i[4] * t + i[7],
            this
        },
        min: function(A) {
            return this.x > A.x && (this.x = A.x),
            this.y > A.y && (this.y = A.y),
            this
        },
        max: function(A) {
            return A.x > this.x && (this.x = A.x),
            A.y > this.y && (this.y = A.y),
            this
        },
        clamp: function(A, e) {
            return this.x = Math.max(A.x, Math.min(e.x, this.x)),
            this.y = Math.max(A.y, Math.min(e.y, this.y)),
            this
        },
        clampScalar: (rg = new sg,
        ag = new sg,
        function(A, e) {
            return rg.set(A, A),
            ag.set(e, e),
            this.clamp(rg, ag)
        }
        ),
        clampLength: function(A, e) {
            var t = this.length();
            return this.divideScalar(t || 1).multiplyScalar(Math.max(A, Math.min(e, t)))
        },
        floor: function() {
            return this.x = Math.floor(this.x),
            this.y = Math.floor(this.y),
            this
        },
        ceil: function() {
            return this.x = Math.ceil(this.x),
            this.y = Math.ceil(this.y),
            this
        },
        round: function() {
            return this.x = Math.round(this.x),
            this.y = Math.round(this.y),
            this
        },
        roundToZero: function() {
            return this.x = 0 > this.x ? Math.ceil(this.x) : Math.floor(this.x),
            this.y = 0 > this.y ? Math.ceil(this.y) : Math.floor(this.y),
            this
        },
        negate: function() {
            return this.x = -this.x,
            this.y = -this.y,
            this
        },
        dot: function(A) {
            return this.x * A.x + this.y * A.y
        },
        cross: function(A) {
            return this.x * A.y - this.y * A.x
        },
        lengthSq: function() {
            return this.x * this.x + this.y * this.y
        },
        length: function() {
            return Math.sqrt(this.x * this.x + this.y * this.y)
        },
        manhattanLength: function() {
            return Math.abs(this.x) + Math.abs(this.y)
        },
        normalize: function() {
            return this.divideScalar(this.length() || 1)
        },
        angle: function() {
            var A = Math.atan2(this.y, this.x);
            return 0 > A && (A += 2 * Math.PI),
            A
        },
        distanceTo: function(A) {
            return Math.sqrt(this.distanceToSquared(A))
        },
        distanceToSquared: function(A) {
            var e = this.x - A.x
              , t = this.y - A.y;
            return e * e + t * t
        },
        manhattanDistanceTo: function(A) {
            return Math.abs(this.x - A.x) + Math.abs(this.y - A.y)
        },
        setLength: function(A) {
            return this.normalize().multiplyScalar(A)
        },
        lerp: function(A, e) {
            return this.x += (A.x - this.x) * e,
            this.y += (A.y - this.y) * e,
            this
        },
        lerpVectors: function(A, e, t) {
            return this.subVectors(e, A).multiplyScalar(t).add(A)
        },
        equals: function(A) {
            return A.x === this.x && A.y === this.y
        },
        fromArray: function(A, e) {
            return void 0 === e && (e = 0),
            this.x = A[e],
            this.y = A[e + 1],
            this
        },
        toArray: function(A, e) {
            return void 0 === A && (A = []),
            void 0 === e && (e = 0),
            A[e] = this.x,
            A[e + 1] = this.y,
            A
        },
        rotateAround: function(A, e) {
            var t = Math.cos(e)
              , i = Math.sin(e)
              , o = this.x - A.x
              , n = this.y - A.y;
            return this.x = o * t - n * i + A.x,
            this.y = o * i + n * t + A.y,
            this
        }
    });
    var lg = function() {
        this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1]
    };
    function cg(A, e) {
        this.normal = void 0 !== A ? A : new $c(1,0,0),
        this.constant = void 0 !== e ? e : 0
    }
    lg.prototype.clear = function() {
        return this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1],
        this
    }
    ,
    lg.prototype.set = function(A, e, t, i, o, n, r, a, s) {
        var l = this.elements;
        return l[0] = A,
        l[1] = i,
        l[2] = r,
        l[3] = e,
        l[4] = o,
        l[5] = a,
        l[6] = t,
        l[7] = n,
        l[8] = s,
        this
    }
    ,
    lg.prototype.clone = function() {
        return (new this.constructor).fromArray(this.elements)
    }
    ,
    lg.prototype.fromArray = function(A, e) {
        void 0 === e && (e = 0);
        for (var t = 0; 9 > t; t += 1)
            this.elements[t] = A[t + e];
        return this
    }
    ,
    lg.prototype.multiply = function(A) {
        return this.multiplyMatrices(this, A)
    }
    ,
    lg.prototype.multiplyMatrices = function(A, e) {
        var t = A.elements
          , i = e.elements
          , o = this.elements
          , n = t[0]
          , r = t[3]
          , a = t[6]
          , s = t[1]
          , l = t[4]
          , c = t[7]
          , h = t[2]
          , d = t[5]
          , p = t[8]
          , g = i[0]
          , u = i[3]
          , f = i[6]
          , m = i[1]
          , C = i[4]
          , y = i[7]
          , v = i[2]
          , I = i[5]
          , E = i[8];
        return o[0] = n * g + r * m + a * v,
        o[3] = n * u + r * C + a * I,
        o[6] = n * f + r * y + a * E,
        o[1] = s * g + l * m + c * v,
        o[4] = s * u + l * C + c * I,
        o[7] = s * f + l * y + c * E,
        o[2] = h * g + d * m + p * v,
        o[5] = h * u + d * C + p * I,
        o[8] = h * f + d * y + p * E,
        this
    }
    ,
    lg.prototype.scale = function(A, e) {
        var t = this.elements;
        return t[0] *= A,
        t[3] *= A,
        t[6] *= A,
        t[1] *= e,
        t[4] *= e,
        t[7] *= e,
        this
    }
    ,
    lg.prototype.rotate = function(A) {
        var e = Math.cos(A)
          , t = Math.sin(A)
          , i = this.elements
          , o = i[0]
          , n = i[3]
          , r = i[6]
          , a = i[1]
          , s = i[4]
          , l = i[7];
        return i[0] = e * o + t * a,
        i[3] = e * n + t * s,
        i[6] = e * r + t * l,
        i[1] = -t * o + e * a,
        i[4] = -t * n + e * s,
        i[7] = -t * r + e * l,
        this
    }
    ,
    lg.prototype.makeRotate = function(A) {
        var e = Math.cos(A)
          , t = Math.sin(A);
        return this.set(e, -t, 0, t, e, 0, 0, 0, 1),
        this
    }
    ,
    lg.prototype.translate = function(A, e) {
        var t = this.elements;
        return t[0] += A * t[2],
        t[3] += A * t[5],
        t[6] += A * t[8],
        t[1] += e * t[2],
        t[4] += e * t[5],
        t[7] += e * t[8],
        this
    }
    ,
    lg.prototype.makeShear = function(A, e) {
        return this.set(1, e, 0, A, 1, 0, 0, 0, 1),
        this
    }
    ,
    lg.prototype.fromCanvasTransform = function(A, e, t, i, o, n) {
        return this.set(A, t, o, e, i, n, 0, 0, 1),
        this
    }
    ,
    lg.prototype.toCanvasTransform = function() {
        var A = this.elements;
        return [A[0], A[3], A[1], A[4], A[6], A[7]]
    }
    ,
    lg.prototype.getInverse = function(A, e) {
        A && A.isMatrix4 && console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");
        var t = A.elements
          , i = this.elements
          , o = t[0]
          , n = t[1]
          , r = t[2]
          , a = t[3]
          , s = t[4]
          , l = t[5]
          , c = t[6]
          , h = t[7]
          , d = t[8]
          , p = d * s - l * h
          , g = l * c - d * a
          , u = h * a - s * c
          , f = o * p + n * g + r * u;
        if (0 === f) {
            var m = "THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0";
            if (!0 === e)
                throw new Error(m);
            return console.warn(m),
            this.identity()
        }
        var C = 1 / f;
        return i[0] = p * C,
        i[1] = (r * h - d * n) * C,
        i[2] = (l * n - r * s) * C,
        i[3] = g * C,
        i[4] = (d * o - r * c) * C,
        i[5] = (r * a - l * o) * C,
        i[6] = u * C,
        i[7] = (n * c - h * o) * C,
        i[8] = (s * o - n * a) * C,
        this
    }
    ,
    Object.assign(cg.prototype, {
        isPlane: !0,
        set: function(A, e) {
            return this.normal.copy(A),
            this.constant = e,
            this
        },
        setComponents: function(A, e, t, i) {
            return this.normal.set(A, e, t),
            this.constant = i,
            this
        },
        setFromNormalAndCoplanarPoint: function(A, e) {
            return this.normal.copy(A),
            this.constant = -e.dot(this.normal),
            this
        },
        setFromCoplanarPoints: function() {
            var A = new $c
              , e = new $c;
            return function(t, i, o) {
                var n = A.subVectors(o, i).cross(e.subVectors(t, i)).normalize();
                return this.setFromNormalAndCoplanarPoint(n, t),
                this
            }
        }(),
        clone: function() {
            return (new this.constructor).copy(this)
        },
        copy: function(A) {
            return this.normal.copy(A.normal),
            this.constant = A.constant,
            this
        },
        normalize: function() {
            var A = 1 / this.normal.length();
            return this.normal.multiplyScalar(A),
            this.constant *= A,
            this
        },
        negate: function() {
            return this.constant *= -1,
            this.normal.negate(),
            this
        },
        distanceToPoint: function(A) {
            return this.normal.dot(A) + this.constant
        },
        distanceToSphere: function(A) {
            return this.distanceToPoint(A.center) - A.radius
        },
        projectPoint: function(A, e) {
            return void 0 === e && (console.warn("THREE.Plane: .projectPoint() target is now required"),
            e = new $c),
            e.copy(this.normal).multiplyScalar(-this.distanceToPoint(A)).add(A)
        },
        intersectLine: function() {
            var A = new $c;
            return function(e, t) {
                void 0 === t && (console.warn("THREE.Plane: .intersectLine() target is now required"),
                t = new $c);
                var i = e.delta(A)
                  , o = this.normal.dot(i);
                if (0 === o)
                    return 0 === this.distanceToPoint(e.start) ? t.copy(e.start) : void 0;
                var n = -(e.start.dot(this.normal) + this.constant) / o;
                return 0 > n || n > 1 ? void 0 : t.copy(i).multiplyScalar(n).add(e.start)
            }
        }(),
        intersectsLine: function(A) {
            var e = this.distanceToPoint(A.start)
              , t = this.distanceToPoint(A.end);
            return 0 > e && t > 0 || 0 > t && e > 0
        },
        intersectsBox: function(A) {
            return A.intersectsPlane(this)
        },
        intersectsSphere: function(A) {
            return A.intersectsPlane(this)
        },
        coplanarPoint: function(A) {
            return void 0 === A && (console.warn("THREE.Plane: .coplanarPoint() target is now required"),
            A = new $c),
            A.copy(this.normal).multiplyScalar(-this.constant)
        },
        applyMatrix4: function() {
            var A = new $c
              , e = new lg;
            return function(t, i) {
                var o = i || e.getNormalMatrix(t)
                  , n = this.coplanarPoint(A).applyMatrix4(t)
                  , r = this.normal.applyMatrix3(o).normalize();
                return this.constant = -n.dot(r),
                this
            }
        }(),
        translate: function(A) {
            return this.constant -= A.dot(this.normal),
            this
        },
        equals: function(A) {
            return A.normal.equals(this.normal) && A.constant === this.constant
        }
    });
    var hg = function(A, e) {
        this._point = void 0,
        this._normal = void 0,
        this.viewer = e,
        this.svg = A;
        var t = document.createElementNS(Dp, "polygon");
        t.setAttribute("fill", "rgba(10,234,6,0.2)"),
        t.setAttribute("stroke", "#0aea06"),
        t.setAttribute("stroke-width", 1),
        t.style.pointerEvents = "none",
        this._panel = t,
        this.hoverPanelSize = {
            width: 20,
            height: 20
        }
    };
    hg.prototype.setupWithPoint = function(A, e) {
        this._point = A,
        this._normal = e
    }
    ,
    hg.prototype.remove = function() {
        this.svg && this._panel.parentNode && this.svg.removeChild(this._panel)
    }
    ,
    hg.prototype.add = function() {
        this.svg && this._panel && this.svg.appendChild(this._panel)
    }
    ,
    hg.prototype.isVisible = function() {
        return !!this._panel.parentNode
    }
    ,
    hg.prototype.stretchOnDirection = function(A, e, t) {
        var i = A.clone().add(e).multiplyScalar(.5)
          , o = e.clone().sub(A).normalize();
        return [i.clone().sub(o.clone().multiplyScalar(t / 2)), i.clone().add(o.clone().multiplyScalar(t / 2))]
    }
    ,
    hg.prototype.draw = function() {
        var A = this.viewer.getScene().worldToDrawing(this._normal);
        A.normalize();
        var e = this.viewer.worldToClient(this._point)
          , t = this.viewer.getScene().worldToDrawing(this._point)
          , i = this.viewer.cameraControl
          , o = new cg;
        o.setFromNormalAndCoplanarPoint(A, t);
        var n = new sg(e.x - 10,e.y - 10)
          , r = new sg(e.x + 10,e.y - 10)
          , a = t
          , s = i.getRaycaster(n.x, n.y)
          , l = new $c
          , c = new $c;
        if (s.ray.intersectPlane(o, l),
        (s = i.getRaycaster(r.x, r.y)).ray.intersectPlane(o, c),
        null !== l && null !== c) {
            var h = new $c(1,0,0)
              , d = new $c(0,0,1)
              , p = new $c(0,1,0)
              , g = .0025 >= Math.abs(A.clone().dot(h))
              , u = .0025 >= Math.abs(A.clone().dot(p));
            if (g && u)
                var f = h.clone()
                  , m = p.clone();
            else
                f = d.clone().cross(A).normalize(),
                m = A.clone().cross(f).normalize();
            var C = l.distanceTo(c) / 2
              , y = f.clone().multiplyScalar(C)
              , v = m.clone().multiplyScalar(C)
              , I = a.clone().sub(y).add(v)
              , E = a.clone().add(y).add(v)
              , B = a.clone().sub(y).sub(v)
              , x = a.clone().add(y).sub(v)
              , S = [];
            S.push(I, E, x, B);
            for (var w = [], M = i.getContainerDimensions(), b = 0; S.length > b; b += 1) {
                var U = new $c(S[b].x,S[b].y,S[b].z);
                U.project(i.camera);
                var F = {
                    x: 0,
                    y: 0,
                    z: 0
                };
                F.x = Math.floor(.5 * (U.x + 1) * M.width + .5),
                F.y = Math.floor(-.5 * (U.y - 1) * M.height + .5),
                F.z = U.z || 0,
                w.push(new $c(F.x,F.y,0))
            }
            var K = this.hoverPanelSize
              , Q = w[0].distanceTo(w[1])
              , R = w[0].distanceTo(w[3]) / K.height;
            if (1 !== Q / K.width) {
                var T = this.stretchOnDirection(w[0], w[1], K.width)
                  , k = this.stretchOnDirection(w[2], w[3], K.width);
                w = T.concat(k)
            }
            if (1 !== R) {
                T = this.stretchOnDirection(w[0], w[3], K.height),
                k = this.stretchOnDirection(w[1], w[2], K.height);
                w = [T[0], k[0], k[1], T[1]]
            }
            for (var D = "", L = 0; w.length > L; L += 1)
                D += w[L].x + ",",
                D += w[L].y + " ";
            this._panel.setAttribute("points", D)
        }
    }
    ;
    var dg = function(A) {
        this._point = void 0,
        this.svg = A;
        var e = Vp(5);
        e.setAttributeNS(null, "fill", "#00ff00"),
        this._circle = e
    };
    dg.prototype.setupWithPoint = function(A) {
        A && (this._point = A)
    }
    ,
    dg.prototype.remove = function() {
        this.svg && this._circle.parentNode && this.svg.removeChild(this._circle)
    }
    ,
    dg.prototype.add = function() {
        this.svg && this._circle && this.svg.appendChild(this._circle)
    }
    ,
    dg.prototype.isVisible = function() {
        return !!this._circle.parentNode
    }
    ,
    dg.prototype.draw = function(A) {
        if (this._point) {
            var e = A(this._point);
            this._circle.setAttributeNS(null, "cx", e[0]),
            this._circle.setAttributeNS(null, "cy", e[1])
        }
    }
    ;
    var pg = function(A) {
        Xp.call(this, A),
        this.volumeText = new _p,
        this.volumeText.textBackgroundColor = "#009bff",
        this.svgGroup.appendChild(this.volumeText.group);
        var e = this;
        this.volumeText.setClickCallback((function() {
            e.onclickCallback && e.onclickCallback(e)
        }
        )),
        this.pickedComponentKeys = [],
        this._position = void 0,
        this._volume = void 0
    };
    (pg.prototype = Object.assign(Object.create(Xp.prototype), {
        constructor: pg
    })).setData = function(A, e, t) {
        this._position = A,
        this._volume = e,
        t && (this.unitOfModel = this.unitOfModel && this.unitOfModel !== t ? void 0 : t)
    }
    ,
    pg.prototype.isDone = function() {
        return this.pickedComponentKeys[0] && this._position
    }
    ,
    pg.prototype.draw = function(A, e) {
        if (this.svgGroup.parentNode && this.isDone()) {
            var t = this._position;
            e && (t = e(t)),
            this.volumeText.setPosition(t[0], t[1]),
            this.updateTexts()
        }
    }
    ,
    pg.prototype.measureResult = function() {
        if (this._volume)
            return this._volume
    }
    ,
    pg.prototype.resultToDisplayOfVolume = function(A) {
        var e = A
          , t = this.unitOfModel;
        return this.adjustOption && (e = this.adjustOption.adjustVolume(A),
        t = this.adjustOption.unit),
        this.unitOnUI && (t && (e = Jp(t, this.unitOnUI, e, 3)),
        t = this.unitOnUI),
        t || (t = ""),
        e = e.toFixed(this.precision),
        "mm" === t ? t = "mm³" : "m" === t ? t = "m³" : "cm" === t && (t = "cm³"),
        {
            value: Number(e),
            unit: t,
            text: e + t
        }
    }
    ,
    pg.prototype.updateTexts = function() {
        this._volume && (this.volumeText.setText(this.resultToDisplayOfVolume(this._volume).text, void 0),
        this.volumeText.draw())
    }
    ,
    pg.prototype.setSelected = function(A) {
        Xp.prototype.setSelected.call(this, A) && (A ? (this.volumeText.isShowShadow = !0,
        this.volumeText.textBackgroundColor = "#ffffff",
        this.volumeText.textColor = "#009bff",
        this.volumeText.draw()) : (this.volumeText.isShowShadow = !1,
        this.volumeText.textBackgroundColor = "#009bff",
        this.volumeText.textColor = "#ffffff",
        this.volumeText.draw()))
    }
    ;
    var gg = function() {
        this.pointTransformer = void 0,
        this.parentDom = void 0,
        this.viewer = void 0,
        this.is3DMode = !1,
        this.isMobile = !1
    }
      , ug = "Distance"
      , fg = "Angle"
      , mg = "Adjust"
      , Cg = "Area"
      , yg = "MinDistance"
      , vg = "Volume"
      , Ig = function(A) {
        this.config = A,
        this.config.viewer.measure = this,
        this.svg = this._createSVG(A.parentDom.clientWidth, A.parentDom.clientHeight),
        A.parentDom.appendChild(this.svg),
        this._resize = this._resize.bind(this),
        this.config.viewer.addEventListener("resize", this._resize),
        this.setCurrentMode(ug),
        this.isOpen = !1,
        this.didEndMeasureCallback = void 0,
        this._items = [],
        this._adjustItem = void 0,
        this._adjustOption = void 0,
        this._precision = 3,
        this._unitSetByUser = "mm",
        this._pickedLine = void 0,
        this._pickedPoint = void 0,
        this._pickedPanel = void 0,
        this._selectedItem = void 0,
        this.open()
    };
    Ig.prototype.supportUnits = function() {
        return [{
            unit: "mm",
            title: "毫米"
        }, {
            unit: "cm",
            title: "厘米"
        }, {
            unit: "m",
            title: "米"
        }]
    }
    ,
    Ig.prototype.open = function() {
        this.isOpen || (this.isOpen = !0,
        this._handleKeyUp = this._handleKeyUp.bind(this),
        document.addEventListener("keyup", this._handleKeyUp))
    }
    ,
    Ig.prototype.close = function() {
        this.svg.parentNode.removeChild(this.svg),
        this.isOpen = !1,
        this.config.is3DMode && (this.config.viewer.clearSelection(),
        this.config.viewer.render()),
        this.config.viewer.measure = void 0,
        document.removeEventListener("keyup", this._handleKeyUp),
        this.config.viewer.removeEventListener("resize", this._resize)
    }
    ,
    Ig.prototype.setCurrentMode = function(A) {
        if (this.config.is3DMode || A !== vg && A !== yg)
            if (this._currentMode !== A && (this._currentMode = A,
            this._currentMeasureItem && (this._currentMeasureItem instanceof og && this.config.is3DMode && (this.config.viewer.clearSelection(),
            this.config.viewer.render()),
            this._currentMeasureItem.remove(),
            this._currentMeasureItem = void 0)),
            this._currentMode === mg) {
                var e = this._adjustItem ? this._adjustItem : this._currentMeasureItem;
                (e || e instanceof $p) && e.isDone() && (e.add(),
                e.draw(void 0, this.config.pointTransformer),
                this.didEndMeasureCallback && this.didEndMeasureCallback(e.measureResult()))
            } else
                this._adjustItem && this._adjustItem.remove()
    }
    ,
    Ig.prototype.getCurrentMode = function() {
        return this._currentMode
    }
    ,
    Ig.prototype.getCurrentUnit = function() {
        return this._unitSetByUser
    }
    ,
    Ig.prototype.setUnit = function(A) {
        if (A && this._unitSetByUser !== A) {
            this._unitSetByUser = A;
            for (var e = 0, t = this._items.length; t > e; e += 1) {
                this._items[e].changeUnit(A)
            }
            this._adjustOption && (this._adjustOption.valueAfterAdjust = Jp(this._adjustOption.unit, A, this._adjustOption.valueAfterAdjust, 0),
            this._adjustOption.unit = A)
        }
    }
    ,
    Ig.prototype.getCurrentPrecision = function() {
        return this._precision
    }
    ,
    Ig.prototype.setPrecision = function(A) {
        if (A && this._precision !== A) {
            this._precision = A;
            for (var e = 0, t = this._items.length; t > e; e += 1) {
                this._items[e].changePrecision(A)
            }
            this._adjustItem && this._adjustItem.changePrecision(A)
        }
    }
    ,
    Ig.prototype.clearAllMeasure = function() {
        for (var A = 0, e = this._items.length; e > A; A += 1) {
            this._items[A].remove()
        }
        this._items = [],
        this._selectedItem = void 0
    }
    ,
    Ig.prototype.removeSelectedMeasure = function() {
        if (this._selectedItem) {
            for (var A = 0, e = this._items.length; e > A; A += 1)
                if (this._items[A] === this._selectedItem) {
                    this._selectedItem.remove(),
                    this._items.splice(A, 1);
                    break
                }
            (this._selectedItem instanceof pg || this._selectedItem instanceof og) && this.config.is3DMode && (this.config.viewer.clearSelection(),
            this.config.viewer.render()),
            this._selectedItem = void 0,
            this._items.length > 0 && (this._selectedItem = this._items[this._items.length - 1],
            this._selectedItem.setSelected(!0))
        }
    }
    ,
    Ig.prototype.setAdjustForCurrentAdjustItem = function(A, e) {
        if (A && e && this._currentMode === mg && (this._currentMeasureItem && this._currentMeasureItem instanceof $p && this._currentMeasureItem.isDone() && (this._adjustItem && this._adjustItem.remove(),
        this._adjustItem = this._currentMeasureItem,
        this._currentMeasureItem = void 0),
        this._adjustItem && this._adjustItem.isDone())) {
            var t = new Ag;
            t.unit = A,
            t.valueBeforeAdjust = this._adjustItem.measureResult().distance,
            t.valueAfterAdjust = e,
            this._adjustOption = t;
            for (var i = 0, o = this._items.length; o > i; i += 1) {
                this._items[i].adjustWithOption(this._adjustOption)
            }
            this._adjustItem.adjustWithOption(this._adjustOption)
        }
    }
    ,
    Ig.prototype.cancelCurrentAdjust = function() {
        if (this._adjustItem && (this._adjustItem.remove(),
        this._adjustItem = void 0),
        this._currentMeasureItem instanceof $p && (this._currentMeasureItem.remove(),
        this._currentMeasureItem = void 0),
        this._adjustOption) {
            for (var A = 0, e = this._items.length; e > A; A += 1) {
                this._items[A].unAdjustWithOption(this._adjustOption)
            }
            this._adjustOption = void 0
        }
    }
    ,
    Ig.prototype.cancelCurrentMeasure = function() {
        !this._currentMeasureItem || this._currentMeasureItem instanceof $p || (this._currentMeasureItem.remove(),
        this._currentMeasureItem = void 0)
    }
    ,
    Ig.prototype.processIntersect = function(A) {
        if (this.isOpen) {
            if (!A)
                return this._hidePickedLine(),
                void this._hidePickedPoint();
            if (A.pickPoint) {
                var e = [A.pickPoint.x, A.pickPoint.y, void 0 === A.pickPoint.z ? 0 : A.pickPoint.z]
                  , t = e;
                if (A.pick) {
                    if (this._currentMode === mg && this._currentMeasureItem && this._currentMeasureItem.isDone() && (this._currentMeasureItem.remove(),
                    this._currentMeasureItem = void 0),
                    this._currentMeasureItem || this._createNewItem(),
                    !this._currentMeasureItem)
                        return;
                    if (this._currentMeasureItem instanceof og) {
                        var i = this._currentMeasureItem.pickedComponentKeys;
                        if (i.push(A.userId),
                        2 === i.length) {
                            var o = this.config.viewer.calculateMinDistance(i[0], i[1]);
                            if (o && o.start && o.end)
                                this._currentMeasureItem.setData([[o.start.x, o.start.y, o.start.z], [o.end.x, o.end.y, o.end.z]], o.minDistance, A.measureUnit),
                                this._currentMeasureItem.draw(void 0, this.config.pointTransformer);
                            else
                                this._currentMeasureItem = void 0
                        }
                        this.config.viewer.addToSelection(i),
                        this.config.viewer.render()
                    } else if (this._currentMeasureItem instanceof pg) {
                        var n = this._currentMeasureItem.pickedComponentKeys;
                        if (0 === n.length) {
                            n.push(A.userId);
                            var r = this.config.viewer.calculateComponentVolume(n[0]);
                            r && (this._currentMeasureItem.setData(r.position, r.volume, A.measureUnit),
                            this._currentMeasureItem.draw(void 0, this.config.pointTransformer)),
                            this.config.viewer.addToSelection(n),
                            this.config.viewer.render()
                        }
                    } else
                        t = void 0,
                        this._currentMeasureItem.addPickedPoint(e, A.measureUnit, this.config.pointTransformer),
                        this._currentMeasureItem.draw(t, this.config.pointTransformer);
                    if (this._currentMeasureItem && this._currentMeasureItem.isDone()) {
                        this._currentMeasureItem instanceof $p || !this._adjustOption || this._currentMeasureItem.adjustWithOption(this._adjustOption);
                        var a = this._currentMeasureItem.measureResult();
                        this._currentMeasureItem instanceof $p || (this._items.push(this._currentMeasureItem),
                        this._selectedItem && (this._selectedItem.setSelected(!1),
                        this._selectedItem = void 0),
                        this._selectedItem = this._currentMeasureItem,
                        this._selectedItem.setSelected(!0),
                        this._currentMeasureItem = void 0),
                        this.didEndMeasureCallback && this.didEndMeasureCallback(a)
                    }
                } else
                    this._currentMeasureItem && this._currentMeasureItem.draw(t, this.config.pointTransformer)
            }
            this._currentMode !== yg && this._currentMode !== vg && (A.pickPoint && A.isAbsorbPoint ? this._showPickedPoint(A.pickPoint) : this._hidePickedPoint(),
            A.pickPlane ? this._showPickedPanel(A.pickPoint, A.normal) : this._hidePickedPanel(),
            A.pickLine ? this._showPickedLine(A.pickLine[0], A.pickLine[1], A.measureUnit) : this._hidePickedLine())
        }
    }
    ,
    Ig.prototype.update = function() {
        if (this.isOpen) {
            for (var A = 0, e = this._items.length; e > A; A += 1) {
                this._items[A].draw(void 0, this.config.pointTransformer)
            }
            this._currentMeasureItem && this._currentMeasureItem.draw(void 0, this.config.pointTransformer),
            this._adjustItem && this._adjustItem.draw(void 0, this.config.pointTransformer),
            this._pickedLine && this._pickedLine.isVisible() && this._pickedLine.draw(void 0, this.config.pointTransformer),
            this._pickedPanel && this._pickedPanel.isVisible() && this._pickedPanel.draw(this.config.pointTransformer)
        }
    }
    ,
    Ig.prototype.changeSelect = function() {
        for (var A = 0, e = this._items.length; e > A; A += 1) {
            var t = this._items[A];
            t.setSelected(this._selectedItem === t)
        }
    }
    ,
    Ig.prototype._resize = function() {
        this.svg.style.width = this.config.parentDom.clientWidth,
        this.svg.style.height = this.config.parentDom.clientHeight
    }
    ,
    Ig.prototype._createNewItem = function() {
        switch (this._currentMode) {
        case ug:
            this._currentMeasureItem = new ig(this.svg,this.config.isMobile,this._items.length + 1);
            break;
        case fg:
            this._currentMeasureItem = new eg(this.svg);
            break;
        case mg:
            this._currentMeasureItem = new $p(this.svg);
            break;
        case Cg:
            this._currentMeasureItem = new tg(this.svg);
            break;
        case yg:
            this._currentMeasureItem = new og(this.svg);
            break;
        case vg:
            this._currentMeasureItem = new pg(this.svg)
        }
        if (this._currentMeasureItem) {
            this._currentMeasureItem.is3DMode = this.config.is3DMode,
            this._currentMeasureItem instanceof $p || (this._adjustOption && this._currentMeasureItem.adjustWithOption(this._adjustOption),
            this._unitSetByUser && this._currentMeasureItem.changeUnit(this._unitSetByUser)),
            this._currentMeasureItem.changePrecision(this._precision);
            var A = this;
            this._currentMeasureItem.setClickCallback((function(e) {
                e.isDone() && (A._selectedItem = e,
                A.changeSelect())
            }
            ))
        }
    }
    ,
    Ig.prototype._showPickedLine = function(A, e, t) {
        var i = [A.x, A.y, void 0 === A.z ? 0 : A.z]
          , o = [e.x, e.y, void 0 === e.z ? 0 : e.z];
        this._pickedLine || (this._pickedLine = new ng(this.svg),
        this._pickedLine.unitOfModel = t),
        this._adjustOption && this._pickedLine.adjustWithOption(this._adjustOption),
        this._pickedLine.changeUnit(this._unitSetByUser ? this._unitSetByUser : t),
        this._pickedLine.changePrecision(this._precision),
        this._pickedLine.add(),
        this._pickedLine.setData(i, o),
        this._pickedLine.draw(void 0, this.config.pointTransformer)
    }
    ,
    Ig.prototype._hidePickedLine = function() {
        this._pickedLine && this._pickedLine.remove()
    }
    ,
    Ig.prototype._showPickedPoint = function(A) {
        this._pickedPoint || (this._pickedPoint = new dg(this.svg)),
        this._pickedPoint.add(),
        this._pickedPoint.setupWithPoint(A),
        this._pickedPoint.draw(this.config.pointTransformer)
    }
    ,
    Ig.prototype._hidePickedPoint = function() {
        this._pickedPoint && this._pickedPoint.remove()
    }
    ,
    Ig.prototype._showPickedPanel = function(A, e) {
        this._pickedPanel || (this._pickedPanel = new hg(this.svg,this.config.viewer)),
        this._pickedPanel.add(),
        this._pickedPanel.setupWithPoint(A, e),
        this._pickedPanel.draw(this.config.pointTransformer)
    }
    ,
    Ig.prototype._hidePickedPanel = function() {
        this._pickedPanel && this._pickedPanel.remove()
    }
    ,
    Ig.prototype._createSVG = function(A, e) {
        var t = Lp();
        return t.style.width = A + "px",
        t.style.height = e + "px",
        t.style.position = "absolute",
        t.style.left = "0",
        t.style.top = "0",
        t
    }
    ,
    Ig.prototype._handleKeyUp = function(A) {
        var e = A.keyCode;
        27 === e ? this.cancelCurrentMeasure() : 46 === e && this.removeSelectedMeasure()
    }
    ;
    var Eg = function(A) {
        yp.call(this, Pc.PICK_BY_MEASURE),
        this.controlManager = A.controlManager,
        this.pickHelper = new kp(A.cameraControl),
        this.mouseDown = new s,
        this.lastEvent = null,
        this.pick = !1,
        this.pickPoint = new y;
        var e = A.getRenderer().domElement.parentElement
          , t = new gg;
        t.parentDom = e,
        t.pointTransformer = A.getScreenCoordFromSceneCoord.bind(A),
        t.viewer = A,
        t.is3DMode = !0,
        this.measure = new Ig(t);
        var i = this;
        A.cameraControl.addEventListener(Rc.ON_CAMERA_CHANGE, (function() {
            i.measure.update()
        }
        )),
        A.clearSelection()
    };
    (Eg.prototype = Object.create(yp.prototype)).constructor = Eg,
    Eg.prototype.destroy = function() {
        yp.prototype.destroy.call(this),
        this.editorManager = null,
        this.mouseDown = null,
        this.lastEvent = null,
        this.pickPoint = null,
        this.pickHelper.destroy(),
        this.pickHelper = null
    }
    ,
    Eg.prototype.processMouseDown = function(A) {
        return !!mh.isMobileDevice() || (A.button === t.LEFT ? (this.mouseDown.x = A.clientX,
        this.mouseDown.y = A.clientY,
        !1) : yp.prototype.processMouseDown.call(this, A))
    }
    ,
    Eg.prototype.processMouseMove = function(A) {
        return !1
    }
    ,
    Eg.prototype.processMouseUp = function(A) {
        if (mh.isMobileDevice())
            return !0;
        if (A.button === t.LEFT) {
            if (2 >= new s(A.clientX,A.clientY).distanceTo(this.mouseDown)) {
                var e = this.pickPoint.clone()
                  , i = void 0;
                return i = A.shiftKey ? this.pickHelper.handleShiftMeasure(A, !0, e) : this.pickHelper.handleMouseMeasure(A, !0, e),
                this.measure.processIntersect(i),
                e.equals(this.pickPoint) || (this.pick = !this.pick,
                this.pickPoint.copy(e)),
                this.controlManager.isUpdateRenderList = !0,
                !0
            }
            return !0
        }
        return yp.prototype.processMouseUp.call(this, A)
    }
    ,
    Eg.prototype.processKeyDown = function(A) {
        return 16 === A.keyCode || yp.prototype.processKeyDown.call(this, A)
    }
    ,
    Eg.prototype.processHover = function(A) {
        if (mh.isMobileDevice())
            return !0;
        var e = void 0;
        return e = A.shiftKey ? this.pickHelper.handleShiftMeasure(A, !1, this.pickPoint) : this.pickHelper.handleMouseMeasure(A, !1, this.pickPoint),
        this.measure.processIntersect(e),
        !0
    }
    ,
    Eg.prototype.processTouchstart = function(A) {
        return this.mouseDown.x = A.touches[0].clientX,
        this.mouseDown.y = A.touches[0].clientY,
        A.clientX = A.touches[0].clientX,
        A.clientY = A.touches[0].clientY,
        this.lastEvent = A,
        yp.prototype.processTouchstart.call(this, A)
    }
    ,
    Eg.prototype.processTouchmove = function(A) {
        return this.lastEvent = null,
        yp.prototype.processTouchmove.call(this, A)
    }
    ,
    Eg.prototype.processTouchend = function(A) {
        if (null !== this.lastEvent) {
            var e = this.pickHelper.handleMouseMeasure(this.lastEvent, !0, this.pickPoint);
            this.measure.processIntersect(e),
            this.controlManager.isUpdateRenderList = !0
        }
        return yp.prototype.processTouchend.call(this, A)
    }
    ,
    Eg.prototype.touchPointMove = function(A) {
        this.measure.processIntersect(this.pickHelper.handleMouseMeasure(A, !1, this.pickPoint))
    }
    ,
    Eg.prototype.touchPointEnd = function(A) {
        var e = this.pickPoint.clone()
          , t = this.pickHelper.handleMouseMeasure(A, !0, e);
        return this.measure.processIntersect(t),
        e.equals(this.pickPoint) || (this.pick = !this.pick,
        this.pickPoint.copy(e)),
        this.controlManager.isUpdateRenderList = !0,
        !0
    }
    ,
    Eg.prototype.onExit = function(A) {
        this.measure.close();
        var e = this.pickHelper.scene;
        e.hasGroup(gp.MEASUREPICKPLANE) && e.removeGroupByName(gp.MEASUREPICKPLANE)
    }
    ;
    var Bg, xg, Sg, wg = {
        pickByRect: function(A, e, t, i, o, n) {
            var r = []
              , a = i.octantToObjectMap
              , s = (A.getMatrixGlobal(),
            i.sceneState)
              , l = new aA;
            function c(A, t, i) {
                A && A.frustumIntersect(e, t, i)
            }
            var h = i.filter
              , d = h._hasVisibleFilter()
              , p = h._hasPickableFilter();
            if (t !== Kc.Clear) {
                var g, u, f = null, m = [];
                for (var C in a)
                    if (a.hasOwnProperty(C)) {
                        var y = i.getModel(C);
                        (f = a[C]).mesh;
                        var v = y && y.kdTreeNode
                          , I = [];
                        if (Array.isArray(v))
                            for (var E = 0, B = v.length; B > E; E += 1) {
                                var x = v[E]
                                  , S = x.modelKey
                                  , w = (new M).copy(y.getModelMatrix());
                                S && w.multiply(y.subModel[S]),
                                c(x, I, w)
                            }
                        else
                            c(v, I, y.getModelMatrix());
                        var b = Object.keys(y.manager.explosionList);
                        y && y.manager && b.length > 0 && (I = I.concat(b));
                        for (var U = 0, F = (m = uh.unique(I)).length; F > U; U += 1) {
                            var K = f.info[m[U]];
                            if (K)
                                for (var Q = 0, R = K.length; R > Q; Q += 1) {
                                    var T = K[Q];
                                    (u = void 0,
                                    u = i.isHiddenSourceObjectUserId((g = T).userId),
                                    d && !h._isVisible(g) || p && !h._isPickable(g) || u) || (l.copy(T.boundingBox),
                                    l.applyMatrix4(y.getModelMatrix()),
                                    this._intersectBox(e, l, n) && !this._clipBox(o, l) && r.push(T.userId))
                                }
                        }
                    }
                return (r = r.concat(this.pickNonModelObjectsByRect(o, i, e, n))).length > 0 && (Kc.Remove === t ? (s.removeSelection(r),
                i.dispatchEvent({
                    type: Rc.ON_RECTPICK_REMOVE,
                    list: r
                })) : Kc.Add === t && (s.addSelection(r),
                i.dispatchEvent({
                    type: Rc.ON_RECTPICK_ADD,
                    list: r
                }))),
                r
            }
            s.clearSelection()
        },
        getObjectsInBox: function(A, e, t, i, o) {
            var n = {}
              , r = t.octantToObjectMap
              , a = (A.getMatrixGlobal(),
            new aA);
            function s(A) {
                for (var e = new y, t = 0; 8 > t; t += 1)
                    if (e.x = 4 > t ? A.min.x : A.max.x,
                    e.y = 2 > t / 2 ? A.min.y : A.max.y,
                    e.z = t % 2 == 0 ? A.min.z : A.max.z,
                    !i.clipPoint(e))
                        return !1;
                return !0
            }
            function l(A) {
                return o ? !(e.min.x > A.min.x || A.max.x > e.max.x || e.min.y > A.min.y || A.max.y > e.max.y || e.min.z > A.min.z || A.max.z > e.max.z) : !(e.min.x > A.max.x || A.min.x > e.max.x || e.min.y > A.max.y || A.min.y > e.max.y || e.min.z > A.max.z || A.min.z > e.max.z)
            }
            function c(A) {
                return Boolean(!(e.max.x > A.max.x || A.min.x > e.min.x || e.max.y > A.max.y || A.min.y > e.min.y || e.max.z > A.max.z || A.min.z > e.min.z))
            }
            var h = t.filter
              , d = h._hasVisibleFilter()
              , p = h._hasPickableFilter();
            var g, u, f = null;
            for (var m in r)
                if (r.hasOwnProperty(m)) {
                    var C = t.getModel(m);
                    for (var v in (f = r[m]).info)
                        if (f.info.hasOwnProperty(v)) {
                            var I = f.info[v];
                            if (!I)
                                continue;
                            for (var E = 0, B = I.length; B > E; E += 1) {
                                var x = I[E];
                                (u = void 0,
                                u = t.isHiddenSourceObjectUserId((g = x).userId),
                                d && !h._isVisible(g) || p && !h._isPickable(g) || u) || (a.copy(x.boundingBox),
                                a.applyMatrix4(C.getModelMatrix()),
                                !l(a) || c(a) || s(a) || (n[x.userId] = !0))
                            }
                        }
                }
            var S = [];
            for (var w in n)
                S.push(w);
            return S
        },
        pickNonModelObjectsByRect: function(A, e, t, i) {
            var o = []
              , n = e.getNodeInfosInPlugins()
              , r = new aA;
            for (var a in n)
                if (n.hasOwnProperty(a)) {
                    var s = n[a];
                    for (var a in s)
                        if (s.hasOwnProperty(a)) {
                            var l = s[a][0].mesh;
                            if (l) {
                                l instanceof Array || (l = [l]),
                                r.empty();
                                for (var c = 0, h = l.length; h > c; c += 1) {
                                    var d = l[c];
                                    d instanceof H && r.expandByObject(d)
                                }
                                this._intersectBox(t, r, i) && !this._clipBox(A, r) && o.push(a)
                            }
                        }
                }
            return o
        },
        _intersectBox: (xg = new y,
        Sg = new y,
        function(A, e, t) {
            for (var i = 0, o = A.planes, n = 0; 6 > n; n += 1) {
                var r = o[n];
                xg.x = r.normal.x > 0 ? e.min.x : e.max.x,
                Sg.x = r.normal.x > 0 ? e.max.x : e.min.x,
                xg.y = r.normal.y > 0 ? e.min.y : e.max.y,
                Sg.y = r.normal.y > 0 ? e.max.y : e.min.y,
                xg.z = r.normal.z > 0 ? e.min.z : e.max.z,
                Sg.z = r.normal.z > 0 ? e.max.z : e.min.z;
                var a = r.distanceToPoint(xg)
                  , s = r.distanceToPoint(Sg);
                if (0 > a && 0 > s)
                    return !1;
                0 > a * s || (i += 1)
            }
            return t ? i >= 2 : 6 === i
        }
        ),
        _clipBox: (Bg = new y,
        function(A, e) {
            for (var t = 0; 8 > t; t += 1)
                if (Bg.x = 4 > t ? e.min.x : e.max.x,
                Bg.y = 2 > t / 2 ? e.min.y : e.max.y,
                Bg.z = t % 2 == 0 ? e.min.z : e.max.z,
                !A.clipPoint(Bg))
                    return !1;
            return !0
        }
        )
    }, Mg = function(A, e, t) {
        yp.call(this, A),
        this.cameraControl = e,
        this.frustum = new Ze,
        this.startPt = new s,
        this.endPt = new s,
        this.eventDispatcher = t
    };
    (Mg.prototype = Object.create(yp.prototype)).constructor = Mg,
    Mg.prototype.destroy = function(A) {
        yp.prototype.destroy.call(this),
        this.cameraControl = null,
        this.frustum = null,
        this.startPt = null,
        this.endPt = null,
        this.eventDispatcher = null
    }
    ,
    Mg.prototype.onUpdateUI = function(A) {
        this.eventDispatcher.dispatchEvent({
            type: Rc.ON_CONTROL_UPDATEUI,
            data: A,
            editor: this.name
        })
    }
    ,
    Mg.prototype.updateFrustum = function(A, e) {
        var t = this.startPt.x
          , i = this.endPt.x
          , o = this.startPt.y
          , n = this.endPt.y;
        if (t > i) {
            var r = t;
            t = i,
            i = r
        }
        if (o > n) {
            var a = o;
            o = n,
            n = a
        }
        if (i - t == 0 || n - o == 0)
            return !1;
        var s = this.cameraControl
          , l = s.getContainerDimensions();
        return A && s.computeFrustum(t, i, o, n, this.frustum, l),
        e && this.onUpdateUI({
            visible: !0,
            dir: this.endPt.x > this.startPt.x,
            left: t - l.left,
            top: o - l.top,
            width: i - t,
            height: n - o
        }),
        !0
    }
    ;
    var bg = function(A) {
        Mg.call(this, Pc.PICK_BY_RECT, A.cameraControl, A.modelManager),
        this.viewer = A,
        this.scene = A.getScene(),
        this.pickHelper = new kp(this.cameraControl),
        this.activatePick = !1,
        this.pressKey = "",
        this.pickPoint = new y,
        this.snapIsEnabled = !1
    };
    (bg.prototype = Object.create(Mg.prototype)).constructor = bg,
    bg.prototype.destroy = function() {
        Mg.prototype.destroy.call(this),
        this.pickHelper.destroy(),
        this.pickHelper = null,
        this.viewer = null,
        this.scene = null,
        this.pickPoint = null
    }
    ,
    bg.prototype.setPressKey = function(A) {
        this.pressKey = A
    }
    ,
    bg.prototype.processMouseDown = function(A) {
        return A.preventDefault(),
        this.activatePick = A.ctrlKey || A.altKey,
        this.activatePick && A.button === t.LEFT ? (this.startPt.set(A.clientX, A.clientY),
        !0) : Mg.prototype.processMouseDown(this, A)
    }
    ,
    bg.prototype.processMouseMove = function(A) {
        return this.activatePick && A.button === t.LEFT ? (this.endPt.set(A.clientX, A.clientY),
        this.updateFrustum(!1, !0),
        !0) : Mg.prototype.processMouseMove(this, A)
    }
    ,
    bg.prototype.processMouseUp = function(A) {
        if (this.onUpdateUI({
            visible: !1
        }),
        this.activatePick && A.button === t.LEFT) {
            if (this.activatePick = !1,
            2 > Math.abs(this.startPt.x - A.clientX) && 2 > Math.abs(this.startPt.y - A.clientY))
                return this.pickHelper.click(A, null),
                !0;
            if (this.endPt.set(A.clientX, A.clientY),
            !this.updateFrustum(!0, !1))
                return this.pickHelper.click(A),
                !0;
            var e = Kc.Clear
              , i = this.pressKey || A.ctrlKey && "ctrl" || A.altKey && "alt" || "";
            return "ctrl" === i ? e = Kc.Add : "alt" === i && (e = Kc.Remove),
            wg.pickByRect(this.scene, this.frustum, e, this.cameraControl.viewer.modelManager, this.viewer, this.startPt.x > this.endPt.x),
            this.pickHelper.lastPickedUserId = "",
            this.cameraControl.updateView(!0),
            !0
        }
        return Mg.prototype.processMouseUp(this, A)
    }
    ,
    bg.prototype.processTouchstart = function(A) {
        return A.preventDefault(),
        this.pressKey ? (this.startPt.set(A.changedTouches[0].pageX, A.changedTouches[0].pageY),
        !0) : Mg.prototype.processTouchstart(this, A)
    }
    ,
    bg.prototype.processTouchmove = function(A) {
        return this.pressKey ? (this.endPt.set(A.changedTouches[0].pageX, A.changedTouches[0].pageY),
        this.updateFrustum(!1, !0),
        !0) : Mg.prototype.processMouseMove(this, A)
    }
    ,
    bg.prototype.processTouchend = function(A) {
        this.onUpdateUI({
            visible: !1
        });
        var e = A.changedTouches[0].pageX
          , t = A.changedTouches[0].pageY;
        if (this.pressKey) {
            if (2 > Math.abs(this.startPt.x - e) && 2 > Math.abs(this.startPt.y - t))
                return this.pickHelper.click(A, null),
                !0;
            if (this.endPt.set(e, t),
            !this.updateFrustum(!0, !1))
                return this.pickHelper.click(A),
                !0;
            var i = Kc.Clear
              , o = this.pressKey;
            return "ctrl" === o ? i = Kc.Add : "alt" === o && (i = Kc.Remove),
            wg.pickByRect(this.scene, this.frustum, i, this.cameraControl.viewer.modelManager, this.viewer, this.startPt.x > this.endPt.x),
            this.pickHelper.lastPickedUserId = "",
            this.cameraControl.updateView(!0),
            !0
        }
        return Mg.prototype.processTouchend(this, A)
    }
    ,
    bg.prototype.processHover = function(A) {
        if (this.snapIsEnabled)
            return vc.IsMobile || this.pickHelper.handleMouseMeasure(A, !1, this.pickPoint, Rc.ON_HOVER_SNAP),
            !0
    }
    ,
    bg.prototype.enableSnap = function(A) {
        this.snapIsEnabled = A
    }
    ;
    var Ug = function(A) {
        Mg.call(this, Pc.ZOOM_BY_RECT, A.cameraControl, A.modelManager),
        this.scene = A.getScene(),
        this.activateZoom = !1
    };
    (Ug.prototype = Object.create(Mg.prototype)).constructor = Ug,
    Ug.prototype.destroy = function() {
        Mg.prototype.destroy.call(this),
        this.scene = null
    }
    ,
    Ug.prototype.processMouseDown = function(A) {
        return A.button === t.LEFT ? (this.startPt.set(A.clientX, A.clientY),
        this.activateZoom = !0,
        !0) : Mg.prototype.processMouseDown.call(this, A)
    }
    ,
    Ug.prototype.processMouseMove = function(A) {
        return this.activateZoom ? (this.endPt.set(A.clientX, A.clientY),
        this.updateFrustum(!1, !0),
        !0) : Mg.prototype.processMouseMove.call(this, A)
    }
    ,
    Ug.prototype.processMouseUp = function(A) {
        return this.activateZoom ? (this.activateZoom = !1,
        this.onUpdateUI({
            visible: !1
        }),
        this.endPt.set(A.clientX, A.clientY),
        this.updateFrustum(!0, !1) && this.zoomToRectangle(),
        !0) : Mg.prototype.processMouseUp.call(this, A)
    }
    ,
    Ug.prototype.zoomToRectangle = function() {
        var A = this.cameraControl.camera
          , e = this.cameraControl.camera.target
          , t = this.cameraControl.getContainerDimensions()
          , i = this.startPt.x
          , o = this.startPt.y
          , n = this.endPt.x
          , r = this.endPt.y
          , a = Math.abs(n - i)
          , l = Math.abs(o - r);
        if (0 !== a && 0 !== l) {
            var c = new s((i + n) / 2,(o + r) / 2)
              , h = A.position.clone()
              , d = e.clone().sub(h)
              , p = d.length()
              , g = 0
              , u = this.cameraControl.getIntersectContext(c)
              , f = this.cameraControl.intersector.hitTest(u);
            if (f) {
                var m = a / l > t.width / t.height ? a / t.width : l / t.height
                  , C = f.distanceTo(h) * m;
                d.normalize(),
                g = d.clone().negate().multiplyScalar(C)
            } else {
                var v = {};
                v.left = Math.min(i, n),
                v.top = Math.min(o, r),
                v.right = Math.max(i, n),
                v.bottom = Math.max(o, r);
                var I = this.scene.getNearDepthByRect(this.frustum, A);
                if (I === 1 / 0)
                    return;
                var E = new y((i + n) / 2,(o + r) / 2,I)
                  , B = new y(v.left,v.top,I)
                  , x = this.clientToWorld(E)
                  , S = this.clientToWorld(B)
                  , w = x.clone().sub(S).length();
                f = x.clone(),
                d.normalize(),
                g = d.clone().negate().multiplyScalar(w)
            }
            h = f.clone().add(g),
            A.position.copy(h),
            e.copy(h).sub(g.clone().normalize().multiplyScalar(p)),
            this.cameraControl.updateView(!0)
        }
    }
    ,
    Ug.prototype.worldToClient = function(A) {
        var e = this.cameraControl.camera
          , t = new y(A.x,A.y,A.z);
        return t.project(e),
        t
    }
    ,
    Ug.prototype.clientToWorld = function(A) {
        var e = this.cameraControl.getContainerDimensions()
          , t = this.cameraControl.camera
          , i = new y;
        return i.x = A.x / e.width * 2 - 1,
        i.y = -A.y / e.height * 2 + 1,
        i.z = A.z,
        i.unproject(t),
        i
    }
    ;
    var Fg = function(A, e) {
        this.name = A,
        this.cameraControl = e,
        this.mouseButtons = {
            ORBIT: t.LEFT,
            PAN2: t.MIDDLE,
            PAN: t.RIGHT
        },
        this.StateType = {
            NONE: -1,
            ROTATE: 0,
            DOLLY: 1,
            PAN: 2
        },
        this.state = this.StateType.NONE,
        this.zoomSpeed = Math.pow(.95, .2),
        this.defaultMovementSpeed = .005 * vc.SceneSize,
        this.movementSpeed = this.defaultMovementSpeed,
        this.minMovementSpeed = .001,
        this.defaultKeyPanSpeed = 2,
        this.keyPanSpeed = this.defaultKeyPanSpeed,
        this.minKeyPanSpeed = .01,
        this.wheelZoomFactor = 45e-5,
        this.pointerLock = !1
    };
    Fg.prototype.getName = function() {
        return this.name
    }
    ,
    Fg.prototype.destroy = function() {
        this.scene = null,
        this.domElement = null,
        this.cameraControl = null,
        this.mouseButtons = null,
        this.StateType = null
    }
    ,
    Fg.prototype.onExit = function() {}
    ,
    Fg.prototype.onEnter = function() {}
    ,
    Fg.prototype.processMouseDown = function(A) {}
    ,
    Fg.processMouseMove = function(A) {}
    ,
    Fg.prototype.processMouseUp = function(A) {}
    ,
    Fg.prototype.processMouseWheel = function(A) {}
    ,
    Fg.prototype.processMouseDoubleClick = function(A) {}
    ,
    Fg.prototype.processKeyDown = function(A) {}
    ,
    Fg.prototype.processKeyUp = function(A) {}
    ,
    Fg.prototype.processTouchstart = function(A) {}
    ,
    Fg.prototype.processTouchmove = function(A) {}
    ,
    Fg.prototype.processTouchend = function(A) {}
    ,
    Fg.prototype.processHover = function(A) {}
    ,
    Fg.prototype.processMovement = function(A) {}
    ,
    Fg.prototype.processPointerLockEnter = function(A) {}
    ,
    Fg.prototype.processPointerLockExit = function(A) {}
    ,
    Fg.prototype.moveTo = function(A, e, t) {}
    ,
    Fg.prototype.rotateTo = function(A) {}
    ,
    Fg.prototype.dispatchEvent = function(A) {
        this.cameraControl.viewer.getControlManager().dispatchEvent(A)
    }
    ,
    Fg.prototype.getDomElement = function() {
        return this.domElement
    }
    ,
    Fg.prototype.getRendererDomElement = function() {
        return this.rendererDomElement
    }
    ,
    Fg.prototype.updateButtons = function(A) {
        void 0 !== A.ORBIT && (this.mouseButtons.ORBIT = A.ORBIT),
        void 0 !== A.PAN && (this.mouseButtons.PAN = A.PAN),
        void 0 !== A.PAN2 && (this.mouseButtons.PAN2 = A.PAN2),
        void 0 !== A.ZOOM && (this.mouseButtons.ZOOM = A.ZOOM)
    }
    ;
    var Kg = function(A) {
        Fg.call(this, Gc.FLY, A),
        this.lookSpeed = .001,
        this.constrainPitch = !0,
        this.pitchMin = a.degToRad(5) - .5 * Math.PI,
        this.pitchMax = .5 * Math.PI - this.pitchMin,
        this.pitchDeltaTotal = 0,
        this.moveState = qc.NONE,
        this.rotateStart = new s,
        this.rotateEnd = new s,
        this.rotateDelta = new s,
        this._panStart = new s,
        this._panEnd = new s,
        this._panDelta = new s,
        this._pan = new y,
        this._worldDimension = new s,
        this.lastMousePoint = new s,
        this.isLockHeight = !1,
        this.lockedHeight = 0,
        this.pickHelper = new kp(A),
        this.intersectOfMouseDown = null
    };
    (Kg.prototype = Object.create(Fg.prototype)).constructor = Kg,
    Kg.prototype.destroy = function() {
        Fg.prototype.destroy.call(this),
        this.cameraControl = null,
        this.scene = null,
        this.rotateStart = null,
        this.rotateEnd = null,
        this.rotateDelta = null,
        this._panStart = null,
        this._panEnd = null,
        this._panDelta = null,
        this._pan = null,
        this._worldDimension = null,
        this.lastMousePoint = null,
        this.intersectOfMouseDown = null,
        this.pickHelper.destroy(),
        this.pickHelper = null
    }
    ,
    Kg.prototype.processMouseDown = function(A) {
        A.preventDefault(),
        A.stopPropagation(),
        this.lastMousePoint.set(A.clientX, A.clientY);
        var e = this.cameraControl;
        if (this.intersectOfMouseDown = null,
        A.button === this.mouseButtons.ORBIT) {
            if (jh.NoRotate)
                return;
            this.rotateStart.set(A.clientX, A.clientY),
            this.state = this.StateType.ROTATE,
            this.dispatchEvent({
                type: Rc.ON_CONTROL_BEGIN,
                name: "look",
                control: this.name
            })
        } else if (A.button === this.mouseButtons.PAN || A.button === this.mouseButtons.PAN2) {
            if (jh.NoPan)
                return;
            this._panStart.set(A.clientX, A.clientY),
            this._worldDimension = e.getWorldDimension(A.clientX, A.clientY),
            this.intersectOfMouseDown = e.getLastIntersect(),
            this.state = this.StateType.PAN,
            this.isLockHeight && (this.lockedHeight = A.clientY)
        }
    }
    ,
    Kg.prototype.doPan = function(A, e) {
        var t = this.cameraControl;
        this._panEnd.set(A, this.isLockHeight ? this.lockedHeight : e),
        this._panDelta.subVectors(this._panEnd, this._panStart),
        0 === this._panDelta.x && 0 === this._panDelta.y || (t.panOnWorld(this._panStart, this._panEnd, this._pan, this._worldDimension),
        t.adjustCameraForPan(this._pan),
        this._panStart.copy(this._panEnd),
        t.update(!0))
    }
    ,
    Kg.prototype.processMouseMove = function(A) {
        var e = this.cameraControl;
        (A.preventDefault(),
        this.state === this.StateType.ROTATE) ? (this.rotateEnd.set(A.clientX, A.clientY),
        this.rotateDelta.subVectors(this.rotateEnd, this.rotateStart),
        this.rotateStart.copy(this.rotateEnd),
        (0 !== this.rotateDelta.x || 0 !== this.rotateDelta.y) && e.rotateForFly(this.rotateDelta.x * this.lookSpeed, this.rotateDelta.y * this.lookSpeed, this.pitchMin, this.pitchMax)) : this.state === this.StateType.PAN && this.doPan(A.clientX, A.clientY)
    }
    ,
    Kg.prototype.processMouseUp = function(A) {
        if (A.preventDefault(),
        A.stopPropagation(),
        A.button !== t.LEFT || this.lastMousePoint.x !== A.clientX || this.lastMousePoint.y !== A.clientY) {
            this.intersectOfMouseDown = null;
            var e = this.cameraControl;
            switch (this.state) {
            case this.StateType.ROTATE:
                this.rotateDelta.set(0, 0);
                e.rotateForFly(0, 0, this.pitchMin, this.pitchMax),
                this.dispatchEvent({
                    type: Rc.ON_CONTROL_END,
                    name: "look",
                    control: this.name
                });
                break;
            case this.StateType.PAN:
                this.doPan(A.clientX, A.clientY)
            }
            e.endOperation(),
            this.state = this.StateType.NONE
        } else
            this.pickHelper.click(A, this.intersectOfMouseDown)
    }
    ,
    Kg.prototype.processHover = function(A) {
        this.pickHelper.handleMouseHover(A)
    }
    ,
    Kg.prototype.processMouseWheel = function(A) {
        A.preventDefault(),
        A.stopPropagation();
        var e = this.cameraControl;
        if (!jh.NoZoom) {
            var t = A.wheelDelta || A.detail;
            t = Math.abs(t) > 10 ? t : 40 * -t,
            t *= 5e-4,
            jh.ReverseWheelDirection && (t *= -1),
            this.cameraControl.delayHandle();
            var i = e.getContainerDimensions();
            e.zoom(t, i.left + .5 * i.width, i.top + .5 * i.height)
        }
    }
    ,
    Kg.prototype.processKeyDown = function(A) {
        if (!jh.NoKey && !A.altKey) {
            var e = qc
              , t = e.NONE;
            switch (A.keyCode) {
            case Ph:
                this.movementSpeed = this.defaultMovementSpeed;
                break;
            case Vh:
                this.movementSpeed *= 1.1;
                break;
            case Gh:
                this.movementSpeed *= .9,
                this.minMovementSpeed > this.movementSpeed && (this.movementSpeed = this.minMovementSpeed);
                break;
            case Fh:
            case Nh:
                t = e.FORWARD;
                break;
            case Qh:
            case Lh:
                t = e.BACK;
                break;
            case Uh:
            case Rh:
                t = e.LEFT;
                break;
            case Kh:
            case Th:
                t = e.RIGHT;
                break;
            case Dh:
                t = e.UP;
                break;
            case kh:
                t = e.DOWN
            }
            t !== e.NONE && (this.moveState |= t,
            this.dispatchEvent({
                type: Rc.ON_CONTROL_KEYDOWN,
                event: A,
                state: t,
                direction: e,
                control: this.name
            }),
            this.cameraControl.delayHandle(),
            this.cameraControl.updateFlyMove(this.moveState, this.movementSpeed * jh.MovementSpeedRate))
        }
    }
    ,
    Kg.prototype.processKeyUp = function(A) {
        if (!jh.NoKey) {
            var e = qc
              , t = e.NONE;
            switch (A.keyCode) {
            case Fh:
            case Nh:
                t = e.FORWARD;
                break;
            case Qh:
            case Lh:
                t = e.BACK;
                break;
            case Uh:
            case Rh:
                t = e.LEFT;
                break;
            case Kh:
            case Th:
                t = e.RIGHT;
                break;
            case Dh:
                t = e.UP;
                break;
            case kh:
                t = e.DOWN
            }
            t !== e.NONE && (this.dispatchEvent({
                type: Rc.ON_CONTROL_KEYUP,
                event: A,
                state: t,
                direction: e,
                control: this.name
            }),
            this.moveState &= ~t)
        }
    }
    ,
    Kg.prototype.moveTo = function(A) {
        this.cameraControl.updateFlyMove(A, this.movementSpeed * jh.MovementSpeedRate)
    }
    ;
    var Qg = function(A, e) {
        Fg.call(this, A, e),
        this.oldMouseX = -1,
        this.oldMouseY = -1,
        this.rotatePivot = null,
        this._rotateStart = new s,
        this._rotateEnd = new s,
        this._rotateDelta = new s,
        this._lastTrackingPoint = null,
        this.rotateSpeed = 1,
        this._dollyStart = new s,
        this._dollyEnd = new s,
        this._dollyDelta = new s,
        this._dollyCenter = new s,
        this.zoomSpeed = Math.pow(.95, .2),
        this.modelManager = e.viewer.modelManager,
        this._panStart = new s,
        this._panEnd = new s,
        this._panDelta = new s,
        this._pan = new y,
        this._worldDimension = new s,
        this.pickHelper = new kp(e),
        this.intersectOfMouseDown = null,
        this.timeId = null,
        this.longTapFlag = !1,
        this.selectPad = (mh.isMobileDevice(),
        null),
        this.startPt = new s;
        var t = this;
        this.longTap = function() {
            t.longTapFlag = !0,
            Bh.log("long tap"),
            t.selectPad && t.selectPad.showOverlay(t.startPt)
        }
        ,
        this._reqid = 0,
        this._animateBinded = this._animate.bind(this),
        this._clock = new as,
        this._moving = !1
    };
    (Qg.prototype = Object.create(Fg.prototype)).constructor = Qg,
    Qg.prototype.destroy = function() {
        Fg.prototype.destroy.call(this),
        this.modelManager = null,
        this.intersectOfMouseDown = null,
        this.rotatePivot = null,
        this._rotateStart = null,
        this._rotateEnd = null,
        this._rotateDelta = null,
        this._lastTrackingPoint = null,
        this._dollyStart = null,
        this._dollyEnd = null,
        this._dollyDelta = null,
        this._dollyCenter = null,
        this._panStart = null,
        this._panEnd = null,
        this._panDelta = null,
        this._pan = null,
        this._worldDimension = null,
        this.startPt = null,
        this._animateBinded = null,
        this._clock = null,
        this.timeId && (clearTimeout(this.timeId),
        this.timeId = null),
        this.pickHelper.destroy(),
        this.pickHelper = null,
        this.selectPad && (this.selectPad.destroy(),
        this.selectPad = null)
    }
    ,
    Qg.prototype.beginPan = function(A, e) {
        this._panStart.set(A, e),
        this._worldDimension = this.getWorldDimension(A, e)
    }
    ,
    Qg.prototype.processMouseDown = function(A) {
        this.oldMouseX = A.clientX,
        this.oldMouseY = A.clientY;
        var e = this.cameraControl;
        this.intersectOfMouseDown = null,
        A.preventDefault();
        var t = "";
        if (A.button === this.mouseButtons.ORBIT) {
            if (jh.NoRotate)
                return;
            this.rotatePivot = e.calculatePivot(jh.RotatePivotMode, {
                x: A.clientX,
                y: A.clientY
            }),
            this.state = this.StateType.ROTATE,
            this._rotateStart.set(A.clientX, A.clientY),
            this._lastTrackingPoint = null,
            t = Gc.ORBIT
        } else if (A.button === this.mouseButtons.ZOOM) {
            if (jh.NoZoom)
                return;
            this.state = this.StateType.DOLLY,
            this._dollyStart.set(A.clientX, A.clientY),
            t = Gc.ZOOM
        } else if (A.button === this.mouseButtons.PAN || A.button === this.mouseButtons.PAN2) {
            if (jh.NoPan)
                return;
            this._panStart.set(A.clientX, A.clientY),
            this._worldDimension = e.getWorldDimension(A.clientX, A.clientY),
            this.state = this.StateType.PAN,
            t = Gc.PAN
        }
        this.dispatchEvent({
            type: Rc.ON_CONTROL_BEGIN,
            name: t,
            control: this.name
        })
    }
    ,
    Qg.prototype.processMouseMove = function(A) {
        var e = this.cameraControl;
        switch (A.preventDefault(),
        this.state) {
        case this.StateType.ROTATE:
            if (this._rotateEnd.set(A.clientX, A.clientY),
            this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart),
            0 === this._rotateDelta.x && 0 === this._rotateDelta.y)
                return;
            this._rotateStart.copy(this._rotateEnd),
            e.processRotate(this._rotateDelta, this.rotatePivot);
            break;
        case this.StateType.DOLLY:
            if (this._dollyEnd.set(A.clientX, A.clientY),
            this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart),
            0 === this._dollyDelta.x && 0 === this._dollyDelta.y)
                return;
            this.cameraControl.adjustCameraForDolly(this._dollyDelta.y > 0 ? this.zoomSpeed : 1 / this.zoomSpeed, null),
            this._dollyStart.copy(this._dollyEnd);
            break;
        case this.StateType.PAN:
            if (this._panEnd.set(A.clientX, A.clientY),
            this._panDelta.subVectors(this._panEnd, this._panStart),
            0 === this._panDelta.x && 0 === this._panDelta.y)
                return;
            this.cameraControl.panOnWorld(this._panStart, this._panEnd, this._pan, this._worldDimension),
            this.cameraControl.adjustCameraForPan(this._pan),
            this._panStart.copy(this._panEnd)
        }
        this.state !== this.StateType.NONE && this.cameraControl.update(!0)
    }
    ,
    Qg.prototype.processMouseUp = function(A) {
        if (this.state === this.StateType.NONE)
            return !1;
        this.intersectOfMouseDown = null;
        var e = this.cameraControl;
        this.oldMouseX === A.clientX && this.oldMouseY === A.clientY || e.update(!0),
        this.state = this.StateType.NONE,
        this.rotatePivot = null,
        e.endOperation();
        var t = "";
        return A.button === this.mouseButtons.ORBIT ? t = Gc.ORBIT : A.button === this.mouseButtons.ZOOM ? t = Gc.ZOOM : A.button !== this.mouseButtons.PAN && A.button !== this.mouseButtons.PAN2 || (t = Gc.PAN),
        this.dispatchEvent({
            type: Rc.ON_CONTROL_END,
            name: t,
            control: this.name
        }),
        !0
    }
    ,
    Qg.prototype.processMouseWheel = function(A) {
        var e = this.cameraControl;
        if (!jh.NoZoom) {
            A.preventDefault(),
            A.stopPropagation();
            var t = 0;
            A.wheelDelta ? t = A.wheelDelta : A.deltaY && (t = 40 * -A.deltaY),
            Math.abs(t) > 720 && (t = t > 0 ? 720 : -720),
            t *= this.wheelZoomFactor,
            jh.ReverseWheelDirection && (t *= -1),
            e.zoom(t, A.clientX, A.clientY),
            e.delayHandle(),
            this.dispatchEvent({
                type: Rc.ON_CONTROL_ZOOM
            })
        }
    }
    ,
    Qg.prototype.processKeyDown = function(A) {
        if (!jh.NoKey && !jh.NoPan) {
            var e = this.cameraControl
              , t = null;
            vc.MergeComponent ? (this.animationStarted || (this.animationStarted = !0,
            this._start()),
            t = !1) : (t = !0,
            e.delayHandle()),
            this._moving = !0;
            var i = !1
              , o = this.movementSpeed * jh.MovementSpeedRate
              , n = this.keyPanSpeed * jh.MovementSpeedRate;
            switch (A.keyCode) {
            case Ph:
                this.keyPanSpeed = e.defaultKeyPanSpeed,
                this.movementSpeed = e.defaultMovementSpeed;
                break;
            case Vh:
                this.keyPanSpeed *= 1.1,
                this.movementSpeed *= 1.1;
                break;
            case Gh:
                this.keyPanSpeed *= .9,
                this.minKeyPanSpeed > this.keyPanSpeed && (this.keyPanSpeed = this.minKeyPanSpeed),
                this.movementSpeed *= .9,
                this.minMovementSpeed > this.movementSpeed && (this.movementSpeed = this.minMovementSpeed);
                break;
            case Dh:
                e.pan(0, n),
                i = !0;
                break;
            case kh:
                e.pan(0, -n),
                i = !0;
                break;
            case Uh:
                e.processRotate({
                    x: -10,
                    y: 0
                }, this.rotatePivot),
                i = !0;
                break;
            case Rh:
                e.pan(n, 0),
                i = !0;
                break;
            case Kh:
                e.processRotate({
                    x: 10,
                    y: 0
                }, this.rotatePivot),
                i = !0;
                break;
            case Th:
                e.pan(-n, 0),
                i = !0;
                break;
            case Fh:
                e.processRotate({
                    x: 0,
                    y: -10
                }, this.rotatePivot),
                i = !0;
                break;
            case Nh:
                e.moveStraight(o, !A.shiftKey),
                i = !0;
                break;
            case Qh:
                e.processRotate({
                    x: 0,
                    y: 10
                }, this.rotatePivot),
                i = !0;
                break;
            case Lh:
                e.moveStraight(-o, !A.shiftKey),
                i = !0
            }
            i && t && e.update(!0)
        }
    }
    ,
    Qg.prototype.processKeyUp = function(A) {
        if (!jh.NoKey && !jh.NoPan)
            switch (A.keyCode) {
            case qh:
                this.cameraControl.viewer.modelManager.sceneState.clearSelection(),
                this.pickHelper.lastPickedUserId = void 0,
                this.cameraControl.updateView(!0)
            }
    }
    ,
    Qg.prototype.processTouchstart = function(A) {
        this.startPt.set(A.touches[0].clientX, A.touches[0].clientY),
        this.timeId && clearTimeout(this.timeId);
        var e = this.cameraControl;
        switch (this.timeId = setTimeout(this.longTap, 400),
        this.selectPad && this.selectPad.hideOverlay(),
        A.touches.length) {
        case 1:
            if (jh.NoRotate)
                return;
            this.rotatePivot = e.calculatePivot(jh.RotatePivotMode, {
                x: A.touches[0].clientX,
                y: A.touches[0].clientY
            }),
            this._rotateStart.set(A.touches[0].clientX, A.touches[0].clientY),
            this.state = this.StateType.ROTATE;
            break;
        case 2:
            if (!jh.NoZoom) {
                var t = A.touches[0].clientX - A.touches[1].clientX
                  , i = A.touches[0].clientY - A.touches[1].clientY;
                this._dollyStart.set(0, Math.sqrt(t * t + i * i))
            }
            if (!jh.NoPan)
                this._panStart.set(.5 * (A.touches[0].clientX + A.touches[1].clientX), .5 * (A.touches[0].clientY + A.touches[1].clientY));
            break;
        default:
            this.state = this.StateType.NONE
        }
    }
    ,
    Qg.prototype.processTouchmove = function(A) {
        var e = this.cameraControl;
        switch (A.preventDefault(),
        A.touches.length) {
        case 1:
            if (jh.NoRotate)
                return;
            this._rotateEnd.set(A.touches[0].clientX, A.touches[0].clientY),
            this._rotateDelta.subVectors(this._rotateStart, this._rotateEnd);
            var t = this.cameraControl.getClientSize()
              , i = 2 * Math.PI * this._rotateDelta.x / t.x * this.rotateSpeed
              , o = 2 * Math.PI * this._rotateDelta.y / t.y * this.rotateSpeed;
            e.handleRotation(i, o, this.rotatePivot),
            this._rotateStart.copy(this._rotateEnd);
            break;
        case 2:
            if (e.clearTouchRotateState(),
            !jh.NoZoom) {
                var n = A.touches[0].clientX - A.touches[1].clientX
                  , r = A.touches[0].clientY - A.touches[1].clientY
                  , a = Math.sqrt(n * n + r * r);
                if (this._dollyEnd.set(0, a),
                this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart),
                Math.abs(this._dollyDelta.y) > 3) {
                    var s = 0;
                    this._dollyDelta.y > 0 ? s = 1 / Math.pow(this.zoomSpeed, .5 * this._dollyDelta.y) : 0 > this._dollyDelta.y && (s = Math.pow(this.zoomSpeed, .5 * -this._dollyDelta.y)),
                    this._dollyStart.copy(this._dollyEnd),
                    e.touchDolly(.5 * (A.touches[0].clientX + A.touches[1].clientX), .5 * (A.touches[0].clientY + A.touches[1].clientY), s),
                    this.state = this.StateType.DOLLY
                }
            }
            if (!jh.NoPan) {
                var l = .5 * (A.touches[0].clientX + A.touches[1].clientX)
                  , c = .5 * (A.touches[0].clientY + A.touches[1].clientY);
                if (this._panEnd.set(l, c),
                this._panDelta.subVectors(this._panEnd, this._panStart),
                3 > Math.abs(this._panDelta.x) && 3 > Math.abs(this._panDelta.y))
                    return;
                this._worldDimension = e.getWorldDimension(l, c),
                e.panOnWorld(this._panStart, this._panEnd, this._pan, this._worldDimension),
                e.adjustCameraForPan(this._pan),
                this._panStart.copy(this._panEnd),
                this.state = this.StateType.PAN
            }
        }
        e.touchUpdate()
    }
    ,
    Qg.prototype.processTouchend = function(A) {
        this.timeId && clearTimeout(this.timeId),
        this.longTapFlag && (this.longTapFlag = !1,
        A.preventDefault());
        var e = this.cameraControl;
        switch (A.touches.length) {
        case 0:
            this.state = this.StateType.NONE,
            e.touchEndHandler(A);
            break;
        case 1:
            if (jh.NoRotate)
                return;
            this._rotateStart.set(A.touches[0].clientX, A.touches[0].clientY),
            this.state = this.StateType.ROTATE
        }
    }
    ,
    Qg.prototype.processHover = function(A) {
        this.pickHelper.handleMouseHover(A)
    }
    ,
    Qg.prototype.moveTo = function(A) {
        if (void 0 !== A) {
            var e = this.cameraControl;
            if (!jh.NoKey && !jh.NoPan) {
                var t = this.movementSpeed * jh.MovementSpeedRate
                  , i = this.keyPanSpeed * jh.MovementSpeedRate
                  , o = qc;
                switch (A) {
                case o.FORWARD:
                    e.moveForward(t, !0);
                    break;
                case o.BACK:
                    e.moveBackward(t, !0);
                    break;
                case o.LEFT:
                    e.pan(i, 0);
                    break;
                case o.RIGHT:
                    e.pan(-i, 0);
                    break;
                case o.UP:
                    e.pan(0, i);
                    break;
                case o.DOWN:
                    e.pan(0, -i);
                    break;
                default:
                    A = o.NONE
                }
                A !== o.NONE && e.update(!0, !0)
            }
        }
    }
    ,
    Qg.prototype._updateMove = function() {
        this._moving && (this._moving = !1,
        this.cameraControl.update(!0))
    }
    ,
    Qg.prototype._animate = function() {
        this._reqid = requestAnimationFrame(this._animateBinded),
        this._updateMove()
    }
    ,
    Qg.prototype._start = function() {
        this._animate()
    }
    ,
    Qg.prototype._stop = function() {
        cancelAnimationFrame(this._reqid)
    }
    ,
    Qg.prototype.onExit = function() {
        vc.MergeComponent && this.animationStarted && (this._stop(),
        this.animationStarted = !1)
    }
    ;
    var Rg = function(A) {
        Qg.call(this, Gc.ORBIT, A),
        this.mouseButtons = {
            ORBIT: t.LEFT,
            PAN2: t.MIDDLE,
            PAN: t.RIGHT
        }
    };
    (Rg.prototype = Object.create(Qg.prototype)).constructor = Rg;
    var Tg = function(A) {
        Qg.call(this, Gc.PAN, A),
        this.mouseButtons = {
            ORBIT: t.RIGHT,
            PAN2: t.MIDDLE,
            PAN: t.LEFT
        }
    };
    (Tg.prototype = Object.create(Qg.prototype)).constructor = Tg;
    var kg = function(A) {
        Rg.call(this, A, Gc.PICK)
    };
    (kg.prototype = Object.create(Rg.prototype)).constructor = kg,
    kg.prototype.processMouseUp = function(A) {
        A.preventDefault();
        var e = 1 >= Math.abs(this.oldMouseX - A.clientX) && 1 >= Math.abs(this.oldMouseY - A.clientY);
        A.button !== t.LEFT && A.button !== t.RIGHT || e && (this.pickHelper.click(A, this.intersectOfMouseDown),
        this.intersectOfMouseDown = null),
        e || A.button !== this.mouseButtons.ORBIT && A.button !== this.mouseButtons.PAN || this.cameraControl.update(!0),
        this.intersectOfMouseDown = null,
        this.state = this.StateType.NONE;
        var i = "";
        A.button === this.mouseButtons.ORBIT ? i = Gc.ORBIT : A.button === this.mouseButtons.ZOOM ? i = Gc.ZOOM : A.button !== this.mouseButtons.PAN && A.button !== this.mouseButtons.PAN2 || (i = Gc.PAN,
        e || this.dispatchEvent({
            type: Rc.ON_MOUSE_DRAGGED,
            event: A
        })),
        this.dispatchEvent({
            type: Rc.ON_CONTROL_END,
            name: i,
            Control: this.name
        })
    }
    ,
    kg.prototype.processMouseDoubleClick = function(A) {
        A.button === t.LEFT && this.pickHelper.doubleClick(A)
    }
    ;
    var Dg = function(A) {
        this.control = A,
        this.cameraControl = A.cameraControl,
        this.dim = this.cameraControl.getContainerDimensions(),
        this.pad = null,
        this.padSize = 96,
        this.startPt = new s,
        this.position = new s,
        this.callback = null,
        this.intersect = null,
        this.destroy = function() {
            this.control = null,
            this.cameraControl = null,
            this.dim = null,
            this.pad = null,
            this.startPt = null,
            this.position = null,
            this.callback = null,
            this.intersect = null
        }
        ,
        this.init = function() {
            window.addEventListener("resize", this.padInitBind, !1),
            this.pad = document.createElement("div"),
            this.padInit(),
            this.cameraControl.domElement.appendChild(this.pad),
            this.addEventListener()
        }
        ,
        this.addEventListener = function() {
            this.pad.addEventListener("touchstart", this.padOnTouchStartBind, !1),
            this.pad.addEventListener("touchmove", this.padOnTouchMoveBind, !1),
            this.pad.addEventListener("touchend", this.padOnTouchEndBind, !1)
        }
        ,
        this.padInit = function() {
            null !== this.pad && (this.pad.style.backgroundImage = "url(images/selectPad.png)",
            this.pad.style.backgroundSize = "100%",
            this.pad.style.position = "absolute",
            this.pad.style.width = this.padSize.toString() + "px",
            this.pad.style.height = this.padSize.toString() + "px",
            this.pad.style.zIndex = "10",
            this.pad.style.display = "none")
        }
        ,
        this.showOverlay = function(A) {
            this.position = A,
            this.pad.style.left = this.position.x.toString() + "px",
            this.pad.style.top = (this.position.y - this.dim.top).toString() + "px",
            this.pad.style.display = ""
        }
        ,
        this.hideOverlay = function() {
            this.pad.style.display = "none"
        }
        ,
        this.pick = function() {
            var A = this.position.x
              , e = this.position.y
              , t = this.cameraControl
              , i = t.viewer.modelManager.sceneState
              , o = this
              , n = new s(A,e)
              , r = t.getIntersectContext(n);
            t.intersector.pick(r, (function(A) {
                if (i.clearSelection(),
                !A)
                    return t.updateView(!0),
                    void (o.intersect = null);
                var e = A.userId;
                t.viewer.getScene().intersectToWorld(A, t.viewer),
                i.addSelection([e]),
                o.intersect = A,
                t.updateView(!0)
            }
            )),
            null !== o.intersect && (o.intersect.cx = A,
            o.intersect.cy = e)
        }
        ,
        this.onTouchStart = function(A) {
            1 === A.touches.length && (A.stopPropagation(),
            A.preventDefault(),
            this.startPt.set(A.touches[0].clientX, A.touches[0].clientY))
        }
        ,
        this.onTouchMove = function(A) {
            if (1 === A.touches.length) {
                A.stopPropagation(),
                A.preventDefault();
                var e = A.touches[0].clientY - this.startPt.y;
                this.position.x += A.touches[0].clientX - this.startPt.x,
                this.position.y += e,
                this.pad.style.left = this.position.x.toString() + "px",
                this.pad.style.top = (this.position.y - this.dim.top).toString() + "px",
                this.startPt.set(A.touches[0].clientX, A.touches[0].clientY),
                this.pick(A)
            }
        }
        ,
        this.onTouchEnd = function(A) {
            A.stopPropagation(),
            null !== this.callback ? this.callback(this.intersect) : console.log("selectPad click", this.intersect)
        }
        ,
        this.padInitBind = this.padInit.bind(this),
        this.padOnTouchStartBind = this.onTouchStart.bind(this),
        this.padOnTouchEndBind = this.onTouchEnd.bind(this),
        this.padOnTouchMoveBind = this.onTouchMove.bind(this),
        this.init()
    }
      , Lg = function(A) {
        Fg.call(this, Gc.WALK, A),
        this.mouseButtons = {
            ORBIT: t.LEFT,
            PAN2: t.MIDDLE,
            PAN: t.RIGHT
        },
        this.pickHelper = new kp(A),
        this.lastMousePoint = new s,
        this._reqid = 0,
        this._animateBinded = this._animate.bind(this),
        this._clock = new as,
        this.moveState = {
            up: 0,
            down: 0,
            left: 0,
            right: 0,
            forward: 0,
            back: 0,
            pitchUp: 0,
            pitchDown: 0,
            yawLeft: 0,
            yawRight: 0,
            rollLeft: 0,
            rollRight: 0
        },
        this.startPt = new s,
        this.timeId = null,
        this.rotateSpeed = 1,
        this._rotateStart = new s,
        this._rotateEnd = new s,
        this._rotateDelta = new s,
        this._dollyStart = new s,
        this._dollyEnd = new s,
        this._dollyDelta = new s,
        this._dollyCenter = new s,
        this.zoomSpeed = Math.pow(.95, .2),
        this._panStart = new s,
        this._panEnd = new s,
        this._panDelta = new s,
        this._pan = new y,
        this.selectPad = mh.isMobileDevice() ? new Dg(this) : null,
        this.moveVector = new y(0,0,0),
        this.rotationVector = new y(0,0,0),
        this.zoomDelta = 0,
        this.rotateStart = new s,
        this.rotateEnd = new s,
        this.rotateDelta = new s,
        this.firstRotate = !0,
        this.dragLook = !0,
        this.lockHeightEnabled = !1,
        this.isLockHeight = !1,
        this.lockedHeight = 0,
        this.pickEnabled = !0,
        this.mouseType = null;
        var e = A.viewer.getScene().getBoundingBoxWorld();
        this.defaultMovementSpeed = e ? e.getSize(new y(0,0,0)).length() / 10 : 1500,
        this.movementSpeed = this.defaultMovementSpeed,
        this.shiftSpeedup = !1,
        this.setFocuse = function() {
            var A = document.querySelector(".main-canvas");
            A && A.focus && A.focus()
        }
    };
    (Lg.prototype = Object.create(Fg.prototype)).constructor = Lg,
    Lg.prototype.destroy = function() {
        Fg.prototype.destroy.call(this),
        this.pickHelper.destroy(),
        this.pickHelper = null,
        this.selectPad && (this.selectPad.destroy(),
        this.selectPad = null),
        this.timeId && (clearTimeout(this.timeId),
        this.timeId = null),
        this._clock = null,
        this._animateBinded = null,
        this.mouseButtons = null,
        this.moveState = null,
        this.startPt = null,
        this.lastMousePoint = null,
        this.rotateStart = null,
        this.rotateEnd = null,
        this.rotateDelta = null,
        this._rotateStart = null,
        this._rotateEnd = null,
        this._rotateDelta = null,
        this._dollyStart = null,
        this._dollyEnd = null,
        this._dollyDelta = null,
        this._dollyCenter = null,
        this._panStart = null,
        this._panEnd = null,
        this._panDelta = null,
        this._pan = null,
        this.moveVector = null,
        this.rotationVector = null,
        this.rotateStart = null,
        this.rotateEnd = null,
        this.rotateDelta = null
    }
    ,
    Lg.prototype._animate = function() {
        this._reqid = requestAnimationFrame(this._animateBinded),
        this.updateWalkMove()
    }
    ,
    Lg.prototype._start = function() {
        this.moveState = {
            up: 0,
            down: 0,
            left: 0,
            right: 0,
            forward: 0,
            back: 0,
            pitchUp: 0,
            pitchDown: 0,
            yawLeft: 0,
            yawRight: 0,
            rollLeft: 0,
            rollRight: 0
        },
        this._animate()
    }
    ,
    Lg.prototype._stop = function() {
        cancelAnimationFrame(this._reqid)
    }
    ,
    Lg.prototype._updateMovement = function() {
        this.moveVector.x = -this.moveState.left + this.moveState.right,
        this.moveVector.z = this.isLockHeight ? 0 : -this.moveState.down + this.moveState.up,
        this.moveVector.y = -this.moveState.forward + this.moveState.back
    }
    ,
    Lg.prototype._updateRotation = function() {
        this.rotationVector.x = jh.LockAxisZ ? 0 : -this.moveState.pitchDown + this.moveState.pitchUp,
        this.rotationVector.z = -this.moveState.yawRight + this.moveState.yawLeft,
        this.rotationVector.y = -this.moveState.rollRight + this.moveState.rollLeft
    }
    ,
    Lg.prototype._doRotate = function(A) {
        vc.WalkingWithViewLock && (A.y = 0);
        var e = this.cameraControl.getClientSize()
          , t = e.y / 2;
        this.moveState.yawLeft = A.x / (e.x / 2),
        this.moveState.pitchDown = A.y / t,
        this._updateRotation()
    }
    ,
    Lg.prototype.processMouseDown = function(A) {
        this.oldMouseX = A.clientX,
        this.oldMouseY = A.clientY;
        var e = this.cameraControl;
        if (A.button === this.mouseButtons.ORBIT) {
            if (A.preventDefault(),
            A.stopPropagation(),
            this.mouseType = A.button,
            this.lastMousePoint.set(A.clientX, A.clientY),
            this.firstRotate = !1,
            A.button === this.mouseButtons.ORBIT) {
                if (jh.NoRotate)
                    return;
                this.rotateStart.set(A.clientX, A.clientY),
                this.state = this.StateType.ROTATE,
                this.dispatchEvent({
                    type: Rc.ON_CONTROL_BEGIN,
                    name: "look",
                    control: this.name
                })
            }
        } else if (A.button === this.mouseButtons.PAN || A.button === this.mouseButtons.PAN2) {
            if (jh.NoPan)
                return;
            this._panStart.set(A.clientX, A.clientY),
            this._worldDimension = e.getWorldDimension(A.clientX, A.clientY),
            this.state = this.StateType.PAN,
            this.dispatchEvent({
                type: Rc.ON_CONTROL_BEGIN,
                name: Gc.PAN,
                control: this.name
            })
        }
    }
    ,
    Lg.prototype.processMouseUp = function(A) {
        return A.preventDefault(),
        A.stopPropagation(),
        A.button === this.mouseButtons.PAN && this.setFocuse(),
        this.mouseType = null,
        this.pickEnabled && (A.button === t.LEFT || A.button === t.RIGHT) && 2 > Math.abs(this.lastMousePoint.x - A.clientX) && 2 > Math.abs(this.lastMousePoint.y - A.clientY) ? (this.state = this.StateType.NONE,
        void this.pickHelper.click(A)) : (this.state === this.StateType.ROTATE && (this.moveState.yawLeft = this.moveState.pitchDown = 0,
        this.dispatchEvent({
            type: Rc.ON_CONTROL_END,
            name: "look",
            control: this.name
        })),
        this.state = this.StateType.NONE,
        !0)
    }
    ,
    Lg.prototype.processMouseMove = function(A) {
        if (A.preventDefault(),
        this.dragLook && this.state === this.StateType.ROTATE && 0 === this.mouseType) {
            if (this.rotateEnd.set(A.clientX, A.clientY),
            this.rotateDelta.subVectors(this.rotateEnd, this.rotateStart),
            0 === this.rotateDelta.x && 0 === this.rotateDelta.y)
                return;
            this.rotateStart.copy(this.rotateEnd),
            this._doRotate(this.rotateDelta)
        } else {
            switch (this.state) {
            case this.StateType.DOLLY:
                if (this._dollyEnd.set(A.clientX, A.clientY),
                this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart),
                0 === this._dollyDelta.x && 0 === this._dollyDelta.y)
                    return;
                this.cameraControl.adjustCameraForDolly(this._dollyDelta.y > 0 ? this.zoomSpeed : 1 / this.zoomSpeed, null),
                this._dollyStart.copy(this._dollyEnd);
                break;
            case this.StateType.PAN:
                if (this._panEnd.set(A.clientX, A.clientY),
                this._panDelta.subVectors(this._panEnd, this._panStart),
                0 === this._panDelta.x && 0 === this._panDelta.y)
                    return;
                this.cameraControl.panOnWorld(this._panStart, this._panEnd, this._pan, this._worldDimension),
                this.cameraControl.adjustCameraForPan(this._pan),
                this._panStart.copy(this._panEnd)
            }
            this.state !== this.StateType.NONE && this.cameraControl.update(!0)
        }
    }
    ,
    Lg.prototype.processTouchstart = function(A) {
        this.startPt.set(A.touches[0].clientX, A.touches[0].clientY),
        this.timeId && clearTimeout(this.timeId);
        switch (this.timeId = setTimeout(this.longTap, 400),
        this.selectPad && this.selectPad.hideOverlay(),
        A.touches.length) {
        case 1:
            if (jh.NoRotate)
                return;
            this._rotateStart.set(A.touches[0].clientX, A.touches[0].clientY),
            this.state = this.StateType.ROTATE;
            break;
        case 2:
            if (!jh.NoZoom) {
                var e = A.touches[0].clientX - A.touches[1].clientX
                  , t = A.touches[0].clientY - A.touches[1].clientY;
                this._dollyStart.set(0, Math.sqrt(e * e + t * t))
            }
            if (!jh.NoPan)
                this._panStart.set(.5 * (A.touches[0].clientX + A.touches[1].clientX), .5 * (A.touches[0].clientY + A.touches[1].clientY));
            break;
        default:
            this.state = this.StateType.NONE
        }
    }
    ,
    Lg.prototype.processTouchmove = function(A) {
        this.timeId && clearTimeout(this.timeId);
        var e = this.cameraControl;
        switch (A.preventDefault(),
        A.touches.length) {
        case 1:
            this.dragLook && this.state === this.StateType.ROTATE && (this._rotateEnd.set(A.touches[0].clientX, A.touches[0].clientY),
            this._rotateDelta.subVectors(this._rotateEnd, this._rotateStart),
            this._rotateStart.copy(this._rotateEnd),
            this._doRotate(this._rotateDelta));
            break;
        case 2:
            if (e.clearTouchRotateState(),
            !jh.NoZoom) {
                var t, i = A.touches[0].clientX - A.touches[1].clientX, o = A.touches[0].clientY - A.touches[1].clientY, n = Math.sqrt(i * i + o * o);
                if (this._dollyEnd.set(0, n),
                this._dollyDelta.subVectors(this._dollyEnd, this._dollyStart),
                Math.abs(this._dollyDelta.y) > 3)
                    this._dollyDelta.y > 0 ? t = 1 / Math.pow(this.zoomSpeed, .5 * this._dollyDelta.y) : 0 > this._dollyDelta.y && (t = Math.pow(this.zoomSpeed, .5 * -this._dollyDelta.y)),
                    this._dollyStart.copy(this._dollyEnd),
                    e.touchDolly(.5 * (A.touches[0].clientX + A.touches[1].clientX), .5 * (A.touches[0].clientY + A.touches[1].clientY), t),
                    this.state = this.StateType.DOLLY
            }
            if (!jh.NoPan) {
                var r = .5 * (A.touches[0].clientX + A.touches[1].clientX)
                  , a = .5 * (A.touches[0].clientY + A.touches[1].clientY);
                if (this._panEnd.set(r, a),
                this._panDelta.subVectors(this._panEnd, this._panStart),
                3 > Math.abs(this._panDelta.x) && 3 > Math.abs(this._panDelta.y))
                    return;
                this._worldDimension = e.getWorldDimension(r, a),
                e.panOnWorld(this._panStart, this._panEnd, this._pan, this._worldDimension),
                e.adjustCameraForPan(this._pan),
                this._panStart.copy(this._panEnd),
                this.state = this.StateType.PAN
            }
        }
        e.touchUpdate()
    }
    ,
    Lg.prototype.processTouchend = function(A) {
        this.timeId && clearTimeout(this.timeId),
        this.longTapFlag && (this.longTapFlag = !1,
        A.preventDefault());
        var e = this.cameraControl;
        switch (A.touches.length) {
        case 0:
            this.state = this.StateType.NONE,
            e.touchEndHandler(A);
            break;
        case 1:
            if (jh.NoRotate)
                return;
            this._rotateStart.set(A.touches[0].clientX, A.touches[0].clientY),
            this.state = this.StateType.ROTATE
        }
    }
    ,
    Lg.prototype.processHover = function(A) {
        this.dragLook || (this.firstRotate && (this.firstRotate = !1,
        this.rotateStart.set(A.clientX, A.clientY)),
        this.rotateEnd.set(A.clientX, A.clientY),
        this.rotateDelta.subVectors(this.rotateEnd, this.rotateStart),
        this.rotateStart.copy(this.rotateEnd),
        this._doRotate(this.rotateDelta))
    }
    ,
    Lg.prototype.processMouseWheel = function(A) {
        var e = this.cameraControl;
        if (A.preventDefault(),
        A.stopPropagation(),
        !jh.NoZoom) {
            var t = 0;
            A.wheelDelta ? t = A.wheelDelta : A.deltaY && (t = 40 * -A.deltaY),
            Math.abs(t) > 720 && (t = t > 0 ? 720 : -720),
            t *= this.wheelZoomFactor,
            jh.ReverseWheelDirection && (t *= -1),
            e.zoom(t, A.clientX, A.clientY),
            e.delayHandle(),
            this.dispatchEvent({
                type: Rc.ON_CONTROL_ZOOM
            })
        }
    }
    ,
    Lg.prototype.processKeyDown = function(A) {
        if (!jh.NoKey && !A.altKey) {
            var e = qc.NONE;
            switch (A.key) {
            case "0":
                this.movementSpeed = this.defaultMovementSpeed;
                break;
            case "=":
            case "+":
                this.movementSpeed *= 1.1;
                break;
            case "-":
            case "——":
                this.movementSpeed *= .9,
                this.minMovementSpeed > this.movementSpeed && (this.movementSpeed = this.minMovementSpeed);
                break;
            case "ArrowUp":
            case "w":
            case "W":
                e = qc.FORWARD,
                this.moveState.forward = 1;
                break;
            case "ArrowDown":
            case "s":
            case "S":
                e = qc.BACK,
                this.moveState.back = 1;
                break;
            case "ArrowLeft":
            case "a":
            case "A":
                e = qc.LEFT,
                this.moveState.left = 1;
                break;
            case "ArrowRight":
            case "d":
            case "D":
                e = qc.RIGHT,
                this.moveState.right = 1;
                break;
            case "q":
            case "Q":
                e = qc.UP,
                this.moveState.up = 1;
                break;
            case "e":
            case "E":
                e = qc.DOWN,
                this.moveState.down = 1;
                break;
            case "Shift":
                this.shiftSpeedup || (this.movementSpeed += this.defaultMovementSpeed,
                this.shiftSpeedup = !0);
                break;
            case "Tab":
                return this.moveVector.set(0, 0, 0),
                this.moveState.forward = 0,
                this.moveState.back = 0,
                this.moveState.left = 0,
                this.moveState.right = 0,
                this.moveState.up = 0,
                void (this.moveState.down = 0)
            }
            this._updateMovement(),
            this._updateRotation(),
            e !== qc.NONE && this.dispatchEvent({
                type: Rc.ON_CONTROL_KEYDOWN,
                event: A,
                direction: e,
                control: this.name
            })
        }
    }
    ,
    Lg.prototype.processKeyUp = function(A) {
        if (!jh.NoKey) {
            var e = qc.NONE;
            switch (A.key) {
            case "ArrowUp":
            case "W":
            case "w":
                e = qc.FORWARD,
                this.moveState.forward = 0;
                break;
            case "ArrowDown":
            case "s":
            case "S":
                e = qc.BACK,
                this.moveState.back = 0;
                break;
            case "ArrowLeft":
            case "a":
            case "A":
                e = qc.LEFT,
                this.moveState.left = 0;
                break;
            case "ArrowRight":
            case "d":
            case "D":
                e = qc.RIGHT,
                this.moveState.right = 0;
                break;
            case "q":
            case "Q":
                e = qc.UP,
                this.moveState.up = 0;
                break;
            case "e":
            case "E":
                e = qc.DOWN,
                this.moveState.down = 0;
                break;
            case "Shift":
                this.shiftSpeedup && (this.movementSpeed -= this.defaultMovementSpeed,
                this.shiftSpeedup = !1);
                break;
            default:
                e = qc.NONE
            }
            this._updateMovement(),
            this._updateRotation(),
            e !== qc.NONE && this.dispatchEvent({
                type: Rc.ON_CONTROL_KEYUP,
                event: A,
                direction: e,
                control: this.name
            })
        }
    }
    ,
    Lg.prototype.updateWalkMove = function() {
        var A = this._clock.getDelta()
          , e = this.cameraControl
          , t = e.camera.position.z;
        if (0 !== this.moveVector.x || 0 !== this.moveVector.y || 0 !== this.moveVector.z || 0 !== this.rotationVector.x || 0 !== this.rotationVector.y || 0 !== this.rotationVector.z || 0 !== this.zoomDelta) {
            var i = this.movementSpeed * jh.WalkSpeedRate * A;
            if (!0 === vc.WalkingWithGravity && (this.moveVector.z = 0,
            e.computeManHeight(),
            e.computeGravity()),
            e.dirtyCamera(!0),
            0 !== this.zoomDelta)
                e.zoomCameraForWalk(1 + this.zoomDelta * A),
                this.zoomDelta = 0;
            0 !== i && e.translateCameraForWalk(this.moveVector, i),
            e.rotateCameraForWalk(this.rotationVector, this.dragLook ? 1 : 2),
            e.flyOnWorld(!1),
            this.moveState.pitchUp = 0,
            this.moveState.pitchDown = 0,
            this.moveState.yawLeft = 0,
            this.moveState.yawRight = 0,
            this.moveState.rollLeft = 0,
            this.moveState.rollRight = 0,
            t !== e.camera.position.z && e.viewer.modelManager.dispatchEvent({
                type: Rc.ON_CAMERA_HEIGHT_CHANGED,
                cameraPosition: e.camera.position.clone()
            })
        }
    }
    ,
    Lg.prototype.onEnter = function() {
        var A = this.cameraControl.getCamera();
        A.isPerspective || (console.log("Current camera is Orthographic"),
        A.toPerspective()),
        this._start()
    }
    ,
    Lg.prototype.onExit = function() {
        this._stop()
    }
    ,
    Lg.prototype.rotateTo = function(A) {
        this._doRotate(A)
    }
    ,
    Lg.prototype.moveTo = function(A, e, t) {
        if (void 0 === t && (t = !0),
        void 0 === e && (e = 1),
        t)
            switch (A) {
            case qc.FORWARD:
                this.moveState.forward = e;
                break;
            case qc.BACK:
                this.moveState.back = e;
                break;
            case qc.LEFT:
                this.moveState.left = e;
                break;
            case qc.RIGHT:
                this.moveState.right = e;
                break;
            case qc.UP:
                this.moveState.up = e;
                break;
            case qc.DOWN:
                this.moveState.down = e
            }
        else
            switch (A) {
            case qc.FORWARD:
                this.moveState.forward = 0;
                break;
            case qc.BACK:
                this.moveState.back = 0;
                break;
            case qc.LEFT:
                this.moveState.left = 0;
                break;
            case qc.RIGHT:
                this.moveState.right = 0;
                break;
            case qc.UP:
                this.moveState.up = 0;
                break;
            case qc.DOWN:
                this.moveState.down = 0
            }
        this._updateMovement()
    }
    ,
    Lg.prototype.setHeightLocked = function(A) {
        this.lockHeightEnabled && this.isLockHeight !== A && (this.isLockHeight = A)
    }
    ,
    Lg.prototype.setDragLook = function(A) {
        this.dragLook !== A && (this.firstRotate = !0,
        this.dragLook = A)
    }
    ,
    Lg.prototype.processPointerLockEnter = function() {
        this.pointerLock = !0
    }
    ,
    Lg.prototype.processPointerLockExit = function() {
        this.pointerLock = !1
    }
    ,
    Lg.prototype.processMovement = function(A) {
        this.rotateDelta.set(A.movementX || A.mozMovementX || A.webkitMovementX || 0, A.movementY || A.mozMovementY || A.webkitMovementY || 0),
        this._doRotate(this.rotateDelta)
    }
    ;
    var Ng = function(A) {
        Qg.call(this, Gc.ZOOM, A),
        this.mouseButtons = {
            ZOOM: t.LEFT,
            PAN2: t.MIDDLE,
            PAN: t.RIGHT
        }
    };
    (Ng.prototype = Object.create(Qg.prototype)).constructor = Ng;
    var Og = function() {
        this.control = null,
        this.controls = {},
        this.tools = [],
        this.domElement = null,
        this.enabled = !0,
        this.isUpdateRenderList = !0;
        var A = !1
          , e = this;
        function t(t) {
            if (e.enabled) {
                for (var i = e.tools, o = i.length - 1; o >= 0; o -= 1)
                    if (i[o].onEvent(t)) {
                        switch (t.type) {
                        case "mouseup":
                            A = !1
                        }
                        return
                    }
                switch (t.type) {
                case "touchmove":
                    e.control.processTouchmove(t);
                    break;
                case "touchstart":
                    e.control.processTouchstart(t);
                    break;
                case "touchend":
                    e.control.processTouchend(t);
                    break;
                case "keydown":
                    e.control.processKeyDown(t);
                    break;
                case "keyup":
                    e.control.processKeyUp(t);
                    break;
                case "wheel":
                case "mousewheel":
                case "DOMMouseScroll":
                    e.cameraChange = !0,
                    e.control.processMouseWheel(t);
                    break;
                case "mousedown":
                    !function(t) {
                        e.setFocuse(),
                        A = !0,
                        e.isUpdateRenderList = !1,
                        e.control ? e.control.processMouseDown(t) : Bh.warn("control is null")
                    }(t);
                    break;
                case "mousemove":
                    !function(t) {
                        e.pointerLock ? e.control.processMovement(t) : A ? (e.isUpdateRenderList = !1,
                        e.cameraChange = !0,
                        e.control.processMouseMove(t)) : e.control.processHover(t)
                    }(t);
                    break;
                case "mouseup":
                    !function(t) {
                        e.isUpdateRenderList = !0,
                        A && (e.control.processMouseUp(t),
                        A = !1)
                    }(t);
                    break;
                case "dblclick":
                    e.control.processMouseDoubleClick(t)
                }
            } else
                e.cameraChange = !1
        }
        function i(A) {
            A.preventDefault()
        }
        function o(A) {
            document.pointerLockElement === e.domElement || document.mozPointerLockElement === e.domElement || document.webkitPointerLockElement === e.domElement ? (e.pointerLock = !0,
            e.control.processPointerLockEnter(A)) : (e.pointerLock = !1,
            e.control.processPointerLockExit(A),
            e.domElement.focus(),
            e.control.dispatchEvent({
                type: Rc.ON_POINTERLOCK_EXIST,
                name: e.control.getName()
            }))
        }
        function n(A) {
            e.pointerLock = !1,
            e.control.processPointerLockExit(A),
            e.control.dispatchEvent({
                type: Rc.ON_POINTERLOCK_EXIST,
                name: e.control.getName()
            })
        }
        this.setFocuse = function() {
            if (e.domElement) {
                var A = e.domElement.querySelector(".main-canvas");
                A && A.focus && A.focus()
            }
        }
        ,
        this.setFocus = this.setFocuse,
        this.getCameraControl = function() {
            return this.cameraControl
        }
        ,
        this.registerDomEventListeners = function(A) {
            this.domElement = A,
            A.addEventListener("contextmenu", i, !1),
            A.addEventListener("mousedown", t, !1),
            A.addEventListener("mousewheel", t, !1),
            A.addEventListener("DOMMouseScroll", t, !1),
            A.addEventListener("wheel", t, !1),
            A.addEventListener("dblclick", t, !1),
            window.addEventListener("mousemove", t, !1),
            window.addEventListener("mouseup", t, !1),
            A.addEventListener("touchstart", t, !1),
            A.addEventListener("touchend", t, !1),
            A.addEventListener("touchmove", t, !1),
            window.addEventListener("touchmove", (function(A) {}
            ), !1),
            A.addEventListener("keydown", t, !1),
            window.addEventListener("keyup", t, !1),
            document.addEventListener("pointerlockchange", o, !1),
            document.addEventListener("mozpointerlockchange", o, !1),
            document.addEventListener("webkitpointerlockchange", o, !1),
            document.addEventListener("pointerlockerror", n, !1),
            document.addEventListener("mozpointerlockerror", n, !1),
            document.addEventListener("webkitpointerlockerror", n, !1),
            this.setFocuse()
        }
        ,
        this.unregisterDomEventListeners = function(A) {
            A.removeEventListener("contextmenu", i, !1),
            A.removeEventListener("mousedown", t, !1),
            A.removeEventListener("mousewheel", t, !1),
            A.removeEventListener("DOMMouseScroll", t, !1),
            A.removeEventListener("dblclick", t, !1),
            window.removeEventListener("mousemove", t, !1),
            window.removeEventListener("mouseup", t, !1),
            A.removeEventListener("touchstart", t, !1),
            A.removeEventListener("touchend", t, !1),
            A.removeEventListener("touchmove", t, !1),
            A.removeEventListener("keydown", t, !1),
            window.removeEventListener("keyup", t, !1),
            document.removeEventListener("pointerlockchange", o, !1),
            document.removeEventListener("mozpointerlockchange", o, !1),
            document.removeEventListener("webkitpointerlockchange", o, !1),
            document.removeEventListener("pointerlockerror", n, !1),
            document.removeEventListener("mozpointerlockerror", n, !1),
            document.removeEventListener("webkitpointerlockerror", n, !1)
        }
    };
    Og.prototype = {
        constructor: Og,
        destroy: function() {
            for (var A in this.control = null,
            this.controls) {
                this.controls[A].destroy()
            }
            this.controls = {};
            for (var e = 0, t = this.tools.length; t > e; e += 1)
                this.tools[e].destroy();
            this.tools = null,
            this.unregisterDomEventListeners(this.domElement),
            this.domElement = null
        },
        getCurrentControlName: function() {
            return this.control ? this.control.name : ""
        },
        _getControlByName: function(A, e) {
            var t = this.controls[e];
            if (t)
                return t;
            var i = Gc;
            this.viewer = A,
            this.cameraControl = A.cameraControl;
            var o = A.cameraControl;
            switch (e) {
            case i.ORBIT:
                t = new Rg(o);
                break;
            case i.PICK:
                t = new kg(o);
                break;
            case i.PAN:
                t = new Tg(o);
                break;
            case i.FLY:
                t = new Kg(o);
                break;
            case i.WALK:
                t = new Lg(o);
                break;
            case i.ZOOM:
                t = new Ng(o);
                break;
            default:
                t = null,
                Bh.error("invalid control name")
            }
            return t && (t.name = e,
            this.controls[e] = t),
            t
        },
        getCurrentControlMode: function() {
            return this.control
        },
        getCurrentControl: function() {
            return this.control
        },
        setControlMode: function(A, e) {
            var t = this._getControlByName(A, e);
            t && this.control !== t && (null !== this.control && (this.control.dispatchEvent({
                type: Rc.ON_CONTROL_EXIST,
                name: this.control.getName()
            }),
            this.control.onExit()),
            this.control = t,
            this.control.onEnter(),
            this.control.dispatchEvent({
                type: Rc.ON_CONTROL_ENTER,
                name: this.control.getName()
            }))
        },
        getToolByName: function(A) {
            for (var e = this.tools.length, t = 0; e > t; t += 1)
                if (this.tools[t].name === A)
                    return this.tools[t]
        },
        enableTool: function(A, e) {
            for (var t = Pc, i = this.tools, o = 0, n = i.length; n > o; o += 1)
                if (i[o].name === e)
                    return;
            var r = null;
            switch (e) {
            case t.PICK_BY_RECT:
                r = new bg(A);
                break;
            case t.ZOOM_BY_RECT:
                r = new Ug(A);
                break;
            case t.CLIP_BY_BOX:
                r = new vp(A);
                break;
            case t.CLIP_FILL:
                r = new Sp(A);
                break;
            case t.PICK_BY_MEASURE:
                r = new Eg(A);
                break;
            case t.COMPONENT_TRANSFORM:
                r = new Ip(A.getScene(),A.camera,A.domElement)
            }
            r && i.push(r)
        },
        disableTool: function(A) {
            for (var e = this.tools, t = 0, i = e.length; i > t; t += 1)
                if (e[t].name === A) {
                    e[t].onExit(),
                    this.dispatchEvent({
                        type: Rc.ON_CONTROL_EXIST,
                        name: A
                    }),
                    e.splice(t, 1);
                    break
                }
        },
        setInteractiveState: function(A) {
            this.enabled = A
        },
        requestPointerLock: function() {
            this.control instanceof Lg && (this.domElement.requestPointerLock = this.domElement.requestPointerLock || this.domElement.mozRequestPointerLock || this.domElement.webkitRequestPointerLock,
            this.domElement.requestPointerLock())
        }
    },
    Object.assign(Og.prototype, Ld.prototype);
    var Vg = function() {
        this.className = "FilterAction"
    };
    Vg.prototype.getClassName = function() {
        return this.className
    }
    ,
    Vg.prototype.applyFilter = function(A) {}
    ;
    var Gg = function() {
        Vg.call(this),
        this.className = "IdsFilterAction",
        this.ids = []
    };
    (Gg.prototype = Object.create(Vg.prototype)).arrayToMap = function(A) {
        for (var e = {}, t = 0; A.length > t; t += 1) {
            var i = A[t];
            e[i] = i
        }
        return e
    }
    ,
    Gg.prototype.constructor = Gg,
    Gg.prototype.setIds = function(A) {
        this.ids = A
    }
    ;
    var Pg = function(A, e) {
        Gg.call(this),
        this.className = "VisibleIdsFA",
        this.flag = A,
        this.isVisible = e
    };
    (Pg.prototype = Object.create(Gg.prototype)).constructor = Pg,
    Pg.prototype.applyFilter = function(A) {
        Array.isArray(this.ids) ? (A.setVisible(this.ids, this.isVisible, this.flag),
        A.calculateVisibleComponentsBbox()) : Bh.warn("Ids should be type of array.")
    }
    ;
    var qg = function(A, e) {
        Gg.call(this),
        this.className = "OverrideIdsFA",
        this.flag = A,
        this.material = e
    };
    (qg.prototype = Object.create(Gg.prototype)).constructor = qg,
    qg.prototype.applyFilter = function(A) {
        Array.isArray(this.ids) ? A.setMaterial(this.ids, this.material, this.flag) : Bh.warn("Ids should be type of array.")
    }
    ;
    var jg = function(A, e) {
        Gg.call(this),
        this.className = "WireframeIdsFA",
        this.flag = A,
        this.material = e
    };
    (jg.prototype = Object.create(Gg.prototype)).constructor = jg,
    jg.prototype.applyFilter = function(A) {
        Array.isArray(this.ids) ? A.setMaterial(this.ids, this.material, this.flag) : Bh.warn("Ids should be type of array.")
    }
    ;
    var Hg = function(A) {
        Gg.call(this),
        this.className = "IsolateIdsFA",
        this.isolateHide = A
    };
    (Hg.prototype = Object.create(Gg.prototype)).constructor = Hg,
    Hg.prototype.applyFilter = function(A) {
        Array.isArray(this.ids) ? (A.clearIsolates(),
        this.isolateHide ? (A.setIsolateHide(this.ids, !0, !1),
        A.calculateVisibleComponentsBbox()) : A.setIsolateTransparent(this.ids, !0, !1)) : Bh.warn("Ids should be type of array.")
    }
    ;
    var Yg = function(A, e) {
        Gg.call(this),
        this.className = "TransparentIdsFA",
        this.flag = A,
        this.isOpaque = e
    };
    (Yg.prototype = Object.create(Gg.prototype)).constructor = Yg,
    Yg.prototype.applyFilter = function(A) {
        Array.isArray(this.ids) ? A.setTransparent(this.ids, !this.isOpaque, this.flag) : Bh.warn("Ids should be type of array.")
    }
    ;
    var Wg = function() {
        Vg.call(this),
        this.className = "ConditionFilterAction",
        this.conditions = null
    };
    (Wg.prototype = Object.create(Vg.prototype)).constructor = Wg;
    var Jg = function(A, e) {
        Wg.call(this),
        this.className = "VisibleConditionFA",
        this.flag = A,
        this.isVisible = e
    };
    (Jg.prototype = Object.create(Wg.prototype)).constructor = Jg,
    Jg.prototype.applyFilter = function(A) {
        var e = this;
        Array.isArray(this.conditions) ? (A.matchConditions(this.conditions, (function(t, i) {
            e.flag === i && (A.setVisible(t, e.isVisible),
            t = null)
        }
        )),
        A.calculateVisibleComponentsBbox()) : Bh.warn("Conditions should be type of array.")
    }
    ;
    var zg = function(A, e) {
        Wg.call(this),
        this.className = "OverrideConditionFA",
        this.flag = A,
        this.material = e
    };
    (zg.prototype = Object.create(Wg.prototype)).constructor = zg,
    zg.prototype.applyFilter = function(A, e) {
        var t = this;
        Array.isArray(this.conditions) ? A.matchConditions(this.conditions, (function(e, i) {
            t.flag === i && (A.setMaterial(e, t.material),
            e = null)
        }
        )) : Bh.warn("Conditions should be type of array.")
    }
    ;
    var Zg = function(A, e) {
        Wg.call(this),
        this.className = "TransparentConditionFA",
        this.flag = A,
        this.isOpaque = e
    };
    (Zg.prototype = Object.create(Wg.prototype)).constructor = Zg,
    Zg.prototype.applyFilter = function(A) {
        var e = this;
        Array.isArray(this.conditions) ? A.matchConditions(this.conditions, (function(t, i) {
            e.flag === i && (A.setTransparent(t, !e.isOpaque),
            t = null)
        }
        )) : Bh.warn("Conditions should be type of array.")
    }
    ;
    var Xg = function(A) {
        Wg.call(this),
        this.className = "IsolateConditionFA",
        this.isolateHide = A
    };
    (Xg.prototype = Object.create(Wg.prototype)).constructor = Xg,
    Xg.prototype.applyFilter = function(A) {
        A.clearIsolates();
        var e = this.isolateHide;
        Array.isArray(this.conditions) ? A.matchConditions(this.conditions, (function(t, i) {
            !0 !== i ? (e ? (A.setIsolateHide(t, !i),
            A.calculateVisibleComponentsBbox()) : A.setIsolateTransparent(t, !i),
            t = null) : t = null
        }
        )) : Bh.warn("Conditions should be type of array.")
    }
    ;
    var _g = function(A) {
        this._activeFilterList = [],
        this._filterResultModes = {},
        this._defaultReturnValue = A,
        this._filterPriority = null
    };
    _g.prototype.setFilterMode = function(A) {
        this._filterResultModes = A
    }
    ,
    _g.prototype.setFilterPriority = function(A) {
        this._filterPriority = A
    }
    ,
    _g.prototype.addBaseFilter = function(A) {
        var e = this._activeFilterList
          , t = e.indexOf(A);
        if (null === this._filterPriority)
            -1 === t ? e.push(A) : t !== e.length - 1 && (e.splice(t, 1),
            e.push(A));
        else if (0 === e.length)
            e.push(A);
        else {
            -1 !== t && t !== e.length - 1 && e.splice(t, 1);
            for (var i = this._filterPriority[A.getType()], o = 0, n = e.length; n > o; o += 1)
                if (this._filterPriority[e[o].getType()] > i) {
                    e.splice(o, 0, A);
                    break
                }
            o === n && e.push(A)
        }
    }
    ,
    _g.prototype.removeBaseFilter = function(A) {
        var e = this._activeFilterList.indexOf(A);
        -1 !== e && this._activeFilterList.splice(e, 1)
    }
    ,
    _g.prototype.isEmpty = function() {
        return 0 === this._activeFilterList.length
    }
    ,
    _g.prototype.hasFilterNotIn = function(A) {
        for (var e = this._activeFilterList, t = e.length - 1; t >= 0; t -= 1) {
            if (void 0 === A._filterResultModes[e[t].getType()])
                return !0
        }
        return !1
    }
    ,
    _g.prototype.apply = function(A) {
        for (var e = Jc, t = null, i = this._activeFilterList.length - 1; i >= 0; i -= 1)
            switch (this._filterResultModes[(t = this._activeFilterList[i]).getType()]) {
            case e.MATCH_RETURN_TRUE:
                if (t.match(A))
                    return !0;
                break;
            case e.MATCH_RETURN_FALSE:
                if (t.match(A))
                    return !1;
                break;
            case e.NOMATCH_RETURN_TRUE:
                if (!t.match(A))
                    return !0;
                break;
            case e.NOMATCH_RETURN_FALSE:
                if (!t.match(A))
                    return !1;
                break;
            default:
                return !1
            }
        return this._defaultReturnValue
    }
    ,
    _g.prototype.getApplyFilterId = function(A) {
        for (var e = Jc, t = null, i = this._activeFilterList.length - 1; i >= 0; i -= 1)
            switch (this._filterResultModes[(t = this._activeFilterList[i]).getType()]) {
            case e.MATCH_RETURN_TRUE:
            case e.MATCH_RETURN_FALSE:
                if (t.match(A))
                    return t.getType();
                break;
            case e.NOMATCH_RETURN_TRUE:
            case e.NOMATCH_RETURN_FALSE:
                if (!t.match(A))
                    return t.getType();
                break;
            default:
                return -1
            }
        return -1
    }
    ,
    Math.log2 = Math.log2 || function(A) {
        return Math.log(A) / Math.LN2
    }
    ,
    "function" != typeof String.prototype.startsWith && (String.prototype.startsWith = function(A) {
        return this.slice(0, A.length) === A
    }
    ),
    Array.prototype.remove || Object.defineProperty(Array.prototype, "remove", {
        enumerable: !1,
        value: function(A) {
            var e = this.indexOf(A);
            e > -1 && this.splice(e, 1)
        }
    }),
    "undefined" != typeof window && mh.isIE11() && function() {
        function A(A, e) {
            e = e || {
                bubbles: !1,
                cancelable: !1,
                detail: void 0
            };
            var t = document.createEvent("CustomEvent");
            return t.initCustomEvent(A, e.bubbles, e.cancelable, e.detail),
            t
        }
        A.prototype = window.CustomEvent.prototype,
        window.CustomEvent = A
    }(),
    "function" != typeof String.prototype.startsWith && (String.prototype.startsWith = function(A) {
        return this.slice(0, A.length) === A
    }
    ),
    "function" != typeof String.prototype.endsWith && (String.prototype.endsWith = function(A) {
        return -1 !== this.indexOf(A, this.length - A.length)
    }
    ),
    "undefined" != typeof window && (window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder),
    Number.isInteger = Number.isInteger || function(A) {
        return "number" == typeof A && isFinite(A) && Math.floor(A) === A
    }
    ,
    String.prototype.repeat = String.prototype.repeat || function(A) {
        if (1 > A)
            return "";
        for (var e = "", t = this.valueOf(); A > 1; )
            1 & A && (e += t),
            A >>= 1,
            t += t;
        return e + t
    }
    ,
    Array.prototype.fill || Object.defineProperty(Array.prototype, "fill", {
        enumerable: !1,
        value: function(A, e, t) {
            t = void 0 === t ? this.length : t;
            for (var i = e = void 0 === e ? 0 : e; t > i; i += 1)
                this[i] = A
        }
    }),
    Array.prototype.find || Object.defineProperty(Array.prototype, "find", {
        enumerable: !1,
        value: function(A, e) {
            for (var t = this.length, i = 0; t > i; i += 1) {
                var o = this[i];
                if (A.call(e, o, i, this))
                    return o
            }
        }
    }),
    Array.prototype.hasValue || Object.defineProperty(Array.prototype, "hasValue", {
        enumerable: !1,
        value: function(A) {
            return this.indexOf(A) > -1
        }
    }),
    "function" != typeof Object.assign && Object.defineProperty(Object, "assign", {
        value: function(A, e) {
            if (null == A)
                throw new TypeError("Cannot convert undefined or null to object");
            for (var t = Object(A), i = 1; arguments.length > i; i += 1) {
                var o = arguments[i];
                if (null != o)
                    for (var n in o)
                        Object.prototype.hasOwnProperty.call(o, n) && (t[n] = o[n])
            }
            return t
        },
        writable: !0,
        configurable: !0
    }),
    ArrayBuffer.prototype.slice || (ArrayBuffer.prototype.slice = function(A, e) {
        if (!e || e > this.byteLength ? e = this.byteLength : 0 > e && 0 > (e = this.byteLength + e) && (e = 0),
        0 > A && 0 > (A = this.byteLength + A) && (A = 0),
        A >= e)
            return new ArrayBuffer;
        for (var t = e - A, i = new Uint8Array(this,A,t), o = new Uint8Array(t), n = 0; t > n; n += 1)
            o[n] = i[n];
        return o.buffer
    }
    ),
    Float32Array.prototype.slice || (Float32Array.prototype.slice = Float32Array.prototype.subarray),
    Uint32Array.prototype.slice || (Uint32Array.prototype.slice = Uint32Array.prototype.subarray),
    Int32Array.prototype.slice || (Int32Array.prototype.slice = Int32Array.prototype.subarray),
    Int16Array.prototype.slice || (Int16Array.prototype.slice = Int16Array.prototype.subarray);
    var $g, Au = "function" == typeof Symbol && "symbol" === lc(Symbol.iterator) ? function(A) {
        return lc(A)
    }
    : function(A) {
        return A && "function" == typeof Symbol && A.constructor === Symbol && A !== Symbol.prototype ? "symbol" : lc(A)
    }
    , eu = function() {
        function A(A, e) {
            for (var t = 0; e.length > t; t += 1) {
                var i = e[t];
                i.enumerable = i.enumerable || !1,
                i.configurable = !0,
                "value"in i && (i.writable = !0),
                Object.defineProperty(A, i.key, i)
            }
        }
        return function(e, t, i) {
            return t && A(e.prototype, t),
            i && A(e, i),
            e
        }
    }();
    HTMLElement.prototype.tap = function(A) {
        var e = 0;
        this.addEventListener("touchstart", (function(A) {
            e = Date.now()
        }
        )),
        this.addEventListener("touchend", (function(t) {
            200 > Date.now() - e && A(t)
        }
        ))
    }
    ,
    (Boolean(window.ActiveXObject) || "ActiveXObject"in window) && (HTMLElement.prototype.remove = function() {
        var A = this.parentNode || this.parentElement;
        A && A.removeChild(this)
    }
    ,
    window.Element && (($g = Element.prototype).matches = $g.matches || $g.matchesSelector || $g.webkitMatchesSelector || $g.msMatchesSelector || function(A) {
        for (var e = (this.parentNode || this.document).querySelectorAll(A), t = -1; e[t += 1] && e[t] !== this; )
            ;
        return Boolean(e[t])
    }
    ),
    window.Element && function(A) {
        A.closest = A.closest || function(A) {
            for (var e = this; e.matches && !e.matches(A); )
                e = e.parentNode;
            return e.matches ? e : null
        }
    }(Element.prototype)),
    SVGElement.prototype.getClass = HTMLElement.prototype.getClass = function(A) {
        return this.getAttribute("class")
    }
    ,
    SVGElement.prototype.hasClass = HTMLElement.prototype.hasClass = function(A) {
        var e = this.getClass();
        return !!e && (e && e.split(" ")).indexOf(A) > -1
    }
    ,
    SVGElement.prototype.addClass = HTMLElement.prototype.addClass = function(A) {
        var e = this.getClass()
          , t = e && e.split(" ");
        return e ? -1 === t.indexOf(A) && (t.push(A),
        e = t.join(" "),
        this.setAttribute("class", String(e))) : this.setAttribute("class", String(A)),
        this
    }
    ,
    SVGElement.prototype.removeClass = HTMLElement.prototype.removeClass = function(A) {
        if (!this.hasClass(A))
            return this;
        var e = this.getClass().replace(A, "").trim();
        return e ? this.setAttribute("class", String(e)) : this.removeAttribute("class"),
        this
    }
    ,
    SVGElement.prototype.toggleClass = HTMLElement.prototype.toggleClass = function(A, e) {
        this.getClass();
        var t = this.hasClass(A);
        return null != e ? (e && !t && this.addClass(A),
        e || this.removeClass(A)) : t ? this.removeClass(A) : this.addClass(A),
        !t
    }
    ,
    Array.prototype.getObjectByAttribute || Object.defineProperty(Array.prototype, "getObjectByAttribute", {
        enumerable: !1,
        value: function(A, e) {
            for (var t = this.length, i = 0; t > i; i += 1)
                if (this[i][A] === e)
                    return this[i];
            return !1
        }
    }),
    Array.prototype.removeObjectByAttribute || Object.defineProperty(Array.prototype, "removeObjectByAttribute", {
        enumerable: !1,
        value: function(A, e) {
            for (var t = this, i = t.length, o = 0; i > o; o += 1)
                if (t[o][A] === e)
                    return t = t.splice(o, 1);
            return !1
        }
    }),
    Array.prototype.getAllObjectByAttribute || Object.defineProperty(Array.prototype, "getAllObjectByAttribute", {
        enumerable: !1,
        value: function(A, e) {
            for (var t = this.length, i = 0, o = []; t > i; i += 1)
                this[i][A] === e && o.push(this[i]);
            return o
        }
    }),
    Array.prototype.removeByValue || Object.defineProperty(Array.prototype, "removeByValue", {
        enumerable: !1,
        value: function(A) {
            for (var e = this.length - 1; e >= 0; e -= 1)
                this[e] === A && this.splice(e, 1);
            return this
        }
    }),
    Array.prototype.insert || Object.defineProperty(Array.prototype, "insert", {
        enumerable: !1,
        value: function(A, e) {
            return this.splice(A, 0, e),
            this
        }
    }),
    SVGElement.prototype.setCss = HTMLElement.prototype.setCss = function(A) {
        if (A)
            for (var e in A)
                this.style[e] = A[e]
    }
    ,
    SVGElement.prototype.getCss = HTMLElement.prototype.getCss = function() {
        return this.style
    }
    ;
    var tu = function(A, e) {
        this._type = A,
        this._name = e,
        this._enabled = !1,
        this._items = {},
        this._relatedCompoundFilterList = []
    };
    tu.prototype.getType = function() {
        return this._type
    }
    ,
    tu.prototype.getName = function() {
        return this._name
    }
    ,
    tu.prototype.get = function() {
        return this._items
    }
    ,
    tu.prototype.getAll = function() {
        return this._items
    }
    ,
    tu.prototype.clearAll = function() {
        this._items = {},
        this._enabled && (this._enabled = !1,
        this.enableStateChanged())
    }
    ,
    tu.prototype.clear = function() {
        this.clearAll()
    }
    ,
    tu.prototype.isEmpty = function() {
        return !this._enabled
    }
    ,
    tu.prototype.forceEnable = function() {
        this._enabled || (this._enabled = !0,
        this.enableStateChanged())
    }
    ,
    tu.prototype.setByData = function(A) {
        !function(A) {
            if (null === A)
                return !0;
            if ("object" !== (void 0 === A ? "undefined" : Au(A)))
                return !0;
            for (var e in A)
                if (A.hasOwnProperty(e))
                    return !1;
            return !0
        }(A) ? (this._items = A,
        this._enabled || (this._enabled = !0,
        this.enableStateChanged())) : (this._items = {},
        this._enabled && (this._enabled = !1,
        this.enableStateChanged()))
    }
    ,
    tu.prototype.match = function(A) {
        return !1
    }
    ,
    tu.prototype.registerToCompoundFilter = function(A) {
        this._relatedCompoundFilterList.push(A)
    }
    ,
    tu.prototype.enableStateChanged = function() {
        for (var A = 0, e = this._relatedCompoundFilterList.length; e > A; A += 1)
            this._enabled ? this._relatedCompoundFilterList[A].addBaseFilter(this) : this._relatedCompoundFilterList[A].removeBaseFilter(this)
    }
    ;
    var iu = function(A, e) {
        tu.call(this, A, e)
    };
    (iu.prototype = Object.create(tu.prototype)).constructor = iu,
    iu.prototype.match = function(A) {
        var e = A.userData;
        return !e || function(A, e) {
            for (var t = !1, i = 0, o = A.length; o > i; i += 1) {
                t = !0;
                var n = A[i];
                for (var r in n) {
                    if (!Array.isArray(n[r]) && e[r] !== n[r]) {
                        t = !1;
                        break
                    }
                    if (Array.isArray(n[r]) && -1 === n[r].indexOf(e[r])) {
                        t = !1;
                        break
                    }
                }
                if (t)
                    return !0
            }
            return !1
        }(this._items, e)
    }
    ;
    var ou = function(A, e) {
        tu.call(this, A, e)
    };
    (ou.prototype = Object.create(tu.prototype)).constructor = ou,
    ou.prototype.add = function(A) {
        var e = this._items;
        if (A && A.length > 0) {
            for (var t = 0, i = A.length; i > t; t += 1)
                e[A[t]] = !0;
            this._enabled || (this._enabled = !0,
            this.enableStateChanged())
        }
    }
    ,
    ou.prototype.remove = function(A) {
        var e = this._items;
        if (A && A.length > 0) {
            for (var t = 0, i = A.length; i > t; t += 1) {
                var o = A[t];
                e.hasOwnProperty(o) && delete e[o]
            }
            0 === Object.keys(e).length && this._enabled && (this._enabled = !1,
            this.enableStateChanged())
        }
    }
    ;
    var nu = function(A, e) {
        ou.call(this, A, e)
    };
    (nu.prototype = Object.create(ou.prototype)).constructor = nu,
    nu.prototype.match = function(A) {
        var e = A.name;
        if (e) {
            var t = e.indexOf(".");
            if (-1 !== t) {
                var i = e.substring(0, t);
                return !!this._items[i]
            }
        }
        var o = A.userData;
        if (o && (i = o.sceneId))
            return !!this._items[i];
        return !1
    }
    ;
    var ru = function(A, e) {
        ou.call(this, A, e)
    };
    (ru.prototype = Object.create(ou.prototype)).constructor = ru,
    ru.prototype.match = function(A) {
        return !!this._items[A.name]
    }
    ;
    var au = function() {
        this.defaultWireframeColor = {
            color: new LA(0,0,0),
            opacity: .4
        },
        this.wireframeMaterial = new jA(this.defaultWireframeColor),
        !1 === vc.TranslucentDepthDisabled && (this.wireframeMaterial.transparent = !0),
        this.instanceWireframeMaterial = Kd.createInstanceMaterial(Kd.getMaterialParameters(this.wireframeMaterial)),
        !1 === vc.TranslucentDepthDisabled && (this.instanceWireframeMaterial.transparent = !0),
        this.wireframeGeometryMap = {}
    };
    au.prototype.destroy = function() {
        this.wireframeMaterial.dispose(),
        this.wireframeMaterial = null,
        this.instanceWireframeMaterial.destroy(),
        this.instanceWireframeMaterial = null,
        this.wireframeGeometryMap = null,
        this.defaultWireframeColor.color = null,
        this.defaultWireframeColor = null
    }
    ,
    au.prototype.setWireframeColor = function(A, e) {
        this.wireframeMaterial.color = A,
        this.wireframeMaterial.opacity = e,
        this.wireframeMaterial.transparent = 1 !== e,
        this.instanceWireframeMaterial.color = A,
        this.instanceWireframeMaterial.opacity = e,
        this.instanceWireframeMaterial.transparent = 1 !== e
    }
    ,
    au.prototype.getWireframeColor = function() {
        var A = this.wireframeMaterial.color.clone();
        return A.opacity = this.wireframeMaterial.opacity,
        A
    }
    ,
    au.prototype.restoreWireframeColor = function() {
        var A = this.defaultWireframeColor;
        this.setWireframeColor(A.color, A.opacity)
    }
    ;
    var su = function() {
        new au;
        var A = [{
            name: "scene",
            param: {
                name: "scene",
                color: 8947848,
                opacity: .4,
                transparent: !0,
                side: 2
            }
        }, {
            name: "darkRed",
            param: {
                name: "darkRed",
                color: 10496040,
                opacity: 1,
                transparent: !1,
                side: 2
            }
        }, {
            name: "lightBlue",
            param: {
                name: "lightBlue",
                color: 1275840,
                opacity: 1,
                transparent: !1,
                side: 2
            }
        }, {
            name: "black",
            param: {
                name: "black",
                color: 0,
                opacity: .3,
                transparent: !0,
                side: 2
            }
        }, {
            name: "add",
            param: {
                name: "add",
                color: 65280,
                opacity: 1,
                transparent: !0,
                side: 2
            }
        }, {
            name: "delete",
            param: {
                name: "delete",
                color: 16711680,
                opacity: .5,
                transparent: !0,
                side: 2
            }
        }, {
            name: "beforeEdit",
            param: {
                name: "beforeEdit",
                color: 16432389,
                opacity: .5,
                transparent: !0,
                side: 2
            }
        }, {
            name: "afterEdit",
            param: {
                name: "afterEdit",
                color: 16432389,
                opacity: 1,
                transparent: !0,
                side: 2
            }
        }]
          , e = {};
        e.selection = Kd.createHighlightMaterial(),
        e.selection.name = "selection";
        for (var t = 0, i = A.length; i > t; t += 1) {
            var o = A[t]
              , n = o.name;
            e[n] = Kd.createStandardMaterial(o.param),
            e[n].createByBos = !0
        }
        e.red = e.delete,
        e.green = e.add,
        e.yellow = e.beforeEdit,
        e.blue = e.selection;
        var r = {
            color: 8947848,
            opacity: .2,
            transparent: !0,
            side: 2
        }
          , a = Kd.createStandardMaterial(r);
        a.name = "isolate";
        var s = {
            color: 8947848,
            opacity: .2,
            transparent: !0,
            side: 2
        }
          , l = Kd.createStandardMaterial(s);
        l.name = "looming";
        var c = {
            color: 0,
            opacity: 1,
            transparent: !1,
            wireframe: !0,
            side: 2
        }
          , h = Kd.createStandardMaterial(c);
        h.name = "wireframe",
        e.wireframe = h;
        var d = {
            color: 15293,
            side: 2
        }
          , p = Kd.createStandardMaterial(d);
        for (var g in p.name = "selected",
        this.getDefaultMaterialName = function() {
            return "lightBlue"
        }
        ,
        this.get = function(A) {
            return e[A]
        }
        ,
        this.getAll = function() {
            return e
        }
        ,
        this.add = function(A) {
            var t, i = null, o = {};
            return A && A.hasOwnProperty("color") && (o.color = A.color,
            o.side = 2,
            A.hasOwnProperty("opacity") && (o.opacity = A.opacity,
            o.transparent = 1 !== A.opacity)),
            t = this._getMaterialName(A),
            (i = e[t]) || (o.name = t,
            i = Kd.createStandardMaterial(o),
            e[t] = i,
            e[t].createByBos = !0),
            t
        }
        ,
        this.remove = function(A) {
            var t;
            t = this._getMaterialName(A),
            e[t] && delete e[t]
        }
        ,
        this.has = function(A) {
            return Boolean(e[A])
        }
        ,
        this.getMaterialNameByColor = function(A) {
            var t;
            return t = this._getMaterialName(A),
            e[t] ? t : this.add(A)
        }
        ,
        this.getMaterialNameByWireframe = function(A) {
            var t;
            return (t = this._getMaterialName(A)) && !e[t] ? this.add(A) : t
        }
        ,
        this.addOverrideMaterial = function(A) {
            if (A) {
                var t = A.name;
                e[t] || (e[t] = A)
            }
        }
        ,
        this.updateOverrideMaterial = function(A) {
            A && (e[A.name] = A)
        }
        ,
        this.getMaterialParamsFromName = function(A) {
            var e = {}
              , t = A.split("_");
            return "mat" === t[0] ? (e.color = parseInt(t[1], 0),
            e.opacity = 1) : (e.color = parseInt(t[0], 0),
            e.opacity = parseFloat(t[1], 0)),
            e
        }
        ,
        this._getMaterialName = function(A) {
            var e = null;
            return A && A.hasOwnProperty("color") ? e = A.hasOwnProperty("opacity") ? A.color + "_" + A.opacity : "mat_" + A.color : A && A.hasOwnProperty("wireframe") ? A.wireframe && (e = "wireframe") : e = "mat_" + A,
            e
        }
        ,
        this.setWireframeMaterial = function(A) {
            e.wireframe.color.setHex(void 0 !== A.color ? A.color : c.color),
            e.wireframe.opacity = void 0 !== A.opacity ? A.opacity : c.opacity,
            e.wireframe.transparent = void 0 !== A.transparent ? A.transparent : c.transparent,
            e.wireframe.side = void 0 !== A.side ? A.side : c.side,
            e.wireframe.needsUpdate = !0
        }
        ,
        this.getWireframeMaterial = function() {
            return e.wireframe
        }
        ,
        this.setFrozonMaterial = function(A) {
            l.color.setHex(void 0 !== A.color ? A.color : s.color),
            l.opacity = void 0 !== A.opacity ? A.opacity : s.opacity,
            l.transparent = void 0 !== A.transparent ? A.transparent : s.transparent,
            l.side = void 0 !== A.side ? A.side : s.side,
            l.needsUpdate = !0
        }
        ,
        this.getFrozonMaterial = function() {
            return l
        }
        ,
        this.setSelectedMaterial = function(A) {
            p.color.setHex(void 0 !== A.color ? A.color : d.color),
            p.opacity = void 0 !== A.opacity ? A.opacity : d.opacity,
            p.transparent = void 0 !== A.transparent ? A.transparent : d.transparent,
            p.side = void 0 !== A.side ? A.side : d.side,
            p.needsUpdate = !0
        }
        ,
        this.getSelectedMaterial = function() {
            return p
        }
        ,
        this.setIsolateMaterial = function(A) {
            a.color.setHex(void 0 !== A.color ? A.color : r.color),
            a.opacity = void 0 !== A.opacity ? A.opacity : r.opacity,
            a.transparent = void 0 !== A.transparent ? A.transparent : r.transparent,
            a.side = void 0 !== A.side ? A.side : r.side,
            a.needsUpdate = !0
        }
        ,
        this.getIsolateMaterial = function() {
            return a
        }
        ,
        this.resetIsolateMaterial = function() {
            a.color.setHex(r.color),
            a.opacity = r.opacity,
            a.transparent = r.transparent,
            a.side = r.side,
            a.needsUpdate = !0
        }
        ,
        e)
            e[g].createByBos = !0
    }
      , lu = function(A, e) {
        tu.call(this, A, e)
    };
    (lu.prototype = Object.create(tu.prototype)).constructor = lu,
    lu.prototype.match = function(A) {
        return null !== this.getMatchItem(A)
    }
    ,
    lu.prototype.getMatchItem = function(A) {
        var e = this._items
          , t = A.userData
          , i = !1;
        if (t)
            for (var o = e.length, n = 0; o > n; n += 1) {
                var r = e[n]
                  , a = r.condition;
                for (var s in i = !0,
                a)
                    if (a[s] !== t[s]) {
                        i = !1;
                        break
                    }
                if (i)
                    return r
            }
        return null
    }
    ;
    var cu = function(A, e) {
        tu.call(this, A, e)
    };
    (cu.prototype = Object.create(tu.prototype)).constructor = cu,
    cu.prototype.remove = function(A, e) {
        var t = this._items[A];
        if (t && e && e.length > 0) {
            for (var i = 0, o = e.length; o > i; i += 1) {
                var n = e[i];
                t.hasOwnProperty(n) && delete t[n]
            }
            uh.isEmptyObject(this._items) && this._enabled && (this._enabled = !1,
            this.enableStateChanged())
        }
    }
    ,
    cu.prototype.add = function(A, e, t) {
        var i = this._items
          , o = i[A];
        if (e && e.length > 0) {
            void 0 === t && (t = !0),
            o || (o = i[A] = {});
            for (var n = 0, r = e.length; r > n; n += 1)
                o[e[n]] = t;
            this._enabled || (this._enabled = !0,
            this.enableStateChanged())
        }
    }
    ,
    cu.prototype.clear = function(A) {
        var e = this._items;
        e.hasOwnProperty(A) && (delete e[A],
        uh.isEmptyObject(e) && this._enabled && (this._enabled = !1,
        this.enableStateChanged()))
    }
    ;
    var hu = function(A, e) {
        tu.call(this, A, e)
    };
    (hu.prototype = Object.create(cu.prototype)).constructor = hu,
    hu.prototype.match = function(A) {
        return null !== this.getMatchItem(A)
    }
    ,
    hu.prototype.getMatchItem = function(A) {
        var e = this._items
          , t = A.name;
        for (var i in e) {
            var o = e[i];
            if (o[t])
                return o[t]
        }
        return null
    }
    ;
    var du = function(A, e) {
        tu.call(this, A, e)
    };
    (du.prototype = Object.create(cu.prototype)).constructor = du,
    du.prototype.match = function(A) {
        return null !== this.getMatchItem(A)
    }
    ,
    du.prototype.getMatchItem = function(A) {
        var e = this._items
          , t = A.userData;
        if (t)
            for (var i in e) {
                var o = e[i]
                  , n = t[i];
                if (n && void 0 !== o[n])
                    return o[n]
            }
        return null
    }
    ;
    var pu = function() {
        var A = Jc
          , e = {
            IDFILTER_OFFSET: 0,
            FILE_VISIBLE: 0,
            FILE_HIDDEN: 1,
            VISIBLE: 2,
            HIDDEN: 3,
            TRANSLUCENT: 4,
            TRANSLUCENT_OTHERS: 5,
            WIREFRAME: 24,
            COLORFUL: 25,
            RENDER_PROMOTION: 6,
            IDFILTER_ENDOFFSET: 6,
            ISOLATEFILTER_OFFSET: 7,
            ISOLATE_HIDDEN: 7,
            ISOLATE_HIDDEN_OTHERS: 8,
            ISOLATE_TRANSLUCENT: 9,
            ISOLATE_TRANSLUCENT_OTHERS: 10,
            ISOLATEFILTER_ENDOFFSET: 10,
            USERFILTER_OFFSET: 11,
            USER_HIDDEN: 11,
            USER_OVERRIDE: 12,
            USER_WITH_BOARDLINE: 13,
            USERFILTER_ENDOFFSET: 13,
            CONDITIONFILTER_OFFSET: 14,
            CONDITION_HIDDEN_OTHERS: 14,
            CONDITION_TRANSLUCENT_OTHERS: 15,
            CONDITION_OVERRIDE: 16,
            CONDITION_BORDERLINE: 26,
            CONDITIONFILTER_ENDOFFSET: 16,
            ISOLATECONDITIONFILTER_OFFSET: 17,
            ISOLATE_CONDITION_HIDDEN: 17,
            ISOLATE_CONDITION_HIDDEN_OTHERS: 18,
            ISOLATE_CONDITION_TRANSLUCENT: 19,
            ISOLATE_CONDITION_TRANSLUCENT_OTHERS: 20,
            ISOLATECONDITIONFILTER_ENDOFFSET: 20,
            FROZENFILTER: 21,
            FROZENCONDITIONFILTER: 22,
            OVERRIDEFILTER: 23,
            BASICFILTER_COUNT: 23
        }
          , t = new _g(!0)
          , i = new _g(!0)
          , o = new _g(!1)
          , n = new _g(!0)
          , r = new _g(!1)
          , a = new _g(!1)
          , s = new _g(!1)
          , l = []
          , c = null
          , h = null
          , d = Vc.DISABLED
          , p = new su;
        !function() {
            l[e.FILE_VISIBLE] = new nu(e.FILE_VISIBLE,"FILE_VISIBLE"),
            l[e.FILE_HIDDEN] = new nu(e.FILE_HIDDEN,"FILE_HIDDEN"),
            l[e.VISIBLE] = new ru(e.VISIBLE,"VISIBLE"),
            l[e.HIDDEN] = new ru(e.HIDDEN,"HIDDEN"),
            l[e.TRANSLUCENT] = new ru(e.TRANSLUCENT,"TRANSLUCENT"),
            l[e.TRANSLUCENT_OTHERS] = new ru(e.TRANSLUCENT_OTHERS,"TRANSLUCENT_OTHERS"),
            l[e.RENDER_PROMOTION] = new ru(e.RENDER_PROMOTION,"RENDER_PROMOTION"),
            l[e.WIREFRAME] = new ru(e.WIREFRAME,"WIREFRAME"),
            l[e.COLORFUL] = new ru(e.COLORFUL,"COLORFUL"),
            l[e.ISOLATE_HIDDEN] = new ru(e.ISOLATE_HIDDEN,"ISOLATE_HIDDEN"),
            l[e.ISOLATE_HIDDEN_OTHERS] = new ru(e.ISOLATE_HIDDEN_OTHERS,"ISOLATE_HIDDEN_OTHERS"),
            l[e.ISOLATE_TRANSLUCENT] = new ru(e.ISOLATE_TRANSLUCENT,"ISOLATE_TRANSLUCENT"),
            l[e.ISOLATE_TRANSLUCENT_OTHERS] = new ru(e.ISOLATE_TRANSLUCENT_OTHERS,"ISOLATE_TRANSLUCENT_OTHERS"),
            l[e.USER_HIDDEN] = new du(e.USER_HIDDEN,"USER_HIDDEN"),
            l[e.USER_OVERRIDE] = new du(e.USER_OVERRIDE,"USER_OVERRIDE"),
            l[e.CONDITION_BORDERLINE] = new iu(e.CONDITION_BORDERLINE,"CONDITION_BORDERLINE"),
            l[e.CONDITION_HIDDEN_OTHERS] = new iu(e.CONDITION_HIDDEN_OTHERS,"CONDITION_HIDDEN_OTHERS"),
            l[e.CONDITION_TRANSLUCENT_OTHERS] = new iu(e.CONDITION_TRANSLUCENT_OTHERS,"CONDITION_TRANSLUCENT_OTHERS"),
            l[e.CONDITION_OVERRIDE] = new lu(e.CONDITION_OVERRIDE,"CONDITION_OVERRIDE"),
            l[e.ISOLATE_CONDITION_HIDDEN] = new iu(e.ISOLATE_CONDITION_HIDDEN,"ISOLATE_CONDITION_HIDDEN"),
            l[e.ISOLATE_CONDITION_HIDDEN_OTHERS] = new iu(e.ISOLATE_CONDITION_HIDDEN_OTHERS,"ISOLATE_CONDITION_HIDDEN_OTHERS"),
            l[e.ISOLATE_CONDITION_TRANSLUCENT] = new iu(e.ISOLATE_CONDITION_TRANSLUCENT,"ISOLATE_CONDITION_TRANSLUCENT"),
            l[e.ISOLATE_CONDITION_TRANSLUCENT_OTHERS] = new iu(e.ISOLATE_CONDITION_TRANSLUCENT_OTHERS,"ISOLATE_CONDITION_TRANSLUCENT_OTHERS"),
            h = new ru(e.FROZENFILTER,"FROZENFILTER"),
            l[e.FROZENCONDITIONFILTER] = new iu(e.FROZENCONDITIONFILTER,"FROZENCONDITIONFILTER"),
            l[e.FROZENFILTER] = h,
            c = new hu(e.OVERRIDEFILTER,"OVERRIDEFILTER"),
            l[e.OVERRIDEFILTER] = c;
            var d = null
              , p = {};
            for (d in p[e.HIDDEN] = A.MATCH_RETURN_FALSE,
            p[e.VISIBLE] = A.NOMATCH_RETURN_FALSE,
            p[e.USER_HIDDEN] = A.MATCH_RETURN_FALSE,
            p[e.CONDITION_HIDDEN_OTHERS] = A.NOMATCH_RETURN_FALSE,
            p[e.ISOLATE_HIDDEN] = A.MATCH_RETURN_FALSE,
            p[e.ISOLATE_HIDDEN_OTHERS] = A.NOMATCH_RETURN_FALSE,
            p[e.ISOLATE_CONDITION_HIDDEN_OTHERS] = A.NOMATCH_RETURN_FALSE,
            t.setFilterMode(p),
            p)
                l[d].registerToCompoundFilter(t);
            var g = {};
            for (d in g[e.FROZENFILTER] = A.MATCH_RETURN_FALSE,
            g[e.FROZENCONDITIONFILTER] = A.MATCH_RETURN_FALSE,
            g[e.TRANSLUCENT] = A.MATCH_RETURN_FALSE,
            g[e.TRANSLUCENT_OTHERS] = A.NOMATCH_RETURN_FALSE,
            g[e.CONDITION_TRANSLUCENT_OTHERS] = A.NOMATCH_RETURN_FALSE,
            g[e.ISOLATE_TRANSLUCENT] = A.MATCH_RETURN_FALSE,
            g[e.ISOLATE_TRANSLUCENT_OTHERS] = A.NOMATCH_RETURN_FALSE,
            g[e.ISOLATE_CONDITION_TRANSLUCENT_OTHERS] = A.NOMATCH_RETURN_FALSE,
            n.setFilterMode(g),
            g)
                l[d].registerToCompoundFilter(n);
            var u = {};
            u[e.ISOLATE_TRANSLUCENT] = A.MATCH_RETURN_TRUE,
            u[e.ISOLATE_TRANSLUCENT_OTHERS] = A.NOMATCH_RETURN_TRUE,
            u[e.ISOLATE_CONDITION_TRANSLUCENT_OTHERS] = A.NOMATCH_RETURN_TRUE,
            u[e.CONDITION_TRANSLUCENT_OTHERS] = A.NOMATCH_RETURN_TRUE,
            u[e.TRANSLUCENT] = A.MATCH_RETURN_TRUE,
            u[e.TRANSLUCENT_OTHERS] = A.NOMATCH_RETURN_TRUE,
            u[e.OVERRIDEFILTER] = A.MATCH_RETURN_TRUE,
            u[e.USER_OVERRIDE] = A.MATCH_RETURN_TRUE,
            u[e.CONDITION_OVERRIDE] = A.MATCH_RETURN_TRUE,
            u[e.FROZENFILTER] = A.MATCH_RETURN_TRUE,
            u[e.FROZENCONDITIONFILTER] = A.MATCH_RETURN_TRUE;
            var f = {};
            for (d in f[e.ISOLATE_TRANSLUCENT] = 5,
            f[e.ISOLATE_TRANSLUCENT_OTHERS] = 5,
            f[e.ISOLATE_CONDITION_TRANSLUCENT_OTHERS] = 5,
            f[e.CONDITION_TRANSLUCENT_OTHERS] = 5,
            f[e.TRANSLUCENT] = 5,
            f[e.TRANSLUCENT_OTHERS] = 5,
            f[e.OVERRIDEFILTER] = 0,
            f[e.USER_OVERRIDE] = 0,
            f[e.CONDITION_OVERRIDE] = 0,
            f[e.FROZENFILTER] = 3,
            f[e.FROZENCONDITIONFILTER] = 3,
            i.setFilterMode(u),
            i.setFilterPriority(f),
            u)
                l[d].registerToCompoundFilter(i);
            var m = {};
            for (d in m[e.OVERRIDEFILTER] = A.MATCH_RETURN_TRUE,
            m[e.USER_OVERRIDE] = A.MATCH_RETURN_TRUE,
            m[e.CONDITION_OVERRIDE] = A.MATCH_RETURN_TRUE,
            m[e.CONDITION_TRANSLUCENT_OTHERS] = A.MATCH_RETURN_TRUE,
            o.setFilterMode(m),
            m)
                l[d].registerToCompoundFilter(o);
            var C = {};
            for (d in C[e.FILE_VISIBLE] = A.NOMATCH_RETURN_TRUE,
            C[e.FILE_HIDDEN] = A.MATCH_RETURN_TRUE,
            r.setFilterMode(C),
            C)
                l[d].registerToCompoundFilter(r);
            var y = {};
            for (d in y[e.RENDER_PROMOTION] = A.MATCH_RETURN_TRUE,
            y[e.ISOLATE_CONDITION_TRANSLUCENT_OTHERS] = A.MATCH_RETURN_TRUE,
            a.setFilterMode(y),
            y)
                l[d].registerToCompoundFilter(a);
            var v = {};
            for (d in v[e.CONDITION_BORDERLINE] = A.MATCH_RETURN_TRUE,
            s.setFilterMode(v),
            v)
                l[d].registerToCompoundFilter(s)
        }(),
        this.getMaterialSelector = function() {
            return p
        }
        ,
        this.getBasicFilterList = function() {
            return l
        }
        ,
        this.getFilterType = function() {
            return e
        }
        ,
        this.saveState = function() {
            for (var A = {}, e = null, t = 0, i = l.length; i > t; t += 1)
                A[(e = l[t]).getName()] = e.getAll();
            return A.sceneState = this.getSceneState(),
            A.version = "1.0",
            A
        }
        ,
        this.loadState = function(A) {
            if (this.clearAll(),
            A.hasOwnProperty("version")) {
                if ("1.0" === A.version) {
                    for (var t = {}, i = 0, o = l.length; o > i; i += 1)
                        t[l[i].getName()] = i;
                    for (var n in A)
                        "sceneState" !== n && "version" !== n && (t.hasOwnProperty(n) ? l[t[n]].setByData(A[n]) : Bh.warn("Warning: Not supported filter '" + n + "'"))
                }
            } else
                for (var r in A)
                    "sceneState" !== r && (2 > r ? l[r].setByData(A[r]) : r > 2 ? e.BASICFILTER_COUNT + 2 > r && l[r - 1].setByData(A[r]) : 2 !== r && "2" !== r || Bh.warn("Warning: Old version filter data! The selection state is out of the filter, can not restore it."));
            this.setSceneState(A.sceneState)
        }
        ,
        this.clear = function() {
            for (var A = 0, t = l.length; t > A; A += 1) {
                var i = l[A].getType();
                i !== e.FROZENFILTER && i !== e.CONDITION_BORDERLINE && l[A].clearAll()
            }
            this.setSceneState(Vc.DISABLED)
        }
        ,
        this.clearAll = function() {
            for (var A = 0, e = l.length; e > A; A += 1)
                l[A].clearAll();
            this.setSceneState(Vc.DISABLED)
        }
        ,
        this.clearIsolate = function() {
            this.clearAllIsolateList(),
            this.clearAllIsolateConditions()
        }
        ,
        this.clearFrozenList = function() {
            h.clearAll()
        }
        ,
        this.addToFrozenList = function(A) {
            h.add(A)
        }
        ,
        this.removeFromFrozenList = function(A) {
            h.remove(A)
        }
        ,
        this.setFrozenList = function(A) {
            this.clearFrozenList(),
            this.addToFrozenList(A)
        }
        ,
        this.setFrozenConditions = function(A) {
            l[e.FROZENCONDITIONFILTER].setByData(A)
        }
        ,
        this.getFrozenConditions = function() {
            return l[e.FROZENCONDITIONFILTER].getAll()
        }
        ,
        this.clearFrozenConditions = function() {
            l[e.FROZENCONDITIONFILTER].clear()
        }
        ,
        this.clearFrozen = function() {
            this.clearFrozenList(),
            this.clearFrozenConditions()
        }
        ,
        this.clearAllIdList = function() {
            var A = null;
            for (A = e.IDFILTER_OFFSET; e.IDFILTER_ENDOFFSET >= A; A += 1)
                l[A].clearAll()
        }
        ,
        this.clearIdList = function(A) {
            var t = e.IDFILTER_OFFSET + A;
            e.IDFILTER_OFFSET > t || t > e.IDFILTER_ENDOFFSET || l[t].clear()
        }
        ,
        this.addToIdList = function(A, t) {
            var i = e.IDFILTER_OFFSET + A;
            e.IDFILTER_OFFSET > i || i > e.IDFILTER_ENDOFFSET || l[i].add(t)
        }
        ,
        this.removeFromIdList = function(A, t) {
            var i = e.IDFILTER_OFFSET + A;
            e.IDFILTER_OFFSET > i || i > e.IDFILTER_ENDOFFSET || l[i].remove(t)
        }
        ,
        this.setIdList = function(A, e) {
            this.clearIdList(A),
            this.addToIdList(A, e)
        }
        ,
        this.clearAllOverrideList = function() {
            c.clearAll()
        }
        ,
        this.clearOverrideList = function(A) {
            c.clear(A)
        }
        ,
        this.addToOverrideList = function(A, e, t) {
            e && e.length > 0 && (p.has(t) || (t = p.getDefaultMaterialName()),
            c.add(A, e, t))
        }
        ,
        this.removeFromOverrideList = function(A, e) {
            c.remove(A, e)
        }
        ,
        this.setOverrideList = function(A, e, t) {
            this.clearOverrideList(A),
            this.addToOverrideList(A, e, t)
        }
        ,
        this.addToOverrideListByColor = function(A, e, t) {
            var i = p.add(t);
            c.add(A, e, i)
        }
        ,
        this.setOverrideListByColor = function(A, e, t) {
            this.clearOverrideList(A),
            this.addToOverrideListByColor(A, e, t)
        }
        ,
        this.clearAllUserList = function() {
            var A = null;
            for (A = e.USERFILTER_OFFSET; e.USERFILTER_ENDOFFSET >= A; A += 1)
                l[A].clearAll()
        }
        ,
        this.clearUserListByType = function(A) {
            var t = e.USERFILTER_OFFSET + A;
            e.USERFILTER_OFFSET > t || t > e.USERFILTER_ENDOFFSET || l[t].clearAll()
        }
        ,
        this.clearUserList = function(A, t) {
            var i = e.USERFILTER_OFFSET + A;
            e.USERFILTER_OFFSET > i || i > e.USERFILTER_ENDOFFSET || l[i].clear(t)
        }
        ,
        this.addToUserList = function(A, t, i, o) {
            var n = e.USERFILTER_OFFSET + A;
            e.USERFILTER_OFFSET > n || n > e.USERFILTER_ENDOFFSET || l[n].add(t, i, o)
        }
        ,
        this.removeFromUserList = function(A, t, i) {
            var o = e.USERFILTER_OFFSET + A;
            e.USERFILTER_OFFSET > o || o > e.USERFILTER_ENDOFFSET || l[o].remove(t, i)
        }
        ,
        this.setUserList = function(A, e, t, i) {
            this.clearUserList(A, e),
            this.addToUserList(A, e, t, i)
        }
        ,
        this.isIsolate = function() {
            var A = null;
            for (A = e.ISOLATEFILTER_OFFSET; e.ISOLATEFILTER_ENDOFFSET >= A; A += 1)
                if (!l[A].isEmpty())
                    return !0;
            return !1
        }
        ,
        this.isFiltering = function() {
            return !!this.isIsolate() || !(l[e.HIDDEN].isEmpty() && l[e.VISIBLE].isEmpty() && l[e.TRANSLUCENT].isEmpty() && l[e.TRANSLUCENT_OTHERS].isEmpty() && this.getSceneState() === Vc.DISABLED)
        }
        ,
        this.setFrozonMaterial = function(A) {
            p.setFrozonMaterial(A)
        }
        ,
        this.getFrozonMaterial = function() {
            return p.getFrozonMaterial()
        }
        ,
        this.setSelectedMaterial = function(A) {
            p.setSelectedMaterial(A)
        }
        ,
        this.getSelectedMaterial = function() {
            return p.getSelectedMaterial()
        }
        ,
        this.setIsolateMaterial = function(A) {
            p.setIsolateMaterial(A)
        }
        ,
        this.getIsolateMaterial = function() {
            return p.getIsolateMaterial()
        }
        ,
        this.resetIsolateMaterial = function() {
            p.resetIsolateMaterial()
        }
        ,
        this.clearAllIsolateList = function() {
            var A = null;
            for (A = e.ISOLATEFILTER_OFFSET; e.ISOLATEFILTER_ENDOFFSET >= A; A += 1)
                l[A].clear()
        }
        ,
        this.clearIsolateList = function(A) {
            var t = e.ISOLATEFILTER_OFFSET + A;
            e.ISOLATEFILTER_OFFSET > t || t > e.ISOLATEFILTER_ENDOFFSET || l[t].clear()
        }
        ,
        this.addToIsolateList = function(A, t) {
            var i = e.ISOLATEFILTER_OFFSET + A;
            e.ISOLATEFILTER_OFFSET > i || i > e.ISOLATEFILTER_ENDOFFSET || l[i].add(t)
        }
        ,
        this.removeFromIsolateList = function(A, t) {
            var i = e.ISOLATEFILTER_OFFSET + A;
            e.ISOLATEFILTER_OFFSET > i || i > e.ISOLATEFILTER_ENDOFFSET || l[i].remove(t)
        }
        ,
        this.setIsolateList = function(A, e) {
            this.clearIsolateList(A),
            this.addToIsolateList(A, e)
        }
        ,
        this.setIsolateConditions = function(A, t) {
            var i = e.ISOLATECONDITIONFILTER_OFFSET + t;
            e.ISOLATECONDITIONFILTER_OFFSET > i || i > e.ISOLATECONDITIONFILTER_ENDOFFSET || l[i].setByData(A)
        }
        ,
        this.getIsolateConditions = function(A) {
            var t = null
              , i = e.ISOLATECONDITIONFILTER_OFFSET + A;
            return e.ISOLATECONDITIONFILTER_OFFSET > i || i > e.ISOLATECONDITIONFILTER_ENDOFFSET || (t = l[i].getAll()),
            t
        }
        ,
        this.clearIsolateConditions = function(A) {
            var t = e.ISOLATECONDITIONFILTER_OFFSET + A;
            e.ISOLATECONDITIONFILTER_OFFSET > t || t > e.ISOLATECONDITIONFILTER_ENDOFFSET || l[t].clear()
        }
        ,
        this.clearAllIsolateConditions = function() {
            var A = null;
            for (A = e.ISOLATECONDITIONFILTER_OFFSET; e.ISOLATECONDITIONFILTER_ENDOFFSET >= A; A += 1)
                l[A].clearAll()
        }
        ,
        this.setConditions = function(A, t) {
            var i = e.CONDITIONFILTER_OFFSET + A;
            e.CONDITIONFILTER_OFFSET > i || i > e.CONDITIONFILTER_ENDOFFSET || l[i].setByData(t)
        }
        ,
        this.getConditions = function(A) {
            var t = null
              , i = e.CONDITIONFILTER_OFFSET + A;
            return e.CONDITIONFILTER_OFFSET > i || i > e.CONDITIONFILTER_ENDOFFSET || (t = l[i].get()),
            t
        }
        ,
        this.clearConditions = function(A) {
            var t = e.CONDITIONFILTER_OFFSET + A;
            e.CONDITIONFILTER_OFFSET > t || t > e.CONDITIONFILTER_ENDOFFSET || l[t].clearAll()
        }
        ,
        this.clearAllConditions = function() {
            var A = null;
            for (A = e.CONDITIONFILTER_OFFSET; e.CONDITIONFILTER_ENDOFFSET >= A; A += 1)
                l[A].clear()
        }
        ,
        this.makeSceneTranslucent = function() {
            this.setSceneState(Vc.TRANSLUCENT)
        }
        ,
        this.cancelSceneTranslucent = function() {
            this.setSceneState(Vc.DISABLED)
        }
        ,
        this.hideScene = function() {
            this.setSceneState(Vc.HIDDEN)
        }
        ,
        this.showScene = function() {
            this.setSceneState(Vc.DISABLED)
        }
        ,
        this.setSceneState = function(A) {
            d = A
        }
        ,
        this.getSceneState = function() {
            return d
        }
        ,
        this.cancelTranslucent = function() {
            this.clearIdList(Dc.TRANSLUCENT),
            this.clearIdList(Dc.TRANSLUCENT_OTHERS)
        }
        ,
        this._addIdsToFilter = function(A, t) {
            var i = e.IDFILTER_OFFSET + A;
            e.IDFILTER_OFFSET > i || i > e.IDFILTER_ENDOFFSET || l[i].add(t)
        }
        ,
        this.hideByIds = function(A) {
            this._addIdsToFilter(Dc.HIDDEN, A)
        }
        ,
        this.showByIds = function(A) {
            this._addIdsToFilter(Dc.VISIBLE, A)
        }
        ,
        this.makeTranslucentByIds = function(A) {
            this._addIdsToFilter(Dc.TRANSLUCENT, A)
        }
        ,
        this.makeTranslucentOthersByIds = function(A) {
            this._addIdsToFilter(Dc.TRANSLUCENT_OTHERS, A)
        }
        ,
        this._isVisible = function(A) {
            return this.getSceneState() !== Vc.HIDDEN && t.apply(A)
        }
        ,
        this._isSelectable = function(A) {
            return this.getSceneState() !== Vc.TRANSLUCENT && n.apply(A, this.getSceneState())
        }
        ,
        this._isSelectableById = function(A) {
            return !h.get()[A]
        }
        ,
        this.getMaterialNameByColor = function(A) {
            return p.getMaterialNameByColor(A)
        }
        ,
        this.getMaterialNameByWireframe = function(A) {
            return p.getMaterialNameByWireframe(A)
        }
        ,
        this.addOverrideMaterial = function(A) {
            p.addOverrideMaterial(A)
        }
        ,
        this.updateOverrideMaterial = function(A) {
            p.updateOverrideMaterial(A)
        }
        ,
        this.getMaterialByName = function(A) {
            return p.get(A)
        }
        ,
        this._getOverrideMaterial = function(A) {
            if (this.getSceneState() === Vc.TRANSLUCENT)
                return p.get("scene");
            var t = i.getApplyFilterId(A)
              , o = null
              , n = "";
            switch (t) {
            case e.ISOLATE_TRANSLUCENT:
            case e.ISOLATE_TRANSLUCENT_OTHERS:
            case e.ISOLATE_CONDITION_TRANSLUCENT_OTHERS:
                o = this.getIsolateMaterial();
                break;
            case e.CONDITION_TRANSLUCENT_OTHERS:
            case e.TRANSLUCENT:
            case e.TRANSLUCENT_OTHERS:
                o = p.get("scene");
                break;
            case e.FROZENFILTER:
            case e.FROZENCONDITIONFILTER:
                break;
            case e.OVERRIDEFILTER:
            case e.USER_OVERRIDE:
            case e.CONDITION_OVERRIDE:
                var r = l[t].getMatchItem(A);
                n = r.hasOwnProperty("color") ? p.getMaterialNameByColor(r.color) : r.material ? r.material : r
            }
            return o || "" === n || (p.has(n) || (n = p.getDefaultMaterialName()),
            o = p.get(n)),
            o
        }
        ,
        this._getMaterialName = function(A) {
            if (this.getSceneState() === Vc.TRANSLUCENT)
                return "scene";
            var t = i.getApplyFilterId(A)
              , o = "";
            switch (t) {
            case e.ISOLATE_TRANSLUCENT:
            case e.ISOLATE_TRANSLUCENT_OTHERS:
            case e.ISOLATE_CONDITION_TRANSLUCENT_OTHERS:
                o = this.getIsolateMaterial().name;
                break;
            case e.CONDITION_TRANSLUCENT_OTHERS:
            case e.TRANSLUCENT:
            case e.TRANSLUCENT_OTHERS:
                o = "scene";
                break;
            case e.FROZENFILTER:
            case e.FROZENCONDITIONFILTER:
                break;
            case e.OVERRIDEFILTER:
            case e.USER_OVERRIDE:
            case e.CONDITION_OVERRIDE:
                var n = l[t].getMatchItem(A);
                o = n.hasOwnProperty("color") ? p.getMaterialNameByColor(n.color) : n.material ? n.material : n
            }
            return o
        }
        ,
        this._getMaterialByName = function(A) {
            return A instanceof qA ? A : "isolate" === A ? p.getIsolateMaterial() : "looming" === A || "scene" === A ? p.getFrozonMaterial() : "selected" === A ? p.getSelectedMaterial() : p.get(A)
        }
        ,
        this._hasHighPriorityOverrideMaterial = function(A) {
            return this.getSceneState() === Vc.TRANSLUCENT || o.apply(A)
        }
        ,
        this._hasOverrideMaterial = function(A) {
            return this.getSceneState() === Vc.TRANSLUCENT || o.apply(A) || i.apply(A)
        }
        ,
        this._isHiddenFileId = function(A) {
            return r.apply(A)
        }
        ,
        this._hasHiddenFileIdFilter = function() {
            return !r.isEmpty()
        }
        ,
        this._hasVisibleFilter = function() {
            return this.getSceneState() === Vc.HIDDEN || !t.isEmpty()
        }
        ,
        this._hasPickableFilter = function() {
            return this.getSceneState() === Vc.TRANSLUCENT || !n.isEmpty()
        }
        ,
        this._hasOverrideMaterialFilter = function() {
            return this.getSceneState() === Vc.TRANSLUCENT || !i.isEmpty()
        }
        ,
        this._hasLowPriorityOverride = function() {
            return i.hasFilterNotIn(o)
        }
        ,
        this._isRenderPromotion = function(A) {
            return a.apply(A)
        }
        ,
        this._hasRenderPromotionFilter = function() {
            return !a.isEmpty()
        }
        ,
        this._isRenderWithBoardline = function(A) {
            return s.apply(A)
        }
        ,
        this._hasRenderWithBoardlineFilter = function() {
            return !s.isEmpty()
        }
        ,
        this._getFilterObjectsKeys = function(A) {
            var e = l[A].get()
              , t = [];
            for (var i in e)
                t.push(i);
            return t
        }
    }
      , gu = function(A) {
        this.materialSelector = A;
        var e = function(A) {
            var e = [];
            for (var t in A)
                !0 === A[t] && e.push(t);
            return e
        };
        this.saveState = function(A) {
            var e = A.getIsolateFilterAction()
              , t = A.getModelIsolateFilterAction()
              , i = A.getFilterActionList()
              , o = {
                isolateAction: e,
                modelIsolateAction: t,
                modelActions: A.getModelFilterActionList(),
                actions: i,
                sceneState: A.getSceneState(),
                version: "1.0"
            };
            return JSON.stringify(o)
        }
        ,
        this.createAction = function(A) {
            var e = A.className
              , t = null;
            switch (e) {
            case "IsolateIdsFA":
                (t = new Hg(A.isolateHide)).ids = A.ids;
                break;
            case "VisibleIdsFA":
                (t = new Pg(A.flag,A.isVisible)).ids = A.ids;
                break;
            case "OverrideIdsFA":
                if (o = A.material) {
                    var i = this.materialSelector.getMaterialNameByColor({
                        opacity: A.material.opacity,
                        color: A.material.color
                    });
                    o = this.materialSelector.get(i)
                }
                (t = new qg(A.flag,o)).ids = A.ids;
                break;
            case "TransparentIdsFA":
                (t = new Yg(A.flag,A.isOpaque)).ids = A.ids;
                break;
            case "VisibleConditionFA":
                (t = new Jg(A.flag,A.isVisible)).conditions = A.conditions;
                break;
            case "OverrideConditionFA":
                var o;
                if (o = A.material) {
                    i = this.materialSelector.getMaterialNameByColor({
                        opacity: o.opacity,
                        color: o.color
                    });
                    o = this.materialSelector.get(i)
                }
                (t = new zg(A.flag,o)).conditions = A.conditions;
                break;
            case "TransparentConditionFA":
                (t = new Zg(A.flag,A.isOpaque)).conditions = A.conditions;
                break;
            case "IsolateConditionFA":
                (t = new Xg(A.isolateHide)).conditions = A.conditions;
                break;
            default:
                Bh.warn("Warning: Not supported filterAction '" + e + "'")
            }
            return t
        }
        ,
        this.createActionByOldFilter = function(A, t) {
            var i = [];
            switch (A) {
            case "CONDITION_OVERRIDE":
                for (var o = [], n = 0; t.length > n; n += 1) {
                    var r = t[n];
                    o.push(r.condition)
                }
                var a = this.materialSelector.add(p = r.color)
                  , s = this.materialSelector.get(a);
                (g = new zg(!0,s)).conditions = o,
                i.push(g);
                break;
            case "CONDITION_TRANSLUCENT_OTHERS":
                (g = new Zg(!1,!1)).conditions = t,
                i.push(g);
                break;
            case "ISOLATE_CONDITION_HIDEEN_OTHERS":
                (g = new Xg(!0)).conditions = t,
                i.push(g);
                break;
            case "ISOLATE_CONDITION_TRANSLUCENT_OTHERS":
                (g = new Xg(!1)).conditions = t,
                i.push(g);
                break;
            case "ISOLATE_HIDDEN_OTHERS":
                (g = new Hg(!0)).ids = e(t),
                i.push(g);
                break;
            case "ISOLATE_TRANSLUCENT_OTHERS":
                (g = new Hg(!1)).ids = e(t),
                i.push(g);
                break;
            case "OVERRIDEFILTER":
                for (var l in t)
                    if (t.hasOwnProperty(l)) {
                        var c = []
                          , h = t[l];
                        for (var d in h)
                            c.push(d);
                        var p = this.materialSelector.getMaterialParamsFromName(h[d]);
                        a = this.materialSelector.add(p),
                        s = this.materialSelector.get(a);
                        (g = new qg(!0,s)).ids = c,
                        i.push(g)
                    }
                break;
            case "TRANSLUCENT":
                (g = new Yg(!0,!1)).ids = e(t),
                i.push(g);
                break;
            case "TRANSLUCTANT_OTHERS":
                (g = new Yg(!1,!1)).ids = e(t),
                i.push(g);
                break;
            case "VISIBLE":
                var g;
                (g = new Pg(!0,!0)).ids = e(t),
                i.push(g);
                break;
            default:
                Bh.warn("Warning: Not supported filter '" + A + "'")
            }
            return i
        }
        ,
        this.loadState = function(A, e) {
            e.clearFilterActionList(),
            e.clearModelFilterActionList(),
            e.getObjectInfoManager().resetAll(),
            e.getModelInfoManager().resetAll();
            var t = JSON.parse(A);
            if (t.hasOwnProperty("version") && "1.0" === t.version) {
                var i = t.isolateAction;
                if (i) {
                    var o = this.createAction(i);
                    e.pushBack(o)
                }
                for (var n = t.actions, r = 0; n.length > r; r += 1) {
                    o = this.createAction(n[r]);
                    e.pushBack(o)
                }
                var a = t.modelIsolateAction;
                if (a) {
                    o = this.createAction(a);
                    e.pushModelBack(o)
                }
                for (var s = t.modelActions, l = 0; s.length > l; l += 1) {
                    o = this.createAction(s[l]);
                    e.pushModelBack(o)
                }
            }
            e.setSceneState(t.sceneState)
        }
    }
      , uu = function() {
        var A = {}
          , e = []
          , t = !1
          , i = !1
          , o = !1
          , n = !1
          , r = !1
          , a = new aA;
        this.init = function(A) {}
        ,
        this.clearData = function() {}
        ,
        this.getObjectsMap = function() {}
        ,
        this.add = function(t) {
            A[t] = {
                state: Lc.Visible,
                modelKey: t,
                material: null
            },
            e = Object.keys(A)
        }
        ,
        this.remove = function(t) {
            delete A[t],
            e = Object.keys(A)
        }
        ,
        this.calculateVisibleComponentsBbox = function() {}
        ,
        this.getVisibleComponentsBbox = function() {
            return a.isEmpty() && this.calculateVisibleComponentsBbox(),
            a
        }
        ,
        this.arrayToMap = function(A) {
            for (var e = {}, t = 0; A.length > t; t += 1) {
                var i = A[t];
                e[i] = i
            }
            return e
        }
        ,
        this.isMatchConditions = function(A, e) {
            for (var t = !0, i = 0, o = e.length; o > i; i += 1) {
                var n = e[i];
                for (var r in n) {
                    if (!Array.isArray(n[r]) && A[r] !== n[r]) {
                        t = !1;
                        break
                    }
                    if (Array.isArray(n[r]) && -1 === n[r].indexOf(A[r])) {
                        t = !1;
                        break
                    }
                }
                if (!0 === t)
                    break;
                e.length - 1 > i && (t = !0)
            }
            return t
        }
        ,
        this.matchConditions = function(A, e) {}
        ,
        this.setVisible = function(t, o, n) {
            var r = function(A) {
                o ? A.state = Lc.Visible : (i = !0,
                A.state &= ~Lc.Visible)
            };
            if (void 0 === n || !0 === n)
                for (var a = 0, s = t.length; s > a; a += 1)
                    A.hasOwnProperty(t[a]) && r(A[t[a]]);
            else
                for (var l = this.arrayToMap(t), c = 0, h = e.length; h > c; c += 1)
                    l.hasOwnProperty(e[c]) || r(A[e[c]])
        }
        ,
        this.isVisible = function(e) {
            if (A.hasOwnProperty(e))
                return A[e].state & Lc.Visible > 0
        }
        ,
        this.clearVisible = function() {
            for (var e in i = !1,
            A) {
                if (A.hasOwnProperty(e))
                    A[e].state = Lc.Visible
            }
        }
        ,
        this.hideAll = function() {
            for (var e in i = !0,
            A) {
                if (A.hasOwnProperty(e))
                    A[e].state &= ~Lc.Visible
            }
        }
        ,
        this.setTransparent = function(i, o, r) {
            var a = function(A) {
                o ? (A.state |= Lc.Transparent,
                t = !0,
                n = !0) : A.state &= ~Lc.Transparent
            };
            if (void 0 === r || !0 === r)
                for (var s = 0, l = i.length; l > s; s += 1)
                    A.hasOwnProperty(i[s]) && a(A[i[s]]);
            else
                for (var c = this.arrayToMap(i), h = 0, d = e.length; d > h; h += 1)
                    c.hasOwnProperty(e[h]) || a(A[e[h]])
        }
        ,
        this.isTransparent = function(e) {
            if (A.hasOwnProperty(e)) {
                var t = A[e]
                  , i = (t.state & Lc.Transparent) > 0;
                return i = i || (t.state & Lc.TransparentByIsolate) > 0
            }
        }
        ,
        this.clearTransparent = function() {
            for (var e in n = !1,
            A) {
                if (A.hasOwnProperty(e))
                    A[e].state &= ~Lc.Transparent
            }
        }
        ,
        this.setMaterial = function(i, o, n) {
            if (void 0 === n || !0 === n)
                for (var r = 0, a = i.length; a > r; r += 1) {
                    if (A.hasOwnProperty(i[r]))
                        A[i[r]].material = o,
                        t = !0
                }
            else
                for (var s = this.arrayToMap(i), l = 0, c = e.length; c > l; l += 1) {
                    if (!s.hasOwnProperty(e[l]))
                        A[e[l]].material = o,
                        t = !0
                }
        }
        ,
        this.getMaterial = function(e) {
            if (A.hasOwnProperty(e))
                return A[e].material
        }
        ,
        this.clearMaterial = function() {
            for (var e in A) {
                A[e].material = null
            }
        }
        ,
        this.setIsolateHide = function(t, i, n) {
            var r = function(A) {
                i ? (o = !0,
                A.state |= Lc.HideByIsolate) : A.state &= ~Lc.HideByIsolate
            };
            if (void 0 === n || !0 === n)
                for (var a = 0, s = t.length; s > a; a += 1)
                    A.hasOwnProperty(t[a]) && r(A[t[a]]);
            else
                for (var l = this.arrayToMap(t), c = 0, h = e.length; h > c; c += 1)
                    l.hasOwnProperty(e[c]) || r(A[e[c]])
        }
        ,
        this.isIsolateHide = function(e) {
            if (A.hasOwnProperty(e))
                return (A[e].state & Lc.HideByIsolate) > 0
        }
        ,
        this.setIsolateTransparent = function(i, o, n) {
            var a = function(A) {
                o ? (A.state |= Lc.TransparentByIsolate,
                t = !0,
                r = !0) : A.state &= ~Lc.TransparentByIsolate
            };
            if (void 0 === n || !0 === n)
                for (var s = 0, l = i.length; l > s; s += 1)
                    A.hasOwnProperty(i[s]) && a(A[i[s]]);
            else
                for (var c = this.arrayToMap(i), h = 0, d = e.length; d > h; h += 1)
                    c.hasOwnProperty(e[h]) || a(A[e[h]])
        }
        ,
        this.isIsolateTransparent = function(e) {
            if (A.hasOwnProperty(e))
                return (A[e].state & Lc.TransparentByIsolate) > 0
        }
        ,
        this.clearIsolateHide = function() {
            o = !1;
            var e = Object.keys(A);
            e.length > 0 && this.setIsolateHide(e, !1)
        }
        ,
        this.clearIsolates = function() {
            r = !1,
            o = !1;
            var e = Object.keys(A);
            e.length > 0 && (this.setIsolateHide(e, !1),
            this.setIsolateTransparent(e, !1))
        }
        ,
        this.clearTransparentByIsolate = function() {
            for (var e in r = !1,
            A) {
                if (A.hasOwnProperty(e))
                    A[e].state &= ~Lc.TransparentByIsolate
            }
        }
        ,
        this.isHidden = function(e) {
            if (A.hasOwnProperty(e)) {
                var t = A[e]
                  , i = 0 == (t.state & Lc.Visible);
                return i = i || (t.state & Lc.HideByIsolate) > 0
            }
        }
        ,
        this.isFrozen = function(e) {
            if (A.hasOwnProperty(e)) {
                var t = A[e]
                  , i = (t.state & Lc.Transparent) > 0;
                return i = i || (t.state & Lc.TransparentByIsolate) > 0
            }
        }
        ,
        this.resetAll = function() {
            for (var e in A)
                A.hasOwnProperty(e) && (A[e].state = Lc.Visible,
                A[e].material = null);
            t = !1,
            i = o = !1,
            n = r = !1
        }
        ,
        this.hasOverrideMaterial = function(e) {
            return void 0 === e ? t : A.hasOwnProperty(e) ? null !== A[e].material || this.isTransparent(e) : void 0
        }
        ,
        this.hasObjectHidden = function() {
            return i || o
        }
        ,
        this.hasObjectCantSelected = function() {
            return i || n || r
        }
        ,
        this.hasObjectTransparent = function() {
            return n || r
        }
    }
      , fu = function() {
        var A = {}
          , e = {};
        this.init = function(t) {
            for (var i in A = t)
                e.hasOwnProperty(i) && !uh.isEmptyObject(e[i]) || uh.isEmptyObject(A[i]) || (e[i] = Object.keys(A[i]))
        }
        ,
        this.reinit = function(t) {
            for (var i in e = {},
            A = t)
                e[i] = Object.keys(t[i])
        }
        ,
        this.clear = function() {
            A = {},
            e = {}
        }
        ,
        this.getObjectsMap = function() {
            return A
        }
        ,
        this.getObjectIds = function(A) {
            return e.hasOwnProperty(A) ? e[A] : []
        }
    }
      , mu = function() {
        var A = new fu
          , e = !1
          , t = !1
          , i = !1
          , o = !1
          , n = !1
          , r = !1
          , a = new aA
          , s = !1;
        this.inactivatedIdMap = {},
        this.inactivatedIds = [],
        this.bIsInactivateAll = !1,
        this.init = function(e) {
            A.init(e)
        }
        ,
        this.reinit = function(e) {
            A.reinit(e)
        }
        ,
        this.clearData = function() {
            A.clear()
        }
        ,
        this.getObjectsMap = function() {
            return A.getObjectsMap()
        }
        ,
        this.calculateVisibleComponentsBbox = function() {
            a.makeEmpty();
            var e = A.getObjectsMap();
            for (var t in e)
                for (var i = e[t], o = A.getObjectIds(t), n = null, r = 0, l = o.length; l > r; r += 1) {
                    var c = o[r];
                    if (!this.isHidden(c)) {
                        var h = i[c][0];
                        if (h.boundingBox) {
                            !n && h.model && (n = h.model.getModelMatrix());
                            var d = h.boundingBox.clone();
                            n && d.applyMatrix4(n),
                            d.isEmpty() || (a.expandByPoint(d.min),
                            a.expandByPoint(d.max))
                        }
                    }
                }
            s = !1
        }
        ,
        this.getVisibleComponentsBbox = function() {
            return (s || a.isEmpty()) && this.calculateVisibleComponentsBbox(),
            a
        }
        ,
        this.needUpdateBoxAfterExplode = function() {
            s = !0
        }
        ,
        this.arrayToMap = function(A) {
            for (var e = {}, t = 0; A.length > t; t += 1) {
                var i = A[t];
                e[i] = i
            }
            return e
        }
        ,
        this.isMatchConditions = function(A, e) {
            for (var t = !0, i = 0, o = e.length; o > i; i += 1) {
                var n = e[i];
                for (var r in n) {
                    if (!Array.isArray(n[r]) && A[r] !== n[r]) {
                        t = !1;
                        break
                    }
                    if (Array.isArray(n[r]) && -1 === n[r].indexOf(A[r])) {
                        t = !1;
                        break
                    }
                }
                if (!0 === t)
                    break;
                e.length - 1 > i && (t = !0)
            }
            return t
        }
        ,
        this.matchConditions = function(e, t) {
            var i = A.getObjectsMap();
            for (var o in i)
                for (var n = [], r = [], a = i[o], s = A.getObjectIds(o), l = 0, c = s.length; c > l; l += 1) {
                    var h = s[l]
                      , d = a[h][0].userData || {};
                    d.elementId = a[h][0].userId,
                    this.isMatchConditions(d, e) ? n.push(h) : r.push(h)
                }
            t && t(n, !0),
            t && t(r, !1)
        }
        ,
        this.getMatchIds = function(e) {
            var t = A.getObjectsMap()
              , i = [];
            for (var o in t)
                for (var n = t[o], r = A.getObjectIds(o), a = 0, s = r.length; s > a; a += 1) {
                    var l = r[a]
                      , c = n[l][0].userData || {};
                    c.elementId = n[l][0].userId,
                    !0 === this.isMatchConditions(c, e) && i.push(l)
                }
            return i
        }
        ,
        this.setVisible = function(e, t, o) {
            var n = function(A) {
                t ? A.state = Lc.Visible : (i = !0,
                A.state &= ~Lc.Visible)
            }
              , r = A.getObjectsMap();
            for (var a in r) {
                var s = r[a];
                if (void 0 === o || !0 === o)
                    for (var l = 0, c = e.length; c > l; l += 1) {
                        if (s.hasOwnProperty(f = e[l]) && this.isActive(f)) {
                            var h = s[f][0];
                            n(h)
                        }
                    }
                else {
                    for (var d = this.arrayToMap(e), p = A.getObjectIds(a), g = 0, u = p.length; u > g; g += 1) {
                        var f;
                        !d.hasOwnProperty(f = p[g]) && this.isActive(f) && n(h = s[f][0])
                    }
                    d = null
                }
            }
        }
        ,
        this.isVisible = function(e) {
            var t = A.getObjectsMap();
            for (var i in t) {
                var o = t[i];
                if (o.hasOwnProperty(e))
                    return o[e][0].state & Lc.Visible > 0
            }
        }
        ,
        this.clearVisible = function() {
            var e = A.getObjectsMap();
            for (var t in i = !1,
            this.inactivatedIds.length > 0 && (i = !0),
            e)
                for (var o = e[t], n = A.getObjectIds(t), r = 0, a = n.length; a > r; r += 1) {
                    var s = n[r]
                      , l = o[s][0];
                    this.isActive(s) && (l.state = Lc.Visible)
                }
        }
        ,
        this.hideAll = function() {
            var e = A.getObjectsMap();
            for (var t in i = !0,
            e)
                for (var o = e[t], n = A.getObjectIds(t), r = 0, a = n.length; a > r; r += 1) {
                    o[n[r]][0].state &= ~Lc.Visible
                }
        }
        ,
        this.setTransparent = function(t, i, o) {
            var r = function(A) {
                i ? (A.state |= Lc.Transparent,
                e = !0,
                n = !0) : A.state &= ~Lc.Transparent
            }
              , a = A.getObjectsMap();
            for (var s in a) {
                var l = a[s];
                if (void 0 === o || !0 === o)
                    for (var c = 0, h = t.length; h > c; c += 1) {
                        if (this.isActive(m = t[c]) && l.hasOwnProperty(m)) {
                            var d = l[m][0];
                            r(d)
                        }
                    }
                else {
                    for (var p = this.arrayToMap(t), g = A.getObjectIds(s), u = 0, f = g.length; f > u; u += 1) {
                        var m;
                        this.isActive(m = g[u]) && !p.hasOwnProperty(m) && r(d = l[m][0])
                    }
                    p = null
                }
            }
        }
        ,
        this.isTransparent = function(e) {
            var t = A.getObjectsMap();
            for (var i in t) {
                var o = t[i];
                if (o.hasOwnProperty(e) && this.isActive(e)) {
                    var n = o[e][0]
                      , r = (n.state & Lc.Transparent) > 0;
                    return r = r || (n.state & Lc.TransparentByIsolate) > 0
                }
            }
        }
        ,
        this.clearTransparent = function() {
            var e = A.getObjectsMap();
            for (var t in n = !1,
            e)
                for (var i = e[t], o = A.getObjectIds(t), r = 0, a = o.length; a > r; r += 1) {
                    var s = o[r];
                    if (this.isActive(s))
                        i[s][0].state &= ~Lc.Transparent
                }
        }
        ,
        this.setMaterial = function(t, i, o) {
            var n = A.getObjectsMap();
            for (var r in n) {
                var a = n[r];
                if (void 0 === o || !0 === o)
                    for (var s = 0, l = t.length; l > s; s += 1) {
                        if (this.isActive(u = t[s]) && a.hasOwnProperty(u)) {
                            var c = a[u][0];
                            c.material = i,
                            e = !0
                        }
                    }
                else {
                    for (var h = this.arrayToMap(t), d = A.getObjectIds(r), p = 0, g = d.length; g > p; p += 1) {
                        var u;
                        this.isActive(u = d[p]) && !h.hasOwnProperty(u) && ((c = a[u][0]).material = i,
                        e = !0)
                    }
                    h = null
                }
            }
        }
        ,
        this.getMaterial = function(e) {
            var t = A.getObjectsMap();
            for (var i in t) {
                var o = t[i];
                if (o.hasOwnProperty(e))
                    return o[e][0].material
            }
        }
        ,
        this.clearMaterial = function() {
            var e = A.getObjectsMap();
            for (var t in e) {
                var i = e[t];
                for (var o in i)
                    this.isActive(o) && (i[o][0].material = null)
            }
        }
        ,
        this.setWireFrameMaterial = function(e, i, o) {
            var n = A.getObjectsMap();
            for (var r in n) {
                var a = n[r];
                if (void 0 === o || !0 === o)
                    for (var s = 0, l = e.length; l > s; s += 1) {
                        if (a.hasOwnProperty(u = e[s])) {
                            var c = a[u][0];
                            c.wireFrameMaterial = i,
                            t = !0
                        }
                    }
                else {
                    for (var h = this.arrayToMap(e), d = A.getObjectIds(r), p = 0, g = d.length; g > p; p += 1) {
                        var u;
                        h.hasOwnProperty(u = d[p]) || ((c = a[u][0]).wireFrameMaterial = i,
                        t = !0)
                    }
                    h = null
                }
            }
        }
        ,
        this.getWireFrameMaterial = function(e) {
            var t = A.getObjectsMap();
            for (var i in t) {
                var o = t[i];
                if (o.hasOwnProperty(e))
                    return o[e][0].wireFrameMaterial
            }
        }
        ,
        this.clearWireFrameMaterial = function() {
            var e = A.getObjectsMap();
            for (var t in e) {
                var i = e[t];
                for (var o in i)
                    i[o][0].wireFrameMaterial = null
            }
        }
        ,
        this.clearMaterialByKey = function(e) {
            var t = A.getObjectsMap();
            for (var i in t) {
                var o = t[i];
                for (var n in o)
                    -1 !== e.indexOf(n) && (o[n][0].material = null)
            }
        }
        ,
        this.setIsolateHide = function(e, t, i) {
            var n = function(A) {
                t ? (o = !0,
                A.state |= Lc.HideByIsolate) : A.state &= ~Lc.HideByIsolate
            }
              , r = A.getObjectsMap();
            for (var a in r) {
                var s = r[a];
                if (void 0 === i || !0 === i)
                    for (var l = 0, c = e.length; c > l; l += 1) {
                        if (this.isActive(f = e[l]) && s.hasOwnProperty(f)) {
                            var h = s[f][0];
                            n(h)
                        }
                    }
                else {
                    for (var d = this.arrayToMap(e), p = A.getObjectIds(a), g = 0, u = p.length; u > g; g += 1) {
                        var f;
                        this.isActive(f = p[g]) && !d.hasOwnProperty(f) && n(h = s[f][0])
                    }
                    d = null
                }
            }
        }
        ,
        this.isIsolateHide = function(e) {
            var t = A.getObjectsMap();
            for (var i in t) {
                var o = t[i];
                if (o.hasOwnProperty(e))
                    return (o[e][0].state & Lc.HideByIsolate) > 0
            }
        }
        ,
        this.setIsolateTransparent = function(t, i, o) {
            var n = function(A) {
                i ? (A.state |= Lc.TransparentByIsolate,
                e = !0,
                r = !0) : A.state &= ~Lc.TransparentByIsolate
            }
              , a = A.getObjectsMap();
            for (var s in a) {
                var l = a[s];
                if (void 0 === o || !0 === o)
                    for (var c = 0, h = t.length; h > c; c += 1) {
                        if (l.hasOwnProperty(m = t[c])) {
                            var d = l[m][0];
                            n(d)
                        }
                    }
                else {
                    for (var p = this.arrayToMap(t), g = A.getObjectIds(s), u = 0, f = g.length; f > u; u += 1) {
                        var m;
                        !p.hasOwnProperty(m = g[u]) && this.isActive(m) && n(d = l[m][0])
                    }
                    p = null
                }
            }
        }
        ,
        this.isIsolateTransparent = function(e) {
            var t = A.getObjectsMap();
            for (var i in t) {
                var o = t[i];
                if (o.hasOwnProperty(e) && this.isActive(e))
                    return (o[e][0].state & Lc.TransparentByIsolate) > 0
            }
        }
        ,
        this.clearIsolateHide = function() {
            var e = A.getObjectsMap();
            for (var t in o = !1,
            e) {
                var i = A.getObjectIds(t);
                i.length > 0 && this.setIsolateHide(i, !1)
            }
        }
        ,
        this.clearIsolates = function() {
            var e = A.getObjectsMap();
            for (var t in r = !1,
            o = !1,
            e) {
                var i = A.getObjectIds(t);
                i.length > 0 && (this.setIsolateHide(i, !1),
                this.setIsolateTransparent(i, !1))
            }
        }
        ,
        this.clearTransparentByIsolate = function() {
            var e = A.getObjectsMap();
            for (var t in r = !1,
            e)
                for (var i = e[t], o = A.getObjectIds(t), n = 0, a = o.length; a > n; n += 1) {
                    var s = o[n];
                    if (this.isActive(s))
                        i[s][0].state &= ~Lc.TransparentByIsolate
                }
        }
        ,
        this.isHidden = function(e) {
            var t = A.getObjectsMap();
            for (var i in t) {
                var o = t[i];
                if (o.hasOwnProperty(e)) {
                    var n = o[e][0]
                      , r = 0 == (n.state & Lc.Visible);
                    return r = r || (n.state & Lc.HideByIsolate) > 0
                }
            }
        }
        ,
        this.isFrozen = function(e) {
            var t = A.getObjectsMap();
            for (var i in t) {
                var o = t[i];
                if (o.hasOwnProperty(e)) {
                    var n = o[e][0]
                      , r = (n.state & Lc.Transparent) > 0;
                    return r = r || (n.state & Lc.TransparentByIsolate) > 0
                }
            }
        }
        ,
        this.resetAll = function() {
            var t = A.getObjectsMap();
            for (var a in t)
                for (var s = t[a], l = A.getObjectIds(a), c = 0, h = l.length; h > c; c += 1) {
                    var d = l[c];
                    s[d][0].state = Lc.Visible,
                    this.isActive(d) && (s[d][0].material = null)
                }
            e = !1,
            i = o = !1,
            n = r = !1,
            this.inactivatedIds.length > 0 && (i = !0)
        }
        ,
        this.hasOverrideMaterial = function(t) {
            var i = A.getObjectsMap();
            if (void 0 === t)
                return e;
            for (var o in i) {
                var n = i[o];
                if (n.hasOwnProperty(t))
                    return null !== n[t][0].material || this.isTransparent(t)
            }
        }
        ,
        this.hasOverrideMaterialForWireFrame = function(e) {
            var i = A.getObjectsMap();
            if (null == e)
                return t;
            for (var o in i) {
                var n = i[o];
                if (n.hasOwnProperty(e))
                    return null !== n[e][0].wireFrameMaterial
            }
        }
        ,
        this.hasObjectInactivated = function() {
            return this.inactivatedIds.length > 0
        }
        ,
        this.hasObjectHidden = function() {
            return i || o
        }
        ,
        this.hasObjectCantSelected = function() {
            return this.hasObjectHidden() || this.hasObjectTransparent() || this.hasObjectInactivated()
        }
        ,
        this.hasObjectTransparent = function() {
            if (this.hasObjectInactivated()) {
                var A = !1
                  , e = !0
                  , t = !1
                  , i = void 0;
                try {
                    for (var o, a = this.inactivatedIds[Symbol.iterator](); !(e = (o = a.next()).done); e = !0) {
                        if (this.isTransparent(o.value)) {
                            A = !0;
                            break
                        }
                    }
                } catch (A) {
                    t = !0,
                    i = A
                } finally {
                    try {
                        !e && a.return && a.return()
                    } finally {
                        if (t)
                            throw i
                    }
                }
                return A
            }
            return n || r
        }
        ,
        this.deactivateByIds = function(e) {
            var t = !0
              , o = !1
              , n = void 0
              , r = A.getObjectsMap();
            try {
                for (var a, s = e[Symbol.iterator](); !(t = (a = s.next()).done); t = !0) {
                    var l = a.value;
                    for (var c in r) {
                        var h = r[c];
                        if (h.hasOwnProperty(l))
                            h[l][0].state &= ~Lc.Visible
                    }
                    this.inactivatedIdMap[l] = !0
                }
            } catch (A) {
                o = !0,
                n = A
            } finally {
                try {
                    !t && s.return && s.return()
                } finally {
                    if (o)
                        throw n
                }
            }
            i = !0,
            this.inactivatedIds = Object.keys(this.inactivatedIdMap)
        }
        ,
        this.activateByIds = function(e) {
            for (var t = A.getObjectsMap(), o = 0, n = e.length; n > o; o += 1) {
                var r = e[o];
                for (var a in delete this.inactivatedIdMap[r],
                t) {
                    var s = t[a];
                    if (s.hasOwnProperty(r))
                        s[r][0].state = Lc.Visible
                }
            }
            this.inactivatedIds = Object.keys(this.inactivatedIdMap),
            this.inactivatedIds.length > 0 && (i = !0)
        }
        ,
        this.clearInactivatedIdMap = function() {
            this.inactivatedIdMap = {},
            this.inactivatedIds = []
        }
        ,
        this.isActive = function(A) {
            return !1 === this.bIsInactivateAll && !(!0 === this.inactivatedIdMap[A])
        }
        ,
        this.deactivateAll = function() {
            this.bIsInactivateAll = !0
        }
        ,
        this.activateAll = function() {
            this.bIsInactivateAll = !1
        }
        ,
        this.getInactivatedIdMap = function() {
            return this.inactivatedIdMap
        }
    }
      , Cu = function(A, e) {
        Wg.call(this),
        this.className = "OverrideConditionForWireFrameFA",
        this.flag = A,
        this.material = e
    };
    (Cu.prototype = Object.create(Wg.prototype)).constructor = Cu,
    Cu.prototype.applyFilter = function(A, e) {
        var t = this;
        this.conditions instanceof Array ? A.matchConditions(this.conditions, (function(e, i) {
            t.flag === i && (A.setWireFrameMaterial(e, t.material),
            e = null)
        }
        )) : Bh.warn("Conditions should be type of array.")
    }
    ;
    var yu = function(A, e) {
        Gg.call(this),
        this.className = "OverrideIdsForWireFrameFA",
        this.flag = A,
        this.material = e
    };
    (yu.prototype = Object.create(Gg.prototype)).constructor = yu,
    yu.prototype.applyFilter = function(A) {
        this.ids instanceof Array ? A.setWireFrameMaterial(this.ids, this.material, this.flag) : Bh.warn("Ids should be type of array.")
    }
    ;
    var vu = function() {
        function A(e, t) {
            cc(this, A),
            this.id = e,
            this.object = t
        }
        return dc(A, [{
            key: "destroy",
            value: function() {
                this.object = null
            }
        }, {
            key: "_inDistanceRange",
            value: function(A, e) {
                return A >= e.near && e.far >= A
            }
        }, {
            key: "raycast",
            value: function(A, e, t, i, o) {}
        }]),
        A
    }();
    vu.prototype.destroy = function() {}
    ;
    var Iu = function(A) {
        function e(A, t) {
            return cc(this, e),
            Cc(this, fc(e).call(this, A, t))
        }
        return uc(e, A),
        dc(e, [{
            key: "raycast",
            value: function(A, e, t, i, o, n) {
                var r = [];
                if (this.object.raycast(A, r),
                r.length > 0) {
                    r.sort((function(A, e) {
                        return A.distance - e.distance
                    }
                    ));
                    for (var a = 0, s = r.length; s > a; a += 1) {
                        var l = r[a];
                        if (this._inDistanceRange(l.distance, t) && !i.clipPoint(l.point)) {
                            n || (t.far = l.distance - uh.MinusEpsilon),
                            o.push(l);
                            break
                        }
                    }
                }
            }
        }]),
        e
    }(vu)
      , Eu = function(A) {
        function e(A, t) {
            return cc(this, e),
            Cc(this, fc(e).call(this, A, t))
        }
        return uc(e, A),
        dc(e, [{
            key: "raycast",
            value: function(A, e, t, i, o, n) {
                var r = this.object
                  , a = r._indicesGroup;
                if (a) {
                    var s = a[e.userId];
                    if (s) {
                        for (var l, c = !1, h = 0, d = s.length; d > h; h += 1)
                            if (s[h].nodeId === e.nodeId) {
                                l = s[h],
                                c = !0;
                                break
                            }
                        if (c) {
                            var p = [];
                            if (r.raycastByIndices(A, p, l),
                            p.length > 0) {
                                p.sort((function(A, e) {
                                    return A.distance - e.distance
                                }
                                ));
                                for (var g = 0, u = p.length; u > g; g += 1) {
                                    var f = p[g];
                                    if (this._inDistanceRange(f.distance, t) && !i.clipPoint(f.point)) {
                                        n || (t.far = f.distance - uh.MinusEpsilon),
                                        f.userId = l.userId,
                                        f.indexInfo = l,
                                        o.push(f);
                                        break
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }]),
        e
    }(vu)
      , Bu = function(A) {
        function e(A, t) {
            return cc(this, e),
            Cc(this, fc(e).call(this, A, t))
        }
        return uc(e, A),
        dc(e, [{
            key: "raycast",
            value: function(A, e, t, i, o, n) {
                var r = [];
                if (this.object.raycastByIndices(A, r, null, e.matrix),
                r.length > 0) {
                    r.sort((function(A, e) {
                        return A.distance - e.distance
                    }
                    ));
                    for (var a = 0, s = r.length; s > a; a += 1) {
                        var l = r[a];
                        if (this._inDistanceRange(l.distance, t) && !i.clipPoint(l.point)) {
                            n || (t.far = l.distance - uh.MinusEpsilon),
                            l.userId = e.userId,
                            l.matrix = e.matrix,
                            o.push(l);
                            break
                        }
                    }
                }
            }
        }]),
        e
    }(vu)
      , xu = function() {
        this._filterImpl = new pu;
        var A = []
          , e = []
          , t = null
          , i = null
          , o = this._filterImpl.getMaterialSelector()
          , n = new mu
          , r = new uu
          , a = new gu(o);
        this.observerForSceneState = null,
        this.setObserverForSceneState = function(A) {
            this.observerForSceneState = A
        }
        ,
        this.setSceneStateHelper = function(A) {}
        ,
        this.getFilterActionList = function() {
            return A
        }
        ,
        this.getModelFilterActionList = function() {
            return e
        }
        ,
        this.addModel = function(A) {
            r.add(A)
        }
        ,
        this.removeModel = function(A) {
            r.remove(A)
        }
        ,
        this.clearFilterActionList = function() {
            A = []
        }
        ,
        this.clearModelFilterActionList = function() {
            e = []
        }
        ,
        this.initFilterManager = function(A) {
            n.init(A)
        }
        ,
        this.reinitFilterManager = function(A) {
            n.reinit(A)
        }
        ,
        this.clearFilterManager = function() {
            n.clearData()
        }
        ;
        var s = !1;
        this.isStateChanged = function() {
            return s
        }
        ,
        this.enableStateChanged = function() {
            s = !0
        }
        ,
        this.disableStateChanged = function() {
            s = !1
        }
        ,
        this.getIsolateFilterAction = function() {
            return t
        }
        ,
        this.getModelIsolateFilterAction = function() {
            return i
        }
        ,
        this.setIsolateAction = function(A) {
            (t = A).apply()
        }
        ,
        this.getVisibleComponentsBbox = function() {
            return n.getVisibleComponentsBbox()
        }
        ,
        this.pushBack = function(e) {
            var i = e.getClassName();
            "IsolateIdsFA" === i || "IsolateConditionFA" === i ? t = e : A.push(e),
            s = !0,
            e.applyFilter(n)
        }
        ,
        this.pushModelBack = function(A) {
            var t = A.getClassName();
            "IsolateIdsFA" === t || "IsolateConditionFA" === t ? i = A : e.push(A),
            s = !0,
            A.applyFilter(r)
        }
        ;
        var l = function(e) {
            for (var t = [], i = 0; A.length > i; ) {
                var o = A[i];
                e === o.getClassName() ? (t = t.concat(o.ids),
                A.splice(i, 1)) : i += 1
            }
            return t
        }
          , c = function(A) {
            for (var t = 0; e.length > t; ) {
                A === e[t].getClassName() ? e.splice(t, 1) : t += 1
            }
        };
        function h(A, e) {
            var t = e || "";
            return A.map((function(A) {
                var e = A.clone();
                for (var i in e.name += "_" + t,
                A)
                    A.hasOwnProperty(i) && (A[i]instanceof d || A[i]instanceof ut) && (e[i] = A[i].clone(),
                    e[i].needsUpdate = !0);
                return e
            }
            ))
        }
        function p(A, e, t, i, o, n, r) {
            var a = Boolean(r || 0 === r)
              , s = [];
            a && !Array.isArray(r) && (r = [r]);
            var l = !0
              , c = !1
              , h = void 0;
            try {
                for (var d, p = o[Symbol.iterator](); !(l = (d = p.next()).done); l = !0) {
                    var g = d.value;
                    A._filterImpl.getMaterialByName(g.name) || A._filterImpl.addOverrideMaterial(g)
                }
            } catch (A) {
                c = !0,
                h = A
            } finally {
                try {
                    l || null == p.return || p.return()
                } finally {
                    if (c)
                        throw h
                }
            }
            var u = t[0]
              , f = u.materialId;
            if (u.originMId === f && (u.originMId = [].concat(f)),
            null === u.material)
                for (var m = 0, C = f.length; C > m; m += 1)
                    s[m] = e.models[u.model.modelKey].materialManager.getMaterialById(f[m]);
            else
                s = u.material;
            for (var y = null, v = null, I = 0, E = s.length; E > I; I += 1) {
                if (a) {
                    if (!r[I])
                        break;
                    y = r[I].compMatOrder,
                    v = r[I].replMatOrder
                } else
                    y = v = I;
                if (!o[v] || y >= o.length) {
                    o[v] ? console.log('构件材质数组越界,越界位置:{"componentKey":'.concat(i, ',"order":').concat(y, "}")) : console.log('替换材质数组越界,越界位置:{"componentKey":'.concat(i, ',"order":').concat(v, "}"));
                    break
                }
                s[y] = o[v],
                f[y] = o[v].name
            }
            var B = new qg(!0,s);
            B.ids = [u.componentKey],
            n[u.componentKey] = s,
            A.pushBack(B)
        }
        function g(A, e, t, i, o, n, r) {
            var a, s = [];
            (a = Boolean(r || 0 === r)) && !Array.isArray(r) && (r = [r]);
            var l = !0
              , c = !1
              , h = void 0;
            try {
                for (var d, p = o[Symbol.iterator](); !(l = (d = p.next()).done); l = !0) {
                    A._filterImpl.updateOverrideMaterial(d.value)
                }
            } catch (A) {
                c = !0,
                h = A
            } finally {
                try {
                    l || null == p.return || p.return()
                } finally {
                    if (c)
                        throw h
                }
            }
            for (var g = 0, u = t.length; u > g; g += 1) {
                var f = t[g]
                  , m = t[0].material;
                if (null === m)
                    s[g] = e.models[f.model.modelKey].materialManager.getMaterialById(f.materialId),
                    s[g].materialId = f.materialId;
                else if (Array.isArray(m)) {
                    s[g] = m[g]
                } else
                    s[g] = m
            }
            for (var C = null, y = null, v = 0, I = s.length; I > v; v += 1) {
                if (a) {
                    if (!r[v])
                        break;
                    C = r[v].compMatOrder,
                    y = r[v].replMatOrder
                } else
                    C = y = v;
                if (!o[y] || C >= t.length) {
                    o[y] ? console.log('构件材质数组越界,越界位置:{"componentKey":'.concat(i, ',"order":').concat(C, "}")) : console.log('替换材质数组越界,越界位置:{"componentKey":'.concat(i, ',"order":').concat(y, "}"));
                    break
                }
                var E = t[C].nodeId
                  , B = s[C].mapNodeIdToOrigMatId && s[C].mapNodeIdToOrigMatId[E] ? s[C].mapNodeIdToOrigMatId[E] : s[C].materialId;
                t[C].mesh.geometry.getAttribute("uv") || null === o[y].map && null === o[y].aoMap ? (s[C] = o[y],
                s[C].mapNodeIdToOrigMatId || (s[C].mapNodeIdToOrigMatId = {}),
                s[C].materialId = o[y].name,
                s[C].mapNodeIdToOrigMatId[E] = B) : console.log('构件node缺少uv:{"componentKey":'.concat(i, ',"order":').concat(y, ",nodeId：").concat(t[C].nodeId, "}"))
            }
            var x = new qg(!0,s);
            x.ids = [i],
            n && (n[i] = s),
            A.pushBack(x)
        }
        function u(A, e, t) {
            var i = A.models[e]
              , o = i._handler.defaultManager.meshManager
              , n = i._handler.instancedManager.meshManager
              , r = i.loader.getDescriptor()
              , a = n.getNodeIdxMapByUserId(t)
              , s = i.group.children.find((function(A) {
                return "Geometry" === A.name
            }
            ));
            s || ((s = new Xi).name = "Geometry",
            i.group.add(s));
            var l = new Xi
              , c = [];
            s.add(l);
            var h = r.mapNodeInfoByComponentKey[t]
              , d = function(r) {
                var s = a[r][0]
                  , d = n.getInstanceGeometries(r);
                d[0].attributes.vState.array[s] = -1,
                d[0].attributes.vState.needsUpdate = !0;
                var p = new he;
                d[0].removed || (d[0].removed = {}),
                d[0].removed[s] = !0;
                for (var g = d[0].attributes.position.array, u = [], f = new y, m = n.matrixInfoMapFromUserId[t][r][0].matrix, C = 0, v = g.length; v > C; C += 3)
                    f.set(g[C], g[C + 1], g[C + 2]).applyMatrix4(m),
                    u.push(f.x, f.y, f.z);
                d[0].attributes.uv && p.setAttribute("uv", d[0].attributes.uv.clone()),
                d[0].attributes.normal && p.setAttribute("normal", d[0].attributes.normal.clone());
                var I = d[0].index.clone();
                p.setAttribute("position", new YA(new Float32Array(u),3)),
                p.setIndex(I);
                var E = n.getMaterialIdByMeshId(r)
                  , B = n.manager.model.materialManager.getInstanceMaterialById(E)[0]
                  , x = Kd.getMaterialParameters(B)
                  , S = Kd.createStandardMaterial(x)
                  , w = new Ue(p,S)
                  , M = r.split("&")[1]
                  , b = E + "_" + s + "_cm"
                  , U = ""
                  , F = !0
                  , K = !1
                  , Q = void 0;
                try {
                    for (var R, T = h[Symbol.iterator](); !(F = (R = T.next()).done); F = !0) {
                        var k = R.value;
                        k.geometryId !== M && k.geometryId.toString() !== M || (U = k.nodeId,
                        k.instanceOrNot = !1,
                        k.isBatched = !1,
                        k.mesh = w,
                        k.instancedRenderOrder = s,
                        k.RenderTypeChange = !0,
                        k.materialId = b,
                        k.uv = !0,
                        c.push(k))
                    }
                } catch (A) {
                    K = !0,
                    Q = A
                } finally {
                    try {
                        F || null == T.return || T.return()
                    } finally {
                        if (K)
                            throw Q
                    }
                }
                var D = b + "&1&meshes";
                l.add(w),
                w.geometry.computeBoundingBox(),
                w.modelKey = e;
                var L = pc({}, t, [{
                    boundingBox: w.geometry.boundingBox,
                    indexCount: I.count,
                    indexStart: 0,
                    lightmapIdx: void 0,
                    nodeId: U,
                    positionCount: p.attributes.position.count,
                    positionStart: 0,
                    userId: t
                }]);
                o.mapMaterialIdToMergedNode[D] = [{
                    geometry: p,
                    indices: L,
                    mesh: w,
                    RenderTypeChange: !0
                }],
                w._indicesGroup = L,
                w.computeBoundingBox = function() {
                    var A = this.matrixWorld
                      , e = new aA;
                    return e.copy(this.geometry.boundingBox),
                    e.applyMatrix4(A),
                    e
                }
                ,
                w.intersectBoxWithDistanceByIndices = function(A) {
                    return A.ray.intersectBoxWithDistance(this.computeBoundingBox())
                }
                ,
                w.raycastByIndices = function(A, e) {
                    w.raycast(A, e)
                }
                ,
                i.materialManager.materials[b] = S,
                A.addMeshToOctantMap(e, D, new Eu(D,w))
            };
            for (var p in a)
                d(p);
            return A.octantToObjectMap[e].info[t] = c,
            r.mapNodeInfoByCategory[1] || (r.mapNodeInfoByCategory[1] = {}),
            r.mapNodeInfoByCategory[1][t] = c,
            delete r.instancedComponent[t],
            delete r.mapNodeInfoByCategory[0][t],
            delete n.nodeIdxMapFromUserId[t],
            o.getPickingNodeGenerator().clearData(),
            l
        }
        this.showAll = function() {
            l("VisibleIdsFA"),
            l("VisibleConditionFA"),
            n.clearVisible(),
            n.calculateVisibleComponentsBbox(),
            this.enableStateChanged()
        }
        ,
        this.showAllModel = function() {
            c("VisibleIdsFA"),
            r.clearVisible(),
            this.enableStateChanged()
        }
        ,
        this.hideAll = function() {
            var A = new Pg(!1,!1);
            A.ids = [],
            this.pushBack(A)
        }
        ,
        this.hideAllModel = function() {
            var A = new Pg(!1,!1);
            A.ids = [],
            this.pushModelBack(A)
        }
        ,
        this.getObjectInfoManager = function() {
            return n
        }
        ,
        this.getModelInfoManager = function() {
            return r
        }
        ,
        this.getMatchIds = function(A) {
            return n.getMatchIds(A)
        }
        ,
        this._isVisible = function(A) {
            return !n.isHidden(A.userId)
        }
        ,
        this._isModelVisible = function(A) {
            return !r.isHidden(A)
        }
        ,
        this._isTransparent = function(A) {
            return n.isTransparent(A.userId)
        }
        ,
        this._isModelTransparent = function(A) {
            return r.isTransparent(A)
        }
        ,
        this._isModelPickable = function(A) {
            return !r.isFrozen(A) || vc.EnableSelectionByTranslucent
        }
        ,
        this._isSelectable = function(A) {
            if (vc.EnableSelectionByTranslucent)
                return !0;
            var e = A.userId;
            return !n.isFrozen(e) && this._filterImpl._isSelectableById(e)
        }
        ,
        this._isPickable = function(A) {
            var e = A.userId;
            return this.isComponentActive(e) && this._filterImpl._isSelectableById(e) && (!n.isFrozen(e) || vc.EnableSelectionByTranslucent)
        }
        ,
        this._isSelectableById = function(A) {
            return !!vc.EnableSelectionByTranslucent || !n.isFrozen(A) && this._filterImpl._isSelectableById(A)
        }
        ,
        this._getOverrideMaterial = function(A) {
            var e = A.userId;
            return n.isFrozen(e) ? this._filterImpl.getFrozonMaterial() : n.getMaterial(e)
        }
        ,
        this._getModelOverrideMaterial = function(A) {
            return r.isFrozen(A) ? this._filterImpl.getFrozonMaterial() : r.getMaterial(A)
        }
        ,
        this._getMaterialName = function(A) {
            return this._filterImpl._getMaterialName(A)
        }
        ,
        this._getMaterialByName = function(A) {
            return this._filterImpl._getMaterialByName(A)
        }
        ,
        this._hasOverrideMaterial = function(A) {
            return n.hasOverrideMaterial(A.userId)
        }
        ,
        this._hasModelOverrideMaterial = function(A) {
            return r.hasOverrideMaterial(A)
        }
        ,
        this._hasHighPriorityOverrideMaterial = function(A) {
            return this._filterImpl._hasHighPriorityOverrideMaterial(A)
        }
        ,
        this._isHiddenFileId = function(A) {
            return this._filterImpl._isHiddenFileId(A)
        }
        ,
        this._isRenderPromotion = function(A) {
            return this._filterImpl._isRenderPromotion(A)
        }
        ,
        this._isRenderWithBoardline = function(A) {
            return this._filterImpl._isRenderWithBoardline(A)
        }
        ,
        this._hasHiddenFileIdFilter = function() {
            return this._filterImpl._hasHiddenFileIdFilter()
        }
        ,
        this._hasVisibleFilter = function() {
            return n.hasObjectHidden()
        }
        ,
        this._hasPickableFilter = function() {
            return n.hasObjectCantSelected() || this._filterImpl._hasPickableFilter()
        }
        ,
        this._hasTransparentFilter = function() {
            return n.hasObjectTransparent()
        }
        ,
        this._hasOverrideMaterialFilter = function() {
            return n.hasOverrideMaterial()
        }
        ,
        this._hasModelVisibleFilter = function() {
            return r.hasObjectHidden()
        }
        ,
        this._hasModelSelectableFilter = function() {
            return r.hasObjectCantSelected()
        }
        ,
        this._hasModelTransparentFilter = function() {
            return r.hasObjectTransparent()
        }
        ,
        this._hasModelOverrideMaterialFilter = function() {
            return r.hasOverrideMaterial()
        }
        ,
        this._hasLowPriorityOverride = function() {
            return this._filterImpl._hasLowPriorityOverride()
        }
        ,
        this._hasRenderPromotionFilter = function() {
            return this._filterImpl._hasRenderPromotionFilter()
        }
        ,
        this._hasRenderWithBoardlineFilter = function() {
            return this._filterImpl._hasRenderWithBoardlineFilter()
        }
        ,
        this.saveState = function() {
            return a.saveState(this)
        }
        ,
        this.loadState = function(A) {
            a.loadState(A, this)
        }
        ,
        this.clear = function() {
            n.resetAll(),
            s = !0
        }
        ,
        this.clearAll = function() {
            return this.enableStateChanged(),
            this._filterImpl.clearAll()
        }
        ,
        this.clearIsolate = function() {
            n.clearIsolates()
        }
        ,
        this.clearFrozenList = function() {
            return this.enableStateChanged(),
            this._filterImpl.clearFrozenList()
        }
        ,
        this.addToFrozenList = function(A) {
            return this.enableStateChanged(),
            this._filterImpl.addToFrozenList(A)
        }
        ,
        this.removeFromFrozenList = function(A) {
            return this.enableStateChanged(),
            this._filterImpl.removeFromFrozenList(A)
        }
        ,
        this.setFrozenList = function(A) {
            return this.enableStateChanged(),
            this._filterImpl.setFrozenList(A)
        }
        ,
        this.setFrozenConditions = function(A) {
            this.enableStateChanged(),
            this._filterImpl.setFrozenConditions(A)
        }
        ,
        this.getFrozenConditions = function() {
            return this._filterImpl.getFrozenConditions()
        }
        ,
        this.clearFrozenConditions = function() {
            this.enableStateChanged(),
            this._filterImpl.clearFrozenConditions()
        }
        ,
        this.clearFrozen = function() {
            this.enableStateChanged(),
            this.clearFrozenList(),
            this.clearFrozenConditions()
        }
        ,
        this.clearAllIdList = function() {
            return this.enableStateChanged(),
            this._filterImpl.clearAllIdList()
        }
        ,
        this.clearIdList = function(A) {
            return this.enableStateChanged(),
            this._filterImpl.clearIdList(A)
        }
        ,
        this.addToIdList = function(A, e) {
            return this.enableStateChanged(),
            this._filterImpl.addToIdList(A, e)
        }
        ,
        this.removeFromIdList = function(A, e) {
            return this.enableStateChanged(),
            this._filterImpl.removeFromIdList(A, e)
        }
        ,
        this.setIdList = function(A, e) {
            return this.enableStateChanged(),
            this._filterImpl.setIdList(A, e)
        }
        ,
        this.clearAllOverrideList = function() {
            l("OverrideIdsFA"),
            l("OverrideConditionFA"),
            n.clearMaterial();
            for (var e = 0, t = A.length; t > e; e += 1) {
                var i = A[e];
                "WireframeIdsFA" === i.getClassName() && i.applyFilter(n)
            }
            this.enableStateChanged()
        }
        ,
        this.clearModelAllOverrideList = function() {
            c("OverrideIdsFA"),
            r.clearMaterial(),
            this.enableStateChanged()
        }
        ,
        this.clearOverrideList = function(A) {
            return this.enableStateChanged(),
            this._filterImpl.clearOverrideList(A)
        }
        ,
        this.addToOverrideList = function(A, e, t) {
            return this.enableStateChanged(),
            this._filterImpl.addToOverrideList(A, e, t)
        }
        ,
        this.removeFromOverrideList = function(A, e) {
            return this.enableStateChanged(),
            this._filterImpl.removeFromOverrideList(A, e)
        }
        ,
        this.setOverrideList = function(A, e, t) {
            return this.enableStateChanged(),
            this._filterImpl.setOverrideList(A, e, t)
        }
        ,
        this.addToOverrideListByColor = function(A, e) {
            var t = null;
            if (e) {
                var i = this._filterImpl.getMaterialNameByColor(e);
                t = this._filterImpl.getMaterialByName(i)
            }
            var o = new qg(!0,t);
            o.ids = A,
            this.pushBack(o)
        }
        ,
        this.addToOverrideListByCustomerMaterial = function(A, e, t, i, o) {
            var n = this
              , r = {};
            Array.isArray(t) || (t = [t]);
            var a = t;
            return e.forEach((function(e) {
                for (var s in e)
                    i || (a = h(t, s)),
                    e[s][0].isBatched || e[s][0].instanceOrNot || e[s][0].RenderTypeChange ? !e[s][0].instanceOrNot && e[s][0].isBatched || e[s][0].RenderTypeChange ? g(n, A, e[s], s, a, r, o) : e[s][0].instanceOrNot && e[s][0].isBatched && (u(A, e[s][0].model.modelKey, s),
                    g(n, A, e[s], s, a, r, o)) : p(n, A, e[s], s, a, r, o)
            }
            )),
            r
        }
        ,
        this.addToModelOverrideListByColor = function(A, e) {
            var t = null;
            if (e) {
                var i = this._filterImpl.getMaterialNameByColor(e);
                t = this._filterImpl.getMaterialByName(i)
            }
            var o = new qg(!0,t);
            o.ids = A,
            this.pushModelBack(o)
        }
        ,
        this.addToOverrideListByConditions = function(A, e) {
            var t = null;
            if (e) {
                var i = this._filterImpl.getMaterialNameByColor(e);
                t = this._filterImpl.getMaterialByName(i)
            }
            var o = new zg(!0,t);
            o.conditions = A,
            this.pushBack(o)
        }
        ,
        this.addToOverrideListByConditions = function(A, e) {
            var t = null;
            if (e) {
                var i = this._filterImpl.getMaterialNameByColor(e);
                t = this._filterImpl.getMaterialByName(i)
            }
            var o = new zg(!0,t);
            o.conditions = A,
            this.pushBack(o)
        }
        ,
        this.addToOverrideListByMaterial = function(A, e) {
            this._filterImpl.addOverrideMaterial(e);
            var t = new zg(!0,e);
            t.conditions = A,
            this.pushBack(t)
        }
        ,
        this.setOverrideListByColor = function(A, e, t) {
            for (var i = 0; e.length > i; i += 1) {
                var o = this._filterImpl.getMaterialNameByColor(t)
                  , r = this._filterImpl.getMaterialByName(o);
                n.setMaterial(e[i], r)
            }
        }
        ,
        this.getVisibleComponentSet = function(A) {
            for (var e = {}, t = Object.keys(A), i = 0; t.length > i; i += 1)
                this._isVisible({
                    userId: t[i]
                }) && (e[t[i]] = !0);
            return e
        }
        ,
        this.clearAllWireframeList = function() {
            n.clearMaterialByKey(l("WireframeIdsFA")),
            this.enableStateChanged()
        }
        ,
        this.addToWireframeByWireframe = function(A, e) {
            var t = null;
            if (e) {
                var i = this._filterImpl.getMaterialNameByWireframe(e);
                t = this._filterImpl.getMaterialByName(i)
            }
            var o = new jg(!0,t);
            o.ids = A,
            this.pushBack(o)
        }
        ,
        this.clearAllUserList = function() {
            return this.enableStateChanged(),
            this._filterImpl.clearAllUserList()
        }
        ,
        this.clearUserListByType = function(A) {
            return this.enableStateChanged(),
            this._filterImpl.clearUserListByType(A)
        }
        ,
        this.clearUserList = function(A, e) {
            return this.enableStateChanged(),
            this._filterImpl.clearUserList(A, e)
        }
        ,
        this.addToUserList = function(A, e, t, i) {
            return this.enableStateChanged(),
            this._filterImpl.addToUserList(A, e, t, i)
        }
        ,
        this.removeFromUserList = function(A, e, t) {
            this.enableStateChanged(),
            this._filterImpl.removeFromUserList(A, e, t)
        }
        ,
        this.setUserList = function(A, e, t, i) {
            this.enableStateChanged(),
            this._filterImpl.setUserList(A, e, t, i)
        }
        ,
        this.isIsolate = function() {
            var A = n.getObjectsMap();
            for (var e in A) {
                if (A.hasOwnProperty(e))
                    var t = A[e];
                for (var i in t) {
                    var o = n.isIsolateHide(i);
                    if (o |= n.isIsolateTransparent(i))
                        return !0
                }
            }
            return !1
        }
        ,
        this.isFiltering = function() {
            var A = this.filterActionList.length > 0;
            return this.isIsolate() || A
        }
        ,
        this.getFrozonMaterial = function() {
            return this._filterImpl.getFrozonMaterial()
        }
        ,
        this.setIsolateMaterial = function(A) {
            this.enableStateChanged(),
            this._filterImpl.setIsolateMaterial(A)
        }
        ,
        this.getIsolateMaterial = function() {
            return this._filterImpl.getIsolateMaterial()
        }
        ,
        this.resetIsolateMaterial = function() {
            this.enableStateChanged(),
            this._filterImpl.resetIsolateMaterial()
        }
        ,
        this.clearAllIsolateList = function() {
            n.clearIsolates()
        }
        ,
        this.clearIsolation = function() {
            n.clearIsolates(),
            t = null,
            s = !0
        }
        ,
        this.clearModelIsolation = function() {
            r.clearIsolates(),
            i = null,
            s = !0
        }
        ,
        this.addToIsolateList = function(A, e) {
            var t = new Hg("HideOthers" === e);
            t.ids = A.concat(),
            this.pushBack(t),
            this.clearFilterActionList()
        }
        ,
        this.removeFromIsolateList = function(A) {
            t && Array.isArray(A) && (A.forEach((function(A) {
                t.ids.remove(A)
            }
            )),
            1 > t.ids.length ? (n.clearIsolates(),
            t = null) : t.applyFilter(n),
            this.enableStateChanged())
        }
        ,
        this.removeModelFromIsolateList = function(A) {
            i && Array.isArray(A) && (A.forEach((function(A) {
                i.ids.remove(A)
            }
            )),
            1 > i.ids.length ? (r.clearIsolates(),
            i = null) : i.applyFilter(r),
            this.enableStateChanged())
        }
        ,
        this.setIsolateList = function(A, e) {
            var t = new Hg(e);
            t.ids = A.concat(),
            this.pushBack(t)
        }
        ,
        this.setModelIsolateList = function(A, e) {
            var t = new Hg(e);
            t.ids = A.concat(),
            this.pushModelBack(t)
        }
        ,
        this.setIsolateConditions = function(A, e) {
            var t = new Xg(e === Nc.HIDDEN_OTHERS);
            t.conditions = A,
            this.pushBack(t),
            this.clearFilterActionList()
        }
        ,
        this.getIsolateConditions = function(A) {
            return this._filterImpl.getIsolateConditions(A)
        }
        ,
        this.clearIsolateConditions = function(A) {
            this.enableStateChanged(),
            this._filterImpl.clearIsolateConditions(A)
        }
        ,
        this.clearAllIsolateConditions = function() {
            this.enableStateChanged(),
            this._filterImpl.clearAllIsolateConditions()
        }
        ,
        this.setConditions = function(A, e) {
            if (0 === A) {
                n.hideAll();
                var t = new Jg(!0,!0);
                t.conditions = e,
                this.pushBack(t)
            }
            3 === A && this._filterImpl.setConditions(A, e)
        }
        ,
        this.getConditions = function(A) {
            return this._filterImpl.getConditions(A)
        }
        ,
        this.clearConditions = function(A) {
            this.enableStateChanged(),
            this._filterImpl.clearConditions(A)
        }
        ,
        this.clearAllConditions = function() {
            this.enableStateChanged(),
            this._filterImpl.clearAllConditions()
        }
        ,
        this.makeSceneTranslucent = function() {
            this.enableStateChanged(),
            this._filterImpl.makeSceneTranslucent()
        }
        ,
        this.cancelSceneTranslucent = function() {
            this.enableStateChanged(),
            this._filterImpl.cancelSceneTranslucent()
        }
        ,
        this.hideScene = function() {
            this.enableStateChanged(),
            this._filterImpl.hideScene()
        }
        ,
        this.showScene = function() {
            this.enableStateChanged(),
            this._filterImpl.showScene()
        }
        ,
        this.setSceneState = function(A) {
            this.enableStateChanged(),
            this._filterImpl.setSceneState(A)
        }
        ,
        this.getSceneState = function() {
            return this._filterImpl.getSceneState()
        }
        ,
        this.cancelHidden = function() {
            this.enableStateChanged(),
            this._filterImpl.cancelHidden()
        }
        ,
        this.cancelTranslucent = function() {
            this.enableStateChanged(),
            this._filterImpl.cancelTranslucent()
        }
        ,
        this.hideByIds = function(A) {
            var e = new Pg(!0,!1);
            e.ids = A,
            this.pushBack(e)
        }
        ,
        this.hideModelByIds = function(A) {
            var e = new Pg(!0,!1);
            e.ids = A,
            this.pushModelBack(e)
        }
        ,
        this.hideByConditions = function(A) {
            var e = new Jg(!0,!1);
            e.conditions = A,
            this.pushBack(e)
        }
        ,
        this.hideOthersByConditions = function(A) {
            var e = new Jg(!1,!1);
            e.conditions = A,
            this.pushBack(e)
        }
        ,
        this.showByIds = function(A) {
            var e = new Pg(!0,!0);
            e.ids = A,
            this.pushBack(e)
        }
        ,
        this.showModelByIds = function(A) {
            var e = new Pg(!0,!0);
            e.ids = A,
            this.pushModelBack(e)
        }
        ,
        this.showByConditions = function(A) {
            var e = new Jg(!0,!0);
            e.conditions = A,
            this.pushBack(e)
        }
        ,
        this.makeTranslucentByIds = function(A) {
            var e = new Yg(!0,!1);
            e.ids = A,
            this.pushBack(e)
        }
        ,
        this.makeModelTranslucentByIds = function(A) {
            var e = new Yg(!0,!1);
            e.ids = A,
            this.pushModelBack(e)
        }
        ,
        this.makeTranslucentByConditions = function(A) {
            var e = new Zg(!0,!1);
            e.conditions = A,
            this.pushBack(e)
        }
        ,
        this.opaqueByIds = function(A) {
            var e = new Yg(!0,!0);
            e.ids = A,
            this.pushBack(e)
        }
        ,
        this.opaqueModelByIds = function(A) {
            var e = new Yg(!0,!0);
            e.ids = A,
            this.pushModelBack(e)
        }
        ,
        this.opaqueByConditions = function(A) {
            var e = new Zg(!0,!0);
            e.conditions = A,
            this.pushBack(e)
        }
        ,
        this.setFrozonMaterial = function(A) {
            this._filterImpl.setFrozonMaterial(A)
        }
        ,
        this.makeTranslucentOthersByIds = function(A) {
            var e = new Yg(!1,!1);
            e.ids = A,
            this.pushBack(e)
        }
        ,
        this.makeTranslucentOthersModelByIds = function(A) {
            var e = new Yg(!1,!1);
            e.ids = A,
            this.pushModelBack(e)
        }
        ,
        this.opaqueAll = function() {
            l("TransparentIdsFA"),
            l("TransparentConditionFA"),
            n.clearTransparent(),
            this.enableStateChanged()
        }
        ,
        this.opaqueAllModel = function() {
            c("TransparentIdsFA"),
            c("TransparentConditionFA"),
            r.clearTransparent(),
            this.enableStateChanged()
        }
        ,
        this.deactivateByIds = function(A) {
            n.deactivateByIds(A),
            this.observerForSceneState && this.observerForSceneState(A),
            this.enableStateChanged()
        }
        ,
        this.activateByIds = function(A) {
            n.activateByIds(A),
            this.enableStateChanged()
        }
        ,
        this.clearInactivatedIdMap = function() {
            n.clearInactivatedIdMap()
        }
        ,
        this.getInactivatedIdMap = function() {
            return n.getInactivatedIdMap()
        }
        ,
        this.deactivateAll = function() {
            n.deactivateAll()
        }
        ,
        this.activateAll = function() {
            n.activateAll()
        }
        ,
        this.isComponentActive = function(A) {
            return n.isActive(A)
        }
        ,
        this.getFilterType = function() {
            return this._filterImpl._getFilterType()
        }
        ,
        this._hasOverrideMaterialForWireFrame = function(A) {
            return n.hasOverrideMaterialForWireFrame(A.name)
        }
        ,
        this._hasOverrideMaterialFilterForWireFrame = function() {
            return n.hasOverrideMaterialForWireFrame()
        }
        ,
        this._getOverrideMaterialForWireFrame = function(A) {
            return n.getWireFrameMaterial(A.name)
        }
        ,
        this._getOverrideWireFrameMaterial = function(A) {
            return n.getWireFrameMaterial(A.name)
        }
        ,
        this.addToOverrideListForWireFrameByColor = function(A, e) {
            var t = null;
            if (e) {
                var i = this._filterImpl.getMaterialNameByColor(e);
                t = this._filterImpl.getMaterialByName(i)
            }
            var o = new yu(!0,t);
            o.ids = A,
            this.pushBack(o)
        }
        ,
        this.addToOverrideListForWireFrameByConditions = function(A, e) {
            var t = null;
            if (e) {
                var i = this._filterImpl.getMaterialNameByColor(e);
                t = this._filterImpl.getMaterialByName(i)
            }
            var o = new Cu(!0,t);
            o.conditions = A,
            this.pushBack(o)
        }
        ,
        this._getFilterObjectsKeys = function(A) {
            return this._filterImpl._getFilterObjectsKeys(A)
        }
        ,
        this.transparentComponentsByKey = function(A, e, t) {}
        ,
        this.closeOrigMatModelTransparent = function(A, e) {
            var t = A.models[e].materialManager.materials;
            for (var i in t) {
                var o = t[i];
                void 0 !== o._origTransparent && (o.transparent = o._origTransparent,
                o.needsUpdate = !0),
                void 0 !== o._origOpacity && (o.opacity = o._origOpacity,
                o.needsUpdate = !0)
            }
            var n = A.models[e].materialManager.instanceMaterials;
            for (var r in n)
                n[r].forEach((function(A) {
                    void 0 !== A._origTransparent && (A.transparent = A._origTransparent,
                    A.needsUpdate = !0),
                    void 0 !== A._origOpacity && (A.opacity = A._origOpacity,
                    A.needsUpdate = !0)
                }
                ))
        }
        ,
        this.transparentModelOrigMatByKey = function(A, e) {
            var t = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : .5
              , i = A.models[e].materialManager.materials;
            for (var o in i) {
                var n = i[o];
                void 0 === n._origTransparent && (n._origTransparent = n.transparent),
                void 0 === n._origOpacity && (n._origOpacity = n.opacity),
                n.transparent = !0,
                n.opacity = t,
                n.needsUpdate = !0
            }
            var r = A.models[e].materialManager.instanceMaterials;
            for (var a in r)
                r[a].forEach((function(A) {
                    void 0 === A._origTransparent && (A._origTransparent = A.transparent),
                    void 0 === A._origOpacity && (A._origOpacity = A.opacity),
                    A.transparent = !0,
                    A.opacity = t,
                    A.needsUpdate = !0
                }
                ))
        }
    };
    var Su = function(A) {
        ji.call(this),
        this.type = "InstancedDepthMaterial",
        this.uniforms = it.depth.uniforms,
        this.vertexShader = function(A) {
            return A.replace("#include <project_vertex>", "\n        vec4 mvPosition = modelViewMatrix * vec4(getInstancePosition(transformed), 1.0);\n        gl_Position = projectionMatrix * mvPosition;\n    ")
        }(it.depth.vertexShader.replace("void main() {", "\n            attribute float vState;            \n            attribute vec4 aColor;            \n            attribute vec3 mcol0;\n            attribute vec3 mcol1;\n            attribute vec3 mcol2;\n            attribute vec3 mcol3;\n            #if defined(USE_MAP)\n                attribute vec2 muvCol0;\n                attribute vec2 muvCol1;\n                attribute vec2 muvCol2;\n            #endif\n            \n            varying float vfState;\n            \n            vec3 getInstancePosition(vec3 position) {\n                return vec3(mat4(vec4(mcol0, 0.0),\n                                 vec4(mcol1, 0.0),\n                                 vec4(mcol2, 0.0),\n                                 vec4(mcol3, 1.0)) * vec4(position, 1.0));\n            }\n            \n            void main() {\n                vfState = vState;\n        ")),
        this.fragmentShader = it.depth.fragmentShader.replace("void main() {", "\n            varying float vfState;            \n            void main() {\n                if (vfState <= -0.99 && vfState >= -1.01) discard;\n                \n        "),
        void 0 !== A && this.setValues(A)
    };
    function wu(A, e, t) {
        var i = this
          , o = !1
          , n = 0
          , r = 0
          , a = void 0
          , s = [];
        this.onStart = void 0,
        this.onLoad = A,
        this.onProgress = e,
        this.onError = t,
        this.itemStart = function(A) {
            r += 1,
            !1 === o && void 0 !== i.onStart && i.onStart(A, n, r),
            o = !0
        }
        ,
        this.itemEnd = function(A) {
            n += 1,
            void 0 !== i.onProgress && i.onProgress(A, n, r),
            n === r && (o = !1,
            void 0 !== i.onLoad && i.onLoad())
        }
        ,
        this.itemError = function(A) {
            void 0 !== i.onError && i.onError(A)
        }
        ,
        this.resolveURL = function(A) {
            return a ? a(A) : A
        }
        ,
        this.setURLModifier = function(A) {
            return a = A,
            this
        }
        ,
        this.addHandler = function(A, e) {
            return s.push(A, e),
            this
        }
        ,
        this.removeHandler = function(A) {
            var e = s.indexOf(A);
            return -1 !== e && s.splice(e, 2),
            this
        }
        ,
        this.getHandler = function(A) {
            for (var e = 0, t = s.length; t > e; e += 2) {
                var i = s[e]
                  , o = s[e + 1];
                if (i.global && (i.lastIndex = 0),
                i.test(A))
                    return o
            }
            return null
        }
    }
    (Su.prototype = Object.create(ji.prototype)).constructor = Su;
    var Mu = new wu
      , bu = function(A) {
        this.manager = null != A ? A : Mu,
        this.model = A.model,
        this.cacheViable = !0,
        this.modelKey = A.model.modelKey
    };
    Object.assign(bu.prototype, {
        _load: function(A, e, t, i) {
            void 0 === A && (A = ""),
            null != this.path && (A = this.path + A);
            var o = this
              , n = A.match(/^data:(.*?)(;base64)?,(.*)$/);
            if (n) {
                var r = n[1]
                  , a = Boolean(n[2])
                  , s = n[3];
                s = window.decodeURIComponent(s),
                a && (s = window.atob(s));
                try {
                    var l = null
                      , c = (this.responseType || "").toLowerCase();
                    switch (c) {
                    case "arraybuffer":
                    case "blob":
                        l = new ArrayBuffer(s.length);
                        for (var h = new Uint8Array(l), d = 0; s.length > d; d += 1)
                            h[d] = s.charCodeAt(d);
                        "blob" === c && (l = new Blob([l],{
                            type: r
                        }));
                        break;
                    case "document":
                        var p = new DOMParser;
                        l = p.parseFromString(s, r);
                        break;
                    case "json":
                        l = JSON.parse(s);
                        break;
                    default:
                        l = s
                    }
                    window.setTimeout((function() {
                        e && e(l),
                        o.manager.itemEnd(A)
                    }
                    ), 0)
                } catch (e) {
                    window.setTimeout((function() {
                        i && i(e),
                        o.manager.itemEnd(A),
                        o.manager.itemError(A)
                    }
                    ), 0)
                }
            } else {
                var g = new XMLHttpRequest;
                for (var u in g.open("GET", A, !0),
                g.addEventListener("load", (function(t) {
                    var n = t.target.response;
                    if (200 === this.status) {
                        var r = o.model.getStorage();
                        if (null == n)
                            return i && i(t),
                            o.manager.itemEnd(A),
                            o.manager.itemError(A),
                            void Bh.error("response 为 null");
                        if (!(n instanceof ArrayBuffer || n instanceof Array || n instanceof Blob || n instanceof Object))
                            try {
                                n = JSON.parse(n)
                            } catch (A) {}
                        if (n instanceof Blob && mh.isIOSDevice()) {
                            var a = new FileReader;
                            a.readAsDataURL(n),
                            a.onloadend = function(t) {
                                r && o.cacheViable && r.put(A, t.target.result, o.modelKey, (function() {
                                    o.manager.progress.loaded += 1
                                }
                                ), (function() {
                                    Bh.warn(A, "缓存失败"),
                                    o.manager.progress.failed += 1
                                }
                                )),
                                e && e(t.target.result)
                            }
                        } else {
                            if (r && o.cacheViable)
                                if (n.byteLength && n.byteLength > 12e7) {
                                    for (var s = [], l = Math.floor(n.byteLength / 4e7), c = 0; l >= c; c += 1) {
                                        o.manager.progress.total += 1;
                                        var h = null;
                                        h = c === l ? n.slice(4e7 * c) : n.slice(4e7 * c, 4e7 * (c + 1));
                                        var d = A + "_" + c;
                                        s.push(d),
                                        r.put(d, h, o.modelKey, (function() {
                                            o.manager.progress.loaded += 1
                                        }
                                        ), (function() {
                                            o.manager.progress.failed += 1
                                        }
                                        ))
                                    }
                                    r.put(A, {
                                        split: !0,
                                        list: s,
                                        length: n.byteLength
                                    }, o.modelKey, (function() {}
                                    ), (function() {
                                        Bh.warn(A, "缓存失败")
                                    }
                                    ))
                                } else
                                    r.put(A, n, o.modelKey, (function() {
                                        o.manager.progress && (o.manager.progress.loaded += 1)
                                    }
                                    ), (function() {
                                        o.manager.progress && (Bh.warn(A, "缓存失败"),
                                        o.manager.progress.failed += 1)
                                    }
                                    ));
                            e && e(n)
                        }
                        o.manager.itemEnd(A)
                    } else
                        0 === this.status ? (Bh.warn("THREE.FileLoader: HTTP Status 0 received."),
                        e && e(n),
                        o.manager.itemEnd(A)) : (i && i(t),
                        o.manager.itemEnd(A),
                        o.manager.itemError(A))
                }
                ), !1),
                "function" == typeof t && g.addEventListener("progress", (function(A) {
                    t(A)
                }
                ), !1),
                g.addEventListener("error", (function(e) {
                    i && i(e),
                    o.manager.itemEnd(A),
                    o.manager.itemError(A)
                }
                ), !1),
                void 0 !== this.responseType && (g.responseType = this.responseType),
                void 0 !== this.withCredentials && (g.withCredentials = this.withCredentials),
                g.overrideMimeType && g.overrideMimeType(void 0 !== this.mimeType ? this.mimeType : "text/plain"),
                this.requestHeader)
                    g.setRequestHeader(u, this.requestHeader[u]);
                g.send(null)
            }
            return o.manager.itemStart(A),
            g
        },
        load: function(A, e, t, i) {
            void 0 === A && (A = ""),
            null != this.path && (A = this.path + A);
            return this._load.call(this, A, e, t, i)
        },
        setPath: function(A) {
            return this.path = A,
            this
        },
        setResponseType: function(A) {
            return this.responseType = A,
            this
        },
        setWithCredentials: function(A) {
            return this.withCredentials = A,
            this
        },
        setMimeType: function(A) {
            return this.mimeType = A,
            this
        },
        setCacheViable: function(A) {
            return this.cacheViable = A,
            this
        },
        setRequestHeader: function(A) {
            return this.requestHeader = A,
            this
        }
    });
    var Uu = function(A) {
        this.compArr = [],
        this.compArr = A,
        Bh.debug(this.compArr)
    };
    Uu.prototype = {
        constructor: Uu,
        getComponent: function(A) {}
    };
    var Fu, Ku, Qu, Ru, Tu = {
        EmptyGeometry: new he,
        UnitCylinderInstance: new hr(1,1,1,8,1,!1),
        UnitBoxInstance: new Ne(1,1,1),
        UnitTextureCylinder: null,
        UnitTextureBox: null,
        initializeUnitInstances: function() {
            Tu.UnitCylinderInstance.boundingBox || Tu.UnitCylinderInstance.computeBoundingBox(),
            Tu.UnitBoxInstance.boundingBox || Tu.UnitBoxInstance.computeBoundingBox()
        },
        destroyUnitInstances: function() {
            Tu.UnitCylinderInstance.dispose(),
            Tu.UnitBoxInstance.dispose()
        },
        getBoxData: function(A) {
            for (var e = [[], [], [], [], [], []], t = 0; 4 > t; t += 1)
                e[0].push(-1, 0, 0);
            for (t = 0; 4 > t; t += 1)
                e[1].push(0, -1, 0);
            for (t = 0; 4 > t; t += 1)
                e[2].push(0, 0, -1);
            for (t = 0; 4 > t; t += 1)
                e[3].push(0, 0, 1);
            for (t = 0; 4 > t; t += 1)
                e[4].push(0, 1, 0);
            for (t = 0; 4 > t; t += 1)
                e[5].push(1, 0, 0);
            var i = [[], [], [], [], [], []];
            return i[0] = i[2] = i[4] = [-.5, -.5, -.5, .5, .5, -.5, .5, .5],
            i[1] = i[3] = i[5] = [-.5, -.5, -.5, .5, .5, -.5, .5, .5],
            {
                vertex: [[-.5, -.5, -.5, -.5, -.5, .5, -.5, .5, -.5, -.5, .5, .5], [-.5, -.5, -.5, -.5, -.5, .5, .5, -.5, -.5, .5, -.5, .5], [-.5, -.5, -.5, -.5, .5, -.5, .5, -.5, -.5, .5, .5, -.5], [-.5, -.5, .5, -.5, .5, .5, .5, -.5, .5, .5, .5, .5], [-.5, .5, -.5, -.5, .5, .5, .5, .5, -.5, .5, .5, .5], [.5, -.5, -.5, .5, -.5, .5, .5, .5, -.5, .5, .5, .5]][A],
                normal: e[A],
                uv: i[A],
                index: [[0, 1, 2, 3, 2, 1], [2, 1, 0, 1, 2, 3], [0, 1, 2, 3, 2, 1], [2, 1, 0, 1, 2, 3], [0, 1, 2, 3, 2, 1], [2, 1, 0, 1, 2, 3]][A]
            }
        },
        getPipeData2: (Fu = [.5, 0, .5, .353530875, .353530875, .5, 0, .5, .5, -.353530875, .353530875, .5, -.5, 0, .5, -.353530875, -.353530875, .5, 0, -.5, .5, .353530875, -.353530875, .5, .5, 0, .5, .5, 0, -.5, .353530875, .353530875, -.5, 0, .5, -.5, -.353530875, .353530875, -.5, -.5, 0, -.5, -.353530875, -.353530875, -.5, 0, -.5, -.5, .353530875, -.353530875, -.5, .5, 0, -.5, .5, 0, .5, .353530875, .353530875, .5, 0, .5, .5, -.353530875, .353530875, .5, -.5, 0, .5, -.353530875, -.353530875, .5, 0, -.5, .5, .353530875, -.353530875, .5, .5, 0, -.5, .353530875, .353530875, -.5, 0, .5, -.5, -.353530875, .353530875, -.5, -.5, 0, -.5, -.353530875, -.353530875, -.5, 0, -.5, -.5, .353530875, -.353530875, -.5],
        Ku = [0, 9, 1, 1, 9, 10, 1, 10, 2, 2, 10, 11, 2, 11, 3, 3, 11, 12, 3, 12, 4, 4, 12, 13, 4, 13, 5, 5, 13, 14, 5, 14, 6, 6, 14, 15, 6, 15, 7, 7, 15, 16, 7, 16, 8, 8, 16, 17, 18, 19, 20, 18, 20, 21, 18, 21, 22, 18, 22, 23, 18, 23, 24, 18, 24, 25, 26, 28, 27, 26, 29, 28, 26, 30, 29, 26, 31, 30, 26, 32, 31, 26, 33, 32],
        Qu = [1, 0, 0, .7, .7, 0, 0, 1, 0, -.7, .7, 0, -1, 0, 0, -.7, -.7, 0, 0, -1, 0, .7, -.7, 0, 1, 0, 0, 1, 0, 0, .7, .7, 0, 0, 1, 0, -.7, .7, 0, -1, 0, 0, -.7, -.7, 0, 0, -1, 0, .7, -.7, 0, 1, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1],
        Ru = [-.5, .5, -.375, .5, -.25, .5, -.125, .5, 0, .5, .125, .5, .25, .5, .375, .5, .5, .5, -.5, -.5, -.375, -.5, -.25, -.5, -.125, -.5, 0, -.5, .125, -.5, .25, -.5, .375, -.5, .5, -.5, .5, 0, .353530875, .353530875, 0, .5, -.353530875, .353530875, -.5, 0, -.353530875, -.353530875, 0, -.5, .353530875, -.353530875, .5, 0, .353530875, .353530875, 0, .5, -.353530875, .353530875, -.5, 0, -.353530875, -.353530875, 0, -.5, .353530875, -.353530875],
        function() {
            return {
                vertex: Fu,
                normal: Qu,
                uv: Ru,
                index: Ku
            }
        }
        ),
        getPipeData: function(A) {
            (void 0 === A || 8 > A) && (A = 8),
            A > 256 && (A = 256);
            var e = 4 * A + 2
              , t = 3 * (4 * A - 4)
              , i = A + 1
              , o = 1 / A
              , n = 6.28318530714 / A
              , r = null
              , a = null
              , s = [];
            for (r = 0; A > r; r += 1)
                s.push(.5 * Math.cos(r * n)),
                s.push(.5 * Math.sin(r * n));
            s.push(.5),
            s.push(0);
            var l = [];
            for (a = 2 * i,
            r = 0; a > r; r += 2)
                l.push(s[r]),
                l.push(s[r + 1]),
                l.push(.5);
            for (r = 0; a > r; r += 2)
                l.push(s[r]),
                l.push(s[r + 1]),
                l.push(-.5);
            for (a = 2 * A,
            r = 0; a > r; r += 2)
                l.push(s[r]),
                l.push(s[r + 1]),
                l.push(.5);
            for (r = a; r > 0; r -= 2)
                l.push(s[r]),
                l.push(s[r + 1]),
                l.push(-.5);
            var c = []
              , h = A + 1;
            for (r = 0; A > r; r += 1)
                c.push(r),
                c.push(r + h),
                c.push(r + 1),
                c.push(r + 1),
                c.push(r + h),
                c.push(r + h + 1);
            var d = 2 * i;
            for (r = 1; A - 1 > r; r += 1)
                c.push(d),
                c.push(d + r),
                c.push(d + r + 1);
            for (d += A,
            r = 1; A - 1 > r; r += 1)
                c.push(d),
                c.push(d + r),
                c.push(d + r + 1);
            var p = [];
            for (r = A; r >= 0; r -= 1)
                p.push(r * o - .5),
                p.push(-.5);
            for (r = A; r >= 0; r -= 1)
                p.push(r * o - .5),
                p.push(.5);
            for (a = 2 * A,
            r = 0; a > r; r += 2)
                p.push(s[r]),
                p.push(s[r + 1]);
            for (r = a; r > 0; r -= 2)
                p.push(s[r]),
                p.push(s[r + 1]);
            a = 3 * e;
            var g = [];
            for (r = 0; a > r; r += 1)
                g.push(0);
            var u = null
              , f = null
              , m = null
              , C = new y
              , v = new y
              , I = new y
              , E = new y
              , B = new y;
            for (r = 0; t > r; r += 3)
                f = 3 * c[r + 1],
                m = 3 * c[r + 2],
                C.fromArray(l, u = 3 * c[r]),
                v.fromArray(l, f),
                I.fromArray(l, m),
                E.subVectors(I, v),
                B.subVectors(C, v),
                E.cross(B),
                g[u] += E.x,
                g[u + 1] += E.y,
                g[u + 2] += E.z,
                g[f] += E.x,
                g[f + 1] += E.y,
                g[f + 2] += E.z,
                g[m] += E.x,
                g[m + 1] += E.y,
                g[m + 2] += E.z;
            var x = new y;
            for (a = 3 * e,
            r = 0; a > r; r += 3)
                x.fromArray(g, r),
                x.normalize(),
                g[r] = x.x,
                g[r + 1] = x.y,
                g[r + 2] = x.z;
            return {
                vertex: l,
                normal: g,
                uv: p,
                index: c,
                edges: A
            }
        },
        getInstancePipeData: function(A, e) {
            var t = this.getPipeData(A);
            (void 0 === A || 8 > A) && (A = 8),
            A > 256 && (A = 256);
            var i = 2 * (A + 1)
              , o = i + A
              , n = 4 * A + 2
              , r = [[], [], []];
            r[0] = t.vertex.slice(0, 3 * i),
            r[1] = t.vertex.slice(3 * i, 3 * o),
            r[2] = t.vertex.slice(3 * o, 3 * n);
            var a = [[], [], []]
              , s = A + 1
              , l = 0;
            for (l = 0; A > l; l += 1)
                a[0].push(l),
                a[0].push(l + s),
                a[0].push(l + 1),
                a[0].push(l + 1),
                a[0].push(l + s),
                a[0].push(l + s + 1);
            for (l = 1; A - 1 > l; l += 1)
                a[1].push(0),
                a[1].push(l),
                a[1].push(l + 1);
            for (l = 1; A - 1 > l; l += 1)
                a[2].push(0),
                a[2].push(l),
                a[2].push(l + 1);
            var c = [[], [], []];
            c[0] = t.uv.slice(0, 2 * i),
            c[1] = t.uv.slice(2 * i, 2 * o),
            c[2] = t.uv.slice(2 * o, 2 * n);
            var h = [[], [], []];
            return h[0] = t.normal.slice(0, 3 * i),
            h[1] = t.normal.slice(3 * i, 3 * o),
            h[2] = t.normal.slice(3 * o, 3 * n),
            {
                vertex: r[e],
                normal: h[e],
                uv: c[e],
                index: a[e]
            }
        },
        getUnitTextureCylinder: function() {
            if (null === Tu.UnitTextureCylinder) {
                Tu.UnitTextureCylinder = new Array(3);
                for (var A = 0; 3 > A; A += 1) {
                    var e = Tu.getInstancePipeData(32, A);
                    Tu.UnitTextureCylinder[A] = new he,
                    Tu.UnitTextureCylinder[A].setIndex(e.index),
                    Tu.UnitTextureCylinder[A].addAttribute("position", new Ae(e.vertex,3)),
                    Tu.UnitTextureCylinder[A].addAttribute("normal", new Ae(e.normal,3)),
                    Tu.UnitTextureCylinder[A].addAttribute("uv", new Ae(e.uv,2))
                }
            }
            return Tu.UnitTextureCylinder
        },
        getUnitTextureBox: function() {
            if (null === Tu.UnitTextureBox) {
                Tu.UnitTextureBox = new Array(6);
                for (var A = 0; 6 > A; A += 1) {
                    var e = Tu.getBoxData(A);
                    Tu.UnitTextureBox[A] = new he,
                    Tu.UnitTextureBox[A].setIndex(e.index),
                    Tu.UnitTextureBox[A].addAttribute("position", new Ae(e.vertex,3)),
                    Tu.UnitTextureBox[A].addAttribute("normal", new Ae(e.normal,3)),
                    Tu.UnitTextureBox[A].addAttribute("uv", new Ae(e.uv,2))
                }
            }
            return Tu.UnitTextureBox
        },
        getBoxBufferGeometryWithUvMatrices: function(A) {
            for (var e = [], t = null, i = new l, o = new y, n = !!A, r = 0; 6 > r; r += 1) {
                t = new he;
                var a = Tu.getBoxData(r);
                if (n) {
                    var s = [];
                    i.set(A[6 * r], A[6 * r + 2], A[6 * r + 4], A[6 * r + 1], A[6 * r + 3], A[6 * r + 5], 0, 0, 1);
                    for (var c = 0, h = a.uv.length; h > c; c += 2)
                        o.set(a.uv[c], a.uv[c + 1], 1),
                        o.applyMatrix3(i),
                        s.push(o.x),
                        s.push(o.y);
                    t.addAttribute("uv", new Ae(s,2))
                }
                t.setIndex(new YA(Uint32Array.from(a.index),1)),
                t.addAttribute("position", new Ae(a.vertex,3)),
                t.addAttribute("normal", new Ae(a.normal,3)),
                e.push(t)
            }
            return Tu.mergeBufferGeometries2(e)
        },
        getPipeBufferGeometryWithUvMatrices: function(A) {
            var e = Tu.getPipeData(32)
              , t = e.edges
              , i = !(!A || 18 !== A.length)
              , o = new he;
            if (i) {
                for (var n = [], r = 0, a = A.length; a > r; r += 6) {
                    var s = new l;
                    s.set(A[6 * r], A[6 * r + 2], A[6 * r + 4], A[6 * r + 1], A[6 * r + 3], A[6 * r + 5], 0, 0, 1),
                    n.push(s)
                }
                for (var c = [], h = new y, d = 4 * (t + 1), p = d + 2 * t, g = 0, u = e.uv.length; u > g; g += 2)
                    h.set(e.uv[g], e.uv[g + 1], 1),
                    h.applyMatrix3(d > g ? n[0] : p > g ? n[1] : n[2]),
                    c.push(h.x),
                    c.push(h.y);
                o.addAttribute("uv", new Ae(c,2))
            }
            return o.setIndex(new $A(e.index,1)),
            o.addAttribute("position", new Ae(e.vertex,3)),
            o.addAttribute("normal", new Ae(e.normal,3)),
            o
        },
        getGeometryFromBox3: function(A) {
            var e = new he
              , t = []
              , i = []
              , o = A.min
              , n = A.max
              , r = o.x
              , a = o.y
              , s = o.z
              , l = n.x
              , c = n.y
              , h = n.z;
            return t.push(r, a, s),
            t.push(l, a, s),
            t.push(r, a, h),
            t.push(l, a, h),
            t.push(r, c, s),
            t.push(l, c, s),
            t.push(r, c, h),
            t.push(l, c, h),
            i.push(0, 1, 3),
            i.push(0, 3, 2),
            i.push(1, 5, 7),
            i.push(1, 7, 3),
            i.push(5, 4, 6),
            i.push(5, 6, 7),
            i.push(4, 2, 6),
            i.push(4, 0, 2),
            i.push(0, 4, 5),
            i.push(0, 5, 1),
            i.push(2, 3, 7),
            i.push(2, 7, 6),
            e.setIndex(new YA(new Uint32Array(i),1)),
            e.setAttribute("position", new YA(new Float32Array(t),3)),
            e
        },
        getWorldMatrixOfMesh: function(A) {
            for (var e = [], t = A.parent; t; )
                e.push(t.matrix),
                t = t.parent;
            var i = new M;
            if (e.length > 0) {
                i = e[e.length - 1];
                for (var o = e.length - 2; o >= 0; o -= 1)
                    i.multiply(e[o])
            }
            var n = new M;
            return n.multiplyMatrices(i, A.matrix),
            n
        },
        getWorldPositionOfMesh: function(A, e) {
            e || (e = new M);
            var t = new M;
            t.getInverse(e);
            var i = A.clone();
            return i.applyMatrix4(t),
            i
        },
        getBoundingBoxWorldOfMesh: function(A, e) {
            var t = A.boundingBox;
            t || (A.geometry.boundingBox || A.geometry.computeBoundingBox(),
            t = A.geometry.boundingBox);
            var i = t.clone();
            i.applyMatrix4(A.matrixWorld);
            var o = new M;
            return o.getInverse(e),
            i.applyMatrix4(o),
            i
        },
        getBoundingBoxByBuffer: function(A) {
            for (var e = 1 / 0, t = 1 / 0, i = 1 / 0, o = -1 / 0, n = -1 / 0, r = -1 / 0, a = new ph, s = 0, l = A.length; l > s; s += 3) {
                var c = A[s]
                  , h = A[s + 1]
                  , d = A[s + 2];
                e > c && (e = c),
                t > h && (t = h),
                i > d && (i = d),
                c > o && (o = c),
                h > n && (n = h),
                d > r && (r = d)
            }
            return a.min.set(e, t, i),
            a.max.set(o, n, r),
            a
        },
        mergeBufferGeometriesFromMeshs: function(A, e) {
            for (var t = null !== A[0].geometry.index, i = new Set(Object.keys(A[0].geometry.attributes)), o = new Set(Object.keys(A[0].geometry.morphAttributes)), n = {}, r = {}, a = new he, s = 0; A.length > s; s += 1) {
                var l = A[s].geometry;
                if (t !== (null !== l.index))
                    return null;
                for (var c in l.attributes) {
                    if (!i.has(c))
                        return console.log("attributes not Used: ", c),
                        null;
                    void 0 === n[c] && (n[c] = []),
                    n[c].push(l.attributes[c])
                }
                for (var c in l.morphAttributes) {
                    if (!o.has(c))
                        return null;
                    void 0 === r[c] && (r[c] = []),
                    r[c].push(l.morphAttributes[c])
                }
                null != l.userData && (a.userData = a.userData || {},
                a.userData.mergedUserData = a.userData.mergedUserData || [],
                a.userData.mergedUserData.push(l.userData))
            }
            if (t) {
                var h = 0
                  , d = []
                  , p = 0
                  , g = 0;
                for (s = 0; A.length > s; s += 1) {
                    var u = A[s].geometry.index;
                    if (h > 0) {
                        u = u.clone();
                        for (var f = 0; u.count > f; f += 1)
                            u.setX(f, u.getX(f) + h)
                    }
                    d.push(u),
                    h += A[s].geometry.attributes.position.count,
                    void 0 === e[A[s].userId] && (e[A[s].userId] = []),
                    e[A[s].userId].push({
                        nodeId: A[s].nodeId,
                        indexStart: p,
                        indexCount: u.count,
                        positionStart: g,
                        positionCount: A[s].geometry.attributes.position.count
                    }),
                    g += A[s].geometry.attributes.position.count,
                    p += u.count
                }
                var m = this.mergeBufferAttributes(d);
                if (!m)
                    return null;
                a.index = m
            }
            for (var c in n) {
                var C = this.mergeBufferAttributes(n[c]);
                if (!C)
                    return null;
                a.setAttribute(c, C)
            }
            for (var c in r) {
                var y = r[c][0].length;
                if (0 === y)
                    break;
                a.morphAttributes = a.morphAttributes || {},
                a.morphAttributes[c] = [];
                for (s = 0; y > s; s += 1) {
                    var v = [];
                    for (f = 0; r[c].length > f; f += 1)
                        v.push(r[c][f][s]);
                    var I = this.mergeBufferAttributes(v);
                    if (!I)
                        return null;
                    a.morphAttributes[c].push(I)
                }
            }
            return a
        },
        mergeBufferGeometries: function(A, e) {
            for (var t = null !== A[0].index, i = new Set(Object.keys(A[0].attributes)), o = {}, n = new he, r = 0; A.length > r; r += 1) {
                var a = A[r];
                if (t !== (null !== a.index))
                    return null;
                for (var s in a.attributes) {
                    if (!i.has(s))
                        return null;
                    void 0 === o[s] && (o[s] = []),
                    o[s].push(a.attributes[s])
                }
            }
            if (t) {
                var l = 0
                  , c = [];
                for (r = 0; A.length > r; r += 1) {
                    var h = A[r].index;
                    if (l > 0) {
                        h = h.clone();
                        for (var d = 0; h.count > d; d += 1)
                            h.setX(d, h.getX(d) + l)
                    }
                    c.push(h),
                    l += A[r].attributes.position.count
                }
                var p = this.mergeBufferAttributes(c);
                if (!p)
                    return null;
                n.index = p
            }
            for (var s in o) {
                var g = this.mergeBufferAttributes(o[s], e);
                if (!g)
                    return null;
                n.setAttribute(s, g)
            }
            return n
        },
        reducedGeometry: function(A, e) {
            for (var t = {}, i = 0, o = e.length; o > i; i += 1) {
                var n = e[i];
                t[n] || (t[n] = []),
                t[n].push(i)
            }
            var r = 0
              , a = new Float32Array(3 * Object.keys(t).length);
            for (var s in t) {
                for (var l = t[s], c = 0, h = l.length; h > c; c += 1)
                    e[l[c]] = r,
                    a[3 * r] = A[3 * s],
                    a[3 * r + 1] = A[3 * s + 1],
                    a[3 * r + 2] = A[3 * s + 2];
                r += 1
            }
            return {
                buffer: a,
                index: e
            }
        },
        mergeBufferAttributes: function(A, e) {
            for (var t = null, i = null, o = null, n = 0, r = 0; A.length > r; r += 1) {
                var a = A[r];
                if (a.isInterleavedBufferAttribute)
                    return null;
                if (null === t && (t = a.array.constructor),
                t !== a.array.constructor)
                    return null;
                if (null === i && (i = a.itemSize),
                i !== a.itemSize)
                    return null;
                if (null === o && (o = a.normalized),
                o !== a.normalized)
                    return null;
                n += a.array.length
            }
            for (var s = new t(n), c = 0, h = !1, d = 0; A.length > d; d += 1) {
                if (e && !e[d].equals(Bc) && ("position" === A[d].name || "normal" === A[d].name)) {
                    if ("position" === A[d].name && e[d].applyToBufferAttribute(A[d]),
                    "normal" === A[d].name)
                        (new l).getNormalMatrix(e[d]).applyToBufferAttribute(A[d]);
                    h = !0
                }
                if (s.set(A[d].array, c),
                c += A[d].array.length,
                h) {
                    var p = (new M).getInverse(e[d]);
                    if ("position" === A[d].name && p.applyToBufferAttribute(A[d]),
                    "normal" === A[d].name)
                        (new l).getNormalMatrix(p).applyToBufferAttribute(A[d]);
                    h = !1
                }
            }
            return new YA(s,i,o)
        },
        applyMatrix3ToBuffer: function() {
            var A = new y;
            return function(e, t, i, o) {
                if (e.equals(xc))
                    return t;
                for (var n = i || 0, r = o || t.length; r > n; n += 3)
                    A.x = t[n + 0],
                    A.y = t[n + 1],
                    A.z = t[n + 2],
                    A.applyMatrix3(e),
                    t[n + 0] = A.x,
                    t[n + 1] = A.y,
                    t[n + 2] = A.z;
                return t
            }
        }(),
        applyMatrix4ToBuffer: function() {
            var A = new y;
            return function(e, t, i, o) {
                if (e.equals(Bc))
                    return t;
                for (var n = i || 0, r = o || t.length; r > n; n += 3)
                    A.x = t[n + 0],
                    A.y = t[n + 1],
                    A.z = t[n + 2],
                    A.applyMatrix4(e),
                    t[n + 0] = A.x,
                    t[n + 1] = A.y,
                    t[n + 2] = A.z;
                return t
            }
        }(),
        normalizeBuffer: function(A) {
            for (var e = null, t = null, i = null, o = null, n = 0, r = A.length; r > n; n += 3)
                e = A[n],
                t = A[n + 1],
                i = A[n + 2],
                o = 1 / Math.sqrt(e * e + t * t + i * i),
                A[n] = e * o,
                A[n + 1] = t * o,
                A[n + 2] = i * o
        },
        disposeBufferFromGeometry: function(A, e) {
            for (var t = 0, i = e.length; i > t; t += 1) {
                var o = A.getAttribute(e[t]);
                o && (o.array = null)
            }
        },
        disposeIndexBufferFromGeometry: function(A) {
            A.index && (A.index.array = null)
        },
        copyMeshProperties: function(A, e) {
            A.name = e.name,
            A.up.copy(e.up),
            A.position.copy(e.position),
            A.quaternion.copy(e.quaternion),
            A.scale.copy(e.scale),
            A.matrix.copy(e.matrix),
            A.matrixWorld.copy(e.matrixWorld),
            A.matrixAutoUpdate = e.matrixAutoUpdate,
            A.matrixWorldNeedsUpdate = e.matrixWorldNeedsUpdate
        },
        createBufferGeometryWithPosAndSkin: function(A) {
            var e = new he;
            if (A.isBufferGeometry || A._bufferGeometry) {
                var t = A.isBufferGeometry ? A : A._bufferGeometry;
                e.addAttribute("position", t.getAttribute("position")),
                t.getAttribute("skinIndex") && e.addAttribute("skinIndex", t.getAttribute("skinIndex")),
                t.getAttribute("skinWeight") && e.addAttribute("skinWeight", t.getAttribute("skinWeight"));
                var i = t.getIndex();
                i && e.setIndex(i)
            } else if (A.isGeometry) {
                var o = new Ae(3 * A.vertices.length,3);
                if (e.addAttribute("position", o.copyVector3sArray(A.vertices)),
                A.skinIndices.length > 0) {
                    var n = new Ae(4 * A.skinIndices.length,4);
                    e.addAttribute("skinIndex", n.copyVector4sArray(A.skinIndices))
                }
                if (A.skinWeights.length > 0) {
                    var r = new Ae(4 * A.skinWeights.length,4);
                    this.addAttribute("skinWeight", r.copyVector4sArray(A.skinWeights))
                }
                if (A.faces.length) {
                    for (var a = A.faces, s = [], l = 0; a.length > l; l += 1) {
                        var c = a[l];
                        s.push(c.a, c.b, c.c)
                    }
                    var h = new (uh.arrayMax(s) > 65535 ? Uint32Array : Uint16Array)(3 * s.length);
                    e.setIndex(new YA(h,1).copyIndicesArray(s))
                }
            }
            return e
        },
        calculateVolumeOfGeometry: function(A, e, t, i) {
            if (A && e) {
                var o = 0
                  , n = new y
                  , r = new y
                  , a = new y;
                t || (t = 0),
                i || (i = e.length);
                for (var s = 0, l = 0, c = 0, h = t, d = t + i; d > h; h += 3) {
                    l = e[h + 1],
                    c = e[h + 2],
                    n.set(A[3 * (s = e[h])], A[3 * s + 1], A[3 * s + 2]),
                    r.set(A[3 * l], A[3 * l + 1], A[3 * l + 2]),
                    a.set(A[3 * c], A[3 * c + 1], A[3 * c + 2]),
                    o += n.clone().cross(r).dot(a) / 6
                }
                return o
            }
        },
        minDistanceBetweenTriToMesh: function(A, e, t, i) {
            function o(A, e) {
                return new y(A.x - e.x,A.y - e.y,A.z - e.z)
            }
            function n(A, e) {
                return new y(A.x + e.x,A.y + e.y,A.z + e.z)
            }
            function r(A, e, t) {
                return new y(A.x + e.x * t,A.y + e.y * t,A.z + e.z * t)
            }
            function a(A, e) {
                return A.x * e.x + A.y * e.y + A.z * e.z
            }
            function s(A, e) {
                return new y(A.y * e.z - A.z * e.y,A.z * e.x - A.x * e.z,A.x * e.y - A.y * e.x)
            }
            function l(A, e, t, i) {
                var l, c = a(e, i), h = a(e, e), d = a(i, i), p = o(t, A), g = a(e, p), u = a(i, p), f = null;
                0 > (f = (g * d - u * c) / (h * d - c * c)) || isNaN(f) ? f = 0 : f > 1 && (f = 1);
                var m = null
                  , C = null
                  , y = null
                  , v = null;
                return 0 >= (l = (f * c - u) / d) || isNaN(l) ? (C = t,
                0 >= (f = g / h) || isNaN(f) ? (m = A,
                y = o(t, A)) : 1 > f ? (m = r(A, e, f),
                v = s(p, e),
                y = s(e, v)) : y = o(t, m = n(A, e))) : 1 > l ? (C = r(t, i, l),
                0 >= f || isNaN(f) ? (m = A,
                v = s(p, i),
                y = s(i, v)) : 1 > f ? (m = r(A, e, f),
                0 > a(y = s(e, i), p) && y.multiplyScalar(-1)) : (v = s(p = o(t, m = n(A, e)), i),
                y = s(i, v))) : (C = n(t, i),
                0 >= (f = (c + g) / h) || isNaN(f) ? (m = A,
                y = o(C, A)) : 1 > f ? (m = r(A, e, f),
                v = s(p = o(C, A), e),
                y = s(e, v)) : y = o(C, m = n(A, e))),
                {
                    vec: y,
                    closestP: m,
                    closestQ: C
                }
            }
            function c(A, e) {
                var t = null
                  , i = null
                  , n = []
                  , c = []
                  , h = null;
                n[0] = o(A[1], A[0]),
                n[1] = o(A[2], A[1]),
                n[2] = o(A[0], A[2]),
                c[0] = o(e[1], e[0]),
                c[1] = o(e[2], e[1]),
                c[2] = o(e[0], e[2]);
                for (var d = null, p = null, g = null, u = 0, f = A[0].distanceToSquared(e[0]) + 1, m = 0; 3 > m; m += 1)
                    for (var C = 0; 3 > C; C += 1) {
                        var y = l(A[m], n[m], e[C], c[C]);
                        h = y.vec;
                        var v = a(d = o(i = y.closestQ, t = y.closestP), d);
                        if (f >= v) {
                            p = t.clone(),
                            g = i.clone(),
                            f = v;
                            var I = a(o(A[(m + 2) % 3], t), h)
                              , E = a(o(e[(C + 2) % 3], i), h);
                            if (0 >= I && E >= 0)
                                return {
                                    start: t.clone(),
                                    end: i.clone(),
                                    minDistance: Math.sqrt(v)
                                };
                            0 > I && (I = 0),
                            E > 0 && (E = 0),
                            a(d, h) - I + E > 0 && (u = 1)
                        }
                    }
                var B = s(n[0], n[1])
                  , x = a(B, B);
                if (x > 1e-15) {
                    var S = [];
                    d = o(A[0], e[0]),
                    S[0] = a(d, B),
                    d = o(A[0], e[1]),
                    S[1] = a(d, B),
                    d = o(A[0], e[2]),
                    S[2] = a(d, B);
                    var w = -1;
                    if (S[0] > 0 && S[1] > 0 && S[2] > 0 ? S[w = S[1] > S[0] ? 0 : 1] > S[2] && (w = 2) : 0 > S[0] && 0 > S[1] && 0 > S[2] && S[2] > S[w = S[0] > S[1] ? 0 : 1] && (w = 2),
                    w >= 0 && (u = 1,
                    a(d = o(e[w], A[0]), s(B, n[0])) > 0 && a(d = o(e[w], A[1]), s(B, n[1])) > 0 && a(d = o(e[w], A[2]), s(B, n[2])) > 0))
                        return t = r(e[w], B, S[w] / x),
                        i = e[w].clone(),
                        {
                            start: t.clone(),
                            end: i,
                            minDistance: t.distanceTo(i)
                        }
                }
                var M = s(c[0], c[1])
                  , b = a(M, M);
                if (b > 1e-15) {
                    var U = [];
                    d = o(e[0], A[0]),
                    U[0] = a(d, M),
                    d = o(e[0], A[1]),
                    U[1] = a(d, M),
                    d = o(e[0], A[2]),
                    U[2] = a(d, M);
                    w = -1;
                    if (U[0] > 0 && U[1] > 0 && U[2] > 0 ? U[w = U[1] > U[0] ? 0 : 1] > U[2] && (w = 2) : 0 > U[0] && 0 > U[1] && 0 > U[2] && U[2] > U[w = U[0] > U[1] ? 0 : 1] && (w = 2),
                    w >= 0 && (u = 1,
                    a(d = o(A[w], e[0]), s(M, c[0])) > 0 && a(d = o(A[w], e[1]), s(M, c[1])) > 0 && a(d = o(A[w], e[2]), s(M, c[2])) > 0))
                        return {
                            start: t = A[w].clone(),
                            end: (i = r(A[w], M, U[w] / b)).clone(),
                            minDistance: t.distanceTo(i)
                        }
                }
                return u ? (t = p,
                i = g,
                {
                    start: p.clone(),
                    end: g.clone(),
                    minDistance: Math.sqrt(f)
                }) : {
                    start: p.clone(),
                    end: g.clone(),
                    minDistance: 0
                }
            }
            var h = new y
              , d = new y
              , p = new y;
            function g(A, e, t, i, o, n) {
                h.fromBufferAttribute(e, t),
                d.fromBufferAttribute(e, i),
                p.fromBufferAttribute(e, o),
                n && (h.applyMatrix4(n),
                d.applyMatrix4(n),
                p.applyMatrix4(n)),
                A.push(h),
                A.push(d),
                A.push(p)
            }
            for (var u = {
                start: null,
                end: null,
                minDistance: Number.POSITIVE_INFINITY
            }, f = e.geometry, m = f.attributes.position, C = t ? t.indexStart : 0, v = f.getIndex().array, I = C, E = t ? t.indexStart + t.indexCount : v.length; E > I; I += 3) {
                var B = [];
                g(B, m, v[I], v[I + 1], v[I + 2], i);
                var x = c(A, B);
                if (0 >= x.minDistance)
                    return u.minDistance = 0,
                    u.start = x.start.clone(),
                    u.end = x.end.clone(),
                    u;
                u.minDistance > x.minDistance && (u.minDistance = x.minDistance,
                u.start = x.start.clone(),
                u.end = x.end.clone())
            }
            return u
        },
        minDistanceBetweenTriToTri: function(A, e) {
            function t(A, e) {
                return new y(A.x - e.x,A.y - e.y,A.z - e.z)
            }
            function i(A, e) {
                return new y(A.x + e.x,A.y + e.y,A.z + e.z)
            }
            function o(A, e, t) {
                return new y(A.x + e.x * t,A.y + e.y * t,A.z + e.z * t)
            }
            function n(A, e) {
                return A.x * e.x + A.y * e.y + A.z * e.z
            }
            function r(A, e) {
                return new y(A.y * e.z - A.z * e.y,A.z * e.x - A.x * e.z,A.x * e.y - A.y * e.x)
            }
            function a(A, e, a, s) {
                var l, c = n(e, s), h = n(e, e), d = n(s, s), p = t(a, A), g = n(e, p), u = n(s, p), f = null;
                0 > (f = (g * d - u * c) / (h * d - c * c)) || isNaN(f) ? f = 0 : f > 1 && (f = 1);
                var m = null
                  , C = null
                  , y = null
                  , v = null;
                return 0 >= (l = (f * c - u) / d) || isNaN(l) ? (C = a,
                0 >= (f = g / h) || isNaN(f) ? (m = A,
                y = t(a, A)) : 1 > f ? (m = o(A, e, f),
                v = r(p, e),
                y = r(e, v)) : y = t(a, m = i(A, e))) : 1 > l ? (C = o(a, s, l),
                0 >= f || isNaN(f) ? (m = A,
                v = r(p, s),
                y = r(s, v)) : 1 > f ? (m = o(A, e, f),
                0 > n(y = r(e, s), p) && y.multiplyScalar(-1)) : (v = r(p = t(a, m = i(A, e)), s),
                y = r(s, v))) : (C = i(a, s),
                0 >= (f = (c + g) / h) || isNaN(f) ? (m = A,
                y = t(C, A)) : 1 > f ? (m = o(A, e, f),
                v = r(p = t(C, A), e),
                y = r(e, v)) : y = t(C, m = i(A, e))),
                {
                    vec: y,
                    closestP: m,
                    closestQ: C
                }
            }
            function s(A, e) {
                var i = null
                  , s = null
                  , l = []
                  , c = []
                  , h = null;
                l[0] = t(A[1], A[0]),
                l[1] = t(A[2], A[1]),
                l[2] = t(A[0], A[2]),
                c[0] = t(e[1], e[0]),
                c[1] = t(e[2], e[1]),
                c[2] = t(e[0], e[2]);
                for (var d = null, p = null, g = null, u = 0, f = A[0].distanceToSquared(e[0]) + 1, m = 0; 3 > m; m += 1)
                    for (var C = 0; 3 > C; C += 1) {
                        var y = a(A[m], l[m], e[C], c[C]);
                        h = y.vec;
                        var v = n(d = t(s = y.closestQ, i = y.closestP), d);
                        if (f >= v) {
                            p = i.clone(),
                            g = s.clone(),
                            f = v;
                            var I = n(t(A[(m + 2) % 3], i), h)
                              , E = n(t(e[(C + 2) % 3], s), h);
                            if (0 >= I && E >= 0)
                                return {
                                    start: i.clone(),
                                    end: s.clone(),
                                    minDistance: Math.sqrt(v)
                                };
                            0 > I && (I = 0),
                            E > 0 && (E = 0),
                            n(d, h) - I + E > 0 && (u = 1)
                        }
                    }
                var B = r(l[0], l[1])
                  , x = n(B, B);
                if (x > 1e-15) {
                    var S = [];
                    d = t(A[0], e[0]),
                    S[0] = n(d, B),
                    d = t(A[0], e[1]),
                    S[1] = n(d, B),
                    d = t(A[0], e[2]),
                    S[2] = n(d, B);
                    var w = -1;
                    if (S[0] > 0 && S[1] > 0 && S[2] > 0 ? S[w = S[1] > S[0] ? 0 : 1] > S[2] && (w = 2) : 0 > S[0] && 0 > S[1] && 0 > S[2] && S[2] > S[w = S[0] > S[1] ? 0 : 1] && (w = 2),
                    w >= 0 && (u = 1,
                    n(d = t(e[w], A[0]), r(B, l[0])) > 0 && n(d = t(e[w], A[1]), r(B, l[1])) > 0 && n(d = t(e[w], A[2]), r(B, l[2])) > 0))
                        return i = o(e[w], B, S[w] / x),
                        s = e[w].clone(),
                        {
                            start: i.clone(),
                            end: s,
                            minDistance: i.distanceTo(s)
                        }
                }
                var M = r(c[0], c[1])
                  , b = n(M, M);
                if (b > 1e-15) {
                    var U = [];
                    d = t(e[0], A[0]),
                    U[0] = n(d, M),
                    d = t(e[0], A[1]),
                    U[1] = n(d, M),
                    d = t(e[0], A[2]),
                    U[2] = n(d, M);
                    w = -1;
                    if (U[0] > 0 && U[1] > 0 && U[2] > 0 ? U[w = U[1] > U[0] ? 0 : 1] > U[2] && (w = 2) : 0 > U[0] && 0 > U[1] && 0 > U[2] && U[2] > U[w = U[0] > U[1] ? 0 : 1] && (w = 2),
                    w >= 0 && (u = 1,
                    n(d = t(A[w], e[0]), r(M, c[0])) > 0 && n(d = t(A[w], e[1]), r(M, c[1])) > 0 && n(d = t(A[w], e[2]), r(M, c[2])) > 0))
                        return {
                            start: i = A[w].clone(),
                            end: (s = o(A[w], M, U[w] / b)).clone(),
                            minDistance: i.distanceTo(s)
                        }
                }
                return u ? (i = p,
                s = g,
                {
                    start: p.clone(),
                    end: g.clone(),
                    minDistance: Math.sqrt(f)
                }) : {
                    start: p.clone(),
                    end: g.clone(),
                    minDistance: 0
                }
            }
            for (var l = {
                start: null,
                end: null,
                minDistance: Number.POSITIVE_INFINITY
            }, c = 0, h = A.length; h > c; c += 1)
                for (var d = 0, p = e.length; p > d; d += 1) {
                    var g = s(A[c], e[d]);
                    if (0 >= g.minDistance)
                        return l.minDistance = 0,
                        l.start = g.start.clone(),
                        l.end = g.end.clone(),
                        l;
                    l.minDistance > g.minDistance && (l.minDistance = g.minDistance,
                    l.start = g.start.clone(),
                    l.end = g.end.clone())
                }
            return l
        },
        calculateTheIntersectionOfGeometryAndPlane: function(A, e) {
            var t = A.getIndex().array
              , i = A.attributes.position
              , o = t.length
              , n = e.clone()
              , r = 0;
            -1 === n.normal.x ? r = 0 : 1 === n.normal.x ? (n.normal.x = -1,
            n.constant *= -1,
            r = 1) : -1 === n.normal.y ? r = 2 : 1 === n.normal.y ? (n.normal.y = -1,
            n.constant *= -1,
            r = 3) : -1 === n.normal.z ? r = 4 : 1 === n.normal.z && (n.normal.z = -1,
            n.constant *= -1,
            r = 5);
            for (var a, s, l, c, h, d, p, g, u = [], f = new Hs, m = 0, C = o; C > m; m += 3) {
                var v = [];
                a = v,
                s = i,
                l = t[m],
                c = t[m + 1],
                h = t[m + 2],
                d = new y,
                p = new y,
                g = new y,
                d.fromBufferAttribute(s, l),
                p.fromBufferAttribute(s, c),
                g.fromBufferAttribute(s, h),
                a.push(d),
                a.push(p),
                a.push(g);
                var I = v[0]
                  , E = v[1]
                  , B = v[2]
                  , x = !1
                  , S = !1
                  , w = !1;
                switch (r) {
                case 0:
                case 1:
                    x = n.constant > I.x,
                    S = n.constant > E.x,
                    w = n.constant > B.x;
                    break;
                case 2:
                case 3:
                    x = n.constant > I.y,
                    S = n.constant > E.y,
                    w = n.constant > B.y;
                    break;
                case 4:
                case 5:
                    x = n.constant > I.z,
                    S = n.constant > E.z,
                    w = n.constant > B.z
                }
                var M = null
                  , b = null;
                x ? S ? w || (f.set(B, E),
                (M = n.intersectLine(f, new y)) && u.push(M),
                f.set(B, I),
                (b = n.intersectLine(f, new y)) && u.push(b)) : w ? (f.set(E, B),
                (M = n.intersectLine(f, new y)) && u.push(M),
                f.set(E, I),
                (b = n.intersectLine(f, new y)) && u.push(b)) : (f.set(E, I),
                (M = n.intersectLine(f, new y)) && u.push(M),
                f.set(B, I),
                (b = n.intersectLine(f, new y)) && u.push(b)) : S ? w ? (f.set(I, E),
                (M = n.intersectLine(f, new y)) && u.push(M),
                f.set(I, B),
                (b = n.intersectLine(f, new y)) && u.push(b)) : (f.set(I, E),
                (M = n.intersectLine(f, new y)) && u.push(M),
                f.set(B, E),
                (b = n.intersectLine(f, new y)) && u.push(b)) : w && (f.set(I, B),
                (M = n.intersectLine(f, new y)) && u.push(M),
                f.set(E, B),
                (b = n.intersectLine(f, new y)) && u.push(b))
            }
            if (u.length >= 1) {
                for (var U = {}, F = [], K = [], Q = 0, R = u.length; R > Q; Q += 1) {
                    var T = u[Q].toArray(F).toString();
                    U[T] || (U[T] = []),
                    2 > U[T].length || (T = T + "_" + Math.floor(U[T].length / 2 + .6),
                    U[T] || (U[T] = [])),
                    U[T].push(Q),
                    K.push(T)
                }
                var k = []
                  , D = K[0];
                return k.push(u[0], u[1]),
                function A(e, t) {
                    var i = U[K[e]]
                      , o = i[0] === e ? i[1] : i[0]
                      , n = o % 2 ? o - 1 : o + 1;
                    if (t.push(u[n]),
                    K[n] !== D) {
                        if (isNaN(n))
                            return void (k = null);
                        A(n, t)
                    }
                }(1, k),
                k
            }
        },
        getShapeGeometryFromGeometryAndPlane: function(A, e) {
            var t = Tu.calculateTheIntersectionOfGeometryAndPlane(A, e);
            if (t) {
                var i = 0;
                -1 === e.normal.x ? i = 0 : 1 === e.normal.x ? i = 1 : -1 === e.normal.y ? i = 2 : 1 === e.normal.y ? i = 3 : -1 === e.normal.z ? i = 4 : 1 === e.normal.z && (i = 5);
                var o = []
                  , n = []
                  , r = []
                  , a = []
                  , l = [];
                A.boundingBox || A.computeBoundingBox();
                for (var c = A.boundingBox.getSize(new y), h = e.normal.x * c.x * 1e-4, d = e.normal.y * c.y * 1e-4, p = e.normal.z * c.z * 1e-4, g = 0, u = t.length; u > g; g += 1) {
                    var f = t[g]
                      , m = new s;
                    switch (n.push(f.x + h, f.y + d, f.z + p),
                    i) {
                    case 0:
                    case 1:
                        r.push(1, 0, 0),
                        a.push(f.y, f.z),
                        m.set(f.y, f.z);
                        break;
                    case 2:
                    case 3:
                        r.push(0, 1, 0),
                        a.push(f.x, f.z),
                        m.set(f.x, f.z);
                        break;
                    case 4:
                    case 5:
                        r.push(0, 0, 1),
                        a.push(f.x, f.y),
                        m.set(f.x, f.y)
                    }
                    l.push(m)
                }
                for (var C = Hn.triangulateShape(l, []), v = 0, I = C.length; I > v; v += 1) {
                    var E = C[v];
                    o.push(E[0], E[1], E[2])
                }
                var B = new he;
                return B.setIndex(o),
                B.setAttribute("position", new Ae(n,3)),
                B.setAttribute("normal", new Ae(r,3)),
                B.setAttribute("uv", new Ae(a,2)),
                B
            }
        }
    };
    Tu.getBoxMBuffer = function() {
        for (var A = null, e = null, t = [], i = [], o = [], n = 0, r = 0; 6 > r; r += 1) {
            var a = Tu.getBoxData(r);
            for (A = 0,
            e = a.vertex.length; e > A; A += 1)
                t.push(a.vertex[A]);
            for (A = 0,
            e = a.index.length; e > A; A += 1)
                o.push(a.index[A] + n);
            for (n += a.vertex.length / 3,
            A = 0,
            e = a.normal.length; e > A; A += 1)
                i.push(a.normal[A])
        }
        return function(A) {
            var e = null;
            if (A) {
                var n = new l
                  , r = new y;
                e = [];
                for (var a = 0; 6 > a; a += 1) {
                    var s = Tu.getBoxData(a);
                    n.set(A[6 * a], A[6 * a + 2], A[6 * a + 4], A[6 * a + 1], A[6 * a + 3], A[6 * a + 5], 0, 0, 1);
                    for (var c = 0, h = s.uv.length; h > c; c += 2)
                        r.set(s.uv[c], s.uv[c + 1], 1),
                        r.applyMatrix3(n),
                        e.push(r.x),
                        e.push(r.y)
                }
            }
            return {
                vertex: t,
                normal: i,
                uv: e,
                index: o
            }
        }
    }(),
    Tu.getPipeMBuffer = function() {
        var A = Tu.getPipeData(32)
          , e = A.edges
          , t = A.vertex
          , i = A.normal
          , o = A.index;
        return function(A) {
            var n = null;
            if (!(!A || 18 !== A.length)) {
                n = [];
                for (var r = [], a = 0, s = A.length / 6; s > a; a += 1) {
                    var c = new l;
                    c.set(A[6 * a], A[6 * a + 2], A[6 * a + 4], A[6 * a + 1], A[6 * a + 3], A[6 * a + 5], 0, 0, 1),
                    r.push(c)
                }
                for (var h = Tu.getPipeData(32), d = 4 * (e + 1), p = d + 2 * e, g = new y, u = 0, f = h.uv.length; f > u; u += 2)
                    g.set(h.uv[u], h.uv[u + 1], 1),
                    g.applyMatrix3(d > u ? r[0] : p > u ? r[1] : r[2]),
                    n.push(g.x),
                    n.push(g.y)
            }
            return {
                vertex: t,
                normal: i,
                uv: n,
                index: o
            }
        }
    }();
    var ku = {
        geoHeader: function(A) {
            var e = new Int32Array(A);
            this.geoCount = e[0],
            this.headerBuffer = e.slice(1, 4 * this.geoCount + 1)
        },
        GeometryReader: function(A, e) {
            Bh.time("GeometryReader"),
            this.geomMap = [],
            this.geoCount = new Uint32Array(A,0,1)[0];
            var t = this.geoCount
              , i = []
              , o = 0
              , n = null
              , r = null
              , a = null
              , s = null
              , l = null
              , c = null
              , h = null
              , d = 0
              , p = null
              , g = 0
              , u = null
              , f = 0
              , m = null
              , C = 0
              , y = null
              , v = 0
              , I = null;
            if (np(e, "2"))
                for (var E = 0; t > E; E += 1) {
                    if (i = {},
                    o = 4 * (1 + 7 * t),
                    r = (n = new Uint32Array(A,4 * (1 + 7 * E),7))[0],
                    a = n[2],
                    s = n[3],
                    l = n[4],
                    c = n[5],
                    h = n[6],
                    d = o + n[1],
                    p = new Float32Array(A.slice(d, 4 * a + d)),
                    g = 4 * a + d,
                    u = new Float32Array(A.slice(g, g + 4 * s)),
                    f = g + 4 * s,
                    m = new Uint32Array(A.slice(f, f + 4 * l)),
                    C = f + 4 * l,
                    y = new Float32Array(A.slice(C, C + 4 * c)),
                    v = C + 4 * c,
                    I = new Int16Array(A.slice(v, v + 2 * h)),
                    vc.DataReduction) {
                        var B = (new M).makeScale(.001, .001, .001);
                        Tu.applyMatrix4ToBuffer(B, p)
                    }
                    i.position = p,
                    i.normal = u,
                    i.index = m,
                    i.uv = y,
                    i.materialIndex = I,
                    i.geoId = r,
                    this.geomMap.push(i)
                }
            else
                for (var x = 0; t > x; x += 1)
                    i = {},
                    o = 4 * (1 + 6 * t),
                    r = (n = new Uint32Array(A,4 * (1 + 6 * x),6))[0],
                    a = n[2],
                    s = n[3],
                    l = n[4],
                    c = n[5],
                    d = o + n[1],
                    p = new Float32Array(A.slice(d, 4 * a + d)),
                    g = 4 * a + d,
                    u = new Float32Array(A.slice(g, g + 4 * s)),
                    f = g + 4 * s,
                    m = new Uint32Array(A.slice(f, f + 4 * l)),
                    C = f + 4 * l,
                    y = new Float32Array(A.slice(C, C + 4 * c)),
                    i.position = p,
                    i.normal = u,
                    i.index = m,
                    i.uv = y,
                    i.geoId = r,
                    this.geomMap.push(i);
            Bh.debug(this.geomMap),
            Bh.timeEnd("GeometryReader")
        },
        BatchedGeometryReader: function(A, e) {
            Bh.time("BatchedGeometryReader"),
            this.geomMap = [],
            this.geoCount = new Uint32Array(A,0,1)[0];
            for (var t = this.geoCount, i = 0, o = 0, n = 0, r = [], a = 4, s = 0; t > s; s += 1) {
                var l = {};
                r.push(l);
                var c = new Uint32Array(A,a,7);
                l.geoId = c[0],
                l.offset = c[1],
                l.vertexLength = c[2],
                l.normalLength = c[5],
                l.indicesLength = c[3],
                l.uvLength = c[4],
                l.componentCount = o = c[6],
                l.nodeInfo = [],
                a += 28;
                for (var h = 0; o > h; h += 1) {
                    var d = new Uint32Array(A,a,1)[0];
                    a += 4;
                    for (var p = 0; d > p; p += 1) {
                        var g = new Uint32Array(A,a,3);
                        a += 12,
                        l.nodeInfo.push(g)
                    }
                }
                l.materialKeyLength = new Uint32Array(A,a,1)[0],
                a += 4
            }
            for (var u = 0; t > u; u += 1) {
                var f = r[u]
                  , m = f.normalLength
                  , C = f.indicesLength
                  , y = f.uvLength;
                i = a + f.offset,
                n = 4 * f.vertexLength;
                var v = new Float32Array(A.slice(i, i + n));
                i += n,
                n = 4 * C;
                var I = new Uint32Array(A.slice(i, i + n));
                i += n,
                n = 4 * y;
                var E = new Float32Array(A.slice(i, i + n));
                i += n,
                n = 4 * m;
                var B = new Float32Array(A.slice(i, i + n));
                i += n,
                o = f.componentCount;
                for (var x = {}, S = 0, w = f.nodeInfo.length; w > S; S += 1) {
                    var b = f.nodeInfo[S];
                    n = 2 * b[0];
                    var U = uh.ab2str(new Int16Array(A.slice(i, i + n)));
                    i += n,
                    n = 2 * b[1];
                    var F = uh.ab2str(new Int16Array(A.slice(i, i + n)));
                    i += n;
                    var K = new Uint32Array(A.slice(i, i + 4))[0];
                    i += 4;
                    var Q = new Uint32Array(A.slice(i, i + 4))[0];
                    i += 4;
                    var R = new Uint32Array(A.slice(i, i + 4))[0];
                    i += 4;
                    var T = new Uint32Array(A.slice(i, i + 4))[0];
                    i += 4;
                    var k = {};
                    k.userId = U,
                    k.nodeId = F,
                    k.positionStart = K,
                    k.positionCount = Q,
                    k.indexStart = R,
                    k.indexCount = T,
                    x[U] || (x[U] = []),
                    x[U].push(k)
                }
                n = 2 * f.materialKeyLength;
                var D = uh.ab2str(new Int16Array(A.slice(i, i + n)));
                if (vc.DataReduction) {
                    var L = (new M).makeScale(.001, .001, .001);
                    Tu.applyMatrix4ToBuffer(L, v)
                }
                var N = {};
                N.position = v,
                N.normal = B,
                N.index = I,
                N.uv = E,
                N.materialIndex = null,
                N.geoId = f.geoId,
                N.materialKey = D,
                N.componentInfo = x,
                this.geomMap.push(N)
            }
            Bh.debug(this.geomMap),
            Bh.timeEnd("BatchedGeometryReader")
        },
        NodesReader: function(A, e) {
            Bh.time("NodesReader"),
            this.geomMap = [],
            this.nodeCount = new Uint32Array(A,0,1)[0];
            for (var t = this.nodeCount, i = 0, o = 0, n = [], r = 4, a = 0; t > a; a += 1) {
                var s = {};
                n.push(s);
                var l = new Uint32Array(A,r,5);
                s.geoId = l[0],
                s.offset = l[1],
                s.nodeIdLength = l[2],
                s.materialKeyLength = l[3],
                s.matrixLength = l[4],
                r += 20
            }
            for (var c = 0; t > c; c += 1) {
                var h = n[c]
                  , d = h.materialKeyLength
                  , p = h.matrixLength
                  , g = uh.ab2str(A.slice(i = r + h.offset, i + (o = h.nodeIdLength)))
                  , u = uh.ab2str(A.slice(i += o, i + (o = d)));
                i += o,
                o = 8 * p;
                var f = new Float64Array(A.slice(i, i + o));
                i += o;
                var m = {};
                m.nodeId = g,
                m.geoId = h.geoId,
                m.material = u,
                m.matrix = f,
                this.geomMap.push(m)
            }
            Bh.debug(this.geomMap),
            Bh.timeEnd("NodesReader")
        },
        InstancedGeometryReader: function(A, e) {
            Bh.time("InstancedGeometryReader"),
            this.geomMap = [],
            this.geoCount = new Uint32Array(A,0,1)[0];
            for (var t = this.geoCount, i = null, o = 0, n = 0, r = 0, a = [], s = 4, l = 0; t > l; l += 1) {
                var c = {};
                a.push(c),
                i = new Uint32Array(A,s,7),
                c.geoId = i[0],
                c.offset = i[1],
                c.vertexLength = i[2],
                c.normalLength = i[5],
                c.indicesLength = i[3],
                c.uvLength = i[4],
                c.componentCount = n = i[6],
                c.nodeInfo = {},
                s += 28;
                var h = [];
                c.componentKeyLength = h,
                c.matrixArrayLength = [];
                for (var d = 0; n > d; d += 1) {
                    h.push(new Uint32Array(A,s,1)[0]),
                    s += 4;
                    var p = new Uint32Array(A,s,1)[0];
                    s += 4,
                    c.nodeInfo[d] = [];
                    for (var g = 0; p > g; g += 1) {
                        var u = new Uint32Array(A,s,1)[0];
                        s += 4,
                        c.nodeInfo[d].push(u)
                    }
                }
                c.matrixArrayLength = new Uint32Array(A,s,1)[0],
                s += 4,
                c.materialKeyLength = new Uint32Array(A,s,1)[0],
                s += 4
            }
            for (var f = 0; t > f; f += 1) {
                var m = a[f]
                  , C = m.normalLength
                  , y = m.indicesLength
                  , v = m.uvLength;
                o = s + m.offset,
                r = 4 * m.vertexLength;
                var I = new Float32Array(A.slice(o, o + r));
                o += r,
                r = 4 * y;
                var E = new Uint32Array(A.slice(o, o + r));
                o += r,
                r = 4 * v;
                var B = new Float32Array(A.slice(o, o + r));
                o += r,
                r = 4 * C;
                var x = new Float32Array(A.slice(o, o + r));
                o += r;
                for (var S = {}, w = [], b = [], U = 0, F = 0, K = n = m.componentCount; K > F; F += 1) {
                    var Q = uh.ab2str(A.slice(o, o + (r = m.componentKeyLength[F])));
                    o += r,
                    b.push(Q),
                    S[Q] || (S[Q] = []);
                    for (var R = m.nodeInfo[F], T = 0, k = R.length; k > T; T += 1) {
                        var D = uh.ab2str(A.slice(o, o + (r = R[T])));
                        o += r,
                        S[Q].push(U),
                        w.push(D),
                        U += 1
                    }
                }
                r = 8 * m.matrixArrayLength;
                var L = new Float64Array(A.slice(o, o + r));
                o += r;
                var N = new Float64Array(A.slice(o, o + r));
                o += r;
                var O = new Float64Array(A.slice(o, o + r));
                o += r;
                var V = new Float64Array(A.slice(o, o + r))
                  , G = uh.ab2str(A.slice(o += r, o + (r = m.materialKeyLength)));
                o += r,
                r = 4 * w.length * 4;
                var P = new Float32Array(A.slice(o, o + r));
                if (o += r,
                vc.DataReduction) {
                    var q = (new M).makeScale(.001, .001, .001);
                    Tu.applyMatrix4ToBuffer(q, I)
                }
                var j = {};
                j.position = I,
                j.normal = x,
                j.index = E,
                j.uv = B,
                j.materialIndex = null,
                j.geoId = m.geoId,
                j.materialKey = G,
                j.componentInfo = S,
                j.mcol0 = L,
                j.mcol1 = N,
                j.mcol2 = O,
                j.mcol3 = V,
                j.color = P,
                j.nodeIdInfo = w,
                j.componentKeyInfo = b,
                this.geomMap.push(j)
            }
            Bh.debug(this.geomMap),
            Bh.timeEnd("InstancedGeometryReader")
        },
        BoneReader: function(A, e) {
            Bh.time("BoneReader"),
            this.boneMap = [],
            this.boneCount = new Uint32Array(A,0,1)[0];
            for (var t = this.boneCount, i = [], o = 0, n = null, r = null, a = null, s = null, l = null, c = null, h = 0, d = null, p = 0, g = null, u = 0, f = null, m = 0, C = [], y = "[]", v = 0; t > v; v += 1) {
                i = {},
                o = 4 * (1 + 5 * t),
                r = (n = new Uint32Array(A,4 * (1 + 5 * v),5))[0],
                a = n[2],
                s = n[3],
                l = n[3],
                c = n[4],
                h = o + n[1],
                d = new Float32Array(A.slice(h, 4 * a + h)),
                p = 4 * a + h,
                g = new Uint16Array(A.slice(p, p + 2 * s)),
                u = p + 2 * s,
                f = new Float32Array(A.slice(u, u + 4 * l)),
                m = u + 4 * l;
                var I = new Uint8Array(A.slice(m, m + c));
                y = mh.isIE11() ? uh.decodeUTF8(I) : new TextDecoder("utf-8").decode(I);
                try {
                    C = JSON.parse(y)
                } catch (A) {
                    Bh.error("解析name出错：", A)
                }
                i.offsetMatrix = d,
                i.skinIndex = g,
                i.skinWeight = f,
                i.name = C,
                i.geoId = r,
                this.boneMap.push(i)
            }
            Bh.debug(this.boneMap),
            Bh.time("BoneReader")
        }
    };
    ku.GeometryReader.prototype = {
        constructor: ku.GeometryReader,
        getPositionBuffer: function(A) {
            return this.geos[A].position
        },
        getIndexBuffer: function(A) {
            return this.geos[A].index
        },
        getNormalBuffer: function(A) {
            return this.geos[A].normal
        },
        getUVBuffer: function(A) {
            return []
        }
    };
    var Du = function(A, e) {
        if (this.materialMap = [],
        np(e, "2"))
            this.materialMap = A;
        else
            for (var t = this.materialCount = new Uint32Array(A,0,1)[0], i = 4 * (1 + 6 * t), o = 0; t > o; o += 1) {
                var n = new Uint32Array(A,4 * (1 + 6 * o),6)
                  , r = n[0]
                  , a = n[1]
                  , s = n[2]
                  , l = n[3]
                  , c = n[4]
                  , h = n[5]
                  , d = new Float32Array(A.slice(i + a, 4 * s + i + a))
                  , p = new Int16Array(A.slice(4 * s + i + a, 4 * s + i + a + 2 * l))
                  , g = new Uint8Array(A.slice(4 * s + i + a + 2 * l, 4 * s + i + a + 2 * l + c))
                  , u = 4 * s + i + a + 2 * l + c
                  , f = new Int16Array(A.slice(u, u + 2 * h))
                  , m = "[]";
                m = mh.isIE11() ? uh.decodeUTF8(g) : new TextDecoder("utf-8").decode(g);
                var C = [];
                try {
                    C = JSON.parse(m)
                } catch (A) {
                    Bh.error("解析纹理出错：", A)
                }
                var y = {};
                y.matId = r,
                y.color = d,
                y.colorIndex = p,
                y.texture = C,
                y.textureIndex = f,
                this.materialMap.push(y)
            }
        Bh.debug(this.materialMap)
    }
      , Lu = {
        geoHeader: function(A) {
            var e = new Int32Array(A);
            this.geoCount = e[0],
            this.headerBuffer = e.slice(1, 4 * this.geoCount + 1)
        },
        GeometryReader: function(A, e) {
            this.geomMap = [],
            this.geoCount = new Uint32Array(A,0,1)[0];
            for (var t = this.geoCount, i = [], o = 0, n = null, r = null, a = null, s = null, l = 0, c = null, h = null, d = 0, p = 0; t > p; p += 1)
                i = {},
                o = 4 * (1 + 4 * t),
                r = (n = new Uint32Array(A,4 * (1 + 4 * p),4))[0],
                a = n[3],
                s = n[2],
                l = o + n[1],
                h = new Uint32Array(A.slice(l, l + 4 * s)),
                d = l + 4 * s,
                c = new Float32Array(A.slice(d, 4 * a + d)),
                i.position = c,
                i.index = h,
                i.geoId = r,
                this.geomMap.push(i);
            Bh.debug(this.geomMap)
        },
        BoneReader: function(A, e) {
            this.boneMap = [],
            this.boneCount = new Uint32Array(A,0,1)[0];
            for (var t = this.boneCount, i = [], o = 0, n = null, r = null, a = null, s = null, l = null, c = null, h = 0, d = null, p = 0, g = null, u = 0, f = null, m = 0, C = [], y = "[]", v = 0; t > v; v += 1) {
                i = {},
                o = 4 * (1 + 5 * t),
                r = (n = new Uint32Array(A,4 * (1 + 5 * v),5))[0],
                a = n[2],
                s = n[3],
                l = n[3],
                c = n[4],
                h = o + n[1],
                d = new Float32Array(A.slice(h, 4 * a + h)),
                p = 4 * a + h,
                g = new Uint16Array(A.slice(p, p + 2 * s)),
                u = p + 2 * s,
                f = new Float32Array(A.slice(u, u + 4 * l)),
                m = u + 4 * l;
                var I = new Uint8Array(A.slice(m, m + c));
                y = mh.isIE11() ? uh.decodeUTF8(I) : new TextDecoder("utf-8").decode(I);
                try {
                    C = JSON.parse(y)
                } catch (A) {
                    Bh.error("解析name出错：", A)
                }
                i.offsetMatrix = d,
                i.skinIndex = g,
                i.skinWeight = f,
                i.name = C,
                i.geoId = r,
                this.boneMap.push(i)
            }
            Bh.debug(this.boneMap)
        }
    };
    Lu.GeometryReader.prototype = {
        constructor: Lu.GeometryReader,
        getPositionBuffer: function(A) {
            return this.geos[A].position
        },
        getIndexBuffer: function(A) {
            return this.geos[A].index
        },
        getNormalBuffer: function(A) {
            return this.geos[A].normal
        },
        getUVBuffer: function(A) {
            return []
        }
    };
    var Nu = function(A) {
        this.MaxThreadCount = A || 8,
        this.todoList = [],
        this.doingCount = 0,
        this.addItem = function(A) {
            void 0 !== A && this.todoList.push(A)
        }
        ,
        this.run = function(A, e, t) {
            if (0 >= this.doingCount)
                if (0 !== this.todoList.length) {
                    var i = this.todoList
                      , o = i.length;
                    this.todoList = [],
                    this.doingCount = o;
                    for (var n = Math.min(this.MaxThreadCount, vc.ConcurrencyRequestCount, o), r = this, a = 0; n > a; a += 1)
                        s(a)
                } else
                    t();
            function s(a) {
                o > a ? (e(r.doingCount, o),
                A(i[a], a + n, s)) : 1 > r.doingCount && (r.run(A, e, t),
                e(r.doingCount, o),
                t())
            }
        }
    }
      , Ou = function(A, e) {
        this.type = e,
        this.manager = A,
        this.worker = new Nu(4),
        this.working = !0
    };
    function Vu(A, e, t, i) {
        for (var o = function(A, e) {
            var t = void 0;
            t = "Line" === e || "LineSegments" === e ? new Ba : new Ja;
            for (var i = new s, o = new s, n = new s, r = !0, a = !1, l = A.match(/[a-df-z][^a-df-z]*/gi), c = 0, h = l.length; h > c; c++) {
                var d = l[c]
                  , p = (e = d.charAt(0),
                d.substr(1).trim());
                switch (!0 === r && (a = !0,
                r = !1),
                e) {
                case "M":
                    for (var g = Gu(p), u = 0, f = g.length; f > u; u += 2)
                        i.x = g[u + 0],
                        i.y = g[u + 1],
                        o.x = i.x,
                        o.y = i.y,
                        0 === u ? t.moveTo(i.x, i.y) : t.lineTo(i.x, i.y),
                        0 === u && !0 === a && n.copy(i);
                    break;
                case "H":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u++)
                        i.x = g[u],
                        o.x = i.x,
                        o.y = i.y,
                        t.lineTo(i.x, i.y),
                        0 === u && !0 === a && n.copy(i);
                    break;
                case "V":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u++)
                        i.y = g[u],
                        o.x = i.x,
                        o.y = i.y,
                        t.lineTo(i.x, i.y),
                        0 === u && !0 === a && n.copy(i);
                    break;
                case "L":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u += 2)
                        i.x = g[u + 0],
                        i.y = g[u + 1],
                        o.x = i.x,
                        o.y = i.y,
                        t.lineTo(i.x, i.y),
                        0 === u && !0 === a && n.copy(i);
                    break;
                case "C":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u += 6)
                        t.bezierCurveTo(g[u + 0], g[u + 1], g[u + 2], g[u + 3], g[u + 4], g[u + 5]),
                        o.x = g[u + 2],
                        o.y = g[u + 3],
                        i.x = g[u + 4],
                        i.y = g[u + 5],
                        0 === u && !0 === a && n.copy(i);
                    break;
                case "S":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u += 4)
                        t.bezierCurveTo(Pu(i.x, o.x), Pu(i.y, o.y), g[u + 0], g[u + 1], g[u + 2], g[u + 3]),
                        o.x = g[u + 0],
                        o.y = g[u + 1],
                        i.x = g[u + 2],
                        i.y = g[u + 3],
                        0 === u && !0 === a && n.copy(i);
                    break;
                case "Q":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u += 4)
                        t.quadraticCurveTo(g[u + 0], g[u + 1], g[u + 2], g[u + 3]),
                        o.x = g[u + 0],
                        o.y = g[u + 1],
                        i.x = g[u + 2],
                        i.y = g[u + 3],
                        0 === u && !0 === a && n.copy(i);
                    break;
                case "T":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u += 2) {
                        var m = Pu(i.x, o.x)
                          , C = Pu(i.y, o.y);
                        t.quadraticCurveTo(m, C, g[u + 0], g[u + 1]),
                        o.x = m,
                        o.y = C,
                        i.x = g[u + 0],
                        i.y = g[u + 1],
                        0 === u && !0 === a && n.copy(i)
                    }
                    break;
                case "A":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u += 7) {
                        var y = i.clone();
                        i.x = g[u + 5],
                        i.y = g[u + 6],
                        o.x = i.x,
                        o.y = i.y,
                        qu(t, g[u], g[u + 1], g[u + 2], g[u + 3], g[u + 4], y, i),
                        0 === u && !0 === a && n.copy(i)
                    }
                    break;
                case "m":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u += 2)
                        i.x += g[u + 0],
                        i.y += g[u + 1],
                        o.x = i.x,
                        o.y = i.y,
                        0 === u ? t.moveTo(i.x, i.y) : t.lineTo(i.x, i.y),
                        0 === u && !0 === a && n.copy(i);
                    break;
                case "h":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u++)
                        i.x += g[u],
                        o.x = i.x,
                        o.y = i.y,
                        t.lineTo(i.x, i.y),
                        0 === u && !0 === a && n.copy(i);
                    break;
                case "v":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u++)
                        i.y += g[u],
                        o.x = i.x,
                        o.y = i.y,
                        t.lineTo(i.x, i.y),
                        0 === u && !0 === a && n.copy(i);
                    break;
                case "l":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u += 2)
                        i.x += g[u + 0],
                        i.y += g[u + 1],
                        o.x = i.x,
                        o.y = i.y,
                        t.lineTo(i.x, i.y),
                        0 === u && !0 === a && n.copy(i);
                    break;
                case "c":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u += 6)
                        t.bezierCurveTo(i.x + g[u + 0], i.y + g[u + 1], i.x + g[u + 2], i.y + g[u + 3], i.x + g[u + 4], i.y + g[u + 5]),
                        o.x = i.x + g[u + 2],
                        o.y = i.y + g[u + 3],
                        i.x += g[u + 4],
                        i.y += g[u + 5],
                        0 === u && !0 === a && n.copy(i);
                    break;
                case "s":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u += 4)
                        t.bezierCurveTo(Pu(i.x, o.x), Pu(i.y, o.y), i.x + g[u + 0], i.y + g[u + 1], i.x + g[u + 2], i.y + g[u + 3]),
                        o.x = i.x + g[u + 0],
                        o.y = i.y + g[u + 1],
                        i.x += g[u + 2],
                        i.y += g[u + 3],
                        0 === u && !0 === a && n.copy(i);
                    break;
                case "q":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u += 4)
                        t.quadraticCurveTo(i.x + g[u + 0], i.y + g[u + 1], i.x + g[u + 2], i.y + g[u + 3]),
                        o.x = i.x + g[u + 0],
                        o.y = i.y + g[u + 1],
                        i.x += g[u + 2],
                        i.y += g[u + 3],
                        0 === u && !0 === a && n.copy(i);
                    break;
                case "t":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u += 2) {
                        m = Pu(i.x, o.x),
                        C = Pu(i.y, o.y);
                        t.quadraticCurveTo(m, C, i.x + g[u + 0], i.y + g[u + 1]),
                        o.x = m,
                        o.y = C,
                        i.x = i.x + g[u + 0],
                        i.y = i.y + g[u + 1],
                        0 === u && !0 === a && n.copy(i)
                    }
                    break;
                case "a":
                    for (g = Gu(p),
                    u = 0,
                    f = g.length; f > u; u += 7) {
                        y = i.clone();
                        i.x += g[u + 5],
                        i.y += g[u + 6],
                        o.x = i.x,
                        o.y = i.y,
                        qu(t, g[u], g[u + 1], g[u + 2], g[u + 3], g[u + 4], y, i),
                        0 === u && !0 === a && n.copy(i)
                    }
                    break;
                case "Z":
                case "z":
                    t.currentPath.autoClose = !0,
                    t.currentPath.curves.length > 0 && (i.copy(n),
                    t.currentPath.currentPoint.copy(i),
                    r = !0);
                    break;
                default:
                    console.warn(d)
                }
                a = !1
            }
            return t
        }(A), n = "Shape" === o.type ? [o] : o.toShapes(!0), r = new H, a = 0; n.length > a; a++) {
            var l = n[a];
            if ("Line" === e || "LineSegments" === e) {
                for (var c = l.getPoints(), h = 0; c.length > h; h += 1) {
                    var d = c[h];
                    d.y = -d.y,
                    i && (d.z = i)
                }
                if ("LineSegments" === e) {
                    var p = new jo((new De).setFromPoints(c),t);
                    r.add(p)
                } else if ("Line" === e) {
                    var g = new Go((new De).setFromPoints(c),t);
                    r.add(g)
                }
            } else if ("Mesh" === e) {
                for (var u = new ar(l), f = u.getAttribute("position"), m = f.array, C = 0, y = m.length; y > C; C += 3)
                    m[C + 1] = -m[C + 1],
                    m[C + 2] = i;
                f.needsUpdate = !0;
                var v = new Ue(u,t);
                r.add(v)
            }
        }
        return r
    }
    function Gu(A) {
        for (var e = A.split(/[\s,]+|(?=\s?[+\-])/), t = 0; e.length > t; t += 1) {
            var i = e[t];
            if (i.indexOf(".") !== i.lastIndexOf("."))
                for (var o = i.split("."), n = 2; o.length > n; n += 1)
                    e.splice(t + n - 1, 0, "0." + o[n]);
            e[t] = parseFloat(i)
        }
        return e
    }
    function Pu(A, e) {
        return A - (e - A)
    }
    function qu(A, e, t, i, o, n, r, a) {
        i = i * Math.PI / 180,
        e = Math.abs(e),
        t = Math.abs(t);
        var s = (r.x - a.x) / 2
          , l = (r.y - a.y) / 2
          , c = Math.cos(i) * s + Math.sin(i) * l
          , h = -Math.sin(i) * s + Math.cos(i) * l
          , d = e * e
          , p = t * t
          , g = c * c
          , u = h * h
          , f = g / d + u / p;
        if (f > 1) {
            var m = Math.sqrt(f);
            d = (e *= m) * e,
            p = (t *= m) * t
        }
        var C = d * u + p * g
          , y = Math.sqrt(Math.max(0, (d * p - C) / C));
        o === n && (y = -y);
        var v = y * e * h / t
          , I = -y * t * c / e
          , E = Math.cos(i) * v - Math.sin(i) * I + (r.x + a.x) / 2
          , B = Math.sin(i) * v + Math.cos(i) * I + (r.y + a.y) / 2
          , x = svgAngle(1, 0, (c - v) / e, (h - I) / t)
          , S = svgAngle((c - v) / e, (h - I) / t, (-c - v) / e, (-h - I) / t) % (2 * Math.PI);
        A.currentPath.absellipse(E, B, e, t, x, x + S, 0 === n, i)
    }
    function ju(A) {
        this.group = A;
        var e = new LA(16711680);
        this._lineMaterial = new ko({
            color: e,
            side: 2
        }),
        this._meshMaterial = new jA({
            color: e,
            side: 2
        })
    }
    function Hu() {
        this.axisNet = void 0,
        this.visibleByUser = !1
    }
    Ou.prototype = {
        constructor: Ou,
        addTask: function(A) {
            this.worker.addItem(A)
        },
        processTasks: function(A, e, t) {
            var i = this
              , o = this.worker;
            this.worker.run((function(e, t, n) {
                i.working && A(e, (function() {
                    o.doingCount -= 1,
                    n(t)
                }
                ))
            }
            ), e = e || function() {}
            , t = t || function() {}
            )
        },
        stop: function() {
            this.working = !1
        },
        start: function() {
            this.working = !0
        }
    },
    ju.prototype.fromJSON = function(A, e) {
        for (var t in A)
            if (A.hasOwnProperty(t)) {
                var i = A[t];
                for (var o in i)
                    if (i.hasOwnProperty(o)) {
                        var n = i[o]
                          , r = n.G.Path;
                        if (r && r.length > 0) {
                            var a = n.P.matrix || [0, 0];
                            if (n.P.Type && "LINE" === n.P.Type) {
                                for (var s = "", l = 0, c = r.length; c > l; l += 1)
                                    s += r[l];
                                var h = Vu(s, "LineSegments", this._lineMaterial, e);
                                h.position.setX(a[0]),
                                h.position.setY(-a[1]),
                                this.group.add(h),
                                h.updateMatrixWorld(!0)
                            } else
                                for (var d = 0, p = r.length; p > d; d += 1) {
                                    var g = void 0
                                      , u = Vu(r[d], g = n.G.Fill && n.G.Fill.length === p && 0 !== n.G.Fill[d].length ? "Mesh" : "Line", "Line" === g ? this._lineMaterial : this._meshMaterial, e);
                                    u.position.setX(a[0]),
                                    u.position.setY(-a[1]),
                                    this.group.add(u),
                                    u.updateMatrixWorld(!0)
                                }
                        }
                    }
            }
    }
    ,
    ju.prototype.setColor = function(A, e) {
        if (A) {
            var t = new LA(A);
            this._lineMaterial.color = t,
            e && (this._lineMaterial.opacity = e,
            this._lineMaterial.transparent = 1 !== e),
            this._meshMaterial.color = t,
            e && (this._meshMaterial.opacity = e,
            this._meshMaterial.transparent = 1 !== e),
            this._lineMaterial.needsUpdate = !0,
            this._meshMaterial.needsUpdate = !0
        }
    }
    ,
    ju.prototype.enableStayInFront = function() {
        this._lineMaterial.transparent = !0,
        this._meshMaterial.transparent = !0,
        this._lineMaterial.depthTest = !1,
        this._meshMaterial.depthTest = !1
    }
    ,
    ju.prototype.disableStayInFront = function() {
        this._lineMaterial.transparent = !1,
        this._meshMaterial.transparent = !1,
        this._lineMaterial.depthTest = !0,
        this._meshMaterial.depthTest = !0
    }
    ,
    Hu.prototype.setupColor = function(A, e) {
        A && this.axisNet.setColor(A, e)
    }
    ,
    Hu.prototype.hide = function() {
        this.axisNet && (this.visibleByUser = !1,
        this.axisNet.group.visible = !1)
    }
    ,
    Hu.prototype.show = function() {
        this.axisNet && (this.visibleByUser = !0,
        this.axisNet.group.visible = !0)
    }
    ,
    Hu.prototype.privateShow = function() {
        this.axisNet && (this.axisNet.group.visible = !0)
    }
    ,
    Hu.prototype.privateHide = function() {
        this.axisNet && (this.axisNet.group.visible = !1)
    }
    ,
    Hu.prototype.enableStayInFront = function() {
        this.axisNet.enableStayInFront()
    }
    ,
    Hu.prototype.disableStayInFront = function() {
        this.axisNet.disableStayInFront()
    }
    ;
    var Yu = function() {
        this.name = "",
        this.componentkeys = [],
        this.box = void 0,
        this.center = void 0,
        this.map = void 0
    }
      , Wu = function() {
        this.name = "",
        this.image = void 0,
        this.width = 0,
        this.height = 0,
        this.sceneWidth = 0,
        this.sceneHeight = 0,
        this.box = {
            x1: 0,
            y1: 0,
            z1: 0,
            x2: 0,
            y2: 0,
            z2: 0,
            offsetX: 0,
            offsetY: 0
        },
        this.componentKeys = void 0
    };
    Wu.prototype.clone = function() {
        var A = new Wu;
        return A.name = this.name,
        A.image = this.image,
        A.width = this.width,
        A.height = this.height,
        A.sceneWidth = this.sceneWidth,
        A.sceneHeight = this.sceneHeight,
        A.box = Object.assign({}, this.box),
        A.componentKeys = this.componentKeys ? [].concat(this.componentKeys) : void 0,
        A
    }
    ,
    Yu.parseFloorInfos = function(A) {
        for (var e = [], t = Object.keys(A), i = 0, o = t.length; o > i; i += 1) {
            var n = A[t[i]];
            if (n.length > 0) {
                var r = new Yu;
                r.componentkeys = n,
                r.name = t[i],
                e.push(r)
            }
        }
        if (e.length > 0)
            return e
    }
    ;
    var Ju = function() {
        this.floors = void 0,
        this.sortedFloors = void 0,
        this.factor = 1,
        this.baseFloorIndex = -1,
        this.averageHeight = 0,
        this.center = void 0
    }
      , zu = function() {
        function A() {
            cc(this, A),
            this.floors = void 0,
            this.floorExplosionInfo = void 0,
            this.modelType = void 0,
            this.modelKey = void 0,
            this.revitFilter = {
                OST_CeilingOpening: !0,
                OST_FloorOpening: !0,
                OST_RoofOpening: !0,
                OST_Walls: !0,
                OST_StructuralFraming: !0,
                OST_CurtainWallPanels: !0,
                OST_CurtainWallMullions: !0,
                OST_CurtaSystem: !0,
                OST_ShaftOpening: !0
            },
            this.ifcFilter = {
                IfcWallStandardCase: !0,
                IfcWall: !0,
                IfcCurtainWall: !0,
                IfcBeam: !0,
                IfcMember: !0
            }
        }
        return dc(A, [{
            key: "generateMiniMap",
            value: function(A) {
                var e = this;
                if ((this.modelType === Zc.RVT || this.modelType === Zc.IFC || this.modelType === Zc.MERGE) && this.floors && this.floors.length > 0) {
                    var t = vc.MiniMapSize
                      , i = t
                      , o = A.rendererManager.renderer
                      , n = new s(t,i)
                      , r = new g(n.x,n.y,{
                        stencilBuffer: !1
                    });
                    o.setRenderTarget(r);
                    var a = new p
                      , l = o.getPixelRatio();
                    o.getViewport(a),
                    o.setPixelRatio(1),
                    o.setViewport(0, 0, n.width, n.height);
                    var c = A.getScene()
                      , h = new y
                      , d = new y
                      , u = A.getModel(this.modelKey).getBoundingBoxWorld();
                    u.getCenter(h),
                    u.getSize(d);
                    var f = Math.ceil(Math.max(d.x, d.y))
                      , m = f / 2
                      , C = new y(f,f,d.z);
                    u.setFromCenterAndSize(h, C);
                    var v = new Ka;
                    v.up.set(0, 1, 0),
                    v.position.set(h.x, h.y, u.max.z),
                    v.lookAt(h.x, h.y, u.min.z),
                    v.left = -m,
                    v.right = m,
                    v.top = m,
                    v.bottom = -m,
                    v.near = 1,
                    v.far = d.z,
                    v.updateMatrixWorld(!0),
                    v.updateProjectionMatrix();
                    var I = document.createElement("canvas");
                    I.width = n.width,
                    I.height = n.height;
                    var E = I.getContext("2d")
                      , B = new Uint8Array(n.width * n.height * 4)
                      , x = A.getFilter();
                    this.floors.forEach((function(a) {
                        var s = e.findSpecificKeys(a.componentkeys, A);
                        0 === s.length && (s = a.componentkeys);
                        var l = A.getBoundingBoxByIds(s);
                        l.getCenter(h),
                        l.getSize(d);
                        var p = new Wu;
                        p.box.x1 = l.min.x,
                        p.box.y1 = l.min.y,
                        p.box.z1 = l.min.z,
                        p.box.x2 = l.max.x,
                        p.box.y2 = l.max.y,
                        p.box.z2 = l.max.z,
                        p.box.offsetX = l.min.x - u.min.x,
                        p.box.offsetY = l.min.y - u.min.y,
                        p.width = t,
                        p.height = i,
                        p.sceneWidth = f,
                        p.sceneHeight = f,
                        p.name = a.name,
                        p.componentKeys = s,
                        a.map = p,
                        x.setIsolateList(s, !0),
                        A.modelManager.applyFilter(),
                        o.render(c, v),
                        o.readRenderTargetPixels(r, 0, 0, n.width, n.height, B);
                        for (var g = i / 2, m = 4 * t, C = new Uint8Array(4 * t), y = 0; g > y; y += 1) {
                            var S = y * m
                              , w = (i - y - 1) * m;
                            C.set(B.subarray(S, S + m)),
                            B.copyWithin(S, w, w + m),
                            B.set(C, w)
                        }
                        var M = new Uint8ClampedArray(B.buffer)
                          , b = new ImageData(M,n.width,n.height);
                        E.putImageData(b, 0, 0),
                        p.image = I.toDataURL()
                    }
                    )),
                    x.clearIsolation(),
                    o.setRenderTarget(null),
                    o.setPixelRatio(l),
                    o.setViewport(a.x, a.y, a.width, a.height)
                }
            }
        }, {
            key: "findSpecificKeys",
            value: function(A, e) {
                for (var t = [], i = 0, o = A.length; o > i; i += 1) {
                    var n = e.modelManager.getComponent(A[i]);
                    if (n && n.length > 0) {
                        var r = n[0]
                          , a = r.buildInCategory
                          , s = r.type;
                        (a && this.revitFilter[a] || s && this.ifcFilter[s]) && t.push(A[i])
                    }
                }
                return t
            }
        }, {
            key: "getMimiMaps",
            value: function() {
                if (this.serverMapData)
                    return {
                        msg: "success",
                        data: this.serverMapData.data
                    };
                if (this.floors && this.floors.length > 0) {
                    for (var A = [], e = 0, t = this.floors.length; t > e; e += 1) {
                        var i = this.floors[e].map;
                        i && A.push(i.clone())
                    }
                    if (A.length > 0)
                        return {
                            msg: "success",
                            data: A
                        }
                }
                return {
                    msg: "该模型不支持小地图"
                }
            }
        }, {
            key: "getServerMimiMaps",
            value: function(A) {
                var e = this.model.dataUrl.floorMapUrl()
                  , t = this.model.accessToken
                  , i = this;
                if (this.floors && this.floors.length > 0)
                    if (this.serverMapData)
                        A({
                            msg: "success",
                            data: i.serverMapData.data
                        });
                    else {
                        var o = {
                            url: e,
                            success: function(e) {
                                var t;
                                "SUCCESS" === (t = "string" == typeof e ? JSON.parse(e) : e).code ? (i.serverMapData = t,
                                A({
                                    msg: "success",
                                    data: t.data
                                })) : "FAILURE" === t.code ? setTimeout((function() {
                                    i.getServerMimiMaps(A)
                                }
                                ), 3e3) : A({
                                    msg: "获取模型小地图出错"
                                })
                            },
                            error: function() {
                                A({
                                    msg: "该模型不支持小地图"
                                })
                            }
                        };
                        t && (o.headers = {
                            Authorization: t
                        }),
                        _d(o)
                    }
            }
        }]),
        A
    }()
      , Zu = function() {
        this.leftChild = null,
        this.rightChild = null,
        this.boundingBox = null,
        this.level = -1,
        this.components = []
    };
    Zu.prototype.init = function(A) {
        if (A && (void 0 !== A.axis && (this.level = A.axis),
        A.left && (this.leftChild = new Zu,
        this.leftChild.init(A.left[0] ? A.left[0] : A.left)),
        A.right && (this.rightChild = new Zu,
        this.rightChild.init(A.right[0] ? A.right[0] : A.right)),
        A.box && !A.items && (this.boundingBox = new aA((new y).fromArray(A.box.min),(new y).fromArray(A.box.max))),
        A.items))
            for (var e = 0; A.items.length > e; e += 1)
                this.components.push(A.items[e].key)
    }
    ,
    Zu.prototype.intersect = function(A, e) {
        if (this.boundingBox) {
            if (!1 === A.intersectsBox(this.boundingBox))
                return;
            this.leftChild && this.leftChild.intersect(A, e),
            this.rightChild && this.rightChild.intersect(A, e);
            for (var t = 0; this.components.length > t; t += 1)
                e.push(this.components[t])
        } else
            for (var i = 0; this.components.length > i; i += 1)
                e.push(this.components[i])
    }
    ,
    Zu.prototype.frustumIntersect = function(A, e, t) {
        if (this.boundingBox) {
            var i = this.boundingBox;
            if (t && !t.equals(Bc) && (i = this.boundingBox.clone()).applyMatrix4(t),
            !1 === A.intersectsBox(i))
                return;
            this.leftChild && this.leftChild.frustumIntersect(A, e, t),
            this.rightChild && this.rightChild.frustumIntersect(A, e, t);
            for (var o = 0; this.components.length > o; o += 1)
                e.push(this.components[o])
        } else
            for (var n = 0; this.components.length > n; n += 1)
                e.push(this.components[n])
    }
    ,
    Zu.prototype.destroy = function() {
        this.leftChild && this.leftChild.destroy(),
        this.rightChild && this.rightChild.destroy(),
        this.leftChild = null,
        this.rightChild = null,
        this.boundingBox = null,
        this.level = -1,
        this.components = []
    }
    ;
    var Xu = function(A) {
        jr.call(this),
        this.handler = A,
        this.model = A.model,
        this.dataVersion = this.model.dataVersion,
        this.storage = this.model.getStorage(),
        this.url = A.model.dataUrl,
        this.offLine = A.model.offLine,
        this.fileLoader = A.model.fileLoader,
        this.descriptor = null,
        this.loader = new bu(this),
        this.Textureloader = new bu(this),
        this.jsonLoader = new bu(this),
        this.loadTaskCount = 0,
        this.maxLoadTaskCount = 0,
        this.loadTextureCount = 0,
        this.maxLoadTextureCount = 0,
        this.textruesLoaded = !1,
        this.dataLoaded = !1,
        this.taskComponentManager = new Ou(this,"component"),
        this.taskReuseNodeManager = new Ou(this,"component"),
        this.taskGeometrieManager = new Ou(this,"geometrie"),
        this.taskComponentNodeManager = new Ou(this,"nodes"),
        this.taskMaterialManager = new Ou(this,"material"),
        this.taskTexturesManager = new Ou(this,"textures"),
        this.fileKeyFromModelKey = {},
        this.enableCompressedTexture = !1,
        this.enableSmallTexture = !1,
        this.startCallback = null,
        this.progressCallback = null,
        this.finishCallback = null,
        this.progress = {
            total: 0,
            loaded: 0,
            failed: 0
        },
        this.requests = {}
    };
    Xu.prototype.destroy = function() {
        for (var A in this.requests)
            this.requests.hasOwnProperty(A) && (this.requests[A].abort && this.requests[A].abort(),
            delete this.requests[A]);
        this.taskComponentManager.stop(),
        this.taskComponentManager = null,
        this.taskGeometrieManager.stop(),
        this.taskGeometrieManager = null,
        this.taskMaterialManager.stop(),
        this.taskMaterialManager = null,
        this.taskTexturesManager.stop(),
        this.taskTexturesManager = null,
        this.url = null,
        this.model = null,
        this.fileLoader = null,
        this.descriptor = null,
        this.handler = null,
        this.startCallback = null,
        this.progressCallback = null,
        this.finishCallback = null,
        this.descriptor && this.descriptor.destroy()
    }
    ,
    Xu.prototype.getStorage = function() {
        return this.storage
    }
    ,
    Xu.prototype.getDescriptor = function() {
        return this.descriptor
    }
    ,
    Xu.prototype.setNotifyProgress = function(A) {
        this.notifyProgress = A
    }
    ,
    Xu.prototype.load = function(A, e, t) {
        this.startCallback = A,
        this.progressCallback = e,
        this.finishCallback = t,
        this.loadData()
    }
    ,
    Xu.prototype.loadData = function() {
        var A = this.model
          , e = A.getConfig()
          , t = e.scene
          , i = e.animation;
        if (!t || !t.components || !t.geometries && (!t.batchedGeometries && !t.instancedGeometries || 1 > t.batchedGeometries.length && 1 > t.instancedGeometries.length) || !t.materials || !t.textures)
            return A.setEmptyScene(!0),
            Bh.error("scene is null,modelKey is ", A.modelKey),
            void A.dispatchEventEx({
                type: Rc.ON_LOAD_EMPTY_SCENE,
                modelKey: A.modelKey
            });
        var o = 0
          , n = 0
          , r = 0
          , a = t.components.length || 0
          , s = t.materials.length || 0
          , l = t.textures.length || 0
          , c = t.lights && t.lights.length || 0
          , h = t.reuseNodes && t.reuseNodes.length || 0
          , d = []
          , p = []
          , g = []
          , u = []
          , f = []
          , m = []
          , C = []
          , y = t.textures
          , v = []
          , I = [];
        if (this.map = {},
        ap(this.dataVersion, "2.0.0")) {
            for (var E = 0; a > E; E += 1)
                t.components[E].fileKey ? d.push(t.components[E].fileKey) : A.dispatchEventEx({
                    type: Tc.SCENE_NOT_CLOSE,
                    modelKey: A.modelKey
                });
            for (var B = 0; s > B; B += 1)
                t.materials[B].fileKey ? p.push(t.materials[B].fileKey) : A.dispatchEventEx({
                    type: Tc.SCENE_NOT_CLOSE,
                    modelKey: A.modelKey
                })
        } else
            d = t.components,
            t.geometries,
            p = t.materials,
            Array.isArray(t.nodes) && (C = t.nodes),
            I = t.reuseNodes || [];
        if (t.map && (this.map = t.map),
        t.lights && t.lights.length > 0 && (m = t.lights),
        t.trees.length > 0)
            for (var x = 0; t.trees.length > x; x += 1) {
                var S = t.trees[x];
                "partition" === S.type && v.push(S.fileKey)
            }
        if (i && (o = i.bones.length,
        n = 1,
        r = 1,
        g = i.bones,
        u.push(i.clips),
        f.push(i.nodes)),
        this.maxLoadTaskCount = 0,
        this.maxLoadTaskCount += a,
        this.maxLoadTaskCount += s,
        this.maxLoadTaskCount += o,
        this.maxLoadTaskCount += n,
        this.maxLoadTaskCount += r,
        this.maxLoadTaskCount += c,
        this.maxLoadTaskCount += v.length,
        this.maxLoadTaskCount += h,
        this.maxLoadTaskCount += C.length,
        1 > this.maxLoadTaskCount)
            return Bh.info("Nothing to load ", A.modelKey),
            void A.dispatchEventEx({
                type: Tc.SCENE_NOTHING_TO_LOAD,
                modelKey: A.modelKey
            });
        this.progress.total += this.maxLoadTaskCount,
        this.startCallback && this.startCallback(),
        Bh.time("数据加载时间"),
        this._loadComponent(d),
        this._loadMaterial(p),
        this._loadComponentNode(C),
        this._loadReuseNode(I),
        vc.EnableTextureLoading && l > 0 ? (this.maxLoadTextureCount += l,
        this._loadTextures(y)) : this._onLoadTexture(),
        this._loadKDTree(v),
        this._loadClips(u),
        this._loadBones(g),
        this._loadNodes(f),
        c && this._loadLights(m),
        this.offLine && this.loadAttribute(),
        e.axis && this._loadAxisNet(e.axis),
        this.loadFloorInfo(this.model.modelKey),
        this.loadSceneAndGeos(e)
    }
    ,
    Xu.prototype.loadSceneAndGeos = function(A) {}
    ,
    Xu.prototype.getSceneTaskCount = function(A) {
        return 0
    }
    ,
    Xu.prototype._loadLightmapConfig = function(A, e) {
        var t = this.model
          , i = this.descriptor;
        i && this.fileLoader.load(A, (function(A) {
            var o;
            try {
                o = JSON.parse(A)
            } catch (A) {
                return void console.log("Lightmap config data exceptions!")
            }
            void 0 !== o.count.lightmapNum && o.count.lightmapNum > 0 && (t.lightmapNum = o.count.lightmapNum,
            t.lightmap = !0,
            i.lightmap = !0,
            vc.Instance = !1,
            vc.EnableLightmap = !0),
            e && e()
        }
        ))
    }
    ,
    Xu.prototype._onTaskFinished = function() {
        var A = this.model;
        this.loadTaskCount += 1;
        var e = this.dealProgressSegment(A, this.loadTaskCount);
        this.notifyProgress && (this.progressCallback && this.progressCallback({
            total: this.maxLoadTaskCount,
            loaded: e,
            modelKey: this.model.modelKey
        }));
        this.maxLoadTaskCount > this.loadTaskCount || (this.dataLoaded = !0,
        this.textruesLoaded && (Bh.timeEnd("数据加载时间"),
        this.finishCallback && this.finishCallback()))
    }
    ,
    Xu.prototype._onLoadTexture = function() {
        this.loadTextureCount += 1,
        this.maxLoadTextureCount > this.loadTextureCount || (this.textruesLoaded = !0,
        this.dataLoaded && (Bh.timeEnd("数据加载时间"),
        this.finishCallback && this.finishCallback()))
    }
    ,
    Xu.prototype._loadScene = function(A) {
        var e = this
          , t = this.model
          , i = this.url
          , o = this.fileLoader;
        o.setResponseType("arraybuffer"),
        o.load(i.sceneUrl(A), (function(t) {
            e._parseScene(t, A),
            e._onTaskFinished()
        }
        ), void 0, (function(A) {
            t.dispatchEvent({
                type: Tc.LOAD_ERROR,
                errorType: Tc.LOAD_SCENE_ERROR,
                event: A
            }),
            e._onTaskFinished()
        }
        ))
    }
    ,
    Xu.prototype._parseScene = function(A, e) {
        var t = new Loader.SceneReader(A);
        this.descriptor.mapSceneReader[e] = t,
        t = null
    }
    ,
    Xu.prototype._loadLine = function() {
        var A = this
          , e = this.model
          , t = this.url
          , i = this.fileLoader;
        i.setResponseType("arraybuffer"),
        i.load(t.lineUrl(), (function(e) {
            A._parseLine(e),
            A._onTaskFinished()
        }
        ), void 0, (function(t) {
            e.dispatchEvent({
                type: Tc.LOAD_ERROR,
                errorType: Tc.LOAD_MATERIAL_ERROR,
                event: t
            }),
            A._onTaskFinished()
        }
        ))
    }
    ,
    Xu.prototype._parseLine = function(A) {
        for (var e = new Loader.LineReader(A), t = 0, i = e.header.lineCount; i > t; ++t) {
            var o = e.getPtBuffer(t)
              , n = e.getIdxBuffer(t);
            if (void 0 !== o && void 0 !== n) {
                var r = e.getLineData(t);
                if (0 === r.lineType) {
                    for (var a = [], s = 1, l = n.length; l > s; s++)
                        a.push(n[s - 1]),
                        a.push(n[s]);
                    a.length && (n = a)
                }
                this.descriptor.cacheReferencedMeshBufferData("line-" + r.line_id, {
                    P: o,
                    I: n
                })
            } else
                Bh.log("Error Geometry!")
        }
        e = null
    }
    ,
    Xu.prototype._parseMaterialBinary = function(A) {
        var e, t = this.url, i = this.model.materialManager, o = i.materials, n = i.textures, r = new Loader.MaterialReader(A), a = r.materialCount, s = this, l = [];
        if (a >= 0) {
            var c = this.model.manager.scene;
            for (e = 0; a > e; ++e) {
                var h, d = {}, p = r.getMaterial(e);
                if (void 0 !== p.color && (d.color = p.color),
                void 0 !== p.opacity && (d.opacity = p.opacity,
                1 > p.opacity && (d.transparent = !0)),
                void 0 !== p.side && p.side && (d.side = 2),
                void 0 !== p.emissive && (d.emissive = p.emissive),
                void 0 !== p.environment && (d.envMapIntensity = p.environment),
                void 0 !== p.roughness && (d.roughness = p.roughness,
                d.originRoughness = p.roughness),
                void 0 !== p.metalness && (d.metalness = p.metalness,
                d.originMetalness = p.metalness),
                vc.IBL ? (d.iblProbe = c.iblProbe,
                (h = new ImageBasedLighting.IBLMaterial(d)).type = "IBL") : h = Kd.createStandardMaterial(d),
                h.name = e,
                o[e] = h,
                d = null,
                vc.EnableTextureLoading) {
                    var g = null;
                    p.texture_n > 0 && (g = r.getTexture(p.texture_id[0])),
                    g && l.push({
                        id: e,
                        data: g
                    })
                }
            }
            if (l.length > 0) {
                for (a = this.maxLoadTextureCount = l.length,
                e = 0; a > e; e += 1)
                    this._parseTexture(t, l[e], n);
                l = null
            } else
                s._onLoadTexture();
            if (this.model.lightmap) {
                var u = this.model.lightmapNum;
                for (this.maxLoadTextureCount += u,
                e = 0; u > e; e += 1) {
                    var f = this._loadTexture(t.textureUrl("lightmap-rgbm" + e + ".png"), (function() {
                        s._onLoadTexture()
                    }
                    ), void 0, (function() {
                        s._onLoadTexture()
                    }
                    ));
                    i.lightmaps[e] = f
                }
            }
            r = null
        }
    }
    ,
    Xu.prototype._parseMaterialJson = function(A) {
        var e, t = this.url, i = this.model.materialManager, o = i.materials, n = i.textures, r = new Loader.MaterialReaderJson(A), a = r.count, s = this, l = [];
        if (a >= 0) {
            var c = this.model.manager.scene;
            for (e = 0; a > e; ++e) {
                var h, d = {}, p = r.getMaterial(e), g = p.parameters;
                if (void 0 !== g.color && (d.color = g.color),
                void 0 !== g.opacity && (d.opacity = g.opacity,
                1 > g.opacity && (d.transparent = !0)),
                void 0 !== g.side && "double" === g.side && (d.side = 2),
                void 0 !== g.emissive && (d.emissive = g.emissive),
                void 0 !== g.environment && (d.envMapIntensity = g.environment),
                void 0 !== g.roughness && (d.roughness = g.roughness,
                d.originRoughness = g.roughness),
                void 0 !== g.metalness && (d.metalness = g.metalness,
                d.originMetalness = g.metalness),
                void 0 !== g.refractionRatio && (d.refractionRatio = g.refractionRatio),
                void 0 !== g.imageFade && (d.imageFade = g.imageFade),
                this.model.lightmap && (d.lights = !1),
                vc.IBL ? (d.iblProbe = c.iblProbe,
                (h = new ImageBasedLighting.IBLMaterial(d)).type = "IBL") : (h = Kd.createStandardMaterial(d)).refreshUniforms(),
                h.name = e,
                o[e] = h,
                d = null,
                vc.EnableTextureLoading) {
                    var u = []
                      , f = p.textures;
                    for (var m in f) {
                        "reliefMap" == m && f.bumpMap || u.push({
                            type: m,
                            data: f[m]
                        })
                    }
                    u.length > 0 && l.push({
                        id: e,
                        dataArray: u
                    })
                }
            }
            if (l.length > 0) {
                for (a = l.length,
                e = 0; a > e; e += 1) {
                    this.maxLoadTextureCount += (u = l[e].dataArray).length
                }
                for (e = 0; a > e; e += 1) {
                    for (var C = l[e].id, y = [], v = 0, I = (u = l[e].dataArray).length; I > v; v++)
                        this._parseTextureJson(t, u[v], y);
                    n[C] = y
                }
                l = null
            } else
                s._onLoadTexture();
            if (this.model.lightmap) {
                var E = this.model.lightmapNum;
                for (this.maxLoadTextureCount += E,
                e = 0; E > e; e += 1) {
                    var B = this._loadTexture(t.lightmapTexUrl("lightmap-rgbm" + e + ".png"), (function() {
                        s._onLoadTexture()
                    }
                    ), void 0, (function() {
                        s._onLoadTexture()
                    }
                    ));
                    i.lightmaps[e] = B
                }
            }
            r = null
        }
    }
    ,
    Xu.prototype._loadTexture = function(A, e, t, i) {
        var o, n = Yr.Handlers.get(A), r = this;
        return null !== n ? o = n.load(A, e) : (o = new d,
        (n = new _r).setCrossOrigin("anonymous"),
        n.load(A, (function(A) {
            o.image = Kd.ensurePowerOfTwo(A),
            o.needsUpdate = !0,
            e && e(o)
        }
        ), t, (function(A) {
            void 0 !== i && i(A),
            r.model.dispatchEvent({
                type: Tc.LOAD_ERROR,
                errorType: Tc.LOAD_TEXTURE_ERROR,
                event: A
            })
        }
        ))),
        o
    }
    ,
    Xu.prototype._loadCompressedTexture = function(A, e, t, i) {}
    ,
    Xu.prototype._loadTextureByCrypto = function(A, e, t, i) {
        var o, n = Yr.Handlers.get(A), r = this;
        return null !== n ? o = n.load(A, e) : (o = new d,
        (n = new TEST.CryptoResourceLoader).loadURL(A, (function(A) {
            var t = new Blob([A],{
                type: "jpeg"
            })
              , n = new Image;
            n.onload = function() {
                o.image = Kd.ensurePowerOfTwo(n),
                o.needsUpdate = !0,
                e && e(o)
            }
            ,
            n.onerror = function(A) {
                i && i(A),
                r.model.dispatchEvent({
                    type: Tc.LOAD_ERROR,
                    errorType: Tc.LOAD_TEXTURE_ERROR,
                    event: A
                })
            }
            ,
            n.src = URL.createObjectURL(t)
        }
        ), (function(A) {
            void 0 !== i && i(A),
            r.model.dispatchEvent({
                type: Tc.LOAD_ERROR,
                errorType: Tc.LOAD_TEXTURE_ERROR,
                event: A
            })
        }
        ))),
        o
    }
    ,
    Xu.prototype._parseTexture = function(A, e, t) {
        var i = window.TEST || {}
          , o = e.id
          , n = e.data
          , r = n.id + n.file_name_ext;
        this.textureLoader = this.enableCompressedTexture && n.dds ? this._loadCompressedTexture : i.CryptoResourceLoader ? this._loadTextureByCrypto : this._loadTexture;
        var a = this;
        this.textureLoader(A.textureUrl(r), (function(A) {
            A.repeat.fromArray([n.scale_u, n.scale_v]),
            A.offset.fromArray([n.offset_u, n.offset_v]),
            A.setRotateAngle && A.setRotateAngle(n.angle),
            n.repeat_u && (A.wrapS = 1e3),
            n.repeat_v && (A.wrapT = 1e3),
            A && (t[o] = A),
            a._onLoadTexture()
        }
        ), void 0, (function() {
            a._onLoadTexture()
        }
        ))
    }
    ,
    Xu.prototype._parseTextureJson = function(A, e, t) {
        var i = window.TEST || {}
          , o = e.type
          , n = e.data
          , r = A.textureUrl(n.sourceFile)
          , a = this.enableSmallTexture && n.texture_small;
        if (!a && this.enableCompressedTexture && n.dds)
            this.textureLoader = this._loadCompressedTexture;
        else if (this.textureLoader = i.CryptoResourceLoader ? this._loadTextureByCrypto : this._loadTexture,
        a) {
            var s = r.lastIndexOf(".");
            r = r.substring(0, s) + "_s" + r.substring(s)
        }
        var l = this;
        this.textureLoader(r, (function(A) {
            A.repeat.fromArray([n.scale[0], n.scale[1]]),
            A.offset.fromArray([n.offset[0], n.offset[1]]),
            A.setRotateAngle && A.setRotateAngle(n.angle),
            n.repeatU && (A.wrapS = 1e3),
            n.repeatV && (A.wrapT = 1e3),
            A.texturetype = o,
            "reliefMap" == o && (A.texturetype = "bumpMap"),
            n.dataType && "NormalMap" == n.dataType && (A.texturetype = "normalMap"),
            n.alpha && (A.texturetype = "alphaMap"),
            n.depth && (A.depth = n.depth),
            A && t.push(A),
            l._onLoadTexture()
        }
        ), void 0, (function() {
            l._onLoadTexture()
        }
        ))
    }
    ,
    Xu.prototype._loadUV2 = function() {
        var A = this
          , e = this.url
          , t = this.fileLoader;
        t.setResponseType("arraybuffer"),
        t.load(e.uv2Url(), (function(e) {
            A.uv2Buffer = new Uint16Array(e),
            A._onTaskFinished()
        }
        ), void 0, (function(e) {
            A._onTaskFinished()
        }
        )),
        t.setResponseType(""),
        t.load(e.uv2MapItemUrl(), (function(e) {
            A.uv2MapItem = JSON.parse(e),
            A._onTaskFinished()
        }
        ), void 0, (function(e) {
            A._onTaskFinished()
        }
        ))
    }
    ,
    Xu.prototype.getUV2ById = function(A, e) {
        if (this.uv2MapItem && e) {
            var t = this.uv2MapItem[A];
            if (t) {
                var i = t.uv1Scale
                  , o = t.uv1Translation
                  , n = t.uv1ByteOffset / 2
                  , r = 2 * e;
                if (this.uv2Buffer) {
                    for (var a = this.uv2Buffer.slice(n, n + r), s = [], l = 0; r > l; l += 2)
                        s.push(i[0] * (a[l] / 65535) + o[0]),
                        s.push(i[1] * (a[l + 1] / 65535) + o[1]);
                    return {
                        lightmapIdx: t.lightmapIdx,
                        uv2: s
                    }
                }
            }
        }
    }
    ,
    Xu.prototype._loadSymbol = function() {
        var A = this
          , e = this.url
          , t = this.fileLoader;
        t.setResponseType("arraybuffer"),
        t.load(e.symbolUrl(), (function(e) {
            A.parseSymbol(e),
            A._onTaskFinished()
        }
        ), void 0, (function(e) {
            A.model.dispatchEvent({
                type: Tc.LOAD_ERROR,
                errorType: Tc.LOAD_SYMBOL_ERROR,
                event: e
            }),
            A._onTaskFinished()
        }
        ))
    }
    ,
    Xu.prototype.parseSymbol = function(A) {
        this.descriptor.symbolReader = new Loader.SymbolReader(A)
    }
    ,
    Xu.prototype._loadOctree = function(A, e) {
        var t = null
          , i = this.model.configLoader.transformInfos.transformMatrix;
        this.model.configLoader.transformInfos.octreeTransformed && (t = new M).getInverse(i),
        A && this._loadOctreeBy(t, !1),
        e && this._loadOctreeBy(t, !0)
    }
    ,
    Xu.prototype._loadOctreeBy = function(A, e) {
        var t, i = this, o = this.url, n = this.fileLoader;
        t = o.octreeUrl(e ? "i" : "o"),
        n.setResponseType("arraybuffer"),
        n.load(t, (function(t) {
            i._parseOctree(t, A, e),
            i._onTaskFinished()
        }
        ), void 0, (function(A) {
            i.model.dispatchEvent({
                type: Tc.LOAD_ERROR,
                errorType: Tc.LOAD_OCTREEINNER_ERROR,
                event: A
            }),
            i._onTaskFinished()
        }
        ))
    }
    ,
    Xu.prototype._parseOctree = function(A, e, t) {
        this.descriptor.octreeRootNode[t ? "inner" : "outer"] = this._getOctreeRootNode(A, e)
    }
    ,
    Xu.prototype._getOctreeRootNode = function(A, e) {
        function t(A, t) {
            e && t.boundingBox.applyMatrix4(e),
            A.boundingBoxWorld = t.boundingBox.clone(),
            A.min = t.boundingBox.min,
            A.max = t.boundingBox.max,
            A.center = t.boundingBox.getCenter(),
            A.size = t.boundingBox.getSize().lengthSq(),
            A.childStart = t.child_s,
            A.childEnd = t.child_e
        }
        function i(A, e) {
            A.octType = 0,
            e.center.x > A.center.x && (A.octType += 1),
            e.center.y > A.center.y && (A.octType += 2),
            e.center.z > A.center.z && (A.octType += 4)
        }
        var o = null
          , n = new Loader.OctreeReader(A);
        if (n.getCount() > 0) {
            var r = n.getNode(0);
            t(o = new Loader.OctreeNode(r.cell_id,0), r),
            function A(e, o) {
                for (var n = e.childEnd, r = e.childStart; n > r; ++r) {
                    var a = o.getNode(r)
                      , s = new Loader.OctreeNode(a.cell_id,e.depth);
                    t(s, a),
                    e.add(s),
                    i(s, e),
                    s.updateMaxDepth(),
                    A(s, o)
                }
            }(o, n)
        }
        return n = null,
        o
    }
    ,
    Xu.prototype._loadUserId = function() {
        var A = this
          , e = this.url
          , t = this.fileLoader;
        t.setResponseType("arraybuffer"),
        t.load(e.userIdUrl(), (function(e) {
            A._parseUserId(e),
            A._onTaskFinished()
        }
        ), void 0, (function(e) {
            A.model.dispatchEvent({
                type: Tc.LOAD_ERROR,
                errorType: Tc.LOAD_USERID_ERROR,
                event: e
            }),
            A._onTaskFinished()
        }
        ))
    }
    ,
    Xu.prototype._parseUserId = function(A) {
        this.descriptor.userIdReader = new Loader.IdReader(A)
    }
    ,
    Xu.prototype._loadUserData = function() {
        var A = this
          , e = this.url
          , t = this.fileLoader;
        t.setResponseType(""),
        t.load(e.userDataUrl(), (function(e) {
            A._parseUserData(e),
            A._onTaskFinished()
        }
        ), void 0, (function(e) {
            A.model.dispatchEvent({
                type: Tc.LOAD_ERROR,
                errorType: Tc.LOAD_USERDATA_ERROR,
                event: e
            }),
            A._onTaskFinished()
        }
        ))
    }
    ,
    Xu.prototype._parseUserData = function(A) {
        this.descriptor.userDataReader = new Loader.UserDataReader(A)
    }
    ,
    Xu.prototype._loadCamera = function() {
        var A = this
          , e = this.url
          , t = this.fileLoader;
        t.setResponseType(""),
        t.load(e.cameraUrl(), (function(e) {
            A._parseCamera(e),
            A._onTaskFinished()
        }
        ), void 0, (function(e) {
            A.model.dispatchEvent({
                type: Tc.LOAD_ERROR,
                errorType: Tc.LOAD_CAMERA_ERROR,
                event: e
            }),
            A._onTaskFinished()
        }
        ))
    }
    ,
    Xu.prototype._parseCamera = function(A) {
        var e = this.model.configLoader.transformInfos.transformMatrix;
        new Loader.CameraReader(A).parse(this.model, e)
    }
    ,
    Xu.prototype._parseGeo = function(A, e) {
        for (var t = new Loader.MPKReader(A), i = new M, o = 0, n = t.header.meshCount; n > o; ++o) {
            var r = t.getPtBuffer(o)
              , a = t.getIdxBuffer(o)
              , s = t.getNormalBuffer(o)
              , l = t.getMeshData(o)
              , c = t.getUVBuffer(o);
            null != r && null != a ? (0 !== l.baseScale && (r = new Float32Array(r),
            i.identity(),
            i.setPosition(new y(l.baseX,l.baseY,l.baseZ)),
            i.scale(new y(l.baseScale,l.baseScale,l.baseScale)),
            GeomUtil.applyMatrix4ToBuffer(i, r)),
            this.descriptor.cacheReferencedMeshBufferData(l.mesh_id, {
                P: r,
                I: a,
                N: s,
                UV: c
            }),
            this.descriptor.cacheReferencedMeshGeoIds(e, l.mesh_id)) : Logger.log("Error Geometry!")
        }
        t = null
    }
    ,
    Xu.prototype._loadBorderline = function(A) {
        var e = this
          , t = this.url
          , i = this.fileLoader
          , o = t.borderLineUrl(A ? 1 : 0);
        i.setResponseType("arraybuffer"),
        i.load(o, (function(t) {
            e._parseBorderLine(t, A),
            e._onTaskFinished()
        }
        ), void 0, (function(A) {
            e.model.dispatchEvent({
                type: Tc.LOAD_ERROR,
                errorType: Tc.LOAD_MATERIAL_ERROR,
                event: A
            }),
            e._onTaskFinished()
        }
        ))
    }
    ,
    Xu.prototype._parseBorderLine = function(A, e) {
        for (var t = new Loader.LineReader(A), i = [], o = 0, n = t.header.lineCount; n > o; ++o) {
            var r = t.getLineData(o);
            i.push({
                meshId: r.line_id,
                positionStart: r.ptOffset / 4,
                positionCount: 3 * r.ptCount,
                indexStart: r.idxOffset / 4,
                indexCount: r.idxCount
            })
        }
        this.descriptor.cacheBorderLine(e, {
            P: t.ptBuffer,
            I: t.idxBuffer,
            IndexInfos: i
        }),
        t = null
    }
    ,
    Xu.prototype._isLoadGeoBorderlines = function() {
        var A = this.model.getConfig().metadata;
        return !(!vc.BorderLineBatched || !A.outline_mpk)
    }
    ,
    Xu.prototype.getAllBorderlineCount = function() {
        var A = this.model.getConfig().metadata;
        return this._isLoadGeoBorderlines() ? A.outline_mpk : A.outline_0 + A.outline_1
    }
    ,
    Xu.prototype._loadAllBorderlines = function(A) {
        this._isLoadGeoBorderlines() ? A.outline_mpk && this._loadAllGeoBorderLines(A.outline_mpk) : (A.outline_0 && this._loadBorderline(!1),
        A.outline_1 && this._loadBorderline(!0))
    }
    ,
    Xu.prototype.delayLoadBorderlines = function(A) {
        this.model.getConfig();
        this._isLoadGeoBorderlines() ? this._delayLoadGeoBorderlines(A) : this._delayLoadTogetherBorderlines(A)
    }
    ,
    Xu.prototype._delayLoadGeoBorderlines = function(A) {
        var e = this.model.getConfig().metadata;
        this.startCallback = null,
        this.progressCallback = null,
        this.finishCallback = A,
        this.loadTaskCount = 0,
        this.maxLoadTaskCount = e.outline_mpk,
        e.outline_mpk && this._loadAllGeoBorderLines(e.outline_mpk)
    }
    ,
    Xu.prototype._delayLoadTogetherBorderlines = function(A) {
        var e = this.model.getConfig().metadata;
        this.startCallback = null,
        this.progressCallback = null,
        this.finishCallback = A,
        this.loadTaskCount = 0,
        this.maxLoadTaskCount = e.outline_0 + e.outline_1,
        e.outline_0 && this._loadBorderline(!1),
        e.outline_1 && this._loadBorderline(!0)
    }
    ,
    Xu.prototype._loadAllGeoBorderLines = function(A) {
        this.mpkBorderLineTaskManager || (this.mpkBorderLineTaskManager = new Ou);
        for (var e = 0; A > e; ++e)
            this.mpkBorderLineTaskManager.addTask(e);
        this.mpkBorderLineTaskManager.processTasks(this._loadGeoBorderLine.bind(this))
    }
    ,
    Xu.prototype._loadGeoBorderLine = function(A, e) {
        var t = this
          , i = this.fileLoader
          , o = this.url
          , n = A >= this.model.getConfig().metadata.mpk_shared_index;
        i.setResponseType("arraybuffer"),
        i.load(o.mpkBorderLineUrl(A), (function(A) {
            t._parseGeoBorderLine(A, n),
            e(),
            t._onTaskFinished()
        }
        ), void 0, (function(A) {
            t._onTaskFinished()
        }
        ))
    }
    ,
    Xu.prototype._parseGeoBorderLine = function(A, e) {
        for (var t = new Loader.LineReader(A), i = [], o = 0, n = t.header.lineCount; n > o; ++o) {
            var r = t.getLineData(o);
            i.push({
                meshId: r.line_id,
                positionStart: r.ptOffset / 4,
                positionCount: 3 * r.ptCount,
                indexStart: r.idxOffset / 4,
                indexCount: r.idxCount
            })
        }
        this.descriptor.cacheBorderLine(e, {
            P: t.ptBuffer,
            I: t.idxBuffer,
            IndexInfos: i
        }),
        t = null
    }
    ,
    Xu.prototype.dealProgressSegment = function(A, e) {
        return vc.MergeComponent ? e * A.progressPercentage.load : e
    }
    ,
    Xu.prototype._loadWireframe = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.mpkUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = function(t) {
                    if (A[i[t]])
                        if (!0 === A[i[t]].split) {
                            var o = A[i[t]].list
                              , s = new Uint8Array(A[i[t]].length);
                            n.getBatch(o, (function(A) {
                                for (var n = !0, r = 0; o.length > r; r += 1)
                                    A[o[r]] ? s.set(new Uint8Array(A[o[r]]), 4e7 * r) : (n = !1,
                                    Bh.error("获取分割几何失败"));
                                if (n) {
                                    var a = i[t].indexOf("fileKey=");
                                    e._parseWireframe(s.buffer, i[t].slice(a + 8)),
                                    Bh.debug("load geo from local"),
                                    e._onTaskFinished()
                                } else {
                                    var l = e.taskGeometrieManager;
                                    if (-1 === (a = i[t].indexOf("fileKey=")))
                                        return void Bh.error("url is not has fileKey");
                                    l.addTask(i[t].slice(a + 8)),
                                    Bh.debug("load geo from net"),
                                    e.taskGeometrieManager.processTasks(e.loadWireframe.bind(e))
                                }
                            }
                            ), (function() {
                                Bh.error("获取分割几何失败")
                            }
                            ))
                        } else
                            a = i[t].indexOf("fileKey="),
                            e._parseWireframe(A[i[t]], i[t].slice(a + 8)),
                            Bh.debug("load geo from local"),
                            e._onTaskFinished();
                    else {
                        if (r = e.taskGeometrieManager,
                        -1 === (a = i[t].indexOf("fileKey=")))
                            return Bh.error("url is not has fileKey"),
                            {
                                v: void 0
                            };
                        r.addTask(i[t].slice(a + 8)),
                        Bh.debug("load geo from net")
                    }
                }, o = 0; i.length > o; o += 1) {
                    var r, a, s = t(o);
                    if ("object" === lc(s))
                        return s.v
                }
                e.taskGeometrieManager.processTasks(e.loadWireframe.bind(e))
            }
            ), (function() {
                for (var t = e.taskGeometrieManager, i = 0; A.length > i; i += 1)
                    t.addTask(A[i]);
                t.processTasks(e.loadWireframe.bind(e))
            }
            ))
        } else {
            for (var r = this.taskGeometrieManager, a = 0; A.length > a; a += 1)
                r.addTask(A[a]);
            r.processTasks(e.loadWireframe.bind(e))
        }
    }
    ,
    Xu.prototype._loadGeo = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.mpkUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = function(t) {
                    if (A[i[t]])
                        if (!0 === A[i[t]].split) {
                            var o = A[i[t]].list
                              , s = new Uint8Array(A[i[t]].length);
                            n.getBatch(o, (function(A) {
                                for (var n = 0; o.length > n; n += 1)
                                    A[o[n]] ? s.set(new Uint8Array(A[o[n]]), 4e7 * n) : Bh.error("获取分割几何失败");
                                var r = i[t].indexOf("fileKey=");
                                e._parseGeometrie(s.buffer, i[t].slice(r + 8)),
                                Bh.debug("load geo from local"),
                                e._onTaskFinished()
                            }
                            ), (function() {
                                Bh.error("获取分割几何失败")
                            }
                            ))
                        } else
                            a = i[t].indexOf("fileKey="),
                            e._parseGeometrie(A[i[t]], i[t].slice(a + 8)),
                            Bh.debug("load geo from local"),
                            e._onTaskFinished();
                    else {
                        if (r = e.taskGeometrieManager,
                        -1 === (a = i[t].indexOf("fileKey=")))
                            return Bh.error("url is not has fileKey"),
                            {
                                v: void 0
                            };
                        r.addTask(i[t].slice(a + 8)),
                        Bh.debug("load geo from net")
                    }
                }, o = 0; i.length > o; o += 1) {
                    var r, a, s = t(o);
                    if ("object" === lc(s))
                        return s.v
                }
                e.taskGeometrieManager.processTasks(e.loadGeometrie.bind(e))
            }
            ), (function() {
                for (var t = e.taskGeometrieManager, i = 0; A.length > i; i += 1)
                    t.addTask(A[i]);
                t.processTasks(e.loadGeometrie.bind(e))
            }
            ))
        } else {
            for (var r = this.taskGeometrieManager, a = 0; A.length > a; a += 1)
                r.addTask(A[a]);
            r.processTasks(e.loadGeometrie.bind(e))
        }
    }
    ,
    Xu.prototype._loadComponentNode = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.mpkUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = function(t) {
                    if (A[i[t]])
                        if (!0 === A[i[t]].split) {
                            var o = A[i[t]].list
                              , s = new Uint8Array(A[i[t]].length);
                            n.getBatch(o, (function(A) {
                                for (var n = 0; o.length > n; n += 1)
                                    A[o[n]] ? s.set(new Uint8Array(A[o[n]]), 4e7 * n) : Bh.error("获取分割node失败");
                                var r = i[t].indexOf("fileKey=");
                                e._parseComponentNode(s.buffer, i[t].slice(r + 8)),
                                Bh.debug("load geo from local"),
                                e._onTaskFinished()
                            }
                            ), (function() {
                                Bh.error("获取分割node失败")
                            }
                            ))
                        } else
                            a = i[t].indexOf("fileKey="),
                            e._parseComponentNode(A[i[t]], i[t].slice(a + 8)),
                            Bh.debug("load geo from local"),
                            e._onTaskFinished();
                    else {
                        if (r = e.taskComponentNodeManager,
                        -1 === (a = i[t].indexOf("fileKey=")))
                            return Bh.error("url is not has fileKey"),
                            {
                                v: void 0
                            };
                        r.addTask(i[t].slice(a + 8)),
                        Bh.debug("load component.node from net")
                    }
                }, o = 0; i.length > o; o += 1) {
                    var r, a, s = t(o);
                    if ("object" === lc(s))
                        return s.v
                }
                e.taskComponentNodeManager.processTasks(e.loadComponentNode.bind(e))
            }
            ), (function() {
                for (var t = e.taskComponentNodeManager, i = 0; A.length > i; i += 1)
                    t.addTask(A[i]);
                t.processTasks(e.loadComponentNode.bind(e))
            }
            ))
        } else {
            for (var r = this.taskComponentNodeManager, a = 0; A.length > a; a += 1)
                r.addTask(A[a]);
            r.processTasks(e.loadComponentNode.bind(e))
        }
    }
    ,
    Xu.prototype._loadKDTree = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.kdTreeUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = 0; i.length > t; t += 1) {
                    var o = i[t].indexOf("fileKey=");
                    if (-1 === o)
                        return void Bh.error("url is not has fileKey");
                    var n = i[t].slice(o + 8);
                    A[i[t]] ? (e._parseKDTree(A[i[t]], n),
                    Bh.debug("load kdTree from local"),
                    e._onTaskFinished()) : (e.loadKDTree(n, (function() {}
                    )),
                    Bh.debug("load kdtree from net"))
                }
            }
            ), (function() {
                for (var t = 0; A.length > t; t += 1)
                    e.loadKDTree(A[t], (function() {}
                    ))
            }
            ))
        } else
            for (var r = 0; A.length > r; r += 1)
                e.loadKDTree(A[r], (function() {}
                ))
    }
    ,
    Xu.prototype._loadLights = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.lightUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = 0; i.length > t; t += 1) {
                    var o = i[t].indexOf("fileKey=");
                    if (-1 === o)
                        return void Bh.error("url is not has fileKey");
                    var n = i[t].slice(o + 8);
                    A[i[t]] ? (e._parseLight(A[i[t]], n),
                    Bh.debug("load light from local"),
                    e._onTaskFinished()) : (e.loadLight(n, (function() {}
                    )),
                    Bh.debug("load kdtree from net"))
                }
            }
            ), (function() {
                for (var t = 0; A.length > t; t += 1)
                    e.loadLight(A[t], (function() {}
                    ))
            }
            ))
        } else
            for (var r = 0; A.length > r; r += 1)
                e.loadLight(A[r], (function() {}
                ))
    }
    ,
    Xu.prototype._loadBones = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.bonesUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = 0; i.length > t; t += 1)
                    if (A[i[t]])
                        e._parseBones(A[i[t]]),
                        Bh.debug("load Bones from local"),
                        e._onTaskFinished();
                    else {
                        var o = i[t].indexOf("fileKey=");
                        if (-1 === o)
                            return void Bh.error("url is not has fileKey");
                        e.loadBones(i[t].slice(o + 8), (function() {}
                        )),
                        Bh.debug("load Bones from net")
                    }
            }
            ), (function() {
                for (var t = 0; A.length > t; t += 1)
                    e.loadBones(A[t], (function() {}
                    ))
            }
            ))
        } else {
            for (var r = this.taskComponentManager, a = 0; A.length > a; a += 1)
                r.addTask(A[a]);
            r.processTasks(e.loadBones.bind(e))
        }
    }
    ,
    Xu.prototype._loadClips = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.clipsUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = 0; i.length > t; t += 1)
                    if (A[i[t]])
                        e._parseClips(A[i[t]]),
                        Bh.debug("load Clips from local"),
                        e._onTaskFinished();
                    else {
                        var o = i[t].indexOf("fileKey=");
                        if (-1 === o)
                            return void Bh.error("url is not has fileKey");
                        e.loadClips(i[t].slice(o + 8), (function() {}
                        )),
                        Bh.debug("load Clips from net")
                    }
            }
            ), (function() {
                for (var t = 0; A.length > t; t += 1)
                    e.loadClips(A[t], (function() {}
                    ))
            }
            ))
        } else {
            for (var r = this.taskComponentManager, a = 0; A.length > a; a += 1)
                r.addTask(A[a]);
            r.processTasks(e.loadClips.bind(e))
        }
    }
    ,
    Xu.prototype._loadNodes = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.nodesUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = 0; i.length > t; t += 1)
                    if (A[i[t]])
                        e._parseNodes(A[i[t]]),
                        Bh.debug("load Nodes from local"),
                        e._onTaskFinished();
                    else {
                        var o = i[t].indexOf("fileKey=");
                        if (-1 === o)
                            return void Bh.error("url is not has fileKey");
                        e.loadNodes(i[t].slice(o + 8), (function() {}
                        )),
                        Bh.debug("load Nodes from net")
                    }
            }
            ), (function() {
                for (var t = 0; A.length > t; t += 1)
                    e.loadNodes(A[t], (function() {}
                    ))
            }
            ))
        } else {
            for (var r = this.taskComponentManager, a = 0; A.length > a; a += 1)
                r.addTask(A[a]);
            r.processTasks(e.loadNodes.bind(e))
        }
    }
    ,
    Xu.prototype._loadComponent = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.mpkUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = 0; i.length > t; t += 1) {
                    if (-1 === (r = i[t].indexOf("fileKey=")) && !e.offLine)
                        return void Bh.error("url is not has fileKey");
                    var o = i[t].slice(r + 8);
                    if (A[i[t]])
                        e._parseComponent(A[i[t]], o),
                        Bh.debug("load com from local"),
                        e._onTaskFinished();
                    else {
                        var n = e.taskComponentManager;
                        if (e.offLine) {
                            var r;
                            if (-1 === (r = i[t].indexOf("data/")))
                                return void Bh.error("url is not has data/");
                            n.addTask(i[t].slice(r + 5))
                        } else
                            n.addTask(o);
                        n.processTasks(e.loadComponent.bind(e)),
                        Bh.debug("load com from net")
                    }
                }
            }
            ), (function() {
                for (var t = e.taskComponentManager, i = 0; A.length > i; i += 1)
                    t.addTask(A[i]);
                t.processTasks(e.loadComponent.bind(e))
            }
            ))
        } else {
            for (var r = this.taskComponentManager, a = 0; A.length > a; a += 1)
                r.addTask(A[a]);
            r.processTasks(e.loadComponent.bind(e))
        }
    }
    ,
    Xu.prototype._loadReuseNode = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.mpkUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = 0; i.length > t; t += 1)
                    if (A[i[t]])
                        e._parseReuseNodes(A[i[t]]),
                        Bh.debug("load com from local"),
                        e._onTaskFinished();
                    else {
                        var o = e.taskReuseNodeManager;
                        if (e.offLine) {
                            if (-1 === (n = i[t].indexOf("data/")))
                                return void Bh.error("url is not has data/");
                            o.addTask(i[t].slice(n + 5))
                        } else {
                            var n;
                            if (-1 === (n = i[t].indexOf("fileKey=")))
                                return void Bh.error("url is not has fileKey");
                            o.addTask(i[t].slice(n + 8))
                        }
                        o.processTasks(e.loadReuseNode.bind(e)),
                        Bh.debug("load com from net")
                    }
            }
            ), (function() {
                for (var t = e.taskReuseNodeManager, i = 0; A.length > i; i += 1)
                    t.addTask(A[i]);
                t.processTasks(e.loadReuseNode.bind(e))
            }
            ))
        } else {
            for (var r = this.taskReuseNodeManager, a = 0; A.length > a; a += 1)
                r.addTask(A[a]);
            r.processTasks(e.loadReuseNode.bind(e))
        }
    }
    ,
    Xu.prototype._loadMaterial = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.mpkUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = 0; i.length > t; t += 1)
                    if (A[i[t]])
                        e._parseMaterial(A[i[t]]),
                        Bh.debug("load mat from local"),
                        e._onTaskFinished();
                    else {
                        var o = e.taskMaterialManager
                          , n = i[t].indexOf("fileKey=");
                        if (-1 === n)
                            return void Bh.error("url is not has fileKey");
                        o.addTask(i[t].slice(n + 8)),
                        o.processTasks(e.loadMaterial.bind(e)),
                        Bh.debug("load mat from net")
                    }
            }
            ), (function() {
                for (var t = e.taskMaterialManager, i = 0; A.length > i; i += 1)
                    t.addTask(A[i]);
                t.processTasks(e.loadMaterial.bind(e))
            }
            ))
        } else {
            for (var r = this.taskMaterialManager, a = 0; A.length > a; a += 1)
                r.addTask(A[a]);
            r.processTasks(e.loadMaterial.bind(e))
        }
    }
    ,
    Xu.prototype._loadTextures = function(A) {
        var e = this.model.materialManager.textures
          , t = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var i = this.url, o = [], n = 0; A.length > n; n += 1)
                o.push(i.mpkUrl(A[n]));
            var r = this.model.getStorage();
            r && r.getBatch(o, (function(A) {
                for (var i = 0; o.length > i; i += 1)
                    if (A[o[i]]) {
                        var n, r = function() {
                            if (-1 === (n = o[i].indexOf("fileKey=")))
                                return Bh.error("url is not has fileKey"),
                                {
                                    v: void 0
                                };
                            var r = A[o[i]];
                            A[o[i]]instanceof Blob || (r = new Blob([A[o[i]]],{
                                type: "text/plain"
                            }));
                            var a = o[i].slice(n + 8)
                              , s = new d;
                            Bh.debug("load tex from local"),
                            e[a] = s;
                            var l = document.createElement("img");
                            s.wrapS = s.wrapT = 1e3,
                            l.onload = function(e) {
                                "string" != typeof A[o[i]] && window.URL.revokeObjectURL(l.src),
                                t.model.textureNeedsUpdate = !0,
                                s.image = Kd.ensurePowerOfTwo(l),
                                t._onLoadTexture()
                            }
                            ,
                            l.onerror = function(A) {
                                t.model.dispatchEventEx({
                                    type: Tc.LOAD_TEXTURE_ERROR
                                })
                            }
                            ,
                            l.src = "string" == typeof A[o[i]] ? A[o[i]] : window.URL.createObjectURL(r),
                            s.image = l,
                            s.needsUpdate = !0
                        }();
                        if ("object" === lc(r))
                            return r.v
                    } else {
                        var a = t.taskTexturesManager
                          , s = o[i].indexOf("fileKey=");
                        if (-1 === s)
                            return void Bh.error("url is not has fileKey");
                        a.addTask(o[i].slice(s + 8)),
                        a.processTasks(t.loadTextures.bind(t)),
                        Bh.debug("load tex from net")
                    }
            }
            ), (function() {
                for (var e = t.taskTexturesManager, i = 0; A.length > i; i += 1)
                    e.addTask(A[i]);
                e.processTasks(t.loadTextures.bind(t))
            }
            ))
        } else {
            for (var a = this.taskTexturesManager, s = 0; A.length > s; s += 1)
                a.addTask(A[s]);
            a.processTasks(t.loadTextures.bind(t))
        }
    }
    ,
    Xu.prototype._loadAxisNet = function(A) {
        if (A) {
            var e = this;
            if (vc.getDataFromIndexedDB && !this.offLine) {
                var t = this.url.axisNetUrl(A)
                  , i = this.model.getStorage();
                i && i.getBatch([t], (function(i) {
                    if (i[t])
                        e._parseAxisNet(i[t]),
                        Bh.debug("load axisnet from local");
                    else {
                        if (-1 === t.indexOf("fileKey="))
                            return void Bh.error("url is not has fileKey");
                        e.loadAxisNet(A),
                        Bh.debug("load axisnet from net")
                    }
                }
                ), (function() {
                    e.loadAxisNet(A)
                }
                ))
            } else
                e.loadAxisNet(A)
        }
    }
    ,
    Xu.prototype._parseWireframe = function(A, e) {
        var t = new Lu.GeometryReader(A,this.dataVersion)
          , i = this.descriptor;
        if (i) {
            for (var o = t.geoCount, n = 0; o > n; n += 1) {
                var r = t.geomMap[n];
                void 0 !== r.position && void 0 !== r.index ? i.cacheReferencedMeshWireframeData(r.geoId, r) : Bh.error("Error Geometry!")
            }
            t = null
        }
    }
    ,
    Xu.prototype._parseGeometrie = function(A, e) {
        var t = this.fileKeyFromModelKey[e] || ""
          , i = new ku.GeometryReader(A,this.dataVersion)
          , o = this.descriptor;
        if (o) {
            for (var n = i.geoCount, r = 0; n > r; r += 1) {
                var a = i.geomMap[r];
                void 0 !== a.position && void 0 !== a.index && void 0 !== a.normal ? (vc.DEBUG && window.geoidToFileKeyMap && (window.geoidToFileKeyMap[a.geoId] = e),
                o.cacheReferencedMeshBufferData(t + a.geoId, a)) : Bh.error("Error Geometry!")
            }
            i = null
        }
    }
    ,
    Xu.prototype._parseComponentNode = function(A, e) {
        var t = this.fileKeyFromModelKey[e] || ""
          , i = new ku.NodesReader(A,this.dataVersion)
          , o = this.descriptor;
        if (o) {
            for (var n = i.nodeCount, r = 0; n > r; r += 1) {
                var a = i.geomMap[r];
                void 0 !== a.matrix && void 0 !== a.material && void 0 !== a.nodeId ? o.cacheReferencedMeshComponentNodeData(t + a.nodeId, a) : Bh.error("Error Node!")
            }
            i = null
        }
    }
    ,
    Xu.prototype._parseMaterial = function(A, e) {
        var t = this.descriptor;
        if (t) {
            var i = new Du(A,this.dataVersion);
            if (Array.isArray(i.materialMap)) {
                var o = i.materialCount;
                if (0 > o)
                    return;
                for (var n = 0; o > n; n += 1) {
                    var r = i.materialMap[n];
                    t.cacheReferencedMeshMaterialData(r.matId, r)
                }
            } else
                for (var a in i.materialMap)
                    t.cacheReferencedMeshMaterialData(a, i.materialMap[a]);
            i = null
        }
    }
    ,
    Xu.prototype._parseComponent = function(A, e) {
        if (A) {
            var t = new Uu(A)
              , i = t.compArr.length
              , o = this.descriptor;
            if (o) {
                for (var n = 0; i > n; n += 1) {
                    var r = t.compArr[n];
                    o.cacheReferencedMeshComponentData(r.key, r)
                }
                t = null
            }
        } else
            Bh.error("没有数据")
    }
    ,
    Xu.prototype._parseKDTree = function(A, e) {
        var t = {};
        t = "string" == typeof A ? JSON.parse(A) : A,
        !this.model.kdTreeNode && t && (this.model.kdTreeNode = new Zu,
        this.model.kdTreeNode.init(t))
    }
    ,
    Xu.prototype._parseLight = function(A, e) {
        var t, i = [];
        if (t = "string" == typeof A ? JSON.parse(A) : A)
            for (var o = 0, n = t.length; n > o; o += 1) {
                var r = t[o]
                  , a = void 0
                  , s = r.pos || [0, 0, 0]
                  , l = void 0;
                switch (r.type) {
                case Fc.DirectionalLight:
                    (a = new Ra((new LA).fromArray(r.diffuse),.5)).position.set(s[0] - r.lookat[0], s[1] - r.lookat[1], s[2] - r.lookat[2]),
                    a.name = r.parent,
                    0 === r.ambient[0] && 0 === r.ambient[1] && 0 === r.ambient[2] || (l = new Ta((new LA).fromArray(r.ambient),.5));
                    break;
                case Fc.PointLight:
                    (a = new Fa((new LA).fromArray(r.diffuse))).position.set(s[0], s[1], s[2]),
                    a.name = r.parent,
                    0 === r.ambient[0] && 0 === r.ambient[1] && 0 === r.ambient[2] || (l = new Ta((new LA).fromArray(r.ambient),.5));
                    break;
                case Fc.SpotLight:
                    (a = new ba((new LA).fromArray(r.diffuse),.5)).position.set(s[0] - r.lookat[0], s[1] - r.lookat[1], s[2] - r.lookat[2]),
                    a.angle = r.cone_inn || Math.PI / 2,
                    a.name = r.parent,
                    0 === r.ambient[0] && 0 === r.ambient[1] && 0 === r.ambient[2] || (l = new Ta((new LA).fromArray(r.ambient),.5))
                }
                a && i.push(a),
                l && i.push(l)
            }
        this.model.addLights(i)
    }
    ,
    Xu.prototype._parseNodes = function(A, e) {
        var t = this.descriptor;
        if (t) {
            var i = {};
            i = "string" == typeof A ? JSON.parse(A) : A,
            Bh.debug("nodes", i),
            t.cacheReferencedMeshNodesData(i)
        }
    }
    ,
    Xu.prototype._parseClips = function(A, e) {
        var t = this.descriptor;
        if (t) {
            var i = {};
            i = "string" == typeof A ? JSON.parse(A) : A,
            Bh.debug("clips", i),
            t.cacheReferencedMeshClipsData(i)
        }
    }
    ,
    Xu.prototype._parseBones = function(A, e) {
        var t = new ku.BoneReader(A)
          , i = this.descriptor;
        if (i) {
            for (var o = t.boneCount, n = 0; o > n; n += 1) {
                var r = t.boneMap[n];
                Bh.debug("bones", r),
                i.cacheReferencedMeshBoneBufferData(r.geoId, r)
            }
            t = null
        }
    }
    ,
    Xu.prototype._parseAxisNet = function(A) {
        var e = this.model.getBoundingBoxWorld()
          , t = 0;
        e && (t = e.min.z);
        var i = this.model._getNodeGroup(gp.AXISNET);
        i.visible = !1;
        var o = new ju(i);
        o.fromJSON(A, t);
        var n = new Hu;
        n.axisNet = o,
        this.model.axisNetManager = n
    }
    ,
    Xu.prototype.loadWireframe = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.url
          , n = this.model
          , r = vc.GeoWorkerUrl;
        if (vc.UseGeoWorker)
            i.setResponseType("arraybuffer"),
            i.load(o.mpkUrl(A), (function(A) {
                var i = new Worker(r);
                i.onmessage = function(A) {
                    var i = A.data;
                    for (var o in i)
                        i.hasOwnProperty(o);
                    e(),
                    t._onTaskFinished()
                }
                ,
                i.postMessage({
                    msg: A
                })
            }
            ));
        else {
            i.setResponseType("arraybuffer"),
            i.setCacheViable(!this.offLine);
            var a = i.load(o.mpkUrl(A), (function(i) {
                t._parseWireframe(i, A),
                Bh.debug("geo load from online"),
                e(),
                t._onTaskFinished()
            }
            ), void 0, (function(A) {
                n.dispatchEventEx({
                    type: Tc.LOAD_GEOMETRY_ERROR,
                    modelKey: n.modelKey
                })
            }
            ));
            t.requests.loadGeometrie = a
        }
    }
    ,
    Xu.prototype.loadGeometrie = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.url
          , n = this.model;
        i.setResponseType("arraybuffer"),
        i.setCacheViable(!this.offLine);
        var r = i.load(o.mpkUrl(A), (function(i) {
            t._parseGeometrie(i, A),
            Bh.debug("geo load from online"),
            e(),
            t._onTaskFinished()
        }
        ), void 0, (function(A) {
            n.dispatchEventEx({
                type: Tc.LOAD_GEOMETRY_ERROR,
                modelKey: n.modelKey
            }),
            e(),
            t._onTaskFinished()
        }
        ));
        t.requests.loadGeometrie = r
    }
    ,
    Xu.prototype.loadComponentNode = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.url
          , n = this.model;
        i.setResponseType("arraybuffer"),
        i.setCacheViable(!this.offLine);
        var r = i.load(o.mpkUrl(A), (function(i) {
            t._parseComponentNode(i, A),
            Bh.debug("geo load from online"),
            e(),
            t._onTaskFinished()
        }
        ), void 0, (function(A) {
            n.dispatchEventEx({
                type: Tc.LOAD_COMPONENTNODE_ERROR,
                modelKey: n.modelKey
            }),
            e(),
            t._onTaskFinished()
        }
        ));
        t.requests.loadComponentNode = r
    }
    ,
    Xu.prototype.loadMaterial = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.url
          , n = this.model
          , r = vc.GeoWorkerUrl;
        if (vc.UseGeoWorker)
            i.setResponseType("arraybuffer"),
            i.load(o.mpkUrl(A), (function(A) {
                var i = new Worker(r);
                i.onmessage = function(A) {
                    var i = A.data;
                    for (var o in i)
                        i.hasOwnProperty(o);
                    e(),
                    t._onTaskFinished()
                }
                ,
                i.postMessage({
                    msg: A
                })
            }
            ));
        else {
            rp(t.dataVersion, "1") ? i.setResponseType("json") : i.setResponseType("arraybuffer"),
            i.setCacheViable(!this.offLine);
            var a = i.load(o.mpkUrl(A), (function(A) {
                t._parseMaterial(A),
                Bh.debug("met  load from online"),
                e(),
                t._onTaskFinished()
            }
            ), void 0, (function(A) {
                n.dispatchEventEx({
                    type: Tc.LOAD_MATERIAL_ERROR,
                    modelKey: n.modelKey
                })
            }
            ));
            t.requests.loadMaterial = a
        }
    }
    ,
    Xu.prototype.loadTextures = function(A, e) {
        var t = this.model.materialManager.textures
          , i = this
          , o = this.Textureloader
          , n = this.url
          , r = this.model
          , a = vc.GeoWorkerUrl;
        if (vc.UseGeoWorker)
            o.load(n.mpkUrl(A), (function(A) {
                var t = new Worker(a);
                t.onmessage = function(A) {
                    var t = A.data;
                    for (var o in t)
                        t.hasOwnProperty(o);
                    e(),
                    i._onTaskFinished()
                }
                ,
                t.postMessage({
                    msg: A
                })
            }
            ));
        else {
            o.setResponseType("arraybuffer"),
            o.setCacheViable(!this.offLine);
            var s = o.load(n.textureUrl(A), (function(o) {
                var n = o;
                o instanceof Blob || (n = new Blob([o],{
                    type: "text/plain"
                })),
                Bh.debug("tex load from online");
                var a = new d;
                t[A] = a,
                a.wrapS = a.wrapT = 1e3;
                var s = document.createElement("img");
                s.onload = function(A) {
                    "string" != typeof n && window.URL.revokeObjectURL(s.src),
                    a.image = Kd.ensurePowerOfTwo(s),
                    i._onLoadTexture(),
                    e(),
                    i.model.textureNeedsUpdate = !0
                }
                ,
                s.onerror = function(A) {
                    r.dispatchEventEx({
                        type: Tc.LOAD_TEXTURE_ERROR,
                        modelKey: r.modelKey
                    })
                }
                ,
                s.src = "string" == typeof n ? n : window.URL.createObjectURL(n),
                a.image = s,
                a.needsUpdate = !0
            }
            ), void 0, (function(A) {
                r.dispatchEventEx({
                    type: Tc.LOAD_TEXTURE_ERROR,
                    modelKey: r.modelKey
                })
            }
            ));
            i.requests.loadTextures = s
        }
    }
    ,
    Xu.prototype.loadComponent = function(A, e) {
        var t = this
          , i = this.jsonLoader
          , o = this.model
          , n = this.url
          , r = vc.GeoWorkerUrl;
        if (vc.UseGeoWorker)
            i.setResponseType("json"),
            i.load(n.mpkUrl(A), (function(A) {
                var i = new Worker(r);
                i.onmessage = function(A) {
                    var i = A.data;
                    for (var o in i)
                        i.hasOwnProperty(o);
                    e(),
                    t._onTaskFinished()
                }
                ,
                i.postMessage({
                    msg: A
                })
            }
            ), (function(A) {}
            ));
        else {
            i.setResponseType("json"),
            vc.useGzip && i.setResponseType("arraybuffer"),
            i.setCacheViable(!0);
            var a = i.load(n.mpkUrl(A), (function(i) {
                t._parseComponent(i, A),
                Bh.debug("component load from online"),
                e(),
                t._onTaskFinished()
            }
            ), void 0, (function(A) {
                o.dispatchEventEx({
                    type: Tc.LOAD_COMPONENT_ERROR,
                    modelKey: o.modelKey
                })
            }
            ));
            t.requests.loadComponent = a
        }
    }
    ,
    Xu.prototype.loadKDTree = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.model
          , n = this.url
          , r = vc.GeoWorkerUrl;
        if (vc.UseGeoWorker)
            i.setResponseType("json"),
            i.load(n.mpkUrl(A), (function(A) {
                var i = new Worker(r);
                i.onmessage = function(A) {
                    var i = A.data;
                    for (var o in i)
                        i.hasOwnProperty(o);
                    e(),
                    t._onTaskFinished()
                }
                ,
                i.postMessage({
                    msg: A
                })
            }
            ), (function(A) {}
            ));
        else {
            i.setResponseType("json"),
            i.setCacheViable(!this.offLine);
            var a = i.load(n.kdTreeUrl(A), (function(i) {
                t._parseKDTree(i, A),
                Bh.debug("kdtree load from online"),
                e(),
                t._onTaskFinished()
            }
            ), void 0, (function(A) {
                o.dispatchEventEx({
                    type: Tc.LOAD_COMPONENT_ERROR,
                    modelKey: o.modelKey
                })
            }
            ));
            t.requests.loadKDTree = a
        }
    }
    ,
    Xu.prototype.loadLight = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.model
          , n = this.url;
        i.setResponseType("json"),
        i.setCacheViable(!this.offLine);
        var r = i.load(n.lightUrl(A), (function(i) {
            t._parseLight(i, A),
            Bh.debug("light load from online"),
            e(),
            t._onTaskFinished()
        }
        ), void 0, (function(A) {
            o.dispatchEventEx({
                type: Tc.LOAD_COMPONENT_ERROR,
                modelKey: o.modelKey
            })
        }
        ));
        t.requests.loadLight = r
    }
    ,
    Xu.prototype.loadBones = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.model
          , n = this.url
          , r = vc.GeoWorkerUrl;
        if (vc.UseGeoWorker)
            i.setResponseType("arraybuffer"),
            i.load(n.bonesUrl(A), (function(A) {
                var i = new Worker(r);
                i.onmessage = function(A) {
                    var i = A.data;
                    for (var o in i)
                        i.hasOwnProperty(o);
                    e(),
                    t._onTaskFinished()
                }
                ,
                i.postMessage({
                    msg: A
                })
            }
            ), (function(A) {}
            ));
        else {
            i.setResponseType("arraybuffer"),
            i.setCacheViable(!this.offLine);
            var a = i.load(n.bonesUrl(A), (function(A) {
                t._parseBones(A),
                Bh.debug("bones load from online"),
                e(),
                t._onTaskFinished()
            }
            ), void 0, (function(A) {
                o.dispatchEventEx({
                    type: Tc.LOAD_COMPONENT_ERROR,
                    modelKey: o.modelKey
                })
            }
            ));
            t.requests.loadBones = a
        }
    }
    ,
    Xu.prototype.loadClips = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.model
          , n = this.url
          , r = vc.GeoWorkerUrl;
        if (vc.UseGeoWorker)
            i.setResponseType("json"),
            i.load(n.mpkUrl(A), (function(A) {
                var i = new Worker(r);
                i.onmessage = function(A) {
                    var i = A.data;
                    for (var o in i)
                        i.hasOwnProperty(o);
                    e(),
                    t._onTaskFinished()
                }
                ,
                i.postMessage({
                    msg: A
                })
            }
            ), (function(A) {}
            ));
        else {
            i.setResponseType("json"),
            i.setCacheViable(!this.offLine);
            var a = i.load(n.clipsUrl(A), (function(A) {
                t._parseClips(A),
                Bh.debug("Clips load from online"),
                e(),
                t._onTaskFinished()
            }
            ), void 0, (function(A) {
                o.dispatchEventEx({
                    type: Tc.LOAD_COMPONENT_ERROR,
                    modelKey: o.modelKey
                })
            }
            ));
            t.requests.loadClips = a
        }
    }
    ,
    Xu.prototype.loadNodes = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.model
          , n = this.url
          , r = vc.GeoWorkerUrl;
        if (vc.UseGeoWorker)
            i.setResponseType("json"),
            i.load(n.mpkUrl(A), (function(A) {
                var i = new Worker(r);
                i.onmessage = function(A) {
                    var i = A.data;
                    for (var o in i)
                        i.hasOwnProperty(o);
                    e(),
                    t._onTaskFinished()
                }
                ,
                i.postMessage({
                    msg: A
                })
            }
            ), (function(A) {}
            ));
        else {
            i.setResponseType("json"),
            i.setCacheViable(!this.offLine);
            var a = i.load(n.nodesUrl(A), (function(A) {
                t._parseNodes(A),
                Bh.debug("Nodes load from online"),
                e(),
                t._onTaskFinished()
            }
            ), void 0, (function(A) {
                o.dispatchEventEx({
                    type: Tc.LOAD_COMPONENT_ERROR,
                    modelKey: o.modelKey
                })
            }
            ));
            t.requests.loadNodes = a
        }
    }
    ,
    Xu.prototype.loadAttribute = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.model
          , n = this.url
          , r = vc.GeoWorkerUrl;
        if (vc.UseGeoWorker)
            i.setResponseType("json"),
            i.load(n.mpkUrl(A), (function(A) {
                var i = new Worker(r);
                i.onmessage = function(A) {
                    var i = A.data;
                    for (var o in i)
                        i.hasOwnProperty(o);
                    e(),
                    t._onTaskFinished()
                }
                ,
                i.postMessage({
                    msg: A
                })
            }
            ), (function(A) {}
            ));
        else {
            i.setResponseType("json"),
            i.setCacheViable(!this.offLine);
            var a = i.load(n.attributeUrl(), (function(A) {
                if (A instanceof String)
                    try {
                        A = JSON.parse(A)
                    } catch (A) {}
                o.attributes = A,
                Bh.debug("Attribute load from online")
            }
            ), void 0, (function(A) {
                o.dispatchEventEx({
                    type: Tc.LOAD_COMPONENT_ERROR,
                    modelKey: o.modelKey
                })
            }
            ));
            t.requests.loadAttribute = a
        }
    }
    ,
    Xu.prototype.loadGeopkOnDemand = function(A, e, t) {
        this.loadTaskCount = 0,
        this.maxLoadTaskCount = A.length,
        this._loadingOnDemand = !0,
        this.finishCallback = t;
        var i = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var o = this.url, n = [], r = 0; A.length > r; r += 1)
                n.push(o.mpkUrl(A[r]));
            var a = this.model.getStorage();
            a && a.getBatch(n, (function(A) {
                for (var t = function(e) {
                    if (A[n[e]])
                        if (!0 === A[n[e]].split) {
                            var t = A[n[e]].list
                              , o = new Uint8Array(A[n[e]].length);
                            a.getBatch(t, (function(A) {
                                for (var r = 0; t.length > r; r += 1)
                                    A[t[r]] ? o.set(new Uint8Array(A[t[r]]), 4e7 * r) : Bh.error("获取分割几何失败");
                                var a = n[e].indexOf("fileKey=");
                                i._parseGeometrie(o.buffer, n[e].slice(a + 8)),
                                Bh.debug("load geo from local"),
                                i._onTaskFinished()
                            }
                            ), (function() {
                                Bh.error("获取分割几何失败")
                            }
                            ))
                        } else
                            s = n[e].indexOf("fileKey="),
                            i._parseGeometrie(A[n[e]], n[e].slice(s + 8)),
                            Bh.debug("load geo from local"),
                            i._onTaskFinished();
                    else {
                        if (r = i.taskGeometrieManager,
                        -1 === (s = n[e].indexOf("fileKey=")))
                            return Bh.error("url is not has fileKey"),
                            {
                                v: void 0
                            };
                        r.addTask(n[e].slice(s + 8)),
                        Bh.debug("load geo from net")
                    }
                }, o = 0; n.length > o; o += 1) {
                    var r, s, l = t(o);
                    if ("object" === lc(l))
                        return l.v
                }
                i.taskGeometrieManager.processTasks(i.loadGeometrie.bind(i), e)
            }
            ), (function() {
                for (var t = i.taskGeometrieManager, o = 0; A.length > o; o += 1)
                    t.addTask(A[o]);
                t.processTasks(i.loadGeometrie.bind(i), e)
            }
            ))
        } else {
            for (var s = this.taskGeometrieManager, l = 0; A.length > l; l += 1)
                s.addTask(A[l]);
            s.processTasks(i.loadGeometrie.bind(i), e)
        }
    }
    ,
    Xu.prototype.loadAxisNet = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.url
          , n = this.model;
        rp(t.dataVersion, "1") ? i.setResponseType("json") : i.setResponseType("arraybuffer"),
        i.setCacheViable(!this.offLine);
        var r = i.load(o.axisNetUrl(A), (function(A) {
            t._parseAxisNet(A),
            Bh.debug("axis net  load from online"),
            e && e()
        }
        ), void 0, (function(A) {
            n.dispatchEventEx({
                type: Tc.LOAD_AXISNET_ERROR,
                modelKey: n.modelKey
            })
        }
        ));
        t.requests.loadAxisNet = r
    }
    ,
    Xu.prototype.loadFloorInfo = function(A, e) {
        var t = this;
        this._loadFloorInfoFromDB(A, (function(i) {
            i && i.data ? (t._parseFloorInfo(i),
            e && e(!0)) : t._loadFloorInfoFromNet(A, (function(A) {
                A ? (t._parseFloorInfo(A),
                e && e(!0)) : e && e(!1)
            }
            ))
        }
        ))
    }
    ,
    Xu.prototype._loadFloorInfoFromDB = function(A, e) {
        if (vc.getDataFromIndexedDB && !this.offLine) {
            var t = this.url.floorInfoUrl(A)
              , i = this.model.getStorage();
            i && i.getBatch([t], (function(A) {
                A[t] ? (e(A[t]),
                Bh.debug("load floorinfo from local")) : e()
            }
            ), (function() {
                e()
            }
            ))
        } else
            e()
    }
    ,
    Xu.prototype._loadFloorInfoFromNet = function(A, e) {
        var t = new bu(this)
          , i = this.url
          , o = this.model;
        this.model.accessToken && t.setRequestHeader({
            Authorization: this.model.accessToken
        }),
        rp(this.dataVersion, "1") ? t.setResponseType("json") : t.setResponseType("arraybuffer"),
        t.setCacheViable(!this.offLine);
        var n = t.load(i.floorInfoUrl(A), (function(A) {
            Bh.debug("floor info load from online"),
            e && e(A)
        }
        ), void 0, (function(t) {
            o.dispatchEventEx({
                type: Tc.LOAD_FLOORINFO_ERROR,
                modelKey: A
            }),
            e && e()
        }
        ));
        this.requests.loadFloorInfo = n
    }
    ,
    Xu.prototype._parseReuseNodes = function(A, e) {
        if (A) {
            vc.useGzip && (A = JSON.parse(uh.ab2str(pako.ungzip(A))));
            var t = this.descriptor;
            t && (t.referencedMeshCache.reuseNodes = A)
        } else
            Bh.error("没有数据")
    }
    ,
    Xu.prototype.loadReuseNode = function(A, e) {
        var t = this
          , i = this.jsonLoader
          , o = this.model
          , n = this.url;
        i.setResponseType("json"),
        vc.useGzip && i.setResponseType("arraybuffer"),
        i.setCacheViable(!0);
        i.load(n.mpkUrl(A), (function(A) {
            t._parseReuseNodes(A),
            Bh.debug("component load from online"),
            e(),
            t._onTaskFinished()
        }
        ), void 0, (function(A) {
            o.dispatchEventEx({
                type: Tc.LOAD_COMPONENT_ERROR,
                modelKey: o.modelKey
            })
        }
        ))
    }
    ,
    Xu.prototype._parseFloorInfo = function(A) {
        if (A.data && 0 !== Object.keys(A.data).length) {
            var e = new zu;
            e.floors = Yu.parseFloorInfos(A.data),
            e.modelKey = this.model.modelKey;
            var t = new Ju;
            t.floors = e.floors,
            e.floorExplosionInfo = t,
            e.modelType = this.model.getConfig().type,
            this.model.floorManager = e,
            e.model = this.model
        }
    }
    ;
    var _u = {
        IfcRoof: {
            color: [.837255, .203922, .270588, 1]
        },
        IfcSlab: {
            color: [.637255, .603922, .670588, 1]
        },
        IfcWall: {
            color: [.537255, .337255, .237255, 1]
        },
        IfcWallStandardCase: {
            color: [.537255, .337255, .237255, 1]
        },
        IfcDoor: {
            color: [.637255, .603922, .670588, 1]
        },
        IfcWindow: {
            color: [.137255, .403922, .870588, .4]
        },
        IfcOpeningElement: {
            color: [.137255, .403922, .870588, .1]
        },
        IfcRailing: {
            color: [.137255, .403922, .870588, 1]
        },
        IfcColumn: {
            color: [.137255, .403922, .870588, 1]
        },
        IfcBeam: {
            color: [.137255, .403922, .870588, 1]
        },
        IfcFurnishingElement: {
            color: [.137255, .403922, .870588, 1]
        },
        IfcCurtainWall: {
            color: [.137255, .403922, .870588, 1]
        },
        IfcStair: {
            color: [.637255, .603922, .670588, 1]
        },
        IfcStairFlight: {
            color: [.637255, .603922, .670588, 1]
        },
        IfcBuildingElementProxy: {
            color: [.5, .5, .5, 1]
        },
        IfcFlowSegment: {
            color: [.137255, .403922, .870588, 1]
        },
        IfcFlowitting: {
            color: [.137255, .403922, .870588, 1]
        },
        IfcFlowTerminal: {
            color: [.137255, .403922, .870588, 1]
        },
        IfcProxy: {
            color: [.137255, .403922, .870588, 1]
        },
        IfcSite: {
            color: [.137255, .403922, .870588, 1]
        },
        IfcLightFixture: {
            color: [.8470588235, .8470588235, .870588, 1]
        },
        IfcDuctSegment: {
            color: [.8470588235, .427450980392, 0, 1]
        },
        IfcDistributionFlowElement: {
            color: [.8470588235, .427450980392, 0, 1]
        },
        IfcDuctFitting: {
            color: [.8470588235, .427450980392, 0, 1]
        },
        IfcPlate: {
            color: [.137255, .403922, .870588, .5]
        },
        IfcAirTerminal: {
            color: [.8470588235, .427450980392, 0, 1]
        },
        IfcMember: {
            color: [.8470588235, .427450980392, 0, 1]
        },
        IfcCovering: {
            color: [.8470588235, .427450980392, 0, 1]
        },
        IfcTransportElement: {
            color: [.8470588235, .427450980392, 0, 1]
        },
        IfcFlowController: {
            color: [.8470588235, .427450980392, 0, 1]
        },
        IfcFlowFitting: {
            color: [.8470588235, .427450980392, 0, 1]
        },
        IfcRamp: {
            color: [.8470588235, .427450980392, 0, 1]
        },
        IfcFurniture: {
            color: [.8470588235, .427450980392, 0, 1]
        },
        IfcFooting: {
            color: [.8470588235, .427450980392, 0, 1]
        },
        IfcSystemFurnitureElement: {
            color: [.8470588235, .427450980392, 0, 1]
        },
        IfcSpace: {
            color: [.137255, .303922, .570588, .5]
        },
        DEFAULT: {
            color: [.8470588235, .427450980392, 0, 1]
        }
    }
      , $u = function(A) {
        this.symbolReader = null,
        this.userIdReader = null,
        this.userDataReader = null,
        this.mapSceneReader = {},
        this.lightmap = !1,
        this.mapNodeInfoByCategory = {},
        this.mapNodeInfoByUserId = {},
        this.mapNodeInfoByNodeId = {},
        this.mapNodeInfoByComponentKey = {},
        this.mapNodeInfoByParameterizedDesc = {},
        this.mapNodeInfoByGeometryId = {},
        this.referencedMeshCache = {},
        this.componentCount = 0,
        this.borderLines = {},
        this.octreeRootNode = {
            inner: null,
            outer: null,
            layer: null
        },
        this.meshCache = {},
        this.allBones = {},
        this.model = A
    };
    $u.EnumNodeItemType = {
        SYMBOL: 0,
        MESH: 1,
        TUBE: 2,
        PIPE: 3,
        BOX: 4,
        BOX_M: 5,
        PIPE_M: 6,
        MESH_REF: 7,
        LINE: 8
    },
    $u.NodeInfoCategory = {
        INSTANCED: 0,
        STANDARD: 1
    },
    $u.EnumDataType = {
        NONE: 0,
        MERGE_DATA: 1,
        LAYER: 2,
        LAYER_SCENE: 3,
        ANIMATION: 4
    },
    $u.EnumKeyframeTrackType = {
        position: "position",
        scale: "scale",
        quaternion: "quaternion",
        weights: "weights"
    },
    $u.prototype.destroy = function() {
        this.destroyReader(),
        this.octreeRootNode = null,
        this.mapNodeInfoByCategory = {},
        this.mapNodeInfoByUserId = {},
        this.mapNodeInfoByNodeId = {},
        this.mapNodeInfoByComponentKey = {},
        this.mapNodeInfoByParameterizedDesc = {},
        this.mapNodeInfoByGeometryId = {},
        this.referencedMeshCache = {},
        this.componentCount = 0,
        this.borderLines = {}
    }
    ,
    $u.prototype.destroyReader = function() {
        this.userIdReader = {},
        this.userDataReader = {},
        this.symbolReader = {},
        this.mapSceneReader = {}
    }
    ,
    $u.prototype.getSceneReaderMap = function() {
        return this.mapSceneReader
    }
    ,
    $u.prototype.isValidScene = function() {
        return !uh.isEmptyObject(this.getSceneReaderMap()) || (Bh.log("model load not started!"),
        !1)
    }
    ,
    $u.prototype.parseItemData = function(A) {
        var e = this.model;
        (ap(e.dataVersion, "2.0.0") || void 0 === e.dataVersion) && (Bh.time("升级几何结构"),
        this._updateV1ToV2(e),
        e.dataVersion = "2.0.0",
        Bh.timeEnd("升级几何结构")),
        this._readMaterialBuffer(e),
        e.hasAnimation && vc.EnableAnimation ? (this._parseClips(),
        this._parseBones()) : this._parseGeo();
        var t = {}
          , i = this.referencedMeshCache;
        for (var o in Bh.time("_readItemData"),
        i.bufferData && Object.keys(i.bufferData).length > 0 || A && A(),
        i.components)
            this._readItemData(t, o, o, void 0, 0);
        e.hasAnimation && vc.EnableAnimation && this._parseNodes(),
        Bh.timeEnd("_readItemData"),
        t = null,
        A && A()
    }
    ,
    $u.prototype.asyncParseItemData = function(A) {
        for (var e = this.getSceneReaderMap(), t = Object.keys(e), i = t.length, o = 0, n = this, r = 0; i > r; r += 1) {
            var a = e[t[r]];
            uh.asyncProcess(a, a.header.componentCount, 100, (function(A, e) {
                n._parseItemDataBy(A, e)
            }
            ), (function() {
                (o += 1) === i && A && A()
            }
            ))
        }
    }
    ,
    $u.prototype._parseItemDataBy = function(A, e) {
        for (var t = A.getComponentInfo(e), i = t.itemIndex; t.itemCount > i; i += 1)
            this._readItemData(A, i, e)
    }
    ,
    $u.prototype.parseItemDataByComponentKey = function(A) {
        var e = this.getSceneReaderMap();
        for (var t in e)
            this._parseItemDataBy(e[t], A)
    }
    ,
    $u.prototype._readItemData = function(A, e, t) {
        var i = this.referencedMeshCache.components[e];
        void 0 !== i && -1 !== i.geoId && this._readMeshInfo(A, t, i, null)
    }
    ,
    $u.prototype._readSymbolInfo = function(A, e, t) {
        var i = this.symbolReader;
        if (i) {
            var o = i.header.symbolCount
              , n = t.toData
              , r = A.getMatrixInfo(t.matrixId).matrix.clone()
              , a = {
                matrix: r,
                ItemId: t.ItemId,
                originalId: t.originalId,
                userDataId: t.userDataId,
                materialId: t.materialId
            };
            if (n >= 0 && o > n)
                for (var s = i.getSymbolInfo(n), l = s.itemIndex; s.itemCount > l; l += 1) {
                    var c = i.getItemInfo(l);
                    c.type !== $u.EnumNodeItemType.SYMBOL && this._readMeshInfo(i, e, c, a)
                }
            r = null,
            a = null,
            i = null
        }
    }
    ,
    $u.prototype._readMeshInfo = function(A, e, t, i) {
        var o = null
          , n = null;
        null === i ? (t.userDataId,
        o = t.originalId,
        n = t.materials || t.matId) : (i.userDataId,
        o = i.originalId,
        n = i.materialId > -1 ? i.materialId : t.materialId);
        var r = null;
        if (r = this._getMeshNodeAttr(A, t, i)) {
            if (t.buildInCategory && (r.buildInCategory = t.buildInCategory),
            r.userId = e,
            r.name = t.name,
            r.type = t.type,
            r.componentKey = e,
            r.originalId = o,
            r.materialId = n,
            r.state = Lc.Visible,
            r.material = null,
            r.originMId = n,
            r.userData = null,
            r.categoryId = 0,
            r.familyName = t.familyName,
            r.familySymbol = t.familySymbol,
            this.lightmap) {
                var a = t.ItemId;
                i && (a = i.ItemId + "_" + t.ItemId),
                r.itemIdUV2 = a
            }
            r.instanceOrNot = !1,
            this._classifyNodeInfo(r),
            r = null
        }
    }
    ,
    $u.prototype._getMeshNodeAttrOfPipe = function(A, e, t) {
        var i = A.getMatrixInfo(e.matrixId).matrix.clone();
        t && i.multiplyMatrices(t.matrix, i);
        var o = e.boundingBox.clone();
        o.applyMatrix4(i);
        var n = A.getGeomPipeInfo(e.toData)
          , r = n.startPt
          , a = n.endPt
          , s = new y;
        s.subVectors(a, r);
        var l = s.length();
        s.normalize();
        var c = n.radius;
        c > 1 || (c = 100);
        var h = new y(0,1,0)
          , d = new y(c,l,c)
          , p = (new f).setFromUnitVectors(h, s)
          , g = r.clone().addScaledVector(s, .5 * l)
          , u = (new M).compose(g, p, d);
        return i.multiply(u),
        n = null,
        {
            nodeId: (t ? t.ItemId + "_" + e.ItemId : e.ItemId) + "_pipe",
            geometryId: "pipe",
            boundingBox: o,
            matrix: i
        }
    }
    ,
    $u.prototype._getMeshNodeAttrOfTube = function(A, e, t) {
        var i = this._getMeshNodeAttrOfPipe(A, e, t);
        return i.nodeId += "_tube",
        i.geometryId = "tube",
        i
    }
    ,
    $u.prototype._getMeshNodeAttrOfBox = function(A, e, t) {
        var i = A.getMatrixInfo(e.matrixId).matrix.clone();
        t && i.multiplyMatrices(t.matrix, i);
        var o = e.boundingBox.clone();
        o.applyMatrix4(i);
        var n = e.boundingBox
          , r = n.getSize()
          , a = n.getCenter()
          , s = (new M).scale(new y(r.x,r.y,r.z));
        return s.setPosition(a),
        i.multiply(s),
        {
            nodeId: (t ? t.ItemId + "_" + e.ItemId : e.ItemId) + "_box",
            geometryId: "box",
            boundingBox: o,
            matrix: i
        }
    }
    ,
    $u.prototype._getMeshNodeAttrOfBoxM = function(A, e, t) {
        var i = A.getMatrixInfo(e.matrixId).matrix.clone();
        t && i.multiplyMatrices(t.matrix, i);
        var o = e.boundingBox.clone();
        return o.applyMatrix4(i),
        {
            nodeId: (t ? t.ItemId + "_" + e.ItemId : e.ItemId) + "_boxM",
            geometryId: "boxM",
            boundingBox: o,
            matrix: i,
            uvArrayBuffer: A.getGeomBoxUvInfo(e.toData)
        }
    }
    ,
    $u.prototype._getMeshNodeAttrOfPipeM = function(A, e, t) {
        var i = A.getMatrixInfo(e.matrixId).matrix.clone();
        t && i.multiplyMatrices(t.matrix, i);
        var o = e.boundingBox.clone();
        return o.applyMatrix4(i),
        {
            nodeId: (t ? t.ItemId + "_" + e.ItemId : e.ItemId) + "_pipeM",
            geometryId: "pipeM",
            boundingBox: o,
            matrix: i,
            uvArrayBuffer: A.getGeomPipeUvInfo(e.toData)
        }
    }
    ,
    $u.prototype._getMeshNodeAttrOfMeshRef = function(A, e, t) {
        var i = A.getMatrixInfo(e.matrixId).matrix.clone();
        t && i.multiplyMatrices(t.matrix, i);
        var o = e.boundingBox.clone();
        return o.applyMatrix4(i),
        {
            nodeId: "refMesh|" + (t ? t.ItemId + "_" + e.ItemId : e.ItemId),
            geometryId: e.toData,
            boundingBox: o,
            matrix: i
        }
    }
    ,
    $u.prototype._getMeshNodeAttr = function(A, e, t, i) {
        var o = new M;
        o.fromArray(e.matrix || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
        vc.DataReduction && o.scale(new y(1e3,1e3,1e3));
        var n = t ? e.key + "_" + i : e.key
          , r = t ? e.geoId + "_" + i : e.geoId;
        if (-1 !== r) {
            var a = new ph
              , s = this.getReferencedMeshBufferById(e.geoId);
            return s && s.position ? (a = Tu.getBoundingBoxByBuffer(s.position)).applyMatrix4(o) : Bh.error("没有找到对应几何"),
            {
                nodeId: n,
                guid: e.guid,
                geometryId: r,
                originalGeometryId: e.geoId,
                matrix: o,
                boundingBox: a,
                model: this.model
            }
        }
    }
    ,
    $u.prototype._getComponentNodeAttr = function(A, e) {
        var t = new M;
        t.fromArray(A.matrix || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
        vc.DataReduction && t.scale(new y(1e3,1e3,1e3)),
        e && t.multiplyMatrices(e.matrix, t);
        var i = A.nodeId
          , o = A.geoId;
        if (-1 !== o) {
            var n = A.maxBoundary || e.maxBoundary
              , r = A.minBoundary || e.minBoundary
              , a = new ph;
            return a.set(r, n),
            {
                nodeId: i,
                guid: A.guid,
                geometryId: o,
                originalGeometryId: A.geoId,
                matrix: t,
                boundingBox: a,
                model: this.model
            }
        }
    }
    ,
    $u.prototype._getLineNodeAttr = function(A, e, t) {
        var i = e.boundingBox.clone()
          , o = null;
        return -1 !== e.matrixId ? (o = A.getMatrixInfo(e.matrixId).matrix.clone(),
        t && o.multiplyMatrices(t.matrix, o),
        i.applyMatrix4(o)) : (o = new M,
        t && i.applyMatrix4(t.matrix)),
        {
            nodeId: t ? "line-" + t.ItemId + "-" + e.ItemId : "line-" + e.ItemId,
            geometryId: "line-" + e.toData,
            boundingBox: i,
            matrix: o
        }
    }
    ,
    $u.prototype._classifyNodeInfo = function(A) {
        this._cacheNodeInfoByComponentKey(A),
        this._cacheNodeInfoByNodeId(A),
        this._cacheNodeInfoByUserId(A),
        this._cacheNodeInfoByCategory(A),
        this._cacheNodeInfoByParameterizedDesc(A)
    }
    ,
    $u.prototype._cacheNodeInfoByComponentKey = function(A) {
        void 0 === this.mapNodeInfoByComponentKey[A.componentKey] && (this.mapNodeInfoByComponentKey[A.componentKey] = []),
        this.mapNodeInfoByComponentKey[A.componentKey].push(A)
    }
    ,
    $u.prototype._cacheNodeInfoByUserId = function(A) {
        void 0 === this.mapNodeInfoByUserId[A.userId] && (this.mapNodeInfoByUserId[A.userId] = []),
        this.mapNodeInfoByUserId[A.userId].push(A)
    }
    ,
    $u.prototype._cacheNodeInfoByNodeId = function(A) {
        this.mapNodeInfoByNodeId[A.nodeId] = A
    }
    ,
    $u.prototype._cacheNodeInfoByCategory = function(A) {
        var e = null;
        void 0 === this.mapNodeInfoByCategory[e = A.instanceOrNot ? $u.NodeInfoCategory.INSTANCED : $u.NodeInfoCategory.STANDARD] && (this.mapNodeInfoByCategory[e] = {}),
        void 0 === this.mapNodeInfoByCategory[e][A.userId] && (this.mapNodeInfoByCategory[e][A.userId] = []),
        this.mapNodeInfoByCategory[e][A.userId].push(A)
    }
    ,
    $u.prototype._cacheNodeInfoByParameterizedDesc = function(A) {
        A.parameterizedDesc && (void 0 === this.mapNodeInfoByParameterizedDesc[A.type] && (this.mapNodeInfoByParameterizedDesc[A.type] = []),
        this.mapNodeInfoByParameterizedDesc[A.type].push(A))
    }
    ,
    $u.prototype._clearNodeInfoCacheWithParameterizedDesc = function(A) {
        if (A)
            for (var e = 0, t = A.length; t > e; e += 1)
                delete this.mapNodeInfoByParameterizedDesc[A[e]];
        else
            this.mapNodeInfoByParameterizedDesc = {}
    }
    ,
    $u.prototype._clearNodeInfoCacheWithComponentKey = function(A) {
        if (A)
            for (var e = 0, t = A.length; t > e; e += 1)
                delete this.mapNodeInfoByComponentKey[A[e]];
        else
            this.mapNodeInfoByComponentKey = {}
    }
    ,
    $u.prototype._clearNodeInfoCacheWithCategory = function(A) {
        if (A)
            for (var e = this.mapNodeInfoByCategory[$u.NodeInfoCategory.INSTANCED], t = this.mapNodeInfoByCategory[$u.NodeInfoCategory.STANDARD], i = 0, o = A.length; o > i; i += 1)
                e && delete e[A[i]],
                t && delete t[A[i]];
        else
            this.mapNodeInfoByCategory = {}
    }
    ,
    $u.prototype.clearNodeInfoCacheByComponentsKey = function(A) {
        this._clearNodeInfoCacheWithComponentKey(A),
        this._clearNodeInfoCacheWithUserId(A),
        this._clearNodeInfoCacheWithCategory(A)
    }
    ,
    $u.prototype._clearNodeInfoCacheWithUserId = function(A) {
        if (A)
            for (var e = 0, t = A.length; t > e; e += 1)
                delete this.mapNodeInfoByUserId[A[e]],
                delete this.mapNodeInfoByNodeId[A[e]];
        else
            this.mapNodeInfoByUserId = {};
        this.mapNodeInfoByUserId = {}
    }
    ,
    $u.prototype.clearNodeInfoCache = function() {
        this._clearNodeInfoCacheWithComponentKey(),
        this._clearNodeInfoCacheWithUserId(),
        this._clearNodeInfoCacheWithCategory()
    }
    ,
    $u.prototype.getNodeInfosByComponentKey = function(A) {
        return this.mapNodeInfoByComponentKey[A]
    }
    ,
    $u.prototype.getNodeInfosWithComponentKey = function() {
        return this.mapNodeInfoByComponentKey
    }
    ,
    $u.prototype.getAllNodeInfos = function() {
        return this.mapNodeInfoByUserId
    }
    ,
    $u.prototype.getNodeInfosByUserId = function(A) {
        return this.mapNodeInfoByUserId[A]
    }
    ,
    $u.prototype.getNodeInfosByNodeId = function(A) {
        return this.mapNodeInfoByNodeId[A]
    }
    ,
    $u.prototype.getNodeInfosWithUserId = function() {
        return this.mapNodeInfoByUserId
    }
    ,
    $u.prototype.getStandardNodeInfos = function() {
        return this.mapNodeInfoByCategory[$u.NodeInfoCategory.STANDARD]
    }
    ,
    $u.prototype.getInstancedNodeInfos = function() {
        return this.mapNodeInfoByCategory[$u.NodeInfoCategory.INSTANCED]
    }
    ,
    $u.prototype.getStandardUserIds = function() {
        return this.getStandardNodeInfos() ? Object.keys(this.getStandardNodeInfos()) : []
    }
    ,
    $u.prototype.getInstancedUserIds = function() {
        return this.getInstancedNodeInfos() ? Object.keys(this.getInstancedNodeInfos()) : []
    }
    ,
    $u.prototype.getStandardNodeInfosById = function(A) {
        var e = this.getStandardNodeInfos();
        return e ? e[A] : null
    }
    ,
    $u.prototype.getInstancedNodeInfosById = function(A) {
        var e = this.getInstancedNodeInfos();
        return e ? e[A] : null
    }
    ,
    $u.prototype._getUserIdsByCategory = function(A, e) {
        var t = []
          , i = null;
        if (i = e === $u.NodeInfoCategory.INSTANCED ? this.getInstancedNodeInfos() : this.getStandardNodeInfos())
            for (var o = 0, n = A.length; n > o; o += 1)
                i[A[o]] && t.push(A[o]);
        return t
    }
    ,
    $u.prototype.getInstancedUserIdsByCategory = function(A) {
        return this._getUserIdsByCategory(A, $u.NodeInfoCategory.INSTANCED)
    }
    ,
    $u.prototype.getStandardUserIdsByCategory = function(A) {
        return this._getUserIdsByCategory(A, $u.NodeInfoCategory.STANDARD)
    }
    ,
    $u.prototype._traverseNodeInfosByIds = function(A, e, t) {
        for (var i = 0, o = e.length; o > i; i += 1) {
            var n = e[i];
            t(n, A[n])
        }
    }
    ,
    $u.prototype.traverseStandardNodeInfos = function(A, e) {
        var t = this.getStandardNodeInfos();
        t && (A = A || this.getStandardUserIds(),
        this._traverseNodeInfosByIds(t, A, e))
    }
    ,
    $u.prototype.traverseInstancedNodeInfos = function(A, e) {
        var t = this.getInstancedNodeInfos();
        t && (A = A || this.getInstancedUserIds(),
        this._traverseNodeInfosByIds(t, A, e))
    }
    ,
    $u.prototype.traverseNodeInfosByComponent = function(A) {
        for (var e = Object.keys(this.mapNodeInfoByComponentKey), t = 0, i = e.length; i > t; t += 1)
            for (var o = e[t], n = this.mapNodeInfoByComponentKey[o], r = 0, a = n.length; a > r; r += 1)
                A(o, n[r])
    }
    ,
    $u.prototype.clearReferencedMeshCache = function() {
        if (!vc.DEBUG) {
            for (var A in this.referencedMeshCache)
                delete this.referencedMeshCache[A];
            this.referencedMeshCache = null
        }
    }
    ,
    $u.prototype.cacheReferencedMeshBufferData = function(A, e) {
        this.referencedMeshCache.bufferData || (this.referencedMeshCache.bufferData = {}),
        this.referencedMeshCache.bufferData[A] = e
    }
    ,
    $u.prototype.cacheReferencedMeshComponentNodeData = function(A, e) {
        this.referencedMeshCache.componentNode || (this.referencedMeshCache.componentNode = {}),
        this.referencedMeshCache.componentNode[A] = e
    }
    ,
    $u.prototype.cacheReferencedMeshWireframeData = function(A, e) {
        this.referencedMeshCache.wireframeData || (this.referencedMeshCache.wireframeData = {}),
        this.referencedMeshCache.wireframeData[A] = e
    }
    ,
    $u.prototype.getReferencedMeshBufferData = function() {
        return this.referencedMeshCache.bufferData
    }
    ,
    $u.prototype.getReferencedMeshBufferById = function(A) {
        return this.referencedMeshCache && this.referencedMeshCache.bufferData ? this.referencedMeshCache.bufferData[A] : null
    }
    ,
    $u.prototype.getReferencedMeshComponentNodeById = function(A) {
        return this.referencedMeshCache && this.referencedMeshCache.componentNode ? this.referencedMeshCache.componentNode[A] : null
    }
    ,
    $u.prototype.getReferencedMeshWireframeDataById = function(A) {
        return this.referencedMeshCache && this.referencedMeshCache.wireframeData ? this.referencedMeshCache.wireframeData[A] : null
    }
    ,
    $u.prototype.cacheReferencedMeshBoneBufferData = function(A, e) {
        this.referencedMeshCache.bones || (this.referencedMeshCache.bones = {}),
        this.referencedMeshCache.bones[A] = e
    }
    ,
    $u.prototype.cacheReferencedMeshClipsData = function(A) {
        this.referencedMeshCache.clips = A
    }
    ,
    $u.prototype.cacheReferencedMeshNodesData = function(A) {
        this.referencedMeshCache.nodes = A
    }
    ,
    $u.prototype.cacheReferencedMeshComponentData = function(A, e) {
        this.referencedMeshCache.components || (this.referencedMeshCache.components = {}),
        this.referencedMeshCache.components[A] = e
    }
    ,
    $u.prototype.cacheReferencedMeshMaterialData = function(A, e) {
        this.referencedMeshCache.materials || (this.referencedMeshCache.materials = {}),
        this.referencedMeshCache.materials[A] = e
    }
    ,
    $u.prototype.cacheReferencedMeshGeoIds = function(A, e) {
        this.referencedMeshCache.mpkIds || (this.referencedMeshCache.mpkIds = {}),
        this.referencedMeshCache.mpkIds[A] || (this.referencedMeshCache.mpkIds[A] = []),
        this.referencedMeshCache.mpkIds[A].push(e)
    }
    ,
    $u.prototype.clearReferencedMeshCacheByGeopkIdxs = function(A, e) {
        if (this.referencedMeshCache.mpkIds)
            for (var t = 0, i = A.length; i > t; t += 1) {
                var o = A[t]
                  , n = this.referencedMeshCache.mpkIds[o];
                if (n) {
                    for (var r = 0, a = n.length; a > r; r += 1)
                        e && e(n[r]),
                        delete this.referencedMeshCache[n[r]];
                    delete this.referencedMeshCache.mpkIds[o]
                }
            }
    }
    ,
    $u.prototype.cacheBorderLine = function(A, e) {
        var t = A ? "shared" : "unique";
        this.borderLines[t] || (this.borderLines[t] = []),
        this.borderLines[t].push(e)
    }
    ,
    $u.prototype.getSharedBorderLineCache = function() {
        return this.borderLines.shared
    }
    ,
    $u.prototype.getUniqueBorderLineCache = function() {
        return this.borderLines.unique
    }
    ,
    $u.prototype._isRegularShape = function(A) {
        return A.type === $u.EnumNodeItemType.TUBE || A.type === $u.EnumNodeItemType.PIPE || A.type === $u.EnumNodeItemType.BOX || A.type === $u.EnumNodeItemType.BOX_M || A.type === $u.EnumNodeItemType.PIPE_M
    }
    ,
    $u.prototype._isInstancedNode = function(A) {
        return !!vc.Instance && (A.type === $u.EnumNodeItemType.MESH_REF ? !!vc.SharedMeshInstanceEnable : !!A.parameterizedDesc)
    }
    ,
    $u.prototype.getComponentCount = function() {
        return this.componentCount
    }
    ,
    $u.prototype.getOctreeRootNode = function() {
        return this.octreeRootNode
    }
    ,
    $u.prototype.isUseInnerAndOuterOctree = function() {
        return !0
    }
    ,
    $u.prototype.isOctreeOuter = function(A) {
        var e = this.octreeRootNode.inner || this.octreeRootNode.outer;
        return !(e.min.x > A.x || A.x > e.max.x || e.min.y > A.y || A.y > e.max.y || e.min.z > A.z || A.z > e.max.z)
    }
    ,
    $u.prototype.getOctreeRoots = function(A) {
        this.octreeRootNode.outer && A.push(this.octreeRootNode.outer),
        this.octreeRootNode.inner && A.push(this.octreeRootNode.inner)
    }
    ,
    $u.prototype.updateOctreeNodeBy = function(A, e) {
        var t = new aA;
        function i(A, e) {
            t.copy(A.boundingBoxWorld),
            t.applyMatrix4(e),
            A.min.copy(t.min),
            A.max.copy(t.max),
            A.center = t.getCenter(),
            A.size = t.getSize().lengthSq()
        }
        i(A, e),
        function A(e, t) {
            for (var o = 0, n = e.childOctants.length; n > o; o += 1) {
                var r = e.childOctants[o];
                i(r, t),
                A(r, t)
            }
        }(A, e)
    }
    ,
    $u.prototype.updateOctreeNode = function(A) {
        var e = this.getOctreeRootNode();
        e.outer && this.updateOctreeNodeBy(e.outer, A),
        e.inner && this.updateOctreeNodeBy(e.inner, A)
    }
    ,
    $u.prototype.removeFromSceneReaderMap = function(A) {
        for (var e = 0, t = A.length; t > e; e += 1)
            this.mapSceneReader[A[e]] && delete this.mapSceneReader[A[e]]
    }
    ,
    $u.prototype.isUserIdExist = function(A) {
        return !!this.getNodeInfosByUserId(A)
    }
    ,
    $u.prototype.addToNodeInfoMap = function(A) {
        for (var e = 0, t = A.length; t > e; e += 1)
            this._cacheNodeInfoByUserId(A[e])
    }
    ,
    $u.prototype.removeFromNodeInfoMap = function(A) {
        for (var e = this.getAllNodeInfos(), t = 0, i = A.length; i > t; t += 1) {
            var o = A[t].userId;
            e[o] && delete e[o]
        }
    }
    ,
    $u.prototype.cacheNodeInfosOnGeometryId = function() {
        var A = this.getStandardNodeInfos();
        for (var e in this.mapNodeInfoByGeometryId = {},
        A)
            for (var t = A[e], i = 0, o = t.length; o > i; i += 1)
                t[i].geometryId = this.convertGeometryId(t[i].geometryId),
                this.mapNodeInfoByGeometryId[t[i].geometryId] || (this.mapNodeInfoByGeometryId[t[i].geometryId] = []),
                this.mapNodeInfoByGeometryId[t[i].geometryId].push(t[i])
    }
    ,
    $u.prototype.getNodeInfosOnGeometryId = function() {
        return this.mapNodeInfoByGeometryId || this.cacheNodeInfosOnGeometryId(),
        this.mapNodeInfoByGeometryId
    }
    ,
    $u.prototype.clearNodeInfosWithGeometryId = function() {
        this.mapNodeInfoByGeometryId = {}
    }
    ,
    $u.prototype.convertGeometryId = function(A) {
        return A
    }
    ,
    $u.prototype._readMaterialBuffer = function(A) {
        var e = A.materialManager
          , t = e.materials
          , i = e.textures
          , o = this.referencedMeshCache.materials;
        for (var n in o) {
            var r = o[n];
            if (!r)
                return null;
            var a = Kd.createMaterialByMaterialBufferAndTexture(r, i);
            a.refreshUniforms && a.refreshUniforms(),
            t[n] = a,
            vc.EnableShadow && A.manager.viewerImpl.rendererManager.csm && A.manager.viewerImpl.rendererManager.csm.setupMaterial(a)
        }
    }
    ,
    $u.prototype._updateV1ToV2 = function() {
        var A = this.referencedMeshCache.components
          , e = this.referencedMeshCache.bufferData
          , t = this.referencedMeshCache.materials;
        for (var i in A)
            if (A.hasOwnProperty(i)) {
                var o = A[i]
                  , n = o.matId
                  , r = e[o.geoId];
                if (o.materials)
                    continue;
                if (o.materials = [],
                !r)
                    continue;
                var a = t[n];
                if (!a)
                    continue;
                var s = this._updateMaterialV1ToV2(n, a);
                if (s)
                    for (var l in r.materialIndex = s.materialIndex,
                    o.materials = s.materialId,
                    s.materials)
                        s.materials.hasOwnProperty(l) && (this.referencedMeshCache.materials[l] = s.materials[l])
            }
    }
    ,
    $u.prototype._updateMaterialV1ToV2 = function(A, e) {
        var t = {}
          , i = []
          , o = {};
        if (!e)
            return null;
        for (var n = e.color, r = e.colorIndex, a = e.texture, s = e.textureIndex, l = 0; n.length > l; l += 4) {
            var c = {};
            c.color = [n[l], n[l + 1], n[l + 2]],
            c.opacity = Math.floor(100 * n[l + 3]) / 100,
            c.transparent = 1 > n[l + 3];
            var h = (255 * c.color[0] << 16 ^ 255 * c.color[1] << 8 ^ 255 * c.color[2] << 0) + "_" + c.opacity;
            o[h] = c,
            i.push(h)
        }
        if (0 !== a.length && r.length === s.length)
            for (var d = -1, p = 0; s.length > p; p += 1)
                if (d !== r[p] && (d = r[p],
                -1 !== s[p])) {
                    var g = i[r[p]]
                      , u = a[s[p]];
                    if (o[g].map = u,
                    -1 === g.indexOf(u)) {
                        var f = g + "_" + a[s[p]];
                        o[f] = o[g],
                        i.length > Object.keys(o).length - 1 || delete o[g],
                        i[r[p]] = f
                    }
                }
        return t.materials = o,
        t.materialId = i,
        t.materialIndex = r,
        t
    }
    ,
    $u.prototype._computeVertexNormalsFromFaceNormals = function(A, e, t) {
        for (var i = new Float32Array(t), o = 0, n = 0, r = 0, a = 0, s = 0, l = 0, c = 0; A.length > c; c += 3)
            s = A[c + 1],
            l = A[c + 2],
            n = 3 * e[c + 1],
            r = 3 * e[c + 2],
            i[o = 3 * e[c]] = a = A[c],
            i[o + 1] = s,
            i[o + 2] = l,
            i[n] = a,
            i[n + 1] = s,
            i[n + 2] = l,
            i[r] = a,
            i[r + 1] = s,
            i[r + 2] = l;
        return i
    }
    ,
    $u.prototype._computeVertexNormalsFromIndex = function(A, e, t) {
        var i = new Float32Array(e.length);
        if (e) {
            var o = 0
              , n = 0
              , r = 0
              , a = new y
              , s = new y
              , l = new y
              , c = new y
              , h = new y;
            if (A)
                for (var d = A, p = 0; d.length > p; p += 3)
                    n = 3 * d[p + 1],
                    r = 3 * d[p + 2],
                    a.fromArray(e, o = 3 * d[p]),
                    s.fromArray(e, n),
                    l.fromArray(e, r),
                    c.subVectors(l, s),
                    h.subVectors(a, s),
                    c.cross(h),
                    i[o] += c.x,
                    i[o + 1] += c.y,
                    i[o + 2] += c.z,
                    i[n] += c.x,
                    i[n + 1] += c.y,
                    i[n + 2] += c.z,
                    i[r] += c.x,
                    i[r + 1] += c.y,
                    i[r + 2] += c.z;
            else
                for (var g = 0, u = e.length; u > g; g += 9)
                    a.fromArray(e, g),
                    s.fromArray(e, g + 3),
                    l.fromArray(e, g + 6),
                    c.subVectors(l, s),
                    h.subVectors(a, s),
                    c.cross(h),
                    i[g] = c.x,
                    i[g + 1] = c.y,
                    i[g + 2] = c.z,
                    i[g + 3] = c.x,
                    i[g + 4] = c.y,
                    i[g + 5] = c.z,
                    i[g + 6] = c.x,
                    i[g + 7] = c.y,
                    i[g + 8] = c.z
        }
        return i
    }
    ,
    $u.prototype.addMeshToInfoMap = function(A, e, t, i, o) {
        var n = this.getNodeInfosByComponentKey(A);
        Array.isArray(n) && n.forEach((function(A) {
            A.nodeId === e && (A.mesh = t,
            A.index = i,
            A.uv = A.uv || o)
        }
        ))
    }
    ,
    $u.prototype._parseGeo = function() {
        Bh.time("处理几何:计算法线");
        var A = this.referencedMeshCache;
        for (var e in A.bufferData) {
            var t = A.bufferData[e];
            t.position.length !== t.normal.length && (t.normal = t.normal.length === t.index.length ? this._computeVertexNormalsFromFaceNormals(t.normal, t.index, t.position.length) : this._computeVertexNormalsFromIndex(t.index, t.position))
        }
        Bh.timeEnd("处理几何:计算法线")
    }
    ,
    $u.prototype._parseBones = function() {
        var A = this.referencedMeshCache;
        for (var e in A._offsetMatrix || (A._offsetMatrix = {}),
        A.bufferData) {
            var t = A.bufferData[e];
            t.position.length !== t.normal.length && (t.normal = t.normal.length === t.index.length ? this._computeVertexNormalsFromFaceNormals(t.normal, t.index, t.position.length) : this._computeVertexNormalsFromIndex(t.index, t.position));
            var i = A.bones[e];
            if (i) {
                t.skinIndex = i.skinIndex,
                t.skinWeight = i.skinWeight;
                var o = i.name;
                i.offsetMatrix.length / 16 !== o.length && Bh.debug("bones的name数量与Matrix数量不符！");
                for (var n = 0; o.length > n; n += 1)
                    A._offsetMatrix[o[n]] = (new M).fromArray(i.offsetMatrix, 16 * n)
            }
        }
    }
    ,
    $u.prototype._parseClips = function() {
        for (var A = this.referencedMeshCache.clips, e = [], t = 0, i = A.length; i > t; t += 1) {
            for (var o = [], n = A[t], r = 0, a = n.tracks.length; a > r; r += 1) {
                var s = n.tracks[r]
                  , l = null;
                switch (s.type) {
                case $u.EnumKeyframeTrackType.weights:
                    l = Dr;
                    break;
                case $u.EnumKeyframeTrackType.quaternion:
                    l = Nr;
                    break;
                case $u.EnumKeyframeTrackType.position:
                case $u.EnumKeyframeTrackType.scale:
                default:
                    l = Vr
                }
                if (0 === n.ticksPerSec) {
                    n.ticksPerSec = 1e3;
                    for (var c = 0; s.times.length > c; c += 1)
                        s.times[c] /= n.ticksPerSec
                }
                var h = new l(Fs.sanitizeNodeName(s.name) + "." + s.type,s.times,s.values,2301);
                o.push(h)
            }
            var d = new Gr(void 0 !== n.name ? n.name : "animation_" + t,n.duration / n.ticksPerSec,o);
            e.push(d)
        }
        this.model.animations = e
    }
    ,
    $u.prototype._parseNodes = function() {
        var A = this.referencedMeshCache;
        A.allBones = [],
        A.offsetMatrix = [];
        var e = function A(e, t) {
            var i = null;
            "node" === e.type ? i = new H : "bone" === e.type && (i = new Uo,
            t.allBones[e.name] = i),
            i.name = Fs.sanitizeNodeName(e.name),
            i.matrix.fromArray(e.transformation || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
            i.matrix.decompose(i.position, i.quaternion, i.scale);
            for (var o = 0; e.children.length > o; o += 1) {
                var n = A(e.children[o], t);
                n && i.add(n)
            }
            for (var r = 0; e.meshes.length > r; r += 1) {
                var a = e.meshes[r];
                t.model._getHandler().defaultManager.meshManager._readBufferInfo(t.model, [t.model.modelKey + "_" + e.meshes[r]]);
                var s = t.model._getHandler().defaultManager.meshManager._makeSkinMesh(t.model, [t.model.modelKey + "_" + e.meshes[r]], (function(A) {}
                ));
                t.meshCache[a] = s,
                s.name = e.name,
                i.add(s)
            }
            return i
        }(A.nodes, this);
        for (var t in A.bufferData) {
            var i = this.meshCache[t];
            if (i && i.isSkinnedMesh) {
                for (var o = [], n = [], r = 0; A.bones[t].name.length > r; r += 1) {
                    var a = A.bones[t].name[r]
                      , s = A._offsetMatrix[a]
                      , l = this.allBones[a];
                    s && l && (o.push(l),
                    n.push(s))
                }
                var c = new bo(o,n);
                i.bind(c, i.matrixWorld)
            }
        }
        this.model.nodes = e,
        this.model.manager.getScene().onBeforeRender = function(A, e, t, i) {
            e.updateMatrixWorld(!0)
        }
        ,
        this.model.group.add(e),
        (c = new _s(e)).visible = !1,
        this.model.skeleton = c,
        this.model.group.add(c),
        this.model.mixer = new Rs(e),
        this.model.actions = [];
        for (var h = 0; this.model.animations.length > h; h += 1) {
            var d = this.model.mixer.clipAction(this.model.animations[h]);
            this.model.actions.push(d)
        }
    }
    ;
    var Af = function(A) {
        $u.call(this, A),
        this.instancedComponent = {}
    };
    Object.assign(Af.prototype, $u.prototype),
    Af.prototype.parseItemData = function(A) {
        var e = this.model;
        (ap(e.dataVersion, "2.0.0") || void 0 === e.dataVersion) && (Bh.time("升级几何结构"),
        this._updateV1ToV2(e),
        e.dataVersion = "2.0.0",
        Bh.timeEnd("升级几何结构")),
        this._readMaterialBuffer(e),
        e.hasAnimation && vc.EnableAnimation ? (this._parseClips(),
        this._parseBones()) : (this._parseGeo(),
        vc.Instance && sp(e.dataVersion, "2.0.0") && this._parseInstanced());
        var t = {}
          , i = this.referencedMeshCache;
        if (Bh.time("_readItemData"),
        !i.bufferData || 0 >= Object.keys(i.bufferData).length)
            return Bh.warn("缺少几何数据"),
            !0;
        for (var o in i.components)
            this._readItemData(t, o, o, void 0, 0);
        Bh.timeEnd("_readItemData"),
        t = null,
        A && A()
    }
    ,
    Af.prototype._readMeshInfo = function(A, e, t, i) {
        var o = this.model.materialManager.materials
          , n = null
          , r = null
          , a = null
          , s = this.referencedMeshCache;
        if (t.nodes || t.nodeIds) {
            r = t.originalId;
            var l = t
              , c = (new M).fromArray(l.matrix || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
            l.matrix = c;
            var h = [];
            h = l.nodes ? l.nodes : l.nodeIds;
            for (var d = 0; h.length > d; d += 1) {
                var p = h[d];
                if ("object" !== lc(p) && (p = this.getReferencedMeshComponentNodeById(p)),
                p) {
                    var g, u = null;
                    if (a = "",
                    -1 !== p.geoId)
                        if (u = this._getComponentNodeAttr(p, l, d)) {
                            if (l.buildInCategory && (u.buildInCategory = l.buildInCategory),
                            !o[a = p.material]) {
                                var f = _u[l.type] ? _u[l.type].color : void 0;
                                f || (Bh.log("Material not found for type: ", l.type),
                                f = _u.DEFAULT.color),
                                f || (Bh.log("Default material not found for type: ", l.type),
                                f = [1, 1, 1, 1]);
                                var m = new LA(f[0],f[1],f[2])
                                  , C = a || m.getHexString() + "_" + f[3]
                                  , y = o[C];
                                y || (Bh.warn("缺少材质 " + a),
                                y = Kd.createStandardMaterial({
                                    color: m
                                }),
                                1 > f[3] && (y.transparent = !0,
                                y.opacity = f[3]),
                                y.side = 2,
                                o[C] = y),
                                u.material = a = C
                            }
                            if (o[a].aoMap) {
                                var v = this.getReferencedMeshBufferById(u.geometryId);
                                v && (v.uv2 = v.uv)
                            }
                            g = u.nodeId;
                            var I = (K = this.userDataReader) ? K.getUserData(n) : null;
                            u.type = l.type,
                            u.userId = e,
                            u.name = l.name,
                            u.userDataId = n,
                            u.originalId = r,
                            u.materialId = a,
                            u.originMId = a,
                            u.userData = I,
                            u.categoryId = 0,
                            u.componentKey = e,
                            u.familyName = l.familyName,
                            u.familySymbol = l.familySymbol;
                            var E = vc.Instance
                              , B = s.reuseNodes.hasOwnProperty(g);
                            u.instanceOrNot = !(!E || !B),
                            u.isBatched = !0,
                            u.state = Lc.Visible,
                            u.material = null,
                            this._classifyNodeInfo(u),
                            u = null
                        } else
                            Bh.debug("非法node")
                }
            }
        } else if (null === i ? (n = t.userDataId,
        r = t.originalId,
        a = t.materialId || t.matId) : (n = i.userDataId,
        r = i.originalId,
        a = i.materialId > -1 ? i.materialId : t.materialId),
        t.materials || (t.materials = []),
        t.materials.length > 0)
            for (d = 0; t.materials.length > d; d += 1) {
                var x = null;
                if (x = this._getMeshNodeAttr(A, t, t.materials.length > 1, d),
                !o[a = t.materials[d]]) {
                    var S = _u[t.type] ? _u[t.type].color : void 0;
                    S || (Bh.log("Material not found for type: ", t.type),
                    S = _u.DEFAULT.color),
                    S || (Bh.log("Default material not found for type: ", t.type),
                    S = [1, 1, 1, 1]);
                    var w = new LA(S[0],S[1],S[2])
                      , b = a || w.getHexString() + "_" + S[3]
                      , U = o[b];
                    U || (Bh.warn("缺少材质 " + a),
                    U = Kd.createStandardMaterial({
                        color: w
                    }),
                    1 > S[3] && (U.transparent = !0,
                    U.opacity = S[3]),
                    U.side = 2,
                    o[b] = U)
                }
                if (o[a].aoMap) {
                    var F = this.getReferencedMeshBufferById(x.geometryId);
                    F && (F.uv2 = F.uv)
                }
                if (!x)
                    return;
                var K;
                I = (K = this.userDataReader) ? K.getUserData(n) : null;
                x.type = t.type,
                x.userId = e,
                x.name = t.name,
                x.userDataId = n,
                x.originalId = r,
                x.materialId = a,
                x.originMId = a,
                x.userData = I,
                x.categoryId = 0,
                x.componentKey = e,
                x.familyName = t.familyName,
                x.familySymbol = t.familySymbol,
                vc.Instance && this.instancedComponent[e] ? x.instanceOrNot = !0 : (x.instanceOrNot = !1,
                this.instancedGeo[x.originalGeometryId].length > 1 && (x.originalGeometryId = "")),
                x.state = Lc.Visible,
                x.material = null,
                x.isBatched = !0,
                this._classifyNodeInfo(x),
                x = null
            }
        else {
            var Q = null
              , R = _u[t.type] ? _u[t.type].color : void 0;
            R || (Bh.log("Material not found for type: ", t.type),
            R = _u.DEFAULT.color),
            R || (Bh.log("Default material not found for type: ", t.type),
            R = [1, 1, 1, 1]);
            var T = new LA(R[0],R[1],R[2])
              , k = T.getHexString() + "_" + R[3]
              , D = o[k];
            if (D || (D = Kd.createStandardMaterial({
                color: T
            }),
            1 > R[3] && (D.transparent = !0,
            D.opacity = R[3]),
            D.side = 2,
            o[k] = D),
            t.materials.push(k),
            Q = this._getMeshNodeAttr(A, t, !1, 0),
            a = t.materials[0],
            !Q)
                return;
            t.buildInCategory && (Q.buildInCategory = t.buildInCategory);
            e = t.key;
            Q.type = t.type,
            Q.userId = e,
            Q.name = t.name,
            Q.originalId = r,
            Q.materialId = a,
            Q.originMId = a,
            Q.userData = {},
            Q.categoryId = 0,
            Q.componentKey = e,
            Q.familyName = t.familyName,
            Q.familySymbol = t.familySymbol,
            Q.instanceOrNot = !(!vc.Instance || !this.instancedComponent[e]),
            Q.isBatched = !0,
            Q.state = Lc.Visible,
            Q.material = null,
            this._classifyNodeInfo(Q),
            Q = null
        }
    }
    ,
    Af.prototype._parseGeo = function() {
        Bh.time("处理几何:按材质拆分构件");
        var A = this.referencedMeshCache;
        for (var e in A.bufferData) {
            var t = A.bufferData[e];
            if (t.position.length !== t.normal.length && (t.normal = t.normal.length === t.index.length ? this._computeVertexNormalsFromFaceNormals(t.normal, t.index, t.position.length) : this._computeVertexNormalsFromIndex(t.index, t.position)),
            void 0 !== t.materialIndex) {
                for (var i = void 0, o = [], n = null, r = 0; t.materialIndex.length > r; r += 1) {
                    var a = t.materialIndex[r];
                    a !== n && (n = a,
                    void 0 !== i && (i.count = 3 * r - i.start,
                    o.push(i)),
                    i = {
                        start: 3 * r,
                        materialIndex: n
                    })
                }
                if (void 0 !== i && (i.count = 3 * t.materialIndex.length - i.start,
                o.push(i)),
                1 === o.length) {
                    A.bufferData[e + "_" + o[0].materialIndex] = t
                } else {
                    for (var s = {}, l = 0; o.length > l; l += 1) {
                        var c = o[l];
                        void 0 === s[c.materialIndex] && (s[c.materialIndex] = {
                            index: [],
                            count: 0
                        }),
                        s[c.materialIndex].index.push({
                            start: c.start,
                            count: c.count
                        }),
                        s[c.materialIndex].count += c.count
                    }
                    var h = function() {
                        p = {},
                        g = s[d];
                        for (var i = 0, o = new Uint32Array(g.count), n = 0; g.index.length > n; n += 1) {
                            var r = g.index[n]
                              , a = t.index.slice(r.start, r.start + r.count);
                            o.set(a, i),
                            i += r.count
                        }
                        u = {},
                        o.forEach((function(A, e) {
                            u[A] || (u[A] = []),
                            u[A].push(e)
                        }
                        ));
                        var l = Object.keys(u).length;
                        f = new Float32Array(3 * l),
                        m = new Float32Array(3 * l),
                        C = new Float32Array(2 * l),
                        y = 0,
                        v = 0;
                        var c = 0;
                        for (var h in u)
                            if (u.hasOwnProperty(h)) {
                                h = Number(h);
                                var I = t.position.slice(3 * h, 3 * h + 3)
                                  , E = t.normal.slice(3 * h, 3 * h + 3);
                                if (t.uv.length > 0) {
                                    var B = t.uv.slice(2 * h, 2 * h + 2);
                                    C.set(B, v),
                                    v += 2
                                }
                                f.set(I, y),
                                m.set(E, y),
                                y += 3,
                                u[h].forEach((function(A) {
                                    o[A] = c
                                }
                                )),
                                c += 1
                            }
                        p.index = o,
                        p.position = f,
                        p.normal = m,
                        t.uv && t.uv.length > 0 && (p.uv = C),
                        A.bufferData[e + "_" + d] = p
                    };
                    for (var d in s) {
                        var p, g, u, f, m, C, y, v;
                        h()
                    }
                }
            }
        }
        Bh.timeEnd("处理几何:按材质拆分构件")
    }
    ,
    Af.prototype._parseInstanced = function() {
        Bh.time("_parseInstanced"),
        this.instancedComponent = {};
        var A = {}
          , e = {}
          , t = this.referencedMeshCache
          , i = this.model.materialManager.materials;
        for (var o in t.components)
            if (t.components.hasOwnProperty(o)) {
                var n = t.components[o];
                if (n.nodeIds || n.nodes)
                    continue;
                var r = n.geoId;
                if (-1 === r) {
                    Bh.debug("实体没有几何");
                    continue
                }
                if (void 0 === A[r] && (A[r] = []),
                A[r].push(1),
                !n.materials || 1 > n.materials.length) {
                    n.materials = [];
                    var a = _u[n.type] ? _u[n.type].color : void 0;
                    a || (Bh.log("Material not found for type: ", n.type),
                    a = _u.DEFAULT.color),
                    a || (Bh.log("Default material not found for type: ", n.type),
                    a = [1, 1, 1, 1]);
                    var s = new LA(a[0],a[1],a[2])
                      , l = s.getHexString() + "_" + a[3]
                      , c = i[l];
                    c || (Bh.warn("缺少材质 " + l),
                    c = Kd.createStandardMaterial({
                        color: s
                    }),
                    1 > a[3] && (c.transparent = !0,
                    c.opacity = a[3]),
                    c.side = 2,
                    i[l] = c),
                    n.materials.push(l)
                }
                for (var h = 0, d = n.materials.length; d > h; h += 1) {
                    var p = n.materials[h] + "&" + r;
                    void 0 === e[p] && (e[p] = []),
                    e[p].push({
                        componentKey: o
                    })
                }
            }
        for (var g in this.instancedGeo = A,
        e)
            if (e.hasOwnProperty(g))
                if (1 < e[g].length)
                    for (var u = 0; e[g].length > u; u += 1)
                        this.instancedComponent[e[g][u].componentKey] = !0;
                else
                    delete e[g];
        Bh.timeEnd("_parseInstanced")
    }
    ;
    var ef = function(A) {
        Xu.call(this, A),
        this.descriptor = new Af(A.model)
    };
    (ef.prototype = Object.assign(ef.prototype, Xu.prototype)).loadSceneAndGeos = function(A) {
        var e = A.scene
          , t = this.model
          , i = e.geometries.length || 0
          , o = [];
        if (this.map = {},
        ap(this.dataVersion, "2.0.0"))
            for (var n = 0; i > n; n += 1)
                e.geometries[n].fileKey ? o.push(e.geometries[n].fileKey) : t.dispatchEventEx({
                    type: Tc.SCENE_NOT_CLOSE,
                    modelKey: t.modelKey
                });
        else
            o = e.geometries;
        this.maxLoadTaskCount += i,
        this._loadGeo(o)
    }
    ,
    ef.prototype.getSceneTaskCount = function(A) {
        var e = A.scenes;
        return e += A.lines,
        e += A.mpks,
        vc.BorderLineDelayLoaded || (e += this.getAllBorderlineCount()),
        e
    }
    ;
    var tf = function(A) {
        this.model = A,
        this.defaultManager = null,
        this.instancedManager = null,
        this.model = A,
        this.loader = null,
        this.loaded = !1,
        this.dataReady = !1,
        this.borderlinesLoaded = !1,
        this.borderlinesGenerated = !1
    };
    tf.prototype.destroy = function() {
        this.model = null,
        this.defaultManager.destroy(),
        this.defaultManager = null,
        this.instancedManager.destroy(),
        this.instancedManager = null,
        this.loader && (this.loader.destroy(),
        this.loader = null)
    }
    ,
    tf.prototype.load = function(A) {
        var e = this
          , t = this.model;
        this.loader.setNotifyProgress(A),
        this.loader.load((function() {
            t.manager.dispatchEvent({
                type: Rc.ON_LOAD_START,
                modelKey: t.modelKey
            })
        }
        ), (function(A) {
            t.manager.dispatchEvent({
                type: Rc.ON_LOAD_PROGRESS,
                progress: A,
                modelKey: t.modelKey
            })
        }
        ), (function() {
            e.prepareData((function() {
                e.processLoadCompleted((function() {
                    t.manager.dispatchEvent({
                        type: Rc.ON_LOAD_COMPLETE,
                        modelKey: t.modelKey
                    })
                }
                ))
            }
            ))
        }
        ))
    }
    ,
    tf.prototype.processLoadCompleted = function(A) {
        var e = this.model;
        e.materialManager._updateTextureMapping(),
        e.materialManager._updateIBL(e),
        e.setLoaded(!0);
        var t = e.manager.filter
          , i = e.manager.getNodeInfos();
        t.initFilterManager(i),
        requestAnimationFrame((function() {
            A && A(),
            e.hasAnimation && vc.EnableAnimation && e.createPanel(),
            e.updateMeshNodes(),
            e.applyFilter(),
            e.debut(e)
        }
        ))
    }
    ,
    tf.prototype.prepareData = function(A) {
        if (!this.dataReady) {
            var e = this;
            this.loader.getDescriptor().parseItemData((function() {
                e.dataReady = !0,
                e.settleData(A)
            }
            ))
        }
    }
    ,
    tf.prototype.prepareWireframe = function(A, e) {
        if (A.isActivateWireframe())
            if (vc.BorderLineDelayLoaded && this.loader.getAllBorderlineCount())
                if (this.borderlinesLoaded)
                    this.borderlinesGenerated && (this.defaultManager.asyncGenerateWireframe(A),
                    this.instancedManager.generateWireframe(A));
                else {
                    this.borderlinesLoaded = !0;
                    var t = this;
                    this.loader.delayLoadBorderlines((function() {
                        t.instancedManager.generateWireframe(A),
                        t.defaultManager.asyncGenerateWireframe(A, (function() {
                            t.borderlinesGenerated = !0,
                            e && e()
                        }
                        ))
                    }
                    ))
                }
            else
                this.defaultManager.generateWireframe(A),
                this.instancedManager.generateWireframe(A)
    }
    ,
    tf.prototype.prepare = function(A) {}
    ,
    tf.prototype.needUpdate = function() {
        return !0
    }
    ,
    tf.prototype.updateNodes = function() {
        this.defaultManager.updateNodes(this.model),
        vc.Instance && this.instancedManager.updateNodes(this.model)
    }
    ,
    tf.prototype.isLoaded = function() {
        return this.loaded
    }
    ,
    tf.prototype.isDataReady = function() {
        return this.loaded
    }
    ,
    tf.prototype.isAllReady = function() {
        return !0
    }
    ,
    tf.prototype.isHidden = function() {
        var A = this.model;
        return !A.visible && (A.manager.scene.removeGroupByName(A._getWireframeGroupName()),
        !0)
    }
    ,
    tf.prototype.settleData = function(A) {}
    ,
    tf.prototype.addNodeInfoToOctantMap = function() {}
    ,
    tf.prototype.applyFilter = function() {
        this.isLoaded() && (this.defaultManager.applyFilter(this.model),
        vc.Instance && this.instancedManager.applyFilter(this.model))
    }
    ,
    tf.prototype.applySelection = function() {
        this.isLoaded() && (this.defaultManager.applySelection(this.model),
        vc.Instance && this.instancedManager.applySelection(this.model))
    }
    ,
    tf.prototype.clearSelection = function() {
        this.isLoaded() && (this.defaultManager.clearSelection(this.model),
        vc.Instance && this.instancedManager.clearSelection(this.model))
    }
    ,
    tf.prototype.applyHover = function() {
        this.isLoaded() && (this.defaultManager.applyHover(this.model),
        vc.Instance && this.instancedManager.applyHover(this.model))
    }
    ,
    tf.prototype.clearHover = function() {
        this.isLoaded() && (this.defaultManager.clearHover(this.model),
        vc.Instance && this.instancedManager.clearHover(this.model))
    }
    ,
    tf.prototype.applyBlink = function() {
        this.isLoaded() && (this.defaultManager.applyBlink(this.model),
        vc.Instance && this.instancedManager.applyBlink(this.model))
    }
    ,
    tf.prototype.clearBlink = function() {
        this.isLoaded() && (this.defaultManager.clearBlink(this.model),
        vc.Instance && this.instancedManager.clearBlink(this.model))
    }
    ,
    tf.prototype.applyReplacement = function() {
        this.isLoaded() && (this.defaultManager.applyReplacement(this.model),
        vc.Instance && this.instancedManager.applyReplacement(this.model))
    }
    ,
    tf.prototype.getMeshesByUserIds = function(A) {
        if (this.isLoaded()) {
            var e = this.defaultManager.getMeshesByUserIds(this.model, A)
              , t = [];
            return vc.Instance && (t = this.instancedManager.getMeshesByUserId(this.model, A)),
            [].concat(e).concat(t)
        }
    }
    ,
    tf.prototype.rebuildIndicesforLightmap = function() {
        this.defaultManager.rebuildIndices(this.model)
    }
    ,
    tf.prototype.adjustVisibility = function(A) {
        this.defaultManager.adjustVisibility(this.model, A)
    }
    ,
    tf.prototype.changeVisibilityOfSelectedObjects = function(A) {
        this.defaultManager.changeVisibilityOfSelectedObjects(this.model, A)
    }
    ,
    tf.prototype.changeVisibilityOfNonSelectedObjects = function(A) {
        this.defaultManager.changeVisibilityOfNonSelectedObjects(this.model, A)
    }
    ,
    tf.prototype.adjustInstanceVisibility = function(A) {
        this.instancedManager.adjustVisibility(this.model, A)
    }
    ,
    tf.prototype.changeInstanceVisibilityOfSelectedObjects = function(A) {
        this.instancedManager.changeVisibilityOfSelectedObjects(this.model, A)
    }
    ,
    tf.prototype.changeInstanceVisibilityOfNonSelectedObjects = function(A) {
        this.instancedManager.changeVisibilityOfNonSelectedObjects(this.model, A)
    }
    ,
    tf.prototype.restoreVisibilityOfObjects = function() {
        this.defaultManager.restoreVisibilityOfObjects(),
        this.instancedManager.restoreVisibilityOfObjects()
    }
    ,
    tf.prototype.getBlinkMaterials = function() {
        var A = []
          , e = this.model.materialManager.instanceMaterials;
        for (var t in e)
            for (var i = e[t], o = 0, n = i.length; n > o; o += 1)
                A.push(i[o]);
        return A = A.concat(this.defaultManager.meshManager.getBlinkMaterials())
    }
    ,
    tf.prototype.disposeBufferAfterVbo = function() {
        this.isLoaded() && (this.defaultManager.disposeBufferAfterVbo(),
        this.instancedManager.disposeBufferAfterVbo())
    }
    ,
    tf.prototype.getGeometryBuffersByUserId = function(A) {
        if (!this.isLoaded())
            return [];
        var e = [];
        return e = (e = e.concat(this.defaultManager.getGeometryBuffersByUserId(this.model, A))).concat(this.instancedManager.getGeometryBuffersByUserId(this.model, A))
    }
    ,
    tf.prototype.unloadComponents = function(A) {}
    ,
    tf.prototype.explosion = function(A) {
        this.isLoaded() && (this.defaultManager.explosion(this.model, A),
        vc.Instance && this.instancedManager.explosion(this.model, A))
    }
    ,
    tf.prototype.closeExplosion = function() {
        this.isLoaded() && (this.defaultManager.closeExplosion(this.model),
        vc.Instance && this.instancedManager.closeExplosion(this.model))
    }
    ,
    tf.prototype.componentsExplosion = function(A) {
        this.isLoaded() && (this.defaultManager.componentsExplosion(this.model, A),
        vc.Instance && this.instancedManager.componentsExplosion(this.model, A))
    }
    ,
    tf.prototype.closeComponentsExplosion = function(A) {
        this.isLoaded() && (this.defaultManager.closeComponentsExplosion(this.model, A),
        vc.Instance && this.instancedManager.closeComponentsExplosion(this.model, A))
    }
    ,
    tf.prototype.isHiddenNode = function(A) {
        return this.defaultManager.isHiddenNode(A) || this.instancedManager.isHiddenNode(A)
    }
    ,
    tf.prototype.moveMeshfromInstancedToDefault = function(A) {}
    ;
    var of = function(A) {
        this.manager = A,
        this.pickingNodeMap = null,
        this.pickingNodeGroup = null,
        this.nodeGroupName = "PickingNodeGroup"
    };
    of.prototype.destroy = function() {
        this.clearData(),
        this.pickingNodeGroup = null,
        this.manager = null
    }
    ,
    of.prototype.clearData = function() {
        this.clearAllFromPickingNodeGroup(),
        this.clearAllFromPickingNodeMap()
    }
    ,
    of.prototype.addToPickingNodeMap = function(A, e) {
        this.pickingNodeMap || (this.pickingNodeMap = {}),
        this.pickingNodeMap[A] = e,
        this.addToPickingNodeGroup(e)
    }
    ,
    of.prototype.removeFromPickingNodeMap = function(A) {
        this.pickingNodeMap && this.pickingNodeMap[A] && (this.removeFormPickingNodeGroup(A),
        this.disposePickingNodeById(A),
        delete this.pickingNodeMap[A])
    }
    ,
    of.prototype.addToPickingNodeGroup = function(A) {
        this.pickingNodeGroup || (this.pickingNodeGroup = new Xi,
        this.pickingNodeGroup.name = this.nodeGroupName);
        for (var e = 0, t = A.length; t > e; e += 1)
            this.pickingNodeGroup.add(A[e])
    }
    ,
    of.prototype.removeFormPickingNodeGroup = function(A) {
        if (this.pickingNodeGroup)
            for (var e = this.pickingNodeMap[A], t = 0, i = e.length; i > t; t += 1)
                this.pickingNodeGroup.remove(e[t])
    }
    ,
    of.prototype.disposePickingNodeById = function(A) {
        for (var e = this.pickingNodeMap[A], t = 0, i = e.length; i > t; t += 1)
            e[t].material = null,
            e[t].geometry.dispose(),
            e[t] = null
    }
    ,
    of.prototype.clearAllFromPickingNodeMap = function() {
        if (this.pickingNodeMap) {
            for (var A = Object.keys(this.pickingNodeMap), e = 0, t = A.length; t > e; e += 1)
                this.disposePickingNodeById(A[e]);
            this.pickingNodeMap = null
        }
    }
    ,
    of.prototype.clearAllFromPickingNodeGroup = function() {
        this.pickingNodeGroup && (this.pickingNodeGroup.children.length = 0)
    }
    ,
    of.prototype.isPickingMeshesGenerated = function() {
        return !!this.pickingNodeMap
    }
    ,
    of.prototype.generatePickingMeshes = function() {}
    ,
    of.prototype.updatePickingMeshesState = function(A, e, t) {}
    ,
    of.prototype.resetPickingMeshesState = function() {}
    ,
    of.prototype.updatePickingMeshes = function(A, e, t) {
        return this.isPickingMeshesGenerated() || (this.generatePickingMeshes(),
        this.isPickingMeshesGenerated()) ? (this.resetPickingMeshesState(),
        this.updatePickingMeshesState(A, e, t),
        this.getPickingNodeGroup()) : null
    }
    ,
    of.prototype.getPickingNodeGroup = function() {
        return this.pickingNodeGroup
    }
    ;
    var nf = function(A) {
        of.call(this, A),
        this.nodeGroupName = "PickingBatchedMeshGroup"
    };
    Object.assign(nf.prototype, of.prototype),
    eu(nf, [{
        key: "disposePickingNodeById",
        value: function(A) {
            for (var e = this.pickingNodeMap[A], t = 0, i = e.length; i > t; t += 1)
                e[t]._indicesGroup = null,
                e[t].material = null,
                e[t].geometry.dispose(),
                e[t] = null
        }
    }, {
        key: "generatePickingMeshes",
        value: function() {
            for (var A = this.manager, e = Object.keys(A.mapMaterialIdToMergedNode), t = 0, i = e.length; i > t; t += 1) {
                for (var o = e[t], n = A.getPropertyValueByMaterialKey(o), r = A.mapMaterialIdToMergedNode[o], a = [], s = 0, l = r.length; l > s; s += 1) {
                    var c = r[s]
                      , h = c.geometry
                      , d = c.indices
                      , p = c.mesh
                      , g = new he;
                    g.setAttribute("position", h.getAttribute("position")),
                    g.setIndex(h.getIndex());
                    var u = new ("lines" === n.type ? jo : Ue)(g,Kd.DefaultMaterial);
                    p.matrixWorld.decompose(u.position, u.quaternion, u.scale),
                    u.name = o,
                    u.frustumCulled = !1,
                    u.renderOrder = 0,
                    u._indicesGroup = d,
                    a.push(u)
                }
                this.addToPickingNodeMap(o, a)
            }
        }
    }, {
        key: "_rebuildGeometryGroup",
        value: function(A, e, t) {
            var i, o = this.manager.manager, n = 0, r = 0, a = 0, s = A._indicesGroup, l = Object.keys(s), c = [], h = {};
            e.length > l.length ? (c = l,
            h = t) : (c = e,
            h = s);
            var d = [];
            for (a = 0,
            i = c.length; i > a; a += 1) {
                var p = c[a];
                if (o.isPickableNode(p) && h[p]) {
                    var g = s[p];
                    if (g && g.length > 0)
                        for (n = 0,
                        r = g.length; r > n; n += 1)
                            d.push({
                                indexStart: g[n].indexStart,
                                indexCount: g[n].indexCount
                            })
                }
            }
            A.visible = !0;
            var u = A.geometry;
            if (u.clearGroups(),
            0 !== d.length)
                for (d.sort((function(A, e) {
                    return A.indexStart - e.indexStart
                }
                )),
                n = 0,
                r = d.length; r > n; n += 1) {
                    var f = d[n].indexStart
                      , m = d[n].indexCount;
                    if (0 === n)
                        u.addGroup(f, m, 0);
                    else
                        f === d[n - 1].indexStart + d[n - 1].indexCount ? u.groups[u.groups.length - 1].count += m : u.addGroup(f, m, 0)
                }
            else
                A.visible = !1
        }
    }, {
        key: "updatePickingMeshesState",
        value: function(A, e, t) {
            for (var i = this.pickingNodeMap, o = Object.keys(i), n = 0, r = o.length; r > n; n += 1)
                for (var a = i[o[n]], s = 0, l = a.length; l > s; s += 1)
                    a[s].material = [A],
                    a[s].visible = !1,
                    this._rebuildGeometryGroup(a[s], e, t)
        }
    }]);
    var rf = new aA
      , af = new M
      , sf = new CA
      , lf = new cA
      , cf = function() {
        jo.call(this),
        this.type = "LineSegmentsEx"
    };
    cf.prototype.init = function(A) {}
    ,
    cf.prototype.destroy = function() {}
    ,
    cf.prototype.intersectBoxWithDistance = function(A, e) {
        var t = this.geometry
          , i = this.matrixWorld;
        return e && (i = this.matrixWorld.clone()).multiplyMatrices(this.matrixWorld, e),
        t.boundingBox || t.computeBoundingBox(),
        rf.copy(t.boundingBox),
        rf.applyMatrix4(i),
        A.ray.intersectBoxWithDistance(rf)
    }
    ,
    cf.prototype.intersectBoxWithDistanceByIndices = function(A, e) {
        var t = this.geometry.attributes.position.array
          , i = 0
          , o = t.length;
        e && e.indexCount > 0 && (i = e.positionStart,
        o = e.positionStart + e.positionCount);
        var n = uh.box3FromArrayRange(t, i, o);
        return n.applyMatrix4(this.matrixWorld),
        A.ray.intersectBoxWithDistance(n)
    }
    ,
    cf.prototype.raycastByIndices = function(A, e, t, i) {
        var o = A.linePrecision;
        A.linePrecision = vc.LineSelectRange || 5;
        var n = A.linePrecision
          , r = n * n
          , a = null;
        i ? (a = this.matrixWorld.clone()).multiplyMatrices(this.matrixWorld, i) : a = this.matrixWorld;
        var s = this.geometry;
        if (null === s.boundingSphere && s.computeBoundingSphere(),
        lf.copy(s.boundingSphere),
        lf.applyMatrix4(a),
        !1 !== A.ray.intersectsSphere(lf)) {
            af.getInverse(a),
            sf.copy(A.ray).applyMatrix4(af);
            var l = new y
              , c = new y
              , h = new y
              , d = new y
              , p = s.attributes.position.array
              , g = s.index.array
              , u = 0
              , f = g.length;
            t && t.indexCount > 0 && (u = t.indexStart,
            f = t.indexStart + t.indexCount);
            for (var m = u; f - 1 > m; m += 2) {
                var C = g[m + 1];
                if (l.fromArray(p, 3 * g[m]),
                c.fromArray(p, 3 * C),
                r >= sf.distanceSqToSegment(l, c, d, h)) {
                    d.applyMatrix4(a);
                    var v = A.ray.origin.distanceTo(d);
                    A.near > v || v > A.far || e.push({
                        distance: v,
                        point: h.clone().applyMatrix4(a),
                        index: m,
                        face: null,
                        faceIndex: null,
                        object: this
                    })
                }
            }
            A.linePrecision = o
        }
    }
    ;
    var hf = new M
      , df = new CA
      , pf = new cA
      , gf = new y
      , uf = new y
      , ff = new y
      , mf = new y
      , Cf = new y
      , yf = new y
      , vf = new y
      , If = new y
      , Ef = new y
      , Bf = new s
      , xf = new s
      , Sf = new s
      , wf = new y
      , Mf = new y;
    function bf(A, e, t, i, o, n, r, a) {
        if (null === (Array.isArray(e) ? i.intersectTriangle(o, n, r, !1, a) : 1 === e.side ? i.intersectTriangle(r, n, o, !0, a) : i.intersectTriangle(o, n, r, 2 !== e.side, a)))
            return null;
        Mf.copy(a),
        Mf.applyMatrix4(A.matrixWorld);
        var s = t.ray.origin.distanceTo(Mf);
        return t.near > s || s > t.far ? null : {
            distance: s,
            point: Mf.clone(),
            object: A
        }
    }
    function Uf(A, e, t, i, o, n, r, a, l, c, h, d) {
        gf.fromBufferAttribute(o, c),
        uf.fromBufferAttribute(o, h),
        ff.fromBufferAttribute(o, d);
        var p = A.morphTargetInfluences;
        if (e.morphTargets && n && p) {
            vf.set(0, 0, 0),
            If.set(0, 0, 0),
            Ef.set(0, 0, 0);
            for (var g = 0, u = n.length; u > g; g += 1) {
                var f = p[g]
                  , m = n[g];
                0 !== f && (mf.fromBufferAttribute(m, c),
                Cf.fromBufferAttribute(m, h),
                yf.fromBufferAttribute(m, d),
                r ? (vf.addScaledVector(mf, f),
                If.addScaledVector(Cf, f),
                Ef.addScaledVector(yf, f)) : (vf.addScaledVector(mf.sub(gf), f),
                If.addScaledVector(Cf.sub(uf), f),
                Ef.addScaledVector(yf.sub(ff), f)))
            }
            gf.add(vf),
            uf.add(If),
            ff.add(Ef)
        }
        var C = bf(A, e, t, i, gf, uf, ff, wf);
        if (C) {
            a && (Bf.fromBufferAttribute(a, c),
            xf.fromBufferAttribute(a, h),
            Sf.fromBufferAttribute(a, d),
            C.uv = RA.getUV(wf, gf, uf, ff, Bf, xf, Sf, new s)),
            l && (Bf.fromBufferAttribute(l, c),
            xf.fromBufferAttribute(l, h),
            Sf.fromBufferAttribute(l, d),
            C.uv2 = RA.getUV(wf, gf, uf, ff, Bf, xf, Sf, new s));
            var y = new GA(c,h,d);
            RA.getNormal(gf, uf, ff, y.normal),
            C.face = y
        }
        return C
    }
    var Ff, Kf = function(A, e) {
        Ue.call(this),
        this.type = "MeshEx",
        this.matrixAutoUpdate = !1,
        this.active = !1,
        this.guid = "",
        this.key = "",
        this.typeEx = "",
        this.geometry = A || Tu.EmptyGeometry,
        this.material = e || Kd.DefaultMaterial,
        this.visible = !1,
        this.pickable = !0
    };
    (Kf.prototype = Object.create(Ue.prototype)).constructor = Kf,
    Kf.prototype.init = function(A) {
        A && A.parent && A.parent.add(this)
    }
    ,
    Kf.prototype.destroy = function() {
        this.parent && this.parent.remove(this),
        this.userData && (this.userData = null),
        this.geometry = null,
        this.material = null
    }
    ,
    Kf.prototype.isVisible = function() {
        return this.visible && this.active
    }
    ,
    Kf.prototype.spawn = function(A) {
        void 0 !== A.guid && (this.guid = A.guid),
        void 0 !== A.key && (this.key = A.key),
        void 0 !== A.name && (this.name = A.name),
        void 0 !== A.typeEx && (this.typeEx = A.typeEx),
        A.geometry && (this.geometry = A.geometry),
        A.material && (this.material = A.material),
        A.matrix ? (this.matrix.copy(A.matrix),
        this.updateMatrixWorld(!0)) : (this.matrix.identity(),
        this.updateMatrixWorld(!0)),
        this.modelKey = A.modelKey ? A.modelKey : "",
        A.userData ? this.userData = A.userData : this.userData && (this.userData = null),
        void 0 !== A.visible && (this.visible = A.visible),
        void 0 !== A.isMesh && (this.isMesh = A.isMesh),
        void 0 !== A.isLine && (this.isLine = A.isLine),
        void 0 !== A.isLineSegments && (this.isLineSegments = A.isLineSegments),
        this.pickable = void 0 === A.pickable || A.pickable,
        this.renderOrder = A.renderOrder || 0,
        this.active = !0,
        this.visible = !0,
        this.frustumCulled = !1,
        this.matChange = !1
    }
    ,
    Kf.prototype.clear = function() {
        this.geometry = Tu.EmptyGeometry,
        this.material = Kd.DefaultMaterial,
        this.active = !1,
        this.visible = !0,
        this.guid = "",
        this.key = "",
        this.typeEx = "",
        this.frustumCulled = !0,
        this.material.visible = !1
    }
    ,
    Kf.prototype.intersectBoxWithDistance = (Ff = new aA,
    function(A, e) {
        var t = this.geometry
          , i = this.material
          , o = this.matrixWorld;
        return e && (o = new M).multiplyMatrices(this.matrixWorld, e),
        void 0 === i ? -1 : (t.boundingBox || t.computeBoundingBox(),
        Ff.copy(t.boundingBox),
        Ff.applyMatrix4(o),
        A.ray.intersectBoxWithDistance(Ff))
    }
    ),
    Kf.prototype.intersectBoxWithDistanceByIndices = function(A, e) {
        var t = this.matrixWorld
          , i = this.computeBoundingBox(e);
        return i.applyMatrix4(t),
        A.ray.intersectBoxWithDistance(i)
    }
    ,
    Kf.prototype.intersectBoxWithClipPlane = function(A, e) {
        var t = this.matrixWorld
          , i = this.computeBoundingBox(e);
        return i.applyMatrix4(t),
        i.intersectsPlane(A)
    }
    ,
    Kf.prototype.getIntersectionPoints = function(A, e, t, i) {
        var o = new M;
        o.getInverse(this.matrixWorld);
        var n = A.clone();
        n.constant *= -1,
        n = n.applyMatrix4(o);
        function r(A, e) {
            var i = e.intersectLine(A);
            i && t.push(i.x, i.y, i.z)
        }
        for (var a, s, l, c = this.geometry.getIndex().array, h = this.geometry.getAttribute("position").array, d = i ? 0 : e.indexStart, p = i ? c.length : e.indexStart + e.indexCount, g = new y, u = new y, f = new y, m = new Hs, C = new Hs, v = new Hs, I = d, E = p; E > I; I += 3)
            s = 3 * c[I + 1],
            l = 3 * c[I + 2],
            g.set(h[a = 3 * c[I]], h[a + 1], h[a + 2]),
            u.set(h[s], h[s + 1], h[s + 2]),
            f.set(h[l], h[l + 1], h[l + 2]),
            i && (g.applyMatrix4(e.matrix),
            u.applyMatrix4(e.matrix),
            f.applyMatrix4(e.matrix)),
            m.set(g, u),
            C.set(u, f),
            v.set(f, g),
            r(m, n),
            r(C, n),
            r(v, n)
    }
    ,
    Kf.prototype.raycastByIndices = function() {
        var A = new M
          , e = new CA
          , t = new cA
          , i = new y
          , o = new y
          , n = new y
          , r = new s
          , a = new s
          , l = new s
          , c = new y
          , h = new y
          , d = new y
          , p = new M;
        function g(A, e, t, s, g, u, f, m) {
            i.fromBufferAttribute(s, u),
            o.fromBufferAttribute(s, f),
            n.fromBufferAttribute(s, m);
            var C = function(A, e, t, i, o, n, r) {
                var a = A.material;
                if (null === (Array.isArray(a) ? t.intersectTriangle(i, o, n, !1, r) : 1 === a.side ? t.intersectTriangle(n, o, i, !0, r) : t.intersectTriangle(i, o, n, 2 !== a.side, r)))
                    return null;
                d.copy(r),
                d.applyMatrix4(p);
                var s = e.ray.origin.distanceTo(d);
                return e.near > s || s > e.far ? null : {
                    distance: s,
                    point: d.clone(),
                    object: A
                }
            }(A, e, t, i, o, n, h);
            if (C) {
                if (g && g.array && g.array.length && (r.fromBufferAttribute(g, u),
                a.fromBufferAttribute(g, f),
                l.fromBufferAttribute(g, m),
                C.uv = function(A, e, t, i, o, n, r) {
                    return RA.getBarycoord(A, e, t, i, c),
                    o.multiplyScalar(c.x),
                    n.multiplyScalar(c.y),
                    r.multiplyScalar(c.z),
                    o.add(n).add(r),
                    o.clone()
                }(h, i, o, n, r, a, l)),
                s.instanceMatrix) {
                    var v = i.clone().applyMatrix4(s.instanceMatrix)
                      , I = o.clone().applyMatrix4(s.instanceMatrix)
                      , E = n.clone().applyMatrix4(s.instanceMatrix);
                    C.face = new GA(u,f,m,RA.getNormal(v, I, E, new y))
                } else
                    C.face = new GA(u,f,m,RA.getNormal(i, o, n, new y));
                C.faceIndex = u
            }
            return C
        }
        return function(i, o, n, r) {
            var a = this.geometry
              , s = this.material;
            if (r) {
                a = this.geometry,
                s = this.material;
                if ((p = new M).multiplyMatrices(this.matrixWorld, r),
                void 0 === s)
                    return;
                if (null === a.boundingSphere && a.computeBoundingSphere(),
                t.copy(a.boundingSphere),
                t.applyMatrix4(p),
                !1 === i.ray.intersectsSphere(t))
                    return;
                if (A.getInverse(p),
                e.copy(i.ray).applyMatrix4(A),
                null !== a.boundingBox && !1 === e.intersectsBox(a.boundingBox))
                    return;
                var l = null
                  , c = null
                  , h = null
                  , d = null
                  , u = a.index;
                (I = a.attributes.position).instanceMatrix = r;
                var f = a.attributes.uv
                  , m = null
                  , C = null;
                if (null !== u)
                    for (m = 0,
                    C = u.count; C > m; m += 3)
                        c = u.getX(m),
                        h = u.getX(m + 1),
                        d = u.getX(m + 2),
                        (l = g(this, i, e, I, f, c, h, d)) && (l.faceIndex = Math.floor(m / 3),
                        o.push(l));
                else
                    for (m = 0,
                    C = I.count; C > m; m += 3)
                        (l = g(this, i, e, I, f, c = m, h = m + 1, d = m + 2)) && (l.index = c,
                        o.push(l))
            } else {
                if (p = this.matrixWorld,
                void 0 === s)
                    return;
                if (t.copy(this.computeBoundingSphere(n)),
                t.applyMatrix4(p),
                !1 === i.ray.intersectsSphere(t))
                    return;
                A.getInverse(p),
                e.copy(i.ray).applyMatrix4(A);
                var y = this.computeBoundingBox(n);
                if (!1 === e.intersectsBox(y))
                    return;
                l = null,
                c = null,
                h = null,
                d = null;
                var v, I = a.attributes.position, E = (f = a.attributes.uv,
                m = null,
                n.indexStart), B = n.indexStart + n.indexCount, x = a.getIndex().array;
                for (m = E,
                v = B; v > m; m += 3)
                    (l = g(this, i, e, I, f, c = x[m], h = x[m + 1], d = x[m + 2])) && (l.faceIndex = Math.floor(m / 3),
                    o.push(l))
            }
        }
    }(),
    Kf.prototype.raycastByIndices2 = function() {
        var A = new M
          , e = new CA
          , t = new cA
          , i = new y
          , o = new y
          , n = new y
          , r = new s
          , a = new s
          , l = new s
          , c = new y
          , h = new y
          , d = new y
          , p = new M;
        function g(A, e, t, s, g, u, f, m) {
            i.fromBufferAttribute(s, u),
            o.fromBufferAttribute(s, f),
            n.fromBufferAttribute(s, m);
            var C = function(A, e, t, i, o, n, r) {
                var a = A.material;
                if (null === (a instanceof Array ? t.intersectTriangle(i, o, n, !1, r) : 1 === a.side ? t.intersectTriangle(n, o, i, !0, r) : t.intersectTriangle(i, o, n, 2 !== a.side, r)))
                    return null;
                d.copy(r),
                d.applyMatrix4(p);
                var s = e.ray.origin.distanceTo(d);
                return e.near > s || s > e.far ? null : {
                    distance: s,
                    point: d.clone(),
                    object: A
                }
            }(A, e, t, i, o, n, h);
            if (C) {
                if (g && g.array && g.array.length && (r.fromBufferAttribute(g, u),
                a.fromBufferAttribute(g, f),
                l.fromBufferAttribute(g, m),
                C.uv = function(A, e, t, i, o, n, r) {
                    return RA.barycoordFromPoint(A, e, t, i, c),
                    o.multiplyScalar(c.x),
                    n.multiplyScalar(c.y),
                    r.multiplyScalar(c.z),
                    o.add(n).add(r),
                    o.clone()
                }(h, i, o, n, r, a, l)),
                s.instanceMatrix) {
                    var y = i.clone().applyMatrix4(s.instanceMatrix)
                      , v = o.clone().applyMatrix4(s.instanceMatrix)
                      , I = n.clone().applyMatrix4(s.instanceMatrix);
                    C.face = new GA(u,f,m,RA.normal(y, v, I))
                } else
                    C.face = new GA(u,f,m,RA.normal(i, o, n));
                C.faceIndex = u
            }
            return C
        }
        return function(i, o, n, r) {
            var a = this.geometry
              , s = this.material;
            if (r = !!r,
            n.isInstanced) {
                if (void 0 === n.matrix)
                    return;
                if (p.multiplyMatrices(this.matrixWorld, n.matrix),
                void 0 === s)
                    return;
                if (r && (null === a.boundingSphere && a.computeBoundingSphere(),
                t.copy(a.boundingSphere),
                t.applyMatrix4(p),
                !1 === i.ray.intersectsSphere(t)))
                    return;
                if (A.getInverse(p),
                e.copy(i.ray).applyMatrix4(A),
                r && null !== a.boundingBox && !1 === e.intersectsBox(a.boundingBox))
                    return;
                var l = a.index;
                (I = a.attributes.position).instanceMatrix = n.matrix;
                var c, h = a.attributes.uv;
                if (null !== l)
                    for (y = 0,
                    c = l.count; c > y; y += 3)
                        f = l.getX(y),
                        m = l.getX(y + 1),
                        C = l.getX(y + 2),
                        (u = g(this, i, e, I, h, f, m, C)) && (u.faceIndex = Math.floor(y / 3),
                        o.push(u));
                else
                    for (y = 0,
                    c = I.count; c > y; y += 3)
                        (u = g(this, i, e, I, h, f = y, m = y + 1, C = y + 2)) && (u.index = f,
                        o.push(u))
            } else if (n.matrix ? p.multiplyMatrices(this.matrixWorld, n.matrix) : p = this.matrixWorld,
            void 0 !== s && (!r || (t.copy(this.computeBoundingSphere(n)),
            t.applyMatrix4(p),
            !1 !== i.ray.intersectsSphere(t)))) {
                if (A.getInverse(p),
                e.copy(i.ray).applyMatrix4(A),
                r) {
                    var d = this.computeBoundingBox(n);
                    if (!1 === e.intersectsBox(d))
                        return
                }
                var u, f, m, C, y, v, I = a.attributes.position, E = (h = a.attributes.uv,
                n.indexStart), B = n.indexStart + n.indexCount, x = a.getIndex().array;
                for (y = E,
                v = B; v > y; y += 3)
                    (u = g(this, i, e, I, h, f = x[y], m = x[y + 1], C = x[y + 2])) && (u.faceIndex = Math.floor(y / 3),
                    o.push(u))
            }
        }
    }(),
    Kf.prototype.computeBoundingBox = function(A) {
        var e = new aA
          , t = this.geometry.attributes.position.array
          , i = null
          , o = null;
        return A ? (i = A.positionStart,
        o = A.positionStart + A.positionCount) : (i = 0,
        o = t.length),
        this.setBoundingBoxFromArray(e, t, i, o),
        e
    }
    ,
    Kf.prototype.computeBoundingSphere = function(A) {
        var e = new aA
          , t = new y
          , i = this.geometry.attributes.position.array
          , o = null
          , n = null;
        A ? (o = A.positionStart,
        n = A.positionStart + A.positionCount) : (o = 0,
        n = i.length);
        var r = new cA
          , a = r.center;
        this.setBoundingBoxFromArray(e, i, o, n),
        e.getCenter(a);
        for (var s = 0, l = o, c = n; c > l; l += 3)
            t.x = i[l],
            t.y = i[l + 1],
            t.z = i[l + 2],
            s = Math.max(s, a.distanceToSquared(t));
        return r.radius = Math.sqrt(s),
        r
    }
    ,
    Kf.prototype.setBoundingBoxFromArray = function(A, e, t, i) {
        for (var o = Number(1 / 0), n = Number(1 / 0), r = Number(1 / 0), a = -1 / 0, s = -1 / 0, l = -1 / 0, c = t, h = i; h > c; c += 3) {
            var d = e[c]
              , p = e[c + 1]
              , g = e[c + 2];
            o > d && (o = d),
            n > p && (n = p),
            r > g && (r = g),
            d > a && (a = d),
            p > s && (s = p),
            g > l && (l = g)
        }
        A.min.set(o, n, r),
        A.max.set(a, s, l)
    }
    ,
    Kf.prototype.raycast = function(A, e) {
        var t = this.geometry
          , i = this.material
          , o = this.matrixWorld;
        if (void 0 !== i && (null === t.boundingSphere && t.computeBoundingSphere(),
        pf.copy(t.boundingSphere),
        pf.applyMatrix4(o),
        !1 !== A.ray.intersectsSphere(pf) && (hf.getInverse(o),
        df.copy(A.ray).applyMatrix4(hf),
        null === t.boundingBox || !1 !== df.intersectsBox(t.boundingBox)))) {
            var n = null;
            if (t.isBufferGeometry) {
                var r = null
                  , a = null
                  , l = null
                  , c = t.index
                  , h = t.attributes.position
                  , d = t.morphAttributes.position
                  , p = t.morphTargetsRelative
                  , g = t.attributes.uv
                  , u = t.attributes.uv2
                  , f = t.groups
                  , m = t.drawRange
                  , C = null
                  , y = null
                  , v = null
                  , I = null
                  , E = null
                  , B = null;
                if (null !== c)
                    if (Array.isArray(i)) {
                        for (C = 0,
                        v = f.length; v > C; C += 1)
                            if (B = i[(E = f[C]).materialIndex])
                                for (y = Math.max(E.start, m.start),
                                I = Math.min(E.start + E.count, m.start + m.count); I > y; y += 3)
                                    r = c.getX(y),
                                    a = c.getX(y + 1),
                                    l = c.getX(y + 2),
                                    (n = Uf(this, B, A, df, h, d, p, g, u, r, a, l)) && (n.faceIndex = Math.floor(y / 3),
                                    n.face.materialIndex = E.materialIndex,
                                    e.push(n))
                    } else
                        for (C = Math.max(0, m.start),
                        v = Math.min(c.count, m.start + m.count); v > C; C += 3)
                            r = c.getX(C),
                            a = c.getX(C + 1),
                            l = c.getX(C + 2),
                            (n = Uf(this, i, A, df, h, d, p, g, u, r, a, l)) && (n.faceIndex = Math.floor(C / 3),
                            e.push(n));
                else if (void 0 !== h)
                    if (Array.isArray(i)) {
                        for (C = 0,
                        v = f.length; v > C; C += 1)
                            if (B = i[(E = f[C]).materialIndex])
                                for (y = Math.max(E.start, m.start),
                                I = Math.min(E.start + E.count, m.start + m.count); I > y; y += 3)
                                    (n = Uf(this, B, A, df, h, d, p, g, u, r = y, a = y + 1, l = y + 2)) && (n.faceIndex = Math.floor(y / 3),
                                    n.face.materialIndex = E.materialIndex,
                                    e.push(n))
                    } else
                        for (C = Math.max(0, m.start),
                        v = Math.min(h.count, m.start + m.count); v > C; C += 3)
                            (n = Uf(this, i, A, df, h, d, p, g, u, r = C, a = C + 1, l = C + 2)) && (n.faceIndex = Math.floor(C / 3),
                            e.push(n))
            } else if (t.isGeometry) {
                var x = null
                  , S = null
                  , w = null
                  , M = Array.isArray(i)
                  , b = t.vertices
                  , U = t.faces
                  , F = null
                  , K = t.faceVertexUvs[0];
                K.length > 0 && (F = K);
                for (var Q = 0, R = U.length; R > Q; Q += 1) {
                    var T = U[Q]
                      , k = M ? i[T.materialIndex] : i;
                    if (void 0 !== k && (n = bf(this, k, A, df, x = b[T.a], S = b[T.b], w = b[T.c], wf))) {
                        if (F && F[Q]) {
                            var D = F[Q];
                            Bf.copy(D[0]),
                            xf.copy(D[1]),
                            Sf.copy(D[2]),
                            n.uv = RA.getUV(wf, x, S, w, Bf, xf, Sf, new s)
                        }
                        n.face = T,
                        n.faceIndex = Q,
                        e.push(n)
                    }
                }
            }
        }
    }
    ;
    var Qf = function(A, e) {
        this.model = e,
        this.loader = A,
        this.mapNodeInfoByCategory = {},
        this.mapNodeInfoByUserId = {},
        this.mapNodeInfoByComponentId = {},
        this.referencedMeshCache = {},
        this.nodeInfosOnGeometryId = null,
        this.componentCount = 0,
        this.meshCache = {},
        this.allBones = {}
    };
    Qf.EnumNodeItemType = {
        SYMBOL: 0,
        MESH: 1,
        TUBE: 2,
        PIPE: 3,
        BOX: 4,
        BOX_M: 5,
        PIPE_M: 6,
        MESH_REF: 7,
        LINE: 8
    },
    Qf.NodeInfoCategory = {
        INSTANCED: 0,
        STANDARD: 1
    },
    Qf.EnumDataType = {
        NONE: 0,
        MERGE_DATA: 1,
        LAYER: 2,
        LAYER_SCENE: 3,
        ANIMATION: 4
    },
    Qf.EnumKeyframeTrackType = {
        position: "position",
        scale: "scale",
        quaternion: "quaternion",
        weights: "weights"
    },
    Qf.prototype.destroy = function() {
        this.mapNodeInfoByCategory = null,
        this.mapNodeInfoByUserId = null,
        this.mapNodeInfoByComponentId = null,
        this.referencedMeshCache = null,
        this.nodeInfosOnGeometryId = null
    }
    ,
    Qf.prototype.clearReferencedMeshCache = function() {
        if (!vc.DEBUG) {
            for (var A in this.referencedMeshCache)
                delete this.referencedMeshCache[A];
            this.referencedMeshCache = null
        }
    }
    ,
    Qf.prototype.cacheReferencedMeshBufferData = function(A, e) {
        this.referencedMeshCache.geometries || (this.referencedMeshCache.geometries = {}),
        this.referencedMeshCache.geometries[A] = e
    }
    ,
    Qf.prototype.cacheReferencedMeshBoneBufferData = function(A, e) {
        this.referencedMeshCache.bones || (this.referencedMeshCache.bones = {}),
        this.referencedMeshCache.bones[A] = e
    }
    ,
    Qf.prototype.cacheReferencedMeshClipsData = function(A) {
        this.referencedMeshCache.clips = A
    }
    ,
    Qf.prototype.cacheReferencedMeshNodesData = function(A) {
        this.referencedMeshCache.nodes = A
    }
    ,
    Qf.prototype.cacheReferencedMeshComponentData = function(A, e) {
        this.referencedMeshCache.components || (this.referencedMeshCache.components = {}),
        this.referencedMeshCache.components[A] = e
    }
    ,
    Qf.prototype.cacheReferencedMeshMaterialData = function(A, e) {
        this.referencedMeshCache.materials || (this.referencedMeshCache.materials = {}),
        this.referencedMeshCache.materials[A] = e
    }
    ,
    Qf.prototype.getReferencedMeshBufferData = function() {
        return this.referencedMeshCache.geometries
    }
    ,
    Qf.prototype.getReferencedMeshBufferById = function(A) {
        return this.referencedMeshCache.geometries ? this.referencedMeshCache.geometries[A] : null
    }
    ,
    Qf.prototype.cacheReferencedMeshMpkIds = function(A, e) {
        this.referencedMeshCache.mpkIds || (this.referencedMeshCache.mpkIds = {}),
        this.referencedMeshCache.mpkIds[A] || (this.referencedMeshCache.mpkIds[A] = []),
        this.referencedMeshCache.mpkIds[A].push(e)
    }
    ,
    Qf.prototype.clearReferencedMeshCacheByMpkIdxs = function(A, e) {
        if (this.referencedMeshCache.mpkIds)
            for (var t = 0, i = A.length; i > t; t += 1) {
                var o = A[t]
                  , n = this.referencedMeshCache.mpkIds[o];
                if (n) {
                    for (var r = 0, a = n.length; a > r; r += 1)
                        e && e(n[r]),
                        delete this.referencedMeshCache[n[r]];
                    delete this.referencedMeshCache.mpkIds[o]
                }
            }
    }
    ,
    Qf.prototype.parseItemData = function(A, e) {
        (op(A.dataVersion, "1.0") || void 0 === A.dataVersion) && (Bh.time("升级几何结构"),
        this._updateV1ToV2(A),
        A.dataVersion = "2.0",
        Bh.timeEnd("升级几何结构")),
        this._readMaterialBuffer222(A),
        A.hasAnimation && vc.EnableAnimation ? (this._parseClips(),
        this._parseBones()) : (this._parseGeo(),
        this._parseInstanced());
        var t = this.loader.getSceneReaderArray();
        if (!t)
            return Bh.log("Empty scene"),
            !1;
        var i = this.referencedMeshCache;
        if (Bh.time("_readItemData"),
        !i.geometries || 0 >= Object.keys(i.geometries).length)
            return !0;
        if (e)
            for (var o = 0, n = e.length; n > o; o += 1)
                i.components[e[o]] && this._readItemData(t, e[o], e[o], void 0, 0);
        else
            for (var r in i.components)
                this._readItemData(t, r, r, void 0, 0);
        return A.hasAnimation && vc.EnableAnimation && this._parseNodes(),
        Bh.timeEnd("_readItemData"),
        t = null,
        !0
    }
    ,
    Qf.prototype._readItemData = function(A, e, t) {
        var i = this.referencedMeshCache.components[e];
        void 0 !== i && -1 !== i.geoId && (this.model.merged ? this._readMeshInfo(A, t, i, null) : this._readMeshInfo2(A, t, i, null))
    }
    ,
    Qf.prototype._readSymbolInfo = function(A, e, t) {
        var i = this.loader.getSymbolReader();
        if (i) {
            var o = i.header.symbolCount
              , n = t.toData
              , r = A.getMatrixInfo(t.matrixId).matrix.clone()
              , a = {
                matrix: r,
                ItemId: t.ItemId,
                originalId: t.originalId,
                userDataId: t.userDataId,
                materialId: t.materialId
            };
            if (n >= 0 && o > n)
                for (var s = i.getSymbolInfo(n), l = s.itemIndex; s.itemCount > l; l += 1) {
                    var c = i.getItemInfo(l);
                    c.type !== Qf.EnumNodeItemType.SYMBOL && this._readMeshInfo(i, e, c, a)
                }
            r = null,
            a = null,
            i = null
        }
    }
    ,
    Qf.prototype._readMeshInfo = function(A, e, t, i) {
        var o = this.loader
          , n = this.model.materialManager.materials
          , r = null
          , a = null
          , s = null;
        if (null === i ? (r = t.userDataId,
        a = t.originalId,
        s = t.materialId || t.matId) : (r = i.userDataId,
        a = i.originalId,
        s = i.materialId > -1 ? i.materialId : t.materialId),
        t.materials || (t.materials = []),
        t.materials.length > 0)
            for (var l = 0; t.materials.length > l; l += 1) {
                var c = null;
                if (c = this._getMeshNodeAttr(A, t, t.materials.length > 1, l),
                !n[s = t.materials[l]]) {
                    var h = _u[t.type] ? _u[t.type].color : void 0;
                    h || (Bh.log("Material not found for type: ", t.type),
                    h = _u.DEFAULT.color),
                    h || (Bh.log("Default material not found for type: ", t.type),
                    h = [1, 1, 1, 1]);
                    var d = new LA(h[0],h[1],h[2])
                      , p = s || d.getHexString() + "_" + h[3]
                      , g = n[p];
                    g || (Bh.warn("缺少材质 " + s),
                    g = new xr({
                        color: d
                    }),
                    1 > h[3] && (g.transparent = !0,
                    g.opacity = h[3]),
                    g.side = 2,
                    n[p] = g)
                }
                if (n[s].aoMap) {
                    var u = this.getReferencedMeshBufferById(c.geometryId);
                    u && (u.uv2 = u.uv)
                }
                if (!c)
                    return;
                var f = o.getUserDataReader()
                  , m = f ? f.getUserData(r) : null
                  , C = t.key;
                c.type = t.type,
                c.userId = C,
                c.name = t.name,
                c.userDataId = r,
                c.originalId = a,
                c.materialId = s,
                c.originMId = s,
                c.userData = m,
                c.categoryId = 0,
                c.componentId = C,
                c.familyName = t.familyName,
                c.familySymbol = t.familySymbol,
                c.instanceOrNot = !(!vc.Instance || !this.instancedComponent[C]),
                c.state = Lc.Visible,
                c.material = null,
                this._classifyNodeInfo(c),
                c = null
            }
        else {
            var y = null
              , v = _u[t.type] ? _u[t.type].color : void 0;
            v || (Bh.log("Material not found for type: ", t.type),
            v = _u.DEFAULT.color),
            v || (Bh.log("Default material not found for type: ", t.type),
            v = [1, 1, 1, 1]);
            var I = new LA(v[0],v[1],v[2])
              , E = I.getHexString() + "_" + v[3]
              , B = n[E];
            if (B || (B = new xr({
                color: I
            }),
            1 > v[3] && (B.transparent = !0,
            B.opacity = v[3]),
            B.side = 2,
            n[E] = B),
            t.materials.push(E),
            y = this._getMeshNodeAttr(A, t, !1, 0),
            s = t.materials[0],
            !y)
                return;
            var x = t.key;
            y.type = t.type,
            y.userId = x,
            y.name = t.name,
            y.originalId = a,
            y.materialId = s,
            y.originMId = s,
            y.userData = {},
            y.categoryId = 0,
            y.componentId = x,
            y.familyName = t.familyName,
            y.familySymbol = t.familySymbol,
            y.instanceOrNot = !(!vc.Instance || !this.instancedComponent[x]),
            y.state = Lc.Visible,
            y.material = null,
            this._classifyNodeInfo(y),
            y = null
        }
    }
    ,
    Qf.prototype._readMeshInfo2 = function(A, e, t, i) {
        var o = this.loader
          , n = null
          , r = null
          , a = null;
        null === i ? (n = t.userDataId,
        r = t.originalId,
        a = t.materials || t.matId) : (n = i.userDataId,
        r = i.originalId,
        a = i.materialId > -1 ? i.materialId : t.materialId);
        var s = null;
        if (s = this._getMeshNodeAttr(A, t, !1)) {
            var l = o.getUserDataReader()
              , c = l ? l.getUserData(n) : null
              , h = t.key;
            s.type = t.type,
            s.userId = h,
            s.name = t.name,
            s.originalId = r,
            s.materialId = a,
            s.originMId = a,
            s.userData = c,
            s.categoryId = 0,
            s.componentId = h,
            s.familyName = t.familyName,
            s.familySymbol = t.familySymbol,
            s.state = Lc.Visible,
            s.material = null,
            this._classifyNodeInfo(s),
            s = null
        }
    }
    ,
    Qf.prototype._getMeshNodeAttrOfPipe = function(A, e, t) {
        var i = A.getMatrixInfo(e.matrixId).matrix.clone()
          , o = uh.TemporaryMatrix;
        o.copy(i);
        var n = A.getGeomPipeInfo(e.toData)
          , r = n.startPt
          , a = n.endPt
          , s = new y;
        s.subVectors(a, r);
        var l = s.length();
        s.normalize();
        var c = n.radius;
        c > 1 || (c = 100);
        var h = new y(0,1,0)
          , d = new y(c,l,c)
          , p = (new f).setFromUnitVectors(h, s)
          , g = r.clone().addScaledVector(s, .5 * l)
          , u = (new M).compose(g, p, d);
        return i.multiply(u),
        t && (i.multiplyMatrices(t.matrix, i),
        o.multiplyMatrices(t.matrix, o)),
        n = null,
        {
            nodeId: (t ? t.ItemId + "_" + e.ItemId : e.ItemId) + "_pipe",
            geometryId: "pipe",
            boundingBox: e.boundingBox.clone().applyMatrix4(o),
            matrix: i,
            finalState: !0
        }
    }
    ,
    Qf.prototype._getMeshNodeAttrOfTube = function(A, e, t) {
        var i = this._getMeshNodeAttrOfPipe(A, e, t);
        return i.nodeId += "_tube",
        i.geometryId = "tube",
        i
    }
    ,
    Qf.prototype._getMeshNodeAttrOfBox = function(A, e, t) {
        var i = A.getMatrixInfo(e.matrixId).matrix.clone()
          , o = uh.TemporaryMatrix;
        o.copy(i);
        var n = e.boundingBox
          , r = n.getSize()
          , a = n.getCenter()
          , s = (new M).scale(new y(r.x,r.y,r.z));
        return s.setPosition(a),
        i.multiply(s),
        t && (i.multiplyMatrices(t.matrix, i),
        o.multiplyMatrices(t.matrix, o)),
        {
            nodeId: (t ? t.ItemId + "_" + e.ItemId : e.ItemId) + "_box",
            geometryId: "box",
            boundingBox: e.boundingBox.clone().applyMatrix4(o),
            matrix: i,
            finalState: !0
        }
    }
    ,
    Qf.prototype._getMeshNodeAttrOfBoxM = function(A, e, t) {
        var i = A.getMatrixInfo(e.matrixId).matrix.clone();
        return t && i.multiplyMatrices(t.matrix, i),
        {
            nodeId: (t ? t.ItemId + "_" + e.ItemId : e.ItemId) + "_boxM",
            geometryId: "boxM",
            boundingBox: e.boundingBox.clone().applyMatrix4(i),
            matrix: i,
            uvArrayBuffer: A.getGeomBoxUvInfo(e.toData),
            finalState: !0
        }
    }
    ,
    Qf.prototype._getMeshNodeAttrOfPipeM = function(A, e, t) {
        var i = A.getMatrixInfo(e.matrixId).matrix.clone();
        return t && i.multiplyMatrices(t.matrix, i),
        {
            nodeId: (t ? t.ItemId + "_" + e.ItemId : e.ItemId) + "_pipeM",
            geometryId: "pipeM",
            boundingBox: e.boundingBox.clone().applyMatrix4(i),
            matrix: i,
            uvArrayBuffer: A.getGeomPipeUvInfo(e.toData),
            finalState: !0
        }
    }
    ,
    Qf.prototype._getMeshNodeAttrOfMeshRef = function(A, e, t) {
        return {
            nodeId: "refMesh|" + (t ? t.ItemId + "_" + e.ItemId : e.ItemId),
            geometryId: e.toData,
            boundingBox: e.boundingBox.clone(),
            matrix: A.getMatrixInfo(e.matrixId).matrix.clone(),
            matrixParent: t ? t.matrix : null,
            finalState: !1,
            transformed: !1,
            shared: !0
        }
    }
    ,
    Qf.prototype._getMeshNodeAttr = function(A, e, t, i) {
        var o = new M;
        o.fromArray(e.matrix || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
        var n = t ? e.key + "_" + i : e.key
          , r = t ? e.geoId + "_" + i : e.geoId;
        if (-1 !== r) {
            var a = new aA
              , s = this.getReferencedMeshBufferById(e.geoId);
            return s && s.position ? (a = Tu.getBoundingBoxByBuffer(s.position)).applyMatrix4(o) : Bh.warn("no position "),
            {
                nodeId: n,
                guid: e.guid,
                geometryId: r,
                originalGeometryId: e.geoId,
                matrix: o,
                boundingBox: a,
                model: this.model
            }
        }
    }
    ,
    Qf.prototype._getLineNodeAttr = function(A, e, t) {
        var i = null
          , o = null;
        return -1 !== e.matrixId ? (o = !1,
        i = A.getMatrixInfo(e.matrixId).matrix.clone()) : (o = !0,
        i = new M),
        {
            nodeId: t ? "line-" + t.ItemId + "-" + e.ItemId : "line-" + e.ItemId,
            geometryId: "line-" + e.toData,
            boundingBox: e.boundingBox.clone(),
            matrix: i,
            matrixParent: t ? t.matrix : null,
            finalState: !1,
            transformed: o
        }
    }
    ,
    Qf.prototype._classifyNodeInfo = function(A) {
        this._cacheNodeInfoByComponentId(A),
        this._cacheNodeInfoByUserId(A),
        this._cacheNodeInfoByCategory(A)
    }
    ,
    Qf.prototype._cacheNodeInfoByComponentId = function(A) {
        void 0 === this.mapNodeInfoByComponentId[A.componentId] && (this.mapNodeInfoByComponentId[A.componentId] = []),
        this.mapNodeInfoByComponentId[A.componentId].push(A)
    }
    ,
    Qf.prototype._clearNodeInfoCacheWithComponentId = function(A) {
        if (A)
            for (var e = 0, t = A.length; t > e; e += 1)
                delete this.mapNodeInfoByComponentId[A[e]];
        else
            this.mapNodeInfoByComponentId = {}
    }
    ,
    Qf.prototype._clearNodeInfoCacheWithUserId = function(A) {
        if (A)
            for (var e = 0, t = A.length; t > e; e += 1)
                delete this.mapNodeInfoByUserId[A[e]];
        else
            this.mapNodeInfoByUserId = {}
    }
    ,
    Qf.prototype._clearNodeInfoCacheWithCategory = function(A) {
        if (A)
            for (var e = this.mapNodeInfoByCategory[Qf.NodeInfoCategory.INSTANCED], t = this.mapNodeInfoByCategory[Qf.NodeInfoCategory.STANDARD], i = 0, o = A.length; o > i; i += 1)
                e && delete e[A[i]],
                t && delete t[A[i]];
        else
            this.mapNodeInfoByCategory = {}
    }
    ,
    Qf.prototype.clearNodeInfoCache = function() {
        this._clearNodeInfoCacheWithComponentId(),
        this._clearNodeInfoCacheWithUserId(),
        this._clearNodeInfoCacheWithCategory()
    }
    ,
    Qf.prototype.clearNodeInfoCacheByComponentsKey = function(A) {
        this._clearNodeInfoCacheWithComponentId(A),
        this._clearNodeInfoCacheWithUserId(A),
        this._clearNodeInfoCacheWithCategory(A)
    }
    ,
    Qf.prototype.getNodeInfosWithComponentId = function() {
        return this.mapNodeInfoByComponentId
    }
    ,
    Qf.prototype.getNodeInfosByComponentId = function(A) {
        return this.mapNodeInfoByComponentId[A]
    }
    ,
    Qf.prototype._cacheNodeInfoByUserId = function(A) {
        void 0 === this.mapNodeInfoByUserId[A.userId] && (this.mapNodeInfoByUserId[A.userId] = []),
        this.mapNodeInfoByUserId[A.userId].push(A)
    }
    ,
    Qf.prototype.getNodeInfosByUserId = function(A) {
        return this.mapNodeInfoByUserId[A]
    }
    ,
    Qf.prototype.getNodeInfosWithUserId = function() {
        return this.mapNodeInfoByUserId
    }
    ,
    Qf.prototype._cacheNodeInfoByCategory = function(A) {
        var e = null;
        void 0 === this.mapNodeInfoByCategory[e = A.instanceOrNot ? Qf.NodeInfoCategory.INSTANCED : Qf.NodeInfoCategory.STANDARD] && (this.mapNodeInfoByCategory[e] = {}),
        void 0 === this.mapNodeInfoByCategory[e][A.userId] && (this.mapNodeInfoByCategory[e][A.userId] = []),
        this.mapNodeInfoByCategory[e][A.userId].push(A)
    }
    ,
    Qf.prototype.getNodeInfosByCategory = function(A) {
        return this.mapNodeInfoByCategory[A]
    }
    ,
    Qf.prototype.getStandardNodeInfos = function() {
        return this.getNodeInfosByCategory(Qf.NodeInfoCategory.STANDARD)
    }
    ,
    Qf.prototype.getInstancedNodeInfos = function() {
        return this.getNodeInfosByCategory(Qf.NodeInfoCategory.INSTANCED)
    }
    ,
    Qf.prototype.getStandardUserIds = function() {
        return this.getStandardNodeInfos() ? Object.keys(this.getStandardNodeInfos()) : null
    }
    ,
    Qf.prototype.getInstancedUserIds = function() {
        return this.getInstancedNodeInfos() ? Object.keys(this.getInstancedNodeInfos()) : null
    }
    ,
    Qf.prototype.traverseNodeInfos = function(A) {
        if (A)
            for (var e in this.mapNodeInfoByComponentId)
                for (var t = this.mapNodeInfoByComponentId[e], i = 0, o = t.length; o > i; i += 1)
                    A(e, t[i])
    }
    ,
    Qf.prototype.getUserIdsByCategory = function(A, e) {
        var t = []
          , i = null;
        if (i = e === Qf.NodeInfoCategory.INSTANCED ? this.getInstancedNodeInfos() : this.getStandardNodeInfos())
            for (var o = 0, n = A.length; n > o; o += 1)
                i[A[o]] && t.push(A[o]);
        return t
    }
    ,
    Qf.prototype.getInstancedUserIdsByCategory = function(A) {
        return this.getUserIdsByCategory(A, Qf.NodeInfoCategory.INSTANCED)
    }
    ,
    Qf.prototype.getStandardUserIdsByCategory = function(A) {
        return this.getUserIdsByCategory(A, Qf.NodeInfoCategory.STANDARD)
    }
    ,
    Qf.prototype.getNodeInfosOnBMpkGeometryId = function() {
        return this.nodeInfosOnGeometryId || this.cacheNodeInfosOnGeometryId(),
        this.nodeInfosOnGeometryId
    }
    ,
    Qf.prototype.cacheNodeInfosOnGeometryId = function() {
        var A = this.getStandardNodeInfos();
        for (var e in this.nodeInfosOnGeometryId = {},
        A)
            for (var t = A[e], i = 0, o = t.length; o > i; i += 1) {
                var n = this.loader.convertToBMpkGeometryId(t[i].geometryId);
                void 0 !== n && (t[i].geometryId = n),
                this.nodeInfosOnGeometryId[t[i].geometryId] || (this.nodeInfosOnGeometryId[t[i].geometryId] = []),
                this.nodeInfosOnGeometryId[t[i].geometryId].push(t[i])
            }
    }
    ,
    Qf.prototype.updateNodeInfosByIds = function(A) {}
    ,
    Qf.prototype._isRegularShape = function(A) {
        var e = A.type === Qf.EnumNodeItemType.TUBE || A.type === Qf.EnumNodeItemType.PIPE || A.type === Qf.EnumNodeItemType.BOX || A.type === Qf.EnumNodeItemType.BOX_M || A.type === Qf.EnumNodeItemType.PIPE_M;
        return vc.SharedMeshInstanceEnable && (e = e || A.type === Qf.EnumNodeItemType.MESH_REF),
        e
    }
    ,
    Qf.prototype.getOctreeRoots = function(A) {
        var e = this.loader
          , t = e.getOctreeRootNodeOuter();
        t && A.push(t);
        var i = e.getOctreeRootNodeInner();
        i && A.push(i)
    }
    ,
    Qf.prototype.getComponentCount = function() {
        return this.componentCount
    }
    ,
    Qf.prototype._parseInstanced = function() {
        this.instancedComponent = {};
        var A = {}
          , e = {}
          , t = this.referencedMeshCache;
        for (var i in t.components)
            if (t.components.hasOwnProperty(i)) {
                var o = t.components[i]
                  , n = o.geoId;
                if (-1 === n) {
                    Bh.debug("实体没有几何");
                    continue
                }
                if (void 0 === A[n] && (A[n] = [],
                e[n] = {}),
                A[n].push({
                    componentId: i
                }),
                !o.materials) {
                    o.materials = [];
                    continue
                }
                for (var r = 0; o.materials.length > r; r += 1) {
                    var a = o.materials[r];
                    e[n][a] || (e[n][a] = []),
                    e[n][a].push({
                        componentId: i,
                        matrix: o.matrix
                    })
                }
            }
        for (var s in A)
            if (A.hasOwnProperty(s))
                if (1 < A[s].length)
                    for (r = 0; A[s].length > r; r += 1)
                        this.instancedComponent[A[s][r].componentId] = !0;
                else
                    delete A[s],
                    delete e[s]
    }
    ,
    Qf.prototype._parseBones = function() {
        var A = this.referencedMeshCache;
        for (var e in A._offsetMatrix || (A._offsetMatrix = {}),
        A.geometries) {
            var t = A.geometries[e];
            t.position.length !== t.normal.length && (t.normal = t.normal.length === t.index.length ? this._computeVertexNormalsFromFaceNormals(t.normal, t.index, t.position.length) : this._computeVertexNormalsFromIndex(t.index, t.position));
            var i = A.bones[e];
            if (i) {
                t.skinIndex = i.skinIndex,
                t.skinWeight = i.skinWeight;
                var o = i.name;
                i.offsetMatrix.length / 16 !== o.length && Bh.debug("bones的name数量与Matrix数量不符！");
                for (var n = 0; o.length > n; n += 1)
                    A._offsetMatrix[o[n]] = (new M).fromArray(i.offsetMatrix, 16 * n)
            }
        }
    }
    ,
    Qf.prototype._parseClips = function() {
        for (var A = this.referencedMeshCache.clips, e = [], t = 0, i = A.length; i > t; t += 1) {
            for (var o = [], n = A[t], r = 0, a = n.tracks.length; a > r; r += 1) {
                var s = n.tracks[r]
                  , l = null;
                switch (s.type) {
                case Qf.EnumKeyframeTrackType.weights:
                    l = Dr;
                    break;
                case Qf.EnumKeyframeTrackType.quaternion:
                    l = Nr;
                    break;
                case Qf.EnumKeyframeTrackType.position:
                case Qf.EnumKeyframeTrackType.scale:
                default:
                    l = Vr
                }
                if (0 === n.ticksPerSec) {
                    n.ticksPerSec = 1e3;
                    for (var c = 0; s.times.length > c; c += 1)
                        s.times[c] /= n.ticksPerSec
                }
                var h = new l(Fs.sanitizeNodeName(s.name) + "." + s.type,s.times,s.values,2301);
                o.push(h)
            }
            var d = new Gr(void 0 !== n.name ? n.name : "animation_" + t,n.duration / n.ticksPerSec,o);
            e.push(d)
        }
        this.model.animations = e
    }
    ,
    Qf.prototype._parseNodes = function() {
        var A = this.referencedMeshCache;
        A.allBones = [],
        A.offsetMatrix = [];
        var e = function A(e, t) {
            var i = null;
            "node" === e.type ? i = new H : "bone" === e.type && (i = new Uo,
            t.allBones[e.name] = i),
            i.name = Fs.sanitizeNodeName(e.name),
            i.matrix.fromArray(e.transformation || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
            i.matrix.decompose(i.position, i.quaternion, i.scale);
            for (var o = 0; e.children.length > o; o += 1) {
                var n = A(e.children[o], t);
                n && i.add(n)
            }
            for (var r = 0; e.meshes.length > r; r += 1) {
                var a = e.meshes[r];
                t.model._getHandler().defaultManager.meshManager._readBufferInfo(t.model, [t.model.modelKey + "_" + e.meshes[r]]);
                var s = t.model._getHandler().defaultManager.meshManager._makeSkinMesh(t.model, [t.model.modelKey + "_" + e.meshes[r]], (function(A) {}
                ));
                t.meshCache[a] = s,
                s.name = e.name,
                i.add(s)
            }
            return i
        }(A.nodes, this);
        for (var t in A.geometries) {
            var i = this.meshCache[t];
            if (i && i.isSkinnedMesh) {
                for (var o = [], n = [], r = 0; A.bones[t].name.length > r; r += 1) {
                    var a = A.bones[t].name[r]
                      , s = A._offsetMatrix[a]
                      , l = this.allBones[a];
                    s && l && (o.push(l),
                    n.push(s))
                }
                var c = new bo(o,n);
                i.bind(c, i.matrixWorld)
            }
        }
        this.model.nodes = e,
        this.model.manager.getScene().onBeforeRender = function(A, e, t, i) {
            e.updateMatrixWorld(!0)
        }
        ,
        this.model.group.add(e),
        (c = new _s(e)).visible = !1,
        this.model.skeleton = c,
        this.model.group.add(c),
        this.model.mixer = new Rs(e),
        this.model.actions = [];
        for (var h = 0; this.model.animations.length > h; h += 1) {
            var d = this.model.mixer.clipAction(this.model.animations[h]);
            this.model.actions.push(d)
        }
    }
    ,
    Qf.prototype._parseGeo = function() {
        Bh.time("处理几何:按材质拆分构件");
        var A = this.referencedMeshCache;
        for (var e in A.geometries) {
            var t = A.geometries[e];
            if (t.position.length !== t.normal.length && (t.normal = t.normal.length === t.index.length ? this._computeVertexNormalsFromFaceNormals(t.normal, t.index, t.position.length) : this._computeVertexNormalsFromIndex(t.index, t.position)),
            void 0 !== t.materialIndex) {
                for (var i = void 0, o = [], n = null, r = 0; t.materialIndex.length > r; r += 1) {
                    var a = t.materialIndex[r];
                    a !== n && (n = a,
                    void 0 !== i && (i.count = 3 * r - i.start,
                    o.push(i)),
                    i = {
                        start: 3 * r,
                        materialIndex: n
                    })
                }
                if (void 0 !== i && (i.count = 3 * t.materialIndex.length - i.start,
                o.push(i)),
                1 === o.length) {
                    A.geometries[e + "_" + o[0].materialIndex] = t
                } else {
                    for (var s = {}, l = 0; o.length > l; l += 1) {
                        var c = o[l];
                        void 0 === s[c.materialIndex] && (s[c.materialIndex] = {
                            index: [],
                            count: 0
                        }),
                        s[c.materialIndex].index.push({
                            start: c.start,
                            count: c.count
                        }),
                        s[c.materialIndex].count += c.count
                    }
                    var h = function() {
                        p = {},
                        g = s[d];
                        for (var i = 0, o = new Uint32Array(g.count), n = 0; g.index.length > n; n += 1) {
                            var r = g.index[n]
                              , a = t.index.slice(r.start, r.start + r.count);
                            o.set(a, i),
                            i += r.count
                        }
                        u = {},
                        o.forEach((function(A, e) {
                            u[A] || (u[A] = []),
                            u[A].push(e)
                        }
                        ));
                        var l = Object.keys(u).length;
                        f = new Float32Array(3 * l),
                        m = new Float32Array(3 * l),
                        C = new Float32Array(2 * l),
                        y = 0,
                        v = 0;
                        var c = 0;
                        for (var h in u)
                            if (u.hasOwnProperty(h)) {
                                h = Number(h);
                                var I = t.position.slice(3 * h, 3 * h + 3)
                                  , E = t.normal.slice(3 * h, 3 * h + 3);
                                if (t.uv.length > 0) {
                                    var B = t.uv.slice(2 * h, 2 * h + 2);
                                    C.set(B, v),
                                    v += 2
                                }
                                f.set(I, y),
                                m.set(E, y),
                                y += 3,
                                u[h].forEach((function(A) {
                                    o[A] = c
                                }
                                )),
                                c += 1
                            }
                        p.index = o,
                        p.position = f,
                        p.normal = m,
                        t.uv && t.uv.length > 0 && (p.uv = C),
                        A.geometries[e + "_" + d] = p
                    };
                    for (var d in s) {
                        var p, g, u, f, m, C, y, v;
                        h()
                    }
                }
            }
        }
        Bh.timeEnd("处理几何:按材质拆分构件")
    }
    ,
    Qf.prototype._computeVertexNormalsFromFaceNormals = function(A, e, t) {
        for (var i = new Float32Array(t), o = 0, n = 0, r = 0, a = 0, s = 0, l = 0, c = 0; A.length > c; c += 3)
            s = A[c + 1],
            l = A[c + 2],
            n = 3 * e[c + 1],
            r = 3 * e[c + 2],
            i[o = 3 * e[c]] = a = A[c],
            i[o + 1] = s,
            i[o + 2] = l,
            i[n] = a,
            i[n + 1] = s,
            i[n + 2] = l,
            i[r] = a,
            i[r + 1] = s,
            i[r + 2] = l;
        return i
    }
    ,
    Qf.prototype._computeVertexNormalsFromIndex = function(A, e) {
        var t = new Float32Array(e.length);
        if (e) {
            var i = 0
              , o = 0
              , n = 0
              , r = new y
              , a = new y
              , s = new y
              , l = new y
              , c = new y;
            if (A)
                for (var h = A, d = 0; h.length > d; d += 3)
                    o = 3 * h[d + 1],
                    n = 3 * h[d + 2],
                    r.fromArray(e, i = 3 * h[d]),
                    a.fromArray(e, o),
                    s.fromArray(e, n),
                    l.subVectors(s, a),
                    c.subVectors(r, a),
                    l.cross(c),
                    t[i] += l.x,
                    t[i + 1] += l.y,
                    t[i + 2] += l.z,
                    t[o] += l.x,
                    t[o + 1] += l.y,
                    t[o + 2] += l.z,
                    t[n] += l.x,
                    t[n + 1] += l.y,
                    t[n + 2] += l.z;
            else
                for (var p = 0, g = e.length; g > p; p += 9)
                    r.fromArray(e, p),
                    a.fromArray(e, p + 3),
                    s.fromArray(e, p + 6),
                    l.subVectors(s, a),
                    c.subVectors(r, a),
                    l.cross(c),
                    t[p] = l.x,
                    t[p + 1] = l.y,
                    t[p + 2] = l.z,
                    t[p + 3] = l.x,
                    t[p + 4] = l.y,
                    t[p + 5] = l.z,
                    t[p + 6] = l.x,
                    t[p + 7] = l.y,
                    t[p + 8] = l.z
        }
        return t
    }
    ,
    Qf.prototype._readMaterialBuffer222 = function(A) {
        var e = A.materialManager
          , t = e.materials
          , i = e.textures
          , o = this.referencedMeshCache.materials;
        for (var n in o) {
            var r = o[n];
            if (!r)
                return null;
            var a = new xr;
            if (a.name = r.name || n,
            a.key = n,
            r.emissive && a.emissive && (1 === r.emissive[0] && 1 === r.emissive[1] && 1 === r.emissive[2] || a.emissive.setRGB(r.emissive[0], r.emissive[1], r.emissive[2])),
            r.color ? a.color.setRGB(r.color[0], r.color[1], r.color[2]) : a.color.setRGB(.72, .72, .72),
            r.tint && a.color.setRGB(r.tint[0], r.tint[1], r.tint[2]),
            r.specular && a.specular && a.specular.setRGB(r.specular[0], r.specular[1], r.specular[2]),
            r.map)
                if (void 0 !== r.mapOffsetY && 0 !== r.mapOffsetY || void 0 !== r.mapOffsetX && 0 !== r.mapOfsfetX || void 0 !== r.mapScaleX && 1 !== r.mapScaleX || void 0 !== r.mapScaleY && 1 !== r.mapScaleY || void 0 !== r.mapWAngle && 0 !== r.mapWAngle) {
                    var s = r.mapOffsetX + "_" + r.mapOffsetY + "_" + r.mapScaleX + "_" + r.mapScaleY + "_" + r.mapWAngle + "_" + r.map;
                    if (i[s])
                        a.map = i[s];
                    else
                        (g = new d).wrapS = g.wrapT = 1e3,
                        g.image = i[r.map].image ? i[r.map].image : null,
                        g.needsUpdate = !0,
                        g.image && (g.offset.x = r.mapOffsetX ? r.mapOffsetX : 0,
                        g.offset.y = r.mapOffsetY ? r.mapOffsetY : 0,
                        g.repeat.x = r.mapScaleX ? r.mapScaleX : 1,
                        g.repeat.y = r.mapScaleY ? r.mapScaleY : 1,
                        g.rotation = r.mapWAngle ? r.mapWAngle : 0,
                        i[s] = g,
                        a.map = g)
                } else
                    a.map = i[r.map] ? i[r.map] : null;
            if (r.aoMap)
                if (void 0 !== r.aoMapOffsetY && 0 !== r.aoMapOffsetY || void 0 !== r.aoMapOffsetX && 0 !== r.aoMapOfsfetX || void 0 !== r.aoMapScaleX && 1 !== r.aoMapScaleX || void 0 !== r.aoMapScaleY && 1 !== r.aoMapScaleY || void 0 !== r.aoMapWAngle && 0 !== r.aoMapWAngle) {
                    var l = r.aoMapOffsetX + "_" + r.aoMapOffsetY + "_" + r.aoMapScaleX + "_" + r.aoMapScaleY + "_" + r.aoMapWAngle + "_" + r.aoMap;
                    if (i[l])
                        a.aoMap = i[l];
                    else
                        (g = new d).wrapS = g.wrapT = 1e3,
                        g.image = i[r.aoMap] && i[r.aoMap].image ? i[r.aoMap].image : null,
                        g.needsUpdate = !0,
                        g.image && (g.offset.x = r.aoMapOffsetX ? r.aoMapOffsetX : 0,
                        g.offset.y = r.aoMapOffsetY ? r.aoMapOffsetY : 0,
                        g.repeat.x = r.aoMapScaleX ? r.aoMapScaleX : 1,
                        g.repeat.y = r.aoMapScaleY ? r.aoMapScaleY : 1,
                        g.rotation = r.aoMapWAngle ? r.aoMapWAngle : 0,
                        i[l] = g,
                        a.aoMap = g)
                } else
                    a.aoMap = i[r.aoMap] ? i[r.aoMap] : null;
            if (void 0 !== r.aoMapIntensity && (a.aoMapIntensity = r.aoMapIntensity),
            r.envMap)
                if (void 0 !== r.envMapOffsetY && 0 !== r.envMapOffsetY || void 0 !== r.envMapOffsetX && 0 !== r.envMapOfsfetX || void 0 !== r.envMapScaleX && 1 !== r.envMapScaleX || void 0 !== r.envMapScaleY && 1 !== r.envMapScaleY || void 0 !== r.envMapWAngle && 0 !== r.envMapWAngle) {
                    var c = r.envMapOffsetX + "_" + r.envMapOffsetY + "_" + r.envMapScaleX + "_" + r.envMapScaleY + "_" + r.envMapWAngle + "_" + r.envMap;
                    if (i[c])
                        a.envMap = i[c];
                    else
                        (g = new d).wrapS = g.wrapT = 1e3,
                        g.image = i[r.envMap].image ? i[r.envMap].image : null,
                        g.needsUpdate = !0,
                        g.image && (g.offset.x = r.envMapOffsetX ? r.envMapOffsetX : 0,
                        g.offset.y = r.envMapOffsetY ? r.envMapOffsetY : 0,
                        g.repeat.x = r.envMapScaleX ? r.envMapScaleX : 1,
                        g.repeat.y = r.envMapScaleY ? r.envMapScaleY : 1,
                        g.rotation = r.envMapWAngle ? r.envMapWAngle : 0,
                        i[c] = g,
                        a.envMap = g)
                } else
                    a.envMap = i[r.envMap] ? i[r.envMap] : null;
            if (r.lightMap)
                if (void 0 !== r.lightMapOffsetY && 0 !== r.lightMapOffsetY || void 0 !== r.lightMapOffsetX && 0 !== r.lightMapOfsfetX || void 0 !== r.lightMapScaleX && 1 !== r.lightMapScaleX || void 0 !== r.lightMapScaleY && 1 !== r.lightMapScaleY || void 0 !== r.lightMapWAngle && 0 !== r.lightMapWAngle) {
                    var h = r.lightMapOffsetX + "_" + r.lightMapOffsetY + "_" + r.lightMapScaleX + "_" + r.lightMapScaleY + "_" + r.lightMapWAngle + "_" + r.lightMap;
                    if (i[h])
                        a.lightMap = i[h];
                    else
                        (g = new d).wrapS = g.wrapT = 1e3,
                        g.image = i[r.lightMap].image ? i[r.lightMap].image : null,
                        g.needsUpdate = !0,
                        g.image && (g.offset.x = r.lightMapOffsetX ? r.lightMapOffsetX : 0,
                        g.offset.y = r.lightMapOffsetY ? r.lightMapOffsetY : 0,
                        g.repeat.x = r.lightMapScaleX ? r.lightMapScaleX : 1,
                        g.repeat.y = r.lightMapScaleY ? r.lightMapScaleY : 1,
                        g.rotation = r.lightMapWAngle ? r.lightMapWAngle : 0,
                        i[h] = g,
                        a.lightMap = g)
                } else
                    a.lightMap = i[r.lightMap] ? i[r.lightMap] : null;
            if (void 0 !== r.lightMapIntensity && (a.lightMapIntensity = r.lightMapIntensity),
            r.emissiveMap)
                if (void 0 !== r.emissiveMapOffsetY && 0 !== r.emissiveMapOffsetY || void 0 !== r.emissiveMapOffsetX && 0 !== r.emissiveMapOfsfetX || void 0 !== r.emissiveMapScaleX && 1 !== r.emissiveMapScaleX || void 0 !== r.emissiveMapScaleY && 1 !== r.emissiveMapScaleY || void 0 !== r.emissiveMapWAngle && 0 !== r.emissiveMapWAngle) {
                    var p = r.emissiveMapOffsetX + "_" + r.emissiveMapOffsetY + "_" + r.emissiveMapScaleX + "_" + r.emissiveMapScaleY + "_" + r.emissiveMapWAngle + "_" + r.emissiveMap;
                    if (i[p])
                        a.emissiveMap = i[p];
                    else
                        (g = new d).wrapS = g.wrapT = 1e3,
                        g.image = i[r.emissiveMap].image ? i[r.emissiveMap].image : null,
                        g.needsUpdate = !0,
                        g.image && (g.offset.x = r.emissiveMapOffsetX ? r.emissiveMapOffsetX : 0,
                        g.offset.y = r.emissiveMapOffsetY ? r.emissiveMapOffsetY : 0,
                        g.repeat.x = r.emissiveMapScaleX ? r.emissiveMapScaleX : 1,
                        g.repeat.y = r.emissiveMapScaleY ? r.emissiveMapScaleY : 1,
                        g.rotation = r.emissiveMapWAngle ? r.emissiveMapWAngle : 0,
                        i[p] = g,
                        a.emissiveMap = g)
                } else
                    a.emissiveMap = i[r.emissiveMap] ? i[r.emissiveMap] : null;
            if (void 0 !== r.emissiveIntensity && (a.emissiveIntensity = r.emissiveIntensity),
            r.specularMap)
                if (void 0 !== r.specularMapOffsetY && 0 !== r.specularMapOffsetY || void 0 !== r.specularMapOffsetX && 0 !== r.specularMapOfsfetX || void 0 !== r.specularMapScaleX && 1 !== r.specularMapScaleX || void 0 !== r.specularMapScaleY && 1 !== r.specularMapScaleY || void 0 !== r.specularMapWAngle && 0 !== r.specularMapWAngle) {
                    var g, u = r.specularMapOffsetX + "_" + r.specularMapOffsetY + "_" + r.specularMapScaleX + "_" + r.specularMapScaleY + "_" + r.specularMapWAngle + "_" + r.specularMap;
                    if (i[u])
                        a.specularMap = i[u];
                    else
                        (g = new d).wrapS = g.wrapT = 1e3,
                        g.image = i[r.specularMap].image ? i[r.specularMap].image : null,
                        g.needsUpdate = !0,
                        g.image && (g.offset.x = r.specularMapOffsetX ? r.specularMapOffsetX : 0,
                        g.offset.y = r.specularMapOffsetY ? r.specularMapOffsetY : 0,
                        g.repeat.x = r.specularMapScaleX ? r.specularMapScaleX : 1,
                        g.repeat.y = r.specularMapScaleY ? r.specularMapScaleY : 1,
                        g.rotation = r.specularMapWAngle ? r.specularMapWAngle : 0,
                        i[u] = g,
                        a.specularMap = g)
                } else
                    a.specularMap = i[r.specularMap] ? i[r.specularMap] : null;
            void 0 !== r.shininess && (a.shininess = r.shininess),
            void 0 !== r.opacity && (a.opacity = r.opacity,
            1 > r.opacity && (a.transparent = !0),
            r.opacity > 0 || (a.opacity = .1)),
            a.side = 2,
            t[n] = a
        }
    }
    ,
    Qf.prototype._updateV1ToV2 = function(A) {
        var e = this.referencedMeshCache.components
          , t = this.referencedMeshCache.geometries
          , i = this.referencedMeshCache.materials;
        for (var o in e)
            if (e.hasOwnProperty(o)) {
                var n = e[o]
                  , r = n.matId
                  , a = t[n.geoId];
                if (n.materials)
                    continue;
                if (n.materials = [],
                !a)
                    continue;
                var s = i[r];
                if (!s)
                    continue;
                var l = this._updateMaterialV1ToV2(r, s);
                if (l)
                    for (var c in a.materialIndex = l.materialIndex,
                    n.materials = l.materialId,
                    l.materials)
                        l.materials.hasOwnProperty(c) && (this.referencedMeshCache.materials[c] = l.materials[c])
            }
    }
    ,
    Qf.prototype._updateMaterialV1ToV2 = function(A, e) {
        var t = {}
          , i = []
          , o = {};
        if (!e)
            return null;
        for (var n = e.color, r = e.colorIndex, a = e.texture, s = e.textureIndex, l = 0; n.length > l; l += 4) {
            var c = {};
            c.color = [n[l], n[l + 1], n[l + 2]],
            c.opacity = Math.floor(100 * n[l + 3]) / 100,
            c.transparent = 1 > n[l + 3];
            var h = (255 * c.color[0] << 16 ^ 255 * c.color[1] << 8 ^ 255 * c.color[2] << 0) + "_" + c.opacity;
            o[h] = c,
            i.push(h)
        }
        if (0 !== a.length && r.length === s.length)
            for (var d = -1, p = 0; s.length > p; p += 1) {
                if (d !== r[p])
                    if (d = r[p],
                    -1 !== s[p])
                        o[i[r[p]]].map = a[s[p]]
            }
        return t.materials = o,
        t.materialId = i,
        t.materialIndex = r,
        t
    }
    ,
    Qf.prototype.addMeshToInfoMap = function(A, e, t, i) {
        var o = this.getNodeInfosByComponentId(A);
        Array.isArray(o) && o.forEach((function(A) {
            A.nodeId === e && (A.mesh = t,
            A.index = i)
        }
        ))
    }
    ;
    var Rf = function() {
        this.geometries = {}
    };
    Rf.prototype.dispose = function() {
        this.disposeGeometries(),
        this.geometries = {}
    }
    ,
    Rf.prototype.destory = function() {
        this.dispose()
    }
    ,
    Rf.prototype.disposeGeometries = function() {
        for (var A in this.geometries)
            this.disposeGeometry(A)
    }
    ,
    Rf.prototype.disposeGeometry = function(A) {
        var e = this.geometries[A];
        if (e) {
            if (Array.isArray(e))
                for (var t = 0, i = e.length; i > t; t += 1)
                    e[t].dispose();
            else
                e.dispose();
            delete this.geometries[A]
        }
    }
    ,
    Rf.prototype._hasGeometry = function(A) {
        return !!this.geometries[A]
    }
    ,
    Rf.prototype._cacheGeometry = function(A, e) {
        void 0 === this.geometries[A] && (this.geometries[A] = e)
    }
    ,
    Rf.prototype.getNodeIdxMapByUserId = function(A) {}
    ,
    Rf.prototype.getGeometryById = function(A) {
        return this.geometries[A]
    }
    ,
    Rf.prototype.getGeometryByNodeInfo = function(A, e) {
        return this._hasGeometry(e.geometryId) ? this.getGeometryById(e.geometryId) : this._createGeometryByNodeInfo(A, e)
    }
    ,
    Rf.prototype._createGeometryByNodeInfo = function(A, e) {
        return this._createGeometry(e.type, e.geometryId, A.getModelDescriptor().getReferencedMeshBufferById(e.geometryId))
    }
    ,
    Rf.prototype._createGeometry = function(A, e, t) {
        if (this._hasGeometry(e))
            return this.getGeometryById(e);
        var i = this._createBufferGeometry(A, t);
        return i ? (i.key = e,
        this._cacheGeometry(e, i),
        i) : null
    }
    ,
    Rf.prototype._createBufferGeometry = function(A, e) {
        var t = Qf.EnumNodeItemType
          , i = null;
        switch (1) {
        case t.MESH:
        case t.MESH_REF:
            if (!e)
                return null;
            if ((i = new he).setIndex(new YA(e.index,1)),
            i.setAttribute("position", new YA(e.position,3)),
            e.normal && e.normal.length > 0 ? i.setAttribute("normal", new YA(e.normal,3)) : i.computeVertexNormals(),
            e.uv && e.uv.length > 0 && i.setAttribute("uv", new YA(e.uv,2)),
            e.uv2 && e.uv2.length > 0 && i.setAttribute("uv2", new YA(e.uv2,2)),
            e.skinIndex && e.skinIndex.length > 0 ? i.setAttribute("skinIndex", new YA(e.skinIndex,4)) : Bh.debug("skinIndex 长度为0"),
            e.skinWeight && e.skinWeight.length > 0 ? i.setAttribute("skinWeight", new YA(e.skinWeight,4)) : Bh.debug("skinWeight 长度为0"),
            void 0 !== e.materialIndex) {
                for (var o = null, n = [], r = void 0, a = 0; e.materialIndex.length > a; a += 1) {
                    var s = e.materialIndex[a];
                    s !== r && (r = s,
                    null != o && (o.count = 3 * a - o.start,
                    n.push(o)),
                    o = {
                        start: 3 * a,
                        materialIndex: r
                    })
                }
                null != o && (o.count = 3 * e.materialIndex.length - o.start,
                n.push(o)),
                i.groups = n
            }
            break;
        case t.TUBE:
        case t.PIPE:
            i = Tu.UnitCylinderInstance;
            break;
        case t.BOX:
            i = Tu.UnitBoxInstance;
            break;
        case t.BOX_M:
            i = Tu.getUnitTextureBox();
            break;
        case t.PIPE_M:
            i = Tu.getUnitTextureCylinder();
            break;
        case t.LINE:
            if (!e)
                return null;
            (i = new he).setIndex(new YA(e.I,1)),
            i.setAttribute("position", new YA(e.P,3))
        }
        return i
    }
    ,
    Rf.prototype.createBufferByBufferDataWithUV2 = function(A, e, t) {
        var i = this.createBufferByBufferData(e, t);
        if (!i)
            return null;
        if (!A.lightmap)
            return i;
        var o = []
          , n = i.index
          , r = A.getLoader().getUV2ById(e.itemIdUV2, n.length);
        r && (e.lightmapIdx = r.lightmapIdx,
        o = r.uv2);
        for (var a = i.position, s = i.normal, l = i.uv, c = [], h = [], d = [], p = 0; n.length > p; p += 1) {
            var g = n[p];
            c.push(a[3 * g]),
            c.push(a[3 * g + 1]),
            c.push(a[3 * g + 2]),
            s && (h.push(s[3 * g]),
            h.push(s[3 * g + 1]),
            h.push(s[3 * g + 2])),
            l && (d.push(l[2 * g]),
            d.push(l[2 * g + 1])),
            n[p] = p
        }
        return a = null,
        s = null,
        l = null,
        i.uv2 = o,
        i.position = c,
        i.normal = h,
        i.uv = d,
        i
    }
    ,
    Rf.prototype.createBufferByBufferData = function(A, e) {
        this.cachedComponentGeoBuffer || (this.cachedComponentGeoBuffer = {});
        var t = null
          , i = null
          , o = null
          , n = null
          , r = null
          , a = Qf.EnumNodeItemType
          , s = null;
        switch (1) {
        case a.MESH:
        case a.MESH_REF:
            if (!e || !e.buffer)
                return Bh.debug("缺少几何buffer"),
                null;
            var c = e.buffer;
            if (i = c.index,
            A.geometryId === A.originalGeometryId ? (t = c.position,
            o = c.normal,
            n = c.uv ? c.uv : null,
            r = c.uv2 ? c.uv2 : null) : (t = Float32Array.from(c.position),
            o = Float32Array.from(c.normal),
            n = c.uv ? Float32Array.from(c.uv) : null,
            r = c.uv2 ? Float32Array.from(c.uv2) : null),
            c = null,
            e.indexInfo) {
                i = i.slice(e.indexInfo.indexStart, e.indexInfo.indexStart + e.indexInfo.indexCount),
                t = t.slice(e.indexInfo.positionStart, e.indexInfo.positionStart + e.indexInfo.positionCount),
                o = o.slice(e.indexInfo.positionStart, e.indexInfo.positionStart + e.indexInfo.positionCount),
                n = n ? n.slice(e.indexInfo.uvStart, e.indexInfo.uvStart + e.indexInfo.uvCount) : null,
                r = r ? r.slice(e.indexInfo.uvStart, e.indexInfo.uvStart + e.indexInfo.uvCount) : null;
                var h = e.indexInfo.positionStart / 3;
                i.forEach((function(A, e, t) {
                    t[e] -= h
                }
                ))
            }
            if (uh.isMirror(A.matrix.elements))
                for (var d = 0, p = i.length; p > d; d += 3) {
                    var g = i[d + 1];
                    i[d + 1] = i[d + 2],
                    i[d + 2] = g
                }
            break;
        case a.BOX:
        case a.PIPE:
            s = Tu.UnitCylinderInstance,
            i = Uint32Array.from(s.index.array),
            t = Float32Array.from(s.attributes.position.array),
            o = Float32Array.from(s.attributes.normal.array),
            s = null;
            break;
        case a.TUBE:
        case a.BOX_M:
        case a.PIPE_M:
            s = A.type === a.BOX_M || A.type === a.BOX ? Tu.getBoxMBuffer(A.uvArrayBuffer) : Tu.getPipeMBuffer(A.uvArrayBuffer),
            i = Uint32Array.from(s.index),
            t = Float32Array.from(s.vertex),
            o = Float32Array.from(s.normal),
            s.uv && (n = Float32Array.from(s.uv),
            delete s.uv),
            s = null;
            break;
        case a.LINE:
            if (!e || !e.buffer)
                return null;
            if (e.isDataView ? (i = Uint32Array.from(e.buffer.I),
            t = Float32Array.from(e.buffer.P),
            o = null,
            n = null) : (i = new Uint32Array(e.buffer.I),
            t = new Float32Array(e.buffer.P),
            o = null,
            n = null),
            e.indexInfo) {
                i = i.slice(e.indexInfo.indexStart, e.indexInfo.indexStart + e.indexInfo.indexCount),
                t = t.slice(e.indexInfo.positionStart, e.indexInfo.positionStart + e.indexInfo.positionCount);
                h = e.indexInfo.positionStart / 3;
                i.forEach((function(A, e, t) {
                    t[e] -= h
                }
                ))
            }
            break;
        default:
            Bh.log("error data!")
        }
        if (!this.cachedComponentGeoBuffer[A.geometryId] || A.geometryId !== A.originalGeometryId) {
            var u = A.matrix;
            if (Tu.applyMatrix4ToBuffer(u, t),
            o) {
                var f = new l;
                f.getNormalMatrix(u),
                Tu.applyMatrix3ToBuffer(f, o),
                Tu.normalizeBuffer(o)
            }
            this.cachedComponentGeoBuffer[A.geometryId] = !0
        }
        return A.uv = !!n,
        {
            index: i,
            position: t,
            normal: o,
            uv: n,
            uv2: r
        }
    }
    ;
    var Tf = function(A) {
        return Rf.call(this),
        this.manager = A,
        this._maxIndiceseNum = 0,
        this._materialList = [],
        this.mapMaterialIdToMergedNode = {},
        this.selectedMeshes = [],
        this.nonSelectedMeshes = [],
        this.selectedObjectIds = [],
        this.blinkMaterials = [],
        this.mapDestroyedBufferKey = {},
        this
    };
    function kf(A, e, t, i) {
        for (var o = A.getAttribute("position").array, n = e; t > n; n += 3)
            o[n] += i.x,
            o[n + 1] += i.y,
            o[n + 2] += i.z;
        A.getAttribute("position").needsUpdate = !0
    }
    (Tf.prototype = Object.create(Rf.prototype)).destroy = function() {
        this.dispose(),
        this.clearData(),
        this.mapMaterialIdToMergedNode = {},
        this.manager = null,
        this._materialList = [],
        this.selectedMeshes = [],
        this.nonSelectedMeshes = [],
        this.selectedObjectIds = [],
        this.blinkMaterials = [],
        this.mapDestroyedBufferKey = {}
    }
    ,
    Tf.prototype.clearData = function() {
        this.bufferDestroyed = !1,
        this.clearAllNodeBuffer(),
        this._disposeMergedGeometries()
    }
    ,
    Tf.prototype.getMeshesByUserIds = function(A, e) {
        var t = [];
        for (var i in this.mapMaterialIdToMergedNode)
            for (var o = this.mapMaterialIdToMergedNode[i], n = 0, r = o.length; r > n; n += 1) {
                var a = o[n]
                  , s = a.indices[e];
                if (s)
                    for (var l = 0, c = s.length; c > l; l += 1) {
                        var h = {};
                        h.mesh = a.mesh,
                        h.indexInfo = s[l],
                        h.matrix = A.getModelMatrix(),
                        t.push(h)
                    }
            }
        return t
    }
    ,
    Tf.prototype.rebuildIndices = function(A) {
        this._materialList.length = 0;
        var e = vc.EnableLightmap && A.lightmap;
        this.clearSelectedObjectIds();
        var t = this.manager.getFilteredUserIds()
          , i = this.manager.getSelectedUserIds()
          , o = this.manager.getHoveredUserIds()
          , n = this.manager.getBlinkedUserIds()
          , r = (A.hasReplacedUserId(),
        A.manager.scene.fillClipPlane && vc.ClippingCaps)
          , a = {};
        for (var s in this.mapMaterialIdToMergedNode) {
            var l, c = this.getPropertyValueByMaterialKey(s).materialId, h = null, d = null, p = null, g = null, u = null, f = null, m = null, C = null, y = null;
            i && i[c] && (g = i[c]),
            o && o[c] && (u = o[c]),
            n && n[c] && (f = n[c]),
            t && t[c] && (h = t[c][zc.HIDDEN],
            d = t[c][zc.OVERRIDED],
            p = t[c][zc.TRANSPARENT]);
            var v = this.mapMaterialIdToMergedNode[s];
            for (y = 0,
            l = v.length; l > y; y += 1) {
                var I = v[y]
                  , E = I.indices
                  , B = I.geometry;
                if (B.clearGroups(),
                B._visible = !0,
                e)
                    for (var x = A.lightmapNum, S = 0; x > S; S += 1) {
                        var w = "lightmap|" + S;
                        -1 === this._materialList.indexOf(w) && this._materialList.push(w)
                    }
                if (g || h || d || u || p || vc.EnableLightmap || r || f) {
                    var M = [];
                    for (var b in E)
                        if (E.hasOwnProperty(b)) {
                            if (h && h[b])
                                continue;
                            var U = E[b];
                            if (U && U.length > 0) {
                                if (U.sort((function(A, e) {
                                    return A.indexStart - e.indexStart
                                }
                                )),
                                p && p[b]) {
                                    for (m = 0,
                                    C = U.length; C > m; m += 1)
                                        M.push({
                                            indexStart: U[m].indexStart,
                                            indexCount: U[m].indexCount,
                                            state: zc.TRANSPARENT
                                        });
                                    continue
                                }
                                if (A.manager.isSelectPriority()) {
                                    if (g && g[b]) {
                                        if (this.cacheSelectedObjectIds(b, s, y),
                                        vc.PickingEffect) {
                                            if (d && d[b]) {
                                                var F = d[b]
                                                  , K = this._materialList.indexOf(F);
                                                for (-1 === K && (this._materialList.push(F),
                                                K = this._materialList.length - 1),
                                                m = 0,
                                                C = U.length; C > m; m += 1)
                                                    M.push({
                                                        indexStart: U[m].indexStart,
                                                        indexCount: U[m].indexCount,
                                                        state: zc.OVERRIDED + K
                                                    });
                                                continue
                                            }
                                            for (m = 0,
                                            C = U.length; C > m; m += 1)
                                                M.push({
                                                    indexStart: U[m].indexStart,
                                                    indexCount: U[m].indexCount,
                                                    state: zc.NONE
                                                });
                                            continue
                                        }
                                        for (m = 0,
                                        C = U.length; C > m; m += 1)
                                            M.push({
                                                indexStart: U[m].indexStart,
                                                indexCount: U[m].indexCount,
                                                state: zc.SELECTED
                                            });
                                        continue
                                    }
                                    if (f && f[b]) {
                                        if (d && d[b]) {
                                            var Q = "blink|" + d[b]
                                              , R = this._materialList.indexOf(Q);
                                            for (-1 === R && (this._materialList.push(Q),
                                            R = this._materialList.length - 1),
                                            m = 0,
                                            C = U.length; C > m; m += 1)
                                                M.push({
                                                    indexStart: U[m].indexStart,
                                                    indexCount: U[m].indexCount,
                                                    state: zc.OVERRIDED + R
                                                });
                                            continue
                                        }
                                        for (m = 0,
                                        C = U.length; C > m; m += 1)
                                            M.push({
                                                indexStart: U[m].indexStart,
                                                indexCount: U[m].indexCount,
                                                state: zc.BLINK
                                            });
                                        continue
                                    }
                                } else {
                                    if (f && f[b]) {
                                        if (d && d[b]) {
                                            var T = "blink|" + d[b]
                                              , k = this._materialList.indexOf(T);
                                            for (-1 === k && (this._materialList.push(T),
                                            k = this._materialList.length - 1),
                                            m = 0,
                                            C = U.length; C > m; m += 1)
                                                M.push({
                                                    indexStart: U[m].indexStart,
                                                    indexCount: U[m].indexCount,
                                                    state: zc.OVERRIDED + k
                                                });
                                            continue
                                        }
                                        for (m = 0,
                                        C = U.length; C > m; m += 1)
                                            M.push({
                                                indexStart: U[m].indexStart,
                                                indexCount: U[m].indexCount,
                                                state: zc.BLINK
                                            });
                                        continue
                                    }
                                    if (g && g[b]) {
                                        if (this.cacheSelectedObjectIds(b, s, y),
                                        vc.PickingEffect) {
                                            if (d && d[b]) {
                                                var D = d[b]
                                                  , L = this._materialList.indexOf(D);
                                                for (-1 === L && (this._materialList.push(D),
                                                L = this._materialList.length - 1),
                                                m = 0,
                                                C = U.length; C > m; m += 1)
                                                    M.push({
                                                        indexStart: U[m].indexStart,
                                                        indexCount: U[m].indexCount,
                                                        state: zc.OVERRIDED + L
                                                    });
                                                continue
                                            }
                                            for (m = 0,
                                            C = U.length; C > m; m += 1)
                                                M.push({
                                                    indexStart: U[m].indexStart,
                                                    indexCount: U[m].indexCount,
                                                    state: zc.NONE
                                                });
                                            continue
                                        }
                                        for (m = 0,
                                        C = U.length; C > m; m += 1)
                                            M.push({
                                                indexStart: U[m].indexStart,
                                                indexCount: U[m].indexCount,
                                                state: zc.SELECTED
                                            });
                                        continue
                                    }
                                }
                                if (p && p[b]) {
                                    for (m = 0,
                                    C = U.length; C > m; m += 1)
                                        M.push({
                                            indexStart: U[m].indexStart,
                                            indexCount: U[m].indexCount,
                                            state: zc.TRANSPARENT
                                        });
                                    continue
                                }
                                if (u && u[b]) {
                                    if (d && d[b]) {
                                        var N = this._materialList.indexOf(O = "hover|" + d[b]);
                                        for (-1 === N && (this._materialList.push(O),
                                        N = this._materialList.length - 1),
                                        m = 0,
                                        C = U.length; C > m; m += 1)
                                            M.push({
                                                indexStart: U[m].indexStart,
                                                indexCount: U[m].indexCount,
                                                state: zc.OVERRIDED + N
                                            });
                                        continue
                                    }
                                    for (m = 0,
                                    C = U.length; C > m; m += 1)
                                        M.push({
                                            indexStart: U[m].indexStart,
                                            indexCount: U[m].indexCount,
                                            state: zc.HOVER
                                        });
                                    continue
                                }
                                if (d && d[b]) {
                                    var O, V = this._materialList.indexOf(O = d[b]);
                                    for (-1 === V && (this._materialList.push(O),
                                    V = this._materialList.length - 1),
                                    m = 0,
                                    C = U.length; C > m; m += 1)
                                        M.push({
                                            indexStart: U[m].indexStart,
                                            indexCount: U[m].indexCount,
                                            state: zc.OVERRIDED + V
                                        });
                                    continue
                                }
                                if (r && a[b]) {
                                    for (m = 0,
                                    C = U.length; C > m; m += 1)
                                        M.push({
                                            indexStart: U[m].indexStart,
                                            indexCount: U[m].indexCount,
                                            state: zc.CLIPPING
                                        });
                                    continue
                                }
                                if (vc.EnableLightmap)
                                    for (m = 0,
                                    C = U.length; C > m; m += 1) {
                                        var G = this._materialList.indexOf("lightmap|" + U[m].lightmapIdx);
                                        M.push({
                                            indexStart: U[m].indexStart,
                                            indexCount: U[m].indexCount,
                                            state: zc.OVERRIDED + G
                                        })
                                    }
                                else
                                    for (m = 0,
                                    C = U.length; C > m; m += 1)
                                        M.push({
                                            indexStart: U[m].indexStart,
                                            indexCount: U[m].indexCount,
                                            state: 0
                                        })
                            }
                        }
                    if (M.length > 0)
                        for (M.sort((function(A, e) {
                            return A.state === e.state ? A.indexStart - e.indexStart : A.state - e.state
                        }
                        )),
                        m = 0,
                        C = M.length; C > m; m += 1) {
                            var P = M[m].indexStart
                              , q = M[m].indexCount
                              , j = M[m].state;
                            if (0 === m)
                                B.addGroup(P, q, j);
                            else
                                j === M[m - 1].state && P === M[m - 1].indexStart + M[m - 1].indexCount ? B.groups[B.groups.length - 1].count += q : B.addGroup(P, q, j)
                        }
                    else
                        B._visible = !1
                }
            }
        }
    }
    ,
    Tf.prototype.update = function(A, e) {
        var t = A.manager.filter
          , i = A.materialManager.materials
          , o = A.selectedMaterial
          , n = A.manager.sceneState
          , r = null
          , a = null
          , s = null
          , l = null
          , c = null
          , h = null
          , d = vc.EnableLightmap && A.lightmap;
        if (A.isOnlyWireframe())
            for (var p in this.mapMaterialIdToMergedNode) {
                var g = this.mapMaterialIdToMergedNode[p];
                for (s = 0,
                l = g.length; l > s; s += 1) {
                    var u = g[s].mesh;
                    u && (u.visible = !1)
                }
            }
        else {
            vc.TranslucentDepthDisabled && (o.depthWrite = !o.transparent);
            var f = t._getMaterialByName("scene");
            vc.TranslucentDepthDisabled && (f.depthWrite = !1);
            var m = [];
            this.blinkMaterials.length = 0;
            var C = {};
            if (!d)
                for (r = 0,
                a = this._materialList.length; a > r; r += 1) {
                    var y = null
                      , v = this._materialList[r]
                      , I = v.split("|");
                    "hover" === I[0] ? (y = t._getMaterialByName(I[1]),
                    y = n.getHoverMaterial(y)) : "blink" === I[0] ? (y = t._getMaterialByName(I[1]),
                    y = n.getBlinkMaterial(y),
                    C[v] || this.blinkMaterials.push(y)) : y = t._getMaterialByName(v) ? t._getMaterialByName(v) : this.manager.model.materialManager.getMaterialById(v),
                    vc.TranslucentDepthDisabled && (y.depthWrite = !y.transparent),
                    m[r] = y
                }
            for (var E in this.mapMaterialIdToMergedNode) {
                var B = this.getPropertyValueByMaterialKey(E).materialId
                  , x = A.manager.getOverrideMaterialByName(B) || i[B] || Kd.getDefaultStandardMaterial();
                if (x) {
                    if (d)
                        for (r = 0,
                        a = this._materialList.length; a > r; r += 1) {
                            var S = null
                              , w = this._materialList[r].split("|");
                            if ("lightmap" === w[0])
                                if (vc.IBL)
                                    S = x.clone();
                                else {
                                    var M = Kd.getMaterialParameters(x);
                                    M.lights = !1,
                                    (S = Kd.createStandardMaterial(M)).lightMap = A.materialManager.lightmaps[w[1]],
                                    S.lightMapIntensity = vc.LightmapIntensity
                                }
                            vc.TranslucentDepthDisabled && S && (S.depthWrite = !S.transparent),
                            m[r] = S
                        }
                    vc.TranslucentDepthDisabled && (x.depthWrite = !x.transparent);
                    var b = n.getHoverMaterial(i[B]);
                    vc.TranslucentDepthDisabled && (b.depthWrite = !b.transparent);
                    var U = this.mapMaterialIdToMergedNode[E];
                    for (s = 0,
                    l = U.length; l > s; s += 1) {
                        var F = U[s]
                          , K = F.geometry;
                        if (null !== K) {
                            var Q = F.mesh;
                            if (Q)
                                if (K._visible) {
                                    if (K.groups.length > 0) {
                                        var R = C[B];
                                        R || (R = C[B] = n.getBlinkMaterial(x),
                                        this.blinkMaterials.push(R));
                                        var T = [x, o, R, b, f];
                                        for (r = 0,
                                        a = m.length; a > r; r += 1) {
                                            if (!m[r].createByBos) {
                                                if (m[r].materialId !== B && !m[r].mapNodeIdToOrigMatId)
                                                    continue;
                                                if (!Object.keys(m[r].mapNodeIdToOrigMatId).find((function(A) {
                                                    return m[r].mapNodeIdToOrigMatId[A] === B
                                                }
                                                )))
                                                    continue
                                            }
                                            for (var k in K.attributes.uv || (m[r].map = null),
                                            U[s].indices)
                                                if (this.manager.mapMaterialIdToUserIdsForFilter[B] && this.manager.mapMaterialIdToUserIdsForFilter[B][zc.OVERRIDED])
                                                    for (var D = Object.keys(this.manager.mapMaterialIdToUserIdsForFilter[B][zc.OVERRIDED]), L = 0, N = D.length; N > L; L += 1)
                                                        k === D[L] && (T[5 + r] = m[r])
                                        }
                                        if (e) {
                                            var O = [];
                                            for (c = 0,
                                            h = T.length; h > c; c += 1)
                                                O.push(e);
                                            T = O
                                        }
                                        Q.material = T
                                    } else
                                        Q.material = e || x;
                                    Q.visible = !0
                                } else
                                    Q.visible = !1;
                            else
                                Bh.error("没有mesh对象")
                        }
                    }
                    x = null
                }
            }
        }
    }
    ,
    Tf.prototype.explode = function(A, e, t) {
        for (var i in this.mapMaterialIdToMergedNode)
            for (var o = this.mapMaterialIdToMergedNode[i], n = 0, r = o.length; r > n; n += 1) {
                var a = o[n]
                  , s = a.geometry;
                if (null !== s) {
                    var l = a.indices;
                    for (var c in l) {
                        var h = A.manager.getComponentInfoByUserId(c).boundingBox
                          , d = uh.computeExplodeTranslation(e, h, t)
                          , p = l[c];
                        if (p)
                            for (var g = 0, u = p.length; u > g; g += 1) {
                                var f = p[g].positionStart;
                                kf(s, f, f + p[g].positionCount, d)
                            }
                    }
                }
            }
    }
    ,
    Tf.prototype.explosion = function(A, e) {
        var t = A.getModelDescriptor().getStandardUserIds();
        e.componentKey = t,
        this.componentsExplosion(A, e)
    }
    ,
    Tf.prototype.closeExplosion = function(A) {
        this.explosion(A, {})
    }
    ,
    Tf.prototype.componentsExplosion = function(A, e) {
        var t = e.coefficientX || 1
          , i = e.coefficientY || 1
          , o = e.coefficientZ || 1
          , n = e.offsetX || 0
          , r = e.offsetY || 0
          , a = e.offsetZ || 0
          , s = null;
        if (e.center)
            s = (new y).fromArray(e.center);
        else if (1 !== t || 1 !== i || 1 !== o || 0 !== n || 0 !== r || 0 !== a)
            return;
        var l = Array.isArray(e.componentKey) ? e.componentKey : [e.componentKey]
          , c = new y
          , h = new aA
          , d = new y(0,0,0)
          , p = new y(0,0,0)
          , g = new y
          , u = new M
          , m = A.getModelMatrix();
        m && s && (u.getInverse(m),
        s.applyMatrix4(u));
        var C = A.manager
          , v = !1
          , I = new y
          , E = new f
          , B = new y(1,1,1);
        uh.isEmptyObject(A.subModel) || (v = !0);
        for (var x = 0, S = l.length; S > x; x += 1) {
            var w = l[x];
            if (w) {
                var b = A.getModelDescriptor().getStandardNodeInfosById(w);
                if (b)
                    for (var U = 0, F = b.length; F > U; U += 1) {
                        var K = b[U];
                        if (K) {
                            var Q = this._getMaterialKeyByNodeInfo(K)
                              , R = this.mapMaterialIdToMergedNode[Q];
                            if (R)
                                for (var T = 0, k = R.length; k > T; T += 1) {
                                    var D = R[T]
                                      , L = D.geometry
                                      , N = D.mesh;
                                    if (L && N) {
                                        var O = D.indices;
                                        if (O) {
                                            var V = O[w];
                                            if (V) {
                                                h.copy(K.boundingBox),
                                                h.getCenter(c),
                                                K.userData || (K.userData = {}),
                                                d.set(0, 0, 0),
                                                p.set(0, 0, 0);
                                                var G = new y(1,1,1);
                                                if (v && (N.matrix.decompose(I, E, B),
                                                G.divide(B)),
                                                1 !== t || 1 !== i || 1 !== o || K.userData.explosionFactor) {
                                                    K.userData.explosionFactor || (K.userData.explosionFactor = new y(1,1,1),
                                                    K.userData.explosionBaseDifference = c.sub(s).clone().multiply(G));
                                                    var P = K.userData.explosionFactor
                                                      , q = K.userData.explosionBaseDifference;
                                                    d.set((t - P.x) * q.x, (i - P.y) * q.y, (o - P.z) * q.z),
                                                    1 === t && 1 === i && 1 === o ? (K.userData.explosionFactor = void 0,
                                                    K.userData.explosionBaseDifference = void 0) : P.set(t, i, o)
                                                }
                                                if (0 !== n || 0 !== r || 0 !== a || K.userData.explosionOffset) {
                                                    K.userData.explosionOffset || (K.userData.explosionOffset = new y(0,0,0));
                                                    var j = K.userData.explosionOffset;
                                                    p.set(n * G.x - j.x, r * G.y - j.y, a * G.z - j.z),
                                                    0 === n && 0 === r && 0 === a ? K.userData.explosionOffset = void 0 : j.set(n * G.x, r * G.y, a * G.z)
                                                }
                                                if (g.set(d.x + p.x, d.y + p.y, d.z + p.z),
                                                0 !== g.x || 0 !== g.y || 0 !== g.z) {
                                                    K.userData.explosionFactor || K.userData.explosionOffset ? C.explosionList[w] || (C.explosionList[w] = !0) : delete C.explosionList[w];
                                                    var H = g.clone().multiply(B);
                                                    u.makeTranslation(H.x, H.y, H.z),
                                                    K.userData.changeOffset = g.clone(),
                                                    K.transformation || (K.transformation = !0,
                                                    K.transformationOriginalMatrix = K.matrix.clone(),
                                                    K.applyMatrix = new M,
                                                    K.transformationOriginalBoundingBox = K.boundingBox.clone()),
                                                    K.matrix.premultiply(u),
                                                    K.applyMatrix.premultiply(u),
                                                    K.boundingBox.copy(K.transformationOriginalBoundingBox).applyMatrix4(K.applyMatrix);
                                                    for (var Y = 0, W = V.length; W > Y; Y += 1) {
                                                        var J = V[Y].positionStart;
                                                        kf(L, J, J + V[Y].positionCount, g)
                                                    }
                                                    L.attributes.position.needsUpdate = !0
                                                }
                                            }
                                        }
                                    }
                                }
                        }
                    }
            }
        }
    }
    ,
    Tf.prototype.closeComponentsExplosion = function(A, e) {
        e = Array.isArray(e) ? e : [e];
        this.componentsExplosion(A, {
            componentKey: e
        })
    }
    ,
    Tf.prototype._getNodeGroup = function(A) {
        return A._getNodeGroup(gp.GEOMETRY, {
            globalSpace: !0
        })
    }
    ,
    Tf.prototype._hasNodeGroup = function(A) {
        return A._hasNodeGroup(gp.GEOMETRY)
    }
    ,
    Tf.prototype._resetMaxIndicesNumberPerBathSegment = function(A) {
        vc.SegmentedBatchMergeEnable && this._maxIndiceseNum > vc.maxIndicesNumberPerBathSegment && (Bh.log("adjust maxIndicesNumberPerBathSegment value from " + vc.maxIndicesNumberPerBathSegment + " to " + this._maxIndiceseNum + "!"),
        vc.maxIndicesNumberPerBathSegment = A)
    }
    ,
    Tf.prototype.asyncCreateMeshNodes = function(A, e, t) {
        var i = this;
        e && e.length ? this._asyncMergeData(A, e, (function() {
            Bh.timeEnd("MergeData"),
            i._makeMeshNodes(A),
            t && t()
        }
        )) : t && t()
    }
    ,
    Tf.prototype.createBatchedMeshNodes = function(A, e) {
        var t = this.mapMaterialIdToMergedNode
          , i = A.manager
          , o = A.modelKey
          , n = A._encodedDatabagId
          , r = this._getNodeGroup(A)
          , a = A.materialManager
          , s = e.materialKey
          , l = this.getPropertyValueByMaterialKey(s)
          , c = a.getMaterialById(l.materialId);
        if (!c) {
            var h = Object.keys(e.componentInfo)[0]
              , d = e.componentInfo[h][0].nodeId
              , p = A.getModelDescriptor().getNodeInfosByNodeId(d);
            if (!p)
                return;
            p.uv = "1" === l.uvProp,
            s = this._getMaterialKeyByNodeInfo(p, A),
            l = this.getPropertyValueByMaterialKey(s),
            c = a.getMaterialById(l.materialId)
        }
        var g = new he;
        if (g._visible = !0,
        g.setIndex(new YA(e.index,1)),
        e.position && e.position.length > 0) {
            g.setAttribute("position", new YA(e.position,3)),
            e.normal && e.normal.length === e.position.length && g.setAttribute("normal", new YA(e.normal,3));
            var u = !1;
            e.uv && e.uv.length > 0 > 0 && (g.setAttribute("uv", new YA(e.uv,2)),
            u = !0),
            c.aoMap && g.setAttribute("uv2", new YA(e.uv,2)),
            g.getAttribute("normal") || g.computeVertexNormals();
            var f = e.componentInfo;
            t[s] || (t[s] = []);
            var m = null;
            if ("lines" === l.type)
                (m = new cf(g)).modelKey = o;
            else {
                var C = {
                    modelKey: o
                };
                (m = new Kf(g,c)).spawn(C)
            }
            if (t[s].push({
                geometry: g,
                indices: f,
                mesh: m
            }),
            m._indicesGroup = f,
            !uh.isEmptyObject(A.subModel)) {
                var y = Object.keys(f)[0];
                if (y) {
                    var v = uh.getModelKeyFromComponentKey(y);
                    A.subModel[v] && m.matrix.copy(A.subModel[v])
                }
            }
            r.add(m),
            i.addMeshToOctantMap(n, s, new Eu(s,m));
            var I = function(e) {
                f.hasOwnProperty(e) && f[e].forEach((function(t) {
                    A.addMeshToInfoMap(e, t.nodeId, m, t, u)
                }
                ))
            };
            for (var E in f)
                I(E);
            r.updateMatrixWorld(!0),
            f = null,
            m = null
        }
    }
    ,
    Tf.prototype._asyncMergeData = function(A, e, t) {
        Bh.time("MergeData");
        var i = {}
          , o = this
          , n = A.getLoader().maxLoadTaskCount
          , r = A.progressPercentage.load
          , a = A.progressPercentage.collect
          , s = e.length
          , l = Math.ceil(s / A.progressFrequency)
          , c = A.getModelDescriptor().getStandardNodeInfos();
        requestAnimationFrame(function h(d) {
            var p = d;
            return function() {
                var d = null
                  , g = null;
                for (g = p + l > s ? s : p + l,
                d = p; g > d; d += 1) {
                    if (o._collectMergedNodeInfosById(A, e[d], c, i),
                    d === g - 1)
                        if (g !== s)
                            A.dispatchEventEx({
                                type: Rc.ON_LOAD_PROGRESS,
                                progress: {
                                    total: n,
                                    loaded: (d / s * a + r) * n,
                                    modelKey: A.modelKey
                                }
                            }),
                            requestAnimationFrame(h(d + 1));
                        else
                            A.dispatchEventEx({
                                type: Rc.ON_LOAD_PROGRESS,
                                progress: {
                                    total: n,
                                    loaded: (a + r) * n,
                                    modelKey: A.modelKey
                                }
                            }),
                            o._asyncMergeGeometry(i, A, t)
                }
            }
        }(0))
    }
    ,
    Tf.prototype._asyncMergeGeometry = function(A, e, t) {
        var i = [];
        for (var o in A)
            i.push(o);
        if (0 !== i.length) {
            this._resetMaxIndicesNumberPerBathSegment(this._maxIndiceseNum);
            var n = this
              , r = e.getLoader().maxLoadTaskCount
              , a = e.progressPercentage.load
              , s = e.progressPercentage.collect
              , l = e.progressPercentage.merge
              , c = i.length
              , h = Math.ceil(c / e.progressFrequency)
              , d = this.mapMaterialIdToMergedNode;
            requestAnimationFrame(function o(p) {
                var g = p;
                return function() {
                    var p, u = null;
                    for (u = g + h > c ? c : g + h,
                    p = g; u > p; p += 1) {
                        if (n._collectMergedGeometriesById(i[p], A, d),
                        p === u - 1)
                            if (u !== i.length)
                                e.dispatchEventEx({
                                    type: Rc.ON_LOAD_PROGRESS,
                                    progress: {
                                        total: r,
                                        loaded: (p / c * l + a + s) * r,
                                        modelKey: e.modelKey
                                    },
                                    modelKey: e.modelKey
                                }),
                                requestAnimationFrame(o(p + 1));
                            else
                                t()
                    }
                }
            }(0))
        } else
            t()
    }
    ,
    Tf.prototype._collectMergedNodeInfosById = function(A, e, t, i) {
        for (var o = t[e], n = 0, r = o.length; r > n; n += 1) {
            var a = o[n];
            this._createNodeBuffer(A, a);
            var s = this._getNodeBufferBy(a.nodeId);
            if (s) {
                var l = s.index;
                l && l.length > this._maxIndiceseNum && (this._maxIndiceseNum = l.length);
                var c = this._getMaterialKeyByNodeInfo(a, A);
                void 0 === i[c] && (i[c] = []),
                i[c].push(a)
            }
        }
    }
    ,
    Tf.prototype._collectMergedGeometriesById = function(A, e, t) {
        var i = e[A];
        void 0 === t[A] && (t[A] = []);
        for (var o = [], n = Math.max(i.length / 800, 500), r = Math.floor(i.length / n), a = i.length, s = 0; r >= s; s += 1) {
            for (var l = 0, c = 0, h = 0, d = 0, p = 0, g = null, u = !1, f = 0, m = 0, C = a > n ? n : a; C > m; m += 1) {
                var y = s * n
                  , v = i[y + m];
                if (!v)
                    break;
                (g = this._getNodeBufferBy(v.nodeId)) ? (c += g.index.length,
                l += g.position.length,
                g.normal && (h += g.normal.length),
                g.uv && g.uv.length > 0 ? (u = !0,
                d += g.uv.length) : d += g.position.length / 3 * 2,
                g.uv2 && (p += g.uv2.length),
                vc.SegmentedBatchMergeEnable && c > vc.maxIndicesNumberPerBathSegment ? (g.normal && (h -= g.normal.length),
                g.uv && (d -= g.uv.length),
                g.uv2 && (p -= g.uv2.length),
                o.push({
                    start: f,
                    end: m,
                    steps: y,
                    arrayPositionLength: l -= g.position.length,
                    arrayIndexLength: c -= g.index.length,
                    arrayNormalLength: h,
                    arrayUVLength: d,
                    arrayUV2Length: p
                }),
                l = 0,
                c = 0,
                h = 0,
                d = 0,
                p = 0,
                f = m,
                m -= 1) : m === C - 1 && o.push({
                    start: f,
                    end: C,
                    steps: y,
                    arrayPositionLength: l,
                    arrayIndexLength: c,
                    arrayNormalLength: h,
                    arrayUVLength: d,
                    arrayUV2Length: p
                }),
                g = null) : m === C - 1 && o.push({
                    start: f,
                    end: C,
                    steps: y,
                    arrayPositionLength: l,
                    arrayIndexLength: c,
                    arrayNormalLength: h,
                    arrayUVLength: d,
                    arrayUV2Length: p
                })
            }
            a -= n
        }
        for (var I = 0, E = o.length; E > I; I += 1) {
            for (var B = o[I], x = new he, S = {}, w = new Float32Array(B.arrayPositionLength), M = new Uint32Array(B.arrayIndexLength), b = new Float32Array(B.arrayNormalLength), U = new Float32Array(B.arrayUVLength), F = new Float32Array(B.arrayUV2Length), K = 0, Q = 0, R = 0, T = 0, k = 0, D = [], L = B.start, N = B.end; N > L; L += 1) {
                var O = i[B.steps + L];
                if (g = this._getNodeBufferBy(O.nodeId)) {
                    D.push(O.nodeId);
                    var V = g.index
                      , G = g.position
                      , P = g.normal
                      , q = g.uv
                      , j = g.uv2;
                    w.set(G, K);
                    for (var H = new Uint32Array(V), Y = 0, W = H.length; W > Y; Y += 1)
                        H[Y] += K / 3;
                    M.set(H, Q),
                    void 0 === S[O.userId] && (S[O.userId] = []),
                    S[O.userId].push({
                        userId: O.userId,
                        nodeId: O.nodeId,
                        positionStart: K,
                        positionCount: G.length,
                        indexStart: Q,
                        indexCount: V.length,
                        lightmapIdx: O.lightmapIdx,
                        boundingBox: O.boundingBox
                    }),
                    Q += V.length,
                    K += G.length,
                    P && (b.set(P, R),
                    R += P.length),
                    u && (q ? (U.set(q, T),
                    T += q.length) : (U.set(new Float32Array(G.length / 3 * 2), T),
                    T += q.length)),
                    j && (F.set(j, k),
                    k += j.length),
                    V = null,
                    G = null,
                    P = null,
                    q = null,
                    j = null,
                    g = null
                }
            }
            this.clearNodeBufferByNodeIds(D),
            x._visible = !0,
            x.setIndex(new YA(M,1)),
            x.setAttribute("position", new YA(w,3)),
            R > 0 && x.setAttribute("normal", new YA(b,3)),
            T > 0 && x.setAttribute("uv", new YA(U,2)),
            k > 0 && x.setAttribute("uv2", new YA(F,2)),
            t[A].push({
                geometry: x,
                indices: S
            })
        }
    }
    ,
    Tf.prototype.clearAllNodeBuffer = function() {
        this.cachedNodeBuffer && (this.cachedNodeBuffer = {})
    }
    ,
    Tf.prototype.clearNodeBufferByNodeIds = function(A) {
        if (this.cachedNodeBuffer)
            for (var e = 0, t = A.length; t > e; e += 1)
                this.cachedNodeBuffer[A[e]] = null
    }
    ,
    Tf.prototype._getNodeBufferByNodeInfo = function(A, e) {
        return this.cachedNodeBuffer || this._createNodeBuffer(A, e),
        this.cachedNodeBuffer[e.nodeId]
    }
    ,
    Tf.prototype._getNodeBufferBy = function(A) {
        return this.cachedNodeBuffer ? this.cachedNodeBuffer[A] : null
    }
    ,
    Tf.prototype._createNodeBufferForMergedBuffer = function(A, e, t) {
        this.cachedNodeBuffer || (this.cachedNodeBuffer = {}),
        this.cachedNodeBuffer[e.nodeId] || (this.cachedNodeBuffer[e.nodeId] = this.createBufferByBufferDataWithUV2(A, e, t))
    }
    ,
    Tf.prototype._createNodeBuffer = function(A, e) {
        this._createNodeBufferForMergedBuffer(A, e, {
            buffer: A.getModelDescriptor().getReferencedMeshBufferById(e.geometryId),
            isDataView: !0
        })
    }
    ,
    Tf.prototype._createGeometries = function(A, e) {
        var t = this
          , i = A.getModelDescriptor().getNodeInfosOnGeometryId()
          , o = A.getModelDescriptor().getReferencedMeshBufferData()
          , n = this._getClassifiedMeshes(i, o);
        this._dealDataMergedMeshs(A, n, o, i, (function() {
            t._dealDataMergeableMeshs(A, n, o, i, e)
        }
        ))
    }
    ,
    Tf.prototype._getClassifiedMeshes = function(A, e) {
        var t = []
          , i = [];
        for (var o in e) {
            var n = e[o].IndexInfos
              , r = void 0;
            if (n) {
                if (1 > n.length)
                    continue;
                for (var a = 0, s = n.length; s > a; a += 1) {
                    if ((l = A[n[a].meshId]) && l.length) {
                        r = n[a].meshId;
                        break
                    }
                }
            } else {
                var l;
                (l = A[o]) && l.length && (r = o)
            }
            if (void 0 !== r)
                (l = A[r]) && l.length && (l[0].type === $u.EnumNodeItemType.LINE || !l[0].instanceOrNot && l[0].shared ? t.push(o) : i.push(o))
        }
        if (!vc.Instance)
            for (var o in A)
                i[o] || t[o] || t.push(o);
        return {
            mergeableIdxs: t,
            mergedIdxs: i
        }
    }
    ,
    Tf.prototype._collectMergeableMeshesByIdxId = function(A, e, t, i, o) {
        t[e] && t[e].IndexInfos ? this._collectSharedMeshesByIdxId(A, e, t, i, o) : this._collectLineOrIntanceMeshesByIdxId(A, e, t, i, o)
    }
    ,
    Tf.prototype._collectLineOrIntanceMeshesByIdxId = function(A, e, t, i, o) {
        for (var n = i[e], r = {
            buffer: A.getModelDescriptor().getReferencedMeshBufferById(e)
        }, a = 0, s = n.length; s > a; a += 1) {
            var l = n[a];
            this._createNodeBufferByGeoBufferData(A, l, r);
            var c = this._getMaterialKeyByNodeInfo(l);
            o[c] || (o[c] = []),
            o[c].push(l)
        }
    }
    ,
    Tf.prototype._collectSharedMeshesByIdxId = function(A, e, t, i, o) {
        for (var n = t[e].IndexInfos, r = 0, a = n.length; a > r; r += 1) {
            var s = i[n[r].meshId];
            if (s)
                for (var l = {
                    buffer: A.getModelDescriptor().getReferencedMeshBufferById(e),
                    indexInfo: n[r]
                }, c = 0, h = s.length; h > c; c += 1) {
                    var d = s[c];
                    this._createNodeBufferByGeoBufferData(A, d, l);
                    var p = this._getMaterialKeyByNodeInfo(d);
                    o[p] || (o[p] = []),
                    o[p].push(d)
                }
        }
    }
    ,
    Tf.prototype._mergeMergeableMeshes = function(A, e, t, i) {
        var o = Object.keys(e);
        if (0 !== o.length) {
            var n = this
              , r = A.getLoader().maxLoadTaskCount
              , a = o.length
              , s = A.progressPercentage.load
              , l = A.progressPercentage.collect
              , c = A.progressPercentage.merge
              , h = Math.ceil(a / A.progressFrequency);
            requestAnimationFrame(function d(p) {
                var g = p;
                return function() {
                    var p = null
                      , u = null;
                    for (u = g + h > a ? a : g + h,
                    p = g; u > p; p += 1)
                        n._collectMergedGeometriesById(o[p], e, t),
                        p === u - 1 && (u !== a ? (A.dispatchEvent({
                            type: Rc.ON_LOAD_PROGRESS,
                            progress: {
                                total: r,
                                loaded: (p / a * c + s + l) * r,
                                modelKey: A.modelKey
                            }
                        }),
                        requestAnimationFrame(d(p + 1))) : n._makeMeshNodes(A, i))
                }
            }(0))
        } else
            this._makeMeshNodes(A, i)
    }
    ,
    Tf.prototype._dealDataMergeableMeshs = function(A, e, t, i, o) {
        if (0 !== e.mergeableIdxs.length) {
            var n = this
              , r = this.mapMaterialIdToMergedNode
              , a = {}
              , s = e.mergedIdxs.length
              , l = e.mergeableIdxs.length
              , c = s + l
              , h = e.mergeableIdxs
              , d = A.getLoader().maxLoadTaskCount
              , p = A.progressPercentage.load
              , g = A.progressPercentage.collect
              , u = Math.ceil(l / A.progressFrequency);
            requestAnimationFrame(function e(f) {
                var m = f;
                return function() {
                    var f = null
                      , C = null;
                    for (C = m + u > l ? l : m + u,
                    f = m; C > f; f += 1)
                        n._collectMergeableMeshesByIdxId(A, h[f], t, i, a),
                        f === C - 1 && (C !== l ? (A.dispatchEvent({
                            type: Rc.ON_LOAD_PROGRESS,
                            progress: {
                                total: d,
                                loaded: ((f + s) / c * g + p) * d,
                                modelKey: A.modelKey
                            }
                        }),
                        requestAnimationFrame(e(f + 1))) : (A.dispatchEvent({
                            type: Rc.ON_LOAD_PROGRESS,
                            progress: {
                                total: d,
                                loaded: (g + p) * d,
                                modelKey: A.modelKey
                            }
                        }),
                        n._mergeMergeableMeshes(A, a, r, o)))
                }
            }(0))
        } else
            this._makeMeshNodes(A, o)
    }
    ,
    Tf.prototype._collectDataMergedMeshesByIdxId = function(A, e, t, i, o) {
        var n = e[A]
          , r = n.IndexInfos;
        if (r && 0 !== r.length) {
            var a = !1;
            n.UV && (n.UV.byteLength || n.UV.length) && (a = !0),
            o.lightmap && (n = this.getAttributeForLightmapWithDataMerged(n, o, A));
            for (var s = void 0, l = 0, c = r.length; c > l; l += 1) {
                var h = t[r[l].meshId];
                if (h && 0 !== h.length) {
                    o.lightmap && (r[l].lightmapIdx = n.lightmapIdx,
                    r[l].positionStart = 3 * r[l].indexStart,
                    r[l].positionCount = 3 * r[l].indexCount),
                    s = r[l].meshId;
                    for (var d = 0, p = h.length; p > d; d += 1)
                        h[d].uv = a
                }
            }
            if (void 0 !== s) {
                var g = t[s][0]
                  , u = {}
                  , f = this._getMaterialKeyByNodeInfo(g);
                void 0 === i[f] && (i[f] = []);
                for (var m = 0, C = r.length; C > m; m += 1)
                    t[r[m].meshId] && (void 0 === u[(g = t[r[m].meshId][0]).userId] && (u[g.userId] = []),
                    r[m].userId = g.userId,
                    r[m].nodeId = g.nodeId,
                    r[m].boundingBox = g.boundingBox,
                    u[g.name].push(r[m]));
                var y = new he;
                y._visible = !0,
                y.setIndex(new YA(new Uint32Array(n.I),1)),
                y.setAttribute("position", new YA(new Float32Array(n.P),3)),
                n.N && (n.N.byteLength || n.N.length) && y.setAttribute("normal", new YA(new Float32Array(n.N),3)),
                a && y.setAttribute("uv", new YA(new Float32Array(n.UV),2)),
                n.UV2 && (y.setAttribute("uv2", new YA(new Float32Array(n.UV2),2)),
                y.lightmapIdx = n.lightmapIdx),
                i[f].push({
                    geometry: y,
                    indices: u
                })
            }
        }
    }
    ,
    Tf.prototype.getAttributeForLightmapWithDataMerged = function(A, e, t) {
        var i = []
          , o = new Uint32Array(A.I)
          , n = e.getLoader().getUV2ById("bmpk_" + t, o.length);
        if (n) {
            var r = n.lightmapIdx;
            i = n.uv2
        }
        for (var a = new Float32Array(A.P), s = new Float32Array(A.N), l = new Float32Array(A.UV), c = [], h = [], d = [], p = 0; o.length > p; p += 1) {
            var g = o[p];
            c.push(a[3 * g]),
            c.push(a[3 * g + 1]),
            c.push(a[3 * g + 2]),
            s.length > 0 && (h.push(s[3 * g]),
            h.push(s[3 * g + 1]),
            h.push(s[3 * g + 2])),
            l.length > 0 && (d.push(l[2 * g]),
            d.push(l[2 * g + 1])),
            o[p] = p
        }
        return a = null,
        s = null,
        l = null,
        {
            I: o,
            UV2: i,
            P: c,
            N: h,
            UV: d,
            lightmapIdx: r
        }
    }
    ,
    Tf.prototype._dealDataMergedMeshs = function(A, e, t, i, o) {
        if (0 !== e.mergedIdxs.length) {
            var n = this
              , r = this.mapMaterialIdToMergedNode
              , a = e.mergedIdxs
              , s = a.length
              , l = e.mergedIdxs.length + e.mergeableIdxs.length
              , c = A.getLoader().maxLoadTaskCount
              , h = A.progressPercentage.load
              , d = A.progressPercentage.collect
              , p = Math.ceil(s / A.progressFrequency);
            requestAnimationFrame(function e(g) {
                var u = g;
                return function() {
                    var g = null
                      , f = null;
                    for (f = u + p > s ? s : u + p,
                    g = u; f > g; g += 1)
                        n._collectDataMergedMeshesByIdxId(a[g], t, i, r),
                        g === f - 1 && (f !== s ? (A.dispatchEvent({
                            type: Rc.ON_LOAD_PROGRESS,
                            progress: {
                                total: c,
                                loaded: (g / l * d + h) * c,
                                modelKey: A.modelKey
                            }
                        }),
                        requestAnimationFrame(e(g + 1))) : (A.dispatchEvent({
                            type: Rc.ON_LOAD_PROGRESS,
                            progress: {
                                total: c,
                                loaded: (g / l * d + h) * c,
                                modelKey: A.modelKey
                            }
                        }),
                        o && o()))
                }
            }(0))
        } else
            o && o()
    }
    ,
    Tf.prototype._dealUnsharedMeshs = function(A, e, t) {
        for (var i = this.mapMaterialIdToMergedNode, o = 0, n = A.length; n > o; o += 1) {
            var r = t[A[o]]
              , a = r.IndexInfos
              , s = e[a[0].meshId][0]
              , l = {}
              , c = this._getMaterialKeyByNodeInfo(s);
            void 0 === i[c] && (i[c] = []);
            for (var h = 0, d = a.length; d > h; h += 1)
                void 0 === l[(s = e[a[h].meshId][0]).userId] && (l[s.userId] = []),
                a[h].userId = s.userId,
                a[h].nodeId = s.nodeId,
                l[s.userId].push(a[h]);
            var p = new he;
            p._visible = !0,
            p.setIndex(new YA(new Uint32Array(r.index),1)),
            p.setAttribute("position", new YA(new Float32Array(r.position),3)),
            r.normal && p.setAttribute("normal", new YA(new Float32Array(r.normal),3)),
            r.uv && p.setAttribute("uv", new YA(new Float32Array(r.uv),2)),
            i[c].push({
                geometry: p,
                indices: l
            })
        }
    }
    ,
    Tf.prototype._makeMeshNodes = function(A, e) {
        Bh.time("makeMesh");
        var t = A.manager
          , i = A.modelKey
          , o = A._encodedDatabagId
          , n = this._getNodeGroup(A)
          , r = this.mapMaterialIdToMergedNode;
        for (var a in r)
            for (var s = this.getPropertyValueByMaterialKey(a), l = r[a], c = 0, h = l.length; h > c; c += 1) {
                var d = l[c].geometry
                  , p = l[c].indices;
                if (!l[c].mesh) {
                    var g = null;
                    if ("lines" === s.type)
                        (g = new cf(d)).modelKey = i;
                    else {
                        var u = {
                            modelKey: i
                        };
                        (g = new Kf(d)).spawn(u)
                    }
                    if (!uh.isEmptyObject(A.subModel)) {
                        var f = Object.keys(p)[0];
                        if (f) {
                            var m = uh.getModelKeyFromComponentKey(f);
                            A.subModel[m] && g.matrix.copy(A.subModel[m])
                        }
                    }
                    g._indicesGroup = p,
                    n.add(g),
                    l[c].mesh = g,
                    t.addMeshToOctantMap(o, a, new Eu(a,g));
                    var C = function(e) {
                        p.hasOwnProperty(e) && p[e].forEach((function(t) {
                            A.addMeshToInfoMap(e, t.nodeId, g, t)
                        }
                        ))
                    };
                    for (var y in p)
                        C(y);
                    p = null,
                    g = null
                }
            }
        n.updateMatrixWorld(!0),
        A.dispatchEvent({
            type: Rc.ON_LOAD_PROGRESS,
            progress: {
                total: A.getLoader().maxLoadTaskCount,
                loaded: A.getLoader().maxLoadTaskCount,
                modelKey: A.modelKey
            }
        }),
        e && e(),
        Bh.timeEnd("makeMesh")
    }
    ,
    Tf.prototype.createMeshNodes = function(A, e) {
        A.getModelDescriptor().getStandardNodeInfos() ? this._createGeometries(A, e) : e && e()
    }
    ,
    Tf.prototype.applySelection = function(A) {}
    ,
    Tf.prototype.clearSelection = function(A) {}
    ,
    Tf.prototype.applyHover = function(A) {}
    ,
    Tf.prototype.clearHover = function(A) {}
    ,
    Tf.prototype.getMeshNode = function() {
        return this.mapMaterialIdToMergedNode
    }
    ,
    Tf.prototype._disposeMergedGeometries = function() {
        for (var A in this.mapMaterialIdToMergedNode) {
            for (var e = this.mapMaterialIdToMergedNode[A], t = 0, i = e.length; i > t; t += 1) {
                e[t].geometry.dispose(),
                delete e[t].geometry,
                delete e[t].indices,
                delete e[t].mesh
            }
            delete this.mapMaterialIdToMergedNode[A]
        }
    }
    ,
    Tf.prototype._getMaterialKeyByNodeInfo = function(A, e) {
        if (e) {
            var t = e.manager.getOverrideMaterialByNodeInfo(A);
            A.materialId = t ? t.name : A.originMId
        }
        return uh.getCombinedKeyString([A.materialId, A.uv ? "1" : "0", A.type === $u.EnumNodeItemType.LINE ? "lines" : "meshes"])
    }
    ,
    Tf.prototype.getPropertyValueByMaterialKey = function(A) {
        var e = uh.splitCombinedKeyString(A);
        return {
            materialId: e[0],
            uvProp: e[1],
            type: e[2]
        }
    }
    ,
    Tf.prototype.clearSelectedObjectIds = function() {
        this.selectedObjectIds.length = 0
    }
    ,
    Tf.prototype.cacheSelectedObjectIds = function(A, e, t) {
        this.selectedObjectIds.push({
            uid: A,
            mKey: e,
            idx: t
        })
    }
    ,
    Tf.prototype.adjustVisibility = function(A, e) {
        var t = this._getNodeGroup(A)
          , i = t.visible;
        e && !t.bVisible || (t.visible = e),
        t.bVisible = i
    }
    ,
    Tf.prototype.changeVisibilityOfSelectedObjects = function(A, e) {
        if (e)
            for (var t = 0, i = this.selectedMeshes.length; i > t; t += 1) {
                var o = this.selectedMeshes[t].object
                  , n = this.selectedMeshes[t].indices;
                if (o)
                    for (var r = 0, a = n.length; a > r; r += 1) {
                        var s = o.geometry.groups[n[r].idx];
                        s.start = n[r].start,
                        s.count = n[r].count
                    }
            }
        else {
            this.selectedMeshes.length = 0;
            for (var l = {}, c = 0, h = this.selectedObjectIds.length; h > c; c += 1) {
                var d = this.selectedObjectIds[c].mKey
                  , p = this.selectedObjectIds[c].idx
                  , g = uh.getCombinedKeyString([d, p]);
                if (!l[g]) {
                    l[g] = !0;
                    var u = this.mapMaterialIdToMergedNode[d][p]
                      , f = u.mesh;
                    if (f) {
                        for (var m = [], C = u.geometry.groups, y = 0, v = C.length; v > y; y += 1) {
                            var I = C[y];
                            I.materialIndex === zc.SELECTED && (m.push({
                                idx: y,
                                start: I.start,
                                count: I.count
                            }),
                            I.start = 0,
                            I.count = 0)
                        }
                        m.length && this.selectedMeshes.push({
                            object: f,
                            indices: m
                        })
                    }
                }
            }
        }
    }
    ,
    Tf.prototype.changeVisibilityOfNonSelectedObjects = function(A, e) {
        if (e)
            for (var t = 0, i = this.nonSelectedMeshes.length; i > t; t += 1) {
                var o = this.nonSelectedMeshes[t].object
                  , n = this.nonSelectedMeshes[t].indices;
                if (n)
                    for (var r = 0, a = n.length; a > r; r += 1) {
                        var s = o.geometry.groups[n[r].idx];
                        s.start = n[r].start,
                        s.count = n[r].count
                    }
                else
                    o.visible = this.nonSelectedMeshes[t].visibility
            }
        else {
            this.nonSelectedMeshes.length = 0;
            for (var l = {}, c = 0, h = this.selectedObjectIds.length; h > c; c += 1) {
                var d = this.selectedObjectIds[c];
                l[d.mKey] || (l[d.mKey] = {}),
                l[d.mKey][d.idx] = !0
            }
            for (var p in this.mapMaterialIdToMergedNode) {
                var g = this.mapMaterialIdToMergedNode[p];
                if (l[p])
                    for (var u = 0, f = g.length; f > u; u += 1) {
                        var m = g[u].mesh;
                        if (m) {
                            if (!l[p][u]) {
                                this.nonSelectedMeshes.push({
                                    object: m,
                                    indices: null,
                                    visibility: m.visible
                                }),
                                m.visible = !1;
                                continue
                            }
                            for (var C = [], y = m.geometry.groups, v = 0, I = y.length; I > v; v += 1) {
                                var E = y[v];
                                E.materialIndex !== zc.SELECTED && (C.push({
                                    idx: v,
                                    start: E.start,
                                    count: E.count
                                }),
                                E.start = 0,
                                E.count = 0)
                            }
                            C.length > 0 && this.nonSelectedMeshes.push({
                                object: m,
                                indices: C
                            })
                        }
                    }
                else
                    for (var B = 0, x = g.length; x > B; B += 1) {
                        var S = g[B].mesh;
                        S && (this.nonSelectedMeshes.push({
                            object: S,
                            indices: null,
                            visibility: S.visible
                        }),
                        S.visible = !1)
                    }
            }
        }
    }
    ,
    Tf.prototype.restoreVisibilityOfObjects = function() {
        this.selectedMeshes.length = 0,
        this.nonSelectedMeshes.length = 0
    }
    ,
    Tf.prototype.getBlinkMaterials = function() {
        return this.blinkMaterials
    }
    ,
    Tf.prototype.disposeBufferAfterVbo = function() {
        if (!this.bufferDestroyed) {
            var A = 0;
            for (var e in this.mapMaterialIdToMergedNode) {
                for (var t = this.mapMaterialIdToMergedNode[e], i = 0, o = t.length; o > i; i += 1) {
                    var n = t[i]
                      , r = n.geometry;
                    if (null !== r) {
                        A += 1;
                        var a = e + "-" + i;
                        this.mapDestroyedBufferKey[a] || n.mesh.visible && (this.mapDestroyedBufferKey[a] = !0,
                        Tu.disposeBufferFromGeometry(r, ["normal", "uv", "uv2"]))
                    }
                }
                Object.keys(this.mapDestroyedBufferKey).length === A && (this.mapDestroyedBufferKey = {},
                this.bufferDestroyed = !0)
            }
        }
    }
    ,
    Tf.prototype._traverseMeshNodeMap = function(A) {
        for (var e in this.mapMaterialIdToMergedNode)
            for (var t = this.mapMaterialIdToMergedNode[e], i = 0, o = t.length; o > i; i += 1)
                A && A(e, t[i])
    }
    ,
    Tf.prototype.getGeometryBuffersByUserId = function(A, e) {
        var t = []
          , i = A.getDatabagId();
        return this._traverseMeshNodeMap((function(A, o) {
            var n = o.indices[e];
            if (n)
                for (var r = o.geometry, a = r.getIndex().array, s = r.getAttribute("position").array, l = 0, c = n.length; c > l; l += 1) {
                    var h = n[l]
                      , d = h.indexStart
                      , p = h.indexStart + h.indexCount
                      , g = a.slice(d, p)
                      , u = s.slice(d = h.positionStart, p = h.positionStart + h.positionCount);
                    d /= 3,
                    g.forEach((function(A, e, t) {
                        t[e] -= d
                    }
                    )),
                    t.push({
                        databagId: i,
                        nodeId: h.nodeId,
                        position: u,
                        index: g
                    })
                }
        }
        )),
        t
    }
    ,
    Tf.prototype.getPickingNodeGenerator = function() {
        return this.pickingNodeGenerator || (this.pickingNodeGenerator = new nf(this)),
        this.pickingNodeGenerator
    }
    ;
    var Df = function(A) {
        of.call(this, A),
        this.nodeGroupName = "PickingBatchedWireFrameGroup"
    };
    Object.assign(Df.prototype, of.prototype),
    eu(Df, [{
        key: "disposePickingNodeById",
        value: function(A) {
            for (var e = this.pickingNodeMap[A], t = 0, i = e.length; i > t; t += 1)
                e[t]._indicesGroup = null,
                e[t].material = null,
                e[t].geometry.dispose(),
                e[t] = null
        }
    }, {
        key: "generatePickingMeshes",
        value: function() {
            var A = this.manager.getWireFrameLineSegments();
            A || (this.manager.generateWireframe(),
            A = this.manager.getWireFrameLineSegments());
            for (var e = 0, t = A.length; t > e; e += 1) {
                var i = A[e].geometry
                  , o = new he;
                o.setAttribute("position", i.getAttribute("position")),
                o.setIndex(i.getIndex());
                var n = new jo(o,Kd.DefaultMaterial);
                (new M).copy(A[e].matrix).multiply(this.manager.model.getModelMatrix()).decompose(n.position, n.quaternion, n.scale),
                n._indicesGroup = A[e]._indicesGroup,
                n.frustumCulled = !1,
                n.renderOrder = 1,
                this.addToPickingNodeMap(e, [n])
            }
        }
    }, {
        key: "_rebuildGeometryGroup",
        value: function(A, e, t) {
            var i, o = this.manager.manager, n = 0, r = 0, a = 0, s = A._indicesGroup, l = Object.keys(s), c = [], h = {};
            e.length > l.length ? (c = l,
            h = t) : (c = e,
            h = s);
            var d = [];
            for (a = 0,
            i = c.length; i > a; a += 1) {
                var p = c[a];
                if (o.isPickableNode(p) && h[p]) {
                    var g = s[p];
                    if (g && g.length > 0)
                        for (n = 0,
                        r = g.length; r > n; n += 1)
                            d.push({
                                indexStart: g[n].indexStart,
                                indexCount: g[n].indexCount
                            })
                }
            }
            A.visible = !0;
            var u = A.geometry;
            if (u.clearGroups(),
            0 !== d.length)
                for (d.sort((function(A, e) {
                    return A.indexStart - e.indexStart
                }
                )),
                n = 0,
                r = d.length; r > n; n += 1) {
                    var f = d[n].indexStart
                      , m = d[n].indexCount;
                    if (0 === n)
                        u.addGroup(f, m, 0);
                    else
                        f === d[n - 1].indexStart + d[n - 1].indexCount ? u.groups[u.groups.length - 1].count += m : u.addGroup(f, m, 0)
                }
            else
                A.visible = !1
        }
    }, {
        key: "updatePickingMeshesState",
        value: function(A, e, t) {
            for (var i = this.pickingNodeMap, o = Object.keys(i), n = 0, r = o.length; r > n; n += 1)
                for (var a = i[o[n]], s = 0, l = a.length; l > s; s += 1)
                    a[s].material = [A],
                    a[s].visible = !1,
                    this._rebuildGeometryGroup(a[s], e, t)
        }
    }]);
    var Lf = function(A) {
        this.manager = A,
        this.model = A.model,
        this.generated = !1,
        this.wireframeLineSegment = null,
        this.wireframeGeometryMap = null,
        this.wireframeDataMap = null,
        this.userIdMapForNoWireFrame = {}
    };
    function Nf(A, e, t, i) {
        for (var o = A.getAttribute("position").array, n = e; t > n; n += 1)
            o[3 * n] += i.x,
            o[3 * n + 1] += i.y,
            o[3 * n + 2] += i.z;
        A.getAttribute("position").needsUpdate = !0
    }
    Lf.prototype.destroy = function() {
        this.clearData(),
        this.manager = null,
        this.userIdMapForNoWireFrame = null,
        this.pickingNodeGenerator && (this.pickingNodeGenerator.destroy(),
        this.pickingNodeGenerator = null)
    }
    ,
    Lf.prototype.clearData = function() {
        this.generated = !1,
        this.bufferDestroyed = !1,
        this.wireframeLineSegment && (this.wireframeLineSegment._indicesGroup = null,
        this.wireframeLineSegment.geometry.dispose(),
        this.wireframeLineSegment = null),
        this.pickingNodeGenerator && this.pickingNodeGenerator.clearData(),
        this.wireframeGeometryMap = null,
        this.userIdMapForNoWireFrame = {}
    }
    ,
    Lf.prototype._createWireframeGeometry = function(A, e) {
        if (this.wireframeGeometryMap || (this.wireframeGeometryMap = {}),
        this.wireframeDataMap || (this.wireframeDataMap = {}),
        !this.wireframeGeometryMap[e.nodeId]) {
            var t = this._getWireframeData(A, e)
              , i = new he;
            i.setIndex(new $A(t.index,1)),
            i.setAttribute("position", new YA(t.buffer,3)),
            i._userId = e.userId,
            this.wireframeGeometryMap[e.nodeId] = i
        }
    }
    ,
    Lf.prototype._getWireframeData = function(A, e) {
        this.wireframeDataMap || (this.wireframeDataMap = {});
        var t = {};
        if (!this.wireframeDataMap[e.nodeId]) {
            for (var i = A.attributes.position.array.slice(e.positionStart, e.positionStart + e.positionCount), o = A.getIndex().array.slice(e.indexStart, e.indexStart + e.indexCount), n = 0, r = o.length; r > n; n += 1)
                o[n] -= e.positionStart / 3;
            var a = Up(i, o);
            return t = Tu.reducedGeometry(i, a),
            this.wireframeDataMap[e.nodeId] = t,
            t
        }
        return this.wireframeDataMap[e.nodeId]
    }
    ,
    Lf.prototype._createWireframeGeometries = function(A) {
        A || (A = this.model);
        var e = A.manager.filter
          , t = A.getModelDescriptor().getStandardNodeInfos();
        function i(A) {
            var i = t[A];
            return !(i && e._hasRenderWithBoardlineFilter() && !e._isRenderWithBoardline(i[0]))
        }
        var o = this.manager.getMeshNode();
        for (var n in Bh.time("createWireframeGeometry"),
        o) {
            if ("meshes" === this.manager.getPropertyValueByMaterialKey(n).type)
                for (var r = o[n], a = 0, s = r.length; s > a; a += 1) {
                    var l, c = r[a];
                    if (c.RenderTypeChange) {
                        for (var h = (l = c.geometry.clone()).attributes.position.array, d = [], p = new y, g = c.mesh.matrixWorld, u = 0, f = h.length; f > u; u += 3)
                            p.set(h[u], h[u + 1], h[u + 2]).applyMatrix4(g),
                            d.push(p.x, p.y, p.z);
                        l.setAttribute("position", new YA(new Float32Array(d),3))
                    } else
                        l = c.geometry;
                    if (null !== l) {
                        var m = c.indices;
                        for (var C in m) {
                            i(C) || (this.userIdMapForNoWireFrame[C] = !0);
                            for (var v = m[C], I = 0, E = v.length; E > I; I += 1)
                                this._createWireframeGeometry(l, v[I])
                        }
                    }
                }
        }
        return Bh.timeEnd("createWireframeGeometry"),
        !0
    }
    ,
    Lf.prototype._makeWireframe = function(A) {
        A || (A = this.model);
        var e = {}
          , t = A.getWireframeMaterial();
        for (var i in this.wireframeGeometryMap) {
            var o = this.wireframeGeometryMap[i]
              , n = o._userId
              , r = new jo(o,t);
            r.userId = n,
            r.nodeId = i,
            e[n] || (e[n] = []),
            e[n].push(r),
            r = null
        }
        var a = [];
        for (var n in e)
            for (var s = e[n], l = 0, c = s.length; c > l; l += 1)
                a.push(s[l]);
        if (a.length > 0) {
            var h = {}
              , d = Tu.mergeBufferGeometriesFromMeshs(a, h);
            if (d && (this.wireframeLineSegment = new jo(d,A.getWireframeMaterial()),
            this.wireframeLineSegment.matrixAutoUpdate = !1,
            this.wireframeLineSegment._indicesGroup = h,
            !uh.isEmptyObject(A.subModel))) {
                var p = Object.keys(h)[0];
                if (p) {
                    var g = uh.getModelKeyFromComponentKey(p);
                    A.subModel[g] && this.wireframeLineSegment.matrix.copy(A.subModel[g])
                }
            }
        }
        for (var n in a = null,
        e)
            delete e[n];
        e = null,
        this.wireframeGeometryMap = null
    }
    ,
    Lf.prototype.generateWireframe = function(A, e) {
        A || (A = this.model),
        this.generated || (this._createWireframeGeometries(A),
        this._makeWireframe(A),
        this.generated = !0,
        e && e())
    }
    ,
    Lf.prototype.update = function(A) {
        if (this.manager.hasNodeInfo(A))
            if (A.isActivateWireframe()) {
                if (this.generateWireframe(A),
                this.wireframeLineSegment) {
                    var e = this._getNodeGroup(A);
                    e.clear(),
                    e.add(this.wireframeLineSegment),
                    e.updateMatrixWorld(!0)
                }
            } else
                A._hasNodeGroup(gp.WIREFRAME) && A._removeNodeGroup(gp.WIREFRAME)
    }
    ,
    Lf.prototype.rebuildIndices = function(A) {
        if (this.needDealWireframeLine(A)) {
            this.wireframeLineSegment.visible = !0;
            var e = this.wireframeLineSegment._indicesGroup
              , t = this.wireframeLineSegment.geometry;
            t.clearGroups();
            var i = A.getWireframeMaterial();
            this.wireframeLineSegment.material = i;
            var o = this.manager.getFilteredUserIdsForWireFrame()
              , n = Boolean(o && Object.keys(o).length);
            if (this._existHiddenUserId() || n) {
                var r = []
                  , a = 0
                  , s = 0
                  , l = [];
                for (var c in e)
                    if (!this._isHiddenUserId(c)) {
                        var h = e[c];
                        if (h && h.length > 0) {
                            if (o[c]) {
                                var d = o[c]
                                  , p = l.indexOf(d);
                                for (-1 === p && (l.push(d),
                                p = l.length - 1),
                                a = 0,
                                s = h.length; s > a; a += 1)
                                    r.push({
                                        indexStart: h[a].indexStart,
                                        indexCount: h[a].indexCount,
                                        state: 1 + p
                                    });
                                continue
                            }
                            for (a = 0,
                            s = h.length; s > a; a += 1)
                                r.push({
                                    indexStart: h[a].indexStart,
                                    indexCount: h[a].indexCount,
                                    state: 0
                                })
                        }
                    }
                if (0 !== r.length) {
                    for (r.sort((function(A, e) {
                        return A.indexStart - e.indexStart
                    }
                    )),
                    a = 0,
                    s = r.length; s > a; a += 1) {
                        var g = r[a].indexStart
                          , u = r[a].indexCount
                          , f = r[a].state;
                        if (0 === a)
                            t.addGroup(g, u, f);
                        else
                            f === r[a - 1].state && g === r[a - 1].indexStart + r[a - 1].indexCount ? t.groups[t.groups.length - 1].count += u : t.addGroup(g, u, f)
                    }
                    var m = A.getFilter()
                      , C = [i];
                    for (a = 0,
                    s = l.length; s > a; a += 1) {
                        var y = m._getMaterialByName(l[a]);
                        C.push(y)
                    }
                    this.wireframeLineSegment.material = C
                } else
                    this.wireframeLineSegment.visible = !1
            }
        }
    }
    ,
    Lf.prototype.explode = function(A, e, t) {}
    ,
    Lf.prototype.explosion = function(A, e) {
        if (this.wireframeLineSegment) {
            var t = Object.keys(this.wireframeLineSegment._indicesGroup);
            e || (e = {}),
            e.componentKey = t,
            this.componentsExplosion(A, e)
        }
    }
    ,
    Lf.prototype.closeExplosion = function(A) {
        this.explosion(A)
    }
    ,
    Lf.prototype.componentsExplosion = function(A, e) {
        if (this.wireframeLineSegment)
            for (var t = Array.isArray(e.componentKey) ? e.componentKey : [e.componentKey], i = this.wireframeLineSegment._indicesGroup, o = this.wireframeLineSegment.geometry, n = 0, r = t.length; r > n; n += 1) {
                var a = t[n];
                if (a) {
                    var s = A.getModelDescriptor().getStandardNodeInfosById(a);
                    if (s) {
                        var l = i[a];
                        if (l) {
                            var c = s[0];
                            if (!c || !c.userData || !c.userData.changeOffset)
                                continue;
                            for (var h = 0, d = l.length; d > h; h += 1) {
                                var p = l[h].positionStart;
                                Nf(o, p, p + l[h].positionCount, c.userData.changeOffset)
                            }
                            c.userData.changeOffset = void 0
                        }
                    }
                }
            }
    }
    ,
    Lf.prototype.closeComponentsExplosion = function(A, e) {
        this.componentsExplosion(A, {
            componentKey: e
        })
    }
    ,
    Lf.prototype._getNodeGroup = function(A) {
        return A._getNodeGroup(gp.WIREFRAME, {
            globalSpace: !0
        })
    }
    ,
    Lf.prototype.needDealWireframeLine = function(A) {
        return !(!A.isActivateWireframe() || !this.wireframeLineSegment)
    }
    ,
    Lf.prototype.adjustVisibility = function(A, e) {
        if (this.needDealWireframeLine(A)) {
            var t = this._getNodeGroup(A)
              , i = t.visible;
            e && !t.bVisible || (t.visible = e),
            t.bVisible = i
        }
    }
    ,
    Lf.prototype.changeVisibilityOfSelectedObjects = function(A, e) {}
    ,
    Lf.prototype.changeVisibilityOfNonSelectedObjects = function(A, e) {
        this.adjustVisibility(A, e)
    }
    ,
    Lf.prototype.restoreVisibilityOfObjects = function() {}
    ,
    Lf.prototype.disposeBufferAfterVbo = function() {
        this.generated && !this.bufferDestroyed && this.wireframeLineSegment && this.wireframeLineSegment.visible && (this.bufferDestroyed = !0,
        Tu.disposeBufferFromGeometry(this.wireframeLineSegment.geometry, ["position", "normal", "uv", "uv2"]))
    }
    ,
    Lf.prototype._existHiddenUserId = function() {
        var A = this.manager.getHiddenUserIds();
        return !!(this.userIdMapForNoWireFrame && Object.keys(this.userIdMapForNoWireFrame).length || A && Object.keys(A).length)
    }
    ,
    Lf.prototype._isHiddenUserId = function(A) {
        if (this.userIdMapForNoWireFrame[A])
            return !0;
        var e = this.manager.getHiddenUserIds();
        return !(!e || !e[A])
    }
    ,
    Lf.prototype.getWireFrameLineSegments = function() {
        return this.wireframeLineSegment ? [this.wireframeLineSegment] : null
    }
    ,
    Lf.prototype.getPickingNodeGenerator = function() {
        return this.pickingNodeGenerator || (this.pickingNodeGenerator = new Df(this)),
        this.pickingNodeGenerator
    }
    ;
    var Of = function(A, e) {
        this.model = e,
        this.meshManager = new Tf(this),
        A || (this.wireframeManager = new Lf(this))
    };
    Of.prototype.destroy = function() {
        this.meshManager.destroy(),
        this.meshManager = null,
        this.wireframeManager.destroy(),
        this.wireframeManager = null,
        this._clearFilteredState(),
        this._clearSelectedState(),
        this._clearHoveredState(),
        this._clearBlinkedState()
    }
    ,
    Of.prototype.updateNodes = function(A) {
        var e;
        e = this._collectModelFiltered(A),
        this.meshManager.update(A, e),
        this.wireframeManager.update(A)
    }
    ,
    Of.prototype.generateWireframe = function(A, e) {
        this.wireframeManager.generateWireframe(A, e)
    }
    ,
    Of.prototype.asyncGenerateWireframe = function(A, e) {
        this.wireframeManager.asyncGenerateWireframe(A, e)
    }
    ,
    Of.prototype.rebuildIndices = function(A) {
        this._rebuildIndices(A)
    }
    ,
    Of.prototype.clearData = function() {
        this.meshManager.clearData(),
        this.wireframeManager.clearData(),
        this._clearFilteredState(),
        this._clearSelectedState(),
        this._clearHoveredState(),
        this._clearBlinkedState()
    }
    ,
    Of.prototype.createMeshNodes = function(A, e) {
        this.meshManager.createMeshNodes(A, e)
    }
    ,
    Of.prototype.createBatchedMeshNodes = function(A, e) {
        this.meshManager.createBatchedMeshNodes(A, e)
    }
    ,
    Of.prototype.asyncCreateMeshNodes = function(A, e, t) {
        this.meshManager.asyncCreateMeshNodes(A, e, t)
    }
    ,
    Of.prototype.hasNodeInfo = function(A) {
        return Boolean(A.getModelDescriptor().getStandardNodeInfos())
    }
    ,
    Of.prototype.disposeGeometry = function(A) {
        this.meshManager.disposeGeometry(A)
    }
    ,
    Of.prototype.getMeshNode = function() {
        return this.meshManager.getMeshNode()
    }
    ,
    Of.prototype.getPropertyValueByMaterialKey = function(A) {
        return this.meshManager.getPropertyValueByMaterialKey(A)
    }
    ,
    Of.prototype.getFilteredUserIds = function() {
        return this.mapMaterialIdToUserIdsForFilter
    }
    ,
    Of.prototype.getSelectedUserIds = function() {
        return this.mapMaterialIdToUserIdsForSelection
    }
    ,
    Of.prototype.getHoveredUserIds = function() {
        return this.mapMaterialIdToUserIdsForHover
    }
    ,
    Of.prototype.getBlinkedUserIds = function() {
        return this.mapBlinkUserIds
    }
    ,
    Of.prototype.getHiddenUserIds = function() {
        return this.hiddenUserIdSetObject
    }
    ,
    Of.prototype.getTransparentUserIds = function() {
        return this.transparentUserIdSetObject
    }
    ,
    Of.prototype.applyFilter = function(A, e) {
        if (this.hasNodeInfo(A)) {
            var t = null;
            t = e || A.getModelDescriptor().getStandardUserIds();
            var i = A.getModelDescriptor().getStandardNodeInfos();
            this._collectFilteredUserIds(A, t, i),
            this._collectFilteredUserIdsForWireFrame(A, t, i),
            this._collectSelectedUserIds(A.manager.sceneState.selectionSet, i),
            this._collectHoveredUserIds(A.manager.sceneState.hoverId, i),
            this._rebuildIndices(A),
            this.updateNodes(A)
        }
    }
    ,
    Of.prototype.applySelection = function(A) {
        if (this.hasNodeInfo(A)) {
            var e = A.getModelDescriptor().getStandardNodeInfos();
            this._clearSelectedState(A),
            this._clearHoveredState(A),
            this._collectSelectedUserIds(A.manager.sceneState.selectionSet, e),
            this._collectHoveredUserIds(A.manager.sceneState.hoverId, e),
            this._rebuildIndices(A),
            this.updateNodes(A)
        }
    }
    ,
    Of.prototype.clearSelection = function(A) {
        this._clearSelectedState(A),
        this.applyHover(A)
    }
    ,
    Of.prototype.applyHover = function(A) {
        if (this.hasNodeInfo(A)) {
            var e = A.getModelDescriptor().getStandardNodeInfos();
            this._clearHoveredState(A),
            this._collectHoveredUserIds(A.manager.sceneState.hoverId, e),
            this._rebuildIndices(A),
            this.updateNodes(A)
        }
    }
    ,
    Of.prototype.clearHover = function(A) {
        this._clearHoveredState(A),
        this._rebuildIndices(A),
        this.updateNodes(A)
    }
    ,
    Of.prototype.applyBlink = function(A) {
        if (this.hasNodeInfo(A)) {
            var e = A.getModelDescriptor().getStandardNodeInfos();
            this._clearBlinkedState(A),
            this._clearHoveredState(A),
            this._collectBlinkedUserIds(A.manager.sceneState.getBlinkComponentsIdMap(), e),
            this._collectHoveredUserIds(A.manager.sceneState.hoverId, e),
            this._rebuildIndices(A),
            this.updateNodes(A)
        }
    }
    ,
    Of.prototype.clearBlink = function(A) {
        this._clearBlinkedState(A),
        this.applyHover(A)
    }
    ,
    Of.prototype.applyReplacement = function(A) {
        this._rebuildIndices(A),
        this.updateNodes(A)
    }
    ,
    Of.prototype._collectFilteredUserIds = function(A, e, t) {
        var i = A.manager.filter
          , o = i._hasHiddenFileIdFilter()
          , n = i._hasVisibleFilter()
          , r = i._hasOverrideMaterialFilter()
          , a = i._hasTransparentFilter()
          , s = A.hasReplacedUserId()
          , l = A.hasHiddenSourceObjectUserId()
          , c = this.mapMaterialIdToUserIdsForFilter = {};
        if (this.hiddenUserIdSetObject = {},
        this.overrideUserIdSetObject = {},
        this.transparentUserIdSetObject = {},
        o || n || r || a || s || l)
            for (var h = 0; e.length > h; h += 1) {
                var d = e[h]
                  , p = t[d];
                if (p && p.length)
                    for (var g = 0, u = p.length; u > g; g += 1) {
                        var f = p[g];
                        if (o && i._isHiddenFileId(f) || n && !1 === i._isVisible(f) || A.isReplacedUserId(d) || A.isHiddenSourceObjectUserId(d))
                            void 0 === c[f.materialId] && (c[f.materialId] = {}),
                            void 0 === c[f.materialId][zc.HIDDEN] && (c[f.materialId][zc.HIDDEN] = {}),
                            c[f.materialId][zc.HIDDEN][d] = !0,
                            this.hiddenUserIdSetObject[d] = !0;
                        else if (a && i._isTransparent(f))
                            void 0 === c[f.materialId] && (c[f.materialId] = {}),
                            void 0 === c[f.materialId][zc.TRANSPARENT] && (c[f.materialId][zc.TRANSPARENT] = {}),
                            c[f.materialId][zc.TRANSPARENT][d] = !0,
                            this.transparentUserIdSetObject[d] = !0;
                        else if (r && i._hasOverrideMaterial(f)) {
                            var m = i._getOverrideMaterial(f);
                            if (Array.isArray(m)) {
                                var C = g
                                  , y = m.find((function(A) {
                                    return !!A.mapNodeIdToOrigMatId && Object.keys(A.mapNodeIdToOrigMatId).includes(f.nodeId)
                                }
                                ))
                                  , v = y ? y.mapNodeIdToOrigMatId[f.nodeId] : m[C].materialId
                                  , I = y ? y.materialId : "";
                                "" !== I && (void 0 === c[v] && (c[v] = {}),
                                void 0 === c[v][zc.OVERRIDED] && (c[v][zc.OVERRIDED] = {})),
                                c[v] || (c[v] = {},
                                c[v][zc.OVERRIDED] = {}),
                                c[v][zc.OVERRIDED][d] = I,
                                this.overrideUserIdSetObject[d] || (this.overrideUserIdSetObject[d] = []),
                                this.overrideUserIdSetObject[d][C] = I
                            } else {
                                var E = null !== m ? m.name : "";
                                "" !== E && (void 0 === c[f.materialId] && (c[f.materialId] = {}),
                                void 0 === c[f.materialId][zc.OVERRIDED] && (c[f.materialId][zc.OVERRIDED] = {}),
                                c[f.materialId][zc.OVERRIDED][d] = E,
                                this.overrideUserIdSetObject[d] = E)
                            }
                        }
                    }
            }
    }
    ,
    Of.prototype._collectFilteredUserIdsForWireFrame = function(A, e, t) {
        var i = A.getFilter()
          , o = i._hasOverrideMaterialFilterForWireFrame();
        if (this.mapFilteredUserIdsForWireFrame = {},
        o)
            for (var n = 0; e.length > n; n += 1) {
                var r = e[n];
                if (!this.hiddenUserIdSetObject[r]) {
                    var a = t[r];
                    if (a && a.length)
                        for (var s = 0, l = a.length; l > s; s += 1) {
                            var c = a[s];
                            if (i._hasOverrideMaterialForWireFrame(c)) {
                                var h = i._getOverrideMaterialForWireFrame(c)
                                  , d = null !== h ? h.name : "";
                                "" !== d && (this.mapFilteredUserIdsForWireFrame[r] = d)
                            }
                        }
                }
            }
    }
    ,
    Of.prototype._collectModelFiltered = function(A) {
        var e = A.manager.filter
          , t = A.modelKey
          , i = e._hasModelOverrideMaterialFilter()
          , o = e._hasModelTransparentFilter()
          , n = A.manager.modelState.selectionSet;
        return A.manager.modelState.hoverId === t ? A.manager.modelState.getHoverMaterial() : n.hasOwnProperty(A.modelKey) ? A.manager.modelState.selectionMaterial : o && e._isModelTransparent(t) ? e._getMaterialByName("scene") : i && e._hasModelOverrideMaterial(t) ? e._getModelOverrideMaterial(t) : null
    }
    ,
    Of.prototype._clearFilteredState = function() {
        this.mapMaterialIdToUserIdsForFilter = null
    }
    ,
    Of.prototype._collectSelectedUserIds = function(A, e) {
        var t = this.mapMaterialIdToUserIdsForSelection = {};
        for (var i in A)
            if (this.model.modelKey === i)
                for (var o in A[i]) {
                    var n = e[o];
                    if (n && n.length)
                        for (var r = 0, a = n.length; a > r; r += 1)
                            void 0 === t[n[r].materialId] && (t[n[r].materialId] = {}),
                            void 0 === t[n[r].materialId][o] && (t[n[r].materialId][o] = !0)
                }
    }
    ,
    Of.prototype._clearSelectedState = function() {
        this.mapMaterialIdToUserIdsForSelection && (this.mapMaterialIdToUserIdsForSelection = null)
    }
    ,
    Of.prototype._collectHoveredUserIds = function(A, e) {
        var t = this.mapMaterialIdToUserIdsForHover = {};
        if (A && e[A])
            for (var i = e[A], o = 0, n = i.length; n > o; o += 1)
                void 0 === t[i[o].materialId] && (t[i[o].materialId] = {}),
                void 0 === t[i[o].materialId][A] && (t[i[o].materialId][A] = !0)
    }
    ,
    Of.prototype._clearHoveredState = function() {
        this.mapMaterialIdToUserIdsForHover && (this.mapMaterialIdToUserIdsForHover = null)
    }
    ,
    Of.prototype._collectBlinkedUserIds = function(A, e) {
        var t = this.mapBlinkUserIds = {};
        for (var i in A) {
            var o = e[i];
            if (o && o.length)
                for (var n = 0, r = o.length; r > n; n += 1)
                    void 0 === t[o[n].materialId] && (t[o[n].materialId] = {}),
                    void 0 === t[o[n].materialId][i] && (t[o[n].materialId][i] = !0)
        }
    }
    ,
    Of.prototype.calculateClippingIds = function(A, e) {
        this.meshManager.calculateClippingIds(A, e)
    }
    ,
    Of.prototype._clearBlinkedState = function() {
        this.mapBlinkUserIds && (this.mapBlinkUserIds = null)
    }
    ,
    Of.prototype._rebuildIndices = function(A) {
        this.meshManager.rebuildIndices(A),
        this.wireframeManager.rebuildIndices(A)
    }
    ,
    Of.prototype.clearCachedData = function() {
        this.meshManager.clearAllNodeBuffer()
    }
    ,
    Of.prototype.getMeshesByUserIds = function(A, e) {
        return this.meshManager.getMeshesByUserIds(A, e)
    }
    ,
    Of.prototype.adjustVisibility = function(A, e) {
        this.meshManager.adjustVisibility(A, e),
        this.wireframeManager.adjustVisibility(A, e)
    }
    ,
    Of.prototype.changeVisibilityOfSelectedObjects = function(A, e) {
        this.meshManager.changeVisibilityOfSelectedObjects(A, e),
        this.wireframeManager.changeVisibilityOfSelectedObjects(A, e)
    }
    ,
    Of.prototype.changeVisibilityOfNonSelectedObjects = function(A, e) {
        this.meshManager.changeVisibilityOfNonSelectedObjects(A, e),
        this.wireframeManager.changeVisibilityOfNonSelectedObjects(A, e)
    }
    ,
    Of.prototype.restoreVisibilityOfObjects = function() {
        this.meshManager.restoreVisibilityOfObjects(),
        this.wireframeManager.restoreVisibilityOfObjects()
    }
    ,
    Of.prototype.disposeBufferAfterVbo = function() {
        this.meshManager.disposeBufferAfterVbo(),
        this.wireframeManager.disposeBufferAfterVbo()
    }
    ,
    Of.prototype.getGeometryBuffersByUserId = function(A, e) {
        return this.meshManager.getGeometryBuffersByUserId(A, e)
    }
    ,
    Of.prototype.explosion = function(A, e) {
        this.meshManager.explosion(A, e),
        this.wireframeManager.explosion(A, e)
    }
    ,
    Of.prototype.closeExplosion = function(A) {
        this.meshManager.closeExplosion(A),
        this.wireframeManager.closeExplosion(A)
    }
    ,
    Of.prototype.componentsExplosion = function(A, e) {
        this.meshManager.componentsExplosion(A, e),
        this.wireframeManager.componentsExplosion(A, e)
    }
    ,
    Of.prototype.closeComponentsExplosion = function(A, e) {
        this.meshManager.closeComponentsExplosion(A, e),
        this.wireframeManager.closeComponentsExplosion(A, e)
    }
    ,
    Of.prototype.isPickableNode = function(A) {
        var e = this.getHiddenUserIds();
        if (e && e[A])
            return !1;
        var t = this.getTransparentUserIds();
        return !t || !t[A]
    }
    ,
    Of.prototype.isHiddenNode = function(A) {
        var e = this.getHiddenUserIds();
        return !(!e || !e[A])
    }
    ,
    Of.prototype.getMeshManager = function() {
        return this.meshManager
    }
    ,
    Of.prototype.getWireFrameManager = function() {
        return this.wireframeManager
    }
    ,
    Of.prototype.getFilteredUserIdsForWireFrame = function() {
        return this.mapFilteredUserIdsForWireFrame
    }
    ;
    var Vf = function(A) {
        of.call(this, A),
        this.nodeGroupName = "PickingInstancedMeshGroup"
    };
    function Gf(A, e, t) {
        for (var i = A.getAttribute("mcol3").array, o = 0; e.length > o; o += 1) {
            var n = e[o];
            i[3 * n] += t.x,
            i[3 * n + 1] += t.y,
            i[3 * n + 2] += t.z
        }
        A.getAttribute("mcol3").needsUpdate = !0
    }
    Object.assign(Vf.prototype, of.prototype),
    eu(Vf, [{
        key: "generatePickingMeshes",
        value: function() {
            var A = this
              , e = this.manager
              , t = e.cachedInstance
              , i = !vc.BatchMergeEnabled;
            e.traverseInstanceNodeMap(null, (function(e, o) {
                for (var n = [], r = 0, a = o.length; a > r; r += 1) {
                    var s = o[r].geometry
                      , l = o[r]
                      , c = new Na;
                    c.setAttribute("position", s.getAttribute("position")),
                    c.setAttribute("mcol0", s.getAttribute("mcol0")),
                    c.setAttribute("mcol1", s.getAttribute("mcol1")),
                    c.setAttribute("mcol2", s.getAttribute("mcol2")),
                    c.setAttribute("mcol3", s.getAttribute("mcol3")),
                    c.setAttribute("vState", new Oa(new Float32Array(t.vState[e]),1,!1,1)),
                    c.setIndex(s.getIndex());
                    var h = new Ue(c,Kd.DefaultMaterial);
                    l.matrixWorld.decompose(h.position, h.quaternion, h.scale),
                    h.name = e,
                    h.frustumCulled = !1,
                    h.renderOrder = i ? 1 : 0,
                    n.push(h)
                }
                A.addToPickingNodeMap(e, n)
            }
            ))
        }
    }, {
        key: "updatePickingMeshesState",
        value: function(A, e, t) {
            if (this.pickingNodeMap)
                for (var i = this.manager.manager, o = this.pickingNodeMap, n = 0, r = e.length; r > n; n += 1) {
                    var a = e[n];
                    if (i.isPickableNode(a)) {
                        var s = i.getMeshManager().getNodeIdxMapByUserId(a);
                        if (s)
                            for (var l = Object.keys(s), c = 0, h = l.length; h > c; c += 1) {
                                var d = l[c]
                                  , p = o[d];
                                if (p)
                                    for (var g = s[d], u = 0, f = p.length; f > u; u += 1) {
                                        var m = p[u];
                                        m.material = A,
                                        m.visible = !0;
                                        for (var C = m.geometry, y = C.getAttribute("vState").array, v = 0, I = g.length; I > v; v += 1)
                                            y[g[v]] = Hc.NONE;
                                        C.getAttribute("vState").needsUpdate = !0
                                    }
                            }
                    }
                }
        }
    }, {
        key: "resetPickingMeshesState",
        value: function() {
            if (this.pickingNodeMap)
                for (var A = this.pickingNodeMap, e = Object.keys(A), t = 0, i = e.length; i > t; t += 1)
                    for (var o = A[e[t]], n = 0, r = o.length; r > n; n += 1)
                        o[n].visible = !1,
                        o[n].geometry.getAttribute("vState").array.fill(Hc.HIDDEN),
                        o[n].geometry.getAttribute("vState").needsUpdate = !0
        }
    }]);
    var Pf = function(A) {
        return Rf.call(this),
        this.manager = A,
        this.instanceGeometryMap = {},
        this.bufferAttributeMap = {},
        this.instanceNodeMap = {},
        this.nodeIdxMapFromUserId = {},
        this.matrixInfoMapFromUserId = {},
        this.cachedInstance = {
            vState: {},
            vState2: {},
            vColor: {},
            vMirror: {},
            mcol0: {},
            mcol1: {},
            mcol2: {},
            mcol3: {},
            muvCol0: {},
            muvCol1: {},
            muvCol2: {},
            userId: {},
            nodeId: {}
        },
        this.selectedMeshes = [],
        this.nonSelectedMeshes = [],
        this.selectedObjectIds = [],
        this
    };
    (Pf.prototype = Object.create(Rf.prototype)).destroy = function() {
        this.cachedInstance = {},
        this.instanceNodeMap = {},
        this.bufferAttributeMap = {},
        this.nodeIdxMapFromUserId = {},
        this.matrixInfoMapFromUserId = {},
        this.disposeInstanceGeometries(),
        this.instanceGeometryMap = {},
        this.manager = null,
        this.selectedMeshes = [],
        this.nonSelectedMeshes = [],
        this.selectedObjectIds = []
    }
    ,
    Pf.prototype.clearData = function() {
        this.bufferDestroyed = !1,
        this.disposeGeometries(),
        this.disposeInstanceGeometries(),
        this.clearInstanceCache(),
        this.pickingNodeGenerator && this.pickingNodeGenerator.clearData()
    }
    ,
    Pf.prototype.clearInstanceCache = function() {
        this.cachedInstance.vState = {},
        this.cachedInstance.vState2 = {},
        this.cachedInstance.vColor = {},
        this.cachedInstance.vMirror = {},
        this.cachedInstance.mcol0 = {},
        this.cachedInstance.mcol1 = {},
        this.cachedInstance.mcol2 = {},
        this.cachedInstance.mcol3 = {},
        this.cachedInstance.muvCol0 = {},
        this.cachedInstance.muvCol1 = {},
        this.cachedInstance.muvCol2 = {},
        this.bufferAttributeMap = {},
        this.nodeIdxMapFromUserId = {},
        this.instanceNodeMap = {},
        this.instanceGeometryMap = {},
        this.matrixInfoMapFromUserId = {},
        this.geometries = {}
    }
    ,
    Pf.prototype.updateNodes = function(A) {
        this._getNodeGroup(A).visible = !A.isOnlyWireframe()
    }
    ,
    Pf.prototype.createMeshNodes = function(A, e) {
        this._createInstanceGeometries(A, e),
        this._makeInstanceNodes(A)
    }
    ,
    Pf.prototype.disposeInstanceGeometries = function() {
        this.traverseInstanceGeometryMap((function(A, e) {
            for (var t = 0, i = e.length; i > t; t += 1)
                e[t].dispose()
        }
        ))
    }
    ,
    Pf.prototype._createInstanceGeometries = function(A, e) {
        Bh.time("createInstanceGeometries");
        var t = this;
        A.getModelDescriptor().traverseInstancedNodeInfos(e, (function(e, i) {
            for (var o = 0, n = i.length; n > o; o += 1) {
                var r = i[o]
                  , a = t.getGeometryByNodeInfo(A, r);
                if (a) {
                    var s = A.manager.getOverrideMaterialByNodeInfo(r);
                    s && (r.materialId = s.name);
                    var l = t.getMeshIdByNodeInfo(r)
                      , c = t.cacheInstanceAttributeStateBy(A, l, a, r, s);
                    t.cacheNodeIdxByUserId(r.userId, l, c),
                    t.cacheMatrixInfoByUserId(r.userId, l, {
                        matrix: r.matrix,
                        boundingBox: r.boundingBox
                    }),
                    t.cacheInstanceGeometries(l, a)
                }
            }
        }
        )),
        Bh.timeEnd("createInstanceGeometries")
    }
    ,
    Pf.prototype._createBatchedInstanceGeometries = function(A, e) {
        var t = A.materialManager.getMaterialById(e.materialKey)
          , i = A.getModelDescriptor();
        if (!t) {
            var o = i.getNodeInfosByNodeId(e.nodeIdInfo[0]);
            if (!o)
                return;
            e.materialKey = o.materialId,
            t = A.materialManager.getMaterialById(e.materialKey),
            e.color = [];
            for (var n = 0, r = e.nodeIdInfo.length; r > n; n += 1)
                e.color.push(t.color.r, t.color.g, t.color.b, t.opacity)
        }
        var a = !1;
        t.aoMap && (a = !0),
        e.hasUV2 = a;
        var s = uh.getCombinedKeyString([e.materialKey, e.geoId])
          , l = this.cachedInstance;
        if (e.nodeIdInfo.length < 1)
            Bh.error("node 数量为 0 ");
        else if (l.vState[s])
            Bh.warn("实例化几何已存在：", s);
        else {
            l.vState[s] = new Float32Array(e.nodeIdInfo.length),
            l.vColor[s] = e.color,
            l.vMirror[s] = new Float32Array(e.nodeIdInfo.length),
            l.mcol0[s] = e.mcol0,
            l.mcol1[s] = e.mcol1,
            l.mcol2[s] = e.mcol2,
            l.mcol3[s] = e.mcol3,
            l.muvCol0[s] = [],
            l.muvCol1[s] = [],
            l.muvCol2[s] = [],
            l.userId[s] = [],
            l.nodeId[s] = [];
            for (var c = new M, h = [], d = 0, p = e.nodeIdInfo.length; p > d; d += 1)
                h = [],
                l.userId[s].push(e.componentKeyInfo[d]),
                l.nodeId[s].push(e.nodeIdInfo[d]),
                h.push(e.mcol0[3 * d]),
                h.push(e.mcol0[3 * d + 1]),
                h.push(e.mcol0[3 * d + 2]),
                h.push(0),
                h.push(e.mcol1[3 * d]),
                h.push(e.mcol1[3 * d + 1]),
                h.push(e.mcol1[3 * d + 2]),
                h.push(0),
                h.push(e.mcol2[3 * d]),
                h.push(e.mcol2[3 * d + 1]),
                h.push(e.mcol2[3 * d + 2]),
                h.push(0),
                h.push(e.mcol3[3 * d]),
                h.push(e.mcol3[3 * d + 1]),
                h.push(e.mcol3[3 * d + 2]),
                h.push(1),
                c.fromArray(h),
                0 > c.determinant() && (l.vMirror[s][d] = -1);
            this.getBufferAttributesBy(s);
            this.cacheBatchedInstanceGeometries(s, e);
            for (var g in e.componentInfo)
                if (e.componentInfo.hasOwnProperty(g))
                    for (var u = 0, f = e.componentInfo[g].length; f > u; u += 1) {
                        var m = e.componentInfo[g][u];
                        this.cacheNodeIdxByUserId(g, s, m);
                        var C = i.getNodeInfosByNodeId(e.nodeIdInfo[m]);
                        C && this.cacheMatrixInfoByUserId(g, s, {
                            matrix: C.matrix,
                            boundingBox: C.boundingBox
                        })
                    }
            this._makeInstanceNodeById(A, s, this.instanceGeometryMap[s])
        }
    }
    ,
    Pf.prototype.getBufferAttributesBy = function(A) {
        if (this.bufferAttributeMap[A])
            return this.bufferAttributeMap[A];
        var e = this.cachedInstance
          , t = new Oa(new Float32Array(e.mcol0[A]),3,!1,1)
          , i = new Oa(new Float32Array(e.mcol1[A]),3,!1,1)
          , o = new Oa(new Float32Array(e.mcol2[A]),3,!1,1)
          , n = new Oa(new Float32Array(e.mcol3[A]),3,!1,1)
          , r = []
          , a = []
          , s = [];
        if (e.muvCol0[A])
            for (var l = 0, c = e.muvCol0[A].length; c > l; l += 1)
                r.push(new Oa(new Float32Array(e.muvCol0[A][l]),2,!1,1)),
                a.push(new Oa(new Float32Array(e.muvCol1[A][l]),2,!1,1)),
                s.push(new Oa(new Float32Array(e.muvCol2[A][l]),2,!1,1));
        return this.bufferAttributeMap[A] = {
            attributeMcol0: t,
            attributeMcol1: i,
            attributeMcol2: o,
            attributeMcol3: n,
            attributeMuvCol0Array: r,
            attributeMuvCol1Array: a,
            attributeMuvCol2Array: s
        },
        this.bufferAttributeMap[A]
    }
    ,
    Pf.prototype._addInstanceNodeToScene = function(A, e, t) {
        this._getNodeGroup(A).add(t),
        t.updateMatrixWorld(!0),
        A.manager.addMeshToOctantMap(A.modelKey, e, new Bu(e,t))
    }
    ,
    Pf.prototype.addAllInstanceNodeToScene = function(A) {
        this.traverseInstanceNodeMap(null, (function(e, t) {
            for (var i = 0, o = t.length; o > i; i += 1)
                A.manager.addMeshToOctantMap(A._encodedDatabagId, e, new Bu(e,t[i]))
        }
        ))
    }
    ,
    Pf.prototype._makeInstanceNodeById = function(A, e, t) {
        var i = this.cachedInstance
          , o = A.materialManager
          , n = this.getMaterialIdByMeshId(e)
          , r = this.getBufferAttributesBy(e)
          , a = o.getInstanceMaterialById(n, A);
        this.instanceNodeMap[e] || (this.instanceNodeMap[e] = []);
        for (var s = this.instanceNodeMap[e], l = 0, c = t.length; c > l; l += 1) {
            t[l].setAttribute("mcol0", r.attributeMcol0),
            t[l].setAttribute("mcol1", r.attributeMcol1),
            t[l].setAttribute("mcol2", r.attributeMcol2),
            t[l].setAttribute("mcol3", r.attributeMcol3),
            r.attributeMuvCol0Array.length > 0 && (t[l].setAttribute("muvCol0", r.attributeMuvCol0Array[l]),
            t[l].setAttribute("muvCol1", r.attributeMuvCol1Array[l]),
            t[l].setAttribute("muvCol2", r.attributeMuvCol2Array[l])),
            t[l].setAttribute("aColor", new Oa(new Float32Array(i.vColor[e]),4,!1,1)),
            t[l].setAttribute("vState", new Oa(new Float32Array(i.vState[e]),1,!1,1)),
            t[l].setAttribute("vState2", new Oa(new Float32Array(i.vState[e]),1,!1,1)),
            t[l].setAttribute("vMirror", new Oa(new Float32Array(i.vMirror[e]),1,!1,1)),
            t[l].getAttribute("vState2").array.fill(Hc.HIDDEN);
            var h = t[l].index;
            t[l].addGroup(0, h.count, 0),
            t[l].addGroup(0, h.count, 1),
            a[1].visible = !1;
            var d = new Kf(t[l],a);
            if (d.visible = !0,
            d.modelKey = A.modelKey,
            d.frustumCulled = !1,
            s.push(d),
            !uh.isEmptyObject(A.subModel)) {
                var p = i.userId[e][0];
                if (p) {
                    var g = uh.getModelKeyFromComponentKey(p);
                    A.subModel[g] && d.matrix.copy(A.subModel[g])
                }
            }
            this._addInstanceNodeToScene(A, e, d)
        }
    }
    ,
    Pf.prototype._makeInstanceNodes = function(A) {
        Bh.time("makeInstanceNodes");
        var e = this;
        this.traverseInstanceGeometryMap((function(t, i) {
            e._makeInstanceNodeById(A, t, i)
        }
        )),
        Bh.timeEnd("makeInstanceNodes")
    }
    ,
    Pf.prototype.resetInstanceMaterial = function(A) {
        var e = this
          , t = A.materialManager;
        this.traverseInstanceGeometryMap((function(i, o) {
            var n = e.getMaterialIdByMeshId(i)
              , r = t.getInstanceMaterialById(n, A);
            r[0].visible = !0,
            r[1].visible = !1,
            r.splice(2, 1);
            for (var a = 0, s = o.length; s > a; a += 1) {
                if (o[a].getAttribute("vState").array.fill(Hc.NONE),
                o[0].removed)
                    for (var l in o[0].removed)
                        o[a].getAttribute("vState").array[l] = -1;
                o[a].getAttribute("vState").needsUpdate = !0,
                o[a].getAttribute("vState2").array.fill(Hc.HIDDEN),
                o[a].getAttribute("vState2").needsUpdate = !0,
                o[a].deleteAttribute("vState3"),
                o[a].groups.splice(2, 1)
            }
        }
        ))
    }
    ,
    Pf.prototype.clearInstanceStateByUserId = function(A) {
        function e(A, e, t, i) {
            for (var o = A.getAttribute("vState").array, n = A.getAttribute("vState2").array, r = 0, a = e.length; a > r; r += 1) {
                var s = e[r];
                o[s] = t,
                n[s] = i
            }
            A.getAttribute("vState").needsUpdate = !0,
            A.getAttribute("vState2").needsUpdate = !0
        }
        var t = this
          , i = Hc.NONE
          , o = Hc.HIDDEN;
        this.traverseNodeIdxMapByUserId(A, (function(A, n) {
            var r = t.getInstanceGeometries(A);
            if (r)
                for (var a = 0, s = r.length; s > a; a += 1)
                    e(r[a], n, i, o)
        }
        ))
    }
    ,
    Pf.prototype.updateInstanceStateByUserId = function(A, e, t, i) {
        function o(A, e, t, i, o, n, r) {
            var a = A.getAttribute("vState").array
              , s = A.getAttribute("vState2").array
              , l = A.getAttribute("aColor")
              , c = A.getAttribute("vState3")
              , h = null;
            null !== r && (c ? h = c.array : ((h = (c = A.getAttribute("vState").clone()).array).fill(Hc.HIDDEN),
            A.setAttribute("vState3", c)));
            for (var d = l ? l.array : null, p = 0; e.length > p; p += 1) {
                var g = e[p];
                a[g] = t,
                s[g] = i,
                h && (h[g] = r),
                null !== d && null !== o && (d[4 * g] = o[0],
                d[4 * g + 1] = o[1],
                d[4 * g + 2] = o[2],
                d[4 * g + 3] = o[3])
            }
            if (A.getAttribute("vState").needsUpdate = !0,
            A.getAttribute("vState2").needsUpdate = !0,
            c && (c.needsUpdate = !0),
            l && (l.needsUpdate = !0),
            n) {
                var u = !1
                  , f = !1;
                if (!n[0].visible)
                    if (t !== Hc.HIDDEN)
                        n[0].visible = !0;
                    else {
                        for (var m = 0, C = a.length; C > m; m += 1)
                            if (a[m] !== Hc.HIDDEN) {
                                u = !0;
                                break
                            }
                        n[0].visible = u
                    }
                if (!n[1].visible)
                    if (i !== Hc.HIDDEN)
                        n[1].visible = !0;
                    else {
                        for (var y = 0, v = s.length; v > y; y += 1)
                            if (s[y] !== Hc.HIDDEN) {
                                f = !0;
                                break
                            }
                        n[1].visible = f
                    }
            }
        }
        var n = A.materialManager
          , r = this;
        this.traverseNodeIdxMapByUserId(e, (function(a, s) {
            var l = r.getInstanceGeometries(a);
            r.getInstanceNodesById(a);
            if (l) {
                var c = null
                  , h = null
                  , d = null;
                if (t === Hc.HIDDEN) {
                    c = Hc.HIDDEN,
                    h = Hc.HIDDEN;
                    for (var p = 0, g = l.length; g > p; p += 1)
                        o(l[p], s, c, h, null, null)
                } else {
                    var u = r.getMaterialIdByMeshId(a)
                      , f = r.getUsableMaterialColorParamsBy(A, u, t, i)
                      , m = f.rgbaColor
                      , C = t;
                    t === Hc.TRANSPARENT && (C = Hc.OVERRIDED),
                    t === Hc.SELECTED && r.cacheSelectedObjectIds(e, a);
                    var y = n.getInstanceMaterialById(u, A)
                      , v = y[0];
                    if (v.transparent === f.transparent ? (c = C,
                    h = Hc.HIDDEN) : (c = Hc.HIDDEN,
                    h = C),
                    !0 === f.wireframe) {
                        var I = y[2] || Kd.createInstanceMaterial(Kd.getMaterialParameters(v));
                        I.wireframe = !0,
                        I.defines.INSTANCE_STATE_TERTIARY = "",
                        3 > y.length && y.push(I),
                        c = Hc.HIDDEN,
                        h = Hc.HIDDEN,
                        d = C
                    }
                    C === Hc.BLINK && v.setBlinkColor(A.manager.getBlinkColor());
                    for (p = 0,
                    g = l.length; g > p; p += 1) {
                        if (!0 === f.wireframe) {
                            var E = l[p].groups[0];
                            l[p].groups[2] = {
                                start: E.start,
                                count: E.count,
                                materialIndex: 2
                            }
                        }
                        o(l[p], s, c, h, m, y, d)
                    }
                }
            }
        }
        ))
    }
    ,
    Pf.prototype.getUsableMaterialColorParamsBy = function(A, e, t, i) {
        var o = A.selectedMaterial
          , n = A.manager.filter._getMaterialByName("scene")
          , r = A.materialManager
          , a = A.manager.getOverrideMaterialByName(e) || r.getMaterialById(e)
          , s = null
          , l = null;
        switch (t) {
        case Hc.HOVER:
            i ? (s = A.manager.filter._getMaterialByName(i),
            l = A.manager.sceneState.getHoverColorByMaterial(s)) : l = A.manager.sceneState.getHoverColorByMaterial(a);
            break;
        case Hc.SELECTED:
            l = Kd.getColorParamsByMaterial(o);
            break;
        case Hc.TRANSPARENT:
            l = Kd.getColorParamsByMaterial(n);
            break;
        case Hc.OVERRIDED:
        case Hc.BLINK:
            i ? (s = A.manager.filter._getMaterialByName(i),
            l = Kd.getColorParamsByMaterial(s)) : l = Kd.getColorParamsByMaterial(a)
        }
        return l
    }
    ,
    Pf.prototype.getInstanceNodesById = function(A) {
        return this.instanceNodeMap[A]
    }
    ,
    Pf.prototype.traverseInstanceNodeMap = function(A, e) {
        for (var t = this.instanceNodeMap, i = 0, o = (A = A || Object.keys(this.instanceNodeMap)).length; o > i; i += 1) {
            var n = A[i];
            e(n, t[n])
        }
    }
    ,
    Pf.prototype.getInstanceGeometries = function(A) {
        return this.instanceGeometryMap[A]
    }
    ,
    Pf.prototype.cacheInstanceGeometries = function(A, e) {
        if (!this.instanceGeometryMap[A]) {
            var t = this.instanceGeometryMap[A] = [];
            e instanceof Array || (e = [e]);
            for (var i = 0, o = e.length; o > i; i += 1)
                t[i] = new Na,
                t[i].setIndex(e[i].index),
                e[i].attributes.position && t[i].setAttribute("position", e[i].attributes.position),
                e[i].attributes.normal && t[i].setAttribute("normal", e[i].attributes.normal),
                e[i].attributes.uv && t[i].setAttribute("uv", e[i].attributes.uv),
                e[i].attributes.uv2 && t[i].setAttribute("uv2", e[i].attributes.uv2)
        }
    }
    ,
    Pf.prototype.cacheBatchedInstanceGeometries = function(A, e) {
        if (this.instanceGeometryMap[A])
            return this.instanceGeometryMap[A][0];
        var t = this.instanceGeometryMap[A] = []
          , i = new Na;
        return t[0] = i,
        i.setIndex(new YA(e.index,1)),
        e.position && e.position.length > 0 && i.setAttribute("position", new YA(e.position,3)),
        e.normal && e.normal.length === e.position.length && i.setAttribute("normal", new YA(e.normal,3)),
        e.uv && e.uv.length > 0 && i.setAttribute("uv", new YA(e.uv,2)),
        e.hasUV2 && i.getAttribute("uv") && i.setAttribute("uv2", i.getAttribute("uv")),
        i.getAttribute("normal") || i.computeVertexNormals(),
        i
    }
    ,
    Pf.prototype.traverseInstanceGeometryMap = function(A) {
        var e = this.instanceGeometryMap;
        for (var t in e)
            A(t, e[t])
    }
    ,
    Pf.prototype.disposeInstanceGeometries = function() {
        this.traverseInstanceGeometryMap((function(A, e) {
            for (var t = 0, i = e.length; i > t; t += 1)
                e[t].dispose()
        }
        ))
    }
    ,
    Pf.prototype.cacheInstanceAttributeStateBy = function(A, e, t, i, o) {
        var n = i.materialId;
        t instanceof Array || (t = [t]);
        var r = t.length
          , a = this.cachedInstance;
        if (!a.vState[e]) {
            a.vState[e] = [],
            a.vColor[e] = [],
            a.vMirror[e] = [],
            a.mcol0[e] = [],
            a.mcol1[e] = [],
            a.mcol2[e] = [],
            a.mcol3[e] = [],
            a.muvCol0[e] = [],
            a.muvCol1[e] = [],
            a.muvCol2[e] = [],
            a.userId[e] = [],
            a.nodeId[e] = [];
            for (var s = 0; r > s; s += 1)
                a.muvCol0[e][s] = [],
                a.muvCol1[e][s] = [],
                a.muvCol2[e][s] = []
        }
        var l = o || A.materialManager.getMaterialById(n);
        a.userId[e].push(i.userId),
        a.nodeId[e].push(i.nodeId),
        a.vColor[e].push(l.color.r, l.color.g, l.color.b, l.opacity),
        a.vState[e].push(0);
        var c = i.matrix.elements;
        return a.mcol0[e].push(c[0], c[1], c[2]),
        a.mcol1[e].push(c[4], c[5], c[6]),
        a.mcol2[e].push(c[8], c[9], c[10]),
        a.mcol3[e].push(c[12], c[13], c[14]),
        0 > i.matrix.determinant() ? a.vMirror[e].push(-1) : a.vMirror[e].push(0),
        a.vState[e].length - 1
    }
    ,
    Pf.prototype.cacheNodeIdxByUserId = function(A, e, t) {
        var i = this.nodeIdxMapFromUserId;
        i[A] || (i[A] = {}),
        i[A][e] || (i[A][e] = []),
        i[A][e].push(t)
    }
    ,
    Pf.prototype.getNodeIdxMapByUserId = function(A) {
        return this.nodeIdxMapFromUserId[A]
    }
    ,
    Pf.prototype.traverseNodeIdxMapByUserId = function(A, e) {
        var t = this.nodeIdxMapFromUserId[A];
        for (var i in t)
            e(i, t[i])
    }
    ,
    Pf.prototype.traverseNodeIdxMap = function(A, e) {
        for (var t = Object.keys(this.nodeIdxMapFromUserId), i = 0, o = t.length; o > i; i += 1) {
            var n = t[i]
              , r = this.nodeIdxMapFromUserId[n];
            if (!e || !e(n))
                for (var a in r)
                    A(a, r[a])
        }
    }
    ,
    Pf.prototype.cacheMatrixInfoByUserId = function(A, e, t) {
        var i = this.matrixInfoMapFromUserId;
        i[A] || (i[A] = {}),
        i[A][e] || (i[A][e] = []),
        i[A][e].push(t)
    }
    ,
    Pf.prototype.traverseMatrixInfoMapByUserId = function(A, e) {
        var t = this.matrixInfoMapFromUserId[A];
        for (var i in t)
            e(i, t[i])
    }
    ,
    Pf.prototype.getMeshesByUserId = function(A, e) {
        var t = this
          , i = [];
        return this.traverseMatrixInfoMapByUserId(e, (function(e, o) {
            for (var n = t.getInstanceNodesById(e), r = 0, a = o.length; a > r; r += 1)
                for (var s = 0, l = n.length; l > s; s += 1) {
                    var c = {};
                    if (c.matrix = A.getModelMatrix().clone().multiply(o[r].matrix),
                    c.mesh = n[s],
                    1 === l)
                        c.boundingBox = o[r].boundingBox;
                    else {
                        var h = c.mesh.geometry.boundingBox;
                        h ? h = h.clone() : (c.mesh.geometry.computeBoundingBox(),
                        h = c.mesh.geometry.boundingBox.clone()),
                        h.applyMatrix4(c.matrix),
                        c.boundingBox = h
                    }
                    i.push(c)
                }
        }
        )),
        i
    }
    ,
    Pf.prototype._getNodeGroup = function(A) {
        return A._getNodeGroup(gp.INSTANCEGEOMETRY, {
            globalSpace: !0
        })
    }
    ,
    Pf.prototype._hasNodeGroup = function(A) {
        return A._hasNodeGroup(gp.INSTANCEGEOMETRY)
    }
    ,
    Pf.prototype.clearSelectedObjectIds = function() {
        this.selectedObjectIds.length = 0
    }
    ,
    Pf.prototype.cacheSelectedObjectIds = function(A, e) {
        this.selectedObjectIds.push({
            uid: A,
            mgId: e
        })
    }
    ,
    Pf.prototype.adjustVisibility = function(A, e) {
        var t = this._getNodeGroup(A)
          , i = t.visible;
        e && !t.bVisible || (t.visible = e),
        t.bVisible = i
    }
    ,
    Pf.prototype.changeVisibilityOfSelectedObjects = function(A, e) {
        var t = null;
        if (e)
            for (var i = 0, o = (t = this.selectedMeshes).length; o > i; i += 1) {
                var n = t[i].object
                  , r = t[i].indices;
                if (r) {
                    if (r.length) {
                        for (var a = n.geometry.getAttribute("vState").array, s = n.geometry.getAttribute("vState2").array, l = 0, c = r.length; c > l; l += 1)
                            r[l].state ? a[r[l].idx] = r[l].state : r[l].state2 && (s[r[l].idx] = r[l].state2);
                        n.geometry.getAttribute("vState").needsUpdate = !0,
                        n.geometry.getAttribute("vState2").needsUpdate = !0
                    }
                } else
                    n.visible = t[i].visibility
            }
        else {
            this.selectedMeshes.length = 0,
            t = this.selectedMeshes;
            for (var h = {}, d = 0, p = this.selectedObjectIds.length; p > d; d += 1)
                h[this.selectedObjectIds[d].mgId] = !0;
            var g = Object.keys(h);
            this.traverseInstanceNodeMap(g, (function(A, e) {
                for (var i = 0, o = e.length; o > i; i += 1) {
                    for (var n = e[i], r = [], a = n.geometry.getAttribute("vState").array, s = n.geometry.getAttribute("vState2").array, l = 0, c = a.length; c > l; l += 1)
                        a[l] === Hc.SELECTED ? (r.push({
                            idx: l,
                            state: a[l]
                        }),
                        a[l] = Hc.HIDDEN) : s[l] === Hc.SELECTED && (r.push({
                            idx: l,
                            state2: s[l]
                        }),
                        s[l] = Hc.HIDDEN);
                    r.length ? (n.geometry.getAttribute("vState").needsUpdate = !0,
                    n.geometry.getAttribute("vState2").needsUpdate = !0,
                    t.push({
                        object: n,
                        indices: r
                    })) : (t.push({
                        object: n,
                        indices: null,
                        visibility: n.visible
                    }),
                    n.visible = !1)
                }
            }
            ))
        }
    }
    ,
    Pf.prototype.changeVisibilityOfNonSelectedObjects = function(A, e) {
        var t = null;
        if (e)
            for (var i = 0, o = (t = this.nonSelectedMeshes).length; o > i; i += 1) {
                var n = t[i].object
                  , r = t[i].indices;
                if (r) {
                    if (r.length) {
                        for (var a = n.geometry.getAttribute("vState").array, s = n.geometry.getAttribute("vState2").array, l = 0, c = r.length; c > l; l += 1)
                            void 0 !== r[l].state ? a[r[l].idx] = r[l].state : void 0 !== r[l].state2 && (s[r[l].idx] = r[l].state2);
                        n.geometry.getAttribute("vState").needsUpdate = !0
                    }
                } else
                    n.visible = t[i].visibility
            }
        else {
            this.nonSelectedMeshes.length = 0,
            t = this.nonSelectedMeshes;
            for (var h = {}, d = 0, p = this.selectedObjectIds.length; p > d; d += 1)
                h[this.selectedObjectIds[d].mgId] = !0;
            this.traverseInstanceNodeMap(null, (function(A, e) {
                if (h[A])
                    for (var i = 0, o = e.length; o > i; i += 1) {
                        for (var n = [], r = (p = e[i]).geometry.getAttribute("vState").array, a = p.geometry.getAttribute("vState2").array, s = 0, l = r.length; l > s; s += 1)
                            r[s] !== Hc.SELECTED && r[s] !== Hc.HIDDEN ? (n.push({
                                idx: s,
                                state: r[s]
                            }),
                            r[s] = Hc.HIDDEN) : a[s] !== Hc.SELECTED && a[s] !== Hc.HIDDEN && (n.push({
                                idx: s,
                                state2: a[s]
                            }),
                            a[s] = Hc.HIDDEN);
                        n.length && (p.geometry.getAttribute("vState").needsUpdate = !0,
                        p.geometry.getAttribute("vState2").needsUpdate = !0,
                        t.push({
                            object: p,
                            indices: n
                        }))
                    }
                else
                    for (var c = 0, d = e.length; d > c; c += 1) {
                        var p;
                        t.push({
                            object: p = e[c],
                            indices: null,
                            visibility: p.visible
                        }),
                        p.visible = !1
                    }
            }
            ))
        }
    }
    ,
    Pf.prototype.restoreVisibilityOfObjects = function() {
        this.selectedMeshes.length = 0,
        this.nonSelectedMeshes.length = 0
    }
    ,
    Pf.prototype.getMeshIdByNodeInfo = function(A) {
        return uh.getCombinedKeyString([A.materialId, A.geometryId])
    }
    ,
    Pf.prototype.getMaterialIdByMeshId = function(A) {
        return uh.splitCombinedKeyString(A)[0]
    }
    ,
    Pf.prototype.getOriginalMaterialIdByMeshId = function(A) {
        var e = uh.splitCombinedKeyString(A);
        return uh.splitCombinedKeyString(e[0], "_")[0]
    }
    ,
    Pf.prototype.disposeBufferAfterVbo = function() {
        if (!this.bufferDestroyed) {
            this.bufferDestroyed = !0;
            var A = ["muvCol0", "muvCol1", "muvCol2", "mcol0", "mcol1", "mcol2", "mcol3"];
            vc.EnableExplosion && A.pop(),
            this.traverseInstanceGeometryMap((function(e, t) {
                for (var i = 0, o = t.length; o > i; i += 1)
                    Tu.disposeBufferFromGeometry(t[i], A)
            }
            ))
        }
    }
    ,
    Pf.prototype.getGeometryBuffersByUserId = function(A, e) {
        var t = A.getModelDescriptor().getInstancedNodeInfosById(e);
        if (!t)
            return [];
        for (var i = [], o = A.getDatabagId(), n = 0, r = t.length; r > n; n += 1) {
            var a = t[n]
              , s = this.getGeometryByNodeInfo(A, a)
              , l = this._isLines(a);
            if (s instanceof Array)
                for (var c = 0, h = s.length; h > c; c += 1)
                    i.push({
                        isLines: l,
                        databagId: o,
                        nodeId: a.nodeId,
                        position: s[c].getAttribute("position").array,
                        index: s[c].getIndex().array,
                        matrix: a.matrix
                    });
            else
                i.push({
                    databagId: o,
                    nodeId: a.nodeId,
                    position: s.getAttribute("position").array,
                    index: s.getIndex().array,
                    matrix: a.matrix
                })
        }
        return i
    }
    ,
    Pf.prototype.explode = function(A, e, t) {
        var i = this;
        for (var o in i.nodeIdxMapFromUserId)
            i.traverseNodeIdxMapByUserId(o, (function(n, r) {
                var a = A.manager.getComponentInfoByUserId(o).boundingBox
                  , s = uh.computeExplodeTranslation(e, a, t)
                  , l = i.getInstanceGeometries(n);
                l && Gf(l[0], r, s)
            }
            ))
    }
    ,
    Pf.prototype.explosion = function(A, e) {
        var t = Object.keys(this.nodeIdxMapFromUserId);
        e.componentKey = t,
        this.componentsExplosion(A, e)
    }
    ,
    Pf.prototype.closeExplosion = function(A) {
        this.explosion(A, {})
    }
    ,
    Pf.prototype.componentsExplosion = function(A, e) {
        var t = e.coefficientX || 1
          , i = e.coefficientY || 1
          , o = e.coefficientZ || 1
          , n = e.offsetX || 0
          , r = e.offsetY || 0
          , a = e.offsetZ || 0
          , s = null;
        if (e.center)
            s = (new y).fromArray(e.center);
        else if (1 !== t || 1 !== i || 1 !== o || 0 !== n || 0 !== r || 0 !== a)
            return;
        var l = Array.isArray(e.componentKey) ? e.componentKey : [e.componentKey]
          , c = new y
          , h = new aA
          , d = new y(0,0,0)
          , p = new y(0,0,0)
          , g = new y
          , u = new M
          , m = A.getModelMatrix();
        m && s && (u.getInverse(m),
        s.applyMatrix4(u));
        var C = A.manager
          , v = !1
          , I = new y
          , E = new f
          , B = new y(1,1,1);
        uh.isEmptyObject(A.subModel) || (v = !0);
        for (var x = 0, S = l.length; S > x; x += 1) {
            var w = l[x];
            if (w) {
                var b = A.getModelDescriptor().getInstancedNodeInfosById(w);
                if (b)
                    for (var U = this.nodeIdxMapFromUserId[w], F = 0, K = b.length; K > F; F += 1) {
                        var Q = b[F];
                        if (Q) {
                            var R = Q.materialId + "&" + Q.geometryId
                              , T = new y(1,1,1);
                            if (v)
                                this.getInstanceNodesById(R)[0].matrix.decompose(I, E, B),
                                T.divide(B);
                            if (h.copy(Q.boundingBox),
                            h.getCenter(c),
                            Q.userData || (Q.userData = {}),
                            d.set(0, 0, 0),
                            p.set(0, 0, 0),
                            1 !== t || 1 !== i || 1 !== o || Q.userData.explosionFactor) {
                                Q.userData.explosionFactor || (Q.userData.explosionFactor = new y(1,1,1),
                                Q.userData.explosionBaseDifference = c.sub(s).clone().multiply(T));
                                var k = Q.userData.explosionFactor
                                  , D = Q.userData.explosionBaseDifference;
                                d.set((t - k.x) * D.x, (i - k.y) * D.y, (o - k.z) * D.z),
                                1 === t && 1 === i && 1 === o ? (Q.userData.explosionFactor = void 0,
                                Q.userData.explosionBaseDifference = void 0) : k.set(t, i, o)
                            }
                            if (0 !== n || 0 !== r || 0 !== a || Q.userData.explosionOffset) {
                                Q.userData.explosionOffset || (Q.userData.explosionOffset = new y(0,0,0));
                                var L = Q.userData.explosionOffset;
                                p.set(n * T.x - L.x, r * T.y - L.y, a * T.z - L.z),
                                0 === n && 0 === r && 0 === a ? Q.userData.explosionOffset = void 0 : L.set(n * T.x, r * T.y, a * T.z)
                            }
                            if (g.set(d.x + p.x, d.y + p.y, d.z + p.z),
                            0 !== g.x || 0 !== g.y || 0 !== g.z) {
                                Q.userData.explosionFactor || Q.userData.explosionOffset ? C.explosionList[w] || (C.explosionList[w] = !0) : delete C.explosionList[w];
                                var N = g.clone().multiply(B)
                                  , O = u;
                                v && (O = u.clone()).makeTranslation(g.x, g.y, g.z),
                                u.makeTranslation(N.x, N.y, N.z),
                                Q.transformation || (Q.transformation = !0,
                                Q.transformationOriginalMatrix = Q.matrix.clone(),
                                Q.applyMatrix = new M,
                                Q.transformationOriginalBoundingBox = Q.boundingBox.clone()),
                                Q.matrix.premultiply(O),
                                Q.applyMatrix.premultiply(u),
                                Q.boundingBox.copy(Q.transformationOriginalBoundingBox).applyMatrix4(Q.applyMatrix);
                                var V = Q.matrix
                                  , G = U[R]
                                  , P = this.getInstanceGeometries(R);
                                if (P) {
                                    var q = P[0]
                                      , j = q.getAttribute("mcol0")
                                      , H = q.getAttribute("mcol1")
                                      , Y = q.getAttribute("mcol2")
                                      , W = q.getAttribute("mcol3")
                                      , J = G[0];
                                    j.array[3 * J] = V.elements[0],
                                    j.array[3 * J + 1] = V.elements[1],
                                    j.array[3 * J + 2] = V.elements[2],
                                    j.needsUpdate = !0,
                                    H.array[3 * J] = V.elements[4],
                                    H.array[3 * J + 1] = V.elements[5],
                                    H.array[3 * J + 2] = V.elements[6],
                                    H.needsUpdate = !0,
                                    Y.array[3 * J] = V.elements[8],
                                    Y.array[3 * J + 1] = V.elements[9],
                                    Y.array[3 * J + 2] = V.elements[10],
                                    Y.needsUpdate = !0,
                                    W.array[3 * J] = V.elements[12],
                                    W.array[3 * J + 1] = V.elements[13],
                                    W.array[3 * J + 2] = V.elements[14],
                                    W.needsUpdate = !0
                                }
                            }
                        }
                    }
            }
        }
    }
    ,
    Pf.prototype.closeComponentsExplosion = function(A, e) {
        e = Array.isArray(e) ? e : [e];
        this.componentsExplosion(A, {
            componentKey: e
        })
    }
    ,
    Pf.prototype._isLines = function(A) {
        return A.type === $u.EnumNodeItemType.LINE
    }
    ,
    Pf.prototype.getPickingNodeGenerator = function() {
        return this.pickingNodeGenerator || (this.pickingNodeGenerator = new Vf(this)),
        this.pickingNodeGenerator
    }
    ,
    Pf.prototype.calculateClippingIds = function(A, e) {
        var t = this;
        for (var i in t.nodeIdxMapFromUserId)
            this.traverseMatrixInfoMapByUserId(i, (function(i, o) {
                for (var n = t.getInstanceNodesById(i), r = 0, a = o.length; a > r; r += 1)
                    for (var s = 0, l = n.length; l > s; s += 1)
                        n[s].intersectBoxWithClipPlane(A, o[r]) && n[s].getIntersectionPoints(A, o[r], e, !0)
            }
            ))
    }
    ;
    var qf = function(A) {
        of.call(this, A),
        this.nodeGroupName = "PickingInstancedWireFrameGroup"
    };
    Object.assign(qf.prototype, of.prototype),
    eu(qf, [{
        key: "generatePickingMeshes",
        value: function() {
            this.manager.generateWireframe(),
            this.manager.updateNodes();
            var A = this
              , e = this.manager
              , t = e.manager.getCachedInstanceData()
              , i = !vc.BatchMergeEnabled;
            e._traverseWireframeGeometryMap((function(o, n) {
                for (var r = [], a = e._getWireframeMeshById(o), s = 0, l = n.length; l > s; s += 1) {
                    var c = n[s]
                      , h = new Na
                      , d = a[s];
                    h.setAttribute("position", c.getAttribute("position")),
                    h.setAttribute("mcol0", c.getAttribute("mcol0")),
                    h.setAttribute("mcol1", c.getAttribute("mcol1")),
                    h.setAttribute("mcol2", c.getAttribute("mcol2")),
                    h.setAttribute("mcol3", c.getAttribute("mcol3")),
                    h.setAttribute("vState", new Oa(new Float32Array(t.vState[o]),1,!1,1)),
                    h.setIndex(c.getIndex());
                    var p = new jo(h,Kd.DefaultMaterial);
                    d.matrixWorld.decompose(p.position, p.quaternion, p.scale),
                    p.name = o,
                    p.frustumCulled = !1,
                    p.renderOrder = i ? 0 : 1,
                    r.push(p)
                }
                A.addToPickingNodeMap(o, r)
            }
            ))
        }
    }, {
        key: "updatePickingMeshesState",
        value: function(A, e, t) {
            if (this.pickingNodeMap)
                for (var i = this.manager.manager, o = this.pickingNodeMap, n = 0, r = e.length; r > n; n += 1) {
                    var a = e[n];
                    if (i.isPickableNode(a)) {
                        var s = i.getMeshManager().getNodeIdxMapByUserId(a);
                        if (s)
                            for (var l = Object.keys(s), c = 0, h = l.length; h > c; c += 1) {
                                var d = l[c]
                                  , p = o[d];
                                if (p)
                                    for (var g = s[d], u = 0, f = p.length; f > u; u += 1) {
                                        var m = p[u];
                                        m.material = A,
                                        m.visible = !0;
                                        for (var C = m.geometry, y = C.getAttribute("vState").array, v = 0, I = g.length; I > v; v += 1)
                                            y[g[v]] = Hc.NONE;
                                        C.getAttribute("vState").needsUpdate = !0
                                    }
                            }
                    }
                }
        }
    }, {
        key: "resetPickingMeshesState",
        value: function() {
            if (this.pickingNodeMap)
                for (var A = this.pickingNodeMap, e = Object.keys(A), t = 0, i = e.length; i > t; t += 1)
                    for (var o = A[e[t]], n = 0, r = o.length; r > n; n += 1)
                        o[n].visible = !1,
                        o[n].geometry.getAttribute("vState").array.fill(Hc.HIDDEN),
                        o[n].geometry.getAttribute("vState").needsUpdate = !0
        }
    }]);
    var jf = function(A) {
        this.manager = A,
        this.model = A.model,
        this.wireframeGeometryMap = {},
        this.wireframeMeshMap = {},
        this.noNeedWireframingIdMap = {},
        this.generated = !1
    };
    jf.prototype.destroy = function() {
        this.disposeGeometries(),
        this.wireframeGeometryMap = null,
        this.noNeedWireframingIdMap = null,
        this.manager = null
    }
    ,
    jf.prototype.clearData = function() {
        this.generated = !1,
        this.bufferDestroyed = !1,
        this.wireframeMesh = {},
        this.disposeGeometries(),
        this.wireframeGeometryMap = {},
        this.noNeedWireframingIdMap = {}
    }
    ,
    jf.prototype.disposeGeometries = function() {
        this._traverseWireframeGeometryMap((function(A, e) {
            for (var t = 0, i = e.length; i > t; t += 1)
                e[t].dispose()
        }
        ))
    }
    ,
    jf.prototype.updateNodes = function(A) {
        A || (A = this.model);
        var e = null;
        A.isActivateWireframe() ? (this.generateWireframe(A),
        (e = this._getNodeGroup(A)).updateMatrixWorld(!0),
        e.visible = !0) : this._hasNodeGroup(A) && ((e = this._getNodeGroup(A)).visible = !1)
    }
    ,
    jf.prototype.resetInstanceMaterial = function() {
        var A = Hc.NONE;
        this._traverseWireframeGeometryMap((function(e, t) {
            for (var i = 0, o = t.length; o > i; i += 1) {
                for (var n = t[i].getAttribute("vState").array, r = 0, a = n.length; a > r; r += 1)
                    n[r] = A;
                t[i].getAttribute("vState").needsUpdate = !0
            }
        }
        )),
        this._updateNoWireframingState()
    }
    ,
    jf.prototype.updateInstanceWireframeByUserId = function(A, e, t, i) {
        if (t === Hc.HIDDEN || t === Hc.NONE || t === Hc.OVERRIDED) {
            var o = null;
            if (i) {
                var n = A.getFilter()._getMaterialByName(i)
                  , r = Kd.getColorParamsByMaterial(n);
                o = r.rgbaColor
            }
            var a = this;
            this.manager.traverseNodeIdxMapByUserId(e, (function(A, e) {
                a._setInstanceWireframeState(A, e, t, o)
            }
            ))
        }
    }
    ,
    jf.prototype._updateNoWireframingState = function() {
        var A = this
          , e = Hc.HIDDEN;
        this.manager.traverseNodeIdxMap((function(t, i) {
            A._setInstanceWireframeState(t, i, e)
        }
        ), (function(e) {
            return A._isNeedWireframing(e)
        }
        ))
    }
    ,
    jf.prototype._setInstanceWireframeState = function(A, e, t, i) {
        var o = this._getWireframeGeometryById(A);
        if (o)
            for (var n = 0, r = o.length; r > n; n += 1) {
                var a = o[n].getAttribute("vState").array
                  , s = null
                  , l = null;
                i && (l = (s = o[n].getAttribute("aColor")) ? s.array : null);
                for (var c = 0, h = e.length; h > c; c += 1) {
                    var d = e[c];
                    a[d] = t,
                    null !== l && (l[4 * d] = i[0],
                    l[4 * d + 1] = i[1],
                    l[4 * d + 2] = i[2],
                    l[4 * d + 3] = i[3])
                }
                o[n].getAttribute("vState").needsUpdate = !0,
                s && (s.needsUpdate = !0)
            }
    }
    ,
    jf.prototype._generateInstanceWireframe = function(A) {
        A || (A = this.model),
        this._collectNoWireframingIds(A),
        this._createInstanceWireframeGeometries(A),
        this._makeInstanceWireframe(A),
        this._updateNoWireframingState()
    }
    ,
    jf.prototype.generateWireframe = function(A) {
        A || (A = this.model),
        this.generated || (Bh.time("createInstancedWireframeGeometry"),
        this._generateInstanceWireframe(A),
        Bh.timeEnd("createInstancedWireframeGeometry"),
        this.generated = !0)
    }
    ,
    jf.prototype._collectNoWireframingIds = function(A) {
        var e = this
          , t = A.manager.filter;
        A.getModelDescriptor().traverseInstancedNodeInfos(null, (function(A, i) {
            i && t._hasRenderWithBoardlineFilter() && !t._isRenderWithBoardline(i[0]) && (e.noNeedWireframingIdMap[A] = !0)
        }
        ))
    }
    ,
    jf.prototype._createInstanceWireframeGeometries = function(A) {
        var e = this
          , t = {};
        this.manager.traverseInstanceGeometryMap((function(A, i) {
            for (var o = e._getWireframeBufferById(A, i, t), n = e.wireframeGeometryMap[A] = [], r = 0, a = o.length; a > r; r += 1) {
                var s = new Na;
                s.setIndex(o[r].index),
                s.setAttribute("position", o[r].position),
                n.push(s)
            }
        }
        )),
        t = null
    }
    ,
    jf.prototype._makeInstanceWireframe = function(A) {
        var e = this
          , t = this.manager
          , i = t.getCachedInstanceData()
          , o = this._getWireframeMaterial(A);
        this._traverseWireframeGeometryMap((function(n, r) {
            for (var a = t.getBufferAttributesBy(n), s = e.wireframeMeshMap[n] = [], l = 0, c = r.length; c > l; l += 1) {
                r[l].setAttribute("vState", new Oa(new Float32Array(i.vState[n]),1,!1,1)),
                r[l].setAttribute("mcol0", a.attributeMcol0),
                r[l].setAttribute("mcol1", a.attributeMcol1),
                r[l].setAttribute("mcol2", a.attributeMcol2),
                r[l].setAttribute("mcol3", a.attributeMcol3);
                var h = new jo(r[l],o);
                if (h.matrixAutoUpdate = !1,
                h.frustumCulled = !1,
                !uh.isEmptyObject(A.subModel)) {
                    var d = i.userId[n][0];
                    if (d) {
                        var p = uh.getModelKeyFromComponentKey(d);
                        A.subModel[p] && h.matrix.copy(A.subModel[p])
                    }
                }
                s.push(h),
                e._addWireframeNodeToScene(A, h)
            }
        }
        ))
    }
    ,
    jf.prototype._addWireframeNodeToScene = function(A, e) {
        this._getNodeGroup(A).add(e),
        e.updateMatrixWorld(!0)
    }
    ,
    jf.prototype._isNeedWireframing = function(A) {
        return !this.noNeedWireframingIdMap || !this.noNeedWireframingIdMap[A]
    }
    ,
    jf.prototype._getWireframeMaterial = function(A) {
        return A.getInstanceWireframeMaterial()
    }
    ,
    jf.prototype._getWireframeBufferById = function(A, e, t) {
        var i = this.getGeometryIdByMeshId(A);
        if (t[i])
            return t[i];
        t[i] = [];
        for (var o = 0, n = e.length; n > o; o += 1) {
            var r = e[o];
            t[i].push({
                index: Up(r.attributes.position.array, r.index.array),
                position: r.attributes.position
            })
        }
        return t[i]
    }
    ,
    jf.prototype._getWireframeGeometryById = function(A) {
        return this.wireframeGeometryMap[A]
    }
    ,
    jf.prototype._getWireframeMeshById = function(A) {
        return this.wireframeMeshMap[A]
    }
    ,
    jf.prototype._traverseWireframeGeometryMap = function(A) {
        var e = this.wireframeGeometryMap;
        for (var t in e)
            A(t, e[t])
    }
    ,
    jf.prototype._getNodeGroup = function(A) {
        return A._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
            globalSpace: !0
        })
    }
    ,
    jf.prototype._hasNodeGroup = function(A) {
        return A._hasNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY)
    }
    ,
    jf.prototype.getGeometryIdByMeshId = function(A) {
        return uh.splitCombinedKeyString(A)[1]
    }
    ,
    jf.prototype.adjustVisibility = function(A, e) {
        if (A.isActivateWireframe()) {
            var t = this._getNodeGroup(A)
              , i = t.visible;
            e && !t.bVisible || (t.visible = e),
            t.bVisible = i
        }
    }
    ,
    jf.prototype.changeVisibilityOfSelectedObjects = function(A, e) {}
    ,
    jf.prototype.changeVisibilityOfNonSelectedObjects = function(A, e) {
        this.adjustVisibility(A, e)
    }
    ,
    jf.prototype.restoreVisibilityOfObjects = function() {}
    ,
    jf.prototype.disposeBufferAfterVbo = function() {
        if (this.generated && !this.bufferDestroyed) {
            this.bufferDestroyed = !0;
            var A = ["mcol0", "mcol1", "mcol2", "mcol3"];
            vc.EnableExplosion && A.pop(),
            this._traverseWireframeGeometryMap((function(e, t) {
                for (var i = 0, o = t.length; o > i; i += 1)
                    Tu.disposeBufferFromGeometry(t[i], A)
            }
            ))
        }
    }
    ,
    jf.prototype.getPickingNodeGenerator = function() {
        return this.pickingNodeGenerator || (this.pickingNodeGenerator = new qf(this)),
        this.pickingNodeGenerator
    }
    ;
    var Hf = function(A) {
        this.model = A,
        this.meshManager = new Pf(this),
        this.wireframeManager = new jf(this)
    };
    Hf.prototype.destroy = function() {
        this.meshManager.destroy(),
        this.meshManager = null,
        this.wireframeManager.destroy(),
        this.wireframeManager = null
    }
    ,
    Hf.prototype.clearData = function() {
        this.meshManager.clearData(),
        this.wireframeManager.clearData()
    }
    ,
    Hf.prototype.getGeometryByNodeInfo = function(A, e) {
        return this.meshManager.getGeometryByNodeInfo(A, e)
    }
    ,
    Hf.prototype.getInstanceGeometries = function() {
        return this.meshManager.instanceGeometryMap
    }
    ,
    Hf.prototype.traverseInstanceGeometryMap = function(A) {
        this.meshManager.traverseInstanceGeometryMap(A)
    }
    ,
    Hf.prototype.getCachedInstanceData = function() {
        return this.meshManager.cachedInstance
    }
    ,
    Hf.prototype.getBufferAttributesBy = function(A) {
        return this.meshManager.getBufferAttributesBy(A)
    }
    ,
    Hf.prototype.traverseNodeIdxMapByUserId = function(A, e) {
        this.meshManager.traverseNodeIdxMapByUserId(A, e)
    }
    ,
    Hf.prototype.traverseNodeIdxMap = function(A, e) {
        this.meshManager.traverseNodeIdxMap(A, e)
    }
    ,
    Hf.prototype.getMeshesByUserId = function(A, e) {
        return this.meshManager.getMeshesByUserId(A, e)
    }
    ,
    Hf.prototype._updateInstanceMaterialByUserId = function(A, e, t, i) {
        this.meshManager.updateInstanceStateByUserId(A, e, t, i)
    }
    ,
    Hf.prototype._updateInstanceMaterialForWireFrameByUserId = function(A, e, t, i) {
        this.wireframeManager.updateInstanceWireframeByUserId(A, e, t, i)
    }
    ,
    Hf.prototype._updateInstanceMaterial = function(A) {
        Bh.time("update instance material");
        var e = zc;
        for (var t in this.clearSelectedObjectIds(),
        this.filteredIds) {
            var i = this.filteredIds[t];
            if (i[e.HIDDEN])
                this._updateInstanceMaterialByUserId(A, t, Hc.HIDDEN),
                this._updateInstanceMaterialForWireFrameByUserId(A, t, Hc.HIDDEN);
            else if (i[e.TRANSPARENT])
                this._updateInstanceMaterialByUserId(A, t, Hc.TRANSPARENT);
            else {
                if (A.manager.isSelectPriority()) {
                    if (i[e.SELECTED]) {
                        this._updateInstanceMaterialByUserId(A, t, Hc.SELECTED);
                        continue
                    }
                    if (i[e.BLINK]) {
                        i[e.OVERRIDED] ? this._updateInstanceMaterialByUserId(A, t, Hc.BLINK, i[e.OVERRIDED]) : this._updateInstanceMaterialByUserId(A, t, Hc.BLINK);
                        continue
                    }
                } else {
                    if (i[e.BLINK]) {
                        i[e.OVERRIDED] ? this._updateInstanceMaterialByUserId(A, t, Hc.BLINK, i[e.OVERRIDED]) : this._updateInstanceMaterialByUserId(A, t, Hc.BLINK);
                        continue
                    }
                    if (i[e.SELECTED]) {
                        this._updateInstanceMaterialByUserId(A, t, Hc.SELECTED);
                        continue
                    }
                }
                i[e.HOVER] ? i[e.OVERRIDED] ? this._updateInstanceMaterialByUserId(A, t, Hc.HOVER, i[e.OVERRIDED]) : this._updateInstanceMaterialByUserId(A, t, Hc.HOVER) : i[e.OVERRIDED] && this._updateInstanceMaterialByUserId(A, t, Hc.OVERRIDED, i[e.OVERRIDED])
            }
        }
        this._updateInstanceMaterialForWireFrame(A),
        Bh.timeEnd("update instance material")
    }
    ,
    Hf.prototype._updateInstanceMaterialForWireFrame = function(A) {
        var e = this.mapFilteredUserIdsForWireFrame;
        if (e)
            for (var t = Object.keys(e), i = 0, o = t.length; o > i; i += 1) {
                var n = t[i];
                this.filteredIds && this.filteredIds[n] && this.filteredIds[n][zc.HIDDEN] || this._updateInstanceMaterialForWireFrameByUserId(A, n, Hc.OVERRIDED, e[n])
            }
    }
    ,
    Hf.prototype._resetInstanceMaterial = function(A) {
        this.meshManager.resetInstanceMaterial(A),
        this.wireframeManager.resetInstanceMaterial()
    }
    ,
    Hf.prototype._collectFilteredUserIds = function(A, e, t) {
        var i = A.manager.filter
          , o = i._hasHiddenFileIdFilter()
          , n = i._hasVisibleFilter()
          , r = i._hasOverrideMaterialFilter()
          , a = i._hasTransparentFilter()
          , s = A.hasReplacedUserId()
          , l = A.hasHiddenUserId()
          , c = this.filteredIds = {};
        if (this.transparentUserIdSetObject = {},
        o || n || r || a || s || l)
            for (var h = zc, d = 0; e.length > d; d += 1) {
                var p = e[d]
                  , g = t[p];
                if (g && g.length) {
                    var u = g[0];
                    if (o && i._isHiddenFileId(u) || n && !1 === i._isVisible(u) || A.isReplacedUserId(p) || A.isHiddenSourceObjectUserId(p))
                        c[p] || (c[p] = {}),
                        c[p][h.HIDDEN] = !0;
                    else if (a && i._isTransparent(u))
                        c[p] || (c[p] = {}),
                        c[p][h.TRANSPARENT] = !0,
                        this.transparentUserIdSetObject[p] = !0;
                    else if (r && i._hasOverrideMaterial(u)) {
                        var f = i._getOverrideMaterial(u)
                          , m = null;
                        if (Array.isArray(f)) {
                            var C = u.nodeId.replace(u.componentKey + "_", "")
                              , y = parseInt(C, 10);
                            "" === (m = null !== f[y] ? f[y].name : "") && (m = u.materialId),
                            c[p] || (c[p] = {}),
                            c[p][h.OVERRIDED] || (c[p][h.OVERRIDED] = []),
                            c[p][h.OVERRIDED][y] = m
                        } else
                            "" !== (m = null !== f ? f.name : "") && (c[p] || (c[p] = {}),
                            c[p][h.OVERRIDED] = m)
                    }
                }
            }
    }
    ,
    Hf.prototype._collectModelFiltered = function(A) {
        var e = A.manager.filter
          , t = A.modelKey
          , i = e._hasModelOverrideMaterialFilter()
          , o = e._hasModelTransparentFilter()
          , n = A.manager.modelState.selectionSet;
        return A.manager.modelState.hoverId === t ? A.manager.modelState.getHoverMaterial() : n.hasOwnProperty(A.modelKey) ? A.manager.modelState.selectionMaterial : o && e._isModelTransparent(t) ? e._getMaterialByName("scene") : i && e._hasModelOverrideMaterial(t) ? e._getModelOverrideMaterial(t) : null
    }
    ,
    Hf.prototype._collectFilteredUserIdsForWireFrame = function(A, e, t) {
        var i = A.getFilter()
          , o = i._hasOverrideMaterialFilterForWireFrame();
        if (this.mapFilteredUserIdsForWireFrame = {},
        o)
            for (var n = zc, r = 0; e.length > r; r += 1) {
                var a = e[r];
                if (!(this.filteredIds && this.filteredIds[a] && this.filteredIds[a][n.HIDDEN])) {
                    var s = t[a];
                    if (s && s.length) {
                        var l = s[0];
                        if (i._hasOverrideMaterialForWireFrame(l)) {
                            var c = i._getOverrideMaterialForWireFrame(l)
                              , h = null !== c ? c.name : "";
                            "" !== h && (this.mapFilteredUserIdsForWireFrame[a] = h)
                        }
                    }
                }
            }
    }
    ,
    Hf.prototype._collectSelectedUserIds = function(A, e) {
        var t = this.filteredIds = this.filteredIds || {}
          , i = zc
          , o = {};
        for (var n in A)
            if (this.model.modelKey === n)
                for (var r in A[n])
                    e[r] && (t[r] || (t[r] = {}),
                    t[r][i.SELECTED] = !0,
                    o[r] = !0);
        this.selectedUserIds = Object.keys(o)
    }
    ,
    Hf.prototype._clearSelectedState = function(A) {
        if (this.filteredIds && this.selectedUserIds && this.selectedUserIds.length) {
            for (var e = 0, t = this.selectedUserIds.length; t > e; e += 1) {
                var i = this.selectedUserIds[e];
                this.filteredIds[i] && (this.meshManager.clearInstanceStateByUserId(i),
                delete this.filteredIds[i][zc.SELECTED])
            }
            this.selectedUserIds = null
        }
    }
    ,
    Hf.prototype._collectHoveredUserIds = function(A, e) {
        var t = this.filteredIds = this.filteredIds || {};
        this.hoverdUserId = void 0,
        A && e[A] && (t[A] || (t[A] = {}),
        t[A][zc.HOVER] = !0,
        this.hoverdUserId = A)
    }
    ,
    Hf.prototype._clearHoveredState = function(A) {
        this.filteredIds && this.hoverdUserId && this.filteredIds[this.hoverdUserId] && (this.meshManager.clearInstanceStateByUserId(this.hoverdUserId),
        delete this.filteredIds[this.hoverdUserId][zc.HOVER],
        this.hoverdUserId = void 0)
    }
    ,
    Hf.prototype._collectBlinkedUserIds = function(A, e) {
        var t = this.filteredIds = this.filteredIds || {}
          , i = zc
          , o = {};
        for (var n in A)
            e[n] && (t[n] || (t[n] = {}),
            t[n][i.BLINK] = !0,
            o[n] = !0);
        this.blinkUserIds = Object.keys(o)
    }
    ,
    Hf.prototype._clearBlinkedState = function(A) {
        if (this.filteredIds && this.blinkUserIds && this.blinkUserIds.length) {
            for (var e = 0, t = this.blinkUserIds.length; t > e; e += 1) {
                var i = this.blinkUserIds[e];
                this.filteredIds[i] && (this.meshManager.clearInstanceStateByUserId(i),
                delete this.filteredIds[i][zc.BLINK])
            }
            this.blinkUserIds = null
        }
    }
    ,
    Hf.prototype.applyFilter = function(A, e) {
        if (this.hasNodeInfo(A)) {
            this.updateNodes(A),
            this._resetInstanceMaterial(A);
            var t = null;
            t = e || A.getModelDescriptor().getInstancedUserIds();
            var i = A.getModelDescriptor().getInstancedNodeInfos();
            this._collectFilteredUserIds(A, t, i),
            this._collectFilteredUserIdsForWireFrame(A, t, i),
            this._collectSelectedUserIds(A.manager.sceneState.selectionSet, i),
            this._collectBlinkedUserIds(A.manager.sceneState.getBlinkComponentsIdMap(), i),
            this._collectHoveredUserIds(A.manager.sceneState.hoverId, i),
            this._updateInstanceMaterial(A),
            this.updateNodes(A)
        }
    }
    ,
    Hf.prototype.applySelection = function(A) {
        if (this.hasNodeInfo(A)) {
            var e = A.getModelDescriptor().getInstancedNodeInfos();
            this._clearSelectedState(A),
            this._clearHoveredState(A),
            this._collectSelectedUserIds(A.manager.sceneState.selectionSet, e),
            this._collectHoveredUserIds(A.manager.sceneState.hoverId, e),
            this._updateInstanceMaterial(A),
            this.updateNodes(A)
        }
    }
    ,
    Hf.prototype.clearSelection = function(A) {
        this._clearSelectedState(A),
        this.applyHover(A)
    }
    ,
    Hf.prototype.applyHover = function(A) {
        if (this.hasNodeInfo(A)) {
            var e = A.getModelDescriptor().getInstancedNodeInfos();
            this._clearHoveredState(A),
            this._collectHoveredUserIds(A.manager.sceneState.hoverId, e),
            this._updateInstanceMaterial(A),
            this.updateNodes(A)
        }
    }
    ,
    Hf.prototype.clearHover = function(A) {
        this._clearHoveredState(A),
        this._updateInstanceMaterial(A),
        this.updateNodes(A)
    }
    ,
    Hf.prototype.applyBlink = function(A) {
        if (this.hasNodeInfo(A)) {
            var e = A.getModelDescriptor().getInstancedNodeInfos();
            this._clearBlinkedState(A),
            this._clearHoveredState(A),
            this._collectBlinkedUserIds(A.manager.sceneState.getBlinkComponentsIdMap(), e),
            this._collectHoveredUserIds(A.manager.sceneState.hoverId, e),
            this._updateInstanceMaterial(A),
            this.updateNodes(A)
        }
    }
    ,
    Hf.prototype.clearBlink = function(A) {
        this._clearBlinkedState(A),
        this.applyHover(A)
    }
    ,
    Hf.prototype.applyReplacement = function(A) {
        this._updateInstanceMaterial(A),
        this.updateNodes(A)
    }
    ,
    Hf.prototype.hasNodeInfo = function(A) {
        return Boolean(A.getModelDescriptor().getInstancedNodeInfos())
    }
    ,
    Hf.prototype.updateNodes = function(A) {
        if (this.hasNodeInfo(A)) {
            var e;
            if (e = this._collectModelFiltered(A))
                for (var t = A.getModelDescriptor().getInstancedUserIds(), i = 0; t.length > i; i += 1)
                    this._updateInstanceMaterialByUserId(A, t[i], Hc.OVERRIDED, e);
            this.meshManager.updateNodes(A),
            this.wireframeManager.updateNodes(A)
        }
    }
    ,
    Hf.prototype.generateWireframe = function(A, e) {
        this.wireframeManager.generateWireframe(A, e)
    }
    ,
    Hf.prototype.createMeshNodes = function(A, e) {
        this.meshManager.createMeshNodes(A, e)
    }
    ,
    Hf.prototype.createInstancedMeshNodes = function(A, e) {
        this.meshManager._createBatchedInstanceGeometries(A, e)
    }
    ,
    Hf.prototype.clearCachedData = function() {
        this.meshManager.disposeGeometries()
    }
    ,
    Hf.prototype.getMeshesByUserIds = function(A, e) {
        this.meshManager.getMeshesByUserId(A, e)
    }
    ,
    Hf.prototype.clearSelectedObjectIds = function() {
        this.meshManager.clearSelectedObjectIds()
    }
    ,
    Hf.prototype.adjustVisibility = function(A, e) {
        this.meshManager.adjustVisibility(A, e),
        this.wireframeManager.adjustVisibility(A, e)
    }
    ,
    Hf.prototype.changeVisibilityOfSelectedObjects = function(A, e) {
        this.meshManager.changeVisibilityOfSelectedObjects(A, e),
        this.wireframeManager.changeVisibilityOfSelectedObjects(A, e)
    }
    ,
    Hf.prototype.changeVisibilityOfNonSelectedObjects = function(A, e) {
        this.meshManager.changeVisibilityOfNonSelectedObjects(A, e),
        this.wireframeManager.changeVisibilityOfNonSelectedObjects(A, e)
    }
    ,
    Hf.prototype.restoreVisibilityOfObjects = function() {
        this.meshManager.restoreVisibilityOfObjects(),
        this.wireframeManager.restoreVisibilityOfObjects()
    }
    ,
    Hf.prototype.disposeBufferAfterVbo = function() {
        this.meshManager.disposeBufferAfterVbo(),
        this.wireframeManager.disposeBufferAfterVbo()
    }
    ,
    Hf.prototype.addAllInstanceNodeToScene = function(A) {
        this.meshManager.addAllInstanceNodeToScene(A)
    }
    ,
    Hf.prototype.getGeometryBuffersByUserId = function(A, e) {
        return this.meshManager.getGeometryBuffersByUserId(A, e)
    }
    ,
    Hf.prototype.explode = function(A, e, t) {
        this.meshManager.explode(A, e, t)
    }
    ,
    Hf.prototype.explosion = function(A, e) {
        this.meshManager.explosion(A, e)
    }
    ,
    Hf.prototype.closeExplosion = function(A) {
        this.meshManager.closeExplosion(A)
    }
    ,
    Hf.prototype.componentsExplosion = function(A, e) {
        this.meshManager.componentsExplosion(A, e)
    }
    ,
    Hf.prototype.closeComponentsExplosion = function(A, e) {
        this.meshManager.closeComponentsExplosion(A, e)
    }
    ,
    Hf.prototype.isPickableNode = function(A) {
        if (!this.filteredIds || !this.filteredIds[A])
            return !0;
        var e = this.filteredIds[A];
        return !e[zc.HIDDEN] && !e[zc.TRANSPARENT]
    }
    ,
    Hf.prototype.isHiddenNode = function(A) {
        return !!(this.filteredIds && this.filteredIds[A] && this.filteredIds[A][zc.HIDDEN])
    }
    ,
    Hf.prototype.getMeshManager = function() {
        return this.meshManager
    }
    ,
    Hf.prototype.getWireFrameManager = function() {
        return this.wireframeManager
    }
    ,
    Hf.prototype.getTransparentUserIds = function() {
        return this.transparentUserIdSetObject
    }
    ;
    var Yf = function(A, e) {
        tf.call(this, A),
        this.defaultManager = new Of(e,A),
        this.instancedManager = new Hf(A),
        this.loader = new ef(this)
    };
    function Wf(A, e) {
        var t = A.__state.conversionName.toString()
          , i = Math.round(A.r)
          , o = Math.round(A.g)
          , n = Math.round(A.b)
          , r = A.a
          , a = Math.round(A.h)
          , s = A.s.toFixed(1)
          , l = A.v.toFixed(1);
        if (e || "THREE_CHAR_HEX" === t || "SIX_CHAR_HEX" === t) {
            for (var c = A.hex.toString(16); 6 > c.length; )
                c = "0" + c;
            return "#" + c
        }
        return "CSS_RGB" === t ? "rgb(" + i + "," + o + "," + n + ")" : "CSS_RGBA" === t ? "rgba(" + i + "," + o + "," + n + "," + r + ")" : "HEX" === t ? "0x" + A.hex.toString(16) : "RGB_ARRAY" === t ? "[" + i + "," + o + "," + n + "]" : "RGBA_ARRAY" === t ? "[" + i + "," + o + "," + n + "," + r + "]" : "RGB_OBJ" === t ? "{r:" + i + ",g:" + o + ",b:" + n + "}" : "RGBA_OBJ" === t ? "{r:" + i + ",g:" + o + ",b:" + n + ",a:" + r + "}" : "HSV_OBJ" === t ? "{h:" + a + ",s:" + s + ",v:" + l + "}" : "HSVA_OBJ" === t ? "{h:" + a + ",s:" + s + ",v:" + l + ",a:" + r + "}" : "unknown format"
    }
    (Yf.prototype = Object.create(tf.prototype)).prepare = function(A, e) {
        if (this.isLoaded() && !this.isHidden()) {
            this.prepareWireframe(this.model, e);
            this.model.getMaterialManager();
            this.model.getMaterialManager()._updateTextureMapping(),
            !this.model.lightmap || this.model.enableLightmap === vc.EnableLightmap && this.model.lightmapIntensity === vc.LightmapIntensity || (this.model.enableLightmap = vc.EnableLightmap,
            this.model.lightmapIntensity = vc.LightmapIntensity,
            this.rebuildIndicesforLightmap(),
            this.updateNodes())
        }
    }
    ,
    Yf.prototype.settleData = function(A) {
        this.addNodeInfoToOctantMap(),
        this.createMeshNodes(A)
    }
    ,
    Yf.prototype.addNodeInfoToOctantMap = function() {
        var A = this.model.manager
          , e = this.model.getEncodedDatabagId();
        this.loader.getDescriptor().traverseNodeInfosByComponent((function(t, i) {
            A.addNodeInfoToOctantMap(e, t, i)
        }
        ))
    }
    ,
    Yf.prototype.createMeshNodes = function(A) {
        var e = this
          , t = this.model
          , i = this.loader.getDescriptor();
        this.instancedManager.createMeshNodes(t, i.getInstancedUserIds()),
        this.defaultManager.asyncCreateMeshNodes(t, i.getStandardUserIds(), (function() {
            t.getMaterialManager()._updateTextureMapping(),
            e.clearCachedData(t),
            e.loaded = !0,
            A && A()
        }
        ))
    }
    ,
    Yf.prototype.clearCachedData = function(A) {
        this.loader.getDescriptor().destroyReader(),
        this.loader.getDescriptor().clearReferencedMeshCache(),
        this.defaultManager.clearCachedData(),
        this.instancedManager.clearCachedData()
    }
    ;
    var Jf = Array.prototype.forEach
      , zf = Array.prototype.slice
      , Zf = {
        BREAK: {},
        extend: function(A) {
            return this.each(zf.call(arguments, 1), (function(e) {
                (this.isObject(e) ? Object.keys(e) : []).forEach(function(t) {
                    this.isUndefined(e[t]) || (A[t] = e[t])
                }
                .bind(this))
            }
            ), this),
            A
        },
        defaults: function(A) {
            return this.each(zf.call(arguments, 1), (function(e) {
                (this.isObject(e) ? Object.keys(e) : []).forEach(function(t) {
                    this.isUndefined(A[t]) && (A[t] = e[t])
                }
                .bind(this))
            }
            ), this),
            A
        },
        compose: function() {
            var A = zf.call(arguments);
            return function() {
                for (var e = zf.call(arguments), t = A.length - 1; t >= 0; t--)
                    e = [A[t].apply(this, e)];
                return e[0]
            }
        },
        each: function(A, e, t) {
            if (A)
                if (Jf && A.forEach && A.forEach === Jf)
                    A.forEach(e, t);
                else if (A.length === A.length + 0) {
                    var i, o = void 0;
                    for (o = 0,
                    i = A.length; i > o; o++)
                        if (o in A && e.call(t, A[o], o) === this.BREAK)
                            return
                } else
                    for (var n in A)
                        if (e.call(t, A[n], n) === this.BREAK)
                            return
        },
        defer: function(A) {
            setTimeout(A, 0)
        },
        debounce: function(A, e, t) {
            var i = void 0;
            return function() {
                var o = this
                  , n = arguments;
                function r() {
                    i = null,
                    t || A.apply(o, n)
                }
                var a = t || !i;
                clearTimeout(i),
                i = setTimeout(r, e),
                a && A.apply(o, n)
            }
        },
        toArray: function(A) {
            return A.toArray ? A.toArray() : zf.call(A)
        },
        isUndefined: function(A) {
            return void 0 === A
        },
        isNull: function(A) {
            return null === A
        },
        isNaN: function(A) {
            function e() {
                return A.apply(this, arguments)
            }
            return e.toString = function() {
                return A.toString()
            }
            ,
            e
        }((function(A) {
            return isNaN(A)
        }
        )),
        isArray: Array.isArray || function(A) {
            return A.constructor === Array
        }
        ,
        isObject: function(A) {
            return A === Object(A)
        },
        isNumber: function(A) {
            return A === A + 0
        },
        isString: function(A) {
            return A === A + ""
        },
        isBoolean: function(A) {
            return !1 === A || !0 === A
        },
        isFunction: function(A) {
            return "[object Function]" === Object.prototype.toString.call(A)
        }
    }
      , Xf = [{
        litmus: Zf.isString,
        conversions: {
            THREE_CHAR_HEX: {
                read: function(A) {
                    var e = A.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);
                    return null !== e && {
                        space: "HEX",
                        hex: parseInt("0x" + e[1].toString() + e[1].toString() + e[2].toString() + e[2].toString() + e[3].toString() + e[3].toString(), 0)
                    }
                },
                write: Wf
            },
            SIX_CHAR_HEX: {
                read: function(A) {
                    var e = A.match(/^#([A-F0-9]{6})$/i);
                    return null !== e && {
                        space: "HEX",
                        hex: parseInt("0x" + e[1].toString(), 0)
                    }
                },
                write: Wf
            },
            CSS_RGB: {
                read: function(A) {
                    var e = A.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);
                    return null !== e && {
                        space: "RGB",
                        r: parseFloat(e[1]),
                        g: parseFloat(e[2]),
                        b: parseFloat(e[3])
                    }
                },
                write: Wf
            },
            CSS_RGBA: {
                read: function(A) {
                    var e = A.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);
                    return null !== e && {
                        space: "RGB",
                        r: parseFloat(e[1]),
                        g: parseFloat(e[2]),
                        b: parseFloat(e[3]),
                        a: parseFloat(e[4])
                    }
                },
                write: Wf
            }
        }
    }, {
        litmus: Zf.isNumber,
        conversions: {
            HEX: {
                read: function(A) {
                    return {
                        space: "HEX",
                        hex: A,
                        conversionName: "HEX"
                    }
                },
                write: function(A) {
                    return A.hex
                }
            }
        }
    }, {
        litmus: Zf.isArray,
        conversions: {
            RGB_ARRAY: {
                read: function(A) {
                    return 3 === A.length && {
                        space: "RGB",
                        r: A[0],
                        g: A[1],
                        b: A[2]
                    }
                },
                write: function(A) {
                    return [A.r, A.g, A.b]
                }
            },
            RGBA_ARRAY: {
                read: function(A) {
                    return 4 === A.length && {
                        space: "RGB",
                        r: A[0],
                        g: A[1],
                        b: A[2],
                        a: A[3]
                    }
                },
                write: function(A) {
                    return [A.r, A.g, A.b, A.a]
                }
            }
        }
    }, {
        litmus: Zf.isObject,
        conversions: {
            RGBA_OBJ: {
                read: function(A) {
                    return !!(Zf.isNumber(A.r) && Zf.isNumber(A.g) && Zf.isNumber(A.b) && Zf.isNumber(A.a)) && {
                        space: "RGB",
                        r: A.r,
                        g: A.g,
                        b: A.b,
                        a: A.a
                    }
                },
                write: function(A) {
                    return {
                        r: A.r,
                        g: A.g,
                        b: A.b,
                        a: A.a
                    }
                }
            },
            RGB_OBJ: {
                read: function(A) {
                    return !!(Zf.isNumber(A.r) && Zf.isNumber(A.g) && Zf.isNumber(A.b)) && {
                        space: "RGB",
                        r: A.r,
                        g: A.g,
                        b: A.b
                    }
                },
                write: function(A) {
                    return {
                        r: A.r,
                        g: A.g,
                        b: A.b
                    }
                }
            },
            HSVA_OBJ: {
                read: function(A) {
                    return !!(Zf.isNumber(A.h) && Zf.isNumber(A.s) && Zf.isNumber(A.v) && Zf.isNumber(A.a)) && {
                        space: "HSV",
                        h: A.h,
                        s: A.s,
                        v: A.v,
                        a: A.a
                    }
                },
                write: function(A) {
                    return {
                        h: A.h,
                        s: A.s,
                        v: A.v,
                        a: A.a
                    }
                }
            },
            HSV_OBJ: {
                read: function(A) {
                    return !!(Zf.isNumber(A.h) && Zf.isNumber(A.s) && Zf.isNumber(A.v)) && {
                        space: "HSV",
                        h: A.h,
                        s: A.s,
                        v: A.v
                    }
                },
                write: function(A) {
                    return {
                        h: A.h,
                        s: A.s,
                        v: A.v
                    }
                }
            }
        }
    }]
      , _f = void 0
      , $f = void 0
      , Am = function() {
        $f = !1;
        var A = arguments.length > 1 ? Zf.toArray(arguments) : arguments[0];
        return Zf.each(Xf, (function(e) {
            if (e.litmus(A))
                return Zf.each(e.conversions, (function(e, t) {
                    if (_f = e.read(A),
                    !1 === $f && !1 !== _f)
                        return $f = _f,
                        _f.conversionName = t,
                        _f.conversion = e,
                        Zf.BREAK
                }
                )),
                Zf.BREAK
        }
        )),
        $f
    }
      , em = void 0
      , tm = {
        hsv_to_rgb: function(A, e, t) {
            var i = Math.floor(A / 60) % 6
              , o = A / 60 - Math.floor(A / 60)
              , n = t * (1 - e)
              , r = t * (1 - o * e)
              , a = t * (1 - (1 - o) * e)
              , s = [[t, a, n], [r, t, n], [n, t, a], [n, r, t], [a, n, t], [t, n, r]][i];
            return {
                r: 255 * s[0],
                g: 255 * s[1],
                b: 255 * s[2]
            }
        },
        rgb_to_hsv: function(A, e, t) {
            var i = Math.min(A, e, t)
              , o = Math.max(A, e, t)
              , n = o - i
              , r = void 0;
            return 0 === o ? {
                h: NaN,
                s: 0,
                v: 0
            } : (r = A === o ? (e - t) / n : e === o ? 2 + (t - A) / n : 4 + (A - e) / n,
            0 > (r /= 6) && (r += 1),
            {
                h: 360 * r,
                s: n / o,
                v: o / 255
            })
        },
        rgb_to_hex: function(A, e, t) {
            var i = this.hex_with_component(0, 2, A);
            return i = this.hex_with_component(i, 1, e),
            i = this.hex_with_component(i, 0, t)
        },
        component_from_hex: function(A, e) {
            return A >> 8 * e & 255
        },
        hex_with_component: function(A, e, t) {
            return t << (em = 8 * e) | A & ~(255 << em)
        }
    }
      , im = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(A) {
        return typeof A
    }
    : function(A) {
        return A && "function" == typeof Symbol && A.constructor === Symbol && A !== Symbol.prototype ? "symbol" : typeof A
    }
      , om = function(A, e) {
        if (!(A instanceof e))
            throw new TypeError("Cannot call a class as a function")
    }
      , nm = function() {
        function A(A, e) {
            for (var t = 0; e.length > t; t++) {
                var i = e[t];
                i.enumerable = i.enumerable || !1,
                i.configurable = !0,
                "value"in i && (i.writable = !0),
                Object.defineProperty(A, i.key, i)
            }
        }
        return function(e, t, i) {
            return t && A(e.prototype, t),
            i && A(e, i),
            e
        }
    }()
      , rm = function A(e, t, i) {
        null === e && (e = Function.prototype);
        var o = Object.getOwnPropertyDescriptor(e, t);
        if (void 0 === o) {
            var n = Object.getPrototypeOf(e);
            return null === n ? void 0 : A(n, t, i)
        }
        if ("value"in o)
            return o.value;
        var r = o.get;
        return void 0 !== r ? r.call(i) : void 0
    }
      , am = function(A, e) {
        if ("function" != typeof e && null !== e)
            throw new TypeError("Super expression must either be null or a function, not " + typeof e);
        A.prototype = Object.create(e && e.prototype, {
            constructor: {
                value: A,
                enumerable: !1,
                writable: !0,
                configurable: !0
            }
        }),
        e && (Object.setPrototypeOf ? Object.setPrototypeOf(A, e) : A.__proto__ = e)
    }
      , sm = function(A, e) {
        if (!A)
            throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
        return !e || "object" != typeof e && "function" != typeof e ? A : e
    }
      , lm = function() {
        function A() {
            if (om(this, A),
            this.__state = Am.apply(this, arguments),
            !1 === this.__state)
                throw new Error("Failed to interpret color arguments");
            this.__state.a = this.__state.a || 1
        }
        return nm(A, [{
            key: "toString",
            value: function() {
                return Wf(this)
            }
        }, {
            key: "toHexString",
            value: function() {
                return Wf(this, !0)
            }
        }, {
            key: "toOriginal",
            value: function() {
                return this.__state.conversion.write(this)
            }
        }]),
        A
    }();
    function cm(A, e, t) {
        Object.defineProperty(A, e, {
            get: function() {
                return "RGB" === this.__state.space || lm.recalculateRGB(this, e, t),
                this.__state[e]
            },
            set: function(A) {
                "RGB" !== this.__state.space && (lm.recalculateRGB(this, e, t),
                this.__state.space = "RGB"),
                this.__state[e] = A
            }
        })
    }
    function hm(A, e) {
        Object.defineProperty(A, e, {
            get: function() {
                return "HSV" === this.__state.space || lm.recalculateHSV(this),
                this.__state[e]
            },
            set: function(A) {
                "HSV" !== this.__state.space && (lm.recalculateHSV(this),
                this.__state.space = "HSV"),
                this.__state[e] = A
            }
        })
    }
    lm.recalculateRGB = function(A, e, t) {
        if ("HEX" === A.__state.space)
            A.__state[e] = tm.component_from_hex(A.__state.hex, t);
        else {
            if ("HSV" !== A.__state.space)
                throw new Error("Corrupted color state");
            Zf.extend(A.__state, tm.hsv_to_rgb(A.__state.h, A.__state.s, A.__state.v))
        }
    }
    ,
    lm.recalculateHSV = function(A) {
        var e = tm.rgb_to_hsv(A.r, A.g, A.b);
        Zf.extend(A.__state, {
            s: e.s,
            v: e.v
        }),
        Zf.isNaN(e.h) ? Zf.isUndefined(A.__state.h) && (A.__state.h = 0) : A.__state.h = e.h
    }
    ,
    lm.COMPONENTS = ["r", "g", "b", "h", "s", "v", "hex", "a"],
    cm(lm.prototype, "r", 2),
    cm(lm.prototype, "g", 1),
    cm(lm.prototype, "b", 0),
    hm(lm.prototype, "h"),
    hm(lm.prototype, "s"),
    hm(lm.prototype, "v"),
    Object.defineProperty(lm.prototype, "a", {
        get: function() {
            return this.__state.a
        },
        set: function(A) {
            this.__state.a = A
        }
    }),
    Object.defineProperty(lm.prototype, "hex", {
        get: function() {
            return "HEX" !== !this.__state.space && (this.__state.hex = tm.rgb_to_hex(this.r, this.g, this.b)),
            this.__state.hex
        },
        set: function(A) {
            this.__state.space = "HEX",
            this.__state.hex = A
        }
    });
    var dm = function() {
        function A(e, t) {
            om(this, A),
            this.initialValue = e[t],
            this.domElement = document.createElement("div"),
            this.object = e,
            this.property = t,
            this.__onChange = void 0,
            this.__onFinishChange = void 0
        }
        return nm(A, [{
            key: "onChange",
            value: function(A) {
                return this.__onChange = A,
                this
            }
        }, {
            key: "onFinishChange",
            value: function(A) {
                return this.__onFinishChange = A,
                this
            }
        }, {
            key: "setValue",
            value: function(A) {
                return this.object[this.property] = A,
                this.__onChange && this.__onChange.call(this, A),
                this.updateDisplay(),
                this
            }
        }, {
            key: "getValue",
            value: function() {
                return this.object[this.property]
            }
        }, {
            key: "updateDisplay",
            value: function() {
                return this
            }
        }, {
            key: "isModified",
            value: function() {
                return this.initialValue !== this.getValue()
            }
        }]),
        A
    }()
      , pm = {};
    Zf.each({
        HTMLEvents: ["change"],
        MouseEvents: ["click", "mousemove", "mousedown", "mouseup", "mouseover"],
        KeyboardEvents: ["keydown"]
    }, (function(A, e) {
        Zf.each(A, (function(A) {
            pm[A] = e
        }
        ))
    }
    ));
    var gm = /(\d+(\.\d+)?)px/;
    function um(A) {
        if ("0" === A || Zf.isUndefined(A))
            return 0;
        var e = A.match(gm);
        return Zf.isNull(e) ? 0 : parseFloat(e[1])
    }
    var fm = {
        makeSelectable: function(A, e) {
            void 0 !== A && void 0 !== A.style && (A.onselectstart = e ? function() {
                return !1
            }
            : function() {}
            ,
            A.style.MozUserSelect = e ? "auto" : "none",
            A.style.KhtmlUserSelect = e ? "auto" : "none",
            A.unselectable = e ? "on" : "off")
        },
        makeFullscreen: function(A, e, t) {
            var i = t
              , o = e;
            Zf.isUndefined(o) && (o = !0),
            Zf.isUndefined(i) && (i = !0),
            A.style.position = "absolute",
            o && (A.style.left = 0,
            A.style.right = 0),
            i && (A.style.top = 0,
            A.style.bottom = 0)
        },
        fakeEvent: function(A, e, t, i) {
            var o = t || {}
              , n = pm[e];
            if (!n)
                throw new Error("Event type " + e + " not supported.");
            var r = document.createEvent(n);
            switch (n) {
            case "MouseEvents":
                r.initMouseEvent(e, o.bubbles || !1, o.cancelable || !0, window, o.clickCount || 1, 0, 0, o.x || o.clientX || 0, o.y || o.clientY || 0, !1, !1, !1, !1, 0, null);
                break;
            case "KeyboardEvents":
                var a = r.initKeyboardEvent || r.initKeyEvent;
                Zf.defaults(o, {
                    cancelable: !0,
                    ctrlKey: !1,
                    altKey: !1,
                    shiftKey: !1,
                    metaKey: !1,
                    keyCode: void 0,
                    charCode: void 0
                }),
                a(e, o.bubbles || !1, o.cancelable, window, o.ctrlKey, o.altKey, o.shiftKey, o.metaKey, o.keyCode, o.charCode);
                break;
            default:
                r.initEvent(e, o.bubbles || !1, o.cancelable || !0)
            }
            Zf.defaults(r, i),
            A.dispatchEvent(r)
        },
        bind: function(A, e, t, i) {
            return A.addEventListener ? A.addEventListener(e, t, i || !1) : A.attachEvent && A.attachEvent("on" + e, t),
            fm
        },
        unbind: function(A, e, t, i) {
            return A.removeEventListener ? A.removeEventListener(e, t, i || !1) : A.detachEvent && A.detachEvent("on" + e, t),
            fm
        },
        addClass: function(A, e) {
            if (void 0 === A.className)
                A.className = e;
            else if (A.className !== e) {
                var t = A.className.split(/ +/);
                -1 === t.indexOf(e) && (t.push(e),
                A.className = t.join(" ").replace(/^\s+/, "").replace(/\s+$/, ""))
            }
            return fm
        },
        removeClass: function(A, e) {
            if (e)
                if (A.className === e)
                    A.removeAttribute("class");
                else {
                    var t = A.className.split(/ +/)
                      , i = t.indexOf(e);
                    -1 !== i && (t.splice(i, 1),
                    A.className = t.join(" "))
                }
            else
                A.className = void 0;
            return fm
        },
        hasClass: function(A, e) {
            return new RegExp("(?:^|\\s+)" + e + "(?:\\s+|$)").test(A.className) || !1
        },
        getWidth: function(A) {
            var e = getComputedStyle(A);
            return um(e["border-left-width"]) + um(e["border-right-width"]) + um(e["padding-left"]) + um(e["padding-right"]) + um(e.width)
        },
        getHeight: function(A) {
            var e = getComputedStyle(A);
            return um(e["border-top-width"]) + um(e["border-bottom-width"]) + um(e["padding-top"]) + um(e["padding-bottom"]) + um(e.height)
        },
        getOffset: function(A) {
            var e = A
              , t = {
                left: 0,
                top: 0
            };
            if (e.offsetParent)
                do {
                    t.left += e.offsetLeft,
                    t.top += e.offsetTop,
                    e = e.offsetParent
                } while (e);return t
        },
        isActive: function(A) {
            return A === document.activeElement && (A.type || A.href)
        }
    }
      , mm = function(A) {
        function e(A, t) {
            om(this, e);
            var i = sm(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, A, t))
              , o = i;
            return i.__prev = i.getValue(),
            i.__checkbox = document.createElement("input"),
            i.__checkbox.setAttribute("type", "checkbox"),
            fm.bind(i.__checkbox, "change", (function() {
                o.setValue(!o.__prev)
            }
            ), !1),
            i.domElement.appendChild(i.__checkbox),
            i.updateDisplay(),
            i
        }
        return am(e, A),
        nm(e, [{
            key: "setValue",
            value: function(A) {
                var t = rm(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "setValue", this).call(this, A);
                return this.__onFinishChange && this.__onFinishChange.call(this, this.getValue()),
                this.__prev = this.getValue(),
                t
            }
        }, {
            key: "updateDisplay",
            value: function() {
                return !0 === this.getValue() ? (this.__checkbox.setAttribute("checked", "checked"),
                this.__checkbox.checked = !0,
                this.__prev = !0) : (this.__checkbox.checked = !1,
                this.__prev = !1),
                rm(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this)
            }
        }]),
        e
    }(dm)
      , Cm = function(A) {
        function e(A, t, i) {
            om(this, e);
            var o = sm(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, A, t))
              , n = i
              , r = o;
            if (o.__select = document.createElement("select"),
            Zf.isArray(n)) {
                var a = {};
                Zf.each(n, (function(A) {
                    a[A] = A
                }
                )),
                n = a
            }
            return Zf.each(n, (function(A, e) {
                var t = document.createElement("option");
                t.innerHTML = e,
                t.setAttribute("value", A),
                r.__select.appendChild(t)
            }
            )),
            o.updateDisplay(),
            fm.bind(o.__select, "change", (function() {
                r.setValue(this.options[this.selectedIndex].value)
            }
            )),
            o.domElement.appendChild(o.__select),
            o
        }
        return am(e, A),
        nm(e, [{
            key: "setValue",
            value: function(A) {
                var t = rm(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "setValue", this).call(this, A);
                return this.__onFinishChange && this.__onFinishChange.call(this, this.getValue()),
                t
            }
        }, {
            key: "updateDisplay",
            value: function() {
                return fm.isActive(this.__select) ? this : (this.__select.value = this.getValue(),
                rm(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this))
            }
        }]),
        e
    }(dm)
      , ym = function(A) {
        function e(A, t) {
            om(this, e);
            var i = sm(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, A, t))
              , o = i;
            function n() {
                o.setValue(o.__input.value)
            }
            return i.__input = document.createElement("input"),
            i.__input.setAttribute("type", "text"),
            fm.bind(i.__input, "keyup", n),
            fm.bind(i.__input, "change", n),
            fm.bind(i.__input, "blur", (function() {
                o.__onFinishChange && o.__onFinishChange.call(o, o.getValue())
            }
            )),
            fm.bind(i.__input, "keydown", (function(A) {
                13 === A.keyCode && this.blur()
            }
            )),
            i.updateDisplay(),
            i.domElement.appendChild(i.__input),
            i
        }
        return am(e, A),
        nm(e, [{
            key: "updateDisplay",
            value: function() {
                return fm.isActive(this.__input) || (this.__input.value = this.getValue()),
                rm(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this)
            }
        }]),
        e
    }(dm);
    function vm(A) {
        var e = A.toString();
        return e.indexOf(".") > -1 ? e.length - e.indexOf(".") - 1 : 0
    }
    var Im = function(A) {
        function e(A, t, i) {
            om(this, e);
            var o = sm(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, A, t))
              , n = i || {};
            return o.__min = n.min,
            o.__max = n.max,
            o.__step = n.step,
            o.__impliedStep = Zf.isUndefined(o.__step) ? 0 === o.initialValue ? 1 : Math.pow(10, Math.floor(Math.log(Math.abs(o.initialValue)) / Math.LN10)) / 10 : o.__step,
            o.__precision = vm(o.__impliedStep),
            o
        }
        return am(e, A),
        nm(e, [{
            key: "setValue",
            value: function(A) {
                var t = A;
                return void 0 !== this.__min && this.__min > t ? t = this.__min : void 0 !== this.__max && t > this.__max && (t = this.__max),
                void 0 !== this.__step && t % this.__step != 0 && (t = Math.round(t / this.__step) * this.__step),
                rm(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "setValue", this).call(this, t)
            }
        }, {
            key: "min",
            value: function(A) {
                return this.__min = A,
                this
            }
        }, {
            key: "max",
            value: function(A) {
                return this.__max = A,
                this
            }
        }, {
            key: "step",
            value: function(A) {
                return this.__step = A,
                this.__impliedStep = A,
                this.__precision = vm(A),
                this
            }
        }]),
        e
    }(dm);
    var Em = function(A) {
        function e(A, t, i) {
            om(this, e);
            var o = sm(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, A, t, i));
            o.__truncationSuspended = !1;
            var n = o
              , r = void 0;
            function a() {
                n.__onFinishChange && n.__onFinishChange.call(n, n.getValue())
            }
            function s(A) {
                var e = r - A.clientY;
                n.setValue(n.getValue() + e * n.__impliedStep),
                r = A.clientY
            }
            function l() {
                fm.unbind(window, "mousemove", s),
                fm.unbind(window, "mouseup", l),
                a()
            }
            return o.__input = document.createElement("input"),
            o.__input.setAttribute("type", "text"),
            fm.bind(o.__input, "change", (function() {
                var A = parseFloat(n.__input.value);
                Zf.isNaN(A) || n.setValue(A)
            }
            )),
            fm.bind(o.__input, "blur", (function() {
                a()
            }
            )),
            fm.bind(o.__input, "mousedown", (function(A) {
                fm.bind(window, "mousemove", s),
                fm.bind(window, "mouseup", l),
                r = A.clientY
            }
            )),
            fm.bind(o.__input, "keydown", (function(A) {
                13 === A.keyCode && (n.__truncationSuspended = !0,
                this.blur(),
                n.__truncationSuspended = !1,
                a())
            }
            )),
            o.updateDisplay(),
            o.domElement.appendChild(o.__input),
            o
        }
        return am(e, A),
        nm(e, [{
            key: "updateDisplay",
            value: function() {
                var A, t;
                return this.__input.value = this.__truncationSuspended ? this.getValue() : (A = this.getValue(),
                t = Math.pow(10, this.__precision),
                Math.round(A * t) / t),
                rm(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this)
            }
        }]),
        e
    }(Im);
    function Bm(A, e, t, i, o) {
        return i + (A - e) / (t - e) * (o - i)
    }
    var xm = function(A) {
        function e(A, t, i, o, n) {
            om(this, e);
            var r = sm(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, A, t, {
                min: i,
                max: o,
                step: n
            }))
              , a = r;
            function s(A) {
                A.preventDefault();
                var e = a.__background.getBoundingClientRect();
                return a.setValue(Bm(A.clientX, e.left, e.right, a.__min, a.__max)),
                !1
            }
            function l() {
                fm.unbind(window, "mousemove", s),
                fm.unbind(window, "mouseup", l),
                a.__onFinishChange && a.__onFinishChange.call(a, a.getValue())
            }
            function c(A) {
                var e = A.touches[0].clientX
                  , t = a.__background.getBoundingClientRect();
                a.setValue(Bm(e, t.left, t.right, a.__min, a.__max))
            }
            function h() {
                fm.unbind(window, "touchmove", c),
                fm.unbind(window, "touchend", h),
                a.__onFinishChange && a.__onFinishChange.call(a, a.getValue())
            }
            return r.__background = document.createElement("div"),
            r.__foreground = document.createElement("div"),
            fm.bind(r.__background, "mousedown", (function(A) {
                document.activeElement.blur(),
                fm.bind(window, "mousemove", s),
                fm.bind(window, "mouseup", l),
                s(A)
            }
            )),
            fm.bind(r.__background, "touchstart", (function(A) {
                if (1 !== A.touches.length)
                    return;
                fm.bind(window, "touchmove", c),
                fm.bind(window, "touchend", h),
                c(A)
            }
            )),
            fm.addClass(r.__background, "slider"),
            fm.addClass(r.__foreground, "slider-fg"),
            r.updateDisplay(),
            r.__background.appendChild(r.__foreground),
            r.domElement.appendChild(r.__background),
            r
        }
        return am(e, A),
        nm(e, [{
            key: "updateDisplay",
            value: function() {
                var A = (this.getValue() - this.__min) / (this.__max - this.__min);
                return this.__foreground.style.width = 100 * A + "%",
                rm(e.prototype.__proto__ || Object.getPrototypeOf(e.prototype), "updateDisplay", this).call(this)
            }
        }]),
        e
    }(Im)
      , Sm = function(A) {
        function e(A, t, i) {
            om(this, e);
            var o = sm(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, A, t))
              , n = o;
            return o.__button = document.createElement("div"),
            o.__button.innerHTML = void 0 === i ? "Fire" : i,
            fm.bind(o.__button, "click", (function(A) {
                return A.preventDefault(),
                n.fire(),
                !1
            }
            )),
            fm.addClass(o.__button, "button"),
            o.domElement.appendChild(o.__button),
            o
        }
        return am(e, A),
        nm(e, [{
            key: "fire",
            value: function() {
                this.__onChange && this.__onChange.call(this),
                this.getValue().call(this.object),
                this.__onFinishChange && this.__onFinishChange.call(this, this.getValue())
            }
        }]),
        e
    }(dm)
      , wm = function(A) {
        function e(A, t) {
            om(this, e);
            var i = sm(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, A, t));
            i.__color = new lm(i.getValue()),
            i.__temp = new lm(0);
            var o = i;
            i.domElement = document.createElement("div"),
            fm.makeSelectable(i.domElement, !1),
            i.__selector = document.createElement("div"),
            i.__selector.className = "selector",
            i.__saturation_field = document.createElement("div"),
            i.__saturation_field.className = "saturation-field",
            i.__field_knob = document.createElement("div"),
            i.__field_knob.className = "field-knob",
            i.__field_knob_border = "2px solid ",
            i.__hue_knob = document.createElement("div"),
            i.__hue_knob.className = "hue-knob",
            i.__hue_field = document.createElement("div"),
            i.__hue_field.className = "hue-field",
            i.__input = document.createElement("input"),
            i.__input.type = "text",
            i.__input_textShadow = "0 1px 1px ",
            fm.bind(i.__input, "keydown", (function(A) {
                13 === A.keyCode && h.call(this)
            }
            )),
            fm.bind(i.__input, "blur", h),
            fm.bind(i.__selector, "mousedown", (function() {
                fm.addClass(this, "drag").bind(window, "mouseup", (function() {
                    fm.removeClass(o.__selector, "drag")
                }
                ))
            }
            )),
            fm.bind(i.__selector, "touchstart", (function() {
                fm.addClass(this, "drag").bind(window, "touchend", (function() {
                    fm.removeClass(o.__selector, "drag")
                }
                ))
            }
            ));
            var n, r = document.createElement("div");
            function a(A) {
                p(A),
                fm.bind(window, "mousemove", p),
                fm.bind(window, "touchmove", p),
                fm.bind(window, "mouseup", l),
                fm.bind(window, "touchend", l)
            }
            function s(A) {
                g(A),
                fm.bind(window, "mousemove", g),
                fm.bind(window, "touchmove", g),
                fm.bind(window, "mouseup", c),
                fm.bind(window, "touchend", c)
            }
            function l() {
                fm.unbind(window, "mousemove", p),
                fm.unbind(window, "touchmove", p),
                fm.unbind(window, "mouseup", l),
                fm.unbind(window, "touchend", l),
                d()
            }
            function c() {
                fm.unbind(window, "mousemove", g),
                fm.unbind(window, "touchmove", g),
                fm.unbind(window, "mouseup", c),
                fm.unbind(window, "touchend", c),
                d()
            }
            function h() {
                var A = Am(this.value);
                !1 !== A ? (o.__color.__state = A,
                o.setValue(o.__color.toOriginal())) : this.value = o.__color.toString()
            }
            function d() {
                o.__onFinishChange && o.__onFinishChange.call(o, o.__color.toOriginal())
            }
            function p(A) {
                -1 === A.type.indexOf("touch") && A.preventDefault();
                var e = o.__saturation_field.getBoundingClientRect()
                  , t = A.touches && A.touches[0] || A
                  , i = (t.clientX - e.left) / (e.right - e.left)
                  , n = 1 - (t.clientY - e.top) / (e.bottom - e.top);
                return n > 1 ? n = 1 : 0 > n && (n = 0),
                i > 1 ? i = 1 : 0 > i && (i = 0),
                o.__color.v = n,
                o.__color.s = i,
                o.setValue(o.__color.toOriginal()),
                !1
            }
            function g(A) {
                -1 === A.type.indexOf("touch") && A.preventDefault();
                var e = o.__hue_field.getBoundingClientRect()
                  , t = 1 - ((A.touches && A.touches[0] || A).clientY - e.top) / (e.bottom - e.top);
                return t > 1 ? t = 1 : 0 > t && (t = 0),
                o.__color.h = 360 * t,
                o.setValue(o.__color.toOriginal()),
                !1
            }
            return Zf.extend(i.__selector.style, {
                width: "122px",
                height: "102px",
                padding: "3px",
                backgroundColor: "#222",
                boxShadow: "0px 1px 3px rgba(0,0,0,0.3)"
            }),
            Zf.extend(i.__field_knob.style, {
                position: "absolute",
                width: "12px",
                height: "12px",
                border: i.__field_knob_border + (.5 > i.__color.v ? "#fff" : "#000"),
                boxShadow: "0px 1px 3px rgba(0,0,0,0.5)",
                borderRadius: "12px",
                zIndex: 1
            }),
            Zf.extend(i.__hue_knob.style, {
                position: "absolute",
                width: "15px",
                height: "2px",
                borderRight: "4px solid #fff",
                zIndex: 1
            }),
            Zf.extend(i.__saturation_field.style, {
                width: "100px",
                height: "100px",
                border: "1px solid #555",
                marginRight: "3px",
                display: "inline-block",
                cursor: "pointer"
            }),
            Zf.extend(r.style, {
                width: "100%",
                height: "100%",
                background: "none"
            }),
            bm(r, "top", "rgba(0,0,0,0)", "#000"),
            Zf.extend(i.__hue_field.style, {
                width: "15px",
                height: "100px",
                border: "1px solid #555",
                cursor: "ns-resize",
                position: "absolute",
                top: "3px",
                right: "3px"
            }),
            (n = i.__hue_field).style.background = "",
            n.style.cssText += "background: -moz-linear-gradient(top,  #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",
            n.style.cssText += "background: -webkit-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",
            n.style.cssText += "background: -o-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",
            n.style.cssText += "background: -ms-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",
            n.style.cssText += "background: linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",
            Zf.extend(i.__input.style, {
                outline: "none",
                textAlign: "center",
                color: "#fff",
                border: 0,
                fontWeight: "bold",
                textShadow: i.__input_textShadow + "rgba(0,0,0,0.7)"
            }),
            fm.bind(i.__saturation_field, "mousedown", a),
            fm.bind(i.__saturation_field, "touchstart", a),
            fm.bind(i.__field_knob, "mousedown", a),
            fm.bind(i.__field_knob, "touchstart", a),
            fm.bind(i.__hue_field, "mousedown", s),
            fm.bind(i.__hue_field, "touchstart", s),
            i.__saturation_field.appendChild(r),
            i.__selector.appendChild(i.__field_knob),
            i.__selector.appendChild(i.__saturation_field),
            i.__selector.appendChild(i.__hue_field),
            i.__hue_field.appendChild(i.__hue_knob),
            i.domElement.appendChild(i.__input),
            i.domElement.appendChild(i.__selector),
            i.updateDisplay(),
            i
        }
        return am(e, A),
        nm(e, [{
            key: "updateDisplay",
            value: function() {
                var A = Am(this.getValue());
                if (!1 !== A) {
                    var e = !1;
                    Zf.each(lm.COMPONENTS, (function(t) {
                        if (!Zf.isUndefined(A[t]) && !Zf.isUndefined(this.__color.__state[t]) && A[t] !== this.__color.__state[t])
                            return e = !0,
                            {}
                    }
                    ), this),
                    e && Zf.extend(this.__color.__state, A)
                }
                Zf.extend(this.__temp.__state, this.__color.__state),
                this.__temp.a = 1;
                var t = .5 > this.__color.v || this.__color.s > .5 ? 255 : 0
                  , i = 255 - t;
                Zf.extend(this.__field_knob.style, {
                    marginLeft: 100 * this.__color.s - 7 + "px",
                    marginTop: 100 * (1 - this.__color.v) - 7 + "px",
                    backgroundColor: this.__temp.toHexString(),
                    border: this.__field_knob_border + "rgb(" + t + "," + t + "," + t + ")"
                }),
                this.__hue_knob.style.marginTop = 100 * (1 - this.__color.h / 360) + "px",
                this.__temp.s = 1,
                this.__temp.v = 1,
                bm(this.__saturation_field, "left", "#fff", this.__temp.toHexString()),
                this.__input.value = this.__color.toString(),
                Zf.extend(this.__input.style, {
                    backgroundColor: this.__color.toHexString(),
                    color: "rgb(" + t + "," + t + "," + t + ")",
                    textShadow: this.__input_textShadow + "rgba(" + i + "," + i + "," + i + ",.7)"
                })
            }
        }]),
        e
    }(dm)
      , Mm = ["-moz-", "-o-", "-webkit-", "-ms-", ""];
    function bm(A, e, t, i) {
        A.style.background = "",
        Zf.each(Mm, (function(o) {
            A.style.cssText += "background: " + o + "linear-gradient(" + e + ", " + t + " 0%, " + i + " 100%); "
        }
        ))
    }
    var Um = function(A, e) {
        var t = e || document
          , i = document.createElement("style");
        i.type = "text/css",
        i.innerHTML = A;
        var o = t.getElementsByTagName("head")[0];
        try {
            o.appendChild(i)
        } catch (A) {}
    }
      , Fm = '<div id="dg-save" class="dg dialogue">\n\n  Here\'s the new load parameter for your <code>GUI</code>\'s constructor:\n\n  <textarea id="dg-new-constructor"></textarea>\n\n  <div id="dg-save-locally">\n\n    <input id="dg-local-storage" type="checkbox"/> Automatically save\n    values to <code>localStorage</code> on exit.\n\n    <div id="dg-local-explain">The values saved to <code>localStorage</code> will\n      override those passed to <code>dat.GUI</code>\'s constructor. This makes it\n      easier to work incrementally, but <code>localStorage</code> is fragile,\n      and your friends may not see the same values you do.\n\n    </div>\n\n  </div>\n\n</div>'
      , Km = function(A, e) {
        var t = A[e];
        return Zf.isArray(arguments[2]) || Zf.isObject(arguments[2]) ? new Cm(A,e,arguments[2]) : Zf.isNumber(t) ? Zf.isNumber(arguments[2]) && Zf.isNumber(arguments[3]) ? Zf.isNumber(arguments[4]) ? new xm(A,e,arguments[2],arguments[3],arguments[4]) : new xm(A,e,arguments[2],arguments[3]) : Zf.isNumber(arguments[4]) ? new Em(A,e,{
            min: arguments[2],
            max: arguments[3],
            step: arguments[4]
        }) : new Em(A,e,{
            min: arguments[2],
            max: arguments[3]
        }) : Zf.isString(t) ? new ym(A,e) : Zf.isFunction(t) ? new Sm(A,e,"") : Zf.isBoolean(t) ? new mm(A,e) : null
    };
    var Qm = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(A) {
        setTimeout(A, 1e3 / 60)
    }
      , Rm = function() {
        function A() {
            om(this, A),
            this.backgroundElement = document.createElement("div"),
            Zf.extend(this.backgroundElement.style, {
                backgroundColor: "rgba(0,0,0,0.8)",
                top: 0,
                left: 0,
                display: "none",
                zIndex: "1000",
                opacity: 0,
                WebkitTransition: "opacity 0.2s linear",
                transition: "opacity 0.2s linear"
            }),
            fm.makeFullscreen(this.backgroundElement),
            this.backgroundElement.style.position = "fixed",
            this.domElement = document.createElement("div"),
            Zf.extend(this.domElement.style, {
                position: "fixed",
                display: "none",
                zIndex: "1001",
                opacity: 0,
                WebkitTransition: "-webkit-transform 0.2s ease-out, opacity 0.2s linear",
                transition: "transform 0.2s ease-out, opacity 0.2s linear"
            }),
            document.body.appendChild(this.backgroundElement),
            document.body.appendChild(this.domElement);
            var e = this;
            fm.bind(this.backgroundElement, "click", (function() {
                e.hide()
            }
            ))
        }
        return nm(A, [{
            key: "show",
            value: function() {
                var A = this;
                this.backgroundElement.style.display = "block",
                this.domElement.style.display = "block",
                this.domElement.style.opacity = 0,
                this.domElement.style.webkitTransform = "scale(1.1)",
                this.layout(),
                Zf.defer((function() {
                    A.backgroundElement.style.opacity = 1,
                    A.domElement.style.opacity = 1,
                    A.domElement.style.webkitTransform = "scale(1)"
                }
                ))
            }
        }, {
            key: "hide",
            value: function() {
                var A = this
                  , e = function e() {
                    A.domElement.style.display = "none",
                    A.backgroundElement.style.display = "none",
                    fm.unbind(A.domElement, "webkitTransitionEnd", e),
                    fm.unbind(A.domElement, "transitionend", e),
                    fm.unbind(A.domElement, "oTransitionEnd", e)
                };
                fm.bind(this.domElement, "webkitTransitionEnd", e),
                fm.bind(this.domElement, "transitionend", e),
                fm.bind(this.domElement, "oTransitionEnd", e),
                this.backgroundElement.style.opacity = 0,
                this.domElement.style.opacity = 0,
                this.domElement.style.webkitTransform = "scale(1.1)"
            }
        }, {
            key: "layout",
            value: function() {
                this.domElement.style.left = window.innerWidth / 2 - fm.getWidth(this.domElement) / 2 + "px",
                this.domElement.style.top = window.innerHeight / 2 - fm.getHeight(this.domElement) / 2 + "px"
            }
        }]),
        A
    }();
    Um(function(A) {
        if (A && "undefined" != typeof window) {
            var e = document.createElement("style");
            return e.setAttribute("type", "text/css"),
            e.innerHTML = A,
            document.head.appendChild(e),
            A
        }
    }(".dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}\n"));
    var Tm = function() {
        try {
            return !!window.localStorage
        } catch (A) {
            return !1
        }
    }()
      , km = void 0
      , Dm = !0
      , Lm = void 0
      , Nm = !1
      , Om = []
      , Vm = function A(e) {
        var t = this
          , i = e || {};
        this.domElement = document.createElement("div"),
        this.__ul = document.createElement("ul"),
        this.domElement.appendChild(this.__ul),
        fm.addClass(this.domElement, "dg"),
        this.__folders = {},
        this.__controllers = [],
        this.__rememberedObjects = [],
        this.__rememberedObjectIndecesToControllers = [],
        this.__listening = [],
        i = Zf.defaults(i, {
            closeOnTop: !1,
            autoPlace: !0,
            width: A.DEFAULT_WIDTH
        }),
        i = Zf.defaults(i, {
            resizable: i.autoPlace,
            hideable: i.autoPlace
        }),
        Zf.isUndefined(i.load) ? i.load = {
            preset: "Default"
        } : i.preset && (i.load.preset = i.preset),
        Zf.isUndefined(i.parent) && i.hideable && Om.push(this),
        i.resizable = Zf.isUndefined(i.parent) && i.resizable,
        i.autoPlace && Zf.isUndefined(i.scrollable) && (i.scrollable = !0);
        var o = Tm && "true" === localStorage.getItem(Ym(this, "isLocal"))
          , n = void 0
          , r = void 0;
        if (Object.defineProperties(this, {
            parent: {
                get: function() {
                    return i.parent
                }
            },
            scrollable: {
                get: function() {
                    return i.scrollable
                }
            },
            autoPlace: {
                get: function() {
                    return i.autoPlace
                }
            },
            closeOnTop: {
                get: function() {
                    return i.closeOnTop
                }
            },
            preset: {
                get: function() {
                    return t.parent ? t.getRoot().preset : i.load.preset
                },
                set: function(A) {
                    t.parent ? t.getRoot().preset = A : i.load.preset = A,
                    function(A) {
                        for (var e = 0; A.__preset_select.length > e; e++)
                            A.__preset_select[e].value === A.preset && (A.__preset_select.selectedIndex = e)
                    }(this),
                    t.revert()
                }
            },
            width: {
                get: function() {
                    return i.width
                },
                set: function(A) {
                    i.width = A,
                    Xm(t, A)
                }
            },
            name: {
                get: function() {
                    return i.name
                },
                set: function(A) {
                    i.name = A,
                    r && (r.innerHTML = i.name)
                }
            },
            closed: {
                get: function() {
                    return i.closed
                },
                set: function(e) {
                    i.closed = e,
                    i.closed ? fm.addClass(t.__ul, A.CLASS_CLOSED) : fm.removeClass(t.__ul, A.CLASS_CLOSED),
                    this.onResize(),
                    t.__closeButton && (t.__closeButton.innerHTML = e ? A.TEXT_OPEN : A.TEXT_CLOSED)
                }
            },
            load: {
                get: function() {
                    return i.load
                }
            },
            useLocalStorage: {
                get: function() {
                    return o
                },
                set: function(A) {
                    Tm && (o = A,
                    A ? fm.bind(window, "unload", n) : fm.unbind(window, "unload", n),
                    localStorage.setItem(Ym(t, "isLocal"), A))
                }
            }
        }),
        Zf.isUndefined(i.parent)) {
            if (this.closed = i.closed || !1,
            fm.addClass(this.domElement, A.CLASS_MAIN),
            fm.makeSelectable(this.domElement, !1),
            Tm && o) {
                t.useLocalStorage = !0;
                var a = localStorage.getItem(Ym(this, "gui"));
                a && (i.load = JSON.parse(a))
            }
            this.__closeButton = document.createElement("div"),
            this.__closeButton.innerHTML = A.TEXT_CLOSED,
            fm.addClass(this.__closeButton, A.CLASS_CLOSE_BUTTON),
            i.closeOnTop ? (fm.addClass(this.__closeButton, A.CLASS_CLOSE_TOP),
            this.domElement.insertBefore(this.__closeButton, this.domElement.childNodes[0])) : (fm.addClass(this.__closeButton, A.CLASS_CLOSE_BOTTOM),
            this.domElement.appendChild(this.__closeButton)),
            fm.bind(this.__closeButton, "click", (function() {
                t.closed = !t.closed
            }
            ))
        } else {
            void 0 === i.closed && (i.closed = !0);
            var s = document.createTextNode(i.name);
            fm.addClass(s, "controller-name"),
            r = Gm(t, s);
            fm.addClass(this.__ul, A.CLASS_CLOSED),
            fm.addClass(r, "title"),
            fm.bind(r, "click", (function(A) {
                return A.preventDefault(),
                t.closed = !t.closed,
                !1
            }
            )),
            i.closed || (this.closed = !1)
        }
        i.autoPlace && (Zf.isUndefined(i.parent) && (Dm && (Lm = document.createElement("div"),
        fm.addClass(Lm, "dg"),
        fm.addClass(Lm, A.CLASS_AUTO_PLACE_CONTAINER),
        document.body.appendChild(Lm),
        Dm = !1),
        Lm.appendChild(this.domElement),
        fm.addClass(this.domElement, A.CLASS_AUTO_PLACE)),
        this.parent || Xm(t, i.width)),
        this.__resizeHandler = function() {
            t.onResizeDebounced()
        }
        ,
        fm.bind(window, "resize", this.__resizeHandler),
        fm.bind(this.__ul, "webkitTransitionEnd", this.__resizeHandler),
        fm.bind(this.__ul, "transitionend", this.__resizeHandler),
        fm.bind(this.__ul, "oTransitionEnd", this.__resizeHandler),
        this.onResize(),
        i.resizable && Zm(this),
        this.saveToLocalStorageIfPossible = n = function() {
            Tm && "true" === localStorage.getItem(Ym(t, "isLocal")) && localStorage.setItem(Ym(t, "gui"), JSON.stringify(t.getSaveObject()))
        }
        ,
        i.parent || function() {
            var A = t.getRoot();
            A.width += 1,
            Zf.defer((function() {
                A.width -= 1
            }
            ))
        }()
    };
    function Gm(A, e, t) {
        var i = document.createElement("li");
        return e && i.appendChild(e),
        t ? A.__ul.insertBefore(i, t) : A.__ul.appendChild(i),
        A.onResize(),
        i
    }
    function Pm(A) {
        fm.unbind(window, "resize", A.__resizeHandler),
        A.saveToLocalStorageIfPossible && fm.unbind(window, "unload", A.saveToLocalStorageIfPossible)
    }
    function qm(A, e) {
        var t = A.__preset_select[A.__preset_select.selectedIndex];
        t.innerHTML = e ? t.value + "*" : t.value
    }
    function jm(A, e) {
        var t = A.getRoot()
          , i = t.__rememberedObjects.indexOf(e.object);
        if (-1 !== i) {
            var o = t.__rememberedObjectIndecesToControllers[i];
            if (void 0 === o && (t.__rememberedObjectIndecesToControllers[i] = o = {}),
            o[e.property] = e,
            t.load && t.load.remembered) {
                var n = t.load.remembered
                  , r = void 0;
                if (n[A.preset])
                    r = n[A.preset];
                else {
                    if (!n.Default)
                        return;
                    r = n.Default
                }
                if (r[i] && void 0 !== r[i][e.property]) {
                    var a = r[i][e.property];
                    e.initialValue = a,
                    e.setValue(a)
                }
            }
        }
    }
    function Hm(A, e, t, i) {
        if (void 0 === e[t])
            throw new Error('Object "' + e + '" has no property "' + t + '"');
        var o = void 0;
        if (i.color)
            o = new wm(e,t);
        else {
            var n = [e, t].concat(i.factoryArgs);
            o = Km.apply(A, n)
        }
        i.before instanceof dm && (i.before = i.before.__li),
        jm(A, o),
        fm.addClass(o.domElement, "c");
        var r = document.createElement("span");
        fm.addClass(r, "property-name"),
        r.innerHTML = o.property;
        var a = document.createElement("div");
        a.appendChild(r),
        a.appendChild(o.domElement);
        var s = Gm(A, a, i.before);
        return fm.addClass(s, Vm.CLASS_CONTROLLER_ROW),
        fm.addClass(s, o instanceof wm ? "color" : im(o.getValue())),
        function(A, e, t) {
            if (t.__li = e,
            t.__gui = A,
            Zf.extend(t, {
                options: function(e) {
                    if (arguments.length > 1) {
                        var i = t.__li.nextElementSibling;
                        return t.remove(),
                        Hm(A, t.object, t.property, {
                            before: i,
                            factoryArgs: [Zf.toArray(arguments)]
                        })
                    }
                    if (Zf.isArray(e) || Zf.isObject(e)) {
                        var o = t.__li.nextElementSibling;
                        return t.remove(),
                        Hm(A, t.object, t.property, {
                            before: o,
                            factoryArgs: [e]
                        })
                    }
                },
                name: function(A) {
                    return t.__li.firstElementChild.firstElementChild.innerHTML = A,
                    t
                },
                listen: function() {
                    return t.__gui.listen(t),
                    t
                },
                remove: function() {
                    return t.__gui.remove(t),
                    t
                }
            }),
            t instanceof xm) {
                var i = new Em(t.object,t.property,{
                    min: t.__min,
                    max: t.__max,
                    step: t.__step
                });
                Zf.each(["updateDisplay", "onChange", "onFinishChange", "step", "min", "max"], (function(A) {
                    var e = t[A]
                      , o = i[A];
                    t[A] = i[A] = function() {
                        var A = Array.prototype.slice.call(arguments);
                        return o.apply(i, A),
                        e.apply(t, A)
                    }
                }
                )),
                fm.addClass(e, "has-slider"),
                t.domElement.insertBefore(i.domElement, t.domElement.firstElementChild)
            } else if (t instanceof Em) {
                var o = function(e) {
                    if (Zf.isNumber(t.__min) && Zf.isNumber(t.__max)) {
                        var i = t.__li.firstElementChild.firstElementChild.innerHTML
                          , o = t.__gui.__listening.indexOf(t) > -1;
                        t.remove();
                        var n = Hm(A, t.object, t.property, {
                            before: t.__li.nextElementSibling,
                            factoryArgs: [t.__min, t.__max, t.__step]
                        });
                        return n.name(i),
                        o && n.listen(),
                        n
                    }
                    return e
                };
                t.min = Zf.compose(o, t.min),
                t.max = Zf.compose(o, t.max)
            } else
                t instanceof mm ? (fm.bind(e, "click", (function() {
                    fm.fakeEvent(t.__checkbox, "click")
                }
                )),
                fm.bind(t.__checkbox, "click", (function(A) {
                    A.stopPropagation()
                }
                ))) : t instanceof Sm ? (fm.bind(e, "click", (function() {
                    fm.fakeEvent(t.__button, "click")
                }
                )),
                fm.bind(e, "mouseover", (function() {
                    fm.addClass(t.__button, "hover")
                }
                )),
                fm.bind(e, "mouseout", (function() {
                    fm.removeClass(t.__button, "hover")
                }
                ))) : t instanceof wm && (fm.addClass(e, "color"),
                t.updateDisplay = Zf.compose((function(A) {
                    return e.style.borderLeftColor = t.__color.toString(),
                    A
                }
                ), t.updateDisplay),
                t.updateDisplay());
            t.setValue = Zf.compose((function(e) {
                return A.getRoot().__preset_select && t.isModified() && qm(A.getRoot(), !0),
                e
            }
            ), t.setValue)
        }(A, s, o),
        A.__controllers.push(o),
        o
    }
    function Ym(A, e) {
        return document.location.href + "." + e
    }
    function Wm(A, e, t) {
        var i = document.createElement("option");
        i.innerHTML = e,
        i.value = e,
        A.__preset_select.appendChild(i),
        t && (A.__preset_select.selectedIndex = A.__preset_select.length - 1)
    }
    function Jm(A, e) {
        e.style.display = A.useLocalStorage ? "block" : "none"
    }
    function zm(A) {
        var e = A.__save_row = document.createElement("li");
        fm.addClass(A.domElement, "has-save"),
        A.__ul.insertBefore(e, A.__ul.firstChild),
        fm.addClass(e, "save-row");
        var t = document.createElement("span");
        t.innerHTML = "&nbsp;",
        fm.addClass(t, "button gears");
        var i = document.createElement("span");
        i.innerHTML = "Save",
        fm.addClass(i, "button"),
        fm.addClass(i, "save");
        var o = document.createElement("span");
        o.innerHTML = "New",
        fm.addClass(o, "button"),
        fm.addClass(o, "save-as");
        var n = document.createElement("span");
        n.innerHTML = "Revert",
        fm.addClass(n, "button"),
        fm.addClass(n, "revert");
        var r = A.__preset_select = document.createElement("select");
        if (A.load && A.load.remembered ? Zf.each(A.load.remembered, (function(e, t) {
            Wm(A, t, t === A.preset)
        }
        )) : Wm(A, "Default", !1),
        fm.bind(r, "change", (function() {
            for (var e = 0; A.__preset_select.length > e; e++)
                A.__preset_select[e].innerHTML = A.__preset_select[e].value;
            A.preset = this.value
        }
        )),
        e.appendChild(r),
        e.appendChild(t),
        e.appendChild(i),
        e.appendChild(o),
        e.appendChild(n),
        Tm) {
            var a = document.getElementById("dg-local-explain")
              , s = document.getElementById("dg-local-storage");
            document.getElementById("dg-save-locally").style.display = "block",
            "true" === localStorage.getItem(Ym(0, "isLocal")) && s.setAttribute("checked", "checked"),
            Jm(A, a),
            fm.bind(s, "change", (function() {
                A.useLocalStorage = !A.useLocalStorage,
                Jm(A, a)
            }
            ))
        }
        var l = document.getElementById("dg-new-constructor");
        fm.bind(l, "keydown", (function(A) {
            !A.metaKey || 67 !== A.which && 67 !== A.keyCode || km.hide()
        }
        )),
        fm.bind(t, "click", (function() {
            l.innerHTML = JSON.stringify(A.getSaveObject(), void 0, 2),
            km.show(),
            l.focus(),
            l.select()
        }
        )),
        fm.bind(i, "click", (function() {
            A.save()
        }
        )),
        fm.bind(o, "click", (function() {
            var e = prompt("Enter a new preset name.");
            e && A.saveAs(e)
        }
        )),
        fm.bind(n, "click", (function() {
            A.revert()
        }
        ))
    }
    function Zm(A) {
        var e = void 0;
        function t(t) {
            return t.preventDefault(),
            A.width += e - t.clientX,
            A.onResize(),
            e = t.clientX,
            !1
        }
        function i() {
            fm.removeClass(A.__closeButton, Vm.CLASS_DRAG),
            fm.unbind(window, "mousemove", t),
            fm.unbind(window, "mouseup", i)
        }
        function o(o) {
            return o.preventDefault(),
            e = o.clientX,
            fm.addClass(A.__closeButton, Vm.CLASS_DRAG),
            fm.bind(window, "mousemove", t),
            fm.bind(window, "mouseup", i),
            !1
        }
        A.__resize_handle = document.createElement("div"),
        Zf.extend(A.__resize_handle.style, {
            width: "6px",
            marginLeft: "-3px",
            height: "200px",
            cursor: "ew-resize",
            position: "absolute"
        }),
        fm.bind(A.__resize_handle, "mousedown", o),
        fm.bind(A.__closeButton, "mousedown", o),
        A.domElement.insertBefore(A.__resize_handle, A.domElement.firstElementChild)
    }
    function Xm(A, e) {
        A.domElement.style.width = e + "px",
        A.__save_row && A.autoPlace && (A.__save_row.style.width = e + "px"),
        A.__closeButton && (A.__closeButton.style.width = e + "px")
    }
    function _m(A, e) {
        var t = {};
        return Zf.each(A.__rememberedObjects, (function(i, o) {
            var n = {};
            Zf.each(A.__rememberedObjectIndecesToControllers[o], (function(A, t) {
                n[t] = e ? A.initialValue : A.getValue()
            }
            )),
            t[o] = n
        }
        )),
        t
    }
    Vm.toggleHide = function() {
        Nm = !Nm,
        Zf.each(Om, (function(A) {
            A.domElement.style.display = Nm ? "none" : ""
        }
        ))
    }
    ,
    Vm.CLASS_AUTO_PLACE = "a",
    Vm.CLASS_AUTO_PLACE_CONTAINER = "ac",
    Vm.CLASS_MAIN = "main",
    Vm.CLASS_CONTROLLER_ROW = "cr",
    Vm.CLASS_TOO_TALL = "taller-than-window",
    Vm.CLASS_CLOSED = "closed",
    Vm.CLASS_CLOSE_BUTTON = "close-button",
    Vm.CLASS_CLOSE_TOP = "close-top",
    Vm.CLASS_CLOSE_BOTTOM = "close-bottom",
    Vm.CLASS_DRAG = "drag",
    Vm.DEFAULT_WIDTH = 245,
    Vm.TEXT_CLOSED = "关闭控制器",
    Vm.TEXT_OPEN = "打开控制器",
    Vm._keydownHandler = function(A) {
        "text" === document.activeElement.type || 72 !== A.which && 72 !== A.keyCode || Vm.toggleHide()
    }
    ,
    fm.bind(window, "keydown", Vm._keydownHandler, !1),
    Zf.extend(Vm.prototype, {
        add: function(A, e) {
            return Hm(this, A, e, {
                factoryArgs: Array.prototype.slice.call(arguments, 2)
            })
        },
        addColor: function(A, e) {
            return Hm(this, A, e, {
                color: !0
            })
        },
        remove: function(A) {
            this.__ul.removeChild(A.__li),
            this.__controllers.splice(this.__controllers.indexOf(A), 1);
            var e = this;
            Zf.defer((function() {
                e.onResize()
            }
            ))
        },
        destroy: function() {
            if (this.parent)
                throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");
            this.autoPlace && Lm.removeChild(this.domElement);
            var A = this;
            Zf.each(this.__folders, (function(e) {
                A.removeFolder(e)
            }
            )),
            fm.unbind(window, "keydown", Vm._keydownHandler, !1),
            Pm(this)
        },
        addFolder: function(A) {
            if (void 0 !== this.__folders[A])
                throw new Error('You already have a folder in this GUI by the name "' + A + '"');
            var e = {
                name: A,
                parent: this
            };
            e.autoPlace = this.autoPlace,
            this.load && this.load.folders && this.load.folders[A] && (e.closed = this.load.folders[A].closed,
            e.load = this.load.folders[A]);
            var t = new Vm(e);
            this.__folders[A] = t;
            var i = Gm(this, t.domElement);
            return fm.addClass(i, "folder"),
            t
        },
        removeFolder: function(A) {
            this.__ul.removeChild(A.domElement.parentElement),
            delete this.__folders[A.name],
            this.load && this.load.folders && this.load.folders[A.name] && delete this.load.folders[A.name],
            Pm(A);
            var e = this;
            Zf.each(A.__folders, (function(e) {
                A.removeFolder(e)
            }
            )),
            Zf.defer((function() {
                e.onResize()
            }
            ))
        },
        open: function() {
            this.closed = !1
        },
        close: function() {
            this.closed = !0
        },
        hide: function() {
            this.domElement.style.display = "none"
        },
        show: function() {
            this.domElement.style.display = ""
        },
        onResize: function() {
            var A = this.getRoot();
            if (A.scrollable) {
                var e = fm.getOffset(A.__ul).top
                  , t = 0;
                Zf.each(A.__ul.childNodes, (function(e) {
                    A.autoPlace && e === A.__save_row || (t += fm.getHeight(e))
                }
                )),
                window.innerHeight - e - 20 < t ? (fm.addClass(A.domElement, Vm.CLASS_TOO_TALL),
                A.__ul.style.height = window.innerHeight - e - 20 + "px") : (fm.removeClass(A.domElement, Vm.CLASS_TOO_TALL),
                A.__ul.style.height = "auto")
            }
            A.__resize_handle && Zf.defer((function() {
                A.__resize_handle.style.height = A.__ul.offsetHeight + "px"
            }
            )),
            A.__closeButton && (A.__closeButton.style.width = A.width + "px")
        },
        onResizeDebounced: Zf.debounce((function() {
            this.onResize()
        }
        ), 50),
        remember: function() {
            if (Zf.isUndefined(km) && ((km = new Rm).domElement.innerHTML = Fm),
            this.parent)
                throw new Error("You can only call remember on a top level GUI.");
            var A = this;
            Zf.each(Array.prototype.slice.call(arguments), (function(e) {
                0 === A.__rememberedObjects.length && zm(A),
                -1 === A.__rememberedObjects.indexOf(e) && A.__rememberedObjects.push(e)
            }
            )),
            this.autoPlace && Xm(this, this.width)
        },
        getRoot: function() {
            for (var A = this; A.parent; )
                A = A.parent;
            return A
        },
        getSaveObject: function() {
            var A = this.load;
            return A.closed = this.closed,
            this.__rememberedObjects.length > 0 && (A.preset = this.preset,
            A.remembered || (A.remembered = {}),
            A.remembered[this.preset] = _m(this)),
            A.folders = {},
            Zf.each(this.__folders, (function(e, t) {
                A.folders[t] = e.getSaveObject()
            }
            )),
            A
        },
        save: function() {
            this.load.remembered || (this.load.remembered = {}),
            this.load.remembered[this.preset] = _m(this),
            qm(this, !1),
            this.saveToLocalStorageIfPossible()
        },
        saveAs: function(A) {
            this.load.remembered || (this.load.remembered = {},
            this.load.remembered.Default = _m(this, !0)),
            this.load.remembered[A] = _m(this),
            this.preset = A,
            Wm(this, A, !0),
            this.saveToLocalStorageIfPossible()
        },
        revert: function(A) {
            Zf.each(this.__controllers, (function(e) {
                this.getRoot().load.remembered ? jm(A || this.getRoot(), e) : e.setValue(e.initialValue),
                e.__onFinishChange && e.__onFinishChange.call(e, e.getValue())
            }
            ), this),
            Zf.each(this.__folders, (function(A) {
                A.revert(A)
            }
            )),
            A || qm(this.getRoot(), !1)
        },
        listen: function(A) {
            var e = 0 === this.__listening.length;
            this.__listening.push(A),
            e && function A(e) {
                0 !== e.length && Qm.call(window, (function() {
                    A(e)
                }
                ));
                Zf.each(e, (function(A) {
                    A.updateDisplay()
                }
                ))
            }(this.__listening)
        },
        updateDisplay: function() {
            Zf.each(this.__controllers, (function(A) {
                A.updateDisplay()
            }
            )),
            Zf.each(this.__folders, (function(A) {
                A.updateDisplay()
            }
            ))
        }
    });
    var $m = Vm
      , AC = function(A) {
        var e = this;
        this.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
        window.IDBKeyRange || window;
        var t = uh.extend({}, {
            dbName: "bos3d",
            store: "default",
            version: 1,
            indexes: ["id"],
            keyPath: "id"
        }, A);
        this.IDBOpenDBRequest = null,
        this.dbName = t.dbName;
        var i = this.version = t.version;
        this.storeName = t.store;
        var o = t.keyPath
          , n = this.indexedDB.open(this.dbName, i);
        n.onupgradeneeded = function(A) {
            Bh.log("DB version changed to " + i);
            var n = A.target.result
              , r = null;
            if (!1 === n.objectStoreNames.contains(e.storeName)) {
                r = n.createObjectStore(e.storeName, {
                    keyPath: o
                });
                for (var a = 0; t.indexes.length > a; a += 1) {
                    var s = t.indexes[a];
                    r.createIndex(s, s, {
                        unique: !1
                    })
                }
            }
        }
        ,
        n.onsuccess = function(A) {
            e.IDBOpenDBRequest = A.target.result,
            Bh.log("成功建立并打开数据库:" + e.IDBOpenDBRequest.name + " version " + i),
            e.dispatchEvent({
                type: Rc.ON_DATABASE_OPEN
            })
        }
        ,
        n.onerror = function(A) {
            Bh.error("IndexedDB", A),
            e.dispatchEvent({
                type: Rc.ON_DATABASE_EEEOR
            })
        }
        ,
        n.onblocked = function(A) {
            Bh.warn("Please close all other tabs with this site open!", A)
        }
    };
    Object.assign(AC.prototype, Ld.prototype),
    Object.assign(AC.prototype, {
        constructor: AC,
        get: function(A, e, t) {
            if (this.IDBOpenDBRequest) {
                var i = this.IDBOpenDBRequest.transaction([this.storeName]).objectStore(this.storeName).get(A);
                i.onsuccess = function(A) {
                    "function" == typeof e && e(A.target.result ? A.target.result.data : null)
                }
                ,
                i.onerror = function(A) {
                    Bh.error("getDataByKey error"),
                    "function" == typeof t && t(A)
                }
            }
        },
        getBatch: function(A, e, t) {
            if (this.IDBOpenDBRequest) {
                for (var i = this.IDBOpenDBRequest.transaction([this.storeName]).objectStore(this.storeName), o = {}, n = [], r = 0; A.length > r; r += 1)
                    n.push(new Promise((function(e, t) {
                        var o = A[r]
                          , n = i.index("id").get(o);
                        n.onsuccess = function(A) {
                            e(A.target.result)
                        }
                        ,
                        n.onerror = function(A) {
                            Bh.error(o, "failed", A),
                            t(A)
                        }
                    }
                    )));
                Promise.all(n).then((function(A) {
                    for (var t = 0; A.length > t; t += 1)
                        A[t] && (o[A[t].id] = A[t].data);
                    e(o)
                }
                )).catch((function(A) {
                    Bh.debug(A),
                    A instanceof TypeError ? Bh.error(A) : e(o)
                }
                ))
            }
        },
        setBatch: function(A, e, t) {
            if (this.IDBOpenDBRequest)
                for (var i = this.IDBOpenDBRequest.transaction([this.storeName], "readwrite").objectStore(this.storeName), o = 0; A.length > o; o += 1) {
                    i.put({
                        id: A[o].key,
                        data: A[o]
                    }).onsuccess = function(A) {}
                }
        },
        set: function(A, e, t, i) {
            var o = performance.now();
            if (this.IDBOpenDBRequest) {
                var n = this.IDBOpenDBRequest.transaction([this.storeName], "readwrite").objectStore(this.storeName).add([{
                    id: A,
                    data: e
                }]);
                n.onsuccess = function(A) {
                    "function" == typeof t && t(A.target.result),
                    Bh.debug("Saved state to IndexedDB. " + (performance.now() - o).toFixed(2) + "ms")
                }
                ,
                n.onerror = function(A) {
                    "function" == typeof i && i(A)
                }
            }
        },
        put: function(A, e, t, i, o) {
            if (this.IDBOpenDBRequest) {
                var n = performance.now()
                  , r = this.IDBOpenDBRequest.transaction([t], "readwrite").objectStore(t).put({
                    id: A,
                    data: e
                });
                r.onsuccess = function(A) {
                    "function" == typeof i && i(A.target.result),
                    Bh.debug("Saved state to IndexedDB. " + (performance.now() - n).toFixed(2) + "ms")
                }
                ,
                r.onerror = function(A) {
                    Bh.error("离线存储出错:", A.target.error.name, ":", A.target.error.message),
                    "function" == typeof o && o(A)
                }
            }
        },
        delete: function(A, e, t) {
            if (this.IDBOpenDBRequest) {
                var i = this.IDBOpenDBRequest.transaction(this.storeName, "readwrite").objectStore(this.storeName).delete(A);
                i.onsuccess = function(A) {
                    Bh.debug("delete data form IndexedDB."),
                    "function" == typeof e && e(A.target.result)
                }
                ,
                i.onerror = function(A) {
                    Bh.error("IndexedDB", A),
                    "function" == typeof t && t(A)
                }
            }
        },
        clear: function(A, e) {
            if (this.IDBOpenDBRequest) {
                var t = this.IDBOpenDBRequest.transaction(this.storeName, "readwrite").objectStore(this.storeName).clear();
                t.onsuccess = function(e) {
                    Bh.debug("Cleared IndexedDB."),
                    "function" == typeof A && A(e.target.result)
                }
                ,
                t.onerror = function(A) {
                    Bh.error("IndexedDB", A),
                    "function" == typeof e && e(A)
                }
            }
        },
        deleteDatabase: function(A) {
            indexedDB.deleteDatabase(this.dbName),
            Bh.debug(this.dbName + "数据库已删除"),
            "function" == typeof A && A()
        },
        close: function(A) {
            this.IDBOpenDBRequest && (this.IDBOpenDBRequest.close(),
            Bh.debug("数据库已关闭"),
            "function" == typeof A && A())
        },
        getIndex: function(A, e, t, i) {
            var o = A.transaction(e, "readwrite").objectStore(e).index("id");
            o.openCursor().onsuccess = function() {
                var A = this.result;
                A && (Bh.debug(A.value),
                A.continue())
            }
            ;
            var n = IDBKeyRange.only(2)
              , r = o.openCursor(n);
            r.onsuccess = function() {
                var A = r.result;
                A && Bh.info(A.value)
            }
        },
        destroy: function() {
            this.close(),
            this.IDBOpenDBRequest = null,
            this.dbName = null,
            this.storeName = null
        }
    });
    var eC = function(A) {
        this.serverUrl = A.serverUrl,
        this.modelKey = A.modelKey,
        this.dbName = A.dbName,
        this.offLine = A.offLine,
        this.shareParameter = "" !== A.share ? "&share=" + A.share : ""
    };
    eC.prototype.projectUrl = function(A) {
        return this.offLine ? this.serverUrl + "/" + this.modelKey + "/resource/scene/scene.json" : this.serverUrl + "/api/" + this.dbName + "/models?modelKey=" + (A || this.modelKey) + this.shareParameter
    }
    ,
    eC.prototype.sceneUrl = function(A) {
        return this.serverUrl + this.modelKey + "/scene/scene_" + (A = A || 0) + vc.ZipResourcePostfix
    }
    ,
    eC.prototype.sceneIdUrl = function() {
        return this.serverUrl + this.modelKey + "/scene/scene_id" + vc.ZipResourcePostfix
    }
    ,
    eC.prototype.userIdUrl = function() {
        return this.serverUrl + this.modelKey + "/scene/user_id" + vc.ZipResourcePostfix
    }
    ,
    eC.prototype.octreeUrl = function(A) {
        return this.serverUrl + this.modelKey + "/scene/octree_" + A + vc.ZipResourcePostfix
    }
    ,
    eC.prototype.symbolUrl = function() {
        return this.serverUrl + this.modelKey + "/symbol/symbol" + vc.ZipResourcePostfix
    }
    ,
    eC.prototype.mpkUrl = function(A) {
        return this.offLine ? this.serverUrl + "/" + this.modelKey + "/resource/data/" + A : np(this.apiVersion, "1.6.0") ? this.serverUrl + "/data?fileKey=" + A : this.serverUrl + "/api/" + this.dbName + "/files?fileKey=" + A
    }
    ,
    eC.prototype.texUrl = function(A) {
        return this.offLine ? this.serverUrl + "/" + this.modelKey + "/resource/data/Texture/" + A : np(this.apiVersion, "1.6.0") ? this.serverUrl + "/data?fileKey=" + A : this.serverUrl + "/api/" + this.dbName + "/files?fileKey=" + A
    }
    ,
    eC.prototype.bonesUrl = function(A) {
        return this.offLine ? this.serverUrl + "/" + this.modelKey + "/resource/data/" + A : np(this.apiVersion, "1.6.0") ? this.serverUrl + "/data?fileKey=" + A : this.serverUrl + "/api/" + this.dbName + "/files?fileKey=" + A
    }
    ,
    eC.prototype.nodesUrl = function(A) {
        return this.offLine ? this.serverUrl + "/" + this.modelKey + "/resource/data/" + A : np(this.apiVersion, "1.6.0") ? this.serverUrl + "/data?fileKey=" + A : this.serverUrl + "/api/" + this.dbName + "/files?fileKey=" + A
    }
    ,
    eC.prototype.clipsUrl = function(A) {
        return this.offLine ? this.serverUrl + "/" + this.modelKey + "/resource/data/" + A : np(this.apiVersion, "1.6.0") ? this.serverUrl + "/data?fileKey=" + A : this.serverUrl + "/api/" + this.dbName + "/files?fileKey=" + A
    }
    ,
    eC.prototype.kdTreeUrl = function(A) {
        return this.offLine ? this.serverUrl + "/" + this.modelKey + "/resource/data/" + A : np(this.apiVersion, "1.6.0") ? this.serverUrl + "/data?fileKey=" + A : this.serverUrl + "/api/" + this.dbName + "/files?fileKey=" + A
    }
    ,
    eC.prototype.lightUrl = function(A) {
        return this.offLine ? this.serverUrl + "/" + this.modelKey + "/resource/data/" + A : np(this.apiVersion, "1.6.0") ? this.serverUrl + "/data?fileKey=" + A : this.serverUrl + "/api/" + this.dbName + "/files?fileKey=" + A
    }
    ,
    eC.prototype.rootTilesUrl = function(A) {
        return this.offLine ? this.serverUrl + "/" + this.modelKey + "/tileset.json" : this.serverUrl + "/api/" + this.dbName + "/geomodels/" + this.modelKey + "/data/tileset.json"
    }
    ,
    eC.prototype.tilesUrl = function(A) {
        return this.offLine ? this.serverUrl + "/" + this.modelKey + "/" + A : this.serverUrl + "/api/" + this.dbName + "/geomodels/" + this.modelKey + "/data/" + A
    }
    ,
    eC.prototype.b3dmUrl = function(A) {
        return this.offLine ? this.serverUrl + "/" + this.modelKey + "/" + A : this.serverUrl + "/api/" + this.dbName + "/geomodels/" + this.modelKey + "/data/" + A
    }
    ,
    eC.prototype.attributeUrl = function() {
        if (this.offLine)
            return this.serverUrl + "/" + this.modelKey + "/resource/attribute/attribute.json"
    }
    ,
    eC.prototype.meshIdUrl = function() {
        return this.serverUrl + this.modelKey + "/mpk/mesh_id" + vc.ZipResourcePostfix
    }
    ,
    eC.prototype.materialUrl = function() {
        return this.serverUrl + this.modelKey + "/material/material" + vc.ZipResourcePostfix
    }
    ,
    eC.prototype.materialIdUrl = function() {
        return this.serverUrl + this.modelKey + "/material/material_id" + vc.ZipResourcePostfix
    }
    ,
    eC.prototype.userDataUrl = function() {
        return this.serverUrl + this.modelKey + "/userdata/userdata" + vc.ZipResourcePostfix
    }
    ,
    eC.prototype.textureUrl = function(A) {
        return this.offLine ? this.serverUrl + "/" + this.modelKey + "/resource/data/" + A : np(this.apiVersion, "1.6.0") ? this.serverUrl + "/data?fileKey=" + A : this.serverUrl + "/api/" + this.dbName + "/files?fileKey=" + A + this.shareParameter
    }
    ,
    eC.prototype.axisNetUrl = function(A) {
        return this.offLine ? this.serverUrl + "/" + this.modelKey + "/resource/data/" + A : np(this.apiVersion, "1.6.0") ? this.serverUrl + "/data?fileKey=" + A : this.serverUrl + "/api/" + this.dbName + "/files?fileKey=" + A
    }
    ,
    eC.prototype.floorInfoUrl = function(A) {
        return this.offLine ? this.serverUrl + "/" + A + "/resource/floor/floorKey.json" : this.serverUrl + "/api/" + this.dbName + "/components/floorkeys?modelKey=" + A + this.shareParameter
    }
    ,
    eC.prototype.floorMapUrl = function(A) {
        return this.offLine ? this.serverUrl + "/" + this.modelKey + "/resource/floor/map.json" : this.serverUrl + "/api/" + this.dbName + "/models/maps?modelKey=" + this.modelKey + this.shareParameter
    }
    ;
    var tC = function(A) {
        $u.call(this, A),
        this.instancedComponent = {}
    };
    Object.assign(tC.prototype, $u.prototype),
    tC.prototype.parseItemData = function(A) {
        this._readMaterialBuffer(this.model);
        var e = {}
          , t = this.referencedMeshCache;
        for (var i in Bh.time("_readItemData"),
        t.components)
            t.components.hasOwnProperty(i) && this._readItemData(e, i, i, void 0, 0);
        Bh.timeEnd("_readItemData"),
        e = null,
        A && A()
    }
    ,
    tC.prototype._readItemData = function(A, e, t) {
        var i = this.referencedMeshCache.components[e];
        void 0 !== i && this._readMeshInfo(A, t, i, null)
    }
    ,
    tC.prototype._readMeshInfo = function(A, e, t, i) {
        var o = this.referencedMeshCache
          , n = this.model.materialManager.materials
          , r = null;
        if (t.nodes || t.nodeIds) {
            r = t.originalId;
            var a = (new M).fromArray(t.matrix || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
            t.matrix = a;
            var s = [];
            s = t.nodes ? t.nodes : t.nodeIds;
            for (var l = 0; s.length > l; l += 1) {
                var c = s[l];
                if ("object" !== lc(c) && (c = this.getReferencedMeshComponentNodeById(c)),
                c) {
                    var h, d = null, p = "";
                    if (-1 !== c.geoId)
                        if (d = this._getComponentNodeAttr(c, t, l)) {
                            if (t.buildInCategory && (d.buildInCategory = t.buildInCategory),
                            !n[p = c.material]) {
                                var g = _u[t.type] ? _u[t.type].color : void 0;
                                g || (Bh.log("Material not found for type: ", t.type),
                                g = _u.DEFAULT.color),
                                g || (Bh.log("Default material not found for type: ", t.type),
                                g = [1, 1, 1, 1]);
                                var u = new LA(g[0],g[1],g[2])
                                  , f = p || u.getHexString() + "_" + g[3]
                                  , m = n[f];
                                m || (Bh.warn("缺少材质 " + p),
                                m = Kd.createStandardMaterial({
                                    color: u
                                }),
                                1 > g[3] && (m.transparent = !0,
                                m.opacity = g[3]),
                                m.side = 2,
                                n[f] = m),
                                d.material = p = f
                            }
                            if (n[p].aoMap) {
                                var C = this.getReferencedMeshBufferById(d.geometryId);
                                C && (C.uv2 = C.uv)
                            }
                            h = d.nodeId;
                            var y = this.userDataReader
                              , v = y ? y.getUserData(null) : null;
                            d.type = t.type,
                            d.userId = e,
                            d.name = t.name,
                            d.userDataId = null,
                            d.originalId = r,
                            d.materialId = p,
                            d.originMId = p,
                            d.userData = v,
                            d.categoryId = 0,
                            d.componentKey = e,
                            d.familyName = t.familyName,
                            d.familySymbol = t.familySymbol;
                            var I = vc.Instance
                              , E = o.reuseNodes.hasOwnProperty(h);
                            d.instanceOrNot = !(!I || !E),
                            d.isBatched = !0,
                            d.state = Lc.Visible,
                            d.material = null,
                            this._classifyNodeInfo(d),
                            d = null
                        } else
                            Bh.debug("非法node")
                }
            }
        }
    }
    ,
    tC.prototype._parseInstanced = function() {
        Bh.time("_parseInstanced"),
        this.instancedComponent = {},
        this.instancedNode = {};
        var A = {}
          , e = this.referencedMeshCache
          , t = e.componentNodes
          , i = this.model.materialManager.materials;
        for (var o in e.components)
            if (e.components.hasOwnProperty(o))
                for (var n = e.components[o], r = 0, a = n.Nodes.length; a > r; r += 1) {
                    var s = n.Nodes[r]
                      , l = t[s]
                      , c = l.geometry
                      , h = l.material;
                    if (-1 !== c) {
                        if (!h && 0 !== h) {
                            var d = _u[n.type] ? _u[n.type].color : void 0;
                            d || (Bh.log("Material not found for type: ", n.type),
                            d = _u.DEFAULT.color),
                            d || (Bh.log("Default material not found for type: ", n.type),
                            d = [1, 1, 1, 1]);
                            var p = new LA(d[0],d[1],d[2])
                              , g = p.getHexString() + "_" + d[3]
                              , u = i[g];
                            u || (Bh.warn("缺少材质 " + g),
                            u = Kd.createStandardMaterial({
                                color: p
                            }),
                            1 > d[3] && (u.transparent = !0,
                            u.opacity = d[3]),
                            u.side = 2,
                            i[g] = u),
                            l.material = g,
                            h = g
                        }
                        var f = h + "&" + c;
                        void 0 === A[f] && (A[f] = []),
                        A[f].push({
                            nodeId: s
                        })
                    } else
                        Bh.debug("实体没有几何")
                }
        for (var m in A)
            if (A.hasOwnProperty(m))
                if (1 < A[m].length)
                    for (var C = 0; A[m].length > C; C += 1)
                        this.instancedComponent[A[m][C].nodeId] = !0;
                else
                    delete A[m];
        Bh.timeEnd("_parseInstanced")
    }
    ;
    var iC = function(A) {
        Xu.call(this, A),
        this.maxGeoLoadTaskCount = 0,
        this.geoLoadTaskCount = 0,
        this.taskInstancedGeometrieManager = new Ou(this,"geometrie"),
        this.descriptor = new tC(A.model)
    };
    (iC.prototype = Object.assign(iC.prototype, Xu.prototype))._parseMaterial = function(A, e) {
        if (A) {
            var t = this.descriptor;
            if (t)
                for (var i in A)
                    t.cacheReferencedMeshMaterialData(i, A[i])
        } else
            Bh.error("没有数据")
    }
    ,
    iC.prototype.loadBatchedGeometrie = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.url
          , n = this.model;
        i.setResponseType("arraybuffer"),
        i.setCacheViable(!this.offLine);
        var r = i.load(o.mpkUrl(A), (function(i) {
            t._parseBatchedGeometrie(i, A),
            Bh.debug("geo load from online"),
            t._onGeoTaskFinished(),
            e()
        }
        ), void 0, (function(A) {
            n.dispatchEventEx({
                type: Tc.LOAD_GEOMETRY_ERROR,
                modelKey: n.modelKey
            }),
            e(),
            t._onGeoTaskFinished()
        }
        ));
        t.requests.loadGeometrie = r
    }
    ,
    iC.prototype.loadInstancedGeometrie = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.url
          , n = this.model;
        i.setResponseType("arraybuffer"),
        i.setCacheViable(!this.offLine);
        var r = i.load(o.mpkUrl(A), (function(i) {
            t._parseInstancedGeometrie(i, A),
            Bh.debug("geo load from online"),
            t._onGeoTaskFinished(),
            e()
        }
        ), void 0, (function(A) {
            n.dispatchEventEx({
                type: Tc.LOAD_GEOMETRY_ERROR,
                modelKey: n.modelKey
            }),
            e(),
            t._onGeoTaskFinished()
        }
        ));
        t.requests.loadGeometrie = r
    }
    ,
    iC.prototype._parseGeometrie = function(A, e) {
        if (A) {
            var t = this.descriptor;
            if (t)
                for (var i in A)
                    A.hasOwnProperty(i) && (A[i].position = new Float32Array(A[i].positions),
                    delete A[i].positions,
                    A[i].index = new Uint32Array(A[i].indices),
                    delete A[i].indices,
                    A[i].normal = new Float32Array(A[i].normals),
                    A[i].uv = new Float32Array(A[i].uv),
                    delete A[i].normals,
                    t.cacheReferencedMeshBufferData(i, A[i]))
        } else
            Bh.error("没有数据")
    }
    ,
    iC.prototype._parseBatchedGeometrie = function(A, e) {
        var t = new ku.BatchedGeometryReader(A,this.dataVersion)
          , i = this.descriptor;
        if (i) {
            var o = t.geoCount;
            Bh.time("createBatchedMeshNodes");
            for (var n = 0; o > n; n += 1) {
                var r = t.geomMap[n];
                void 0 !== r.position && void 0 !== r.index && void 0 !== r.normal ? (i.cacheReferencedMeshBufferData(r.geoId, r),
                this.handler.createBatchedMeshNodes(r)) : Bh.error("Error Geometry!")
            }
            this.model.manager.viewerImpl.render(),
            Bh.timeEnd("createBatchedMeshNodes"),
            t = null
        }
    }
    ,
    iC.prototype._parseInstancedGeometrie = function(A, e) {
        var t = new ku.InstancedGeometryReader(A,this.dataVersion)
          , i = this.descriptor;
        if (i) {
            var o = t.geoCount;
            Bh.time("createInstancedMeshNodes");
            for (var n = 0; o > n; n += 1) {
                var r = t.geomMap[n];
                void 0 !== r.position && void 0 !== r.index && void 0 !== r.normal ? (i.cacheReferencedMeshBufferData(r.geoId, r),
                this.handler.createInstancedMeshNodes(r)) : Bh.error("Error Geometry!")
            }
            this.model.manager.viewerImpl.render(),
            t = null,
            Bh.timeEnd("createInstancedMeshNodes")
        }
    }
    ,
    iC.prototype.startLoadSceneAndGeos = function(A) {
        Bh.time("几何数据加载时间");
        var e = A.scene
          , t = e.instancedGeometries.length || 0
          , i = e.batchedGeometries
          , o = e.instancedGeometries;
        this.maxGeoLoadTaskCount += e.batchedGeometries.length || 0,
        this.maxGeoLoadTaskCount += t,
        this._loadBatchedGeo(i),
        this._loadInstancedGeo(o)
    }
    ,
    iC.prototype._loadBatchedGeo = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.mpkUrl(A[o]));
            var n = this.model.getStorage();
            if (n)
                for (var r = function() {
                    var t = i.splice(0, 30);
                    n.getBatch(t, (function(A) {
                        for (var i = function(i) {
                            if (A[t[i]])
                                if (!0 === A[t[i]].split) {
                                    var o = A[t[i]].list
                                      , s = new Uint8Array(A[t[i]].length);
                                    n.getBatch(o, (function(A) {
                                        for (var n = !0, r = 0; o.length > r; r += 1)
                                            A[o[r]] ? s.set(new Uint8Array(A[o[r]]), 4e7 * r) : (n = !1,
                                            Bh.error("获取分割几何失败"));
                                        if (n) {
                                            var a = t[i].indexOf("fileKey=");
                                            e._parseBatchedGeometrie(s.buffer, t[i].slice(a + 8)),
                                            e._onGeoTaskFinished(),
                                            Bh.debug("load geo from local")
                                        } else {
                                            var l = e.taskGeometrieManager
                                              , c = t[i].indexOf("fileKey=");
                                            if (-1 === c)
                                                return void Bh.error("url is not has fileKey");
                                            l.addTask(t[i].slice(c + 8)),
                                            Bh.debug("load geo from net"),
                                            e.taskGeometrieManager.processTasks(e.loadBatchedGeometrie.bind(e))
                                        }
                                    }
                                    ), (function() {
                                        Bh.error("获取分割几何失败")
                                    }
                                    ))
                                } else
                                    a = t[i].indexOf("fileKey="),
                                    e._parseBatchedGeometrie(A[t[i]], t[i].slice(a + 8)),
                                    e._onGeoTaskFinished(),
                                    Bh.debug("load geo from local");
                            else {
                                if (r = e.taskGeometrieManager,
                                -1 === (a = t[i].indexOf("fileKey=")))
                                    return Bh.error("url is not has fileKey"),
                                    {
                                        v: void 0
                                    };
                                r.addTask(t[i].slice(a + 8)),
                                Bh.debug("load geo from net")
                            }
                        }, o = 0; t.length > o; o += 1) {
                            var r, a, s = i(o);
                            if ("object" === lc(s))
                                return s.v
                        }
                        e.taskGeometrieManager.processTasks(e.loadBatchedGeometrie.bind(e))
                    }
                    ), (function() {
                        for (var t = e.taskGeometrieManager, i = 0; A.length > i; i += 1)
                            t.addTask(A[i]);
                        t.processTasks(e.loadBatchedGeometrie.bind(e))
                    }
                    ))
                }; i.length > 0; )
                    r()
        } else {
            for (var a = this.taskGeometrieManager, s = 0; A.length > s; s += 1)
                a.addTask(A[s]);
            a.processTasks(e.loadBatchedGeometrie.bind(e))
        }
    }
    ,
    iC.prototype._loadInstancedGeo = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.mpkUrl(A[o]));
            var n = this.model.getStorage();
            if (n)
                for (var r = function() {
                    var t = i.splice(0, 30);
                    n.getBatch(t, (function(A) {
                        for (var i = function(i) {
                            if (A[t[i]])
                                if (!0 === A[t[i]].split) {
                                    var o = A[t[i]].list
                                      , s = new Uint8Array(A[t[i]].length);
                                    n.getBatch(o, (function(A) {
                                        for (var n = 0; o.length > n; n += 1)
                                            A[o[n]] ? s.set(new Uint8Array(A[o[n]]), 4e7 * n) : Bh.error("获取分割几何失败");
                                        var r = t[i].indexOf("fileKey=");
                                        e._parseInstancedGeometrie(s.buffer, t[i].slice(r + 8)),
                                        e._onGeoTaskFinished(),
                                        Bh.debug("load geo from local")
                                    }
                                    ), (function() {
                                        Bh.error("获取分割几何失败")
                                    }
                                    ))
                                } else
                                    a = t[i].indexOf("fileKey="),
                                    e._parseInstancedGeometrie(A[t[i]], t[i].slice(a + 8)),
                                    e._onGeoTaskFinished(),
                                    Bh.debug("load geo from local");
                            else {
                                if (r = e.taskInstancedGeometrieManager,
                                -1 === (a = t[i].indexOf("fileKey=")))
                                    return Bh.error("url is not has fileKey"),
                                    {
                                        v: void 0
                                    };
                                r.addTask(t[i].slice(a + 8)),
                                Bh.debug("load geo from net")
                            }
                        }, o = 0; t.length > o; o += 1) {
                            var r, a, s = i(o);
                            if ("object" === lc(s))
                                return s.v
                        }
                        e.taskInstancedGeometrieManager.processTasks(e.loadInstancedGeometrie.bind(e))
                    }
                    ), (function() {
                        for (var t = e.taskInstancedGeometrieManager, i = 0; A.length > i; i += 1)
                            t.addTask(A[i]);
                        t.processTasks(e.loadInstancedGeometrie.bind(e))
                    }
                    ))
                }; i.length > 0; )
                    r()
        } else {
            for (var a = this.taskInstancedGeometrieManager, s = 0; A.length > s; s += 1)
                a.addTask(A[s]);
            a.processTasks(e.loadInstancedGeometrie.bind(e))
        }
    }
    ,
    iC.prototype._onGeoTaskFinished = function() {
        (this.geoLoadTaskCount += 1,
        this.notifyProgress) && (this.progressCallback && this.progressCallback({
            total: this.maxLoadTaskCount + this.maxGeoLoadTaskCount,
            loaded: .8 * (this.loadTaskCount + this.geoLoadTaskCount),
            modelKey: this.model.modelKey
        }));
        this.maxGeoLoadTaskCount > this.geoLoadTaskCount || (this.dataLoaded = !0,
        Bh.timeEnd("几何数据加载时间"),
        this.geoFinishCallback && this.geoFinishCallback())
    }
    ,
    iC.prototype.getSceneTaskCount = function(A) {
        var e = A.scenes;
        return e += A.lines,
        e += A.mpks,
        vc.BorderLineDelayLoaded || (e += this.getAllBorderlineCount()),
        e
    }
    ;
    var oC = function(A, e) {
        tf.call(this, A),
        this.defaultManager = new Of(e,A),
        this.instancedManager = new Hf(A),
        this.loader = new iC(this)
    };
    (oC.prototype = Object.create(tf.prototype)).prepare = function(A, e) {
        if (this.isLoaded() && !this.isHidden()) {
            this.prepareWireframe(this.model, e);
            this.model.getMaterialManager();
            this.model.getMaterialManager()._updateTextureMapping(),
            !this.model.lightmap || this.model.enableLightmap === vc.EnableLightmap && this.model.lightmapIntensity === vc.LightmapIntensity || (this.model.enableLightmap = vc.EnableLightmap,
            this.model.lightmapIntensity = vc.LightmapIntensity,
            this.rebuildIndicesforLightmap(),
            this.updateNodes())
        }
    }
    ,
    oC.prototype.settleData = function(A) {
        var e = this;
        this.addNodeInfoToOctantMap(),
        e.model.setLoaded(!0);
        this.loader.geoFinishCallback = function() {
            e.loaded = !0,
            e.model.getMaterialManager()._updateTextureMapping(),
            e.clearCachedData(e.model),
            A && A()
        }
        ,
        this.loader.startLoadSceneAndGeos(this.model.getConfig())
    }
    ,
    oC.prototype.addNodeInfoToOctantMap = function() {
        var A = this.model.manager
          , e = this.model.getEncodedDatabagId();
        this.loader.getDescriptor().traverseNodeInfosByComponent((function(t, i) {
            A.addNodeInfoToOctantMap(e, t, i)
        }
        ))
    }
    ,
    oC.prototype.createMeshNodes = function(A) {
        var e = this
          , t = this.model;
        vc.stepLoad && t.setLoaded(!0);
        var i = this.loader.getDescriptor();
        this.instancedManager.createMeshNodes(t, i.getInstancedUserIds()),
        this.defaultManager.asyncCreateMeshNodes(t, i.getStandardUserIds(), (function() {
            t.getMaterialManager()._updateTextureMapping(),
            e.clearCachedData(t),
            e.loaded = !0,
            A && A()
        }
        ))
    }
    ,
    oC.prototype.clearCachedData = function(A) {
        this.loader.getDescriptor().destroyReader(),
        this.loader.getDescriptor().clearReferencedMeshCache(),
        this.defaultManager.clearCachedData(),
        this.instancedManager.clearCachedData()
    }
    ,
    oC.prototype.createBatchedMeshNodes = function(A) {
        this.defaultManager.createBatchedMeshNodes(this.model, A)
    }
    ,
    oC.prototype.createInstancedMeshNodes = function(A) {
        this.instancedManager.createInstancedMeshNodes(this.model, A)
    }
    ;
    var nC = function(A) {
        Xu.call(this, A),
        this._loadingOnDemand = !1
    };
    (nC.prototype = Object.assign(nC.prototype, Xu.prototype)).loadGeopkOnDemand = function(A, e, t) {
        this.loadTaskCount = 0,
        this.maxLoadTaskCount = A.length,
        this._loadingOnDemand = !0,
        this.finishCallback = t;
        var i = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var o = this.url, n = [], r = 0; A.length > r; r += 1)
                n.push(o.mpkUrl(A[r]));
            var a = this.model.getStorage();
            a && a.getBatch(n, (function(A) {
                for (var t = function(e) {
                    if (A[n[e]])
                        if (!0 === A[n[e]].split) {
                            var t = A[n[e]].list
                              , o = new Uint8Array(A[n[e]].length);
                            a.getBatch(t, (function(A) {
                                for (var r = 0; t.length > r; r += 1)
                                    A[t[r]] ? o.set(new Uint8Array(A[t[r]]), 4e7 * r) : Bh.error("获取分割几何失败");
                                var a = n[e].indexOf("fileKey=");
                                i._parseGeometrie(o.buffer, n[e].slice(a + 8)),
                                Bh.debug("load geo from local"),
                                i._onTaskFinished()
                            }
                            ), (function() {
                                Bh.error("获取分割几何失败")
                            }
                            ))
                        } else
                            s = n[e].indexOf("fileKey="),
                            i._parseGeometrie(A[n[e]], n[e].slice(s + 8)),
                            Bh.debug("load geo from local"),
                            i._onTaskFinished();
                    else {
                        if (r = i.taskGeometrieManager,
                        -1 === (s = n[e].indexOf("fileKey=")))
                            return Bh.error("url is not has fileKey"),
                            {
                                v: void 0
                            };
                        r.addTask(n[e].slice(s + 8)),
                        Bh.debug("load geo from net")
                    }
                }, o = 0; n.length > o; o += 1) {
                    var r, s, l = t(o);
                    if ("object" === lc(l))
                        return l.v
                }
                i.taskGeometrieManager.processTasks(i.loadGeometrie.bind(i), e)
            }
            ), (function() {
                for (var t = i.taskGeometrieManager, o = 0; A.length > o; o += 1)
                    t.addTask(A[o]);
                t.processTasks(i.loadGeometrie.bind(i), e)
            }
            ))
        } else {
            for (var s = this.taskGeometrieManager, l = 0; A.length > l; l += 1)
                s.addTask(A[l]);
            s.processTasks(i.loadGeometrie.bind(i), e, t)
        }
    }
    ,
    nC.prototype.resetProcessState = function(A) {
        this.loadTaskCount = 0,
        this.maxLoadTaskCount = A,
        this._loadingOnDemand = !0
    }
    ,
    nC.prototype.dealProgressSegment = function(A, e) {
        return vc.MergeComponent && this._loadingOnDemand ? e * A.progressPercentage.load : e
    }
    ,
    nC.prototype._loadLayerKey = function() {
        var A = this
          , e = this.fileLoader
          , t = this.url
          , i = this.model
          , o = this.handler.getLayerProvider();
        e.setResponseType(""),
        e.load(t.layerKeyUrl(), (function(e) {
            var t = new LayerKeyReader(e)
              , i = []
              , n = t.getData();
            o.cacheLayerKeys(n);
            for (var r = 0, a = t.getCount(); a > r; ++r) {
                var s = t.getLayerKey(r)
                  , l = o.formatLayerIds(s);
                i.push(l[0])
            }
            A._loadLayer(i)
        }
        ), void 0, (function(e) {
            i.dispatchEvent({
                type: Tc.LOAD_ERROR,
                errorType: Tc.LOAD_MPK_ERROR,
                event: e
            }),
            A._onTaskFinished()
        }
        ))
    }
    ,
    nC.prototype._loadLayer = function(A) {
        var e = this
          , t = this.fileLoader
          , i = this.url
          , o = this.model
          , n = this.handler.getLayerProvider();
        t.setResponseType("arraybuffer"),
        t.load(i.layerUrl(), (function(t) {
            for (var i = new LayerReader(t), o = 0, r = i.getLayerCount(); r > o; ++o)
                if (void 0 !== A[o]) {
                    for (var a = [], s = i.getLayerData(o), l = i.getGeopkList(o), c = 0, h = l.length; h > c; c += 1)
                        a.push(l[c]);
                    n.cacheLayerData(A[o], {
                        layerId: s.layer_id,
                        boundingBox: s.boundingBox,
                        mpkIdxs: a
                    })
                }
            e._onTaskFinished()
        }
        ), void 0, (function(A) {
            o.dispatchEvent({
                type: Tc.LOAD_ERROR,
                errorType: Tc.LOAD_MPK_ERROR,
                event: A
            }),
            e._onTaskFinished()
        }
        ))
    }
    ,
    nC.prototype.delayLoadResources = function(A) {
        var e = this.model.getConfig().metadata;
        e && 0 !== e.lines ? (this.startCallback = null,
        this.progressCallback = null,
        this.finishCallback = A,
        this.loadTaskCount = 0,
        this.maxLoadTaskCount = 0,
        this.maxLoadTaskCount += e.lines,
        e.lines && this._loadLine()) : A && A()
    }
    ;
    var rC = function(A) {
        Af.call(this, A)
    };
    (rC.prototype = Object.assign(rC.prototype, Af.prototype)).parseItemData = function(A, e) {
        var t = this.model;
        (ap(t.dataVersion, "2.0.0") || void 0 === t.dataVersion) && (Bh.time("升级几何结构"),
        this._updateV1ToV2(t),
        t.dataVersion = "2.0.0",
        Bh.timeEnd("升级几何结构")),
        this._readMaterialBuffer(t),
        t.hasAnimation && vc.EnableAnimation ? (this._parseClips(),
        this._parseBones()) : (this._parseGeo(),
        vc.Instance && sp(t.dataVersion, "2.0.0") && this._parseInstanced());
        var i = {};
        if (!i)
            return Bh.log("Empty scene"),
            !1;
        var o = this.referencedMeshCache;
        if (Bh.time("_readItemData"),
        !o.bufferData || 0 >= Object.keys(o.bufferData).length)
            return !0;
        if (A)
            for (var n = 0, r = A.length; r > n; n += 1)
                o.components[A[n]] && this._readItemData(i, A[n], A[n], void 0, 0);
        else
            for (var a in o.components)
                this._readItemData(i, a, a, void 0, 0);
        t.hasAnimation && vc.EnableAnimation && this._parseNodes(),
        Bh.timeEnd("_readItemData"),
        i = null,
        e && e()
    }
    ;
    var aC = function(A) {
        nC.call(this, A),
        this.descriptor = new rC(A.model)
    };
    (aC.prototype = Object.assign(aC.prototype, nC.prototype)).loadSceneAndMpks = function(A) {
        this._loadScene(0),
        this._loadLayerKey(),
        vc.BorderLineDelayLoaded || this._loadAllBorderlines(A)
    }
    ,
    aC.prototype.getSceneTaskCount = function(A) {
        var e = 2;
        return vc.BorderLineDelayLoaded || (e += this.getAllBorderlineCount()),
        e
    }
    ;
    var sC = function(A) {
        tf.call(this, A),
        this.layerDataLoaded = !1,
        this.loadedUserIdsObject = null,
        this.loadedUserIds = null,
        this.layerProvider = null,
        this.firstToLoad = !1
    };
    (sC.prototype = Object.assign(sC.prototype, tf.prototype)).destroy = function() {
        sC.prototype.destroy.call(this),
        this.loadedUserIdsObject = null,
        this.loadedUserIds = null,
        this.layerProvider.destroy(),
        this.layerProvider = null
    }
    ,
    sC.prototype.getLayerProvider = function() {
        return this.layerProvider
    }
    ,
    sC.prototype.load = function(A) {
        var e = this
          , t = this.model;
        this.loader.setNotifyProgress(A),
        this.loader.load((function() {
            t.manager.dispatchEvent({
                type: Rc.ON_LOAD_START
            })
        }
        ), (function(A) {
            t.manager.dispatchEvent({
                type: Rc.ON_LOAD_PROGRESS,
                progress: A
            })
        }
        ), (function() {
            e.processLoadCompleted((function() {
                t.manager.dispatchEvent({
                    type: Rc.ON_LOAD_COMPLETE,
                    modelKey: e.model.modelKey
                })
            }
            ))
        }
        ))
    }
    ,
    sC.prototype.unload = function(A, e) {}
    ,
    sC.prototype.loadGeopkOnDemand = function(A, e, t, i) {
        var o = this
          , n = this.model
          , r = !A
          , a = function(A) {
            n.manager.dispatchEvent({
                type: Rc.ON_LOAD_PROGRESS,
                progress: A
            })
        };
        this.firstToLoad ? this.loader.delayLoadResources((function() {
            o.firstToLoad = !1,
            o.loader.finishCallback = null,
            o.prepareData((function() {
                o.loader.progressCallback = a,
                o.getLayerProvider().setConditionsOnDemandLoad(A),
                o._loadGeopkOnDemand(r, e, t, i)
            }
            ))
        }
        )) : (o.loader.progressCallback = a,
        o.getLayerProvider().setConditionsOnDemandLoad(A),
        o._loadGeopkOnDemand(r, e, t, i))
    }
    ,
    sC.prototype._loadGeopkOnDemand = function(A, e, t, i) {
        var o = this
          , n = this.model;
        this.layerDataLoaded = !1,
        e && e(),
        n.manager.dispatchEvent({
            type: Rc.ON_LOAD_START
        }),
        this.getLayerProvider().loadGeopkOnDemand(A, (function(A) {
            o.dealData(A)
        }
        ), (function(A, e) {}
        ), t, (function() {
            o.layerDataLoaded = !0,
            n.manager.updateFilterManager(),
            Bh.log("load finish"),
            n.dispatchEventEx({
                type: Rc.ON_DEMAND_LOAD_COMPLETE,
                data: {
                    boundingBox: n.manager.getLoadOnDemandDirector().getBoundingBoxForUsedComponent()
                },
                modelKey: o.model.modelKey
            }),
            i && i()
        }
        ))
    }
    ,
    sC.prototype.processLoadCompleted = function(A) {
        var e = this.model;
        e.materialManager._updateTextureMapping(),
        e.materialManager._updateIBL(e),
        e.loaded = !0,
        e.updateOctreeNode(),
        requestAnimationFrame((function() {
            A && A(),
            e.debut(e)
        }
        ))
    }
    ,
    sC.prototype.isAllReady = function() {
        return !(!this.isLoaded() || this.isHidden() || !this.isLayerDataLoaded())
    }
    ,
    sC.prototype.applyFilter = function() {
        if (this.isLoaded() && this.isLayerDataLoaded()) {
            var A = this.model.getModelDescriptor().getStandardUserIdsByCategory(this.loadedUserIds);
            if (A.length && this.defaultManager.applyFilter(this.model, A),
            vc.Instance) {
                var e = this.model.getModelDescriptor().getInstancedUserIdsByCategory(this.loadedUserIds);
                e.length && this.instancedManager.applyFilter(this.model, e)
            }
        }
    }
    ,
    sC.prototype.needUpdate = function() {
        return !!this.isLayerDataLoaded()
    }
    ,
    sC.prototype.clearData = function() {}
    ,
    sC.prototype.initData = function(A) {}
    ,
    sC.prototype.dealMeshNodes = function(A) {}
    ,
    sC.prototype.dealData = function(A) {
        var e = this;
        this.initData((function() {
            e.model.manager.loadOverrideMaterialsByDemand((function() {
                e.dealMeshNodes(A)
            }
            ), (function() {
                e.dealMeshNodes(A)
            }
            ))
        }
        ))
    }
    ,
    sC.prototype.getLoadedUserIdsObject = function() {
        return this.loadedUserIdsObject
    }
    ,
    sC.prototype.isLayerDataLoaded = function() {
        return this.layerDataLoaded
    }
    ,
    sC.prototype.clearLoadedState = function() {
        this.layerDataLoaded = !1,
        this.loadedUserIdsObject = null,
        this.loadedUserIds = null
    }
    ;
    var lC = function(A) {
        this.model = A,
        this.conditionsChanged = !0,
        this.nodeInfosWithLayerKey = {},
        this.cachedLayerData = {},
        this.cacheAttributes = null,
        this.cacheSpecialtysLevels = {},
        this.mapLayerKeys = {},
        this.lastUsedGeopkIdxsObject = null,
        this.lastUsedLayerIdsObject = null,
        this.lastUsedLayerData = null,
        this.mapNeededConditions = null
    };
    lC.prototype.destroy = function() {
        this.cachedLayerData = null,
        this.nodeInfosWithLayerKey = null,
        this.cacheAttributes = null,
        this.cacheSpecialtysLevels = null,
        this.mapLayerKeys = null,
        this.lastUsedLayerData = null,
        this.lastUsedGeopkIdxsObject = null,
        this.lastUsedLayerIdsObject = null,
        this.mapNeededConditions = null
    }
    ,
    lC.prototype.clearData = function() {}
    ,
    lC.prototype.loadLayerDataByIdxs = function(A, e, t, i) {}
    ,
    lC.prototype.dealLayerDataLoading = function(A, e, t, i, o) {}
    ,
    lC.prototype.loadGeopkOnDemand = function(A, e, t, i, o) {
        var n = A ? this.getAllLayerIdxData() : this.getUsedLayerIdxData();
        this.dealLayerDataLoading(this.getLayerIdxInfoByLayerData(n), e, t, i, o)
    }
    ,
    lC.prototype.getUsedIdxsInfoFrom = function(A, e) {
        var t = null
          , i = {}
          , o = {}
          , n = {}
          , r = {};
        if (A && A.length)
            for (var a = 0, s = A.length; s > a; a += 1)
                i[t = A[a]] = !0;
        if (e)
            if (uh.isEmptyObject(i))
                n = e;
            else {
                for (t in e)
                    i[t] && (r[t] = !0);
                if (uh.isEmptyObject(r))
                    o = i,
                    n = e;
                else {
                    for (t in e)
                        r[t] || (n[t] = !0);
                    for (t in i)
                        r[t] || (o[t] = !0)
                }
            }
        else
            uh.isEmptyObject(i) || (o = i);
        return {
            objCurrUsedIdxs: i,
            addIdxs: Object.keys(o),
            removeIdxs: Object.keys(n)
        }
    }
    ,
    lC.prototype.getLayerIdxInfoByLayerData = function(A) {
        var e = null
          , t = null;
        A ? (e = A.layerIds,
        t = A.mpkIdxs) : (e = null,
        t = null);
        var i = this.getUsedIdxsInfoFrom(e, this.lastUsedLayerIdsObject);
        this.lastUsedLayerIdsObject = i.objCurrUsedIdxs;
        var o = this.getUsedIdxsInfoFrom(t, this.lastUsedGeopkIdxsObject);
        return this.lastUsedGeopkIdxsObject = o.objCurrUsedIdxs,
        {
            layerScene: i,
            mpk: o
        }
    }
    ,
    lC.prototype.getUsedLayerIdxData = function() {
        if (!this.isConditionsChanged() && this.lastUsedLayerData)
            return this.lastUsedLayerData;
        this.setConditionsChanged(!1);
        var A = this.getConditionsOnDemand();
        if (!A)
            return this.lastUsedLayerData = null,
            null;
        this.getCachedLayerData();
        for (var e = [], t = A, i = this.model.getModelDescriptor().referencedMeshCache.components, o = this.model.getModelDescriptor(), n = 0, r = t.length; r > n; n += 1) {
            var a = t[n]
              , s = i[a];
            if (s)
                if (s.nodes || s.nodeIds)
                    for (var l = null, c = 0, h = (l = s.nodes ? s.nodes : s.nodeIds).length; h > c; c += 1) {
                        var d = l[c];
                        if ("object" !== lc(d) && (d = o.getReferencedMeshComponentNodeById(d)),
                        d) {
                            var p = this.getFileKeyByGeoId(d.geoId);
                            p && e.push(p)
                        }
                    }
                else {
                    var g = this.getFileKeyByGeoId(i[a].geoId);
                    g && e.push(g)
                }
        }
        return this.lastUsedLayerData = {
            layerIds: [],
            layerKeys: [],
            boundingBoxes: [],
            mpkIdxs: e
        },
        this.lastUsedLayerData
    }
    ,
    lC.prototype.getFileKeyByGeoId = function(A) {
        for (var e in this.cachedLayerData)
            if (this.cachedLayerData.hasOwnProperty(e)) {
                var t = this.cachedLayerData[e];
                if (A >= t[0] && t[1] >= A)
                    return e
            }
        return window.geoidToFileKeyMap ? window.geoidToFileKeyMap[A] : null
    }
    ,
    lC.prototype.getAllLayerIdxData = function() {
        this.setConditionsChanged(!1);
        var A = this.getCachedLayerData();
        if (!A)
            return null;
        var e = []
          , t = []
          , i = []
          , o = [];
        for (var n in A) {
            for (var r = A[n].mpkIdxs, a = 0, s = r.length; s > a; a += 1)
                i.push(r[a]);
            e.push(n),
            t.push(A[n].layerId),
            o.push(A[n].boundingBox)
        }
        return {
            layerIds: t,
            layerKeys: e,
            boundingBoxes: o,
            mpkIdxs: i
        }
    }
    ,
    lC.prototype.getUserIdsOnDemand = function() {
        var A = {}
          , e = this.getConditionsOnDemand();
        if (e)
            for (var t in e)
                A[e[t]] = !0;
        return A
    }
    ,
    lC.prototype.cacheLayerData = function(A, e) {
        this.cachedLayerData[A] = e
    }
    ,
    lC.prototype.getCachedLayerData = function() {
        return this.cachedLayerData
    }
    ,
    lC.prototype.clearNodeInfoCacheWithLayerKey = function() {
        this.nodeInfosWithLayerKey = {}
    }
    ,
    lC.prototype.cacheNodeInfoByLayerKey = function(A, e) {
        this.nodeInfosWithLayerKey[A] || (this.nodeInfosWithLayerKey[A] = []),
        this.nodeInfosWithLayerKey[A].push(e)
    }
    ,
    lC.prototype.cacheNodeInfosWithLayerKey = function() {
        var A = this.model.getModelDescriptor().getAllNodeInfos();
        for (var e in A)
            for (var t = A[e], i = 0, o = t.length; o > i; i += 1) {
                var n = t[i]
                  , r = this.formatLayerIds(n.userData);
                this.cacheNodeInfoByLayerKey(r[0], n)
            }
    }
    ,
    lC.prototype.cacheLayerKeys = function(A) {
        this.mapLayerKeys = A;
        var e = {}
          , t = this.getLayerKeyAttributes();
        for (var i in A) {
            var o = A[i]
              , n = o[t[0]]
              , r = o[t[1]];
            e.hasOwnProperty(n) || (e[n] = []),
            e.hasOwnProperty(r) || (e[r] = []),
            e[n].push(r),
            e[r].push(n)
        }
        this.cacheSpecialtysLevels = e
    }
    ,
    lC.prototype.getLayerKeyAttributes = function() {
        if (this.cacheAttributes)
            return this.cacheAttributes;
        var A = []
          , e = Object.keys(this.mapLayerKeys)
          , t = this.mapLayerKeys[e[0]];
        for (var i in t)
            t.hasOwnProperty(i) && A.push(i);
        return this.cacheAttributes = A,
        this.cacheAttributes
    }
    ,
    lC.prototype.formatLayerIds = function(A) {
        var e = [];
        if (!A)
            return e.push("unknown"),
            e;
        var t = this.getFileKeyByGeoId(A.originalGeometryId);
        return e.push(t || "unknown"),
        e
    }
    ,
    lC.prototype.getLevelsOrSpecialtys = function(A) {
        return this.cacheSpecialtysLevels.hasOwnProperty(A) ? this.cacheSpecialtysLevels[A] : (Bh.warn("Attribute " + A + "has no according levels or specialtys."),
        [])
    }
    ,
    lC.prototype.getUnionBoundingBoxOnDemand = function() {
        var A = this.getBoundingBoxesOnDemand();
        if (A && A.length > 0) {
            for (var e = new aA, t = 0, i = A.length; i > t; t += 1)
                e.union(A[t]);
            return e
        }
        return null
    }
    ,
    lC.prototype.getBoundingBoxesOnDemand = function() {
        var A = this.getUsedLayerIdxData();
        return A ? A.boundingBoxes : null
    }
    ,
    lC.prototype.setConditionsOnDemandLoad = function(A) {
        this.mapNeededConditions = A,
        this.setConditionsChanged(!0)
    }
    ,
    lC.prototype.setConditionsChanged = function(A) {
        this.conditionsChanged = A
    }
    ,
    lC.prototype.getConditionsOnDemand = function() {
        return this.mapNeededConditions
    }
    ,
    lC.prototype.isConditionsChanged = function() {
        return this.conditionsChanged
    }
    ;
    var cC = function(A) {
        lC.call(this, A)
    };
    (cC.prototype = Object.assign(cC.prototype, lC.prototype)).loadLayerDataByIdxs = function(A, e, t, i) {
        this.model.getLoader().resetProcessState(e.length),
        this.model.getLoader().loadGeopkOnDemand(e, (function(A, e) {
            t && t(e - A, e)
        }
        ), i)
    }
    ,
    cC.prototype.dealLayerDataLoading = function(A, e, t, i, o) {
        var n = A.mpk;
        if (0 !== n.addIdxs.length || 0 !== n.removeIdxs.length) {
            var r = !1;
            n.removeIdxs.length > 0 && (r = !0,
            t && t(null, n.removeIdxs)),
            n.addIdxs.length > 0 ? this.loadLayerDataByIdxs(null, n.addIdxs, i, (function() {
                e && e(o)
            }
            )) : r ? e && e(o) : o && o()
        } else
            e && e(o)
    }
    ;
    var hC = function(A) {
        return sC.call(this, A),
        this.layerProvider = new cC(A),
        this
    };
    (hC.prototype = Object.assign(hC.prototype, sC.prototype)).settleData = function(A) {
        this.addNodeInfoToOctantMap(),
        this.getLayerProvider().cacheNodeInfosWithLayerKey(),
        this.loaded = !0,
        A && A()
    }
    ,
    hC.prototype.clearData = function() {
        this.model.clearNodeGroup(),
        this.model.clearMeshFromOctantMap(),
        this.getLayerProvider().clearData(),
        this.model.clearWireframeElementCount(),
        this.defaultManager.clearData(),
        this.instancedManager.clearData(),
        this.clearLoadedState()
    }
    ,
    hC.prototype.addNodeInfoToOctantMap = function() {
        var A = this.model.manager
          , e = this.model.getEncodedDatabagId();
        this.model.getModelDescriptor().traverseNodeInfosByComponent((function(t, i) {
            A.addNodeInfoToOctantMap(e, t, i)
        }
        ))
    }
    ,
    hC.prototype.initData = function(A) {
        var e = this;
        e.model.getModelDescriptor().parseItemData(e.layerProvider.getConditionsOnDemand(), (function() {
            e.settleData(),
            e.loadedUserIdsObject = e.getLayerProvider().getUserIdsOnDemand(),
            e.loadedUserIds = Object.keys(e.loadedUserIdsObject),
            A && A()
        }
        ))
    }
    ,
    hC.prototype.unload = function(A, e) {
        var t = this;
        this.model.getModelDescriptor().clearReferencedMeshCacheByGeopkIdxs(e, (function(A) {
            t.defaultManager.disposeGeometry(A)
        }
        ))
    }
    ;
    var dC = function(A, e) {
        return hC.call(this, A, e),
        this.tag = "layer",
        this.defaultManager = new Of(e,A),
        this.instancedManager = new Hf(A),
        this.loader = new aC(this),
        this
    };
    (dC.prototype = Object.assign(dC.prototype, hC.prototype)).prepare = function(A, e) {
        this.isAllReady() && (this.prepareWireframe(this.model, e),
        this.model.getMaterialManager()._updateTextureMapping(this.model))
    }
    ,
    dC.prototype.dealMeshNodes = function(A) {
        delete this.model.manager.octantToObjectMap[this.model.modelKey],
        this.addNodeInfoToOctantMap();
        var e = this.model.getModelDescriptor().getInstancedUserIdsByCategory(this.loadedUserIds);
        this.model._removeNodeGroup(gp.INSTANCEGEOMETRY),
        this.model._removeNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY),
        this.instancedManager.meshManager.dispose(),
        this.instancedManager.meshManager.disposeInstanceGeometries(),
        e.length && this.instancedManager.createMeshNodes(this.model, e);
        var t = this.model.getModelDescriptor().getStandardUserIdsByCategory(this.loadedUserIds);
        this.model._removeNodeGroup(gp.GEOMETRY),
        this.model._removeNodeGroup(gp.WIREFRAME),
        this.defaultManager.meshManager.dispose(),
        this.defaultManager.meshManager.clearData(),
        t.length ? this.defaultManager.asyncCreateMeshNodes(this.model, t, A) : A && A()
    }
    ,
    dC.prototype.unloadComponents = function(A, e) {
        for (var t = this.model.modelKey, i = 0, o = A.length; o > i; i += 1)
            this.model.manager.removeBatchedMeshFromOctantMap(t, A[i]);
        this.model.getModelDescriptor().clearNodeInfoCacheByComponentsKey(A),
        this.dealMeshNodes(e)
    }
    ;
    var pC = function(A) {
        $u.call(this, A)
    };
    (pC.prototype = Object.assign(pC.prototype, $u.prototype)).parseItemData = function(A, e) {
        var t = this.model;
        (ap(t.dataVersion, "2.0.0") || void 0 === t.dataVersion) && (Bh.time("升级几何结构"),
        this._updateV1ToV2(t),
        t.dataVersion = "2.0.0",
        Bh.timeEnd("升级几何结构")),
        this._readMaterialBuffer(t),
        t.hasAnimation && vc.EnableAnimation ? (this._parseClips(),
        this._parseBones()) : this._parseGeo();
        var i = {};
        if (!i)
            return Bh.log("Empty scene"),
            !1;
        var o = this.referencedMeshCache;
        if (Bh.time("_readItemData"),
        !o.bufferData || 0 >= Object.keys(o.bufferData).length)
            return !0;
        if (A)
            for (var n = 0, r = A.length; r > n; n += 1)
                o.components[A[n]] && this._readItemData(i, A[n], A[n], void 0, 0);
        else
            for (var a in o.components)
                this._readItemData(i, a, a, void 0, 0);
        t.hasAnimation && vc.EnableAnimation && this._parseNodes(),
        Bh.timeEnd("_readItemData"),
        i = null,
        e && e()
    }
    ;
    var gC = function(A) {
        nC.call(this, A),
        this.descriptor = new pC(A.model)
    };
    (gC.prototype = Object.assign(gC.prototype, nC.prototype)).loadSceneAndMpks = function(A) {
        this._loadScene(0),
        this._loadLayerKey(),
        vc.BorderLineDelayLoaded || this._loadAllBorderlines(A)
    }
    ,
    gC.prototype.getSceneTaskCount = function(A) {
        var e = 2;
        return vc.BorderLineDelayLoaded || (e += this.getAllBorderlineCount()),
        e
    }
    ;
    var uC = function(A) {
        of.call(this, A),
        this.nodeGroupName = "PickingMeshGroup"
    };
    Object.assign(uC.prototype, of.prototype),
    eu(uC, [{
        key: "disposePickingNodeById",
        value: function(A) {
            for (var e = Object.keys(this.pickingNodeMap[A]), t = 0, i = e.length; i > t; t += 1)
                for (var o = this.pickingNodeMap[A][e[t]], n = 0, r = o.length; r > n; n += 1)
                    o[n].material = null,
                    o[n].geometry.dispose(),
                    o[n] = null
        }
    }, {
        key: "removeFormPickingNodeGroup",
        value: function(A) {
            if (this.pickingNodeGroup)
                for (var e = Object.keys(this.pickingNodeMap[A]), t = 0, i = e.length; i > t; t += 1)
                    for (var o = this.pickingNodeMap[A][e[t]], n = 0, r = o.length; r > n; n += 1)
                        this.pickingNodeGroup.remove(o[n])
        }
    }, {
        key: "addToPickingNodeMap",
        value: function(A, e, t) {
            this.pickingNodeMap || (this.pickingNodeMap = {}),
            this.pickingNodeMap[A] || (this.pickingNodeMap[A] = {}),
            this.pickingNodeMap[A][e] = t,
            this.addToPickingNodeGroup(t)
        }
    }, {
        key: "generatePickingMeshes",
        value: function(A) {
            var e = this;
            this.manager.traverseActiveMeshMap(A, (function(A, t, i) {
                if (!e._isExistNode(A, t)) {
                    for (var o = [], n = 0, r = i.length; r > n; n += 1) {
                        var a = i[n]
                          , s = new he;
                        s.setAttribute("position", a.geometry.getAttribute("position")),
                        s.setIndex(a.geometry.getIndex()),
                        s._withDrawRange && s.setDrawRange(a.geometry.drawRange.start, a.geometry.drawRange.count);
                        var l = new (a.isLineSegments ? jo : Ue)(s,Kd.DefaultMaterial);
                        Tu.copyMeshProperties(l, a),
                        l.renderOrder = 1,
                        o.push(l)
                    }
                    e.addToPickingNodeMap(A, t, o)
                }
            }
            ))
        }
    }, {
        key: "_isExistNode",
        value: function(A, e) {
            return !!(this.pickingNodeMap && this.pickingNodeMap[A] && this.pickingNodeMap[A][e])
        }
    }, {
        key: "updatePickingMeshesState",
        value: function(A, e, t) {
            if (this.pickingNodeMap)
                for (var i = this.pickingNodeMap, o = this.manager, n = 0, r = e.length; r > n; n += 1) {
                    var a = e[n];
                    if (i[a] && o.isPickableNode(a)) {
                        var s = o.getActiveMeshMapById(a);
                        if (s)
                            for (var l = Object.keys(i[a]), c = 0, h = l.length; h > c; c += 1) {
                                var d = l[c];
                                if (s[d]) {
                                    var p = i[a][d];
                                    if (p)
                                        for (var g = 0, u = p.length; u > g; g += 1)
                                            p[g].material = A,
                                            p[g].visible = !0
                                }
                            }
                    }
                }
        }
    }, {
        key: "resetPickingMeshesState",
        value: function() {
            if (this.pickingNodeMap)
                for (var A = this.pickingNodeMap, e = Object.keys(A), t = 0, i = e.length; i > t; t += 1)
                    for (var o = e[t], n = Object.keys(A[o]), r = 0, a = n.length; a > r; r += 1)
                        for (var s = A[o][n[r]], l = 0, c = s.length; c > l; l += 1)
                            s[l].visible = !1
        }
    }, {
        key: "updatePickingMeshes",
        value: function(A, e, t) {
            return this.generatePickingMeshes(e),
            this.resetPickingMeshesState(),
            this.updatePickingMeshesState(A, e, t),
            this.getPickingNodeGroup()
        }
    }]);
    var fC = function(A, e) {
        So.call(this),
        this.type = "SkinnedMeshEx",
        this.matrixAutoUpdate = !0,
        this.active = !1,
        this.guid = "",
        this.key = "",
        this.typeEx = "",
        this.geometry = A || Tu.EmptyGeometry,
        this.material = e || Kd.DefaultMaterial,
        this.visible = !1,
        this.castShadow = vc.EnableShadow,
        this.receiveShadow = vc.EnableShadow
    };
    (fC.prototype = Object.create(So.prototype)).constructor = fC,
    fC.prototype.init = function(A) {
        A && A.parent && A.parent.add(this)
    }
    ,
    fC.prototype.destroy = function() {
        this.parent && this.parent.remove(this),
        this.userData && (this.userData = null),
        this.geometry = null,
        this.material = null
    }
    ,
    fC.prototype.isVisible = function() {
        return this.visible && this.active
    }
    ,
    fC.prototype.spawn = function(A) {
        void 0 !== A.guid && (this.guid = A.guid),
        void 0 !== A.key && (this.key = A.key),
        void 0 !== A.name && (this.name = A.name),
        void 0 !== A.typeEx && (this.typeEx = A.typeEx),
        A.geometry && (this.geometry = A.geometry),
        A.material && (this.material = A.material),
        A.matrix ? (this.matrix.copy(A.matrix),
        this.updateMatrixWorld(!0)) : (this.matrix.identity(),
        this.updateMatrixWorld(!0)),
        this.modelKey = A.modelKey ? A.modelKey : "",
        A.userData ? this.userData = A.userData : this.userData && (this.userData = null),
        void 0 !== A.visible && (this.visible = A.visible),
        this.renderOrder = A.renderOrder || 0,
        this.active = !0,
        this.visible = !0,
        this.frustumCulled = !1,
        this.matChange = !1
    }
    ,
    fC.prototype.clear = function() {
        this.geometry = Tu.EmptyGeometry,
        this.material = Kd.DefaultMaterial,
        this.active = !1,
        this.visible = !0,
        this.guid = "",
        this.key = "",
        this.typeEx = "",
        this.frustumCulled = !0,
        this.material.visible = !1
    }
    ,
    fC.prototype.intersectBoxWithDistance = function() {
        var A = new aA;
        return function(e, t) {
            var i = this.geometry
              , o = this.material
              , n = this.matrixWorld;
            return t && (n = new M).multiplyMatrices(this.matrixWorld, t),
            void 0 === o ? -1 : (i.boundingBox || i.computeBoundingBox(),
            A.copy(i.boundingBox),
            A.applyMatrix4(n),
            e.ray.intersectBoxWithDistance(A))
        }
    }(),
    fC.prototype.intersectBoxWithDistanceByIndices = function(A, e) {
        var t = this.matrixWorld
          , i = this.computeBoundingBox(e);
        return i.applyMatrix4(t),
        A.ray.intersectBoxWithDistance(i)
    }
    ,
    fC.prototype.intersectBoxWithClipPlane = function(A, e) {
        var t = this.matrixWorld
          , i = this.computeBoundingBox(e);
        return i.applyMatrix4(t),
        i.intersectsPlane(A)
    }
    ,
    fC.prototype.raycastByIndices = function() {
        var A = new M
          , e = new CA
          , t = new cA
          , i = new y
          , o = new y
          , n = new y
          , r = new s
          , a = new s
          , l = new s
          , c = new y
          , h = new y
          , d = new y
          , p = new M;
        function g(A, e, t, s, g, u, f, m) {
            i.fromBufferAttribute(s, u),
            o.fromBufferAttribute(s, f),
            n.fromBufferAttribute(s, m);
            var C = function(A, e, t, i, o, n, r) {
                var a = A.material;
                if (null === (Array.isArray(a) ? t.intersectTriangle(i, o, n, !1, r) : 1 === a.side ? t.intersectTriangle(n, o, i, !0, r) : t.intersectTriangle(i, o, n, 2 !== a.side, r)))
                    return null;
                d.copy(r),
                d.applyMatrix4(p);
                var s = e.ray.origin.distanceTo(d);
                return e.near > s || s > e.far ? null : {
                    distance: s,
                    point: d.clone(),
                    object: A
                }
            }(A, e, t, i, o, n, h);
            if (C) {
                if (g && g.array && g.array.length && (r.fromBufferAttribute(g, u),
                a.fromBufferAttribute(g, f),
                l.fromBufferAttribute(g, m),
                C.uv = function(A, e, t, i, o, n, r) {
                    return RA.getBarycoord(A, e, t, i, c),
                    o.multiplyScalar(c.x),
                    n.multiplyScalar(c.y),
                    r.multiplyScalar(c.z),
                    o.add(n).add(r),
                    o.clone()
                }(h, i, o, n, r, a, l)),
                s.instanceMatrix) {
                    var v = i.clone().applyMatrix4(s.instanceMatrix)
                      , I = o.clone().applyMatrix4(s.instanceMatrix)
                      , E = n.clone().applyMatrix4(s.instanceMatrix);
                    C.face = new GA(u,f,m,RA.getNormal(v, I, E, new y))
                } else
                    C.face = new GA(u,f,m,RA.getNormal(i, o, n, new y));
                C.faceIndex = u
            }
            return C
        }
        return function(i, o, n, r) {
            var a = this.geometry
              , s = this.material;
            if (r) {
                a = this.geometry,
                s = this.material;
                if ((p = new M).multiplyMatrices(this.matrixWorld, r),
                void 0 === s)
                    return;
                if (null === a.boundingSphere && a.computeBoundingSphere(),
                t.copy(a.boundingSphere),
                t.applyMatrix4(p),
                !1 === i.ray.intersectsSphere(t))
                    return;
                if (A.getInverse(p),
                e.copy(i.ray).applyMatrix4(A),
                null !== a.boundingBox && !1 === e.intersectsBox(a.boundingBox))
                    return;
                var l = null
                  , c = null
                  , h = null
                  , d = null
                  , u = a.index;
                (I = a.attributes.position).instanceMatrix = r;
                var f = a.attributes.uv
                  , m = null
                  , C = null;
                if (null !== u)
                    for (m = 0,
                    C = u.count; C > m; m += 3)
                        c = u.getX(m),
                        h = u.getX(m + 1),
                        d = u.getX(m + 2),
                        (l = g(this, i, e, I, f, c, h, d)) && (l.faceIndex = Math.floor(m / 3),
                        o.push(l));
                else
                    for (m = 0,
                    C = I.count; C > m; m += 3)
                        (l = g(this, i, e, I, f, c = m, h = m + 1, d = m + 2)) && (l.index = c,
                        o.push(l))
            } else {
                if (p = this.matrixWorld,
                void 0 === s)
                    return;
                if (t.copy(this.computeBoundingSphere(n)),
                t.applyMatrix4(p),
                !1 === i.ray.intersectsSphere(t))
                    return;
                A.getInverse(p),
                e.copy(i.ray).applyMatrix4(A);
                var y = this.computeBoundingBox(n);
                if (!1 === e.intersectsBox(y))
                    return;
                l = null,
                c = null,
                h = null,
                d = null;
                var v, I = a.attributes.position, E = (f = a.attributes.uv,
                m = null,
                n.indexStart), B = n.indexStart + n.indexCount, x = a.getIndex().array;
                for (m = E,
                v = B; v > m; m += 3)
                    (l = g(this, i, e, I, f, c = x[m], h = x[m + 1], d = x[m + 2])) && (l.faceIndex = Math.floor(m / 3),
                    o.push(l))
            }
        }
    }(),
    fC.prototype.minDistanceToTri = function(A, e, t) {
        function i(A, e) {
            return new y(A.x - e.x,A.y - e.y,A.z - e.z)
        }
        function o(A, e) {
            return new y(A.x + e.x,A.y + e.y,A.z + e.z)
        }
        function n(A, e, t) {
            return new y(A.x + e.x * t,A.y + e.y * t,A.z + e.z * t)
        }
        function r(A, e) {
            return A.x * e.x + A.y * e.y + A.z * e.z
        }
        function a(A, e) {
            return new y(A.y * e.z - A.z * e.y,A.z * e.x - A.x * e.z,A.x * e.y - A.y * e.x)
        }
        function s(A, e, t, s) {
            var l, c = r(e, s), h = r(e, e), d = r(s, s), p = i(t, A), g = r(e, p), u = r(s, p), f = null;
            0 > (f = (g * d - u * c) / (h * d - c * c)) || isNaN(f) ? f = 0 : f > 1 && (f = 1);
            var m = null
              , C = null
              , y = null
              , v = null;
            return 0 >= (l = (f * c - u) / d) || isNaN(l) ? (C = t,
            0 >= (f = g / h) || isNaN(f) ? (m = A,
            y = i(t, A)) : 1 > f ? (m = n(A, e, f),
            v = a(p, e),
            y = a(e, v)) : y = i(t, m = o(A, e))) : 1 > l ? (C = n(t, s, l),
            0 >= f || isNaN(f) ? (m = A,
            v = a(p, s),
            y = a(s, v)) : 1 > f ? (m = n(A, e, f),
            0 > r(y = a(e, s), p) && y.multiplyScalar(-1)) : (v = a(p = i(t, m = o(A, e)), s),
            y = a(s, v))) : (C = o(t, s),
            0 >= (f = (c + g) / h) || isNaN(f) ? (m = A,
            y = i(C, A)) : 1 > f ? (m = n(A, e, f),
            v = a(p = i(C, A), e),
            y = a(e, v)) : y = i(C, m = o(A, e))),
            {
                vec: y,
                closestP: m,
                closestQ: C
            }
        }
        function l(A, e) {
            var t = null
              , o = null
              , l = []
              , c = []
              , h = null;
            l[0] = i(A[1], A[0]),
            l[1] = i(A[2], A[1]),
            l[2] = i(A[0], A[2]),
            c[0] = i(e[1], e[0]),
            c[1] = i(e[2], e[1]),
            c[2] = i(e[0], e[2]);
            for (var d = null, p = null, g = null, u = 0, f = A[0].distanceToSquared(e[0]) + 1, m = 0; 3 > m; m += 1)
                for (var C = 0; 3 > C; C += 1) {
                    var y = s(A[m], l[m], e[C], c[C]);
                    h = y.vec;
                    var v = r(d = i(o = y.closestQ, t = y.closestP), d);
                    if (f >= v) {
                        p = t.clone(),
                        g = o.clone(),
                        f = v;
                        var I = r(i(A[(m + 2) % 3], t), h)
                          , E = r(i(e[(C + 2) % 3], o), h);
                        if (0 >= I && E >= 0)
                            return {
                                start: t.clone(),
                                end: o.clone(),
                                minDistance: Math.sqrt(v)
                            };
                        0 > I && (I = 0),
                        E > 0 && (E = 0),
                        r(d, h) - I + E > 0 && (u = 1)
                    }
                }
            var B = a(l[0], l[1])
              , x = r(B, B);
            if (x > 1e-15) {
                var S = [];
                d = i(A[0], e[0]),
                S[0] = r(d, B),
                d = i(A[0], e[1]),
                S[1] = r(d, B),
                d = i(A[0], e[2]),
                S[2] = r(d, B);
                var w = -1;
                if (S[0] > 0 && S[1] > 0 && S[2] > 0 ? S[w = S[1] > S[0] ? 0 : 1] > S[2] && (w = 2) : 0 > S[0] && 0 > S[1] && 0 > S[2] && S[2] > S[w = S[0] > S[1] ? 0 : 1] && (w = 2),
                w >= 0 && (u = 1,
                r(d = i(e[w], A[0]), a(B, l[0])) > 0 && r(d = i(e[w], A[1]), a(B, l[1])) > 0 && r(d = i(e[w], A[2]), a(B, l[2])) > 0))
                    return t = n(e[w], B, S[w] / x),
                    o = e[w].clone(),
                    t.distanceTo(o)
            }
            var M = a(c[0], c[1])
              , b = r(M, M);
            if (b > 1e-15) {
                var U = [];
                d = i(e[0], A[0]),
                U[0] = r(d, M),
                d = i(e[0], A[1]),
                U[1] = r(d, M),
                d = i(e[0], A[2]),
                U[2] = r(d, M);
                w = -1;
                if (U[0] > 0 && U[1] > 0 && U[2] > 0 ? U[w = U[1] > U[0] ? 0 : 1] > U[2] && (w = 2) : 0 > U[0] && 0 > U[1] && 0 > U[2] && U[2] > U[w = U[0] > U[1] ? 0 : 1] && (w = 2),
                w >= 0 && (u = 1,
                r(d = i(A[w], e[0]), a(M, c[0])) > 0 && r(d = i(A[w], e[1]), a(M, c[1])) > 0 && r(d = i(A[w], e[2]), a(M, c[2])) > 0))
                    return {
                        start: t = A[w].clone(),
                        end: (o = n(A[w], M, U[w] / b)).clone(),
                        minDistance: t.distanceTo(o)
                    }
            }
            return u ? (t = p,
            o = g,
            {
                start: p.clone(),
                end: g.clone(),
                minDistance: Math.sqrt(f)
            }) : {
                start: p.clone(),
                end: g.clone(),
                minDistance: 0
            }
        }
        var c = new y
          , h = new y
          , d = new y;
        function p(A, e, t, i, o, n) {
            c.fromBufferAttribute(e, t),
            h.fromBufferAttribute(e, i),
            d.fromBufferAttribute(e, o),
            n && (c.applyMatrix4(n),
            h.applyMatrix4(n),
            d.applyMatrix4(n)),
            A.push(c),
            A.push(h),
            A.push(d)
        }
        for (var g = {
            start: null,
            end: null,
            minDistance: Number.POSITIVE_INFINITY
        }, u = this.geometry, f = u.attributes.position, m = e ? e.indexStart : 0, C = u.getIndex().array, v = m, I = e ? e.indexStart + e.indexCount : C.length; I > v; v += 3) {
            var E = [];
            p(E, f, C[v], C[v + 1], C[v + 2], t);
            var B = l(A, E);
            if (0 >= B.minDistance)
                return g.minDistance = 0,
                g;
            g.minDistance > B.minDistance && (g.minDistance = B.minDistance,
            g.start = B.start.clone(),
            g.end = B.end.clone())
        }
        return g
    }
    ,
    fC.prototype.computeBoundingBox = function(A) {
        var e = new aA
          , t = this.geometry.attributes.position.array
          , i = null
          , o = null;
        return A ? (i = A.positionStart,
        o = A.positionStart + A.positionCount) : (i = 0,
        o = t.length),
        this.setBoundingBoxFromArray(e, t, i, o),
        e
    }
    ,
    fC.prototype.computeBoundingSphere = function(A) {
        var e = new aA
          , t = new y
          , i = this.geometry.attributes.position.array
          , o = null
          , n = null;
        A ? (o = A.positionStart,
        n = A.positionStart + A.positionCount) : (o = 0,
        n = i.length);
        var r = new cA
          , a = r.center;
        this.setBoundingBoxFromArray(e, i, o, n),
        e.getCenter(a);
        for (var s = 0, l = o, c = n; c > l; l += 3)
            t.x = i[l],
            t.y = i[l + 1],
            t.z = i[l + 2],
            s = Math.max(s, a.distanceToSquared(t));
        return r.radius = Math.sqrt(s),
        r
    }
    ,
    fC.prototype.setBoundingBoxFromArray = function(A, e, t, i) {
        for (var o = Number(1 / 0), n = Number(1 / 0), r = Number(1 / 0), a = -1 / 0, s = -1 / 0, l = -1 / 0, c = t, h = i; h > c; c += 3) {
            var d = e[c]
              , p = e[c + 1]
              , g = e[c + 2];
            o > d && (o = d),
            n > p && (n = p),
            r > g && (r = g),
            d > a && (a = d),
            p > s && (s = p),
            g > l && (l = g)
        }
        A.min.set(o, n, r),
        A.max.set(a, s, l)
    }
    ;
    var mC = function(A) {
        return Rf.call(this),
        this.manager = A,
        this.nodePriority = {
            high: [],
            medium: [],
            low: []
        },
        this.visibleOctant = [],
        this.occlusionVisibleOctant = [],
        this.usedNodeInfosObject = {},
        this.lineNodes = {},
        this.blinkMaterials = [],
        this.selectedMeshes = [],
        this.nonSelectedMeshes = [],
        this.selectedObjectIds = [],
        this.activeMeshMap = {},
        this
    };
    (mC.prototype = Object.create(Rf.prototype)).destroy = function() {
        this.dispose(),
        this.clearData(),
        this.pickingNodeGenerator && (this.pickingNodeGenerator.destroy(),
        this.pickingNodeGenerator = null),
        this.activeMeshMap = null,
        this.manager = null,
        this.nodePriority = null,
        this.visibleOctant = null,
        this.occlusionVisibleOctant = null,
        this.nodePriority = null,
        this.lineNodes = null,
        this.blinkMaterials = null
    }
    ,
    mC.prototype.disposeLineNodes = function() {
        for (var A in this.lineNodes) {
            var e = this.lineNodes[A];
            e.geometry.dispose(),
            e = null,
            delete this.lineNodes[A]
        }
    }
    ,
    mC.prototype.clearData = function() {
        this.pickingNodeGenerator && this.pickingNodeGenerator.clearData(),
        this._clearActiveMeshMap(),
        this.disposeGeometries(),
        this.disposeLineNodes(),
        this._clearNodePriorityData(!0),
        this._clearUsedNodeInfosObject(),
        this.visibleOctant.length = 0,
        this.occlusionVisibleOctant.length = 0
    }
    ,
    mC.prototype.update = function(A, e, t) {
        this._updateMeshNodes(A, e, t)
    }
    ,
    mC.prototype.cullNodes = function(A, e) {
        this._clearNodePriorityData(!1),
        this._adjustLowNodePriorityLength(A);
        var t = 0;
        return t = vc.EnableOctant ? this._cullNodesWithOctant(A, e) : this._cullNodesWithFull(A),
        this._calcPrioritizedNodeCount(A, t)
    }
    ,
    mC.prototype.getPriorityNodes = function() {
        return [this.nodePriority.high, this.nodePriority.medium, this.nodePriority.low]
    }
    ,
    mC.prototype._cullNodesWithOctant = function(A, e) {
        var t = 0
          , i = 0
          , o = this.manager.getLoader(A).getOctreeRootNodeInner()
          , n = this.manager.getLoader(A).getOctreeRootNodeOuter();
        if (this.manager.getContainsCamera(A) || !n)
            return this.visibleOctant.length = 0,
            o && this._frustumCull(A, e, o),
            n && this._frustumCull(A, e, n),
            (i = this.visibleOctant.length) > 0 && (this._sortVisibleOctant(e),
            t = this._logicCull(A, !0, !0, t, i)),
            t;
        n && (this.visibleOctant.length = 0,
        this._frustumCull(A, e, n),
        (i = this.visibleOctant.length) > 0 && (this._sortVisibleOctant(e),
        t = this._logicCull(A, !0, !1, t, i)));
        var r = this.manager.getFilter(A);
        (Object.keys(this.nodePriority.low).length + this.nodePriority.high.length + this.nodePriority.medium.length < this.manager.getRenderableCount(A) || r._hasRenderPromotionFilter()) && ((o = this.manager.getLoader(A).getOctreeRootNodeInner()) && (this.visibleOctant.length = 0,
        this._frustumCull(A, e, o),
        (i = this.visibleOctant.length) > 0 && (this._sortVisibleOctant(A, e),
        t = this._logicCull(A, !0, !1, t, i))));
        return t
    }
    ,
    mC.prototype._cullNodesWithFull = function(A) {
        var e = A.getModelDescriptor().getComponentCount();
        return 0 === e ? 0 : this._logicCullWithFull(A, e)
    }
    ,
    mC.prototype._calcPrioritizedNodeCount = function(A, e) {
        var t = e + this.nodePriority.high.length + this.nodePriority.medium.length;
        return t > this.manager.getRenderableCount(A) && (t = this.manager.getRenderableCount(A)),
        t
    }
    ,
    mC.prototype._updateMeshNodes = function(A, e, t) {
        if (this.filter = A.getFilter(),
        A.isOnlyWireframe()) {
            A._getNodeGroup(gp.GEOMETRY).visible = !1
        } else {
            var i = A.getModelDescriptor().getStandardNodeInfos();
            if (i) {
                this.clearSelectedObjectIds(),
                A._getNodeGroup(gp.GEOMETRY).visible = !0;
                var o = A.manager.filter
                  , n = A.selectedMaterial
                  , r = A.manager.sceneState
                  , a = A.manager;
                if (a.octantToObjectMap && a.octantToObjectMap[A.modelKey]) {
                    var s = a.octantToObjectMap[A.modelKey].mesh
                      , l = A.materialManager.materials
                      , c = this.manager.hiddenUserIdSetObject
                      , h = this.manager.overrideUserIdSetObject
                      , d = this.manager.transparentUserIdSetObject
                      , p = this.manager.selectedUserIdSetObject
                      , g = this.manager.hoveredUserIdSetObject;
                    this.blinkMaterials.length = 0,
                    e || (e = A.getModelDescriptor().getStandardUserIds()),
                    vc.TranslucentDepthDisabled && (n.depthWrite = !n.transparent);
                    var u = o._getMaterialByName("scene");
                    vc.TranslucentDepthDisabled && (u.depthWrite = !1);
                    for (var f = 0; e.length > f; f += 1) {
                        var m = e[f];
                        if (i[m]) {
                            var C = i[m][0];
                            if (C)
                                if (s[m]) {
                                    var y = s[m][0];
                                    if (y instanceof vu && (y = y.object),
                                    y)
                                        if (c && c[m])
                                            y.visible = !1;
                                        else {
                                            y.visible = !0;
                                            var v = [];
                                            if (d && d[m] && !vc.EnableSelectionByTranslucent) {
                                                for (var I = 0; C.materialId.length > I; I += 1)
                                                    v.push(t || u);
                                                y.material = v
                                            } else if (p && p[m])
                                                if (this.cacheSelectedObjectIds(m),
                                                vc.PickingEffect)
                                                    for (var E = o._getOverrideMaterial(C), B = 0; C.materialId.length > B; B += 1)
                                                        v.push(t || E);
                                                else {
                                                    for (var x = 0; C.materialId.length > x; x += 1)
                                                        v.push(t || n);
                                                    y.material = v
                                                }
                                            else if (g && g[m]) {
                                                for (var S = 0; C.materialId.length > S; S += 1)
                                                    if (h[m]) {
                                                        var w = o._getMaterialByName(h[m])
                                                          , M = r.getHoverMaterial(t || w);
                                                        v.push(M)
                                                    } else {
                                                        var b = r.getHoverMaterial(t || l[C.materialId[S]]);
                                                        v.push(b)
                                                    }
                                                y.material = v
                                            } else if (d && d[m]) {
                                                for (var U = 0; C.materialId.length > U; U += 1)
                                                    v.push(t || u);
                                                y.material = v
                                            } else if (h && h[m]) {
                                                for (var F = 0; C.materialId.length > F; F += 1)
                                                    if (Array.isArray(h[m])) {
                                                        (K = l[C.materialId[F]]) || (K = o._getMaterialByName(h[m][F])),
                                                        v.push(t || K)
                                                    } else {
                                                        var K = o._getMaterialByName(h[m]);
                                                        v.push(t || K)
                                                    }
                                                y.material = v
                                            } else {
                                                for (var Q = 0; C.materialId.length > Q; Q += 1) {
                                                    K = l[C.materialId[Q]];
                                                    v.push(t || K)
                                                }
                                                y.material = v
                                            }
                                        }
                                } else
                                    Bh.error(m, "没有创建对应的mesh")
                        }
                    }
                }
            }
        }
    }
    ,
    mC.prototype._getUsableMaterial = function(A, e, t, i) {
        var o = e.materialId
          , n = e.userId
          , r = A.materialManager.materials
          , a = A.manager.sceneState
          , s = A.manager.filter
          , l = null
          , c = a.isSelected(n);
        !0 !== c || s._isPickable(e) || (c = !1),
        t ? vc.PickingEffect ? l = s._getOverrideMaterial(e) : (l = s._getOverrideMaterial(e)) && !c || (l = t) : i && (l = s._getOverrideMaterial(e));
        var h = A.manager.getOverrideMaterialByNodeInfo(e);
        return l = l || h || r[o],
        vc.Hover && !vc.EnableRenderPass && a.hoverId === n && !1 === c && (l = a.getHoverMaterial(l)),
        l
    }
    ,
    mC.prototype._dealMeshes = function(A, e, t, i, o) {
        var n = this.getGeometryByNodeInfo(A, e)
          , r = A.pool
          , a = 0;
        if (Array.isArray(n))
            for (var s = 0, l = n.length; l > s; s += 1) {
                a = r.get({
                    modelKey: A.modelKey,
                    nodeId: e.nodeId,
                    userId: e.userId,
                    originalId: e.originalId,
                    userData: e.userData,
                    geometry: n[s],
                    matrix: e.matrix,
                    material: i,
                    renderOrder: i.transparent ? 0 : vc.MaximumDepth - e.cellDepth,
                    visible: t
                }),
                null
            }
        else
            a = r.get({
                modelKey: A.modelKey,
                nodeId: e.nodeId,
                userId: e.userId,
                originalId: e.originalId,
                userData: e.userData,
                geometry: n,
                matrix: e.matrix,
                material: i,
                renderOrder: i.transparent ? 0 : vc.MaximumDepth - e.cellDepth,
                visible: t
            });
        0 > a || o.curOctantId !== e.octantId && (a > 0 && A.manager.addObjectRangeToOctantMap(o.curOctantId, o.octantStartIndex, a - 1),
        o.octantStartIndex = a,
        o.curOctantId = e.octantId)
    }
    ,
    mC.prototype._dealLineSegments = function(A, e, t, i) {
        var o = this.getGeometryByNodeInfo(A, e);
        if (o) {
            var n = this._getLineSegmentsNodeGroup(A)
              , r = this.lineNodes[e.nodeId];
            r || ((r = new cf(o,i)).nodeId = e.nodeId,
            r.name = e.name,
            r.geometryId = e.geometryId,
            r.modelKey = A.modelKey,
            this.lineNodes[e.nodeId] = r),
            r.material = i,
            r.visible = t,
            n.add(r),
            r.updateMatrixWorld(!0),
            this._cacheActiveMesh(e.userId, e.nodeId, r)
        }
    }
    ,
    mC.prototype._frustumCull = function(A, e, t) {
        var i = A.manager
          , o = e.getFrustum()
          , n = vc.OctantDepth
          , r = e.projScreenMatrix
          , a = new aA;
        function s(A, e, t, i, o) {
            var n = null;
            if (e && t > A.depth && (a.set(A.min, A.max),
            n = e.intersectsBox(a)),
            n) {
                if (i) {
                    var l = a.applyMatrix4(r)
                      , c = l.getSize().length()
                      , h = l.getCenter().z;
                    A.priority = c / (h = h > 1e-6 ? h : 1e-6),
                    o.push(A)
                } else
                    o.push(A);
                for (var d = 0, p = A.childOctants.length; p > d; d += 1)
                    s(A.childOctants[d], e, t, i, o)
            }
        }
        (vc.DEBUG && i.showOctreeBox(t),
        s(t, o, n, !0, this.visibleOctant),
        vc.OcclusionTranslucentEnabled) && s(t, this.manager.getFrustumFromOcclusionCamera(), n, !1, this.occlusionVisibleOctant);
        return !0
    }
    ,
    mC.prototype._logicCull = function(A, e, t, i, o) {
        var n = A.manager
          , r = n.filter
          , a = r._hasHiddenFileIdFilter()
          , s = r._hasOverrideMaterialFilter()
          , l = n.sceneState.selectionSet
          , c = r._hasRenderPromotionFilter()
          , h = this.nodePriority.high
          , d = this.nodePriority.medium
          , p = this.nodePriority.low
          , g = this.nodePriority.low.length
          , u = A.getModelDescriptor().getNodeInfosWithComponentKey();
        function f(A, e) {
            if (!(a && r._isHiddenFileId(A) || !1 === r._isVisible(A)))
                if (l.hasOwnProperty(A.userId) || s && r._hasHighPriorityOverrideMaterial(A))
                    h.push(A);
                else {
                    var t = !1;
                    if (c && r._isRenderPromotion(A) && (t = !0),
                    e) {
                        var o = A.userData
                          , n = o ? o.categoryId : void 0;
                        n && e[n] && (t = !0)
                    }
                    t ? d.push(A) : g > i && (p[i] = A,
                    i += 1)
                }
        }
        var m = n.getCategoriesFromHighPriority("outer");
        !0 === t && (m = n.getCategoriesFromHighPriority("inner"));
        for (var C = 0, y = 0, v = 0; o > v; v += 1) {
            var I = null
              , E = 0;
            e ? (I = this.visibleOctant[v].octantId,
            E = this.visibleOctant[v].depth) : I = v;
            var B = u[I];
            if (B) {
                var x = this._getUsedNodeInfosByComponentKey(I);
                if (!x) {
                    for (C = 0,
                    y = B.length; y > C; C += 1) {
                        (w = B[C]).octantId = I,
                        w.cellDepth = E,
                        this._isSatisfied(A, w) && this._cacheUsedNodeInfosByComponentKey(I, w)
                    }
                    x = this._getUsedNodeInfosByComponentKey(I)
                }
                if (x) {
                    var S = x.default;
                    for (C = 0,
                    y = S.length; y > C; C += 1) {
                        var w;
                        f(w = S[C], m)
                    }
                }
            }
        }
        return Bh.timeEnd("collectNodeInfo"),
        i
    }
    ,
    mC.prototype._clearUsedNodeInfosObject = function() {
        for (var A in this.usedNodeInfosObject)
            delete this.usedNodeInfosObject[A].default,
            delete this.usedNodeInfosObject[A].instance,
            delete this.usedNodeInfosObject[A];
        this.usedNodeInfosObject = {}
    }
    ,
    mC.prototype._getUsedNodeInfosByComponentKey = function(A) {
        return this.usedNodeInfosObject[A]
    }
    ,
    mC.prototype._cacheUsedNodeInfosByComponentKey = function(A, e) {
        this.usedNodeInfosObject[A] || (this.usedNodeInfosObject[A] = {},
        this.usedNodeInfosObject[A].default = [],
        this.usedNodeInfosObject[A].instance = []),
        this.usedNodeInfosObject[A].default.push(e)
    }
    ,
    mC.prototype._isSatisfied = function(A, e) {
        var t = A.getLoadedUserIdsObject();
        return !t || Boolean(t[e.userId])
    }
    ,
    mC.prototype._logicCullWithFull = function(A, e) {
        return this._logicCull(A, !1, !0, 0, e)
    }
    ,
    mC.prototype._sortVisibleOctant = function(A, e) {}
    ,
    mC.prototype._applyOcclusionTranslucent = function(A) {
        if (vc.OcclusionTranslucentEnabled) {
            var e = A.pool.getObjects()
              , t = A.manager.octantToObjectMap
              , i = this.occlusionVisibleOctant.length;
            if (i > 0)
                for (var o = A.manager.getFrustumFromOcclusionCamera(), n = 0; i > n; n += 1) {
                    var r = t[this.occlusionVisibleOctant[n].octantId];
                    if (r && r.length > 0)
                        for (var a = 0, s = r.length; s > a; a += 2)
                            for (var l = r[a]; r[a + 1] >= l; l += 1) {
                                var c = e[l][0];
                                Rd.intersectObjectWithFrustum(c, o) && this._overrideOcclusionMaterial(c)
                            }
                }
        }
    }
    ,
    mC.prototype._overrideOcclusionMaterial = function(A, e) {
        var t = e.material;
        if (t && !1 === t.transparent) {
            var i = A.manager.acquireMaterial()
              , o = i.material;
            t.color ? o.color.copy(t.color) : i.resetColor(),
            o.opacity = vc.OcclusionOpacity,
            e.material = o,
            e.material.needsUpdate = !0
        }
    }
    ,
    mC.prototype._clearNodePriorityData = function(A) {
        var e = this.nodePriority;
        e.high.length = 0,
        e.medium.length = 0,
        A && (e.low.length = 0)
    }
    ,
    mC.prototype._adjustLowNodePriorityLength = function(A) {
        0 === this.nodePriority.low.length && (this.nodePriority.low.length = this.manager.getRenderableCount(A))
    }
    ,
    mC.prototype._clearLineSegmentsNodeGroup = function(A) {
        this._getLineSegmentsNodeGroup(A).clear()
    }
    ,
    mC.prototype._getLineSegmentsNodeGroup = function(A) {
        return A._getNodeGroup(gp.LINESEGMENTS, {
            globalSpace: !0
        })
    }
    ,
    mC.prototype._isLineSegments = function(A) {
        return A.type === Qf.EnumNodeItemType.LINE
    }
    ,
    mC.prototype.getBlinkMaterials = function(A) {
        return this.blinkMaterials
    }
    ,
    mC.prototype._makeMesh = function(A, e, t) {
        var i = A.modelKey
          , o = A.manager
          , n = A.getModelDescriptor().getStandardNodeInfos();
        if (n) {
            e || (e = A.getModelDescriptor().getInstancedUserIds());
            for (var r = A.getModelDescriptor(), a = A._getNodeGroup(gp.GEOMETRY, {
                globalSpace: !0
            }), s = A.materialManager.materials, l = 0, c = e.length; c > l; l += 1) {
                var h = A.getModelDescriptor().getNodeInfosByComponentKey(e[l]);
                if (!h || !h[0].mesh)
                    for (var d = n[e[l]], p = 0, g = d.length; g > p; p += 1) {
                        var u = d[p];
                        if (u) {
                            var f = u.geometryId
                              , m = this.getGeometryById(f);
                            if (m) {
                                var C = u.materialId || r.referencedMeshCache.components[e[l]].matId
                                  , y = null;
                                if (y = [],
                                op(A.dataVersion, "1.0") || void 0 === A.dataVersion) {
                                    var v = s[C];
                                    if (u.materialId = [],
                                    !v)
                                        continue;
                                    if (Array.isArray(v))
                                        if (v.length > 1)
                                            for (p = 0; v.length > p; p += 1)
                                                u.materialId.push(C + "_" + p),
                                                s[C + "_" + p] = v[p];
                                        else
                                            s[C] = v[0],
                                            u.materialId.push(C);
                                    else
                                        u.materialId.push(C);
                                    for (p = 0; u.materialId.length > p; p += 1)
                                        y.push(s[u.materialId[p]])
                                } else
                                    for (p = 0; C.length > p; p += 1) {
                                        var I = s[C[p]];
                                        I || (I = Kd.DefaultMaterial),
                                        y.push(I)
                                    }
                                if (1 > y.length) {
                                    var E = _u[u.type] ? _u[u.type].color : void 0;
                                    E || (Bh.log("Material not found for type: ", u.type),
                                    E = _u.DEFAULT.color),
                                    E || (Bh.log("Default material not found for type: ", u.type),
                                    E = [1, 1, 1, 1]);
                                    var B = new LA(E[0],E[1],E[2])
                                      , x = B.getHexString() + "_" + E[3]
                                      , S = s[x];
                                    S || (S = new xr({
                                        color: B
                                    }),
                                    1 > E[3] && (S.transparent = !0,
                                    S.opacity = E[3]),
                                    S.side = 2,
                                    s[x] = S),
                                    m.groups = [{
                                        start: 0,
                                        count: m.index.count,
                                        materialIndex: 0
                                    }],
                                    u.materialId.push(x),
                                    y.push(S)
                                }
                                for (var w = 0; y.length > w; w += 1)
                                    y[w].aoMap && m.attributes.uv && (m.attributes.uv2 = m.attributes.uv);
                                var M = new Kf(m,y)
                                  , b = {
                                    matrix: u.matrix,
                                    modelKey: i,
                                    name: u.name,
                                    key: u.componentKey,
                                    userData: {},
                                    typeEx: u.type
                                };
                                M.spawn(b),
                                a.add(M),
                                o.addMeshToOctantMap(i, u.componentKey, new Iu(u.componentKey,M));
                                var U = {
                                    indexCount: m.index.count,
                                    indexStart: 0,
                                    lightmapIdx: void 0,
                                    nodeId: u.componentKey,
                                    positionCount: 3 * m.attributes.position.count,
                                    positionStart: 0,
                                    userId: u.componentKey
                                };
                                M._indicesGroup = {},
                                M._indicesGroup[u.componentKey] = [U],
                                A.addMeshToInfoMap(u.componentKey, u.componentKey, M, U),
                                M.geometryId = u.geometryId,
                                this._cacheActiveMesh(u.userId, u.nodeId, M),
                                f = null,
                                C = null,
                                b = null,
                                y = null,
                                m = null,
                                M = null
                            }
                        }
                    }
            }
            a.updateMatrixWorld(!0),
            t && t()
        }
    }
    ,
    mC.prototype._makeSkinMesh = function(A, e, t) {
        var i = A.modelKey
          , o = A.manager
          , n = A.getModelDescriptor().getStandardNodeInfos();
        if (n) {
            e || (e = A.getModelDescriptor().getInstancedUserIds());
            for (var r = A.getModelDescriptor(), a = A.materialManager.materials, s = 0, l = e.length; l > s; s += 1)
                for (var c = n[e[s]], h = 0, d = c.length; d > h; h += 1) {
                    var p = c[h];
                    if (p) {
                        var g = p.geometryId
                          , u = this.getGeometryById(g);
                        if (u) {
                            var f = p.materialId || r.referencedMeshCache.components[e[s]].matId
                              , m = null;
                            m = [];
                            for (h = 0; f.length > h; h += 1) {
                                var C = a[f[h]];
                                C || (C = Kd.DefaultMaterial),
                                m.push(C)
                            }
                            if (1 > m.length) {
                                var y = _u[p.type] ? _u[p.type].color : void 0;
                                y || (Bh.log("Material not found for type: ", p.type),
                                y = _u.DEFAULT.color),
                                y || (Bh.log("Default material not found for type: ", p.type),
                                y = [1, 1, 1, 1]);
                                var v = new LA(y[0],y[1],y[2])
                                  , I = v.getHexString() + "_" + y[3]
                                  , E = a[I];
                                E || (E = new xr({
                                    color: v
                                }),
                                1 > y[3] && (E.transparent = !0,
                                E.opacity = y[3]),
                                E.side = 2,
                                a[I] = E),
                                u.groups = [{
                                    start: 0,
                                    count: u.index.count,
                                    materialIndex: 0
                                }],
                                p.materialId.push(I),
                                m.push(E)
                            }
                            for (var B = 0; m.length > B; B += 1)
                                m[B].aoMap && (u.attributes.uv2 = u.attributes.uv);
                            var x = null;
                            if ("skinIndex"in u.attributes && "skinWeight"in u.attributes) {
                                x = new fC(u,m);
                                for (var S = 0; m.length > S; S += 1)
                                    m[S].skinning = !0;
                                console.log("SkinnedMesh 类型mesh")
                            } else
                                x = new Kf(u,m);
                            var w = {
                                matrix: p.matrix,
                                modelKey: i,
                                name: p.name,
                                key: p.componentKey,
                                userData: {},
                                typeEx: p.type
                            };
                            x.spawn(w),
                            o.addMeshToOctantMap(i, p.componentKey, new Iu(p.componentKey,x));
                            var M = {
                                indexCount: u.index.count,
                                indexStart: 0,
                                lightmapIdx: void 0,
                                nodeId: p.componentKey,
                                positionCount: u.attributes.position.count,
                                positionStart: 0,
                                userId: p.componentKey
                            };
                            return x._indicesGroup = {},
                            x._indicesGroup[p.componentKey] = [M],
                            A.addMeshToInfoMap(p.componentKey, p.componentKey, x, M),
                            x.geometryId = p.geometryId,
                            this._cacheActiveMesh(p.userId, p.nodeId, x),
                            g = null,
                            f = null,
                            w = null,
                            m = null,
                            u = null,
                            x
                        }
                    }
                }
        }
    }
    ,
    mC.prototype._readBufferInfo = function(A, e) {
        var t = A.getModelDescriptor().getStandardNodeInfos();
        if (t) {
            e || (e = A.getModelDescriptor().getInstancedUserIds());
            for (var i = A.getModelDescriptor(), o = A.materialManager.materials, n = A.materialManager.textures, r = 0, a = e.length; a > r; r += 1)
                for (var s = t[e[r]], l = 0, c = s.length; c > l; l += 1) {
                    var h = i.referencedMeshCache.components[s[l].componentKey]
                      , d = h.type;
                    if (-1 !== h.geoId) {
                        var p = this.getGeometryById(h.geoId);
                        if (p || (p = this.getGeometryByNodeInfo(A, s[l])))
                            if (np(A.dataVersion, "2.0.0"))
                                ;
                            else {
                                var g = o[h.matId];
                                if (g) {
                                    if (A.textureNeedsUpdate && void 0 !== A.dataVersion && ap(A.dataVersion, "2.0.0") && (A.textureNeedsUpdate = !1,
                                    g.textures.length > 0))
                                        if (g.materials.length > 1)
                                            for (l = 0; g.UVgroup.length > l; l += 1)
                                                for (m = (f = g.UVgroup[l]).start,
                                                C = f.count,
                                                y = f.textureIndex,
                                                r = 0; g.groups.length > r; r += 1) {
                                                    E = (v = g.groups[r]).count,
                                                    B = v.materialIndex;
                                                    if ((m === (I = v.start) || m + C === I + E || I > m && C > E) && C >= E) {
                                                        S = g.materials[B];
                                                        (x = n[g.textures[y]]) && S && (S.map = x)
                                                    }
                                                }
                                        else
                                            g.materials[0].map = n[g.textures[0]]
                                } else if (g = this._readMaterialBuffer(h.matId, A)) {
                                    if (0 === g.materials.length) {
                                        (v = _u[d] ? _u[d].color : void 0) || (Bh.log("Material not found for type: ", d),
                                        v = _u.DEFAULT.color),
                                        v || Bh.log("Default material not found for type: ", d);
                                        var u = new xr({
                                            color: new LA(v[0],v[1],v[2])
                                        });
                                        1 > v[3] && (u.transparent = !0,
                                        u.opacity = v[3]),
                                        u.side = 2,
                                        g.materials.push(u),
                                        g.groups.push({
                                            start: 0,
                                            count: c = p.index.count,
                                            materialIndex: 0
                                        })
                                    }
                                    if (g.textures.length > 0)
                                        if (g.materials.length > 1)
                                            for (var l = 0; g.UVgroup.length > l; l += 1)
                                                for (var f, m = (f = g.UVgroup[l]).start, C = f.count, y = f.textureIndex, r = 0; g.groups.length > r; r += 1) {
                                                    var v, I, E = (v = g.groups[r]).count, B = v.materialIndex;
                                                    if ((m === (I = v.start) || m + C === I + E || I > m && C > E) && C >= E) {
                                                        var x, S = g.materials[B];
                                                        (x = n[g.textures[y]]) && S && (S.map = x)
                                                    }
                                                }
                                        else
                                            g.materials[0].map = n[g.textures[0]];
                                    p && g && (p.groups = g.groups),
                                    o[h.matId] = g.materials
                                }
                            }
                    } else
                        Bh.debug("实体没有几何")
                }
        }
    }
    ,
    mC.prototype.createMeshNodes = function(A, e) {
        this._readBufferInfo(A, e),
        A.hasAnimation && vc.EnableAnimation ? this._makeSkinMesh(A) : this._makeMesh(A)
    }
    ,
    mC.prototype.asyncCreateMeshNodes = function(A, e, t) {
        this._readBufferInfo(A, e),
        A.hasAnimation && vc.EnableAnimation ? t && t() : this._makeMesh(A, e, t)
    }
    ,
    mC.prototype._readMaterialBuffer = function(A, e) {
        var t = e.getModelDescriptor().referencedMeshCache.materials[A];
        if (!t)
            return null;
        var i = t.color
          , o = t.colorIndex
          , n = t.texture
          , r = t.textureIndex
          , a = []
          , s = []
          , l = [];
        new Aa;
        if (i.length > 4) {
            for (var c = 0; i.length / 4 > c; c += 1) {
                var h = new xr({
                    color: new LA(i[4 * c],i[4 * c + 1],i[4 * c + 2])
                });
                1 > i[4 * c + 3] && (h.transparent = !0,
                h.opacity = i[4 * c + 3]),
                h.side = 2,
                a.push(h),
                h = null
            }
            for (var d = null, p = void 0, g = 0; o.length > g; g += 1) {
                var u = o[g];
                u !== p && (p = u,
                null != d && (d.count = 3 * g - d.start,
                s.push(d)),
                d = {
                    start: 3 * g,
                    materialIndex: p
                })
            }
            null != d && (d.count = 3 * o.length - d.start,
            s.push(d))
        } else if (4 === i.length) {
            var f = new xr({
                color: new LA(i[0],i[1],i[2])
            });
            1 > i[3] && (f.transparent = !0,
            f.opacity = i[3]),
            f.side = 2,
            a.push(f),
            s.push({
                start: 0,
                count: 3 * o.length,
                materialIndex: 0
            })
        }
        for (var m = null, C = void 0, y = r, v = 0; y.length > v; v += 1) {
            var I = y[v];
            I !== C && (C = I,
            null != m && (m.count = 3 * v - m.start,
            l.push(m)),
            m = {
                start: 3 * v,
                textureIndex: C
            })
        }
        return null != m && (m.count = 3 * y.length - m.start,
        l.push(m)),
        {
            materials: a,
            groups: s,
            textures: n,
            UVgroup: l
        }
    }
    ,
    mC.prototype.clearSelectedObjectIds = function() {
        this.selectedObjectIds.length = 0
    }
    ,
    mC.prototype.cacheSelectedObjectIds = function(A) {
        this.selectedObjectIds.push(A)
    }
    ,
    mC.prototype.adjustVisibility = function(A, e) {
        var t = this._getNodeGroup(A)
          , i = t.visible;
        e && !t.bVisible || (t.visible = e),
        t.bVisible = i
    }
    ,
    mC.prototype.changeVisibilityOfSelectedObjects = function(A, e) {
        var t = A.manager
          , i = t.octantToObjectMap[A.modelKey].mesh;
        this.selectedMeshes.length = 0;
        for (var o = 0, n = this.selectedObjectIds.length; n > o; o += 1) {
            var r = this.selectedObjectIds[o]
              , a = i[r][0];
            a && (t.filter._isVisible({
                userId: r
            }) && (a.visible = e))
        }
    }
    ,
    mC.prototype.changeVisibilityOfNonSelectedObjects = function(A, e) {
        var t = A.manager
          , i = t.octantToObjectMap[A.modelKey].mesh;
        this.selectedMeshes.length = 0;
        for (var o = {}, n = 0, r = this.selectedObjectIds.length; r > n; n += 1) {
            o[this.selectedObjectIds[n]] = !0
        }
        for (var a in i)
            if (i.hasOwnProperty(a) && !o[a]) {
                var s = i[a][0];
                if (!s)
                    continue;
                if (!t.filter._isVisible({
                    userId: a
                }))
                    continue;
                s.visible = e
            }
    }
    ,
    mC.prototype.restoreVisibilityOfObjects = function() {
        this.selectedMeshes.length = 0,
        this.nonSelectedMeshes.length = 0
    }
    ,
    mC.prototype._getNodeGroup = function(A) {
        return A._getNodeGroup(gp.GEOMETRY, {
            globalSpace: !0
        })
    }
    ,
    mC.prototype.getMeshesByUserIds = function(A, e) {
        var t = e
          , i = A.getModelDescriptor().getNodeInfosByComponentKey(t);
        if (i) {
            for (var o = [], n = 0, r = i.length; r > n; n += 1)
                for (var a = i[n], s = a.mesh, l = s._indicesGroup[t], c = 0, h = l.length; h > c; c += 1) {
                    var d = {};
                    d.mesh = s,
                    d.indexInfo = l[c],
                    d.matrix = s.matrix.clone().multiply(A.getModelMatrix()),
                    d.boundingBox = a.boundingBox.clone().applyMatrix4(d.matrix),
                    o.push(d)
                }
            return o
        }
        return null
    }
    ,
    mC.prototype._getUsedGeometry = function(A, e) {
        var t = null;
        if (!vc.Instance && e.uvArrayBuffer) {
            var i = e.geometryId + "|" + e.nodeId;
            if (t = this.getGeometryById(i))
                return t;
            var o = this._createGeometryByNodeInfo(A, e);
            o instanceof Array || (o = [o]),
            t = [];
            for (var n = new l, r = new y, a = e.uvArrayBuffer, s = 0, c = o.length; c > s; s += 1) {
                var h = new he;
                h.setIndex(o[s].index),
                h.addAttribute("position", o[s].attributes.position),
                h.addAttribute("normal", o[s].attributes.normal),
                n.set(a[6 * s], a[6 * s + 2], a[6 * s + 4], a[6 * s + 1], a[6 * s + 3], a[6 * s + 5], 0, 0, 1);
                for (var d = [], p = o[s].attributes.uv.array, g = 0, u = p.length; u > g; g += 2)
                    r.set(p[g], p[g + 1], 1),
                    r.applyMatrix3(n),
                    d.push(r.x),
                    d.push(r.y);
                h.addAttribute("uv", new Ae(d,2)),
                t.push(h)
            }
            this._cacheGeometry(i, t)
        } else
            t = this.getGeometryByNodeInfo(A, e);
        return t
    }
    ,
    mC.prototype.getGeometryBuffersByUserId = function(A, e) {
        var t = A.getModelDescriptor().getStandardNodeInfosById(e);
        if (!t)
            return [];
        for (var i = [], o = A.getDatabagId(), n = 0, r = t.length; r > n; n += 1) {
            var a = t[n]
              , s = this.getGeometryByNodeInfo(A, a);
            if (s) {
                var l = this._isLines(a);
                if (s instanceof Array)
                    for (var c = 0, h = s.length; h > c; c += 1)
                        i.push({
                            isLines: l,
                            databagId: o,
                            nodeId: a.nodeId,
                            position: s[c].getAttribute("position").array,
                            index: s[c].getIndex().array,
                            matrix: a.matrix
                        });
                else
                    i.push({
                        isLines: l,
                        databagId: o,
                        nodeId: a.nodeId,
                        position: s.getAttribute("position").array,
                        index: s.getIndex().array,
                        matrix: a.matrix
                    })
            }
        }
        return i
    }
    ,
    mC.prototype.traverseActiveMeshMap = function(A, e) {
        for (var t = 0, i = (A = A || Object.keys(this.activeMeshMap)).length; i > t; t += 1) {
            var o = A[t];
            if (this.activeMeshMap[o])
                for (var n = Object.keys(this.activeMeshMap[o]), r = 0, a = n.length; a > r; r += 1) {
                    var s = n[r];
                    e(o, s, this.activeMeshMap[o][s])
                }
        }
    }
    ,
    mC.prototype.getActiveMeshMapById = function(A) {
        return this.activeMeshMap[A]
    }
    ,
    mC.prototype._clearActiveMeshMap = function() {
        this.activeMeshMap = {}
    }
    ,
    mC.prototype._cacheActiveMesh = function(A, e, t) {
        this.activeMeshMap[A] || (this.activeMeshMap[A] = {}),
        this.activeMeshMap[A][e] || (this.activeMeshMap[A][e] = []),
        this.activeMeshMap[A][e].push(t)
    }
    ,
    mC.prototype._isLines = function(A) {
        return A.type === $u.EnumNodeItemType.LINE
    }
    ,
    mC.prototype.getPickingNodeGenerator = function() {
        return this.pickingNodeGenerator || (this.pickingNodeGenerator = new uC(this)),
        this.pickingNodeGenerator
    }
    ,
    mC.prototype.isPickableNode = function(A) {
        return !this.filter || this.filter._isPickable({
            userId: A
        })
    }
    ;
    var CC = function(A) {
        of.call(this, A),
        this.nodeGroupName = "PickingWireFrameGroup"
    };
    Object.assign(CC.prototype, of.prototype),
    eu(CC, [{
        key: "disposePickingNodeById",
        value: function(A) {
            for (var e = Object.keys(this.pickingNodeMap[A]), t = 0, i = e.length; i > t; t += 1)
                for (var o = this.pickingNodeMap[A][e[t]], n = 0, r = o.length; r > n; n += 1)
                    o[n].material = null,
                    o[n].geometry.dispose(),
                    o[n] = null
        }
    }, {
        key: "addToPickingNodeMap",
        value: function(A, e, t) {
            this.pickingNodeMap || (this.pickingNodeMap = {}),
            this.pickingNodeMap[A] || (this.pickingNodeMap[A] = {}),
            this.pickingNodeMap[A][e] = t,
            this.addToPickingNodeGroup(t)
        }
    }, {
        key: "removeFormPickingNodeGroup",
        value: function(A) {
            if (this.pickingNodeGroup)
                for (var e = Object.keys(this.pickingNodeMap[A]), t = 0, i = e.length; i > t; t += 1)
                    for (var o = this.pickingNodeMap[A][e[t]], n = 0, r = o.length; r > n; n += 1)
                        this.pickingNodeGroup.remove(o[n])
        }
    }, {
        key: "generatePickingMeshes",
        value: function(A) {
            var e = this
              , t = this.manager;
            this.manager.manager.getMeshManager().traverseActiveMeshMap(A, (function(A, i, o) {
                if (!(o && o.length && o[0].isLineSegments || e._isExistNode(A, i))) {
                    var n = 0
                      , r = 0
                      , a = o[0].geometryId
                      , s = [];
                    for (n = 0,
                    r = o.length; r > n; n += 1)
                        s.push(o[n].geometry);
                    var l = t._getWireframeGeometryById(a, s)
                      , c = [];
                    for (n = 0,
                    r = l.length; r > n; n += 1) {
                        var h = new jo(l[n],Kd.DefaultMaterial);
                        Tu.copyMeshProperties(h, o[n]),
                        h.renderOrder = 0,
                        c.push(h)
                    }
                    e.addToPickingNodeMap(A, i, c)
                }
            }
            ))
        }
    }, {
        key: "_isExistNode",
        value: function(A, e) {
            return !!(this.pickingNodeMap && this.pickingNodeMap[A] && this.pickingNodeMap[A][e])
        }
    }, {
        key: "updatePickingMeshesState",
        value: function(A, e, t) {
            if (this.pickingNodeMap)
                for (var i = this.pickingNodeMap, o = this.manager.manager.getMeshManager(), n = 0, r = e.length; r > n; n += 1) {
                    var a = e[n];
                    if (i[a] && o.isPickableNode(a)) {
                        var s = o.getActiveMeshMapById(a);
                        if (s)
                            for (var l = Object.keys(i[a]), c = 0, h = l.length; h > c; c += 1) {
                                var d = l[c];
                                if (s[d]) {
                                    var p = i[a][d];
                                    if (p)
                                        for (var g = 0, u = p.length; u > g; g += 1)
                                            p[g].material = A,
                                            p[g].visible = !0
                                }
                            }
                    }
                }
        }
    }, {
        key: "resetPickingMeshesState",
        value: function() {
            if (this.pickingNodeMap)
                for (var A = this.pickingNodeMap, e = Object.keys(A), t = 0, i = e.length; i > t; t += 1)
                    for (var o = e[t], n = Object.keys(A[o]), r = 0, a = n.length; a > r; r += 1)
                        for (var s = A[o][n[r]], l = 0, c = s.length; c > l; l += 1)
                            s[l].visible = !1
        }
    }, {
        key: "updatePickingMeshes",
        value: function(A, e, t) {
            return this.generatePickingMeshes(e),
            this.resetPickingMeshesState(),
            this.updatePickingMeshesState(A, e, t),
            this.getPickingNodeGroup()
        }
    }]);
    var yC = function(A) {
        this.manager = A,
        this.wireframeGeometries = {},
        this.wireframeLineMeshes = {}
    };
    yC.prototype._disposeGeometries = function() {
        for (var A in this.wireframeGeometries)
            this._disposeGeometry(A)
    }
    ,
    yC.prototype.destroy = function() {
        this.manager = null,
        this._clearWireframeLineMeshes(),
        this.wireframeLineMeshes = null,
        this._disposeGeometries(),
        this.wireframeGeometries = null
    }
    ,
    yC.prototype.clearData = function() {
        this._clearWireframeLineMeshes(),
        this._disposeGeometries()
    }
    ,
    yC.prototype.update = function(A, e) {
        this.isActivateWireframe(A) ? (this._clearWireframeGroupNode(A),
        this._generateWireframeNodes(A, e),
        this._getWireWireframeGroupNode(A).updateMatrixWorld(!0)) : this._removeWireframeGroupNode(A)
    }
    ,
    yC.prototype._disposeGeometry = function(A) {
        var e = this.wireframeGeometries[A];
        if (e) {
            if (Array.isArray(e))
                for (var t = 0, i = e.length; i > t; t += 1)
                    e[t].dispose();
            else
                e.dispose();
            delete this.wireframeGeometries[A]
        }
    }
    ,
    yC.prototype._clearWireframeLineMeshes = function() {
        for (var A in this.wireframeLineMeshes)
            delete this.wireframeLineMeshes[A];
        this.wireframeLineMeshes = {}
    }
    ,
    yC.prototype._clearWireframeGroupNode = function(A) {
        this._getWireWireframeGroupNode(A).clear()
    }
    ,
    yC.prototype._removeWireframeGroupNode = function(A) {
        A._removeNodeGroup(this._getWireframeGroupName(A))
    }
    ,
    yC.prototype.isActivateWireframe = function(A) {
        return A.isActivateWireframe()
    }
    ,
    yC.prototype._getWireWireframeGroupNode = function(A) {
        return A._getNodeGroup(this._getWireframeGroupName(A), {
            globalSpace: !0
        })
    }
    ,
    yC.prototype._getWireframeGeometryByNodeInfo = function(A, e) {
        return this._getWireframeGeometryById(e.geometryId, this.manager.getGeometryByNodeInfo(A, e), A)
    }
    ,
    yC.prototype._getWireframeGeometryById = function(A, e, t) {
        if (this.wireframeGeometries[A])
            return this.wireframeGeometries[A];
        var i = []
          , o = null
          , n = null;
        if (Array.isArray(e))
            for (var r = 0, a = e.length; a > r; r += 1)
                n = Up(e[r].attributes.position.array, e[r].index.array),
                (o = new he).setIndex(new $A(n,1)),
                o.setAttribute("position", e[r].attributes.position, 3),
                i.push(o);
        else
            n = Up(e.attributes.position.array, e.index.array),
            (o = new he).setIndex(new $A(n,1)),
            o.setAttribute("position", e.attributes.position, 3),
            i.push(o);
        return this.wireframeGeometries[A] = i,
        this.wireframeGeometries[A]
    }
    ,
    yC.prototype._makeWireframeLineMeshes = function(A, e, t) {
        var i = this.wireframeLineMeshes[e.nodeId];
        if (!i) {
            i = this.wireframeLineMeshes[e.nodeId] = [];
            for (var o = this._getWireframeGeometryByNodeInfo(A, e), n = 0, r = o.length; r > n; n += 1) {
                var a = new jo(o[n],this._getWireframeMaterial(A));
                a.name = e.nodeId + "_" + n,
                a.applyMatrix4(e.matrix),
                a.matrixAutoUpdate = !1,
                i.push(a)
            }
            e.wireframeMeshs = i
        }
        for (var s = 0, l = i.length; l > s; s += 1)
            t.add(i[s])
    }
    ,
    yC.prototype._generateWireframeNodes = function(A, e) {
        var t = this._getWireWireframeGroupNode(A)
          , i = A.getModelDescriptor().getStandardNodeInfos();
        e || (e = A.getModelDescriptor().getStandardUserIds());
        for (var o, n, r = this.manager.getHiddenUserIds(), a = 0; e.length > a; a += 1) {
            var s = e[a]
              , l = i[s][0];
            r[s] || (o = l,
            n = this._getFilter(A),
            o.type === Qf.EnumNodeItemType.LINE || vc.Instance && ("box" === o.geometryId || "boxM" === o.geometryId) || n._hasRenderWithBoardlineFilter() && !n._isRenderWithBoardline(o) || this._makeWireframeLineMeshes(A, l, t))
        }
    }
    ,
    yC.prototype._getWireframeGroupName = function(A) {
        return A._getWireframeGroupName()
    }
    ,
    yC.prototype._getWireframeMaterial = function(A) {
        return A.getWireframeMaterial()
    }
    ,
    yC.prototype._getFilter = function(A) {
        return A.manager.filter
    }
    ,
    yC.prototype.adjustVisibility = function(A, e) {
        if (A.isActivateWireframe()) {
            var t = this._getWireWireframeGroupNode(A)
              , i = t.visible;
            e && !t.bVisible || (t.visible = e),
            t.bVisible = i
        }
    }
    ,
    yC.prototype.changeVisibilityOfSelectedObjects = function(A, e) {}
    ,
    yC.prototype.changeVisibilityOfNonSelectedObjects = function(A, e) {
        this.adjustVisibility(A, e)
    }
    ,
    yC.prototype.restoreVisibilityOfObjects = function() {}
    ,
    yC.prototype.getPickingNodeGenerator = function() {
        return this.pickingNodeGenerator || (this.pickingNodeGenerator = new CC(this)),
        this.pickingNodeGenerator
    }
    ;
    var vC = function(A) {
        this.meshManager = new mC(this),
        this.model = A,
        this.wireframeManager = new yC(this)
    };
    vC.prototype.destroy = function() {
        this.meshManager.destroy(),
        this.meshManager = null,
        this.wireframeManager.destroy(),
        this.wireframeManager = null
    }
    ,
    vC.prototype.clearData = function() {
        this.meshManager.clearData(),
        this.wireframeManager.clearData()
    }
    ,
    vC.prototype.disposeGeometry = function(A) {
        this.meshManager.disposeGeometry(A)
    }
    ,
    vC.prototype.cullNodes = function(A, e) {
        this.hasNodeInfo(A) && this.meshManager.cullNodes(A, e)
    }
    ,
    vC.prototype.updateNodes = function(A, e) {
        if (this.hasNodeInfo(A)) {
            var t;
            t = this._collectModelFiltered(A),
            this.meshManager.update(A, e, t),
            this.wireframeManager.update(A, e)
        }
    }
    ,
    vC.prototype.applyFilter = function(A, e) {
        if (this.hasNodeInfo(A)) {
            var t = null;
            t = e || A.getModelDescriptor().getStandardUserIds();
            var i = A.getModelDescriptor().getStandardNodeInfos();
            this._collectFilteredUserIds(A.manager.filter, t, i),
            this._collectSelectedUserIds(A.manager.sceneState.selectionSet, i),
            this._collectHoveredUserIds(A.manager.sceneState.hoverId, i),
            this.updateNodes(A, e)
        }
    }
    ,
    vC.prototype.applySelection = function(A) {
        if (this.hasNodeInfo(A)) {
            var e = A.getModelDescriptor().getStandardNodeInfos();
            this._clearSelectedState(A),
            this._clearHoveredState(A),
            this._collectSelectedUserIds(A.manager.sceneState.selectionSet, e),
            this._collectHoveredUserIds(A.manager.sceneState.hoverId, e),
            this.updateNodes(A)
        }
    }
    ,
    vC.prototype.clearSelection = function(A) {
        this._clearSelectedState(A),
        this.applyHover(A)
    }
    ,
    vC.prototype.applyHover = function(A) {
        if (this.hasNodeInfo(A)) {
            var e = A.getModelDescriptor().getStandardNodeInfos();
            this._clearHoveredState(A),
            this._collectHoveredUserIds(A.manager.sceneState.hoverId, e),
            this.updateNodes(A)
        }
    }
    ,
    vC.prototype.clearHover = function(A) {
        this._clearHoveredState(A),
        this.updateNodes(A)
    }
    ,
    vC.prototype.applyBlink = function(A) {}
    ,
    vC.prototype.clearBlink = function(A) {}
    ,
    vC.prototype.getPriorityNodes = function() {
        return this.meshManager.getPriorityNodes()
    }
    ,
    vC.prototype.getGeometryByNodeInfo = function(A, e) {
        return this.meshManager.getGeometryByNodeInfo(A, e)
    }
    ,
    vC.prototype.getRenderableCount = function(A) {
        return A.renderableCount
    }
    ,
    vC.prototype.getLoader = function(A) {
        return A.loader
    }
    ,
    vC.prototype.getContainsCamera = function(A) {
        return A.containsCamera
    }
    ,
    vC.prototype.getFilter = function(A) {
        return A.manager.filter
    }
    ,
    vC.prototype.hasNodeInfo = function(A) {
        return !!A.getModelDescriptor().getStandardNodeInfos()
    }
    ,
    vC.prototype.createMeshNodes = function(A) {
        this.meshManager.createMeshNodes(A)
    }
    ,
    vC.prototype.asyncCreateMeshNodes = function(A, e, t) {
        this.meshManager.asyncCreateMeshNodes(A, e, t)
    }
    ,
    vC.prototype._collectFilteredUserIds = function(A, e, t) {
        var i = A._hasHiddenFileIdFilter()
          , o = A._hasVisibleFilter()
          , n = A._hasOverrideMaterialFilter()
          , r = A._hasTransparentFilter();
        this.mapMaterialIdToUserIdsForFilter = {};
        if (this.hiddenUserIdSetObject = {},
        this.overrideUserIdSetObject = {},
        this.transparentUserIdSetObject = {},
        i || o || n || r)
            for (var a = 0; e.length > a; a += 1) {
                var s = e[a]
                  , l = t[s];
                if (l && l.length)
                    for (var c = 0, h = l.length; h > c; c += 1) {
                        var d = l[c];
                        if (i && A._isHiddenFileId(d) || o && !1 === A._isVisible(d))
                            this.hiddenUserIdSetObject[s] = !0;
                        else if (r && A._isTransparent(d))
                            this.transparentUserIdSetObject[s] = !0;
                        else if (n && A._hasOverrideMaterial(d)) {
                            var p = A._getOverrideMaterial(d);
                            if (Array.isArray(p)) {
                                for (var g = [], u = 0, f = p.length; f > u; u++) {
                                    var m = null !== p[u] ? p[u].name : "";
                                    "" !== m && g.push(m)
                                }
                                this.overrideUserIdSetObject[s] = g
                            } else {
                                var C = null !== p ? p.name : "";
                                "" !== C && (this.overrideUserIdSetObject[s] = C)
                            }
                        }
                    }
            }
    }
    ,
    vC.prototype._collectModelFiltered = function(A) {
        var e = A.manager.filter
          , t = A.modelKey
          , i = e._hasModelOverrideMaterialFilter()
          , o = e._hasModelTransparentFilter()
          , n = A.manager.modelState.selectionSet;
        return A.manager.modelState.hoverId === t ? A.manager.modelState.getHoverMaterial() : n.hasOwnProperty(A.modelKey) ? A.manager.modelState.selectionMaterial : o && e._isModelTransparent(t) ? e._getMaterialByName("scene") : i && e._hasModelOverrideMaterial(t) ? e._getModelOverrideMaterial(t) : null
    }
    ,
    vC.prototype._clearFilteredState = function() {
        this.hiddenUserIdSetObject = {},
        this.overrideUserIdSetObject = {},
        this.transparentUserIdSetObject = {}
    }
    ,
    vC.prototype.getFilteredUserIds = function() {
        return this.mapMaterialIdToUserIdsForFilter
    }
    ,
    vC.prototype.getSelectedUserIds = function() {
        return this.mapMaterialIdToUserIdsForSelection
    }
    ,
    vC.prototype.getHoveredUserIds = function() {
        return this.mapMaterialIdToUserIdsForHover
    }
    ,
    vC.prototype.getBlinkedUserIds = function() {
        return this.mapBlinkUserIds
    }
    ,
    vC.prototype.getHiddenUserIds = function() {
        return this.hiddenUserIdSetObject
    }
    ,
    vC.prototype._collectSelectedUserIds = function(A, e) {
        for (var t in this.selectedUserIdSetObject = {},
        A)
            if (A.hasOwnProperty(t)) {
                if (!e[t])
                    continue;
                this.selectedUserIdSetObject[t] = !0
            }
    }
    ,
    vC.prototype._clearSelectedState = function() {
        this.selectedUserIdSetObject = {}
    }
    ,
    vC.prototype._collectHoveredUserIds = function(A, e) {
        if (this.hoveredUserIdSetObject = {},
        A && e[A]) {
            var t = e[A];
            this.hoveredUserIdSetObject = {},
            t && (this.hoveredUserIdSetObject[A] = !0)
        }
    }
    ,
    vC.prototype._clearHoveredState = function() {
        this.hoveredUserIdSetObject = {}
    }
    ,
    vC.prototype.getMeshesByUserIds = function(A, e) {
        return this.meshManager.getMeshesByUserIds(A, e)
    }
    ,
    vC.prototype.adjustVisibility = function(A, e) {
        this.meshManager.adjustVisibility(A, e),
        this.wireframeManager.adjustVisibility(A, e)
    }
    ,
    vC.prototype.changeVisibilityOfSelectedObjects = function(A, e) {
        this.meshManager.changeVisibilityOfSelectedObjects(A, e),
        this.wireframeManager.changeVisibilityOfSelectedObjects(A, e)
    }
    ,
    vC.prototype.changeVisibilityOfNonSelectedObjects = function(A, e) {
        this.meshManager.changeVisibilityOfNonSelectedObjects(A, e),
        this.wireframeManager.changeVisibilityOfNonSelectedObjects(A, e)
    }
    ,
    vC.prototype.restoreVisibilityOfObjects = function() {
        this.meshManager.restoreVisibilityOfObjects(),
        this.wireframeManager.restoreVisibilityOfObjects()
    }
    ,
    vC.prototype.isPickableNode = function(A) {
        var e = this.getHiddenUserIds();
        if (e && e[A])
            return !1;
        var t = this.getTransparentUserIds();
        return !t || !t[A]
    }
    ,
    vC.prototype.isHiddenNode = function(A) {
        var e = this.getHiddenUserIds();
        return !(!e || !e[A])
    }
    ,
    vC.prototype.getMeshManager = function() {
        return this.meshManager
    }
    ,
    vC.prototype.getWireFrameManager = function() {
        return this.wireframeManager
    }
    ,
    vC.prototype.getTransparentUserIds = function() {
        return this.transparentUserIdSetObject
    }
    ;
    var IC = function(A) {
        return hC.call(this, A),
        this.tag = "layer",
        this.defaultManager = new vC,
        this.instancedManager = new Hf,
        this.loader = new gC(this),
        this
    };
    (IC.prototype = Object.assign(IC.prototype, hC.prototype)).destroy = function() {
        this.defaultManager.destroy(),
        this.defaultManager = null,
        this.instancedManager.destroy(),
        this.instancedManager = null
    }
    ,
    IC.prototype.prepareData = function(A) {}
    ,
    IC.prototype.prepare = function(A) {
        this.isAllReady() && (this.model.getMaterialManager()._updateTextureMapping(),
        this.model.clearMeshFromOctantMap())
    }
    ,
    IC.prototype.updateNodes = function() {}
    ,
    IC.prototype.addNodeInfoToOctantMap = function() {}
    ,
    IC.prototype.dealMeshNodes = function(A) {
        A && A()
    }
    ,
    IC.prototype.disposeBufferAfterVbo = function() {}
    ,
    IC.prototype.dealMeshNodes = function(A) {
        this.model.getModelDescriptor().getInstancedUserIdsByCategory(this._loadedUserIds);
        var e = this.model
          , t = this;
        this.defaultManager.asyncCreateMeshNodes(e, e.getModelDescriptor().getStandardUserIds(), (function() {
            t.updateNodes(),
            A && A()
        }
        ))
    }
    ,
    IC.prototype.unloadComponents = function(A, e) {
        for (var t = this.model.modelKey, i = 0, o = A.length; o > i; i += 1) {
            var n = this.model.getModelDescriptor().getNodeInfosByComponentKey(A[i]);
            if (n) {
                for (var r = 0, a = n.length; a > r; r += 1) {
                    var s = n[r];
                    if (s.mesh)
                        this.defaultManager.meshManager.disposeGeometry(s.mesh.geometry.key),
                        s.mesh.destroy()
                }
                this.model.manager.removeMeshFromOctantMap(t, A[i])
            }
        }
        this.model.getModelDescriptor().clearNodeInfoCacheByComponentsKey(A),
        e && e()
    }
    ;
    var EC = function(A) {
        Af.call(this, A),
        this.instancedComponent = {}
    };
    Object.assign(EC.prototype, Af.prototype),
    EC.prototype.parseItemData = function(A) {
        this._readMaterialBuffer(this.model),
        this._parseGeo(),
        vc.Instance && this._parseInstanced();
        var e = {}
          , t = this.referencedMeshCache;
        for (var i in Bh.time("_readItemData"),
        t.components)
            t.components.hasOwnProperty(i) && this._readItemData(e, i, i, void 0, 0);
        Bh.timeEnd("_readItemData"),
        e = null,
        A && A()
    }
    ,
    EC.prototype._readItemData = function(A, e, t) {
        var i = this.referencedMeshCache.components[e];
        void 0 !== i && this._readMeshInfo(A, t, i, null)
    }
    ,
    EC.prototype._readMeshInfo = function(A, e, t, i) {
        var o = this.referencedMeshCache
          , n = this.model.materialManager.materials
          , r = null
          , a = null
          , s = this.model.subModel[t.subModel];
        if (t.nodes || t.nodeIds) {
            a = t.originalId;
            var l = (new M).fromArray(t.matrix || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
            t.matrix = l;
            var c = [];
            c = t.nodes ? t.nodes : t.nodeIds;
            for (var h = 0; c.length > h; h += 1) {
                var d = c[h];
                if ("object" !== lc(d) && (d = this.getReferencedMeshComponentNodeById(d)),
                d) {
                    var p, g = null, u = "";
                    if (-1 !== d.geoId)
                        if ((g = this._getMeshNodeAttr(d, t, h)).boundingBox.applyMatrix4(s),
                        g) {
                            if (t.buildInCategory && (g.buildInCategory = t.buildInCategory),
                            !n[u = d.material]) {
                                var f = _u[t.type] ? _u[t.type].color : void 0;
                                f || (Bh.log("Material not found for type: ", t.type),
                                f = _u.DEFAULT.color),
                                f || (Bh.log("Default material not found for type: ", t.type),
                                f = [1, 1, 1, 1]);
                                var m = new LA(f[0],f[1],f[2])
                                  , C = u || m.getHexString() + "_" + f[3]
                                  , y = n[C];
                                y || (Bh.warn("缺少材质 " + u),
                                y = Kd.createStandardMaterial({
                                    color: m
                                }),
                                1 > f[3] && (y.transparent = !0,
                                y.opacity = f[3]),
                                y.side = 2,
                                n[C] = y),
                                g.material = u = C
                            }
                            if (n[u].aoMap) {
                                var v = this.getReferencedMeshBufferById(g.geometryId);
                                v && (v.uv2 = v.uv)
                            }
                            p = g.nodeId;
                            var I = (R = this.userDataReader) ? R.getUserData(r) : null;
                            g.type = t.type,
                            g.userId = e,
                            g.name = t.name,
                            g.userDataId = r,
                            g.originalId = a,
                            g.materialId = u,
                            g.originMId = u,
                            g.userData = I,
                            g.categoryId = 0,
                            g.componentKey = e,
                            g.familyName = t.familyName,
                            g.familySymbol = t.familySymbol;
                            var E = vc.Instance
                              , B = o.reuseNodes.hasOwnProperty(p);
                            g.instanceOrNot = !(!E || !B),
                            g.isBatched = !0,
                            g.state = Lc.Visible,
                            g.material = null,
                            this._classifyNodeInfo(g),
                            g = null
                        } else
                            Bh.debug("非法node")
                }
            }
        } else {
            var x = t
              , S = "";
            if (null === i ? (r = x.userDataId,
            a = x.originalId,
            S = x.materialId || x.matId) : (r = i.userDataId,
            a = i.originalId,
            S = i.materialId > -1 ? i.materialId : x.materialId),
            x.materials || (x.materials = []),
            x.materials.length > 0)
                for (h = 0; x.materials.length > h; h += 1) {
                    var w = null;
                    if (w = this._getOldMeshNodeAttr(A, x, x.materials.length > 1, h)) {
                        if (x.buildInCategory && (w.buildInCategory = x.buildInCategory),
                        w.boundingBox.applyMatrix4(s),
                        !n[S = x.materials[h]]) {
                            var b = _u[x.type] ? _u[x.type].color : void 0;
                            b || (Bh.log("Material not found for type: ", x.type),
                            b = _u.DEFAULT.color),
                            b || (Bh.log("Default material not found for type: ", x.type),
                            b = [1, 1, 1, 1]);
                            var U = new LA(b[0],b[1],b[2])
                              , F = S || U.getHexString() + "_" + b[3]
                              , K = n[F];
                            K || (Bh.warn("缺少材质 " + S),
                            K = Kd.createStandardMaterial({
                                color: U
                            }),
                            1 > b[3] && (K.transparent = !0,
                            K.opacity = b[3]),
                            K.side = 2,
                            n[F] = K)
                        }
                        if (n[S].aoMap) {
                            var Q = this.getReferencedMeshBufferById(w.geometryId);
                            Q && (Q.uv2 = Q.uv)
                        }
                        if (!w)
                            return;
                        var R;
                        I = (R = this.userDataReader) ? R.getUserData(r) : null;
                        w.type = x.type,
                        w.userId = x.key,
                        w.name = x.name,
                        w.userDataId = r,
                        w.originalId = a,
                        w.materialId = S,
                        w.originMId = S,
                        w.userData = I,
                        w.categoryId = 0,
                        w.componentKey = x.key,
                        w.familyName = x.familyName,
                        w.familySymbol = x.familySymbol,
                        vc.Instance && this.instancedComponent[x.key] ? w.instanceOrNot = !0 : (w.instanceOrNot = !1,
                        this.instancedGeo[w.originalGeometryId].length > 1 && (w.originalGeometryId = "")),
                        w.state = Lc.Visible,
                        w.material = null,
                        w.isBatched = !0,
                        this._classifyNodeInfo(w),
                        w = null
                    } else
                        Bh.debug("非法node")
                }
            else {
                var T = null
                  , k = _u[x.type] ? _u[x.type].color : void 0;
                k || (Bh.log("Material not found for type: ", x.type),
                k = _u.DEFAULT.color),
                k || (Bh.log("Default material not found for type: ", x.type),
                k = [1, 1, 1, 1]);
                var D = new LA(k[0],k[1],k[2])
                  , L = D.getHexString() + "_" + k[3]
                  , N = n[L];
                if (N || (N = Kd.createStandardMaterial({
                    color: D
                }),
                1 > k[3] && (N.transparent = !0,
                N.opacity = k[3]),
                N.side = 2,
                n[L] = N),
                x.materials.push(L),
                (T = this._getOldMeshNodeAttr(A, x, !1, 0)).boundingBox.applyMatrix4(s),
                S = x.materials[0],
                !T)
                    return;
                e = x.key;
                T.type = x.type,
                T.userId = e,
                T.name = x.name,
                T.originalId = a,
                T.materialId = S,
                T.originMId = S,
                T.userData = {},
                T.categoryId = 0,
                T.componentKey = e,
                T.familyName = x.familyName,
                T.familySymbol = x.familySymbol,
                T.instanceOrNot = !(!vc.Instance || !this.instancedComponent[e]),
                T.isBatched = !0,
                T.state = Lc.Visible,
                T.material = null,
                this._classifyNodeInfo(T),
                T = null
            }
        }
    }
    ,
    EC.prototype._getMeshNodeAttr = function(A, e, t) {
        var i = new M;
        i.fromArray(A.matrix || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
        vc.DataReduction && i.scale(new y(1e3,1e3,1e3)),
        e && i.multiplyMatrices(e.matrix, i),
        A.geoId = e.subModel + A.geoId;
        var o = A.nodeId
          , n = A.geoId;
        if (-1 !== n) {
            var r = A.maxBoundary || e.maxBoundary
              , a = A.minBoundary || e.minBoundary
              , s = new ph;
            return s.set(a, r),
            {
                nodeId: o,
                guid: A.guid,
                geometryId: n,
                originalGeometryId: A.geoId,
                matrix: i,
                boundingBox: s,
                model: this.model
            }
        }
    }
    ,
    EC.prototype._getOldMeshNodeAttr = function(A, e, t, i) {
        var o = new M;
        o.fromArray(e.matrix || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
        vc.DataReduction && o.scale(new y(1e3,1e3,1e3));
        var n = t ? e.key + "_" + i : e.key
          , r = t ? e.geoId + "_" + i : e.geoId;
        if (-1 !== r) {
            var a = new ph
              , s = this.getReferencedMeshBufferById(e.geoId);
            return s && s.position ? (a = Tu.getBoundingBoxByBuffer(s.position)).applyMatrix4(o) : Bh.warn("no position "),
            {
                nodeId: n,
                guid: e.guid,
                geometryId: r,
                originalGeometryId: e.geoId,
                matrix: o,
                boundingBox: a,
                model: this.model
            }
        }
    }
    ;
    var BC = function(A) {
        Xu.call(this, A),
        this.maxGeoLoadTaskCount = 0,
        this.geoLoadTaskCount = 0,
        this.taskInstancedGeometrieManager = new Ou(this,"geometrie"),
        this.descriptor = new EC(A.model)
    };
    (BC.prototype = Object.assign(BC.prototype, Xu.prototype)).loadData = function() {
        for (var A = this, e = this, t = this.model, i = t.getConfig(), o = !1, n = 0, r = 0, a = 0, s = 0, l = [], c = [], h = [], d = [], p = [], g = [], u = [], f = [], m = [], C = function(C, y) {
            var v = i.children[C];
            if (E = i.animation,
            !(I = i.scene[C]) || !I.components || !I.geometries && (!I.batchedGeometries && !I.instancedGeometries || 1 > I.batchedGeometries.length && 1 > I.instancedGeometries.length) || !I.materials || !I.textures)
                return Bh.error("scene is null,modelKey is ", t.modelKey),
                t.dispatchEventEx({
                    type: Rc.ON_LOAD_EMPTY_SCENE,
                    modelKey: t.modelKey
                }),
                "continue";
            if (o = !0,
            n += I.components.length || 0,
            I.components.forEach((function(A) {
                e.fileKeyFromModelKey[A] = v
            }
            )),
            r += I.materials.length || 0,
            a += I.textures.length || 0,
            s += I.reuseNodes && I.reuseNodes.length || 0,
            u = u.concat(I.textures),
            A.map = A.map || [],
            2 > Number(I.geo))
                return Bh.error("不支持1.0版本的几何结构和其他版本混合加载。"),
                {
                    v: void 0
                };
            if (l = l.concat(I.components),
            h = h.concat(I.materials),
            m = m.concat(I.reuseNodes || []),
            Array.isArray(I.nodes) && (c = c.concat(I.nodes)),
            u = u.concat(I.textures),
            I.map && A.map.push(I.map),
            I.trees.length > 0)
                for (B = 0; I.trees.length > B; B += 1)
                    "partition" === (x = I.trees[B]).type && (f.push(x.fileKey),
                    e.fileKeyFromModelKey[x.fileKey] = v);
            I.lights && I.lights.length > 0 && (g = g.concat(I.lights)),
            E && (E.bones.length,
            E.bones,
            d.push(E.clips),
            p.push(E.nodes))
        }, y = 0, v = i.scene.length; v > y; y += 1) {
            var I, E, B, x, S = C(y);
            switch (S) {
            case "continue":
                continue;
            default:
                if ("object" === lc(S))
                    return S.v
            }
        }
        if (t.setEmptyScene(!o),
        e.maxLoadTaskCount = 0,
        e.maxLoadTaskCount += n,
        e.maxLoadTaskCount += r,
        e.maxLoadTaskCount += f.length,
        e.maxLoadTaskCount += s,
        e.maxLoadTaskCount += c.length,
        e.maxLoadTaskCount += g.length,
        1 > e.maxLoadTaskCount)
            return Bh.info("Nothing to load ", t.modelKey),
            void t.dispatchEventEx({
                type: Tc.SCENE_NOTHING_TO_LOAD,
                modelKey: t.modelKey
            });
        e.progress.total += e.maxLoadTaskCount,
        e.startCallback && e.startCallback(),
        Bh.time("数据加载时间"),
        e._loadComponent(l),
        e._loadMaterial(h),
        e._loadComponentNode(c),
        e._loadReuseNode(m),
        vc.EnableTextureLoading && a > 0 ? (e.maxLoadTextureCount += a,
        e._loadTextures(u)) : e._onLoadTexture(),
        e._loadKDTree(f),
        g.length > 0 && e._loadLights(g),
        e.offLine && e.loadAttribute(),
        e.loadFloorInfo(e.model.modelKey),
        e.loadSceneAndGeos(i)
    }
    ,
    BC.prototype.loadReuseNode = function(A, e) {
        var t = this
          , i = this.jsonLoader
          , o = this.model
          , n = this.url;
        i.setResponseType("json"),
        vc.useGzip && i.setResponseType("arraybuffer"),
        i.setCacheViable(!0);
        i.load(n.mpkUrl(A), (function(A) {
            t._parseReuseNodes(A),
            Bh.debug("component load from online"),
            e(),
            t._onTaskFinished()
        }
        ), void 0, (function(A) {
            o.dispatchEventEx({
                type: Tc.LOAD_COMPONENT_ERROR,
                modelKey: o.modelKey
            })
        }
        ))
    }
    ,
    BC.prototype._parseComponent = function(A, e) {
        var t = this.fileKeyFromModelKey[e] || "";
        if (A) {
            var i = this.descriptor;
            if (i)
                for (var o in vc.useGzip && (A = JSON.parse(uh.ab2str(pako.ungzip(A)))),
                A)
                    if (A.hasOwnProperty(o)) {
                        var n = A[o];
                        -1 !== n.geoId && (n.geoId = t + n.geoId,
                        n.subModel = t),
                        i.cacheReferencedMeshComponentData(A[o].key, A[o])
                    }
        } else
            Bh.error("没有数据")
    }
    ,
    BC.prototype._parseMaterial = function(A, e) {
        if (A) {
            if (A instanceof ArrayBuffer)
                try {
                    A = JSON.parse(uh.ab2str(A))
                } catch (A) {
                    Bh.error("处理材质出错")
                }
            var t = this.descriptor;
            if (t)
                for (var i in A)
                    t.cacheReferencedMeshMaterialData(i, A[i])
        } else
            Bh.error("没有数据")
    }
    ,
    BC.prototype.loadBatchedGeometrie = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.url
          , n = this.model;
        i.setResponseType("arraybuffer"),
        i.setCacheViable(!this.offLine);
        var r = i.load(o.mpkUrl(A), (function(i) {
            t._parseBatchedGeometrie(i, A),
            Bh.debug("geo load from online"),
            t._onGeoTaskFinished(),
            e()
        }
        ), void 0, (function(A) {
            n.dispatchEventEx({
                type: Tc.LOAD_GEOMETRY_ERROR,
                modelKey: n.modelKey
            }),
            e(),
            t._onGeoTaskFinished()
        }
        ));
        t.requests.loadGeometrie = r
    }
    ,
    BC.prototype.loadInstancedGeometrie = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.url
          , n = this.model;
        i.setResponseType("arraybuffer"),
        i.setCacheViable(!this.offLine);
        var r = i.load(o.mpkUrl(A), (function(i) {
            t._parseInstancedGeometrie(i, A),
            Bh.debug("geo load from online"),
            t._onGeoTaskFinished(),
            e()
        }
        ), void 0, (function(A) {
            n.dispatchEventEx({
                type: Tc.LOAD_GEOMETRY_ERROR,
                modelKey: n.modelKey
            }),
            e(),
            t._onGeoTaskFinished()
        }
        ));
        t.requests.loadGeometrie = r
    }
    ,
    BC.prototype._parseBatchedGeometrie = function(A, e) {
        var t = this.fileKeyFromModelKey[e] || ""
          , i = new ku.BatchedGeometryReader(A,this.dataVersion)
          , o = this.descriptor;
        if (o) {
            for (var n = i.geoCount, r = 0; n > r; r += 1) {
                var a = i.geomMap[r];
                void 0 !== a.position && void 0 !== a.index && void 0 !== a.normal ? (a.geoId = t + a.geoId,
                o.cacheReferencedMeshBufferData(a.geoId, a),
                this.handler.createBatchedMeshNodes(a)) : Bh.error("Error Geometry!")
            }
            this.model.manager.viewerImpl.render(),
            i = null
        }
    }
    ,
    BC.prototype._parseInstancedGeometrie = function(A, e) {
        var t = this.fileKeyFromModelKey[e] || ""
          , i = new ku.InstancedGeometryReader(A,this.dataVersion)
          , o = this.descriptor;
        if (o) {
            for (var n = i.geoCount, r = 0; n > r; r += 1) {
                var a = i.geomMap[r];
                void 0 !== a.position && void 0 !== a.index && void 0 !== a.normal ? (a.geoId = t + a.geoId,
                o.cacheReferencedMeshBufferData(a.geoId, a),
                this.handler.createInstancedMeshNodes(a)) : Bh.error("Error Geometry!")
            }
            this.model.manager.viewerImpl.render(),
            i = null
        }
    }
    ,
    BC.prototype._parseReuseNodes = function(A, e) {
        if (A) {
            vc.useGzip && (A = JSON.parse(uh.ab2str(pako.ungzip(A))));
            var t = this.descriptor;
            if (t)
                if (t.referencedMeshCache.reuseNodes)
                    for (var i in A)
                        t.referencedMeshCache.reuseNodes[i] = A[i];
                else
                    t.referencedMeshCache.reuseNodes = A
        } else
            Bh.error("没有数据")
    }
    ,
    BC.prototype.startLoadSceneAndGeos = function(A) {
        Bh.time("几何数据加载时间");
        for (var e = A.scene, t = this, i = 0, o = 0, n = [], r = [], a = function(a, s) {
            var l = e[a]
              , c = A.children[a];
            (l.batchedGeometries && l.batchedGeometries.length > 0 || l.instancedGeometries && l.instancedGeometries.length > 0) && (i += l.batchedGeometries.length || 0,
            o += l.instancedGeometries.length || 0,
            n = n.concat(l.batchedGeometries),
            r = r.concat(l.instancedGeometries),
            l.batchedGeometries.forEach((function(A) {
                t.fileKeyFromModelKey[A] = c
            }
            )),
            l.instancedGeometries.forEach((function(A) {
                t.fileKeyFromModelKey[A] = c
            }
            )))
        }, s = 0, l = e.length; l > s; s += 1)
            a(s);
        t.maxGeoLoadTaskCount += i,
        t.maxGeoLoadTaskCount += o,
        t.maxGeoLoadTaskCount > 0 || t._onGeoTaskFinished(),
        this._loadBatchedGeo(n),
        this._loadInstancedGeo(r)
    }
    ,
    BC.prototype.loadSceneAndGeos = function(A) {
        for (var e = A.scene, t = this, i = 0, o = [], n = function(n, r) {
            var a = e[n]
              , s = A.children[n];
            a.geometries && a.geometries.length > 0 && !(a.batchedGeometries && a.batchedGeometries.length > 0 || a.instancedGeometries && a.instancedGeometries.length > 0) && (i += a.geometries.length || 0,
            o = o.concat(a.geometries),
            a.geometries.forEach((function(A) {
                t.fileKeyFromModelKey[A] = s
            }
            )))
        }, r = 0, a = e.length; a > r; r += 1)
            n(r);
        t.maxLoadTaskCount += i,
        this._loadGeo(o)
    }
    ,
    BC.prototype._loadBatchedGeo = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.mpkUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = function(t) {
                    if (A[i[t]])
                        if (!0 === A[i[t]].split) {
                            var o = A[i[t]].list
                              , s = new Uint8Array(A[i[t]].length);
                            n.getBatch(o, (function(A) {
                                for (var n = !0, r = 0; o.length > r; r += 1)
                                    A[o[r]] ? s.set(new Uint8Array(A[o[r]]), 4e7 * r) : (n = !1,
                                    Bh.error("获取分割几何失败"));
                                if (n) {
                                    var a = i[t].indexOf("fileKey=");
                                    e._parseBatchedGeometrie(s.buffer, i[t].slice(a + 8)),
                                    e._onGeoTaskFinished(),
                                    Bh.debug("load geo from local")
                                } else {
                                    var l = e.taskGeometrieManager
                                      , c = i[t].indexOf("fileKey=");
                                    if (-1 === c)
                                        return void Bh.error("url is not has fileKey");
                                    l.addTask(i[t].slice(c + 8)),
                                    Bh.debug("load geo from net"),
                                    e.taskGeometrieManager.processTasks(e.loadBatchedGeometrie.bind(e))
                                }
                            }
                            ), (function() {
                                Bh.error("获取分割几何失败")
                            }
                            ))
                        } else
                            a = i[t].indexOf("fileKey="),
                            e._parseBatchedGeometrie(A[i[t]], i[t].slice(a + 8)),
                            e._onGeoTaskFinished(),
                            Bh.debug("load geo from local");
                    else {
                        if (r = e.taskGeometrieManager,
                        -1 === (a = i[t].indexOf("fileKey=")))
                            return Bh.error("url is not has fileKey"),
                            {
                                v: void 0
                            };
                        r.addTask(i[t].slice(a + 8)),
                        Bh.debug("load geo from net")
                    }
                }, o = 0; i.length > o; o += 1) {
                    var r, a, s = t(o);
                    if ("object" === lc(s))
                        return s.v
                }
                e.taskGeometrieManager.processTasks(e.loadBatchedGeometrie.bind(e))
            }
            ), (function() {
                for (var t = e.taskGeometrieManager, i = 0; A.length > i; i += 1)
                    t.addTask(A[i]);
                t.processTasks(e.loadBatchedGeometrie.bind(e))
            }
            ))
        } else {
            for (var r = this.taskGeometrieManager, a = 0; A.length > a; a += 1)
                r.addTask(A[a]);
            r.processTasks(e.loadBatchedGeometrie.bind(e))
        }
    }
    ,
    BC.prototype._loadInstancedGeo = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.mpkUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = function(t) {
                    if (A[i[t]])
                        if (!0 === A[i[t]].split) {
                            var o = A[i[t]].list
                              , s = new Uint8Array(A[i[t]].length);
                            n.getBatch(o, (function(A) {
                                for (var n = 0; o.length > n; n += 1)
                                    A[o[n]] ? s.set(new Uint8Array(A[o[n]]), 4e7 * n) : Bh.error("获取分割几何失败");
                                var r = i[t].indexOf("fileKey=");
                                e._parseInstancedGeometrie(s.buffer, i[t].slice(r + 8)),
                                e._onGeoTaskFinished(),
                                Bh.debug("load geo from local")
                            }
                            ), (function() {
                                Bh.error("获取分割几何失败")
                            }
                            ))
                        } else
                            a = i[t].indexOf("fileKey="),
                            e._parseInstancedGeometrie(A[i[t]], i[t].slice(a + 8)),
                            e._onGeoTaskFinished(),
                            Bh.debug("load geo from local");
                    else {
                        if (r = e.taskInstancedGeometrieManager,
                        -1 === (a = i[t].indexOf("fileKey=")))
                            return Bh.error("url is not has fileKey"),
                            {
                                v: void 0
                            };
                        r.addTask(i[t].slice(a + 8)),
                        Bh.debug("load geo from net")
                    }
                }, o = 0; i.length > o; o += 1) {
                    var r, a, s = t(o);
                    if ("object" === lc(s))
                        return s.v
                }
                e.taskInstancedGeometrieManager.processTasks(e.loadInstancedGeometrie.bind(e))
            }
            ), (function() {
                for (var t = e.taskInstancedGeometrieManager, i = 0; A.length > i; i += 1)
                    t.addTask(A[i]);
                t.processTasks(e.loadInstancedGeometrie.bind(e))
            }
            ))
        } else {
            for (var r = this.taskInstancedGeometrieManager, a = 0; A.length > a; a += 1)
                r.addTask(A[a]);
            r.processTasks(e.loadInstancedGeometrie.bind(e))
        }
    }
    ,
    BC.prototype._onGeoTaskFinished = function() {
        (this.geoLoadTaskCount += 1,
        this.notifyProgress) && (this.progressCallback && this.progressCallback({
            total: this.maxLoadTaskCount + this.maxGeoLoadTaskCount,
            loaded: .8 * (this.loadTaskCount + this.geoLoadTaskCount),
            modelKey: this.model.modelKey
        }));
        this.maxGeoLoadTaskCount > this.geoLoadTaskCount || (this.dataLoaded = !0,
        Bh.timeEnd("几何数据加载时间"),
        this.geoFinishCallback && this.geoFinishCallback())
    }
    ,
    BC.prototype.getSceneTaskCount = function(A) {
        var e = A.scenes;
        return e += A.lines,
        e += A.mpks,
        vc.BorderLineDelayLoaded || (e += this.getAllBorderlineCount()),
        e
    }
    ,
    BC.prototype._parseKDTree = function(A, e) {
        var t = {};
        t = "string" == typeof A ? JSON.parse(A) : A,
        this.model.kdTreeNode = this.model.kdTreeNode || [];
        var i = this.fileKeyFromModelKey[e] || "";
        if (t) {
            var o = new Zu;
            o.modelKey = i,
            o.init(t),
            this.model.kdTreeNode.push(o)
        }
    }
    ;
    var xC = function(A, e) {
        tf.call(this, A),
        this.defaultManager = new Of(e,A),
        this.instancedManager = new Hf(A),
        this.loader = new BC(this)
    };
    (xC.prototype = Object.create(tf.prototype)).prepare = function(A, e) {
        if (this.isLoaded() && !this.isHidden()) {
            this.prepareWireframe(this.model, e);
            this.model.getMaterialManager();
            this.model.getMaterialManager()._updateTextureMapping(),
            !this.model.lightmap || this.model.enableLightmap === vc.EnableLightmap && this.model.lightmapIntensity === vc.LightmapIntensity || (this.model.enableLightmap = vc.EnableLightmap,
            this.model.lightmapIntensity = vc.LightmapIntensity,
            this.rebuildIndicesforLightmap(),
            this.updateNodes())
        }
    }
    ,
    xC.prototype.settleData = function(A) {
        var e = this;
        this.addNodeInfoToOctantMap();
        var t = !1
          , i = !1;
        this.createMeshNodes((function() {
            t = !0,
            i && (e.loaded = !0,
            e.model.getMaterialManager()._updateTextureMapping(),
            e.clearCachedData(e.model),
            A && A())
        }
        )),
        e.model.setLoaded(!0);
        this.loader.geoFinishCallback = function() {
            i = !0,
            t && (e.loaded = !0,
            e.model.getMaterialManager()._updateTextureMapping(),
            e.clearCachedData(e.model),
            A && A())
        }
        ,
        this.loader.startLoadSceneAndGeos(this.model.getConfig())
    }
    ,
    xC.prototype.addNodeInfoToOctantMap = function() {
        var A = this.model.manager
          , e = this.model.getEncodedDatabagId();
        this.loader.getDescriptor().traverseNodeInfosByComponent((function(t, i) {
            A.addNodeInfoToOctantMap(e, t, i)
        }
        ))
    }
    ,
    xC.prototype.createMeshNodes = function(A) {
        var e = this
          , t = this.model;
        vc.stepLoad && t.setLoaded(!0);
        var i = this.loader.getDescriptor();
        this.instancedManager.createMeshNodes(t, i.getInstancedUserIds()),
        this.defaultManager.asyncCreateMeshNodes(t, i.getStandardUserIds(), (function() {
            t.getMaterialManager()._updateTextureMapping(),
            e.loaded = !0,
            A && A()
        }
        ))
    }
    ,
    xC.prototype.clearCachedData = function(A) {
        this.loader.getDescriptor().destroyReader(),
        this.loader.getDescriptor().clearReferencedMeshCache(),
        this.defaultManager.clearCachedData(),
        this.instancedManager.clearCachedData()
    }
    ,
    xC.prototype.createBatchedMeshNodes = function(A) {
        this.defaultManager.createBatchedMeshNodes(this.model, A)
    }
    ,
    xC.prototype.createInstancedMeshNodes = function(A) {
        this.instancedManager.createInstancedMeshNodes(this.model, A)
    }
    ;
    var SC = function(A) {
        $u.call(this, A)
    };
    Object.assign(SC.prototype, $u.prototype);
    var wC = function(A) {
        Xu.call(this, A),
        this.descriptor = new SC(A.model)
    };
    (wC.prototype = Object.assign(wC.prototype, Xu.prototype)).loadSceneAndGeos = function(A) {
        var e = A.scene
          , t = this.model
          , i = e.geometries.length || 0
          , o = [];
        if (this.map = {},
        ap(this.dataVersion, "2.0.0"))
            for (var n = 0; i > n; n += 1)
                e.geometries[n].fileKey ? o.push(e.geometries[n].fileKey) : t.dispatchEventEx({
                    type: Tc.SCENE_NOT_CLOSE,
                    modelKey: t.modelKey
                });
        else
            o = e.geometries;
        this.maxLoadTaskCount += i,
        this._loadGeo(o)
    }
    ,
    wC.prototype.getSceneTaskCount = function(A) {
        var e = A.scenes;
        return e += A.lines,
        e += A.mpks,
        vc.BorderLineDelayLoaded || (e += this.getAllBorderlineCount()),
        e
    }
    ;
    var MC = function(A, e) {
        tf.call(this, A),
        this.defaultManager = new vC(e,A),
        this.instancedManager = new Hf(A),
        this.loader = new wC(this)
    };
    Object.assign(MC.prototype, tf.prototype),
    MC.prototype.prepare = function(A) {
        this.isLoaded() && !this.isHidden() && (this.model.getMaterialManager()._updateTextureMapping(),
        this.model.clearMeshFromOctantMap(),
        this.instancedManager.addAllInstanceNodeToScene(this.model),
        this.defaultManager.cullNodes(this.model, A),
        this.prepareWireframe(this.model),
        this.updateNodes())
    }
    ,
    MC.prototype.prepareWireframe = function(A, e) {
        A.isActivateWireframe() && this.instancedManager.generateWireframe(A)
    }
    ,
    MC.prototype.settleData = function(A) {
        this.addNodeInfoToOctantMap(),
        this.createMeshNodes(A)
    }
    ,
    MC.prototype.addNodeInfoToOctantMap = function() {
        var A = this.model.manager
          , e = this.model.getEncodedDatabagId();
        this.model.getModelDescriptor().traverseNodeInfosByComponent((function(t, i) {
            A.addNodeInfoToOctantMap(e, t, i)
        }
        ))
    }
    ,
    MC.prototype.createMeshNodes = function(A) {
        var e = this.model
          , t = this;
        this.instancedManager.createMeshNodes(this.model, this.model.getModelDescriptor().getInstancedUserIds()),
        this.defaultManager.asyncCreateMeshNodes(e, e.getModelDescriptor().getStandardUserIds(), (function() {
            e.getMaterialManager()._updateTextureMapping(),
            t.updateNodes(),
            e.getModelDescriptor().clearReferencedMeshCache(),
            t.loaded = !0,
            A && A()
        }
        ))
    }
    ,
    MC.prototype.disposeBufferAfterVbo = function() {}
    ,
    MC.prototype.explosion = function(A) {
        if (this.isLoaded()) {
            var e = this.model.getComponentlist();
            A.componentKey = e,
            this.componentsExplosion(A)
        }
    }
    ,
    MC.prototype.closeExplosion = function() {
        this.explosion({})
    }
    ,
    MC.prototype.componentsExplosion = function(A) {
        if (this.isLoaded()) {
            var e = A.coefficientX || 1
              , t = A.coefficientY || 1
              , i = A.coefficientZ || 1
              , o = A.offsetX || 0
              , n = A.offsetY || 0
              , r = A.offsetZ || 0
              , a = null;
            if (A.center)
                a = (new y).fromArray(A.center);
            else if (1 !== e || 1 !== t || 1 !== i || 0 !== o || 0 !== n || 0 !== r)
                return;
            var s = this.model
              , l = s.manager
              , c = Array.isArray(A.componentKey) ? A.componentKey : [A.componentKey]
              , h = new y
              , d = new aA
              , p = new y(0,0,0)
              , g = new y(0,0,0)
              , u = new y
              , f = s.getModelMatrix()
              , m = new M;
            f && a && (m.getInverse(f),
            a.applyMatrix4(m));
            for (var C = 0; c.length > C; C += 1) {
                var v = c[C]
                  , I = s.getComponentInfo(v);
                if (I && I.length > 0)
                    for (var E = 0, B = I.length; B > E; E += 1) {
                        var x = I[E]
                          , S = x.mesh;
                        if (S) {
                            if (d.copy(x.boundingBox),
                            d.getCenter(h),
                            x.userData || (x.userData = {}),
                            p.set(0, 0, 0),
                            g.set(0, 0, 0),
                            1 !== e || 1 !== t || 1 !== i || x.userData.explosionFactor) {
                                x.userData.explosionFactor || (x.userData.explosionFactor = new y(1,1,1),
                                x.userData.explosionBaseDifference = h.sub(a).clone());
                                var w = x.userData.explosionFactor
                                  , b = x.userData.explosionBaseDifference;
                                p.set((e - w.x) * b.x, (t - w.y) * b.y, (i - w.z) * b.z),
                                1 === e && 1 === t && 1 === i ? (x.userData.explosionFactor = void 0,
                                x.userData.explosionBaseDifference = void 0) : w.set(e, t, i)
                            }
                            if (0 !== o || 0 !== n || 0 !== r || x.userData.explosionOffset) {
                                x.userData.explosionOffset || (x.userData.explosionOffset = new y(0,0,0));
                                var U = x.userData.explosionOffset;
                                g.set(o - U.x, n - U.y, r - U.z),
                                0 === o && 0 === n && 0 === r ? x.userData.explosionOffset = void 0 : U.set(o, n, r)
                            }
                            if (u.set(p.x + g.x, p.y + g.y, p.z + g.z),
                            0 !== u.x || 0 !== u.y || 0 !== u.z) {
                                x.userData.explosionFactor || x.userData.explosionOffset ? l.explosionList[v] || (l.explosionList[v] = !0) : delete l.explosionList[v],
                                m.makeTranslation(u.x, u.y, u.z),
                                x.transformation || (x.transformation = !0,
                                x.transformationOriginalMatrix = x.matrix.clone(),
                                x.applyMatrix = new M,
                                x.transformationOriginalBoundingBox = x.boundingBox.clone()),
                                x.matrix.premultiply(m),
                                x.applyMatrix.premultiply(m),
                                x.boundingBox.copy(x.transformationOriginalBoundingBox).applyMatrix4(x.applyMatrix);
                                var F = S.matrixAutoUpdate;
                                S.matrixAutoUpdate = !1,
                                S.applyMatrix4(m),
                                S.updateMatrixWorld(!0),
                                S.matrixAutoUpdate = F;
                                var K = x.wireframeMeshs;
                                if (K)
                                    for (var Q = 0, R = K.length; R > Q; Q += 1) {
                                        var T = K[Q];
                                        F = T.matrixAutoUpdate,
                                        T.matrixAutoUpdate = !1,
                                        T.matrix.copy(S.matrix),
                                        T.updateMatrixWorld(!0),
                                        T.matrixAutoUpdate = F
                                    }
                            }
                        }
                    }
            }
        }
    }
    ,
    MC.prototype.closeComponentsExplosion = function(A) {
        var e = Array.isArray(A) ? A : [A];
        this.componentsExplosion({
            componentKey: e
        })
    }
    ;
    var bC = function(A) {
        this.model = A,
        this.config = null,
        this.statistics = {
            renderableCount: 0,
            renderableTotal: vc.maxObjectNumInPool,
            renderableTotalForPool: vc.maxObjectNumInPool,
            numOfElements: 0,
            numOfTriangles: 0,
            memoeryInfo: null
        },
        this.transformInfos = {
            octreeTransformed: !0,
            originalBoundingBox: null,
            boundingBox: null,
            position: new y,
            rotation: new f,
            scale: new y(1,1,1),
            transformMatrix: new M,
            originalMatrix: new M
        }
    };
    bC.prototype.destroy = function() {
        this.model = null,
        this.config = null,
        this.statistics = null,
        this.transformInfos = null
    }
    ,
    bC.prototype.load = function(A) {
        var e = this
          , t = this.model
          , i = t.dataUrl
          , o = function(o) {
            var n = {};
            if ("string" == typeof o)
                try {
                    n = JSON.parse(o)
                } catch (A) {
                    return t.setEmptyScene(!0),
                    void t.dispatchEventEx({
                        type: Rc.ON_LOAD_INVALID_SCENE,
                        modelKey: t.modelKey
                    })
                }
            else
                n = o;
            if (n && "SUCCESS" === n.code) {
                if (vc.offLine)
                    e.model.getStorage().put(i.projectUrl(), n, e.model.modelKey, (function() {}
                    ), (function() {}
                    ));
                if (-1 === Number(n.data.status))
                    return void t.dispatchEventEx({
                        type: Tc.PARSEFAILE,
                        modelKey: t.modelKey
                    });
                if (3 > Number(n.data.status))
                    return void t.dispatchEventEx({
                        type: Tc.PARSING,
                        modelKey: t.modelKey
                    });
                if (n.data.type === Zc.DWG)
                    return t.dispatchEventEx({
                        type: Tc.IS2D,
                        modelKey: t.modelKey
                    }),
                    void Bh.error("模型 ", t.modelKey, " 是图纸文件，请使用EIMDRAWINGS库加载");
                !n.data.profiles || n.data.children && n.data.children.length > 1 ? (e.dataVersion = "2.0.0",
                i.apiVersion = "2.0.0",
                e.model.dataVersion = e.dataVersion) : (e.dataVersion = n.data.profiles.geo || "1.0.0",
                i.apiVersion = n.data.profiles.api,
                e.model.dataVersion = e.dataVersion),
                e._parse(n.data),
                t.dispatchEventEx({
                    type: Rc.ON_LOAD_CONFIG_FINISH,
                    modelKey: t.modelKey
                }),
                A && A()
            } else
                Bh.log(t.modelKey, "config load error! ", n.message),
                t.dispatchEventEx({
                    type: Rc.ON_LOAD_ERROR,
                    modelKey: t.modelKey,
                    code: n.code,
                    message: n.message
                }),
                t.manager.unload(t.modelKey)
        };
        if (vc.offLine) {
            var n = this.model.getStorage();
            n && n.getBatch([i.projectUrl()], (function(A) {
                A[i.projectUrl()] ? o(A[i.projectUrl()]) : _d({
                    type: "GET",
                    url: i.projectUrl(),
                    headers: {
                        Authorization: t.accessToken
                    },
                    success: o,
                    error: function(A) {
                        t.dispatchEventEx({
                            type: Rc.ON_NETWORK_ERROR,
                            modelKey: t.modelKey,
                            data: A
                        })
                    }
                })
            }
            ), (function() {}
            ))
        } else
            _d({
                type: "GET",
                url: i.projectUrl(),
                headers: {
                    Authorization: t.accessToken
                },
                success: o,
                error: function(A, e) {
                    switch (A) {
                    case 401:
                        t.dispatchEventEx({
                            type: Rc.ACCOUNT_NO_EXIST,
                            modelKey: t.modelKey,
                            data: e
                        });
                        break;
                    case 403:
                        t.dispatchEventEx({
                            type: Rc.NO_PERMISSION,
                            modelKey: t.modelKey,
                            data: e
                        });
                        break;
                    default:
                        t.dispatchEventEx({
                            type: Rc.ON_NETWORK_ERROR,
                            modelKey: t.modelKey,
                            data: A
                        })
                    }
                }
            })
    }
    ,
    bC.prototype._parse = function(A) {
        this.config = A,
        A.lengthUnit && (this.model.originalLengthUnit = A.lengthUnit),
        vc.AutoMergeComponent && A.componentCount > vc.AutoMergeComponentCount && (vc.MergeComponent = !0),
        this._toStatistics(A),
        this._setTransformInfos(A),
        this._chooseRendering(A),
        this._setHandler(A)
    }
    ,
    bC.prototype._getDataProvider = function(A) {
        if (vc.DataProvider === Wc.MERGED && void 0 !== A.bmpks && A.bmpks > 0)
            return Bh.debug("data from: merged"),
            Wc.MERGED;
        if (vc.LoadComponentOnDemand && A.scene && A.scene.map) {
            if (vc.DataProvider === Wc.LAYER_SCENE)
                return A.layers > 1 ? (Bh.debug("data from: layer scene"),
                Wc.LAYER_SCENE) : (Bh.debug("data from: layer"),
                Wc.LAYER);
            if (vc.DataProvider === Wc.LAYER)
                return Bh.debug("data from: layer"),
                Wc.LAYER
        }
        if (vc.DataProvider === Wc.AUTO) {
            if (vc.LoadComponentOnDemand && A.scene && A.scene.map)
                return np(this.dataVersion, "2.0.0") && (vc.MergeComponent = !0),
                Bh.debug("data from: layer"),
                Wc.LAYER;
            if (!vc.loadBatch && A.scene.geometries && A.scene.geometries.length > 0)
                return rp(this.dataVersion, "2.0.0") && (vc.MergeComponent = !0),
                Wc.DEFAULT;
            if (A.scene.batchedGeometries && A.scene.batchedGeometries.length > 0 || A.scene.instancedGeometries && A.scene.instancedGeometries.length > 0)
                return vc.MergeComponent = !0,
                Wc.MERGED;
            if (vc.MergeComponent && void 0 !== A.bmpks && A.bmpks > 0)
                return Bh.debug("data from: merged"),
                Wc.MERGED
        }
        return Bh.debug("data from: default"),
        Wc.DEFAULT
    }
    ,
    bC.prototype._chooseRendering = function(A) {
        this.model.manager.chooseRendering(this.statistics.memoeryInfo)
    }
    ,
    bC.prototype._setHandler = function(A) {
        var e = this._getDataProvider(A)
          , t = null
          , i = this.model;
        if (Array.isArray(A.scene)) {
            for (var o = 0, n = A.children.length; n > o; o += 1) {
                var r = A.scene[o];
                r && (i.subModel[A.children[o]] = (new M).fromArray(r.matrix || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]))
            }
            t = new xC(i,!1),
            i.merged = !0,
            vc.MergeComponent = !0
        } else if (i.hasAnimation && vc.EnableAnimation)
            t = new MC(i);
        else if (vc.MergeComponent) {
            switch (e) {
            case Wc.LAYER:
                vc.HasLayerData = !0,
                vc.LoadGeoOnDemand = !0,
                (t = new dC(i,!1)).layerProvider.cachedLayerData = A.scene.map;
                break;
            case Wc.LAYER_SCENE:
                vc.HasLayerData = !0,
                vc.LoadGeoOnDemand = !0;
                break;
            case Wc.MERGED:
                t = new oC(i,!1);
                break;
            default:
                t = new Yf(i,!1)
            }
            i.merged = !0
        } else if (vc.OrganizeNodesByCameraView)
            switch (e) {
            case Wc.LAYER:
            case Wc.LAYER_SCENE:
                vc.HasLayerData = !0,
                vc.LoadGeoOnDemand = !0
            }
        else
            switch (e) {
            case Wc.LAYER:
                vc.HasLayerData = !0,
                vc.LoadGeoOnDemand = !0,
                (t = new IC(i)).layerProvider.cachedLayerData = A.scene.map;
                break;
            case Wc.LAYER_SCENE:
                vc.HasLayerData = !0,
                vc.LoadGeoOnDemand = !0;
                break;
            case Wc.MERGED:
                break;
            default:
                t = new MC(i)
            }
        i._handler = t
    }
    ,
    bC.prototype._setTransformInfos = function(A) {
        if (this.model.hasAnimation = A.hasAnimation,
        this.transformInfos.octreeTransformed = !1,
        this.transformInfos.boundingBox && this.transformInfos.boundingBox.isBox3 || (this.transformInfos.boundingBox = new aA),
        this.transformInfos.boundingBox.expandByPoint(new y(A.minBoundary.x,A.minBoundary.y,A.minBoundary.z)),
        this.transformInfos.boundingBox.expandByPoint(new y(A.maxBoundary.x,A.maxBoundary.y,A.maxBoundary.z)),
        this.transformInfos.transformMatrix.compose(this.transformInfos.position, this.transformInfos.rotation, this.transformInfos.scale),
        this.transformInfos.transformMatrix.fromArray(A.matrix || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
        A.transform && Array.isArray(A.transform)) {
            var e = (new M).fromArray(A.transform || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
            this.transformInfos.transformMatrix.multiplyMatrices(this.transformInfos.transformMatrix, e)
        }
        this.transformInfos.originalMatrix.copy(this.transformInfos.transformMatrix),
        this.model.setModelMatrix(this.transformInfos.transformMatrix),
        this.model.manager.updateScene()
    }
    ,
    bC.prototype._toStatistics = function(A) {
        A.count = {},
        A.count.texture_pixels && A.count.texture_pixels > vc.MaxTexturePixels && (vc.EnableTextureLoading = !1),
        void 0 !== A.count && (void 0 !== A.count.mesh_face && (this.statistics.numOfTriangles += A.count.mesh_face),
        this.statistics.renderableTotal = 0,
        this.statistics.renderableTotalForPool = 0,
        void 0 !== A.count.geom_box && void 0 !== A.count.geom_pipe && void 0 !== A.count.geom_tube && void 0 !== A.count.mesh ? (this.statistics.renderableTotal += A.count.geom_box,
        this.statistics.renderableTotal += A.count.geom_pipe,
        this.statistics.renderableTotal += A.count.geom_tube,
        this.statistics.renderableTotal += A.count.mesh,
        this.statistics.renderableTotalForPool += 6 * A.count.geom_box,
        this.statistics.renderableTotalForPool += 3 * A.count.geom_pipe,
        this.statistics.renderableTotalForPool += A.count.geom_tube,
        this.statistics.renderableTotalForPool += A.count.mesh,
        this.statistics.numOfTriangles += 12 * A.count.geom_box,
        this.statistics.numOfTriangles += 32 * A.count.geom_pipe,
        this.statistics.numOfTriangles += 32 * A.count.geom_tube) : void 0 !== A.count.geom && void 0 !== A.count.mesh && (this.statistics.renderableTotal += A.count.geom,
        this.statistics.renderableTotal += A.count.mesh,
        this.statistics.numOfTriangles += 12 * A.count.geom,
        this.statistics.numOfElements = this.statistics.renderableTotal,
        this.statistics.renderableTotalForPool = this.statistics.renderableTotal),
        void 0 !== A.count.item && (this.statistics.numOfElements = A.count.item)),
        this.statistics.memoeryInfo = this._computeApproximateMemoerySize(A)
    }
    ,
    bC.prototype._computeApproximateMemoerySize = function(A) {
        var e = 0
          , t = 0
          , i = A.count.mesh_vertex || 0
          , o = A.count.mesh_face || 0
          , n = A.count.geom_box || 0
          , r = A.count.geom_pipe || 0
          , a = A.count.texture_pixels || 0;
        t += 8 * i,
        t += 3 * o,
        t += 0,
        t += 0,
        e += 6 * i,
        e += 3 * o,
        e += 0,
        e += 0;
        var s = 0;
        if (s += o,
        n > 0 && (s += 12 * n),
        r > 0 && (s += 124 * r),
        s += 0,
        vc.Instance) {
            n > 0 && (t += 192,
            t += 36,
            t += 24 * n,
            e += 144,
            e += 36,
            e += 18 * n),
            r > 0 && (t += 1040,
            t += 372,
            t += 24 * r,
            e += 780,
            e += 372,
            e += 18 * r)
        } else
            n > 0 && (t += 24 * n * 8,
            t += 12 * n * 3,
            e += 24 * n * 6,
            e += 12 * n * 3),
            r > 0 && (t += 130 * r * 8,
            t += 124 * r * 3,
            e += 130 * r * 6,
            e += 124 * r * 3);
        return vc.EnableTextureLoading && (t += 4 * a,
        e += 4 * a),
        t *= 4,
        e *= 4,
        t *= 1 / 1048576,
        e *= 1 / 1048576,
        {
            maxMemoerySize: t = Math.ceil(t),
            minMemoerySize: e = Math.ceil(e),
            triangleNumber: s,
            instanceEnabled: vc.Instance
        }
    }
    ,
    bC.prototype.getMemoeryInfo = function() {
        return this.statistics.memoeryInfo
    }
    ,
    bC.prototype.getStatistics = function() {
        return this.statistics
    }
    ,
    bC.prototype.getConfig = function() {
        return this.config
    }
    ,
    bC.prototype.getTransforms = function() {
        return this.transformInfos
    }
    ,
    bC.prototype.setRenderableCount = function(A) {
        this.statistics.renderableCount = A
    }
    ;
    var UC = function(A) {
        ef.call(this, A),
        this.descriptor = new Af(A.model),
        this.fileKeyFromModelKey = {}
    };
    (UC.prototype = Object.assign(UC.prototype, ef.prototype)).loadData = function() {
        var A = this
          , e = this.model;
        this.modelDataVersion = e.configLoader.modelDataVersion;
        e.getConfig();
        var t = e.configLoader.scenes
          , i = []
          , o = []
          , n = []
          , r = []
          , a = []
          , s = []
          , l = []
          , c = [];
        A.maxLoadTaskCount = 0,
        A.maxLoadTextureCount = 0;
        for (var h = function(h) {
            var d = t[h].scene
              , F = t[h].dataVersion
              , K = t[h].modelKey;
            if (!(d && d.components && d.geometries && d.materials && d.textures))
                return e.setEmptyScene(!0),
                Bh.error("scene is null,modelKey is ", K),
                e.dispatchEventEx({
                    type: Rc.ON_LOAD_EMPTY_SCENE,
                    modelKey: K
                }),
                {
                    v: void 0
                };
            if (p = d.components.length || 0,
            g = d.geometries.length || 0,
            u = d.materials.length || 0,
            f = d.textures.length || 0,
            m = [],
            C = [],
            y = [],
            v = [],
            I = [],
            E = [],
            B = d.textures,
            x = [],
            op(F, "2.0.0"))
                m = d.components,
                C = d.geometries,
                y = d.materials;
            else {
                for (S = 0; p > S; S += 1)
                    d.components[S].fileKey ? m.push(d.components[S].fileKey) : e.dispatchEventEx({
                        type: Tc.SCENE_NOT_CLOSE,
                        modelKey: K
                    });
                for (w = 0; g > w; w += 1)
                    d.geometries[w].fileKey ? C.push(d.geometries[w].fileKey) : e.dispatchEventEx({
                        type: Tc.SCENE_NOT_CLOSE,
                        modelKey: K
                    });
                for (M = 0; u > M; M += 1)
                    d.materials[M].fileKey ? y.push(d.materials[M].fileKey) : e.dispatchEventEx({
                        type: Tc.SCENE_NOT_CLOSE,
                        modelKey: K
                    })
            }
            if (d.trees.length > 0)
                for (b = 0; d.trees.length > b; b += 1)
                    "partition" === (U = d.trees[b]).type && x.push(U.fileKey);
            A.maxLoadTaskCount += p,
            A.maxLoadTaskCount += g,
            A.maxLoadTaskCount += u,
            vc.EnableTextureLoading && (A.maxLoadTextureCount += f),
            A.maxLoadTaskCount += 0,
            A.maxLoadTaskCount += 0,
            A.maxLoadTaskCount += 0,
            A.maxLoadTaskCount += x.length,
            m.forEach((function(e) {
                A.fileKeyFromModelKey[e] = K
            }
            )),
            C.forEach((function(e) {
                A.fileKeyFromModelKey[e] = K
            }
            )),
            y.forEach((function(e) {
                A.fileKeyFromModelKey[e] = K
            }
            )),
            v.forEach((function(e) {
                A.fileKeyFromModelKey[e] = K
            }
            )),
            I.forEach((function(e) {
                A.fileKeyFromModelKey[e] = K
            }
            )),
            E.forEach((function(e) {
                A.fileKeyFromModelKey[e] = K
            }
            )),
            B.forEach((function(e) {
                A.fileKeyFromModelKey[e] = K
            }
            )),
            x.forEach((function(e) {
                A.fileKeyFromModelKey[e] = K
            }
            )),
            i = i.concat(m),
            o = o.concat(C),
            n = n.concat(y),
            r = r.concat(v),
            a = a.concat(I),
            s = s.concat(E),
            l = l.concat(B),
            c = c.concat(x)
        }, d = 0; t.length > d; d += 1) {
            var p, g, u, f, m, C, y, v, I, E, B, x, S, w, M, b, U, F = h(d);
            if ("object" === lc(F))
                return F.v
        }
        if (A.progress.total += A.maxLoadTaskCount,
        1 > A.maxLoadTaskCount)
            return Bh.info("Nothing to load ", e.modelKey),
            void e.dispatchEventEx({
                type: Tc.SCENE_NOTHING_TO_LOAD,
                modelKey: e.modelKey
            });
        Bh.time("数据加载时间"),
        A._loadComponent(i),
        A._loadMaterial(n),
        vc.EnableTextureLoading && A.maxLoadTextureCount.length > 0 ? A._loadTextures(l) : A._onLoadTexture(),
        A._loadTextures(l),
        A._loadKDTree(c),
        A._loadClips(a),
        A._loadBones(r),
        A._loadNodes(s),
        A.offLine && A.loadAttribute(),
        A._loadGeo(o)
    }
    ,
    UC.prototype.loadSceneAndGeos = function(A) {
        this._loadGeo(A)
    }
    ,
    UC.prototype._loadGeometrie = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            var t = this.url
              , i = []
              , o = [];
            i.push(o);
            for (var n = 0, r = 0; A.length > r; r += 1)
                50 > n || (i.push(o = []),
                n = 0),
                n += 1,
                o.push(t.mpkUrl(A[r]));
            var a = this.model.getStorage();
            if (a)
                for (var s = function(t, o) {
                    var n = i[o];
                    a.getBatch(n, (function(A) {
                        for (var t = function(t) {
                            if (-1 === (o = n[t].indexOf("fileKey=")))
                                return Bh.error("url is not has fileKey"),
                                {
                                    v: void 0
                                };
                            var i = n[t].slice(o + 8);
                            if (A[n[t]])
                                if (!0 === A[n[t]].split) {
                                    var s = A[n[t]].list
                                      , l = new Uint8Array(A[n[t]].length);
                                    a.getBatch(s, (function(A) {
                                        for (var t = 0; s.length > t; t += 1)
                                            A[s[t]] ? l.set(new Uint8Array(A[s[t]]), 4e7 * t) : Bh.error("获取分割几何失败");
                                        e._parseGeometrie(l.buffer, i),
                                        Bh.debug("load geo from local"),
                                        e._onTaskFinished()
                                    }
                                    ), (function() {
                                        Bh.error("获取分割几何失败")
                                    }
                                    ))
                                } else
                                    e._parseGeometrie(A[n[t]], i),
                                    Bh.debug("load geo from local"),
                                    e._onTaskFinished();
                            else {
                                if (r = e.taskGeometrieManager,
                                -1 === n[t].indexOf("fileKey="))
                                    return Bh.error("url is not has fileKey"),
                                    {
                                        v: void 0
                                    };
                                r.addTask(i),
                                Bh.debug("load geo from net")
                            }
                        }, i = 0; n.length > i; i += 1) {
                            var o, r, s = t(i);
                            if ("object" === lc(s))
                                return s.v
                        }
                        e.taskGeometrieManager.processTasks(e.loadGeometrie.bind(e))
                    }
                    ), (function() {
                        for (var t = e.taskGeometrieManager, i = 0; A.length > i; i += 1)
                            t.addTask(A[i]);
                        t.processTasks(e.loadGeometrie.bind(e))
                    }
                    ))
                }, l = 0, c = i.length; c > l; l += 1)
                    s(0, l)
        } else {
            for (var h = this.taskGeometrieManager, d = 0; A.length > d; d += 1)
                h.addTask(A[d]);
            h.processTasks(e.loadGeometrie.bind(e))
        }
    }
    ,
    UC.prototype._loadKDTree = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            var t = this.url
              , i = []
              , o = [];
            i.push(o);
            for (var n = 0, r = 0; A.length > r; r += 1)
                50 > n || (i.push(o = []),
                n = 0),
                n += 1,
                o.push(t.mpkUrl(A[r]));
            var a = this.model.getStorage();
            if (a)
                for (var s = function(t, o) {
                    var n = i[o];
                    a.getBatch(n, (function(A) {
                        for (var t = 0; n.length > t; t += 1) {
                            var i = n[t].indexOf("fileKey=");
                            if (-1 === i)
                                return void Bh.error("url is not has fileKey");
                            var o = n[t].slice(i + 8);
                            if (A[n[t]])
                                e._parseKDTree(A[n[t]], o),
                                Bh.debug("load kdtree from local"),
                                e._onTaskFinished();
                            else {
                                var r = e.taskComponentManager;
                                if (-1 === n[t].indexOf("fileKey="))
                                    return void Bh.error("url is not has fileKey");
                                r.addTask(o),
                                r.processTasks(e.loadKDTree.bind(e)),
                                Bh.debug("load kdtree from net")
                            }
                        }
                    }
                    ), (function() {
                        for (var t = e.taskComponentManager, i = 0; A.length > i; i += 1)
                            t.addTask(A[i]);
                        t.processTasks(e.loadKDTree.bind(e))
                    }
                    ))
                }, l = 0, c = i.length; c > l; l += 1)
                    s(0, l)
        } else {
            for (var h = this.taskComponentManager, d = 0; A.length > d; d += 1)
                h.addTask(A[d]);
            h.processTasks(e.loadKDTree.bind(e))
        }
    }
    ,
    UC.prototype._loadBones = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.bonesUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = 0; i.length > t; t += 1) {
                    var o = i[t].indexOf("fileKey=");
                    if (-1 === o)
                        return void Bh.error("url is not has fileKey");
                    var n = i[t].slice(o + 8);
                    if (A[i[t]])
                        e._parseBones(A[i[t]], n),
                        Bh.debug("load Bones from local"),
                        e._onTaskFinished();
                    else {
                        if (-1 === i[t].indexOf("fileKey="))
                            return void Bh.error("url is not has fileKey");
                        e.loadBones(i[t].slice(o + 8), (function() {}
                        )),
                        Bh.debug("load Bones from net")
                    }
                }
            }
            ), (function() {
                for (var t = 0; A.length > t; t += 1)
                    e.loadBones(A[t], (function() {}
                    ))
            }
            ))
        } else {
            for (var r = this.taskComponentManager, a = 0; A.length > a; a += 1)
                r.addTask(A[a]);
            r.processTasks(e.loadBones.bind(e))
        }
    }
    ,
    UC.prototype._loadClips = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.clipsUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = 0; i.length > t; t += 1) {
                    var o = i[t].indexOf("fileKey=");
                    if (-1 === o)
                        return void Bh.error("url is not has fileKey");
                    var n = i[t].slice(o + 8);
                    if (A[i[t]])
                        e._parseClips(A[i[t]], n),
                        Bh.debug("load Clips from local"),
                        e._onTaskFinished();
                    else {
                        if (-1 === i[t].indexOf("fileKey="))
                            return void Bh.error("url is not has fileKey");
                        e.loadClips(i[t].slice(o + 8), (function() {}
                        )),
                        Bh.debug("load Clips from net")
                    }
                }
            }
            ), (function() {
                for (var t = 0; A.length > t; t += 1)
                    e.loadClips(A[t], (function() {}
                    ))
            }
            ))
        } else {
            for (var r = this.taskComponentManager, a = 0; A.length > a; a += 1)
                r.addTask(A[a]);
            r.processTasks(e.loadClips.bind(e))
        }
    }
    ,
    UC.prototype._loadNodes = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.nodesUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = 0; i.length > t; t += 1) {
                    var o = i[t].indexOf("fileKey=");
                    if (-1 === o)
                        return void Bh.error("url is not has fileKey");
                    var n = i[t].slice(o + 8);
                    if (A[i[t]])
                        e._parseNodes(A[i[t]], n),
                        Bh.debug("load Nodes from local"),
                        e._onTaskFinished();
                    else {
                        if (-1 === i[t].indexOf("fileKey="))
                            return void Bh.error("url is not has fileKey");
                        e.loadNodes(i[t].slice(o + 8), (function() {}
                        )),
                        Bh.debug("load Nodes from net")
                    }
                }
            }
            ), (function() {
                for (var t = 0; A.length > t; t += 1)
                    e.loadNodes(A[t], (function() {}
                    ))
            }
            ))
        } else {
            for (var r = this.taskComponentManager, a = 0; A.length > a; a += 1)
                r.addTask(A[a]);
            r.processTasks(e.loadNodes.bind(e))
        }
    }
    ,
    UC.prototype._loadComponent = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            var t = this.url
              , i = []
              , o = [];
            i.push(o);
            for (var n = 0, r = 0; A.length > r; r += 1)
                50 > n || (i.push(o = []),
                n = 0),
                n += 1,
                o.push(t.mpkUrl(A[r]));
            var a = this.model.getStorage();
            if (a)
                for (var s = function(t, o) {
                    var n = i[o];
                    a.getBatch(n, (function(A) {
                        for (var t = 0; n.length > t; t += 1) {
                            var i = n[t].indexOf("fileKey=");
                            if (-1 === i)
                                return void Bh.error("url is not has fileKey");
                            var o = n[t].slice(i + 8);
                            if (A[n[t]])
                                e._parseComponent(A[n[t]], o),
                                Bh.debug("load com from local"),
                                e._onTaskFinished();
                            else {
                                var r = e.taskComponentManager;
                                if (-1 === n[t].indexOf("fileKey="))
                                    return void Bh.error("url is not has fileKey");
                                r.addTask(o),
                                r.processTasks(e.loadComponent.bind(e)),
                                Bh.debug("load com from net")
                            }
                        }
                    }
                    ), (function() {
                        for (var t = e.taskComponentManager, i = 0; A.length > i; i += 1)
                            t.addTask(A[i]);
                        t.processTasks(e.loadComponent.bind(e))
                    }
                    ))
                }, l = 0, c = i.length; c > l; l += 1)
                    s(0, l)
        } else {
            for (var h = this.taskComponentManager, d = 0; A.length > d; d += 1)
                h.addTask(A[d]);
            h.processTasks(e.loadComponent.bind(e))
        }
    }
    ,
    UC.prototype._loadMaterial = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var t = this.url, i = [], o = 0; A.length > o; o += 1)
                i.push(t.mpkUrl(A[o]));
            var n = this.model.getStorage();
            n && n.getBatch(i, (function(A) {
                for (var t = 0; i.length > t; t += 1) {
                    var o = i[t].indexOf("fileKey=");
                    if (-1 === o)
                        return void Bh.error("url is not has fileKey");
                    var n = i[t].slice(o + 8);
                    if (A[i[t]])
                        e._parseMaterial(A[i[t]], n),
                        Bh.debug("load mat from local"),
                        e._onTaskFinished();
                    else {
                        var r = e.taskMaterialManager;
                        if (-1 === i[t].indexOf("fileKey="))
                            return void Bh.error("url is not has fileKey");
                        r.addTask(n),
                        r.processTasks(e.loadMaterial.bind(e)),
                        Bh.debug("load mat from net")
                    }
                }
            }
            ), (function() {
                for (var t = e.taskMaterialManager, i = 0; A.length > i; i += 1)
                    t.addTask(A[i]);
                t.processTasks(e.loadMaterial.bind(e))
            }
            ))
        } else {
            for (var r = this.taskMaterialManager, a = 0; A.length > a; a += 1)
                r.addTask(A[a]);
            r.processTasks(e.loadMaterial.bind(e))
        }
    }
    ,
    UC.prototype._loadTextures = function(A) {
        var e = this.model.materialManager.textures
          , t = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            for (var i = this.url, o = [], n = 0; A.length > n; n += 1)
                o.push(i.mpkUrl(A[n]));
            var r = this.model.getStorage();
            r && r.getBatch(o, (function(A) {
                for (var i = 0; o.length > i; i += 1)
                    if (A[o[i]]) {
                        var n = o[i].indexOf("fileKey=");
                        if (-1 === n)
                            return void Bh.error("url is not has fileKey");
                        var r = o[i].slice(n + 8)
                          , a = new d;
                        Bh.debug("load tex from local"),
                        e[r] = a;
                        var s = document.createElement("img");
                        a.wrapS = a.wrapT = 1e3,
                        s.onload = function(e) {
                            "string" != typeof A[o[i]] && window.URL.revokeObjectURL(s.src),
                            t.model.textureNeedsUpdate = !0,
                            t._onLoadTexture()
                        }
                        ,
                        s.onerror = function(A) {
                            t.model.dispatchEventEx({
                                type: Tc.LOAD_TEXTURE_ERROR
                            })
                        }
                        ,
                        s.src = "string" == typeof A[o[i]] ? A[o[i]] : window.URL.createObjectURL(A[o[i]]),
                        a.image = s,
                        a.needsUpdate = !0
                    } else {
                        var l = t.taskTexturesManager
                          , c = o[i].indexOf("fileKey=");
                        if (-1 === c)
                            return void Bh.error("url is not has fileKey");
                        l.addTask(o[i].slice(c + 8)),
                        l.processTasks(t.loadTextures.bind(t)),
                        Bh.debug("load tex from net")
                    }
            }
            ), (function() {
                for (var e = t.taskTexturesManager, i = 0; A.length > i; i += 1)
                    e.addTask(A[i]);
                e.processTasks(t.loadTextures.bind(t))
            }
            ))
        } else {
            for (var a = this.taskTexturesManager, s = 0; A.length > s; s += 1)
                a.addTask(A[s]);
            a.processTasks(t.loadTextures.bind(t))
        }
    }
    ,
    UC.prototype._parseGeometrie = function(A, e) {
        var t = this.fileKeyFromModelKey[e] || ""
          , i = new ku.GeometryReader(A,this.modelDataVersion[t])
          , o = this.descriptor;
        if (o) {
            for (var n = i.geoCount, r = 0; n > r; r += 1) {
                var a = i.geomMap[r];
                void 0 !== a.position && void 0 !== a.index && void 0 !== a.normal ? o.cacheReferencedMeshBufferData(t + a.geoId, a) : Bh.error("Error Geometry!")
            }
            i = null
        }
    }
    ,
    UC.prototype._parseMaterial = function(A, e) {
        var t = this.descriptor;
        if (t) {
            var i = new Du(A,this.modelDataVersion[this.fileKeyFromModelKey[e] || ""]);
            if (Array.isArray(i.materialMap)) {
                var o = i.materialCount;
                if (0 > o)
                    return;
                for (var n = 0; o > n; n += 1) {
                    var r = i.materialMap[n];
                    t.cacheReferencedMeshMaterialData(r.matId, r)
                }
            } else
                for (var a in i.materialMap)
                    t.cacheReferencedMeshMaterialData(a, i.materialMap[a]);
            i = null
        }
    }
    ,
    UC.prototype._parseComponent = function(A, e) {
        if (A) {
            var t = new Uu(A)
              , i = t.compArr.length
              , o = this.descriptor;
            if (o) {
                for (var n = this.fileKeyFromModelKey[e] || "", r = 0; i > r; r += 1) {
                    var a = t.compArr[r];
                    -1 !== a.geoId && (a.geoId = n + a.geoId,
                    -1 !== a.matId && (a.matId = n + a.matId),
                    this.model.submodel[n] = this.model.submodel[n] || [],
                    this.model.submodel[n].push(a.key)),
                    o.cacheReferencedMeshComponentData(a.key, a)
                }
                t = null
            }
        } else
            Bh.error("没有数据")
    }
    ,
    UC.prototype._parseKDTree = function(A, e) {
        var t = {};
        if (t = "string" == typeof A ? JSON.parse(A) : A,
        this.model.kdTreeNode = this.model.kdTreeNode || [],
        t) {
            var i = new Zu;
            i.init(t),
            this.model.kdTreeNode.push(i)
        }
    }
    ,
    UC.prototype._parseNodes = function(A, e) {
        var t = this.descriptor;
        if (t) {
            var i = {};
            i = "string" == typeof A ? JSON.parse(A) : A,
            Bh.debug("nodes", i),
            t.cacheReferencedMeshNodesData(i)
        }
    }
    ,
    UC.prototype._parseClips = function(A, e) {
        var t = this.descriptor;
        if (t) {
            var i = {};
            i = "string" == typeof A ? JSON.parse(A) : A,
            Bh.debug("clips", i),
            t.cacheReferencedMeshClipsData(i)
        }
    }
    ,
    UC.prototype._parseBones = function(A, e) {
        var t = new ku.BoneReader(A)
          , i = this.descriptor;
        if (i) {
            for (var o = t.boneCount, n = 0; o > n; n += 1) {
                var r = t.boneMap[n];
                Bh.debug("bones", r),
                i.cacheReferencedMeshBoneBufferData(r.geoId, r)
            }
            t = null
        }
    }
    ,
    UC.prototype._loadComponent = function(A) {
        var e = this;
        if (vc.getDataFromIndexedDB && !this.offLine) {
            var t = this.url
              , i = []
              , o = [];
            i.push(o);
            for (var n = 0, r = 0; A.length > r; r += 1)
                50 > n || (i.push(o = []),
                n = 0),
                n += 1,
                o.push(t.mpkUrl(A[r]));
            var a = this.model.getStorage();
            if (a)
                for (var s = function(t, o) {
                    var n = i[o];
                    a.getBatch(n, (function(A) {
                        for (var t = 0; n.length > t; t += 1) {
                            var i = n[t].indexOf("fileKey=");
                            if (-1 === i)
                                return void Bh.error("url is not has fileKey");
                            var o = n[t].slice(i + 8);
                            if (A[n[t]])
                                e._parseComponent(A[n[t]], o),
                                Bh.debug("load com from local"),
                                e._onTaskFinished();
                            else {
                                var r = e.taskComponentManager;
                                if (-1 === n[t].indexOf("fileKey="))
                                    return void Bh.error("url is not has fileKey");
                                r.addTask(o),
                                r.processTasks(e.loadComponent.bind(e)),
                                Bh.debug("load com from net")
                            }
                        }
                    }
                    ), (function() {
                        for (var t = e.taskComponentManager, i = 0; A.length > i; i += 1)
                            t.addTask(A[i]);
                        t.processTasks(e.loadComponent.bind(e))
                    }
                    ))
                }, l = 0, c = i.length; c > l; l += 1)
                    s(0, l)
        } else {
            for (var h = this.taskComponentManager, d = 0; A.length > d; d += 1)
                h.addTask(A[d]);
            h.processTasks(e.loadComponent.bind(e))
        }
    }
    ,
    UC.prototype.loadGeometrie = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.url
          , n = this.model
          , r = vc.GeoWorkerUrl;
        vc.UseGeoWorker ? (i.setResponseType("arraybuffer"),
        i.load(o.mpkUrl(A), (function(A) {
            var i = new Worker(r);
            i.onmessage = function(A) {
                var i = A.data;
                for (var o in i)
                    i.hasOwnProperty(o);
                e(),
                t._onTaskFinished()
            }
            ,
            i.postMessage({
                msg: A
            })
        }
        ))) : (i.setResponseType("arraybuffer"),
        i.setCacheViable(!this.offLine),
        i.load(o.mpkUrl(A), (function(i) {
            t._parseGeometrie(i, A, A),
            Bh.debug("geo load from online"),
            e(),
            t._onTaskFinished()
        }
        ), void 0, (function(A) {
            n.dispatchEventEx({
                type: Tc.LOAD_GEOMETRY_ERROR,
                modelKey: n.modelKey
            })
        }
        )))
    }
    ,
    UC.prototype.loadMaterial = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.url
          , n = this.model
          , r = vc.GeoWorkerUrl;
        vc.UseGeoWorker ? (i.setResponseType("arraybuffer"),
        i.load(o.mpkUrl(A), (function(A) {
            var i = new Worker(r);
            i.onmessage = function(A) {
                var i = A.data;
                for (var o in i)
                    i.hasOwnProperty(o);
                e(),
                t._onTaskFinished()
            }
            ,
            i.postMessage({
                msg: A
            })
        }
        ))) : (i.setResponseType(t.modelDataVersion[t.fileKeyFromModelKey[A] || ""] > 1 ? "json" : "arraybuffer"),
        i.setCacheViable(!this.offLine),
        i.load(o.mpkUrl(A), (function(i) {
            t._parseMaterial(i, A),
            Bh.debug("met  load from online"),
            e(),
            t._onTaskFinished()
        }
        ), void 0, (function(A) {
            n.dispatchEventEx({
                type: Tc.LOAD_MATERIAL_ERROR,
                modelKey: n.modelKey
            })
        }
        )))
    }
    ,
    UC.prototype.loadTextures = function(A, e) {
        var t = this.model.materialManager.textures
          , i = this
          , o = this.Textureloader
          , n = this.url
          , r = this.model
          , a = vc.GeoWorkerUrl;
        vc.UseGeoWorker ? o.load(n.mpkUrl(A), (function(A) {
            var t = new Worker(a);
            t.onmessage = function(A) {
                var t = A.data;
                for (var o in t)
                    t.hasOwnProperty(o);
                e(),
                i._onTaskFinished()
            }
            ,
            t.postMessage({
                msg: A
            })
        }
        )) : (o.setResponseType("blob"),
        o.setMimeType("text/plain"),
        o.setCacheViable(!this.offLine),
        o.load(n.textureUrl(A), (function(o) {
            Bh.debug("tex load from online");
            var n = new d;
            t[A] = n,
            n.wrapS = n.wrapT = 1e3;
            var a = document.createElement("img");
            a.onload = function(A) {
                "string" != typeof o && window.URL.revokeObjectURL(a.src),
                e(),
                i.model.textureNeedsUpdate = !0,
                i._onLoadTexture()
            }
            ,
            a.onerror = function(A) {
                r.dispatchEventEx({
                    type: Tc.LOAD_TEXTURE_ERROR,
                    modelKey: r.modelKey
                })
            }
            ,
            a.src = "string" == typeof o ? o : window.URL.createObjectURL(o),
            n.image = a,
            n.needsUpdate = !0
        }
        ), void 0, (function(A) {
            r.dispatchEventEx({
                type: Tc.LOAD_TEXTURE_ERROR,
                modelKey: r.modelKey
            })
        }
        )))
    }
    ,
    UC.prototype.loadComponent = function(A, e) {
        var t = this
          , i = this.jsonLoader
          , o = this.model
          , n = this.url
          , r = vc.GeoWorkerUrl;
        vc.UseGeoWorker ? (i.setResponseType("json"),
        i.load(n.mpkUrl(A), (function(A) {
            var i = new Worker(r);
            i.onmessage = function(A) {
                var i = A.data;
                for (var o in i)
                    i.hasOwnProperty(o);
                e(),
                t._onTaskFinished()
            }
            ,
            i.postMessage({
                msg: A
            })
        }
        ), (function(A) {}
        ))) : (i.setResponseType("json"),
        i.setCacheViable(!this.offLine),
        i.load(n.mpkUrl(A), (function(i) {
            t._parseComponent(i, A),
            Bh.debug("component load from online"),
            e(),
            t._onTaskFinished()
        }
        ), void 0, (function(A) {
            o.dispatchEventEx({
                type: Tc.LOAD_COMPONENT_ERROR,
                modelKey: o.modelKey
            })
        }
        )))
    }
    ,
    UC.prototype.loadKDTree = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.model
          , n = this.url
          , r = vc.GeoWorkerUrl;
        vc.UseGeoWorker ? (i.setResponseType("json"),
        i.load(n.mpkUrl(A), (function(A) {
            var i = new Worker(r);
            i.onmessage = function(A) {
                var i = A.data;
                for (var o in i)
                    i.hasOwnProperty(o);
                e(),
                t._onTaskFinished()
            }
            ,
            i.postMessage({
                msg: A
            })
        }
        ), (function(A) {}
        ))) : (i.setResponseType("json"),
        i.setCacheViable(!this.offLine),
        i.load(n.kdTreeUrl(A), (function(i) {
            t._parseKDTree(i, A),
            Bh.debug("kdtree load from online"),
            e(),
            t._onTaskFinished()
        }
        ), void 0, (function(A) {
            o.dispatchEventEx({
                type: Tc.LOAD_COMPONENT_ERROR,
                modelKey: o.modelKey
            })
        }
        )))
    }
    ,
    UC.prototype.loadBones = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.model
          , n = this.url
          , r = vc.GeoWorkerUrl;
        vc.UseGeoWorker ? (i.setResponseType("arraybuffer"),
        i.load(n.bonesUrl(A), (function(A) {
            var i = new Worker(r);
            i.onmessage = function(A) {
                var i = A.data;
                for (var o in i)
                    i.hasOwnProperty(o);
                e(),
                t._onTaskFinished()
            }
            ,
            i.postMessage({
                msg: A
            })
        }
        ), (function(A) {}
        ))) : (i.setResponseType("arraybuffer"),
        i.setCacheViable(!this.offLine),
        i.load(n.bonesUrl(A), (function(i) {
            t._parseBones(i, A),
            Bh.debug("bones load from online"),
            e(),
            t._onTaskFinished()
        }
        ), void 0, (function(A) {
            o.dispatchEventEx({
                type: Tc.LOAD_COMPONENT_ERROR,
                modelKey: o.modelKey
            })
        }
        )))
    }
    ,
    UC.prototype.loadClips = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.model
          , n = this.url
          , r = vc.GeoWorkerUrl;
        vc.UseGeoWorker ? (i.setResponseType("json"),
        i.load(n.mpkUrl(A), (function(A) {
            var i = new Worker(r);
            i.onmessage = function(A) {
                var i = A.data;
                for (var o in i)
                    i.hasOwnProperty(o);
                e(),
                t._onTaskFinished()
            }
            ,
            i.postMessage({
                msg: A
            })
        }
        ), (function(A) {}
        ))) : (i.setResponseType("json"),
        i.setCacheViable(!this.offLine),
        i.load(n.clipsUrl(A), (function(i) {
            t._parseClips(i, A),
            Bh.debug("Clips load from online"),
            e(),
            t._onTaskFinished()
        }
        ), void 0, (function(A) {
            o.dispatchEventEx({
                type: Tc.LOAD_COMPONENT_ERROR,
                modelKey: o.modelKey
            })
        }
        )))
    }
    ,
    UC.prototype.loadNodes = function(A, e) {
        var t = this
          , i = this.loader
          , o = this.model
          , n = this.url
          , r = vc.GeoWorkerUrl;
        vc.UseGeoWorker ? (i.setResponseType("json"),
        i.load(n.mpkUrl(A), (function(A) {
            var i = new Worker(r);
            i.onmessage = function(A) {
                var i = A.data;
                for (var o in i)
                    i.hasOwnProperty(o);
                e(),
                t._onTaskFinished()
            }
            ,
            i.postMessage({
                msg: A
            })
        }
        ), (function(A) {}
        ))) : (i.setResponseType("json"),
        i.setCacheViable(!this.offLine),
        i.load(n.nodesUrl(A), (function(i) {
            t._parseNodes(i, A),
            Bh.debug("Nodes load from online"),
            e(),
            t._onTaskFinished()
        }
        ), void 0, (function(A) {
            o.dispatchEventEx({
                type: Tc.LOAD_COMPONENT_ERROR,
                modelKey: o.modelKey
            })
        }
        )))
    }
    ;
    var FC = function(A, e) {
        tf.call(this, A),
        this.defaultManager = new Of(e,A),
        this.instancedManager = new Hf(A),
        this.loader = new UC(this)
    };
    FC.prototype = Object.create(Yf.prototype);
    var KC = function(A) {
        bC.call(this, A),
        this.modelDataVersion = {}
    };
    (KC.prototype = Object.assign(KC.prototype, bC.prototype)).load = function(A) {
        var e = this
          , t = this.model;
        this.config = {};
        var i = t.dataUrl
          , o = function(o) {
            var n = {};
            if ("string" == typeof o)
                try {
                    n = JSON.parse(o)
                } catch (A) {
                    return t.setEmptyScene(!0),
                    void t.dispatchEventEx({
                        type: Rc.ON_LOAD_INVALID_SCENE,
                        modelKey: t.modelKey
                    })
                }
            else
                n = o;
            if (n && "SUCCESS" === n.code) {
                if (vc.offLine)
                    e.model.getStorage().put(i.projectUrl(), n, e.model.modelKey, (function() {}
                    ), (function() {}
                    ));
                if (-1 === Number(n.data.status))
                    return void t.dispatchEventEx({
                        type: Tc.PARSEFAILE,
                        modelKey: t.modelKey
                    });
                if (3 > Number(n.data.status))
                    return void t.dispatchEventEx({
                        type: Tc.PARSING,
                        modelKey: t.modelKey
                    });
                e.dataVersion = n.data.profiles.geo || "1.0.0",
                i.apiVersion = n.data.profiles.api,
                e.model.dataVersion = e.dataVersion,
                e._parse(n.data),
                t.dispatchEventEx({
                    type: Rc.ON_LOAD_CONFIG_FINISH,
                    modelKey: t.modelKey
                }),
                A && A()
            } else
                Bh.log(t.modelKey, "config load error! ", n.message),
                t.dispatchEventEx({
                    type: Rc.ON_LOAD_ERROR,
                    modelKey: t.modelKey,
                    code: n.code,
                    message: n.message
                })
        };
        if (vc.offLine) {
            var n = this.model.getStorage();
            n && n.getBatch([i.projectUrl()], (function(A) {
                A[i.projectUrl()] ? o(A[i.projectUrl()]) : _d({
                    type: "GET",
                    url: i.projectUrl(),
                    headers: {
                        Authorization: t.accessToken
                    },
                    success: o,
                    error: function(A) {
                        t.dispatchEventEx({
                            type: Rc.ON_NETWORK_ERROR,
                            modelKey: t.modelKey,
                            data: A
                        })
                    }
                })
            }
            ), (function() {}
            ))
        } else {
            for (var r = [], a = function() {
                var A = t.modelKeys[s];
                r.push(new Promise((function(e, o) {
                    _d({
                        type: "GET",
                        url: i.projectUrl(A),
                        headers: {
                            Authorization: t.accessToken
                        },
                        success: function(t) {
                            e({
                                modelKey: A,
                                data: t
                            })
                        },
                        error: function(e, i) {
                            switch (e) {
                            case 401:
                                t.dispatchEventEx({
                                    type: Rc.ACCOUNT_NO_EXIST,
                                    modelKey: A,
                                    data: i
                                });
                                break;
                            case 403:
                                t.dispatchEventEx({
                                    type: Rc.NO_PERMISSION,
                                    modelKey: A,
                                    data: i
                                });
                                break;
                            default:
                                t.dispatchEventEx({
                                    type: Rc.ON_NETWORK_ERROR,
                                    modelKey: A,
                                    data: e
                                })
                            }
                            o(e, i)
                        }
                    })
                }
                )))
            }, s = 0; t.modelKeys.length > s; s += 1)
                a();
            Promise.all(r).then((function(o) {
                for (var n = [], r = 0, a = 0; o.length > a; a += 1)
                    if (o[a]) {
                        var s = o[a].data
                          , l = o[a].modelKey
                          , c = {};
                        if ("string" == typeof s)
                            try {
                                c = JSON.parse(s)
                            } catch (A) {
                                return void t.dispatchEventEx({
                                    type: Rc.ON_LOAD_INVALID_SCENE,
                                    modelKey: l
                                })
                            }
                        else
                            c = s;
                        if (c && "SUCCESS" === c.code) {
                            if (vc.offLine)
                                e.model.getStorage().put(i.projectUrl(), c, e.model.modelKey, (function() {}
                                ), (function() {}
                                ));
                            var h = c.data.scene || null
                              , d = c.data.profiles.geo || "1.0.0";
                            if (i.apiVersion = c.data.profiles.api,
                            n.push({
                                scene: h,
                                modelKey: c.data.key,
                                dataVersion: d
                            }),
                            e.modelDataVersion[c.data.key] = d,
                            r += c.data.componentCount,
                            -1 === Number(c.data.status))
                                return void t.dispatchEventEx({
                                    type: Tc.PARSEFAILE,
                                    modelKey: l
                                });
                            if (3 > Number(c.data.status))
                                return void t.dispatchEventEx({
                                    type: Tc.PARSING,
                                    modelKey: l
                                });
                            e.dataVersion = c.data.profiles.geo || "1.0.0",
                            e.sceneReader = e.sceneReader || [],
                            t.setConfig(c.data),
                            e._parse(c.data)
                        } else
                            Bh.log(t.modelKey, "config load error! ", c.message),
                            t.dispatchEventEx({
                                type: Rc.ON_LOAD_ERROR,
                                modelKey: l,
                                code: c.code,
                                message: c.message
                            })
                    }
                var p = new FC(t,!1);
                t._handler = p,
                e.model.componentCount = r,
                t.dispatchEventEx({
                    type: Rc.ON_LOAD_CONFIG_FINISH,
                    modelKey: t.modelKey
                }),
                e.scenes = n,
                A && A()
            }
            )).catch((function(A) {
                console.log(A)
            }
            ))
        }
    }
    ,
    KC.prototype._parse = function(A) {
        this.config = A,
        A.lengthUnit && (this.model.originalLengthUnit = A.lengthUnit),
        vc.MergeComponent = !0,
        this._toStatistics(A),
        this._setTransformInfos(A),
        this._chooseRendering(A)
    }
    ;
    var QC = {};
    QC.brdf_vs = ["varying vec2 vUV;", "void main() {", "    vUV = uv;", "    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);", "}"].join("\n"),
    QC.brdf_fs = ["varying vec2 vUV;", "uniform sampler2D HammersleyTable;", "const float PI = 3.14159265358979;", "float GGX(float NdotV, float alpha)", "{", "    float alpha2 = pow(alpha, 2.0);", "    return 2.0 * NdotV / (NdotV + sqrt(alpha2 + (1.0 - alpha2) * NdotV * NdotV));", "}", "float G_Smith(float NdotV, float NdotL, float roughness)", "{", "    float alpha = pow(roughness, 2.0);", "    return GGX(NdotV, alpha) * GGX(NdotL, alpha);", "}", "vec3 ImportanceSampleGGX(vec2 Xi, vec3 N, float roughness)", "{", "    float a = roughness * roughness;", "    float Phi = 2.0 * PI * Xi.x; ", "    float CosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a * a - 1.0) * Xi.y)); ", "    float SinTheta = sqrt(1.0 - CosTheta * CosTheta);", "    vec3 H;", "    H.x = SinTheta * cos(Phi); ", "    H.y = SinTheta * sin(Phi); ", "    H.z = CosTheta;", "    vec3 UpVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); ", "    vec3 TangentX = normalize(cross(UpVector, N)); ", "    vec3 TangentY = cross(N, TangentX);", "    return normalize(TangentX * H.x + TangentY * H.y + N * H.z);", "}", "vec2 IntegrateBRDF(float NdotV, float roughness)", "{", "    vec3 N = vec3(0.0, 0.0, 1.0);", "    vec3 V = vec3(sqrt(1.0 - NdotV * NdotV), 0.0, NdotV);", "    vec2 result = vec2(0.0, 0.0);", "    const int NumSamples = 1024;", "    for (int i = 0; i < NumSamples; i++)", "    {", "        float u = float(i) / float(NumSamples);", "        vec2 Xi = vec2(u, texture2D(HammersleyTable, vec2(u)).r);", "        vec3 H = ImportanceSampleGGX(Xi, N, roughness);", "        vec3 L = 2.0 * dot(V, H) * H - V;", "        float NdotL = saturate(L.z);", "        float NdotH = saturate(H.z);", "        float VdotH = saturate(dot(V, H));", "        float NdotV = saturate(dot(N, V));", "        if (NdotL > 0.0)", "        {", "            float G = G_Smith(NdotV, NdotL, roughness);", "            float G_Vis = G * VdotH / (NdotH * NdotV); ", "            float F = pow(1.0 - VdotH, 5.0);", "            result.x += (1.0 - F) * G_Vis;", "            result.y += F * G_Vis;", "        }", "    }", "    return result / float(NumSamples);", "}", "void main()", "{", "    vec2 brdf = IntegrateBRDF(vUV.x, vUV.y);", "    gl_FragColor = vec4(brdf, 0.0, 1.0);", "}"].join("\n"),
    QC.BRDFMap = function(A, e) {
        this.texture = null,
        this.resolution = e || 512,
        this.brdfMaterial = new Pe({
            vertexShader: QC.brdf_vs,
            fragmentShader: QC.brdf_fs,
            uniforms: {
                HammersleyTable: {
                    value: A
                }
            },
            lights: !1
        }),
        this.quad = new Ue(new et(window.innerWidth,window.innerHeight),this.brdfMaterial),
        this.quad.position.z = -100
    }
    ,
    QC.BRDFMap.prototype.constructor = QC.BRDFMap,
    QC.BRDFMap.prototype.generateMap = function(A) {
        var e = new Y;
        e.add(this.quad);
        var t = new Ka(window.innerWidth / -2,window.innerWidth / 2,window.innerHeight / 2,window.innerHeight / -2,-1e4,1e4);
        t.position.z = 100;
        var i = new g(this.resolution,this.resolution,{
            minFilter: 1006,
            magFilter: 1003,
            format: 1022
        });
        A.setRenderTarget(i),
        A.clear(),
        A.render(e, t),
        this.texture = i.texture
    }
    ;
    var RC = function() {
        this.instanceMaterials = {},
        this.materials = {},
        this.textures = {},
        this.lightmaps = {},
        this.ensureImagePowerOfTwo = !1
    };
    RC.prototype.changeAllMaterials = function(A, e) {}
    ,
    RC.prototype.destroy = function() {
        this.instanceMaterials = {},
        this.materials = {},
        this.textures = {},
        this.lightmaps = {}
    }
    ,
    RC.prototype.disposeInstanceMaterials = function(A) {
        var e = this.instanceMaterials;
        for (var t in e) {
            var i = e[t];
            if (Array.isArray(i))
                for (var o = 0, n = i.length; n > o; o += 1)
                    i[o].dispose();
            else
                i.dispose()
        }
    }
    ,
    RC.prototype.disposeMaterials = function(A) {
        for (var e in this.materials)
            this.materials[e].dispose();
        this.disposeInstanceMaterials(A)
    }
    ,
    RC.prototype.updateMaterialsValue = function(A, e, t) {
        var i = this.materials
          , o = this.instanceMaterials
          , n = null;
        for (var r in i)
            for (var r in (n = i[r]) && n[e] && (n[e] = t,
            "function" == typeof n.refreshUniforms && n.refreshUniforms(),
            n.needsUpdate = !0),
            o)
                if (n = o[r])
                    if (Array.isArray(n))
                        for (var a = 0, s = n.length; s > a; a += 1)
                            n[a][e] && (n[a][e] = t,
                            "function" == typeof n[a].refreshUniforms && n[a].refreshUniforms(),
                            n[a].needsUpdate = !0);
                    else
                        n[e] && (n[e] = t,
                        "function" == typeof n.refreshUniforms && n.refreshUniforms(),
                        n.needsUpdate = !0)
    }
    ,
    RC.prototype.enableColorWithoutLight = function(A) {
        var e = this.materials
          , t = this.instanceMaterials
          , i = null;
        if (A) {
            for (var o in e)
                (i = e[o]) && (i.defines.USE_COLORWITHOUTLIGHT = "",
                i.needsUpdate = !0);
            for (var o in t)
                if (i = t[o])
                    if (i instanceof Array)
                        for (var n = 0, r = i.length; r > n; n += 1)
                            i[n].defines.USE_COLORWITHOUTLIGHT = "",
                            i[n].needsUpdate = !0;
                    else
                        i.defines.USE_COLORWITHOUTLIGHT = "",
                        i.needsUpdate = !0
        } else {
            for (var o in e)
                (i = e[o]) && (delete i.defines.USE_COLORWITHOUTLIGHT,
                i.needsUpdate = !0);
            for (var o in t)
                if (i = t[o])
                    if (i instanceof Array)
                        for (n = 0,
                        r = i.length; r > n; n += 1)
                            delete i[n].defines.USE_COLORWITHOUTLIGHT,
                            i[n].needsUpdate = !0;
                    else
                        delete i.defines.USE_COLORWITHOUTLIGHT,
                        i.needsUpdate = !0
        }
    }
    ,
    RC.prototype._updateTextureMapping = function(A) {
        var e = vc.EnableTextureMapping
          , t = this.ensureImagePowerOfTwo;
        function i(A, e) {
            if (e) {
                if (void 0 === e.length)
                    A.map = e;
                else
                    for (var i = 0; e.length > i; i += 1)
                        t || (e[i].image = Kd.ensurePowerOfTwo(e[i].image)),
                        "map" === e[i].texturetype ? A.map = e[i] : "bumpMap" === e[i].texturetype ? e[i].depth && (A.bumpScale = e[i].depth) : "specularMap" === e[i].texturetype ? A.specularMap = e[i] : "alphaMap" === e[i].texturetype ? (A.alphaMap = e[i],
                        A.alphaTest = .01,
                        A.map = e[i],
                        A.transparent = !0) : "emissiveMap" === e[i].texturetype ? A.emissiveMap = e[i] : "environmentMap" === e[i].texturetype ? A.envMap = e[i] : "normalMap" === e[i].texturetype ? (A.normalMap = e[i],
                        e[i].depth && A.normalScale.set(e[i].depth, e[i].depth)) : Bh.warn("This map type is not supported yet:", e[i].texturetype);
                vc.IBL && A.refreshUniforms(),
                A.needsUpdate = !0
            } else
                A.textureColor && A.color.setStyle(A.textureColor),
                A.needsUpdate = !0
        }
        if (this.lastTextureEnabled !== e) {
            var o = this.textures
              , n = this.materials;
            if (A)
                var r = A.manager.getMaterialOverrideSet()
                  , a = r ? r.materialsByName : null
                  , s = r ? r.textures : null;
            var l = this.instanceMaterials
              , c = null
              , h = null;
            if (e) {
                for (c in n) {
                    if (h = n[c])
                        i(h, d = o[c])
                }
                for (c in l)
                    if (h = l[c]) {
                        var d = o[c];
                        if (s && s[c] && (d = s[c]),
                        Array.isArray(h))
                            for (var p = 0, g = h.length; g > p; p += 1)
                                i(h[p], d);
                        else
                            i(h, d)
                    }
                for (c in a) {
                    if (h = a[c])
                        i(h, d = s[c.split("#")[0]])
                }
                this.ensureImagePowerOfTwo = !0
            } else {
                if (!r)
                    for (c in n)
                        (h = n[c]) && (h.map = null,
                        h.needsUpdate = !0);
                for (c in l)
                    if (h = l[c])
                        if (Array.isArray(h))
                            for (p = 0,
                            g = h.length; g > p; p += 1)
                                h[p].pureColor && (h[p].color.setStyle(h[p].pureColor),
                                h[p].map = null,
                                h[p].needsUpdate = !0),
                                r || (h[p].map = null,
                                h[p].needsUpdate = !0);
                        else
                            h.pureColor && (h.color.setStyle(h.pureColor),
                            h.map = null,
                            h.needsUpdate = !0),
                            r || (h.map = null,
                            h.needsUpdate = !0);
                for (c in a)
                    (h = a[c]) && (h.map = null,
                    h.needsUpdate = !0,
                    h.pureColor && h.color.setStyle(h.pureColor))
            }
            this.lastTextureEnabled = e
        }
    }
    ,
    RC.prototype.updateMaterials = function(A) {
        var e = this.materials;
        for (var t in e)
            if (e.hasOwnProperty(t)) {
                var i = e[t];
                i.IBLMaps = A.manager.scene.IBLMaps,
                i.refreshUniforms()
            }
    }
    ,
    RC.prototype._updateIBL = function(A) {
        var e = A.manager.scene;
        if (vc.IBL && null !== e.iblProbe && e.iblProbe.isComputed) {
            this.materialManager.updateMaterials(A);
            var t = e.IBLcfg
              , i = t[Object.keys(t)[e.IBLIndex]];
            for (var o in i)
                this.materialManager.updateMaterialsValue(A, o, i[o])
        }
    }
    ,
    RC.prototype.changeAllMaterials = function(A, e) {
        var t = this.materials;
        for (var i in t)
            if (t.hasOwnProperty(i)) {
                var o = Kd.getMaterialParameters(t[i])
                  , n = null;
                e ? (delete o.textureColor,
                delete o.pureColor,
                delete o.imageFade,
                o.lights = !0,
                (n = new QC.IBLMaterial(o)).type = "IBL",
                n.refreshUniforms()) : (delete o.iblProbe,
                (n = Kd.createStandardMaterial(o)).roughness = o.originRoughness,
                n.metalness = o.originMetalness,
                n.refreshUniforms()),
                n.name = i,
                t[i] = n,
                o = null
            }
    }
    ,
    RC.prototype.switchNewStyleMaterial = function(A, e) {
        var t = this.materials;
        for (var i in t)
            if (t.hasOwnProperty(i)) {
                var o = Kd.getMaterialParameters(t[i])
                  , n = null;
                (n = e ? Kd.createNewStyleMaterial(o) : Kd.createStandardMaterial(o)).name = i,
                t[i] = n,
                o = null
            }
    }
    ,
    RC.prototype.getInstanceMaterialById = function(A, e) {
        if (this.instanceMaterials[A])
            return this.instanceMaterials[A];
        var t = Kd.getMaterialParameters(e.manager.getOverrideMaterialByName(A) || this.materials[A])
          , i = t.transparent
          , o = Kd.createInstanceMaterial(t, !0);
        o.transparent = !1;
        var n = Kd.createInstanceMaterial(t, !0);
        return n.transparent = !0,
        vc.TranslucentDepthDisabled && (n.depthWrite = !1),
        i === o.transparent ? (this.instanceMaterials[A] = [o, n],
        n.defines.INSTANCE_STATE_SECONDARY = "") : (this.instanceMaterials[A] = [n, o],
        o.defines.INSTANCE_STATE_SECONDARY = ""),
        this.instanceMaterials[A]
    }
    ,
    RC.prototype.getMaterialById = function(A) {
        return this.materials[A]
    }
    ;
    var TC = function(A, e, t, i) {
        var o = this;
        this.manager = A,
        this.modelKey = e.modelKey,
        this.projectKey = e.dbName,
        this.offLine = e.offLine,
        this.accessToken = e.token || "",
        this.shareKey = e.share || "",
        this.dataVersion = null,
        this.debut = i,
        this.dataUrl = new eC(e),
        this.submodel = {},
        this.loadingManager = new jr,
        this.loadingManager.model = this,
        this.fileLoader = new bu(this.loadingManager),
        this.configLoader = new bC(this),
        this.firstOctreeTransform = !0,
        this.numOfElements = 0,
        this.numOfTriangles = 0,
        this.singleStepMode = !1,
        this.sizeOfNextStep = 0,
        this.needUpdate = !1,
        this.boundingBoxWorld = null,
        this.rotation = new f,
        this.position = new y,
        this.scale = new y(1,1,1),
        this.transformMatrix = new M,
        this.selectedMaterial = this.manager.sceneState.selectionMaterial,
        this.materialManager = new RC,
        this.wireframeManager = new au,
        this.axisNetManager = void 0,
        this.floorManager = void 0,
        this.containsCamera = !1,
        this.loaded = !1,
        this.visible = !0,
        this.emptyScene = !1,
        this.cameraList = [],
        this.index = 0,
        this.modelConfig = null,
        this.kdTreeNode = null,
        this.parseCfgFinish = void 0,
        this.progressPercentage = {
            load: .4,
            collect: .5,
            merge: .1
        },
        this.progressFrequency = 10,
        this._encodedDatabagId = this.modelKey,
        this.groupName = gp.MODEL + "|" + this.modelKey,
        this.group = this.manager.scene.getOrCreateGroup(this.groupName, {
            pickableType: Qc.Geometry,
            globalSpace: !0
        }),
        this._handler = null,
        this.lightmap = !1,
        this.lightmapNum = 0,
        this.enableLightmap = !1,
        this.lightmapIntensity = vc.LightmapIntensity,
        this.minDistanceObjects = {},
        this.prioritizedNodeCount = 0,
        this.plugins = [],
        this.merged = !1,
        e.modelKeys && (this.modelGroup = !0,
        this.groupKey = e.modelKey,
        this.modelKeys = e.modelKeys,
        this.progressFrequency = 100,
        this.merged = !0,
        this.configLoader = new KC(this)),
        this.subModel = {},
        mh.isSupportIndexedDB() ? (this.storage = new AC({
            store: this.modelKey,
            version: 1,
            dbName: this.modelKey
        }),
        this.storage.addEventListener(Rc.ON_DATABASE_OPEN, (function(A) {
            t && t(o, !0)
        }
        )),
        this.storage.addEventListener(Rc.ON_DATABASE_EEEOR, (function(A) {
            o.storage = void 0,
            t && t(o, !1)
        }
        ))) : (o.storage = void 0,
        t && t(this, !1))
    };
    Object.assign(TC.prototype, Ld.prototype),
    TC.prototype.getStorage = function() {
        return this.storage
    }
    ,
    TC.prototype.destroy = function() {
        this.selectedMaterial = null,
        this.cameraList = null,
        this.occlusionCamera && (this.occlusionCamera = null),
        this._removeMeshNodeGroup(),
        this.removeAllFromOctantMap(),
        this._handler && (this._handler.destroy(),
        this._handler = null),
        this.wireframeManager.destroy(),
        this.wireframeManager = null,
        this.materialManager.disposeMaterials(this),
        this.materialManager.destroy(),
        this.materialManager = null,
        this.manager = null,
        this.plugins = null,
        this.dataUrl = null,
        this.fileLoader = null,
        this.configLoader.destroy(),
        this.configLoader = null
    }
    ,
    TC.prototype._getWireframeGroupName = function() {
        return gp.WIREFRAME + "|" + this.modelKey
    }
    ,
    TC.prototype.load = function(A) {
        var e = this;
        this.configLoader.load((function() {
            e.parseCfgFinish && e.parseCfgFinish(),
            e.manager.updateScene(),
            e._getHandler().load(A)
        }
        ))
    }
    ,
    TC.prototype.setCrossOrigin = function(A) {
        this.fileLoader.setCrossOrigin(A)
    }
    ,
    TC.prototype.prepare = function(A, e) {
        var t = this._getHandler();
        t && t.prepare(A, e)
    }
    ,
    TC.prototype.dispatchEventEx = function(A) {
        A.modelKey = this.modelKey,
        this.manager.dispatchEvent(A)
    }
    ,
    TC.prototype.setLoaded = function(A) {
        this.loaded = A
    }
    ,
    TC.prototype.isLoaded = function() {
        return this.loaded
    }
    ,
    TC.prototype.getTransformMatrix = function() {
        return this.transformMatrix
    }
    ,
    TC.prototype.isEmptyScene = function() {
        return this.emptyScene
    }
    ,
    TC.prototype.setEmptyScene = function(A) {
        this.emptyScene = A
    }
    ,
    TC.prototype.isLayerData = function() {
        return !(!this._handler || "layer" !== this._handler.tag)
    }
    ,
    TC.prototype.setConfig = function(A) {
        this.configLoader.config = A
    }
    ,
    TC.prototype.getConfig = function() {
        return this.configLoader.config
    }
    ,
    TC.prototype.isVisible = function() {
        return this.manager.filter._isModelVisible(this.modelKey)
    }
    ,
    TC.prototype.setVisible = function(A) {
        A ? this.manager.filter.showModelByIds([this.modelKey]) : this.manager.filter.hideModelByIds([this.modelKey])
    }
    ,
    TC.prototype.calculateCameraModelRelation = function(A) {
        this.containsCamera = this.getModelDescriptor().isOctreeOuter(A)
    }
    ,
    TC.prototype.addCamera = function(A) {
        this.cameraList.push(A)
    }
    ,
    TC.prototype.getCameraNameList = function() {
        for (var A = [], e = this.cameraList.length - 1; e >= 0; e -= 1)
            A.push(this.cameraList[e].name);
        return A
    }
    ,
    TC.prototype.getCamera = function(A) {
        for (var e = this.cameraList.length - 1; e >= 0; e -= 1)
            if (this.cameraList[e].name === A)
                return this.cameraList[e];
        return null
    }
    ,
    TC.prototype.updateOctreeNode = function(A) {
        if (A || this.firstOctreeTransform) {
            this.firstOctreeTransform && (this.firstOctreeTransform = !1);
            var e = this.manager.scene.getMatrixGlobal();
            this.getModelDescriptor().updateOctreeNode(e)
        }
    }
    ,
    TC.prototype.isDataReady = function() {
        var A = this._handler;
        return !!A && A.isDataReady()
    }
    ,
    TC.prototype.updateMeshNodes = function(A) {
        var e = this._getHandler();
        if (e) {
            if ("layer" === e.tag && !e.layerDataLoaded)
                return;
            e.updateNodes()
        }
    }
    ,
    TC.prototype._getHandler = function(A) {
        return this._handler
    }
    ,
    TC.prototype.getMeshesByUserIds = function(A) {
        if (A) {
            var e = this._getHandler();
            return e ? e.getMeshesByUserIds(A) : void 0
        }
    }
    ,
    TC.prototype.applyFilter = function() {
        if (!1 !== this.manager.filter._isModelVisible(this.modelKey)) {
            for (var A = 0, e = this.plugins.length; e > A; A += 1)
                this.plugins[A].applyFilter();
            this.group.visible = !0;
            var t = this._getHandler();
            t && t.applyFilter()
        } else
            this.group.visible = !1
    }
    ,
    TC.prototype.applySelection = function() {
        for (var A = 0, e = this.plugins.length; e > A; A += 1)
            this.plugins[A].applySelection();
        var t = this._getHandler();
        t && t.applySelection()
    }
    ,
    TC.prototype.clearSelection = function() {
        for (var A = 0, e = this.plugins.length; e > A; A += 1)
            this.plugins[A].clearSelection();
        var t = this._getHandler();
        t && t.clearSelection()
    }
    ,
    TC.prototype.applyHover = function() {
        for (var A = 0, e = this.plugins.length; e > A; A += 1)
            this.plugins[A].applyHover();
        var t = this._getHandler();
        t && t.applyHover()
    }
    ,
    TC.prototype.clearHover = function() {
        for (var A = 0, e = this.plugins.length; e > A; A += 1)
            this.plugins[A].clearHover();
        var t = this._getHandler();
        t && t.clearHover()
    }
    ,
    TC.prototype.applyBlink = function() {
        var A = this._getHandler();
        A && A.applyBlink()
    }
    ,
    TC.prototype.clearBlink = function() {
        var A = this._getHandler();
        A && A.clearBlink()
    }
    ,
    TC.prototype.applyReplacement = function() {
        var A = this._getHandler();
        A && A.applyReplacement()
    }
    ,
    TC.prototype._removeMeshNodeGroup = function() {
        this._removeNodeGroup(gp.GEOMETRY),
        this._removeNodeGroup(gp.INSTANCEGEOMETRY),
        this._removeNodeGroup(gp.WIREFRAME),
        this._removeNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY),
        this._removeNodeGroup(gp.AXISNET),
        this._removeSceneGroup(),
        this.group = null
    }
    ,
    TC.prototype._getNodeGroup = function(A, e) {
        for (var t = this.group.children, i = 0, o = t.length; o > i; i += 1)
            if (t[i].name === A)
                return t[i];
        var n = new ep(A,e);
        return this.group.add(n),
        n.globalSpace && (n.matrixAutoUpdate = !1,
        n.updateMatrixWorld(!0)),
        n
    }
    ,
    TC.prototype._removeNodeGroup = function(A) {
        this.group.removeByName(A)
    }
    ,
    TC.prototype._hasNodeGroup = function(A) {
        return this.group.hasChild(A)
    }
    ,
    TC.prototype._removeSceneGroup = function() {
        this.manager.scene.removeGroupByName(this.groupName),
        this.manager.scene.removeGroupByName(this._getWireframeGroupName())
    }
    ,
    TC.prototype.removeAllFromOctantMap = function() {
        this.manager.removeAllFromOctantMap(this.modelKey)
    }
    ,
    TC.prototype.clearMeshFromOctantMap = function() {
        this.manager.removeMeshFromOctantMap(this.modelKey)
    }
    ,
    TC.prototype.getDatabagId = function() {
        return this.modelKey
    }
    ,
    TC.prototype.getEncodedDatabagId = function() {
        return this.modelKey
    }
    ,
    TC.prototype.getMaterialManager = function() {
        return this.materialManager
    }
    ,
    TC.prototype.clearWireframeElementCount = function() {
        this.wireframeElementCount = void 0
    }
    ,
    TC.prototype.getWireframeElementCount = function() {
        if (void 0 !== this.wireframeElementCount)
            return this.wireframeElementCount;
        var A = this.getModelDescriptor().getAllNodeInfos()
          , e = this.manager.filter
          , t = 0;
        for (var i in A) {
            var o = A[i];
            e._hasRenderWithBoardlineFilter() && !e._isRenderWithBoardline(o[0]) || (t += o.length)
        }
        return this.wireframeElementCount = t,
        t
    }
    ,
    TC.prototype.isActivateWireframe = function() {
        return this.manager.isDrawingBoardlineEnabled()
    }
    ,
    TC.prototype.isOnlyWireframe = function() {
        return this.manager.isOnlyWireframe()
    }
    ,
    TC.prototype.getLoadedUserIdsObject = function() {
        return this._handler && this._handler.getLoadedUserIdsObject ? this._handler.getLoadedUserIdsObject() : null
    }
    ,
    TC.prototype.clearNodeGroup = function() {
        var A = this._getNodeGroup(gp.GEOMETRY, {
            globalSpace: !0
        });
        A.clear(),
        (A = this._getNodeGroup(gp.WIREFRAME, {
            globalSpace: !0
        })).clear(),
        (A = this._getNodeGroup(gp.INSTANCEGEOMETRY, {
            globalSpace: !0
        })).clear(),
        (A = this._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
            globalSpace: !0
        })).clear()
    }
    ,
    TC.prototype.getWireframeMaterial = function() {
        return this.wireframeManager.wireframeMaterial
    }
    ,
    TC.prototype.getInstanceWireframeMaterial = function() {
        return this.wireframeManager.instanceWireframeMaterial
    }
    ,
    TC.prototype.getMaterialByMaterialId = function(A) {
        return this.materialManager.materials[A]
    }
    ,
    TC.prototype.adjustProgressPercentage = function(A, e, t) {
        this.progressPercentage.load = A,
        this.progressPercentage.collect = e,
        this.progressPercentage.merge = t
    }
    ,
    TC.prototype.setReplacedUserIdMap = function(A) {
        this.replacedUserIdMap = uh.isOwnEmptyObject(A) ? null : A
    }
    ,
    TC.prototype.hasReplacedUserId = function() {
        return !uh.isEmptyObject(this.replacedUserIdMap)
    }
    ,
    TC.prototype.isReplacedUserId = function(A) {
        return this.replacedUserIdMap && this.replacedUserIdMap[A]
    }
    ,
    TC.prototype.registerPlugin = function(A) {
        this.plugins.push(A)
    }
    ,
    TC.prototype.disposeBufferAfterVbo = function() {
        var A = this._getHandler();
        A && A.disposeBufferAfterVbo()
    }
    ,
    TC.prototype.isHiddenUserId = function(A) {
        var e = this._getHandler();
        return !!e && e.isHiddenNode(A)
    }
    ,
    TC.prototype.hasHiddenUserId = function() {
        return this.manager.hasHiddenUserId()
    }
    ,
    TC.prototype.isHiddenSourceObjectUserId = function(A) {
        return this.manager.isHiddenSourceObjectUserId(A)
    }
    ,
    TC.prototype.hasHiddenSourceObjectUserId = function() {
        return this.manager.hasHiddenSourceObjectUserId()
    }
    ,
    TC.prototype.getModelDescriptor = function() {
        return this._handler.loader.getDescriptor()
    }
    ,
    TC.prototype.getLoader = function() {
        return this._handler.loader
    }
    ,
    TC.prototype.getConfig = function() {
        return this.configLoader.getConfig()
    }
    ,
    TC.prototype.getTransforms = function() {
        return this.configLoader.getTransforms()
    }
    ,
    TC.prototype.getStatistics = function() {
        return this.configLoader.getStatistics()
    }
    ,
    TC.prototype.setRenderableCount = function(A) {
        this.configLoader.setRenderableCount(A),
        this._handler && this._handler.clearPriorityNodesSet && this._handler.clearPriorityNodesSet(!0)
    }
    ,
    TC.prototype.getRenderableCount = function() {
        return this.configLoader.getStatistics().renderableCount
    }
    ,
    TC.prototype.getBoundingBoxWorld = function() {
        return this.configLoader.getTransforms().boundingBox
    }
    ,
    TC.prototype.calculateBoundingBox = function() {
        var A = this.getModelDescriptor().getAllNodeInfos()
          , e = new aA;
        for (var t in A)
            for (var i = A[t], o = 0, n = i.length; n > o; o += 1) {
                var r = i[o];
                r.boundingBox && e.union(r.boundingBox)
            }
        var a = this.getModelMatrix();
        a && e.applyMatrix4(a),
        this.configLoader.getTransforms().boundingBox.copy(e)
    }
    ,
    TC.prototype.calculateClippingIds = function() {
        var A = this._getHandler();
        A && A.calculateClippingIds()
    }
    ,
    TC.prototype.explode = function(A) {
        var e = this.getBoundingBoxWorld().getCenter()
          , t = this._getHandler();
        t && t.explode(e, A)
    }
    ,
    TC.prototype.formatLayerIds = function(A) {
        return this.getLayerProvider().formatLayerIds(A)
    }
    ,
    TC.prototype.getBoundingBoxOfGeometries = function(A) {
        for (var e = !A, t = new aA, i = 0; A.length > i; i += 1) {
            var o = this.group.getObjectByProperty("guid", A[i]);
            if (o) {
                var n = o.geometry;
                if (n) {
                    if (e || n) {
                        n.boundingBox || n.computeBoundingBox();
                        var r = n.boundingBox;
                        if (r) {
                            var a = r.clone();
                            o.matrixWorld && a.applyMatrix4(o.matrixWorld),
                            t.expandByPoint(a.min),
                            t.expandByPoint(a.max)
                        }
                    }
                } else
                    Bh.log("empty geometry!")
            }
        }
        return t
    }
    ,
    TC.prototype.setModelMatrix = function(A) {
        this.group.matrix.copy(A),
        this.group.updateMatrixWorld(!0);
        var e = this.configLoader.transformInfos;
        e && e.boundingBox && (e.transformMatrix.copy(A),
        e.originalBoundingBox ? this.calculateBoundingBox() : (e.originalBoundingBox = e.boundingBox.clone(),
        e.boundingBox.applyMatrix4(A))),
        this.manager.updateSceneBoundingBox()
    }
    ,
    TC.prototype.applyModelMatrix = function(A) {
        var e = this.configLoader.transformInfos;
        e && e.boundingBox && (e.transformMatrix.premultiply(A),
        e.originalBoundingBox || (e.originalBoundingBox = e.boundingBox.clone()),
        e.boundingBox.applyMatrix4(A)),
        this.group.matrix.copy(e.transformMatrix),
        this.group.updateMatrixWorld(!0),
        this.manager.updateSceneBoundingBox()
    }
    ,
    TC.prototype.getModelMatrix = function() {
        var A = null;
        return this.group.matrix && (A = this.group.matrix.clone()),
        A
    }
    ,
    TC.prototype.resetModelMatrix = function() {
        var A = this.configLoader.transformInfos.originalMatrix;
        A && this.setModelMatrix(A)
    }
    ,
    TC.prototype.overturnYAndZaxis = function() {
        var A = (new M).makeRotationFromEuler(new F(Math.PI / 2,0,0));
        this.group.matrix && (A.multiply(this.group.matrix),
        this.setModelMatrix(A))
    }
    ,
    TC.prototype.hasComponent = function(A) {
        return !!this.getModelDescriptor().getNodeInfosByUserId(A)
    }
    ,
    TC.prototype.getComponentInfo = function(A) {
        return this.getModelDescriptor().getNodeInfosByComponentKey(A)
    }
    ,
    TC.prototype.getComponentlist = function() {
        var A = []
          , e = this.getModelDescriptor();
        for (var t in e.mapNodeInfoByComponentKey)
            e.mapNodeInfoByComponentKey.hasOwnProperty(t) && A.push(t);
        return A
    }
    ,
    TC.prototype.addMeshToInfoMap = function(A, e, t, i, o) {
        this.getModelDescriptor().addMeshToInfoMap(A, e, t, i, o)
    }
    ,
    TC.prototype.loadGeopkOnDemand = function(A, e, t) {
        this._handler && "layer" === this._handler.tag && this._handler.loadGeopkOnDemand(A, e, t)
    }
    ,
    TC.prototype.unloadGeopkOnDemand = function(A, e) {
        this._handler && "layer" === this._handler.tag && this._handler.unloadComponents(A, e)
    }
    ,
    TC.prototype.loadAllGeosOnDemand = function(A, e, t) {
        this._handler && "layer" === this._handler.tag && this._handler.loadAllGeosOnDemand(A, e, t)
    }
    ,
    TC.prototype.getUnionBoundingBoxOnDemand = function() {
        return this.getLayerProvider().getUnionBoundingBoxOnDemand()
    }
    ,
    TC.prototype.setConditionsChangedOnDemand = function(A) {
        this.getLayerProvider().setConditionsChanged(A)
    }
    ,
    TC.prototype.explosion = function(A) {
        var e = this._getHandler();
        Bh.time("模型离散用时"),
        e && (this.explosioning = !0,
        e.explosion(A)),
        Bh.timeEnd("模型离散用时"),
        this.calculateBoundingBox()
    }
    ,
    TC.prototype.closeExplosion = function() {
        Bh.time("取消模型离散用时");
        var A = this._getHandler();
        A && (A.closeExplosion(),
        this.explosioning = !1),
        Bh.timeEnd("取消模型离散用时")
    }
    ,
    TC.prototype.componentsExplosion = function(A) {
        var e = this._getHandler();
        if (1 === (A.coefficientX || 1) && 1 === (A.coefficientY || 1) && 1 === (A.coefficientZ || 1) && 0 === (A.offsetX || 0) && 0 === (A.offsetY || 0) && 0 === (A.offsetZ || 0))
            return this.explosioning = !1,
            this.closeComponentsExplosion(A.componentKey),
            void this.calculateBoundingBox();
        Bh.time("构件离散用时"),
        e && (this.explosioning = !0,
        e.componentsExplosion(A),
        this.calculateBoundingBox()),
        Bh.timeEnd("构件离散用时")
    }
    ,
    TC.prototype.closeComponentsExplosion = function(A) {
        Bh.time("取消构件离散用时");
        var e = this._getHandler();
        e && (e.closeComponentsExplosion(A),
        this.explosioning = !1),
        Bh.timeEnd("取消构件离散用时")
    }
    ,
    TC.prototype.floorExplosion = function(A) {
        if (this.floorManager) {
            var e = this.floorManager.floorExplosionInfo;
            this.explosioning = !0;
            var t = this._getHandler();
            if (!t)
                return !1;
            if (!e.sortedFloors) {
                for (var i = [], o = 0, n = e.floors.length; n > o; o += 1) {
                    var r = e.floors[o]
                      , a = this.manager.getBoundingBoxByIds(r.componentkeys);
                    if (!a.isEmpty()) {
                        r.box = a;
                        var s = new y;
                        r.box.getCenter(s),
                        r.center = s,
                        i.push(r)
                    }
                }
                i.sort((function(A, e) {
                    return A.center.z - e.center.z
                }
                )),
                e.sortedFloors = i;
                for (var l = 0, c = 1 / 0, h = 0, d = 0, p = i.length; p > d; d += 1) {
                    var g = Math.abs(i[d].center.z);
                    c > g && (l = d,
                    c = g);
                    var u = new y;
                    i[d].box.getSize(u),
                    h += u.z
                }
                e.baseFloorIndex = l,
                e.averageHeight = h / i.length;
                var f = i[l].center.toArray();
                e.center = f
            }
            for (var m = (A - 1) * e.averageHeight, C = 0, v = e.sortedFloors.length; v > C; C += 1) {
                if (C !== e.baseFloorIndex)
                    t.componentsExplosion({
                        offsetZ: (C - e.baseFloorIndex) * m,
                        componentKey: e.sortedFloors[C].componentkeys,
                        center: e.center
                    })
            }
            return this.calculateBoundingBox(),
            !0
        }
        return !1
    }
    ,
    TC.prototype.closeFloorExplosion = function() {
        if (this.floorManager) {
            var A = this.floorManager.floorExplosionInfo;
            if (A && A.sortedFloors) {
                var e = this._getHandler();
                if (e) {
                    for (var t = 0, i = A.sortedFloors.length; i > t; t += 1) {
                        e.closeComponentsExplosion(A.sortedFloors[t].componentkeys)
                    }
                    this.calculateBoundingBox(),
                    this.explosioning = !1
                }
            }
        }
    }
    ,
    TC.prototype.showModel = function(A) {
        this.nodes.visible = A
    }
    ,
    TC.prototype.updateMaterials = function() {
        var A = this.materials;
        for (var e in A)
            if (A.hasOwnProperty(e)) {
                var t = A[e];
                t.IBLMaps = this.manager.scene.IBLMaps,
                t.refreshUniforms()
            }
    }
    ,
    TC.prototype.updateMaterialsValue = function(A, e) {
        var t = this.materials;
        for (var i in t)
            if (t.hasOwnProperty(i)) {
                var o = t[i];
                o.hasOwnProperty(A) && (o[A] = e,
                o.refreshUniforms(),
                o.needsUpdate = !0)
            }
    }
    ,
    TC.prototype.changeAllMaterials = function(A) {
        var e = this.materials;
        for (var t in e)
            if (e.hasOwnProperty(t)) {
                var i = Kd.getMaterialParameters(e[t])
                  , o = null;
                A ? (delete i.textureColor,
                delete i.pureColor,
                delete i.imageFade,
                i.lights = !0,
                (o = new QC.IBLMaterial(i)).type = "IBL",
                o.refreshUniforms()) : (delete i.iblProbe,
                (o = Kd.createStandardMaterial(i)).roughness = i.originRoughness,
                o.metalness = i.originMetalness,
                o.refreshUniforms()),
                o.name = t,
                e[t] = o,
                i = null
            }
    }
    ,
    TC.prototype.getAllComponents = function() {
        return this.getComponentlist()
    }
    ,
    TC.prototype.getComponentKeysByTypeFromList = function(A, e) {
        for (var t = this.getModelDescriptor(), i = [], o = 0; A.length > o; o += 1)
            t.mapNodeInfoByComponentKey.hasOwnProperty(A[o]) && t.mapNodeInfoByComponentKey[A[o]][0].type === e && i.push(A[o]);
        return i
    }
    ,
    TC.prototype.getComponentKeysByType = function(A) {
        var e = this.getModelDescriptor()
          , t = [];
        for (var i in e.mapNodeInfoByComponentKey)
            e.mapNodeInfoByComponentKey.hasOwnProperty(i) && e.mapNodeInfoByComponentKey[i][0].type === A && t.push(i);
        return t
    }
    ,
    TC.prototype.getAllComponentKeyType = function() {
        var A = {}
          , e = []
          , t = this.getModelDescriptor();
        for (var i in t.mapNodeInfoByComponentKey)
            if (t.mapNodeInfoByComponentKey.hasOwnProperty(i)) {
                var o = t.mapNodeInfoByComponentKey[i][0].type;
                A[o] || (A[o] = !0,
                e.push(o))
            }
        return e
    }
    ,
    TC.prototype.getComponentKeysByName = function(A) {
        var e = this.getModelDescriptor()
          , t = [];
        for (var i in e.mapNodeInfoByComponentKey)
            e.mapNodeInfoByComponentKey.hasOwnProperty(i) && e.mapNodeInfoByComponentKey[i][0].name === A && t.push(i);
        return t
    }
    ,
    TC.prototype.getComponentKeysByProperty = function(A, e) {
        var t = this.getModelDescriptor()
          , i = [];
        for (var o in t.mapNodeInfoByComponentKey)
            t.mapNodeInfoByComponentKey.hasOwnProperty(o) && t.mapNodeInfoByComponentKey[o][0][A] === e && i.push(o);
        return i
    }
    ,
    TC.prototype._getLayerHandler = function() {
        return this._layerHandler
    }
    ,
    TC.prototype.prepareData = function() {
        var A = this;
        this.materialManager._updateTextureMapping(),
        this.materialManager._updateIBL(this);
        var e = this._getHandler();
        e && e.prepareData((function() {
            A.loaded = !0,
            A.hasAnimation && vc.EnableAnimation && A.createPanel(),
            A.debut(A)
        }
        ))
    }
    ,
    TC.prototype.isUserIdExist = function(A) {
        return !!this.getModelDescriptor().getNodeInfosByUserId(A)
    }
    ,
    TC.prototype.getNodeInfosByUserId = function(A) {
        return this.getModelDescriptor().getNodeInfosByUserId(A)
    }
    ,
    TC.prototype.getNodeInfos = function() {
        return this.getModelDescriptor().getNodeInfosWithUserId()
    }
    ,
    TC.prototype.getFilter = function() {
        return this.manager.filter
    }
    ,
    TC.prototype.getOctreeRoots = function(A) {
        this.getModelDescriptor().getOctreeRoots(A)
    }
    ,
    TC.prototype.getPickingMeshes = function(A, e, t, i) {
        this._dealNonInstancedNodesForPicking(A, e, t, i),
        this._dealInstancedNodesForPicking(A, e, t, i),
        this._dealPluginNodesForPicking(A, e, t, i)
    }
    ,
    TC.prototype._dealNonInstancedNodesForPicking = function(A, e, t, i) {
        if (this._handler) {
            var o = this._handler.defaultManager;
            if (o.hasNodeInfo(this)) {
                var n = o.getMeshManager().getPickingNodeGenerator().updatePickingMeshes(A.selectedMaterial, t, i);
                n && e.meshes.push(n);
                var r = o.getWireFrameManager().getPickingNodeGenerator().updatePickingMeshes(A.wireframeMaterial, t, i);
                r && e.meshes.push(r)
            }
        }
    }
    ,
    TC.prototype._dealInstancedNodesForPicking = function(A, e, t, i) {
        if (this._handler) {
            var o = this._handler.instancedManager;
            if (o.hasNodeInfo(this)) {
                var n = o.getMeshManager().getPickingNodeGenerator().updatePickingMeshes(A.instancedSelectedMaterial, t, i);
                n && e.meshes.push(n);
                var r = o.getWireFrameManager().getPickingNodeGenerator().updatePickingMeshes(A.instancedWireFrameMaterial, t, i);
                r && e.meshes.push(r)
            }
        }
    }
    ,
    TC.prototype._dealPluginNodesForPicking = function(A, e, t, i) {
        if (this._handler)
            for (var o = this.plugins, n = 0, r = o.length; r > n; n += 1) {
                var a = o[n].getPickingNodeGenerator().updatePickingMeshes(A.selectedMaterial, t, i);
                a && e.meshes.push(a)
            }
    }
    ,
    TC.prototype.onWSWorkerMessage = function() {}
    ,
    TC.prototype.onPDWorkerMessage = function() {}
    ,
    TC.prototype._overrideOcclusionMaterial = function(A) {
        var e = A.material;
        if (e && !1 === e.transparent) {
            var t = this.manager.acquireMaterial()
              , i = t.material;
            e.color ? i.color.copy(e.color) : t.resetColor(),
            i.opacity = vc.OcclusionOpacity,
            A.material = i,
            A.material.needsUpdate = !0
        }
    }
    ,
    TC.prototype.showSkeleton = function(A) {
        this.skeleton.visible = A
    }
    ,
    TC.prototype.deactivateAllActions = function() {
        this.needUpdate = !1,
        this.actions.forEach((function(A) {
            A.stop()
        }
        ))
    }
    ,
    TC.prototype.activateAllActions = function() {
        this.needUpdate = !0;
        for (var A = 0; this.actions.length > A; A += 1)
            this.setWeight(this.actions[A], 0 === A ? 1 : 0);
        this.actions.forEach((function(A) {
            A.play()
        }
        ))
    }
    ,
    TC.prototype.pauseAllActions = function() {
        this.needUpdate = !1,
        this.actions.forEach((function(A) {
            A.paused = !0
        }
        ))
    }
    ,
    TC.prototype.toSingleStepMode = function() {
        this.unPauseAllActions(),
        this.singleStepMode = !0,
        this.sizeOfNextStep = this.settings["调整步长"]
    }
    ,
    TC.prototype.pauseContinue = function() {
        this.singleStepMode ? (this.singleStepMode = !1,
        this.unPauseAllActions()) : this.paused ? (this.paused = !1,
        this.unPauseAllActions()) : (this.paused = !0,
        this.pauseAllActions())
    }
    ,
    TC.prototype.unPauseAllActions = function() {
        this.needUpdate = !0,
        this.actions.forEach((function(A) {
            A.paused = !1
        }
        ))
    }
    ,
    TC.prototype.setWeight = function(A, e) {
        A.enabled = !0,
        A.setEffectiveTimeScale(1),
        A.setEffectiveWeight(e)
    }
    ,
    TC.prototype.modifyTimeScale = function(A) {
        this.mixer.timeScale = A
    }
    ,
    TC.prototype.createPanel = function() {
        var A = this
          , e = new $m({
            width: 300
        }).addFolder(this.modelKey)
          , t = e.addFolder("可见性")
          , i = e.addFolder("激活/失活")
          , o = e.addFolder("暂停/步进")
          , n = e.addFolder("混合权重")
          , r = e.addFolder("综合速度");
        this.settings = {
            "显示模型": !0,
            "显示骨骼": !1,
            "关闭全部动画": this.deactivateAllActions.bind(A),
            "激活所有动画": this.activateAllActions.bind(A),
            "暂停/继续": this.pauseContinue.bind(A),
            "单步动画": this.toSingleStepMode.bind(A),
            "调整步长": .05,
            "使用默认持续时间": !0,
            "设置自定义持续时间": 3.5,
            "modify idle weight": 0,
            "modify walk weight": 1,
            "modify run weight": 0,
            "修改时间尺度": 1
        };
        var a = this.settings;
        t.add(a, "显示模型").onChange(this.showModel.bind(A)),
        t.add(a, "显示骨骼").onChange(this.showSkeleton.bind(A)),
        i.add(a, "关闭全部动画"),
        i.add(a, "激活所有动画"),
        o.add(a, "暂停/继续"),
        o.add(a, "单步动画"),
        o.add(a, "调整步长", .01, .1, .001);
        for (var s = this.actions, l = function(e) {
            var t = s[e]._clip.name;
            a[t] = 0 === e ? 1 : 0,
            n.add(a, t, 0, 1, .01).listen().onChange((function(t) {
                A.setWeight(s[e], t)
            }
            ))
        }, c = 0; s.length > c; c += 1)
            l(c);
        r.add(a, "修改时间尺度", 0, 10, .01).onChange(this.modifyTimeScale.bind(A)),
        t.open(),
        i.open(),
        o.open(),
        n.open(),
        r.open()
    }
    ,
    TC.prototype.getTransformGroup = function() {
        return this.transformGroup || (this.transformGroup = this.manager.scene.getOrCreateGroup(gp.TRANSFORM),
        this.group.add(this.transformGroup),
        this.transformGroup.updateMatrixWorld(!0)),
        this.transformGroup
    }
    ,
    TC.prototype.getComponentKeysBySubmodelKey = function(A) {
        return this.submodel[A] || []
    }
    ,
    TC.prototype.getTrianglesCount = function() {
        var A = 0
          , e = 0
          , t = 0
          , i = 0
          , o = {};
        return this.group.traverse((function(n) {
            if (n.isMesh) {
                var r = n.geometry
                  , a = r.getAttribute("position").count
                  , s = r.index.count / 3
                  , l = r.getAttribute("vState");
                o[r.id] || (t += a,
                i += s,
                o[r.id] = !0),
                l && (a *= l.count,
                s *= l.count),
                A += a,
                e += s
            }
        }
        )),
        o = null,
        {
            positionsCount: A,
            trianglesCount: e,
            realPositionCount: t,
            realTrianglesCount: i
        }
    }
    ,
    TC.prototype.addLights = function(A) {
        this.lightGroup = this.lightGroup || new Xi,
        this.group.add(this.lightGroup),
        this.lightGroup.visible = !1;
        for (var e = 0, t = A.length; t > e; e += 1)
            this.lightGroup.add(A[e]),
            A[e].updateMatrixWorld()
    }
    ,
    TC.prototype.hasLights = function() {
        return this.lightGroup && this.lightGroup.children.length > 0
    }
    ,
    TC.prototype.enabledLights = function() {
        this.lightGroup.visible = !0
    }
    ,
    TC.prototype.disabledLights = function() {
        this.lightGroup.visible = !1
    }
    ,
    Object.defineProperties(TC.prototype, {
        modelConfig: {
            get: function() {
                return Bh.warn("EIMMODEL.Model: .modelConfig 现在为 .getConfig()"),
                this.getConfig()
            },
            set: function(A) {
                this.setConfig(A)
            }
        },
        loader: {
            get: function() {
                return this._getHandler().loader
            }
        }
    });
    var kC = {
        getBoxFromTileBoundingVolumeBox: function(A) {
            var e = new aA
              , t = (new y).fromArray(A, 0)
              , i = new y;
            return i.fromArray(A, 3),
            i.add(t),
            e.expandByPoint(i),
            i.fromArray(A, 6),
            i.add(t),
            e.expandByPoint(i),
            i.fromArray(A, 9),
            i.add(t),
            e.expandByPoint(i),
            e
        },
        getSphereFromTileBoundingVolumeSphere: function(A) {
            return new cA((new y).fromArray(A, 0),A[3] || 0)
        },
        getTransfrom: function(A) {
            return Array.isArray(A) ? (new M).fromArray(A) : new M
        },
        getSSE: function(A) {
            var e = this.getBoxByComponentsKey(A)
              , t = this.viewerImpl.camera
              , i = e.getCenter(new y)
              , o = e.getSize().length()
              , n = this.viewerImpl.getRenderer().domElement.width
              , r = t.fov;
            return o * n / (2 * t.position.clone().sub(i).length() * Math.tan(r / 2))
        }
    }
      , DC = function(A) {
        bC.call(this, A)
    };
    function LC(A, e, t) {
        if (0 > e)
            throw new Error("byteOffset cannot be negative.");
        if (0 > t)
            throw new Error("byteLength cannot be negative.");
        if (e + t > A.byteLength)
            throw new Error("sub-region exceeds array bounds.");
        return A = A.subarray(e = e || 0, e + (t = t || A.byteLength - e)),
        LC.decode(A)
    }
    function NC(A, e, t) {
        return A >= e && t >= A
    }
    (DC.prototype = Object.create(bC.prototype)).load = function(A) {
        var e = this
          , t = this.model
          , i = t.dataUrl;
        _d({
            type: "GET",
            url: i.rootTilesUrl(),
            headers: {
                Authorization: t.accessToken
            },
            success: function(o) {
                var n = {};
                if ("string" == typeof o)
                    try {
                        n = JSON.parse(o)
                    } catch (A) {
                        return t.setEmptyScene(!0),
                        void t.dispatchEventEx({
                            type: Rc.ON_LOAD_INVALID_SCENE,
                            modelKey: t.modelKey
                        })
                    }
                else
                    n = o;
                if (n) {
                    if (vc.offLine)
                        e.model.getStorage().put(i.projectUrl(), n, e.model.modelKey, (function() {}
                        ), (function() {}
                        ));
                    e._parse(n),
                    t.dispatchEventEx({
                        type: Rc.ON_LOAD_CONFIG_FINISH,
                        modelKey: t.modelKey
                    }),
                    A && A()
                } else
                    Bh.log(t.modelKey, "config load error! ", n.message),
                    t.dispatchEventEx({
                        type: Rc.ON_LOAD_ERROR,
                        modelKey: t.modelKey,
                        code: n.code,
                        message: n.message
                    })
            },
            error: function(A, e) {
                switch (A) {
                case 401:
                    t.dispatchEventEx({
                        type: Rc.ACCOUNT_NO_EXIST,
                        modelKey: t.modelKey,
                        data: e
                    });
                    break;
                case 403:
                    t.dispatchEventEx({
                        type: Rc.NO_PERMISSION,
                        modelKey: t.modelKey,
                        data: e
                    });
                    break;
                default:
                    t.dispatchEventEx({
                        type: Rc.ON_NETWORK_ERROR,
                        modelKey: t.modelKey,
                        data: A
                    })
                }
            }
        })
    }
    ,
    DC.prototype._parse = function(A) {
        this.config = A,
        A.lengthUnit && (this.model.originalLengthUnit = A.lengthUnit || "m"),
        this._toStatistics(A),
        this._setTransformInfos(A),
        this._chooseRendering(A)
    }
    ,
    DC.prototype._setTransformInfos = function(A) {
        this.model.hasAnimation = !1,
        this.transformInfos.octreeTransformed = !1,
        this.transformInfos.boundingBox && this.transformInfos.boundingBox.isBox3 || (this.transformInfos.boundingBox = kC.getBoxFromTileBoundingVolumeBox(A.root.boundingVolume.box)),
        this.transformInfos.transformMatrix.compose(this.transformInfos.position, this.transformInfos.rotation, this.transformInfos.scale),
        this.transformInfos.transformMatrix.fromArray(A.matrix || [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]),
        this.model.setModelMatrix(this.transformInfos.transformMatrix),
        this.model.manager.updateScene()
    }
    ,
    LC.decodeWithTextDecoder = function(A) {
        return new TextDecoder("utf-8").decode(A)
    }
    ,
    LC.decodeWithFromCharCode = function(A) {
        for (var e = "", t = function(A) {
            for (var e = 0, t = 0, i = 0, o = 128, n = 191, r = [], a = A.length, s = 0; a > s; s += 1) {
                var l = A[s];
                if (0 === i) {
                    if (NC(l, 0, 127)) {
                        r.push(l);
                        continue
                    }
                    if (NC(l, 194, 223)) {
                        i = 1,
                        e = 31 & l;
                        continue
                    }
                    if (NC(l, 224, 239)) {
                        224 === l && (o = 160),
                        237 === l && (n = 159),
                        i = 2,
                        e = 15 & l;
                        continue
                    }
                    if (NC(l, 240, 244)) {
                        240 === l && (o = 144),
                        244 === l && (n = 143),
                        i = 3,
                        e = 7 & l;
                        continue
                    }
                    throw new Error("String decoding failed.")
                }
                NC(l, o, n) ? (o = 128,
                n = 191,
                e = e << 6 | 63 & l,
                (t += 1) === i && (r.push(e),
                e = i = t = 0)) : (e = i = t = 0,
                o = 128,
                n = 191,
                s -= 1)
            }
            return r
        }(A), i = t.length, o = 0; i > o; o += 1) {
            var n = t[o];
            n > 65535 ? (n -= 65536,
            e += String.fromCharCode(55296 + (n >> 10), 56320 + (1023 & n))) : e += String.fromCharCode(n)
        }
        return e
    }
    ,
    LC.decode = "undefined" != typeof TextDecoder ? LC.decodeWithTextDecoder : LC.decodeWithFromCharCode;
    var OC = function() {
        function A(A) {
            Yr.call(this, A),
            this.dracoLoader = null,
            this.ddsLoader = null
        }
        function e() {
            var A = {};
            return {
                get: function(e) {
                    return A[e]
                },
                add: function(e, t) {
                    A[e] = t
                },
                remove: function(e) {
                    delete A[e]
                },
                removeAll: function() {
                    A = {}
                }
            }
        }
        A.prototype = Object.assign(Object.create(Yr.prototype), {
            constructor: A,
            load: function(A, e, t, i) {
                var o, n = this;
                o = "" !== this.resourcePath ? this.resourcePath : "" !== this.path ? this.path : La.extractUrlBase(A),
                n.manager.itemStart(A);
                var r = function(e) {
                    i ? i(e) : console.error(e),
                    n.manager.itemError(A),
                    n.manager.itemEnd(A)
                }
                  , a = new bu(n.manager);
                a.setPath(this.path),
                a.setResponseType("arraybuffer"),
                "use-credentials" === n.crossOrigin && a.setWithCredentials(!0),
                a.load(A, (function(t) {
                    try {
                        n.parse(t, o, (function(t) {
                            e(t),
                            n.manager.itemEnd(A)
                        }
                        ), r)
                    } catch (A) {
                        r(A)
                    }
                }
                ), t, r)
            },
            setDRACOLoader: function(A) {
                return this.dracoLoader = A,
                this
            },
            setDDSLoader: function(A) {
                return this.ddsLoader = A,
                this
            },
            parse: function(A, e, a, s) {
                var l, c = {};
                if ("string" == typeof A)
                    l = A;
                else {
                    var g = La.decodeText(new Uint8Array(A,0,4));
                    if (g === r) {
                        try {
                            c[t.KHR_BINARY_GLTF] = new h(A)
                        } catch (A) {
                            return void (s && s(A))
                        }
                        l = c[t.KHR_BINARY_GLTF].content
                    } else if ("b3dm" === g) {
                        try {
                            c[t.KHR_BINARY_GLTF] = new h(function(A) {
                                var e = 0;
                                e = 0;
                                var t = Uint32Array.BYTES_PER_ELEMENT
                                  , i = new Uint8Array(A)
                                  , o = new DataView(A)
                                  , n = o.getUint32(e += t, !0);
                                if (1 !== n)
                                    throw new Error("Only Batched 3D Model version 1 is supported.  Version " + n + " is not.");
                                var r, a = o.getUint32(e += t, !0), s = o.getUint32(e += t, !0), l = o.getUint32(e += t, !0), c = o.getUint32(e += t, !0), h = o.getUint32(e += t, !0);
                                if (e += t,
                                570425344 > c ? 570425344 > h || (e -= t,
                                r = c,
                                c = s,
                                h = l,
                                s = 0,
                                l = 0) : (e -= 2 * t,
                                r = s,
                                c = l,
                                h = 0,
                                s = 0,
                                l = 0),
                                0 === s)
                                    ({
                                        BATCH_LENGTH: r || 0
                                    });
                                else {
                                    var d = LC(i, e, s);
                                    JSON.parse(d),
                                    e += s
                                }
                                if (e += l,
                                c > 0) {
                                    var p = LC(i, e, c);
                                    JSON.parse(p),
                                    e += c,
                                    h > 0 && (e += h)
                                }
                                var g = 0 + a - e;
                                if (0 === g)
                                    throw new Error("glTF byte length must be greater than 0.");
                                var u = null;
                                return e % 4 == 0 ? (new Uint8Array(A,e,g),
                                u = A.slice(e)) : (new Uint8Array(i.subarray(e, e + g)),
                                u = A.slice(e)),
                                u
                            }(A))
                        } catch (A) {
                            return void (s && s(A))
                        }
                        l = c[t.KHR_BINARY_GLTF].content
                    } else
                        l = La.decodeText(new Uint8Array(A))
                }
                var m = JSON.parse(l);
                if (void 0 === m.asset || m.asset.version[0] < 2)
                    s && s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
                else {
                    if (m.extensionsUsed)
                        for (var C = 0; m.extensionsUsed.length > C; ++C) {
                            var y = m.extensionsUsed[C]
                              , v = m.extensionsRequired || [];
                            switch (y) {
                            case t.KHR_LIGHTS_PUNCTUAL:
                                c[y] = new o(m);
                                break;
                            case t.KHR_MATERIALS_UNLIT:
                                c[y] = new n;
                                break;
                            case t.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:
                                c[y] = new u;
                                break;
                            case t.KHR_DRACO_MESH_COMPRESSION:
                                c[y] = new d(m,this.dracoLoader);
                                break;
                            case t.MSFT_TEXTURE_DDS:
                                c[y] = new i(this.ddsLoader);
                                break;
                            case t.KHR_TEXTURE_TRANSFORM:
                                c[y] = new p;
                                break;
                            case t.KHR_MESH_QUANTIZATION:
                                c[y] = new f;
                                break;
                            default:
                                0 > v.indexOf(y) || console.warn('THREE.GLTFLoader: Unknown extension "' + y + '".')
                            }
                        }
                    new q(m,c,{
                        path: e || this.resourcePath || "",
                        crossOrigin: this.crossOrigin,
                        manager: this.manager
                    }).parse(a, s)
                }
            }
        });
        var t = {
            KHR_BINARY_GLTF: "KHR_binary_glTF",
            KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
            KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
            KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: "KHR_materials_pbrSpecularGlossiness",
            KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
            KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
            KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
            MSFT_TEXTURE_DDS: "MSFT_texture_dds"
        };
        function i(A) {
            if (!A)
                throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");
            this.name = t.MSFT_TEXTURE_DDS,
            this.ddsLoader = A
        }
        function o(A) {
            this.name = t.KHR_LIGHTS_PUNCTUAL,
            this.lightDefs = (A.extensions && A.extensions[t.KHR_LIGHTS_PUNCTUAL] || {}).lights || []
        }
        function n() {
            this.name = t.KHR_MATERIALS_UNLIT
        }
        o.prototype.loadLight = function(A) {
            var e, t = this.lightDefs[A], i = new LA(16777215);
            void 0 !== t.color && i.fromArray(t.color);
            var o = void 0 !== t.range ? t.range : 0;
            switch (t.type) {
            case "directional":
                (e = new Ra(i)).target.position.set(0, 0, -1),
                e.add(e.target);
                break;
            case "point":
                (e = new Fa(i)).distance = o;
                break;
            case "spot":
                (e = new ba(i)).distance = o,
                t.spot = t.spot || {},
                t.spot.innerConeAngle = void 0 !== t.spot.innerConeAngle ? t.spot.innerConeAngle : 0,
                t.spot.outerConeAngle = void 0 !== t.spot.outerConeAngle ? t.spot.outerConeAngle : Math.PI / 4,
                e.angle = t.spot.outerConeAngle,
                e.penumbra = 1 - t.spot.innerConeAngle / t.spot.outerConeAngle,
                e.target.position.set(0, 0, -1),
                e.add(e.target);
                break;
            default:
                throw new Error('THREE.GLTFLoader: Unexpected light type, "' + t.type + '".')
            }
            return e.position.set(0, 0, 0),
            e.decay = 2,
            void 0 !== t.intensity && (e.intensity = t.intensity),
            e.name = t.name || "light_" + A,
            Promise.resolve(e)
        }
        ,
        n.prototype.getMaterialType = function() {
            return jA
        }
        ,
        n.prototype.extendParams = function(A, e, t) {
            var i = [];
            A.color = new LA(1,1,1),
            A.opacity = 1;
            var o = e.pbrMetallicRoughness;
            if (o) {
                if (Array.isArray(o.baseColorFactor)) {
                    var n = o.baseColorFactor;
                    A.color.fromArray(n),
                    A.opacity = n[3]
                }
                void 0 !== o.baseColorTexture && i.push(t.assignTexture(A, "map", o.baseColorTexture))
            }
            return Promise.all(i)
        }
        ;
        var r = "glTF"
          , l = 1313821514
          , c = 5130562;
        function h(A) {
            this.name = t.KHR_BINARY_GLTF,
            this.content = null,
            this.body = null;
            var e = new DataView(A,0,12);
            if (this.header = {
                magic: La.decodeText(new Uint8Array(A.slice(0, 4))),
                version: e.getUint32(4, !0),
                length: e.getUint32(8, !0)
            },
            this.header.magic !== r)
                throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
            if (2 > this.header.version)
                throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
            for (var i = new DataView(A,12), o = 0; i.byteLength > o; ) {
                var n = i.getUint32(o, !0)
                  , a = i.getUint32(o += 4, !0);
                if (o += 4,
                a === l) {
                    var s = new Uint8Array(A,12 + o,n);
                    this.content = La.decodeText(s)
                } else if (a === c) {
                    var h = 12 + o;
                    this.body = A.slice(h, h + n)
                }
                o += n
            }
            if (null === this.content)
                throw new Error("THREE.GLTFLoader: JSON content not found.")
        }
        function d(A, e) {
            if (!e)
                throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
            this.name = t.KHR_DRACO_MESH_COMPRESSION,
            this.json = A,
            this.dracoLoader = e,
            this.dracoLoader.preload()
        }
        function p() {
            this.name = t.KHR_TEXTURE_TRANSFORM
        }
        function g(A) {
            yr.call(this),
            this.isGLTFSpecularGlossinessMaterial = !0;
            var e = ["#ifdef USE_SPECULARMAP", "\tuniform sampler2D specularMap;", "#endif"].join("\n")
              , t = ["#ifdef USE_GLOSSINESSMAP", "\tuniform sampler2D glossinessMap;", "#endif"].join("\n")
              , i = ["vec3 specularFactor = specular;", "#ifdef USE_SPECULARMAP", "\tvec4 texelSpecular = texture2D( specularMap, vUv );", "\ttexelSpecular = sRGBToLinear( texelSpecular );", "\t// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture", "\tspecularFactor *= texelSpecular.rgb;", "#endif"].join("\n")
              , o = ["float glossinessFactor = glossiness;", "#ifdef USE_GLOSSINESSMAP", "\tvec4 texelGlossiness = texture2D( glossinessMap, vUv );", "\t// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture", "\tglossinessFactor *= texelGlossiness.a;", "#endif"].join("\n")
              , n = ["PhysicalMaterial material;", "material.diffuseColor = diffuseColor.rgb;", "vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );", "float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );", "material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 );// 0.0525 corresponds to the base mip of a 256 cubemap.", "material.specularRoughness += geometryRoughness;", "material.specularRoughness = min( material.specularRoughness, 1.0 );", "material.specularColor = specularFactor.rgb;"].join("\n")
              , r = {
                specular: {
                    value: (new LA).setHex(16777215)
                },
                glossiness: {
                    value: 1
                },
                specularMap: {
                    value: null
                },
                glossinessMap: {
                    value: null
                }
            };
            this._extraUniforms = r,
            this.onBeforeCompile = function(A) {
                for (var a in r)
                    A.uniforms[a] = r[a];
                A.fragmentShader = A.fragmentShader.replace("uniform float roughness;", "uniform vec3 specular;"),
                A.fragmentShader = A.fragmentShader.replace("uniform float metalness;", "uniform float glossiness;"),
                A.fragmentShader = A.fragmentShader.replace("#include <roughnessmap_pars_fragment>", e),
                A.fragmentShader = A.fragmentShader.replace("#include <metalnessmap_pars_fragment>", t),
                A.fragmentShader = A.fragmentShader.replace("#include <roughnessmap_fragment>", i),
                A.fragmentShader = A.fragmentShader.replace("#include <metalnessmap_fragment>", o),
                A.fragmentShader = A.fragmentShader.replace("#include <lights_physical_fragment>", n)
            }
            ,
            Object.defineProperties(this, {
                specular: {
                    get: function() {
                        return r.specular.value
                    },
                    set: function(A) {
                        r.specular.value = A
                    }
                },
                specularMap: {
                    get: function() {
                        return r.specularMap.value
                    },
                    set: function(A) {
                        r.specularMap.value = A
                    }
                },
                glossiness: {
                    get: function() {
                        return r.glossiness.value
                    },
                    set: function(A) {
                        r.glossiness.value = A
                    }
                },
                glossinessMap: {
                    get: function() {
                        return r.glossinessMap.value
                    },
                    set: function(A) {
                        r.glossinessMap.value = A,
                        A ? (this.defines.USE_GLOSSINESSMAP = "",
                        this.defines.USE_ROUGHNESSMAP = "") : (delete this.defines.USE_ROUGHNESSMAP,
                        delete this.defines.USE_GLOSSINESSMAP)
                    }
                }
            }),
            delete this.metalness,
            delete this.roughness,
            delete this.metalnessMap,
            delete this.roughnessMap,
            this.setValues(A)
        }
        function u() {
            return {
                name: t.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,
                specularGlossinessParams: ["color", "map", "lightMap", "lightMapIntensity", "aoMap", "aoMapIntensity", "emissive", "emissiveIntensity", "emissiveMap", "bumpMap", "bumpScale", "normalMap", "normalMapType", "displacementMap", "displacementScale", "displacementBias", "specularMap", "specular", "glossinessMap", "glossiness", "alphaMap", "envMap", "envMapIntensity", "refractionRatio"],
                getMaterialType: function() {
                    return g
                },
                extendParams: function(A, e, t) {
                    var i = e.extensions[this.name];
                    A.color = new LA(1,1,1),
                    A.opacity = 1;
                    var o = [];
                    if (Array.isArray(i.diffuseFactor)) {
                        var n = i.diffuseFactor;
                        A.color.fromArray(n),
                        A.opacity = n[3]
                    }
                    if (void 0 !== i.diffuseTexture && o.push(t.assignTexture(A, "map", i.diffuseTexture)),
                    A.emissive = new LA(0,0,0),
                    A.glossiness = void 0 !== i.glossinessFactor ? i.glossinessFactor : 1,
                    A.specular = new LA(1,1,1),
                    Array.isArray(i.specularFactor) && A.specular.fromArray(i.specularFactor),
                    void 0 !== i.specularGlossinessTexture) {
                        var r = i.specularGlossinessTexture;
                        o.push(t.assignTexture(A, "glossinessMap", r)),
                        o.push(t.assignTexture(A, "specularMap", r))
                    }
                    return Promise.all(o)
                },
                createMaterial: function(A) {
                    var e = new g(A);
                    return e.fog = !0,
                    e.color = A.color,
                    e.map = void 0 === A.map ? null : A.map,
                    e.lightMap = null,
                    e.lightMapIntensity = 1,
                    e.aoMap = void 0 === A.aoMap ? null : A.aoMap,
                    e.aoMapIntensity = 1,
                    e.emissive = A.emissive,
                    e.emissiveIntensity = 1,
                    e.emissiveMap = void 0 === A.emissiveMap ? null : A.emissiveMap,
                    e.bumpMap = void 0 === A.bumpMap ? null : A.bumpMap,
                    e.bumpScale = 1,
                    e.normalMap = void 0 === A.normalMap ? null : A.normalMap,
                    e.normalMapType = 0,
                    A.normalScale && (e.normalScale = A.normalScale),
                    e.displacementMap = null,
                    e.displacementScale = 1,
                    e.displacementBias = 0,
                    e.specularMap = void 0 === A.specularMap ? null : A.specularMap,
                    e.specular = A.specular,
                    e.glossinessMap = void 0 === A.glossinessMap ? null : A.glossinessMap,
                    e.glossiness = A.glossiness,
                    e.alphaMap = null,
                    e.envMap = void 0 === A.envMap ? null : A.envMap,
                    e.envMapIntensity = 1,
                    e.refractionRatio = .98,
                    e
                }
            }
        }
        function f() {
            this.name = t.KHR_MESH_QUANTIZATION
        }
        function m(A, e, t, i) {
            Ur.call(this, A, e, t, i)
        }
        d.prototype.decodePrimitive = function(A, e) {
            var t = this.json
              , i = this.dracoLoader
              , o = A.extensions[this.name].bufferView
              , n = A.extensions[this.name].attributes
              , r = {}
              , a = {}
              , s = {};
            for (var l in n) {
                var c = K[l] || l.toLowerCase();
                r[c] = n[l]
            }
            for (l in A.attributes) {
                c = K[l] || l.toLowerCase();
                if (void 0 !== n[l]) {
                    var h = t.accessors[A.attributes[l]];
                    s[c] = w[h.componentType],
                    a[c] = !0 === h.normalized
                }
            }
            return e.getDependency("bufferView", o).then((function(A) {
                return new Promise((function(e) {
                    i.decodeDracoFile(A, (function(A) {
                        for (var t in A.attributes) {
                            var i = a[t];
                            void 0 !== i && (A.attributes[t].normalized = i)
                        }
                        e(A)
                    }
                    ), r, s)
                }
                ))
            }
            ))
        }
        ,
        p.prototype.extendTexture = function(A, e) {
            return A = A.clone(),
            void 0 !== e.offset && A.offset.fromArray(e.offset),
            void 0 !== e.rotation && (A.rotation = e.rotation),
            void 0 !== e.scale && A.repeat.fromArray(e.scale),
            void 0 !== e.texCoord && console.warn('THREE.GLTFLoader: Custom UV sets in "' + this.name + '" extension not yet supported.'),
            A.needsUpdate = !0,
            A
        }
        ,
        (g.prototype = Object.create(yr.prototype)).constructor = g,
        g.prototype.copy = function(A) {
            return yr.prototype.copy.call(this, A),
            this.specularMap = A.specularMap,
            this.specular.copy(A.specular),
            this.glossinessMap = A.glossinessMap,
            this.glossiness = A.glossiness,
            delete this.metalness,
            delete this.roughness,
            delete this.metalnessMap,
            delete this.roughnessMap,
            this
        }
        ,
        (m.prototype = Object.create(Ur.prototype)).constructor = m,
        m.prototype.beforeStart_ = m.prototype.copySampleValue_ = function(A) {
            for (var e = this.resultBuffer, t = this.sampleValues, i = this.valueSize, o = A * i * 3 + i, n = 0; n !== i; n++)
                e[n] = t[o + n];
            return e
        }
        ,
        m.prototype.afterEnd_ = m.prototype.copySampleValue_,
        m.prototype.interpolate_ = function(A, e, t, i) {
            for (var o = this.resultBuffer, n = this.sampleValues, r = this.valueSize, a = 2 * r, s = 3 * r, l = i - e, c = (t - e) / l, h = c * c, d = h * c, p = A * s, g = p - s, u = -2 * d + 3 * h, f = d - h, m = 1 - u, C = f - h + c, y = 0; y !== r; y++) {
                o[y] = m * n[g + y + r] + C * (n[g + y + a] * l) + u * n[p + y + r] + f * (n[p + y] * l)
            }
            return o
        }
        ;
        var C = 0
          , v = 1
          , I = 2
          , E = 3
          , B = 4
          , x = 5
          , S = 6
          , w = {
            5120: Int8Array,
            5121: Uint8Array,
            5122: Int16Array,
            5123: Uint16Array,
            5125: Uint32Array,
            5126: Float32Array
        }
          , b = {
            9728: 1003,
            9729: 1006,
            9984: 1004,
            9985: 1007,
            9986: 1005,
            9987: 1008
        }
          , U = {
            33071: 1001,
            33648: 1002,
            10497: 1e3
        }
          , F = {
            SCALAR: 1,
            VEC2: 2,
            VEC3: 3,
            VEC4: 4,
            MAT2: 4,
            MAT3: 9,
            MAT4: 16
        }
          , K = {
            POSITION: "position",
            NORMAL: "normal",
            TANGENT: "tangent",
            TEXCOORD_0: "uv",
            TEXCOORD_1: "uv2",
            COLOR_0: "color",
            WEIGHTS_0: "skinWeight",
            JOINTS_0: "skinIndex"
        }
          , Q = {
            scale: "scale",
            translation: "position",
            rotation: "quaternion",
            weights: "morphTargetInfluences"
        }
          , R = {
            CUBICSPLINE: void 0,
            LINEAR: 2301,
            STEP: 2300
        }
          , T = "OPAQUE"
          , k = "MASK"
          , D = "BLEND"
          , L = {
            "image/png": 1023,
            "image/jpeg": 1022
        };
        function N(A, e) {
            return "string" != typeof A || "" === A ? "" : (/^https?:\/\//i.test(e) && /^\//.test(A) && (e = e.replace(/(^https?:\/\/[^\/]+).*/i, "$1")),
            /^(https?:)?\/\//i.test(A) || /^data:.*,.*$/i.test(A) || /^blob:.*$/i.test(A) ? A : e + A)
        }
        function O(A, e, t) {
            for (var i in t.extensions)
                void 0 === A[i] && (e.userData.gltfExtensions = e.userData.gltfExtensions || {},
                e.userData.gltfExtensions[i] = t.extensions[i])
        }
        function V(A, e) {
            void 0 !== e.extras && ("object" === lc(e.extras) ? Object.assign(A.userData, e.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + e.extras))
        }
        function G(A, e) {
            if (A.updateMorphTargets(),
            void 0 !== e.weights)
                for (var t = 0, i = e.weights.length; i > t; t++)
                    A.morphTargetInfluences[t] = e.weights[t];
            if (e.extras && Array.isArray(e.extras.targetNames)) {
                var o = e.extras.targetNames;
                if (A.morphTargetInfluences.length === o.length) {
                    A.morphTargetDictionary = {};
                    for (t = 0,
                    i = o.length; i > t; t++)
                        A.morphTargetDictionary[o[t]] = t
                } else
                    console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")
            }
        }
        function P(A) {
            for (var e = "", t = Object.keys(A).sort(), i = 0, o = t.length; o > i; i++)
                e += t[i] + ":" + A[t[i]] + ";";
            return e
        }
        function q(A, t, i) {
            this.json = A || {},
            this.extensions = t || {},
            this.options = i || {},
            this.cache = new e,
            this.primitiveCache = {},
            this.textureLoader = new Aa(this.options.manager),
            this.textureLoader.setCrossOrigin(this.options.crossOrigin),
            this.fileLoader = new bu(this.options.manager),
            this.fileLoader.setResponseType("arraybuffer"),
            "use-credentials" === this.options.crossOrigin && this.fileLoader.setWithCredentials(!0)
        }
        function j(A, e, t) {
            var i = e.attributes
              , o = [];
            function n(e, i) {
                return t.getDependency("accessor", e).then((function(e) {
                    A.setAttribute(i, e)
                }
                ))
            }
            for (var r in i) {
                var a = K[r] || r.toLowerCase();
                a in A.attributes || o.push(n(i[r], a))
            }
            if (void 0 !== e.indices && !A.index) {
                var s = t.getDependency("accessor", e.indices).then((function(e) {
                    A.setIndex(e)
                }
                ));
                o.push(s)
            }
            return V(A, e),
            function(A, e, t) {
                var i = e.attributes
                  , o = new aA;
                if (void 0 !== i.POSITION) {
                    var n = (h = t.json.accessors[i.POSITION]).max;
                    if (void 0 !== (d = h.min) && void 0 !== n) {
                        o.set(new y(d[0],d[1],d[2]), new y(n[0],n[1],n[2]));
                        var r = e.targets;
                        if (void 0 !== r)
                            for (var a = new y, s = 0, l = r.length; l > s; s++) {
                                var c = r[s];
                                if (void 0 !== c.POSITION) {
                                    var h, d;
                                    n = (h = t.json.accessors[c.POSITION]).max;
                                    void 0 !== (d = h.min) && void 0 !== n ? (a.setX(Math.max(Math.abs(d[0]), Math.abs(n[0]))),
                                    a.setY(Math.max(Math.abs(d[1]), Math.abs(n[1]))),
                                    a.setZ(Math.max(Math.abs(d[2]), Math.abs(n[2]))),
                                    o.expandByVector(a)) : console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")
                                }
                            }
                        A.boundingBox = o;
                        var p = new cA;
                        o.getCenter(p.center),
                        p.radius = o.min.distanceTo(o.max) / 2,
                        A.boundingSphere = p
                    } else
                        console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")
                }
            }(A, e, t),
            Promise.all(o).then((function() {
                return void 0 !== e.targets ? function(A, e, t) {
                    for (var i = !1, o = !1, n = 0, r = e.length; r > n; n++) {
                        if (void 0 !== (l = e[n]).POSITION && (i = !0),
                        void 0 !== l.NORMAL && (o = !0),
                        i && o)
                            break
                    }
                    if (!i && !o)
                        return Promise.resolve(A);
                    var a = []
                      , s = [];
                    for (n = 0,
                    r = e.length; r > n; n++) {
                        var l = e[n];
                        if (i) {
                            var c = void 0 !== l.POSITION ? t.getDependency("accessor", l.POSITION) : A.attributes.position;
                            a.push(c)
                        }
                        if (o) {
                            c = void 0 !== l.NORMAL ? t.getDependency("accessor", l.NORMAL) : A.attributes.normal;
                            s.push(c)
                        }
                    }
                    return Promise.all([Promise.all(a), Promise.all(s)]).then((function(e) {
                        var t = e[1];
                        return i && (A.morphAttributes.position = e[0]),
                        o && (A.morphAttributes.normal = t),
                        A.morphTargetsRelative = !0,
                        A
                    }
                    ))
                }(A, e.targets, t) : A
            }
            ))
        }
        function Y(A, e) {
            var t = A.getIndex();
            if (null === t) {
                var i = []
                  , o = A.getAttribute("position");
                if (void 0 === o)
                    return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),
                    A;
                for (var n = 0; o.count > n; n++)
                    i.push(n);
                A.setIndex(i),
                t = A.getIndex()
            }
            var r = t.count - 2
              , a = [];
            if (2 === e)
                for (n = 1; r >= n; n++)
                    a.push(t.getX(0)),
                    a.push(t.getX(n)),
                    a.push(t.getX(n + 1));
            else
                for (n = 0; r > n; n++)
                    n % 2 == 0 ? (a.push(t.getX(n)),
                    a.push(t.getX(n + 1)),
                    a.push(t.getX(n + 2))) : (a.push(t.getX(n + 2)),
                    a.push(t.getX(n + 1)),
                    a.push(t.getX(n)));
            a.length / 3 !== r && console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
            var s = A.clone();
            return s.setIndex(a),
            s
        }
        return q.prototype.parse = function(A, e) {
            var t = this
              , i = this.json
              , o = this.extensions;
            this.cache.removeAll(),
            this.markDefs(),
            Promise.all([this.getDependencies("scene"), this.getDependencies("animation"), this.getDependencies("camera")]).then((function(e) {
                var n = {
                    scene: e[0][i.scene || 0],
                    scenes: e[0],
                    animations: e[1],
                    cameras: e[2],
                    asset: i.asset,
                    parser: t,
                    userData: {}
                };
                O(o, n, i),
                V(n, i),
                A(n)
            }
            )).catch(e)
        }
        ,
        q.prototype.markDefs = function() {
            for (var A = this.json.nodes || [], e = this.json.skins || [], t = this.json.meshes || [], i = {}, o = {}, n = 0, r = e.length; r > n; n++)
                for (var a = e[n].joints, s = 0, l = a.length; l > s; s++)
                    A[a[s]].isBone = !0;
            for (var c = 0, h = A.length; h > c; c++) {
                var d = A[c];
                void 0 !== d.mesh && (void 0 === i[d.mesh] && (i[d.mesh] = o[d.mesh] = 0),
                i[d.mesh]++,
                void 0 !== d.skin && (t[d.mesh].isSkinnedMesh = !0))
            }
            this.json.meshReferences = i,
            this.json.meshUses = o
        }
        ,
        q.prototype.getDependency = function(A, e) {
            var i = A + ":" + e
              , o = this.cache.get(i);
            if (!o) {
                switch (A) {
                case "scene":
                    o = this.loadScene(e);
                    break;
                case "node":
                    o = this.loadNode(e);
                    break;
                case "mesh":
                    o = this.loadMesh(e);
                    break;
                case "accessor":
                    o = this.loadAccessor(e);
                    break;
                case "bufferView":
                    o = this.loadBufferView(e);
                    break;
                case "buffer":
                    o = this.loadBuffer(e);
                    break;
                case "material":
                    o = this.loadMaterial(e);
                    break;
                case "texture":
                    o = this.loadTexture(e);
                    break;
                case "skin":
                    o = this.loadSkin(e);
                    break;
                case "animation":
                    o = this.loadAnimation(e);
                    break;
                case "camera":
                    o = this.loadCamera(e);
                    break;
                case "light":
                    o = this.extensions[t.KHR_LIGHTS_PUNCTUAL].loadLight(e);
                    break;
                default:
                    throw new Error("Unknown type: " + A)
                }
                this.cache.add(i, o)
            }
            return o
        }
        ,
        q.prototype.getDependencies = function(A) {
            var e = this.cache.get(A);
            if (!e) {
                var t = this;
                e = Promise.all((this.json[A + ("mesh" === A ? "es" : "s")] || []).map((function(e, i) {
                    return t.getDependency(A, i)
                }
                ))),
                this.cache.add(A, e)
            }
            return e
        }
        ,
        q.prototype.loadBuffer = function(A) {
            var e = this.json.buffers[A]
              , i = this.fileLoader;
            if (e.type && "arraybuffer" !== e.type)
                throw new Error("THREE.GLTFLoader: " + e.type + " buffer type is not supported.");
            if (void 0 === e.uri && 0 === A)
                return Promise.resolve(this.extensions[t.KHR_BINARY_GLTF].body);
            var o = this.options;
            return new Promise((function(A, t) {
                i.load(N(e.uri, o.path), A, void 0, (function() {
                    t(new Error('THREE.GLTFLoader: Failed to load buffer "' + e.uri + '".'))
                }
                ))
            }
            ))
        }
        ,
        q.prototype.loadBufferView = function(A) {
            var e = this.json.bufferViews[A];
            return this.getDependency("buffer", e.buffer).then((function(A) {
                var t = e.byteOffset || 0;
                return A.slice(t, t + (e.byteLength || 0))
            }
            ))
        }
        ,
        q.prototype.loadAccessor = function(A) {
            var e = this
              , t = this.json
              , i = this.json.accessors[A];
            if (void 0 === i.bufferView && void 0 === i.sparse)
                return Promise.resolve(null);
            var o = [];
            return o.push(void 0 !== i.bufferView ? this.getDependency("bufferView", i.bufferView) : null),
            void 0 !== i.sparse && (o.push(this.getDependency("bufferView", i.sparse.indices.bufferView)),
            o.push(this.getDependency("bufferView", i.sparse.values.bufferView))),
            Promise.all(o).then((function(A) {
                var o, n = A[0], r = F[i.type], a = w[i.componentType], s = a.BYTES_PER_ELEMENT, l = i.byteOffset || 0, c = void 0 !== i.bufferView ? t.bufferViews[i.bufferView].byteStride : void 0, h = !0 === i.normalized;
                if (c && c !== s * r) {
                    var d = Math.floor(l / c)
                      , p = "InterleavedBuffer:" + i.bufferView + ":" + i.componentType + ":" + d + ":" + i.count
                      , g = e.cache.get(p);
                    g || (g = new to(new a(n,d * c,i.count * c / s),c / s),
                    e.cache.add(p, g)),
                    o = new no(g,r,l % c / s,h)
                } else
                    o = new YA(null === n ? new a(i.count * r) : new a(n,l,i.count * r),r,h);
                if (void 0 !== i.sparse) {
                    var u = i.sparse.values.byteOffset || 0
                      , f = new (0,
                    w[i.sparse.indices.componentType])(A[1],i.sparse.indices.byteOffset || 0,i.sparse.count * F.SCALAR)
                      , m = new a(A[2],u,i.sparse.count * r);
                    null !== n && (o = new YA(o.array.slice(),o.itemSize,o.normalized));
                    for (var C = 0, y = f.length; y > C; C++) {
                        var v = f[C];
                        if (o.setX(v, m[C * r]),
                        2 > r || o.setY(v, m[C * r + 1]),
                        3 > r || o.setZ(v, m[C * r + 2]),
                        4 > r || o.setW(v, m[C * r + 3]),
                        r >= 5)
                            throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")
                    }
                }
                return o
            }
            ))
        }
        ,
        q.prototype.loadTexture = function(A) {
            var e, i = this, o = this.json, n = this.options, r = this.textureLoader, a = window.URL || window.webkitURL, s = o.textures[A], l = s.extensions || {}, c = (e = l[t.MSFT_TEXTURE_DDS] ? o.images[l[t.MSFT_TEXTURE_DDS].source] : o.images[s.source]).uri, h = !1;
            return void 0 !== e.bufferView && (c = i.getDependency("bufferView", e.bufferView).then((function(A) {
                h = !0;
                var t = new Blob([A],{
                    type: e.mimeType
                });
                return c = a.createObjectURL(t)
            }
            ))),
            Promise.resolve(c).then((function(A) {
                var e = n.manager.getHandler(A);
                return e || (e = l[t.MSFT_TEXTURE_DDS] ? i.extensions[t.MSFT_TEXTURE_DDS].ddsLoader : r),
                new Promise((function(t, i) {
                    e.load(N(A, n.path), t, void 0, i)
                }
                ))
            }
            )).then((function(A) {
                !0 === h && a.revokeObjectURL(c),
                A.flipY = !1,
                s.name && (A.name = s.name),
                e.mimeType in L && (A.format = L[e.mimeType]);
                var t = (o.samplers || {})[s.sampler] || {};
                return A.magFilter = b[t.magFilter] || 1006,
                A.minFilter = b[t.minFilter] || 1008,
                A.wrapS = U[t.wrapS] || 1e3,
                A.wrapT = U[t.wrapT] || 1e3,
                A
            }
            ))
        }
        ,
        q.prototype.assignTexture = function(A, e, i) {
            var o = this;
            return this.getDependency("texture", i.index).then((function(n) {
                if (!n.isCompressedTexture)
                    switch (e) {
                    case "aoMap":
                    case "emissiveMap":
                    case "metalnessMap":
                    case "normalMap":
                    case "roughnessMap":
                        n.format = 1022
                    }
                if (void 0 === i.texCoord || 0 == i.texCoord || "aoMap" === e && 1 == i.texCoord || console.warn("THREE.GLTFLoader: Custom UV set " + i.texCoord + " for texture " + e + " not yet supported."),
                o.extensions[t.KHR_TEXTURE_TRANSFORM]) {
                    var r = void 0 !== i.extensions ? i.extensions[t.KHR_TEXTURE_TRANSFORM] : void 0;
                    r && (n = o.extensions[t.KHR_TEXTURE_TRANSFORM].extendTexture(n, r))
                }
                A[e] = n
            }
            ))
        }
        ,
        q.prototype.assignFinalMaterial = function(A) {
            var e = A.geometry
              , t = A.material
              , i = void 0 !== e.attributes.tangent
              , o = void 0 !== e.attributes.color
              , n = void 0 === e.attributes.normal
              , r = !0 === A.isSkinnedMesh
              , a = Object.keys(e.morphAttributes).length > 0
              , s = a && void 0 !== e.morphAttributes.normal;
            if (A.isPoints) {
                var l = this.cache.get(h = "PointsMaterial:" + t.uuid);
                l || (l = new Yo,
                qA.prototype.copy.call(l, t),
                l.color.copy(t.color),
                l.map = t.map,
                l.sizeAttenuation = !1,
                this.cache.add(h, l)),
                t = l
            } else if (A.isLine) {
                var c = this.cache.get(h = "LineBasicMaterial:" + t.uuid);
                c || (c = new ko,
                qA.prototype.copy.call(c, t),
                c.color.copy(t.color),
                this.cache.add(h, c)),
                t = c
            }
            if (i || o || n || r || a) {
                var h = "ClonedMaterial:" + t.uuid + ":";
                t.isGLTFSpecularGlossinessMaterial && (h += "specular-glossiness:"),
                r && (h += "skinning:"),
                i && (h += "vertex-tangents:"),
                o && (h += "vertex-colors:"),
                n && (h += "flat-shading:"),
                a && (h += "morph-targets:"),
                s && (h += "morph-normals:");
                var d = this.cache.get(h);
                d || (d = t.clone(),
                r && (d.skinning = !0),
                i && (d.vertexTangents = !0),
                o && (d.vertexColors = !0),
                n && (d.flatShading = !0),
                a && (d.morphTargets = !0),
                s && (d.morphNormals = !0),
                this.cache.add(h, d)),
                t = d
            }
            t.aoMap && void 0 === e.attributes.uv2 && void 0 !== e.attributes.uv && e.setAttribute("uv2", new YA(e.attributes.uv.array,2)),
            t.normalScale && !i && (t.normalScale.y = -t.normalScale.y),
            A.material = t
        }
        ,
        q.prototype.loadMaterial = function(A) {
            var e, i = this.extensions, o = this.json.materials[A], n = {}, r = o.extensions || {}, a = [];
            if (r[t.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) {
                var l = i[t.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];
                e = l.getMaterialType(),
                a.push(l.extendParams(n, o, this))
            } else if (r[t.KHR_MATERIALS_UNLIT]) {
                var c = i[t.KHR_MATERIALS_UNLIT];
                e = c.getMaterialType(),
                a.push(c.extendParams(n, o, this))
            } else {
                e = yr;
                var h = o.pbrMetallicRoughness || {};
                if (n.color = new LA(1,1,1),
                n.opacity = 1,
                Array.isArray(h.baseColorFactor)) {
                    var d = h.baseColorFactor;
                    n.color.fromArray(d),
                    n.opacity = d[3]
                }
                void 0 !== h.baseColorTexture && a.push(this.assignTexture(n, "map", h.baseColorTexture)),
                n.metalness = void 0 !== h.metallicFactor ? h.metallicFactor : 1,
                n.roughness = void 0 !== h.roughnessFactor ? h.roughnessFactor : 1,
                void 0 !== h.metallicRoughnessTexture && (a.push(this.assignTexture(n, "metalnessMap", h.metallicRoughnessTexture)),
                a.push(this.assignTexture(n, "roughnessMap", h.metallicRoughnessTexture)))
            }
            !0 === o.doubleSided && (n.side = 2);
            var p = o.alphaMode || T;
            return p === D ? (n.transparent = !0,
            n.depthWrite = !1) : (n.transparent = !1,
            p === k && (n.alphaTest = void 0 !== o.alphaCutoff ? o.alphaCutoff : .5)),
            void 0 !== o.normalTexture && e !== jA && (a.push(this.assignTexture(n, "normalMap", o.normalTexture)),
            n.normalScale = new s(1,1),
            void 0 !== o.normalTexture.scale && n.normalScale.set(o.normalTexture.scale, o.normalTexture.scale)),
            void 0 !== o.occlusionTexture && e !== jA && (a.push(this.assignTexture(n, "aoMap", o.occlusionTexture)),
            void 0 !== o.occlusionTexture.strength && (n.aoMapIntensity = o.occlusionTexture.strength)),
            void 0 !== o.emissiveFactor && e !== jA && (n.emissive = (new LA).fromArray(o.emissiveFactor)),
            void 0 !== o.emissiveTexture && e !== jA && a.push(this.assignTexture(n, "emissiveMap", o.emissiveTexture)),
            Promise.all(a).then((function() {
                var A;
                return A = e === g ? i[t.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(n) : new e(n),
                o.name && (A.name = o.name),
                A.map && (A.map.encoding = 3001),
                A.emissiveMap && (A.emissiveMap.encoding = 3001),
                V(A, o),
                o.extensions && O(i, A, o),
                A
            }
            ))
        }
        ,
        q.prototype.loadGeometries = function(A) {
            var e = this
              , i = this.extensions
              , o = this.primitiveCache;
            function n(A) {
                return i[t.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(A, e).then((function(t) {
                    return j(t, A, e)
                }
                ))
            }
            for (var r, a, s = [], l = 0, c = A.length; c > l; l++) {
                var h, d = A[l], p = (a = void 0,
                (a = (r = d).extensions && r.extensions[t.KHR_DRACO_MESH_COMPRESSION]) ? "draco:" + a.bufferView + ":" + a.indices + ":" + P(a.attributes) : r.indices + ":" + P(r.attributes) + ":" + r.mode), g = o[p];
                if (g)
                    s.push(g.promise);
                else
                    h = d.extensions && d.extensions[t.KHR_DRACO_MESH_COMPRESSION] ? n(d) : j(new he, d, e),
                    o[p] = {
                        primitive: d,
                        promise: h
                    },
                    s.push(h)
            }
            return Promise.all(s)
        }
        ,
        q.prototype.loadMesh = function(A) {
            for (var e, t = this, i = this.json.meshes[A], o = i.primitives, n = [], r = 0, a = o.length; a > r; r++) {
                var s = void 0 === o[r].material ? (void 0 === (e = this.cache).DefaultMaterial && (e.DefaultMaterial = new yr({
                    color: 16777215,
                    emissive: 0,
                    metalness: 1,
                    roughness: 1,
                    transparent: !1,
                    depthTest: !0,
                    side: 0
                })),
                e.DefaultMaterial) : this.getDependency("material", o[r].material);
                n.push(s)
            }
            return n.push(t.loadGeometries(o)),
            Promise.all(n).then((function(e) {
                for (var n = e.slice(0, e.length - 1), r = e[e.length - 1], a = [], s = 0, l = r.length; l > s; s++) {
                    var c, h = r[s], d = o[s], p = n[s];
                    if (d.mode === B || d.mode === x || d.mode === S || void 0 === d.mode)
                        !0 !== (c = !0 === i.isSkinnedMesh ? new So(h,p) : new Ue(h,p)).isSkinnedMesh || c.geometry.attributes.skinWeight.normalized || c.normalizeSkinWeights(),
                        d.mode === x ? c.geometry = Y(c.geometry, 1) : d.mode === S && (c.geometry = Y(c.geometry, 2));
                    else if (d.mode === v)
                        c = new jo(h,p);
                    else if (d.mode === E)
                        c = new Go(h,p);
                    else if (d.mode === I)
                        c = new Ho(h,p);
                    else {
                        if (d.mode !== C)
                            throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + d.mode);
                        c = new Xo(h,p)
                    }
                    Object.keys(c.geometry.morphAttributes).length > 0 && G(c, i),
                    c.name = i.name || "mesh_" + A,
                    r.length > 1 && (c.name += "_" + s),
                    V(c, i),
                    t.assignFinalMaterial(c),
                    a.push(c)
                }
                if (1 === a.length)
                    return a[0];
                var g = new Xi;
                for (s = 0,
                l = a.length; l > s; s++)
                    g.add(a[s]);
                return g
            }
            ))
        }
        ,
        q.prototype.loadCamera = function(A) {
            var e, t = this.json.cameras[A], i = t[t.type];
            if (i)
                return "perspective" === t.type ? e = new je(a.radToDeg(i.yfov),i.aspectRatio || 1,i.znear || 1,i.zfar || 2e6) : "orthographic" === t.type && (e = new Ka(i.xmag / -2,i.xmag / 2,i.ymag / 2,i.ymag / -2,i.znear,i.zfar)),
                t.name && (e.name = t.name),
                V(e, t),
                Promise.resolve(e);
            console.warn("THREE.GLTFLoader: Missing camera parameters.")
        }
        ,
        q.prototype.loadSkin = function(A) {
            var e = this.json.skins[A]
              , t = {
                joints: e.joints
            };
            return void 0 === e.inverseBindMatrices ? Promise.resolve(t) : this.getDependency("accessor", e.inverseBindMatrices).then((function(A) {
                return t.inverseBindMatrices = A,
                t
            }
            ))
        }
        ,
        q.prototype.loadAnimation = function(A) {
            for (var e = this.json.animations[A], t = [], i = [], o = [], n = [], r = [], a = 0, s = e.channels.length; s > a; a++) {
                var l = e.channels[a]
                  , c = e.samplers[l.sampler]
                  , h = l.target
                  , d = void 0 !== e.parameters ? e.parameters[c.input] : c.input
                  , p = void 0 !== e.parameters ? e.parameters[c.output] : c.output;
                t.push(this.getDependency("node", void 0 !== h.node ? h.node : h.id)),
                i.push(this.getDependency("accessor", d)),
                o.push(this.getDependency("accessor", p)),
                n.push(c),
                r.push(h)
            }
            return Promise.all([Promise.all(t), Promise.all(i), Promise.all(o), Promise.all(n), Promise.all(r)]).then((function(t) {
                for (var i = t[0], o = t[1], n = t[2], r = t[3], a = t[4], s = [], l = 0, c = i.length; c > l; l++) {
                    var h = i[l]
                      , d = o[l]
                      , p = n[l]
                      , g = r[l]
                      , u = a[l];
                    if (void 0 !== h) {
                        var f;
                        switch (h.updateMatrix(),
                        h.matrixAutoUpdate = !0,
                        Q[u.path]) {
                        case Q.weights:
                            f = Dr;
                            break;
                        case Q.rotation:
                            f = Nr;
                            break;
                        case Q.position:
                        case Q.scale:
                        default:
                            f = Vr
                        }
                        var C = h.name ? h.name : h.uuid
                          , y = void 0 !== g.interpolation ? R[g.interpolation] : 2301
                          , v = [];
                        Q[u.path] === Q.weights ? h.traverse((function(A) {
                            !0 === A.isMesh && A.morphTargetInfluences && v.push(A.name ? A.name : A.uuid)
                        }
                        )) : v.push(C);
                        var I = p.array;
                        if (p.normalized) {
                            var E;
                            if (I.constructor === Int8Array)
                                E = 1 / 127;
                            else if (I.constructor === Uint8Array)
                                E = 1 / 255;
                            else if (I.constructor == Int16Array)
                                E = 1 / 32767;
                            else {
                                if (I.constructor !== Uint16Array)
                                    throw new Error("THREE.GLTFLoader: Unsupported output accessor component type.");
                                E = 1 / 65535
                            }
                            for (var B = new Float32Array(I.length), x = 0, S = I.length; S > x; x++)
                                B[x] = I[x] * E;
                            I = B
                        }
                        for (x = 0,
                        S = v.length; S > x; x++) {
                            var w = new f(v[x] + "." + Q[u.path],d.array,I,y);
                            "CUBICSPLINE" === g.interpolation && (w.createInterpolant = function(A) {
                                return new m(this.times,this.values,this.getValueSize() / 3,A)
                            }
                            ,
                            w.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0),
                            s.push(w)
                        }
                    }
                }
                return new Gr(e.name ? e.name : "animation_" + A,void 0,s)
            }
            ))
        }
        ,
        q.prototype.loadNode = function(A) {
            var e, i = this.json, o = this.extensions, n = this, r = i.meshReferences, a = i.meshUses, s = i.nodes[A];
            return (e = [],
            void 0 !== s.mesh && e.push(n.getDependency("mesh", s.mesh).then((function(A) {
                var e;
                if (r[s.mesh] > 1) {
                    var t = a[s.mesh]++;
                    (e = A.clone()).name += "_instance_" + t
                } else
                    e = A;
                return void 0 !== s.weights && e.traverse((function(A) {
                    if (A.isMesh)
                        for (var e = 0, t = s.weights.length; t > e; e++)
                            A.morphTargetInfluences[e] = s.weights[e]
                }
                )),
                e
            }
            ))),
            void 0 !== s.camera && e.push(n.getDependency("camera", s.camera)),
            s.extensions && s.extensions[t.KHR_LIGHTS_PUNCTUAL] && void 0 !== s.extensions[t.KHR_LIGHTS_PUNCTUAL].light && e.push(n.getDependency("light", s.extensions[t.KHR_LIGHTS_PUNCTUAL].light)),
            Promise.all(e)).then((function(A) {
                var e;
                if ((e = !0 === s.isBone ? new Uo : A.length > 1 ? new Xi : 1 === A.length ? A[0] : new H) !== A[0])
                    for (var t = 0, i = A.length; i > t; t++)
                        e.add(A[t]);
                if (s.name && (e.userData.name = s.name,
                e.name = Fs.sanitizeNodeName(s.name)),
                V(e, s),
                s.extensions && O(o, e, s),
                void 0 !== s.matrix) {
                    var n = new M;
                    n.fromArray(s.matrix),
                    e.applyMatrix4(n)
                } else
                    void 0 !== s.translation && e.position.fromArray(s.translation),
                    void 0 !== s.rotation && e.quaternion.fromArray(s.rotation),
                    void 0 !== s.scale && e.scale.fromArray(s.scale);
                return e
            }
            ))
        }
        ,
        q.prototype.loadScene = function() {
            function A(e, t, i, o) {
                var n = i.nodes[e];
                return o.getDependency("node", e).then((function(A) {
                    return void 0 === n.skin ? A : o.getDependency("skin", n.skin).then((function(A) {
                        for (var t = [], i = 0, n = (e = A).joints.length; n > i; i++)
                            t.push(o.getDependency("node", e.joints[i]));
                        return Promise.all(t)
                    }
                    )).then((function(t) {
                        return A.traverse((function(A) {
                            if (A.isMesh) {
                                for (var i = [], o = [], n = 0, r = t.length; r > n; n++) {
                                    var a = t[n];
                                    if (a) {
                                        i.push(a);
                                        var s = new M;
                                        void 0 !== e.inverseBindMatrices && s.fromArray(e.inverseBindMatrices.array, 16 * n),
                                        o.push(s)
                                    } else
                                        console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', e.joints[n])
                                }
                                A.bind(new bo(i,o), A.matrixWorld)
                            }
                        }
                        )),
                        A
                    }
                    ));
                    var e
                }
                )).then((function(e) {
                    t.add(e);
                    var r = [];
                    if (n.children)
                        for (var a = n.children, s = 0, l = a.length; l > s; s++) {
                            r.push(A(a[s], e, i, o))
                        }
                    return Promise.all(r)
                }
                ))
            }
            return function(e) {
                var t = this.json
                  , i = this.extensions
                  , o = this.json.scenes[e]
                  , n = new Xi;
                o.name && (n.name = o.name),
                V(n, o),
                o.extensions && O(i, n, o);
                for (var r = o.nodes || [], a = [], s = 0, l = r.length; l > s; s++)
                    a.push(A(r[s], n, t, this));
                return Promise.all(a).then((function() {
                    return n
                }
                ))
            }
        }(),
        A
    }()
      , VC = "REPLACE"
      , GC = function A(e, t, i, o) {
        H.call(this);
        if (this.isRoot = o || !1,
        o || (this.matrix = kC.getTransfrom(i.transform)),
        this.refine = i.refine || VC,
        this.geometricError = i.geometricError || 0,
        this.boundingBox = kC.getBoxFromTileBoundingVolumeBox(i.boundingVolume.box),
        this.scene = null,
        this.model = e,
        this.json = i,
        this.level = t && t.level + 1 || 0,
        this.matrixAutoUpdate = !1,
        this.hasB3DM = !1,
        i.content && (i.content.url.endsWith("json") ? this.loadContent(i.content.url) : i.content.url.endsWith("b3dm") && (this.hasB3DM = !0,
        this.model.tilesList[i.content.url] = this,
        t && t.hasB3DM || (this.firstB3DM = !0,
        this.loadB3DM(i.content.url)))),
        i.children)
            for (var n = 0, r = i.children.length; r > n; n += 1)
                this.add(new A(e,this,i.children[n]))
    };
    (GC.prototype = Object.create(H.prototype)).loadContent = function(A) {
        var e = this
          , t = e.model
          , i = t.dataUrl.tilesUrl(A);
        function o() {
            var A = t.fileLoader;
            A.setResponseType("json"),
            A.setCacheViable(!0),
            A.setRequestHeader({
                Authorization: t.accessToken
            }),
            A.load(i, (function(A) {
                var i = {};
                if ("string" == typeof A)
                    try {
                        i = JSON.parse(A)
                    } catch (A) {
                        return void t.dispatchEventEx({
                            type: Rc.ON_LOAD_INVALID_DATA,
                            modelKey: t.modelKey
                        })
                    }
                else
                    i = A;
                e.add(new GC(t,parent,i.root,parent.level + 1,!0))
            }
            ), (function(A, e) {
                switch (A) {
                case 401:
                    t.dispatchEventEx({
                        type: Rc.ACCOUNT_NO_EXIST,
                        modelKey: t.modelKey,
                        data: e
                    });
                    break;
                case 403:
                    t.dispatchEventEx({
                        type: Rc.NO_PERMISSION,
                        modelKey: t.modelKey,
                        data: e
                    });
                    break;
                default:
                    t.dispatchEventEx({
                        type: Rc.ON_NETWORK_ERROR,
                        modelKey: t.modelKey,
                        data: A
                    })
                }
            }
            ))
        }
        if (vc.getDataFromIndexedDB) {
            var n = t.getStorage();
            n && n.get(i, (function(A) {
                if (A) {
                    var i = {};
                    if ("string" == typeof A)
                        try {
                            i = JSON.parse(A)
                        } catch (A) {
                            return void t.dispatchEventEx({
                                type: Rc.ON_LOAD_INVALID_DATA,
                                modelKey: t.modelKey
                            })
                        }
                    else
                        i = A;
                    e.add(new GC(t,parent,i.root,!0))
                } else
                    o()
            }
            ), (function() {
                o()
            }
            ))
        } else
            o()
    }
    ,
    GC.prototype.loadB3DM = function(A) {
        var e = this
          , t = e.model;
        e.loaderManager = new wu,
        e.loaderManager.model = t;
        var i = new OC(e.loaderManager);
        function o(A) {
            e.scene = A,
            e.loading = !1,
            e.loaded = !0,
            e.add(A.scene),
            t.tileLoadFinish()
        }
        e.loading = !0;
        var n = t.dataUrl.b3dmUrl(A || e.json.content.url);
        if (vc.getDataFromIndexedDB) {
            var r = t.getStorage();
            r && r.get(n, (function(t) {
                t ? i.parse(t, A || e.json.content.url, o) : i.load(n, o)
            }
            ), (function() {
                i.load(n, o)
            }
            ))
        } else
            i.load(n, o)
    }
    ;
    var PC = function(A, e, t, i) {
        TC.call(this, A, e, t, i),
        this.configLoader = new DC(this),
        this.tilesList = {},
        this.isTilesModel = !0
    };
    (PC.prototype = Object.create(TC.prototype)).load = function(A) {
        var e = this;
        this.configLoader.load((function() {
            e.parseCfgFinish && e.parseCfgFinish(),
            e.manager.updateScene(),
            e.group.add(new GC(e,null,e.configLoader.config.root,!0)),
            e.loaded = !0
        }
        ))
    }
    ,
    PC.prototype.tileLoadStart = function() {}
    ,
    PC.prototype.tileLoadFinish = function() {
        this.group.updateMatrixWorld(!0, !0),
        this.manager.viewerImpl.render()
    }
    ,
    PC.prototype.tileUnloadStart = function() {}
    ,
    PC.prototype.tileUnloadFinish = function() {}
    ,
    PC.prototype.checkTilesDataChanged = function(A) {
        for (var e in Bh.time("checkTilesDataChanged"),
        this.tilesList)
            if (this.tilesList.hasOwnProperty(e)) {
                var t = this.tilesList[e];
                this.tilesNeedLoad(t.boundingBox.getCenter((new y).applyMatrix4(t.parent.matrixWorld).applyMatrix4(t.matrix)), t.boundingBox.getSize(new y).length()) || t.firstB3DM ? t.scene || t.loading ? t.visible = !0 : t.loadB3DM() : A ? (t.remove(t.scene),
                t.scene = null) : t.visible = !1
            }
        Bh.timeEnd("checkTilesDataChanged")
    }
    ,
    PC.prototype.tilesNeedLoad = function(A, e) {
        var t, i = this.manager.cameraFov;
        return t = (e || 0) * this.manager.domElementWidth / (2 * this.manager.cameraPosition.clone().sub(A).length() * Math.tan(i / 2)),
        Bh.debug("几何误差：", t),
        t > vc.geometricErrorThresholdValue
    }
    ;
    var qC = function() {
        this.size = 0,
        this.counter = 0,
        this.expansion = 1,
        this._pool = null
    };
    qC.prototype.init = function(A, e) {
        this.classType = A,
        this._pool = [],
        this._expand(e)
    }
    ,
    qC.prototype._expand = function(A) {
        this.size += A;
        for (var e = 0; A > e; e += 1)
            this._pool.push(new this.classType)
    }
    ,
    qC.prototype.acquire = function() {
        return this.size > this.counter || (this.expansion = Math.round(1.2 * this.expansion) + 1,
        this._expand(this.expansion)),
        this._pool[this.counter++]
    }
    ,
    qC.prototype.clear = function() {
        this.counter = 0
    }
    ,
    qC.prototype.destroy = function() {
        for (var A = 0, e = this.size; e > A; A += 1)
            this._pool[A].destroy();
        this.counter = 0,
        this.size = 0,
        this.expansion = 1,
        this._pool = null
    }
    ,
    qC.prototype.getObjects = function() {
        return this._pool
    }
    ;
    var jC = function(A) {
        Pe.call(this),
        this.type = "PhoneLightingMaterial",
        this.color = new LA(16777215),
        this.specular = new LA(1118481),
        this.shininess = 30,
        this.emissive = new LA(0),
        this.map = null,
        this.shadowMapEnabled = !1,
        this.defines = {},
        this.uniforms = Ge.merge([Xe.common, Xe.lights, {
            diffuse: {
                value: new LA(16711680)
            },
            opacity: {
                value: 1
            },
            specular: {
                value: new LA(1118481)
            },
            shininess: {
                value: 30
            },
            emissive: {
                value: new LA(0)
            }
        }]),
        this.vertexShader = ["varying vec3 vViewPosition;", "varying vec3 vNormal;", "#include <uv_pars_vertex>", "void main() {", "   #include <uv_vertex>", "   #include <begin_vertex>", "   #include <project_vertex>", "   #include <beginnormal_vertex>", "   #include <defaultnormal_vertex>", "   vNormal = normalize( transformedNormal );", "   vViewPosition = - mvPosition.xyz;", "}"].join("\n"),
        this.fragmentShader = ["uniform vec3 diffuse;", "uniform float opacity;", "uniform vec3 specular;", "uniform float shininess;", "uniform vec3 emissive;", "#include <common>", "#include <uv_pars_fragment>", "#include <map_pars_fragment>", "#include <packing>", "#include <bsdfs>", "#include <lights_pars_begin>", "#include <lights_phong_pars_fragment>", "#include <specularmap_pars_fragment>", "void main() {", "   vec4 diffuseColor = vec4( diffuse, opacity );", "#ifdef USE_MAP", "   vec4 texelColor = texture2D( map, vUv );", "   texelColor = mapTexelToLinear( texelColor );", "   diffuseColor = vec4(texelColor.rgb, opacity);", "#endif", "   ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );", "   vec3 totalEmissiveRadiance = emissive;", "   float specularStrength = 1.0;", "   #include <normal_flip>", "   #include <normal_fragment>", "   gl_FragColor = linearToOutputTexel( diffuseColor );", "}"].join("\n"),
        this.lights = !1,
        this.defaultAttributeValues = {
            color: [1, 1, 1],
            uv: [0, 0],
            uv2: [0, 0]
        },
        void 0 !== A && (void 0 !== A.attributes && console.error("PhoneLightingMaterial: attributes should now be defined in THREE.BufferGeometry instead."),
        this.setValues(A)),
        this.refreshUniforms()
    };
    (jC.prototype = Object.create(Pe.prototype)).constructor = jC,
    jC.prototype.isShaderMaterial = !0,
    jC.prototype.copy = function(A) {
        return Pe.prototype.copy.call(this, A),
        this.color.copy(A.color),
        this.specular.copy(A.specular),
        this.shininess = A.shininess,
        this.emissive.copy(A.emissive),
        this
    }
    ,
    jC.prototype.refreshUniforms = function() {
        this.uniforms.diffuse.value.set(this.color),
        this.uniforms.opacity.value = this.opacity,
        this.uniforms.specular.value.set(this.specular),
        this.uniforms.shininess.value = this.shininess,
        this.uniforms.emissive.value.set(this.emissive),
        this.uniforms.map.value = this.map
    }
    ;
    var HC = function(A, e) {
        ep.call(this, gp.CLIPPLANE, {
            priority: 20
        });
        var t = [];
        t.push("clipPlane_right"),
        t.push("clipPlane_left"),
        t.push("clipPlane_back"),
        t.push("clipPlane_front"),
        t.push("clipPlane_top"),
        t.push("clipPlane_bottom"),
        this.cubeSize = A.clone(),
        this.center = e.clone(),
        this.visible = !1,
        this.rotatable = !1,
        this.selectIndex = null,
        this.planeOffset = new Array(6),
        this.planeRotate = [0, 0, 0],
        this.observer = null,
        this.uniforms = {
            iClipPlane: {
                type: "i",
                value: 0
            },
            vClipPlane: {
                type: "v4v",
                value: [new p, new p, new p, new p, new p, new p]
            }
        },
        this.clipplanes = null,
        this.calculation = !0,
        this.boundingBox = new aA,
        this.calculateClipBoundingBox = function(A) {
            this.boundingBox.makeEmpty();
            for (var e = new y, t = 0; A.length > t; t += 1) {
                var i = A[t].coplanarPoint(e);
                0 !== i.x && (i.x > this.boundingBox.max.x ? this.boundingBox.max.x = i.x : this.boundingBox.min.x > i.x && (this.boundingBox.min.x = i.x)),
                0 !== i.y && (i.y > this.boundingBox.max.y ? this.boundingBox.max.y = i.y : this.boundingBox.min.y > i.y && (this.boundingBox.min.y = i.y)),
                0 !== i.z && (i.z > this.boundingBox.max.z ? this.boundingBox.max.z = i.z : this.boundingBox.min.z > i.z && (this.boundingBox.min.z = i.z))
            }
        }
        ,
        this.getClipBoundingBox = function() {
            return this.boundingBox
        }
        ,
        this.isVisible = function() {
            return this.visible
        }
        ,
        this.getPlaneNormal = function(A) {
            var e = new p
              , t = Math.floor(A / 2);
            return e.setComponent(t, Math.pow(-1, A % 2)),
            e.w = .5 * -this.cubeSize.getComponent(t),
            this.planeOffset[A] = 0,
            e
        }
        ,
        this.planeMaterial = new jC({
            color: 8158334,
            opacity: .3,
            transparent: !0,
            side: 0,
            lights: !1
        }),
        this.planeHighLightMatrial = new jC({
            color: 255,
            opacity: .3,
            transparent: !0,
            side: 0,
            lights: !1
        }),
        this.initPlaneModel = function(A) {
            var e = Math.floor(A / 2)
              , i = A % 2
              , o = new Ue(new et(0 === e ? this.cubeSize.z : this.cubeSize.x,1 === e ? this.cubeSize.z : this.cubeSize.y),this.planeMaterial);
            switch (o.name = t[A],
            o.customTag = !0,
            o.position.setComponent(e, Math.pow(-1, i) * this.cubeSize.getComponent(e) * .5),
            A) {
            case 0:
                o.rotation.y = .5 * Math.PI;
                break;
            case 1:
                o.rotation.y = .5 * -Math.PI;
                break;
            case 2:
                o.rotation.x = .5 * -Math.PI;
                break;
            case 3:
                o.rotation.x = .5 * Math.PI;
                break;
            case 4:
                break;
            case 5:
                o.rotation.x = Math.PI
            }
            o.renderOrder = 90,
            this.add(o)
        }
        ,
        this.initCapsBox = function() {
            if (this.boxMesh)
                return this.boxMesh;
            var A = new Ne(this.cubeSize.x,this.cubeSize.y,this.cubeSize.z);
            A.groups = null;
            var e = new Ue(A,new jC({
                color: 16776960,
                side: 2,
                stencilWrite: !0,
                stencilFunc: 515,
                stencilRef: 1,
                stencilFuncMask: 255,
                stencilFail: 7680,
                stencilZFail: 7680,
                stencilZPass: 7680
            }));
            return e.matrixWorld = this.matrixWorld,
            e.matrix = this.matrix,
            e.name = "capsBox",
            this.boxMesh = e,
            e
        }
        ,
        this.initWireframes = function() {
            var A = [.5 * -this.cubeSize.x, .5 * -this.cubeSize.y, .5 * -this.cubeSize.z, .5 * this.cubeSize.x, .5 * -this.cubeSize.y, .5 * -this.cubeSize.z, .5 * this.cubeSize.x, .5 * this.cubeSize.y, .5 * -this.cubeSize.z, .5 * -this.cubeSize.x, .5 * this.cubeSize.y, .5 * -this.cubeSize.z, .5 * -this.cubeSize.x, .5 * -this.cubeSize.y, .5 * this.cubeSize.z, .5 * this.cubeSize.x, .5 * -this.cubeSize.y, .5 * this.cubeSize.z, .5 * this.cubeSize.x, .5 * this.cubeSize.y, .5 * this.cubeSize.z, .5 * -this.cubeSize.x, .5 * this.cubeSize.y, .5 * this.cubeSize.z]
              , e = new he
              , t = new jC({
                color: 0,
                lights: !0
            });
            e.setIndex([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 3, 7, 1, 5, 2, 6]),
            e.setAttribute("position", new Ae(A,3)),
            e.setAttribute("color", new Ae([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],3)),
            e.computeBoundingSphere();
            var i = new jo(e,t);
            i.name = "Wireframes",
            i.customTag = !0,
            this.add(i)
        }
        ,
        this.updateClippingParams = function(A) {}
        ,
        this.enable = function(A, e) {
            this.visible = e,
            this.uniforms.iClipPlane.value = A ? 6 : 0,
            this.updateClippingParams(this.uniforms),
            this.boxMesh && (this.boxMesh.visible = e)
        }
        ,
        this.isEnabled = function() {
            return 0 !== this.uniforms.iClipPlane.value
        }
        ;
        var i = function(A, e, t, i, o, n, r, a, s, l, c, h) {
            this.enable = A,
            this.visible = e,
            this.rotatable = t,
            this.calculation = i,
            this.planeOffset = o.slice(0),
            this.planeRotate = n.slice(0),
            this.position = r,
            this.scale = a,
            this.quaternion = s,
            this.cubeSize = l,
            this.center = c,
            this.boundingBox = h
        };
        this.store = function() {
            return new i(!!this.uniforms.iClipPlane.value,this.visible,this.rotatable,this.calculation,this.planeOffset,this.planeRotate,this.position.clone(),this.scale.clone(),this.quaternion.clone(),this.cubeSize.clone(),this.center.clone(),this.boundingBox.clone())
        }
        ,
        this.restore = function(A) {
            this.calculation = !0,
            this.calculationPlanes(A.cubeSize, A.center),
            this.enable(A.enable, A.visible),
            this.rotatable = A.rotatable,
            this.calculation = A.calculation;
            for (var e = 0; 6 > e; e += 1)
                this.planeOffset[e] = A.planeOffset[e];
            for (var t = 0; 3 > t; t += 1)
                this.planeRotate[t] = A.planeRotate[t];
            this.position.copy(A.position),
            this.scale.copy(A.scale),
            this.quaternion._w = A.quaternion._w,
            this.quaternion._x = A.quaternion._x,
            this.quaternion._y = A.quaternion._y,
            this.quaternion._z = A.quaternion._z,
            this.update()
        }
        ,
        this.reset = function() {
            this.calculation = !0;
            for (var A = 0; 6 > A; A += 1)
                this.planeOffset[A] = 0;
            for (A = 0; 3 > A; A += 1)
                this.planeRotate[A] = 0;
            this.position.copy(this.center),
            this.scale.copy(new y(1,1,1)),
            this.quaternion.copy(new f),
            this.update()
        }
        ,
        this.calculationPlanes = function(A, e, t) {
            if (this.calculation || t) {
                this.cubeSize.copy(A),
                this.center.copy(e);
                for (var i = this.children.length - 1; i >= 0; i -= 1)
                    this.remove(this.children[i]);
                for (i = 0; 6 > i; i += 1)
                    this.uniforms.vClipPlane.value[i] = this.getPlaneNormal(i),
                    this.initPlaneModel(i);
                this.initWireframes(),
                this.clipplanes = this.uniforms.vClipPlane.value.slice(0),
                this.reset()
            }
        }
        ,
        this.update = function() {
            this.updateMatrixWorld();
            var A = new M;
            A.getInverse(this.matrix),
            A.transpose();
            for (var e = 0; 6 > e; e += 1)
                this.uniforms.vClipPlane.value[e] = this.clipplanes[e].clone().applyMatrix4(A);
            this.updateClippingParams(this.uniforms),
            this.observer && this.observer()
        }
        ,
        this.offset = function(A, e) {
            this.calculation = !1;
            var t = Math.floor(A / 2);
            this.cubeSize.getComponent(t);
            A % 2 == 0 && this.planeOffset[A] + e > 0 && (e = -this.planeOffset[A]),
            A % 2 == 1 && 0 > this.planeOffset[A] + e && (e = -this.planeOffset[A]),
            this.planeOffset[A] += e;
            for (var i = new y, o = 0; 6 > o; o += 1) {
                var n = this.clipplanes[o].clone()
                  , r = this.planeOffset[o]
                  , a = new y(n.x * r,n.y * r,n.z * r);
                i.add(a)
            }
            var s = 1 + i.getComponent(t) / this.cubeSize.getComponent(t);
            if ((s = 0 === s ? 1e-5 : s) > 0) {
                this.scale.setComponent(t, s);
                var l = this.uniforms.vClipPlane.value[A].clone()
                  , c = new y(l.x,l.y,l.z);
                c.normalize();
                var h = new y(c.x * (a = e),c.y * a,c.z * a);
                A % 2 == 1 ? this.position.sub(h.multiplyScalar(.5)) : this.position.add(h.multiplyScalar(.5)),
                this.update()
            } else
                this.planeOffset[A] -= e
        }
        ;
        var o = new f
          , n = new y(1,0,0);
        this.rotX = function(A) {
            this.calculation = !1,
            o.setFromAxisAngle(n, A),
            this.quaternion.multiply(o),
            this.update()
        }
        ;
        var r = new y(0,1,0);
        this.rotY = function(A) {
            this.calculation = !1,
            o.setFromAxisAngle(r, A),
            this.quaternion.multiply(o),
            this.update()
        }
        ,
        this.setSectionBox = function(A, e) {
            this.calculation = !0;
            var t = new y(e.x - A.x,e.y - A.y,e.z - A.z)
              , i = new y(.5 * (A.x + e.x),.5 * (A.y + e.y),.5 * (A.z + e.z));
            this.calculationPlanes(t, i)
        }
        ,
        this.calculateOffsetByBox = function(A, e) {
            var t = e.x - this.center.x - .5 * this.cubeSize.x;
            this.planeOffset[0] > t ? (this.moveSectionPlane("left", this.center.x - .5 * this.cubeSize.x - A.x),
            this.moveSectionPlane("right", t)) : (this.moveSectionPlane("right", t),
            this.moveSectionPlane("left", this.center.x - .5 * this.cubeSize.x - A.x));
            var i = e.y - this.center.y - .5 * this.cubeSize.y;
            this.planeOffset[2] > i ? (this.moveSectionPlane("bottom", this.center.y - .5 * this.cubeSize.y - A.y),
            this.moveSectionPlane("top", i)) : (this.moveSectionPlane("top", i),
            this.moveSectionPlane("bottom", this.center.y - .5 * this.cubeSize.y - A.y));
            var o = e.z - this.center.z - .5 * this.cubeSize.z;
            this.planeOffset[4] > o ? (this.moveSectionPlane("back", this.center.z - .5 * this.cubeSize.z - A.z),
            this.moveSectionPlane("front", o)) : (this.moveSectionPlane("front", o),
            this.moveSectionPlane("back", this.center.z - .5 * this.cubeSize.z - A.z))
        }
        ,
        this.getPlaneIndexByName = function(A) {
            var e = -1;
            return "right" === A ? e = 0 : "left" === A ? e = 1 : "top" === A ? e = 2 : "bottom" === A ? e = 3 : "front" === A ? e = 4 : "back" === A && (e = 5),
            e
        }
        ,
        this.moveSectionPlane = function(A, e) {
            var t = this.getPlaneIndexByName(A);
            -1 !== t && (t % 2 != 0 && (e = -e),
            this.offset(t, e - this.planeOffset[t]))
        }
        ,
        this.recalculate = function() {
            return this.filter.getVisibleComponentsBbox()
        }
        ,
        this.setProcess = function(A, e) {
            var t = this.getPlaneIndexByName(A)
              , i = 0;
            (2 > t ? i = this.cubeSize.x : 4 > t ? i = this.cubeSize.y : 6 > t && (i = this.cubeSize.z),
            e > 1 ? e = 1 : 0 > e && (e = 0),
            -1 !== t) && (t % 2 != 1 && (e = -e),
            this.offset(t, e * i - this.planeOffset[t]))
        }
        ,
        this.getProcess = function(A) {
            var e = this.getPlaneIndexByName(A);
            -1 === e && console.log("faceName is illegal");
            var t = 0;
            2 > e ? t = this.cubeSize.x : 4 > e ? t = this.cubeSize.y : 6 > e && (t = this.cubeSize.z);
            var i = 1;
            e % 2 != 1 && (i = -1);
            var o = i * this.planeOffset[e] / t;
            return o > 1 ? o = 1 : 0 > o && (o = 0),
            o
        }
        ;
        var a = new y(0,0,1);
        this.rotateSectionBox = function(A, e) {
            "x" === A ? this.planeRotate[0] = e : "y" === A ? this.planeRotate[1] = e : "z" === A && (this.planeRotate[2] = e),
            this.calculation = !0;
            var t = new f;
            t.setFromAxisAngle(n, this.planeRotate[0]);
            var i = new f;
            i.setFromAxisAngle(r, this.planeRotate[1]);
            var o = new f;
            o.setFromAxisAngle(a, this.planeRotate[2]);
            var s = new f;
            s.multiply(t),
            s.multiply(i),
            s.multiply(o),
            this.quaternion.copy(s),
            this.update()
        }
        ,
        this.highLight = function() {
            null !== this.selectIndex && (this.children[this.selectIndex].material = this.planeHighLightMatrial)
        }
        ,
        this.cancelHighLight = function() {
            null !== this.selectIndex && (this.children[this.selectIndex].material = this.planeMaterial,
            this.selectIndex = null)
        }
    };
    (HC.prototype = Object.create(ep.prototype)).constructor = HC,
    HC.prototype.init = function() {
        this.calculationPlanes(this.cubeSize, this.center)
    }
    ,
    HC.prototype.hitTest = function(A) {
        var e = null
          , t = null;
        if (this.raycast(A),
        null !== this.selectIndex) {
            var i = A.ray
              , o = new EA
              , n = this.uniforms.vClipPlane.value[this.selectIndex];
            o.setComponents(n.x, n.y, n.z, n.w),
            e = i.distanceToPlane(o),
            t = 0 > i.direction.dot(o.normal)
        }
        return {
            sign: t,
            distance: e
        }
    }
    ,
    HC.prototype.raycast = function(A) {
        if (this.visible) {
            var e = []
              , t = null;
            this.selectIndex = null;
            for (var i = 0; 6 > i; i += 1)
                if (this.children[i].raycast(A, e),
                e.length > 0) {
                    var o = e.pop();
                    t && o.distance >= t.distance || (t = o,
                    this.selectIndex = i),
                    e = []
                }
        }
    }
    ,
    Xe.line = {
        linewidth: {
            value: 1
        },
        resolution: {
            value: new s(1,1)
        },
        dashScale: {
            value: 1
        },
        dashSize: {
            value: 1
        },
        dashOffset: {
            value: 0
        },
        gapSize: {
            value: 1
        },
        opacity: {
            value: 1
        }
    },
    it.line = {
        uniforms: Ge.merge([Xe.common, Xe.fog, Xe.line]),
        vertexShader: "\n        #include <common>\n        #include <color_pars_vertex>\n        #include <fog_pars_vertex>\n        #include <logdepthbuf_pars_vertex>\n        #include <clipping_planes_pars_vertex>\n\n        uniform float linewidth;\n        uniform vec2 resolution;\n\n        attribute vec3 instanceStart;\n        attribute vec3 instanceEnd;\n\n        attribute vec3 instanceColorStart;\n        attribute vec3 instanceColorEnd;\n\n        varying vec2 vUv;\n\n        #ifdef USE_DASH\n\n            uniform float dashScale;\n            attribute float instanceDistanceStart;\n            attribute float instanceDistanceEnd;\n            varying float vLineDistance;\n\n        #endif\n\n        void trimSegment( const in vec4 start, inout vec4 end ) {\n\n            // trim end segment so it terminates between the camera plane and the near plane\n\n            // conservative estimate of the near plane\n            float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n            float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n            float nearEstimate = - 0.5 * b / a;\n\n            float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n            end.xyz = mix( start.xyz, end.xyz, alpha );\n\n        }\n\n        void main() {\n\n            #ifdef USE_COLOR\n\n                vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n            #endif\n\n            #ifdef USE_DASH\n\n                vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\n            #endif\n\n            float aspect = resolution.x / resolution.y;\n\n            vUv = uv;\n\n            // camera space\n            vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n            vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n            // special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n            // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n            // but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n            // perhaps there is a more elegant solution -- WestLangley\n\n            bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n            if ( perspective ) {\n\n                if ( start.z < 0.0 && end.z >= 0.0 ) {\n\n                    trimSegment( start, end );\n\n                } else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n                    trimSegment( end, start );\n\n                }\n\n            }\n\n            // clip space\n            vec4 clipStart = projectionMatrix * start;\n            vec4 clipEnd = projectionMatrix * end;\n\n            // ndc space\n            vec2 ndcStart = clipStart.xy / clipStart.w;\n            vec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n            // direction\n            vec2 dir = ndcEnd - ndcStart;\n\n            // account for clip-space aspect ratio\n            dir.x *= aspect;\n            dir = normalize( dir );\n\n            // perpendicular to dir\n            vec2 offset = vec2( dir.y, - dir.x );\n\n            // undo aspect ratio adjustment\n            dir.x /= aspect;\n            offset.x /= aspect;\n\n            // sign flip\n            if ( position.x < 0.0 ) offset *= - 1.0;\n\n            // endcaps\n            if ( position.y < 0.0 ) {\n\n                offset += - dir;\n\n            } else if ( position.y > 1.0 ) {\n\n                offset += dir;\n\n            }\n\n            // adjust for linewidth\n            offset *= linewidth;\n\n            // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n            offset /= resolution.y;\n\n            // select end\n            vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n            // back to clip space\n            offset *= clip.w;\n\n            clip.xy += offset;\n\n            gl_Position = clip;\n\n            vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n            #include <logdepthbuf_vertex>\n            #include <clipping_planes_vertex>\n            #include <fog_vertex>\n\n        }\n        ",
        fragmentShader: "\n        uniform vec3 diffuse;\n        uniform float opacity;\n\n        #ifdef USE_DASH\n\n            uniform float dashSize;\n            uniform float dashOffset;\n            uniform float gapSize;\n\n        #endif\n\n        varying float vLineDistance;\n\n        #include <common>\n        #include <color_pars_fragment>\n        #include <fog_pars_fragment>\n        #include <logdepthbuf_pars_fragment>\n        #include <clipping_planes_pars_fragment>\n\n        varying vec2 vUv;\n\n        void main() {\n\n            #include <clipping_planes_fragment>\n\n            #ifdef USE_DASH\n\n                if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n                if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n            #endif\n\n            if ( abs( vUv.y ) > 1.0 ) {\n\n                float a = vUv.x;\n                float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n                float len2 = a * a + b * b;\n\n                if ( len2 > 1.0 ) discard;\n\n            }\n\n            vec4 diffuseColor = vec4( diffuse, opacity );\n\n            #include <logdepthbuf_fragment>\n            #include <color_fragment>\n\n            gl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\n            #include <tonemapping_fragment>\n            #include <encodings_fragment>\n            #include <fog_fragment>\n            #include <premultiplied_alpha_fragment>\n\n        }\n        "
    };
    var YC = function(A) {
        Pe.call(this, {
            type: "LineMaterial",
            uniforms: Ge.clone(it.line.uniforms),
            vertexShader: it.line.vertexShader,
            fragmentShader: it.line.fragmentShader,
            clipping: !0
        }),
        this.dashed = !1,
        Object.defineProperties(this, {
            color: {
                enumerable: !0,
                get: function() {
                    return this.uniforms.diffuse.value
                },
                set: function(A) {
                    this.uniforms.diffuse.value = A
                }
            },
            linewidth: {
                enumerable: !0,
                get: function() {
                    return this.uniforms.linewidth.value
                },
                set: function(A) {
                    this.uniforms.linewidth.value = A
                }
            },
            dashScale: {
                enumerable: !0,
                get: function() {
                    return this.uniforms.dashScale.value
                },
                set: function(A) {
                    this.uniforms.dashScale.value = A
                }
            },
            dashSize: {
                enumerable: !0,
                get: function() {
                    return this.uniforms.dashSize.value
                },
                set: function(A) {
                    this.uniforms.dashSize.value = A
                }
            },
            dashOffset: {
                enumerable: !0,
                get: function() {
                    return this.uniforms.dashOffset.value
                },
                set: function(A) {
                    this.uniforms.dashOffset.value = A
                }
            },
            gapSize: {
                enumerable: !0,
                get: function() {
                    return this.uniforms.gapSize.value
                },
                set: function(A) {
                    this.uniforms.gapSize.value = A
                }
            },
            resolution: {
                enumerable: !0,
                get: function() {
                    return this.uniforms.resolution.value
                },
                set: function(A) {
                    this.uniforms.resolution.value.copy(A)
                }
            },
            opacity: {
                enumerable: !0,
                get: function() {
                    return this.uniforms.opacity.value
                },
                set: function(A) {
                    this.uniforms.opacity.value = A
                }
            }
        }),
        this.setValues(A)
    };
    (YC.prototype = Object.create(Pe.prototype)).constructor = YC,
    YC.prototype.isLineMaterial = !0;
    var WC, JC = function() {
        Na.call(this),
        this.type = "LineSegmentsGeometry";
        this.setIndex([0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5]),
        this.setAttribute("position", new Ae([-1, 2, 0, 1, 2, 0, -1, 1, 0, 1, 1, 0, -1, 0, 0, 1, 0, 0, -1, -1, 0, 1, -1, 0],3)),
        this.setAttribute("uv", new Ae([-1, 2, 1, 2, -1, 1, 1, 1, -1, -1, 1, -1, -1, -2, 1, -2],2))
    };
    JC.prototype = Object.assign(Object.create(Na.prototype), {
        constructor: JC,
        isLineSegmentsGeometry: !0,
        applyMatrix4: function(A) {
            var e = this.attributes.instanceStart
              , t = this.attributes.instanceEnd;
            return void 0 !== e && (e.applyMatrix4(A),
            t.applyMatrix4(A),
            e.needsUpdate = !0),
            null !== this.boundingBox && this.computeBoundingBox(),
            null !== this.boundingSphere && this.computeBoundingSphere(),
            this
        },
        setPositions: function(A) {
            var e = null;
            A instanceof Float32Array ? e = A : Array.isArray(A) && (e = new Float32Array(A));
            var t = new ks(e,6,1);
            return this.setAttribute("instanceStart", new no(t,3,0)),
            this.setAttribute("instanceEnd", new no(t,3,3)),
            this.computeBoundingBox(),
            this.computeBoundingSphere(),
            this
        },
        setColors: function(A) {
            var e = null;
            A instanceof Float32Array ? e = A : Array.isArray(A) && (e = new Float32Array(A));
            var t = new ks(e,6,1);
            return this.setAttribute("instanceColorStart", new no(t,3,0)),
            this.setAttribute("instanceColorEnd", new no(t,3,3)),
            this
        },
        fromWireframeGeometry: function(A) {
            return this.setPositions(A.attributes.position.array),
            this
        },
        fromEdgesGeometry: function(A) {
            return this.setPositions(A.attributes.position.array),
            this
        },
        fromMesh: function(A) {
            return this.fromWireframeGeometry(new on(A.geometry)),
            this
        },
        fromLineSegements: function(A) {
            var e = A.geometry;
            return e.isGeometry ? this.setPositions(e.vertices) : e.isBufferGeometry && this.setPositions(e.attributes.position.array),
            this
        },
        computeBoundingBox: function() {
            var A = new aA;
            return function() {
                null === this.boundingBox && (this.boundingBox = new aA);
                var e = this.attributes.instanceStart
                  , t = this.attributes.instanceEnd;
                void 0 !== e && void 0 !== t && (this.boundingBox.setFromBufferAttribute(e),
                A.setFromBufferAttribute(t),
                this.boundingBox.union(A))
            }
        }(),
        computeBoundingSphere: (WC = new y,
        function() {
            null === this.boundingSphere && (this.boundingSphere = new cA),
            null === this.boundingBox && this.computeBoundingBox();
            var A = this.attributes.instanceStart
              , e = this.attributes.instanceEnd;
            if (void 0 !== A && void 0 !== e) {
                var t = this.boundingSphere.center;
                this.boundingBox.getCenter(t);
                for (var i = 0, o = 0, n = A.count; n > o; o += 1)
                    WC.fromBufferAttribute(A, o),
                    i = Math.max(i, t.distanceToSquared(WC)),
                    WC.fromBufferAttribute(e, o),
                    i = Math.max(i, t.distanceToSquared(WC));
                this.boundingSphere.radius = Math.sqrt(i),
                isNaN(this.boundingSphere.radius) && console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.", this)
            }
        }
        ),
        toJSON: function() {},
        applyMatrix: function(A) {
            return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),
            this.applyMatrix4(A)
        }
    });
    var zC, ZC, XC = function(A, e) {
        void 0 === A && (A = new JC),
        void 0 === e && (e = new YC({
            color: 16777215 * Math.random()
        })),
        Ue.call(this, A, e),
        this.type = "LineSegments2"
    };
    XC.prototype = Object.assign(Object.create(Ue.prototype), {
        constructor: XC,
        isLineSegments2: !0,
        computeLineDistances: (zC = new y,
        ZC = new y,
        function() {
            for (var A = this.geometry, e = A.attributes.instanceStart, t = A.attributes.instanceEnd, i = new Float32Array(2 * e.data.count), o = 0, n = 0, r = e.data.count; r > o; o += 1,
            n += 2)
                zC.fromBufferAttribute(e, o),
                ZC.fromBufferAttribute(t, o),
                i[n] = 0 === n ? 0 : i[n - 1],
                i[n + 1] = i[n] + zC.distanceTo(ZC);
            var a = new ks(i,2,1);
            return A.setAttribute("instanceDistanceStart", new no(a,1,0)),
            A.setAttribute("instanceDistanceEnd", new no(a,1,1)),
            this
        }
        ),
        raycast: function() {
            var A = new p
              , e = new p
              , t = new p
              , i = new y
              , o = new M
              , n = new Hs
              , r = new y;
            return function(s, l) {
                null === s.camera && console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.');
                var c = s.ray
                  , h = s.camera
                  , d = h.projectionMatrix
                  , p = this.geometry
                  , g = this.material
                  , u = g.resolution
                  , f = g.linewidth + (void 0 !== s.params.Line2 && s.params.Line2.threshold || 0)
                  , m = p.attributes.instanceStart
                  , C = p.attributes.instanceEnd;
                c.at(1, t),
                t.w = 1,
                t.applyMatrix4(h.matrixWorldInverse),
                t.applyMatrix4(d),
                t.multiplyScalar(1 / t.w),
                t.x *= u.x / 2,
                t.y *= u.y / 2,
                t.z = 0,
                i.copy(t);
                var v = this.matrixWorld;
                o.multiplyMatrices(h.matrixWorldInverse, v);
                for (var I = 0, E = m.count; E > I; I += 1) {
                    if (A.fromBufferAttribute(m, I),
                    e.fromBufferAttribute(C, I),
                    A.w = 1,
                    e.w = 1,
                    A.applyMatrix4(o),
                    e.applyMatrix4(o),
                    A.applyMatrix4(d),
                    e.applyMatrix4(d),
                    A.multiplyScalar(1 / A.w),
                    e.multiplyScalar(1 / e.w),
                    !(-1 > A.z && -1 > e.z) && !(A.z > 1 && e.z > 1)) {
                        A.x *= u.x / 2,
                        A.y *= u.y / 2,
                        e.x *= u.x / 2,
                        e.y *= u.y / 2,
                        n.start.copy(A),
                        n.start.z = 0,
                        n.end.copy(e),
                        n.end.z = 0;
                        var B = n.closestPointToPointParameter(i, !0);
                        n.at(B, r);
                        var x = a.lerp(A.z, e.z, B)
                          , S = x >= -1 && 1 >= x
                          , w = i.distanceTo(r) < .5 * f;
                        if (S && w) {
                            n.start.fromBufferAttribute(m, I),
                            n.end.fromBufferAttribute(C, I),
                            n.start.applyMatrix4(v),
                            n.end.applyMatrix4(v);
                            var M = new y
                              , b = new y;
                            c.distanceSqToSegment(n.start, n.end, b, M),
                            l.push({
                                point: b,
                                pointOnLine: M,
                                distance: c.origin.distanceTo(b),
                                object: this,
                                face: null,
                                faceIndex: I,
                                uv: null,
                                uv2: null
                            })
                        }
                    }
                }
            }
        }()
    });
    var _C = function(A, e) {
        ep.call(this, gp.FILLCLIPPLANE, {
            priority: 20
        }),
        this.cubeSize = A.clone(),
        this.originBoundingBox = (new aA).setFromCenterAndSize(e, A),
        this.boundingBox = this.originBoundingBox.clone(),
        this.center = e.clone(),
        this.length = .8 * this.originBoundingBox.getSize(new y).length(),
        this.planeOffset = 0,
        this.normalIndex = 3,
        this.visible = !1,
        this.rotatable = !1,
        this.hit = !1,
        this.clipplane = new p,
        this.observer = null,
        this.renderClipPlane = new EA,
        this.angleA = 0,
        this.angleB = 0,
        this.uniforms = {
            iClipPlane: {
                value: 0
            },
            vClipPlane: {
                value: new Array(new p)
            }
        },
        this.planeMaterial = new jC({
            color: 6724044,
            opacity: .3,
            transparent: !0,
            side: 2,
            lights: !0
        }),
        this.planeMaterial.visible = !1,
        this.planeHighLightMatrial = new jC({
            color: 6724044,
            opacity: .3,
            transparent: !0,
            side: 2,
            lights: !0
        }),
        this.initPlaneModel = function() {
            for (var A = this.children.length - 1; A >= 0; A -= 1)
                this.remove(this.children[A]);
            this.planeOffset = 0;
            var e = this.length
              , t = new Ue(new At(e,e),this.planeMaterial);
            t.name = "fillClipPlane",
            t.customTag = !0,
            t.renderOrder = 90,
            this.position.copy(this.center),
            this.clipplane.set(0, 0, 1, 0),
            this.planeMesh = t,
            this.add(t)
        }
        ,
        this.initWireframes = function() {
            var A = .5 * this.length
              , e = [-A, A, 0, A, A, 0, -A, -A, 0, A, -A, 0]
              , t = new he
              , i = new jC({
                color: 2003199,
                lights: !0
            });
            t.setIndex([0, 1, 1, 3, 3, 2, 2, 0]),
            t.setAttribute("position", new Ae(e,3));
            var o = new jo(t,i);
            o.name = "Wireframes",
            o.customTag = !0,
            this.wireframeMesh = o,
            this.add(o)
        }
        ,
        this.getCoordinate = function() {
            var A = .5 * this.length
              , e = new y(-A,A,0);
            e.applyMatrix4(this.matrix);
            var t = new y(A,A,0);
            t.applyMatrix4(this.matrix);
            var i = new y(-A,-A,0);
            return i.applyMatrix4(this.matrix),
            {
                axisX: e.clone().sub(t).normalize(),
                axisY: e.clone().sub(i).normalize()
            }
        }
        ,
        this.initCapsPlane = function() {
            if (this.capPlane)
                return this.capPlane;
            this.planeMesh || this.initPlaneModel();
            var A = this.length
              , e = new Ue(new At(A,A),new jC({
                color: 16776960,
                side: 2,
                stencilWrite: !0,
                stencilFunc: 515,
                stencilRef: 1,
                stencilFuncMask: 255,
                stencilFail: 7680,
                stencilZFail: 7680,
                stencilZPass: 7680
            }))
              , t = this.planeMesh;
            e.matrixWorld = t.matrixWorld,
            e.matrix = this.matrix;
            for (var i = .5 * this.length, o = .01 * this.length, n = [], r = i - o; r > -i; r -= o)
                n.push(r, i, 0),
                n.push(i, r, 0);
            for (r = -i + o; i > r; r += o)
                n.push(-i, r, 0),
                n.push(r, -i, 0);
            var a = new YC({
                color: 2236962,
                stencilWrite: !0,
                stencilFunc: 515,
                stencilRef: 1,
                stencilFuncMask: 255,
                stencilFail: 7680,
                stencilZFail: 7680,
                stencilZPass: 7680
            });
            a.linewidth = 1,
            a.resolution.set(window.innerWidth, window.innerHeight),
            a.depthTest = !1;
            var s = new JC;
            s.setPositions(n);
            var l = new XC(s,a);
            return l.matrix = this.matrix,
            l.matrixWorld = t.matrixWorld,
            this.capPlane = {
                planeMesh: e,
                lineMesh: l
            },
            this.capPlane
        }
        ,
        this.updateClippingParams = function(A) {}
        ,
        this.getFillClipBoundingBox = function() {
            return this.boundingBox
        }
        ,
        this.calculateFillClipBoundingBox = function(A) {
            this.boundingBox = this.originBoundingBox.clone(),
            0 !== this.clipplane.x ? 1 === this.clipplane.x ? this.boundingBox.max.x = A.x : this.boundingBox.min.x = A.x : 0 !== this.clipplane.y ? 1 === this.clipplane.y ? this.boundingBox.max.y = A.y : this.boundingBox.min.y = A.y : 0 !== this.clipplane.z && (1 === this.clipplane.z ? this.boundingBox.max.z = A.z : this.boundingBox.min.z = A.z)
        }
        ,
        this.enable = function(A, e) {
            this.visible = e,
            this.uniforms.iClipPlane.value = A ? 1 : 0,
            this.capPlane && (this.capPlane.lineMesh.visible = e,
            this.capPlane.planeMesh.visible = e),
            this.update()
        }
        ,
        this.isEnabled = function() {
            return 0 !== this.uniforms.iClipPlane.value
        }
        ,
        this.update = function() {
            this.updateMatrixWorld();
            var A = new M;
            A.getInverse(this.matrix),
            A.transpose(),
            this.uniforms.vClipPlane.value[0] = this.clipplane.clone().applyMatrix4(A),
            this.updateClippingParams(this.uniforms),
            this.observer && this.observer()
        }
        ,
        this.getClipPlane = function() {
            return this.clipplane.clone()
        }
        ,
        this.offset = function(A) {
            var e = this.cubeSize.length();
            this.planeOffset += A,
            Math.abs(this.planeOffset) > .5 * e && (this.planeOffset = this.planeOffset > 0 ? .5 * e : .5 * -e);
            var t = this.uniforms.vClipPlane.value[0].clone()
              , i = new y(t.x,t.y,t.z);
            i.normalize();
            var o = new y(i.x * this.planeOffset,i.y * this.planeOffset,i.z * this.planeOffset);
            this.position.copy(this.center).add(o),
            this.update()
        }
        ,
        this.setOffset = function(A) {
            var e = this.cubeSize.length();
            this.planeOffset = A,
            Math.abs(A) > .5 * e && (this.planeOffset = A > 0 ? .5 * e : .5 * -e);
            var t = this.uniforms.vClipPlane.value[0].clone()
              , i = new y(t.x,t.y,t.z);
            i.normalize();
            var o = new y(i.x * this.planeOffset,i.y * this.planeOffset,i.z * this.planeOffset);
            this.position.copy(this.center).add(o),
            this.update()
        }
        ,
        this.changeNormal = function(A) {
            this.quaternion.set(0, 0, 0, 1),
            this.angleA = 0,
            this.angleB = 0,
            this.setNormal(A)
        }
        ,
        this.setNormal = function(A) {
            var e = this.planeMesh
              , t = this.wireframeMesh;
            0 === A ? (this.clipplane.set(1, 0, 0, 0),
            e.rotation.set(0, Math.PI / 2, 0),
            t.rotation.set(0, Math.PI / 2, 0)) : 1 === A ? (this.clipplane.set(-1, 0, 0, 0),
            e.rotation.set(0, -Math.PI / 2, 0),
            t.rotation.set(0, -Math.PI / 2, 0)) : 2 === A ? (this.clipplane.set(0, 0, 1, 0),
            e.rotation.set(Math.PI, 0, 0),
            t.rotation.set(Math.PI, 0, 0)) : 3 === A ? (this.clipplane.set(0, 0, -1, 0),
            e.rotation.set(0, 0, 0),
            t.rotation.set(0, 0, 0)) : 4 === A ? (this.clipplane.set(0, 1, 0, 0),
            e.rotation.set(-Math.PI / 2, 0, 0),
            t.rotation.set(-Math.PI / 2, 0, 0)) : 5 === A && (this.clipplane.set(0, -1, 0, 0),
            e.rotation.set(Math.PI / 2, 0, 0),
            t.rotation.set(Math.PI / 2, 0, 0)),
            this.normalIndex = A,
            e.updateMatrixWorld(),
            t.updateMatrixWorld(),
            this.capPlane && (this.capPlane.planeMesh.matrixWorld = e.matrixWorld,
            this.capPlane.lineMesh.matrixWorld = e.matrixWorld),
            this.update()
        }
        ;
        var t = new f
          , i = new y(1,0,0);
        this.rotX = function(A) {
            t.setFromAxisAngle(i, A),
            this.quaternion.multiply(t),
            this.update()
        }
        ;
        var o = new y(0,1,0);
        this.rotY = function(A) {
            t.setFromAxisAngle(o, A),
            this.quaternion.multiply(t),
            this.update()
        }
        ;
        var n = new y(0,0,1);
        this.rotateByAxis = function(A, e) {
            t.setFromAxisAngle(A, e),
            this.quaternion.multiply(t)
        }
        ,
        this.rotateAngleOffset = function(A, e) {
            var t = this.normalIndex;
            A = A % 360 / 180 * Math.PI,
            0 === t || 1 === t ? ("y" === e && this.rotateByAxis(n, A),
            "z" === e && this.rotateByAxis(o, A)) : 2 === t || 3 === t ? ("x" === e && this.rotateByAxis(i, A),
            "z" === e && this.rotateByAxis(o, A)) : 4 !== t && 5 !== t || ("x" === e && this.rotateByAxis(i, A),
            "y" === e && this.rotateByAxis(n, A)),
            this.update()
        }
        ,
        this.setRotateAngle = function(A, e) {
            this.quaternion.set(0, 0, 0, 1);
            var t = this.normalIndex;
            e = 0 > (e = void 0 === e ? this.angleB : e % 360) ? 360 + e : e,
            this.angleA = A = 0 > (A = void 0 === A ? this.angleA : A % 360) ? 360 + A : A,
            this.angleB = e,
            A = A / 180 * Math.PI,
            e = e / 180 * Math.PI,
            0 === t || 1 === t ? (e = 0 === t ? e : -e,
            this.rotateByAxis(n, A = 0 === t ? -A : A),
            this.rotateByAxis(o, e)) : 2 === t || 3 === t ? (this.rotateByAxis(i, A),
            this.rotateByAxis(o, e)) : 4 !== t && 5 !== t || (e = 3 === t ? e : -e,
            this.rotateByAxis(i, A = 3 === t ? -A : A),
            this.rotateByAxis(n, e)),
            this.update()
        }
        ,
        this.getRotateAngle = function() {
            return {
                angleA: this.angleA,
                angleB: this.angleB
            }
        }
        ,
        this.highLight = function() {
            this.planeMesh.material = this.planeHighLightMatrial
        }
        ,
        this.cancelHighLight = function() {
            this.planeMesh.material = this.planeMaterial,
            this.hit = !1
        }
        ;
        var r = function(A, e, t, i, o, n, r, a, s) {
            this.enable = A,
            this.visible = e,
            this.rotatable = t,
            this.planeOffset = i,
            this.position = o,
            this.scale = n,
            this.quaternion = r,
            this.cubeSize = a,
            this.center = s
        };
        this.store = function() {
            return new r(!!this.uniforms.iClipPlane.value,this.visible,this.rotatable,this.planeOffset,this.position.clone(),this.scale.clone(),this.quaternion.clone(),this.cubeSize.clone(),this.center.clone())
        }
        ,
        this.restore = function(A) {
            this.enable(A.enable, A.visible),
            this.rotatable = A.rotatable,
            this.planeOffset = A.planeOffset,
            this.position.copy(A.position),
            this.scale.copy(A.scale),
            this.quaternion._w = A.quaternion._w,
            this.quaternion._x = A.quaternion._x,
            this.quaternion._y = A.quaternion._y,
            this.quaternion._z = A.quaternion._z,
            this.normalIndex = void 0 === A.normalIndex ? this.normalIndex : A.normalIndex,
            this.setNormal(this.normalIndex)
        }
        ,
        this.setProcess = function(A) {
            var e = this.cubeSize.length();
            A > 1 ? A = 1 : -1 > A && (A = -1),
            this.planeOffset = A * e * .5;
            var t = this.uniforms.vClipPlane.value[0].clone()
              , i = new y(t.x,t.y,t.z);
            i.normalize();
            var o = new y(i.x * this.planeOffset,i.y * this.planeOffset,i.z * this.planeOffset);
            this.position.copy(this.center).add(o),
            this.update()
        }
        ,
        this.restoreRotation = function() {
            this.quaternion.set(0, 0, 0, 1),
            this.update()
        }
        ,
        this.getProcess = function() {
            var A = this.cubeSize.length();
            return this.planeOffset / A * 2
        }
    };
    (_C.prototype = Object.create(ep.prototype)).constructor = _C,
    _C.prototype.init = function() {
        this.initPlaneModel(),
        this.initWireframes()
    }
    ,
    _C.prototype.hitTest = function(A) {
        if (this.visible) {
            var e = null
              , t = null;
            if (this.hit = this.raycast(A),
            this.hit) {
                var i = A.ray
                  , o = new EA
                  , n = this.uniforms.vClipPlane.value[0];
                o.setComponents(n.x, n.y, n.z, n.w),
                e = i.distanceToPlane(o),
                t = 0 > i.direction.dot(o.normal)
            }
            return {
                sign: t,
                distance: e
            }
        }
        this.hit = !1
    }
    ,
    _C.prototype.raycast = function(A, e) {
        var t = [];
        return this.planeMesh.raycast(A, t),
        t.length > 0
    }
    ,
    _C.prototype.resize = function(A, e) {
        var t = A.length() / this.length;
        this.scale.set(t, t, t),
        this.cubeSize.copy(A),
        e && (this.center = e.clone(),
        this.position.copy(this.center)),
        this.offset(0),
        this.updateMatrixWorld()
    }
    ,
    _C.prototype.getSideLength = function() {
        return this.length * this.scale.x
    }
    ;
    var $C = function(A, e) {
        this.cls = A,
        this.size = e,
        this._pool = [],
        this.counter = 0
    };
    $C.prototype.init = function(A) {
        for (var e = 0, t = this.size; t > e; e += 1) {
            var i = new this.cls;
            i.init(A),
            this._pool[e] = i
        }
    }
    ,
    $C.prototype.resize = function(A, e) {
        this.size = A,
        this.collect(),
        this.init(e)
    }
    ,
    $C.prototype.get = function(A) {
        return this.size > this.counter ? (this._pool[this.counter].spawn(A),
        this.counter += 1,
        this.counter - 1) : (Bh.log("the pool is full"),
        -1)
    }
    ,
    $C.prototype.clear = function() {
        for (var A = 0, e = this.size; e > A; A += 1)
            this._pool[A].clear();
        this.counter = 0
    }
    ,
    $C.prototype.destroy = function() {
        this.collect()
    }
    ,
    $C.prototype.collect = function() {
        this._pool = [],
        this.counter = 0
    }
    ,
    $C.prototype.getObjects = function() {
        return this._pool
    }
    ;
    var Ay = function(A, e) {
        var t = new he;
        t.setAttribute("position", new YA(new Float32Array(72),3)),
        jo.call(this, t, new ko({
            color: e
        })),
        void 0 !== A && this.updateBBox(A)
    };
    (Ay.prototype = Object.create(jo.prototype)).constructor = Ay,
    Ay.prototype.unload = function() {}
    ,
    Ay.prototype.updateBBox = function(A) {
        var e = A.min
          , t = A.max
          , i = this.geometry.attributes.position.array;
        i[0] = t.x,
        i[1] = t.y,
        i[2] = t.z,
        i[3] = e.x,
        i[4] = t.y,
        i[5] = t.z,
        i[6] = e.x,
        i[7] = t.y,
        i[8] = t.z,
        i[9] = e.x,
        i[10] = e.y,
        i[11] = t.z,
        i[12] = e.x,
        i[13] = e.y,
        i[14] = t.z,
        i[15] = t.x,
        i[16] = e.y,
        i[17] = t.z,
        i[18] = t.x,
        i[19] = e.y,
        i[20] = t.z,
        i[21] = t.x,
        i[22] = t.y,
        i[23] = t.z,
        i[24] = t.x,
        i[25] = t.y,
        i[26] = e.z,
        i[27] = e.x,
        i[28] = t.y,
        i[29] = e.z,
        i[30] = e.x,
        i[31] = t.y,
        i[32] = e.z,
        i[33] = e.x,
        i[34] = e.y,
        i[35] = e.z,
        i[36] = e.x,
        i[37] = e.y,
        i[38] = e.z,
        i[39] = t.x,
        i[40] = e.y,
        i[41] = e.z,
        i[42] = t.x,
        i[43] = e.y,
        i[44] = e.z,
        i[45] = t.x,
        i[46] = t.y,
        i[47] = e.z,
        i[48] = t.x,
        i[49] = t.y,
        i[50] = t.z,
        i[51] = t.x,
        i[52] = t.y,
        i[53] = e.z,
        i[54] = e.x,
        i[55] = t.y,
        i[56] = t.z,
        i[57] = e.x,
        i[58] = t.y,
        i[59] = e.z,
        i[60] = e.x,
        i[61] = e.y,
        i[62] = t.z,
        i[63] = e.x,
        i[64] = e.y,
        i[65] = e.z,
        i[66] = t.x,
        i[67] = e.y,
        i[68] = t.z,
        i[69] = t.x,
        i[70] = e.y,
        i[71] = e.z,
        this.geometry.attributes.position.needsUpdate = !0,
        this.geometry.computeBoundingBox(),
        this.geometry.computeBoundingSphere(),
        this.matrixAutoUpdate = !1
    }
    ;
    var ey = function() {
        ep.call(this, gp.EXTERNALSCENEMANAGER, {
            pickableType: Qc.Geometry,
            priority: 20
        }),
        this.globalSpace = !0
    };
    (ey.prototype = Object.create(ep.prototype)).constructor = ey,
    ey.prototype.getNode = function(A) {
        for (var e = this.children, t = 0, i = e.length; i > t; t += 1)
            if (e[t].name === A.toString())
                return e[t];
        return null
    }
    ,
    ey.prototype.removeNodeByName = function(A) {
        var e = this.getNode(A);
        return !!e && (this.remove(e),
        !0)
    }
    ,
    ey.prototype.clearNodes = function() {
        this.clear()
    }
    ,
    ey.prototype.setNodeVisibleByName = function(A, e) {
        var t = this.getNode(A);
        return !!t && (t.visible = e,
        !0)
    }
    ,
    ey.prototype.showAllNodes = function() {
        for (var A = this.children, e = 0, t = A.length; t > e; e += 1)
            A[e].visible = !0
    }
    ,
    ey.prototype.hideAllNodes = function() {
        for (var A = this.children, e = 0, t = A.length; t > e; e += 1)
            A[e].visible = !1
    }
    ;
    var ty = function() {
        ep.call(this, gp.EXTRUDEBODYMANAGER, {
            pickableType: Qc.Geometry,
            priority: 20
        }),
        this.globalSpace = !0,
        this.mapColorToNodeId = {},
        this.selectionIds = {},
        this.selectionColor = {
            red: 50,
            green: 224,
            blue: 240,
            alpha: .3
        },
        this.selectionEdgeColor = {
            red: 50,
            green: 224,
            blue: 240,
            alpha: 1
        }
    };
    function iy(A) {
        this.scene = A,
        this.lightArray = void 0,
        this.lightHelperArray = void 0,
        this.lightHelper = !1,
        this._currentPreset = void 0,
        this._intensityFactor = vc.LightIntensityFactor,
        this.defaultShadowLightDir = new y(100,-100,-160),
        this.defaultLightDir = new y(100,-100,-160),
        this.shadowLightDir = new y(100,-100,-160),
        this.lightDir = new y(100,-100,-160),
        this._ambientLight = void 0,
        this.setLightPreset(vc.LightPreset)
    }
    (ty.prototype = Object.create(ep.prototype)).constructor = ty,
    ty.prototype.addNode = function(A, e, t, i, o, n) {
        n = void 0 === n || n;
        var r = this.getNode(A);
        if (r)
            return r.material = i,
            this.setColorInMap(r.name, i),
            void ((r = this.getNode("wireframe_" + A)) && (r.material = o,
            this.setColorInMap(r.name, o)));
        var a = []
          , l = 0;
        if (e.belong && "user" === e.belong)
            a = e.roomBoundary,
            l = e.offsetZ;
        else {
            e.version && "2.0" === e.version && (e = e.loops && e.loops.length > 0 ? e.loops[0] : []);
            for (var c = e.length, h = 0; c > h; h += 1)
                for (var d = e[h], p = d.length, g = 0; p - 1 > g; g += 1) {
                    var u = d[g];
                    a.push(new s(u.x,u.y)),
                    0 === h && 0 === g && (l = u.z)
                }
            a.length > 0 && a.push(a[0])
        }
        var f = new Jn(new Ba(a),{
            amount: t
        });
        i.depthTest = !n,
        f.boundingBox || f.computeBoundingBox();
        var m = new Ue(f,i);
        m.name = A.toString(),
        m.translateZ(l),
        this.setColorInMap(m.name, i),
        this.add(m),
        this.updateMatrixWorld(!0);
        var C = m.geometry.faces
          , y = [];
        for (h = 0,
        p = C.length; p > h; h += 1)
            y.push(C[h].a),
            y.push(C[h].b),
            y.push(C[h].c);
        var v = m.geometry.vertices
          , I = [];
        for (h = 0,
        p = v.length; p > h; h += 1)
            I.push(v[h].x),
            I.push(v[h].y),
            I.push(v[h].z);
        var E = Up(I, y, Math.PI / 3.5)
          , B = new he;
        B.setIndex(new $A(E,1)),
        B.setAttribute("position", new Ae(I,3)),
        o.depthTest = !n,
        o.transparent = !0;
        var x = new jo(B,o);
        x.translateZ(l),
        x.name = "wireframe_" + A,
        this.setColorInMap(x.name, o),
        this.add(x),
        this.updateMatrixWorld(!0)
    }
    ,
    ty.prototype.setColorInMap = function(A, e) {
        this.mapColorToNodeId[A] = {
            red: 255 * e.color.r,
            green: 255 * e.color.g,
            blue: 255 * e.color.b,
            alpha: e.opacity
        }
    }
    ,
    ty.prototype.createMaterial = function(A) {
        return Kd.createStandardMaterial(A)
    }
    ,
    ty.prototype.setNodeMaterial = function(A, e, t) {
        var i = this.getNode(A);
        if (i) {
            var o = i.material;
            for (var n in e) {
                o.hasOwnProperty(r = n) && (o[r] = "color" === r ? new LA(e[n]) : e[n])
            }
        }
        if (i = this.getNode("wireframe_" + A)) {
            o = i.material;
            for (var n in t) {
                var r;
                o.hasOwnProperty(r = n) && (o[r] = "color" === r ? new LA(t[n]) : t[n])
            }
        }
    }
    ,
    ty.prototype.getNode = function(A) {
        for (var e = this.children, t = 0, i = e.length; i > t; t += 1)
            if (e[t].name === A.toString())
                return e[t];
        return null
    }
    ,
    ty.prototype.removeNodeById = function(A) {
        var e = this.getNode(A);
        return e && (delete this.mapColorToNodeId[e.name],
        this.remove(e)),
        !!(e = this.getNode("wireframe_" + A)) && (delete this.mapColorToNodeId[e.name],
        this.remove(e),
        !0)
    }
    ,
    ty.prototype.clearNodes = function() {
        this.clear(),
        this.mapColorToNodeId = {}
    }
    ,
    ty.prototype.setNodeVisibleById = function(A, e) {
        var t = this.getNode(A);
        return t && (t.visible = e),
        !!(t = this.getNode("wireframe_" + A)) && (t.visible = e,
        !0)
    }
    ,
    ty.prototype.showAllNodes = function() {
        for (var A = this.children, e = 0, t = A.length; t > e; e += 1)
            A[e].visible = !0
    }
    ,
    ty.prototype.hideAllNodes = function() {
        for (var A = this.children, e = 0, t = A.length; t > e; e += 1)
            A[e].visible = !1
    }
    ,
    ty.prototype.setNodeColorById = function(A, e) {
        var t = this.getNode(A);
        if (t) {
            var i = t.material;
            return i.color = new LA(e.red / 255,e.green / 255,e.blue / 255),
            i.opacity = e.alpha,
            e !== this.selectionColor && e !== this.selectionEdgeColor && this.setColorInMap(t.name, i),
            !0
        }
        return !1
    }
    ,
    ty.prototype.getNodeColorById = function(A) {
        return this.mapColorToNodeId[A]
    }
    ,
    ty.prototype.setWireframeColorById = function(A, e) {
        return this.setNodeColorById("wireframe_" + A, e)
    }
    ,
    ty.prototype.getWireframeColorById = function(A) {
        return this.getNodeColorById("wireframe_" + A)
    }
    ,
    ty.prototype.applySelection = function(A) {
        this.clearSelection();
        var e = this.selectionIds
          , t = this.mapColorToNodeId
          , i = A.sceneState.selectionSet;
        for (var o in i)
            t[o] && (e[o] = !0,
            this.setNodeColorById(o, this.selectionColor),
            this.setWireframeColorById(o, this.selectionEdgeColor))
    }
    ,
    ty.prototype.clearSelection = function() {
        var A = this.mapColorToNodeId;
        if (this.selectionIds) {
            for (var e = this.children, t = 0, i = e.length; i > t; t += 1) {
                var o = e[t]
                  , n = A[o.name];
                o.material.color = new LA(n.red / 255,n.green / 255,n.blue / 255),
                o.material.opacity = n.alpha
            }
            this.selectionIds = {}
        }
    }
    ,
    ty.prototype.applyHover = function(A) {
        var e = A.sceneState;
        if (e.hoverId && !e.isSelected(e.hoverId)) {
            var t = this.getNode(e.hoverId);
            if (t) {
                this.hoveredId = e.hoverId;
                var i = this.mapColorToNodeId[this.hoveredId]
                  , o = Kd.getHoverColorByColor({
                    r: i.red / 255,
                    g: i.green / 255,
                    b: i.blue / 255,
                    a: i.alpha
                });
                t.material.color.setRGB(o.r, o.g, o.b),
                t.material.opacity = o.a
            }
        }
    }
    ,
    ty.prototype.clearHover = function() {
        var A = this.hoveredId;
        if (A)
            if (this.selectionIds[A])
                this.hoveredId = null;
            else {
                var e = this.getNode(A);
                if (e) {
                    var t = this.mapColorToNodeId[A];
                    e.material.color.setRGB(t.red / 255, t.green / 255, t.blue / 255),
                    e.material.opacity = t.alpha,
                    this.hoveredId = null
                } else
                    this.hoveredId = null
            }
    }
    ,
    iy.prototype.destroy = function() {
        this.scene = void 0,
        this._clearLights(),
        this._clearLightHelpers()
    }
    ,
    iy.prototype.currentLights = function() {
        if (this.lightArray)
            return [].concat(this.lightArray)
    }
    ,
    iy.prototype.setLightPreset = function(A) {
        this._currentPreset !== A && (vc.LightPreset = A,
        this._currentPreset = A,
        this._clearLights(),
        this._clearLightHelpers(),
        this._createLights(),
        this.setIntensityFactor(this._intensityFactor),
        this.lightHelper && this._createLightHelpers())
    }
    ,
    iy.prototype.getLightPreset = function() {
        return this._currentPreset
    }
    ,
    iy.prototype.updateLights = function(A) {
        if (this.lightArray) {
            var e = new y(0,0,1)
              , t = Math.PI / 4
              , i = A.position.clone();
            i.sub(A.target),
            i.normalize();
            var o = null;
            if (0 === this._currentPreset) {
                var n = this.lightArray[1];
                n.position.set(i.x, i.y, i.z),
                n.updateMatrixWorld(!0)
            } else if (1 === this._currentPreset || 3 === this._currentPreset) {
                var r = this.lightArray[2]
                  , a = this.lightArray[3];
                o = i.clone().applyAxisAngle(e, -1.2 * t),
                r.position.copy(o).normalize(),
                r.position.multiplyScalar(1e3),
                r.position.z = 600,
                r.updateMatrixWorld(),
                o = i.clone().applyAxisAngle(e, Number(t)),
                a.position.copy(o).normalize(),
                a.position.multiplyScalar(1e3),
                a.position.z = 600,
                a.updateMatrixWorld()
            } else if (2 === this._currentPreset) {
                var s = this.lightArray[1]
                  , l = this.scene.getBoundingBox().getCenter(new y)
                  , c = new y(l.x - (o = this.lightDir).x,l.y - o.y,l.z - o.z);
                s.position.copy(c),
                s.target.position.set(l.x, l.y, l.z),
                s.target.updateMatrixWorld(!0),
                s.updateMatrixWorld(!0)
            } else {
                s = this.lightArray[1];
                o = i.clone().applyAxisAngle(e, -2 * t),
                s.position.copy(o).normalize(),
                s.position.multiplyScalar(1e3),
                s.position.z = 600,
                s.updateMatrixWorld()
            }
            this.lightHelperArray && this.updateLightHelper()
        }
    }
    ,
    iy.prototype.updateLightHelper = function() {
        for (var A = 0; this.lightHelperArray.length > A; A += 1) {
            var e = this.lightHelperArray[A];
            e.update(),
            e.updateMatrixWorld(!0)
        }
    }
    ,
    iy.prototype.setIntensityFactor = function(A) {
        if (!isNaN(A)) {
            var e = Number(A);
            if (e >= 0 && (this._intensityFactor = e,
            vc.LightIntensityFactor = this._intensityFactor,
            this.lightArray))
                for (var t = 0, i = this.lightArray.length; i > t; t += 1) {
                    var o = this.lightArray[t];
                    o.intensity = o.initIntensity * this._intensityFactor
                }
        }
    }
    ,
    iy.prototype.getIntensityFactor = function() {
        return this._intensityFactor
    }
    ,
    iy.prototype.setAmbientLightIntensity = function(A) {
        if (this._ambientLight) {
            if (isNaN(A))
                return;
            var e = Number(A);
            if (0 > e)
                return;
            this._ambientLight.intensity = e
        }
    }
    ,
    iy.prototype.getAmbientLightIntensity = function() {
        if (this._ambientLight)
            return this._ambientLight.intensity
    }
    ,
    iy.prototype._createLights = function() {
        var A = null;
        switch (this._currentPreset) {
        case 0:
            A = this._lightPreset0();
            break;
        case 1:
            A = this._lightPreset1();
            break;
        case 2:
            A = this._lightPreset2();
            break;
        case 3:
            A = this._lightPreset3();
            break;
        case 4:
            A = this._lightPreset4();
            break;
        default:
            (A = this._commonLights(.72))[1].color.setHex(16777215)
        }
        if (this.lightArray = A,
        this.scene && this.lightArray)
            for (var e = 0, t = this.lightArray.length; t > e; e += 1)
                this.scene.add(this.lightArray[e]),
                this.lightArray[e].updateMatrixWorld()
    }
    ,
    iy.prototype._clearLights = function() {
        if (this.lightArray) {
            for (var A = 0; this.lightArray.length > A; A += 1) {
                var e = this.lightArray[A];
                e.parent && e.parent.remove(e)
            }
            this.lightArray = void 0
        }
        this._ambientLight = void 0
    }
    ,
    iy.prototype._createLightHelpers = function() {
        if (this.lightArray)
            for (var A = 0; this.lightArray.length > A; A += 1) {
                var e = this.lightArray[A];
                if (e instanceof Ra) {
                    var t = new ll(e,6e3);
                    this.lightHelperArray || (this.lightHelperArray = []),
                    this.lightHelperArray.push(t),
                    this.scene && this.scene.add(t)
                }
            }
    }
    ,
    iy.prototype._clearLightHelpers = function() {
        if (this.lightHelperArray) {
            for (var A = 0; this.lightHelperArray.length > A; A += 1) {
                var e = this.lightHelperArray[A];
                e.parent && e.parent.remove(e)
            }
            this.lightHelperArray = void 0
        }
    }
    ,
    iy.prototype._commonLights = function(A, e) {
        var t = []
          , i = new Ta(16777215,.6);
        i.intensity = .3,
        i.initIntensity = i.intensity,
        t.push(i),
        this._ambientLight = i;
        var o = new Ra(16777215,1);
        return o.color.setHex(14800580),
        o.position.set(-100, 100, 160),
        o.intensity = .72,
        o.initIntensity = o.intensity,
        o.distance = 300,
        o.updateMatrixWorld(),
        t.push(o),
        vc.EnableShadow && (o.castShadow = !0,
        o.shadow.camera.near = 0,
        o.shadow.camera.far = 5e6,
        o.shadow.camera.left = -2e5,
        o.shadow.camera.right = 2e5,
        o.shadow.camera.top = 2e5,
        o.shadow.camera.bottom = -2e5,
        o.distance = 1110,
        o.shadow.mapSize.height = 1028,
        o.shadow.mapSize.width = 1028),
        t
    }
    ,
    iy.prototype._lightPreset0 = function() {
        var A = null;
        if (!vc.EnableLightmap) {
            A = [];
            var e = .3
              , t = new Sa(16777215,16777215,e);
            A.push(t),
            t.initIntensity = e,
            t.position.set(0, 0, 500),
            t.updateMatrixWorld(!0);
            var i = new Ra(16777215,e = .7);
            A.push(i),
            i.initIntensity = e,
            i.color.setHSL(.1, .95, 1),
            i.position.set(-1, 1, .75),
            i.position.multiplyScalar(50)
        }
        return A
    }
    ,
    iy.prototype._lightPreset1 = function() {
        var A = this._commonLights(.4, .56);
        A || (A = []);
        var e = new Ra(16777215,1);
        A.push(e),
        e.color.setHex(16777215),
        e.position.set(100, 100, 100),
        e.intensity = .4,
        e.initIntensity = e.intensity,
        e.updateMatrixWorld();
        var t = new Ra(16777215,1);
        return A.push(t),
        t.color.setHex(16777215),
        t.position.set(-100, -100, 100),
        t.intensity = .18,
        t.initIntensity = t.intensity,
        t.updateMatrixWorld(),
        A
    }
    ,
    iy.prototype._lightPreset2 = function() {
        var A = this._commonLights();
        A || (A = []);
        var e = new Ra(16777215,1);
        A.push(e),
        e.position.set(60, 130, 80),
        e.intensity = .28,
        e.initIntensity = e.intensity,
        e.updateMatrixWorld();
        var t = new Ra(16777215,1);
        A.push(t),
        t.color.setHex(8100788),
        t.position.set(100, -100, 80),
        t.intensity = .22,
        t.initIntensity = t.intensity,
        t.updateMatrixWorld();
        var i = new Ra(16777215,1);
        return A.push(i),
        i.color.setHex(8100788),
        i.position.set(-140, -50, 80),
        i.intensity = .18,
        i.initIntensity = i.intensity,
        i.updateMatrixWorld(),
        A
    }
    ,
    iy.prototype._lightPreset3 = function() {
        var A = this._commonLights(.4, .56);
        A || (A = []);
        var e = new Ra(16777215,1);
        A.push(e),
        e.color.setHex(16777215),
        e.position.set(100, 100, 100),
        e.intensity = .22,
        e.initIntensity = e.intensity,
        e.updateMatrixWorld();
        var t = new Ra(16777215,1);
        return A.push(t),
        t.color.setHex(16777215),
        t.position.set(-100, -100, 100),
        t.intensity = .18,
        t.initIntensity = t.intensity,
        t.updateMatrixWorld(),
        A
    }
    ,
    iy.prototype._lightPreset4 = function() {
        var A = this._commonLights(.4, .56);
        A || (A = []);
        var e = new Ra(16777215,1);
        A.push(e),
        e.color.setHex(16777215),
        e.position.set(100, 100, 100),
        e.intensity = .4,
        e.initIntensity = e.intensity,
        e.updateMatrixWorld();
        var t = new Ra(16777215,1);
        return A.push(t),
        t.color.setHex(16777215),
        t.position.set(-100, -100, 100),
        t.intensity = .1,
        t.initIntensity = t.intensity,
        t.updateMatrixWorld(),
        A[0].intensity = .3,
        A[1].intensity = .2,
        this.enableShadowLight(),
        A
    }
    ,
    iy.prototype.enableShadowLight = function() {
        this.lightCastShadow ? this.lightCastShadow.visible = !0 : (this.lightCastShadow = new Ra(16777215,.15),
        this.lightCastShadow.intensity = .5,
        this.lightCastShadow.initIntensity = .5,
        this.lightCastShadow.castShadow = !0,
        this.lightCastShadow.shadow.mapSize.width = 1024,
        this.lightCastShadow.shadow.mapSize.height = 1024,
        this.lightCastShadow.shadow.bias = -9e-4,
        this.scene.add(this.lightCastShadow)),
        this.lightCastShadow.updateMatrixWorld()
    }
    ,
    iy.prototype.getLightDirFromAltitudeAndAzimuth = function(A, e) {
        var t = Math.sin(e)
          , i = Math.cos(e);
        return e > 0 && (i = -i),
        new y(t,i,Math.sin(A) / Math.cos(A)).multiplyScalar(-100)
    }
    ,
    iy.prototype.disableShadowLight = function() {
        this.lightCastShadow && (this.lightCastShadow.visible = !1)
    }
    ,
    iy.prototype.updateShadowLight = function() {
        if (null !== this.scene.geometryGroup.boundingBox && this.lightCastShadow && this.lightCastShadow.visible) {
            var A = this.scene.getBoundingBox().clone()
              , e = new y
              , t = A.getSize(e);
            t.multiplyScalar(.2),
            A.min.sub(t),
            A.max.add(t);
            var i = A.getCenter(new y)
              , o = this.shadowLightDir
              , n = new y(i.x - o.x,i.y - o.y,i.z - o.z);
            this.lightCastShadow.position.set(n.x, n.y, n.z),
            this.lightCastShadow.target.position.set(i.x, i.y, i.z),
            this.lightCastShadow.target.updateMatrixWorld(!0),
            this.lightCastShadow.updateMatrixWorld(!0);
            var r = this.lightCastShadow.shadow.camera;
            r.position.set(n.x, n.y, n.z),
            r.lookAt(i),
            r.updateMatrixWorld(),
            r.matrixWorldInverse.getInverse(r.matrixWorld),
            t = A.getSize(new y),
            A.min.z = A.min.z - .05 * t.z;
            var a = new EA(new y(0,0,1),-A.min.z)
              , s = a.normal.dot(o)
              , l = A.max.clone()
              , c = -(l.dot(a.normal) + a.constant) / s
              , h = new y;
            h.copy(o).multiplyScalar(c).add(l),
            A.expandByPoint(h),
            A.applyMatrix4(r.matrixWorldInverse),
            r.left = A.min.x,
            r.right = A.max.x,
            r.top = A.max.y,
            r.bottom = A.min.y,
            r.far = 1.5 * -A.min.z,
            r.near = -A.max.z,
            r.updateProjectionMatrix()
        }
    }
    ,
    iy.prototype.disableLights = function() {
        if (this.lightArray)
            for (var A = 0, e = this.lightArray.length; e > A; A += 1)
                this.lightArray[A].visible = !1
    }
    ,
    iy.prototype.enableLights = function() {
        if (this.lightArray)
            for (var A = 0, e = this.lightArray.length; e > A; A += 1)
                this.lightArray[A].visible = !0
    }
    ;
    var oy = function() {
        H.call(this),
        this.type = "Scene",
        this.autoUpdate = !1,
        this.tempVector3 = new y,
        this.objectGroups = new ep,
        this.add(this.objectGroups),
        this.geometryGroup = new ep(gp.GEOMETRY,{
            pickableType: Qc.Geometry,
            globalSpace: !0
        }),
        this.geometryGroup.boundingBox = new aA,
        this.pool = new $C(Kf,0),
        this.expandScalar = 1.01,
        this.clipPlanes = null,
        this.fillClipPlane = null,
        this.areaNode = null,
        this.extrudeBodyManager = null,
        this.externalScene = null,
        this.externalComponentManager = null,
        this.customPlaneManager = null,
        this.axisGridManager = null,
        this.lightManager = new iy(this),
        this.selectedMeshes = [],
        this.nonSelectedMeshes = [],
        this.selectedInstanceMeshes = [],
        this.nonSelectedInstanceMeshes = [],
        this.componentTransformControl = void 0
    };
    (oy.prototype = Object.create(H.prototype)).constructor = oy,
    oy.prototype.createCapStencilMaterials = function() {
        this.backMaterial || (this.backMaterial = Kd.createStandardMaterial({
            color: 16711680,
            colorWrite: !1,
            depthWrite: !1,
            depthTest: !1,
            side: 1,
            stencilWrite: !0,
            stencilFunc: 519,
            stencilRef: 1,
            stencilFuncMask: 255,
            stencilFail: 7680,
            stencilZFail: 7680,
            stencilZPass: 7682
        }),
        this.frontMaterial = Kd.createStandardMaterial({
            color: 255,
            colorWrite: !1,
            depthWrite: !1,
            depthTest: !1,
            side: 0,
            stencilWrite: !0,
            stencilFunc: 519,
            stencilRef: 1,
            stencilFuncMask: 255,
            stencilFail: 7680,
            stencilZFail: 7680,
            stencilZPass: 7683
        }),
        this.backInstanceMaterial = Kd.createStandardMaterial({
            color: 16711680,
            colorWrite: !1,
            depthWrite: !1,
            depthTest: !1,
            side: 1,
            stencilWrite: !0,
            stencilFunc: 519,
            stencilRef: 1,
            stencilFuncMask: 255,
            stencilFail: 7680,
            stencilZFail: 7680,
            stencilZPass: 7682
        }),
        this.backInstanceMaterial.defines.USE_INSTANCE = "",
        this.backInstanceMaterial.defines.USE_INSTANCE_NORMAL = "",
        this.frontInstanceMaterial = Kd.createStandardMaterial({
            color: 255,
            colorWrite: !1,
            depthWrite: !1,
            depthTest: !1,
            side: 0,
            stencilWrite: !0,
            stencilFunc: 519,
            stencilRef: 1,
            stencilFuncMask: 255,
            stencilFail: 7680,
            stencilZFail: 7680,
            stencilZPass: 7683
        }),
        this.frontInstanceMaterial.defines.USE_INSTANCE = "",
        this.frontInstanceMaterial.defines.USE_INSTANCE_NORMAL = "")
    }
    ,
    oy.prototype.destroy = function() {
        this.lightManager.destroy(),
        this.clearAll(),
        this.pool.destroy(),
        this.pool = null,
        this.geometryGroup = null,
        this.objectGroups = null,
        this.clipPlanes = null,
        this.fillClipPlane = null,
        this.areaNode = null,
        this.extrudeBodyManager = null,
        this.externalComponentManager = null,
        this.axisGridManager = null,
        this.IBLMaps = null,
        this.transformMatrix = null,
        this.selectedMeshes = null,
        this.nonSelectedMeshes = null,
        this.selectedInstanceMeshes = null,
        this.nonSelectedInstanceMeshes = null
    }
    ,
    oy.prototype.resizePool = function(A) {
        vc.MergeComponent || (this.geometryGroup.clear(),
        this.pool.resize(A, {
            parent: this.geometryGroup
        }))
    }
    ,
    oy.prototype.clearAll = function() {
        this.pool.clear(),
        this.autoUpdate = !1
    }
    ,
    oy.prototype.getRootNode = function() {
        return this.geometryGroup
    }
    ,
    oy.prototype.getBoundingBox = function() {
        var A = this.getBoundingBoxWorld();
        return A.applyMatrix4(this.geometryGroup.matrix),
        A
    }
    ,
    oy.prototype.getGeometryBoundingBox = function() {
        var A = new aA;
        A.copy(this.geometryGroup.boundingBox);
        var e = new y
          , t = A.getSize(e);
        return t.multiplyScalar(this.expandScalar - 1),
        A.min.sub(t),
        A.max.add(t),
        A.applyMatrix4(this.geometryGroup.matrix),
        A
    }
    ,
    oy.prototype.getBoundingBoxWorld = function() {
        var A = new aA
          , e = new y;
        return function() {
            A.copy(this.geometryGroup.boundingBox),
            this.componentTransformControl && A.union(this.componentTransformControl.getBoundingBox());
            var t = A.getSize(e);
            return t.multiplyScalar(this.expandScalar - 1),
            A.min.sub(t),
            A.max.add(t),
            this.fillClipPlane && this.fillClipPlane.visible ? A.expandByObject(this.fillClipPlane) : this.clipPlanes && this.clipPlanes.visible && A.expandByObject(this.clipPlanes),
            A
        }
    }(),
    oy.prototype.setBoundingBoxWorld = function(A) {
        this.geometryGroup.boundingBox ? this.geometryGroup.boundingBox.copy(A) : this.geometryGroup.boundingBox = A;
        var e = A.clone();
        if (this.clipPlanes && this.clipPlanes.visible) {
            var t = e.getSize(new y);
            t.multiplyScalar(this.expandScalar - 1),
            e.min.sub(t),
            e.max.add(t),
            this.clipPlanes.setSectionBox(e.min, e.max)
        }
        if (this.fillClipPlane && this.fillClipPlane.visible) {
            var i = new y;
            e.getSize(i),
            i.multiplyScalar(.05),
            e.min.sub(i),
            e.max.add(i),
            this.fillClipPlane.resize(e.getSize(i), e.getCenter(new y))
        }
    }
    ,
    oy.prototype.expandBoundingBoxWorldBy = function(A) {
        if (A) {
            var e = A;
            A instanceof Array == !1 && (e = [A]);
            for (var t = 0, i = e.length; i > t; t += 1) {
                var o = e[t];
                (o instanceof Ue || o instanceof H) && this.geometryGroup.boundingBox.expandByObject(o)
            }
        }
    }
    ,
    oy.prototype.getTransformMatrixGlobal = function() {
        return this.transformMatrix
    }
    ,
    oy.prototype.getMatrixGlobal = function() {
        return this.geometryGroup.matrix.clone()
    }
    ,
    oy.prototype.getGlobalScaleFactor = function() {
        return this.geometryGroup.matrix.elements[0]
    }
    ,
    oy.prototype.getMatrixWorldGlobal = function() {
        return this.geometryGroup.matrixWorld
    }
    ,
    oy.prototype.getRotationGlobal = function() {
        if (this.geometryGroup.matrix) {
            var A = new M;
            A.extractRotation(this.geometryGroup.matrix);
            var e = new F;
            return e.setFromRotationMatrix(A),
            e
        }
        return null
    }
    ,
    oy.prototype.getTrackingPointFromBoundingBox = function(A, e) {
        if (!this.geometryGroup.boundingBox)
            return null;
        var t = e.origin
          , i = this.getBoundingBox()
          , o = 0
          , n = [new y, new y, new y, new y, new y, new y, new y, new y];
        n[0].set(i.min.x, i.min.y, i.min.z),
        n[1].set(i.min.x, i.min.y, i.max.z),
        n[2].set(i.min.x, i.max.y, i.min.z),
        n[3].set(i.min.x, i.max.y, i.max.z),
        n[4].set(i.max.x, i.min.y, i.min.z),
        n[5].set(i.max.x, i.min.y, i.max.z),
        n[6].set(i.max.x, i.max.y, i.min.z),
        n[7].set(i.max.x, i.max.y, i.max.z);
        for (var r = 0; 8 > r; r += 1) {
            var a = new y;
            a.subVectors(n[r], t);
            var s = a.dot(A);
            s > o && (o = s)
        }
        var l = A.clone().multiplyScalar(o)
          , c = t.clone().add(l)
          , h = new EA;
        return h.setFromNormalAndCoplanarPoint(A, c),
        e.intersectPlane(h, new y)
    }
    ,
    oy.prototype.getNearDepthByRect = function() {
        var A = new aA
          , e = 1 / 0
          , t = new M
          , i = new y;
        function o(A) {
            i.setFromMatrixPosition(A.matrixWorld),
            i.applyProjection(t);
            var o = i.z;
            o >= e || 0 > o || o > 1 || (e = o)
        }
        return function(i, n) {
            function r(e) {
                if (e instanceof Kf) {
                    if (!function(e, t) {
                        if (!t.boundingBox || t instanceof Ue) {
                            var i = t.geometry;
                            null === i.boundingBox && i.computeBoundingBox(),
                            A.copy(i.boundingBox),
                            A.applyMatrix4(t.matrixWorld)
                        } else
                            A.copy(t.boundingBox),
                            A.applyMatrix4(t.matrixWorld);
                        return e.intersectsBox(A)
                    }(i, e))
                        return;
                    o(e)
                } else if (e.worldBoundingBox) {
                    if (!i.intersectsBox(e.worldBoundingBox))
                        return;
                    o(e)
                }
                var t = e.children;
                if (t)
                    for (var n = 0, a = t.length; a > n; n += 1) {
                        var s = t[n];
                        s.visible && r(s)
                    }
            }
            e = 1 / 0,
            t.multiplyMatrices(n.projectionMatrix, n.matrixWorldInverse);
            for (var a = this.geometryGroup.children, s = 0, l = a.length; l > s; s += 1) {
                var c = a[s];
                c.visible && r(c)
            }
            return e
        }
    }(),
    oy.prototype.getExpandScalar = function() {
        return this.expandScalar
    }
    ,
    oy.prototype.hasClipPlanes = function() {
        return null !== this.clipPlanes
    }
    ,
    oy.prototype.getClipPlanes = function(A) {
        var e = this.getBoundingBox()
          , t = e.getSize(new y)
          , i = e.getCenter(this.tempVector3);
        return null === this.clipPlanes ? (this.clipPlanes = new HC(t,i),
        this.objectGroups.add(this.clipPlanes)) : A && this.clipPlanes.setSectionBox(e.min, e.max),
        this.clipPlanes
    }
    ,
    oy.prototype.setClipPlanes = function(A) {
        if (A) {
            var e = this.getClipPlanes();
            A.setFromCenterAndSize(A.getCenter(new y), A.getSize(new y).multiplyScalar(this.expandScalar)),
            e.setSectionBox(A.min, A.max)
        }
    }
    ,
    oy.prototype.resetClipPlanes = function() {
        var A = this.getClipPlanes()
          , e = this.getBoundingBox();
        A.reset(),
        e.max.x !== -1 / 0 && e.max.y !== -1 / 0 && e.max.z !== -1 / 0 && e.min.x !== 1 / 0 && e.min.y !== 1 / 0 && e.min.z !== 1 / 0 ? (e.setFromCenterAndSize(e.getCenter(new y), e.getSize(new y)),
        A.setSectionBox(e.min, e.max)) : this.clipPlanes = null
    }
    ,
    oy.prototype.hasFillClipPlanes = function() {
        return null != this.fillClipPlane
    }
    ,
    oy.prototype.getFillClipPlane = function() {
        var A = new aA;
        A.copy(this.geometryGroup.boundingBox),
        A.applyMatrix4(this.geometryGroup.matrix);
        var e = A.getSize(new y);
        e.multiplyScalar(.05),
        A.min.sub(e),
        A.max.add(e);
        var t = A.getSize(new y)
          , i = A.getCenter(new y);
        return null === this.fillClipPlane ? (this.fillClipPlane = new _C(t,i),
        this.objectGroups.add(this.fillClipPlane)) : this.fillClipPlane.cubeSize.equals(t) || this.fillClipPlane.resize(t, i),
        this.fillClipPlane
    }
    ,
    oy.prototype.disableClipPlanes = function() {
        null != this.clipPlanes && (this.clipPlanes.enable(!1, !1),
        this.clipPlanes.update()),
        null != this.fillClipPlane && (this.fillClipPlane.enable(!1, !1),
        this.fillClipPlane.update())
    }
    ,
    oy.prototype.getAreaNode = function() {
        return this.areaNode
    }
    ,
    oy.prototype.getAxisGridManager = function() {
        return this.axisGridManager
    }
    ,
    oy.prototype.getExtrudeBodyManager = function() {
        return null === this.extrudeBodyManager && (this.extrudeBodyManager = new ty,
        this.objectGroups.add(this.extrudeBodyManager),
        this.extrudeBodyManager.matrix.copy(this.geometryGroup.matrix),
        this.extrudeBodyManager.matrixAutoUpdate = !1,
        this.extrudeBodyManager.updateMatrixWorld(!0)),
        this.extrudeBodyManager
    }
    ,
    oy.prototype.getCustomPlaneManager = function() {
        return this.customPlaneManager
    }
    ,
    oy.prototype.getExternalScene = function() {
        return null === this.externalScene && (this.externalScene = new ey,
        this.add(this.externalScene),
        this.externalScene.updateMatrixWorld(!0)),
        this.externalScene
    }
    ,
    oy.prototype.shrinkScopeByClipPlane = function(A, e) {
        if (this.clipPlanes && this.clipPlanes.isEnabled()) {
            var t = this.clipPlanes.hitTest(A);
            if (null === t.distance && void 0 === t.distance)
                return;
            t.sign ? t.distance > e.near && (e.near = t.distance) : e.far > t.distance && (e.far = t.distance)
        }
    }
    ,
    oy.prototype.updateWorldMatrixByMatrix = function(A) {
        for (var e = this.objectGroups.children, t = 0, i = e.length; i > t; t += 1)
            e[t].globalSpace && (e[t].matrix.copy(A),
            e[t].matrixAutoUpdate = !1,
            e[t].updateMatrixWorld(!0))
    }
    ,
    oy.prototype.currentLights = function() {
        return this.lightManager.currentLights()
    }
    ,
    oy.prototype.setLightPreset = function(A) {
        this.lightManager.setLightPreset(A)
    }
    ,
    oy.prototype.getLightPreset = function() {
        return this.lightManager.getLightPreset()
    }
    ,
    oy.prototype.setLightIntensityFactor = function(A) {
        this.lightManager.setIntensityFactor(A)
    }
    ,
    oy.prototype.updateLights = function(A) {
        this.lightManager.updateLights(A)
    }
    ,
    oy.prototype.setAmbientLightIntensity = function(A) {
        this.lightManager.setAmbientLightIntensity(A)
    }
    ,
    oy.prototype.getAmbientLightIntensity = function() {
        return this.lightManager.getAmbientLightIntensity()
    }
    ,
    oy.prototype.getOrCreateGroup = function(A, e) {
        for (var t = this.objectGroups.children, i = 0, o = t.length; o > i; i += 1)
            if (t[i].name === A)
                return t[i];
        var n = new ep(A,e);
        return n.isGlobalSpace() && (n.matrix.copy(this.geometryGroup.matrix),
        n.matrixAutoUpdate = !1,
        n.updateMatrixWorld(!0)),
        this.objectGroups.add(n),
        n
    }
    ,
    oy.prototype.getGroup = function(A) {
        for (var e = this.objectGroups.children, t = 0, i = e.length; i > t; t += 1)
            if (e[t].name === A)
                return e[t];
        return null
    }
    ,
    oy.prototype.getGroupType = function(A) {
        var e = A.split("|");
        return {
            groupType: e[0],
            modelKey: e.length > 1 ? e[1] : void 0
        }
    }
    ,
    oy.prototype.getGroups = function() {
        return this.objectGroups.children
    }
    ,
    oy.prototype.removeGroup = function(A) {
        this.objectGroups.remove(A)
    }
    ,
    oy.prototype.removeGroupByName = function(A) {
        this.objectGroups.removeByName(A)
    }
    ,
    oy.prototype.hasGroup = function(A) {
        return this.objectGroups.hasChild(A)
    }
    ,
    oy.prototype.prepareScene = function() {}
    ,
    oy.prototype.parseRootNode = function(A) {
        var e = this.geometryGroup
          , t = uh.box3FromObject(A.minBoundary, A.maxBoundary);
        null === e.boundingBox || e.boundingBox.isEmpty() ? e.boundingBox = t : (e.boundingBox.expandByPoint(t.min),
        e.boundingBox.expandByPoint(t.max)),
        e.updateMatrixWorld(!0)
    }
    ,
    oy.prototype.intersectToWorld = function(A, e) {
        var t = this.getMatrixGlobal();
        A.worldPosition = Tu.getWorldPositionOfMesh(A.point, t);
        var i = e.getComponentInfoByUserId(A.userId);
        i && (A.worldBoundingBox = i.boundingBox.clone())
    }
    ,
    oy.prototype.worldToDrawing = function(A) {
        var e = this.getMatrixGlobal()
          , t = new y(A.x,A.y,A.z);
        return t.applyMatrix4(e),
        t
    }
    ,
    oy.prototype.drawingToWorld = function(A) {
        var e = this.getMatrixGlobal()
          , t = new M;
        t.getInverse(e);
        var i = new y(A.x,A.y,A.z);
        return i.applyMatrix4(t),
        i
    }
    ,
    oy.prototype.getBoundingBoxWorldByMesh = function(A) {
        var e = this.getMatrixGlobal()
          , t = A.boundingBox;
        t || (A.geometry.boundingBox || A.geometry.computeBoundingBox(),
        t = A.geometry.boundingBox);
        var i = t.clone();
        i.applyMatrix4(A.matrixWorld);
        var o = new M;
        return o.getInverse(e),
        i.applyMatrix4(o),
        i
    }
    ,
    oy.prototype.getObjectPool = function() {
        return this.pool
    }
    ,
    oy.prototype.getBoundingBoxOfGeometries = function(A) {
        var e = new aA
          , t = [];
        if (Array.isArray(A))
            t = A;
        else
            for (var i in A)
                A.hasOwnProperty(i) && t.push(i);
        for (var o = 0, n = t.length; n > o; o += 1) {
            var r = this.objectGroups.getObjectByProperty("key", t[o]);
            if (r) {
                var a = r.geometry;
                if (a) {
                    a.boundingBox || a.computeBoundingBox();
                    var s = a.boundingBox;
                    if (s) {
                        var l = s.clone();
                        r.matrixWorld && l.applyMatrix4(r.matrixWorld),
                        e.expandByPoint(l.min),
                        e.expandByPoint(l.max)
                    }
                } else
                    Bh.log("empty geometry!")
            }
        }
        return e
    }
    ,
    oy.prototype.adjustInstanceVisibility = function(A) {
        this.traverse((function(e) {
            if ((e instanceof Ue || e instanceof jo) && e.geometry instanceof Na) {
                var t = e.visible;
                A && !e.bVisible || (e.visible = A),
                e.bVisible = t
            }
        }
        ))
    }
    ,
    oy.prototype.adjustVisibility = function(A) {
        this.traverse((function(e) {
            if ((e instanceof Ue || e instanceof jo) && !(e.geometry instanceof Na)) {
                var t = e.visible;
                A && !e.bVisible || (e.visible = A),
                e.bVisible = t
            }
        }
        ))
    }
    ,
    oy.prototype.changeVisibilityOfSelectedObjects = function(A) {
        var e = this;
        A || (e.selectedMeshes.length = 0,
        e.selectedInstanceMeshes.length = 0);
        var t = e.selectedMeshes
          , i = e.selectedInstanceMeshes;
        this.traverse((function(o) {
            (o instanceof Ue || o instanceof jo) && (o.geometry instanceof Na ? A ? function(A) {
                for (var t = 0, i = e.selectedInstanceMeshes.length; i > t; t += 1) {
                    if (A === e.selectedInstanceMeshes[t].object) {
                        for (var o = e.selectedInstanceMeshes[t].indices, n = A.geometry.getAttribute("vState").array, r = 0, a = o.length; a > r; r += 1)
                            n[o[r]] = Hc.SELECTED;
                        A.geometry.getAttribute("vState").needsUpdate = !0
                    }
                }
            }(o) : function(A) {
                if (A.visible) {
                    for (var e = [], t = A.geometry.getAttribute("vState").array, o = 0; t.length > o; o += 1)
                        t[o] === Hc.SELECTED && (e.push(o),
                        t[o] = Hc.HIDDEN);
                    e.length && (A.geometry.getAttribute("vState").needsUpdate = !0,
                    i.push({
                        object: A,
                        indices: e
                    }))
                }
            }(o) : A ? function(A) {
                for (var t = 0, i = e.selectedMeshes.length; i > t; t += 1) {
                    if (A === e.selectedMeshes[t].object)
                        for (var o = e.selectedMeshes[t].indices, n = 0, r = o.length; r > n; n += 1) {
                            var a = o[n]
                              , s = A.geometry.groups[a.idx];
                            s.start = a.start,
                            s.count = a.count
                        }
                }
            }(o) : function(A) {
                if (A._indicesGroup && A.visible) {
                    var e = []
                      , i = A.geometry.groups;
                    if (i && i.length) {
                        for (var o = 0, n = i.length; n > o; o += 1) {
                            var r = i[o];
                            r.materialIndex === zc.SELECTED && (e.push({
                                idx: o,
                                start: r.start,
                                count: r.count
                            }),
                            r.start = 0,
                            r.count = 0)
                        }
                        e.length && t.push({
                            object: A,
                            indices: e
                        })
                    }
                }
            }(o))
        }
        ))
    }
    ,
    oy.prototype.changeVisibilityOfNonSelectedObjects = function(A) {
        var e = this;
        A || (e.nonSelectedMeshes.length = 0,
        e.nonSelectedInstanceMeshes.length = 0);
        var t = e.nonSelectedMeshes
          , i = e.nonSelectedInstanceMeshes;
        this.traverse((function(o) {
            (o instanceof Ue || o instanceof jo) && (o.geometry instanceof Na ? A ? function(A) {
                for (var t = 0, i = e.nonSelectedInstanceMeshes.length; i > t; t += 1) {
                    if (A === e.nonSelectedInstanceMeshes[t].object) {
                        for (var o = e.nonSelectedInstanceMeshes[t].indices, n = A.geometry.getAttribute("vState").array, r = 0, a = o.length; a > r; r += 1)
                            n[o[r].idx] = o[r].state;
                        A.geometry.getAttribute("vState").needsUpdate = !0
                    }
                }
            }(o) : function(A) {
                if (A.visible) {
                    for (var e = [], t = A.geometry.getAttribute("vState").array, o = 0, n = t.length; n > o; o += 1)
                        t[o] !== Hc.SELECTED && t[o] !== Hc.HIDDEN && (e.push({
                            idx: o,
                            state: t[o]
                        }),
                        t[o] = Hc.HIDDEN);
                    e.length && (A.geometry.getAttribute("vState").needsUpdate = !0,
                    i.push({
                        object: A,
                        indices: e
                    }))
                }
            }(o) : A ? function(A) {
                for (var t = 0, i = e.nonSelectedMeshes.length; i > t; t += 1) {
                    if (A === e.nonSelectedMeshes[t].object) {
                        var o = e.nonSelectedMeshes[t].indices;
                        if (null === o)
                            A.visible = !0;
                        else
                            for (var n = 0, r = o.length; r > n; n += 1) {
                                var a = o[n]
                                  , s = A.geometry.groups[a.idx];
                                s.start = a.start,
                                s.count = a.count
                            }
                    }
                }
            }(o) : function(A) {
                if (A._indicesGroup && A.visible) {
                    var e = []
                      , i = A.geometry.groups;
                    if (i && i.length) {
                        for (var o = 0, n = i.length; n > o; o += 1) {
                            var r = i[o];
                            r.materialIndex !== zc.SELECTED && (e.push({
                                idx: o,
                                start: r.start,
                                count: r.count
                            }),
                            r.start = 0,
                            r.count = 0)
                        }
                        e.length ? t.push({
                            object: A,
                            indices: e
                        }) : (A.visible = !1,
                        t.push({
                            object: A,
                            indices: null
                        }))
                    } else
                        A.visible = !1,
                        t.push({
                            object: A,
                            indices: null
                        })
                }
            }(o))
        }
        ))
    }
    ,
    oy.prototype.clearSelectedAndNonSelectedMeshes = function() {
        this.selectedMeshes.length = 0,
        this.nonSelectedMeshes.length = 0,
        this.selectedInstanceMeshes.length = 0,
        this.nonSelectedInstanceMeshes.length = 0
    }
    ,
    oy.prototype.setSkyBox = function(A, e, t, i, o) {
        var n = A
          , r = e || [Pd.skyBoxLeft, Pd.skyBoxRight, Pd.skyBoxBack, Pd.skyBoxFront, Pd.skyBoxUp, Pd.skyBoxDown]
          , a = this;
        (new $r).setPath(n).load(r, (function(A) {
            a.background = A,
            t && t()
        }
        ), i, o)
    }
    ,
    oy.prototype.drawBoundingBox = function(A) {
        if (A) {
            var e = this.getOrCreateGroup("BoundingBox", {
                pickable: 0,
                priority: 2
            })
              , t = this.getBoundingBox();
            void 0 === this.boudingBoxNode ? (this.boudingBoxNode = new Ay(t,16711680),
            e.add(this.boudingBoxNode)) : this.boudingBoxNode.updateBBox(t),
            this.boudingBoxNode.updateMatrixWorld(!0)
        } else
            this.removeGroupByName("BoundingBox")
    }
    ,
    oy.prototype.calculateGisMapBox = function(A) {
        var e = this.getGroup("ExternalComponentManager")
          , t = this.getBoundingBoxWorld()
          , i = t.clone();
        if (e) {
            var o = A.position.clone()
              , n = this.getMatrixWorldGlobal()
              , r = (new M).getInverse(n);
            o.applyMatrix4(r);
            var a = 6370856e3
              , s = o.z - t.min.z;
            s = Math.abs(s);
            var l = a * Math.acos(a / (a + s));
            i.min.x = o.x - l,
            i.max.x = o.x + l,
            i.min.y = o.y - l,
            i.max.y = o.y + l,
            i.min.z = t.min.z,
            i.max.z = t.max.z
        }
        return i
    }
    ,
    oy.prototype.getReceivingPlane = function(A) {
        if (!this.receivingPlane) {
            this.receivingPlane = this.getOrCreateGroup(gp.RECEIVESHADOWPLANE);
            var e = new mr;
            e.transparent = !0,
            e.opacity = .2,
            e.side = 2;
            var t = new Ue(new et(1e6,1e6),e);
            t.receiveShadow = !0,
            this.receivingPlane.add(t),
            this.add(this.receivingPlane),
            this.receivingPlane.matrixAutoUpdate = !1,
            this.updateReceivingPlane()
        }
        return this.receivingPlane.visible = A,
        this.receivingPlane
    }
    ,
    oy.prototype.updateReceivingPlane = function() {
        var A = this.receivingPlane.children[0]
          , e = this.getBoundingBoxWorld()
          , t = e.getCenter(new y)
          , i = e.getSize(new y);
        A.position.z = e.min.z - .05 * i.z,
        A.position.x = t.x,
        A.position.y = t.y,
        A.scale.x = i.x / 1e4,
        A.scale.y = i.y / 1e4,
        this.receivingPlane.updateMatrixWorld(!0)
    }
    ,
    Object.defineProperties(oy.prototype, {
        lightArray: {
            get: function() {
                return Bh.warn("EIMMODEL.Scene: .lightArray 现在为 .lightManager.lightArray"),
                this.lightManager.lightArray
            }
        },
        lightHelperArray: {
            get: function() {
                return Bh.warn("EIMMODEL.Scene: .lightHelperArray 现在为 .lightManager.lightHelperArray"),
                this.lightManager.lightHelperArray
            }
        }
    });
    var ny = function(A) {
        this.selectionSet = {},
        this.selectionMaterial = Kd.createHighlightMaterial(),
        this.selectionMaterial.colorState = Yc.SELECT,
        this.selectionMaterial.name = "selection",
        this.selectionMaterial.refreshUniforms(),
        this.hoverId = void 0,
        this.hoverMaterialDefaultParams = {
            color: 14540253,
            opacity: .9,
            transparent: !0,
            side: 2
        },
        this.hoverMaterial = Kd.createStandardMaterial(this.hoverMaterialDefaultParams),
        this.hoverMaterial.name = "hover",
        this.boxMaterialDefaultParams = {
            color: 16776960,
            opacity: 1,
            transparent: !1
        },
        this.boxMaterial = new ko(this.boxMaterialDefaultParams),
        this.boxMaterial.name = "box",
        this.modelManager = A,
        this.blinkComponentIds = {};
        var e = this;
        this.filter = A.filter,
        this.filter.observerForSceneState = function(t) {
            e.removeSelection(t),
            e.clearBlinkComponentsById(t),
            A.viewerImpl.render()
        }
        ,
        this.phongHoverMaterial = new Ir(this.hoverMaterialDefaultParams),
        this.phongSelectionMaterial = new Ir(vc.SelectionColor)
    };
    ny.prototype = {
        constructor: ny,
        destroy: function() {
            this.selectionSet = null,
            this.blinkComponentIds = null,
            this.modelManager = null,
            this.selectionMaterial.destroy(),
            this.selectionMaterial = null,
            this.hoverMaterial.destroy(),
            this.hoverMaterial = null,
            this.phongHoverMaterial.dispose(),
            this.phongHoverMaterial = null,
            this.phongSelectionMaterial.dispose(),
            this.phongSelectionMaterial = null
        },
        _dispatchChangeEvent: function() {
            var A = this.getSelection();
            if (vc.EnableSelectionBoundingBox) {
                var e = this.modelManager.scene.getOrCreateGroup("BoundingBox");
                if (A && A.length > 0) {
                    var t = this.modelManager.viewerImpl.getBoundingBoxByIds(A);
                    if (t.isEmpty())
                        return void (e.visible = !1);
                    e.visible = !0;
                    var i = e.getObjectByName("Box");
                    if (!i) {
                        var o = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7])
                          , n = new Float32Array(24)
                          , r = new he;
                        r.setIndex(new YA(o,1)),
                        r.setAttribute("position", new YA(n,3)),
                        (i = new jo(r,this.boxMaterial)).name = "Box",
                        i.matrixAutoUpdate = !1,
                        e.add(i)
                    }
                    var a = i.geometry.attributes.position
                      , s = a.array
                      , l = t.min
                      , c = t.max;
                    s[0] = c.x,
                    s[1] = c.y,
                    s[2] = c.z,
                    s[3] = l.x,
                    s[4] = c.y,
                    s[5] = c.z,
                    s[6] = l.x,
                    s[7] = l.y,
                    s[8] = c.z,
                    s[9] = c.x,
                    s[10] = l.y,
                    s[11] = c.z,
                    s[12] = c.x,
                    s[13] = c.y,
                    s[14] = l.z,
                    s[15] = l.x,
                    s[16] = c.y,
                    s[17] = l.z,
                    s[18] = l.x,
                    s[19] = l.y,
                    s[20] = l.z,
                    s[21] = c.x,
                    s[22] = l.y,
                    s[23] = l.z,
                    a.needsUpdate = !0
                } else
                    e.visible = !1
            } else {
                var h = this.modelManager.scene.getObjectByName("BoundingBox");
                h && (h.visible = !1)
            }
            this.modelManager.dispatchEvent({
                type: Rc.ON_SELECTION_CHANGED,
                selectionList: A
            })
        },
        clearSelection: function(A) {
            var e, t = !1;
            if (void 0 === A) {
                var i = [];
                for (var o in this.selectionSet) {
                    for (var n in t = !1,
                    e = this.getSelectionSet(o))
                        if (e.hasOwnProperty(n)) {
                            t = !0;
                            break
                        }
                    t && i.push(o)
                }
                if (i.length) {
                    for (var r = 0, a = i.length; a > r; r += 1)
                        this.selectionSet[i[r]] = {},
                        this.modelManager.clearSelection(i[r]);
                    this._dispatchChangeEvent()
                }
            } else {
                for (var n in e = this.getSelectionSet(A))
                    if (e.hasOwnProperty(n)) {
                        t = !0;
                        break
                    }
                t && (this.selectionSet[A] = {},
                this.modelManager.clearSelection(A),
                this._dispatchChangeEvent())
            }
        },
        addSelection: function(A, e) {
            if (A && A.length >= 1) {
                var t, i = [], o = !1, n = this.modelManager, r = this.filter;
                if (void 0 === e) {
                    for (var a = {}, s = n.getModelKeys(), l = [], c = 0, h = s.length; h > c; c += 1) {
                        var d = s[c];
                        t = this.getSelectionSet(d),
                        o = !1;
                        for (var p = A.length - 1; p >= 0; p -= 1) {
                            n.isUserIdExist(f = A[p], d) && (!t[f] && r.isComponentActive(f, d) && (t[f] = !0,
                            o = !0),
                            a[f] = !0)
                        }
                        o && l.push(d)
                    }
                    for (p = A.length - 1; p >= 0; p -= 1) {
                        a[f = A[p]] || i.push(f)
                    }
                    if (i.length > 0 && n.dispatchEvent({
                        type: Rc.ON_SELECTION_FAILED,
                        failedId: i
                    }),
                    l.length) {
                        for (var g = 0, u = l.length; u > g; g += 1)
                            this.modelManager.applySelection(l[g]);
                        this._dispatchChangeEvent()
                    }
                } else {
                    t = this.getSelectionSet(e);
                    for (p = A.length - 1; p >= 0; p -= 1) {
                        var f;
                        n.isUserIdExist(f = A[p], e) ? !t[f] && r.isComponentActive(f, e) && (t[f] = !0,
                        o = !0) : i.push(f)
                    }
                    i.length > 0 && n.dispatchEvent({
                        type: Rc.ON_SELECTION_FAILED,
                        failedId: i
                    }),
                    o && (this.modelManager.applySelection(e),
                    this._dispatchChangeEvent())
                }
            }
        },
        setSelection: function(A, e) {
            if (A && A.length >= 1)
                if (void 0 === e) {
                    for (var t in this.selectionSet)
                        delete this.selectionSet[t];
                    this.addSelection(A)
                } else
                    this.selectionSet[e] = {},
                    this.addSelection(A, e)
        },
        removeSelection: function(A, e) {
            if (A && A.length >= 1) {
                var t = !1;
                if (void 0 === e) {
                    var i = [];
                    for (var o in this.selectionSet) {
                        var n = this.getSelectionSet(o);
                        t = !1;
                        for (var r = 0, a = A.length; a > r; r += 1) {
                            var s = A[r];
                            n[s] && (delete n[s],
                            t = !0)
                        }
                        t && i.push(o)
                    }
                    if (i.length) {
                        for (var l = 0, c = i.length; c > l; l += 1)
                            this.modelManager.applySelection(i[l]);
                        this._dispatchChangeEvent()
                    }
                } else {
                    for (var h = this.getSelectionSet(e), d = 0, p = A.length; p > d; d += 1) {
                        var g = A[d];
                        h[g] && (delete h[g],
                        t = !0)
                    }
                    t && (this.modelManager.applySelection(e),
                    this._dispatchChangeEvent())
                }
            }
        },
        getSelection: function(A) {
            var e = {};
            if (void 0 === A)
                for (var t in this.selectionSet)
                    for (var i = this.getSelectionSet(t), o = Object.keys(i), n = 0, r = o.length; r > n; n += 1)
                        e[o[n]] = !0;
            else
                e = this.getSelectionSet(t);
            return Object.keys(e)
        },
        hasSelection: function(A) {
            var e, t = !1;
            if (void 0 === A)
                for (var i in this.selectionSet) {
                    for (var o in e = this.getSelectionSet(i))
                        if (e.hasOwnProperty[o]) {
                            t = !0;
                            break
                        }
                    if (t)
                        break
                }
            else
                for (var o in e = this.getSelection(A))
                    if (e.hasOwnProperty[o]) {
                        t = !0;
                        break
                    }
            return t
        },
        getSelectionSet: function(A) {
            if (void 0 === A) {
                var e = {};
                for (var t in this.selectionSet)
                    for (var i = this.getSelectionSet(t), o = Object.keys(i), n = 0, r = o.length; r > n; n += 1)
                        e[o[n]] = !0;
                return e
            }
            return void 0 === this.selectionSet[A] && (this.selectionSet[A] = {}),
            this.selectionSet[A]
        },
        isSelected: function(A, e) {
            var t, i = !1;
            if (void 0 === e) {
                for (var o in this.selectionSet)
                    if ((t = this.selectionSet[o]) && t[A]) {
                        i = !0;
                        break
                    }
            } else
                (t = this.selectionSet[e]) && t[A] && (i = !0);
            return i
        },
        setHoverId: function(A, e) {
            this.hoverId = A,
            this.modelManager.applyHover(e)
        },
        clearHover: function(A) {
            this.hoverId = void 0,
            this.modelManager.clearHover(A)
        },
        getHoverMaterial: function(A) {
            var e = A && A.isMeshPhongMaterial ? this.phongHoverMaterial.clone() : this.hoverMaterial.clone();
            if (A && A.hasOwnProperty("color")) {
                var t = A.color.clone()
                  , i = Math.max(t.r, Math.max(t.g, t.b));
                0 === i && (i = .5),
                t.r += 0 === t.r ? .3 * i : .2 * t.r,
                t.g += 0 === t.g ? .3 * i : .2 * t.g,
                t.b += 0 === t.b ? .3 * i : .2 * t.b,
                t.r > 1 && (t.r = 1),
                t.g > 1 && (t.g = 1),
                t.b > 1 && (t.b = 1),
                1 === t.r && 1 === t.g && 1 === t.b && (t.r = .87,
                t.g = .87,
                t.b = .87),
                e.color.setHex(t.getHex()),
                e.opacity = void 0 !== A.opacity ? A.opacity : this.hoverMaterialDefaultParams.opacity,
                e.transparent = void 0 !== A.transparent ? A.transparent : this.hoverMaterialDefaultParams.transparent,
                e.side = void 0 !== A.side ? A.side : this.hoverMaterialDefaultParams.side,
                void 0 !== A.metalness && (e.metalness = A.metalness),
                void 0 !== A.roughness && (e.roughness = A.roughness),
                void 0 !== A.bumpMap && (e.bumpMap = A.bumpMap),
                void 0 !== A.alphaMap && (e.alphaMap = A.alphaMap),
                void 0 !== A.emissiveMap && (e.emissiveMap = A.emissiveMap),
                void 0 !== A.envMap && (e.envMap = A.envMap),
                void 0 !== A.envMapIntensity && (e.envMapIntensity = A.envMapIntensity),
                null != A.map && (e.map = A.map),
                e.opacity = Kd.getHoverOpacity(e.opacity),
                e.transparent = !0,
                e.needsUpdate = !0
            }
            return e
        },
        getHoverColorByMaterial: function(A) {
            var e = void 0 !== A.opacity ? A.opacity : this.hoverMaterialDefaultParams.opacity;
            if (e = Kd.getHoverOpacity(e),
            !A.hasOwnProperty("color"))
                return {
                    rgbaColor: [this.hoverMaterial.color.r, this.hoverMaterial.color.g, this.hoverMaterial.color.b, e],
                    transparent: !0
                };
            var t = A.color.clone();
            return {
                rgbaColor: [t.r, t.g, t.b, e],
                transparent: !0
            }
        },
        setSelectionColor: function(A, e) {
            var t = this.selectionMaterial.opacity;
            e = void 0 === e ? t : e,
            "0x" + this.selectionMaterial.color.getHexString() === A && t === e || (this.selectionMaterial.color.setHex(A),
            e && (this.selectionMaterial.opacity = e),
            this.selectionMaterial.needsUpdate = !0)
        },
        getSelectionColor: function() {
            var A = this.selectionMaterial.opacity;
            return new Xh(this.selectionMaterial.color.getHex(),A)
        },
        getSelectionMaterial: function() {
            return this.selectionMaterial.clone()
        },
        setBlinkComponentsById: function(A, e) {
            if (this.blinkComponentIds = {},
            A && 0 !== A.length) {
                for (var t = A.length - 1; t >= 0; t -= 1) {
                    this.filter.isComponentActive(A[t], e) && (this.blinkComponentIds[A[t]] = !0)
                }
                this.modelManager.applyBlink()
            }
        },
        addBlinkComponentsById: function(A, e) {
            if (A && A.length) {
                for (var t = this.blinkComponentIds, i = !1, o = A.length - 1; o >= 0; o -= 1) {
                    var n = A[o];
                    !t[n] && this.filter.isComponentActive(n) && (t[n] = !0,
                    i = !0)
                }
                i && this.modelManager.applyBlink()
            }
        },
        clearBlinkComponentsById: function(A, e) {
            if (A && A.length) {
                for (var t = !1, i = this.blinkComponentIds, o = 0, n = A.length; n > o; o += 1) {
                    var r = A[o];
                    i[r] && (delete i[r],
                    t = !0)
                }
                t && this.modelManager.applyBlink()
            }
        },
        clearAllBlinkComponents: function() {
            var A = !1;
            uh.isOwnEmptyObject(this.blinkComponentIds) || (A = !0,
            this.blinkComponentIds = {}),
            A && this.modelManager.clearBlink()
        },
        getBlinkComponents: function() {
            return Object.keys(this.blinkComponentIds)
        },
        getBlinkComponentsIdMap: function(A) {
            var e = this;
            if (this.modelManager.getBlinkEnabled()) {
                if (A) {
                    var t = this.getBlinkComponents()
                      , i = {};
                    return t.forEach((function(t) {
                        var o = e.modelManager.filterHelper.distributeId(t)
                          , n = o.modelKey
                          , r = o.objectId;
                        n && n.toString() !== A.toString() || (i[r] = e.blinkComponentIds[t])
                    }
                    )),
                    i
                }
                return this.blinkComponentIds
            }
            return null
        },
        getBlinkMaterial: function(A) {
            return Kd.getBlinkMaterial(A, this.modelManager.getBlinkColor())
        },
        getBoxMaterial: function() {
            return this.boxMaterial.clone()
        },
        setBoxColor: function(A, e) {
            var t = this.boxMaterial.opacity;
            e = void 0 === e ? t : e,
            "0x" + this.boxMaterial.color.getHexString() === A && t === e || (this.boxMaterial.color.setHex(A),
            e && (this.boxMaterial.opacity = e),
            this.boxMaterial.needsUpdate = !0,
            this.boxMaterial.color.setHex(A),
            this.boxMaterial.needsUpdate = !0)
        }
    };
    var ry = function() {
        this.hiddenUserIdMap = {}
    };
    ry.prototype.destroy = function() {
        this.hiddenUserIdMap = null
    }
    ,
    ry.prototype.hideByUserId = function(A, e) {
        this.hiddenUserIdMap || (this.hiddenUserIdMap = {}),
        this.hiddenUserIdMap[A] = !!e
    }
    ,
    ry.prototype.cancelHiddenByUserId = function(A) {
        this.hiddenUserIdMap && delete this.hiddenUserIdMap[A]
    }
    ,
    ry.prototype.cancelAllHidden = function() {
        this.hiddenUserIdMap = null
    }
    ,
    ry.prototype.isHidden = function(A) {
        return !!this.hiddenUserIdMap[A]
    }
    ,
    ry.prototype.hasHidden = function() {
        return !uh.isEmptyObject(this.hiddenUserIdMap)
    }
    ;
    var ay = function() {
        this.materialDefaultParams = {
            color: 14540253,
            opacity: .5,
            transparent: !0,
            side: 0
        },
        this.material = Kd.createPhongMaterial(this.materialDefaultParams)
    };
    ay.prototype.destroy = function() {
        this.material = null
    }
    ,
    ay.prototype.resetColor = function() {
        this.material.color.setHex(this.materialDefaultParams.color)
    }
    ,
    ay.prototype.resetOpacity = function() {
        this.material.opacity = this.materialDefaultParams.opacity
    }
    ,
    ay.prototype.reset = function() {
        this.material.color.setHex(this.materialDefaultParams.color),
        this.material.opacity = this.materialDefaultParams.opacity,
        this.material.transparent = this.materialDefaultParams.transparent,
        this.material.side = this.materialDefaultParams.side,
        this.material.needsUpdate = !0
    }
    ;
    var sy = function(A) {
        this.manager = A,
        this.requestCount = 0,
        this.maxRequestCount = 1e5,
        this.loading = !1,
        this.delayIntervalTime = 300
    };
    sy.prototype.destroy = function() {
        this.manager = null,
        this.currentConditions = null,
        this.delayLoadTimer && (clearTimeout(this.delayLoadTimer),
        this.delayLoadTimer = null)
    }
    ,
    sy.prototype.isValidModel = function(A) {
        return !(A.isEmptyScene() || !A.isLayerData())
    }
    ,
    sy.prototype.loadGeopkOnDemandByConditionsWithDelay = function(A, e, t, i) {
        var o = this
          , n = this.delayIntervalTime;
        o.delayLoadTimer && clearTimeout(o.delayLoadTimer),
        o.delayLoadTimer = setTimeout((function() {
            o.loadGeopkOnDemandByConditions(A, e, t, i)
        }
        ), n)
    }
    ,
    sy.prototype.loadGeopkOnDemandByConditions = function(A, e, t, i) {
        if (this.currentConditions = A,
        this.requestCount += 1,
        this.requestCount > this.maxRequestCount && (this.requestCount = 0),
        !this.loading) {
            this.loading = !0;
            var o = this;
            requestAnimationFrame(function A(n) {
                var r = n
                  , a = o.currentConditions;
                return function() {
                    o._loadGeopkOnDemandByConditions(a, e, t, (function() {
                        r !== o.requestCount ? requestAnimationFrame(A(o.requestCount)) : (o.loading = !1,
                        i && i(a),
                        a = null)
                    }
                    ))
                }
            }(this.requestCount))
        }
    }
    ,
    sy.prototype._loadGeopkOnDemandByConditions = function(A, e, t, i) {
        var o = this;
        this.manager.traverseModels((function(n) {
            o.isValidModel(n) && n._getHandler().loadGeopkOnDemand(A, e, t, i)
        }
        ))
    }
    ,
    sy.prototype.getBoundingBoxOnDemand = function() {
        var A = new aA
          , e = this;
        return this.manager.traverseModels((function(t) {
            if (e.isValidModel(t)) {
                var i = t._getHandler().getLayerProvider().getUnionBoundingBoxOnDemand();
                i && A.union(i)
            }
        }
        )),
        A.isEmpty() ? null : A
    }
    ,
    sy.prototype.isLoading = function() {
        return this.loading
    }
    ,
    sy.prototype.getBoundingBoxForUsedComponent = function() {
        var A = this.manager
          , e = new aA;
        return A.traverseModels((function(t) {
            var i = t.getLoadedUserIdsObject();
            i && e.union(A.getBoundingBoxByIds(i))
        }
        )),
        e.isEmpty() ? null : e
    }
    ;
    var ly = function(A, e) {
        vc.UseWorker && mh.isSupportWorker() && (this.websocketWorker = new Worker("src/worker/WebsocketWorker.js"),
        this.prepareDataWorkers = new Worker("src/worker/PrepareDataWorker.js")),
        mh.isMobileDevice() && (vc.maxObjectNumInPool = 6e3,
        vc.maxDrawCacheNum = 4e3),
        this.scene = new oy(this),
        this.filter = A,
        this.crossOrigin = !0,
        this.models = {},
        this.viewerImpl = e,
        this.materialPool = null,
        this.occlusionCamera = null,
        this.containsCamera = !1,
        this.highPriorityCategories = {
            inner: {},
            outer: {}
        },
        this.octantToObjectMap = {},
        this.instanceGeometries = {},
        this.sceneState = new ny(this),
        this.modelState = new ny(this),
        this.filter.setSceneStateHelper(this.sceneState),
        this.rotation = new f,
        this.boundingBox = new aA,
        this.explosionList = {},
        this.IBLMaterial = !1,
        this.clippingCaps = !1,
        this.blinkStartTime = null,
        this.blinkEnabled = !1,
        this.blinkIntervalTime = 600,
        this.blinkPermited = !1,
        this.defaultBlinkColor = (new LA).setHex(3330982),
        this.defaultBlinkAlpha = 1,
        this.blinkColor = new p(this.defaultBlinkColor.r,this.defaultBlinkColor.g,this.defaultBlinkColor.b,this.defaultBlinkAlpha),
        this.selectPriority = !0,
        this.materialOverrideSet = null,
        this.plugins = [],
        this.cameraFov = 0,
        this.cameraPosition = new y,
        this.domElementWidth = 1,
        this.transformComponent = {}
    };
    Object.assign(ly.prototype, Ld.prototype),
    ly.prototype.destroy = function() {
        for (var A in this.removeAllEventListener(),
        this.models)
            this.models[A].destroy();
        this.models = null,
        this.octantToObjectMap = null,
        this.materialPool && (this.materialPool.destroy(),
        this.materialPool = null),
        this.occlusionCamera && (this.occlusionCamera = null);
        for (var e = 0, t = this.plugins.length; t > e; e += 1)
            this.plugins[e].destroy();
        this.plugins = null,
        this.loadOnDemandDirector && (this.loadOnDemandDirector.destroy(),
        this.loadOnDemandDirector = null),
        this.highPriorityCategories = null,
        this.rotation = null,
        this.boundingBox = null,
        this.scene.destroy(),
        this.scene = null,
        this.filter = null,
        this.sceneState.destroy(),
        this.sceneState = null,
        this.modelState.destroy(),
        this.modelState = null,
        this.blinkStartTime = null,
        this.defaultBlinkColor = null,
        this.blinkColor = null,
        this.floorExplosionList = null,
        this.explosionTranslation = null
    }
    ,
    ly.prototype.registerPlugin = function(A) {
        this.plugins.push(A)
    }
    ,
    ly.prototype.removeAllEventListener = function() {
        this._listeners = void 0
    }
    ,
    ly.prototype.prepareCapScene = function() {
        this.capsScene ? this.clippingCaps || (this.initCapPlane(),
        this.initCapBox()) : (this.capsScene = new oy,
        this.clippingCaps || (this.initCapPlane(),
        this.initCapBox()),
        this.scene.createCapStencilMaterials())
    }
    ,
    ly.prototype.initCapPlane = function() {
        var A = this.scene.getFillClipPlane().initCapsPlane();
        this.capsScene.add(A.planeMesh),
        this.capsScene.add(A.lineMesh),
        this.clippingCaps = !0
    }
    ,
    ly.prototype.initCapBox = function() {
        var A = this.scene.getClipPlanes().initCapsBox();
        A.material.needsUpdate = !0,
        A.visible = !0,
        this.capsScene.add(A),
        this.clippingCaps = !0
    }
    ,
    ly.prototype.getAllComponents = function() {
        return this.scene.pool._pool
    }
    ,
    ly.prototype.getAllComponentsKey = function() {
        var A = [];
        for (var e in this.models)
            if (this.models.hasOwnProperty(e)) {
                var t = this.models[e];
                if (t) {
                    var i = t.getComponentlist();
                    A = A.concat(i)
                }
            }
        return A
    }
    ,
    ly.prototype.getComponentsKeyByModelKey = function(A) {
        var e = [];
        if (this.models.hasOwnProperty(A)) {
            var t = this.models[A];
            if (t)
                e = t.getComponentlist()
        }
        return e
    }
    ,
    ly.prototype.getComponent = function(A) {
        for (var e in this.models)
            if (this.models.hasOwnProperty(e)) {
                var t = this.models[e];
                if (t.isLoaded() && t.getComponentInfo(A)) {
                    var i = t.getComponentInfo(A);
                    if (i)
                        return i
                }
            }
        for (var o = 0, n = this.plugins.length; n > o; o += 1)
            if (this.plugins[o].getNodeInfosByUserId) {
                var r = this.plugins[o].getNodeInfosByUserId(A);
                if (r)
                    return r
            }
    }
    ,
    ly.prototype.getStorage = function() {
        return this.storage
    }
    ,
    ly.prototype.updateTransformComponentList = function(A) {
        this.transformComponent[A] = !0
    }
    ,
    ly.prototype._updateOcclusionCamera = function(A) {
        var e = A.near
          , t = A.distanceFromWorldToDrawing(this.getMatrixWorldGlobal(), vc.OcclusionDistanceToCamera);
        this.occlusionCamera ? this.occlusionCamera.copy(A) : this.occlusionCamera = A.clone(),
        this.occlusionCamera.setNearFar(e, t),
        this.occlusionCamera.updateMVP()
    }
    ,
    ly.prototype._clearMaterialPool = function() {
        this.materialPool && this.materialPool.clear()
    }
    ,
    ly.prototype.acquireMaterial = function() {
        return this.materialPool ? this.materialPool.acquire() : null
    }
    ,
    ly.prototype.getObjectPool = function() {
        return this.scene.getObjectPool()
    }
    ,
    ly.prototype.getFrustumFromOcclusionCamera = function() {
        return this.occlusionCamera.getFrustum(!1)
    }
    ,
    ly.prototype.getOcclusionCamera = function() {
        return this.occlusionCamera
    }
    ,
    ly.prototype.prepareScene = function(A, e) {
        var t = this.models;
        for (var i in vc.MergeComponent || (this.clearPool(),
        this.clearObjectRangeFromOctantMap()),
        vc.OcclusionTranslucentEnabled && (null === this.materialPool && (this.materialPool = new qC,
        this.materialPool.init(ay, 50)),
        this._clearMaterialPool(),
        this._updateOcclusionCamera(A)),
        t)
            if (t.hasOwnProperty(i)) {
                var o = t[i];
                !vc.RendererWhenLoad && !o.isLoaded() || o.isEmptyScene() || o.prepare(A, e)
            }
        this.dealStateChanged()
    }
    ,
    ly.prototype.clearPool = function() {
        this.scene.getObjectPool().clear()
    }
    ,
    ly.prototype.clearObjectRangeFromOctantMap = function() {
        this.octantToObjectMap && this.octantToObjectMap.pool && (this.octantToObjectMap.pool = {})
    }
    ,
    ly.prototype.setDrawableModel = function(A) {
        this.isDrawableModel = A
    }
    ,
    ly.prototype.isDrawable = function() {
        return this.isDrawableModel
    }
    ,
    ly.prototype.load = function(A, e, t) {
        var i = this.models
          , o = i[A.modelKey]
          , n = this;
        if (this.setDrawableModel(!1),
        void 0 !== o)
            return this.setDrawableModel(!0),
            o.isVisible() || (o.setVisible(!0),
            o.dispatchEventEx({
                type: Rc.ON_LOAD_COMPLETE
            })),
            o;
        var r = [];
        for (var a in i)
            i.hasOwnProperty(a) && r.push(i[a].index);
        r.sort();
        for (var s = 0; r.length > s && r[s] === s; s += 1)
            ;
        return o = new ("GIS" === A.type ? PC : TC)(this,A,(function(e, t) {
            if (vc.UseWorker) {
                if (n.websocketWorker && n.prepareDataWorkers) {
                    var i = JSON.parse(window.localStorage.getItem("bos_IndexedDB"));
                    i || (i = {
                        version: 1
                    }),
                    window.localStorage.setItem("bos_IndexedDB", JSON.stringify(i));
                    var r = i.version;
                    n.websocketWorker.postMessage({
                        type: "INITIALIZE_DATABASE",
                        data: {
                            modelKey: o.modelKey,
                            dbName: o.projectKey,
                            version: r
                        }
                    }),
                    n.websocketWorker.onmessage = o.onWSWorkerMessage,
                    n.prepareDataWorkers.postMessage({
                        type: "INITIALIZE_DATABASE",
                        data: {
                            modelKey: o.modelKey,
                            dbName: o.projectKey,
                            version: r
                        }
                    }),
                    n.prepareDataWorkers.onmessage = o.onPDWorkerMessage
                }
            } else
                e.load(A.notifyProgress)
        }
        ),t),
        this.filter.addModel(o.modelKey),
        this.models[A.modelKey] = o,
        o
    }
    ,
    ly.prototype.loadTiles = function(A, e, t) {
        var i = this.models
          , o = i[A.modelKey]
          , n = this;
        if (void 0 !== o)
            return o.isVisible() || (o.setVisible(!0),
            o.dispatchEventEx({
                type: Rc.ON_LOAD_COMPLETE
            })),
            o;
        var r = [];
        for (var a in i)
            i.hasOwnProperty(a) && r.push(i[a].index);
        r.sort();
        for (var s = 0; r.length > s && r[s] === s; s += 1)
            ;
        return o = new PC(this,A,(function(e, t) {
            if (vc.UseWorker) {
                if (n.websocketWorker && n.prepareDataWorkers) {
                    var i = JSON.parse(window.localStorage.getItem("bos_IndexedDB"));
                    i || (i = {
                        version: 1
                    }),
                    window.localStorage.setItem("bos_IndexedDB", JSON.stringify(i));
                    var r = i.version;
                    n.websocketWorker.postMessage({
                        type: "INITIALIZE_DATABASE",
                        data: {
                            modelKey: o.modelKey,
                            dbName: o.projectKey,
                            version: r
                        }
                    }),
                    n.websocketWorker.onmessage = o.onWSWorkerMessage,
                    n.prepareDataWorkers.postMessage({
                        type: "INITIALIZE_DATABASE",
                        data: {
                            modelKey: o.modelKey,
                            dbName: o.projectKey,
                            version: r
                        }
                    }),
                    n.prepareDataWorkers.onmessage = o.onPDWorkerMessage
                }
            } else
                e.load(A.notifyProgress)
        }
        ),t),
        this.models[A.modelKey] = o,
        o
    }
    ,
    ly.prototype.loadModels = function(A) {
        var e = this.models[A.modelKey]
          , t = this;
        return void 0 !== e ? (e.isVisible() || (e.setVisible(!0),
        e.dispatchEventEx({
            type: Rc.ON_LOAD_COMPLETE
        })),
        e) : (e = new TC(this,A,(function() {
            if (vc.UseWorker) {
                if (t.websocketWorker && t.prepareDataWorkers) {
                    var i = JSON.parse(window.localStorage.getItem("bos_IndexedDB"));
                    i || (i = {
                        version: 1
                    }),
                    window.localStorage.setItem("bos_IndexedDB", JSON.stringify(i));
                    var o = i.version;
                    t.websocketWorker.postMessage({
                        type: "INITIALIZE_DATABASE",
                        data: {
                            modelKey: e.modelKey,
                            dbName: e.projectKey,
                            version: o
                        }
                    }),
                    t.websocketWorker.onmessage = e.onWSWorkerMessage,
                    t.prepareDataWorkers.postMessage({
                        type: "INITIALIZE_DATABASE",
                        data: {
                            modelKey: e.modelKey,
                            dbName: e.projectKey,
                            version: o
                        }
                    }),
                    t.prepareDataWorkers.onmessage = e.onPDWorkerMessage
                }
            } else
                e.load(A.notifyProgress)
        }
        )),
        this.models[A.modelKey] = e,
        e)
    }
    ,
    ly.prototype.unload = function(A) {
        var e = this.models[A];
        return !!e && (e.destroy(),
        delete this.models[A],
        this.filter.removeModel(A),
        this.filter.reinitFilterManager(this.getNodeInfos()),
        this.updateScene(),
        this.updateFilterManager(),
        this.filter.getObjectInfoManager().calculateVisibleComponentsBbox(),
        !0)
    }
    ,
    ly.prototype.unloadAll = function() {
        for (var A = this.getModelKeys(), e = 0, t = A.length; t > e; e += 1)
            this.unload(A[e]);
        this.clearPool(),
        this.models = {}
    }
    ,
    ly.prototype.showModel = function(A) {
        var e = this.models[A];
        return !!e && (e.setVisible(!0),
        !0)
    }
    ,
    ly.prototype.hideModel = function(A) {
        var e = this.models[A];
        return !!e && (e.setVisible(!1),
        !0)
    }
    ,
    ly.prototype.getModelKeys = function() {
        var A = this.models
          , e = [];
        for (var t in A)
            A.hasOwnProperty(t) && e.push(t);
        return e
    }
    ,
    ly.prototype.updateScene = function() {
        this.updateSceneBoundingBox()
    }
    ,
    ly.prototype.updateSceneBoundingBox = function() {
        var A = this.models
          , e = this.boundingBox;
        for (var t in e.makeEmpty(),
        A)
            if (A.hasOwnProperty(t)) {
                var i = A[t];
                if (!i.isEmptyScene()) {
                    var o = i.getBoundingBoxWorld();
                    if (!o || o.isEmpty())
                        continue;
                    e.isEmpty() ? e.copy(o) : (e.expandByPoint(o.min),
                    e.expandByPoint(o.max))
                }
            }
        for (var n = 0, r = this.plugins.length; r > n; n += 1) {
            var a = this.plugins[n];
            if ("function" == typeof a.getBoundingBoxWorld) {
                var s = a.getBoundingBoxWorld();
                s && e.union(s)
            }
        }
        this.scene.setBoundingBoxWorld(e)
    }
    ,
    ly.prototype.parseSceneRootNode = function(A) {
        this.scene.parseRootNode(A),
        this.updateSceneBoundingBox()
    }
    ,
    ly.prototype.updateSceneRootMatrix = function() {
        var A = !1
          , e = new M
          , t = new M
          , i = new f
          , o = this.models;
        for (var n in this.models)
            if (o.hasOwnProperty(n)) {
                var r = o[n];
                if (!r.isEmptyScene()) {
                    i.copy(r.getTransforms().rotation),
                    e.copy(r.getTransforms().transformMatrix),
                    A = r.getTransforms().transformed;
                    break
                }
            }
        if (this.scene.setTransformMatrixGlobal(e),
        A)
            t.copy(e);
        else {
            var a = new y(1,1,1)
              , s = vc.SceneSize
              , l = this.boundingBox.getSize(new y)
              , c = Math.max(l.x, l.y, l.z);
            a.multiplyScalar(s / c),
            t.makeRotationFromQuaternion(i),
            t.scale(a)
        }
        this.scene.updateWorldMatrixByMatrix(t)
    }
    ,
    ly.prototype.updateSceneRenderable = function() {
        var A = this.models
          , e = vc.maxObjectNumInPool
          , t = []
          , i = 0;
        for (var o in A) {
            if (A.hasOwnProperty(o))
                (a = A[o]).isEmptyScene() || (i += a.model.getStatistics().renderableTotalForPool,
                t.push(o))
        }
        for (var n = 0, r = t.length; r > n; n += 1) {
            var a = A[o = t[n]]
              , s = Math.floor(a.getStatistics().renderableTotalForPool / i * e);
            s > a.getStatistics().renderableTotalForPool && (s = a.getStatistics().renderableTotalForPool),
            a.setRenderableCount(s)
        }
    }
    ,
    ly.prototype.updateOctreeNode = function() {
        var A = this.models;
        for (var e in this.models)
            if (A.hasOwnProperty(e)) {
                var t = A[e];
                t.isLoaded() && !t.isEmptyScene() && t.updateOctreeNode(!0)
            }
    }
    ,
    ly.prototype.updateMaterials = function() {
        var A = this.models;
        for (var e in this.models)
            if (A.hasOwnProperty(e)) {
                var t = A[e];
                t.isLoaded() && !t.isEmptyScene() && t.materialManager.updateMaterials(t)
            }
    }
    ,
    ly.prototype.updateMaterialsValue = function(A, e) {
        var t = this.models;
        for (var i in this.models)
            if (t.hasOwnProperty(i)) {
                var o = t[i];
                o.isLoaded() && !o.isEmptyScene() && o.materialManager.updateMaterialsValue(o, A, e)
            }
        this.materialOverrideSet && this.materialOverrideSet.updateMaterialsValue(A, e)
    }
    ,
    ly.prototype.enableColorWithoutLight = function(A) {
        var e = this.models;
        for (var t in this.models)
            if (e.hasOwnProperty(t)) {
                var i = e[t];
                i.isLoaded() && i.isEmptyScene()
            }
    }
    ,
    ly.prototype.switchNewStyleMaterial = function(A) {
        var e = this.models;
        for (var t in this.models)
            if (e.hasOwnProperty(t)) {
                var i = e[t];
                i.isLoaded() && !i.isEmptyScene() && i.materialManager.switchNewStyleMaterial(i, A)
            }
    }
    ,
    ly.prototype.changeAllMaterials = function(A) {
        if (this.IBLMaterial !== A) {
            var e = this.models;
            for (var t in this.models)
                if (e.hasOwnProperty(t)) {
                    var i = e[t];
                    i.isEmptyScene() || i.materialManager.changeAllMaterials(i, A)
                }
            this.IBLMaterial = A
        }
    }
    ,
    ly.prototype.setCrossOrigin = function(A) {
        this.crossOrigin = A
    }
    ,
    ly.prototype.getMatrixWorldGlobal = function() {
        return this.scene.getMatrixWorldGlobal()
    }
    ,
    ly.prototype.hasModel = function() {
        var A = this.models;
        for (var e in A) {
            if (A.hasOwnProperty(e))
                if (A[e].isLoaded())
                    return !0
        }
        return !1
    }
    ,
    ly.prototype.isEmpty = function() {
        if (this.hasModel())
            return !1;
        for (var A = !1, e = 0, t = this.plugins.length; t > e; e += 1) {
            var i = this.plugins[e];
            if ("function" == typeof i.isEmpty && !i.isEmpty()) {
                A = !0;
                break
            }
        }
        return !A
    }
    ,
    ly.prototype.hasModelDataReady = function() {
        var A = this.models
          , e = !1;
        for (var t in A) {
            if (A.hasOwnProperty(t))
                if (e = !0,
                !A[t].isDataReady())
                    return !1
        }
        return e
    }
    ,
    ly.prototype.isLayerData = function() {
        var A = this.models;
        for (var e in A) {
            if (A.hasOwnProperty(e))
                if (A[e].isLayerData())
                    return !0
        }
        return !1
    }
    ,
    ly.prototype.getModel = function(A) {
        var e = this.models[A];
        return e || null
    }
    ,
    ly.prototype.getFirstModel = function() {
        var A = Object.keys(this.models)[0];
        return this.models[A]
    }
    ,
    ly.prototype.showOctreeBox = function(A) {
        vc.ShowOctant || this.scene.removeGroupByName(gp.OCTREENODE)
    }
    ,
    ly.prototype.setCategoriesToHighPriority = function(A, e) {
        var t = A.length;
        if (t >= 1)
            for (var i = this.highPriorityCategories[e] = {}, o = 0; t > o; o += 1)
                i[A[o]] = !0
    }
    ,
    ly.prototype.getCategoriesFromHighPriority = function(A) {
        return this.highPriorityCategories[A]
    }
    ,
    ly.prototype.clearCategoriesFromHighPriority = function(A) {
        this.highPriorityCategories[A] = {}
    }
    ,
    ly.prototype.clearAllCategoriesFromHighPriority = function() {
        this.clearCategoriesFromHighPriority("inner"),
        this.clearCategoriesFromHighPriority("outer")
    }
    ,
    ly.prototype.calculateCameraModelRelation = function(A) {
        var e = !1
          , t = this.models;
        for (var i in t)
            if (t.hasOwnProperty(i)) {
                var o = t[i];
                o && o.isLoaded() && !o.isEmptyScene() && (o.calculateCameraModelRelation(A),
                e = e || o.containsCamera)
            }
        this.containsCamera = e
    }
    ,
    ly.prototype.getCameraNameList = function() {
        var A = this.models
          , e = [];
        for (var t in A)
            if (A.hasOwnProperty(t)) {
                var i = A[t];
                i.isEmptyScene() || (e = e.concat(i.getCameraNameList()))
            }
        return e
    }
    ,
    ly.prototype.getCamera = function(A) {
        var e = this.models
          , t = null;
        for (var i in e)
            if (e.hasOwnProperty(i)) {
                var o = e[i];
                if (!o.isEmptyScene() && (t = o.getCamera(A)))
                    break
            }
        return t
    }
    ,
    ly.prototype.getNumOfElements = function() {
        var A = this.models
          , e = 0;
        for (var t in this.models)
            if (A.hasOwnProperty(t)) {
                var i = A[t];
                i.isEmptyScene() || (e += i.getStatistics().numOfElements)
            }
        return e
    }
    ,
    ly.prototype.getNumOfRenderables = function() {
        var A = this.models
          , e = 0;
        for (var t in this.models)
            if (A.hasOwnProperty(t)) {
                var i = A[t];
                i.isEmptyScene() || (e += i.getStatistics().renderableTotal)
            }
        return e
    }
    ,
    ly.prototype.getNumOfTriangles = function() {
        var A = this.models
          , e = 0;
        for (var t in this.models)
            if (A.hasOwnProperty(t)) {
                var i = A[t];
                i.isEmptyScene() || (e += i.getStatistics().numOfTriangles)
            }
        return e
    }
    ,
    ly.prototype.getScene = function() {
        return this.scene
    }
    ,
    ly.prototype.getOctreeRoots = function() {
        var A = this.models
          , e = {};
        for (var t in A)
            if (A.hasOwnProperty(t)) {
                var i = A[t];
                if (i.isLoaded() && !i.isEmptyScene()) {
                    var o = i.getEncodedDatabagId();
                    e[o] = [],
                    i.getModelDescriptor().getOctreeRoots(e[o])
                }
            }
        return e
    }
    ,
    ly.prototype.getModelSnapshotPhoto = function() {
        return this.viewerImpl.render(),
        {
            imgURL: this.viewerImpl.getRenderer().domElement.toDataURL("image/png"),
            height: this.viewerImpl.domElement.offsetHeight,
            width: this.viewerImpl.domElement.offsetWidth
        }
    }
    ,
    ly.prototype.addMeshToOctantMap = function(A, e, t) {
        var i = this.octantToObjectMap;
        i[A] || (i[A] = {}),
        i[A].mesh || (i[A].mesh = {}),
        i[A].mesh[e] || (i[A].mesh[e] = []),
        i[A].mesh[e].push(t)
    }
    ,
    ly.prototype.addNodeInfoToOctantMap = function(A, e, t) {
        var i = this.octantToObjectMap;
        i[A] || (i[A] = {}),
        i[A].info || (i[A].info = {}),
        i[A].info[e] || (i[A].info[e] = []),
        i[A].info[e].push(t)
    }
    ,
    ly.prototype.removeNodeInfoFromOctantMap = function(A, e) {
        var t = this.octantToObjectMap;
        if (t[A] && t[A].info && t[A].info[e.componentKey])
            for (var i = t[A].info[e.componentKey], o = i.length - 1; o >= 0; o -= 1)
                if (e.nodeId === i[o].nodeId) {
                    i.splice(o);
                    break
                }
    }
    ,
    ly.prototype.clearNodeInfosFromOctantMap = function(A) {
        var e = this.octantToObjectMap;
        e[A] && e[A].info && (e[A] = null)
    }
    ,
    ly.prototype.removeAllFromOctantMap = function(A) {
        var e = this.octantToObjectMap;
        e[A] && delete e[A]
    }
    ,
    ly.prototype.clearMeshFromOctantMap = function(A) {
        var e = this.octantToObjectMap;
        e[A] && e[A].mesh && delete e[A].mesh
    }
    ,
    ly.prototype.removeMeshFromOctantMap = function(A, e) {
        var t = this.octantToObjectMap;
        if (t[A] && t[A].mesh) {
            var i = 0
              , o = t[A].mesh[e];
            for (i = o.length - 1; i >= 0; i -= 1)
                delete o[i];
            delete t[A].mesh[e]
        }
    }
    ,
    ly.prototype.removeBatchedMeshFromOctantMap = function(A, e) {
        var t = this.octantToObjectMap;
        if (t[A] && t[A].mesh && t[A].info) {
            var i = 0
              , o = t[A].info[e];
            for (i = o.length - 1; i >= 0; i -= 1)
                o.splice(i);
            delete t[A].info[e]
        }
    }
    ,
    ly.prototype.getOctantMap = function() {
        return this.octantToObjectMap
    }
    ,
    ly.prototype.isFilterApplied = function() {
        return this.filterApplied
    }
    ,
    ly.prototype.setFilterApplied = function(A) {
        this.filterApplied = A
    }
    ,
    ly.prototype.applyFilter = function() {
        for (var A in Bh.time("applyFilter"),
        this.models) {
            this.models[A].applyFilter()
        }
        for (var e = 0, t = this.plugins.length; t > e; e += 1)
            this.plugins[e].applyFilter();
        this.setFilterApplied(!0),
        Bh.timeEnd("applyFilter")
    }
    ,
    ly.prototype.applySelection = function() {
        for (var A in this.selectPriority = !0,
        this.models) {
            this.models[A].applySelection()
        }
        this.scene.getExtrudeBodyManager().applySelection(this);
        for (var e = 0, t = this.plugins.length; t > e; e += 1)
            this.plugins[e].applySelection()
    }
    ,
    ly.prototype.clearSelection = function() {
        for (var A in this.selectPriority = !0,
        this.models) {
            this.models[A].clearSelection()
        }
        this.scene.getExtrudeBodyManager().clearSelection();
        for (var e = 0, t = this.plugins.length; t > e; e += 1)
            this.plugins[e].clearSelection()
    }
    ,
    ly.prototype.applyHover = function() {
        if (vc.Hover && !vc.EnableRenderPass)
            for (var A in this.models) {
                this.models[A].applyHover()
            }
        this.scene.getExtrudeBodyManager().applyHover(this);
        for (var e = 0, t = this.plugins.length; t > e; e += 1)
            this.plugins[e].applyHover()
    }
    ,
    ly.prototype.clearHover = function() {
        if (vc.Hover && !vc.EnableRenderPass)
            for (var A in this.models) {
                this.models[A].clearHover()
            }
        this.scene.getExtrudeBodyManager().clearHover();
        for (var e = 0, t = this.plugins.length; t > e; e += 1)
            this.plugins[e].clearHover()
    }
    ,
    ly.prototype.chooseRendering = function(A) {}
    ,
    ly.prototype.isUserIdExist = function(A) {
        var e = !1;
        for (var t in this.models) {
            if (this.models.hasOwnProperty(t))
                if (this.models[t].getModelDescriptor().isUserIdExist(A)) {
                    e = !0;
                    break
                }
        }
        for (var i = 0, o = this.plugins.length; o > i; i += 1)
            if (this.plugins[i].isUserIdExist && this.plugins[i].isUserIdExist(A)) {
                e = !0;
                break
            }
        return e
    }
    ,
    ly.prototype.getNodeInfosByUserId = function(A) {
        var e = [];
        for (var t in this.models) {
            var i = this.models[t];
            if (i && i.isLoaded()) {
                var o = this.models[t].getModelDescriptor().getNodeInfosByUserId(A);
                o && (e = e.concat(o))
            }
        }
        for (var n = 0, r = this.plugins.length; r > n; n += 1)
            if (this.plugins[n].getNodeInfosByUserId) {
                var a = this.plugins[n].getNodeInfosByUserId(A);
                a && (e = e.concat(a))
            }
        return e.length ? e : null
    }
    ,
    ly.prototype.getNodeInfos = function() {
        var A = {};
        for (var e in this.models)
            if (this.models[e].isLoaded()) {
                var t = this.models[e].getModelDescriptor().getAllNodeInfos();
                t && (A[e] = t)
            }
        var i = this.getNodeInfosInPlugins();
        return Object.assign(A, i),
        A
    }
    ,
    ly.prototype.getNodeInfosInPlugins = function() {
        for (var A = {}, e = 0, t = this.plugins.length; t > e; e += 1)
            this.plugins[e].getAllNodeInfos && this.plugins[e].getAllNodeInfos(A);
        return A
    }
    ,
    ly.prototype.getMaterialByNodeId = function(A, e, t) {
        var i = this.models[A];
        if (!i)
            return null;
        for (var o = i.getModelDescriptor().getNodeInfosByUserId(e), n = -1, r = 0, a = o.length; a > r; r += 1)
            if (o[r].nodeId === t) {
                n = r;
                break
            }
        return -1 !== n ? i.getMaterialByMaterialId(o[n].materialId) : null
    }
    ,
    ly.prototype.getNodeInfoByNodeId = function(A, e, t) {
        var i = this.models[A];
        if (!i)
            return null;
        for (var o = i.getModelDescriptor().getNodeInfosByUserId(e), n = -1, r = 0, a = o.length; a > r; r += 1)
            if (o[r].nodeId === t) {
                n = r;
                break
            }
        return -1 !== n ? o[n] : null
    }
    ,
    ly.prototype.getComponentInfoByUserId = function(A) {
        var e = this.getNodeInfosByUserId(A);
        if (e && e.length > 0) {
            for (var t = new aA, i = [], o = 0, n = e.length; n > o; o += 1)
                t.union(e[o].boundingBox),
                -1 === i.indexOf(e[o].materialId) && i.push(e[o].materialId);
            return {
                userId: A,
                state: 0,
                materials: i,
                boundingBox: t,
                userData: e[0].userData
            }
        }
        return null
    }
    ,
    ly.prototype.getBoundingBoxByIds = function(A) {
        var e = this.getScene()
          , t = new aA;
        for (var i in A)
            if (!this.isHiddenUserId(i)) {
                Array.isArray(A) && (i = A[i]);
                var o = this.getComponentInfoByUserId(i);
                if (o)
                    t.union(o.boundingBox);
                else {
                    var n = e.getExtrudeBodyManager().getNode(i);
                    if (n) {
                        var r = n.geometry.boundingBox.clone();
                        n.matrix && r.applyMatrix4(n.matrix),
                        t.union(r)
                    }
                }
            }
        return t
    }
    ,
    ly.prototype.createMaterialOverrideSet = function(A, e) {
        this.materialOverrideSet = new MaterialOverriderSet(A,e),
        vc.EnableTextureMapping = !0
    }
    ,
    ly.prototype.getMaterialOverrideSet = function() {
        return this.materialOverrideSet
    }
    ,
    ly.prototype.getOverrideMaterialByNodeInfo = function(A) {
        return this.materialOverrideSet ? this.materialOverrideSet.getOverrideMaterialByNodeInfo(A) : null
    }
    ,
    ly.prototype.getOverrideMaterialByName = function(A) {
        return this.materialOverrideSet ? this.materialOverrideSet.getOverrideMaterialByName(A) : null
    }
    ,
    ly.prototype.loadOverrideMaterialsByDemand = function(A, e) {
        if (this.materialOverrideSet) {
            var t = this.getConditions();
            this.materialOverrideSet.loadByDemand(t, A, e)
        } else
            e && e()
    }
    ,
    ly.prototype.getConditions = function() {
        var A = {}
          , e = {}
          , t = {};
        for (var i in this.models) {
            var o = this.models[i].getModelDescriptor().getAllNodeInfos();
            if (o)
                for (var i in o)
                    if (o.hasOwnProperty(i))
                        for (var n = 0, r = o[i].length; r > n; n += 1) {
                            var a = o[i][n].userData;
                            e[o[i][n].userId] = !0,
                            t[a.systemTypeId] = !0,
                            A[a.familyId] = !0
                        }
        }
        return {
            familyIds: A,
            elementIds: e,
            systemTypeIds: t
        }
    }
    ,
    ly.prototype.isHiddenUserId = function(A) {
        var e = !1;
        for (var t in this.models) {
            if (this.models.hasOwnProperty(t))
                if ((t = this.models[t]).isHiddenUserId(A)) {
                    e = !0;
                    break
                }
        }
        return e
    }
    ,
    ly.prototype.isHiddenSourceObjectUserId = function(A) {
        return !!this.sourceObjectManager && this.sourceObjectManager.isHidden(A)
    }
    ,
    ly.prototype.hasHiddenSourceObjectUserId = function() {
        return !!this.sourceObjectManager && this.sourceObjectManager.hasHidden()
    }
    ,
    ly.prototype.updateMeshNodes = function() {
        for (var A in this.models) {
            if (this.models.hasOwnProperty(A))
                (A = this.models[A]).updateMeshNodes()
        }
    }
    ,
    ly.prototype.getMinDistanceObjects = function(A, e) {
        var t = this
          , i = {};
        for (var o in this.models)
            if (this.models.hasOwnProperty(o)) {
                (o = this.models[o]).minDistanceObjects = {};
                var n = o.getMeshesByUserIds(A)
                  , r = o.getMeshesByUserIds(e);
                if (n && n.length > 0 && (i[A] = n),
                r && r.length > 0 && (i[e] = r),
                i[A] && i[e])
                    return i
            }
        var a = null
          , s = null
          , l = null
          , c = null
          , h = null
          , d = function() {
            var i = {}
              , o = function(A, e, t) {
                var o = {};
                o.mesh = A;
                var n = new M;
                t ? n.multiplyMatrices(t, A.matrix) : n = A.matrix,
                o.matrix = n;
                var r = A.geometry.boundingBox;
                r || (A.geometry.computeBoundingBox(),
                r = o.mesh.geometry.boundingBox);
                var a = r.clone().applyMatrix4(n);
                o.boundingBox = a,
                i[e] && (i[e] = []),
                i[e].push(o)
            };
            if (!(a = t.scene.getGroup("ExternalComponentManager")))
                return {
                    v: void 0
                };
            for (l = 0,
            c = (s = a.children).length; c > l; l += 1)
                (h = s[l]).name !== A && h.name !== e || (uh.isGroupObject(h) ? h.traverseVisible((function(A) {
                    uh.isMeshObject(A) && o(A, h.name, h.matrix)
                }
                )) : o(h, h.name));
            return {
                v: i
            }
        }();
        return d && d.v && (d.v[A] && d.v[A].length > 0 && (i[A] = d.v[A]),
        d.v[e] && d.v[e].length > 0 && (i[e] = d.v[e]),
        i[A] && i[e]) || i[A] && i[e] ? i : null
    }
    ,
    ly.prototype.getMeshByUserId = function(A) {
        for (var e in this.models)
            if (this.models.hasOwnProperty(e)) {
                var t = (e = this.models[e]).getMeshesByUserIds(A);
                if (t)
                    return t
            }
        return null
    }
    ,
    ly.prototype.adjustVisibility = function(A) {
        for (var e in this.models)
            this.models[e] && this.models[e]._getHandler().adjustVisibility(A);
        for (var t = 0, i = this.plugins.length; i > t; t += 1) {
            var o = this.plugins[t];
            o.adjustVisibility && "function" == typeof o.adjustVisibility && o.adjustVisibility(A)
        }
        this.otherAdjustVisibility && this.otherAdjustVisibility(A)
    }
    ,
    ly.prototype.changeVisibilityOfSelectedObjects = function(A) {
        for (var e in this.models)
            this.models[e] && this.models[e]._getHandler().changeVisibilityOfSelectedObjects(A);
        for (var t = 0, i = this.plugins.length; i > t; t += 1) {
            var o = this.plugins[t];
            o.changeVisibilityOfSelectedObjects && "function" == typeof o.changeVisibilityOfSelectedObjects && o.changeVisibilityOfSelectedObjects(A)
        }
    }
    ,
    ly.prototype.changeVisibilityOfNonSelectedObjects = function(A) {
        for (var e in this.models)
            this.models[e] && this.models[e]._getHandler().changeVisibilityOfNonSelectedObjects(A);
        this.otherAdjustVisibility && this.otherAdjustVisibility(A);
        for (var t = 0, i = this.plugins.length; i > t; t += 1) {
            var o = this.plugins[t];
            o.changeVisibilityOfNonSelectedObjects && "function" == typeof o.changeVisibilityOfNonSelectedObjects && o.changeVisibilityOfNonSelectedObjects(A)
        }
    }
    ,
    ly.prototype.adjustInstanceVisibility = function(A) {
        for (var e in this.models)
            this.models[e] && this.models[e].merged && this.models[e]._getHandler().adjustInstanceVisibility(A)
    }
    ,
    ly.prototype.adjustVisibilityOfObjectsWithoutOutline = function(A) {
        for (var e in this.models)
            if (this.models[e]) {
                var t = this.models[e].axisNetManager;
                t && t.visibleByUser && (A ? this.models[e].axisNetManager.privateShow() : this.models[e].axisNetManager.privateHide())
            }
        for (var i = 0, o = this.plugins.length; o > i; i += 1) {
            var n = this.plugins[i];
            n.adjustVisibilityOfObjectsWithoutOutline && "function" == typeof n.adjustVisibilityOfObjectsWithoutOutline && n.adjustVisibilityOfObjectsWithoutOutline(A)
        }
        var r;
        this.scene.hasClipPlanes() && ((r = this.scene.getClipPlanes()).isEnabled() && (!1 === A && r.visible ? (r.visible = !1,
        r._hideByModelManager = !0) : !0 === A && r._hideByModelManager && (r.visible = !0,
        delete r._hideByModelManager)));
        this.scene.hasFillClipPlanes() && ((r = this.scene.getFillClipPlane()).isEnabled() && (!1 === A && r.visible ? (r.visible = !1,
        r._hideByModelManager = !0) : !0 === A && r._hideByModelManager && (r.visible = !0,
        delete r._hideByModelManager)));
        this.scene.receivingPlane && (!1 === A && this.scene.receivingPlane.visible ? (this.scene.receivingPlane.visible = !1,
        this.scene.receivingPlane._hideByModelManager = !0) : !0 === A && this.scene.receivingPlane._hideByModelManager && (this.scene.receivingPlane.visible = !0,
        delete this.scene.receivingPlane._hideByModelManager)),
        this.otherAdjustVisibility && this.otherAdjustVisibility(A);
        for (var a = this.scene.children, s = (i = 0,
        a.length); s > i; i += 1) {
            var l = a[i];
            l !== this.scene.objectGroups && !0 !== l.isLight && !0 === l.isObject3D && (l.visible = A)
        }
    }
    ,
    ly.prototype.changeInstanceVisibilityOfSelectedObjects = function(A) {
        for (var e in this.models)
            this.models[e] && this.models[e].merged && this.models[e]._getHandler().changeInstanceVisibilityOfSelectedObjects(A)
    }
    ,
    ly.prototype.changeInstanceVisibilityOfNonSelectedObjects = function(A) {
        for (var e in this.models)
            this.models[e] && this.models[e].merged && this.models[e]._getHandler().changeInstanceVisibilityOfNonSelectedObjects(A)
    }
    ,
    ly.prototype.restoreVisibilityOfObjects = function() {
        for (var A in this.models)
            this.models[A] && this.models[A]._getHandler().restoreVisibilityOfObjects();
        this.otherAdjustVisibility && this.otherAdjustVisibility(!0)
    }
    ,
    ly.prototype.getComponentKeysByTypeFromList = function(A, e) {
        var t = [];
        for (var i in this.models) {
            if (this.models.hasOwnProperty(i))
                if ((i = this.models[i]).isLoaded()) {
                    var o = i.getComponentKeysByTypeFromList(A, e);
                    o && (t = t.concat(o))
                }
        }
        return t
    }
    ,
    ly.prototype.getComponentKeysByType = function(A) {
        var e = [];
        for (var t in this.models) {
            if (this.models.hasOwnProperty(t))
                if ((t = this.models[t]).isLoaded()) {
                    var i = t.getComponentKeysByType(A);
                    i && (e = e.concat(i))
                }
        }
        return e
    }
    ,
    ly.prototype.getComponentKeysByName = function(A) {
        var e = [];
        for (var t in this.models)
            if (this.models.hasOwnProperty(t)) {
                var i = (t = this.models[t]).getComponentKeysByName(A);
                i && (e = e.concat(i))
            }
        return e
    }
    ,
    ly.prototype.getComponentKeysByProperty = function(A, e) {
        var t = [];
        for (var i in this.models)
            if (this.models.hasOwnProperty(i)) {
                var o = (i = this.models[i]).getComponentKeysByProperty(A, e);
                o && (t = t.concat(o))
            }
        return t
    }
    ,
    ly.prototype.getBlinkMaterials = function() {
        var A = [];
        for (var e in this.models)
            this.models[e] && this.models[e]._getHandler().getBlinkMaterials && (A = A.concat(this.models[e]._getHandler().getBlinkMaterials()));
        return A
    }
    ,
    ly.prototype.resetBlinkMaterial = function() {
        for (var A = this.getBlinkMaterials(), e = 0, t = A.length; t > e; e += 1)
            A[e].resetBlinkUniformValue()
    }
    ,
    ly.prototype.updateBlinkMaterial = function() {
        if (null !== this.blinkStartTime) {
            if (Date.now() - this.blinkStartTime >= this.blinkIntervalTime) {
                this.blinkStartTime = Date.now(),
                this.indexSwitch = !this.indexSwitch;
                for (var A = this.indexSwitch ? Yc.BLINK : Yc.NONE, e = this.getBlinkMaterials(), t = 0, i = e.length; i > t; t += 1)
                    e[t].updateBlinkUniformValue(A, this.blinkColor)
            }
        } else
            this.blinkStartTime = Date.now()
    }
    ,
    ly.prototype.getBlinkColor = function() {
        return this.blinkColor
    }
    ,
    ly.prototype.setBlinkColor = function(A, e) {
        if (A) {
            var t = uh.hexToRgb(A);
            this.blinkColor.fromArray([t.r, t.g, t.b, e || 1])
        } else
            this.blinkColor.set(this.defaultBlinkColor.r, this.defaultBlinkColor.g, this.defaultBlinkColor.b, this.defaultBlinkAlpha)
    }
    ,
    ly.prototype.setBlinkIntervalTime = function(A) {
        this.blinkIntervalTime > 0 && (this.blinkIntervalTime = A)
    }
    ,
    ly.prototype.enableBlink = function(A) {
        this.blinkEnabled = A,
        A ? null === this.blinkStartTime && (this.blinkStartTime = Date.now()) : (this.blinkStartTime = null,
        this.resetBlinkMaterial()),
        this.applyBlink()
    }
    ,
    ly.prototype.getBlinkEnabled = function() {
        return !this.isBlinkPermited() && this.blinkEnabled
    }
    ,
    ly.prototype.getBlinkComponentsIdMap = function() {
        return this.isBlinkPermited() ? null : this.sceneState.getBlinkComponentsIdMap()
    }
    ,
    ly.prototype.applyBlink = function() {
        if (!this.isBlinkPermited())
            for (var A in this.selectPriority = !1,
            this.models) {
                this.models[A].applyBlink()
            }
    }
    ,
    ly.prototype.clearBlink = function() {
        if (!this.isBlinkPermited())
            for (var A in this.selectPriority = !1,
            this.models) {
                this.models[A].clearBlink()
            }
    }
    ,
    ly.prototype.permitBlink = function(A) {
        this.blinkPermited = A
    }
    ,
    ly.prototype.isBlinkPermited = function() {
        return this.blinkPermited
    }
    ,
    ly.prototype.isSelectPriority = function() {
        return this.selectPriority
    }
    ,
    ly.prototype.getSceneState = function() {
        return this.sceneState
    }
    ,
    ly.prototype.getModelSceneState = function() {
        return this.modelState
    }
    ,
    ly.prototype.disposeBufferAfterVbo = function() {
        if (vc.EnableDisposeBufferAfterVbo)
            for (var A in this.models) {
                this.models[A].disposeBufferAfterVbo()
            }
    }
    ,
    ly.prototype.getSourceObjectManager = function() {
        return this.sourceObjectManager || (this.sourceObjectManager = new ry),
        this.sourceObjectManager
    }
    ,
    ly.prototype.isHiddenUserId = function(A) {
        return !!this.sourceObjectManager && this.sourceObjectManager.isHidden(A)
    }
    ,
    ly.prototype.hasHiddenUserId = function() {
        return !!this.sourceObjectManager && this.sourceObjectManager.hasHidden()
    }
    ,
    ly.prototype.traverseModels = function(A, e) {
        for (var t in this.models) {
            var i = this.models[t];
            if (e && e(i))
                break;
            A && A(i)
        }
    }
    ,
    ly.prototype.traverseLoadedModels = function(A) {
        for (var e in this.models) {
            var t = this.models[e];
            t && t.isLoaded() && A(t)
        }
    }
    ,
    ly.prototype.getStatisticsInfo = function() {
        var A = 0
          , e = 0
          , t = 0
          , i = 0;
        for (var o in this.models) {
            var n = this.models[o];
            if (n && n.isLoaded()) {
                var r = n.getTrianglesCount();
                A += r.positionsCount,
                e += r.trianglesCount,
                t += r.realPositionCount,
                i += r.realTrianglesCount
            }
        }
        return {
            positionsCount: A,
            trianglesCount: e,
            realPositionCount: t,
            realTrianglesCount: i,
            componentCount: this.getAllComponentsKey().length
        }
    }
    ,
    ly.prototype.dealStateChanged = function() {
        this.hasModelDataReady() && (this.isRenderStateChanged() || this.filter.isStateChanged()) && (this.isRenderStateChanged() && this.setRenderStateChanged(!1),
        this.filter.isStateChanged() && this.filter.disableStateChanged(),
        this.applyFilter())
    }
    ,
    ly.prototype.setRenderStateChanged = function(A) {
        this._renderStateChanged = A
    }
    ,
    ly.prototype.isRenderStateChanged = function() {
        return this._renderStateChanged
    }
    ,
    ly.prototype.hasLoadOnDemandDirector = function() {
        return !!this.loadOnDemandDirector
    }
    ,
    ly.prototype.getLoadOnDemandDirector = function() {
        return this.loadOnDemandDirector || (this.loadOnDemandDirector = new sy(this)),
        this.loadOnDemandDirector
    }
    ,
    ly.prototype.checkLayerDataLoading = function() {
        return !!(this.isLayerData() && this.hasLoadOnDemandDirector() && this.getLoadOnDemandDirector().isLoading()) && (this.filter.isStateChanged() && this.filter.disableStateChanged(),
        !0)
    }
    ,
    ly.prototype.updateFilterManager = function() {
        var A = this.getNodeInfos()
          , e = this.filter;
        e.clearFilterManager(),
        e.initFilterManager(A),
        e.isStateChanged() && e.disableStateChanged(),
        this.updateMeshNodes(),
        this.applyFilter()
    }
    ,
    ly.prototype.isDrawingBoardlineEnabled = function() {
        return !(!vc.DrawingBoardlineEnabled || vc.DrawingStyle !== jc.BOARDLINE && vc.DrawingStyle !== jc.SHADINGWITHLINE)
    }
    ,
    ly.prototype.isOnlyWireframe = function() {
        return vc.DrawingStyle === jc.BOARDLINE
    }
    ,
    ly.prototype.getExplosionExtent = function() {
        return this.explosionExtent
    }
    ,
    ly.prototype.setExplosionExtent = function(A) {
        var e = A - this.explosionExtent;
        for (var t in this.models)
            this.models[t] && this.models[t].explode(e);
        this.explosionExtent = A
    }
    ,
    ly.prototype.updateAnimation = function() {
        var A = this.viewerImpl.clock.getDelta();
        for (var e in this.models)
            if (this.models.hasOwnProperty(e)) {
                var t = this.models[e];
                if (t.hasAnimation && t.mixer) {
                    var i = t.mixer;
                    t.singleStepMode ? (i.update(t.sizeOfNextStep),
                    t.sizeOfNextStep = 0) : i.update(A)
                }
            }
    }
    ,
    ly.prototype.needUpdateAnimation = function() {
        for (var A in this.models)
            if (this.models.hasOwnProperty(A)) {
                var e = this.models[A];
                if (e.hasAnimation && e.mixer && e.needUpdate)
                    return !0
            }
        return !1
    }
    ,
    ly.prototype.unloadGeopkOnDemand = function(A, e) {
        var t = this.models;
        for (var i in t)
            if (t.hasOwnProperty(i)) {
                var o = t[i];
                o.isLoaded() && !o.isEmptyScene() && o.isLayerData() && o.unloadGeopkOnDemand(A, e)
            }
    }
    ,
    ly.prototype.loadGeopkOnDemand = function(A, e, t, i) {
        this.getLoadOnDemandDirector().loadGeopkOnDemandByConditions(A, e, t, i)
    }
    ,
    ly.prototype.loadAllGeosOnDemand = function(A, e) {
        var t = this.models;
        for (var i in t)
            if (t.hasOwnProperty(i)) {
                var o = t[i];
                o.isLoaded() && !o.isEmptyScene() && o.isLayerData() && o.loadAllGeosOnDemand(A, e)
            }
    }
    ,
    ly.prototype.getBoundingBoxOnDemand = function() {
        var A = this.models
          , e = new aA;
        for (var t in A)
            if (A.hasOwnProperty(t)) {
                var i = A[t];
                if (i.isLoaded() && !i.isEmptyScene() && i.isLayerData()) {
                    var o = i.getUnionBoundingBoxOnDemand();
                    o && e.union(o)
                }
            }
        return e
    }
    ,
    ly.prototype.setConditionsOnDemandLoad = function(A) {
        this.conditionsOnDemandLoad = A;
        var e = this.models;
        for (var t in e)
            if (e.hasOwnProperty(t)) {
                var i = e[t];
                i.isLoaded() && !i.isEmptyScene() && i.isLayerData() && i.setConditionsChangedOnDemand(!0)
            }
    }
    ,
    ly.prototype.getConditionsOnDemandLoad = function() {
        return this.conditionsOnDemandLoad
    }
    ,
    ly.prototype.componentsExplosion = function(A) {
        var e = this.models;
        for (var t in e) {
            if (e.hasOwnProperty(t))
                e[t].componentsExplosion(A)
        }
    }
    ,
    ly.prototype.closeComponentsExplosion = function(A) {
        var e = this.models;
        for (var t in e) {
            if (e.hasOwnProperty(t))
                e[t].closeComponentsExplosion(A)
        }
    }
    ,
    ly.prototype.canFloorExplosion = function() {
        var A = this.models
          , e = !1;
        for (var t in A) {
            if (A.hasOwnProperty(t))
                A[t].floorManager && (e = !0)
        }
        return e
    }
    ,
    ly.prototype.floorExplosion = function(A) {
        var e = this.models
          , t = !1;
        for (var i in e) {
            if (e.hasOwnProperty(i))
                e[i].floorExplosion(A) && (this.updateSceneBoundingBox(),
                t = !0)
        }
        return t
    }
    ,
    ly.prototype.closeFloorExplosion = function() {
        var A = this.models;
        for (var e in A) {
            if (A.hasOwnProperty(e))
                A[e].closeFloorExplosion()
        }
    }
    ,
    ly.prototype.checkTilesDataChanged = function(A, e) {
        if (!this.cameraPosition.equals(A.position) || this.cameraFov !== A.fov || this.domElementWidth !== e.domElement.width) {
            this.cameraFov = A.fov || 45,
            this.cameraPosition = A.position.clone() || new y,
            this.domElementWidth = e.domElement.width || 1e3;
            var t = !1
              , i = this.checkMemory();
            for (var o in i > vc.MaximumAvailableMemory && (t = !0),
            this.models)
                if (this.models.hasOwnProperty(o)) {
                    var n = this.models[o];
                    n.isTilesModel && n.checkTilesDataChanged(t)
                }
        }
    }
    ,
    ly.prototype.checkMemory = function() {
        var A = 0
          , e = this.viewerImpl.getRenderer().info;
        return A += 6 * (e.render.triangles || 0),
        A += 1024 * (e.memory.textures || 0) * 1024 / 4,
        A += 1024 * (e.render.calls || 0) / 4,
        A += 1024 * (e.memory.geometries || 0) / 4,
        A *= 1 / 1048576,
        A = Math.ceil(A)
    }
    ,
    ly.prototype.getMeshIdFromOctantMap = function(A) {
        return A.single ? A.nodeId : A.instanceOrNot ? uh.getCombinedKeyString(A.uv2Info ? [A.materialId, A.geometryId, A.uv2Info.byteOffset] : [A.materialId, A.geometryId]) : vc.MergeComponent ? uh.getCombinedKeyString([A.materialId, A.uv ? "1" : "0", A.type === $u.EnumNodeItemType.LINE ? "lines" : "meshes"]) : A.nodeId
    }
    ;
    var cy, hy, dy, py = {
        uniforms: {
            tDiffuse: {
                value: null
            },
            opacity: {
                value: 1
            }
        },
        vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
        fragmentShader: ["uniform float opacity;", "uniform sampler2D tDiffuse;", "varying vec2 vUv;", "void main() {", "vec4 texel = texture2D( tDiffuse, vUv );", "gl_FragColor = opacity * texel;", "}"].join("\n")
    };
    function gy() {
        this.enabled = !0,
        this.needsSwap = !0,
        this.clear = !1,
        this.renderToScreen = !1
    }
    Object.assign(gy.prototype, {
        setSize: function() {},
        render: function() {
            console.error("THREE.Pass: .render() must be implemented in derived pass.")
        }
    }),
    gy.FullScreenQuad = (cy = new Ka(-1,1,1,-1,0,1),
    hy = new et(2,2),
    dy = function(A) {
        this._mesh = new Ue(hy,A)
    }
    ,
    Object.defineProperty(dy.prototype, "material", {
        get: function() {
            return this._mesh.material
        },
        set: function(A) {
            this._mesh.material = A
        }
    }),
    Object.assign(dy.prototype, {
        render: function(A) {
            A.render(this._mesh, cy)
        }
    }),
    dy);
    var uy = function(A, e) {
        gy.call(this),
        this.textureID = void 0 !== e ? e : "tDiffuse",
        A instanceof Pe ? (this.uniforms = A.uniforms,
        this.material = A) : A && (this.uniforms = Ge.clone(A.uniforms),
        this.material = new Pe({
            defines: Object.assign({}, A.defines),
            uniforms: this.uniforms,
            vertexShader: A.vertexShader,
            fragmentShader: A.fragmentShader
        })),
        this.fsQuad = new gy.FullScreenQuad(this.material)
    };
    uy.prototype = Object.assign(Object.create(gy.prototype), {
        constructor: uy,
        render: function(A, e, t) {
            this.uniforms[this.textureID] && (this.uniforms[this.textureID].value = t.texture),
            this.fsQuad.material = this.material,
            this.renderToScreen ? (A.setRenderTarget(null),
            this.fsQuad.render(A)) : (A.setRenderTarget(e),
            this.clear && A.clear(A.autoClearColor, A.autoClearDepth, A.autoClearStencil),
            this.fsQuad.render(A))
        }
    });
    var fy = function(A, e) {
        gy.call(this),
        this.scene = A,
        this.camera = e,
        this.clear = !0,
        this.needsSwap = !1,
        this.inverse = !1
    };
    fy.prototype = Object.assign(Object.create(gy.prototype), {
        constructor: fy,
        render: function(A, e, t) {
            var i = A.getContext()
              , o = A.state;
            o.buffers.color.setMask(!1),
            o.buffers.depth.setMask(!1),
            o.buffers.color.setLocked(!0),
            o.buffers.depth.setLocked(!0);
            var n = null
              , r = null;
            this.inverse ? (r = 0,
            n = 1) : (r = 1,
            n = 0),
            o.buffers.stencil.setTest(!0),
            o.buffers.stencil.setOp(i.REPLACE, i.REPLACE, i.REPLACE),
            o.buffers.stencil.setFunc(i.ALWAYS, r, 4294967295),
            o.buffers.stencil.setClear(n),
            o.buffers.stencil.setLocked(!0),
            A.setRenderTarget(t),
            this.clear && A.clear(),
            A.render(this.scene, this.camera),
            A.setRenderTarget(e),
            this.clear && A.clear(),
            A.render(this.scene, this.camera),
            o.buffers.color.setLocked(!1),
            o.buffers.depth.setLocked(!1),
            o.buffers.stencil.setLocked(!1),
            o.buffers.stencil.setFunc(i.EQUAL, 1, 4294967295),
            o.buffers.stencil.setOp(i.KEEP, i.KEEP, i.KEEP),
            o.buffers.stencil.setLocked(!0)
        }
    });
    var my = function() {
        gy.call(this),
        this.needsSwap = !1
    };
    my.prototype = Object.create(gy.prototype),
    Object.assign(my.prototype, {
        render: function(A) {
            A.state.buffers.stencil.setLocked(!1),
            A.state.buffers.stencil.setTest(!1)
        }
    });
    var Cy = function(A, e) {
        if (this.renderer = A,
        void 0 === e) {
            var t = {
                minFilter: 1006,
                magFilter: 1006,
                format: 1023,
                stencilBuffer: !1
            }
              , i = A.getSize(new s);
            this._pixelRatio = A.getPixelRatio(),
            this._width = i.width,
            this._height = i.height,
            (e = new g(this._width * this._pixelRatio,this._height * this._pixelRatio,t)).texture.name = "EffectComposer.rt1"
        } else
            this._pixelRatio = 1,
            this._width = e.width,
            this._height = e.height;
        this.renderTarget1 = e,
        this.renderTarget2 = e.clone(),
        this.renderTarget2.texture.name = "EffectComposer.rt2",
        this.writeBuffer = this.renderTarget1,
        this.readBuffer = this.renderTarget2,
        this.renderToScreen = !0,
        this.passes = [],
        void 0 === py && console.error("THREE.EffectComposer relies on CopyShader"),
        void 0 === uy && console.error("THREE.EffectComposer relies on ShaderPass"),
        this.copyPass = new uy(py),
        this.clock = new as
    };
    Object.assign(Cy.prototype, {
        swapBuffers: function() {
            var A = this.readBuffer;
            this.readBuffer = this.writeBuffer,
            this.writeBuffer = A
        },
        addPass: function(A) {
            this.passes.push(A),
            A.setSize(this._width * this._pixelRatio, this._height * this._pixelRatio)
        },
        insertPass: function(A, e) {
            this.passes.splice(e, 0, A)
        },
        isLastEnabledPass: function(A) {
            for (var e = A + 1; this.passes.length > e; e += 1)
                if (this.passes[e].enabled)
                    return !1;
            return !0
        },
        render: function(A) {
            void 0 === A && (A = this.clock.getDelta());
            var e = this.renderer.getRenderTarget()
              , t = !1
              , i = null
              , o = null
              , n = this.passes.length;
            for (o = 0; n > o; o += 1)
                if (!1 !== (i = this.passes[o]).enabled) {
                    if (i.renderToScreen = this.renderToScreen && this.isLastEnabledPass(o),
                    i.render(this.renderer, this.writeBuffer, this.readBuffer, A, t),
                    i.needsSwap) {
                        if (t) {
                            var r = this.renderer.getContext()
                              , a = this.renderer.state.buffers.stencil;
                            a.setFunc(r.NOTEQUAL, 1, 4294967295),
                            this.copyPass.render(this.renderer, this.writeBuffer, this.readBuffer, A),
                            a.setFunc(r.EQUAL, 1, 4294967295)
                        }
                        this.swapBuffers()
                    }
                    void 0 !== fy && (i instanceof fy ? t = !0 : i instanceof my && (t = !1))
                }
            this.renderer.setRenderTarget(e)
        },
        reset: function(A) {
            if (void 0 === A) {
                var e = this.renderer.getSize(new s);
                this._pixelRatio = this.renderer.getPixelRatio(),
                this._width = e.width,
                this._height = e.height,
                (A = this.renderTarget1.clone()).setSize(this._width * this._pixelRatio, this._height * this._pixelRatio)
            }
            this.renderTarget1.dispose(),
            this.renderTarget2.dispose(),
            this.renderTarget1 = A,
            this.renderTarget2 = A.clone(),
            this.writeBuffer = this.renderTarget1,
            this.readBuffer = this.renderTarget2
        },
        setSize: function(A, e) {
            this._width = A,
            this._height = e;
            var t = this._width * this._pixelRatio
              , i = this._height * this._pixelRatio;
            this.renderTarget1.setSize(t, i),
            this.renderTarget2.setSize(t, i);
            for (var o = 0; this.passes.length > o; o += 1)
                this.passes[o].setSize(t, i)
        },
        setPixelRatio: function(A) {
            this._pixelRatio = A,
            this.setSize(this._width, this._height)
        }
    });
    var yy = function() {
        this.enabled = !0,
        this.needsSwap = !0,
        this.clear = !1,
        this.renderToScreen = !1
    };
    Object.assign(yy.prototype, {
        setSize: function() {},
        render: function() {
            console.error("THREE.Pass: .render() must be implemented in derived pass.")
        }
    }),
    yy.FullScreenQuad = function() {
        var A = new Ka(-1,1,1,-1,0,1)
          , e = new et(2,2)
          , t = function(A) {
            this._mesh = new Ue(e,A)
        };
        return Object.defineProperty(t.prototype, "material", {
            get: function() {
                return this._mesh.material
            },
            set: function(A) {
                this._mesh.material = A
            }
        }),
        Object.assign(t.prototype, {
            render: function(e) {
                e.render(this._mesh, A)
            }
        }),
        t
    }();
    var vy = {
        uniforms: {
            tDiffuse: {
                value: null
            },
            resolution: {
                value: new s(1 / 1024,1 / 512)
            }
        },
        vertexShader: ["varying vec2 vUv;", "void main() {", "vUv = uv;", "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
        fragmentShader: ["precision highp float;", "", "uniform sampler2D tDiffuse;", "", "uniform vec2 resolution;", "", "varying vec2 vUv;", "", "// FXAA 3.11 implementation by NVIDIA, ported to WebGL by Agost Biro (biro@archilogic.com)", "", "//----------------------------------------------------------------------------------", "// File:        es3-kepler FXAA assets shaders/FXAA_DefaultES.frag", "// SDK Version: v3.00", "// Email:       gameworks@nvidia.com", "// Site:        http://developer.nvidia.com/", "//", "// Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.", "//", "// Redistribution and use in source and binary forms, with or without", "// modification, are permitted provided that the following conditions", "// are met:", "//  * Redistributions of source code must retain the above copyright", "//    notice, this list of conditions and the following disclaimer.", "//  * Redistributions in binary form must reproduce the above copyright", "//    notice, this list of conditions and the following disclaimer in the", "//    documentation and/or other materials provided with the distribution.", "//  * Neither the name of NVIDIA CORPORATION nor the names of its", "//    contributors may be used to endorse or promote products derived", "//    from this software without specific prior written permission.", "//", "// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY", "// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE", "// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR", "// PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR", "// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,", "// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,", "// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR", "// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY", "// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT", "// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE", "// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", "//", "//----------------------------------------------------------------------------------", "", "#define FXAA_PC 1", "#define FXAA_GLSL_100 1", "#define FXAA_QUALITY_PRESET 12", "", "#define FXAA_GREEN_AS_LUMA 1", "", "/*--------------------------------------------------------------------------*/", "#ifndef FXAA_PC_CONSOLE", "    //", "    // The console algorithm for PC is included", "    // for developers targeting really low spec machines.", "    // Likely better to just run FXAA_PC, and use a really low preset.", "    //", "    #define FXAA_PC_CONSOLE 0", "#endif", "/*--------------------------------------------------------------------------*/", "#ifndef FXAA_GLSL_120", "    #define FXAA_GLSL_120 0", "#endif", "/*--------------------------------------------------------------------------*/", "#ifndef FXAA_GLSL_130", "    #define FXAA_GLSL_130 0", "#endif", "/*--------------------------------------------------------------------------*/", "#ifndef FXAA_HLSL_3", "    #define FXAA_HLSL_3 0", "#endif", "/*--------------------------------------------------------------------------*/", "#ifndef FXAA_HLSL_4", "    #define FXAA_HLSL_4 0", "#endif", "/*--------------------------------------------------------------------------*/", "#ifndef FXAA_HLSL_5", "    #define FXAA_HLSL_5 0", "#endif", "/*==========================================================================*/", "#ifndef FXAA_GREEN_AS_LUMA", "    //", "    // For those using non-linear color,", "    // and either not able to get luma in alpha, or not wanting to,", "    // this enables FXAA to run using green as a proxy for luma.", "    // So with this enabled, no need to pack luma in alpha.", "    //", "    // This will turn off AA on anything which lacks some amount of green.", "    // Pure red and blue or combination of only R and B, will get no AA.", "    //", "    // Might want to lower the settings for both,", "    //    fxaaConsoleEdgeThresholdMin", "    //    fxaaQualityEdgeThresholdMin", "    // In order to insure AA does not get turned off on colors", "    // which contain a minor amount of green.", "    //", "    // 1 = On.", "    // 0 = Off.", "    //", "    #define FXAA_GREEN_AS_LUMA 0", "#endif", "/*--------------------------------------------------------------------------*/", "#ifndef FXAA_EARLY_EXIT", "    //", "    // Controls algorithm's early exit path.", "    // On PS3 turning this ON adds 2 cycles to the shader.", "    // On 360 turning this OFF adds 10ths of a millisecond to the shader.", "    // Turning this off on console will result in a more blurry image.", "    // So this defaults to on.", "    //", "    // 1 = On.", "    // 0 = Off.", "    //", "    #define FXAA_EARLY_EXIT 1", "#endif", "/*--------------------------------------------------------------------------*/", "#ifndef FXAA_DISCARD", "    //", "    // Only valid for PC OpenGL currently.", "    // Probably will not work when FXAA_GREEN_AS_LUMA = 1.", "    //", "    // 1 = Use discard on pixels which don't need AA.", "    //     For APIs which enable concurrent TEX+ROP from same surface.", "    // 0 = Return unchanged color on pixels which don't need AA.", "    //", "    #define FXAA_DISCARD 0", "#endif", "/*--------------------------------------------------------------------------*/", "#ifndef FXAA_FAST_PIXEL_OFFSET", "    //", "    // Used for GLSL 120 only.", "    //", "    // 1 = GL API supports fast pixel offsets", "    // 0 = do not use fast pixel offsets", "    //", "    #ifdef GL_EXT_gpu_shader4", "        #define FXAA_FAST_PIXEL_OFFSET 1", "    #endif", "    #ifdef GL_NV_gpu_shader5", "        #define FXAA_FAST_PIXEL_OFFSET 1", "    #endif", "    #ifdef GL_ARB_gpu_shader5", "        #define FXAA_FAST_PIXEL_OFFSET 1", "    #endif", "    #ifndef FXAA_FAST_PIXEL_OFFSET", "        #define FXAA_FAST_PIXEL_OFFSET 0", "    #endif", "#endif", "/*--------------------------------------------------------------------------*/", "#ifndef FXAA_GATHER4_ALPHA", "    //", "    // 1 = API supports gather4 on alpha channel.", "    // 0 = API does not support gather4 on alpha channel.", "    //", "    #if (FXAA_HLSL_5 == 1)", "        #define FXAA_GATHER4_ALPHA 1", "    #endif", "    #ifdef GL_ARB_gpu_shader5", "        #define FXAA_GATHER4_ALPHA 1", "    #endif", "    #ifdef GL_NV_gpu_shader5", "        #define FXAA_GATHER4_ALPHA 1", "    #endif", "    #ifndef FXAA_GATHER4_ALPHA", "        #define FXAA_GATHER4_ALPHA 0", "    #endif", "#endif", "", "", "/*============================================================================", "                        FXAA QUALITY - TUNING KNOBS", "------------------------------------------------------------------------------", "NOTE the other tuning knobs are now in the shader function inputs!", "============================================================================*/", "#ifndef FXAA_QUALITY_PRESET", "    //", "    // Choose the quality preset.", "    // This needs to be compiled into the shader as it effects code.", "    // Best option to include multiple presets is to", "    // in each shader define the preset, then include this file.", "    //", "    // OPTIONS", "    // -----------------------------------------------------------------------", "    // 10 to 15 - default medium dither (10=fastest, 15=highest quality)", "    // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)", "    // 39       - no dither, very expensive", "    //", "    // NOTES", "    // -----------------------------------------------------------------------", "    // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)", "    // 13 = about same speed as FXAA 3.9 and better than 12", "    // 23 = closest to FXAA 3.9 visually and performance wise", "    //  _ = the lowest digit is directly related to performance", "    // _  = the highest digit is directly related to style", "    //", "    #define FXAA_QUALITY_PRESET 12", "#endif", "", "", "/*============================================================================", "", "                           FXAA QUALITY - PRESETS", "", "============================================================================*/", "", "/*============================================================================", "                     FXAA QUALITY - MEDIUM DITHER PRESETS", "============================================================================*/", "#if (FXAA_QUALITY_PRESET == 10)", "    #define FXAA_QUALITY_PS 3", "    #define FXAA_QUALITY_P0 1.5", "    #define FXAA_QUALITY_P1 3.0", "    #define FXAA_QUALITY_P2 12.0", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_QUALITY_PRESET == 11)", "    #define FXAA_QUALITY_PS 4", "    #define FXAA_QUALITY_P0 1.0", "    #define FXAA_QUALITY_P1 1.5", "    #define FXAA_QUALITY_P2 3.0", "    #define FXAA_QUALITY_P3 12.0", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_QUALITY_PRESET == 12)", "    #define FXAA_QUALITY_PS 5", "    #define FXAA_QUALITY_P0 1.0", "    #define FXAA_QUALITY_P1 1.5", "    #define FXAA_QUALITY_P2 2.0", "    #define FXAA_QUALITY_P3 4.0", "    #define FXAA_QUALITY_P4 12.0", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_QUALITY_PRESET == 13)", "    #define FXAA_QUALITY_PS 6", "    #define FXAA_QUALITY_P0 1.0", "    #define FXAA_QUALITY_P1 1.5", "    #define FXAA_QUALITY_P2 2.0", "    #define FXAA_QUALITY_P3 2.0", "    #define FXAA_QUALITY_P4 4.0", "    #define FXAA_QUALITY_P5 12.0", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_QUALITY_PRESET == 14)", "    #define FXAA_QUALITY_PS 7", "    #define FXAA_QUALITY_P0 1.0", "    #define FXAA_QUALITY_P1 1.5", "    #define FXAA_QUALITY_P2 2.0", "    #define FXAA_QUALITY_P3 2.0", "    #define FXAA_QUALITY_P4 2.0", "    #define FXAA_QUALITY_P5 4.0", "    #define FXAA_QUALITY_P6 12.0", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_QUALITY_PRESET == 15)", "    #define FXAA_QUALITY_PS 8", "    #define FXAA_QUALITY_P0 1.0", "    #define FXAA_QUALITY_P1 1.5", "    #define FXAA_QUALITY_P2 2.0", "    #define FXAA_QUALITY_P3 2.0", "    #define FXAA_QUALITY_P4 2.0", "    #define FXAA_QUALITY_P5 2.0", "    #define FXAA_QUALITY_P6 4.0", "    #define FXAA_QUALITY_P7 12.0", "#endif", "", "/*============================================================================", "                     FXAA QUALITY - LOW DITHER PRESETS", "============================================================================*/", "#if (FXAA_QUALITY_PRESET == 20)", "    #define FXAA_QUALITY_PS 3", "    #define FXAA_QUALITY_P0 1.5", "    #define FXAA_QUALITY_P1 2.0", "    #define FXAA_QUALITY_P2 8.0", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_QUALITY_PRESET == 21)", "    #define FXAA_QUALITY_PS 4", "    #define FXAA_QUALITY_P0 1.0", "    #define FXAA_QUALITY_P1 1.5", "    #define FXAA_QUALITY_P2 2.0", "    #define FXAA_QUALITY_P3 8.0", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_QUALITY_PRESET == 22)", "    #define FXAA_QUALITY_PS 5", "    #define FXAA_QUALITY_P0 1.0", "    #define FXAA_QUALITY_P1 1.5", "    #define FXAA_QUALITY_P2 2.0", "    #define FXAA_QUALITY_P3 2.0", "    #define FXAA_QUALITY_P4 8.0", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_QUALITY_PRESET == 23)", "    #define FXAA_QUALITY_PS 6", "    #define FXAA_QUALITY_P0 1.0", "    #define FXAA_QUALITY_P1 1.5", "    #define FXAA_QUALITY_P2 2.0", "    #define FXAA_QUALITY_P3 2.0", "    #define FXAA_QUALITY_P4 2.0", "    #define FXAA_QUALITY_P5 8.0", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_QUALITY_PRESET == 24)", "    #define FXAA_QUALITY_PS 7", "    #define FXAA_QUALITY_P0 1.0", "    #define FXAA_QUALITY_P1 1.5", "    #define FXAA_QUALITY_P2 2.0", "    #define FXAA_QUALITY_P3 2.0", "    #define FXAA_QUALITY_P4 2.0", "    #define FXAA_QUALITY_P5 3.0", "    #define FXAA_QUALITY_P6 8.0", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_QUALITY_PRESET == 25)", "    #define FXAA_QUALITY_PS 8", "    #define FXAA_QUALITY_P0 1.0", "    #define FXAA_QUALITY_P1 1.5", "    #define FXAA_QUALITY_P2 2.0", "    #define FXAA_QUALITY_P3 2.0", "    #define FXAA_QUALITY_P4 2.0", "    #define FXAA_QUALITY_P5 2.0", "    #define FXAA_QUALITY_P6 4.0", "    #define FXAA_QUALITY_P7 8.0", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_QUALITY_PRESET == 26)", "    #define FXAA_QUALITY_PS 9", "    #define FXAA_QUALITY_P0 1.0", "    #define FXAA_QUALITY_P1 1.5", "    #define FXAA_QUALITY_P2 2.0", "    #define FXAA_QUALITY_P3 2.0", "    #define FXAA_QUALITY_P4 2.0", "    #define FXAA_QUALITY_P5 2.0", "    #define FXAA_QUALITY_P6 2.0", "    #define FXAA_QUALITY_P7 4.0", "    #define FXAA_QUALITY_P8 8.0", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_QUALITY_PRESET == 27)", "    #define FXAA_QUALITY_PS 10", "    #define FXAA_QUALITY_P0 1.0", "    #define FXAA_QUALITY_P1 1.5", "    #define FXAA_QUALITY_P2 2.0", "    #define FXAA_QUALITY_P3 2.0", "    #define FXAA_QUALITY_P4 2.0", "    #define FXAA_QUALITY_P5 2.0", "    #define FXAA_QUALITY_P6 2.0", "    #define FXAA_QUALITY_P7 2.0", "    #define FXAA_QUALITY_P8 4.0", "    #define FXAA_QUALITY_P9 8.0", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_QUALITY_PRESET == 28)", "    #define FXAA_QUALITY_PS 11", "    #define FXAA_QUALITY_P0 1.0", "    #define FXAA_QUALITY_P1 1.5", "    #define FXAA_QUALITY_P2 2.0", "    #define FXAA_QUALITY_P3 2.0", "    #define FXAA_QUALITY_P4 2.0", "    #define FXAA_QUALITY_P5 2.0", "    #define FXAA_QUALITY_P6 2.0", "    #define FXAA_QUALITY_P7 2.0", "    #define FXAA_QUALITY_P8 2.0", "    #define FXAA_QUALITY_P9 4.0", "    #define FXAA_QUALITY_P10 8.0", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_QUALITY_PRESET == 29)", "    #define FXAA_QUALITY_PS 12", "    #define FXAA_QUALITY_P0 1.0", "    #define FXAA_QUALITY_P1 1.5", "    #define FXAA_QUALITY_P2 2.0", "    #define FXAA_QUALITY_P3 2.0", "    #define FXAA_QUALITY_P4 2.0", "    #define FXAA_QUALITY_P5 2.0", "    #define FXAA_QUALITY_P6 2.0", "    #define FXAA_QUALITY_P7 2.0", "    #define FXAA_QUALITY_P8 2.0", "    #define FXAA_QUALITY_P9 2.0", "    #define FXAA_QUALITY_P10 4.0", "    #define FXAA_QUALITY_P11 8.0", "#endif", "", "/*============================================================================", "                     FXAA QUALITY - EXTREME QUALITY", "============================================================================*/", "#if (FXAA_QUALITY_PRESET == 39)", "    #define FXAA_QUALITY_PS 12", "    #define FXAA_QUALITY_P0 1.0", "    #define FXAA_QUALITY_P1 1.0", "    #define FXAA_QUALITY_P2 1.0", "    #define FXAA_QUALITY_P3 1.0", "    #define FXAA_QUALITY_P4 1.0", "    #define FXAA_QUALITY_P5 1.5", "    #define FXAA_QUALITY_P6 2.0", "    #define FXAA_QUALITY_P7 2.0", "    #define FXAA_QUALITY_P8 2.0", "    #define FXAA_QUALITY_P9 2.0", "    #define FXAA_QUALITY_P10 4.0", "    #define FXAA_QUALITY_P11 8.0", "#endif", "", "", "", "/*============================================================================", "", "                                API PORTING", "", "============================================================================*/", "#if (FXAA_GLSL_100 == 1) || (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)", "    #define FxaaBool bool", "    #define FxaaDiscard discard", "    #define FxaaFloat float", "    #define FxaaFloat2 vec2", "    #define FxaaFloat3 vec3", "    #define FxaaFloat4 vec4", "    #define FxaaHalf float", "    #define FxaaHalf2 vec2", "    #define FxaaHalf3 vec3", "    #define FxaaHalf4 vec4", "    #define FxaaInt2 ivec2", "    #define FxaaSat(x) clamp(x, 0.0, 1.0)", "    #define FxaaTex sampler2D", "#else", "    #define FxaaBool bool", "    #define FxaaDiscard clip(-1)", "    #define FxaaFloat float", "    #define FxaaFloat2 float2", "    #define FxaaFloat3 float3", "    #define FxaaFloat4 float4", "    #define FxaaHalf half", "    #define FxaaHalf2 half2", "    #define FxaaHalf3 half3", "    #define FxaaHalf4 half4", "    #define FxaaSat(x) saturate(x)", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_GLSL_100 == 1)", "  #define FxaaTexTop(t, p) texture2D(t, p, 0.0)", "  #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r), 0.0)", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_GLSL_120 == 1)", "    // Requires,", "    //  #version 120", "    // And at least,", "    //  #extension GL_EXT_gpu_shader4 : enable", "    //  (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)", "    #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)", "    #if (FXAA_FAST_PIXEL_OFFSET == 1)", "        #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)", "    #else", "        #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)", "    #endif", "    #if (FXAA_GATHER4_ALPHA == 1)", "        // use #extension GL_ARB_gpu_shader5 : enable", "        #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)", "        #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)", "        #define FxaaTexGreen4(t, p) textureGather(t, p, 1)", "        #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)", "    #endif", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_GLSL_130 == 1)", '    // Requires "#version 130" or better', "    #define FxaaTexTop(t, p) textureLod(t, p, 0.0)", "    #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)", "    #if (FXAA_GATHER4_ALPHA == 1)", "        // use #extension GL_ARB_gpu_shader5 : enable", "        #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)", "        #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)", "        #define FxaaTexGreen4(t, p) textureGather(t, p, 1)", "        #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)", "    #endif", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_HLSL_3 == 1)", "    #define FxaaInt2 float2", "    #define FxaaTex sampler2D", "    #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))", "    #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_HLSL_4 == 1)", "    #define FxaaInt2 int2", "    struct FxaaTex { SamplerState smpl; Texture2D tex; };", "    #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)", "    #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)", "#endif", "/*--------------------------------------------------------------------------*/", "#if (FXAA_HLSL_5 == 1)", "    #define FxaaInt2 int2", "    struct FxaaTex { SamplerState smpl; Texture2D tex; };", "    #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)", "    #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)", "    #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)", "    #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)", "    #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)", "    #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)", "#endif", "", "", "/*============================================================================", "                   GREEN AS LUMA OPTION SUPPORT FUNCTION", "============================================================================*/", "#if (FXAA_GREEN_AS_LUMA == 0)", "    FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; }", "#else", "    FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }", "#endif", "", "", "", "", "/*============================================================================", "", "                             FXAA3 QUALITY - PC", "", "============================================================================*/", "#if (FXAA_PC == 1)", "/*--------------------------------------------------------------------------*/", "FxaaFloat4 FxaaPixelShader(", "    //", "    // Use noperspective interpolation here (turn off perspective interpolation).", "    // {xy} = center of pixel", "    FxaaFloat2 pos,", "    //", "    // Used only for FXAA Console, and not used on the 360 version.", "    // Use noperspective interpolation here (turn off perspective interpolation).", "    // {xy_} = upper left of pixel", "    // {_zw} = lower right of pixel", "    FxaaFloat4 fxaaConsolePosPos,", "    //", "    // Input color texture.", "    // {rgb_} = color in linear or perceptual color space", "    // if (FXAA_GREEN_AS_LUMA == 0)", "    //     {__a} = luma in perceptual color space (not linear)", "    FxaaTex tex,", "    //", "    // Only used on the optimized 360 version of FXAA Console.", '    // For everything but 360, just use the same input here as for "tex".', "    // For 360, same texture, just alias with a 2nd sampler.", "    // This sampler needs to have an exponent bias of -1.", "    FxaaTex fxaaConsole360TexExpBiasNegOne,", "    //", "    // Only used on the optimized 360 version of FXAA Console.", '    // For everything but 360, just use the same input here as for "tex".', "    // For 360, same texture, just alias with a 3nd sampler.", "    // This sampler needs to have an exponent bias of -2.", "    FxaaTex fxaaConsole360TexExpBiasNegTwo,", "    //", "    // Only used on FXAA Quality.", "    // This must be from a constant/uniform.", "    // {x_} = 1.0/screenWidthInPixels", "    // {_y} = 1.0/screenHeightInPixels", "    FxaaFloat2 fxaaQualityRcpFrame,", "    //", "    // Only used on FXAA Console.", "    // This must be from a constant/uniform.", "    // This effects sub-pixel AA quality and inversely sharpness.", "    //   Where N ranges between,", "    //     N = 0.50 (default)", "    //     N = 0.33 (sharper)", "    // {x__} = -N/screenWidthInPixels", "    // {_y_} = -N/screenHeightInPixels", "    // {_z_} =  N/screenWidthInPixels", "    // {__w} =  N/screenHeightInPixels", "    FxaaFloat4 fxaaConsoleRcpFrameOpt,", "    //", "    // Only used on FXAA Console.", "    // Not used on 360, but used on PS3 and PC.", "    // This must be from a constant/uniform.", "    // {x__} = -2.0/screenWidthInPixels", "    // {_y_} = -2.0/screenHeightInPixels", "    // {_z_} =  2.0/screenWidthInPixels", "    // {__w} =  2.0/screenHeightInPixels", "    FxaaFloat4 fxaaConsoleRcpFrameOpt2,", "    //", "    // Only used on FXAA Console.", "    // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.", "    // This must be from a constant/uniform.", "    // {x__} =  8.0/screenWidthInPixels", "    // {_y_} =  8.0/screenHeightInPixels", "    // {_z_} = -4.0/screenWidthInPixels", "    // {__w} = -4.0/screenHeightInPixels", "    FxaaFloat4 fxaaConsole360RcpFrameOpt2,", "    //", "    // Only used on FXAA Quality.", "    // This used to be the FXAA_QUALITY_SUBPIX define.", "    // It is here now to allow easier tuning.", "    // Choose the amount of sub-pixel aliasing removal.", "    // This can effect sharpness.", "    //   1.00 - upper limit (softer)", "    //   0.75 - default amount of filtering", "    //   0.50 - lower limit (sharper, less sub-pixel aliasing removal)", "    //   0.25 - almost off", "    //   0.00 - completely off", "    FxaaFloat fxaaQualitySubpix,", "    //", "    // Only used on FXAA Quality.", "    // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.", "    // It is here now to allow easier tuning.", "    // The minimum amount of local contrast required to apply algorithm.", "    //   0.333 - too little (faster)", "    //   0.250 - low quality", "    //   0.166 - default", "    //   0.125 - high quality", "    //   0.063 - overkill (slower)", "    FxaaFloat fxaaQualityEdgeThreshold,", "    //", "    // Only used on FXAA Quality.", "    // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.", "    // It is here now to allow easier tuning.", "    // Trims the algorithm from processing darks.", "    //   0.0833 - upper limit (default, the start of visible unfiltered edges)", "    //   0.0625 - high quality (faster)", "    //   0.0312 - visible limit (slower)", "    // Special notes when using FXAA_GREEN_AS_LUMA,", "    //   Likely want to set this to zero.", "    //   As colors that are mostly not-green", "    //   will appear very dark in the green channel!", "    //   Tune by looking at mostly non-green content,", "    //   then start at zero and increase until aliasing is a problem.", "    FxaaFloat fxaaQualityEdgeThresholdMin,", "    //", "    // Only used on FXAA Console.", "    // This used to be the FXAA_CONSOLE_EDGE_SHARPNESS define.", "    // It is here now to allow easier tuning.", "    // This does not effect PS3, as this needs to be compiled in.", "    //   Use FXAA_CONSOLE_PS3_EDGE_SHARPNESS for PS3.", "    //   Due to the PS3 being ALU bound,", "    //   there are only three safe values here: 2 and 4 and 8.", "    //   These options use the shaders ability to a free *|/ by 2|4|8.", "    // For all other platforms can be a non-power of two.", "    //   8.0 is sharper (default!!!)", "    //   4.0 is softer", "    //   2.0 is really soft (good only for vector graphics inputs)", "    FxaaFloat fxaaConsoleEdgeSharpness,", "    //", "    // Only used on FXAA Console.", "    // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD define.", "    // It is here now to allow easier tuning.", "    // This does not effect PS3, as this needs to be compiled in.", "    //   Use FXAA_CONSOLE_PS3_EDGE_THRESHOLD for PS3.", "    //   Due to the PS3 being ALU bound,", "    //   there are only two safe values here: 1/4 and 1/8.", "    //   These options use the shaders ability to a free *|/ by 2|4|8.", "    // The console setting has a different mapping than the quality setting.", "    // Other platforms can use other values.", "    //   0.125 leaves less aliasing, but is softer (default!!!)", "    //   0.25 leaves more aliasing, and is sharper", "    FxaaFloat fxaaConsoleEdgeThreshold,", "    //", "    // Only used on FXAA Console.", "    // This used to be the FXAA_CONSOLE_EDGE_THRESHOLD_MIN define.", "    // It is here now to allow easier tuning.", "    // Trims the algorithm from processing darks.", "    // The console setting has a different mapping than the quality setting.", "    // This only applies when FXAA_EARLY_EXIT is 1.", "    // This does not apply to PS3,", "    // PS3 was simplified to avoid more shader instructions.", "    //   0.06 - faster but more aliasing in darks", "    //   0.05 - default", "    //   0.04 - slower and less aliasing in darks", "    // Special notes when using FXAA_GREEN_AS_LUMA,", "    //   Likely want to set this to zero.", "    //   As colors that are mostly not-green", "    //   will appear very dark in the green channel!", "    //   Tune by looking at mostly non-green content,", "    //   then start at zero and increase until aliasing is a problem.", "    FxaaFloat fxaaConsoleEdgeThresholdMin,", "    //", "    // Extra constants for 360 FXAA Console only.", "    // Use zeros or anything else for other platforms.", "    // These must be in physical constant registers and NOT immediates.", "    // Immediates will result in compiler un-optimizing.", "    // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)", "    FxaaFloat4 fxaaConsole360ConstDir", ") {", "/*--------------------------------------------------------------------------*/", "    FxaaFloat2 posM;", "    posM.x = pos.x;", "    posM.y = pos.y;", "    #if (FXAA_GATHER4_ALPHA == 1)", "        #if (FXAA_DISCARD == 0)", "            FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);", "            #if (FXAA_GREEN_AS_LUMA == 0)", "                #define lumaM rgbyM.w", "            #else", "                #define lumaM rgbyM.y", "            #endif", "        #endif", "        #if (FXAA_GREEN_AS_LUMA == 0)", "            FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);", "            FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));", "        #else", "            FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);", "            FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));", "        #endif", "        #if (FXAA_DISCARD == 1)", "            #define lumaM luma4A.w", "        #endif", "        #define lumaE luma4A.z", "        #define lumaS luma4A.x", "        #define lumaSE luma4A.y", "        #define lumaNW luma4B.w", "        #define lumaN luma4B.z", "        #define lumaW luma4B.x", "    #else", "        FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);", "        #if (FXAA_GREEN_AS_LUMA == 0)", "            #define lumaM rgbyM.w", "        #else", "            #define lumaM rgbyM.y", "        #endif", "        #if (FXAA_GLSL_100 == 1)", "          FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0, 1.0), fxaaQualityRcpFrame.xy));", "          FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 0.0), fxaaQualityRcpFrame.xy));", "          FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 0.0,-1.0), fxaaQualityRcpFrame.xy));", "          FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 0.0), fxaaQualityRcpFrame.xy));", "        #else", "          FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));", "          FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));", "          FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));", "          FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));", "        #endif", "    #endif", "/*--------------------------------------------------------------------------*/", "    FxaaFloat maxSM = max(lumaS, lumaM);", "    FxaaFloat minSM = min(lumaS, lumaM);", "    FxaaFloat maxESM = max(lumaE, maxSM);", "    FxaaFloat minESM = min(lumaE, minSM);", "    FxaaFloat maxWN = max(lumaN, lumaW);", "    FxaaFloat minWN = min(lumaN, lumaW);", "    FxaaFloat rangeMax = max(maxWN, maxESM);", "    FxaaFloat rangeMin = min(minWN, minESM);", "    FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;", "    FxaaFloat range = rangeMax - rangeMin;", "    FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);", "    FxaaBool earlyExit = range < rangeMaxClamped;", "/*--------------------------------------------------------------------------*/", "    if(earlyExit)", "        #if (FXAA_DISCARD == 1)", "            FxaaDiscard;", "        #else", "            return rgbyM;", "        #endif", "/*--------------------------------------------------------------------------*/", "    #if (FXAA_GATHER4_ALPHA == 0)", "        #if (FXAA_GLSL_100 == 1)", "          FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0,-1.0), fxaaQualityRcpFrame.xy));", "          FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0, 1.0), fxaaQualityRcpFrame.xy));", "          FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2( 1.0,-1.0), fxaaQualityRcpFrame.xy));", "          FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaFloat2(-1.0, 1.0), fxaaQualityRcpFrame.xy));", "        #else", "          FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));", "          FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));", "          FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));", "          FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));", "        #endif", "    #else", "        FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));", "        FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));", "    #endif", "/*--------------------------------------------------------------------------*/", "    FxaaFloat lumaNS = lumaN + lumaS;", "    FxaaFloat lumaWE = lumaW + lumaE;", "    FxaaFloat subpixRcpRange = 1.0/range;", "    FxaaFloat subpixNSWE = lumaNS + lumaWE;", "    FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;", "    FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;", "/*--------------------------------------------------------------------------*/", "    FxaaFloat lumaNESE = lumaNE + lumaSE;", "    FxaaFloat lumaNWNE = lumaNW + lumaNE;", "    FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;", "    FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;", "/*--------------------------------------------------------------------------*/", "    FxaaFloat lumaNWSW = lumaNW + lumaSW;", "    FxaaFloat lumaSWSE = lumaSW + lumaSE;", "    FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);", "    FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);", "    FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;", "    FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;", "    FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;", "    FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;", "/*--------------------------------------------------------------------------*/", "    FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;", "    FxaaFloat lengthSign = fxaaQualityRcpFrame.x;", "    FxaaBool horzSpan = edgeHorz >= edgeVert;", "    FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;", "/*--------------------------------------------------------------------------*/", "    if(!horzSpan) lumaN = lumaW;", "    if(!horzSpan) lumaS = lumaE;", "    if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;", "    FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;", "/*--------------------------------------------------------------------------*/", "    FxaaFloat gradientN = lumaN - lumaM;", "    FxaaFloat gradientS = lumaS - lumaM;", "    FxaaFloat lumaNN = lumaN + lumaM;", "    FxaaFloat lumaSS = lumaS + lumaM;", "    FxaaBool pairN = abs(gradientN) >= abs(gradientS);", "    FxaaFloat gradient = max(abs(gradientN), abs(gradientS));", "    if(pairN) lengthSign = -lengthSign;", "    FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);", "/*--------------------------------------------------------------------------*/", "    FxaaFloat2 posB;", "    posB.x = posM.x;", "    posB.y = posM.y;", "    FxaaFloat2 offNP;", "    offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;", "    offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;", "    if(!horzSpan) posB.x += lengthSign * 0.5;", "    if( horzSpan) posB.y += lengthSign * 0.5;", "/*--------------------------------------------------------------------------*/", "    FxaaFloat2 posN;", "    posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;", "    posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;", "    FxaaFloat2 posP;", "    posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;", "    posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;", "    FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;", "    FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));", "    FxaaFloat subpixE = subpixC * subpixC;", "    FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));", "/*--------------------------------------------------------------------------*/", "    if(!pairN) lumaNN = lumaSS;", "    FxaaFloat gradientScaled = gradient * 1.0/4.0;", "    FxaaFloat lumaMM = lumaM - lumaNN * 0.5;", "    FxaaFloat subpixF = subpixD * subpixE;", "    FxaaBool lumaMLTZero = lumaMM < 0.0;", "/*--------------------------------------------------------------------------*/", "    lumaEndN -= lumaNN * 0.5;", "    lumaEndP -= lumaNN * 0.5;", "    FxaaBool doneN = abs(lumaEndN) >= gradientScaled;", "    FxaaBool doneP = abs(lumaEndP) >= gradientScaled;", "    if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;", "    if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;", "    FxaaBool doneNP = (!doneN) || (!doneP);", "    if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;", "    if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;", "/*--------------------------------------------------------------------------*/", "    if(doneNP) {", "        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", "        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", "        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", "        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", "        doneN = abs(lumaEndN) >= gradientScaled;", "        doneP = abs(lumaEndP) >= gradientScaled;", "        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;", "        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;", "        doneNP = (!doneN) || (!doneP);", "        if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;", "        if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;", "/*--------------------------------------------------------------------------*/", "        #if (FXAA_QUALITY_PS > 3)", "        if(doneNP) {", "            if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", "            if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", "            if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", "            if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", "            doneN = abs(lumaEndN) >= gradientScaled;", "            doneP = abs(lumaEndP) >= gradientScaled;", "            if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;", "            if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;", "            doneNP = (!doneN) || (!doneP);", "            if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;", "            if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;", "/*--------------------------------------------------------------------------*/", "            #if (FXAA_QUALITY_PS > 4)", "            if(doneNP) {", "                if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", "                if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", "                if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", "                if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", "                doneN = abs(lumaEndN) >= gradientScaled;", "                doneP = abs(lumaEndP) >= gradientScaled;", "                if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;", "                if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;", "                doneNP = (!doneN) || (!doneP);", "                if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;", "                if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;", "/*--------------------------------------------------------------------------*/", "                #if (FXAA_QUALITY_PS > 5)", "                if(doneNP) {", "                    if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", "                    if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", "                    if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", "                    if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", "                    doneN = abs(lumaEndN) >= gradientScaled;", "                    doneP = abs(lumaEndP) >= gradientScaled;", "                    if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;", "                    if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;", "                    doneNP = (!doneN) || (!doneP);", "                    if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;", "                    if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;", "/*--------------------------------------------------------------------------*/", "                    #if (FXAA_QUALITY_PS > 6)", "                    if(doneNP) {", "                        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", "                        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", "                        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", "                        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", "                        doneN = abs(lumaEndN) >= gradientScaled;", "                        doneP = abs(lumaEndP) >= gradientScaled;", "                        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;", "                        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;", "                        doneNP = (!doneN) || (!doneP);", "                        if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;", "                        if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;", "/*--------------------------------------------------------------------------*/", "                        #if (FXAA_QUALITY_PS > 7)", "                        if(doneNP) {", "                            if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", "                            if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", "                            if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", "                            if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", "                            doneN = abs(lumaEndN) >= gradientScaled;", "                            doneP = abs(lumaEndP) >= gradientScaled;", "                            if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;", "                            if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;", "                            doneNP = (!doneN) || (!doneP);", "                            if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;", "                            if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;", "/*--------------------------------------------------------------------------*/", "    #if (FXAA_QUALITY_PS > 8)", "    if(doneNP) {", "        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", "        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", "        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", "        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", "        doneN = abs(lumaEndN) >= gradientScaled;", "        doneP = abs(lumaEndP) >= gradientScaled;", "        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;", "        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;", "        doneNP = (!doneN) || (!doneP);", "        if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;", "        if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;", "/*--------------------------------------------------------------------------*/", "        #if (FXAA_QUALITY_PS > 9)", "        if(doneNP) {", "            if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", "            if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", "            if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", "            if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", "            doneN = abs(lumaEndN) >= gradientScaled;", "            doneP = abs(lumaEndP) >= gradientScaled;", "            if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;", "            if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;", "            doneNP = (!doneN) || (!doneP);", "            if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;", "            if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;", "/*--------------------------------------------------------------------------*/", "            #if (FXAA_QUALITY_PS > 10)", "            if(doneNP) {", "                if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", "                if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", "                if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", "                if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", "                doneN = abs(lumaEndN) >= gradientScaled;", "                doneP = abs(lumaEndP) >= gradientScaled;", "                if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;", "                if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;", "                doneNP = (!doneN) || (!doneP);", "                if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;", "                if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;", "/*--------------------------------------------------------------------------*/", "                #if (FXAA_QUALITY_PS > 11)", "                if(doneNP) {", "                    if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", "                    if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", "                    if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", "                    if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", "                    doneN = abs(lumaEndN) >= gradientScaled;", "                    doneP = abs(lumaEndP) >= gradientScaled;", "                    if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;", "                    if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;", "                    doneNP = (!doneN) || (!doneP);", "                    if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;", "                    if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;", "/*--------------------------------------------------------------------------*/", "                    #if (FXAA_QUALITY_PS > 12)", "                    if(doneNP) {", "                        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));", "                        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));", "                        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;", "                        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;", "                        doneN = abs(lumaEndN) >= gradientScaled;", "                        doneP = abs(lumaEndP) >= gradientScaled;", "                        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;", "                        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;", "                        doneNP = (!doneN) || (!doneP);", "                        if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;", "                        if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;", "/*--------------------------------------------------------------------------*/", "                    }", "                    #endif", "/*--------------------------------------------------------------------------*/", "                }", "                #endif", "/*--------------------------------------------------------------------------*/", "            }", "            #endif", "/*--------------------------------------------------------------------------*/", "        }", "        #endif", "/*--------------------------------------------------------------------------*/", "    }", "    #endif", "/*--------------------------------------------------------------------------*/", "                        }", "                        #endif", "/*--------------------------------------------------------------------------*/", "                    }", "                    #endif", "/*--------------------------------------------------------------------------*/", "                }", "                #endif", "/*--------------------------------------------------------------------------*/", "            }", "            #endif", "/*--------------------------------------------------------------------------*/", "        }", "        #endif", "/*--------------------------------------------------------------------------*/", "    }", "/*--------------------------------------------------------------------------*/", "    FxaaFloat dstN = posM.x - posN.x;", "    FxaaFloat dstP = posP.x - posM.x;", "    if(!horzSpan) dstN = posM.y - posN.y;", "    if(!horzSpan) dstP = posP.y - posM.y;", "/*--------------------------------------------------------------------------*/", "    FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;", "    FxaaFloat spanLength = (dstP + dstN);", "    FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;", "    FxaaFloat spanLengthRcp = 1.0/spanLength;", "/*--------------------------------------------------------------------------*/", "    FxaaBool directionN = dstN < dstP;", "    FxaaFloat dst = min(dstN, dstP);", "    FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;", "    FxaaFloat subpixG = subpixF * subpixF;", "    FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;", "    FxaaFloat subpixH = subpixG * fxaaQualitySubpix;", "/*--------------------------------------------------------------------------*/", "    FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;", "    FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);", "    if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;", "    if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;", "    #if (FXAA_DISCARD == 1)", "        return FxaaTexTop(tex, posM);", "    #else", "        return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);", "    #endif", "}", "/*==========================================================================*/", "#endif", "", "void main() {", "  gl_FragColor = FxaaPixelShader(", "    vUv,", "    vec4(0.0),", "    tDiffuse,", "    tDiffuse,", "    tDiffuse,", "    resolution,", "    vec4(0.0),", "    vec4(0.0),", "    vec4(0.0),", "    0.75,", "    0.166,", "    0.0833,", "    0.0,", "    0.0,", "    0.0,", "    vec4(0.0)", "  );", "", "  // TODO avoid querying texture twice for same texel", "  gl_FragColor.a = texture2D(tDiffuse, vUv).a;", "}"].join("\n")
    }
      , Iy = function(A, e, t, i, o) {
        gy.call(this),
        this.scene = A,
        this.camera = e,
        this.overrideMaterial = t,
        this.clearColor = i,
        this.clearAlpha = void 0 !== o ? o : 0,
        this.clear = !0,
        this.clearDepth = !1,
        this.needsSwap = !1
    };
    Iy.prototype = Object.assign(Object.create(gy.prototype), {
        constructor: Iy,
        render: function(A, e, t) {
            var i = A.autoClear;
            A.autoClear = !1,
            this.scene.overrideMaterial = this.overrideMaterial;
            var o = null
              , n = null;
            this.clearColor && (n = A.getClearColor().getHex(),
            o = A.getClearAlpha(),
            A.setClearColor(this.clearColor, this.clearAlpha)),
            this.clearDepth && A.clearDepth(),
            A.setRenderTarget(this.renderToScreen ? null : t),
            this.clear && A.clear(A.autoClearColor, A.autoClearDepth, A.autoClearStencil),
            A.render(this.scene, this.camera),
            this.clearColor && A.setClearColor(n, o),
            this.scene.overrideMaterial = null,
            A.autoClear = i
        }
    });
    var Ey = function(A, e, t, i, o) {
        gy.call(this),
        this.modelManager = e,
        this.renderScene = t,
        this.renderCamera = i,
        this.selectedObjectIds = void 0 !== o ? o : [],
        this.defaultEdgeColor = (new LA).setHex(4173056),
        this.defaultEdgeAlpha = .95,
        this.edgeColor = new p(this.defaultEdgeColor.r,this.defaultEdgeColor.g,this.defaultEdgeColor.b,this.defaultEdgeAlpha),
        this.edgeLength = 2,
        this.resolution = void 0 !== A ? new s(A.x,A.y) : new s(256,256);
        var n = {
            minFilter: 1006,
            magFilter: 1006,
            format: 1023
        };
        this.renderTargetDepthBuffer = new g(this.resolution.x,this.resolution.y,n),
        this.renderTargetDepthBuffer.texture.name = "OutlinePass.depth",
        this.renderTargetDepthBuffer.texture.generateMipmaps = !1,
        this.renderTargetMaskBuffer = new g(this.resolution.x,this.resolution.y,n),
        this.renderTargetMaskBuffer.texture.name = "OutlinePass.mask",
        this.renderTargetMaskBuffer.texture.generateMipmaps = !1,
        this.renderTargetMaskDownSampleBuffer = new g(this.resolution.x,this.resolution.y,n),
        this.renderTargetMaskDownSampleBuffer.texture.name = "OutlinePass.depthDownSample",
        this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = !1,
        this.renderTargetEdgeBuffer = new g(this.resolution.x,this.resolution.y,n),
        this.renderTargetEdgeBuffer.texture.name = "OutlinePass.edge",
        this.renderTargetEdgeBuffer.texture.generateMipmaps = !1,
        this.renderTargetColorBuffer = new g(this.resolution.x,this.resolution.y,n),
        this.renderTargetColorBuffer.texture.name = "OutlinePass.color",
        this.renderTargetColorBuffer.texture.generateMipmaps = !1,
        this.depthMaterial = new ji,
        this.depthMaterial.side = 2,
        this.depthMaterial.depthPacking = 3201,
        this.depthMaterial.blending = 0,
        this.InstancedDepthMaterial = new Su,
        this.InstancedDepthMaterial.side = 2,
        this.InstancedDepthMaterial.depthPacking = 3201,
        this.InstancedDepthMaterial.blending = 0,
        this.prepareMaskMaterial = this.getPrepareMaskMaterial(),
        this.prepareMaskMaterial.side = 2,
        this.prepareMaskInstancedMaterial = this.getPrepareMaskInstancedMaterial(),
        this.prepareMaskInstancedMaterial.side = 2,
        this.edgeDetectionMaterial = this.getEdgeDetectionMaterial(),
        this.overlayMaterial = this.getOverlayMaterial(),
        void 0 === py && console.error("OutlinePass relies on THREE.CopyShader");
        var r = py;
        return this.copyUniforms = Ge.clone(r.uniforms),
        this.copyUniforms.opacity.value = 1,
        this.materialCopy = new Pe({
            uniforms: this.copyUniforms,
            vertexShader: r.vertexShader,
            fragmentShader: r.fragmentShader,
            blending: 0,
            depthTest: !1,
            depthWrite: !1,
            transparent: !0
        }),
        this.enabled = !0,
        this.needsSwap = !1,
        this.oldClearColor = new LA,
        this.oldClearAlpha = 1,
        this.camera = new Ka(-1,1,1,-1,0,1),
        this.scene = new Y,
        this.quad = new Ue(new et(2,2),null),
        this.quad.frustumCulled = !1,
        this.scene.add(this.quad),
        this.textureMatrix = new M,
        this
    };
    Ey.prototype.dispose = function() {
        this.renderTargetDepthBuffer.dispose(),
        this.renderTargetMaskBuffer.dispose(),
        this.renderTargetMaskDownSampleBuffer.dispose(),
        this.renderTargetEdgeBuffer.dispose(),
        this.renderTargetColorBuffer.dispose()
    }
    ,
    Ey.prototype.setSize = function(A, e) {
        this.renderTargetDepthBuffer.setSize(A, e),
        this.renderTargetMaskBuffer.setSize(A, e),
        this.renderTargetMaskDownSampleBuffer.setSize(A, e),
        this.renderTargetEdgeBuffer.setSize(A, e),
        this.renderTargetColorBuffer.setSize(A, e)
    }
    ,
    Ey.prototype.adjustVisibilityOfObjectsWithoutOutline = function(A) {
        this.modelManager.adjustVisibilityOfObjectsWithoutOutline(A)
    }
    ,
    Ey.prototype.adjustVisibility = function(A) {
        this.modelManager.adjustVisibility(A)
    }
    ,
    Ey.prototype.changeVisibilityOfSelectedObjects = function(A) {
        this.modelManager.changeVisibilityOfSelectedObjects(A)
    }
    ,
    Ey.prototype.changeVisibilityOfNonSelectedObjects = function(A) {
        this.modelManager.changeVisibilityOfNonSelectedObjects(A)
    }
    ,
    Ey.prototype.adjustInstanceVisibility = function(A) {
        this.modelManager.adjustInstanceVisibility(A)
    }
    ,
    Ey.prototype.changeInstanceVisibilityOfSelectedObjects = function(A) {
        this.modelManager.changeInstanceVisibilityOfSelectedObjects(A)
    }
    ,
    Ey.prototype.changeInstanceVisibilityOfNonSelectedObjects = function(A) {
        this.modelManager.changeInstanceVisibilityOfNonSelectedObjects(A)
    }
    ,
    Ey.prototype.restoreVisibilityOfObjects = function() {
        this.modelManager.restoreVisibilityOfObjects()
    }
    ,
    Ey.prototype.updateTextureMatrix = function() {
        this.textureMatrix.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1),
        this.textureMatrix.multiply(this.renderCamera.projectionMatrix),
        this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)
    }
    ,
    Ey.prototype.render = function(A, e, t, i, o) {
        this.oldClearColor.copy(A.getClearColor()),
        this.oldClearAlpha = A.getClearAlpha();
        var n = A.autoClear;
        A.autoClear = !1,
        o && A.state.buffers.stencil.setTest(!1),
        A.setClearColor(0, 0),
        this.adjustVisibilityOfObjectsWithoutOutline(!1),
        this.adjustInstanceVisibility(!1),
        this.changeVisibilityOfSelectedObjects(!1),
        this.renderScene.overrideMaterial = this.depthMaterial,
        A.setRenderTarget(this.renderTargetDepthBuffer),
        A.clear(),
        A.render(this.renderScene, this.renderCamera),
        this.adjustInstanceVisibility(!0),
        this.changeVisibilityOfSelectedObjects(!0),
        this.adjustVisibility(!1),
        this.changeInstanceVisibilityOfSelectedObjects(!1),
        this.renderScene.overrideMaterial = this.InstancedDepthMaterial,
        A.setRenderTarget(this.renderTargetDepthBuffer),
        A.render(this.renderScene, this.renderCamera),
        this.adjustVisibility(!0),
        this.changeInstanceVisibilityOfSelectedObjects(!0),
        this.updateTextureMatrix(),
        this.adjustInstanceVisibility(!1),
        this.changeVisibilityOfNonSelectedObjects(!1),
        this.adjustVisibilityOfObjectsWithoutOutline(!1),
        this.renderScene.overrideMaterial = this.prepareMaskMaterial,
        this.prepareMaskMaterial.uniforms.cameraNearFar.value = new s(this.renderCamera.near,this.renderCamera.far),
        this.prepareMaskMaterial.uniforms.depthTexture.value = this.renderTargetDepthBuffer.texture,
        this.prepareMaskMaterial.uniforms.textureMatrix.value = this.textureMatrix,
        A.setRenderTarget(this.renderTargetMaskBuffer),
        A.clear(),
        A.render(this.renderScene, this.renderCamera),
        this.adjustInstanceVisibility(!0),
        this.changeVisibilityOfNonSelectedObjects(!0),
        this.adjustVisibility(!1),
        this.changeInstanceVisibilityOfNonSelectedObjects(!1),
        this.adjustVisibilityOfObjectsWithoutOutline(!1),
        this.renderScene.overrideMaterial = this.prepareMaskInstancedMaterial,
        this.prepareMaskInstancedMaterial.uniforms.cameraNearFar.value = new s(this.renderCamera.near,this.renderCamera.far),
        this.prepareMaskInstancedMaterial.uniforms.depthTexture.value = this.renderTargetDepthBuffer.texture,
        this.prepareMaskInstancedMaterial.uniforms.textureMatrix.value = this.textureMatrix,
        A.setRenderTarget(this.renderTargetMaskBuffer),
        A.render(this.renderScene, this.renderCamera),
        this.renderScene.overrideMaterial = null,
        this.adjustVisibility(!0),
        this.changeInstanceVisibilityOfNonSelectedObjects(!0),
        this.restoreVisibilityOfObjects(),
        this.quad.material = this.materialCopy,
        this.copyUniforms.tDiffuse.value = this.renderTargetMaskBuffer.texture,
        A.setRenderTarget(this.renderTargetMaskDownSampleBuffer),
        A.clear(),
        A.render(this.scene, this.camera),
        this.quad.material = this.edgeDetectionMaterial,
        this.edgeDetectionMaterial.uniforms.maskTexture.value = this.renderTargetMaskDownSampleBuffer.texture,
        this.edgeDetectionMaterial.uniforms.texSize.value = new s(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),
        this.edgeDetectionMaterial.uniforms.edgeColor.value = this.edgeColor,
        this.edgeDetectionMaterial.uniforms.edgeLength.value = this.edgeLength,
        A.setRenderTarget(this.renderTargetEdgeBuffer),
        A.clear(),
        A.render(this.scene, this.camera),
        this.quad.material = this.overlayMaterial,
        this.overlayMaterial.uniforms.colorTexture.value = t.texture,
        this.overlayMaterial.uniforms.outlineTexture.value = this.renderTargetEdgeBuffer.texture,
        A.setRenderTarget(this.renderTargetColorBuffer),
        A.clear(),
        A.render(this.scene, this.camera),
        this.quad.material = this.materialCopy,
        this.copyUniforms.tDiffuse.value = this.renderTargetColorBuffer.texture,
        o && A.state.buffers.stencil.setTest(!0),
        A.setRenderTarget(t),
        A.clear(),
        this.adjustVisibilityOfObjectsWithoutOutline(!0),
        A.render(this.scene, this.camera),
        A.setClearColor(this.oldClearColor, this.oldClearAlpha),
        A.autoClear = n
    }
    ,
    Ey.prototype.getPrepareMaskMaterial = function() {
        return new Pe({
            uniforms: {
                depthTexture: {
                    value: null
                },
                cameraNearFar: {
                    value: new s(.5,.5)
                },
                textureMatrix: {
                    value: new M
                }
            },
            vertexShader: "varying vec2 vUv;\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tuniform mat4 textureMatrix;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tvPosition = modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t\tvec4 worldPosition = modelMatrix * vec4( position, 1.0 );\n\t\t\t\t\tprojTexCoord = textureMatrix * worldPosition;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",
            fragmentShader: "\n                #include <packing>\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tuniform sampler2D depthTexture;\n\t\t\t\tuniform vec2 cameraNearFar;\n\t\t\t\t\n\t\t\t\tfloat linearDepth(float depth)\n                {\n                    float far = cameraNearFar.y;\n                    float near = cameraNearFar.x;\n                    return (2.0 * near) / (far + near - depth * (far - near));\n                }\n\t\t\t\t\n\t\t\t\tvoid main() {\n\t\t\t\t\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\t\t\t\t\t\n\t\t\t\t\tgl_FragColor = vec4(depth);\n\t\t\t\t}"
        })
    }
    ,
    Ey.prototype.getPrepareMaskInstancedMaterial = function() {
        return new Pe({
            uniforms: {
                depthTexture: {
                    value: null
                },
                cameraNearFar: {
                    value: new s(.5,.5)
                },
                textureMatrix: {
                    value: new M
                }
            },
            vertexShader: "\n                attribute float vState;            \n                attribute vec4 aColor;            \n                attribute vec3 mcol0;\n                attribute vec3 mcol1;\n                attribute vec3 mcol2;\n                attribute vec3 mcol3;\n                #if defined(USE_MAP)\n                    attribute vec2 muvCol0;\n                    attribute vec2 muvCol1;\n                    attribute vec2 muvCol2;\n                #endif\n                \n                varying float vfState;\n                varying vec2 vUv;\n\t\t\t\tvarying vec4 projTexCoord;\n\t\t\t\tvarying vec4 vPosition;\n\t\t\t\tuniform mat4 textureMatrix;\n\t\t\t\t\n\t\t\t\tvec3 getInstancePosition(vec3 position) {\n                    return vec3(mat4(vec4(mcol0, 0.0),\n                                     vec4(mcol1, 0.0),\n                                     vec4(mcol2, 0.0),\n                                     vec4(mcol3, 1.0)) * vec4(position, 1.0));\n                }\n                \n                vec2 getInstanceUV(vec2 uv) {\n                \n                    #if defined(USE_MAP)\n                        return vec2(mat3(vec3(muvCol0, 0.0),\n                                         vec3(muvCol1, 0.0), \n                                         vec3(muvCol2, 1.0)) * vec3(uv, 1.0));\n                    #else\n                        return uv;\n                    #endif                    \n                    \n                }\n            \n\t\t\t\tvoid main() {\n\t\t\t\t    vfState = vState;\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tvPosition = vec4(getInstancePosition(position), 1.0);\n\t\t\t\t\tvec4 worldPosition = modelMatrix * vPosition;\n\t\t\t\t\tprojTexCoord = textureMatrix * worldPosition;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vPosition;\n\t\t\t\t}",
            fragmentShader: "#include <packing>\n                varying float vfState;\n                varying vec2 vUv;\n                varying vec4 vPosition;\n                varying vec4 projTexCoord;\n                uniform sampler2D depthTexture;\n                uniform vec2 cameraNearFar;\n                \n                float linearDepth(float depth)\n                {\n                    float far = cameraNearFar.y;\n                    float near = cameraNearFar.x;\n                    return (2.0 * near) / (far + near - depth * (far - near));\n                }\n                \n                void main() {\n                    if (vfState <= -0.99 && vfState >= -1.01) discard;\n                    float depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n                    gl_FragColor = vec4(depth);\n                }"
        })
    }
    ,
    Ey.prototype.getEdgeDetectionMaterial = function() {
        return new Pe({
            uniforms: {
                maskTexture: {
                    value: null
                },
                texSize: {
                    value: new s(.5,.5)
                },
                edgeColor: {
                    value: new p(1,1,1,1)
                },
                edgeLength: {
                    value: 2
                }
            },
            vertexShader: "\n                varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",
            fragmentShader: "\n                varying vec2 vUv;\n\t\t\t\tuniform sampler2D maskTexture;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec4 edgeColor;\n                uniform float edgeLength; \n                \n                void main(void)\n                {\n                    float directions[3];\n                    directions[0] = -1.0;\n                    directions[1] = 0.0;\n                    directions[2] = 1.0;\n                \n                    float scalars[3];\n                    scalars[0] = 3.0;\n                    scalars[1] = 10.0;\n                    scalars[2] = 3.0;\n                \n                    float padx = 1.0 / texSize.x;\n                    float pady = 1.0 / texSize.y ; \n                \n                    float edgeSize  = 0.0; \n                    float horizEdge = 0.0;\n                    float vertEdge = 0.0;                    \n                \n                    for (int i = 0; i < 3; ++i)\n                    {\n                        float dir = directions[i];\n                        float scale = scalars[i];\n                \n                        horizEdge -= texture2D(maskTexture, vUv + vec2(-padx, dir * pady)).x * scale;\n                        horizEdge += texture2D(maskTexture, vUv + vec2(padx, dir * pady)).x * scale;\n                \n                        vertEdge -= texture2D(maskTexture, vUv + vec2(dir * padx, -pady)).x * scale;\n                        vertEdge += texture2D(maskTexture, vUv + vec2(dir * padx, pady)).x * scale;\n                    }                    \n                  \n                    float len = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);    \n                    float alpha = len > edgeLength ? edgeColor.a : (texture2D(maskTexture, vUv).w > 0.1 ? 0.1 : 0.0);\n                    gl_FragColor = vec4(edgeColor.rgb, alpha);\n                }"
        })
    }
    ,
    Ey.prototype.getOverlayMaterial = function() {
        return new Pe({
            uniforms: {
                colorTexture: {
                    value: null
                },
                outlineTexture: {
                    value: null
                }
            },
            vertexShader: "varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",
            fragmentShader: "varying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform sampler2D outlineTexture;\n\t\t\t\t\n\t\t\t\tvoid main() {\n\t\t\t\t\tvec4 outlineColor = texture2D(outlineTexture, vUv);\t\t\t\t\t\n\t\t\t\t\tgl_FragColor = mix(texture2D(colorTexture, vUv), outlineColor, outlineColor.a);\t\t\t\t\t\n\t\t\t\t}",
            blending: 2,
            depthTest: !1,
            depthWrite: !1,
            transparent: !0
        })
    }
    ,
    Ey.prototype.setOutlineEdgeColor = function(A) {
        this.edgeColor.fromArray([A.r, A.g, A.b, A.opacity ? A.opacity : 1])
    }
    ,
    Ey.prototype.getOutlineEdgeColor = function(A) {
        return (new Xh).fromArray(this.edgeColor.toArray())
    }
    ;
    var By = function(A) {
        this.renderer = A,
        this.composer = null,
        this.renderPass = null,
        this.outlinePass = null,
        this.effectFXAA = null,
        this.selectedObjectIds = []
    };
    By.prototype.destroy = function() {
        this.renderer = null,
        this.composer = null,
        this.renderPass = null,
        this.outlinePass = null,
        this.effectFXAA = null,
        this.selectedObjectIds = null
    }
    ,
    By.prototype.init = function(A, e, t, i, o) {
        this.composer = new Cy(this.renderer),
        this.renderPass = new Iy(e,t),
        this.composer.addPass(this.renderPass),
        this.outlinePass = new Ey(new s(i,o),A,e,t),
        this.composer.addPass(this.outlinePass),
        this.effectFXAA = new uy(vy),
        this.effectFXAA.uniforms.resolution.value.set(1 / i, 1 / o),
        this.effectFXAA.renderToScreen = !0,
        this.composer.addPass(this.effectFXAA)
    }
    ,
    By.prototype.reinit = function(A, e, t, i, o, n) {
        this.renderer = A,
        this.composer = new Cy(this.renderer),
        this.renderPass = this.renderPass || new Iy(t,i),
        this.composer.addPass(this.renderPass),
        this.outlinePass = this.outlinePass || new Ey(new s(o,n),e,t,i),
        this.composer.addPass(this.outlinePass),
        this.effectFXAA = this.effectFXAA || new uy(vy),
        this.effectFXAA.uniforms.resolution.value.set(1 / o, 1 / n),
        this.effectFXAA.renderToScreen = !0,
        this.composer.addPass(this.effectFXAA)
    }
    ,
    By.prototype.render = function() {
        this.composer.render()
    }
    ,
    By.prototype.setSize = function(A, e) {
        this.composer.setSize(A, e),
        this.effectFXAA.uniforms.resolution.value.set(1 / A, 1 / e)
    }
    ,
    By.prototype.addSelectedId = function(A) {
        this.selectedObjectIds.push(A)
    }
    ,
    By.prototype.clearSelectedIds = function() {
        this.selectedObjectIds.length = 0
    }
    ,
    By.prototype.setSelectedIds = function(A) {
        if (this.outlinePass) {
            this.clearSelectedIds();
            for (var e = 0, t = A.length; t > e; e += 1)
                this.addSelectedId(A[e]);
            this.outlinePass.selectedObjectIds = this.selectedObjectIds
        }
    }
    ,
    By.prototype.setOutlineEdgeColor = function(A) {
        this.outlinePass.setOutlineEdgeColor(A)
    }
    ,
    By.prototype.getOutlineEdgeColor = function() {
        return this.outlinePass.getOutlineEdgeColor()
    }
    ;
    var xy = function(A) {
        jA.call(this, A),
        this.type = "InstancedMeshBasicMaterial",
        this.uniforms = it.basic.uniforms,
        this.vertexShader = function(A) {
            return A.replace("#include <project_vertex>", "\n        vec4 mvPosition = modelViewMatrix * vec4(getInstancePosition(transformed), 1.0);\n        gl_Position = projectionMatrix * mvPosition;\n    ")
        }(it.basic.vertexShader.replace("void main() {", "\n            attribute float vState;           \n            attribute vec3 mcol0;\n            attribute vec3 mcol1;\n            attribute vec3 mcol2;\n            attribute vec3 mcol3; \n            varying float vfState;\n            \n            vec3 getInstancePosition(vec3 position) {\n                return vec3(mat4(vec4(mcol0, 0.0),\n                                 vec4(mcol1, 0.0),\n                                 vec4(mcol2, 0.0),\n                                 vec4(mcol3, 1.0)) * vec4(position, 1.0));\n            }\n            \n            void main() {\n                vfState = vState;\n        ")),
        this.fragmentShader = it.basic.fragmentShader.replace("void main() {", "\n            varying float vfState;            \n            void main() {\n                if (vfState <= -0.99 && vfState >= -1.01) discard;\n                \n        ")
    };
    (xy.prototype = Object.create(jA.prototype)).constructor = xy;
    var Sy = function(A) {
        this.viewer = A;
        var e = vc.SelectionColor.color;
        this.wireframeMaterial = new jA({
            color: e,
            opacity: 1,
            transparent: !0,
            blending: 5,
            blendSrc: 201,
            blendDst: 200,
            blendEquation: 100
        }),
        this.selectedMaterial = new jA({
            color: e,
            opacity: .3,
            transparent: !0
        }),
        this.skinningWireframeMaterial = new jA({
            color: e,
            opacity: 1,
            transparent: !0,
            blending: 5,
            blendSrc: 201,
            blendDst: 200,
            blendEquation: 100,
            skinning: !0
        }),
        this.skinningSelectedMaterial = new jA({
            color: e,
            opacity: .3,
            transparent: !0,
            skinning: !0
        }),
        this.selectedLineMaterial = new YC({
            color: e,
            opacity: 1,
            transparent: !0,
            linewidth: 2,
            dashed: !1
        }),
        this.instancedWireFrameMaterial = new xy({
            color: e,
            opacity: 1,
            transparent: !0,
            blending: 5,
            blendSrc: 201,
            blendDst: 200,
            blendEquation: 100
        }),
        this.instancedSelectedMaterial = new xy({
            color: e,
            opacity: .3,
            transparent: !0
        }),
        this.selectionScene = new Y,
        this.selectionScene.autoUpdate = !1,
        this.selectionObjectGroup = new ep,
        this.selectionObjectGroup.name = "PickingObjectGroup",
        this.selectionObjectGroup.matrixAutoUpdate = !1,
        this.selectionScene.add(this.selectionObjectGroup),
        this.lastSelectedUserIdMap = null,
        this.lastSelectedUserIds = null
    };
    Sy.prototype.destroy = function() {
        this.wireframeMaterial.dispose(),
        this.wireframeMaterial = null,
        this.selectedMaterial.dispose(),
        this.selectedMaterial = null,
        this.skinningWireframeMaterial.dispose(),
        this.skinningWireframeMaterial = null,
        this.skinningSelectedMaterial.dispose(),
        this.skinningSelectedMaterial = null,
        this.selectedLineMaterial.dispose(),
        this.selectedLineMaterial = null,
        this.instancedWireFrameMaterial.dispose(),
        this.instancedWireFrameMaterial = null,
        this.instancedSelectedMaterial.dispose(),
        this.instancedSelectedMaterial = null,
        this.selectionObjectGroup.clear(),
        this.selectionObjectGroup = null,
        this.selectionScene = null,
        this.lastSelectedUserIdMap = null,
        this.lastSelectedUserIds = null,
        this.viewer = null
    }
    ,
    Sy.prototype.apply = function(A) {
        var e = this.viewer
          , t = e.getSelection();
        if (!t || !t.length)
            return this._clearSelectedUserIdsCache(),
            void this._clearMeshesFromScene();
        (A || this._isSelectionsChanged()) && (this._cacheSelectedUserIds(t),
        this._updateScene(t)),
        this._render(e.rendererManager.getRenderer(), e.camera)
    }
    ,
    Sy.prototype._isSelectionsChanged = function() {
        var A = this.lastSelectedUserIds;
        if (!A)
            return !0;
        var e = this.viewer.getSelection()
          , t = e.length;
        if (t !== A.length)
            return !0;
        for (var i = !1, o = this.lastSelectedUserIdMap, n = t - 1; n >= 0; n -= 1)
            if (!o[e[n]]) {
                i = !0;
                break
            }
        return i
    }
    ,
    Sy.prototype._cacheSelectedUserIds = function(A) {
        this.lastSelectedUserIds = A.slice(0),
        this.lastSelectedUserIdMap = uh.arrayToMap(A)
    }
    ,
    Sy.prototype._clearSelectedUserIdsCache = function() {
        this.lastSelectedUserIds = null,
        this.lastSelectedUserIdMap = null
    }
    ,
    Sy.prototype._render = function(A, e) {
        var t = A.autoClearColor
          , i = A.autoClearDepth
          , o = A.autoClearStencil;
        A.autoClearColor = !1,
        A.autoClearDepth = !0,
        A.autoClearStencil = !1,
        A.render(this.selectionScene, e),
        A.autoClearColor = t,
        A.autoClearDepth = i,
        A.autoClearStencil = o
    }
    ,
    Sy.prototype._updateScene = function(A) {
        this._clearMeshesFromScene(),
        this._addMeshesToScene(this._getSelectedMeshes(A)),
        this._updateMatrixWorldForScene(),
        this._updateSelectedLineMaterial()
    }
    ,
    Sy.prototype._clearMeshesFromScene = function() {
        this.selectionObjectGroup.clear()
    }
    ,
    Sy.prototype._addMeshesToScene = function(A) {
        for (var e = 0, t = A.length; t > e; e += 1)
            this.selectionObjectGroup.add(A[e])
    }
    ,
    Sy.prototype._updateMatrixWorldForScene = function() {
        this.selectionObjectGroup.matrix.copy(this.viewer.getScene().getMatrixGlobal()),
        this.selectionObjectGroup.updateMatrixWorld(!0)
    }
    ,
    Sy.prototype._getSelectedMeshes = function(A) {
        var e = {
            meshes: []
        }
          , t = this
          , i = uh.arrayToMap(A);
        return this.viewer.getModelManager().traverseLoadedModels((function(o) {
            o.getPickingMeshes(t, e, A, i)
        }
        )),
        e.meshes
    }
    ,
    Sy.prototype._updateSelectedLineMaterial = function() {
        vc.PickingLineWidthEnabled && this.selectedLineMaterial.resolution.set(this.viewer.domElement.offsetWidth, this.viewer.domElement.offsetHeight)
    }
    ,
    Sy.prototype.setSelectionColor = function(A, e) {
        var t = this.selectedMaterial.opacity;
        e = void 0 === e ? t : e,
        "0x" + this.selectedMaterial.color.getHexString() === A && t === e || (this.selectedMaterial.color.setHex(A),
        this.skinningSelectedMaterial.color.setHex(A),
        this.instancedSelectedMaterial.color.setHex(A),
        void 0 === e && null === e || (this.selectedMaterial.opacity = e,
        this.skinningSelectedMaterial.opacity = e,
        this.instancedSelectedMaterial.opacity = e,
        1 > e ? (this.selectedMaterial.transparent = !0,
        this.skinningSelectedMaterial.transparent = !0,
        this.instancedSelectedMaterial.transparent = !0) : (this.selectedMaterial.transparent = !1,
        this.skinningSelectedMaterial.transparent = !1,
        this.instancedSelectedMaterial.transparent = !1)),
        this.selectedMaterial.needsUpdate = !0,
        this.skinningSelectedMaterial.needsUpdate = !0,
        this.instancedSelectedMaterial.needsUpdate = !0)
    }
    ,
    Sy.prototype.getSelectionColor = function(A, e) {
        var t = this.selectedMaterial.opacity;
        return new Xh(this.selectedMaterial.color.getHex(),t)
    }
    ,
    Sy.prototype.setLineSelectionColor = function(A, e) {
        var t = this.wireframeMaterial.opacity;
        e = void 0 === e ? t : e,
        "0x" + this.wireframeMaterial.color.getHexString() === A && t === e || (this.wireframeMaterial.color.setHex(A),
        this.skinningWireframeMaterial.color.setHex(A),
        this.selectedLineMaterial.color.setHex(A),
        this.instancedWireFrameMaterial.color.setHex(A),
        void 0 === e && null === e || (this.wireframeMaterial.opacity = e,
        this.skinningWireframeMaterial.opacity = e,
        this.selectedLineMaterial.opacity = e,
        this.instancedWireFrameMaterial.opacity = e,
        1 > e ? (this.wireframeMaterial.transparent = !0,
        this.skinningWireframeMaterial.transparent = !0,
        this.selectedLineMaterial.transparent = !0,
        this.instancedWireFrameMaterial.transparent = !0) : (this.wireframeMaterial.transparent = !1,
        this.skinningWireframeMaterial.transparent = !1,
        this.selectedLineMaterial.transparent = !1,
        this.instancedWireFrameMaterial.transparent = !1)),
        this.wireframeMaterial.needsUpdate = !0,
        this.skinningWireframeMaterial.needsUpdate = !0,
        this.selectedLineMaterial.needsUpdate = !0,
        this.instancedWireFrameMaterial.needsUpdate = !0)
    }
    ,
    Sy.prototype.getLineSelectionColor = function() {
        var A = this.wireframeMaterial.opacity;
        return new Xh(this.wireframeMaterial.color.getHex(),A)
    }
    ;
    var wy = new M
      , My = function() {
        function A(e) {
            cc(this, A),
            e = e || {},
            this.vertices = {
                near: [new y, new y, new y, new y],
                far: [new y, new y, new y, new y]
            },
            void 0 !== e.projectionMatrix && this.setFromProjectionMatrix(e.projectionMatrix, e.maxFar || 1e4)
        }
        return dc(A, [{
            key: "setFromProjectionMatrix",
            value: function(A, e) {
                var t = 0 === A.elements[11];
                return wy.getInverse(A),
                this.vertices.near[0].set(1, 1, -1),
                this.vertices.near[1].set(1, -1, -1),
                this.vertices.near[2].set(-1, -1, -1),
                this.vertices.near[3].set(-1, 1, -1),
                this.vertices.near.forEach((function(A) {
                    A.applyMatrix4(wy)
                }
                )),
                this.vertices.far[0].set(1, 1, 1),
                this.vertices.far[1].set(1, -1, 1),
                this.vertices.far[2].set(-1, -1, 1),
                this.vertices.far[3].set(-1, 1, 1),
                this.vertices.far.forEach((function(A) {
                    A.applyMatrix4(wy);
                    var i = Math.abs(A.z);
                    t ? A.z *= Math.min(e / i, 1) : A.multiplyScalar(Math.min(e / i, 1))
                }
                )),
                this.vertices
            }
        }, {
            key: "split",
            value: function(e, t) {
                for (; e.length > t.length; )
                    t.push(new A);
                t.length = e.length;
                for (var i = 0; e.length > i; i += 1) {
                    var o = t[i];
                    if (0 === i)
                        for (var n = 0; 4 > n; n += 1)
                            o.vertices.near[n].copy(this.vertices.near[n]);
                    else
                        for (var r = 0; 4 > r; r += 1)
                            o.vertices.near[r].lerpVectors(this.vertices.near[r], this.vertices.far[r], e[i - 1]);
                    if (i === e - 1)
                        for (var a = 0; 4 > a; a += 1)
                            o.vertices.far[a].copy(this.vertices.far[a]);
                    else
                        for (var s = 0; 4 > s; s += 1)
                            o.vertices.far[s].lerpVectors(this.vertices.near[s], this.vertices.far[s], e[i])
                }
            }
        }, {
            key: "toSpace",
            value: function(A, e) {
                for (var t = 0; 4 > t; t += 1)
                    e.vertices.near[t].copy(this.vertices.near[t]).applyMatrix4(A),
                    e.vertices.far[t].copy(this.vertices.far[t]).applyMatrix4(A)
            }
        }]),
        A
    }()
      , by = {
        lights_fragment_begin: "\nGeometricContext geometry;\n\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n\n#ifdef CLEARCOAT\n\n\tgeometry.clearcoatNormal = clearcoatNormal;\n\n#endif\n\nIncidentLight directLight;\n\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\n\t\tpointLight = pointLights[ i ];\n\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\n\t\tspotLight = spotLights[ i ];\n\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#if ( NUM_DIR_LIGHTS > 0) && defined( RE_Direct ) && defined( USE_CSM ) && defined( CSM_CASCADES )\n\n\tDirectionalLight directionalLight;\n\tfloat linearDepth = (vViewPosition.z) / (shadowFar - cameraNear);\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#if defined( USE_SHADOWMAP ) && defined( CSM_FADE )\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\n\t\t// NOTE: Depth gets larger away from the camera.\n\t\t// cascade.x is closer, cascade.y is further\n\t\tvec2 cascade = CSM_cascades[ i ];\n\t\tfloat cascadeCenter = ( cascade.x + cascade.y ) / 2.0;\n\t\tfloat closestEdge = linearDepth < cascadeCenter ? cascade.x : cascade.y;\n\t\tfloat margin = 0.25 * pow( closestEdge, 2.0 );\n\t\tfloat csmx = cascade.x - margin / 2.0;\n\t\tfloat csmy = cascade.y + margin / 2.0;\n\t\tif( i < NUM_DIR_LIGHT_SHADOWS && linearDepth >= csmx && ( linearDepth < csmy || i == CSM_CASCADES - 1 ) ) {\n\n\t\t\tfloat dist = min( linearDepth - csmx, csmy - linearDepth );\n\t\t\tfloat ratio = clamp( dist / margin, 0.0, 1.0 );\n\t\t\tif( i < NUM_DIR_LIGHT_SHADOWS ) {\n\n\t\t\t\tvec3 prevColor = directLight.color;\n\t\t\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\t\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t\t\t\tbool shouldFadeLastCascade = i == CSM_CASCADES - 1 && linearDepth > cascadeCenter;\n\t\t\t\tdirectLight.color = mix( prevColor, directLight.color, shouldFadeLastCascade ? ratio : 1.0 );\n\n\t\t\t}\n\n\t\t\tReflectedLight prevLight = reflectedLight;\n\t\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t\t\tbool shouldBlend = i != CSM_CASCADES - 1 || i == CSM_CASCADES - 1 && linearDepth < cascadeCenter;\n\t\t\tfloat blendRatio = shouldBlend ? ratio : 1.0;\n\n\t\t\treflectedLight.directDiffuse = mix( prevLight.directDiffuse, reflectedLight.directDiffuse, blendRatio );\n\t\t\treflectedLight.directSpecular = mix( prevLight.directSpecular, reflectedLight.directSpecular, blendRatio );\n\t\t\treflectedLight.indirectDiffuse = mix( prevLight.indirectDiffuse, reflectedLight.indirectDiffuse, blendRatio );\n\t\t\treflectedLight.indirectSpecular = mix( prevLight.indirectSpecular, reflectedLight.indirectSpecular, blendRatio );\n\n\t\t}\n\n\t}\n\t#else\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y) directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\n\t\t#endif\n\n\t\tif(linearDepth >= CSM_cascades[UNROLLED_LOOP_INDEX].x && (linearDepth < CSM_cascades[UNROLLED_LOOP_INDEX].y || UNROLLED_LOOP_INDEX == CSM_CASCADES - 1)) RE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\n\t#endif\n\n#endif\n\n\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) && !defined( USE_CSM ) && !defined( CSM_CASCADES )\n\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n\t\tdirectionalLight = directionalLights[ i ];\n\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\n\tRectAreaLight rectAreaLight;\n\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\n\t}\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n\n\tvec3 iblIrradiance = vec3( 0.0 );\n\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\n\t\t}\n\n\t#endif\n\n#endif\n\n#if defined( RE_IndirectSpecular )\n\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n\n#endif\n",
        lights_pars_begin: "\n#if defined( USE_CSM ) && defined( CSM_CASCADES )\nuniform vec2 CSM_cascades[CSM_CASCADES];\nuniform float cameraNear;\nuniform float shadowFar;\n#endif\n\t" + tt.lights_pars_begin
    }
      , Uy = new M
      , Fy = new My
      , Ky = new My
      , Qy = new y
      , Ry = new aA
      , Ty = []
      , ky = []
      , Dy = function() {
        function A(e) {
            cc(this, A),
            this.camera = (e = e || {}).camera,
            this.parent = e.parent,
            this.cascades = e.cascades || 3,
            this.maxFar = e.maxFar || 1e5,
            this.mode = e.mode || "practical",
            this.shadowMapSize = e.shadowMapSize || 2048,
            this.shadowBias = e.shadowBias || 1e-6,
            this.lightDirection = e.lightDirection || new y(1,-1,1).normalize(),
            this.lightIntensity = e.lightIntensity || 1,
            this.lightNear = e.lightNear || 1,
            this.lightFar = e.lightFar || 2e3,
            this.lightMargin = e.lightMargin || 200,
            this.customSplitsCallback = e.customSplitsCallback,
            this.fade = !1,
            this.mainFrustum = new My,
            this.frustums = [],
            this.breaks = [],
            this.lights = [],
            this.shaders = new Map,
            this.createLights(),
            this.getBreaks(),
            this.initCascades(),
            this.injectInclude()
        }
        return dc(A, [{
            key: "createLights",
            value: function() {
                for (var A = 0; this.cascades > A; A++) {
                    var e = new Ra(16777215,this.lightIntensity);
                    e.castShadow = !0,
                    e.intensity = .72,
                    e.distance = 300,
                    e.color.setHex(14800580),
                    e.position.set(-100, 100, 160),
                    e.shadow.mapSize.width = this.shadowMapSize,
                    e.shadow.mapSize.height = this.shadowMapSize,
                    e.shadow.camera.near = this.lightNear,
                    e.shadow.camera.far = this.lightFar,
                    e.shadow.bias = this.shadowBias,
                    e.updateMatrixWorld(),
                    this.parent.add(e),
                    this.parent.add(e.target),
                    this.lights.push(e)
                }
            }
        }, {
            key: "initCascades",
            value: function() {
                var A = this.camera;
                A.updateProjectionMatrix(),
                this.mainFrustum.setFromProjectionMatrix(A.projectionMatrix, this.maxFar),
                this.mainFrustum.split(this.breaks, this.frustums)
            }
        }, {
            key: "getBreaks",
            value: function() {
                var A = this.camera
                  , e = Math.min(A.far, this.maxFar);
                switch (this.breaks.length = 0,
                this.mode) {
                case "uniform":
                    t(this.cascades, A.near, e, this.breaks);
                    break;
                case "logarithmic":
                    i(this.cascades, A.near, e, this.breaks);
                    break;
                case "practical":
                    !function(A, e, o, n, r) {
                        Ty.length = 0,
                        ky.length = 0,
                        i(A, e, o, ky),
                        t(A, e, o, Ty);
                        for (var s = 1; A > s; s++)
                            r.push(a.lerp(Ty[s - 1], ky[s - 1], n));
                        r.push(1)
                    }(this.cascades, A.near, e, .5, this.breaks);
                    break;
                case "custom":
                    void 0 === this.customSplitsCallback && console.error("CSM: Custom split scheme callback not defined."),
                    this.customSplitsCallback(this.cascades, A.near, e, this.breaks)
                }
                function t(A, e, t, i) {
                    for (var o = 1; A > o; o++)
                        i.push((e + (t - e) * o / A) / t);
                    i.push(1)
                }
                function i(A, e, t, i) {
                    for (var o = 1; A > o; o++)
                        i.push(e * (t / e) * (o / A) / t);
                    i.push(1)
                }
            }
        }, {
            key: "update",
            value: function(A) {
                for (var e = this.frustums, t = 0; e.length > t; t++) {
                    var i = this.lights[t];
                    i.shadow.camera.updateMatrixWorld(!0),
                    Uy.multiplyMatrices(i.shadow.camera.matrixWorldInverse, A),
                    e[t].toSpace(Uy, Fy);
                    var o = Fy.vertices.near
                      , n = Fy.vertices.far
                      , r = n[0]
                      , a = void 0;
                    a = r.distanceTo(n[2]) > r.distanceTo(o[2]) ? n[2] : o[2];
                    var s = r.distanceTo(a);
                    Ry.makeEmpty();
                    for (var l = 0; 4 > l; l++)
                        Ry.expandByPoint(o[l]),
                        Ry.expandByPoint(n[l]);
                    if (this.fade) {
                        var c = this.camera
                          , h = Math.max(c.far, this.maxFar);
                        s += .25 * Math.pow(e[t].vertices.far[0].z / (h - c.near), 2) * (h - c.near)
                    }
                    var d = s / this.shadowMapSize;
                    Ry.getCenter(Qy),
                    Qy.z = Ry.max.z + this.lightMargin,
                    Qy.x = Math.floor(Qy.x / d) * d,
                    Qy.y = Math.floor(Qy.y / d) * d,
                    Qy.applyMatrix4(i.shadow.camera.matrixWorld),
                    i.shadow.camera.left = -s / 2,
                    i.shadow.camera.right = s / 2,
                    i.shadow.camera.top = s / 2,
                    i.shadow.camera.bottom = -s / 2,
                    i.position.copy(Qy),
                    i.target.position.copy(Qy),
                    i.target.position.x += this.lightDirection.x,
                    i.target.position.y += this.lightDirection.y,
                    i.target.position.z += this.lightDirection.z,
                    i.shadow.camera.updateProjectionMatrix(),
                    i.shadow.camera.updateMatrixWorld()
                }
            }
        }, {
            key: "injectInclude",
            value: function() {
                tt.lights_fragment_begin = by.lights_fragment_begin,
                tt.lights_pars_begin = by.lights_pars_begin
            }
        }, {
            key: "setupMaterial",
            value: function(A) {
                A.defines = A.defines || {},
                A.defines.USE_CSM = 1,
                A.defines.CSM_CASCADES = this.cascades,
                this.fade && (A.defines.CSM_FADE = "");
                var e = []
                  , t = this
                  , i = this.shaders;
                A.onBeforeCompile = function(o) {
                    var n = Math.min(t.camera.far, t.maxFar);
                    t.getExtendedBreaks(e),
                    console.log("www", e, e.length),
                    o.uniforms.CSM_cascades = {
                        value: e
                    },
                    o.uniforms.cameraNear = {
                        value: t.camera.near
                    },
                    o.uniforms.shadowFar = {
                        value: n
                    },
                    i.set(A, o)
                }
                ,
                i.set(A, null)
            }
        }, {
            key: "updateUniforms",
            value: function() {
                var A = Math.min(this.camera.far, this.maxFar);
                this.shaders.forEach((function(e, t) {
                    if (null !== e) {
                        var i = e.uniforms;
                        this.getExtendedBreaks(i.CSM_cascades.value),
                        i.cameraNear.value = this.camera.near,
                        i.shadowFar.value = A
                    }
                    !this.fade && "CSM_FADE"in t.defines ? (delete t.defines.CSM_FADE,
                    t.needsUpdate = !0) : this.fade && !("CSM_FADE"in t.defines) && (t.defines.CSM_FADE = "",
                    t.needsUpdate = !0)
                }
                ), this)
            }
        }, {
            key: "getExtendedBreaks",
            value: function(A) {
                for (; this.breaks.length > A.length; )
                    A.push(new s);
                A.length = this.breaks.length;
                for (var e = 0; this.cascades > e; e++) {
                    var t = this.breaks[e];
                    A[e].x = this.breaks[e - 1] || 0,
                    A[e].y = t
                }
            }
        }, {
            key: "updateFrustums",
            value: function() {
                this.getBreaks(),
                this.initCascades(),
                this.updateUniforms()
            }
        }, {
            key: "helper",
            value: function(A) {
                for (var e, t, i = new ko({
                    color: 16777215
                }), o = new H, n = 0; this.frustums.length > n; n++) {
                    this.frustums[n].toSpace(A, Ky),
                    e = new he,
                    t = [];
                    for (var r = 0; 5 > r; r++) {
                        var a = Ky.vertices.near[4 === r ? 0 : r];
                        t.push(a.x, a.y, a.z)
                    }
                    e.setAttribute("position", new YA(new Float32Array(t),3)),
                    o.add(new Go(e,i)),
                    e = new he,
                    t = [];
                    for (var s = 0; 5 > s; s++) {
                        var l = Ky.vertices.far[4 === s ? 0 : s];
                        t.push(l.x, l.y, l.z)
                    }
                    e.setAttribute("position", new YA(new Float32Array(t),3)),
                    o.add(new Go(e,i));
                    for (var c = 0; 4 > c; c++) {
                        e = new he;
                        var h = Ky.vertices.near[c]
                          , d = Ky.vertices.far[c];
                        (t = []).push(h.x, h.y, h.z),
                        t.push(d.x, d.y, d.z),
                        e.setAttribute("position", new YA(new Float32Array(t),3)),
                        o.add(new Go(e,i))
                    }
                }
                return o
            }
        }, {
            key: "remove",
            value: function() {
                for (var A = 0; this.lights.length > A; A++)
                    this.parent.remove(this.lights[A])
            }
        }, {
            key: "dispose",
            value: function() {
                var A = this.shaders;
                A.forEach((function(A, e) {
                    delete e.onBeforeCompile,
                    delete e.defines.USE_CSM,
                    delete e.defines.CSM_CASCADES,
                    delete e.defines.CSM_FADE,
                    delete A.uniforms.CSM_cascades,
                    delete A.uniforms.cameraNear,
                    delete A.uniforms.shadowFar,
                    e.needsUpdate = !0
                }
                )),
                A.clear()
            }
        }]),
        A
    }()
      , Ly = function(A) {
        this.viewer = A,
        this.renderer = null,
        this.countRenderRequest = 0,
        this.maxCountRenderRequest = 1e4,
        this.rendering = !1,
        this.incrementRenderHandle = 0,
        this.composer = null,
        this.blinkHandle = 0,
        this.transparentSort = function(A, e) {
            return A.groupOrder !== e.groupOrder ? A.groupOrder - e.groupOrder : A.renderOrder !== e.renderOrder ? A.renderOrder - e.renderOrder : A.z !== e.z ? e.z - A.z : A.id - e.id
        }
    };
    Ly.prototype.destroy = function() {
        this.incrementRenderHandle > 0 && cancelAnimationFrame(this.incrementRenderHandle),
        this.blinkHandle > 0 && cancelAnimationFrame(this.blinkHandle),
        this.composer && (this.composer.destroy(),
        this.composer = null),
        this.renderer && (this.renderer.destroy && this.orderedRenderer && (this.renderer.destroy(),
        this.renderer.setRenderer && this.renderer.setRenderer(null),
        this.orderedRenderer = null),
        this.renderer.dispose(),
        this.renderer.domElement.parentNode && this.renderer.domElement.parentNode.removeChild(this.renderer.domElement)),
        this.renderer = null,
        this.pickingEffecter && (this.pickingEffecter.destroy(),
        this.pickingEffecter = null),
        this.viewer = null
    }
    ,
    Ly.prototype.setupRenderer = function(A) {
        if (!this.renderer) {
            var e = this.viewer;
            this.renderer = new $i(A);
            var t = e.domElement.offsetWidth
              , i = e.domElement.offsetHeight;
            this.renderer.toneMapping = 1,
            this.renderer.setTransparentSort(this.transparentSort),
            this.renderer.setClearColor(0, 0),
            this.renderer.setPixelRatio(window.devicePixelRatio || 1),
            this.renderer.setSize(t, i),
            this.renderer.sortObjects = !0,
            this.renderer.domElement.setAttribute("tabindex", "0"),
            this.renderer.domElement.setAttribute("class", "main-canvas"),
            e.domElement.appendChild(this.renderer.domElement),
            this.composer = new By(this.renderer),
            this.composer.init(e.modelManager, e.getScene(), e.camera, t, i),
            this.composer.setOutlineEdgeColor(new Xh(vc.SelectionColor.color,vc.SelectionColor.opacity))
        }
    }
    ,
    Ly.prototype.resetupRenderer = function(A) {
        var e = this.viewer;
        A.context = this.renderer.getContext();
        var t = new $i(A);
        t.setClearColor(this.renderer.getClearColor(), this.renderer.getClearAlpha()),
        t.setPixelRatio(this.renderer.getPixelRatio());
        var i = this.renderer.getSize(new s);
        t.setSize(i.x, i.y),
        t.gammaFactor = this.renderer.gammaFactor,
        t.sortObjects = this.renderer.sortObjects,
        t.domElement = this.renderer.domElement,
        t.toneMapping = this.renderer.toneMapping,
        t.shadowMap.enabled = this.renderer.shadowMap.enabled,
        t.clippingPlanes = this.renderer.clippingPlanes,
        t.shadowMap.enabled = this.renderer.shadowMap.enabled,
        t.shadowMap.type = this.renderer.shadowMap.type,
        t.shadowMap.autoUpdate = this.renderer.shadowMap.autoUpdate,
        t.shadowMap.needsUpdate = this.renderer.shadowMap.needsUpdate,
        t.setTransparentSort(this.transparentSort),
        this.renderer = t,
        this.composer.reinit(this.renderer, e.modelManager, e.getScene(), e.camera, i.x, i.y)
    }
    ,
    Ly.prototype.setupShadowMap = function(A) {
        var e = this.viewer
          , t = new Dy({
            maxFar: A.far,
            cascades: 4,
            mode: A.mode,
            parent: e.getScene().getExternalScene(),
            shadowMapSize: 1024,
            lightDirection: new y(A.lightX,A.lightY,A.lightZ).normalize(),
            camera: e.camera
        });
        this.csm = t;
        var i = new $m;
        i.add(A, "orthographic").onChange((function(A) {}
        )),
        i.add(A, "fade").onChange((function(A) {
            t.fade = A,
            t.updateFrustums()
        }
        )),
        i.add(A, "far", 1, 5e7).step(1).name("shadow far").onChange((function(A) {
            t.maxFar = A,
            t.updateFrustums()
        }
        )),
        i.add(A, "mode", ["uniform", "logarithmic", "practical"]).name("frustum split mode").onChange((function(A) {
            t.mode = A,
            t.updateFrustums()
        }
        )),
        i.add(A, "lightX", -1, 1).name("light direction x").onChange((function(A) {
            t.lightDirection.x = A
        }
        )),
        i.add(A, "lightY", -1, 1).name("light direction y").onChange((function(A) {
            t.lightDirection.y = A
        }
        )),
        i.add(A, "lightZ", -1, 1).name("light direction z").onChange((function(A) {
            t.lightDirection.z = A
        }
        )),
        i.add(A, "margin", 0, 2e6).name("light margin").onChange((function(A) {
            t.lightMargin = A
        }
        )),
        i.add(A, "lightNear", 1, 1e7).name("light near").onChange((function(A) {
            for (var e = 0; t.lights.length > e; e += 1)
                t.lights[e].shadow.camera.near = A,
                t.lights[e].shadow.camera.updateProjectionMatrix()
        }
        )),
        i.add(A, "lightFar", 1, 1e8).name("light far").onChange((function(A) {
            for (var e = 0; t.lights.length > e; e += 1)
                t.lights[e].shadow.camera.far = A,
                t.lights[e].shadow.camera.updateProjectionMatrix()
        }
        ))
    }
    ,
    Ly.prototype._applyPickingEffectForIncrement = function() {
        if (this.getPickingEffecter()) {
            var A = this.viewer.modelManager.isFilterApplied();
            this.orderedRenderer.restart(),
            this.orderedRenderer.setNonBreakingRender(!0),
            this.pickingEffecter.apply(A),
            this.orderedRenderer.setNonBreakingRender(!1)
        }
    }
    ,
    Ly.prototype._applyPickingEffect = function() {
        if (this.getPickingEffecter()) {
            var A = this.viewer.modelManager.isFilterApplied();
            this.pickingEffecter.apply(A)
        }
    }
    ,
    Ly.prototype._forceRenderOneFrame = function() {
        var A = this.viewer
          , e = A.camera
          , t = A.modelManager.getScene();
        this.orderedRenderer ? (this.orderedRenderer.restart(),
        this.orderedRenderer.setNonBreakingRender(!0),
        this.renderer.render(t, e, null, !0),
        this.orderedRenderer.setNonBreakingRender(!1)) : (this.renderer.setRenderTarget(null),
        this.renderer.clear(),
        this.renderer.render(t, e))
    }
    ,
    Ly.prototype.incrementRender = function(A) {
        if (this.countRenderRequest += 1,
        this.countRenderRequest > this.maxCountRenderRequest && (this.countRenderRequest = 0),
        !this.rendering && !this.pickingEffectRendering) {
            this.rendering = !0;
            var e = this
              , t = this.viewer
              , i = t.camera
              , o = t.modelManager
              , n = t.editorManager
              , r = t.getScene()
              , a = this.renderer;
            o.calculateCameraModelRelation(i.position),
            t.cameraControl.updateCamera(),
            t.calculateNearFar(),
            r.updateLights(i);
            var s = n.isUpdateRenderList;
            a.resetIncrementRender(),
            a.setObjectListUpdateState(s),
            s && o.prepareScene(i),
            this.incrementRenderHandle = requestAnimationFrame(function A(s, l) {
                var c = s;
                return function() {
                    a.autoClear = l,
                    n.cameraChange ? (a.resetIncrementRender(),
                    a.autoClear = !0,
                    n.cameraChange = !1) : a.autoClear = l,
                    a.render(r, i) || c !== e.countRenderRequest ? (e.rendering = !1,
                    c !== e.countRenderRequest ? t.render() : (e.pickingEffectRendering = !0,
                    e._applyPickingEffectForIncrement(),
                    o.setFilterApplied(!1),
                    t.onRenderFinishedCallback(),
                    o.disposeBufferAfterVbo(),
                    e.pickingEffectRendering = !1)) : e.incrementRenderHandle = requestAnimationFrame(A(c, !1))
                }
            }(e.countRenderRequest, !0)),
            t.onRenderCallback(),
            t.cameraControl.setCameraChanging(!1)
        }
    }
    ,
    Ly.prototype.fullRender = function() {
        var A = this
          , e = this.viewer
          , t = e.camera
          , i = e.modelManager
          , o = e.getScene()
          , n = this.renderer;
        this.blinkHandle > 0 && cancelAnimationFrame(this.blinkHandle),
        function r() {
            e.cameraControl.updateCamera(),
            e.calculateNearFar(),
            o.updateLights(t),
            i.getBlinkEnabled() && i.updateBlinkMaterial();
            var a = o.fillClipPlane && o.fillClipPlane.visible
              , s = o.clipPlanes && o.clipPlanes.visible && vc.EnableBoxClippingCaps;
            if (vc.ClippingCaps && (a || s) && vc.EnableClippingCaps) {
                if (a || s) {
                    var l = o.getFillClipPlane()
                      , c = o.getClipPlanes()
                      , h = e.modelManager.getModelKeys();
                    i.prepareCapScene(),
                    n.clear(),
                    n.autoClear = !1,
                    a ? (l.capPlane.planeMesh.visible = !0,
                    l.capPlane.lineMesh.visible = !0,
                    c.boxMesh.visible = !1) : (l.capPlane.planeMesh.visible = !1,
                    l.capPlane.lineMesh.visible = !1,
                    c.boxMesh.visible = !0),
                    l.planeHighLightMatrial.visible = !1,
                    c.planeHighLightMatrial.visible = !1,
                    c.planeMaterial.visible = !1,
                    o.overrideMaterial = o.backMaterial;
                    for (var d = {}, p = 0, g = h.length; g > p; p += 1) {
                        var u = h[p]
                          , f = e.modelManager.getModel(u);
                        if (d[u] = {},
                        f) {
                            var m = f._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            });
                            d[u][gp.GEOMETRY] = m.visible,
                            m = f._getNodeGroup(gp.WIREFRAME, {
                                globalSpace: !0
                            }),
                            d[u][gp.WIREFRAME] = m.visible,
                            m = f._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                globalSpace: !0
                            }),
                            d[u][gp.INSTANCEGEOMETRY] = m.visible,
                            m.visible = !1,
                            m = f._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                globalSpace: !0
                            }),
                            d[u][gp.INSTANCEWIREFRAMEGEOMETRY] = m.visible,
                            m.visible = !1
                        }
                    }
                    n.render(o, t),
                    o.overrideMaterial = o.backInstanceMaterial;
                    for (var C = 0, y = h.length; y > C; C += 1) {
                        var v = h[C]
                          , I = e.modelManager.getModel(v);
                        if (I) {
                            var E = I._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            });
                            E.visible = !1,
                            (E = I._getNodeGroup(gp.WIREFRAME, {
                                globalSpace: !0
                            })).visible = !1,
                            (E = I._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                globalSpace: !0
                            })).visible = d[v][gp.INSTANCEGEOMETRY],
                            (E = I._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                globalSpace: !0
                            })).visible = d[v][gp.INSTANCEWIREFRAMEGEOMETRY]
                        }
                    }
                    n.render(o, t),
                    o.overrideMaterial = o.frontMaterial;
                    for (var B = 0, x = h.length; x > B; B += 1) {
                        var S = h[B]
                          , w = e.modelManager.getModel(S);
                        if (w) {
                            var M = w._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            });
                            M.visible = d[S][gp.GEOMETRY],
                            (M = w._getNodeGroup(gp.WIREFRAME, {
                                globalSpace: !0
                            })).visible = d[S][gp.WIREFRAME],
                            M = w._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                globalSpace: !0
                            }),
                            d[S][gp.INSTANCEGEOMETRY] = M.visible,
                            M.visible = !1,
                            M = w._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                globalSpace: !0
                            }),
                            d[S][gp.INSTANCEWIREFRAMEGEOMETRY] = M.visible,
                            M.visible = !1
                        }
                    }
                    n.render(o, t),
                    o.overrideMaterial = o.frontInstanceMaterial;
                    for (var b = 0, U = h.length; U > b; b += 1) {
                        var F = h[b]
                          , K = e.modelManager.getModel(F);
                        if (K) {
                            var Q = K._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            });
                            Q.visible = !1,
                            (Q = K._getNodeGroup(gp.WIREFRAME, {
                                globalSpace: !0
                            })).visible = !1,
                            (Q = K._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                globalSpace: !0
                            })).visible = d[F][gp.INSTANCEGEOMETRY],
                            (Q = K._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                globalSpace: !0
                            })).visible = d[F][gp.INSTANCEWIREFRAMEGEOMETRY]
                        }
                    }
                    n.render(o, t),
                    n.render(i.capsScene, t),
                    o.overrideMaterial = null,
                    l.planeHighLightMatrial.visible = !0,
                    c.planeHighLightMatrial.visible = !0,
                    c.planeMaterial.visible = !0;
                    for (var R = 0, T = h.length; T > R; R += 1) {
                        var k = h[R]
                          , D = e.modelManager.getModel(k);
                        if (D) {
                            var L = D._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            });
                            L.visible = d[k][gp.GEOMETRY],
                            (L = D._getNodeGroup(gp.WIREFRAME, {
                                globalSpace: !0
                            })).visible = d[k][gp.WIREFRAME],
                            (L = D._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                globalSpace: !0
                            })).visible = d[k][gp.INSTANCEGEOMETRY],
                            (L = D._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                globalSpace: !0
                            })).visible = d[k][gp.INSTANCEWIREFRAMEGEOMETRY]
                        }
                    }
                    d = null,
                    n.render(o, t)
                }
            } else
                !vc.PickingEffect && vc.EnableSelectionOutline && A.composer && e.getSelection().length > 0 ? A.composer.render() : (n.setRenderTarget(null),
                n.clear(),
                n.render(o, t));
            A._applyPickingEffect(),
            i.setFilterApplied(!1),
            e.onRenderListener(),
            e.onRenderFinishedListener(),
            e.cameraControl.isCameraChanging() && i.dispatchEvent({
                type: Rc.ON_CAMERA_CHANGED_AND_RENDERED
            }),
            e.cameraControl.setCameraChanging(!1),
            i.getBlinkEnabled() && (A.blinkHandle = requestAnimationFrame(r)),
            i.disposeBufferAfterVbo()
        }()
    }
    ,
    Ly.prototype.fillCavityRender = function(A) {
        var e = this.viewer
          , t = e.camera
          , i = e.modelManager
          , o = this.renderer
          , n = e.getScene();
        function r(A, e, t, i) {
            var o = new Xi
              , n = new jA;
            n.depthWrite = !1,
            n.depthTest = !1,
            n.colorWrite = !1,
            n.stencilWrite = !0,
            n.stencilFunc = 519;
            var r = n.clone();
            r.side = 1,
            r.clippingPlanes = [e],
            r.stencilFail = 34055,
            r.stencilZFail = 34055,
            r.stencilZPass = 34055;
            var a = new Ue(A,r);
            a.matrixWorld = i.matrixWorld,
            a.renderOrder = t,
            o.add(a);
            var s = n.clone();
            s.side = 0,
            s.clippingPlanes = [e],
            s.stencilFail = 34056,
            s.stencilZFail = 34056,
            s.stencilZPass = 34056;
            var l = new Ue(A,s);
            return l.renderOrder = t,
            l.matrixWorld = i.matrixWorld,
            o.add(l),
            o
        }
        this.blinkHandle > 0 && cancelAnimationFrame(this.blinkHandle),
        function A() {
            e.cameraControl.updateCamera(),
            e.calculateNearFar(),
            n.updateLights(t),
            i.getBlinkEnabled() && i.updateBlinkMaterial();
            var a = n.fillClipPlane && n.fillClipPlane.visible
              , s = n.clipPlanes && n.clipPlanes.visible
              , l = o.autoClear
              , c = o.sortObjects;
            if (vc.ClippingCaps && (a || s)) {
                if (a) {
                    var h = n.getFillClipPlane()
                      , d = n.getClipPlanes()
                      , p = e.modelManager.getModelKeys();
                    i.prepareCapScene(),
                    o.clear(),
                    o.autoClear = !1,
                    a ? (h.capPlane.planeMesh.visible = !0,
                    h.capPlane.lineMesh.visible = !0,
                    d.boxMesh.visible = !1) : (h.capPlane.planeMesh.visible = !1,
                    h.capPlane.lineMesh.visible = !1,
                    d.boxMesh.visible = !0),
                    h.planeHighLightMatrial.visible = !1,
                    d.planeHighLightMatrial.visible = !1,
                    d.planeMaterial.visible = !1,
                    n.overrideMaterial = n.backMaterial;
                    for (var g = {}, u = 0, f = p.length; f > u; u += 1) {
                        var m = p[u]
                          , C = e.modelManager.getModel(m);
                        if (g[m] = {},
                        C) {
                            var y = C._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            });
                            g[m][gp.GEOMETRY] = y.visible,
                            y = C._getNodeGroup(gp.WIREFRAME, {
                                globalSpace: !0
                            }),
                            g[m][gp.WIREFRAME] = y.visible,
                            y = C._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                globalSpace: !0
                            }),
                            g[m][gp.INSTANCEGEOMETRY] = y.visible,
                            y.visible = !1,
                            y = C._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                globalSpace: !0
                            }),
                            g[m][gp.INSTANCEWIREFRAMEGEOMETRY] = y.visible,
                            y.visible = !1
                        }
                    }
                    o.render(n, t),
                    n.overrideMaterial = n.backInstanceMaterial;
                    for (var v = 0, I = p.length; I > v; v += 1) {
                        var E = p[v]
                          , B = e.modelManager.getModel(E);
                        if (B) {
                            var x = B._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            });
                            x.visible = !1,
                            (x = B._getNodeGroup(gp.WIREFRAME, {
                                globalSpace: !0
                            })).visible = !1,
                            (x = B._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                globalSpace: !0
                            })).visible = g[E][gp.INSTANCEGEOMETRY],
                            (x = B._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                globalSpace: !0
                            })).visible = g[E][gp.INSTANCEWIREFRAMEGEOMETRY]
                        }
                    }
                    o.render(n, t),
                    n.overrideMaterial = n.frontMaterial;
                    for (var S = 0, w = p.length; w > S; S += 1) {
                        var M = p[S]
                          , b = e.modelManager.getModel(M);
                        if (b) {
                            var U = b._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            });
                            U.visible = g[M][gp.GEOMETRY],
                            (U = b._getNodeGroup(gp.WIREFRAME, {
                                globalSpace: !0
                            })).visible = g[M][gp.WIREFRAME],
                            U = b._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                globalSpace: !0
                            }),
                            g[M][gp.INSTANCEGEOMETRY] = U.visible,
                            U.visible = !1,
                            U = b._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                globalSpace: !0
                            }),
                            g[M][gp.INSTANCEWIREFRAMEGEOMETRY] = U.visible,
                            U.visible = !1
                        }
                    }
                    o.render(n, t),
                    n.overrideMaterial = n.frontInstanceMaterial;
                    for (var F = 0, K = p.length; K > F; F += 1) {
                        var Q = p[F]
                          , R = e.modelManager.getModel(Q);
                        if (R) {
                            var T = R._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            });
                            T.visible = !1,
                            (T = R._getNodeGroup(gp.WIREFRAME, {
                                globalSpace: !0
                            })).visible = !1,
                            (T = R._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                globalSpace: !0
                            })).visible = g[Q][gp.INSTANCEGEOMETRY],
                            (T = R._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                globalSpace: !0
                            })).visible = g[Q][gp.INSTANCEWIREFRAMEGEOMETRY]
                        }
                    }
                    o.render(n, t),
                    o.render(i.capsScene, t),
                    n.overrideMaterial = null,
                    a ? h.planeHighLightMatrial.visible = !0 : (d.planeHighLightMatrial.visible = !0,
                    d.planeMaterial.visible = !0);
                    for (var k = 0, D = p.length; D > k; k += 1) {
                        var L = p[k]
                          , N = e.modelManager.getModel(L);
                        if (N) {
                            var O = N._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            });
                            O.visible = g[L][gp.GEOMETRY],
                            (O = N._getNodeGroup(gp.WIREFRAME, {
                                globalSpace: !0
                            })).visible = g[L][gp.WIREFRAME],
                            (O = N._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                globalSpace: !0
                            })).visible = g[L][gp.INSTANCEGEOMETRY],
                            (O = N._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                globalSpace: !0
                            })).visible = g[L][gp.INSTANCEWIREFRAMEGEOMETRY]
                        }
                    }
                    g = null,
                    o.render(n, t)
                }
                if (s) {
                    o.clear(),
                    o.autoClear = !1,
                    o.sortObjects = !0,
                    o.localClippingEnabled = !0;
                    var V = e.modelManager.getModelKeys()
                      , G = o.clippingPlanes;
                    o.clippingPlanes = [];
                    var P = n.getClipPlanes()
                      , q = new Y;
                    q.autoUpdate = !1;
                    for (var j = 0, H = n.lightArray.length; H > j; j += 1)
                        q.add(n.lightArray[j].clone());
                    for (var W = [], J = 0; 6 > J; J += 1)
                        W[J] = P.children[J].clone();
                    for (var z = 0, Z = V.length; Z > z; z += 1) {
                        var X = e.modelManager.getModel(V[z]);
                        if (X)
                            for (var _ = X._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            }), $ = 0, AA = _.children.length; AA > $; $ += 1) {
                                var eA = new Xi;
                                eA.name = "object";
                                var tA = []
                                  , iA = [];
                                q.add(eA);
                                var oA = _.children[$];
                                if (oA.visible) {
                                    for (var nA = oA.geometry, rA = [], aA = 0; 6 > aA; aA += 1)
                                        rA[aA] = G[aA].clone();
                                    for (var sA = function(A) {
                                        (cA = new Xi).name = "poGroup";
                                        var e = rA[A];
                                        (hA = r(nA, e, A + 1, oA)).name = "stencilGroup",
                                        dA = new yr({
                                            color: oA.material[0].color,
                                            metalness: .1,
                                            roughness: .75,
                                            clippingPlanes: rA.filter((function(A) {
                                                return A !== e
                                            }
                                            )),
                                            stencilWrite: !0,
                                            stencilRef: 0,
                                            stencilFunc: 517,
                                            stencilFail: 7681,
                                            stencilZFail: 7681,
                                            stencilZPass: 7681
                                        });
                                        var t = W[A].clone();
                                        t.material = dA,
                                        t.testNumber = A,
                                        t.onAfterRender = function() {
                                            o.clearStencil()
                                        }
                                        ,
                                        t.renderOrder = A + 1.1,
                                        eA.add(hA),
                                        cA.add(t),
                                        tA.push(t),
                                        q.add(cA),
                                        iA.push(cA)
                                    }, lA = 0; 6 > lA; lA += 1) {
                                        var cA, hA, dA;
                                        sA(lA)
                                    }
                                    for (var pA = oA.clone(), gA = 0, uA = pA.material.length; uA > gA; gA += 1)
                                        pA.material[gA].clippingPlanes = rA;
                                    pA.renderOrder = 6,
                                    eA.add(pA),
                                    o.render(q, t),
                                    q.remove(eA);
                                    for (var fA = 0, mA = iA.length; mA > fA; fA += 1)
                                        q.remove(iA[fA]);
                                    tA = null
                                }
                            }
                    }
                    o.sortObjects = c,
                    o.clippingPlanes = G,
                    o.autoClear = l,
                    o.localClippingEnabled = !1
                }
            } else
                vc.EnableSelectionOutline && e.composer && e.getSelection().length > 0 ? e.composer.render() : (o.setRenderTarget(null),
                o.clear(),
                o.render(n, t));
            e.onRenderListener(),
            e.onRenderFinishedListener(),
            e.cameraControl.setCameraChanging(!1),
            i.getBlinkEnabled() && (e.blinkHandle = requestAnimationFrame(A)),
            i.disposeBufferAfterVbo()
        }()
    }
    ,
    Ly.prototype.fillCavityRender2 = function(A) {
        var e = this.viewer
          , t = e.camera
          , i = e.modelManager
          , o = this.renderer
          , n = e.getScene();
        this.blinkHandle > 0 && cancelAnimationFrame(this.blinkHandle),
        function A() {
            e.cameraControl.updateCamera(),
            e.calculateNearFar(),
            n.updateLights(t),
            i.getBlinkEnabled() && i.updateBlinkMaterial();
            var r = n.fillClipPlane && n.fillClipPlane.visible
              , a = n.clipPlanes && n.clipPlanes.visible
              , s = o.autoClear;
            if (vc.ClippingCaps && (r || a)) {
                if (r) {
                    var l = n.getFillClipPlane()
                      , c = n.getClipPlanes()
                      , h = e.modelManager.getModelKeys();
                    i.prepareCapScene(),
                    o.clear(),
                    o.autoClear = !1,
                    r ? (l.capPlane.planeMesh.visible = !0,
                    l.capPlane.lineMesh.visible = !0,
                    c.boxMesh.visible = !1) : (l.capPlane.planeMesh.visible = !1,
                    l.capPlane.lineMesh.visible = !1,
                    c.boxMesh.visible = !0),
                    l.planeHighLightMatrial.visible = !1,
                    c.planeHighLightMatrial.visible = !1,
                    c.planeMaterial.visible = !1,
                    n.overrideMaterial = n.backMaterial;
                    for (var d = {}, p = 0, g = h.length; g > p; p += 1) {
                        var u = h[p]
                          , f = e.modelManager.getModel(u);
                        if (d[u] = {},
                        f) {
                            var m = f._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            });
                            d[u][gp.GEOMETRY] = m.visible,
                            m = f._getNodeGroup(gp.WIREFRAME, {
                                globalSpace: !0
                            }),
                            d[u][gp.WIREFRAME] = m.visible,
                            m = f._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                globalSpace: !0
                            }),
                            d[u][gp.INSTANCEGEOMETRY] = m.visible,
                            m.visible = !1,
                            m = f._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                globalSpace: !0
                            }),
                            d[u][gp.INSTANCEWIREFRAMEGEOMETRY] = m.visible,
                            m.visible = !1
                        }
                    }
                    o.render(n, t),
                    n.overrideMaterial = n.backInstanceMaterial;
                    for (var C = 0, y = h.length; y > C; C += 1) {
                        var v = h[C]
                          , I = e.modelManager.getModel(v);
                        if (I) {
                            var E = I._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            });
                            E.visible = !1,
                            (E = I._getNodeGroup(gp.WIREFRAME, {
                                globalSpace: !0
                            })).visible = !1,
                            (E = I._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                globalSpace: !0
                            })).visible = d[v][gp.INSTANCEGEOMETRY],
                            (E = I._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                globalSpace: !0
                            })).visible = d[v][gp.INSTANCEWIREFRAMEGEOMETRY]
                        }
                    }
                    o.render(n, t),
                    n.overrideMaterial = n.frontMaterial;
                    for (var B = 0, x = h.length; x > B; B += 1) {
                        var S = h[B]
                          , w = e.modelManager.getModel(S);
                        if (w) {
                            var M = w._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            });
                            M.visible = d[S][gp.GEOMETRY],
                            (M = w._getNodeGroup(gp.WIREFRAME, {
                                globalSpace: !0
                            })).visible = d[S][gp.WIREFRAME],
                            M = w._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                globalSpace: !0
                            }),
                            d[S][gp.INSTANCEGEOMETRY] = M.visible,
                            M.visible = !1,
                            M = w._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                globalSpace: !0
                            }),
                            d[S][gp.INSTANCEWIREFRAMEGEOMETRY] = M.visible,
                            M.visible = !1
                        }
                    }
                    o.render(n, t),
                    n.overrideMaterial = n.frontInstanceMaterial;
                    for (var b = 0, U = h.length; U > b; b += 1) {
                        var F = h[b]
                          , K = e.modelManager.getModel(F);
                        if (K) {
                            var Q = K._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            });
                            Q.visible = !1,
                            (Q = K._getNodeGroup(gp.WIREFRAME, {
                                globalSpace: !0
                            })).visible = !1,
                            (Q = K._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                globalSpace: !0
                            })).visible = d[F][gp.INSTANCEGEOMETRY],
                            (Q = K._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                globalSpace: !0
                            })).visible = d[F][gp.INSTANCEWIREFRAMEGEOMETRY]
                        }
                    }
                    o.render(n, t),
                    o.render(i.capsScene, t),
                    n.overrideMaterial = null,
                    r ? l.planeHighLightMatrial.visible = !0 : (c.planeHighLightMatrial.visible = !0,
                    c.planeMaterial.visible = !0);
                    for (var R = 0, T = h.length; T > R; R += 1) {
                        var k = h[R]
                          , D = e.modelManager.getModel(k);
                        if (D) {
                            var L = D._getNodeGroup(gp.GEOMETRY, {
                                globalSpace: !0
                            });
                            L.visible = d[k][gp.GEOMETRY],
                            (L = D._getNodeGroup(gp.WIREFRAME, {
                                globalSpace: !0
                            })).visible = d[k][gp.WIREFRAME],
                            (L = D._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                globalSpace: !0
                            })).visible = d[k][gp.INSTANCEGEOMETRY],
                            (L = D._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                globalSpace: !0
                            })).visible = d[k][gp.INSTANCEWIREFRAMEGEOMETRY]
                        }
                    }
                    d = null,
                    o.render(n, t)
                }
                if (a) {
                    o.clear(),
                    o.autoClear = !1;
                    for (var N = e.modelManager.getModelKeys(), O = o.clippingPlanes, V = o.tempPlanes || [], G = 0; 6 > G; G += 1) {
                        if (V[G]) {
                            if (V[G].equals(O[G]))
                                continue;
                            V[G] = O[G].clone()
                        } else
                            V[G] = O[G].clone();
                        for (var P = 0, q = N.length; q > P; P += 1) {
                            var j = e.modelManager.getModel(N[P]);
                            if (j) {
                                var H = j._getNodeGroup(gp.GEOMETRY, {
                                    globalSpace: !0
                                })
                                  , Y = j._getNodeGroup("sectionFill_" + G);
                                Y.clear();
                                for (var W = 0, J = H.children.length; J > W; W += 1) {
                                    var z = H.children[W];
                                    if (z.visible) {
                                        var Z = V[G].clone().applyMatrix4(z.matrixWorld)
                                          , X = z.geometry;
                                        if (X.boundingBox || X.computeBoundingBox(),
                                        X.boundingBox.intersectsPlane(Z)) {
                                            var _ = Tu.getShapeGeometryFromGeometryAndPlane(X, Z);
                                            if (_) {
                                                var $ = new Ue(_,z.material[0]);
                                                Y.add($),
                                                $.matrixWorld.copy(z.matrixWorld)
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    o.tempPlanes = V,
                    o.autoClear = s,
                    o.setRenderTarget(null),
                    o.clear(),
                    o.render(n, t)
                }
            } else
                vc.EnableSelectionOutline && e.composer && e.getSelection().length > 0 ? e.composer.render() : (o.setRenderTarget(null),
                o.clear(),
                o.render(n, t));
            e.onRenderListener(),
            e.onRenderFinishedListener(),
            e.cameraControl.setCameraChanging(!1),
            i.getBlinkEnabled() && (e.blinkHandle = requestAnimationFrame(A)),
            i.disposeBufferAfterVbo()
        }()
    }
    ,
    Ly.prototype.render = function(A) {
        if (this.renderer) {
            var e = this.viewer
              , t = e.modelManager;
            if (t.isEmpty())
                return Bh.log("model not loaded!"),
                void this._forceRenderOneFrame();
            if (!t.checkLayerDataLoading()) {
                e._checkDataChanged();
                e.getScene();
                e.camera.updateMatrixWorld(),
                this.csm && (this.csm.update(e.camera.matrixWorld),
                this.csm.updateFrustums()),
                vc.IncrementRender ? this.incrementRender(A) : vc.FillCavity ? this.fillCavityRender2(A) : this.fullRender(A)
            }
        }
    }
    ,
    Ly.prototype.getRenderer = function() {
        return this.renderer
    }
    ,
    Ly.prototype.setSize = function(A, e) {
        this.renderer.setSize(A, e),
        this.composer && this.composer.setSize(A, e)
    }
    ,
    Ly.prototype.getRendererSize = function() {
        return this.renderer ? this.renderer.getSize() : {
            width: 0,
            height: 0
        }
    }
    ,
    Ly.prototype.getPickingEffecter = function() {
        return vc.PickingEffect ? (this.pickingEffecter || (this.pickingEffecter = new Sy(this.viewer)),
        this.pickingEffecter) : null
    }
    ;
    var Ny = function(A, e) {
        jo.call(this, A, e),
        this.type = "SkinnedMesh",
        this.bindMode = "attached",
        this.bindMatrix = new M,
        this.bindMatrixInverse = new M;
        var t = new bo(this.initBones());
        this.bind(t, this.matrixWorld),
        this.normalizeSkinWeights()
    };
    Ny.prototype = Object.assign(Object.create(jo.prototype), {
        constructor: Ny,
        isSkinnedMesh: !0,
        initBones: function() {
            var A = []
              , e = null
              , t = null
              , i = null
              , o = null;
            if (this.geometry && void 0 !== this.geometry.bones) {
                for (i = 0,
                o = this.geometry.bones.length; o > i; i += 1)
                    t = this.geometry.bones[i],
                    e = new Uo,
                    A.push(e),
                    e.name = t.name,
                    e.position.fromArray(t.pos),
                    e.quaternion.fromArray(t.rotq),
                    void 0 !== t.scl && e.scale.fromArray(t.scl);
                for (i = 0,
                o = this.geometry.bones.length; o > i; i += 1)
                    -1 !== (t = this.geometry.bones[i]).parent && null !== t.parent && void 0 !== A[t.parent] ? A[t.parent].add(A[i]) : this.add(A[i])
            }
            return this.updateMatrixWorld(!0),
            A
        },
        bind: function(A, e) {
            this.skeleton = A,
            void 0 === e && (this.updateMatrixWorld(!0),
            this.skeleton.calculateInverses(),
            e = this.matrixWorld),
            this.bindMatrix.copy(e),
            this.bindMatrixInverse.getInverse(e)
        },
        pose: function() {
            this.skeleton.pose()
        },
        normalizeSkinWeights: function() {
            var A = null
              , e = null;
            if (this.geometry && this.geometry.isGeometry)
                for (e = 0; this.geometry.skinWeights.length > e; e += 1) {
                    var t = this.geometry.skinWeights[e];
                    (A = 1 / t.lengthManhattan()) !== 1 / 0 ? t.multiplyScalar(A) : t.set(1, 0, 0, 0)
                }
            else if (this.geometry && this.geometry.isBufferGeometry) {
                var i = new p
                  , o = this.geometry.attributes.skinWeight;
                for (e = 0; o.count > e; e += 1)
                    i.x = o.getX(e),
                    i.y = o.getY(e),
                    i.z = o.getZ(e),
                    i.w = o.getW(e),
                    (A = 1 / i.lengthManhattan()) !== 1 / 0 ? i.multiplyScalar(A) : i.set(1, 0, 0, 0),
                    o.setXYZW(e, i.x, i.y, i.z, i.w)
            }
        },
        updateMatrixWorld: function(A) {
            jo.prototype.updateMatrixWorld.call(this, A),
            "attached" === this.bindMode ? this.bindMatrixInverse.getInverse(this.matrixWorld) : "detached" === this.bindMode ? this.bindMatrixInverse.getInverse(this.bindMatrix) : console.warn("THREE.SkinnedMesh: Unrecognized bindMode: " + this.bindMode)
        },
        clone: function() {
            return new this.constructor(this.geometry,this.material).copy(this)
        }
    });
    var Oy = function(A) {
        of.call(this, A),
        this.nodeGroupName = "PickingExternalMeshGroup",
        this.pickingEffecter = this.manager.viewer.rendererManager.getPickingEffecter()
    };
    Object.assign(Oy.prototype, of.prototype),
    eu(Oy, [{
        key: "destroy",
        value: function() {
            this.pickingEffecter = null
        }
    }, {
        key: "_disposeGeometryByNode",
        value: function(A) {
            A.traverseVisible((function(e) {
                e !== A && (e.isMesh || e.isLine) && (e.material = null,
                e.geometry.dispose())
            }
            ))
        }
    }, {
        key: "disposePickingNodeById",
        value: function(A) {
            for (var e = this.pickingNodeMap[A], t = 0, i = e.length; i > t; t += 1)
                this._disposeGeometryByNode(e[t]),
                e[t] = null
        }
    }, {
        key: "updatePickingMeshes",
        value: function(A, e, t) {
            if (this.pickingNodeMap) {
                for (var i = Object.keys(this.pickingNodeMap), o = 0, n = i.length; n > o; o += 1) {
                    var r = i[o]
                      , a = this.pickingNodeMap[r]
                      , s = 0
                      , l = 0;
                    if (t[r] && this.manager.isPickableNode({
                        userId: r,
                        name: r
                    }))
                        for (s = 0,
                        l = a.length; l > s; s += 1)
                            a[s].visible = !0;
                    else
                        for (s = 0,
                        l = a.length; l > s; s += 1)
                            a[s].visible = !1
                }
                return this.getPickingNodeGroup()
            }
        }
    }, {
        key: "addNode",
        value: function(A, e) {
            this.addToPickingNodeMap(A, e)
        }
    }, {
        key: "removeNodeById",
        value: function(A) {
            this.removeFromPickingNodeMap(A)
        }
    }, {
        key: "clearNodes",
        value: function() {
            this.clearData()
        }
    }, {
        key: "addToPickingNodeMap",
        value: function(A, e) {
            for (var t = [], i = !vc.BatchMergeEnabled, o = 0, n = e.length; n > o; o += 1) {
                var r = this._createPickingNodeBy(e[o], i);
                if (r)
                    if (Array.isArray(r))
                        for (var a = 0, s = r.length; s > a; a += 1)
                            r[a].name = A,
                            t.push(r[a]);
                    else
                        r.name = A,
                        t.push(r)
            }
            this.pickingNodeMap || (this.pickingNodeMap = {}),
            this.pickingNodeMap[A] = t,
            this.addToPickingNodeGroup(t)
        }
    }, {
        key: "_createPickingNodeBy",
        value: function(A, e) {
            var t = this
              , i = {}
              , o = {};
            if ("Object3D" === A.type || A instanceof Xi || A instanceof ep) {
                var n = new Xi;
                n.copy(A, !1),
                A.animations && (n.animations = A.animations),
                A.traverseVisible((function(n) {
                    if (n !== A) {
                        var r = null;
                        if ("Object3D" === n.type || n instanceof Xi || n instanceof ep || n instanceof Uo)
                            (r = n instanceof Uo ? new Uo : new Xi).copy(n, !1),
                            i[n.uuid] = {
                                destination: r,
                                source: n
                            };
                        else {
                            if (!n.isMesh && !n.isLine)
                                return;
                            (r = t._createPickingMeshesBy(n, e)) && (o[n.uuid] = {
                                destination: r,
                                source: n
                            })
                        }
                        r = null
                    }
                }
                ));
                var r = 0
                  , a = 0
                  , s = null
                  , l = Object.keys(i);
                for (r = 0,
                a = l.length; a > r; r += 1) {
                    var c = i[l[r]];
                    c.source.parent !== A ? i[s = c.source.parent.uuid].destination.add(c.destination) : n.add(c.destination)
                }
                var h = Object.keys(o);
                for (r = 0,
                a = h.length; a > r; r += 1) {
                    var d = o[h[r]]
                      , p = 0
                      , g = 0;
                    if (d.source.parent === A)
                        if (Array.isArray(d.destination))
                            for (p = 0,
                            g = d.destination.length; g > p; p += 1)
                                n.add(d.destination[p]);
                        else
                            n.add(d.destination);
                    else if (s = d.source.parent.uuid,
                    Array.isArray(d.destination))
                        for (p = 0,
                        g = d.destination.length; g > p; p += 1)
                            i[s].destination.add(d.destination[p]);
                    else
                        i[s].destination.add(d.destination)
                }
                return n
            }
            return A.isMesh || A.isLine ? t._createPickingMeshesBy(A, e) : null
        }
    }, {
        key: "_createLineMeshBy",
        value: function(A, e, t) {
            var i = null
              , o = null
              , n = this.pickingEffecter;
            if (vc.PickingLineWidthEnabled) {
                i = n.selectedLineMaterial;
                var r = new JC;
                A.isLineSegments ? r.fromLineSegments(A) : A.isLineLoop ? r.fromLineLoop(A) : r.fromLine(A),
                o = new XC(r,i),
                Tu.copyMeshProperties(o, A),
                o.renderOrder = t ? 1 : 0
            } else
                i = n.selectedMaterial,
                o = A.isLineSegments ? new jo(e,i) : A.isLineLoop ? new Ho(e,i) : new Go(e,i),
                Tu.copyMeshProperties(o, A),
                o.renderOrder = t ? 1 : 0;
            return o
        }
    }, {
        key: "_createMeshBy",
        value: function(A, e, t) {
            var i = new Ue(e,this.pickingEffecter.selectedMaterial);
            return Tu.copyMeshProperties(i, A),
            i.renderOrder = t ? 1 : 0,
            i
        }
    }, {
        key: "_createSkinnedMeshBy",
        value: function(A, e, t) {
            var i = new So(e,this.pickingEffecter.skinningSelectedMaterial);
            return Tu.copyMeshProperties(i, A),
            i.renderOrder = t ? 1 : 0,
            i.bindMatrix.copy(A.bindMatrix),
            i.bindMatrixInverse.copy(A.bindMatrixInverse),
            i.bindMode = A.bindMode,
            i.userData = A.userData,
            i.skeleton = A.skeleton,
            i
        }
    }, {
        key: "_createSkinnedWireFrameBy",
        value: function(A, e, t) {
            if (!e.index)
                return null;
            var i = this.pickingEffecter.skinningWireframeMaterial
              , o = Up(e.attributes.position.array, e.index.array)
              , n = new he;
            n.setIndex(new $A(o,1)),
            n.setAttribute("position", e.getAttribute("position")),
            n.setAttribute("skinIndex", e.getAttribute("skinIndex")),
            n.setAttribute("skinWeight", e.getAttribute("skinWeight"));
            var r = new Ny(n,i);
            return Tu.copyMeshProperties(r, A),
            r.bindMatrix.copy(A.bindMatrix),
            r.bindMatrixInverse.copy(A.bindMatrixInverse),
            r.bindMode = A.bindMode,
            r.userData = A.userData,
            r.skeleton = A.skeleton,
            r.renderOrder = t ? 0 : 1,
            r
        }
    }, {
        key: "_createWireFrameBy",
        value: function(A, e, t) {
            if (!e.index)
                return null;
            var i = this.pickingEffecter.wireframeMaterial
              , o = Up(e.attributes.position.array, e.index.array)
              , n = new he;
            n.setIndex(new $A(o,1)),
            n.setAttribute("position", e.getAttribute("position"));
            var r = new jo(n,i);
            return Tu.copyMeshProperties(r, A),
            r.renderOrder = t ? 0 : 1,
            r
        }
    }, {
        key: "_createPickingMeshesBy",
        value: function(A, e) {
            var t = Tu.createBufferGeometryWithPosAndSkin(A.geometry);
            if (!t)
                return null;
            if (A.isLineSegments)
                return this._createLineMeshBy(A, t, e);
            var i = null
              , o = null;
            return A.isSkinnedMesh ? (i = this._createSkinnedMeshBy(A, t, e),
            o = this._createSkinnedWireFrameBy(A, t, e)) : (i = this._createMeshBy(A, t, e),
            o = this._createWireFrameBy(A, t, e)),
            o ? [i, o] : i
        }
    }, {
        key: "setAccumulateTransform",
        value: function(A, e, t, i) {
            if (this.pickingNodeMap && this.pickingNodeMap[A])
                for (var o = this.pickingNodeMap[A], n = 0, r = o.length; r > n; n += 1) {
                    var a = o[n];
                    e && (a.position.x += e.x,
                    a.position.y += e.y,
                    a.position.z += e.z),
                    t && (a.scale.x *= t.x,
                    a.scale.y *= t.y,
                    a.scale.z *= t.z),
                    i && (a.rotation.x += i.x,
                    a.rotation.y += i.y,
                    a.rotation.z += i.z),
                    a.updateMatrixWorld()
                }
        }
    }, {
        key: "setTransform",
        value: function(A, e, t, i, o) {
            if (this.pickingNodeMap && this.pickingNodeMap[A])
                for (var n = this.pickingNodeMap[A], r = 0, a = n.length; a > r; r += 1) {
                    var s = n[r];
                    o ? this.manager.setTransformForClonedMesh(s, e, t, i) : this.manager.setTransformForMesh(s, e, t, i)
                }
        }
    }, {
        key: "rotateOnBasePoint",
        value: function(A, e, t, i) {
            if (this.pickingNodeMap && this.pickingNodeMap[A]) {
                var o = this.pickingNodeMap[A];
                if (o)
                    for (var n = 0, r = o.length; r > n; n += 1) {
                        var a = o[n]
                          , s = (new f).setFromAxisAngle(t, i);
                        a.quaternion.premultiply(s),
                        a.position.sub(e),
                        a.position.applyQuaternion(s),
                        a.position.add(e),
                        a.updateMatrixWorld()
                    }
            }
        }
    }, {
        key: "applyTransform",
        value: function(A, e, t, i) {
            if (this.pickingNodeMap && this.pickingNodeMap[A]) {
                var o = this.manager.getTransformMatrix(e, t, i);
                this.applyTransformMatrix(A, o)
            }
        }
    }, {
        key: "applyTransformMatrix",
        value: function(A, e) {
            if (this.pickingNodeMap && this.pickingNodeMap[A])
                for (var t = this.pickingNodeMap[A], i = 0, o = t.length; o > i; i += 1)
                    this.manager.updateMatrixWorldForMesh(t[i], e)
        }
    }]);
    var Vy = function(A) {
        this.viewer = A,
        this.viewer.modelManager.registerPlugin(this),
        this.meshes = {},
        this.customSelectMaterials = {},
        this.databagId = "ExternalComponent",
        this.objectIds = null,
        this.lastFilteredIds = null,
        this.firstAnimation = !0,
        this.animationIds = {},
        this.animationLength = 0,
        this.animationId = 0,
        this.invalidObjectType = ["invalidPlane"],
        this.floorExplosion = !1,
        this.boundingBoxWorld = void 0
    };
    Vy.prototype.destroy = function() {
        this.pickingNodeGenerator && (this.pickingNodeGenerator.destroy(),
        this.pickingNodeGenerator = null),
        this._removeNodeGroup(),
        this.meshes = null,
        this.customSelectMaterials = null,
        this.objectIds = null,
        this.lastFilteredIds = null,
        this._cancelAnimate(),
        this.firstAnimation = null,
        this.animationIds = null,
        this.invalidObjectType = null,
        this.viewer = null
    }
    ,
    Vy.prototype.addExternalObject = function(A) {
        if (A && (A instanceof Xi || A instanceof Ue)) {
            var e = uh.createUUID();
            this.meshes[e] = [A];
            var t = {
                name: e,
                userId: e,
                nodeId: e,
                state: Lc.Visible,
                mesh: [A],
                isExternalComponent: !0,
                matrix: A.matrixWorld.clone()
            }
              , i = new aA;
            return i.setFromObject(A),
            t.boundingBox = i,
            A.key = e,
            this._getNodeGroup().add(A),
            this._addToNodeInfoMap(t),
            this._cacheNodeMaterial(A),
            this.boundingBoxWorld ? this.boundingBoxWorld.union(i) : this.boundingBoxWorld = i.clone(),
            this.viewer.modelManager.updateSceneBoundingBox(),
            this._updateFilterManager(),
            this.objectIds = Object.keys(this.meshes),
            {
                nodeId: e
            }
        }
    }
    ,
    Vy.prototype.getObjectCenterAndMatrixByNodeId = function(A) {
        var e = void 0
          , t = this.getNodeInfosByUserId(A);
        if (t && t.length > 0) {
            e = {
                matrix: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
                center: [0, 0, 0]
            };
            var i = t[0];
            if (i.matrix && (e.matrix = i.matrix.toArray()),
            i.boundingBox) {
                var o = new y;
                i.boundingBox.getCenter(o),
                e.center = o.toArray()
            }
        }
        return e
    }
    ,
    Vy.prototype.addNode = function(A, e, t, i) {
        if (this.meshes[A])
            Bh.error("Warning: name is already exist, please change name ");
        else if (-1 === this.invalidObjectType.indexOf(e.type)) {
            e instanceof Array || (e = [e]),
            this.meshes[A] = e,
            this._isPickingEffectEnabled() && this.getPickingNodeGenerator().addNode(A, e),
            void 0 === t && (t = !1),
            i && (this.customSelectMaterials[A] = i);
            for (var o = new aA, n = 0, r = e.length; r > n; n += 1) {
                var a = new aA;
                a.setFromObject(e[n]),
                a.isEmpty() && a.min.x === 1 / 0 && e[n].position && (a.min.copy(e[n].position),
                a.max.copy(e[n].position)),
                o.union(a),
                e[n].box = a,
                e[n].originBox = a.clone();
                var s = new M;
                s.getInverse(e[n].matrix),
                e[n].originBox.applyMatrix4(s),
                this._initializeAnimation(e[n], A);
                var l = e[n];
                l.key = A,
                this._getNodeGroup().add(l),
                l.updateMatrixWorld(!0),
                t || this._cacheNodeMaterial(l)
            }
            var c = {
                name: A,
                userId: A,
                state: Lc.Visible,
                boundingBox: o,
                mesh: e,
                isExternalComponent: !0
            };
            1 === e.length && (c.matrix = e[0].matrixWorld.clone()),
            this._addToNodeInfoMap(c),
            this.boundingBoxWorld ? this.boundingBoxWorld.union(o) : this.boundingBoxWorld = o.clone(),
            this.viewer.modelManager.updateSceneBoundingBox(),
            this._updateFilterManager(),
            this.objectIds = Object.keys(this.meshes)
        } else
            Bh.error("Warning: the object is invalid")
    }
    ,
    Vy.prototype.getNodeById = function(A) {
        var e = this.meshes[A];
        return e && 1 === e.length ? e[0] : e
    }
    ,
    Vy.prototype.removeNodeById = function(A) {
        var e = this.meshes[A];
        if (!e)
            return !1;
        e[0].autoAnimation && (delete this.animationIds[A],
        this.animationLength -= 1,
        0 === this.animationLength && this._cancelAnimate()),
        delete this.meshes[A],
        this._isPickingEffectEnabled() && this.getPickingNodeGenerator().removeNodeById(A),
        this.customSelectMaterials[A] && delete this.customSelectMaterials[A];
        for (var t = this._getNodeGroup(), i = 0, o = e.length; o > i; i += 1)
            t.remove(e[i]);
        return this.filteredIds && this.filteredIds[A] && delete this.filteredIds[A],
        this.lastFilteredIds && this.lastFilteredIds[A] && delete this.lastFilteredIds[A],
        this.viewer.removeFromSelection([A]),
        this.viewer.cancelTransformComponentByKey(A),
        this._removeFromNodeInfoMap(A),
        this._updateFilterManager(),
        this.objectIds = Object.keys(this.meshes),
        !0
    }
    ,
    Vy.prototype.clearNodes = function() {
        this._isPickingEffectEnabled() && this.getPickingNodeGenerator().clearNodes(),
        this._getNodeGroup().clear(),
        this._clearNodeInfoMap(),
        this.meshes = {},
        this.customSelectMaterials = {},
        this.objectIds = null,
        this.animationIds = {},
        this.animationLength = 0,
        this._cancelAnimate()
    }
    ,
    Vy.prototype.getAllNodes = function() {
        return this.meshes
    }
    ,
    Vy.prototype.isEmpty = function() {
        return !this._hasNode()
    }
    ,
    Vy.prototype.setTransform = function(A, e, t, i, o) {
        if (this.floorExplosion && o)
            o();
        else {
            var n = this.meshes[A];
            if (n) {
                for (var r = 0, a = n.length; a > r; r += 1) {
                    var s = n[r];
                    s.position.x = (e = e || s.position).x,
                    s.position.y = e.y,
                    s.position.z = e.z,
                    s.scale.x = (t = t || s.scale).x,
                    s.scale.y = t.y,
                    s.scale.z = t.z,
                    s.setRotationFromQuaternion(i = i || s.quaternion),
                    s.updateMatrixWorld();
                    var l = s.originBox.clone();
                    s.box = l.applyMatrix4(s.matrix),
                    s.levelName = null
                }
                this._isPickingEffectEnabled() && this.getPickingNodeGenerator().setTransform(A, e, t, i)
            }
        }
    }
    ,
    Vy.prototype.getTransform = function(A) {
        var e = this.meshes[A];
        return e ? {
            position: e[0].position,
            scale: e[0].scale,
            rotate: e[0].quaternion
        } : null
    }
    ,
    Vy.prototype.applyTransform = function(A, e, t, i) {
        if (this.meshes[A]) {
            e = e || new y,
            t = t || new y(1,1,1),
            i = i || new f;
            var o = new M;
            o.compose(e, i, t),
            this.applyTransformMatrix(A, o),
            this._isPickingEffectEnabled() && this.getPickingNodeGenerator().applyTransformMatrix(A, o)
        }
    }
    ,
    Vy.prototype.applyTransformMatrix = function(A, e) {
        var t = this.meshes[A];
        if (t)
            for (var i = 0, o = t.length; o > i; i += 1) {
                var n = t[i];
                n._oriMatrix || (n._oriMatrix = n.matrix.clone()),
                n.matrix.multiplyMatrices(e, n._oriMatrix),
                n.updateMatrixWorld(!0);
                var r = n.originBox.clone();
                n.box = r.applyMatrix4(n.matrix)
            }
    }
    ,
    Vy.prototype.applyFilter = function() {
        this._hasNode() && (this._collectFilteredIds(),
        this._collectSelectedIds(),
        this._collectHoveredIds(),
        this._updateNodes())
    }
    ,
    Vy.prototype.applySelection = function() {
        this._hasNode() && (this._collectSelectedIds(),
        this._collectHoveredIds(),
        this._updateNodes())
    }
    ,
    Vy.prototype.clearSelection = function() {
        this._hasNode() && (this._clearSelectedIds(),
        this.applyHover())
    }
    ,
    Vy.prototype.applyHover = function() {
        this._hasNode() && (this._collectHoveredIds(),
        this._updateNodes())
    }
    ,
    Vy.prototype.clearHover = function() {
        this._hasNode() && (this._clearHoveredIds(),
        this._updateNodes())
    }
    ,
    Vy.prototype.getNodeInfosByUserId = function(A) {
        if (this.nodeInfoMap)
            return this.nodeInfoMap[A]
    }
    ,
    Vy.prototype.getAllNodeInfos = function(A) {
        A[this.databagId] = this.nodeInfoMap || {}
    }
    ,
    Vy.prototype.calculateBoundingBox = function() {
        if (this.nodeInfoMap) {
            var A = new aA
              , e = new aA;
            for (var t in this.nodeInfoMap)
                for (var i = this.nodeInfoMap[t], o = 0, n = i.length; n > o; o += 1) {
                    var r = i[o]
                      , a = r.mesh
                      , s = new aA;
                    for (o = 0,
                    n = a.length; n > o; o += 1)
                        e.makeEmpty(),
                        e.setFromObject(a[o]),
                        e.isEmpty() && e.min.x === 1 / 0 && a[o].position && (e.min.copy(a[o].position),
                        e.max.copy(a[o].position)),
                        s.union(e);
                    r.boundingBox.copy(s),
                    A.union(r.boundingBox)
                }
            this.boundingBoxWorld ? this.boundingBoxWorld.copy(A) : this.boundingBoxWorld = A
        }
    }
    ,
    Vy.prototype.recalculateComponentBoundingbox = function(A) {
        var e = this.getNodeInfosByUserId(A);
        if (e)
            for (var t = 0, i = e.length; i > t; t += 1) {
                var o = e[t]
                  , n = o.mesh
                  , r = new aA
                  , a = new aA;
                for (t = 0,
                i = n.length; i > t; t += 1)
                    a.setFromObject(n[t]),
                    a.isEmpty() && a.min.x === 1 / 0 && n[t].position && (a.min.copy(n[t].position),
                    a.max.copy(n[t].position)),
                    r.union(a);
                o.boundingBox.copy(r)
            }
    }
    ,
    Vy.prototype.getBoundingBoxWorld = function() {
        if (this.boundingBoxWorld)
            return this.boundingBoxWorld.clone()
    }
    ,
    Vy.prototype.adjustVisibility = function(A) {
        this._getNodeGroup().visible = A
    }
    ,
    Vy.prototype.changeVisibilityOfSelectedObjects = function(A) {
        if (this.selectedIds)
            for (var e = this.viewer.modelManager.filter, t = 0, i = this.selectedIds.length; i > t; t += 1) {
                var o = this.selectedIds[t]
                  , n = this.meshes[o];
                if (n && e._isVisible({
                    userId: o
                }))
                    for (var r = 0, a = n.length; a > r; r += 1)
                        n[r].visible = A
            }
    }
    ,
    Vy.prototype.changeVisibilityOfNonSelectedObjects = function(A) {
        if (this.objectIds) {
            var e = {};
            if (this.selectedIds)
                for (var t = 0, i = this.selectedIds.length; i > t; t += 1)
                    e[this.selectedIds[t]] = !0;
            for (var o = this.viewer.modelManager.filter, n = 0, r = this.objectIds.length; r > n; n += 1) {
                var a = this.objectIds[n];
                if (!e[a] && o._isVisible({
                    userId: a
                }))
                    for (var s = this.meshes[a], l = 0, c = s.length; c > l; l += 1)
                        s[l].visible = A
            }
        }
    }
    ,
    Vy.prototype.adjustVisibilityOfObjectsWithoutOutline = function(A) {
        if (this.objectIds)
            for (var e = this.viewer.modelManager.filter, t = 0, i = this.objectIds.length; i > t; t += 1) {
                var o = this.objectIds[t];
                if (e._isVisible({
                    userId: o
                }))
                    for (var n = this.meshes[o], r = 0, a = n.length; a > r; r += 1)
                        n[r].isSprite && (n[r].visible = A)
            }
    }
    ,
    Vy.prototype._addToNodeInfoMap = function(A) {
        this.nodeInfoMap || (this.nodeInfoMap = {}),
        this.nodeInfoMap[A.userId] || (this.nodeInfoMap[A.userId] = []),
        this.nodeInfoMap[A.userId].push(A)
    }
    ,
    Vy.prototype._removeFromNodeInfoMap = function(A) {
        this.nodeInfoMap && this.nodeInfoMap[A] && delete this.nodeInfoMap[A]
    }
    ,
    Vy.prototype._clearNodeInfoMap = function() {
        this.nodeInfoMap = null
    }
    ,
    Vy.prototype._updateFilterManager = function() {
        var A = this.viewer.modelManager;
        A.filter.reinitFilterManager(A.getNodeInfos())
    }
    ,
    Vy.prototype._canBePick = function(A) {
        return !!A._oriMaterial
    }
    ,
    Vy.prototype._getNodeGroup = function() {
        return this.viewer.modelManager.scene.getOrCreateGroup(gp.EXTERNALCOMPONENTMANAGER, {
            pickableType: Qc.Geometry,
            globalSpace: !0
        })
    }
    ,
    Vy.prototype._removeNodeGroup = function() {
        this.viewer.modelManager.scene.removeGroupByName(gp.EXTERNALCOMPONENTMANAGER)
    }
    ,
    Vy.prototype._cacheNodeMaterial = function(A) {
        uh.isGroupObject(A) ? A.traverse((function(A) {
            if (uh.isMeshObject(A) && !A._oriMaterial && (A._oriMaterial = A.material,
            !A.geometry.index && A.geometry.attributes && A.geometry.attributes.position)) {
                for (var e = [], t = 0, i = A.geometry.attributes.position.array.length / 3; i > t; t += 1)
                    e.push(t);
                A.geometry.setIndex(new YA(new Uint32Array(e),1))
            }
        }
        )) : A._oriMaterial || (A._oriMaterial = A.material)
    }
    ,
    Vy.prototype._collectFilteredIds = function() {
        var A = this.filteredIds = {}
          , e = this.viewer.modelManager.filter
          , t = e._hasHiddenFileIdFilter()
          , i = e._hasVisibleFilter()
          , o = e._hasOverrideMaterialFilter()
          , n = e._hasTransparentFilter();
        if (t || i || o || n)
            for (var r = this.objectIds, a = zc, s = 0, l = r.length; l > s; s += 1) {
                var c = r[s]
                  , h = {
                    userId: c
                };
                if (i && !1 === e._isVisible(h))
                    A[c] || (A[c] = {}),
                    A[c][a.HIDDEN] = !0;
                else if (n && e._isTransparent(h))
                    A[c] || (A[c] = {}),
                    A[c][a.TRANSPARENT] = !0;
                else if (o && e._hasOverrideMaterial(h)) {
                    var d = e._getOverrideMaterial(h)
                      , p = d ? d.name : "";
                    A[c] || (A[c] = {}),
                    A[c][a.OVERRIDED] = p
                }
            }
    }
    ,
    Vy.prototype._collectSelectedIds = function() {
        var A = this.filteredIds = this.filteredIds || {}
          , e = zc
          , t = this.viewer.modelManager.sceneState.getSelection()
          , i = {};
        this._clearSelectedIds();
        for (var o = 0, n = t.length; n > o; o += 1) {
            var r = t[o];
            this.canBeSelectedId(r) && (A[r] || (A[r] = {}),
            A[r][e.SELECTED] = !0,
            i[r] = !0)
        }
        this.selectedIds = Object.keys(i)
    }
    ,
    Vy.prototype._clearSelectedIds = function() {
        if (this.filteredIds && this.selectedIds && this.selectedIds.length) {
            for (var A = 0, e = this.selectedIds.length; e > A; A += 1) {
                var t = this.selectedIds[A];
                this.filteredIds[t] && delete this.filteredIds[t][zc.SELECTED]
            }
            this.selectedIds = null
        }
    }
    ,
    Vy.prototype._collectHoveredIds = function() {
        var A = this.viewer.modelManager.sceneState.hoverId;
        if (A && this._hasObjectId(A)) {
            var e = this.filteredIds = this.filteredIds || {};
            this.hoveredId = A,
            e[A] || (e[A] = {}),
            e[A][zc.HOVER] = !0
        }
    }
    ,
    Vy.prototype._clearHoveredIds = function() {
        this.filteredIds && this.hoveredId && this.filteredIds[this.hoveredId] && (delete this.filteredIds[this.hoveredId][zc.HOVER],
        this.hoveredId = void 0)
    }
    ,
    Vy.prototype._hasObjectId = function(A) {
        return !!this.meshes[A]
    }
    ,
    Vy.prototype.isUserIdExist = function(A) {
        return this._hasObjectId(A)
    }
    ,
    Vy.prototype.canBeSelectedId = function(A) {
        var e = this.meshes[A];
        return !(!e || e[0].disPickable)
    }
    ,
    Vy.prototype._hasNode = function() {
        return !(!this.objectIds || !this.objectIds.length)
    }
    ,
    Vy.prototype._traverseNodeById = function(A, e) {
        if (this._hasObjectId(A))
            for (var t = this, i = this.meshes[A], o = 0, n = i.length; n > o; o += 1) {
                var r = i[o];
                uh.isGroupObject(r) ? r.traverseVisible((function(A) {
                    uh.isMeshObject(A) && t._canBePick(A) && e && e(A)
                }
                )) : (uh.isMeshObject(r) || r.isSprite) && t._canBePick(r) && e && e(r)
            }
    }
    ,
    Vy.prototype._resetNodeMaterial = function() {
        var A = this.lastFilteredIds;
        if (A && A.length)
            for (var e = 0, t = A.length; t > e; e += 1)
                this._updateNodeVisible(A[e], !0),
                this._traverseNodeById(A[e], (function(A) {
                    A.material = A._oriMaterial
                }
                ))
    }
    ,
    Vy.prototype._updateNodeVisible = function(A, e) {
        if (this._hasObjectId(A))
            for (var t = this.meshes[A], i = 0, o = t.length; o > i; i += 1)
                t[i].visible = e
    }
    ,
    Vy.prototype._updateNodeById = function(A, e) {
        if (this._hasObjectId(A)) {
            var t = this.viewer.modelManager.sceneState
              , i = zc
              , o = this.filteredIds[A];
            if (o)
                if (o[i.HIDDEN])
                    this._updateNodeVisible(A, !1);
                else {
                    var n = function(A, e) {
                        if (A._oriMaterial instanceof Array) {
                            for (var t = [], i = 0, o = A._oriMaterial.length; o > i; i += 1) {
                                var n = A._oriMaterial[i];
                                n instanceof ld ? t.push(e) : t.push = Kd.cloneMaterialBaseOnColor(n, e)
                            }
                            A.material = t
                        } else
                            A.material = A._oriMaterial instanceof ld ? e : Kd.cloneMaterialBaseOnColor(A._oriMaterial, e)
                    };
                    if (o[i.TRANSPARENT]) {
                        var r = e._getMaterialByName("scene");
                        this._traverseNodeById(A, (function(A) {
                            n(A, r)
                        }
                        ))
                    } else if (this._isPickingEffectEnabled() || !o[i.SELECTED]) {
                        if (o[i.HOVER])
                            if (o[i.OVERRIDED]) {
                                var a = t.getHoverMaterial(e._getMaterialByName(o[i.OVERRIDED]));
                                this._traverseNodeById(A, (function(A) {
                                    n(A, a)
                                }
                                ))
                            } else
                                this._traverseNodeById(A, (function(A) {
                                    var e = t.getHoverMaterial(A._oriMaterial);
                                    n(A, e)
                                }
                                ));
                        else if (o[i.OVERRIDED]) {
                            var s = e._getMaterialByName(o[i.OVERRIDED]);
                            this._traverseNodeById(A, (function(A) {
                                n(A, s)
                            }
                            ))
                        }
                    } else {
                        var l = t.selectionMaterial
                          , c = this.customSelectMaterials[A];
                        this._traverseNodeById(A, (function(A) {
                            c ? A.material = c : A._oriMaterial.isMeshPhongMaterial ? (A.material = t.phongSelectionMaterial,
                            A.material.skinning = A._oriMaterial.skinning) : n(A, l)
                        }
                        ))
                    }
                }
        }
    }
    ,
    Vy.prototype._updateNodes = function() {
        var A = this.viewer.modelManager.filter;
        if (this._resetNodeMaterial(),
        this.filteredIds) {
            for (var e in this.filteredIds)
                this._updateNodeById(e, A);
            this.lastFilteredIds = Object.keys(this.filteredIds)
        }
    }
    ,
    Vy.prototype._initializeAnimation = function(A, e) {
        if (A.autoAnimation) {
            if ("fire" === A.type) {
                var t = vc.SceneSize
                  , i = this.viewer.getBoundingBoxWorld().getSize()
                  , o = Math.max(i.x, i.y, i.z);
                A._initializeSizetween(t / o / .01421)
            }
            this.firstAnimation && (this._animate(),
            this.firstAnimation = !1),
            this.animationIds[e] = !0,
            this.animationLength += 1
        }
    }
    ,
    Vy.prototype._animate = function() {
        var A = this;
        !function e() {
            for (var t in A.animationId = requestAnimationFrame(e),
            A.animationIds)
                for (var i = A.meshes[t], o = 0, n = i.length; n > o; o += 1)
                    i[o].autoAnimation && i[o].update && i[o].update();
            A.viewer.render()
        }()
    }
    ,
    Vy.prototype._cancelAnimate = function() {
        this.firstAnimation = !0,
        cancelAnimationFrame(this.animationId),
        this.animationId = 0
    }
    ,
    Vy.prototype.isPickableNode = function(A) {
        if (!this.canBeSelectedId(A.userId))
            return !1;
        var e = this.viewer.modelManager.filter;
        return !e._isHiddenFileId(A) && !1 !== e._isVisible(A) && !e._isTransparent(A)
    }
    ,
    Vy.prototype._isPickingEffectEnabled = function() {
        return !1
    }
    ,
    Vy.prototype.getPickingNodeGenerator = function() {
        return this.pickingNodeGenerator || (this.pickingNodeGenerator = new Oy(this)),
        this.pickingNodeGenerator
    }
    ,
    Vy.prototype.setCloneComponentMaterialsByKey = function(A, e, t) {
        var i = this.meshes[A][0];
        if (!i)
            return {
                result: !1,
                message: "mesh isn`t exist",
                code: -1
            };
        if (!i.byClone)
            return {
                result: !1,
                message: "mesh isn`t qualified",
                code: -2
            };
        var o = 0 === t || Boolean(t);
        if (Array.isArray(e) || (e = [e]),
        o && (Array.isArray(t) || (t = [t])),
        Array.isArray(i.material))
            if (o) {
                var n = 0
                  , r = !0
                  , a = !1
                  , s = void 0;
                try {
                    for (var l, c = t[Symbol.iterator](); !(r = (l = c.next()).done); r = !0) {
                        var h = l.value;
                        if (!i.material[h] || !e[n])
                            break;
                        i.material[h] = e[n],
                        n += 1
                    }
                } catch (A) {
                    a = !0,
                    s = A
                } finally {
                    try {
                        r || null == c.return || c.return()
                    } finally {
                        if (a)
                            throw s
                    }
                }
            } else {
                var d = 0
                  , p = !0
                  , g = !1
                  , u = void 0;
                try {
                    for (var f, m = e[Symbol.iterator](); !(p = (f = m.next()).done); p = !0) {
                        var C = f.value;
                        if (!i.material[d])
                            break;
                        i.material[d] = C,
                        d += 1
                    }
                } catch (A) {
                    g = !0,
                    u = A
                } finally {
                    try {
                        p || null == m.return || m.return()
                    } finally {
                        if (g)
                            throw u
                    }
                }
            }
        else
            i.material = e[0]
    }
    ,
    Vy.prototype.getModelManager = function() {
        return this.viewer.modelManager
    }
    ;
    var Gy = function() {
        this.domElement = null,
        this.camera = null,
        this.highlightManager = null,
        this.controller = document.getElementById("viewerController"),
        this.countRenderRequest = 0,
        this.maxCountRenderRequest = 1e4,
        this.rendering = !1,
        this.incrementRenderHandle = 0,
        this.callbacks = {},
        this.tempBox = new aA,
        this.tempVector3 = new y,
        this.enableCameraNearFar = !0,
        this.currentHomeView = Uc.Home,
        this.initialView = Uc.Home,
        this.filter = new xu,
        this.modelManager = new ly(this.filter,this),
        this.isRecalculationPlanes = !1,
        this.calculationPlanesBind = this.calculationPlanes.bind(this),
        this.addRenderFinishedListener(this.calculationPlanesBind),
        this.uuid = "",
        this.transitionAnimationState = !0,
        this.animator = new dp,
        this._renderStateChanged = !1;
        var A = this;
        this._renderTimer = null,
        this.blinkHandle = 0,
        this.needCheckTilesDataChange = !1,
        this.clock = new as,
        this.rendererManager = new Ly(this),
        this.cameraStateWithFrustum = !1,
        this.checkNeedRender = function() {
            (A.needRender || A.modelManager.needUpdateAnimation()) && (A.needRender = vc.continueRender || !1,
            A.modelManager.updateAnimation(),
            A._render()),
            A._renderTimer = requestAnimationFrame(A.checkNeedRender)
        }
        ,
        this.checkNeedApplyFilter = function() {
            A.needApplyFilter && (A.needApplyFilter = !1,
            A.modelManager.applyFilter(),
            A.render()),
            A._applyFilterTimer = requestAnimationFrame(A.checkNeedApplyFilter)
        }
        ,
        this.blink = {}
    };
    Object.assign(Gy.prototype, Ld.prototype),
    Object.assign(Gy.prototype, {
        constructor: Gy,
        addRenderListener: function(A) {
            this.addEventListener("render", A)
        },
        removeRenderListener: function(A) {
            this.removeEventListener("render", A)
        },
        onRenderListener: function() {
            this.dispatchEvent("render")
        },
        addRenderFinishedListener: function(A) {
            this.addEventListener("renderFinished", A)
        },
        removeRenderFinishedListener: function(A) {
            this.removeEventListener("renderFinished", A)
        },
        onRenderFinishedListener: function() {
            this.dispatchEvent("renderFinished")
        },
        removeAllListeners: function() {
            this.removeAllEventListener()
        },
        destroy: function() {
            if (this.stopRedner(),
            this.stopApplyFilter(),
            this.removeAllListeners(),
            this.controlManager.unregisterDomEventListeners(this.domElement),
            this.renderer) {
                var A = document.getElementById(this.uuid);
                this.domElement.contains(this.getRenderer().domElement) && this.domElement.removeChild(A)
            }
            this.domElement = null,
            this.renderSettings.canvas = null,
            this.renderSettings.context = null,
            this.renderSettings = null,
            this.rendererManager.destroy(),
            this.rendererManager = null,
            this.camera = null,
            this.defaultCamera = null,
            this.cameraControl.destroy(),
            this.cameraControl = null,
            this.controlManager.destroy(),
            this.modelManager.destroy(),
            this.modelManager = null,
            this.controlManager = null,
            this.tmpBox = null,
            this.filter = null,
            this.calculationPlanesBind = null,
            this.animator = null
        },
        init: function(A) {
            var e = this;
            e.uuid = a.generateUUID(),
            this.domElement = A,
            this.resetBackgroundColor();
            var t = {
                alpha: !0,
                preserveDrawingBuffer: !0,
                antialias: !0,
                depth: !0,
                maxDrawCacheNum: vc.maxDrawCacheNum,
                logarithmicDepthBuffer: !1,
                stencil: !0
            };
            vc.logarithmicDepthBuffer && (t.logarithmicDepthBuffer = !0),
            vc.DisableAntialias && (t.antialias = !1);
            var i = null;
            try {
                (i = document.createElement("canvas")).style.outline = "none",
                i.getContext("webgl", t) || i.getContext("experimental-webgl", t) || (t.antialias = !1)
            } catch (A) {
                return !1
            }
            Tu.initializeUnitInstances();
            var o = document.createElement("div");
            o.setAttribute("id", e.uuid),
            o.style.width = "100%",
            o.style.height = "100%",
            t.canvas = i,
            this.renderSettings = t,
            this.camera = this.defaultCamera = new cp(45,A.offsetWidth,A.offsetHeight,.1,200 * vc.SceneSize),
            this.camera.up = new y(0,0,1),
            this.camera.realUp = new y(0,0,1),
            this.camera.lookAt(this.camera.target),
            this.cameraControl = new mp(this,this.camera,A,(function(A) {
                e.render(A)
            }
            )),
            this.controlManager = new Og,
            this.controlManager.setControlMode(this, "pick"),
            this.setOrbitButton("left"),
            this.setReverseWheelDirection(!1),
            this.registerDomEventListener(Rc.ON_CONTROL_END, (function() {
                e.needCheckTilesDataChange = !0
            }
            )),
            this.registerDomEventListener(Rc.ON_CONTROL_ZOOM, (function() {
                e.needCheckTilesDataChange = !0
            }
            )),
            e.rendererManager.setupRenderer(e.renderSettings),
            o.appendChild(this.getRenderer().domElement),
            this.domElement.appendChild(o),
            this.controlManager.registerDomEventListeners(o),
            this.startRender(),
            this.startApplyFilter()
        },
        getDomElement: function() {
            return this.domElement ? this.domElement : null
        },
        getRendererDomElement: function() {
            return this.getRenderer() && this.getRenderer().domElement ? this.getRenderer().domElement : null
        },
        render: function() {
            this.needRender = !0
        },
        startRender: function() {
            this._renderTimer = requestAnimationFrame(this.checkNeedRender)
        },
        stopRedner: function() {
            cancelAnimationFrame(this._renderTimer)
        },
        startApplyFilter: function() {
            this._applyFilterTimer = requestAnimationFrame(this.checkNeedApplyFilter)
        },
        stopApplyFilter: function() {
            cancelAnimationFrame(this._applyFilterTimer)
        },
        _render: function(A) {
            this.rendererManager.render(A)
        },
        incrementRender: function(A) {
            var e = this
              , t = this.camera
              , i = this.modelManager
              , o = this.getRenderer()
              , n = this.getScene();
            if (this.countRenderRequest += 1,
            this.countRenderRequest > this.maxCountRenderRequest && (this.countRenderRequest = 0),
            !this.rendering) {
                this.rendering = !0,
                i.calculateCameraModelRelation(t.position),
                this.ar(),
                this.cameraControl.updateCamera(),
                n.updateLights(t);
                var r = this.controlManager.isUpdateRenderList;
                o.resetIncrementRender(),
                o.setObjectListUpdateState(r),
                this.incrementRenderHandle = requestAnimationFrame(function A(i, r) {
                    var a = i;
                    return function() {
                        o.autoClear = r,
                        e.controlManager.cameraChange ? (o.resetIncrementRender(),
                        o.autoClear = !0,
                        e.controlManager.cameraChange = !1) : o.autoClear = r,
                        o.render(n, t) || a !== e.countRenderRequest ? (e.rendering = !1,
                        a !== e.countRenderRequest ? e.render() : e.onRenderFinishedListener()) : e.incrementRenderHandle = requestAnimationFrame(A(a, !1))
                    }
                }(e.countRenderRequest, !0)),
                r && i.prepareScene(t),
                this.onRenderFinishedListener(),
                this.cameraControl.setCameraChanging(!1)
            }
        },
        fullRender: function(A) {
            var e = this
              , t = this.camera
              , i = this.modelManager
              , o = this.getRenderer()
              , n = this.getScene();
            this.blinkHandle > 0 && cancelAnimationFrame(this.blinkHandle),
            function A() {
                e.calculateNearFar(),
                e.cameraControl.updateCamera(),
                n.updateLights(t),
                i.getBlinkEnabled() && i.updateBlinkMaterial();
                var r = n.fillClipPlane && n.fillClipPlane.visible
                  , a = n.clipPlanes && n.clipPlanes.visible && vc.EnableBoxClippingCaps;
                if (vc.ClippingCaps && (r || a) && vc.EnableClippingCaps) {
                    if (r || a) {
                        var s = n.getFillClipPlane()
                          , l = n.getClipPlanes()
                          , c = e.modelManager.getModelKeys();
                        i.prepareCapScene(),
                        o.clear(),
                        o.autoClear = !1,
                        r ? (s.capPlane.planeMesh.visible = !0,
                        s.capPlane.lineMesh.visible = !0,
                        l.boxMesh.visible = !1) : (s.capPlane.planeMesh.visible = !1,
                        s.capPlane.lineMesh.visible = !1,
                        l.boxMesh.visible = !0),
                        s.planeHighLightMatrial.visible = !1,
                        l.planeHighLightMatrial.visible = !1,
                        l.planeMaterial.visible = !1,
                        n.overrideMaterial = n.backMaterial;
                        for (var h = {}, d = 0, p = c.length; p > d; d += 1) {
                            var g = c[d]
                              , u = e.modelManager.getModel(g);
                            if (h[g] = {},
                            u) {
                                var f = u._getNodeGroup(gp.GEOMETRY, {
                                    globalSpace: !0
                                });
                                h[g][gp.GEOMETRY] = f.visible,
                                f = u._getNodeGroup(gp.WIREFRAME, {
                                    globalSpace: !0
                                }),
                                h[g][gp.WIREFRAME] = f.visible,
                                f = u._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                    globalSpace: !0
                                }),
                                h[g][gp.INSTANCEGEOMETRY] = f.visible,
                                f.visible = !1,
                                f = u._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                    globalSpace: !0
                                }),
                                h[g][gp.INSTANCEWIREFRAMEGEOMETRY] = f.visible,
                                f.visible = !1
                            }
                        }
                        o.render(n, t),
                        n.overrideMaterial = n.backInstanceMaterial;
                        for (var m = 0, C = c.length; C > m; m += 1) {
                            var y = c[m]
                              , v = e.modelManager.getModel(y);
                            if (v) {
                                var I = v._getNodeGroup(gp.GEOMETRY, {
                                    globalSpace: !0
                                });
                                I.visible = !1,
                                (I = v._getNodeGroup(gp.WIREFRAME, {
                                    globalSpace: !0
                                })).visible = !1,
                                (I = v._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                    globalSpace: !0
                                })).visible = h[y][gp.INSTANCEGEOMETRY],
                                (I = v._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                    globalSpace: !0
                                })).visible = h[y][gp.INSTANCEWIREFRAMEGEOMETRY]
                            }
                        }
                        o.render(n, t),
                        n.overrideMaterial = n.frontMaterial;
                        for (var E = 0, B = c.length; B > E; E += 1) {
                            var x = c[E]
                              , S = e.modelManager.getModel(x);
                            if (S) {
                                var w = S._getNodeGroup(gp.GEOMETRY, {
                                    globalSpace: !0
                                });
                                w.visible = h[x][gp.GEOMETRY],
                                (w = S._getNodeGroup(gp.WIREFRAME, {
                                    globalSpace: !0
                                })).visible = h[x][gp.WIREFRAME],
                                w = S._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                    globalSpace: !0
                                }),
                                h[x][gp.INSTANCEGEOMETRY] = w.visible,
                                w.visible = !1,
                                w = S._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                    globalSpace: !0
                                }),
                                h[x][gp.INSTANCEWIREFRAMEGEOMETRY] = w.visible,
                                w.visible = !1
                            }
                        }
                        o.render(n, t),
                        n.overrideMaterial = n.frontInstanceMaterial;
                        for (var M = 0, b = c.length; b > M; M += 1) {
                            var U = c[M]
                              , F = e.modelManager.getModel(U);
                            if (F) {
                                var K = F._getNodeGroup(gp.GEOMETRY, {
                                    globalSpace: !0
                                });
                                K.visible = !1,
                                (K = F._getNodeGroup(gp.WIREFRAME, {
                                    globalSpace: !0
                                })).visible = !1,
                                (K = F._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                    globalSpace: !0
                                })).visible = h[U][gp.INSTANCEGEOMETRY],
                                (K = F._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                    globalSpace: !0
                                })).visible = h[U][gp.INSTANCEWIREFRAMEGEOMETRY]
                            }
                        }
                        o.render(n, t),
                        o.render(i.capsScene, t),
                        n.overrideMaterial = null,
                        s.planeHighLightMatrial.visible = !0,
                        l.planeHighLightMatrial.visible = !0,
                        l.planeMaterial.visible = !0;
                        for (var Q = 0, R = c.length; R > Q; Q += 1) {
                            var T = c[Q]
                              , k = e.modelManager.getModel(T);
                            if (k) {
                                var D = k._getNodeGroup(gp.GEOMETRY, {
                                    globalSpace: !0
                                });
                                D.visible = h[T][gp.GEOMETRY],
                                (D = k._getNodeGroup(gp.WIREFRAME, {
                                    globalSpace: !0
                                })).visible = h[T][gp.WIREFRAME],
                                (D = k._getNodeGroup(gp.INSTANCEGEOMETRY, {
                                    globalSpace: !0
                                })).visible = h[T][gp.INSTANCEGEOMETRY],
                                (D = k._getNodeGroup(gp.INSTANCEWIREFRAMEGEOMETRY, {
                                    globalSpace: !0
                                })).visible = h[T][gp.INSTANCEWIREFRAMEGEOMETRY]
                            }
                        }
                        h = null,
                        o.render(n, t)
                    }
                } else
                    vc.EnableSelectionOutline && e.composer && e.getSelection().length > 0 ? e.composer.render() : (o.setRenderTarget(null),
                    o.clear(),
                    o.render(n, t));
                e.onRenderListener(),
                e.onRenderFinishedListener(),
                e.cameraControl.setCameraChanging(!1),
                i.getBlinkEnabled() && (e.blinkHandle = requestAnimationFrame(A)),
                i.disposeBufferAfterVbo()
            }()
        },
        resize: function(A, e) {
            if (this.camera && this.getRenderer()) {
                var t = this.getDomElement();
                t && (t.style.height = e + "px",
                t.style.width = A + "px"),
                this.camera.setSize(A, e),
                this.camera.updateProjectionMatrix(),
                this.rendererManager.setSize(A, e),
                this.dispatchEvent({
                    type: "resize",
                    data: {
                        width: A,
                        height: e
                    }
                }),
                this.render()
            }
        },
        resizeByFrustum: function(A, e) {
            this.camera && this.getRenderer() && (this.camera.updateProjectionMatrixByFrustum = !0,
            this.camera.setSizeByFrustum(A, e),
            this.render(),
            this.camera.updateProjectionMatrixByFrustum = !1)
        },
        calculateNearFar: function() {
            this.calculateNearFar2()
        },
        calculateNearFar2: function() {
            var A = this.getScene()
              , e = A.getBoundingBoxWorld()
              , t = this.getRenderer();
            if (this.enableCameraNearFar) {
                var i = this.camera
                  , o = i.position.clone().sub(A.getBoundingBoxWorld().getCenter(new y)).length()
                  , n = A.getBoundingBoxWorld().getSize(new y).length();
                if (null !== e && !e.isEmpty()) {
                    e.expandByScalar(1.1);
                    e.applyMatrix4(i.matrixWorldInverse);
                    var r = e.getSize(new y).length() / 1e3
                      , a = 100;
                    1e-4 > r ? a = .001 : .001 > r ? a = .01 : .01 > r ? a = .1 : .1 > r ? a = 1 : 1 > r && (a = 10);
                    var s = 1
                      , l = 0;
                    e.max.z > 0 && 0 > e.min.z ? (l = -e.min.z,
                    s = Math.min(r / 2, a / 2)) : (l = -e.min.z,
                    s = Math.max(Math.min(r, a), -e.max.z)),
                    t.shadowMap.enabled && (l *= 3,
                    s /= 3),
                    l = Math.max(s + 1, l),
                    .1 > (l = Math.min(l, o + n)) - s && (s /= 2),
                    i.setNearFar(s, l)
                }
            }
        },
        resetSelectionColor: function(A, e) {
            this.modelManager.sceneState.setSelectionColor(A, e)
        },
        calculateMinDistance: function(A, e) {
            if (Bh.time("计算最小距离"),
            A === e) {
                var t = this.getBoundingBoxByIds([A]).getCenter(new y);
                return {
                    start: t,
                    end: t,
                    minDistance: 0
                }
            }
            function i(A, e) {
                for (var t = 0, i = 0, o = 0; 3 > o; o += 1) {
                    var n = A.min.getComponent(o)
                      , r = A.max.getComponent(o)
                      , a = e.min.getComponent(o)
                      , s = e.max.getComponent(o)
                      , l = 0;
                    n > s ? l = n - s : a > r && (l = a - r),
                    t += l * l;
                    var c = Math.max(s, r) - Math.min(n, a);
                    i += c * c
                }
                return {
                    minDis: Math.sqrt(t),
                    maxDis: Math.sqrt(i)
                }
            }
            var o = new y
              , n = new y
              , r = new y;
            function a(A, e, t, i, o, n, r, a, s) {
                r.fromBufferAttribute(e, t),
                a.fromBufferAttribute(e, i),
                s.fromBufferAttribute(e, o),
                n && (r.applyMatrix4(n),
                a.applyMatrix4(n),
                s.applyMatrix4(n)),
                A.push(r),
                A.push(a),
                A.push(s)
            }
            function s(A, e, t) {
                var i = {
                    start: null,
                    end: null,
                    minDistance: t
                }
                  , s = A.mesh
                  , l = A.indexInfo
                  , c = s.matrix.clone().multiply(A.matrix)
                  , h = s.geometry
                  , d = h.attributes.position
                  , p = l ? l.indexStart : 0
                  , g = h.getIndex().array
                  , u = l ? l.indexStart + l.indexCount : g.length
                  , f = e.mesh
                  , m = e.indexInfo
                  , C = f.matrix.clone().multiply(e.matrix)
                  , v = f.geometry
                  , I = v.attributes.position
                  , E = m ? m.indexStart : 0
                  , B = v.getIndex().array
                  , x = m ? m.indexStart + m.indexCount : B.length
                  , S = A.boundingBox
                  , w = e.boundingBox;
                if (S.intersectsBox(w)) {
                    for (var M = p, b = u; b > M; M += 3) {
                        var U = [];
                        a(U, d, g[M], g[M + 1], g[M + 2], c, o, n, r);
                        var F = Tu.minDistanceBetweenTriToMesh(U, f, m, C);
                        i.minDistance > F.minDistance && (i.minDistance = F.minDistance,
                        i.start = F.start,
                        i.end = F.end)
                    }
                    return i
                }
                var K = S.getSize(new y)
                  , Q = w.getSize(new y)
                  , R = S.min.x - w.max.x
                  , T = S.min.y - w.max.y
                  , k = S.min.z - w.max.z
                  , D = w.min.x - S.max.x
                  , L = w.min.y - S.max.y
                  , N = w.min.z - S.max.z
                  , O = w.min.x > S.min.x ? S.min.x : w.min.x
                  , V = w.min.y > S.min.y ? S.min.y : w.min.y
                  , G = w.min.z > S.min.z ? S.min.z : w.min.z
                  , P = S.max.x > w.max.x ? S.max.x : w.max.x
                  , q = S.max.y > w.max.y ? S.max.y : w.max.y
                  , j = S.max.z > w.max.z ? S.max.z : w.max.z
                  , H = R;
                switch (T > H && (H = T),
                k > H && (H = k),
                D > H && (H = D),
                L > H && (H = L),
                N > H && (H = N),
                H) {
                case R:
                    O += Q.x / 2,
                    P -= K.x / 2;
                    break;
                case T:
                    V += Q.y / 2,
                    q -= K.y / 2;
                    break;
                case k:
                    G += Q.z / 2,
                    j -= K.z / 2;
                    break;
                case D:
                    O += K.x / 2,
                    P -= Q.x / 2;
                    break;
                case L:
                    V += K.y / 2,
                    q -= Q.y / 2;
                    break;
                case N:
                    G += K.z / 2,
                    j -= Q.z / 2
                }
                for (var Y = new aA(new y(O,V,G),new y(P,q,j)), W = [], J = [], z = [], Z = [], X = p, _ = u; _ > X; X += 3) {
                    var $ = [];
                    a($, d, g[X], g[X + 1], g[X + 2], c, new y, new y, new y),
                    z.push($);
                    for (var AA = 0, eA = $.length; eA > AA; AA += 1)
                        if (Y.containsPoint($[AA])) {
                            W.push($);
                            break
                        }
                }
                for (var tA = E, iA = x; iA > tA; tA += 3) {
                    var oA = [];
                    a(oA, I, B[tA], B[tA + 1], B[tA + 2], C, new y, new y, new y),
                    Z.push(oA);
                    for (var nA = 0, rA = oA.length; rA > nA; nA += 1)
                        if (Y.containsPoint(oA[nA])) {
                            J.push(oA);
                            break
                        }
                }
                W.length || (W = z),
                J.length || (J = Z);
                var sA = Tu.minDistanceBetweenTriToTri(W, J);
                return i.minDistance > sA.minDistance && (i.minDistance = sA.minDistance,
                i.start = sA.start,
                i.end = sA.end),
                i
            }
            var l = this.modelManager.getMinDistanceObjects(A, e);
            if (!l)
                return -1;
            var c = []
              , h = {
                start: null,
                end: null,
                minDistance: Number.POSITIVE_INFINITY
            };
            for (var d in l) {
                if (!l[d].boundingBox) {
                    var p = this.getBoundingBoxByIds([d]);
                    l[d].boundingBox = p
                }
                c.push(l[d])
            }
            if (1 > c[0].length || 1 > c[1].length)
                return Bh.timeEnd("计算最小距离"),
                -1;
            var g = c[0]
              , u = c[1]
              , f = g.length
              , m = u.length
              , C = null
              , v = Number.POSITIVE_INFINITY;
            if (f > 1 || m > 1) {
                C = {};
                for (var I = 0; f > I; I += 1)
                    for (var E = g[I], B = 0; m > B; B += 1) {
                        var x = u[B];
                        x.boundingBox = u.boundingBox,
                        E.boundingBox = g.boundingBox;
                        var S = i(E.boundingBox, x.boundingBox);
                        v = S.maxDis > v ? v : S.maxDis,
                        C[I + "_" + B] = S
                    }
            }
            for (var w = 0; f > w; w += 1)
                for (var M = g[w], b = 0; m > b; b += 1) {
                    if (C) {
                        var U = C[w + "_" + b].minDis;
                        if (U > v || U > h.minDistance)
                            continue
                    }
                    var F = u[b];
                    F.boundingBox = u.boundingBox,
                    M.boundingBox = g.boundingBox;
                    var K = s(M, F, h.minDistance);
                    if (h.minDistance > K.minDistance && (h.minDistance = K.minDistance,
                    h.start = K.start,
                    h.end = K.end),
                    0 === h.minDistance)
                        return Bh.timeEnd("计算最小距离"),
                        h
                }
            return C = null,
            Bh.timeEnd("计算最小距离"),
            h
        },
        registerDomEventListeners: function() {
            this.domElement && this.controlManager.registerDomEventListeners(this.domElement)
        },
        unregisterDomEventListeners: function() {
            this.domElement && this.controlManager.unregisterDomEventListeners(this.domElement)
        },
        registerEventListener: function(A, e) {
            this.modelManager.addEventListener(A, e)
        },
        unregisterEventListener: function(A, e) {
            this.modelManager.removeEventListener(A, e)
        },
        registerCameraEventListener: function(A, e) {
            this.cameraControl.addEventListener(A, e)
        },
        unregisterCameraEventListener: function(A, e) {
            this.cameraControl.removeEventListener(A, e)
        },
        registerDomEventListener: function(A, e) {
            this.controlManager.addEventListener(A, e)
        },
        unregisterDomEventListener: function(A, e) {
            this.controlManager.removeEventListener(A, e)
        },
        load: function(A) {
            var e = this;
            return this.modelManager.load(A, (function() {}
            ), (function(A) {
                Bh.time("Rendering: "),
                e.camera.dirty = !0,
                e.camera.dirty ? e.render() : (e.zoomAll(),
                e.goToInitialView()),
                Bh.timeEnd("Rendering: ")
            }
            ))
        },
        loadWithType: function() {},
        loadTiles: function(A) {
            var e = this;
            return this.modelManager.loadTiles(A, (function() {
                void 0 === e._useBatchMerge && (e._useBatchMerge = e.modelManager.shouldUseBatchRendering(),
                vc.MergeComponent = e._useBatchMerge,
                e._setupRenderer())
            }
            ), (function(A) {
                Bh.time("Rendering: "),
                e.camera.dirty = !0,
                e.camera.dirty ? e.render() : (e.zoomAll(),
                e.goToInitialView()),
                Bh.timeEnd("Rendering: ")
            }
            ))
        },
        unload: function(A) {
            var e = this.modelManager.unload(A);
            return e && (vc.UserControlView || this.zoomAll(),
            this.render()),
            e
        },
        unloadAll: function() {
            this.modelManager.unloadAll(),
            this.render()
        },
        showModel: function(A) {
            this.modelManager.showModel(A) && this.render()
        },
        hideModel: function(A) {
            this.modelManager.hideModel(A) && this.render()
        },
        translateModel: function(A) {
            var e = this._transformModelByKey(A);
            e && e.switchToTranslateMode()
        },
        rotateModel: function(A) {
            var e = this._transformModelByKey(A);
            e && e.switchToRotateMode()
        },
        scaleModel: function(A) {},
        showScene: function(A, e) {
            A && (A.setVisible(e),
            this.render())
        },
        clearAll: function() {
            this.getScene().clearAll()
        },
        restore: function() {
            this.getFilter().clear(),
            this.getScene().disableClipPlanes(),
            this.modelManager.dispatchEvent({
                type: Rc.ON_VIEWER_RESTORED
            })
        },
        getScene: function() {
            return this.modelManager.scene
        },
        getCapsScene: function() {
            return this.modelManager.capsScene
        },
        getControlManager: function() {
            return this.controlManager
        },
        getUserdataByUserId: function(A) {
            var e = this.modelManager.getNodeInfosByUserId(A);
            return e && e instanceof Array ? e[0].userData : null
        },
        getFilter: function() {
            return this.filter
        },
        getCurrentControlName: function() {
            return this.controlManager.getCurrentControlName()
        },
        getCurrentControlMode: function() {
            return this.controlManager.getCurrentControlMode()
        },
        setControlMode: function(A) {
            this.controlManager.setControlMode(this, A),
            this.render()
        },
        setControlDefault: function() {
            this.setControlMode(Gc.PICK)
        },
        getBoundingBoxWorld: function() {
            return this.getScene().getBoundingBoxWorld()
        },
        getBoundingBox: function() {
            return this.getScene().getBoundingBox()
        },
        getModel: function(A) {
            return this.modelManager.getModel(A)
        },
        getModelManager: function() {
            return this.modelManager
        },
        setModelMatrix: function(A, e) {
            var t = this.getModel(e);
            t && t.setModelMatrix(A)
        },
        getModelMatrix: function(A) {
            var e = null
              , t = this.getModel(A);
            return t && (e = t.getModelMatrix()),
            e
        },
        overturnYAndZaxis: function(A) {
            var e = this.getModel(A);
            e && e.overturnYAndZaxis()
        },
        zoomIn: function(A) {
            void 0 === A && (A = .1),
            0 > A && (A = 0),
            this.cameraControl.zoom(A)
        },
        zoomOut: function(A) {
            void 0 === A && (A = .1),
            A > 0 ? A *= -1 : A = 0,
            this.cameraControl.zoom(A)
        },
        zoomAll: function(A, e, t) {
            var i = this.getScene().getBoundingBox();
            this._zoomToLocalBox(i, A, e, t)
        },
        zoomToBuilding: function(A, e, t) {
            this.zoomAll(A, e, t)
        },
        zoomToSelection: function(A, e, t) {
            var i = this.getScene()
              , o = this.getBoundingBoxByIds(this.modelManager.sceneState.getSelection());
            o.isEmpty() && (o = i.getBoundingBox()),
            !0 === this.getTransitionAnimationState() ? this.animator.setStandardView(Uc.Keep, this, o, A) : this._zoomToLocalBox(o, A, e, t)
        },
        _zoomToLocalBox: function(A, e, t, i) {
            this.camera.zoomToBox(A, e, t, i),
            this.cameraControl.update(!0, !0),
            this.cameraControl.dirtyCamera(!0)
        },
        zoomToBox: function(A, e, t, i) {
            var o = new aA;
            A ? (o.copy(A),
            o.applyMatrix4(this.getScene().getMatrixGlobal())) : o.copy(this.getScene().getBoundingBox()),
            !0 === this.getTransitionAnimationState() ? this.animator.setStandardView(Uc.Keep, this, o, e) : this._zoomToLocalBox(o, e, t, i)
        },
        zoomToBoxByDirection: function(A, e, t, i) {
            if (e) {
                if (e && A) {
                    var o = A.clone()
                      , n = o.getCenter(new y).clone().add(e);
                    o.applyMatrix4(this.getScene().getMatrixGlobal()),
                    n.applyMatrix4(this.getScene().getMatrixGlobal());
                    var r = n.clone().sub(o.getCenter(new y));
                    r.length() > 1e-4 ? (r.normalize(),
                    this.camera.realUp.copy(H.DefaultUp),
                    this._zoomToLocalBox(o, t, i, r)) : this._zoomToLocalBox(o, t, i)
                }
            } else
                this.zoomToBox(A, t, i)
        },
        zoomToBoxWithOuterBox: function(A, e, t, i) {
            if (e) {
                if (e && A) {
                    var o = A.clone()
                      , n = e.getCenter(new y);
                    o.applyMatrix4(this.getScene().getMatrixGlobal()),
                    n.applyMatrix4(this.getScene().getMatrixGlobal());
                    var r = n.clone().sub(o.getCenter(new y));
                    r.length() > 1e-4 ? (r.normalize(),
                    this.camera.realUp.copy(H.DefaultUp),
                    this.controlManager.zoomToBox(this, o, t, i, r)) : this.controlManager.zoomToBox(this, o, t, i)
                }
            } else
                this.zoomToBox(A, t, i)
        },
        getObjectsInBox: function(A, e) {
            var t = new aA;
            return t.copy(A),
            t.applyMatrix4(this.getScene().getMatrixGlobal()),
            wg.getObjectsInBox(this.getScene(), t, this.modelManager, this, e)
        },
        setStandardView: function(A, e, t, i) {
            var o = this.camera
              , n = this.getScene().getBoundingBox();
            if (this.transitionAnimationState)
                this.animator.setStandardView(A, this, n, e, t, i);
            else {
                o.setStandardView(A, n);
                this.camera.zoomToBox(n, e);
                this.cameraControl.update(!0, !0),
                i && i()
            }
        },
        rotateCameraByViewCubeSide: function(A) {
            this._viewCubeAnimator && (this._viewCubeAnimator.cancelAnimation(),
            this._viewCubeAnimator = void 0);
            var e = this.camera
              , t = this.getScene().getGeometryBoundingBox()
              , i = new Cp
              , o = this;
            i.rotateCameraByViewCubeSide(e, t, A, (function(A, e, t, i) {
                o.camera.position.copy(t);
                var n = new y(0,1,0);
                n.applyQuaternion(e),
                o.camera.up = n,
                o.camera.realUp = n.clone(),
                o.camera.lookAt(i),
                o.camera.target = i,
                1 > A || o.camera.quaternion.copy(e),
                o.cameraControl.update(!0)
            }
            )),
            this._viewCubeAnimator = i
        },
        cancelCurrentAnimationByViewCube: function() {
            this._viewCubeAnimator && (this._viewCubeAnimator.cancelAnimation(),
            this._viewCubeAnimator = void 0)
        },
        getLineSelectRange: function() {
            return vc.LineSelectRange
        },
        setLineSelectRange: function(A) {
            vc.LineSelectRange = A
        },
        _setStandardView: function(A, e) {
            var t = this.camera
              , i = this.getScene().getBoundingBox();
            t.setStandardView(A, i),
            t.zoomToBox(i, e)
        },
        setStandardViewWithBox: function(A, e, t, i) {
            if (e ? e.applyMatrix4(this.getScene().getMatrixGlobal()) : e = this.getScene().getBoundingBox(),
            this.transitionAnimationState)
                this.animator.setStandardView(A, this, e, t);
            else {
                var o = this.camera;
                o.setStandardView(A, e),
                o.zoomToBox(e, t, i),
                this.cameraControl.update(!0, !0)
            }
        },
        setTopView: function(A, e, t) {
            this.setStandardViewWithBox(Uc.Top, A, e, t)
        },
        setInitialView: function(A) {
            this.initialView = A,
            this._setStandardView(A)
        },
        goToInitialView: function(A) {
            this.setStandardView(this.initialView, A, null)
        },
        setHomeView: function(A) {
            this.currentHomeView = A,
            this._setStandardView(A)
        },
        getHomeView: function() {
            return this.currentHomeView
        },
        goToHomeView: function(A) {
            this.setStandardView(this.currentHomeView, A, null)
        },
        rotateByAxis: function(A, e, t) {
            var i = t || this.cameraControl.calculatePivot(kc.CENTER, null)
              , o = 2 * Math.PI / 60 / 60 * A;
            if (e && "x" !== e) {
                if ("y" !== e)
                    return void Bh.warn("Illegal rotation axis for ViewerImpl.rotateByAxis().");
                this.cameraControl.handleRotation(0, -o, i)
            } else
                this.cameraControl.handleRotation(-o, 0, i);
            this.cameraControl.update(!0)
        },
        lookAt: function(A, e, t) {
            var i = new y;
            i.subVectors(e, A),
            this.camera.lookAtEx(e, i, t),
            this.cameraControl.updateCamera(e),
            this.render()
        },
        setImageResPath: function(A) {
            vc.TextureResRoot = A
        },
        setLimitFrameTime: function(A) {
            vc.IncrementRender && (A > 0 || (A = 30),
            vc.LimitFrameTime = A)
        },
        limitFrameRate: function(A) {
            vc.IncrementRender && (A > 0 || (A = 4),
            vc.LimitFrameTime = 1e3 / A)
        },
        transformCamera: function(A) {
            return Rd.transformCamera(A, this.modelManager.scene)
        },
        getCamera: function() {
            var A = this.getScene().getMatrixGlobal()
              , e = this.cameraControl.getCamera()
              , t = this.cameraControl.getCameraName()
              , i = new Qd(t,e.position,e.target,e.up);
            i = cp.drawingToWorld(i, A);
            var o = {};
            if (this.cameraStateWithFrustum) {
                var n = 2 * (e.near * Math.tan(.5 * a.DEG2RAD * e.fov) / e.zoom);
                o = new Qd(t,i.position,i.target,i.up,e.fov,void 0,e.aspect * n,n)
            } else
                o = new Qd(t,i.position,i.target,i.up,e.fov,void 0);
            return JSON.stringify(o)
        },
        setCameraStateWithFrustum: function(A) {
            this.cameraStateWithFrustum = A
        },
        setCamera: function(A, e, t) {
            this.camera.dirty = !0;
            var i = this
              , o = Rd.parseCameraInfo(A);
            if (null === o)
                Bh.log("Invalid camera info string. Fail to set camera.");
            else if (this.switchToCamera(o.name)) {
                var n = this.getScene().getMatrixGlobal()
                  , r = cp.worldToDrawing(o, n);
                if (this.transitionAnimationState) {
                    var a = {
                        position: this.camera.position.clone(),
                        target: this.camera.target.clone(),
                        up: this.camera.realUp.clone() || this.camera.up.clone()
                    };
                    this.animator.active(a, r, this, (function(A) {
                        i.cameraControl.update(!0, !0)
                    }
                    ), (function() {
                        o.frustumWidth && o.frustumHeight && i.resizeByFrustum(o.frustumWidth, o.frustumHeight),
                        t && t()
                    }
                    ))
                } else {
                    var s = new y;
                    s.subVectors(r.target, r.position),
                    this.camera.lookAtEx(r.target, s, r.up),
                    e && this.cameraControl.updateCamera(),
                    o.frustumWidth && o.frustumHeight && (i.cameraControl.update(!0, !0),
                    i.resizeByFrustum(o.frustumWidth, o.frustumHeight)),
                    t && t()
                }
            }
        },
        getRenderBufferScreenShot: function(A, e, t, i) {
            this._render();
            var o = this.getRenderer().domElement
              , n = o.toDataURL("image/png")
              , r = o.width
              , a = o.height
              , s = window.devicePixelRatio || 1
              , l = e || r / s
              , c = t || a / s;
            if (!l || !c)
                return i ? (i(n),
                null) : n;
            var h, d = null, p = null, g = 0, u = 0;
            if (l > c || l / c > r / a ? (d = l,
            u = c / 2 - (p = a / r * l) / 2) : (p = c,
            g = l / 2 - (d = r / a * c) / 2),
            i)
                return (h = new Image).onload = function() {
                    var e = document.createElement("canvas")
                      , t = e.getContext("2d");
                    e.width = l,
                    e.height = c,
                    A && (t.fillStyle = A,
                    t.fillRect(0, 0, l, c)),
                    t.drawImage(h, g, u, d, p);
                    var o = e.toDataURL("image/png");
                    i(o)
                }
                ,
                h.src = n,
                null;
            (h = new Image).src = n;
            var f = document.createElement("canvas")
              , m = f.getContext("2d");
            return f.width = l,
            f.height = c,
            A && (m.fillStyle = A,
            m.fillRect(0, 0, l, c)),
            m.drawImage(h, g, u, d, p),
            f.toDataURL("image/png")
        },
        screenShot: function(A, e, t) {
            var i = this;
            return this._render(),
            function() {
                var o = i.getRenderer().domElement
                  , n = o.toDataURL("image/png")
                  , r = o.width
                  , a = o.height
                  , s = (window,
                A)
                  , l = e;
                if (!s || !l)
                    return t ? (t(n),
                    null) : n;
                var c = null
                  , h = null
                  , d = 0
                  , p = 0;
                if (s > l || s / l > r / a ? (c = s,
                p = l / 2 - (h = a / r * s) / 2) : (h = l,
                d = s / 2 - (c = r / a * l) / 2),
                t) {
                    var g = new Image;
                    return g.onload = function() {
                        var A = document.createElement("canvas")
                          , e = A.getContext("2d");
                        A.width = s,
                        A.height = l,
                        e.drawImage(g, d, p, c, h);
                        var i = A.toDataURL("image/png");
                        t(i)
                    }
                    ,
                    g.src = n,
                    null
                }
            }()
        },
        canvas2image: function(A, e, t, i) {
            var o = null
              , n = this;
            return i ? (this.getRenderBufferScreenShot(A, e, t, (function(A) {
                i(A),
                n.render()
            }
            )),
            null) : (o = this.getRenderBufferScreenShot(A, e, t),
            this.render(),
            o)
        },
        lockAxisZ: function(A, e) {
            var t = this.cameraControl;
            if (t) {
                var i = t.getZenith()
                  , o = this.getBoundingBox().getCenter().clone();
                if (A && void 0 !== e || (e = null),
                e) {
                    var n = e[0]
                      , r = e[1];
                    i > r ? t.handleRotation(0, r - i, o) : n > i && t.handleRotation(0, n - i, o),
                    this.render()
                }
                this.cameraControl.lockAxisZ(A),
                this.cameraControl.setLockAxisZRange(e)
            }
        },
        isLockedAxisZ: function() {
            return this.cameraControl.isLockedAxisZ()
        },
        enableTranslucentByDClick: function(A) {
            vc.EnableDemolishByDClick = A
        },
        enableHitDetection: function(A) {
            vc.EnableHitDetection = A
        },
        enableRotate: function(A) {
            jh.NoRotate = !A
        },
        rotateCamera: function(A, e) {
            this.cameraControl.processRotate(A, e),
            this.cameraControl.update()
        },
        getActiveCameraInfo: function() {
            var A = {};
            A.up = new y,
            A.dir = new y;
            var e = this.camera
              , t = e.getWorldDirection(new y);
            return A.up.copy(e.realUp || e.up),
            A.dir.copy(t),
            A.quaternion = e.quaternion.clone(),
            A
        },
        calculationPlanes: function() {
            if (this.isRecalculationPlanes) {
                this.isRecalculationPlanes = !1;
                var A = this.getScene()
                  , e = this.getBoundingBoxByIds();
                e.isEmpty() && (e = A.getBoundingBox()),
                A.getClipPlanes().calculationPlanes(e.getSize(new y), e.getCenter(new y)),
                this.render()
            }
        },
        recalculationPlanes: function() {
            this.isRecalculationPlanes = !0
        },
        setOctantDepth: function(A) {
            vc.OctantDepth = A
        },
        resizePool: function(A) {
            vc.maxObjectNumInPool = A,
            this.modelManager.updateSceneRenderable(),
            this.render()
        },
        setCategoriesToHighPriority: function(A, e) {
            this.modelManager.setCategoriesToHighPriority(A, 0 === e ? "inner" : "outer")
        },
        clearCategoriesFromHighPriority: function(A) {
            this.modelManager.clearCategoriesFromHighPriority(0 === A ? "inner" : "outer")
        },
        clearAllCategoriesFromHighPriority: function() {
            this.modelManager.clearAllCategoriesFromHighPriority()
        },
        isolate: function(A, e) {
            var t = this.getFilter();
            switch (e) {
            case "hide":
                t.setIsolateConditions(A, Nc.HIDDEN_OTHERS);
                break;
            case "translucent":
                t.setIsolateConditions(A, Nc.TRANSLUCENT_OTHERS);
                break;
            default:
                Bh.warn("no this isolate state : " + e)
            }
        },
        setIsolateMaterial: function(A) {
            this.getFilter().setIsolateMaterial(A)
        },
        resetIsolateMaterial: function() {
            this.getFilter().resetIsolateMaterial()
        },
        setOrbitButton: function(A) {
            var e = this.controlManager._getControlByName(this, Gc.ORBIT)
              , i = this.controlManager._getControlByName(this, Gc.PICK)
              , o = {};
            "left" === A ? o = {
                ORBIT: t.LEFT,
                PAN2: t.MIDDLE,
                PAN: t.RIGHT
            } : "right" === A && (o = {
                ORBIT: t.RIGHT,
                PAN2: t.MIDDLE,
                PAN: t.LEFT
            }),
            e && e.updateButtons(o),
            i && i.updateButtons(o)
        },
        showPickedInformation: function(A) {},
        setOrbitEnabled: function(A) {
            jh.NoRotate = !0 !== A
        },
        getOrbitEnabled: function() {
            return !jh.NoRotate
        },
        setSelectPadCallback: function(A) {
            var e = this.controlManager.getCurrentControlMode();
            e && e.selectPad && (e.selectPad.callback = A)
        },
        setDeviceMobile: function(A) {
            vc.IsMobile = A || !1
        },
        setPointRotateMode: function(A) {
            jh.RotatePivotMode = A
        },
        worldToDrawing: function(A) {
            if (!this.cameraControl)
                return Bh.warn("camera is not initialized!!!"),
                null;
            var e = this.getScene().worldToDrawing(A);
            return {
                x: e.x,
                y: e.y,
                z: e.z
            }
        },
        drawingToWorld: function(A) {
            if (!this.cameraControl)
                return Bh.warn("camera is not initialized!!!"),
                null;
            var e = this.getScene().drawingToWorld(A);
            return {
                x: e.x,
                y: e.y,
                z: e.z
            }
        },
        worldToCanvas: function(A) {
            var e = this.cameraControl;
            if (!e)
                return Bh.warn("camera is not initialized!!!"),
                null;
            var t = e.getContainerDimensions();
            if (!t)
                return null;
            var i = e.getCamera()
              , o = this.getScene().worldToDrawing(A);
            return Rd.drawingToCanvas(i, o, t.width, t.height)
        },
        canvasToWorld: function(A) {
            var e = this.cameraControl;
            if (!e)
                return Bh.warn("camera is not initialized!!!"),
                null;
            var t = e.getContainerDimensions();
            if (!t)
                return null;
            var i = e.getCamera()
              , o = this.getScene()
              , n = Rd.canvasToDrawing(i, A, t.width, t.height)
              , r = o.drawingToWorld(n);
            return {
                x: r.x,
                y: r.y,
                z: r.z
            }
        },
        worldToClient: function(A) {
            var e = this.cameraControl;
            if (!e)
                return Bh.warn("camera is not initialized!!!"),
                null;
            var t = e.getContainerDimensions();
            if (!t)
                return null;
            var i = e.getCamera()
              , o = this.getScene().worldToDrawing(A)
              , n = Rd.drawingToCanvas(i, o, t.width, t.height);
            return n ? (n.x += t.left,
            n.y += t.top,
            n) : null
        },
        worldPointsToClient: function(A, e) {
            var t = this.cameraControl;
            if (!t)
                return Bh.warn("camera is not initialized!!!"),
                null;
            var i = t.getContainerDimensions();
            if (!i)
                return null;
            var o = t.getCamera()
              , n = this.getScene()
              , r = n.worldToDrawing(A)
              , a = n.worldToDrawing(e)
              , s = Rd.drawingPointsToCanvas(o, r, a, i.width, i.height);
            return s ? (s.start.x += i.left,
            s.start.y += i.top,
            s.end.x += i.left,
            s.end.y += i.top,
            s) : null
        },
        clientToWorld: function(A) {
            var e = this.cameraControl;
            if (!e)
                return Bh.warn("camera is not initialized!!!"),
                null;
            var t = e.getContainerDimensions();
            if (!t)
                return null;
            (n = {
                x: A.x,
                y: A.y,
                z: A.z
            }).x -= t.left,
            n.y -= t.top;
            var i = e.getCamera()
              , o = this.getScene()
              , n = Rd.canvasToDrawing(i, n, t.width, t.height)
              , r = o.drawingToWorld(n);
            return {
                x: r.x,
                y: r.y,
                z: r.z
            }
        },
        insideCamera: function(A) {
            var e = this.cameraControl;
            if (!e)
                return Bh.warn("camera is not initialized!!!"),
                !1;
            var t = this.getScene().worldToDrawing(A);
            return e.getFrustum().containsPoint(t)
        },
        locateToPointWithParallelEye: function(A) {
            var e = this.cameraControl;
            if (!e)
                return Bh.warn("camera is not initialized!!!"),
                !1;
            var t = this.getScene().worldToDrawing(A);
            e.flyToPointWithParallelEye(t)
        },
        locateToPoint: function(A) {
            var e = this.cameraControl;
            if (!e)
                return Bh.warn("camera is not initialized!!!"),
                !1;
            var t = this.getScene().worldToDrawing(A);
            e.flyToPoint(t)
        },
        enableHover: function(A) {
            vc.Hover = A
        },
        getObjectsByClientCoordinates: function(A) {
            return new fp(this).getObjectsByClientCoordinates(A)
        },
        getIBLManager: function() {
            return this.IBLManager
        },
        loadEnvMap: function(A) {
            for (var e = ["posx.hdr", "negx.hdr", "posy.hdr", "negy.hdr", "posz.hdr", "negz.hdr"], t = [], i = 0; 6 > i; i += 1)
                t.push("/" + A + "/" + e[i]);
            var o = this;
            (new (void 0)).load(1015, t, (function(A) {
                o.environmentCubeMap = A,
                o.modelManager.updateMaterialsValue("envMap", A),
                o.render()
            }
            ))
        },
        setEnvMapIntensity: function(A) {
            this.modelManager.updateMaterialsValue("envMapIntensity", A),
            this.setRenderStateChanged(!0),
            this.render()
        },
        closeEnvMap: function() {
            this.modelManager.updateMaterialsValue("envMap", null),
            this.render()
        },
        enableSSAO: function(A) {
            return !vc.IncrementRender && (vc.EnableRenderPass = A,
            vc.SSAO = A,
            this.setRenderStateChanged(!0),
            this.render(),
            !0)
        },
        switchNewStyleMaterial: function(A) {
            this.modelManager.switchNewStyleMaterial(A),
            this.setRenderStateChanged(!0),
            this.render()
        },
        enableColorWithoutLight: function(A) {
            this.modelManager.enableColorWithoutLight(A),
            this.setRenderStateChanged(!0),
            this.render()
        },
        addPlane: function(A, e, t, i) {
            var o = new y;
            o.addVectors(new y(A.x,A.y,A.z), new y(e.x,e.y,e.z)),
            o.multiplyScalar(.5);
            var n = new Ue(new et(e.x - A.x,e.y - A.y),new jA({
                side: 2,
                transparent: !0,
                depthTest: !0
            }));
            n.position.copy(o),
            n.renderOrder = 10,
            this.getScene().getOrCreateGroup(gp.CUSTOMPLANE, {
                globalSpace: !0
            }).add(n),
            n.updateMatrixWorld(!0);
            var r = this;
            return (new Aa).load(t, (function(A) {
                n.material.map = A,
                n.material.needsUpdate = !0,
                r.setRenderStateChanged(!0),
                i && i()
            }
            )),
            n
        },
        removePlane: function(A) {
            var e = this.getScene().getGroup(gp.CUSTOMPLANE);
            e && e.remove(A)
        },
        clearPlane: function() {
            var A = this.getScene().getGroup(gp.CUSTOMPLANE);
            A && A.clear()
        },
        enableTextureMapping: function(A) {
            vc.EnableTextureMapping = A
        },
        enableLightmap: function(A) {
            vc.EnableLightmap !== A && (vc.EnableLightmap = A)
        },
        setLightmapIntensity: function(A) {
            vc.LightmapIntensity !== A && (vc.LightmapIntensity = A)
        },
        setReverseWheelDirection: function(A) {
            jh.ReverseWheelDirection = Boolean(A)
        },
        getReverseWheelDirection: function() {
            return jh.ReverseWheelDirection
        },
        setMovementSpeedRate: function(A) {
            void 0 !== A && (jh.MovementSpeedRate = A)
        },
        getMovementSpeedRate: function() {
            return jh.MovementSpeedRate
        },
        moveTo: function(A, e, t) {
            var i = this.controlManager.control;
            i && i.moveTo(A, e, t)
        },
        rotateTo: function(A) {
            var e = this.controlManager.control;
            e && e.rotateTo(A)
        },
        enableOcclusionTranslucent: function(A) {
            vc.OcclusionTranslucentEnabled = Boolean(A)
        },
        setOcclusionOpacity: function(A) {
            vc.OcclusionOpacity = A
        },
        setOcclusionDistanceToCamera: function(A) {
            vc.OcclusionDistanceToCamera = A
        },
        fitAndRotateBySelection: function() {
            this.cameraControl && this.cameraControl.fitAndRotateBySelection()
        },
        setRoamingWalkHeight: function(A, e, t) {
            if (Array.isArray(A)) {
                var i = this.cameraControl;
                if (!i)
                    return Bh.log("camera is not initialized!!!"),
                    !1;
                if (e > 0 || (e = 1750),
                void 0 === t && (t = !0),
                i.setCameraHeight(A, e),
                t) {
                    var o = this.controlManager.getCurrentControl();
                    o && o.name === Gc.WALK && o.update && i.flyOnWorld()
                }
            } else
                Bh.log("elevations is not arry")
        },
        setRoamingWalkAbsoluteHeight: function(A, e) {
            var t = this.cameraControl;
            if (!t)
                return Bh.log("camera is not initialized!!!"),
                !1;
            if (void 0 === e && (e = !0),
            t.setCameraAbsoluteHeight(A),
            e) {
                var i = this.controlManager.getCurrentControl();
                i && i.name === Gc.WALK && i.update && t.flyOnWorld()
            }
        },
        cameraToWorld: function(A) {
            return this.camera ? cp.drawingToWorld(A, this.getScene().getMatrixGlobal()) : null
        },
        cameraToDrawing: function(A) {
            return this.camera ? cp.worldToDrawing(A, this.getScene().getMatrixGlobal()) : null
        },
        clearSelection: function() {
            this.modelManager.sceneState.clearSelection()
        },
        clearModelSelection: function() {
            this.modelManager.modelState.clearSelection()
        },
        addToSelection: function(A) {
            this.modelManager.sceneState.addSelection(A)
        },
        addToModelSelection: function(A) {
            this.modelManager.modelState.addSelection(A)
        },
        removeFromSelection: function(A) {
            this.modelManager.sceneState.removeSelection(A)
        },
        removeFromModelSelection: function(A) {
            this.modelManager.modelState.removeSelection(A)
        },
        setSelection: function(A) {
            this.modelManager.sceneState.setSelection(A)
        },
        setModelSelection: function(A) {
            this.modelManager.modelState.setSelection(A)
        },
        getSelection: function() {
            return this.modelManager.sceneState.getSelection()
        },
        getModelSelection: function() {
            return this.modelManager.modelState.getSelection()
        },
        setSelectionColor: function(A, e) {
            var t = A
              , i = e;
            A instanceof Xh && (t = A.getHex(),
            i = A.getAlpha()),
            this.modelManager.sceneState.setSelectionColor(t, i);
            var o = this.rendererManager.getPickingEffecter();
            o && o.setSelectionColor(t, i)
        },
        getSelectionColor: function() {
            return this.modelManager.sceneState.getSelectionColor()
        },
        restoreSelectionColor: function() {
            this.setSelectionColor(new Xh(vc.SelectionColor.color,vc.SelectionColor.opacity))
        },
        setModelSelectionColor: function(A, e) {
            this.modelManager.modelState.setSelectionColor(A, e)
        },
        getScreenCoordFromSceneCoordAndCheckCover: function(A) {
            var e = void 0
              , t = !1;
            if ("[object Array]" == Object.prototype.toString.call(A))
                e = new y(A[0],A[1],A[2]);
            else {
                if ("[object Object]" != Object.prototype.toString.call(A))
                    return;
                e = new y(A.x,A.y,A.z)
            }
            if (e) {
                var i = this.camera.position
                  , o = i.distanceTo(e)
                  , n = new Ds(i,e.clone().sub(i).normalize())
                  , r = this.cameraControl.getIntersectContext({
                    x: 100,
                    y: 100
                })
                  , a = this.cameraControl.intersector.getIntersectByRay(r, n.ray);
                if (!a)
                    return;
                t = o - 300 > i.distanceTo(a.point)
            }
            return {
                screenCoord: this.getScreenCoordFromSceneCoord(e),
                cover: t
            }
        },
        pickByPoint: function(A) {
            var e = this.cameraControl;
            if (!1 === e.enabled)
                return !1;
            var t = new s(A.x,A.y)
              , i = e.getIntersectContext(t)
              , o = e.intersector.pick(i)
              , n = this.getScene();
            if (o) {
                n.intersectToWorld(o, this);
                var r = {};
                return r.faceIndex = o.faceIndex,
                r.componentKey = o.userId,
                r.worldPosition = o.worldPosition,
                r.worldBoundingBox = o.worldBoundingBox,
                r
            }
            return null
        },
        pickByPointWithNormal: function(A) {
            var e = this.getScene()
              , t = this.cameraControl;
            if (!1 === t.enabled)
                return null;
            var i = new s(A.x,A.y)
              , o = t.getIntersectContext(i)
              , n = t.intersector.pick(o);
            if (!n)
                return null;
            e.intersectToWorld(n, this),
            n.cx = i.x,
            n.cy = i.y;
            var r = [];
            r.push(n);
            var a = e.getMatrixGlobal()
              , l = n.face.normal.clone()
              , c = new CA(n.worldPosition.clone(),l);
            c.applyMatrix4(a);
            var h = t.intersector.getIntersectByRay(o, c);
            return h && (e.intersectToWorld(h, this),
            r.push(h)),
            r
        },
        toDefaultOrthographicCamera: function(A) {
            this.switchToCamera(Ec.ORTHOGRAPHIC),
            (A || void 0 === A) && this.render()
        },
        toDefaultPerspectiveCamera: function(A) {
            this.switchToCamera(Ec.PERSPECTIVE),
            (A || void 0 === A) && this.render()
        },
        getCameraNameList: function() {
            return ["pesp", "orth"].concat(this.modelManager.getCameraNameList())
        },
        switchToCamera: function(A) {
            var e = !0;
            if (A === Ec.PERSPECTIVE)
                this.camera = this.defaultCamera,
                this.camera.toPerspective();
            else if (A === Ec.ORTHOGRAPHIC)
                this.camera = this.defaultCamera,
                this.camera.toOrthographic();
            else {
                var t = this.modelManager.getCamera(A);
                t ? this.camera = t : (Bh.log("Fail to switch because not found camera '" + A + "'"),
                e = !1)
            }
            return e && this.cameraControl.setCamera(this.camera),
            this.render(),
            e
        },
        getNumOfElements: function() {
            return this.modelManager.getNumOfElements()
        },
        getNumOfRenderables: function() {
            return this.modelManager.getNumOfRenderables()
        },
        getNumOfTriangles: function() {
            return this.modelManager.getNumOfTriangles()
        },
        setLightPreset: function(A) {
            this.getScene().setLightPreset(A),
            this.setRenderStateChanged(!0)
        },
        getLightPreset: function() {
            return this.getScene().getLightPreset()
        },
        setLightIntensityFactor: function(A) {
            this.getScene().setLightIntensityFactor(A),
            this.render()
        },
        setAmbientLightIntensity: function(A) {
            this.getScene().setAmbientLightIntensity(A),
            this.render()
        },
        getAmbientLightIntensity: function() {
            return this.getScene().getAmbientLightIntensity()
        },
        setWalkHeightLocked: function(A) {
            var e = this.controlManager.getCurrentControl();
            e && e.name === Gc.WALK && e.setHeightLocked(A)
        },
        setWalkLookMousePressed: function(A) {
            var e = this.controlManager.getCurrentControl();
            e && e.name === Gc.WALK && e.setDragLook(A)
        },
        setWalkSpeedRate: function(A) {
            var e = this.controlManager.getCurrentControl();
            e && e.name === Gc.WALK && (jh.MovementSpeedRate = A)
        },
        getWalkSpeedRate: function() {
            return jh.WalkSpeedRate
        },
        setDrawingStyle: function(A) {
            vc.DrawingStyle = A,
            this.modelManager.applyFilter(),
            this.setRenderStateChanged(!0)
        },
        getWireframeColor: function(A) {
            var e = this.modelManager;
            if (A && e.models[A])
                return e.models[A].wireframeManager.getWireframeColor();
            for (var t in e.models) {
                return e.models[t].wireframeManager.getWireframeColor()
            }
        },
        setWireframeColor: function(A, e) {
            var t = this.modelManager;
            if (e && t.models[e])
                t.models[e].wireframeManager.setWireframeColor(new LA(A), A.a || 1);
            else
                for (var i in t.models)
                    t.models[i].wireframeManager.setWireframeColor(new LA(A), A.a || 1);
            this.setRenderStateChanged(!0)
        },
        restoreWireframeColor: function(A) {
            var e = this.modelManager;
            if (A && e.models[A])
                e.models[A].wireframeManager.restoreWireframeColor();
            else
                for (var t in e.models)
                    e.models[t].wireframeManager.restoreWireframeColor();
            this.setRenderStateChanged(!0)
        },
        setInstanceMode: function(A) {
            !vc.Instance === A && (vc.Instance = A,
            this.getScene().getOrCreateGroup(gp.INSTANCEGEOMETRY, {
                globalSpace: !0
            }).visible = !!A)
        },
        setTransitionAnimationState: function(A) {
            this.transitionAnimationState = A
        },
        getTransitionAnimationState: function() {
            return this.transitionAnimationState
        },
        clipPoint: function(A) {
            var e = this.getRenderer().clippingPlanes;
            if (e && e.length > 0)
                for (var t = 0; e.length > t; t += 1) {
                    var i = e[t];
                    if (A.dot(i.normal) < -i.constant)
                        return !0
                }
            return !1
        },
        setExposureShift: function(A) {
            vc.ToneMapping = 1,
            this.modelManager.updateMaterialsValue("shift", A > 0 ? -.4 * A + .5 : -4 * A + .5),
            this.setRenderStateChanged(!0)
        },
        setRenderStateChanged: function(A) {
            this.modelManager && this.modelManager.setRenderStateChanged(A)
        },
        isRenderStateChanged: function() {
            return this.modelManager._renderStateChanged
        },
        getComponentInfoByUserId: function(A) {
            return this.modelManager.getComponentInfoByUserId(A)
        },
        getBoundingBoxByIds: function(A) {
            var e = new aA;
            if (Array.isArray(A)) {
                for (var t = 0; A.length > t; t += 1)
                    if (!this.modelManager.isHiddenUserId(A[t])) {
                        var i = this.getModelByComponentKey(A[t])
                          , o = this.getComponentInfoByUserId(A[t]);
                        if (o)
                            if (i) {
                                var n = o.boundingBox.clone().applyMatrix4(i.getModelMatrix());
                                e.union(n)
                            } else
                                e.union(o.boundingBox)
                    }
            } else
                for (var r in A)
                    if (!this.modelManager.isHiddenUserId(r)) {
                        var a = this.getModelByComponentKey(r)
                          , s = this.getComponentInfoByUserId(r);
                        if (s)
                            if (a) {
                                var l = s.boundingBox.clone().applyMatrix4(a.getModelMatrix());
                                e.union(l)
                            } else
                                e.union(s.boundingBox)
                    }
            return e.isEmpty() || e.applyMatrix4(this.getScene().getMatrixGlobal()),
            e
        },
        setConditionsOnDemandLoad: function(A, e, t, i) {
            e = e || !0,
            this.modelManager.setConditionsOnDemandLoad(A),
            e && this.modelManager.loadGeopkOnDemand(t, i)
        },
        loadGeopkOnDemand: function(A, e, t, i) {
            var o = this;
            this.modelManager.loadGeopkOnDemand(A, e, t, (function() {
                var A = o.modelManager.getNodeInfos();
                o.filter.reinitFilterManager(A),
                o.setRenderStateChanged(!0),
                o.render(),
                i && i()
            }
            ))
        },
        unloadGeopkOnDemand: function(A, e) {
            var t = this;
            this.filter._hasVisibleFilter() && (this.filter.showByIds(A),
            this.filter.removeFromIsolateList(A)),
            this.filter._hasOverrideMaterialFilter() && (this.filter.addToOverrideListByColor(A, null),
            this.filter.addToWireframeByWireframe(A, null)),
            this.filter._hasTransparentFilter() && this.filter.opaqueByIds(A),
            this.removeFromSelection(A);
            for (var i = 0, o = A.length; o > i; i += 1)
                ;
            this.modelManager.unloadGeopkOnDemand(A, (function() {
                var A = t.modelManager.getNodeInfos();
                t.filter.reinitFilterManager(A),
                t.setRenderStateChanged(!0),
                t.render(),
                e && e()
            }
            ))
        },
        getBoundingBoxOnDemand: function() {
            return this.modelManager.getBoundingBoxOnDemand()
        },
        getScreenCoordFromSceneCoord: function(A) {
            var e = [];
            if (A.isVector3) {
                var t = A.clone();
                t.applyMatrix4(this.camera.matrixWorldInverse);
                var i = t.z > 0;
                return t.applyMatrix4(this.camera.projectionMatrix),
                e[0] = (t.x + 1) * this.domElement.clientWidth / 2,
                e[1] = (1 - t.y) * this.domElement.clientHeight / 2,
                e[2] = i ? 1 : 0,
                e
            }
            if (Array.isArray(A)) {
                var o = new y(A[0],A[1],A[2]);
                o.applyMatrix4(this.camera.matrixWorldInverse);
                i = o.z > 0;
                return o.applyMatrix4(this.camera.projectionMatrix),
                e[0] = (o.x + 1) * this.domElement.clientWidth / 2,
                e[1] = (1 - o.y) * this.domElement.clientHeight / 2,
                e[2] = i ? 1 : 0,
                o = null,
                e
            }
        },
        _checkDataChanged: function() {
            var A = this.modelManager;
            A.hasModelDataReady() && (this.getFilter().isStateChanged() || this.isRenderStateChanged()) && (this.isRenderStateChanged() && this.setRenderStateChanged(!1),
            this.getFilter().isStateChanged() && this.getFilter().disableStateChanged(),
            this.needApplyFilter = !0),
            this.needCheckTilesDataChange && (this.needCheckTilesDataChange = !1,
            A.checkTilesDataChanged(this.camera, this.getRenderer()))
        },
        _checkLayerDataLoading: function() {
            return !(!this.modelManager.isLayerData() || !this._layerDataLoading) && (this.getFilter().isStateChanged() && this.getFilter().disableStateChanged(),
            !0)
        },
        setOutlineEdgeColor: function(A) {
            this.rendererManager.composer && this.rendererManager.composer.setOutlineEdgeColor(A);
            var e = this.rendererManager.getPickingEffecter();
            e && e.setLineSelectionColor(A.getHex(), A.opacity)
        },
        getOutlineEdgeColor: function() {
            if (this.rendererManager.composer)
                return this.rendererManager.composer.getOutlineEdgeColor();
            var A = this.rendererManager.getPickingEffecter();
            return A ? A.getLineSelectionColor() : void 0
        },
        restoreOutlineEdgeColor: function(A) {
            this.setOutlineEdgeColor(new Xh(vc.SelectionColor.color,vc.SelectionColor.opacity))
        },
        enableSelectedColorIsAffectedByLight: function(A) {
            vc.InfluencedByLight = A,
            vc.InfluencedByLight ? delete this.modelManager.getSceneState().selectionMaterial.defines.NOTAFFECTEDBYLIGHT : this.modelManager.getSceneState().selectionMaterial.defines.NOTAFFECTEDBYLIGHT = ""
        },
        enableLogarithmicDepthBuffer: function(A) {
            vc.logarithmicDepthBuffer !== A && (vc.logarithmicDepthBuffer = A,
            this.renderSettings.logarithmicDepthBuffer = A,
            this.rendererManager.resetupRenderer(this.renderSettings || {}),
            this._render(),
            this.updateShadowLight())
        },
        enableBlinkComponents: function(A) {
            this.modelManager.isBlinkPermited() || (this.modelManager.enableBlink(A),
            this.render())
        },
        setBlinkComponentsById: function(A) {
            this.modelManager.isBlinkPermited() || this.modelManager.sceneState.setBlinkComponentsById(A)
        },
        addBlinkComponentsById: function(A) {
            this.modelManager.isBlinkPermited() || this.modelManager.sceneState.addBlinkComponentsById(A)
        },
        clearBlinkComponentsById: function(A) {
            this.modelManager.isBlinkPermited() || this.modelManager.sceneState.clearBlinkComponentsById(A)
        },
        clearAllBlinkComponents: function() {
            this.modelManager.isBlinkPermited() || this.modelManager.sceneState.clearAllBlinkComponents()
        },
        getBlinkComponents: function() {
            return this.modelManager.isBlinkPermited() ? null : this.modelManager.sceneState.getBlinkComponents()
        },
        setBlinkColor: function(A) {
            this.modelManager.isBlinkPermited() || this.modelManager.setBlinkColor(A.color, A.opacity)
        },
        setBlinkIntervalTime: function(A) {
            this.modelManager.isBlinkPermited() || this.modelManager.setBlinkIntervalTime(A)
        },
        getModelByComponentKey: function(A) {
            var e = null;
            for (var t in this.modelManager.models)
                if (this.modelManager.models.hasOwnProperty(t) && (e = this.modelManager.getModel(t)) && e.isLoaded() && e.hasComponent(A))
                    return e
        },
        getSceneState: function() {
            return {
                state: this.getFilter().saveState(),
                camera: this.getCamera(),
                selection: this.getSelection(),
                modelSelection: this.getModelSelection()
            }
        },
        setSceneState: function(A) {
            void 0 !== A.camera && "object" !== lc(A.camera) || (A.camera = JSON.stringify(A.camera)),
            this.setCamera(A.camera, !1),
            this.setSelection(A.selection),
            this.setModelSelection(A.modelSelection),
            this.getFilter().loadState(A.state)
        },
        setComponentPositionByKey: function(A, e) {
            var t = (new y).fromArray(e)
              , i = (this.getModelManager(),
            new M,
            this.modelManager.getComponent(A));
            if (i && i.length >= 1) {
                for (var o = new aA, n = 0, r = i.length; r > n; n += 1) {
                    o && o.union(i[n].boundingBox)
                }
                var a = new y;
                o.getCenter(a);
                var s = this.getModelByComponentKey(A);
                if (s) {
                    var l = s.getModelMatrix();
                    if (l) {
                        var c = new M;
                        c.getInverse(l),
                        t.applyMatrix4(c)
                    }
                }
                t.sub(a);
                var h = (new M).makeTranslation(t.x, t.y, t.z);
                this.componentApplyMatrix2(A, h, !0),
                this.updateTransformControlIfBindingComKeyEqual(A)
            }
        },
        setBackgroundColor: function(A, e) {
            if (e)
                this.setBackgroundColors([{
                    color: A,
                    stop: "0%"
                }, {
                    color: e,
                    stop: "100%"
                }], "180deg");
            else {
                var t = this.getDomElement();
                t && (t.style.background = A.getRGBA())
            }
        },
        setBackgroundColors: function(A, e) {
            var t = this.getDomElement()
              , i = e || "0deg"
              , o = [];
            if (A && A.length > 0) {
                1 === A.length && this.setBackgroundColor(A[0].color || A[0]);
                for (var n = 0; A.length > n; n += 1) {
                    var r = A[n].color.getRGBA() + " " + A[n].stop;
                    o.push(r)
                }
                var a = i + ", " + o.join(",");
                t && (t.style.background = "linear-gradient(" + a + ")")
            }
        },
        resetBackgroundColor: function() {
            this.getDomElement() && (this.domElement.style.background = "linear-gradient(rgb(135,206,250) 0%, rgb(245, 245, 245) 100%)")
        },
        getComponentLocalMatrixByKey: function(A) {
            if (A) {
                var e = this.modelManager.getComponent(A);
                if (e && e.length > 0 && e[0].matrix)
                    return e[0].matrix.clone()
            }
        },
        getComponentWorldMatrixByKey: function(A) {
            var e = this.getComponentLocalMatrixByKey(A);
            if (e) {
                var t = this.getModelByComponentKey(A);
                if (t) {
                    var i = t.getModelMatrix();
                    e.premultiply(i)
                }
                return e
            }
        },
        setComponentLocalMatrixByKey: function(A, e) {
            if (A) {
                var t = this.modelManager.getComponent(A);
                if (t && t.length > 0) {
                    var i = t[0].mesh;
                    return i.matrix.fromArray(e),
                    i.updateMatrixWorld(!0),
                    this.render(),
                    !0
                }
            }
            return !1
        },
        _transformComponentByKey: function(A, e, t) {
            var i = this;
            if (A) {
                var o = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM);
                if (o && o.bindingComponentKey === A)
                    return o;
                var n = this.getModelByComponentKey(A)
                  , r = function(A) {
                    i.render()
                }
                  , a = function(t) {
                    "string" == typeof A && t.matrix && t.object && (i.componentApplyMatrix2(A, t.matrix, !1),
                    i.getScene().expandBoundingBoxWorldBy(t.object)),
                    e && e(A)
                };
                if ("string" != typeof A) {
                    if (A instanceof H) {
                        var s = A;
                        return this.controlManager.enableTool(this, Pc.COMPONENT_TRANSFORM),
                        (o = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM)).transformComponent(s, r, a),
                        o.bindingComponentKey = void 0,
                        o
                    }
                    return
                }
                var l = this.modelManager.getComponent(A);
                if (l && l.length > 0) {
                    var c = i.externalComponentManager;
                    c && c.getNodeInfosByUserId(A) && c.recalculateComponentBoundingbox(A);
                    for (var h = new aA, d = 0, p = l.length; p > d; d += 1)
                        h.union(l[d].transformationOriginalBoundingBox ? l[d].transformationOriginalBoundingBox : l[d].boundingBox);
                    var g = new Ue(Tu.getGeometryFromBox3(h));
                    if (g.matrixAutoUpdate = !1,
                    l[0].transformation && g.matrix.copy(l[0].applyMatrix),
                    n) {
                        var u = n.getModelMatrix();
                        if (u) {
                            var f = new Xi;
                            f.matrixAutoUpdate = !1,
                            f.matrix.copy(u),
                            f.updateMatrixWorld(!0),
                            f.add(g)
                        }
                    }
                    return g.updateMatrixWorld(!0),
                    this.controlManager.enableTool(this, Pc.COMPONENT_TRANSFORM),
                    (o = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM)).transformComponent(g, r, a, void 0, (function(e) {
                        if (n)
                            n.calculateBoundingBox();
                        else {
                            var o = i.externalComponentManager;
                            o && o.getNodeInfosByUserId(A) && o.calculateBoundingBox()
                        }
                        i.modelManager.updateSceneBoundingBox(),
                        t && t(A)
                    }
                    )),
                    o.bindingComponentKey = A,
                    this.modelManager.updateTransformComponentList(A),
                    o
                }
            }
        },
        _transformModelByKey: function(A) {
            if (A && "string" == typeof A) {
                var e = this.getModel(A);
                if (e && e.isLoaded() && e.isVisible()) {
                    var t = this
                      , i = e.getBoundingBoxWorld();
                    if (i.isEmpty())
                        return;
                    var o = new Ue(Tu.getGeometryFromBox3(i));
                    o.matrixAutoUpdate = !1,
                    o.updateMatrixWorld(!0),
                    this.controlManager.enableTool(this, Pc.COMPONENT_TRANSFORM);
                    var n = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM);
                    return n.transformComponent(o, (function(A) {
                        t.render()
                    }
                    ), (function(A) {
                        A && A.matrix && e.applyModelMatrix(A.matrix)
                    }
                    )),
                    n
                }
            }
        },
        translateComponentByKey: function(A, e, t) {
            var i = this._transformComponentByKey(A, e, t);
            i && i.switchToTranslateMode()
        },
        scaleComponentByKey: function(A, e, t) {
            var i = this._transformComponentByKey(A, e, t);
            i && i.switchToScaleMode()
        },
        rotateComponentByKey: function(A, e, t) {
            var i = this._transformComponentByKey(A, e, t);
            i && i.switchToRotateMode()
        },
        cancelTransformComponent: function(A) {
            var e = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM);
            e && (A && this.restoreComponentTransform(),
            e.cancelTransformComponent(),
            this.controlManager.disableTool(e.name))
        },
        cancelTransformComponentByKey: function(A) {
            if (A && "string" == typeof A) {
                var e = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM);
                e && e.bindingComponentKey === A && (e.cancelTransformComponent(),
                this.controlManager.disableTool(e.name))
            }
        },
        restoreComponentTransform: function() {
            var A = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM);
            A && (A.bindingComponentKey ? this.restoreComponentTransformByKey(A.bindingComponentKey) : A.restoreComponentOriginalTransformState() && this.render())
        },
        restoreComponentTransformByKey: function(A) {
            A && "string" == typeof A && (this.resetComponentMatrix(A),
            this.updateTransformControlIfBindingComKeyEqual(A))
        },
        updateTransformControlIfBindingComKeyEqual: function(A) {
            var e = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM);
            e && e.bindingComponentKey === A && (e.cancelTransformComponent(),
            this._transformComponentByKey(A))
        },
        increaseComponentTransformControlSize: function() {
            var A = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM);
            A && A.increaseTransformControlSize() && this.render()
        },
        decreaseComponentTransformControlSize: function() {
            var A = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM);
            A && A.decreaseTransformControlSize() && this.render()
        },
        setComponentTransformSpaceToLocalSpace: function() {
            var A = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM);
            A && A.setTransformSpaceToLocalSpace() && this.render()
        },
        setComponentTransformSpaceToWorldSpace: function() {
            var A = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM);
            A && A.setTransformSpaceToWorldSpace() && this.render()
        },
        switchComponentTransformSpaceBetweenLocalAndWorld: function() {
            var A = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM);
            A && A.switchTransformSpace() && this.render()
        },
        showComponentTransformOnAxis: function(A) {
            var e = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM);
            e && e.showTransformOnAxis(A) && this.render()
        },
        hideComponentTransformOnAxis: function(A) {
            var e = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM);
            e && e.hideTransformOnAxis(A) && this.render()
        },
        disableComponentTransform: function() {
            var A = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM);
            A && A.disableTransform() && this.render()
        },
        enableComponentTransform: function() {
            var A = this.controlManager.getToolByName(Pc.COMPONENT_TRANSFORM);
            A && A.enableTransform() && this.render()
        },
        componentApplyMatrix: function(A, e) {
            var t = this.getModelManager()
              , i = this.getModelByComponentKey(A);
            if (i) {
                t.explosionList[A] || (t.explosionList[A] = !0);
                var o = i._getHandler();
                if (o instanceof MC) {
                    var n = this.modelManager.getComponent(A);
                    if (n && n[0] && n[0].mesh) {
                        var r = n[0].mesh;
                        if (r) {
                            r.userData.originalMatrix || (r.userData.originalMatrix = r.matrixWorld.clone());
                            var a = new y(r.userData.originalMatrix.elements[12],r.userData.originalMatrix.elements[13],r.userData.originalMatrix.elements[14])
                              , s = new M;
                            s.setPosition(a);
                            var l = new M;
                            l.setPosition(a.multiplyScalar(-1)),
                            r.matrixWorld.multiply(l).multiply(e).multiply(s)
                        }
                    }
                } else if (o instanceof Yf) {
                    var c = i.getModelDescriptor()
                      , h = c.mapNodeInfoByCategory[1]
                      , d = c.mapNodeInfoByCategory[0];
                    if (h.hasOwnProperty(A))
                        for (var p = h[A], g = 0; p.length > g; g += 1) {
                            var u = p[g]
                              , f = u.mesh;
                            if (f) {
                                var m = u.index
                                  , C = f.geometry.attributes.position;
                                Tu.applyMatrix4ToBuffer(e, C.array, m.positionStart, m.positionStart + m.positionCount),
                                C.needsUpdate = !0
                            }
                        }
                    if (d.hasOwnProperty(A))
                        for (var v = d[A], I = o.instancedManager.meshManager, E = 0; v.length > E; E += 1)
                            for (var B = v[E], x = I.getMeshIdByNodeInfo(B), S = I.nodeIdxMapFromUserId[A][x], w = 0, b = S.length; b > w; w += 1) {
                                var U = S[w]
                                  , F = I.instanceGeometryMap[x][w]
                                  , K = F.getAttribute("mcol0")
                                  , Q = F.getAttribute("mcol1")
                                  , R = F.getAttribute("mcol2")
                                  , T = F.getAttribute("mcol3");
                                B.transformation || (B.transformation = !0,
                                B.transformationOriginalMatrix = B.matrix.clone());
                                var k = (new y).fromArray(B.transformationOriginalMatrix.elements, 12)
                                  , D = new M;
                                D.setPosition(k);
                                var L = new M;
                                L.setPosition(k.multiplyScalar(-1));
                                var N = new M;
                                N.fromArray([K.array[3 * U], K.array[3 * U + 1], K.array[3 * U + 2], 0, Q.array[3 * U], Q.array[3 * U + 1], Q.array[3 * U + 2], 0, R.array[3 * U], R.array[3 * U + 1], R.array[3 * U + 2], 0, T.array[3 * U], T.array[3 * U + 1], T.array[3 * U + 2], 1], 0),
                                N.multiply(L).multiply(e).multiply(D),
                                K.array[3 * U] = N.elements[0],
                                K.array[3 * U + 1] = N.elements[1],
                                K.array[3 * U + 2] = N.elements[2],
                                K.needsUpdate = !0,
                                Q.array[3 * U] = N.elements[4],
                                Q.array[3 * U + 1] = N.elements[5],
                                Q.array[3 * U + 2] = N.elements[6],
                                Q.needsUpdate = !0,
                                R.array[3 * U] = N.elements[8],
                                R.array[3 * U + 1] = N.elements[9],
                                R.array[3 * U + 2] = N.elements[10],
                                R.needsUpdate = !0,
                                T.array[3 * U] = N.elements[12],
                                T.array[3 * U + 1] = N.elements[13],
                                T.array[3 * U + 2] = N.elements[14],
                                T.needsUpdate = !0,
                                B.matrix = N
                            }
                } else
                    Bh.warn("当前模式下暂不支持构件变换")
            }
            this.render()
        },
        componentApplyMatrix2: function(A, e, t) {
            var i = this.getModelByComponentKey(A)
              , o = this.getModelManager().getComponent(A);
            if (o && o.length > 0) {
                for (var n = 0; o.length > n; n += 1) {
                    var r = o[n];
                    if (r.matrix || (r.matrix = new M),
                    r.transformation || (r.transformation = !0,
                    r.transformationOriginalMatrix = r.matrix.clone(),
                    r.applyMatrix = new M,
                    r.boundingBox && (r.transformationOriginalBoundingBox = r.boundingBox.clone())),
                    r.matrix.premultiply(e),
                    r.applyMatrix.premultiply(e),
                    r.boundingBox && r.boundingBox.copy(r.transformationOriginalBoundingBox).applyMatrix4(r.applyMatrix),
                    r.isBatched) {
                        var a = i._getHandler();
                        if (!0 === r.instanceOrNot)
                            for (var s = a.instancedManager.meshManager, l = s.getMeshIdByNodeInfo(r), c = s.nodeIdxMapFromUserId[A][l], h = 0, d = c.length; d > h; h += 1) {
                                var p = c[h]
                                  , g = s.instanceGeometryMap[l][h]
                                  , u = g.getAttribute("mcol0")
                                  , f = g.getAttribute("mcol1")
                                  , m = g.getAttribute("mcol2")
                                  , C = g.getAttribute("mcol3")
                                  , y = r.matrix;
                                u.array[3 * p] = y.elements[0],
                                u.array[3 * p + 1] = y.elements[1],
                                u.array[3 * p + 2] = y.elements[2],
                                u.needsUpdate = !0,
                                f.array[3 * p] = y.elements[4],
                                f.array[3 * p + 1] = y.elements[5],
                                f.array[3 * p + 2] = y.elements[6],
                                f.needsUpdate = !0,
                                m.array[3 * p] = y.elements[8],
                                m.array[3 * p + 1] = y.elements[9],
                                m.array[3 * p + 2] = y.elements[10],
                                m.needsUpdate = !0,
                                C.array[3 * p] = y.elements[12],
                                C.array[3 * p + 1] = y.elements[13],
                                C.array[3 * p + 2] = y.elements[14],
                                C.needsUpdate = !0
                            }
                        else {
                            var v = r.mesh;
                            if (!v)
                                continue;
                            var I = r.index
                              , E = v.geometry;
                            v.geometry.boundingBox = null;
                            var B = E.attributes.position;
                            Tu.applyMatrix4ToBuffer(e, B.array, I.positionStart, I.positionStart + I.positionCount),
                            B.needsUpdate = !0;
                            var x = a.defaultManager.wireframeManager.wireframeLineSegment;
                            if (x)
                                for (var S = x._indicesGroup[A], w = 0, b = S.length; b > w; w += 1) {
                                    var U = S[w];
                                    if (S[w].nodeId === r.nodeId) {
                                        var F = x.geometry.attributes.position;
                                        Tu.applyMatrix4ToBuffer(e, F.array, 3 * U.positionStart, 3 * (U.positionStart + U.positionCount)),
                                        F.needsUpdate = !0;
                                        break
                                    }
                                }
                        }
                    } else {
                        var K = null;
                        if (r.mesh instanceof Array)
                            K = r.mesh;
                        else {
                            if (!(r.mesh instanceof H))
                                continue;
                            K = [r.mesh]
                        }
                        for (var Q = 0, R = K.length; R > Q; Q += 1) {
                            var T = K[Q];
                            r.isExternalComponent && (T.userData.originalMatrix || (T.userData.originalMatrix = T.matrix.clone()));
                            var k = T.matrixAutoUpdate;
                            T.matrixAutoUpdate = !1,
                            T.applyMatrix4(e),
                            T.matrixAutoUpdate = k,
                            T.updateMatrixWorld(!0)
                        }
                        var D = r.wireframeMeshs;
                        if (D)
                            for (var L = 0, N = D.length; N > L; L += 1) {
                                var O = D[L];
                                k = O.matrixAutoUpdate,
                                O.matrixAutoUpdate = !1,
                                O.matrix.copy(r.matrix),
                                O.updateMatrixWorld(!0),
                                O.matrixAutoUpdate = k
                            }
                    }
                }
                if (void 0 === t && (t = !0),
                t) {
                    if (i)
                        i.calculateBoundingBox();
                    else {
                        var V = this.externalComponentManager;
                        V && V.getNodeInfosByUserId(A) && V.calculateBoundingBox()
                    }
                    this.modelManager.updateSceneBoundingBox()
                }
            }
            this.modelManager.updateTransformComponentList(A),
            this.render()
        },
        setComponentMatrix: function(A, e) {
            this.setComponentMatrix2(A, e)
        },
        setComponentMatrix2: function(A, e, t) {
            var i = this.getModelManager().getComponent(A);
            if (i && i.length > 0)
                for (var o = 0; i.length > o; o += 1) {
                    var n = i[o];
                    n.matrix || (n.matrix = new M);
                    var r = null;
                    n.transformation ? r = (new M).getInverse(n.applyMatrix) : (n.transformation = !0,
                    n.transformationOriginalMatrix = n.matrix.clone(),
                    n.applyMatrix = new M,
                    n.boundingBox && (n.transformationOriginalBoundingBox = n.boundingBox.clone())),
                    n.matrix.copy(n.transformationOriginalMatrix).premultiply(e),
                    n.applyMatrix.copy(e),
                    n.boundingBox && n.boundingBox.copy(n.transformationOriginalBoundingBox).applyMatrix4(n.applyMatrix);
                    var a = this.getModelByComponentKey(A);
                    if (n.isBatched) {
                        var s = a._getHandler();
                        if (!0 === n.instanceOrNot)
                            for (var l = s.instancedManager.meshManager, c = l.getMeshIdByNodeInfo(n), h = l.nodeIdxMapFromUserId[A][c], d = 0, p = h.length; p > d; d += 1) {
                                var g = h[d]
                                  , u = l.instanceGeometryMap[c][d]
                                  , f = u.getAttribute("mcol0")
                                  , m = u.getAttribute("mcol1")
                                  , C = u.getAttribute("mcol2")
                                  , y = u.getAttribute("mcol3")
                                  , v = n.matrix;
                                f.array[3 * g] = v.elements[0],
                                f.array[3 * g + 1] = v.elements[1],
                                f.array[3 * g + 2] = v.elements[2],
                                f.needsUpdate = !0,
                                m.array[3 * g] = v.elements[4],
                                m.array[3 * g + 1] = v.elements[5],
                                m.array[3 * g + 2] = v.elements[6],
                                m.needsUpdate = !0,
                                C.array[3 * g] = v.elements[8],
                                C.array[3 * g + 1] = v.elements[9],
                                C.array[3 * g + 2] = v.elements[10],
                                C.needsUpdate = !0,
                                y.array[3 * g] = v.elements[12],
                                y.array[3 * g + 1] = v.elements[13],
                                y.array[3 * g + 2] = v.elements[14],
                                y.needsUpdate = !0
                            }
                        else {
                            var I = n.mesh;
                            if (!I)
                                continue;
                            var E = n.index
                              , B = I.geometry.attributes.position;
                            r && Tu.applyMatrix4ToBuffer(r, B.array, E.positionStart, E.positionStart + E.positionCount),
                            Tu.applyMatrix4ToBuffer(n.applyMatrix, B.array, E.positionStart, E.positionStart + E.positionCount),
                            B.needsUpdate = !0;
                            var x = s.defaultManager.wireframeManager.wireframeLineSegment;
                            if (x)
                                for (var S = x._indicesGroup[A], w = 0, b = S.length; b > w; w += 1) {
                                    var U = S[w];
                                    if (S[w].nodeId === n.nodeId) {
                                        var F = x.geometry.attributes.position;
                                        r && Tu.applyMatrix4ToBuffer(r, F.array, 3 * U.positionStart, 3 * (U.positionStart + U.positionCount)),
                                        Tu.applyMatrix4ToBuffer(e, F.array, 3 * U.positionStart, 3 * (U.positionStart + U.positionCount)),
                                        F.needsUpdate = !0;
                                        break
                                    }
                                }
                        }
                    } else {
                        var K = null;
                        if (n.mesh instanceof Array)
                            K = n.mesh;
                        else {
                            if (!(n.mesh instanceof H))
                                continue;
                            K = [n.mesh]
                        }
                        for (var Q = 0, R = K.length; R > Q; Q += 1) {
                            var T = K[o];
                            n.isExternalComponent && (T.userData.originalMatrix || (T.userData.originalMatrix = T.matrix.clone()));
                            var k = T.matrixAutoUpdate;
                            T.matrixAutoUpdate = !1,
                            T.matrix.copy(n.matrix),
                            T.applyMatrix4(new M),
                            T.matrixAutoUpdate = k,
                            T.updateMatrixWorld(!0)
                        }
                        var D = n.wireframeMeshs;
                        if (D)
                            for (var L = 0, N = D.length; N > L; L += 1) {
                                var O = D[L];
                                k = O.matrixAutoUpdate,
                                O.matrixAutoUpdate = !1,
                                O.matrix.copy(n.matrix),
                                O.updateMatrixWorld(!0),
                                O.matrixAutoUpdate = k
                            }
                    }
                    if (void 0 === t && (t = !0),
                    t) {
                        if (a)
                            a.calculateBoundingBox();
                        else {
                            var V = this.externalComponentManager;
                            V && V.getNodeInfosByUserId(A) && V.calculateBoundingBox()
                        }
                        this.modelManager.updateSceneBoundingBox()
                    }
                }
            this.render()
        },
        resetComponentMatrix: function(A, e) {
            var t = this.getModelManager().getComponent(A);
            if (t && t.length > 0)
                for (var i = 0; t.length > i; i += 1) {
                    var o = t[i];
                    if (o.transformation) {
                        o.matrix.copy(o.transformationOriginalMatrix),
                        o.transformationOriginalBoundingBox && (o.boundingBox = o.transformationOriginalBoundingBox.clone());
                        var n = (new M).getInverse(o.applyMatrix)
                          , r = this.getModelByComponentKey(A);
                        if (o.isBatched) {
                            var a = r._getHandler();
                            if (!0 === o.instanceOrNot)
                                for (var s = a.instancedManager.meshManager, l = s.getMeshIdByNodeInfo(o), c = s.nodeIdxMapFromUserId[A][l], h = 0, d = c.length; d > h; h += 1) {
                                    var p = c[h]
                                      , g = s.instanceGeometryMap[l][h]
                                      , u = g.getAttribute("mcol0")
                                      , f = g.getAttribute("mcol1")
                                      , m = g.getAttribute("mcol2")
                                      , C = g.getAttribute("mcol3")
                                      , y = o.matrix;
                                    u.array[3 * p] = y.elements[0],
                                    u.array[3 * p + 1] = y.elements[1],
                                    u.array[3 * p + 2] = y.elements[2],
                                    u.needsUpdate = !0,
                                    f.array[3 * p] = y.elements[4],
                                    f.array[3 * p + 1] = y.elements[5],
                                    f.array[3 * p + 2] = y.elements[6],
                                    f.needsUpdate = !0,
                                    m.array[3 * p] = y.elements[8],
                                    m.array[3 * p + 1] = y.elements[9],
                                    m.array[3 * p + 2] = y.elements[10],
                                    m.needsUpdate = !0,
                                    C.array[3 * p] = y.elements[12],
                                    C.array[3 * p + 1] = y.elements[13],
                                    C.array[3 * p + 2] = y.elements[14],
                                    C.needsUpdate = !0
                                }
                            else {
                                var v = o.mesh;
                                if (!v)
                                    continue;
                                var I = o.index
                                  , E = v.geometry.attributes.position;
                                n && (Tu.applyMatrix4ToBuffer(n, E.array, I.positionStart, I.positionStart + I.positionCount),
                                E.needsUpdate = !0);
                                var B = a.defaultManager.wireframeManager.wireframeLineSegment;
                                if (B)
                                    for (var x = B._indicesGroup[A], S = 0, w = x.length; w > S; S += 1) {
                                        var b = x[S];
                                        if (x[S].nodeId === o.nodeId) {
                                            var U = B.geometry.attributes.position;
                                            n && (Tu.applyMatrix4ToBuffer(n, U.array, 3 * b.positionStart, 3 * (b.positionStart + b.positionCount)),
                                            U.needsUpdate = !0);
                                            break
                                        }
                                    }
                            }
                        } else {
                            var F = null;
                            if (o.mesh instanceof Array)
                                F = o.mesh;
                            else {
                                if (!(o.mesh instanceof H))
                                    continue;
                                F = [o.mesh]
                            }
                            for (var K = 0, Q = F.length; Q > K; K += 1) {
                                var R = F[i]
                                  , T = void 0;
                                if (T = o.isExternalComponent ? R.userData.originalMatrix : o.matrix) {
                                    var k = R.matrixAutoUpdate;
                                    R.matrixAutoUpdate = !1,
                                    R.matrix.copy(T),
                                    R.applyMatrix4(new M),
                                    R.matrixAutoUpdate = k,
                                    R.updateMatrixWorld(!0),
                                    R.userData.originalMatrix = void 0
                                }
                            }
                            var D = o.wireframeMeshs;
                            if (D)
                                for (var L = 0, N = D.length; N > L; L += 1) {
                                    var O = D[L];
                                    k = O.matrixAutoUpdate,
                                    O.matrixAutoUpdate = !1,
                                    O.matrix.copy(o.matrix),
                                    O.updateMatrixWorld(!0),
                                    O.matrixAutoUpdate = k
                                }
                        }
                        if (void 0 === e && (e = !0),
                        e) {
                            if (r)
                                r.calculateBoundingBox();
                            else {
                                var V = this.externalComponentManager;
                                V && V.getNodeInfosByUserId(A) && V.calculateBoundingBox()
                            }
                            this.modelManager.updateSceneBoundingBox()
                        }
                        o.transformationOriginalMatrix = void 0,
                        o.transformationOriginalBoundingBox = void 0,
                        o.applyMatrix = void 0,
                        o.transformation = void 0
                    }
                }
            this.render()
        },
        calculateComponentVolume: function(A) {
            var e = this.modelManager.getComponent(A)
              , t = this.modelManager.getMeshByUserId(A);
            if (e && e.length > 0) {
                Bh.time("计算体积");
                for (var i = 0, o = 0, n = e.length; n > o; o += 1) {
                    var r = e[o];
                    if (r.isExternalComponent)
                        for (var a = r.mesh, s = 0, l = a.length; l > s; s += 1) {
                            var c = a[s].geometry
                              , h = Tu.calculateVolumeOfGeometry(c.attributes.position.array, c.index.array);
                            h && (i += h)
                        }
                    else if (t) {
                        var d = r.mesh || t[o].mesh;
                        if (d) {
                            var p = d.geometry
                              , g = d._indicesGroup;
                            if (g && !r.instanceOrNot)
                                for (var u = g[A], f = 0, m = u.length; m > f; f += 1) {
                                    var C = u[f]
                                      , v = Tu.calculateVolumeOfGeometry(p.attributes.position.array, p.index.array, C.indexStart, C.indexCount);
                                    v && (i += v)
                                }
                            else {
                                var I = Tu.calculateVolumeOfGeometry(p.attributes.position.array, p.index.array);
                                I && (i += I)
                            }
                        }
                    }
                }
                var E = this.getBoundingBoxByIds([A])
                  , B = new y;
                return E.getCenter(B),
                Bh.timeEnd("计算体积"),
                {
                    volume: i,
                    position: B.toArray()
                }
            }
        },
        setAxisNetColor: function(A, e) {
            var t = !1
              , i = this.modelManager;
            for (var o in i.models) {
                var n = i.models[o];
                n.axisNetManager && (n.axisNetManager.setupColor(A, e),
                t = !0)
            }
            t && this.render(!0)
        },
        showAxisNet: function() {
            var A = !1
              , e = this.modelManager;
            for (var t in e.models) {
                var i = e.models[t];
                i.axisNetManager && (i.axisNetManager.show(),
                A = !0)
            }
            A && this.render(!0)
        },
        hideAxisNet: function() {
            var A = !1
              , e = this.modelManager;
            for (var t in e.models) {
                var i = e.models[t];
                i.axisNetManager && (i.axisNetManager.hide(),
                A = !0)
            }
            A && this.render(!0)
        },
        enableAxisNetStayInFront: function() {
            var A = !1
              , e = this.modelManager;
            for (var t in e.models) {
                var i = e.models[t];
                i.axisNetManager && (i.axisNetManager.enableStayInFront(),
                A = !0)
            }
            A && this.render(!0)
        },
        disableAxisNetStayInFront: function() {
            var A = !1
              , e = this.modelManager;
            for (var t in e.models) {
                var i = e.models[t];
                i.axisNetManager && (i.axisNetManager.disableStayInFront(),
                A = !0)
            }
            A && this.render(!0)
        },
        enableSnap: function(A) {
            this.controlManager.getToolByName(Pc.PICK_BY_RECT).enableSnap(A)
        },
        pickToPoint: function(A, e) {
            return this.controlManager.control.pickHelper.pickToPoint(A, e)
        },
        getViewportSize: function() {
            return this.rendererManager.getRendererSize()
        },
        getRenderer: function() {
            return this.rendererManager.getRenderer()
        },
        getExternalComponentManager: function() {
            return this.externalComponentManager || (this.externalComponentManager = new Vy(this)),
            this.externalComponentManager
        },
        addExternalObject: function(A, e, t, i) {
            A = A || uh.createUUID();
            this.getExternalComponentManager().addNode(A, e, t, i),
            this.render()
        },
        addExternalObjects: function(A, e, t) {
            for (var i = this.getExternalComponentManager(), o = [], n = 0; A.length > n; n += 1) {
                var r = uh.createUUID();
                i.addNode(r, A[n], e, t),
                o.push(r)
            }
            return this.render(),
            o
        },
        removeExternalObjectByName: function(A) {
            this.getExternalComponentManager().removeNodeById(A),
            this.render()
        },
        clearExternalObjects: function() {
            this.getExternalComponentManager().clearNodes(),
            this.render()
        },
        getExternalObjectByName: function(A) {
            return this.getExternalComponentManager().getNodeById(A)
        },
        getAllExternalObjects: function() {
            return Object.values(this.getExternalComponentManager().getAllNodes())
        },
        getModelFloorMapsByKey: function(A, e) {
            var t = this.modelManager.models[A];
            if (t && t.floorManager) {
                if ("function" != typeof e)
                    return t.floorManager.getMimiMaps();
                t.floorManager.getServerMimiMaps(e)
            }
        },
        getReceivingPlane: function(A) {
            return this.getScene().getReceivingPlane(A)
        },
        enableShadow: function(A) {
            this.getReceivingPlane(A),
            A ? this.getScene().lightManager.enableShadowLight() : this.getScene().lightManager.disableShadowLight();
            var e = this.getRenderer();
            e.shadowMap.enabled = A,
            e.shadowMap.type = 2,
            e.shadowMap.autoUpdate = !1,
            e.shadowMap.needsUpdate = !0;
            for (var t = this.getScene().getGroups(), i = this.getScene(), o = 0; t.length > o; o += 1) {
                var n = i.getGroupType(t[o].name);
                n.groupType !== gp.IBLCUBE && ("ClipPlane" !== n.groupType && this.traverseGroupEnableShadow(t[o], A))
            }
            this.updateShadowLight()
        },
        updateShadowLight: function() {
            this.getScene().lightManager.updateShadowLight(),
            this.getRenderer().shadowMap.needsUpdate = !0,
            this._render(),
            this.rendererManager.renderer.setClearColor(0, 0),
            this._render()
        },
        traverseGroupEnableShadow: function(A, e) {
            var t = this;
            this.getRenderer();
            !function(A) {
                if (A instanceof Ue) {
                    var i = A.material;
                    if (i instanceof Array) {
                        var o = null;
                        if ("PhoneLightingMaterial" === i[0].type)
                            return;
                        A.castShadow = e,
                        A.receiveShadow = e;
                        for (var n = 0; i.length > n; n += 1)
                            i[n].needsUpdate = !0,
                            o = i[n].defines;
                        A.customDepthMaterial = e && o && o.hasOwnProperty("USE_INSTANCE") ? t.getInstanceDepthMaterial() : void 0
                    } else {
                        if ("PhoneLightingMaterial" === i.type)
                            return;
                        A.castShadow = e,
                        A.receiveShadow = e,
                        i.needsUpdate = !0;
                        var r = i.defines;
                        A.customDepthMaterial = e && r && r.hasOwnProperty("USE_INSTANCE") ? t.getInstanceDepthMaterial() : void 0,
                        i.needsUpdate = !0
                    }
                }
            }(A);
            for (var i = A.children, o = 0, n = i.length; n > o; o += 1)
                this.traverseGroupEnableShadow(i[o], e)
        },
        getInstanceDepthMaterial: function() {
            if (this.instanceDepthMaterial)
                return this.instanceDepthMaterial;
            var A = new Su;
            return A.depthPacking = 3201,
            this.instanceDepthMaterial = A,
            this.instanceDepthMaterial
        },
        updateShadowMap: function() {
            4 === vc.LightPreset && (this.getRenderer().shadowMap.needsUpdate = !0)
        },
        cloneComponent: function(A) {
            function e(A) {
                for (var e in A)
                    A.hasOwnProperty(e) && (A[e]instanceof d || A[e]instanceof ut) && (A[e] = A[e].clone(),
                    A[e].needsUpdate = !0)
            }
            var t, i = this.modelManager.getComponent(A), o = new he, n = i[0].model, r = n.materialManager, a = this.getExternalComponentManager(), s = [];
            if (i[0].isBatched && !i[0].instanceOrNot)
                !function() {
                    var A = []
                      , n = []
                      , l = []
                      , c = []
                      , h = []
                      , d = 0
                      , p = 0
                      , g = []
                      , u = 0
                      , f = !0
                      , m = !1
                      , C = void 0;
                    try {
                        for (var y, v = function() {
                            var t, i, a, f, m = y.value, C = m.index, v = m.mesh.geometry, I = m.mesh.geometry.attributes, E = I.position.array.slice(C.positionStart, C.positionStart + C.positionCount), B = I.normal.array.slice(C.positionStart, C.positionStart + C.positionCount), x = void 0;
                            if (I.uv)
                                x = I.uv.array.slice(C.positionStart / 3 * 2, (C.positionStart + C.positionCount) / 3 * 2);
                            else {
                                var S = E.length / 3 * 2;
                                (x = new Array(S)).fill(0, 0, S)
                            }
                            var w = void 0;
                            if (I.uv2)
                                w = I.uv2.array.slice(C.positionStart / 3 * 2, (C.positionStart + C.positionCount) / 3 * 2);
                            else {
                                var M = x.length;
                                (w = new Array(M)).fill(0, 0, M)
                            }
                            var b = C.positionStart / 3
                              , U = v.index.array
                              , F = C.indexCount
                              , K = m.originMId;
                            s.push(K);
                            var Q = Kd.getMaterialParameters(r.getMaterialById(K))
                              , R = Kd.createStandardMaterial(Q);
                            e(R),
                            g.push(R),
                            h.push.apply(h, yc(U.slice(C.indexStart, C.indexStart + C.indexCount).map((function(A) {
                                return A - b + p
                            }
                            )))),
                            A = (t = A).concat.apply(t, yc(E)),
                            n = (i = n).concat.apply(i, yc(B)),
                            l = (a = l).concat.apply(a, yc(x)),
                            c = (f = c).concat.apply(f, yc(w)),
                            o.groups.push({
                                start: d,
                                count: F,
                                materialIndex: u
                            }),
                            d += F,
                            p += C.positionCount / 3,
                            u += 1
                        }, I = i[Symbol.iterator](); !(f = (y = I.next()).done); f = !0)
                            v()
                    } catch (A) {
                        m = !0,
                        C = A
                    } finally {
                        try {
                            f || null == I.return || I.return()
                        } finally {
                            if (m)
                                throw C
                        }
                    }
                    o.setAttribute("position", new YA(new Float32Array(A),3)),
                    o.setAttribute("uv", new YA(new Float32Array(l),2)),
                    o.setAttribute("uv2", new YA(new Float32Array(c),2)),
                    o.setAttribute("normal", new YA(new Float32Array(n),3)),
                    o.setIndex(new YA(new Uint32Array(h),1)),
                    t = new Ue(o,g),
                    a.addExternalObject(t)
                }();
            else if (i[0].isBatched && i[0].instanceOrNot)
                !function() {
                    var i = n._handler.instancedManager.meshManager
                      , r = i.getNodeIdxMapByUserId(A)
                      , l = []
                      , c = []
                      , h = []
                      , d = []
                      , p = i.matrixInfoMapFromUserId[A][Object.keys(i.matrixInfoMapFromUserId[A])[0]][0].matrix
                      , g = 0
                      , u = 0
                      , f = 0
                      , m = []
                      , C = 0;
                    for (var y in r) {
                        var v, I, E, B = i.getInstanceGeometries(y), x = B[0].index.array;
                        if (u = B[0].index.count,
                        l = (v = l).concat.apply(v, yc(B[0].attributes.position.array)),
                        c = (I = c).concat.apply(I, yc(B[0].attributes.normal.array)),
                        B[0].attributes.uv) {
                            var S;
                            h = (S = h).concat.apply(S, yc(B[0].attributes.uv.array))
                        } else {
                            var w = 2 * u
                              , M = new Array(w);
                            M.fill(0, 0, w),
                            h = h.concat(M)
                        }
                        d = (E = d).concat.apply(E, yc(x.map((function(A) {
                            return A + g
                        }
                        )))),
                        g = l.length / 3;
                        var b = i.getMaterialIdByMeshId(y)
                          , U = i.manager.model.materialManager.getInstanceMaterialById(b)[0]
                          , F = Kd.getMaterialParameters(U)
                          , K = Kd.createStandardMaterial(F);
                        s.push(b),
                        e(K),
                        m.push(K),
                        o.groups.push({
                            start: f,
                            count: u,
                            materialIndex: C
                        }),
                        f += u,
                        C += 1
                    }
                    o.setAttribute("position", new YA(new Float32Array(l),3)),
                    o.setAttribute("uv", new YA(new Float32Array(h),2)),
                    o.setAttribute("normal", new YA(new Float32Array(c),3)),
                    o.setIndex(new YA(new Uint32Array(d),1)),
                    (t = new Ue(o,m)).applyMatrix4(p),
                    t.updateMatrixWorld(),
                    a.addExternalObject(t)
                }();
            else {
                var l = n.getModelDescriptor().getNodeInfosByComponentKey(A)[0].originMId;
                if (s = l,
                t = i[0].mesh.clone(),
                Array.isArray(l))
                    t.material = l.map((function(A) {
                        var t = r.getMaterialById(A)
                          , i = Kd.getMaterialParameters(t)
                          , o = Kd.createStandardMaterial(i);
                        return e(o),
                        o
                    }
                    ));
                else {
                    var c = r.getMaterialById(l)
                      , h = Kd.getMaterialParameters(c)
                      , p = Kd.createStandardMaterial(h);
                    e(p),
                    t.material = p
                }
                a.addExternalObject(t)
            }
            return t ? (t.byClone = !0,
            t.originMId = s,
            t.originComponentKey = A,
            t) : null
        },
        setComponentsBlink: function() {}
    }),
    Object.defineProperties(Gy.prototype, {
        renderer: {
            get: function() {
                return console.warn("EIMMODEL.ViewerImpl: .renderer 现在为 .getRenderer()"),
                this.getRenderer()
            }
        },
        composer: {
            get: function() {
                return console.warn("EIMMODEL.ViewerImpl: .composer 现在为 .rendererManager.composer"),
                this.rendererManager.composer
            }
        }
    });
    var Py = function(A) {
        var e = window.performance.timing;
        Ch.PERFORMANCE > Bh.level || Bh.warn("页面加载时间：", e.domInteractive - e.navigationStart, "ms");
        var t = mh.detectWebGL();
        if (1 === t) {
            vc.language = mh.language(),
            H.DefaultUp.set(0, 0, 1);
            var i = uh.extend({}, {
                host: "https://bos3d.bimwinner.com",
                viewport: ""
            }, A);
            this.host = i.host,
            this.viewerImpl = new Gy;
            var o = document.getElementById(i.viewport);
            o.style.position = "relative";
            var n = this;
            this.getViewerImpl().init(o),
            vc.EnableViewController && !mh.isMobileDevice() && (this.viewController = new lp(this,(function() {
                return !0
            }
            )),
            this.viewController.init(this.getViewerImpl().getDomElement()),
            this.viewController.render(),
            this.getViewerImpl().addRenderFinishedListener((function() {
                n.viewController.render()
            }
            ))),
            this.filter = this.getViewerImpl().filter,
            this.SVGRect = new tp(this),
            this.SVGRect.creatSVG(),
            this.viewport = A.viewport,
            this.viewportDiv = document.getElementById(A.viewport),
            this.getViewerImpl().modelManager.addEventListener(Rc.ON_LOAD_CONFIG_FINISH, (function(A) {
                Bh.time("模型".concat(A.modelKey, "加载时间"));
                var e = n.getViewerImpl().getBoundingBox()
                  , t = n.getViewerImpl().getModel(A.modelKey)
                  , i = t.getConfig();
                i.type !== Zc.I_MODEL && i.type !== Zc.OBJ || n.setLightIntensityFactor(1),
                op(t.dataVersion, "1.0");
                var o = e.getCenter(new y)
                  , r = e.getSize(new y)
                  , a = new y(o.x + r.x,o.y + r.y,o.z + r.z);
                n.originalView && vc.UserControlView ? n.viewerImpl.lookAt(n.originalView.position, n.originalView.target, n.originalView.up) : (n.viewerImpl.lookAt(a, o, n.viewerImpl.camera.up),
                n.setOriginalView(a, o, n.viewerImpl.camera.up))
            }
            )),
            this.getViewerImpl().modelManager.addEventListener(Rc.ON_LOAD_PROGRESS, (function(A) {
                Bh.log(A.progress)
            }
            )),
            this.getViewerImpl().modelManager.addEventListener(Rc.ON_LOAD_COMPLETE, (function(A) {
                Bh.log(A.modelKey, " is load "),
                Bh.timeEnd("模型".concat(A.modelKey, "加载时间"));
                var e = n.getViewerImpl().getModel(A.modelKey);
                for (var t in e.floorManager && vc.EnableCreateMiniMap && (Bh.time("小地图生成"),
                e.floorManager.generateMiniMap(n.getViewerImpl()),
                Bh.timeEnd("小地图生成")),
                e && e.getConfig() && n.getViewerImpl().cameraControl.setSceneUnit(e.getConfig().lengthUnit),
                bc)
                    if (e && bc.hasOwnProperty(t) && !0 === bc[t]) {
                        var i = t
                          , o = e.getComponentKeysByType(i)
                          , r = e.getConfig()
                          , a = [];
                        !r || r.type !== Zc.RVT && r.type !== Zc.MERGE || (a = e.getComponentKeysByProperty("buildInCategory", i)),
                        n.deactivateComponentsByKey(o.concat(a))
                    }
                n.getViewerImpl().getBoundingBox().isEmpty() && (n.getViewerImpl().zoomAll(),
                n.getViewerImpl().goToInitialView())
            }
            )),
            this.getViewerImpl().modelManager.addEventListener(Rc.ON_CLICK_PICK, (function(A) {
                if (A.intersectInfo) {
                    Bh.log("构件key", A.intersectInfo.selectedObjectId);
                    var e = A.intersectInfo.object;
                    e && Bh.log(e)
                }
            }
            )),
            this.getViewerImpl().getControlManager().addEventListener(Rc.ON_CONTROL_EXIST, (function(A) {
                if (A.name === Pc.CLIP_BY_BOX)
                    for (var e = n.getViewerImpl().modelManager.getModelKeys(), t = 0, i = e.length; i > t; t += 1) {
                        var o = n.getViewerImpl().modelManager.getModel(e[t]);
                        if (o)
                            for (var r = 0; 6 > r; r += 1) {
                                o._getNodeGroup("sectionFill_" + r).clear()
                            }
                    }
            }
            )),
            this.viewerImpl.modelManager.addEventListener(Rc.ON_CONTROL_UPDATEUI, (function(A) {
                n.SVGRect.creatRect(A)
            }
            ))
        } else
            mh.showWebGLMessage(t)
    };
    Object.assign(Py.prototype, Ld.prototype),
    Object.assign(Py.prototype, {
        constructor: Py,
        addView: function(A, e, t, i) {
            this.getViewerImpl().load({
                serverUrl: this.host,
                modelKey: A,
                dbName: e,
                token: t,
                share: i || "",
                notifyProgress: !0,
                type: A.startsWith("G") ? "GIS" : ""
            })
        },
        addViews: function(A, e, t, i) {
            vc.AutoMergeComponent = !1,
            vc.MergeComponent = !0,
            this.getViewerImpl().load({
                serverUrl: this.host,
                modelKey: A,
                modelKeys: e,
                dbName: t,
                token: i,
                notifyProgress: !0
            })
        },
        addTilesView: function(A, e, t) {
            this.getViewerImpl().loadTiles({
                serverUrl: this.host,
                modelKey: A,
                dbName: e,
                token: t,
                notifyProgress: !0
            })
        },
        addTilesViewFromLocal: function(A) {
            this.getViewerImpl().loadTiles({
                serverUrl: ".",
                modelKey: A,
                dbName: "",
                token: "",
                notifyProgress: !0,
                offLine: !0
            })
        },
        getSSE: function(A) {
            var e = this.getBoxByComponentsKey(A)
              , t = this.viewerImpl.camera
              , i = e.getCenter(new y)
              , o = e.getSize().length()
              , n = this.viewerImpl.getRenderer().domElement.width
              , r = t.fov;
            return o * n / (2 * t.position.clone().sub(i).length() * Math.tan(r / 2))
        },
        removeView: function(A) {
            return this.getViewerImpl().unload(A)
        },
        removeAllView: function() {
            this.getViewerImpl().unloadAll()
        },
        addViewFromLocal: function(A) {
            this.getViewerImpl().load({
                serverUrl: ".",
                modelKey: A,
                dbName: "",
                notifyProgress: !0,
                offLine: !0
            })
        },
        loadComponents: function(A, e, t, i) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().loadGeopkOnDemand(A, e, t, i)
        },
        unloadCompomemts: function(A, e) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().unloadGeopkOnDemand(A, e)
        },
        getOriginalView: function() {
            return this.originalView
        },
        setOriginalView: function(A, e, t) {
            A && e && t ? (this.originalView || (this.originalView = {}),
            this.originalView.position = Array.isArray(A) ? new y(A[0],A[1],A[2]) : new y(A.x,A.y,A.z),
            this.originalView.target = Array.isArray(e) ? new y(e[0],e[1],e[2]) : new y(e.x,e.y,e.z),
            this.originalView.up = Array.isArray(t) ? new y(t[0],t[1],t[2]) : new y(t.x,t.y,t.z)) : this.originalView = void 0
        },
        getViewerImpl: function() {
            return this.viewerImpl
        },
        getAllComponents: function() {
            return this.getViewerImpl().getModelManager().getAllComponents()
        },
        getAllComponentsKey: function() {
            return this.getViewerImpl().getModelManager().getAllComponentsKey()
        },
        getComponentsKeyByModelKey: function(A) {
            return this.getViewerImpl().getModelManager().getComponentsKeyByModelKey(A)
        },
        getComponentKeysByName: function(A) {
            return this.getViewerImpl().getModelManager().getComponentKeysByName(A)
        },
        getComponentKeysByType: function(A) {
            return this.getViewerImpl().getModelManager().getComponentKeysByType(A)
        },
        getComponentKeysByProperty: function(A, e) {
            return this.getViewerImpl().getModelManager().getComponentKeysByProperty(A, e)
        },
        getScreenCoordFromSceneCoordAndCheckCover: function(A) {
            return this.getViewerImpl().getScreenCoordFromSceneCoordAndCheckCover(A)
        },
        pickByPoint: function(A) {
            return this.getViewerImpl().pickByPoint(A)
        },
        calculateMinDistance: function(A, e) {
            return this.getViewerImpl().calculateMinDistance(A, e)
        },
        otherObjectsInScene: function(A) {},
        getComponentsByKey: function(A) {
            Array.isArray(A) || (A = [A]);
            var e = []
              , t = this;
            return A.forEach((function(A) {
                var i = t.getViewerImpl().modelManager.getComponent(A);
                if (i) {
                    var o = {};
                    o[A] = i,
                    e.push(o)
                }
            }
            )),
            e
        },
        getModelFloorMapsByKey: function(A, e) {
            var t = this.getViewerImpl().getModel(A);
            if (!t)
                return {
                    msg: "没有此模型"
                };
            var i = t.getConfig().type;
            return i !== Zc.RVT && i !== Zc.IFC && i !== Zc.MERGE ? {
                msg: "该模型不支持小地图"
            } : t.floorManager ? this.getViewerImpl().getModelFloorMapsByKey(A, e) : {
                msg: "该模型不支持小地图"
            }
        },
        showComponentsById: function(A, e) {
            Array.isArray(A) || (A = [A]);
            for (var t = [], i = 0; A.length > i; i += 1)
                t[i] = e + "_" + A[i];
            this.getViewerImpl().getFilter().showByIds(t),
            this.render()
        },
        showComponentsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().getFilter().showByIds(A),
            this.render()
        },
        hideComponentsById: function(A, e) {
            Array.isArray(A) || (A = [A]);
            for (var t = [], i = 0; A.length > i; i += 1)
                t[i] = e + "_" + A[i];
            this.filter.hideByIds(t),
            this.render()
        },
        hideComponentsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.filter.hideByIds(A),
            this.render()
        },
        activateComponentsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.filter.activateByIds(A),
            this.render()
        },
        deactivateComponentsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.filter.deactivateByIds(A),
            this.render()
        },
        hideAllComponents: function() {
            this.getViewerImpl().getFilter().hideAll(),
            this.render()
        },
        showAllComponents: function() {
            this.getViewerImpl().getFilter().showAll(),
            this.render()
        },
        highlightComponentsById: function(A, e) {
            Array.isArray(A) || (A = [A]);
            for (var t = [], i = 0; A.length > i; i += 1)
                t[i] = e + "_" + A[i];
            this.getViewerImpl().setSelection(t),
            this.render()
        },
        highlightComponentsByKey: function(A, e) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().setSelection(A);
            var t = e;
            "boolean" != typeof e && (t = !0),
            t && this.render()
        },
        addHighlightComponentsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().addToSelection(A),
            this.render()
        },
        closeHighlightComponentsById: function(A, e) {
            Array.isArray(A) || (A = [A]);
            for (var t = [], i = 0; A.length > i; i += 1)
                t[i] = e + "_" + A[i];
            this.getViewerImpl().removeFromSelection(t),
            this.render()
        },
        closeHighlightComponentsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().removeFromSelection(A),
            this.render()
        },
        getHighlightComponentsKey: function() {
            return this.getViewerImpl().getSelection()
        },
        clearHighlightList: function() {
            this.getViewerImpl().clearSelection(),
            this.render()
        },
        getHighlightComponents: function() {
            var A = this.getHighlightComponentsKey()
              , e = []
              , t = this;
            return A.forEach((function(A) {
                var i = t.getViewerImpl().modelManager.getComponent(A);
                if (i) {
                    var o = {};
                    o[A] = i,
                    e.push(o)
                }
            }
            )),
            e
        },
        setComponentsOpacityState: function(A, e) {
            Array.isArray(A) || (A = [A]),
            e === Oc.TRANSLUCENT ? this.transparentComponentsByKey(A) : e === Oc.OPAQUE && this.closeTransparentComponentsByKey(A)
        },
        transparentComponentsById: function(A, e) {
            Array.isArray(A) || (A = [A]);
            for (var t = [], i = 0; A.length > i; i += 1)
                t[i] = e + "_" + A[i];
            this.getViewerImpl().getFilter().makeTranslucentByIds(t),
            this.render()
        },
        transparentComponentsByKey: function(A, e) {
            Array.isArray(A) || (A = [A]);
            var t = this.getViewerImpl().getFilter();
            if (e) {
                var i = this.getComponentsByKey(A);
                if (Array.isArray(A) && i.length !== A.length) {
                    i = [];
                    var o = !0
                      , n = !1
                      , r = void 0;
                    try {
                        for (var a, s = A[Symbol.iterator](); !(o = (a = s.next()).done); o = !0) {
                            var l = this.getComponentsByKey(a.value);
                            l.length > 0 && i.push(l[0])
                        }
                    } catch (A) {
                        n = !0,
                        r = A
                    } finally {
                        try {
                            o || null == s.return || s.return()
                        } finally {
                            if (n)
                                throw r
                        }
                    }
                }
                t.transparentComponentsByKey(this.getViewerImpl().getModelManager(), i, e)
            } else
                t.makeTranslucentByIds(A);
            this.render()
        },
        transparentOtherComponentsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().getFilter().makeTranslucentOthersByIds(A),
            this.render()
        },
        transparentAllComponents: function() {
            this.getViewerImpl().getFilter().makeTranslucentOthersByIds([]),
            this.render()
        },
        closeTransparentComponentsById: function(A, e) {
            Array.isArray(A) || (A = [A]);
            for (var t = [], i = 0; A.length > i; i += 1)
                t[i] = e + "_" + A[i];
            this.getViewerImpl().getFilter().opaqueByIds(t),
            this.render()
        },
        closeTransparentComponentsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().getFilter().opaqueByIds(A),
            this.render()
        },
        clearTransparentList: function() {
            this.clearComponentTransparentList(),
            this.clearModelTransparentList()
        },
        clearComponentTransparentList: function() {
            var A = this.getViewerImpl().getFilter();
            A.opaqueAll(),
            A.opaqueByIds([]),
            this.render()
        },
        colorfulComponentsById: function(A, e, t, i) {
            Array.isArray(A) || (A = [A]);
            for (var o = [], n = 0; A.length > n; n += 1)
                o[n] = e + "_" + A[n];
            var r = this.getViewerImpl().getFilter()
              , a = {};
            a.color = t,
            "number" == typeof i && (a.opacity = i),
            r.addToOverrideListByColor(o, a),
            this.render()
        },
        colorfulComponentsByKey: function(A, e, t) {
            Array.isArray(A) || (A = [A]);
            var i = this.getViewerImpl().getFilter()
              , o = {};
            o.color = e,
            "number" == typeof t && (o.opacity = t),
            i.addToOverrideListByColor(A, o),
            this.render()
        },
        setComponentsMaterialByKey: function(A, e, t, i) {
            var o = this.getComponentsByKey(A);
            if (Array.isArray(e)) {
                var n = 0
                  , r = !0
                  , a = !1
                  , s = void 0;
                try {
                    for (var l, c = e[Symbol.iterator](); !(r = (l = c.next()).done); r = !0) {
                        var h = l.value;
                        "" === h.name && (h.name = "custMat_" + (new Date).getTime() + "_" + n,
                        n += 1)
                    }
                } catch (A) {
                    a = !0,
                    s = A
                } finally {
                    try {
                        r || null == c.return || c.return()
                    } finally {
                        if (a)
                            throw s
                    }
                }
            } else
                "" === e.name && (e.name = "custMat_" + (new Date).getTime());
            var d = this.getViewerImpl().getFilter().addToOverrideListByCustomerMaterial(this.getViewerImpl().getModelManager(), o, e, t, i);
            return this.render(),
            d
        },
        closeMaterialByKey: function(A) {
            var e = this;
            Array.isArray(A) ? A.forEach((function(A) {
                var t = e.getComponentsByKey(A)[0][A][0];
                if (!t.isBatched && !t.instanceOrNot && !t.RenderTypeChange) {
                    var i = t.originMId;
                    e.getComponentsByKey(A)[0][A][0].materialId = Array.isArray(i) ? [].concat(i) : i
                }
                e.closeColorfulComponentsByKey(A)
            }
            )) : this.closeColorfulComponentsByKey(A)
        },
        closeColorfulComponentsById: function(A, e) {
            Array.isArray(A) || (A = [A]);
            for (var t = [], i = 0; A.length > i; i += 1)
                t[i] = e + "_" + A[i];
            this.getViewerImpl().getFilter().addToOverrideListByColor(t, null),
            this.render()
        },
        closeColorfulComponentsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().getFilter().addToOverrideListByColor(A, null),
            this.render()
        },
        clearColorfulList: function() {
            this.getViewerImpl().getFilter().clearAllOverrideList(),
            this.render()
        },
        wireFrameComponentsById: function(A, e) {
            Array.isArray(A) || (A = [A]);
            for (var t = [], i = 0; A.length > i; i += 1)
                t[i] = e + "_" + A[i];
            this.getViewerImpl().getFilter().addToWireframeByWireframe(t, {
                wireframe: !0
            }),
            this.render()
        },
        wireFrameComponentsByKey: function(A) {
            Array.isArray(A) || (A = [A]);
            this.getViewerImpl().getFilter().addToWireframeByWireframe(A, {
                wireframe: !0
            }),
            this.render()
        },
        closeWireFrameComponentsById: function(A, e) {
            Array.isArray(A) || (A = [A]);
            for (var t = [], i = 0; A.length > i; i += 1)
                t[i] = e + "_" + A[i];
            this.getViewerImpl().getFilter().addToWireframeByWireframe(t, null),
            this.render()
        },
        closeWireFrameComponentsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().getFilter().addToWireframeByWireframe(A, null),
            this.render()
        },
        clearWireframeList: function() {
            this.getViewerImpl().getFilter().clearAllWireframeList(),
            this.render()
        },
        isolateComponentsById: function(A, e, t) {
            Array.isArray(A) || (A = [A]);
            for (var i = [], o = 0; A.length > o; o += 1)
                i[o] = e + "_" + A[o];
            this.getViewerImpl().getFilter().setIsolateList(i, !1 !== t),
            this.render()
        },
        isolateComponentsByKey: function(A, e) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().getFilter().setIsolateList(A, !1 !== e),
            this.render()
        },
        closeIsolateComponentsById: function(A, e) {
            Array.isArray(A) || (A = [A]);
            for (var t = [], i = 0; A.length > i; i += 1)
                t[i] = e + "_" + A[i];
            this.getViewerImpl().getFilter().removeFromIsolateList(t),
            this.render()
        },
        closeIsolateComponentsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().getFilter().removeFromIsolateList(A),
            this.render()
        },
        clearIsolation: function() {
            this.getViewerImpl().getFilter().clearIsolation()
        },
        showModelsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().getFilter().showModelByIds(A),
            this.render()
        },
        hideModelsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.filter.hideModelByIds(A),
            this.render()
        },
        hideAllModels: function() {
            this.getViewerImpl().getFilter().hideAllModel(),
            this.render()
        },
        showAllModels: function() {
            this.getViewerImpl().getFilter().showAllModel(),
            this.render()
        },
        highlightModelsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().setModelSelection(A),
            this.render()
        },
        addHighlightModelsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().addToModelSelection(A),
            this.render()
        },
        closeHighlightModelsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().removeFromModelSelection(A),
            this.render()
        },
        getHighlightModelsKey: function() {
            return this.getViewerImpl().getModelSelection()
        },
        clearModelHighlightList: function() {
            this.getViewerImpl().clearModelSelection(),
            this.render()
        },
        transparentModelsByKey: function(A, e, t) {
            var i = this;
            Array.isArray(A) || (A = [A]),
            this.closeTransparentModelsByKey(A);
            var o = this.getViewerImpl().getFilter();
            e ? A.forEach((function(A) {
                o.transparentModelOrigMatByKey(i.getViewerImpl().getModelManager(), A, t)
            }
            )) : o.makeModelTranslucentByIds(A),
            this.render()
        },
        transparentOtherModelsByKey: function(A, e, t) {
            Array.isArray(A) || (A = [A]);
            for (var i = Object.keys(this.viewerImpl.modelManager.models), o = [], n = 0; i.length > n; n++) {
                var r = i[n];
                A.includes(r) || o.push(r)
            }
            (this.closeTransparentModelsByKey(o),
            e) ? this.transparentModelsByKey(o, e, t) : this.getViewerImpl().getFilter().makeTranslucentOthersModelByIds(A);
            this.render()
        },
        transparentAllModels: function(A, e) {
            if (this.clearModelTransparentList(),
            A) {
                var t = Object.keys(this.viewerImpl.modelManager.models);
                this.transparentModelsByKey(t, A, e)
            } else {
                this.getViewerImpl().getFilter().makeTranslucentOthersModelByIds([])
            }
            this.render()
        },
        closeTransparentModelsByKey: function(A) {
            var e = this
              , t = this.getViewerImpl().getFilter();
            Array.isArray(A) || (A = [A]),
            A.forEach((function(A) {
                t.closeOrigMatModelTransparent(e.viewerImpl.modelManager, A)
            }
            )),
            t.opaqueModelByIds(A),
            this.render()
        },
        clearModelTransparentList: function() {
            var A = this
              , e = this.getViewerImpl().getFilter();
            Object.keys(this.viewerImpl.modelManager.models).forEach((function(t) {
                e.closeOrigMatModelTransparent(A.viewerImpl.modelManager, t)
            }
            )),
            e.opaqueAllModel(),
            e.opaqueModelByIds([]),
            this.render()
        },
        colorfulModelsByKey: function(A, e, t) {
            Array.isArray(A) || (A = [A]);
            var i = this.getViewerImpl().getFilter()
              , o = {};
            o.color = e,
            "number" == typeof t && (o.opacity = t),
            i.addToModelOverrideListByColor(A, o),
            this.render()
        },
        closeColorfulModelsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().getFilter().addToModelOverrideListByColor(A, null),
            this.render()
        },
        clearModelColorfulList: function() {
            this.getViewerImpl().getFilter().clearModelAllOverrideList(),
            this.render()
        },
        isolateModelsByKey: function(A, e) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().getFilter().setModelIsolateList(A, !1 !== e),
            this.render()
        },
        closeIsolateModelsByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.getViewerImpl().getFilter().removeModelFromIsolateList(A),
            this.render()
        },
        clearModelIsolation: function() {
            this.getViewerImpl().getFilter().clearModelIsolation(),
            this.render()
        },
        setModelMatrix: function(A, e) {
            this.getViewerImpl().setModelMatrix(e, A)
        },
        getModelMatrix: function(A) {
            return this.getViewerImpl().getModelMatrix(A)
        },
        disableComponentsSelectionByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.filter.addToFrozenList(A)
        },
        enableComponentsSelectionByKey: function(A) {
            Array.isArray(A) || (A = [A]),
            this.filter.removeFromFrozenList(A)
        },
        clearDisableSelectionList: function() {
            this.filter.clearFrozen()
        },
        overturnYAndZaxis: function(A) {
            this.getViewerImpl().overturnYAndZaxis(A),
            this.render()
        },
        translateModel: function(A) {
            this.getViewerImpl().translateModel(A)
        },
        rotateModel: function(A) {
            this.getViewerImpl().rotateModel(A)
        },
        scaleModel: function(A) {
            this.getViewerImpl().scaleModel(A)
        },
        modelsExplosion: function(A) {
            for (var e = {
                modelKey: [],
                coefficientX: 1,
                coefficientY: 1,
                coefficientZ: 1,
                center: this.getViewerImpl().getScene().getBoundingBoxWorld().getCenter(new y).toArray()
            }, t = uh.extend(!0, {}, e, A), i = Array.isArray(t.modelKey) ? t.modelKey : [t.modelKey], o = 0; i.length > o; o += 1) {
                var n = this.getViewerImpl().getModel(i[o]);
                n && n.explosion(t)
            }
            this.getViewerImpl().getModelManager().updateSceneBoundingBox(),
            this.render()
        },
        closeModelsExplosion: function(A) {
            var e = Array.isArray(A) ? A : [A];
            this.modelsExplosion({
                modelKey: e
            }),
            this.render()
        },
        componentsExplosion: function(A) {
            var e = {
                componentKey: [],
                coefficientX: 1,
                coefficientY: 1,
                coefficientZ: 1,
                offsetX: 0,
                offsetY: 0,
                offsetZ: 0,
                center: this.getViewerImpl().getScene().getBoundingBoxWorld().getCenter(new y).toArray()
            }
              , t = uh.extend(!0, {}, e, A)
              , i = this.getViewerImpl().getModelManager();
            i.componentsExplosion(t),
            i.updateSceneBoundingBox(),
            this.render()
        },
        closeComponentsExplosion: function(A) {
            var e = Array.isArray(A) ? A : [A];
            this.getViewerImpl().getModelManager().componentsExplosion({
                componentKey: e
            }),
            this.render()
        },
        canFloorExplosion: function() {
            return this.getViewerImpl().getModelManager().canFloorExplosion()
        },
        floorExplosion: function(A) {
            return !!this.getViewerImpl().getModelManager().floorExplosion(A) && (this.render(),
            !0)
        },
        closeFloorExplosion: function() {
            var A = this.getViewerImpl().getModelManager();
            A.closeFloorExplosion(),
            A.updateSceneBoundingBox(),
            this.render()
        },
        componentApplyMatrix: function(A, e) {
            return !(!e || !e.isMatrix4) && (this.getViewerImpl().componentApplyMatrix2(A, e),
            this.render(),
            !0)
        },
        getMatrix4FromEuler: function(A, e, t) {
            var i = 0
              , o = 0
              , n = 0;
            Array.isArray(A) ? (i = A[0],
            o = A[1],
            n = A[2]) : (i = A.x,
            o = A.y,
            n = A.z);
            var r = e || [0, 0, 0]
              , a = 0
              , s = 0
              , l = 0;
            Array.isArray(r) ? (a = r[0],
            s = r[1],
            l = r[2]) : (a = r.x,
            s = r.y,
            l = r.z);
            var c = new M;
            c.setPosition(-a, -s, -l);
            var h = new M
              , d = new F(i,o,n,t || "XYZ");
            h.makeRotationFromEuler(d);
            var p = new M;
            return p.setPosition(a, s, l),
            p.multiply(h).multiply(c),
            p
        },
        isolateComponentsByIdForJDS: function(A, e) {
            Array.isArray(A) || (A = [A]);
            for (var t = [], i = 0; A.length > i; i += 1)
                t[i] = e + "_" + A[i];
            this.filter.addToIsolateList(Nc.HIDDEN_OTHERS, t);
            for (var o = this.getViewerImpl().modelManager.getScene().pool._pool, n = 0; o.length > n; n += 1) {
                o[n].visible = !1;
                for (var r = 0; t.length > r; r += 1)
                    o[n].key === t[r] && (o[n].visible = !0)
            }
            return this.render(),
            !0
        },
        sortComponentsById: function(A, e, t) {
            Array.isArray(A) || (A = [A]);
            for (var i = this.getViewerImpl().getModel(e), o = [], n = 0; A.length > n; n += 1)
                o[n] = e + "_" + A[n];
            return i ? i.getComponentKeysByTypeFromList(o, t) : []
        },
        sortComponentsByKey: function(A, e) {
            return Array.isArray(A) || (A = [A]),
            this.getViewerImpl().modelManager.getComponentKeysByTypeFromList(A, e)
        },
        conditionSortComponentsById: function(A, e, t, i, o) {
            var n = this.filter.setConditions(A, e);
            Array.isArray(t) || (t = [t]);
            for (var r = [], a = 0; t.length > a; a += 1)
                r[a] = i + "_" + t[a];
            var s = this.getComponentsByKey(r)
              , l = [];
            if (null !== n)
                switch (A) {
                case 0:
                    for (var c = 0; s.length > c; c += 1)
                        n.match(s[c]) && l.push(s[c].key);
                    this.isolateComponentsByKey(l);
                    break;
                case 1:
                    for (var h = 0; s.length > h; h += 1)
                        n.match(s[h]) && l.push(s[h].key);
                    var d = this.otherObjectsInScene(l);
                    this.transparentComponentsByKey(d, .5, !1);
                    break;
                case 2:
                    for (var p = 0; s.length > p; p += 1)
                        null !== n.getMatchItem(s[p]) && l.push(s[p].key);
                    !0 === o.highLight ? this.highlightComponentsByKey(l) : this.colorfulComponentsByKey(l, o.color)
                }
            return l
        },
        conditionSortComponentsByKey: function(A, e, t, i) {
            var o = this.filter.setConditions(A, e);
            Array.isArray(t) || (t = [t]);
            var n = this.getComponentsByKey(t)
              , r = [];
            if (null !== o)
                switch (A) {
                case 0:
                    for (var a = 0; n.length > a; a += 1)
                        o.match(n[a]) && r.push(n[a].key);
                    this.isolateComponentsByKey(r);
                    break;
                case 1:
                    for (var s = 0; n.length > s; s += 1)
                        o.match(n[s]) && r.push(n[s].key);
                    var l = this.otherObjectsInScene(r);
                    this.transparentComponentsByKey(l, .5, !1);
                    break;
                case 2:
                    for (var c = 0; n.length > c; c += 1)
                        null !== o.getMatchItem(n[c]) && r.push(n[c].key);
                    !0 === i.highLight ? this.highlightComponentsByKey(r) : this.colorfulComponentsByKey(r, i.color)
                }
            return r
        },
        resetScene: function(A) {
            if (A = A || {},
            this.getViewerImpl().getModelManager().dispatchEvent({
                type: Rc.BEFORE_RESETSCENE,
                data: A
            }),
            uh.isEmptyObject(A)) {
                this.clearIsolation(),
                this.clearModelIsolation(),
                this.clearHighlightList(),
                this.clearModelHighlightList(),
                this.showAllComponents(),
                this.showAllModels(),
                this.clearWireframeList(),
                this.clearTransparentList(),
                this.clearModelTransparentList(),
                this.clearColorfulList(),
                this.clearModelColorfulList();
                var e = this.viewerImpl.modelManager.scene.getBoundingBox()
                  , t = e.getCenter(new y)
                  , i = e.getSize(new y)
                  , o = new y(t.x + i.x,t.y + i.y,t.z + i.z);
                this.originalView ? this.viewerImpl.lookAt(this.originalView.position, this.originalView.target, this.originalView.up) : this.viewerImpl.lookAt(o, t, new y(0,0,1))
            } else if (A.visible && (this.clearIsolation(),
            this.clearModelIsolation(),
            this.showAllComponents(),
            this.showAllModels()),
            A.selected && (this.clearHighlightList(),
            this.clearModelHighlightList()),
            A.transparent && (this.clearTransparentList(),
            this.clearModelTransparentList()),
            A.wireframed && this.clearWireframeList(),
            A.colorfully && (this.clearColorfulList(),
            this.clearModelColorfulList()),
            A.view)
                if (this.originalView)
                    this.viewerImpl.lookAt(this.originalView.position, this.originalView.target, this.originalView.up);
                else {
                    var n = this.viewerImpl.modelManager.scene.getBoundingBox()
                      , r = n.getCenter(new y)
                      , a = n.getSize(new y)
                      , s = new y(r.x + a.x,r.y + a.y,r.z + a.z);
                    this.viewerImpl.lookAt(s, r, new y(0,0,1))
                }
            this.getViewerImpl().getModelManager().dispatchEvent({
                type: Rc.AFTER_RESETSCENE,
                data: A
            }),
            this.render()
        },
        getScreenCoordFromSceneCoord: function(A) {
            return this.getViewerImpl().getScreenCoordFromSceneCoord(A)
        },
        getWorldPositionFromLocalPositionByModelKey: function(A, e) {
            var t = this.getModelMatrix(e);
            if (t) {
                if (A.isVector3) {
                    var i = A.clone();
                    return i.applyMatrix4(t),
                    i.toArray()
                }
                if (Array.isArray(A)) {
                    var o = (new y).fromArray(A);
                    return o.applyMatrix4(t),
                    o.toArray()
                }
            } else
                Bh.error("模型key无效")
        },
        getLocalPositionFromWorldPositionByModelKey: function(A, e) {
            var t = this.getModelMatrix(e);
            if (t) {
                var i = (new M).getInverse(t);
                if (A.isVector3) {
                    var o = A.clone();
                    return o.applyMatrix4(i),
                    o.toArray()
                }
                if (Array.isArray(A)) {
                    var n = (new y).fromArray(A);
                    return n.applyMatrix4(i),
                    n.toArray()
                }
            } else
                Bh.error("模型key无效")
        },
        getWorldPositionListFromLocalPositionListByModelKey: function(A, e) {
            var t = this.getModelMatrix(e);
            if (t) {
                for (var i = [], o = 0, n = A.length; n > o; o += 1) {
                    var r = A[o];
                    if (r.isVector3) {
                        var a = r.clone();
                        a.applyMatrix4(t),
                        i.push(a.toArray())
                    } else if (Array.isArray(r)) {
                        var s = (new y).fromArray(r);
                        s.applyMatrix4(t),
                        i.push(s.toArray())
                    }
                }
                return i
            }
            Bh.error("模型key无效")
        },
        getLocalPositionListFromWorldPositionListByModelKey: function(A, e) {
            var t = this.getModelMatrix(e);
            if (t) {
                for (var i = (new M).getInverse(t), o = [], n = 0, r = A.length; r > n; n += 1) {
                    var a = A[n];
                    if (a.isVector3) {
                        var s = a.clone();
                        s.applyMatrix4(i),
                        o.push(s.toArray())
                    } else if (Array.isArray(a)) {
                        var l = (new y).fromArray(a);
                        l.applyMatrix4(i),
                        o.push(l.toArray())
                    }
                }
                return o
            }
            Bh.error("模型key无效")
        },
        getWorldPositionArrayFromLocalPositionArrayByModelKey: function(A, e) {
            var t = this.getModelMatrix(e);
            if (t) {
                for (var i = [], o = 0, n = A.length; n > o; o += 3) {
                    var r = (new y).fromArray(A, o);
                    r.applyMatrix4(t),
                    i.push.apply(i, yc(r.toArray()))
                }
                return i
            }
            Bh.error("模型key无效")
        },
        getLocalPositionArrayFromWorldPositionArrayByModelKey: function(A, e) {
            var t = this.getModelMatrix(e);
            if (t) {
                for (var i = (new M).getInverse(t), o = [], n = 0, r = A.length; r > n; n += 3) {
                    var a = (new y).fromArray(A, n);
                    a.applyMatrix4(i),
                    o.push.apply(o, yc(a.toArray()))
                }
                return o
            }
            Bh.error("模型key无效")
        },
        render: function() {
            this.getViewerImpl().render()
        },
        syncRender: function() {
            this.getViewerImpl()._render()
        },
        resize: function(A, e) {
            this.getViewerImpl().resize(A, e)
        },
        autoResize: function() {
            this.getViewerImpl().resize(window.innerWidth - 5, window.innerHeight - 5)
        },
        setSceneBackGroundColor: function(A, e) {
            this.getViewerImpl().setBackgroundColor(new Xh(A,e))
        },
        resetSceneBackgroundColor: function() {
            this.getViewerImpl().resetBackgroundColor()
        },
        getComponentsAttributeById: function(A, e, t) {
            this.getComponentsAttributeByKey(e + "_" + A, t)
        },
        getComponentsAttributeByKey: function(A, e) {
            var t = this.getViewerImpl().getModelByComponentKey(A);
            if (t) {
                if (t.offLine) {
                    if (t.attributes && t.attributes[A])
                        return void e({
                            attribute: t.attributes[A]
                        });
                    e(null)
                }
                _d({
                    type: "GET",
                    url: (t.loader.url.serverUrl || this.host) + "/api/" + t.projectKey + "/components?componentKey=" + A + ("" === t.shareKey ? "" : "&share=" + t.shareKey),
                    headers: {
                        Authorization: t.accessToken
                    },
                    success: function(A) {
                        try {
                            A = JSON.parse(A)
                        } catch (A) {
                            Bh.log("解析属性失败")
                        }
                        e("SUCCESS" === A.code ? A.data : null)
                    },
                    error: function(A) {
                        e(null)
                    }
                })
            } else
                e(null)
        },
        mergeMesh: function(A, e) {
            var t = this.getViewerImpl().modelManager.getModel(e);
            if (!t)
                return null;
            var i = new ep("mergeGroup");
            i.modelKey = e;
            for (var o = new he, n = [], r = [], a = [], s = [], l = [], c = [], h = t.cache, d = [], p = [], g = null, u = 0, f = 0; A.length > f; f += 1)
                if (t.cache.components.hasOwnProperty(A)) {
                    u += 1;
                    var m = {}
                      , C = r.length
                      , y = n.length / 3;
                    m.start = C;
                    var v = l.length
                      , I = t.cache.components[A]
                      , E = h.geometries[I.geoId];
                    if (!E)
                        continue;
                    var B = E.clone()
                      , x = new M;
                    x.fromArray(I.matrix);
                    var S = B.attributes;
                    B.applyMatrix(x);
                    for (var w = 0; S.position.array.length > w; w += 1)
                        n.push(S.position.array[w]);
                    for (var b = 0; S.normal.array.length > b; b += 1)
                        s.push(S.normal.array[b]);
                    if (S.uv)
                        for (var U = 0; S.uv.array.length > U; U += 1)
                            a.push(S.uv.array[U]);
                    for (var F = 0; B.index.array.length > F; F += 1)
                        r.push(B.index.array[F] + y);
                    if (B.groups.length > 0)
                        for (var K = 0; B.groups.length > K; K += 1) {
                            var Q = {};
                            Q.start = B.groups[K].start + C,
                            Q.count = B.groups[K].count,
                            -1 !== B.groups[K].materialIndex && (Q.materialIndex = B.groups[K].materialIndex + v),
                            c.push(Q)
                        }
                    else {
                        var R = {};
                        R.start = C,
                        R.count = B.index.count,
                        R.materialIndex = v,
                        c.push(R)
                    }
                    var T = h.materials[I.matId];
                    if (!T)
                        continue;
                    for (F = 0; T.materials.length > F; F += 1)
                        l.push(T.materials[F]);
                    if (m.end = r.length / 3,
                    m.guid = I.guid,
                    u > vc.MaxMergeCount) {
                        if (u = 0,
                        o.setAttribute("position", new YA(new Float32Array(n),3)),
                        o.setAttribute("normal", new YA(new Float32Array(s),3)),
                        o.setAttribute("uv", new YA(new Float32Array(a),2)),
                        d = [],
                        Array.fill)
                            d = Array(n.length).fill(1);
                        else
                            for (var k = 0; n.length > k; k += 1)
                                d.push(1);
                        p = new Float32Array(d),
                        o.setAttribute("color", new YA(p,3,!0)),
                        o.setIndex(r),
                        o.groups = c,
                        g = new Ue(o,l),
                        i.add(g),
                        o = new he,
                        n = [],
                        r = [],
                        a = [],
                        s = [],
                        l = [],
                        c = []
                    }
                }
            if (o.setAttribute("position", new YA(new Float32Array(n),3)),
            o.setAttribute("normal", new YA(new Float32Array(s),3)),
            o.setAttribute("uv", new YA(new Float32Array(a),2)),
            d = [],
            Array.fill)
                d = Array(n.length).fill(1);
            else
                for (k = 0; n.length > k; k += 1)
                    d.push(1);
            return p = new Float32Array(d),
            o.setAttribute("color", new YA(p,3,!0)),
            o.setIndex(r),
            o.groups = c,
            g = new Ue(o,l),
            i.add(g),
            d = null,
            n = null,
            r = null,
            a = null,
            s = null,
            l = null,
            c = null,
            i
        },
        setComponentPositionByKey: function(A, e) {
            this.getViewerImpl().setComponentPositionByKey(A, e),
            this.render()
        },
        setComponentPositionById: function(A, e, t) {},
        getBoxByComponentsKey: function(A) {
            return Array.isArray(A) || (A = [A]),
            this.getViewerImpl().getBoundingBoxByIds(A)
        },
        getAttributeByComponentKey: function() {},
        zoomToBox: function(A, e, t) {
            this.getViewerImpl().zoomToBox(A, e, t)
        },
        zoomIn: function(A, e, t) {
            this.getViewerImpl().zoomIn(A, e, t)
        },
        zoomOut: function(A, e, t) {
            this.getViewerImpl().zoomOut(A, e, t)
        },
        flyToStandardView: function(A, e, t, i) {
            this.getViewerImpl().setStandardView(A, e, t, i)
        },
        setStandardViewWithBox: function(A, e, t, i) {
            this.getViewerImpl().setStandardViewWithBox(A, e, t, i)
        },
        adaptiveSize: function() {
            this.getViewerImpl().zoomToSelection()
        },
        adaptiveSizeByKey: function(A) {
            Array.isArray(A) || (A = [A]);
            var e = this.getViewerImpl().getBoundingBoxByIds(A);
            e && !e.isEmpty() && this.getViewerImpl().zoomToBox(e)
        },
        flyTo: function(A, e) {
            var t = this;
            this.getViewerImpl().animator.slerpFlyTo(A, this.viewerImpl, (function(A) {
                t.viewerImpl.cameraControl.update(!0, !0)
            }
            ), e)
        },
        linearFlyTo: function(A, e) {
            var t = this;
            this.getViewerImpl().animator.linearFlyTo(A, this.viewerImpl, (function(A) {
                t.viewerImpl.cameraControl.update(!0, !0)
            }
            ), e)
        },
        slerpFlyTo: function(A, e) {
            var t = this;
            this.getViewerImpl().animator.slerpFlyTo(A, this.viewerImpl, (function(A) {
                t.viewerImpl.cameraControl.update(!0, !0)
            }
            ), e)
        },
        setAnimatorDuration: function(A) {
            var e = this.getViewerImpl().animator;
            return !(!e || "number" != typeof A) && (e.setDuration(A),
            !0)
        },
        getAnimatorDuration: function() {
            var A = this.getViewerImpl().animator;
            if (A)
                return A.getDuration()
        },
        enableViewController: function() {
            var A = this;
            return this.viewController ? (this.viewController.enable(),
            !0) : (this.viewController = new lp(this.viewerImpl,(function() {
                return !0
            }
            )),
            this.viewController.init(this.getViewerImpl().getDomElement()),
            this.viewController.render(),
            this.getViewerImpl().addRenderFinishedListener((function() {
                A.viewController.render()
            }
            )),
            !0)
        },
        disableViewController: function() {
            return !!this.viewController && (this.viewController.disable(),
            !0)
        },
        enabledCameraRotateOfVerticalPolarAngle: function(A) {
            this.getViewerImpl().cameraControl.enabledPolar(A),
            Bh.warn("请改用 lockAxisZ 方法")
        },
        lockAxisZ: function(A, e) {
            this.getViewerImpl().lockAxisZ(A, e)
        },
        setMinPolarAngle: function(A) {
            this.getViewerImpl().cameraControl.setMinPolarAngle(A),
            Bh.warn("请改用 lockAxisZ 方法")
        },
        setMaxPolarAngle: function(A) {
            this.getViewerImpl().cameraControl.setMaxPolarAngle(A),
            Bh.warn("请改用 lockAxisZ 方法")
        },
        getMinPolarAngle: function() {
            return this.getViewerImpl().cameraControl.getMinPolarAngle()
        },
        getMaxPolarAngle: function() {
            return this.getViewerImpl().cameraControl.getMaxPolarAngle()
        },
        enableRotate: function(A) {
            return jh.NoRotate = !A,
            !jh.NoRotate
        },
        enablePan: function(A) {
            return jh.NoPan = !A,
            !jh.NoPan
        },
        enableZoom: function(A) {
            return jh.NoZoom = !A,
            !jh.NoZoom
        },
        setPointRotateMode: function(A) {
            return this.getViewerImpl().setPointRotateMode(A),
            jh.RotatePivotMode
        },
        rotateCamera: function(A, e) {
            var t = new s
              , i = new y;
            Array.isArray(A) ? t.set(A[0], A[1]) : t.set(A.x, A.y),
            e ? Array.isArray(e) ? i.fromArray(e) : i.set(e.x, e.y, e.z) : i = this.getViewerImpl().getScene().getBoundingBoxWorld().getCenter(i),
            this.getViewerImpl().rotateCamera(t, i)
        },
        requestPointerLock: function() {
            this.getViewerImpl().getControlManager().requestPointerLock()
        },
        translateComponentByKey: function(A, e, t) {
            this.getViewerImpl().translateComponentByKey(A, e, t)
        },
        scaleComponentByKey: function(A, e, t) {
            this.getViewerImpl().scaleComponentByKey(A, e, t)
        },
        rotateComponentByKey: function(A, e, t) {
            this.getViewerImpl().rotateComponentByKey(A, e, t)
        },
        cancelTransformComponent: function(A) {
            this.getViewerImpl().cancelTransformComponent(A)
        },
        restoreComponentTransform: function() {
            this.getViewerImpl().restoreComponentTransform()
        },
        getComponentLocalMatrixByKey: function(A) {
            return this.getViewerImpl().getComponentLocalMatrixByKey(A)
        },
        getComponentWorldMatrixByKey: function(A) {
            return this.getViewerImpl().getComponentWorldMatrixByKey(A)
        },
        setComponentLocalMatrixByKey: function(A, e) {
            return this.getViewerImpl().setComponentLocalMatrixByKey(A, e)
        },
        resetComponentMatrix: function(A, e) {
            return this.getViewerImpl().resetComponentMatrix(A, e)
        },
        increaseComponentTransformControlSize: function() {
            this.getViewerImpl().increaseComponentTransformControlSize()
        },
        decreaseComponentTransformControlSize: function() {
            this.getViewerImpl().decreaseComponentTransformControlSize()
        },
        setComponentTransformSpaceToLocalSpace: function() {
            this.getViewerImpl().setComponentTransformSpaceToLocalSpace()
        },
        setComponentTransformSpaceToWorldSpace: function() {
            this.getViewerImpl().setComponentTransformSpaceToWorldSpace()
        },
        switchComponentTransformSpaceBetweenLocalAndWorld: function() {
            this.getViewerImpl().switchComponentTransformSpaceBetweenLocalAndWorld()
        },
        showComponentTransformOnAxis: function(A) {
            this.getViewerImpl().showComponentTransformOnAxis(A)
        },
        hideComponentTransformOnAxis: function(A) {
            this.getViewerImpl().hideComponentTransformOnAxis(A)
        },
        disableComponentTransform: function() {
            this.getViewerImpl().disableComponentTransform()
        },
        enableComponentTransform: function() {
            this.getViewerImpl().enableComponentTransform()
        },
        enableSectionBox: function() {
            var A = this.getViewerImpl();
            A.controlManager.enableTool(A, Pc.CLIP_BY_BOX),
            this._sectionTool = new Ap(A),
            this._sectionTool.toggle(!0, !0),
            this._sectionTool.setVisible(!0),
            this._sectionTool.reset(),
            this._isSection = !0,
            this.render()
        },
        disableSectionBox: function() {
            this.getViewerImpl().controlManager.disableTool(Pc.CLIP_BY_BOX),
            this._isSection = !1,
            this.render()
        },
        resetSectionBox: function() {
            this._isSection ? (this.showSectionBox(),
            this.setSectionBoxMode(),
            this._sectionTool.reset("Rotate")) : Bh.log(fh[vc.language].SectionBoxLockHint)
        },
        setSectionBoxMode: function(A) {
            this._isSection ? this._sectionTool.setRotatable("Rotate" === A) : Bh.log(fh[vc.language].SectionBoxLockHint)
        },
        showSectionBox: function() {
            this._isSection ? (this._sectionTool.setVisible(!0),
            this.render()) : Bh.log(fh[vc.language].SectionBoxLockHint)
        },
        hideSectionBox: function() {
            this._isSection ? (this._sectionTool.setVisible(!1),
            this.render()) : Bh.log(fh[vc.language].SectionBoxLockHint)
        },
        setSectionBox: function(A) {
            var e = this.getViewerImpl()
              , t = e.getScene().getClipPlanes()
              , i = e.worldToDrawing(A.min)
              , o = e.worldToDrawing(A.max);
            this.enableSectionBox(),
            t.setSectionBox(i, o),
            this.hideSectionBox()
        },
        getSectionBoxState: function() {
            if (this._isSection)
                return this._sectionTool.saveState();
            Bh.log(fh[vc.language].SectionBoxLockHint)
        },
        setSectionBoxState: function(A) {
            this._isSection ? (this._sectionTool.loadState(A),
            this.render()) : Bh.log(fh[vc.language].SectionBoxLockHint)
        },
        getSceneState: function() {
            return this.getViewerImpl().getSceneState()
        },
        setSceneState: function(A) {
            this.getViewerImpl().setSceneState(A)
        },
        getScreenShot: function(A) {
            var e, t, i, o;
            return A.color && A.color instanceof Xh && (e = A.color.getRGBA()),
            A.width > 0 && A.height > 0 && (i = A.width,
            o = A.height),
            "function" == typeof A.callback && (t = A.callback),
            this.getViewerImpl().canvas2image(e, i, o, t)
        },
        registerModelEventListener: function(A, e) {
            this.getViewerImpl().registerEventListener(A, e)
        },
        unregisterModelEventListener: function(A, e) {
            this.getViewerImpl().unregisterEventListener(A, e)
        },
        registerControlEventListener: function(A, e) {
            this.getViewerImpl().registerDomEventListener(A, e)
        },
        unregisterControlEventListener: function(A, e) {
            this.getViewerImpl().unregisterDomEventListener(A, e)
        },
        registerCameraEventListener: function(A, e) {
            this.getViewerImpl().registerCameraEventListener(A, e)
        },
        unregisterCameraEventListener: function(A, e) {
            this.getViewerImpl().unregisterCameraEventListener(A, e)
        },
        enableLogarithmicDepthBuffer: function(A) {
            this.getViewerImpl().enableLogarithmicDepthBuffer(A)
        },
        setSkyBox: function(A, e, t, i) {
            var o = this.getRootScene();
            o && (A ? o.setSkyBox(void 0, A, e, t, i) : o.background = null)
        },
        setDrawingStyle: function(A) {
            this.getViewerImpl().setDrawingStyle(A),
            this.render()
        },
        setExposure: function(A) {
            this.getViewerImpl().setExposureShift(A),
            this.render()
        },
        getBoardlineColor: function(A) {
            var e = this.getViewerImpl().getWireframeColor(A);
            return new Xh(e,e.opacity)
        },
        setBoardlineColor: function(A, e) {
            var t = null;
            t = A instanceof Xh ? A : new Xh(A),
            this.getViewerImpl().setWireframeColor(t, e)
        },
        restoreBoardlineColor: function(A) {
            this.getViewerImpl().restoreWireframeColor(A)
        },
        getSelectionBoardlineColor: function() {
            return this.getViewerImpl().getOutlineEdgeColor() || new Xh
        },
        setSelectionBoardlineColor: function(A) {
            var e = null;
            e = A instanceof Xh ? A : new Xh(A),
            this.getViewerImpl().setOutlineEdgeColor(e)
        },
        restoreSelectionBoardlineColor: function() {
            this.getViewerImpl().restoreOutlineEdgeColor()
        },
        getSelectionColor: function() {
            return this.getViewerImpl().getSelectionColor()
        },
        setSelectionColor: function(A) {
            var e = null;
            e = A instanceof Xh ? A : new Xh(A),
            this.getViewerImpl().setSelectionColor(e)
        },
        restoreSelectionColor: function() {
            this.getViewerImpl().restoreSelectionColor()
        },
        setAxisNetColor: function(A, e) {
            this.viewerImpl.setAxisNetColor(A, e)
        },
        showAxisNet: function() {
            this.viewerImpl.showAxisNet()
        },
        hideAxisNet: function() {
            this.viewerImpl.hideAxisNet()
        },
        enableAxisNetStayInFront: function() {
            this.viewerImpl.enableAxisNetStayInFront()
        },
        disableAxisNetStayInFront: function() {
            this.viewerImpl.disableAxisNetStayInFront()
        },
        getScene: function() {
            return this.getViewerImpl().getScene().getExternalScene()
        },
        getRootScene: function() {
            return this.getViewerImpl().getScene()
        },
        updateSceneBoundingBox: function() {
            this.getExternalComponentManager().calculateBoundingBox(),
            this.getViewerImpl().modelManager.updateSceneBoundingBox()
        },
        getCurrentControlName: function() {
            return this.getViewerImpl().getCurrentControlName()
        },
        setControlMode: function(A) {
            this.getViewerImpl().setControlMode(A),
            this.render()
        },
        setControlDefault: function() {
            this.setControlMode(Gc.PICK)
        },
        setZoomSpeed: function(A) {
            this.getViewerImpl().cameraControl.setZoomSpeed(A)
        },
        getZoomSpeed: function() {
            return this.getViewerImpl().cameraControl.getZoomSpeed()
        },
        setZoomOutLimitRate: function(A) {
            this.getViewerImpl().cameraControl.setZoomOutLimitRate(A)
        },
        getZoomOutLimitRate: function() {
            return this.getViewerImpl().cameraControl.getZoomOutLimitRate()
        },
        setLightIntensityFactor: function(A) {
            this.getViewerImpl().setLightIntensityFactor(A)
        },
        enableShadow: function(A) {
            this.getViewerImpl().enableShadow(A)
        },
        updateShadowLight: function() {
            this.getViewerImpl().updateShadowLight()
        },
        setShadowLightDir: function(A) {
            var e;
            A ? (e = Array.isArray(A) ? (new y).fromArray(A) : A.isVector3 ? A : new y(A.x,A.y,A.z),
            this.getViewerImpl().getScene().lightManager.shadowLightDir = e) : Bh.error("无效参数")
        },
        getShadowLightDir: function() {
            return this.getViewerImpl().getScene().lightManager.shadowLightDir.clone()
        },
        getLightDirFromAltitudeAndAzimuth: function(A, e) {
            if (void 0 !== A && void 0 !== e)
                return this.getViewerImpl().getScene().lightManager.getLightDirFromAltitudeAndAzimuth(A, e);
            Bh.error("参数不合法")
        },
        getExternalComponentManager: function() {
            return this.getViewerImpl().getExternalComponentManager()
        },
        addExternalObject: function(A, e, t, i) {
            this.getViewerImpl().addExternalObject(A, e, t, i)
        },
        addExternalObjects: function(A, e, t) {
            return this.getViewerImpl().addExternalObjects(A, e, t)
        },
        removeExternalObjectByName: function(A) {
            this.getViewerImpl().removeExternalObjectByName(A)
        },
        clearExternalObjects: function() {
            this.getViewerImpl().clearExternalObjects()
        },
        getExternalObjectByName: function(A) {
            return this.getViewerImpl().getExternalObjectByName(A)
        },
        getAllExternalObjects: function() {
            return this.getViewerImpl().getAllExternalObjects()
        },
        showFPS: function() {
            this.fpsStats = new $d;
            var A = this;
            this.viewportDiv.appendChild(this.fpsStats.dom),
            this.fpsStats.listener = function() {
                A.fpsStats.update()
            }
            ,
            this.getViewerImpl().addRenderListener(this.fpsStats.listener)
        },
        hideFPS: function() {
            this.fpsStats && (this.viewportDiv.removeChild(this.fpsStats.dom),
            this.getViewerImpl().removeRenderListener(this.fpsStats.listener)),
            this.fpsStats = null
        },
        cloneComponentByKey: function(A, e) {
            var t = this.getViewerImpl().cloneComponent(A);
            return "translate" === e ? this.translateComponentByKey(t.key) : "scale" === e ? this.scaleComponentByKey(t.key) : "rotate" === e && this.rotateComponentByKey(t.key),
            null !== t ? {
                mesh: t,
                key: t.key
            } : null
        },
        setCloneComponentMaterialsByKey: function(A, e, t) {
            return this.getViewerImpl().getExternalComponentManager().setCloneComponentMaterialsByKey(A, e, t)
        },
        createSmoothCurve: function(A) {
            return this.getViewerImpl().catmullRomCurve(A)
        },
        destroy: function() {
            this.getViewerImpl().destroy(),
            this.viewController && (this.viewController.destroy(),
            this.viewController = null)
        }
    });
    var qy, jy, Hy, Yy, Wy = function(A) {
        var e = A.lobibox
          , t = A.toolId
          , i = A.Flag
          , o = document.createElement("div");
        return o.className = "tab-body",
        o.id = "tab-compare-" + t,
        e.window({
            title: ("old" === t ? "新-旧" : "旧-新") + "模型对比结果",
            width: 334,
            height: 705,
            closeOnEsc: !1,
            closeButton: !0,
            afterWindowHide: function() {
                var A = document.getElementById("modelCompares" + t);
                i.modelCompares = !1,
                A && (A.style.backgroundColor = "",
                A.querySelector(".yj-icon").className = "yj-icon modelCompares-icon")
            },
            afterWindowShow: function() {
                var A = document.getElementById("modelCompares" + t);
                i.modelCompares = !0,
                A && (A.style.backgroundColor = "#1f89de",
                A.querySelector(".yj-icon").className = "yj-icon modelCompares-icon active")
            },
            content: o
        })
    }, Jy = function(A) {
        var e = A.lobibox
          , t = A.toolId
          , i = document.createElement("div");
        i.className = "tab-body",
        i.id = "tab-compare-properties-" + t;
        var o = document.createElement("table");
        o.classList.add("sx-table"),
        o.classList.add("table-no-top"),
        i.appendChild(o);
        var n = document.createElement("thead");
        o.appendChild(n);
        var r = document.createElement("tbody");
        o.appendChild(r);
        var a = document.createElement("tr");
        a.className = "noprop",
        r.appendChild(a);
        var s = document.createElement("td");
        return s.innerText = "尚未选择构件",
        a.appendChild(s),
        e.window({
            title: "属性对比详情",
            width: 500,
            height: 400,
            closeOnEsc: !1,
            closeButton: !0,
            afterWindowHide: function() {},
            content: i
        })
    }, zy = {
        AGGREGATION: "AGGREGATION",
        SEPARATION: "SEPARATION",
        MULTIWINDOW: "MULTIWINDOW"
    }, Zy = {
        added: "added",
        deleted: "deleted",
        changed: "changed",
        noChanged: "noChanged",
        oldChanged: "oldChanged",
        newChanged: "newChanged",
        oldNoChanged: "oldNoChanged",
        newNoChanged: "newNoChanged"
    }, Xy = {
        addedColor: {
            color: 32768,
            opacity: 1
        },
        deletedColor: {
            color: 16711680,
            opacity: 1
        },
        changedColor: {
            color: 16753920,
            opacity: 1
        }
    }, _y = {
        ACCOUNT_NO_EXIST: "ACCOUNT_NO_EXIST",
        NO_PERMISSION: "NO_PERMISSION",
        ON_NETWORK_ERROR: "ON_NETWORK_ERROR",
        ON_LOAD_INVALID_COMPARES: "ON_LOAD_INVALID_COMPARES",
        ON_LOAD_INVALID_CONTRASTDETAILS: "ON_LOAD_INVALID_CONTRASTDETAILS",
        ON_LOAD_INVALID_STATE: "ON_LOAD_INVALID_STATE",
        ON_LOAD_ERROR: "ON_LOAD_ERROR"
    }, $y = function(A, e) {
        var t = this
          , i = uh.extend({}, {
            host: "https://bos3d.bimwinner.com",
            viewport: "",
            toolbar: !0,
            coloringImmediately: !1,
            showPanel: !1
        }, A);
        this.host = i.host,
        this.coloringImmediately = i.coloringImmediately,
        this.domElement = document.getElementById(i.viewport),
        this.domElement.style.position = "relative",
        this.oldModelKey = "",
        this.newModelKey = "",
        this.displayModel = e || zy.SEPARATION,
        t.oldNoChangedList = [],
        t.newNoChangedList = [],
        t.oldChangedList = [],
        t.newChangedList = [],
        t.deletedList = [],
        t.addedList = [],
        this.useNewUI = Boolean(window.EIMMODELUI);
        var o = {
            modelCompares: i.showPanel
        }
          , n = {
            modelCompares: i.showPanel
        };
        switch (this.displayModel) {
        case zy.AGGREGATION:
        case zy.SEPARATION:
            if (this.firstViewer = new Py(A),
            this.secondViewer = this.firstViewer,
            t.oldLobibox = new bh,
            t.oldLobibox.viewport = document.querySelector("#" + t.firstViewer.viewport),
            t.newLobibox = t.oldLobibox,
            i.toolbar) {
                this.useNewUI ? this.firstTool = new window.EIMMODELUI({
                    viewer3D: this.firstViewer,
                    EIM: window.EIM,
                    EIMMODEL: window.EIMMODEL
                }) : (this.firstTool = new Xd(this.firstViewer),
                this.firstTool.createTool()),
                this.secondTool = this.firstTool,
                this.oldCompareWindow = Wy({
                    toolId: "old",
                    lobibox: t.oldLobibox,
                    Flag: o
                }),
                this.newCompareWindow = this.oldCompareWindow,
                this.oldContrastDetailsWindow = Jy({
                    toolId: "old",
                    lobibox: t.oldLobibox
                }),
                this.newContrastDetailsWindow = this.oldContrastDetailsWindow,
                this.oldCompareWindow.setPosition({
                    left: "",
                    right: 5,
                    top: 60
                }),
                this.oldContrastDetailsWindow.setPosition({
                    left: t.domElement.offsetWidth / 2 + t.domElement.offsetLeft / 2 - 250,
                    top: 200
                }),
                t.oldContrastDetailsWindow.windowHide();
                var r = document.createElement("div");
                r.className = "yj-group",
                this.useNewUI ? this.firstTool.plugin.addIcon("topRight", r) : this.firstTool.toolbarTop.appendChild(r);
                var a = document.createElement("button");
                a.className = "yj-but",
                a.title = "模型对比结果",
                a.id = "modelComparesold";
                var s = document.createElement("div");
                s.classList.add("yj-icon"),
                s.classList.add("modelCompares-icon"),
                a.appendChild(s),
                r.appendChild(a),
                a.addEventListener("click", (function(A) {
                    o.modelCompares ? t.oldCompareWindow.windowHide() : (o.modelCompares = !o.modelCompares,
                    t.oldCompareWindow.windowShow())
                }
                ))
            }
            break;
        case zy.MULTIWINDOW:
            var l = document.createElement("div");
            l.setAttribute("id", "firstViewer"),
            l.style.width = "50%",
            l.style.height = "100%",
            l.style.float = "left",
            this.domElement.appendChild(l);
            var c = document.createElement("div");
            if (c.setAttribute("id", "secondViewer"),
            c.style.width = "50%",
            c.style.height = "100%",
            c.style.float = "left",
            this.domElement.appendChild(l),
            this.domElement.appendChild(c),
            this.firstViewer = new Py({
                host: this.host,
                viewport: "firstViewer"
            }),
            this.secondViewer = new Py({
                host: this.host,
                viewport: "secondViewer"
            }),
            t.oldLobibox = new bh,
            t.oldLobibox.viewport = document.querySelector("#" + t.firstViewer.viewport),
            t.newLobibox = new bh,
            t.newLobibox.viewport = document.querySelector("#" + t.secondViewer.viewport),
            i.toolbar) {
                this.useNewUI ? (this.firstTool = new window.EIMMODELUI({
                    viewer3D: this.firstViewer,
                    EIM: window.EIM,
                    EIMMODEL: window.EIMMODEL
                }),
                this.secondTool = new window.EIMMODELUI({
                    viewer3D: this.secondViewer,
                    EIM: window.EIM,
                    EIMMODEL: window.EIMMODEL
                })) : (this.firstTool = new Xd(this.firstViewer),
                this.firstTool.createTool(),
                this.secondTool = new Xd(this.secondViewer),
                this.secondTool.createTool()),
                this.oldCompareWindow = Wy({
                    toolId: "old",
                    lobibox: t.oldLobibox,
                    Flag: o
                }),
                this.newCompareWindow = Wy({
                    toolId: "new",
                    lobibox: t.newLobibox,
                    Flag: n
                }),
                this.oldContrastDetailsWindow = Jy({
                    toolId: "old",
                    lobibox: t.oldLobibox
                }),
                this.newContrastDetailsWindow = Jy({
                    toolId: "new",
                    lobibox: t.newLobibox
                }),
                t.oldContrastDetailsWindow.windowHide(),
                t.newContrastDetailsWindow.windowHide(),
                this.oldContrastDetailsWindow.setTitle("旧-新属性对比详情"),
                this.newContrastDetailsWindow.setTitle("新-旧属性对比详情"),
                this.oldCompareWindow.setPosition({
                    left: "",
                    right: 5 + t.domElement.offsetWidth / 2 + t.domElement.offsetLeft / 2,
                    top: 60
                }),
                this.oldContrastDetailsWindow.setPosition({
                    left: t.domElement.offsetWidth / 4 + t.domElement.offsetLeft / 4 - 250,
                    top: 200
                }),
                this.newCompareWindow.setPosition({
                    left: "",
                    right: 5,
                    top: 60
                }),
                this.newContrastDetailsWindow.setPosition({
                    left: t.domElement.offsetWidth / 4 * 3 + t.domElement.offsetLeft / 4 * 3 - 250,
                    top: 200
                });
                var h = document.createElement("div");
                h.className = "yj-group",
                this.useNewUI ? this.firstTool.plugin.addIcon("topRight", h) : this.firstTool.toolbarTop.appendChild(h);
                var d = document.createElement("button");
                d.className = "yj-but",
                d.title = "模型对比结果",
                d.id = "modelComparesold";
                var p = document.createElement("div");
                p.classList.add("yj-icon"),
                p.classList.add("modelCompares-icon"),
                d.appendChild(p),
                h.appendChild(d),
                d.addEventListener("click", (function(A) {
                    o.modelCompares ? t.oldCompareWindow.windowHide() : (o.modelCompares = !o.modelCompares,
                    t.oldCompareWindow.windowShow())
                }
                ));
                var g = document.createElement("div");
                g.className = "yj-group",
                this.useNewUI ? this.secondTool.plugin.addIcon("topRight", g) : this.secondTool.toolbarTop.appendChild(g);
                var u = document.createElement("button");
                u.className = "yj-but",
                u.title = "模型对比结果",
                u.id = "modelComparesnew";
                var f = document.createElement("div");
                f.classList.add("yj-icon"),
                f.classList.add("modelCompares-icon"),
                u.appendChild(f),
                g.appendChild(u),
                u.addEventListener("click", (function(A) {
                    n.modelCompares ? t.newCompareWindow.windowHide() : (n.modelCompares = !n.modelCompares,
                    t.newCompareWindow.windowShow())
                }
                ))
            }
            break;
        default:
            Bh.error("无效的显示模式！")
        }
        i.showPanel || (t.newCompareWindow && t.newCompareWindow.windowHide(),
        t.oldCompareWindow && t.oldCompareWindow.windowHide()),
        this.firstViewer.getViewerImpl().modelManager.addEventListener(Rc.ON_LOAD_COMPLETE, (function(A) {
            A.modelKey === t.oldModelKey && (t.oldModelLoaded = !0,
            t._applyCompareData(),
            t._initCompareResultPlane(t.compareData))
        }
        )),
        this.secondViewer.getViewerImpl().modelManager.addEventListener(Rc.ON_LOAD_COMPLETE, (function(A) {
            A.modelKey === t.newModelKey && (t.newModelLoaded = !0,
            t._applyCompareData(),
            t._initCompareResultPlane(t.compareData))
        }
        ))
    };
    Object.assign($y.prototype, Ld.prototype),
    Object.assign($y.prototype, {
        resize: function(A, e) {
            switch (this.domElement && (this.domElement.style.height = e + "px",
            this.domElement.style.width = A + "px"),
            this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.resize(A, e);
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.resize(A / 2, e),
                this.secondViewer.resize(A / 2, e);
                break;
            default:
                this.firstViewer.resize(A, e)
            }
        },
        autoResize: function() {
            this.resize(this.getClientWidth(), this.getClientHeight())
        },
        getClientHeight: function() {
            return xh.getClientHeight()
        },
        getClientWidth: function() {
            return xh.getClientWidth()
        },
        resetOldScene: function(A) {
            this.firstViewer.resetScene(A)
        },
        resetNewScene: function(A) {
            this.secondViewer.resetScene(A)
        },
        resetScene: function(A) {
            this.firstViewer.resetScene(A),
            this.secondViewer.resetScene(A),
            this._applyCompareData()
        },
        transparentComponentsByType: function(A) {
            var e = this._getDataByType(A);
            this.firstViewer.transparentComponentsByKey(e.oldList),
            this.secondViewer.transparentComponentsByKey(e.newList)
        },
        transparentOtherComponentsByType: function(A) {
            var e = this._getDataByType(A);
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.transparentOtherComponentsByKey([].concat(e.oldList).concat(e.newList));
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.transparentOtherComponentsByKey(e.oldList),
                this.secondViewer.transparentOtherComponentsByKey(e.newList)
            }
        },
        closeTransparentComponentsByType: function(A) {
            var e = this._getDataByType(A);
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.closeTransparentComponentsByKey([].concat(e.oldList).concat(e.newList));
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.closeTransparentComponentsByKey(e.oldList),
                this.secondViewer.closeTransparentComponentsByKey(e.newList)
            }
        },
        clearComponentTransparentList: function() {
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.clearComponentTransparentList();
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.clearComponentTransparentList(),
                this.secondViewer.clearComponentTransparentList()
            }
        },
        showComponentsByType: function(A) {
            var e = this._getDataByType(A);
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.showComponentsByKey([].concat(e.oldList).concat(e.newList));
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.showComponentsByKey(e.oldList),
                this.secondViewer.showComponentsByKey(e.newList)
            }
        },
        hideComponentsByType: function(A) {
            var e = this._getDataByType(A);
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.hideComponentsByKey([].concat(e.oldList).concat(e.newList));
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.hideComponentsByKey(e.oldList),
                this.secondViewer.hideComponentsByKey(e.newList)
            }
        },
        highlightComponentsByType: function(A) {
            var e = this._getDataByType(A);
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.highlightComponentsByKey([].concat(e.oldList).concat(e.newList));
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.highlightComponentsByKey(e.oldList),
                this.secondViewer.highlightComponentsByKey(e.newList)
            }
        },
        addHighlightComponentsByType: function(A) {
            var e = this._getDataByType(A);
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.addHighlightComponentsByKey([].concat(e.oldList).concat(e.newList));
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.addHighlightComponentsByKey(e.oldList),
                this.secondViewer.addHighlightComponentsByKey(e.newList)
            }
        },
        closeHighlightComponentsByType: function(A) {
            var e = this._getDataByType(A);
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.closeHighlightComponentsByKey([].concat(e.oldList).concat(e.newList));
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.closeHighlightComponentsByKey(e.oldList),
                this.secondViewer.closeHighlightComponentsByKey(e.newList)
            }
        },
        getHighlightComponentsKey: function() {
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                return this.firstViewer.getHighlightComponentsKey();
            case zy.MULTIWINDOW:
                return [].concat(this.firstViewer.getHighlightComponentsKey()).concat(this.secondViewer.getHighlightComponentsKey());
            default:
                return []
            }
        },
        clearHighlightList: function() {
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.clearHighlightList();
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.clearHighlightList(),
                this.secondViewer.clearHighlightList()
            }
        },
        getHighlightComponents: function() {
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                return this.firstViewer.getHighlightComponents();
            case zy.MULTIWINDOW:
                return [].concat(this.firstViewer.getHighlightComponents()).concat(this.secondViewer.getHighlightComponents());
            default:
                return []
            }
        },
        colorfulComponentsByType: function(A, e, t) {
            var i = this._getDataByType(A);
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.colorfulComponentsByKey([].concat(i.oldList).concat(i.newList), e, t);
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.colorfulComponentsByKey(i.oldList, e, t),
                this.secondViewer.colorfulComponentsByKey(i.newList, e, t)
            }
        },
        closeColorfulComponentsByType: function(A) {
            var e = this._getDataByType(A);
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.closeColorfulComponentsByKey([].concat(e.oldList).concat(e.newList));
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.closeColorfulComponentsByKey(e.oldList),
                this.secondViewer.closeColorfulComponentsByKey(e.newList)
            }
        },
        clearColorfulList: function() {
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.clearColorfulList();
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.clearColorfulList(),
                this.secondViewer.clearColorfulList()
            }
        },
        wireFrameComponentsByType: function(A) {
            var e = this._getDataByType(A);
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.wireFrameComponentsByKey([].concat(e.oldList).concat(e.newList));
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.wireFrameComponentsByKey(e.oldList),
                this.secondViewer.wireFrameComponentsByKey(e.newList)
            }
        },
        closeWireFrameComponentsByType: function(A) {
            var e = this._getDataByType(A);
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.closeWireFrameComponentsByKey([].concat(e.oldList).concat(e.newList));
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.closeWireFrameComponentsByKey(e.oldList),
                this.secondViewer.closeWireFrameComponentsByKey(e.newList)
            }
        },
        clearWireframeList: function() {
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.clearWireframeList();
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.clearWireframeList(),
                this.secondViewer.clearWireframeList()
            }
        },
        isolateComponentsByType: function(A, e) {
            var t = this._getDataByType(A);
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.isolateComponentsByKey([].concat(t.oldList).concat(t.newList), e);
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.isolateComponentsByKey(t.oldList, e),
                this.secondViewer.isolateComponentsByKey(t.newList, e)
            }
        },
        closeIsolateComponentsByType: function(A) {
            var e = this._getDataByType(A);
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.closeIsolateComponentsByKey([].concat(e.oldList).concat(e.newList));
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.closeIsolateComponentsByKey(e.oldList),
                this.secondViewer.closeIsolateComponentsByKey(e.newList)
            }
        },
        clearIsolation: function() {
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                this.firstViewer.clearIsolation();
                break;
            case zy.MULTIWINDOW:
                this.firstViewer.clearIsolation(),
                this.secondViewer.clearIsolation()
            }
        },
        getAddedList: function() {
            return this.addedList
        },
        getDeletedList: function() {
            return this.deletedList
        },
        getChangedList: function() {
            return [].concat(this.oldChangedList).concat(this.newChangedList)
        },
        getNoChangedList: function() {
            return [].concat(this.oldNoChangedList).concat(this.newNoChangedList)
        },
        getNewChangedList: function() {
            return this.newChangedList
        },
        getOldChangedList: function() {
            return this.oldChangedList
        },
        getNewNoChangedList: function() {
            return this.newNoChangedList
        },
        getOldNoChangedList: function() {
            return this.oldNoChangedList
        },
        setAddedColor: function(A, e) {
            Xy.addedColor.color = A,
            Xy.addedColor.opacity = e
        },
        setChangedColor: function(A, e) {
            Xy.changedColor.color = A,
            Xy.changedColor.opacity = e
        },
        setDeletedColor: function(A, e) {
            Xy.deletedColor.color = A,
            Xy.deletedColor.opacity = e
        },
        getAddedColor: function() {
            return Xy.addedColor
        },
        getChangedColor: function() {
            return Xy.changedColor
        },
        getDeletedColor: function() {
            return Xy.deletedColor
        },
        getOldViewer: function() {
            return this.firstViewer
        },
        getNewViewer: function() {
            return this.secondViewer
        },
        getOldToolbar: function() {
            return this.firstTool
        },
        getNewToolbar: function() {
            return this.secondTool
        },
        getComponentAttribute: function(A, e) {
            var t = this.firstViewer.viewerImpl.getModelByComponentKey(A)
              , i = this.secondViewer.viewerImpl.getModelByComponentKey(A);
            t ? this.firstViewer.getComponentsAttributeByKey(A, (function(A) {
                A && e(A.attribute)
            }
            )) : i && this.secondViewer.getComponentsAttributeByKey(A, (function(A) {
                A && e(A.attribute)
            }
            ))
        },
        getContrastDetails: function(A, e, t) {
            var i = this;
            _d({
                type: "GET",
                url: this.host + "/api/" + this.projectKey + "/compares/changes?compareKey=" + this.compareKey + "&newComponentKey=" + e + "&oldComponentKey=" + A,
                headers: {
                    Authorization: this.accessToken
                },
                success: function(A) {
                    var e = {};
                    if ("string" == typeof A)
                        try {
                            e = JSON.parse(A)
                        } catch (A) {
                            return void i.dispatchEvent({
                                type: _y.ON_LOAD_INVALID_CONTRASTDETAILS,
                                compareKey: i.compareKey
                            })
                        }
                    else
                        e = A;
                    e && "SUCCESS" === e.code ? t && t(e.data) : (Bh.log(i.compareKey, "获取对比详情出错! ", e.message),
                    i.dispatchEvent({
                        type: _y.ON_LOAD_ERROR,
                        compareKey: i.compareKey,
                        code: e.code,
                        message: e.message
                    }))
                },
                error: function(A, e) {
                    switch (A) {
                    case 401:
                        i.dispatchEvent({
                            type: _y.ACCOUNT_NO_EXIST,
                            compareKey: i.compareKey,
                            data: e
                        });
                        break;
                    case 403:
                        i.dispatchEvent({
                            type: _y.NO_PERMISSION,
                            compareKey: i.compareKey,
                            data: e
                        });
                        break;
                    default:
                        i.dispatchEvent({
                            type: _y.ON_NETWORK_ERROR,
                            compareKey: i.compareKey,
                            data: A
                        })
                    }
                }
            })
        },
        showOldContrastDetails: (qy = "",
        jy = document.getElementById("tab-compare-properties-old"),
        Hy = function(A, e, t, i, o) {
            var n = document.createElement("tr");
            i.parentNode.appendChild(n),
            n.classList.add(o);
            var r = document.createElement("td");
            r.innerText = A || "",
            n.appendChild(r);
            var a = document.createElement("td");
            a.innerText = e || "",
            n.appendChild(a);
            var s = document.createElement("td");
            s.innerText = t || "",
            n.appendChild(s)
        }
        ,
        Yy = function(A, e, t, i) {
            var o = document.createElement("tr");
            o.className = "sx-active",
            jy.querySelector("table tbody").appendChild(o);
            var n = document.createElement("td");
            for (var r in n.colSpan = 2,
            n.style.fontSize = "14px",
            o.appendChild(n),
            n.appendChild(document.createElement("b")),
            n.firstElementChild.innerHTML = A,
            e)
                if (e.hasOwnProperty(r)) {
                    if (!(t && t[r] || i && i[r])) {
                        Hy(r, e[r], e[r], o, "compares_noChanged");
                        continue
                    }
                    if (t && t[r] && i && i[r]) {
                        Hy(r, e[r], i[r], o, "compares_changed"),
                        delete i[r];
                        continue
                    }
                    if ((!t || !t[r]) && i && i[r]) {
                        Hy(r, "", i[r], o, "compares_added"),
                        delete i[r];
                        continue
                    }
                    !t || !t[r] || i && i[r] || Hy(r, e[r], "", o, "compares_deleted")
                }
            for (var a in i)
                i.hasOwnProperty(a) && (void 0 !== e[a] ? Hy(a, e[a], i[a], o, "compares_changed") : Hy(a, "", i[a], o, "compares_added"))
        }
        ,
        function(A) {
            var e = this;
            if ((jy = document.querySelector("#tab-compare-properties-old")) && (e.showOldContrastDetailsWindow(),
            A !== qy)) {
                if (void 0 === A) {
                    var t = jy.querySelectorAll("table tbody tr");
                    jy.querySelector("table tbody").removeChild(t[0]),
                    jy.querySelector("table tbody").innerHTML = "";
                    var i = document.createElement("tr");
                    i.className = "noprop";
                    var o = document.createElement("td");
                    return o.setAttribute("colspan", "2"),
                    o.innerHTML = "未选中构件",
                    i.appendChild(o),
                    jy.querySelector("table tbody").appendChild(i),
                    void (qy = A)
                }
                qy = A;
                var n = jy.querySelectorAll("table tbody tr");
                jy.querySelector("table tbody").removeChild(n[0]),
                e.getComponentAttribute(qy, (function(A) {
                    if (jy.querySelector("table tbody").innerHTML = "",
                    null === A) {
                        var t = document.createElement("tr");
                        t.className = "noprop";
                        var i = document.createElement("td");
                        return i.innerHTML = "没有属性",
                        t.appendChild(i),
                        void jy.querySelector("table tbody").appendChild(t)
                    }
                    if (void 0 === A) {
                        var o = document.createElement("tr");
                        o.className = "noprop";
                        var n = document.createElement("td");
                        return n.innerHTML = "属性加载失败",
                        o.appendChild(n),
                        void jy.querySelector("table tbody").appendChild(o)
                    }
                    var r = qy.indexOf("_");
                    if (-1 !== r) {
                        var a = e.newModelKey + qy.slice(r);
                        e.getContrastDetails(qy, a, (function(e) {
                            var t = e.old.attribute
                              , i = e.new.attribute
                              , o = document.createElement("tr");
                            o.className = "noprop";
                            var n = document.createElement("th");
                            o.appendChild(n);
                            var r = document.createElement("span");
                            r.classList.add("value"),
                            r.classList.add("nonEditable"),
                            r.innerHTML = "属性名",
                            n.appendChild(r);
                            var a = document.createElement("th");
                            o.appendChild(a);
                            var s = document.createElement("span");
                            s.classList.add("value"),
                            s.classList.add("nonEditable"),
                            s.innerHTML = "修改前",
                            a.appendChild(s);
                            var l = document.createElement("th");
                            o.appendChild(l);
                            var c = document.createElement("span");
                            c.classList.add("value"),
                            c.classList.add("nonEditable"),
                            c.innerHTML = "修改后",
                            l.appendChild(c),
                            jy.querySelector("table tbody").appendChild(o);
                            var h = A;
                            for (var d in h)
                                "object" === lc(h[d]) ? (Yy(d, h[d], t[d], i[d]),
                                delete i[d]) : "string" == typeof h[d] && Hy(d, h[d], i[d], o);
                            for (var p in i)
                                "object" === lc(h[p]) ? Yy(p, h[p], t[p], i[p]) : "string" == typeof h[p] && Hy(p, h[p], i[p], o)
                        }
                        ))
                    }
                }
                ))
            }
        }
        ),
        showNewContrastDetails: function() {
            var A = ""
              , e = document.getElementById("tab-compare-properties-new")
              , t = function(A, e, t, i, o) {
                var n = document.createElement("tr");
                i.parentNode.appendChild(n),
                n.classList.add(o);
                var r = document.createElement("td");
                r.innerText = A || "",
                n.appendChild(r);
                var a = document.createElement("td");
                a.innerText = e || "",
                n.appendChild(a);
                var s = document.createElement("td");
                s.innerText = t || "",
                n.appendChild(s)
            }
              , i = function(A, i, o, n) {
                var r = document.createElement("tr");
                r.className = "sx-active",
                e.querySelector("table tbody").appendChild(r);
                var a = document.createElement("td");
                for (var s in a.colSpan = 2,
                a.style.fontSize = "14px",
                r.appendChild(a),
                a.appendChild(document.createElement("b")),
                a.firstElementChild.innerHTML = A,
                i)
                    if (i.hasOwnProperty(s)) {
                        if (!(o && o[s] || n && n[s])) {
                            t(s, i[s], i[s], r, "compares_noChanged");
                            continue
                        }
                        if (o && o[s] && n && n[s]) {
                            t(s, i[s], n[s], r, "compares_changed"),
                            delete n[s];
                            continue
                        }
                        if ((!o || !o[s]) && n && n[s]) {
                            t(s, "", n[s], r, "compares_added"),
                            delete n[s];
                            continue
                        }
                        !o || !o[s] || n && n[s] || t(s, i[s], "", r, "compares_deleted")
                    }
                for (var l in n)
                    n.hasOwnProperty(l) && (void 0 !== i[l] ? t(l, i[l], n[l], r, "compares_changed") : t(l, "", n[l], r, "compares_added"))
            };
            return function(o) {
                var n = this;
                if ((e = document.querySelector("#tab-compare-properties-new")) && (n.showNewContrastDetailsWindow(),
                o !== A)) {
                    if (void 0 === o) {
                        var r = e.querySelectorAll("table tbody tr");
                        e.querySelector("table tbody").removeChild(r[0]),
                        e.querySelector("table tbody").innerHTML = "";
                        var a = document.createElement("tr");
                        a.className = "noprop";
                        var s = document.createElement("td");
                        return s.setAttribute("colspan", "2"),
                        s.innerHTML = "未选中构件",
                        a.appendChild(s),
                        e.querySelector("table tbody").appendChild(a),
                        void (A = o)
                    }
                    A = o;
                    var l = e.querySelectorAll("table tbody tr");
                    e.querySelector("table tbody").removeChild(l[0]),
                    n.getComponentAttribute(A, (function(o) {
                        if (e.querySelector("table tbody").innerHTML = "",
                        null === o) {
                            var r = document.createElement("tr");
                            r.className = "noprop";
                            var a = document.createElement("td");
                            return a.innerHTML = "没有属性",
                            r.appendChild(a),
                            void e.querySelector("table tbody").appendChild(r)
                        }
                        if (void 0 === o) {
                            var s = document.createElement("tr");
                            s.className = "noprop";
                            var l = document.createElement("td");
                            return l.innerHTML = "属性加载失败",
                            s.appendChild(l),
                            void e.querySelector("table tbody").appendChild(s)
                        }
                        var c = A.indexOf("_");
                        if (-1 !== c) {
                            var h = n.oldModelKey + A.slice(c);
                            n.getContrastDetails(h, A, (function(A) {
                                var n = A.new.attribute
                                  , r = A.old.attribute
                                  , a = document.createElement("tr");
                                a.className = "noprop";
                                var s = document.createElement("th");
                                a.appendChild(s);
                                var l = document.createElement("span");
                                l.classList.add("value"),
                                l.classList.add("nonEditable"),
                                l.innerHTML = "属性名",
                                s.appendChild(l);
                                var c = document.createElement("th");
                                a.appendChild(c);
                                var h = document.createElement("span");
                                h.classList.add("value"),
                                h.classList.add("nonEditable"),
                                h.innerHTML = "修改前",
                                c.appendChild(h);
                                var d = document.createElement("th");
                                a.appendChild(d);
                                var p = document.createElement("span");
                                p.classList.add("value"),
                                p.classList.add("nonEditable"),
                                p.innerHTML = "修改后",
                                d.appendChild(p),
                                e.querySelector("table tbody").appendChild(a);
                                var g = o;
                                for (var u in g)
                                    "object" === lc(g[u]) ? (i(u, g[u], n[u], r[u]),
                                    delete r[u]) : "string" == typeof g[u] && t(u, g[u], r[u], a);
                                for (var f in r)
                                    "object" === lc(g[f]) ? i(f, g[f], n[f], r[f]) : "string" == typeof g[f] && t(f, g[f], r[f], a)
                            }
                            ))
                        }
                    }
                    ))
                }
            }
        }(),
        showOldContrastDetailsWindow: function() {
            this.oldContrastDetailsWindow && this.oldContrastDetailsWindow.windowShow && this.oldContrastDetailsWindow.windowShow()
        },
        showNewContrastDetailsWindow: function() {
            this.newContrastDetailsWindow && this.newContrastDetailsWindow.windowShow && this.newContrastDetailsWindow.windowShow()
        },
        hideOldContrastDetailsWindow: function() {
            this.oldContrastDetailsWindow && this.oldContrastDetailsWindow.windowHide && this.oldContrastDetailsWindow.windowHide()
        },
        hideNewContrastDetailsWindow: function() {
            this.newContrastDetailsWindow && this.newContrastDetailsWindow.windowHide() && this.newContrastDetailsWindow.windowHide()
        },
        showContrastDetailsWindow: function() {
            this.showOldContrastDetailsWindow(),
            this.showNewContrastDetailsWindow()
        },
        hideContrastDetailsWindow: function() {
            this.hideOldContrastDetailsWindow(),
            this.hideNewContrastDetailsWindow()
        },
        showOldCompareWindow: function() {
            this.oldCompareWindow && this.oldCompareWindow.windowShow && this.oldCompareWindow.windowShow()
        },
        showNewCompareWindow: function() {
            this.newCompareWindow && this.newCompareWindow.windowShow && this.newCompareWindow.windowShow()
        },
        hideOldCompareWindow: function() {
            this.oldCompareWindow && this.oldCompareWindow.windowHide && this.oldCompareWindow.windowHide()
        },
        hideNewCompareWindow: function() {
            this.newCompareWindow && this.newCompareWindow.windowHide() && this.newCompareWindow.windowHide()
        },
        showCompareWindow: function() {
            this.showOldCompareWindow(),
            this.showNewCompareWindow()
        },
        hideCompareWindow: function() {
            this.hideOldCompareWindow(),
            this.hideNewCompareWindow()
        }
    }),
    $y.prototype.addView = function(A, e, t) {
        var i = this;
        this.compareKey = A,
        this.projectKey = e,
        this.accessToken = t || "",
        _d({
            type: "GET",
            url: this.host + "/api/" + e + "/compares/status?compareKey=" + A,
            headers: {
                Authorization: this.accessToken
            },
            success: i._loadSuccess.bind(i),
            error: function(e, t) {
                switch (e) {
                case 401:
                    i.dispatchEvent({
                        type: _y.ACCOUNT_NO_EXIST,
                        compareKey: A,
                        data: t
                    });
                    break;
                case 403:
                    i.dispatchEvent({
                        type: _y.NO_PERMISSION,
                        compareKey: A,
                        data: t
                    });
                    break;
                default:
                    i.dispatchEvent({
                        type: _y.ON_NETWORK_ERROR,
                        compareKey: A,
                        data: e
                    })
                }
            }
        }),
        i._loadCompares()
    }
    ,
    $y.prototype._loadCompares = function() {
        var A = this;
        _d({
            type: "GET",
            url: this.host + "/api/" + this.projectKey + "/compares?compareKey=" + this.compareKey,
            headers: {
                Authorization: this.accessToken
            },
            success: A._loadComparesSuccess.bind(A),
            error: function(e, t) {
                switch (e) {
                case 401:
                    A.dispatchEvent({
                        type: _y.ACCOUNT_NO_EXIST,
                        compareKey: A.compareKey,
                        data: t
                    });
                    break;
                case 403:
                    A.dispatchEvent({
                        type: _y.NO_PERMISSION,
                        compareKey: A.compareKey,
                        data: t
                    });
                    break;
                default:
                    A.dispatchEvent({
                        type: _y.ON_NETWORK_ERROR,
                        compareKey: A.compareKey,
                        data: e
                    })
                }
            }
        })
    }
    ,
    $y.prototype._loadComparesSuccess = function(A) {
        var e = {};
        if ("string" == typeof A)
            try {
                e = JSON.parse(A)
            } catch (A) {
                return void this.dispatchEvent({
                    type: _y.ON_LOAD_INVALID_COMPARES,
                    compareKey: this.compareKey
                })
            }
        else
            e = A;
        if (e && "SUCCESS" === e.code) {
            this.compareData = e.data,
            this.compareDataLoaded = !0;
            for (var t = [], i = [], o = [], n = [], r = null, a = 0, s = this.compareData.changed.categories.length; s > a; a += 1)
                for (var l = 0, c = this.compareData.changed.categories[a].elements.length; c > l; l += 1)
                    t.push((r = this.compareData.changed.categories[a].elements[l]).oldComponentKey),
                    i.push(r.newComponentKey);
            for (var h = 0, d = this.compareData.added.categories.length; d > h; h += 1)
                for (var p = 0, g = this.compareData.added.categories[h].elements.length; g > p; p += 1)
                    o.push((r = this.compareData.added.categories[h].elements[p]).componentKey);
            for (var u = 0, f = this.compareData.deleted.categories.length; f > u; u += 1)
                for (var m = 0, C = this.compareData.deleted.categories[u].elements.length; C > m; m += 1)
                    n.push((r = this.compareData.deleted.categories[u].elements[m]).componentKey);
            this.oldChangedList = t,
            this.newChangedList = i,
            this.deletedList = n,
            this.addedList = o,
            this._initCompareResultPlane(e.data),
            this._applyCompareData()
        } else
            Bh.log(this.compareKey, "config load error! ", e.message),
            this.dispatchEvent({
                type: _y.ON_LOAD_ERROR,
                compareKey: this.compareKey,
                code: e.code,
                message: e.message
            })
    }
    ,
    $y.prototype._loadSuccess = function(A) {
        var e = {};
        if ("string" == typeof A)
            try {
                e = JSON.parse(A)
            } catch (A) {
                return void this.dispatchEvent({
                    type: _y.ON_LOAD_INVALID_STATE,
                    compareKey: this.compareKey
                })
            }
        else
            e = A;
        if (e && "SUCCESS" === e.code)
            if ("1" !== e.data.status)
                ;
            else
                switch (this.oldModelKey = e.data.old,
                this.newModelKey = e.data.new,
                this.name = e.data.name,
                this.displayModel) {
                case zy.AGGREGATION:
                case zy.SEPARATION:
                    this.firstViewer.addView(this.oldModelKey, this.projectKey, this.accessToken),
                    this.firstViewer.addView(this.newModelKey, this.projectKey, this.accessToken);
                    break;
                case zy.MULTIWINDOW:
                    this.firstViewer.addView(this.oldModelKey, this.projectKey, this.accessToken),
                    this.secondViewer.addView(this.newModelKey, this.projectKey, this.accessToken);
                    break;
                default:
                    this.firstViewer.addView(this.oldModelKey, this.projectKey, this.accessToken),
                    this.firstViewer.addView(this.newModelKey, this.projectKey, this.accessToken)
                }
        else
            Bh.log(this.compareKey, "config load error! ", e.message),
            this.dispatchEvent({
                type: _y.ON_LOAD_ERROR,
                compareKey: this.compareKey,
                code: e.code,
                message: e.message
            })
    }
    ,
    $y.prototype._applyCompareData = function() {
        if (this.oldModelLoaded && this.newModelLoaded && this.compareDataLoaded) {
            var A = this.firstViewer.getViewerImpl().getModel(this.oldModelKey)
              , e = null
              , t = null;
            if (A) {
                var i = A.getComponentlist();
                e = this.firstViewer.getBoxByComponentsKey(i);
                for (var o = 0, n = this.deletedList.length; n > o; o += 1)
                    i.remove(this.deletedList[o]);
                for (var r = 0, a = this.oldChangedList.length; a > r; r += 1)
                    i.remove(this.oldChangedList[r]);
                this.oldNoChangedList = i
            }
            var s = this.secondViewer.getViewerImpl().getModel(this.newModelKey);
            if (s) {
                var l = s.getComponentlist();
                t = this.firstViewer.getBoxByComponentsKey(l);
                for (var c = 0, h = this.addedList.length; h > c; c += 1)
                    l.remove(this.addedList[c]);
                for (var d = 0, p = this.newChangedList.length; p > d; d += 1)
                    l.remove(this.newChangedList[d]);
                this.newNoChangedList = l
            }
            if (this.displayModel === zy.SEPARATION && !e.isEmpty() && !t.isEmpty()) {
                var g = e.getSize()
                  , u = t.getSize()
                  , f = 1
                  , m = 1
                  , C = 0;
                f = u.x > g.x ? g.x : u.x,
                m = u.y > g.y ? g.y : u.y;
                var y = s.getModelMatrix()
                  , v = this.firstViewer.viewerImpl.modelManager.scene.getBoundingBoxWorld();
                f > m ? (y.elements[14] += C = 1.5 * m,
                v.min.y -= C / 2,
                v.max.y += C / 2) : (y.elements[13] += C = 1.5 * f,
                v.min.x -= C / 2,
                v.max.x += C / 2),
                s.setModelMatrix(y),
                this.firstViewer.viewerImpl.modelManager.scene.setBoundingBoxWorld(v),
                this.firstViewer.adaptiveSize()
            }
            this.coloringImmediately && (this.firstViewer.colorfulComponentsByKey(this.deletedList, Xy.deletedColor.color, Xy.deletedColor.opacity),
            this.secondViewer.colorfulComponentsByKey(this.addedList, Xy.addedColor.color, Xy.addedColor.opacity),
            this.firstViewer.colorfulComponentsByKey(this.oldChangedList, Xy.changedColor.color, Xy.changedColor.opacity),
            this.secondViewer.colorfulComponentsByKey(this.newChangedList, Xy.changedColor.color, Xy.changedColor.opacity))
        }
    }
    ,
    $y.prototype._getDataByType = function(A) {
        var e = []
          , t = [];
        switch (A) {
        case Zy.added:
            t = this.addedList;
            break;
        case Zy.deleted:
            e = this.deletedList;
            break;
        case Zy.changed:
            e = this.oldChangedList,
            t = this.newChangedList;
            break;
        case Zy.noChanged:
            e = this.oldNoChangedList,
            t = this.newNoChangedList;
            break;
        case Zy.oldChanged:
            e = this.oldChangedList;
            break;
        case Zy.newChanged:
            t = this.newChangedList;
            break;
        case Zy.oldNoChanged:
            e = this.oldNoChangedList;
            break;
        case Zy.newNoChanged:
            t = this.newNoChangedList
        }
        return {
            oldList: e,
            newList: t
        }
    }
    ,
    $y.prototype._addProperty = function(A, e, t) {
        var i = this
          , o = document.createElement("tr");
        o.classList.add("compares_list_tr");
        var n = document.createElement("td");
        n.innerText = A || "",
        o.appendChild(n);
        var r = document.createElement("td");
        if (r.innerText = e || "",
        o.appendChild(r),
        void 0 !== t) {
            var a = document.createElement("td")
              , s = document.createElement("a");
            s.classList.add("showDetails"),
            t ? (s.innerHTML = "查看详情",
            s.addEventListener("click", (function(A) {
                A.stopPropagation();
                for (var e = A.target.parentNode.parentNode.oldKey, t = A.target.parentNode.parentNode.newKey, o = 0, n = A.path.length; n > o; o += 1) {
                    if ("tab-compare-old" === A.path[o].id) {
                        i.showOldContrastDetails(e);
                        break
                    }
                    if ("tab-compare-new" === A.path[o].id) {
                        i.showNewContrastDetails(t);
                        break
                    }
                }
            }
            ))) : s.innerHTML = "无",
            a.appendChild(s),
            o.appendChild(a)
        }
        return o
    }
    ,
    $y.prototype._initCompareResultPlane = function(A) {
        if (this.oldModelLoaded && this.newModelLoaded && this.compareDataLoaded)
            switch (this.displayModel) {
            case zy.AGGREGATION:
            case zy.SEPARATION:
                var e = document.getElementById("tab-compare-old");
                if (!e)
                    return;
                this._createPanel(e, A);
                break;
            case zy.MULTIWINDOW:
                var t = document.getElementById("tab-compare-old");
                if (!t)
                    return;
                this._createInversionPanel(t, A);
                var i = document.getElementById("tab-compare-new");
                if (!i)
                    return;
                this._createPanel(i, A)
            }
    }
    ,
    $y.prototype._createPanel = function(A, e) {
        var t = this;
        if (A) {
            var i = document.createElement("div");
            i.classList.add("compares_list_body"),
            A.appendChild(i);
            var o = document.createElement("div");
            o.classList.add("compares_list_title"),
            o.innerText = "新增构件列表(" + t.addedList.length + ")",
            o.addEventListener("click", (function(A) {
                for (var e = A.target.parentNode.querySelectorAll("tr"), i = [], o = 0, n = e.length; n > o; o += 1)
                    e[o].newKey && i.push(e[o].newKey);
                t.secondViewer.adaptiveSizeByKey(i),
                t.secondViewer.clearColorfulList(),
                t.secondViewer.clearTransparentList(),
                t.secondViewer.transparentOtherComponentsByKey(i),
                t.secondViewer.colorfulComponentsByKey(i, Xy.addedColor.color, Xy.addedColor.opacity)
            }
            )),
            i.appendChild(o);
            var n = document.createElement("table");
            n.classList.add("sx-table"),
            n.classList.add("compares_list_table"),
            n.classList.add("table-no-top"),
            i.appendChild(n);
            var r = document.createElement("thead");
            n.appendChild(r);
            var a = document.createElement("tbody");
            n.appendChild(a);
            var s = document.createElement("tr");
            s.style.backgroundColor = "rgba(0, 128, 0, 0.8)",
            s.className = "noprop";
            var l = document.createElement("th");
            s.appendChild(l);
            var c = document.createElement("span");
            c.classList.add("value"),
            c.classList.add("nonEditable"),
            c.innerHTML = "名称",
            l.appendChild(c);
            var h = document.createElement("th");
            s.appendChild(h);
            var d = document.createElement("span");
            d.classList.add("value"),
            d.classList.add("nonEditable"),
            d.innerHTML = "类型",
            h.appendChild(d),
            r.appendChild(s);
            for (var p = 0, g = t.addedList.length; g > p; p += 1) {
                var u = t.secondViewer.getComponentsByKey(t.addedList[p]);
                if (u && u[0] && u[0][t.addedList[p]] && u[0][t.addedList[p]][0]) {
                    var f = t._addProperty(u[0][t.addedList[p]][0].name, u[0][t.addedList[p]][0].type);
                    f.oldKey = "",
                    f.newKey = t.addedList[p],
                    f.addEventListener("click", (function(A) {
                        var e = A.target.parentNode.newKey;
                        e && (t.secondViewer.adaptiveSizeByKey(e),
                        t.secondViewer.clearColorfulList(),
                        t.secondViewer.clearTransparentList(),
                        t.secondViewer.transparentOtherComponentsByKey(e),
                        t.secondViewer.colorfulComponentsByKey(e, Xy.addedColor.color, Xy.addedColor.opacity))
                    }
                    )),
                    a.appendChild(f)
                }
            }
            var m = t.oldChangedList
              , C = t.newChangedList
              , y = document.createElement("div");
            y.classList.add("compares_list_body"),
            A.appendChild(y);
            var v = document.createElement("div");
            v.classList.add("compares_list_title"),
            v.innerText = "变更构件列表(" + m.length + ")",
            v.addEventListener("click", (function(A) {
                for (var e = A.target.parentNode.querySelectorAll("tr"), i = [], o = [], n = 0, r = e.length; r > n; n += 1)
                    e[n].oldKey && o.push(e[n].oldKey),
                    e[n].newKey && i.push(e[n].newKey);
                switch (t.displayModel) {
                case zy.AGGREGATION:
                case zy.SEPARATION:
                    t.secondViewer.adaptiveSizeByKey(i.concat(o)),
                    t.secondViewer.clearColorfulList(),
                    t.secondViewer.clearTransparentList(),
                    t.secondViewer.transparentOtherComponentsByKey(i.concat(o)),
                    t.secondViewer.colorfulComponentsByKey(i.concat(o), Xy.changedColor.color, Xy.changedColor.opacity);
                    break;
                case zy.MULTIWINDOW:
                    t.firstViewer.adaptiveSizeByKey(o),
                    t.firstViewer.clearColorfulList(),
                    t.firstViewer.clearTransparentList(),
                    t.firstViewer.transparentOtherComponentsByKey(o),
                    t.firstViewer.colorfulComponentsByKey(o, Xy.changedColor.color, Xy.changedColor.opacity),
                    t.secondViewer.adaptiveSizeByKey(i),
                    t.secondViewer.clearColorfulList(),
                    t.secondViewer.clearTransparentList(),
                    t.secondViewer.transparentOtherComponentsByKey(i),
                    t.secondViewer.colorfulComponentsByKey(i, Xy.changedColor.color, Xy.changedColor.opacity)
                }
            }
            )),
            y.appendChild(v);
            var I = document.createElement("table");
            I.classList.add("sx-table"),
            I.classList.add("compares_list_table"),
            I.classList.add("table-no-top"),
            y.appendChild(I);
            var E = document.createElement("thead");
            I.appendChild(E);
            var B = document.createElement("tbody");
            I.appendChild(B);
            var x = document.createElement("tr");
            x.style.backgroundColor = "rgba(255, 165, 0, 0.8)",
            x.className = "noprop";
            var S = document.createElement("th");
            x.appendChild(S);
            var w = document.createElement("span");
            w.classList.add("value"),
            w.classList.add("nonEditable"),
            w.innerHTML = "名称",
            S.appendChild(w);
            var M = document.createElement("th");
            x.appendChild(M);
            var b = document.createElement("span");
            b.classList.add("value"),
            b.classList.add("nonEditable"),
            b.innerHTML = "类型",
            M.appendChild(b);
            var U = document.createElement("th");
            x.appendChild(U);
            var F = document.createElement("span");
            F.classList.add("value"),
            F.classList.add("nonEditable"),
            F.innerHTML = "操作",
            U.appendChild(F),
            E.appendChild(x);
            for (var K = 0, Q = C.length; Q > K; K += 1) {
                var R = t.secondViewer.getComponentsByKey(C[K]);
                if (R && R[0] && R[0][C[K]] && R[0][C[K]][0]) {
                    var T = t._addProperty(R[0][C[K]][0].name, R[0][C[K]][0].type, "geometry" !== C[K].type);
                    T.oldKey = m[K],
                    T.newKey = C[K],
                    T.addEventListener("click", (function(A) {
                        var e = A.target.parentNode.oldKey
                          , i = A.target.parentNode.newKey;
                        if (e && i)
                            switch (t.displayModel) {
                            case zy.AGGREGATION:
                            case zy.SEPARATION:
                                t.secondViewer.adaptiveSizeByKey([e, i]),
                                t.secondViewer.clearColorfulList(),
                                t.secondViewer.clearTransparentList(),
                                t.secondViewer.transparentOtherComponentsByKey([e, i]),
                                t.secondViewer.colorfulComponentsByKey([e, i], Xy.changedColor.color, Xy.changedColor.opacity);
                                break;
                            case zy.MULTIWINDOW:
                                t.firstViewer.adaptiveSizeByKey(e),
                                t.firstViewer.clearColorfulList(),
                                t.firstViewer.clearTransparentList(),
                                t.firstViewer.transparentOtherComponentsByKey(e),
                                t.firstViewer.colorfulComponentsByKey(e, Xy.changedColor.color, Xy.changedColor.opacity),
                                t.secondViewer.adaptiveSizeByKey(i),
                                t.secondViewer.clearColorfulList(),
                                t.secondViewer.clearTransparentList(),
                                t.secondViewer.transparentOtherComponentsByKey(i),
                                t.secondViewer.colorfulComponentsByKey(i, Xy.changedColor.color, Xy.changedColor.opacity)
                            }
                    }
                    )),
                    B.appendChild(T)
                }
            }
            var k = document.createElement("div");
            k.classList.add("compares_list_body"),
            A.appendChild(k);
            var D = document.createElement("div");
            D.classList.add("compares_list_title"),
            D.innerText = "移除构件列表(" + t.deletedList.length + ")",
            D.addEventListener("click", (function(A) {
                for (var e = A.target.parentNode.querySelectorAll("tr"), i = [], o = 0, n = e.length; n > o; o += 1)
                    e[o].oldKey && i.push(e[o].oldKey);
                t.secondViewer.adaptiveSizeByKey(i),
                t.secondViewer.clearColorfulList(),
                t.secondViewer.clearTransparentList(),
                t.secondViewer.transparentOtherComponentsByKey(i),
                t.secondViewer.colorfulComponentsByKey(i, Xy.deletedColor.color, Xy.deletedColor.opacity)
            }
            )),
            k.appendChild(D);
            var L = document.createElement("table");
            L.classList.add("sx-table"),
            L.classList.add("compares_list_table"),
            L.classList.add("table-no-top"),
            k.appendChild(L);
            var N = document.createElement("thead");
            L.appendChild(N);
            var O = document.createElement("tbody");
            L.appendChild(O);
            var V = document.createElement("tr");
            V.style.backgroundColor = "rgba(255, 0, 0, 0.8)",
            V.className = "noprop";
            var G = document.createElement("th");
            V.appendChild(G);
            var P = document.createElement("span");
            P.classList.add("value"),
            P.classList.add("nonEditable"),
            P.innerHTML = "名称",
            G.appendChild(P);
            var q = document.createElement("th");
            V.appendChild(q);
            var j = document.createElement("span");
            j.classList.add("value"),
            j.classList.add("nonEditable"),
            j.innerHTML = "类型",
            q.appendChild(j),
            N.appendChild(V);
            for (var H = 0, Y = t.deletedList.length; Y > H; H += 1) {
                var W = t.firstViewer.getComponentsByKey(t.deletedList[H]);
                if (W && W[0] && W[0][t.deletedList[H]] && W[0][t.deletedList[H]][0]) {
                    var J = t._addProperty(W[0][t.deletedList[H]][0].name, W[0][t.deletedList[H]][0].type);
                    J.oldKey = t.deletedList[H],
                    J.newKey = "",
                    J.addEventListener("click", (function(A) {
                        var e = A.target.parentNode.oldKey;
                        e && (t.firstViewer.adaptiveSizeByKey(e),
                        t.firstViewer.clearColorfulList(),
                        t.firstViewer.clearTransparentList(),
                        t.firstViewer.transparentOtherComponentsByKey(e),
                        t.firstViewer.colorfulComponentsByKey(e, Xy.deletedColor.color, Xy.deletedColor.opacity))
                    }
                    )),
                    O.appendChild(J)
                }
            }
        }
    }
    ,
    $y.prototype._createInversionPanel = function(A, e) {
        var t = this;
        if (A) {
            var i = t.deletedList
              , o = t.addedList
              , n = document.createElement("div");
            n.classList.add("compares_list_body"),
            A.appendChild(n);
            var r = document.createElement("div");
            r.classList.add("compares_list_title"),
            r.innerText = "新增构件列表(" + i.length + ")",
            r.addEventListener("click", (function(A) {
                for (var e = A.target.parentNode.querySelectorAll("tr"), i = [], o = 0, n = e.length; n > o; o += 1)
                    e[o].newKey && i.push(e[o].newKey);
                t.firstViewer.adaptiveSizeByKey(i),
                t.firstViewer.clearColorfulList(),
                t.firstViewer.clearTransparentList(),
                t.firstViewer.transparentOtherComponentsByKey(i),
                t.firstViewer.colorfulComponentsByKey(i, Xy.addedColor.color, Xy.addedColor.opacity)
            }
            )),
            n.appendChild(r);
            var a = document.createElement("table");
            a.classList.add("sx-table"),
            a.classList.add("compares_list_table"),
            a.classList.add("table-no-top"),
            n.appendChild(a);
            var s = document.createElement("thead");
            a.appendChild(s);
            var l = document.createElement("tbody");
            a.appendChild(l);
            var c = document.createElement("tr");
            c.style.backgroundColor = "rgba(0, 128, 0, 0.8)",
            c.className = "noprop";
            var h = document.createElement("th");
            c.appendChild(h);
            var d = document.createElement("span");
            d.classList.add("value"),
            d.classList.add("nonEditable"),
            d.innerHTML = "名称",
            h.appendChild(d);
            var p = document.createElement("th");
            c.appendChild(p);
            var g = document.createElement("span");
            g.classList.add("value"),
            g.classList.add("nonEditable"),
            g.innerHTML = "类型",
            p.appendChild(g),
            s.appendChild(c);
            for (var u = 0, f = i.length; f > u; u += 1) {
                var m = t.firstViewer.getComponentsByKey(i[u]);
                if (m && m[0] && m[0][i[u]] && m[0][i[u]][0]) {
                    var C = t._addProperty(m[0][i[u]][0].name, m[0][i[u]][0].type);
                    C.oldKey = "",
                    C.newKey = i[u],
                    C.addEventListener("click", (function(A) {
                        var e = A.target.parentNode.newKey;
                        e && (t.firstViewer.adaptiveSizeByKey(e),
                        t.firstViewer.clearColorfulList(),
                        t.firstViewer.clearTransparentList(),
                        t.firstViewer.transparentOtherComponentsByKey(e),
                        t.firstViewer.colorfulComponentsByKey(e, Xy.addedColor.color, Xy.addedColor.opacity))
                    }
                    )),
                    l.appendChild(C)
                }
            }
            var y = t.oldChangedList
              , v = t.newChangedList
              , I = document.createElement("div");
            I.classList.add("compares_list_body"),
            A.appendChild(I);
            var E = document.createElement("div");
            E.classList.add("compares_list_title"),
            E.innerText = "变更构件列表(" + y.length + ")",
            E.addEventListener("click", (function(A) {
                for (var e = A.target.parentNode.querySelectorAll("tr"), i = [], o = [], n = 0, r = e.length; r > n; n += 1)
                    e[n].oldKey && o.push(e[n].oldKey),
                    e[n].newKey && i.push(e[n].newKey);
                switch (t.displayModel) {
                case zy.AGGREGATION:
                case zy.SEPARATION:
                    t.secondViewer.adaptiveSizeByKey(i.concat(o)),
                    t.secondViewer.clearColorfulList(),
                    t.secondViewer.clearTransparentList(),
                    t.secondViewer.transparentOtherComponentsByKey(i.concat(o)),
                    t.secondViewer.colorfulComponentsByKey(i.concat(o), Xy.changedColor.color, Xy.changedColor.opacity);
                    break;
                case zy.MULTIWINDOW:
                    t.firstViewer.adaptiveSizeByKey(o),
                    t.firstViewer.clearColorfulList(),
                    t.firstViewer.clearTransparentList(),
                    t.firstViewer.transparentOtherComponentsByKey(o),
                    t.firstViewer.colorfulComponentsByKey(o, Xy.changedColor.color, Xy.changedColor.opacity),
                    t.secondViewer.adaptiveSizeByKey(i),
                    t.secondViewer.clearColorfulList(),
                    t.secondViewer.clearTransparentList(),
                    t.secondViewer.transparentOtherComponentsByKey(i),
                    t.secondViewer.colorfulComponentsByKey(i, Xy.changedColor.color, Xy.changedColor.opacity)
                }
            }
            )),
            I.appendChild(E);
            var B = document.createElement("table");
            B.classList.add("sx-table"),
            B.classList.add("compares_list_table"),
            B.classList.add("table-no-top"),
            I.appendChild(B);
            var x = document.createElement("thead");
            B.appendChild(x);
            var S = document.createElement("tbody");
            B.appendChild(S);
            var w = document.createElement("tr");
            w.style.backgroundColor = "rgba(255, 165, 0, 0.8)",
            w.className = "noprop";
            var M = document.createElement("th");
            w.appendChild(M);
            var b = document.createElement("span");
            b.classList.add("value"),
            b.classList.add("nonEditable"),
            b.innerHTML = "名称",
            M.appendChild(b);
            var U = document.createElement("th");
            w.appendChild(U);
            var F = document.createElement("span");
            F.classList.add("value"),
            F.classList.add("nonEditable"),
            F.innerHTML = "类型",
            U.appendChild(F);
            var K = document.createElement("th");
            w.appendChild(K);
            var Q = document.createElement("span");
            Q.classList.add("value"),
            Q.classList.add("nonEditable"),
            Q.innerHTML = "操作",
            K.appendChild(Q),
            x.appendChild(w);
            for (var R = 0, T = v.length; T > R; R += 1) {
                var k = t.secondViewer.getComponentsByKey(v[R]);
                if (k && k[0] && k[0][v[R]] && k[0][v[R]][0]) {
                    var D = t._addProperty(k[0][v[R]][0].name, k[0][v[R]][0].type, "geometry" !== v[R].type);
                    D.oldKey = y[R],
                    D.newKey = v[R],
                    D.addEventListener("click", (function(A) {
                        var e = A.target.parentNode.oldKey
                          , i = A.target.parentNode.newKey;
                        if (e && i)
                            switch (t.displayModel) {
                            case zy.AGGREGATION:
                            case zy.SEPARATION:
                                t.secondViewer.adaptiveSizeByKey([e, i]),
                                t.secondViewer.clearColorfulList(),
                                t.secondViewer.clearTransparentList(),
                                t.secondViewer.transparentOtherComponentsByKey([e, i]),
                                t.secondViewer.colorfulComponentsByKey([e, i], Xy.changedColor.color, Xy.changedColor.opacity);
                                break;
                            case zy.MULTIWINDOW:
                                t.firstViewer.adaptiveSizeByKey(e),
                                t.firstViewer.clearColorfulList(),
                                t.firstViewer.clearTransparentList(),
                                t.firstViewer.transparentOtherComponentsByKey(e),
                                t.firstViewer.colorfulComponentsByKey(e, Xy.changedColor.color, Xy.changedColor.opacity),
                                t.secondViewer.adaptiveSizeByKey(i),
                                t.secondViewer.clearColorfulList(),
                                t.secondViewer.clearTransparentList(),
                                t.secondViewer.transparentOtherComponentsByKey(i),
                                t.secondViewer.colorfulComponentsByKey(i, Xy.changedColor.color, Xy.changedColor.opacity)
                            }
                    }
                    )),
                    S.appendChild(D)
                }
            }
            var L = document.createElement("div");
            L.classList.add("compares_list_body"),
            A.appendChild(L);
            var N = document.createElement("div");
            N.classList.add("compares_list_title"),
            N.innerText = "移除构件列表(" + o.length + ")",
            N.addEventListener("click", (function(A) {
                for (var e = A.target.parentNode.querySelectorAll("tr"), i = [], o = 0, n = e.length; n > o; o += 1)
                    e[o].oldKey && i.push(e[o].oldKey);
                t.secondViewer.adaptiveSizeByKey(i),
                t.secondViewer.clearColorfulList(),
                t.secondViewer.clearTransparentList(),
                t.secondViewer.transparentOtherComponentsByKey(i),
                t.secondViewer.colorfulComponentsByKey(i, Xy.deletedColor.color, Xy.deletedColor.opacity)
            }
            )),
            L.appendChild(N);
            var O = document.createElement("table");
            O.classList.add("sx-table"),
            O.classList.add("compares_list_table"),
            O.classList.add("table-no-top"),
            L.appendChild(O);
            var V = document.createElement("thead");
            O.appendChild(V);
            var G = document.createElement("tbody");
            O.appendChild(G);
            var P = document.createElement("tr");
            P.style.backgroundColor = "rgba(255, 0, 0, 0.8)",
            P.className = "noprop";
            var q = document.createElement("th");
            P.appendChild(q);
            var j = document.createElement("span");
            j.classList.add("value"),
            j.classList.add("nonEditable"),
            j.innerHTML = "名称",
            q.appendChild(j);
            var H = document.createElement("th");
            P.appendChild(H);
            var Y = document.createElement("span");
            Y.classList.add("value"),
            Y.classList.add("nonEditable"),
            Y.innerHTML = "类型",
            H.appendChild(Y),
            V.appendChild(P);
            for (var W = 0, J = o.length; J > W; W += 1) {
                var z = t.secondViewer.getComponentsByKey(o[W]);
                if (z && z[0] && z[0][o[W]] && z[0][o[W]][0]) {
                    var Z = t._addProperty(z[0][o[W]][0].name, z[0][o[W]][0].type);
                    Z.oldKey = o[W],
                    Z.newKey = "",
                    Z.addEventListener("click", (function(A) {
                        var e = A.target.parentNode.oldKey;
                        e && (t.secondViewer.adaptiveSizeByKey(e),
                        t.secondViewer.clearColorfulList(),
                        t.secondViewer.clearTransparentList(),
                        t.secondViewer.transparentOtherComponentsByKey(e),
                        t.secondViewer.colorfulComponentsByKey(e, Xy.deletedColor.color, Xy.deletedColor.opacity))
                    }
                    )),
                    G.appendChild(Z)
                }
            }
        }
    }
    ;
    var Av = "ON_VIEWER3D_CAMERA_CHANGE"
      , ev = function(A, e) {
        this.viewer2D = e,
        this.viewer3D = A,
        this.enableFocus(),
        this.show3DCameraOn2DViewer()
    };
    ev.prototype.enableFocus = function() {
        var A = this.viewer2D
          , e = this.viewer3D;
        e && A && (A.setOnSelectComponentCallback((function(A) {
            A && A.length > 0 ? (e.highlightComponentsByKey(A),
            e.adaptiveSizeByKey(A)) : e.clearHighlightList()
        }
        )),
        e.registerModelEventListener(Rc.ON_CLICK_PICK, (function(e) {
            e.intersectInfo && e.intersectInfo.selectedObjectId && A.focusOnComponentByKey(e.intersectInfo.selectedObjectId, !0)
        }
        )))
    }
    ,
    ev.prototype.enableMove2DCamera = function() {
        this.viewer2D.getViewerImpl().controlManager.enableTool(this.viewer2D.getViewerImpl(), "viewer3DCameraControl")
    }
    ,
    ev.prototype.disableMove2DCamera = function() {
        this.viewer2D.getViewerImpl().controlManager.disableTool("viewer3DCameraControl")
    }
    ,
    ev.prototype.show3DCameraOn2DViewer = function() {
        var A = this.viewer2D
          , e = this.viewer3D;
        if (e && A) {
            var t = e.getViewerImpl();
            e.registerCameraEventListener(Rc.ON_CAMERA_CHANGE, (function(e) {
                var t = e.camera
                  , i = t.getWorldPosition(new y)
                  , o = t.getWorldDirection(new y);
                A.show3DCamera([i.x, i.y], [o.x, o.y])
            }
            )),
            A.getViewerImpl().cameraControl.addEventListener(Av, (function(A) {
                var e = A.position;
                t.locateToPoint({
                    x: e[0],
                    y: e[1],
                    z: t.camera.position.z
                })
            }
            ))
        }
    }
    ;
    var tv = function A(e, t) {
        Ue.call(this, e),
        this.type = "Reflector";
        var i = this
          , o = new LA(void 0 !== (t = t || {}).color ? t.color : 16777215)
          , n = t.textureWidth || 512
          , r = t.textureHeight || 512
          , s = t.clipBias || 0
          , l = t.shader || A.ReflectorShader
          , c = void 0 !== t.recursion ? t.recursion : 0
          , h = new EA
          , d = new y
          , u = new y
          , f = new y
          , m = new M
          , C = new y(0,0,-1)
          , v = new p
          , I = new y
          , E = new y
          , B = new p
          , x = new M
          , S = new je
          , w = new g(n,r,{
            minFilter: 1006,
            magFilter: 1006,
            format: 1022,
            stencilBuffer: !1
        });
        a.isPowerOfTwo(n) && a.isPowerOfTwo(r) || (w.texture.generateMipmaps = !1);
        var b = new Pe({
            uniforms: Ge.clone(l.uniforms),
            fragmentShader: l.fragmentShader,
            vertexShader: l.vertexShader
        });
        b.uniforms.tDiffuse.value = w.texture,
        b.uniforms.color.value = o,
        b.uniforms.textureMatrix.value = x,
        this.material = b,
        this.onBeforeRender = function(A, e, t) {
            if ("recursion"in t.userData) {
                if (t.userData.recursion === c)
                    return;
                t.userData.recursion += 1
            }
            if (u.setFromMatrixPosition(i.matrixWorld),
            f.setFromMatrixPosition(t.matrixWorld),
            m.extractRotation(i.matrixWorld),
            d.set(0, 0, 1),
            d.applyMatrix4(m),
            I.subVectors(u, f),
            0 >= I.dot(d)) {
                I.reflect(d).negate(),
                I.add(u),
                m.extractRotation(t.matrixWorld),
                C.set(0, 0, -1),
                C.applyMatrix4(m),
                C.add(f),
                E.subVectors(u, C),
                E.reflect(d).negate(),
                E.add(u),
                S.position.copy(I),
                S.up.set(0, 1, 0),
                S.up.applyMatrix4(m),
                S.up.reflect(d),
                S.lookAt(E),
                S.far = t.far,
                S.updateMatrixWorld(),
                S.matrixWorldInverse.getInverse(S.matrixWorld),
                S.projectionMatrix.copy(t.projectionMatrix),
                S.userData.recursion = 0,
                x.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1),
                x.multiply(S.projectionMatrix),
                x.multiply(S.matrixWorldInverse),
                x.multiply(i.matrixWorld),
                h.setFromNormalAndCoplanarPoint(d, u),
                h.applyMatrix4(S.matrixWorldInverse),
                v.set(h.normal.x, h.normal.y, h.normal.z, h.constant);
                var o = S.projectionMatrix;
                B.x = (Math.sign(v.x) + o.elements[8]) / o.elements[0],
                B.y = (Math.sign(v.y) + o.elements[9]) / o.elements[5],
                B.z = -1,
                B.w = (1 + o.elements[10]) / o.elements[14],
                v.multiplyScalar(2 / v.dot(B)),
                o.elements[2] = v.x,
                o.elements[6] = v.y,
                o.elements[10] = v.z + 1 - s,
                o.elements[14] = v.w,
                w.texture.encoding = A.outputEncoding,
                i.visible = !1;
                var n = A.getRenderTarget()
                  , r = A.xr.enabled
                  , a = A.shadowMap.autoUpdate;
                A.xr.enabled = !1,
                A.shadowMap.autoUpdate = !1,
                A.setRenderTarget(w),
                A.state.buffers.depth.setMask(!0),
                !1 === A.autoClear && A.clear(),
                A.render(e, S),
                A.xr.enabled = r,
                A.shadowMap.autoUpdate = a,
                A.setRenderTarget(n);
                var l = t.viewport;
                void 0 !== l && A.state.viewport(l),
                i.visible = !0
            }
        }
        ,
        this.getRenderTarget = function() {
            return w
        }
    };
    (tv.prototype = Object.create(Ue.prototype)).constructor = tv,
    tv.ReflectorShader = {
        uniforms: {
            color: {
                value: null
            },
            tDiffuse: {
                value: null
            },
            textureMatrix: {
                value: null
            }
        },
        vertexShader: ["uniform mat4 textureMatrix;", "varying vec4 vUv;", "void main() {", "    vUv = textureMatrix * vec4( position, 1.0 );", "    gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
        fragmentShader: ["uniform vec3 color;", "uniform sampler2D tDiffuse;", "varying vec4 vUv;", "float blendOverlay( float base, float blend ) {", "    return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );", "}", "vec3 blendOverlay( vec3 base, vec3 blend ) {", "    return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );", "}", "void main() {", "    vec4 base = texture2DProj( tDiffuse, vUv );", "    gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );", "}"].join("\n")
    };
    var iv = function A(e, t) {
        Ue.call(this, e),
        this.type = "Refractor";
        var i = this
          , o = new LA(void 0 !== (t = t || {}).color ? t.color : 8355711)
          , n = t.textureWidth || 512
          , r = t.textureHeight || 512
          , s = t.clipBias || 0
          , l = t.shader || A.RefractorShader
          , c = new je;
        c.matrixAutoUpdate = !1,
        c.userData.refractor = !0;
        var h = new EA
          , d = new M
          , u = new g(n,r,{
            minFilter: 1006,
            magFilter: 1006,
            format: 1022,
            stencilBuffer: !1
        });
        a.isPowerOfTwo(n) && a.isPowerOfTwo(r) || (u.texture.generateMipmaps = !1),
        this.material = new Pe({
            uniforms: Ge.clone(l.uniforms),
            vertexShader: l.vertexShader,
            fragmentShader: l.fragmentShader,
            transparent: !0
        }),
        this.material.uniforms.color.value = o,
        this.material.uniforms.tDiffuse.value = u.texture,
        this.material.uniforms.textureMatrix.value = d;
        var m, C, v, I = function() {
            var A = new y
              , e = new y
              , t = new M
              , o = new y
              , n = new y;
            return function(r) {
                return A.setFromMatrixPosition(i.matrixWorld),
                e.setFromMatrixPosition(r.matrixWorld),
                o.subVectors(A, e),
                t.extractRotation(i.matrixWorld),
                n.set(0, 0, 1),
                n.applyMatrix4(t),
                0 > o.dot(n)
            }
        }(), E = function() {
            var A = new y
              , e = new y
              , t = new f
              , o = new y;
            return function() {
                i.matrixWorld.decompose(e, t, o),
                A.set(0, 0, 1).applyQuaternion(t).normalize(),
                A.negate(),
                h.setFromNormalAndCoplanarPoint(A, e)
            }
        }(), B = (m = new EA,
        C = new p,
        v = new p,
        function(A) {
            c.matrixWorld.copy(A.matrixWorld),
            c.matrixWorldInverse.getInverse(c.matrixWorld),
            c.projectionMatrix.copy(A.projectionMatrix),
            c.far = A.far,
            m.copy(h),
            m.applyMatrix4(c.matrixWorldInverse),
            C.set(m.normal.x, m.normal.y, m.normal.z, m.constant);
            var e = c.projectionMatrix;
            v.x = (Math.sign(C.x) + e.elements[8]) / e.elements[0],
            v.y = (Math.sign(C.y) + e.elements[9]) / e.elements[5],
            v.z = -1,
            v.w = (1 + e.elements[10]) / e.elements[14],
            C.multiplyScalar(2 / C.dot(v)),
            e.elements[2] = C.x,
            e.elements[6] = C.y,
            e.elements[10] = C.z + 1 - s,
            e.elements[14] = C.w
        }
        );
        this.onBeforeRender = function(A, e, t) {
            u.texture.encoding = A.outputEncoding,
            !0 !== t.userData.refractor && !0 != !I(t) && (E(),
            function(A) {
                d.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1),
                d.multiply(A.projectionMatrix),
                d.multiply(A.matrixWorldInverse),
                d.multiply(i.matrixWorld)
            }(t),
            B(t),
            function(A, e, t) {
                i.visible = !1;
                var o = A.getRenderTarget()
                  , n = A.xr.enabled
                  , r = A.shadowMap.autoUpdate;
                A.xr.enabled = !1,
                A.shadowMap.autoUpdate = !1,
                A.setRenderTarget(u),
                !1 === A.autoClear && A.clear(),
                A.render(e, c),
                A.xr.enabled = n,
                A.shadowMap.autoUpdate = r,
                A.setRenderTarget(o);
                var a = t.viewport;
                void 0 !== a && A.state.viewport(a),
                i.visible = !0
            }(A, e, t))
        }
        ,
        this.getRenderTarget = function() {
            return u
        }
    };
    (iv.prototype = Object.create(Ue.prototype)).constructor = iv,
    iv.RefractorShader = {
        uniforms: {
            color: {
                value: null
            },
            tDiffuse: {
                value: null
            },
            textureMatrix: {
                value: null
            }
        },
        vertexShader: ["uniform mat4 textureMatrix;", "varying vec4 vUv;", "void main() {", "    vUv = textureMatrix * vec4( position, 1.0 );", "    gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
        fragmentShader: ["uniform vec3 color;", "uniform sampler2D tDiffuse;", "varying vec4 vUv;", "float blendOverlay( float base, float blend ) {", "    return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );", "}", "vec3 blendOverlay( vec3 base, vec3 blend ) {", "    return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );", "}", "void main() {", "    vec4 base = texture2DProj( tDiffuse, vUv );", "    gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );", "}"].join("\n")
    };
    var ov = function(A) {
        return he.call(this),
        this.points = A,
        this.handlePoints = [],
        this.minX = 0,
        this.minY = 0,
        this.maxX = 0,
        this.maxY = 0,
        this.invalid = !1,
        this._createPlaneGeometry(),
        this
    };
    (ov.prototype = Object.create(he.prototype)).constructor = he,
    ov.prototype._createPlaneGeometry = function() {
        if (this._RemoveDuplicatePoints(this.points))
            this.invalid = !0;
        else {
            if (3 > this.handlePoints.length)
                return Bh.warn("Failed to create plane, the number of the points must be more than three."),
                void (this.invalid = !0);
            if (3 === this.handlePoints.length && 0 === this._area(this.handlePoints[0], this.handlePoints[1], this.handlePoints[2]))
                return Bh.warn("Failed to create plane, points are collinear."),
                void (this.invalid = !0);
            if (this._checkIntersect())
                return Bh.warn("Failed to create plane, the plane border is self-intersecting."),
                void (this.invalid = !0);
            this.handlePoints.push(new s(this.points[0].x,this.points[0].y));
            var A = new ar(new Ba(this.handlePoints))
              , e = new Float32Array(this._updateUv(A));
            A.setAttribute("uv", new YA(e,2)),
            this.attributes = A.attributes,
            this.groups = A.groups,
            this.index = A.index
        }
    }
    ,
    ov.prototype._updateUv = function(A) {
        for (var e = [], t = A.attributes.position.array, i = 0; t.length > i; i += 3) {
            var o = (t[i + 1] - this.minY) / (this.maxY - this.minY);
            e.push((t[i] - this.minX) / (this.maxX - this.minX)),
            e.push(o)
        }
        return e
    }
    ,
    ov.prototype._RemoveDuplicatePoints = function(A) {
        var e = new s(A[0].x,A[0].y);
        this.handlePoints.push(e),
        this.minX = e.x,
        this.maxX = e.x,
        this.minY = e.y,
        this.maxY = e.y;
        for (var t = 1; A.length > t; t += 1) {
            var i = !1;
            if (void 0 === A[t].x || void 0 === A[t].y)
                return Bh.log("Failed to create plane, the format of plane is not right, please follow [{x:,y:},...]"),
                !0;
            for (var o = 0; this.handlePoints.length > o; o += 1)
                if (A[t].x === this.handlePoints[o].x && A[t].y === this.handlePoints[o].y) {
                    i = !0;
                    break
                }
            if (!1 === i) {
                e = new s(A[t].x,A[t].y);
                this.handlePoints.push(e),
                this.minX > e.x && (this.minX = e.x),
                this.minY > e.y && (this.minY = e.y),
                e.x > this.maxX && (this.maxX = e.x),
                e.y > this.maxY && (this.maxY = e.y)
            }
        }
        return !1
    }
    ,
    ov.prototype._checkIntersect = function() {
        for (var A = null, e = null, t = this.handlePoints.length, i = 0; t > i; i += 1) {
            A = this.handlePoints[i],
            e = this.handlePoints[i === t - 1 ? 0 : i + 1];
            for (var o = i + 2; t > o; o += 1)
                if ((0 !== i || o !== t - 1) && this._intersectSegments(A, e, this.handlePoints[o], this.handlePoints[o === t - 1 ? 0 : o + 1]))
                    return !0
        }
        return !1
    }
    ,
    ov.prototype._area = function(A, e, t) {
        return (e.x - A.x) * (t.y - A.y) - (t.x - A.x) * (e.y - A.y)
    }
    ,
    ov.prototype._collinearIntersectCheck = function(A, e, t, i) {
        return (Math.min(A.x, e.x) > t.x || t.x > Math.max(A.x, e.x) || Math.min(A.y, e.y) > t.y || t.y > Math.max(A.y, e.y)) && (Math.min(A.x, e.x) > i.x || i.x > Math.max(A.x, e.x) || Math.min(A.y, e.y) > i.y || i.y > Math.max(A.y, e.y))
    }
    ,
    ov.prototype._intersectSegments = function(A, e, t, i) {
        var o = this._area(A, e, t) * this._area(A, e, i)
          , n = this._area(t, i, A) * this._area(t, i, e);
        return 0 >= o && (0 >= n && (0 !== o || 0 !== n || !this._collinearIntersectCheck(A, e, t, i)))
    }
    ;
    var nv = "data:image/jpeg;base64, "
      , rv = "data:image/jpeg;base64, "
      , av = function A(e, t) {
        Ue.call(this, e),
        this.type = "Water";
        var i = this
          , o = t || {}
          , n = void 0 !== o.color ? o.color : new p(1,1,1,1)
          , r = o.textureWidth || 512
          , a = o.textureHeight || 512
          , l = o.clipBias || 0
          , c = o.flowDirection || new s(1,0)
          , h = o.flowSpeed || .03
          , d = o.reflectivity || 1
          , g = o.scale || 1
          , u = o.shader || A.WaterShader;
        this.reflectorTexturePosition = o.reflectorTexturePosition,
        this.refractorTexturePosition = o.refractorTexturePosition;
        var f = new Aa
          , m = o.flowMap || void 0
          , C = o.normalMap0 || f.load(nv)
          , y = o.normalMap1 || f.load(rv)
          , v = new M
          , I = new as;
        if (void 0 !== tv)
            if (void 0 !== iv) {
                var E = new tv(e,{
                    textureWidth: r,
                    textureHeight: a,
                    clipBias: l
                });
                E.position.copy(this.reflectorTexturePosition),
                E.updateMatrixWorld(!0);
                var B = new iv(e,{
                    textureWidth: r,
                    textureHeight: a,
                    clipBias: l
                });
                B.position.copy(this.refractorTexturePosition),
                B.updateMatrixWorld(!0),
                this.material = new Pe({
                    uniforms: Ge.merge([u.uniforms]),
                    vertexShader: u.vertexShader,
                    fragmentShader: u.fragmentShader,
                    transparent: !0
                }),
                this.material.clipping = !0,
                this.material.side = 2,
                void 0 !== m ? (this.material.defines.USE_FLOWMAP = "",
                this.material.uniforms.tFlowMap = {
                    type: "t",
                    value: m
                }) : this.material.uniforms.flowDirection = {
                    type: "v2",
                    value: c
                },
                C.wrapS = 1e3,
                C.wrapT = 1e3,
                y.wrapS = 1e3,
                y.wrapT = 1e3,
                this.material.uniforms.tReflectionMap.value = E.getRenderTarget().texture,
                this.material.uniforms.tRefractionMap.value = B.getRenderTarget().texture,
                this.material.uniforms.tNormalMap0.value = C,
                this.material.uniforms.tNormalMap1.value = y,
                this.material.uniforms.color.value = n,
                this.material.uniforms.reflectivity.value = d,
                this.material.uniforms.textureMatrix.value = v,
                this.material.uniforms.config.value.x = 0,
                this.material.uniforms.config.value.y = .075,
                this.material.uniforms.config.value.z = .075,
                this.material.uniforms.config.value.w = g,
                this.onBeforeRender = function(A, e, t) {
                    var o, n;
                    !function(A) {
                        v.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1),
                        v.multiply(A.projectionMatrix),
                        v.multiply(A.matrixWorldInverse),
                        v.multiply(i.matrixWorld)
                    }(t),
                    o = I.getDelta(),
                    (n = i.material.uniforms.config).value.x += h * o,
                    n.value.y = n.value.x + .075,
                    .15 > n.value.x ? .15 > n.value.y || (n.value.y = n.value.y - .15) : (n.value.x = 0,
                    n.value.y = .075),
                    i.visible = !1,
                    E.position.equals(this.reflectorTexturePosition) || (E.position.copy(this.reflectorTexturePosition),
                    E.updateMatrixWorld(!0)),
                    B.position.equals(this.refractorTexturePosition) || (B.position.copy(this.refractorTexturePosition),
                    B.updateMatrixWorld(!0)),
                    i.cameraProjectionMatrix || (i.cameraProjectionMatrix = t.projectionMatrix.clone()),
                    t.projectionMatrix.equals(i.cameraProjectionMatrix) || (i.needUpdate = !0),
                    i.waterMatrixWorld || (i.waterMatrixWorld = i.matrixWorld.clone()),
                    i.matrixWorld.equals(i.waterMatrixWorld) || (i.needUpdate = !0),
                    i.needUpdate && (E.onBeforeRender(A, e, t),
                    B.onBeforeRender(A, e, t),
                    i.needUpdate = !1),
                    i.material.uniforms.tReflectionMap.value = E.getRenderTarget().texture,
                    i.material.uniforms.tRefractionMap.value = B.getRenderTarget().texture,
                    i.visible = !0
                }
            } else
                Bh.error("THREE.Water: Required component THREE.Refractor not found.");
        else
            Bh.error("THREE.Water: Required component THREE.Reflector not found.")
    };
    (av.prototype = Object.create(Ue.prototype)).constructor = av,
    av.WaterShader = {
        uniforms: {
            color: {
                type: "v4",
                value: null
            },
            reflectivity: {
                type: "f",
                value: 0
            },
            tReflectionMap: {
                type: "t",
                value: null
            },
            tRefractionMap: {
                type: "t",
                value: null
            },
            tNormalMap0: {
                type: "t",
                value: null
            },
            tNormalMap1: {
                type: "t",
                value: null
            },
            textureMatrix: {
                type: "m4",
                value: null
            },
            config: {
                type: "v4",
                value: new p
            }
        },
        vertexShader: ["#include <fog_pars_vertex>", "uniform mat4 textureMatrix;", "varying vec4 vCoord;", "varying vec2 vUv;", "varying vec3 vToEye;", "#include <clipping_planes_pars_vertex>", "void main() {", "    vUv = uv;", "    vCoord = textureMatrix * vec4( position, 1.0 );", "    vec4 worldPosition = modelMatrix * vec4( position, 1.0 );", "    vToEye = cameraPosition - worldPosition.xyz;", "    vec4 mvPosition =  viewMatrix * worldPosition;", "    gl_Position = projectionMatrix * mvPosition;", "    #include <clipping_planes_vertex>", "    #include <fog_vertex>", "}"].join("\n"),
        fragmentShader: ["#include <common>", "#include <fog_pars_fragment>", "uniform sampler2D tReflectionMap;", "uniform sampler2D tRefractionMap;", "uniform sampler2D tNormalMap0;", "uniform sampler2D tNormalMap1;", "#ifdef USE_FLOWMAP", "    uniform sampler2D tFlowMap;", "#else", "    uniform vec2 flowDirection;", "#endif", "uniform vec4 color;", "uniform float reflectivity;", "uniform vec4 config;", "#include <clipping_planes_pars_fragment>", "varying vec4 vCoord;", "varying vec2 vUv;", "varying vec3 vToEye;", "void main() {", "    #include <clipping_planes_fragment>", "    float flowMapOffset0 = config.x;", "    float flowMapOffset1 = config.y;", "    float halfCycle = config.z;", "    float scale = config.w;", "    vec3 toEye = normalize( vToEye );", "    vec2 flow;", "    #ifdef USE_FLOWMAP", "        flow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0;", "    #else", "        flow = flowDirection;", "    #endif", "    flow.x *= - 1.0;", "    vec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 );", "    vec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 );", "    float flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle;", "    vec4 normalColor = mix( normalColor0, normalColor1, flowLerp );", "    vec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b,  normalColor.g * 2.0 - 1.0 ) );", "    float theta = max( dot( toEye, normal ), 0.0 );", "    float reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 );", "    vec3 coord = vCoord.xyz / vCoord.w;", "    vec2 uv = coord.xy + coord.z * normal.xz * 0.05;", "    vec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) );", "    vec4 refractColor = texture2D( tRefractionMap, uv );", "    gl_FragColor = color * mix( refractColor, reflectColor, reflectance );", "    #include <tonemapping_fragment>", "    #include <encodings_fragment>", "    #include <fog_fragment>", "}"].join("\n")
    };
    var sv = function(A) {
        A ? (this.boundary = A.boundary,
        this.color = A.color,
        this.viewer = A.viewer,
        this.scale = A.scale,
        this.xDirection = A.xDirection,
        this.yDirection = A.yDirection,
        this.reflectivity = A.reflectivity,
        A.reflectorTexturePosition ? "number" == typeof A.reflectorTexturePosition.x ? "number" == typeof A.reflectorTexturePosition.y ? "number" == typeof A.reflectorTexturePosition.z ? (this.reflectorTexturePosition = (new y).copy(A.reflectorTexturePosition),
        A.refractorTexturePosition ? "number" == typeof A.refractorTexturePosition.x ? "number" == typeof A.refractorTexturePosition.y ? "number" == typeof A.refractorTexturePosition.z ? (this.refractorTexturePosition = (new y).copy(A.refractorTexturePosition),
        this.viewer && this.viewer instanceof Gy ? (A.geometry || 0 !== this.boundary.length) && (this.geometry = A.geometry || new ov(this.boundary),
        this.water = new av(this.geometry,{
            color: new p(this.color.r,this.color.g,this.color.b,this.color.a),
            scale: this.scale,
            reflectivity: this.reflectivity,
            flowDirection: new s(this.xDirection,this.yDirection),
            textureWidth: 1024,
            textureHeight: 1024,
            reflectorTexturePosition: this.reflectorTexturePosition,
            refractorTexturePosition: this.refractorTexturePosition
        }),
        this.height = A.height,
        this.water.translateZ(this.height),
        this.water.renderOrder = -1,
        this.water.disPickable = !0,
        this.id = uh.createUUID(),
        this.water.name = this.id,
        this.water.autoAnimation = !0,
        this.viewer.addExternalObject(this.id, this.water)) : Bh.log("ERROR::viewer must not support.")) : Bh.error("缺少参数 reflectorTexturePosition.z") : Bh.error("缺少参数 reflectorTexturePosition.y") : Bh.error("缺少参数 reflectorTexturePosition.x") : Bh.error("缺少参数 reflectorTexturePosition")) : Bh.error("缺少参数 reflectorTexturePosition.z") : Bh.error("缺少参数 reflectorTexturePosition.y") : Bh.error("缺少参数 reflectorTexturePosition.x") : Bh.error("缺少参数 reflectorTexturePosition")) : Bh.error("ERROR::waterEffectConfig 不能为空.")
    };
    sv.prototype.getBoundary = function() {
        return this.boundary
    }
    ,
    sv.prototype.getColor = function() {
        return this.color
    }
    ,
    sv.prototype.getScale = function() {
        return this.scale
    }
    ,
    sv.prototype.getXDirection = function() {
        return this.xDirection
    }
    ,
    sv.prototype.getYDirection = function() {
        return this.yDirection
    }
    ,
    sv.prototype.setColor = function(A) {
        A instanceof Xh ? (this.color = A,
        this.water.material.uniforms.color.value.set(this.color.r, this.color.g, this.color.b, this.color.a)) : Bh.log("ERROR::color should be instance of EIMMODEL.Color")
    }
    ,
    sv.prototype.setScale = function(A) {
        this.scale = A,
        this.water.material.uniforms.config.value.w = A
    }
    ,
    sv.prototype.setReflectivity = function(A) {
        this.reflectivity = A,
        this.water.material.uniforms.reflectivity.value = A
    }
    ,
    sv.prototype.getReflectivity = function() {
        return this.reflectivity
    }
    ,
    sv.prototype.getReflectorTexturePosition = function() {
        return this.reflectorTexturePosition.clone()
    }
    ,
    sv.prototype.getRefractorTexturePosition = function() {
        return this.refractorTexturePosition.clone()
    }
    ,
    sv.prototype.setReflectorTexturePosition = function(A) {
        A ? "number" == typeof A.x ? "number" == typeof A.y ? "number" == typeof A.z ? (this.reflectorTexturePosition = new y(A.x,A.y,A.z),
        this.water.reflectorTexturePosition = this.reflectorTexturePosition) : Bh.error("缺少参数 position.z") : Bh.error("缺少参数 position.y") : Bh.error("缺少参数 position.x") : Bh.error("缺少参数 position")
    }
    ,
    sv.prototype.setRefractorTexturePosition = function(A) {
        A ? "number" == typeof A.x ? "number" == typeof A.y ? "number" == typeof A.z ? (this.refractorTexturePosition = new y(A.x,A.y,A.z),
        this.water.refractorTexturePosition = this.refractorTexturePosition) : Bh.error("缺少参数 position.z") : Bh.error("缺少参数 position.y") : Bh.error("缺少参数 position.x") : Bh.error("缺少参数 position")
    }
    ,
    sv.prototype.setXDirection = function(A) {
        this.xDirection = A,
        this.water.material.uniforms.flowDirection.value.x = A
    }
    ,
    sv.prototype.setYDirection = function(A) {
        this.yDirection = A,
        this.water.material.uniforms.flowDirection.value.y = A
    }
    ,
    sv.prototype.remove = function() {
        this.viewer.removeExternalObjectByName(this.id)
    }
    ,
    sv.prototype.setHeight = function(A) {
        this.height = A,
        this.water.translateZ(A),
        this.water.updateMatrixWorld(!0)
    }
    ,
    sv.prototype.getHeight = function() {
        return this.height
    }
    ,
    sv.prototype.setGeometry = function(A) {
        A.isGeometry || A.isBufferGeometry ? (this.geometry = A,
        this.water.geometry = A) : Bh.log("ERROR::geometry type not support")
    }
    ,
    sv.prototype.getGeometry = function() {
        return this.geometry
    }
    ,
    sv.prototype.getWaterObject = function() {
        return this.water
    }
    ;
    var lv = Symbol("_flowing")
      , cv = function() {
        function A(e) {
            cc(this, A),
            this.viewer = e.viewer3D;
            var t = e.opt;
            this.arrowParameters = t,
            this.arrowParameters.speed = this.arrowParameters.speed || 5,
            this.arrowParameters.spacing = this.arrowParameters.spacing || 100,
            this.arrowArray = [],
            this.pathNumb = 0,
            this.totalLength = 0,
            this.path = [],
            !0 === t.customizeMesh ? this.geometricModelLength = t.meshLength : t.arrowShape ? (t.arrowShape.rectangleLength = t.arrowShape.rectangleLength || 500,
            t.arrowShape.triangleBottomHeight = t.arrowShape.triangleBottomHeight || 260,
            this.geometricModelLength = t.arrowShape.rectangleLength + t.arrowShape.triangleBottomHeight ? t.arrowShape.triangleBottomHeight : 260) : this.geometricModelLength = 760,
            this.intervalLength = this.geometricModelLength + t.spacing,
            this.materialObject = {},
            this.materialsInit = this.arrowParameters.materialsInit || "default",
            this.materialsUpdate = this.arrowParameters.materialsUpdate || "fixed",
            this.isFlowing = !1,
            t.callback && (t.callback.enter && (this.callbackEnter = t.callback.enter),
            t.callback.out && (this.callbackOut = t.callback.out)),
            this.meshGroupId = (new Date).getTime(),
            this.meshGroup ? this.meshGroup.children = [] : this.meshGroup = new Xi
        }
        return dc(A, [{
            key: "calculationPathOffset",
            value: function() {
                for (var A = this.path, e = 0; A.length > e; e += 1) {
                    var t = (new y).copy(A[e].startingPoint)
                      , i = new f
                      , o = new f
                      , n = new y(1,1,1);
                    if (A[e].offset) {
                        var r = (new y).copy(A[e].offset.pathDepthAxis).applyQuaternion(i);
                        t.add(r.multiplyScalar(A[e].offset.depth)),
                        o.setFromAxisAngle(A[e].startPoint2EndPointAxis, A[e].angle),
                        i.premultiply(o),
                        o.setFromAxisAngle(A[e].vectorNormalize, A[e].offset.angle),
                        i.premultiply(o)
                    } else
                        o.setFromAxisAngle(A[e].startPoint2EndPointAxis, A[e].angle),
                        i.premultiply(o);
                    A[e].rotationComponent = {},
                    A[e].rotationComponent.position = t,
                    A[e].rotationComponent.quaternion = i,
                    A[e].rotationComponent.scale = n
                }
            }
        }, {
            key: "translationPath",
            value: function() {
                var A = new y(1,0,0)
                  , e = this.arrowParameters.points
                  , t = e.length - 1
                  , i = [];
                this.totalLength = 0;
                for (var o = 0; t > o; o += 1) {
                    var n = {};
                    if (n.startingPoint = new y(e[o].x,e[o].y,e[o].z),
                    n.endingPoint = new y(e[o + 1].x,e[o + 1].y,e[o + 1].z),
                    n.length = n.startingPoint.distanceTo(n.endingPoint),
                    n.vector = (new y).subVectors(n.endingPoint, n.startingPoint),
                    n.vectorNormalize = (new y).subVectors(n.endingPoint, n.startingPoint).normalize(),
                    n.startPoint2EndPointAxis = (new y).crossVectors(A, n.vectorNormalize).normalize(),
                    n.numb = o,
                    n.angle = A.angleTo(n.vectorNormalize),
                    this.arrowParameters.offset && this.arrowParameters.offset[o + 1]) {
                        var r = {}
                          , a = this.arrowParameters.offset[o + 1]
                          , s = a.depth
                          , l = a.angle
                          , c = void 0 === l ? 0 : l;
                        r.depth = void 0 === s ? 0 : s,
                        r.angle = Math.PI / 180 * c,
                        r.pathDepthAxis = new y(0,1,0).applyAxisAngle(n.startPoint2EndPointAxis, n.angle),
                        r.pathDepthAxis.applyAxisAngle(n.vectorNormalize, r.angle).normalize(),
                        n.offset = r
                    }
                    this.totalLength += n.length,
                    i.push(n)
                }
                this.path = i,
                this.pathNumb = this.path.length
            }
        }, {
            key: "calculationArrowAmount",
            value: function() {
                var A = this.arrowParameters
                  , e = 0;
                if (A.createMode && "number" === A.createMode && A.arrowAmount && A.arrowAmount > 0)
                    if (A.intervalMode && "strict" === A.intervalMode) {
                        if (e = Math.floor(this.totalLength / this.intervalLength),
                        A.arrowAmount > e)
                            return {
                                code: "001",
                                message: "Too many arrows,over the length of the path"
                            };
                        this.arrowAmount = A.arrowAmount,
                        this.CreateMode = "number",
                        this.IntervalMode = "strict"
                    } else {
                        if (e = Math.floor(this.totalLength / this.geometricModelLength),
                        A.arrowAmount > e)
                            return {
                                code: "001",
                                message: "Too many arrows,over the length of the path"
                            };
                        this.arrowAmount = A.arrowAmount,
                        this.CreateMode = "number";
                        var t = Math.floor(100 * (this.totalLength - this.intervalLength * A.arrowAmount) / A.arrowAmount) / 100;
                        this.intervalLength += t,
                        this.IntervalMode = "free"
                    }
                else {
                    if (A.createMode && "number" === A.createMode && A.arrowAmount && 1 > A.arrowAmount)
                        return {
                            code: "002",
                            message: "the number is error"
                        };
                    if (e = Math.floor(this.totalLength / this.intervalLength),
                    A.intervalMode && "strict" === A.intervalMode)
                        this.IntervalMode = "strict";
                    else {
                        var i = Math.floor(100 * (this.totalLength % this.intervalLength) / e) / 100;
                        this.intervalLength += i,
                        this.IntervalMode = "free"
                    }
                    this.arrowAmount = e,
                    this.CreateMode = "space"
                }
            }
        }, {
            key: "createArrowArray",
            value: function() {
                var A = this.arrowAmount;
                if (!0 === this.arrowParameters.customizeMesh)
                    for (var e = 0; A > e; e += 1) {
                        var t = this.arrowParameters.mesh.clone();
                        t.material = this.materialObject.default,
                        this.arrowArray.push(t),
                        this.meshGroup.add(t)
                    }
                else
                    for (var i = this.arrowParameters.arrowShape, o = void 0 === i ? {} : i, n = o.triangleBottomLength || 400, r = o.triangleBottomHeight || 260, a = o.rectangleWidth || 180, s = o.rectangleLength || 500, l = o.arrowHeight || 80, c = new Float32Array([r + s, l, 0, s, l, n / 2, s, l, -n / 2, r + s, 0, 0, s, 0, n / 2, s, 0, -n / 2, s, l, -a / 2, s, l, a / 2, 0, l, a / 2, 0, l, -a / 2, s, 0, -a / 2, s, 0, a / 2, 0, 0, a / 2, 0, 0, -a / 2]), h = [2, 1, 0, 3, 4, 5, 0, 1, 4, 0, 4, 3, 1, 2, 4, 4, 2, 5, 5, 2, 0, 3, 5, 0, 8, 7, 6, 9, 8, 6, 13, 9, 6, 10, 13, 6, 12, 8, 9, 9, 13, 12, 12, 13, 10, 12, 10, 11, 7, 8, 12, 11, 7, 12], d = 0; A > d; d += 1) {
                        var p = this.createArrowMesh(c, h);
                        p.arrowID = d,
                        this.arrowArray.push(p),
                        this.meshGroup.add(p)
                    }
            }
        }, {
            key: "createArrowMesh",
            value: function(A, e) {
                var t = new he;
                t.setIndex(e);
                var i = new YA(A,3);
                return t.attributes.position = i,
                new Ue(t,this.materialObject.default)
            }
        }, {
            key: "createMaterialArray",
            value: function() {
                for (var A = this.arrowParameters.colors, e = this.arrowParameters.materials, t = this.path.length, i = 1; t >= i; i += 1)
                    e && e[i] ? this.materialObject[i] = e[i] : A && A[i] && (this.materialObject[i] = new jA({
                        color: A[i]
                    }));
                e && e.default ? this.materialObject.default = e.default : A && A.default ? this.materialObject.default = new jA({
                    color: A.default
                }) : (this.materialObject.default = new jA({
                    color: 10606038
                }),
                this.materialObject.default.transparent = !0,
                this.materialObject.default.opacity = .8)
            }
        }, {
            key: "initPostition",
            value: function() {
                var A = this.arrowArray
                  , e = this.path
                  , t = A.length
                  , i = 0
                  , o = this.intervalLength
                  , n = 0
                  , r = new f;
                if (this.arrowParameters.enterSceMod && "progressive" === this.arrowParameters.enterSceMod)
                    for (var a = 0; t > a; a += 1) {
                        var s = A[a];
                        s.quaternion.copy(r),
                        s.position.x = e[i].startingPoint.x,
                        s.position.y = e[i].startingPoint.y,
                        s.position.z = e[i].startingPoint.z,
                        s.pathOrder = i,
                        e[i].offset ? (s.translateOnAxis(e[i].vectorNormalize, -o * n),
                        s.translateOnAxis(e[i].offset.pathDepthAxis, e[i].offset.depth),
                        s.rotateOnWorldAxis(e[i].startPoint2EndPointAxis, e[i].angle),
                        s.rotateOnWorldAxis(e[i].vectorNormalize, e[i].offset.angle)) : (s.translateOnAxis(e[i].vectorNormalize, -o * n),
                        s.rotateOnWorldAxis(e[i].startPoint2EndPointAxis, e[i].angle)),
                        s.visible = !1,
                        s.userData.BosArrowExt = {},
                        s.userData.BosArrowExt.enterState = "unenter",
                        "path" === this.materialsInit && this.materialObject[i + 1] && (s.material = this.materialObject[i + 1]),
                        s.updateMatrixWorld(),
                        n += 1
                    }
                else
                    for (var l = 0, c = 0; t > c; c += 1) {
                        var h = A[c];
                        h.quaternion.copy(r);
                        var d = e[i];
                        d.offset ? (h.position.x = d.startingPoint.x,
                        h.position.y = d.startingPoint.y,
                        h.position.z = d.startingPoint.z,
                        h.translateOnAxis(d.vectorNormalize, o * n + l),
                        h.translateOnAxis(d.offset.pathDepthAxis, d.offset.depth),
                        h.rotateOnWorldAxis(d.startPoint2EndPointAxis, d.angle),
                        h.rotateOnWorldAxis(d.vectorNormalize, d.offset.angle)) : (h.position.x = d.startingPoint.x,
                        h.position.y = d.startingPoint.y,
                        h.position.z = d.startingPoint.z,
                        h.translateOnAxis(d.vectorNormalize, o * n + l),
                        h.rotateOnWorldAxis(d.startPoint2EndPointAxis, d.angle)),
                        h.pathOrder = i,
                        "path" === this.materialsInit && this.materialObject[i + 1] && (h.material = this.materialObject[i + 1]),
                        d.length - l > o * (n + 1) || (l = o * (n + 1) - d.length + l,
                        i += 1,
                        n = -1),
                        h.updateMatrixWorld(),
                        n += 1
                    }
                this.viewer.removeExternalObjectByName(this.meshGroupId),
                this.viewer.addExternalObject(this.meshGroupId, this.meshGroup)
            }
        }, {
            key: "setSpeed",
            value: function(A) {
                this.isFlowing ? (this.stopFlow(),
                this.arrowParameters.speed = A,
                this.startFlow()) : this.arrowParameters.speed = A
            }
        }, {
            key: "init",
            value: function() {
                this.translationPath(),
                this.calculationPathOffset(),
                this.calculationArrowAmount(),
                this.createMaterialArray(),
                this.createArrowArray(),
                this.initPostition()
            }
        }, {
            key: "updatePosition",
            value: function() {
                var A = this
                  , e = this.path
                  , t = this.arrowParameters.speed;
                this.arrowArray.forEach((function(i) {
                    if (!i.lockPosUpDate || !0 !== i.lockPosUpDate) {
                        var o = 0;
                        if (i.userData.BosArrowExt && i.userData.BosArrowExt.enterState && "unenter" === i.userData.BosArrowExt.enterState) {
                            var n = i.position.distanceTo(e[0].endingPoint);
                            return e[0].length > n && ("fixed" !== A.materialsUpdate && A.materialObject[0] ? i.material = A.materialObject[0] : "fixed" === A.materialsUpdate || A.materialObject[0] || (i.material = A.materialObject.default),
                            A.callbackEnter && "function" == typeof A.callbackEnter && A.callbackEnter(i, e[0]),
                            i.visible = !0,
                            i.userData.BosArrowExt.enterState = "enter",
                            "fixed" !== A.materialsUpdate && A.materialObject[1] ? i.material = A.materialObject[1] : "fixed" === A.materialsUpdate || A.materialObject[1] || (i.material = A.materialObject.default)),
                            i.translateX(t + o),
                            void i.updateMatrixWorld()
                        }
                        var r = i.position.distanceTo(e[i.pathOrder].startingPoint);
                        r > e[i.pathOrder].length - A.geometricModelLength && !1 !== i.visible && (i.visible = !1,
                        A.callbackOut && "function" == typeof A.callbackOut && A.callbackOut(i, e[i.pathOrder])),
                        !1 === i.visible && (i.pathOrder + 1 === A.pathNumb ? e[i.pathOrder].length > r || (o = r - e[i.pathOrder].length,
                        i.pathOrder = 0,
                        i.position.copy(e[i.pathOrder].rotationComponent.position),
                        i.scale.copy(e[i.pathOrder].rotationComponent.scale),
                        i.setRotationFromQuaternion(e[i.pathOrder].rotationComponent.quaternion),
                        "fixed" !== A.materialsUpdate && A.materialObject[1] ? i.material = A.materialObject[1] : "fixed" === A.materialsUpdate || A.materialObject[1] || (i.material = A.materialObject.default),
                        A.callbackEnter && "function" == typeof A.callbackEnter && A.callbackEnter(i, e[i.pathOrder]),
                        i.visible = !0) : e[i.pathOrder].length > r || (o = r - e[i.pathOrder].length,
                        i.pathOrder += 1,
                        i.position.copy(e[i.pathOrder].rotationComponent.position),
                        i.scale.copy(e[i.pathOrder].rotationComponent.scale),
                        i.setRotationFromQuaternion(e[i.pathOrder].rotationComponent.quaternion),
                        "fixed" !== A.materialsUpdate && A.materialObject[i.pathOrder + 1] ? i.material = A.materialObject[i.pathOrder + 1] : "fixed" === A.materialsUpdate || A.materialObject[i.pathOrder + 1] || (i.material = A.materialObject.default),
                        i.visible = !0,
                        A.callbackEnter && "function" == typeof A.callbackEnter && A.callbackEnter(i, e[i.pathOrder]))),
                        i.translateX(t + o),
                        i.updateMatrixWorld()
                    }
                }
                )),
                this.viewer.render()
            }
        }, {
            key: lv,
            value: function() {
                this.requestAnimationFrameID = requestAnimationFrame(this[lv].bind(this)),
                this.updatePosition()
            }
        }, {
            key: "startFlow",
            value: function() {
                if (this.isFlowing)
                    return {
                        code: "003",
                        message: "Do not open repeatedly"
                    };
                this.isFlowing = !0,
                this.requestAnimationFrameID = requestAnimationFrame(this[lv].bind(this))
            }
        }, {
            key: "stopFlow",
            value: function() {
                cancelAnimationFrame(this.requestAnimationFrameID),
                this.isFlowing = !1
            }
        }, {
            key: "hide",
            value: function() {
                this.viewer.removeExternalObjectByName(this.meshGroupId)
            }
        }, {
            key: "show",
            value: function() {
                this.hide(),
                this.viewer.addExternalObject(this.meshGroupId, this.meshGroup)
            }
        }, {
            key: "clear",
            value: function() {
                this.hide(),
                this.meshGroup.children = [],
                this.arrowArray = []
            }
        }]),
        A
    }();
    function hv(A, e) {
        return A === e || A != A && e != e
    }
    function dv(A, e) {
        for (var t = A.length; t--; )
            if (hv(A[t][0], e))
                return t;
        return -1
    }
    var pv = Array.prototype.splice;
    function gv(A) {
        var e = -1
          , t = null == A ? 0 : A.length;
        for (this.clear(); ++e < t; ) {
            var i = A[e];
            this.set(i[0], i[1])
        }
    }
    gv.prototype.clear = function() {
        this.__data__ = [],
        this.size = 0
    }
    ,
    gv.prototype.delete = function(A) {
        var e = this.__data__
          , t = dv(e, A);
        return t >= 0 && (t == e.length - 1 ? e.pop() : pv.call(e, t, 1),
        --this.size,
        !0)
    }
    ,
    gv.prototype.get = function(A) {
        var e = this.__data__
          , t = dv(e, A);
        return 0 > t ? void 0 : e[t][1]
    }
    ,
    gv.prototype.has = function(A) {
        return dv(this.__data__, A) > -1
    }
    ,
    gv.prototype.set = function(A, e) {
        var t = this.__data__
          , i = dv(t, A);
        return 0 > i ? (++this.size,
        t.push([A, e])) : t[i][1] = e,
        this
    }
    ;
    var uv = "object" == typeof global && global && global.Object === Object && global
      , fv = "object" == typeof self && self && self.Object === Object && self
      , mv = uv || fv || Function("return this")()
      , Cv = mv.Symbol
      , yv = Object.prototype
      , vv = yv.hasOwnProperty
      , Iv = yv.toString
      , Ev = Cv ? Cv.toStringTag : void 0;
    var Bv = Object.prototype.toString;
    var xv = Cv ? Cv.toStringTag : void 0;
    function Sv(A) {
        return null == A ? void 0 === A ? "[object Undefined]" : "[object Null]" : xv && xv in Object(A) ? function(A) {
            var e = vv.call(A, Ev)
              , t = A[Ev];
            try {
                A[Ev] = void 0;
                var i = !0
            } catch (A) {}
            var o = Iv.call(A);
            return i && (e ? A[Ev] = t : delete A[Ev]),
            o
        }(A) : function(A) {
            return Bv.call(A)
        }(A)
    }
    function wv(A) {
        var e = typeof A;
        return null != A && ("object" == e || "function" == e)
    }
    function Mv(A) {
        if (!wv(A))
            return !1;
        var e = Sv(A);
        return "[object Function]" == e || "[object GeneratorFunction]" == e || "[object AsyncFunction]" == e || "[object Proxy]" == e
    }
    var bv, Uv = mv["__core-js_shared__"], Fv = (bv = /[^.]+$/.exec(Uv && Uv.keys && Uv.keys.IE_PROTO || "")) ? "Symbol(src)_1." + bv : "";
    var Kv = Function.prototype.toString;
    function Qv(A) {
        if (null != A) {
            try {
                return Kv.call(A)
            } catch (A) {}
            try {
                return A + ""
            } catch (A) {}
        }
        return ""
    }
    var Rv = /^\[object .+?Constructor\]$/
      , Tv = RegExp("^" + Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
    function kv(A) {
        return !(!wv(A) || (e = A,
        Fv && Fv in e)) && (Mv(A) ? Tv : Rv).test(Qv(A));
        var e
    }
    function Dv(A, e) {
        var t = function(A, e) {
            return null == A ? void 0 : A[e]
        }(A, e);
        return kv(t) ? t : void 0
    }
    var Lv = Dv(mv, "Map")
      , Nv = Dv(Object, "create");
    var Ov = Object.prototype.hasOwnProperty;
    var Vv = Object.prototype.hasOwnProperty;
    function Gv(A) {
        var e = -1
          , t = null == A ? 0 : A.length;
        for (this.clear(); ++e < t; ) {
            var i = A[e];
            this.set(i[0], i[1])
        }
    }
    function Pv(A, e) {
        var t, i, o = A.__data__;
        return ("string" == (i = typeof (t = e)) || "number" == i || "symbol" == i || "boolean" == i ? "__proto__" !== t : null === t) ? o["string" == typeof e ? "string" : "hash"] : o.map
    }
    function qv(A) {
        var e = -1
          , t = null == A ? 0 : A.length;
        for (this.clear(); ++e < t; ) {
            var i = A[e];
            this.set(i[0], i[1])
        }
    }
    Gv.prototype.clear = function() {
        this.__data__ = Nv ? Nv(null) : {},
        this.size = 0
    }
    ,
    Gv.prototype.delete = function(A) {
        var e = this.has(A) && delete this.__data__[A];
        return this.size -= e ? 1 : 0,
        e
    }
    ,
    Gv.prototype.get = function(A) {
        var e = this.__data__;
        if (Nv) {
            var t = e[A];
            return "__lodash_hash_undefined__" === t ? void 0 : t
        }
        return Ov.call(e, A) ? e[A] : void 0
    }
    ,
    Gv.prototype.has = function(A) {
        var e = this.__data__;
        return Nv ? void 0 !== e[A] : Vv.call(e, A)
    }
    ,
    Gv.prototype.set = function(A, e) {
        var t = this.__data__;
        return this.size += this.has(A) ? 0 : 1,
        t[A] = Nv && void 0 === e ? "__lodash_hash_undefined__" : e,
        this
    }
    ,
    qv.prototype.clear = function() {
        this.size = 0,
        this.__data__ = {
            hash: new Gv,
            map: new (Lv || gv),
            string: new Gv
        }
    }
    ,
    qv.prototype.delete = function(A) {
        var e = Pv(this, A).delete(A);
        return this.size -= e ? 1 : 0,
        e
    }
    ,
    qv.prototype.get = function(A) {
        return Pv(this, A).get(A)
    }
    ,
    qv.prototype.has = function(A) {
        return Pv(this, A).has(A)
    }
    ,
    qv.prototype.set = function(A, e) {
        var t = Pv(this, A)
          , i = t.size;
        return t.set(A, e),
        this.size += t.size == i ? 0 : 1,
        this
    }
    ;
    function jv(A) {
        var e = this.__data__ = new gv(A);
        this.size = e.size
    }
    jv.prototype.clear = function() {
        this.__data__ = new gv,
        this.size = 0
    }
    ,
    jv.prototype.delete = function(A) {
        var e = this.__data__
          , t = e.delete(A);
        return this.size = e.size,
        t
    }
    ,
    jv.prototype.get = function(A) {
        return this.__data__.get(A)
    }
    ,
    jv.prototype.has = function(A) {
        return this.__data__.has(A)
    }
    ,
    jv.prototype.set = function(A, e) {
        var t = this.__data__;
        if (t instanceof gv) {
            var i = t.__data__;
            if (!Lv || 199 > i.length)
                return i.push([A, e]),
                this.size = ++t.size,
                this;
            t = this.__data__ = new qv(i)
        }
        return t.set(A, e),
        this.size = t.size,
        this
    }
    ;
    var Hv = function() {
        try {
            var A = Dv(Object, "defineProperty");
            return A({}, "", {}),
            A
        } catch (A) {}
    }();
    function Yv(A, e, t) {
        "__proto__" == e && Hv ? Hv(A, e, {
            configurable: !0,
            enumerable: !0,
            value: t,
            writable: !0
        }) : A[e] = t
    }
    var Wv = Object.prototype.hasOwnProperty;
    function Jv(A, e, t) {
        var i = A[e];
        Wv.call(A, e) && hv(i, t) && (void 0 !== t || e in A) || Yv(A, e, t)
    }
    function zv(A, e, t, i) {
        var o = !t;
        t || (t = {});
        for (var n = -1, r = e.length; ++n < r; ) {
            var a = e[n]
              , s = i ? i(t[a], A[a], a, t, A) : void 0;
            void 0 === s && (s = A[a]),
            o ? Yv(t, a, s) : Jv(t, a, s)
        }
        return t
    }
    function Zv(A) {
        return null != A && "object" == typeof A
    }
    function Xv(A) {
        return Zv(A) && "[object Arguments]" == Sv(A)
    }
    var _v = Object.prototype
      , $v = _v.hasOwnProperty
      , AI = _v.propertyIsEnumerable
      , eI = Xv(function() {
        return arguments
    }()) ? Xv : function(A) {
        return Zv(A) && $v.call(A, "callee") && !AI.call(A, "callee")
    }
      , tI = Array.isArray;
    var iI = "object" == typeof A && A && !A.nodeType && A
      , oI = iI && "object" == typeof module && module && !module.nodeType && module
      , nI = oI && oI.exports === iI ? mv.Buffer : void 0
      , rI = (nI ? nI.isBuffer : void 0) || function() {
        return !1
    }
      , aI = /^(?:0|[1-9]\d*)$/;
    function sI(A, e) {
        var t = typeof A;
        return !!(e = null == e ? 9007199254740991 : e) && ("number" == t || "symbol" != t && aI.test(A)) && A > -1 && A % 1 == 0 && e > A
    }
    function lI(A) {
        return "number" == typeof A && A > -1 && A % 1 == 0 && 9007199254740991 >= A
    }
    var cI = {};
    function hI(A) {
        return function(e) {
            return A(e)
        }
    }
    cI["[object Float32Array]"] = cI["[object Float64Array]"] = cI["[object Int8Array]"] = cI["[object Int16Array]"] = cI["[object Int32Array]"] = cI["[object Uint8Array]"] = cI["[object Uint8ClampedArray]"] = cI["[object Uint16Array]"] = cI["[object Uint32Array]"] = !0,
    cI["[object Arguments]"] = cI["[object Array]"] = cI["[object ArrayBuffer]"] = cI["[object Boolean]"] = cI["[object DataView]"] = cI["[object Date]"] = cI["[object Error]"] = cI["[object Function]"] = cI["[object Map]"] = cI["[object Number]"] = cI["[object Object]"] = cI["[object RegExp]"] = cI["[object Set]"] = cI["[object String]"] = cI["[object WeakMap]"] = !1;
    var dI = "object" == typeof A && A && !A.nodeType && A
      , pI = dI && "object" == typeof module && module && !module.nodeType && module
      , gI = pI && pI.exports === dI && uv.process
      , uI = function() {
        try {
            var A = pI && pI.require && pI.require("util").types;
            return A || gI && gI.binding && gI.binding("util")
        } catch (A) {}
    }()
      , fI = uI && uI.isTypedArray
      , mI = fI ? hI(fI) : function(A) {
        return Zv(A) && lI(A.length) && !!cI[Sv(A)]
    }
      , CI = Object.prototype.hasOwnProperty;
    function yI(A, e) {
        var t = tI(A)
          , i = !t && eI(A)
          , o = !t && !i && rI(A)
          , n = !t && !i && !o && mI(A)
          , r = t || i || o || n
          , a = r ? function(A, e) {
            for (var t = -1, i = Array(A); ++t < A; )
                i[t] = e(t);
            return i
        }(A.length, String) : []
          , s = a.length;
        for (var l in A)
            !e && !CI.call(A, l) || r && ("length" == l || o && ("offset" == l || "parent" == l) || n && ("buffer" == l || "byteLength" == l || "byteOffset" == l) || sI(l, s)) || a.push(l);
        return a
    }
    var vI = Object.prototype;
    function II(A) {
        var e = A && A.constructor;
        return A === ("function" == typeof e && e.prototype || vI)
    }
    function EI(A, e) {
        return function(t) {
            return A(e(t))
        }
    }
    var BI = EI(Object.keys, Object)
      , xI = Object.prototype.hasOwnProperty;
    function SI(A) {
        return null != A && lI(A.length) && !Mv(A)
    }
    function wI(A) {
        return SI(A) ? yI(A) : function(A) {
            if (!II(A))
                return BI(A);
            var e = [];
            for (var t in Object(A))
                xI.call(A, t) && "constructor" != t && e.push(t);
            return e
        }(A)
    }
    var MI = Object.prototype.hasOwnProperty;
    function bI(A) {
        if (!wv(A))
            return function(A) {
                var e = [];
                if (null != A)
                    for (var t in Object(A))
                        e.push(t);
                return e
            }(A);
        var e = II(A)
          , t = [];
        for (var i in A)
            ("constructor" != i || !e && MI.call(A, i)) && t.push(i);
        return t
    }
    function UI(A) {
        return SI(A) ? yI(A, !0) : bI(A)
    }
    var FI = "object" == typeof A && A && !A.nodeType && A
      , KI = FI && "object" == typeof module && module && !module.nodeType && module
      , QI = KI && KI.exports === FI ? mv.Buffer : void 0
      , RI = QI ? QI.allocUnsafe : void 0;
    function TI() {
        return []
    }
    var kI = Object.prototype.propertyIsEnumerable
      , DI = Object.getOwnPropertySymbols
      , LI = DI ? function(A) {
        return null == A ? [] : (A = Object(A),
        function(A, e) {
            for (var t = -1, i = null == A ? 0 : A.length, o = 0, n = []; ++t < i; ) {
                var r = A[t];
                e(r, t, A) && (n[o++] = r)
            }
            return n
        }(DI(A), (function(e) {
            return kI.call(A, e)
        }
        )))
    }
    : TI;
    function NI(A, e) {
        for (var t = -1, i = e.length, o = A.length; ++t < i; )
            A[o + t] = e[t];
        return A
    }
    var OI = EI(Object.getPrototypeOf, Object)
      , VI = Object.getOwnPropertySymbols ? function(A) {
        for (var e = []; A; )
            NI(e, LI(A)),
            A = OI(A);
        return e
    }
    : TI;
    function GI(A, e, t) {
        var i = e(A);
        return tI(A) ? i : NI(i, t(A))
    }
    function PI(A) {
        return GI(A, wI, LI)
    }
    function qI(A) {
        return GI(A, UI, VI)
    }
    var jI = Dv(mv, "DataView")
      , HI = Dv(mv, "Promise")
      , YI = Dv(mv, "Set")
      , WI = Dv(mv, "WeakMap")
      , JI = Qv(jI)
      , zI = Qv(Lv)
      , ZI = Qv(HI)
      , XI = Qv(YI)
      , _I = Qv(WI)
      , $I = Sv;
    (jI && "[object DataView]" != $I(new jI(new ArrayBuffer(1))) || Lv && "[object Map]" != $I(new Lv) || HI && "[object Promise]" != $I(HI.resolve()) || YI && "[object Set]" != $I(new YI) || WI && "[object WeakMap]" != $I(new WI)) && ($I = function(A) {
        var e = Sv(A)
          , t = "[object Object]" == e ? A.constructor : void 0
          , i = t ? Qv(t) : "";
        if (i)
            switch (i) {
            case JI:
                return "[object DataView]";
            case zI:
                return "[object Map]";
            case ZI:
                return "[object Promise]";
            case XI:
                return "[object Set]";
            case _I:
                return "[object WeakMap]"
            }
        return e
    }
    );
    var AE = $I
      , eE = Object.prototype.hasOwnProperty;
    var tE = mv.Uint8Array;
    function iE(A) {
        var e = new A.constructor(A.byteLength);
        return new tE(e).set(new tE(A)),
        e
    }
    var oE = /\w*$/;
    var nE = Cv ? Cv.prototype : void 0
      , rE = nE ? nE.valueOf : void 0;
    function aE(A, e, t) {
        var i, o = A.constructor;
        switch (e) {
        case "[object ArrayBuffer]":
            return iE(A);
        case "[object Boolean]":
        case "[object Date]":
            return new o(+A);
        case "[object DataView]":
            return function(A, e) {
                var t = e ? iE(A.buffer) : A.buffer;
                return new A.constructor(t,A.byteOffset,A.byteLength)
            }(A, t);
        case "[object Float32Array]":
        case "[object Float64Array]":
        case "[object Int8Array]":
        case "[object Int16Array]":
        case "[object Int32Array]":
        case "[object Uint8Array]":
        case "[object Uint8ClampedArray]":
        case "[object Uint16Array]":
        case "[object Uint32Array]":
            return function(A, e) {
                var t = e ? iE(A.buffer) : A.buffer;
                return new A.constructor(t,A.byteOffset,A.length)
            }(A, t);
        case "[object Map]":
            return new o;
        case "[object Number]":
        case "[object String]":
            return new o(A);
        case "[object RegExp]":
            return function(A) {
                var e = new A.constructor(A.source,oE.exec(A));
                return e.lastIndex = A.lastIndex,
                e
            }(A);
        case "[object Set]":
            return new o;
        case "[object Symbol]":
            return i = A,
            rE ? Object(rE.call(i)) : {}
        }
    }
    var sE = Object.create
      , lE = function() {
        function A() {}
        return function(e) {
            if (!wv(e))
                return {};
            if (sE)
                return sE(e);
            A.prototype = e;
            var t = new A;
            return A.prototype = void 0,
            t
        }
    }();
    var cE = uI && uI.isMap
      , hE = cE ? hI(cE) : function(A) {
        return Zv(A) && "[object Map]" == AE(A)
    }
    ;
    var dE = uI && uI.isSet
      , pE = dE ? hI(dE) : function(A) {
        return Zv(A) && "[object Set]" == AE(A)
    }
      , gE = {};
    function uE(A, e, t, i, o, n) {
        var r, a = 1 & e, s = 2 & e, l = 4 & e;
        if (t && (r = o ? t(A, i, o, n) : t(A)),
        void 0 !== r)
            return r;
        if (!wv(A))
            return A;
        var c = tI(A);
        if (c) {
            if (r = function(A) {
                var e = A.length
                  , t = new A.constructor(e);
                return e && "string" == typeof A[0] && eE.call(A, "index") && (t.index = A.index,
                t.input = A.input),
                t
            }(A),
            !a)
                return function(A, e) {
                    var t = -1
                      , i = A.length;
                    for (e || (e = Array(i)); ++t < i; )
                        e[t] = A[t];
                    return e
                }(A, r)
        } else {
            var h = AE(A)
              , d = "[object Function]" == h || "[object GeneratorFunction]" == h;
            if (rI(A))
                return function(A, e) {
                    if (e)
                        return A.slice();
                    var t = A.length
                      , i = RI ? RI(t) : new A.constructor(t);
                    return A.copy(i),
                    i
                }(A, a);
            if ("[object Object]" == h || "[object Arguments]" == h || d && !o) {
                if (r = s || d ? {} : function(A) {
                    return "function" != typeof A.constructor || II(A) ? {} : lE(OI(A))
                }(A),
                !a)
                    return s ? function(A, e) {
                        return zv(A, VI(A), e)
                    }(A, function(A, e) {
                        return A && zv(e, UI(e), A)
                    }(r, A)) : function(A, e) {
                        return zv(A, LI(A), e)
                    }(A, function(A, e) {
                        return A && zv(e, wI(e), A)
                    }(r, A))
            } else {
                if (!gE[h])
                    return o ? A : {};
                r = aE(A, h, a)
            }
        }
        n || (n = new jv);
        var p = n.get(A);
        if (p)
            return p;
        n.set(A, r),
        pE(A) ? A.forEach((function(i) {
            r.add(uE(i, e, t, i, A, n))
        }
        )) : hE(A) && A.forEach((function(i, o) {
            r.set(o, uE(i, e, t, o, A, n))
        }
        ));
        var g = l ? s ? qI : PI : s ? keysIn : wI
          , u = c ? void 0 : g(A);
        return function(A, e) {
            for (var t = -1, i = null == A ? 0 : A.length; ++t < i && !1 !== e(A[t], t, A); )
                ;
        }(u || A, (function(i, o) {
            u && (i = A[o = i]),
            Jv(r, o, uE(i, e, t, o, A, n))
        }
        )),
        r
    }
    gE["[object Arguments]"] = gE["[object Array]"] = gE["[object ArrayBuffer]"] = gE["[object DataView]"] = gE["[object Boolean]"] = gE["[object Date]"] = gE["[object Float32Array]"] = gE["[object Float64Array]"] = gE["[object Int8Array]"] = gE["[object Int16Array]"] = gE["[object Int32Array]"] = gE["[object Map]"] = gE["[object Number]"] = gE["[object Object]"] = gE["[object RegExp]"] = gE["[object Set]"] = gE["[object String]"] = gE["[object Symbol]"] = gE["[object Uint8Array]"] = gE["[object Uint8ClampedArray]"] = gE["[object Uint16Array]"] = gE["[object Uint32Array]"] = !0,
    gE["[object Error]"] = gE["[object Function]"] = gE["[object WeakMap]"] = !1;
    function fE(A) {
        return uE(A, 5)
    }
    var mE = function() {
        var A, e = {
            defaultRadius: 40,
            defaultRenderer: "canvas2d",
            defaultGradient: {
                .25: "rgb(0,0,255)",
                .55: "rgb(0,255,0)",
                .85: "yellow",
                1: "rgb(255,0,0)"
            },
            defaultMaxOpacity: 1,
            defaultMinOpacity: 0,
            defaultBlur: .85,
            defaultXField: "x",
            defaultYField: "y",
            defaultValueField: "value",
            plugins: {}
        }, t = function() {
            var A = function(A) {
                this._coordinator = {},
                this._data = [],
                this._radi = [],
                this._min = 10,
                this._max = 1,
                this._xField = A.xField || A.defaultXField,
                this._yField = A.yField || A.defaultYField,
                this._valueField = A.valueField || A.defaultValueField,
                A.radius && (this._cfgRadius = A.radius)
            }
              , t = e.defaultRadius;
            return A.prototype = {
                _organiseData: function(A, e) {
                    var i = A[this._xField]
                      , o = A[this._yField]
                      , n = this._radi
                      , r = this._data
                      , a = this._max
                      , s = this._min
                      , l = A[this._valueField] || 1
                      , c = A.radius || this._cfgRadius || t;
                    r[i] || (r[i] = [],
                    n[i] = []),
                    r[i][o] ? r[i][o] += l : (r[i][o] = l,
                    n[i][o] = c);
                    var h = r[i][o];
                    return h > a ? (e ? this.setDataMax(h) : this._max = h,
                    !1) : s > h ? (e ? this.setDataMin(h) : this._min = h,
                    !1) : {
                        x: i,
                        y: o,
                        value: l,
                        radius: c,
                        min: s,
                        max: a
                    }
                },
                _unOrganizeData: function() {
                    var A = []
                      , e = this._data
                      , t = this._radi;
                    for (var i in e)
                        for (var o in e[i])
                            A.push({
                                x: i,
                                y: o,
                                radius: t[i][o],
                                value: e[i][o]
                            });
                    return {
                        min: this._min,
                        max: this._max,
                        data: A
                    }
                },
                _onExtremaChange: function() {
                    this._coordinator.emit("extremachange", {
                        min: this._min,
                        max: this._max
                    })
                },
                addData: function() {
                    if (arguments[0].length > 0)
                        for (var A = arguments[0], e = A.length; e--; )
                            this.addData.call(this, A[e]);
                    else {
                        var t = this._organiseData(arguments[0], !0);
                        t && (0 === this._data.length && (this._min = this._max = t.value),
                        this._coordinator.emit("renderpartial", {
                            min: this._min,
                            max: this._max,
                            data: [t]
                        }))
                    }
                    return this
                },
                setData: function(A) {
                    var e = A.data
                      , t = e.length;
                    this._data = [],
                    this._radi = [];
                    for (var i = 0; t > i; i++)
                        this._organiseData(e[i], !1);
                    return this._max = A.max,
                    this._min = A.min || 0,
                    this._onExtremaChange(),
                    this._coordinator.emit("renderall", this._getInternalData()),
                    this
                },
                removeData: function() {},
                setDataMax: function(A) {
                    return this._max = A,
                    this._onExtremaChange(),
                    this._coordinator.emit("renderall", this._getInternalData()),
                    this
                },
                setDataMin: function(A) {
                    return this._min = A,
                    this._onExtremaChange(),
                    this._coordinator.emit("renderall", this._getInternalData()),
                    this
                },
                setCoordinator: function(A) {
                    this._coordinator = A
                },
                _getInternalData: function() {
                    return {
                        max: this._max,
                        min: this._min,
                        data: this._data,
                        radi: this._radi
                    }
                },
                getData: function() {
                    return this._unOrganizeData()
                }
            },
            A
        }(), i = function() {
            var A = function(A) {
                var e = A.gradient || A.defaultGradient
                  , t = document.createElement("canvas")
                  , i = t.getContext("2d");
                t.width = 256,
                t.height = 1;
                var o = i.createLinearGradient(0, 0, 256, 1);
                for (var n in e)
                    o.addColorStop(n, e[n]);
                return i.fillStyle = o,
                i.fillRect(0, 0, 256, 1),
                i.getImageData(0, 0, 256, 1).data
            }
              , e = function(A, e) {
                var t = document.createElement("canvas")
                  , i = t.getContext("2d")
                  , o = A
                  , n = A;
                if (t.width = t.height = 2 * A,
                1 == e)
                    i.beginPath(),
                    i.arc(o, n, A, 0, 2 * Math.PI, !1),
                    i.fillStyle = "rgba(0,0,0,1)",
                    i.fill();
                else {
                    var r = i.createRadialGradient(o, n, A * e, o, n, A);
                    r.addColorStop(0, "rgba(0,0,0,1)"),
                    r.addColorStop(1, "rgba(0,0,0,0)"),
                    i.fillStyle = r,
                    i.fillRect(0, 0, 2 * A, 2 * A)
                }
                return t
            };
            function t(e) {
                var t = e.container
                  , i = this.shadowCanvas = document.createElement("canvas")
                  , o = this.canvas = e.canvas || document.createElement("canvas")
                  , n = (this._renderBoundaries = [1e4, 1e4, 0, 0],
                getComputedStyle(e.container) || {});
                o.className = "heatmap-canvas",
                this._width = o.width = i.width = e.width || +n.width.replace(/px/, ""),
                this._height = o.height = i.height = e.height || +n.height.replace(/px/, ""),
                this.shadowCtx = i.getContext("2d"),
                this.ctx = o.getContext("2d"),
                o.style.cssText = i.style.cssText = "position:absolute;left:0;top:0;",
                t.style.position = "relative",
                t.appendChild(o),
                this._palette = A(e),
                this._templates = {},
                this._setStyles(e)
            }
            return t.prototype = {
                renderPartial: function(A) {
                    A.data.length > 0 && (this._drawAlpha(A),
                    this._colorize())
                },
                renderAll: function(A) {
                    this._clear(),
                    A.data.length > 0 && (this._drawAlpha(function(A) {
                        for (var e = [], t = A.min, i = A.max, o = A.radi, n = (A = A.data,
                        Object.keys(A)), r = n.length; r--; )
                            for (var a = n[r], s = Object.keys(A[a]), l = s.length; l--; ) {
                                var c = s[l];
                                e.push({
                                    x: a,
                                    y: c,
                                    value: A[a][c],
                                    radius: o[a][c]
                                })
                            }
                        return {
                            min: t,
                            max: i,
                            data: e
                        }
                    }(A)),
                    this._colorize())
                },
                _updateGradient: function(e) {
                    this._palette = A(e)
                },
                updateConfig: function(A) {
                    A.gradient && this._updateGradient(A),
                    this._setStyles(A)
                },
                setDimensions: function(A, e) {
                    this._width = A,
                    this._height = e,
                    this.canvas.width = this.shadowCanvas.width = A,
                    this.canvas.height = this.shadowCanvas.height = e
                },
                _clear: function() {
                    this.shadowCtx.clearRect(0, 0, this._width, this._height),
                    this.ctx.clearRect(0, 0, this._width, this._height)
                },
                _setStyles: function(A) {
                    this._blur = 0 == A.blur ? 0 : A.blur || A.defaultBlur,
                    A.backgroundColor && (this.canvas.style.backgroundColor = A.backgroundColor),
                    this._width = this.canvas.width = this.shadowCanvas.width = A.width || this._width,
                    this._height = this.canvas.height = this.shadowCanvas.height = A.height || this._height,
                    this._opacity = 255 * (A.opacity || 0),
                    this._maxOpacity = 255 * (A.maxOpacity || A.defaultMaxOpacity),
                    this._minOpacity = 255 * (A.minOpacity || A.defaultMinOpacity),
                    this._useGradientOpacity = !!A.useGradientOpacity
                },
                _drawAlpha: function(A) {
                    for (var t = this._min = A.min, i = this._max = A.max, o = (A = A.data || []).length, n = 1 - this._blur; o--; ) {
                        var r, a = A[o], s = a.x, l = a.y, c = a.radius, h = Math.min(a.value, i), d = s - c, p = l - c, g = this.shadowCtx;
                        this._templates[c] ? r = this._templates[c] : this._templates[c] = r = e(c, n);
                        var u = (h - t) / (i - t);
                        g.globalAlpha = .01 > u ? .01 : u,
                        g.drawImage(r, d, p),
                        this._renderBoundaries[0] > d && (this._renderBoundaries[0] = d),
                        this._renderBoundaries[1] > p && (this._renderBoundaries[1] = p),
                        d + 2 * c > this._renderBoundaries[2] && (this._renderBoundaries[2] = d + 2 * c),
                        p + 2 * c > this._renderBoundaries[3] && (this._renderBoundaries[3] = p + 2 * c)
                    }
                },
                _colorize: function() {
                    var A = this._renderBoundaries[0]
                      , e = this._renderBoundaries[1]
                      , t = this._renderBoundaries[2] - A
                      , i = this._renderBoundaries[3] - e
                      , o = this._width
                      , n = this._height
                      , r = this._opacity
                      , a = this._maxOpacity
                      , s = this._minOpacity
                      , l = this._useGradientOpacity;
                    0 > A && (A = 0),
                    0 > e && (e = 0),
                    A + t > o && (t = o - A),
                    e + i > n && (i = n - e);
                    for (var c = this.shadowCtx.getImageData(A, e, t, i), h = c.data, d = h.length, p = this._palette, g = 3; d > g; g += 4) {
                        var u, f = h[g], m = 4 * f;
                        if (m)
                            u = r > 0 ? r : a > f ? s > f ? s : f : a,
                            h[g - 3] = p[m],
                            h[g - 2] = p[m + 1],
                            h[g - 1] = p[m + 2],
                            h[g] = l ? p[m + 3] : u
                    }
                    this.shadowCtx.putImageData(c, A, e),
                    this.ctx.putImageData(c, A, e),
                    this._renderBoundaries = [1e3, 1e3, 0, 0]
                },
                getValueAt: function(A) {
                    var e = this.shadowCtx.getImageData(A.x, A.y, 1, 1).data[3];
                    return Math.abs(this._max - this._min) * (e / 255) >> 0
                },
                getDataURL: function() {
                    return this.canvas.toDataURL()
                }
            },
            t
        }(), o = (A = !1,
        "canvas2d" === e.defaultRenderer && (A = i),
        A), n = function() {
            for (var A = {}, e = arguments.length, t = 0; e > t; t++) {
                var i = arguments[t];
                for (var o in i)
                    A[o] = i[o]
            }
            return A
        }, r = function() {
            var A = function() {
                function A() {
                    this.cStore = {}
                }
                return A.prototype = {
                    on: function(A, e, t) {
                        var i = this.cStore;
                        i[A] || (i[A] = []),
                        i[A].push((function(A) {
                            return e.call(t, A)
                        }
                        ))
                    },
                    emit: function(A, e) {
                        var t = this.cStore;
                        if (t[A])
                            for (var i = t[A].length, o = 0; i > o; o++) {
                                (0,
                                t[A][o])(e)
                            }
                    }
                },
                A
            }()
              , i = function(A) {
                var e = A._renderer
                  , t = A._coordinator
                  , i = A._store;
                t.on("renderpartial", e.renderPartial, e),
                t.on("renderall", e.renderAll, e),
                t.on("extremachange", (function(e) {
                    A._config.onExtremaChange && A._config.onExtremaChange({
                        min: e.min,
                        max: e.max,
                        gradient: A._config.gradient || A._config.defaultGradient
                    })
                }
                )),
                i.setCoordinator(t)
            };
            function r() {
                var r = this._config = n(e, arguments[0] || {});
                if (this._coordinator = new A,
                r.plugin) {
                    var a = r.plugin;
                    if (!e.plugins[a])
                        throw new Error("Plugin '" + a + "' not found. Maybe it was not registered.");
                    var s = e.plugins[a];
                    this._renderer = new s.renderer(r),
                    this._store = new s.store(r)
                } else
                    this._renderer = new o(r),
                    this._store = new t(r);
                i(this)
            }
            return r.prototype = {
                addData: function() {
                    return this._store.addData.apply(this._store, arguments),
                    this
                },
                removeData: function() {
                    return this._store.removeData && this._store.removeData.apply(this._store, arguments),
                    this
                },
                setData: function() {
                    return this._store.setData.apply(this._store, arguments),
                    this
                },
                setDataMax: function() {
                    return this._store.setDataMax.apply(this._store, arguments),
                    this
                },
                setDataMin: function() {
                    return this._store.setDataMin.apply(this._store, arguments),
                    this
                },
                configure: function(A) {
                    return this._config = n(this._config, A),
                    this._renderer.updateConfig(this._config),
                    this._coordinator.emit("renderall", this._store._getInternalData()),
                    this
                },
                repaint: function() {
                    return this._coordinator.emit("renderall", this._store._getInternalData()),
                    this
                },
                getData: function() {
                    return this._store.getData()
                },
                getDataURL: function() {
                    return this._renderer.getDataURL()
                },
                getValueAt: function(A) {
                    return this._store.getValueAt ? this._store.getValueAt(A) : this._renderer.getValueAt ? this._renderer.getValueAt(A) : null
                }
            },
            r
        }();
        return {
            create: function(A) {
                return new r(A)
            },
            register: function(A, t) {
                e.plugins[A] = t
            }
        }
    }()
      , CE = function() {
        function A(e) {
            cc(this, A),
            this.viewer = e.viewer3D,
            this.id = e.id,
            this.boundary = [],
            this.quaternion = new f,
            this.xMin = 1 / 0,
            this.yMax = -1 / 0,
            this.zoomRate = .05
        }
        return dc(A, [{
            key: "createInstance",
            value: function(A, e) {
                var t = document.createElement("div");
                t.id = "heatmap-" + this.id || (new Date).getTime(),
                t.style.width = "10px",
                t.style.height = "10px",
                t.style.position = "absolute",
                t.style.top = "0",
                t.style.left = "0",
                t.style.zIndex = "-10",
                t.style.overflow = "scroll";
                var i = document.createElement("div");
                i.style.width = A + "px",
                i.style.height = e + "px",
                t.appendChild(i),
                this.viewer.viewportDiv.appendChild(t),
                this.container = t,
                this.heatmap = mE.create({
                    container: i
                })
            }
        }, {
            key: "getHeatmap",
            value: function() {
                return this.heatmap
            }
        }, {
            key: "isPlane",
            value: function(A) {
                if (3 > A.length)
                    return !1;
                if (3 === A.length)
                    return !0;
                for (var e = !0, t = (new y).subVectors(A[0], A[1]), i = (new y).subVectors(A[1], A[2]), o = t.cross(i).normalize(), n = 3; A.length > n; n++) {
                    var r = (new y).subVectors(A[n - 1], A[n]).cross(i).normalize()
                      , a = .001;
                    if (Math.abs(Math.abs(o.x) - Math.abs(r.x)) > a || Math.abs(Math.abs(o.y) - Math.abs(r.y)) > a || Math.abs(Math.abs(o.z) - Math.abs(r.z)) > a) {
                        e = !1;
                        break
                    }
                }
                return e
            }
        }, {
            key: "addHeatmap",
            value: function(A, e) {
                var t = fE(e.boundary);
                if (e.data.data.forEach((function(A) {
                    t.push(A.point)
                }
                )),
                this.isPlane(t)) {
                    this.boundary = fE(e.boundary);
                    var i = new f
                      , o = (new y).subVectors(e.boundary[1], e.boundary[0]).cross((new y).subVectors(e.boundary[2], e.boundary[1]));
                    i.setFromUnitVectors(o.normalize(), new y(0,0,1));
                    var n = fE(e.boundary).map((function(A) {
                        return A.applyQuaternion(i)
                    }
                    ));
                    this.quaternion = i.clone();
                    var r = 1 / 0
                      , a = -1 / 0
                      , s = 1 / 0
                      , l = -1 / 0;
                    n.forEach((function(A) {
                        r > A.x && (r = A.x),
                        A.x > a && (a = A.x),
                        s > A.y && (s = A.y),
                        A.y > l && (l = A.y)
                    }
                    ));
                    var c = a - r
                      , h = l - s;
                    this.xMin = r,
                    this.yMax = l;
                    var d = e.quality || .05;
                    this.zoomRate = d,
                    this.createInstance(Math.round(c * d), Math.round(h * d));
                    var p = e.data.data.map((function(A) {
                        return A.point.applyQuaternion(i)
                    }
                    ))
                      , g = [];
                    e.data.data.forEach((function(A, e) {
                        var t = p[e];
                        g.push({
                            x: Math.round((t.x - r) * d),
                            y: Math.round((l - t.y) * d),
                            value: A.value,
                            radius: (A.radius || 1e3) * d
                        })
                    }
                    )),
                    this.heatmap.setData({
                        min: e.data.min,
                        max: e.data.max,
                        data: g
                    });
                    var u = new ov(n)
                      , m = new jA({
                        map: new en(this.container.querySelector("canvas")),
                        side: 2,
                        transparent: !0,
                        polygonOffset: !0,
                        polygonOffsetFactor: -1,
                        polygonOffsetUnits: -1
                    })
                      , C = new Kf(u,m);
                    C.visible = !0;
                    var v = new M;
                    v.elements[14] = n[0].z;
                    var I = new M;
                    return I.makeRotationFromQuaternion(i.inverse()),
                    C.applyMatrix4(I.multiply(v)),
                    this.viewer.addExternalObject(A, C),
                    C.disPickable = !0,
                    this.viewer.disableComponentsSelectionByKey(A),
                    !0
                }
                return !1
            }
        }, {
            key: "updateHeatmap",
            value: function(A) {
                var e = this
                  , t = fE(this.boundary);
                if (A.data.data.forEach((function(A) {
                    t.push(A.point)
                }
                )),
                this.isPlane(t)) {
                    var i = []
                      , o = A.data.data.map((function(A) {
                        return new y(A.point.x,A.point.y,A.point.z).applyQuaternion(e.quaternion)
                    }
                    ))
                      , n = this.zoomRate;
                    return A.data.data.forEach((function(A, t) {
                        var r = o[t];
                        i.push({
                            x: Math.round((r.x - e.xMin) * n),
                            y: Math.round((e.yMax - r.y) * n),
                            value: A.value,
                            radius: (A.radius || 1e3) * n
                        })
                    }
                    )),
                    this.heatmap.setData({
                        min: A.data.min,
                        max: A.data.max,
                        data: i
                    }),
                    this.viewer.getExternalObjectByName(A.id).material.map.needsUpdate = !0,
                    this.viewer.render(),
                    !0
                }
                return !1
            }
        }, {
            key: "removeHeatmap",
            value: function(A) {
                this.viewer.removeExternalObjectByName(A),
                this.viewer.viewportDiv.removeChild(this.container)
            }
        }]),
        A
    }()
      , yE = function(A) {
        this.maxEdgeLength = A
    };
    yE.prototype.modify = function(A) {
        for (var e, t = [], i = [], o = this.maxEdgeLength * this.maxEdgeLength, n = 0, r = A.faceVertexUvs.length; r > n; n++)
            i[n] = [];
        for (n = 0,
        r = A.faces.length; r > n; n++) {
            var a = A.faces[n];
            if (a instanceof GA) {
                var s = a.a
                  , l = a.b
                  , c = a.c
                  , h = A.vertices[s]
                  , d = A.vertices[l]
                  , p = A.vertices[c]
                  , g = h.distanceToSquared(d)
                  , u = d.distanceToSquared(p)
                  , f = h.distanceToSquared(p);
                if (g > o || u > o || f > o) {
                    var m = A.vertices.length
                      , C = a.clone()
                      , y = a.clone();
                    if (g < u || g < f)
                        if (u < g || u < f) {
                            if ((v = h.clone()).lerp(p, .5),
                            C.a = s,
                            C.b = l,
                            C.c = m,
                            y.a = m,
                            y.b = l,
                            y.c = c,
                            3 === a.vertexNormals.length)
                                (I = a.vertexNormals[0].clone()).lerp(a.vertexNormals[2], .5),
                                C.vertexNormals[2].copy(I),
                                y.vertexNormals[0].copy(I);
                            if (3 === a.vertexColors.length)
                                (E = a.vertexColors[0].clone()).lerp(a.vertexColors[2], .5),
                                C.vertexColors[2].copy(E),
                                y.vertexColors[0].copy(E);
                            e = 2
                        } else {
                            if ((v = d.clone()).lerp(p, .5),
                            C.a = s,
                            C.b = l,
                            C.c = m,
                            y.a = m,
                            y.b = c,
                            y.c = s,
                            3 === a.vertexNormals.length)
                                (I = a.vertexNormals[1].clone()).lerp(a.vertexNormals[2], .5),
                                C.vertexNormals[2].copy(I),
                                y.vertexNormals[0].copy(I),
                                y.vertexNormals[1].copy(a.vertexNormals[2]),
                                y.vertexNormals[2].copy(a.vertexNormals[0]);
                            if (3 === a.vertexColors.length)
                                (E = a.vertexColors[1].clone()).lerp(a.vertexColors[2], .5),
                                C.vertexColors[2].copy(E),
                                y.vertexColors[0].copy(E),
                                y.vertexColors[1].copy(a.vertexColors[2]),
                                y.vertexColors[2].copy(a.vertexColors[0]);
                            e = 1
                        }
                    else {
                        var v, I, E;
                        if ((v = h.clone()).lerp(d, .5),
                        C.a = s,
                        C.b = m,
                        C.c = c,
                        y.a = m,
                        y.b = l,
                        y.c = c,
                        3 === a.vertexNormals.length)
                            (I = a.vertexNormals[0].clone()).lerp(a.vertexNormals[1], .5),
                            C.vertexNormals[1].copy(I),
                            y.vertexNormals[0].copy(I);
                        if (3 === a.vertexColors.length)
                            (E = a.vertexColors[0].clone()).lerp(a.vertexColors[1], .5),
                            C.vertexColors[1].copy(E),
                            y.vertexColors[0].copy(E);
                        e = 0
                    }
                    t.push(C, y),
                    A.vertices.push(v);
                    for (var B = 0, x = A.faceVertexUvs.length; x > B; B++)
                        if (A.faceVertexUvs[B].length) {
                            var S = A.faceVertexUvs[B][n]
                              , w = S[0]
                              , M = S[1]
                              , b = S[2];
                            if (0 === e) {
                                (K = w.clone()).lerp(M, .5);
                                var U = [w.clone(), K.clone(), b.clone()]
                                  , F = [K.clone(), M.clone(), b.clone()]
                            } else if (1 === e) {
                                (K = M.clone()).lerp(b, .5);
                                U = [w.clone(), M.clone(), K.clone()],
                                F = [K.clone(), b.clone(), w.clone()]
                            } else {
                                var K;
                                (K = w.clone()).lerp(b, .5);
                                U = [w.clone(), M.clone(), K.clone()],
                                F = [K.clone(), M.clone(), b.clone()]
                            }
                            i[B].push(U, F)
                        }
                } else {
                    t.push(a);
                    for (B = 0,
                    x = A.faceVertexUvs.length; x > B; B++)
                        i[B].push(A.faceVertexUvs[B][n])
                }
            }
        }
        A.faces = t,
        A.faceVertexUvs = i
    }
    ;
    var vE = function() {
        function A(e) {
            cc(this, A),
            this.viewer = e.viewer3D,
            this.id = e.id,
            this.boundary = [],
            this.quaternion = new f,
            this.xMin = 1 / 0,
            this.yMax = -1 / 0,
            this.zoomRate = .05,
            this._canvasSize = new s,
            this.detailFactor = .5,
            this._offsetToNagZ = !1,
            this._mesh = void 0,
            this._originalGeo = void 0,
            this._currentGeo = void 0
        }
        return dc(A, [{
            key: "createInstance",
            value: function(A, e) {
                var t = document.createElement("div");
                t.id = "heatmap-" + this.id || (new Date).getTime(),
                t.style.width = "10px",
                t.style.height = "10px",
                t.style.position = "absolute",
                t.style.top = "0",
                t.style.left = "0",
                t.style.zIndex = "-10",
                t.style.overflow = "scroll";
                var i = document.createElement("div");
                i.style.width = A + "px",
                i.style.height = e + "px",
                this._canvas = i,
                t.appendChild(i),
                this.viewer.viewportDiv.appendChild(t),
                this.container = t,
                this.heatmap = mE.create({
                    container: i
                }),
                this._canvasSize.set(A, e)
            }
        }, {
            key: "getHeatmap",
            value: function() {
                return this.heatmap
            }
        }, {
            key: "isPlane",
            value: function(A) {
                if (3 > A.length)
                    return !1;
                if (3 === A.length)
                    return !0;
                for (var e = !0, t = (new y).subVectors(A[0], A[1]), i = (new y).subVectors(A[1], A[2]), o = t.cross(i).normalize(), n = 3; A.length > n; n += 1) {
                    var r = (new y).subVectors(A[n - 1], A[n]).cross(i).normalize()
                      , a = .001;
                    if (Math.abs(Math.abs(o.x) - Math.abs(r.x)) > a || Math.abs(Math.abs(o.y) - Math.abs(r.y)) > a || Math.abs(Math.abs(o.z) - Math.abs(r.z)) > a) {
                        e = !1;
                        break
                    }
                }
                return e
            }
        }, {
            key: "addHeatmap",
            value: function(A, e) {
                var t = fE(e.boundary);
                if (e.data.data.forEach((function(A) {
                    t.push(A.point)
                }
                )),
                this.isPlane(t)) {
                    this.boundary = fE(e.boundary);
                    var i = new f
                      , o = (new y).subVectors(e.boundary[1], e.boundary[0]).cross((new y).subVectors(e.boundary[2], e.boundary[1]));
                    i.setFromUnitVectors(o.normalize(), new y(0,0,1)),
                    2 * o.angleTo(new y(0,0,1)) > Math.PI && (this._offsetToNagZ = !0);
                    var n = fE(e.boundary).map((function(A) {
                        return A.applyQuaternion(i)
                    }
                    ));
                    this.quaternion = i.clone();
                    var r = 1 / 0
                      , a = -1 / 0
                      , s = 1 / 0
                      , l = -1 / 0;
                    n.forEach((function(A) {
                        r > A.x && (r = A.x),
                        A.x > a && (a = A.x),
                        s > A.y && (s = A.y),
                        A.y > l && (l = A.y)
                    }
                    ));
                    var c = a - r
                      , h = l - s;
                    this.xMin = r,
                    this.yMax = l;
                    var d = e.quality || .05;
                    this.zoomRate = d,
                    this.createInstance(Math.round(c * d), Math.round(h * d));
                    var p = e.data.data.map((function(A) {
                        return A.point.applyQuaternion(i)
                    }
                    ))
                      , g = [];
                    e.data.data.forEach((function(A, e) {
                        var t = p[e];
                        g.push({
                            x: Math.round((t.x - r) * d),
                            y: Math.round((l - t.y) * d),
                            value: A.value,
                            radius: (A.radius || 1e3) * d
                        })
                    }
                    )),
                    this.heatmap.setData({
                        min: e.data.min,
                        max: e.data.max,
                        data: g
                    });
                    var u = new ov(n)
                      , m = new De;
                    m.fromBufferGeometry(u),
                    this._originalGeo = m.clone();
                    var C = this._tessellateGeometry(m);
                    u = (new he).fromGeometry(C),
                    this._offsetZ(u);
                    var v = new jA({
                        map: new en(this.container.querySelector("canvas")),
                        transparent: !0,
                        side: 2,
                        polygonOffset: !0,
                        polygonOffsetFactor: -1,
                        polygonOffsetUnits: -1,
                        wireframe: !1
                    })
                      , I = new Kf(u,v);
                    I.visible = !0;
                    var E = new M;
                    E.elements[14] = n[0].z;
                    var B = new M;
                    return B.makeRotationFromQuaternion(i.inverse()),
                    I.applyMatrix4(B.multiply(E)),
                    this.viewer.addExternalObject(A, I),
                    I.disPickable = !0,
                    this.viewer.disableComponentsSelectionByKey(A),
                    this._mesh = I,
                    !0
                }
                return !1
            }
        }, {
            key: "updateHeatmap",
            value: function(A) {
                var e = this
                  , t = fE(this.boundary);
                if (A.data.data.forEach((function(A) {
                    t.push(A.point)
                }
                )),
                this.isPlane(t)) {
                    var i = []
                      , o = A.data.data.map((function(A) {
                        return new y(A.point.x,A.point.y,A.point.z).applyQuaternion(e.quaternion)
                    }
                    ))
                      , n = this.zoomRate;
                    A.data.data.forEach((function(A, t) {
                        var r = o[t];
                        i.push({
                            x: Math.round((r.x - e.xMin) * n),
                            y: Math.round((e.yMax - r.y) * n),
                            value: A.value,
                            radius: (A.radius || 1e3) * n
                        })
                    }
                    )),
                    this.heatmap.setData({
                        min: A.data.min,
                        max: A.data.max,
                        data: i
                    });
                    var r = this.viewer.getExternalObjectByName(A.id);
                    if (r)
                        return r.material.map.needsUpdate = !0,
                        this.viewer.render(),
                        !0
                }
                return !1
            }
        }, {
            key: "removeHeatmap",
            value: function(A) {
                this.viewer.removeExternalObjectByName(A),
                this.viewer.viewportDiv.removeChild(this.container)
            }
        }, {
            key: "setDetailFactor",
            value: function(A) {
                if (this.detailFactor !== A && (this.detailFactor = A,
                this._originalGeo && this._mesh)) {
                    var e = this._originalGeo.clone()
                      , t = this._tessellateGeometry(e)
                      , i = (new he).fromGeometry(t);
                    this._offsetZ(i),
                    this._mesh.geometry = i
                }
            }
        }, {
            key: "_tessellateGeometry",
            value: function(A) {
                for (var e = new yE(100), t = 10 + Math.round(10 * this.detailFactor), i = 0; t > i; i += 1)
                    e.modify(A);
                return A
            }
        }, {
            key: "_easeInOutQuad",
            value: function(A) {
                return 1 - (1 - A) * (1 - A)
            }
        }, {
            key: "_offsetZ",
            value: function(A) {
                for (var e = A.getAttribute("uv").array, t = A.getAttribute("position").array, i = this.heatmap.getData(), o = 0, n = e.length; n > o; o += 2) {
                    var r = (this.heatmap.getValueAt({
                        x: e[o] * this._canvasSize.x,
                        y: (1 - e[o + 1]) * this._canvasSize.y
                    }) - i.min) / (i.max - i.min);
                    r = this._easeInOutQuad(r),
                    t[o / 2 * 3 + 2] = 1e3 * r * (this._offsetToNagZ ? -1 : 1)
                }
                A.getAttribute("position").needsUpdate = !0
            }
        }]),
        A
    }()
      , IE = function() {
        function A(e, t) {
            cc(this, A),
            this.viewer = t,
            this.maxHeatValue = 1 / 0,
            this.minHeatValue = -1 / 0,
            this._init(e)
        }
        return dc(A, [{
            key: "show",
            value: function(A) {
                var e = this;
                function t(A) {
                    if (0 === A.uniforms.heatmapPoints.value.length)
                        A.fragmentShader = "#define HEATMAPPOINTSCOUNT " + e.shaderData.heatmapPoints.length + "\n" + A.fragmentShader,
                        A.vertexShader = "#define HEATMAPPOINTSCOUNT " + e.shaderData.heatmapPoints.length + "\n" + A.vertexShader;
                    else {
                        var t = "#define HEATMAPPOINTSCOUNT " + A.uniforms.heatmapPoints.value.length;
                        A.fragmentShader = A.fragmentShader.replace(t, "#define HEATMAPPOINTSCOUNT " + e.shaderData.heatmapPoints.length),
                        A.vertexShader = A.vertexShader.replace(t, "#define HEATMAPPOINTSCOUNT " + e.shaderData.heatmapPoints.length)
                    }
                    A.uniforms.heatmapPoints.value = e.shaderData.heatmapPoints,
                    A.uniforms.heatmapTexture.value = e.shaderData.heatmapTexture,
                    A.needsUpdate = !0
                }
                if (A) {
                    if (!this.viewer.getViewerImpl().getModelByComponentKey(A))
                        return;
                    var i = this.viewer.getViewerImpl().modelManager.getComponent(A);
                    if (i && i.length > 0)
                        for (var o = i[0].mesh.material, n = 0, r = o.length; r > n; n += 1)
                            o[n] = o[n].clone(),
                            t(o[n])
                } else
                    this.shaderData.heatmapPoints && this.shaderData.heatmapTexture && (this.viewer.getViewerImpl().getModelManager().traverseModels((function(A) {
                        var e = A.materialManager.materials;
                        for (var i in e) {
                            t(e[i])
                        }
                    }
                    )),
                    this.viewer.syncRender())
            }
        }, {
            key: "hide",
            value: function() {
                var A = this;
                this.shaderData.heatmapPoints && this.shaderData.heatmapTexture && (this.viewer.getViewerImpl().getModelManager().traverseModels((function(e) {
                    var t = e.materialManager.materials;
                    for (var i in t) {
                        var o = t[i];
                        if (o.uniforms.heatmapPoints.value.length > 0) {
                            o.uniforms.heatmapPoints.value = [],
                            o.uniforms.heatmapTexture.value = null;
                            var n = "#define HEATMAPPOINTSCOUNT " + A.shaderData.heatmapPoints.length;
                            o.fragmentShader = o.fragmentShader.replace(n, ""),
                            o.vertexShader = o.vertexShader.replace(n, ""),
                            o.needsUpdate = !0
                        }
                    }
                }
                )),
                this.viewer.render())
            }
        }, {
            key: "removeHeatmap",
            value: function() {
                this.hide(),
                this.shaderData.heatmapPoints && delete this.shaderData.heatmapPoints,
                this.shaderData.heatmapTexture && delete this.shaderData.heatmapTexture
            }
        }, {
            key: "updateHeatmap",
            value: function(A) {
                var e = A.data;
                this.maxHeatValue = e.max ? e.max : 1 / 0,
                this.minHeatValue = e.min ? e.min : -1 / 0,
                this.shaderData.heatmapPoints = this._createHeatmapBuffer(A.data),
                this.show()
            }
        }, {
            key: "_init",
            value: function(A) {
                var e = A.data;
                this.maxHeatValue = e.max ? e.max : 1 / 0,
                this.minHeatValue = e.min ? e.min : -1 / 0,
                this.shaderData = {
                    heatmapPoints: this._createHeatmapBuffer(e),
                    heatmapTexture: this._createHeatmapTexture()
                }
            }
        }, {
            key: "_createHeatmapBuffer",
            value: function(A) {
                if (A.data && 0 !== A.data.length) {
                    if (this.maxHeatValue === 1 / 0 || this.minHeatValue === -1 / 0)
                        for (var e = 0, t = A.data.length; t > e; e += 1) {
                            var i = A.data[e];
                            i.value > this.maxHeatValue && (this.maxHeatValue = i.value),
                            this.minHeatValue > i.value && (this.minHeatValue = i.value)
                        }
                    for (var o = [], n = 0, r = A.data.length; r > n; n += 1) {
                        var a = A.data[n]
                          , s = Math.max(this.minHeatValue, Math.min(a.value, this.maxHeatValue));
                        o.push(a.point.x, a.point.y, a.point.z, (s - this.minHeatValue) / (this.maxHeatValue - this.minHeatValue), a.radius ? a.radius : 1e3)
                    }
                    return new Float32Array(o)
                }
            }
        }, {
            key: "_createHeatmapTexture",
            value: function() {
                var A = document.createElement("canvas");
                A.width = 256,
                A.height = 1;
                var e = A.getContext("2d")
                  , t = e.createLinearGradient(0, 0, 256, 1)
                  , i = {
                    0: "#44f",
                    .1: "#0ff",
                    .2: "#0f0",
                    .4: "#ff0",
                    1: "#f00"
                };
                for (var o in i)
                    t.addColorStop(o, i[o]);
                return e.fillStyle = t,
                e.fillRect(0, 0, 256, 1),
                new en(A)
            }
        }]),
        A
    }()
      , EE = function() {
        function A(e, t) {
            cc(this, A),
            this.heatSpheres = [],
            this.viewer = t,
            this.maxHeatValue = 1 / 0,
            this.minHeatValue = -1 / 0,
            this._animating = !1,
            this._lastAnimateTime = void 0,
            this._localTime = 0,
            this._duration = 2e3,
            this._init(e)
        }
        return dc(A, [{
            key: "getColorIndexAndValueOfHeatValue",
            value: function(e) {
                A.colorBoard || (A.colorBoard = this._createColorBoard());
                var t = (Math.max(this.minHeatValue, Math.min(e, this.maxHeatValue)) - this.minHeatValue) / (this.maxHeatValue - this.minHeatValue) * 255
                  , i = 4 * (t = Math.round(t));
                return {
                    color: new LA(A.colorBoard[i] / 255,A.colorBoard[i + 1] / 255,A.colorBoard[i + 2] / 255),
                    index: t
                }
            }
        }, {
            key: "updateHeatmap",
            value: function(A) {
                this.removeHeatmap(),
                this._init(A),
                this.startAnimation(this._duration)
            }
        }, {
            key: "startAnimation",
            value: function(A) {
                var e = this;
                this._animating || (this._animating = !0,
                A && (this._duration = A),
                requestAnimationFrame((function(A) {
                    return e._animate(A)
                }
                )))
            }
        }, {
            key: "stopAnimation",
            value: function() {
                this._animating = !1,
                this._lastAnimateTime = void 0,
                this._localTime = 0
            }
        }, {
            key: "removeHeatmap",
            value: function() {
                var A = this;
                this.stopAnimation(),
                this.heatSpheres.forEach((function(e) {
                    A.viewer.removeExternalObjectByName(e.uuid)
                }
                ))
            }
        }, {
            key: "_animate",
            value: function(e) {
                var t = this
                  , i = this._lastAnimateTime ? e - this._lastAnimateTime : 0;
                if (!this._lastAnimateTime || i > 100) {
                    this._localTime += i / this._duration,
                    1 > this._localTime || (this._localTime = 0);
                    var o = this._easeOutSine(this._localTime);
                    this.heatSpheres.forEach((function(e) {
                        e.scale.set(o, o, o),
                        e.updateMatrixWorld(!0);
                        var i = e.userData._heatColorIndex;
                        i = 4 * Math.round(i * (1 - t._localTime)),
                        e.material.color.setRGB(A.colorBoard[i] / 255, A.colorBoard[i + 1] / 255, A.colorBoard[i + 2] / 255),
                        e.material.needsUpdate = !0
                    }
                    )),
                    this.viewer.render(),
                    this._lastAnimateTime = e
                }
                this._animating && requestAnimationFrame((function(A) {
                    return t._animate(A)
                }
                ))
            }
        }, {
            key: "_init",
            value: function(A) {
                var e = A.data;
                if (this.maxHeatValue = e.max ? e.max : 1 / 0,
                this.minHeatValue = e.min ? e.min : -1 / 0,
                this._sphereOpacity = e.alpha ? e.alpha : .7,
                this.maxHeatValue === 1 / 0 || this.minHeatValue === -1 / 0)
                    for (var t = 0, i = e.data.length; i > t; t += 1) {
                        var o = e.data[t];
                        o.value > this.maxHeatValue && (this.maxHeatValue = o.value),
                        this.minHeatValue > o.value && (this.minHeatValue = o.value)
                    }
                for (var n = 0, r = e.data.length; r > n; n += 1)
                    this._addHeatPoint(e.data[n])
            }
        }, {
            key: "_addHeatPoint",
            value: function(A) {
                var e = A
                  , t = e.radius ? e.radius : 1e3
                  , i = 10 * Math.log10(t)
                  , o = new er(t,i,i)
                  , n = this.getColorIndexAndValueOfHeatValue(e.value)
                  , r = n.index
                  , a = new Ue(o,new xr({
                    color: n.color,
                    depthTest: !0,
                    transparent: !0,
                    opacity: this._sphereOpacity
                }));
                a.position.set(e.point.x, e.point.y, e.point.z),
                a.updateMatrixWorld(!0),
                a.userData._heatValue = e.value,
                a.userData._heatColorIndex = r,
                a.disPickable = !0,
                this.viewer.disableComponentsSelectionByKey(a.uuid),
                this.heatSpheres.push(a),
                this.viewer.addExternalObject(a.uuid, a)
            }
        }, {
            key: "_createColorBoard",
            value: function() {
                var A = document.createElement("canvas");
                A.width = 256,
                A.height = 1;
                var e = A.getContext("2d")
                  , t = e.createLinearGradient(0, 0, 256, 1)
                  , i = {
                    0: "#44f",
                    .1: "#0ff",
                    .2: "#0f0",
                    .4: "#ff0",
                    1: "#f00"
                };
                for (var o in i)
                    t.addColorStop(o, i[o]);
                return e.fillStyle = t,
                e.fillRect(0, 0, 256, 1),
                e.getImageData(0, 0, 256, 1).data
            }
        }, {
            key: "_easeOutCubic",
            value: function(A) {
                return 1 - Math.pow(1 - A, 3)
            }
        }, {
            key: "_easeOutSine",
            value: function(A) {
                return Math.sin(A * Math.PI / 2)
            }
        }, {
            key: "_easeInCubic",
            value: function(A) {
                return A * A * A
            }
        }]),
        A
    }()
      , BE = function() {
        function A(e) {
            cc(this, A),
            this.viewer = e.viewer3D,
            this.mapCollection = {}
        }
        return dc(A, [{
            key: "createHeatmap",
            value: function(A) {
                var e = ((new Date).getTime() * (Math.random() + 1)).toString(36).slice(0, 8)
                  , t = new CE({
                    viewer3D: this.viewer,
                    id: e
                })
                  , i = fE(A);
                return i.data.data.forEach((function(A) {
                    A.point = new y(A.point.x,A.point.y,A.point.z)
                }
                )),
                i.boundary = i.boundary.map((function(A) {
                    return new y(A.x,A.y,A.z)
                }
                )),
                t.addHeatmap(e, i) ? (this.mapCollection[e] = t,
                {
                    code: "success",
                    id: e
                }) : {
                    code: "error",
                    message: "输入的点不共面"
                }
            }
        }, {
            key: "updateHeatmap",
            value: function(A) {
                var e = this.mapCollection[A.id];
                if (e && e.updateHeatmap)
                    return e.updateHeatmap(A)
            }
        }, {
            key: "removeHeatmap",
            value: function(A) {
                return !!this.mapCollection[A] && (this.mapCollection[A].removeHeatmap(A),
                delete this.mapCollection[A],
                !0)
            }
        }, {
            key: "createHeatmap3D",
            value: function(A) {
                var e = ((new Date).getTime() * (Math.random() + 1)).toString(36).slice(0, 8)
                  , t = new vE({
                    viewer3D: this.viewer,
                    id: e
                })
                  , i = fE(A);
                return i.data.data.forEach((function(A) {
                    A.point = new y(A.point.x,A.point.y,A.point.z)
                }
                )),
                i.boundary = i.boundary.map((function(A) {
                    return new y(A.x,A.y,A.z)
                }
                )),
                t.addHeatmap(e, i) ? (this.mapCollection[e] = t,
                {
                    code: "success",
                    id: e,
                    map: t
                }) : {
                    code: "error",
                    message: "输入的点不共面"
                }
            }
        }, {
            key: "createSphereHeatmap",
            value: function(A) {
                if (A.data && A.data.data) {
                    var e = ((new Date).getTime() * (Math.random() + 1)).toString(36).slice(0, 8)
                      , t = new EE(A,this.viewer);
                    return t.startAnimation(5e3),
                    this.mapCollection[e] = t,
                    {
                        code: "success",
                        id: e,
                        map: t
                    }
                }
                return {
                    code: "error",
                    message: "参数错误"
                }
            }
        }, {
            key: "createSphereColorOverrideHeatmap",
            value: function(A) {
                if (A.data && A.data.data) {
                    if (A.data.data.length > 150)
                        return {
                            code: "error",
                            message: "热力源个数不能超过150"
                        };
                    var e = new IE(A,this.viewer)
                      , t = ((new Date).getTime() * (Math.random() + 1)).toString(36).slice(0, 8);
                    return this.mapCollection[t] = e,
                    e.show(),
                    {
                        code: "success",
                        id: t,
                        map: e
                    }
                }
                return {
                    code: "error",
                    message: "参数错误"
                }
            }
        }]),
        A
    }()
      , xE = function(A, e) {
        Xo.call(this, A, e),
        this.pointIds = []
    };
    (xE.prototype = Object.create(Xo.prototype)).constructor = xE,
    xE.prototype.raycast = function() {
        var A = new M
          , e = new CA
          , t = new cA;
        return function(i, o) {
            var n = this
              , r = this.geometry
              , a = this.matrixWorld
              , s = this.size
              , l = i.camera || i._camera
              , c = i.viewportSize.height
              , h = this.pointIds;
            function d(e, t) {
                var i = e.clone();
                return i.applyMatrix4(a),
                i.project(l),
                i.y += t / c,
                i.unproject(l),
                i.applyMatrix4(A),
                i
            }
            A.getInverse(a),
            null === r.boundingSphere && r.computeBoundingSphere(),
            t.copy(r.boundingSphere);
            var p = t.center
              , g = d(p, s)
              , u = g.distanceToSquared(p);
            if (t.radius += u,
            t.center.copy(g),
            t.applyMatrix4(a),
            !1 !== i.ray.intersectsSphere(t)) {
                e.copy(i.ray).applyMatrix4(A);
                var f = new y
                  , m = s;
                if (r.isBufferGeometry) {
                    var C = r.index
                      , v = r.attributes
                      , I = v.position.array
                      , E = !1
                      , B = null;
                    if (v.attrSize && (E = !0,
                    B = v.attrSize.array),
                    null !== C)
                        for (var x = C.array, S = 0, w = x.length; w > S; S += 1) {
                            var M = x[S];
                            f.fromArray(I, 3 * M),
                            E && (m = B[M]),
                            F(f, m, M)
                        }
                    else {
                        S = 0;
                        for (var b = I.length / 3; b > S; S += 1)
                            f.fromArray(I, 3 * S),
                            E && (m = B[S]),
                            F(f, m, S)
                    }
                } else {
                    var U = r.vertices;
                    for (S = 0,
                    b = U.length; b > S; S += 1)
                        F(U[S], m, S)
                }
            }
            function F(A, t, r) {
                var s = d(A, t)
                  , l = s.distanceToSquared(A)
                  , c = e.distanceSqToPoint(s);
                if (l > c) {
                    var p = e.closestPointToPoint(s);
                    p.applyMatrix4(a);
                    var g = i.ray.origin.distanceTo(p);
                    if (i.near > g || g > i.far)
                        return;
                    o.push({
                        id: h[r],
                        distance: g,
                        distanceToRay: Math.sqrt(c),
                        point: p.clone(),
                        index: r,
                        face: null,
                        object: n
                    })
                }
            }
        }
    }(),
    xE.prototype.setAttributeSize = function(A, e) {
        var t = this.geometry.attributes;
        t.attrSize && (t.attrSize.array[A] = e,
        t.attrSize.needsUpdate = !0)
    }
    ,
    xE.prototype.getAttributeSize = function(A) {
        var e = this.geometry.attributes
          , t = this.size;
        return e.attrSize && (t = e.attrSize.array[A]),
        t
    }
    ;
    var SE = ["attribute vec3  customColor;", "attribute float customOpacity;", "attribute float customSize;", "attribute float customAngle;", "attribute float customVisible;", "varying vec4  vColor;", "varying float vAngle;", "void main()", "{", "if ( customVisible > 0.5 )", "vColor = vec4( customColor, customOpacity );", "else", "vColor = vec4(0.0, 0.0, 0.0, 0.0);", "vAngle = customAngle;", "vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );", "gl_PointSize = customSize * ( 3000.0 / length( mvPosition.xyz ) );", "gl_Position = projectionMatrix * mvPosition;", "}"].join("\n")
      , wE = ["uniform sampler2D texture;", "varying vec4 vColor;", "varying float vAngle;", "void main()", "{", "gl_FragColor = vColor;", "float c = cos(vAngle);", "float s = sin(vAngle);", "vec2 rotatedUV = vec2(c * (gl_PointCoord.x - 0.5) + s * (gl_PointCoord.y - 0.5) + 0.5,", "c * (gl_PointCoord.y - 0.5) - s * (gl_PointCoord.x - 0.5) + 0.5);", "vec4 rotatedTexture = texture2D( texture,  rotatedUV );", "gl_FragColor = gl_FragColor * rotatedTexture;", "}"].join("\n");
    function ME(A, e) {
        this.times = A || [],
        this.values = e || []
    }
    function bE() {
        this.position = new y,
        this.velocity = new y,
        this.acceleration = new y,
        this.angle = 0,
        this.angleVelocity = 0,
        this.angleAcceleration = 0,
        this.size = 16,
        this.color = new LA,
        this.opacity = 1,
        this.age = 0,
        this.alive = 0
    }
    function UE() {
        this.positionStyle = 1,
        this.positionBase = new y,
        this.positionSpread = new y,
        this.positionRadius = 0,
        this.velocityStyle = 1,
        this.velocityBase = new y,
        this.velocitySpread = new y,
        this.speedBase = 0,
        this.speedSpread = 0,
        this.accelerationBase = new y,
        this.accelerationSpread = new y,
        this.angleBase = 0,
        this.angleSpread = 0,
        this.angleVelocityBase = 0,
        this.angleVelocitySpread = 0,
        this.angleAccelerationBase = 0,
        this.angleAccelerationSpread = 0,
        this.sizeBase = 0,
        this.sizeSpread = 0,
        this.sizeTween = new ME,
        this.colorBase = new y(0,1,.5),
        this.colorSpread = new y(0,0,0),
        this.colorTween = new ME,
        this.opacityBase = 1,
        this.opacitySpread = 0,
        this.opacityTween = new ME,
        this.blendStyle = 1,
        this.particleArray = [],
        this.particlesPerSecond = 100,
        this.particleDeathAge = 1,
        this.emitterAge = 0,
        this.emitterAlive = !0,
        this.emitterDeathAge = 60,
        this.particleCount = this.particlesPerSecond * Math.min(this.particleDeathAge, this.emitterDeathAge)
    }
    ME.prototype.lerp = function(A) {
        for (var e = 0, t = this.times.length; t > e && A > this.times[e]; )
            e += 1;
        if (0 === e)
            return this.values[0];
        if (e === t)
            return this.values[t - 1];
        var i = (A - this.times[e - 1]) / (this.times[e] - this.times[e - 1]);
        return this.values[0]instanceof y ? this.values[e - 1].clone().lerp(this.values[e], i) : this.values[e - 1] + i * (this.values[e] - this.values[e - 1])
    }
    ,
    bE.prototype.update = function(A) {
        if (this.position.add(this.velocity.clone().multiplyScalar(A)),
        this.velocity.add(this.acceleration.clone().multiplyScalar(A)),
        this.angle += .01745329251 * this.angleVelocity * A,
        this.angleVelocity += .01745329251 * this.angleAcceleration * A,
        this.age += A,
        this.sizeTween.times.length > 0 && (this.size = this.sizeTween.lerp(this.age)),
        this.colorTween.times.length > 0) {
            var e = this.colorTween.lerp(this.age);
            this.color = (new LA).setHSL(e.x, e.y, e.z)
        }
        this.opacityTween.times.length > 0 && (this.opacity = this.opacityTween.lerp(this.age))
    }
    ,
    UE.prototype.setValues = function(A) {
        if (void 0 !== A) {
            for (var e in this.sizeTween = new ME,
            this.colorTween = new ME,
            this.opacityTween = new ME,
            A)
                this[e] = A[e];
            this.particleArray = [],
            this.emitterAlive = !0,
            this.particleCount = this.particlesPerSecond * Math.min(this.particleDeathAge, this.emitterDeathAge),
            this.particleGeometry = new he,
            this.particleMaterial = new Pe({
                uniforms: {
                    texture: {
                        value: this.particleTexture
                    }
                },
                vertexShader: SE,
                fragmentShader: wE,
                transparent: !0,
                blending: 1,
                depthWrite: !1
            }),
            this.particleMesh = new xE
        }
    }
    ,
    UE.prototype.randomValue = function(A, e) {
        return A + e * (Math.random() - .5)
    }
    ,
    UE.prototype.randomVector3 = function(A, e) {
        var t = new y(Math.random() - .5,Math.random() - .5,Math.random() - .5);
        return (new y).addVectors(A, t.multiplyVectors(e, t))
    }
    ,
    UE.prototype.updateVector3 = function(A, e, t) {
        var i = new y(Math.random() - .5,Math.random() - .5,Math.random() - .5);
        A.set(0, 0, 0),
        A.addVectors(e, i.multiplyVectors(t, i))
    }
    ,
    UE.prototype.createParticle = function() {
        var A = new bE;
        if (1 === this.positionStyle && (A.position = this.randomVector3(this.positionBase, this.positionSpread)),
        2 === this.positionStyle) {
            var e = 2 * Math.random() - 1
              , t = 6.2832 * Math.random()
              , i = Math.sqrt(1 - e * e)
              , o = new y(i * Math.cos(t),i * Math.sin(t),e);
            A.position = (new y).addVectors(this.positionBase, o.multiplyScalar(this.positionRadius))
        }
        if (1 === this.velocityStyle && (A.velocity = this.randomVector3(this.velocityBase, this.velocitySpread)),
        2 === this.velocityStyle) {
            var n = (new y).subVectors(A.position, this.positionBase)
              , r = this.randomValue(this.speedBase, this.speedSpread);
            A.velocity = n.normalize().multiplyScalar(r)
        }
        A.acceleration = this.randomVector3(this.accelerationBase, this.accelerationSpread),
        A.angle = this.randomValue(this.angleBase, this.angleSpread),
        A.angleVelocity = this.randomValue(this.angleVelocityBase, this.angleVelocitySpread),
        A.angleAcceleration = this.randomValue(this.angleAccelerationBase, this.angleAccelerationSpread),
        A.size = this.randomValue(this.sizeBase, this.sizeSpread);
        var a = this.randomVector3(this.colorBase, this.colorSpread);
        return A.color = (new LA).setHSL(a.x, a.y, a.z),
        A.opacity = this.randomValue(this.opacityBase, this.opacitySpread),
        A.age = 0,
        A.alive = 0,
        A.sizeTween = this.sizeTween,
        A.colorTween = this.colorTween,
        A.opacityTween = this.opacityTween,
        A
    }
    ,
    UE.prototype.updateParticle = function(A) {
        if (1 === this.positionStyle && this.updateVector3(A.position, this.positionBase, this.positionSpread),
        2 === this.positionStyle) {
            var e = 2 * Math.random() - 1
              , t = 6.2832 * Math.random()
              , i = Math.sqrt(1 - e * e)
              , o = new y(i * Math.cos(t),i * Math.sin(t),e);
            A.position = (new y).addVectors(this.positionBase, o.multiplyScalar(this.positionRadius))
        }
        if (1 === this.velocityStyle && this.updateVector3(A.velocity, this.velocityBase, this.velocitySpread),
        2 === this.velocityStyle) {
            var n = (new y).subVectors(A.position, this.positionBase)
              , r = this.randomValue(this.speedBase, this.speedSpread);
            A.velocity = n.normalize().multiplyScalar(r)
        }
        this.updateVector3(A.acceleration, this.accelerationBase, this.accelerationSpread),
        A.angle = this.randomValue(this.angleBase, this.angleSpread),
        A.angleVelocity = this.randomValue(this.angleVelocityBase, this.angleVelocitySpread),
        A.angleAcceleration = this.randomValue(this.angleAccelerationBase, this.angleAccelerationSpread),
        A.size = this.randomValue(this.sizeBase, this.sizeSpread);
        var a = this.randomVector3(this.colorBase, this.colorSpread);
        A.color = A.color.setHSL(a.x, a.y, a.z),
        A.opacity = this.randomValue(this.opacityBase, this.opacitySpread),
        A.age = 0,
        A.alive = 0
    }
    ,
    UE.prototype.initialize = function() {
        this.sortArray = [],
        this.positions = new Float32Array(3 * this.particleCount),
        this.customVisible = new Float32Array(this.particleCount),
        this.customSize = new Float32Array(this.particleCount),
        this.customColor = new Float32Array(3 * this.particleCount),
        this.customOpacity = new Float32Array(this.particleCount),
        this.maxSize = 200;
        for (var A = 0; this.particleCount > A; A += 1)
            this.particleArray[A] = this.createParticle(),
            this.positions[3 * A] = this.particleArray[A].position.x,
            this.positions[3 * A + 1] = this.particleArray[A].position.y,
            this.positions[3 * A + 2] = this.particleArray[A].position.z,
            this.customVisible[A] = this.particleArray[A].alive,
            this.customColor[3 * A] = this.particleArray[A].color.r,
            this.customColor[3 * A + 1] = this.particleArray[A].color.g,
            this.customColor[3 * A + 2] = this.particleArray[A].color.b,
            this.customOpacity[A] = this.particleArray[A].opacity,
            this.customSize[A] = this.particleArray[A].size,
            this.maxSize = this.maxSize > this.customSize[A] ? this.maxSize : this.customSize[A];
        this.particleMaterial.blending = this.blendStyle,
        this.particleGeometry.setAttribute("position", new YA(this.positions,3)),
        this.particleGeometry.setAttribute("customColor", new YA(this.customColor,3)),
        this.particleGeometry.setAttribute("customVisible", new YA(this.customVisible,1)),
        this.particleGeometry.setAttribute("customSize", new YA(this.customSize,1)),
        this.particleGeometry.setAttribute("customOpacity", new YA(this.customOpacity,1)),
        this.particleMesh = new xE(this.particleGeometry,this.particleMaterial),
        this.particleMesh.dynamic = !0,
        this.particleMesh.size = this.maxSize,
        this.particleMesh.renderOrder = -1
    }
    ,
    UE.prototype.update = function(A) {
        A = void 0 === A ? .015 : A;
        for (var e = [], t = 0; this.particleCount > t; t += 1)
            this.particleArray[t].alive && (this.particleArray[t].update(A),
            this.particleArray[t].age > this.particleDeathAge && (this.particleArray[t].alive = 0,
            e.push(t)),
            this.customVisible[t] = this.particleArray[t].alive,
            this.customOpacity[t] = this.particleArray[t].opacity,
            this.customSize[t] = this.particleArray[t].size,
            this.customColor[3 * t] = this.particleArray[t].color.r,
            this.customColor[3 * t + 1] = this.particleArray[t].color.g,
            this.customColor[3 * t + 2] = this.particleArray[t].color.b,
            this.positions[3 * t] = this.particleArray[t].position.x,
            this.positions[3 * t + 1] = this.particleArray[t].position.y,
            this.positions[3 * t + 2] = this.particleArray[t].position.z,
            this.maxSize = this.maxSize > this.customSize[t] ? this.maxSize : this.customSize[t]);
        if (this.particleGeometry.getAttribute("customVisible").needsUpdate = !0,
        this.particleGeometry.getAttribute("customOpacity").needsUpdate = !0,
        this.particleGeometry.getAttribute("customSize").needsUpdate = !0,
        this.particleGeometry.getAttribute("customColor").needsUpdate = !0,
        this.particleGeometry.getAttribute("position").needsUpdate = !0,
        this.emitterAlive) {
            var i = Math.round(this.particlesPerSecond * (this.emitterAge + 0))
              , o = Math.round(this.particlesPerSecond * (this.emitterAge + A));
            o > this.particleCount && (o = this.particleCount);
            for (t = i; o > t; t += 1)
                this.particleArray[t].alive = 1;
            for (var n = 0; e.length > n; n += 1) {
                this.updateParticle(this.particleArray[t = e[n]]),
                this.particleArray[t].alive = 1,
                this.positions[3 * t] = this.particleArray[t].position.x,
                this.positions[3 * t + 1] = this.particleArray[t].position.y,
                this.positions[3 * t + 2] = this.particleArray[t].position.z
            }
            this.emitterAge += A
        }
    }
    ,
    UE.prototype.setScale = function(A) {
        for (var e = 0, t = this.sizeTween.values.length; t > e; e += 1)
            this.sizeTween.values[e] = this.sizeTween.values[e] * A;
        this.maxSize *= A
    }
    ,
    UE.prototype.initializeSizetween = function(A) {
        for (var e = 0, t = this.sizeTween.values.length; t > e; e += 1)
            this.sizeTween.values[e] = this.sizeTween.values[e] * A;
        for (e = 0; this.particleCount > e; e += 1)
            this.particleArray[e].size *= A,
            this.customSize[e] = this.particleArray[e].size,
            this.maxSize = this.maxSize > this.customSize[e] ? this.maxSize : this.customSize[e];
        this.particleGeometry.getAttribute("customSize").needsUpdate = !0
    }
    ,
    UE.prototype.destroy = function() {}
    ;
    var FE = function() {
        return Xi.call(this),
        this.firePosition = {
            x: 0,
            y: 0,
            z: 0
        },
        this.position.set(this.firePosition.x, this.firePosition.y, this.firePosition.z),
        this.fireScale = 1,
        this.type = "fire",
        this.disPickable = !0,
        this.autoAnimation = !0,
        this._loadTexture(),
        this._initialize(),
        this
    };
    (FE.prototype = Object.create(Xi.prototype)).constructor = Xi.prototype,
    FE.prototype._initialize = function() {
        this.fire = new UE,
        this.fire.setValues({
            positionStyle: 1,
            positionBase: new y(0,0,600),
            positionSpread: new y(1500,1500,600),
            velocityStyle: 1,
            velocityBase: new y(0,0,4600),
            velocitySpread: new y(1e3,1e3,4600),
            accelerationBase: new y(0,0,2600),
            particleTexture: this.fireParticle,
            sizeTween: new ME([0, .1],[32, 200]),
            opacityTween: new ME([.7, 1],[.8, 0]),
            colorBase: new y(.04,1,.4),
            blendStyle: 2,
            particlesPerSecond: 80,
            particleDeathAge: 1.5
        }),
        this.fire.initialize(),
        this.smoke = new UE,
        this.smoke.setValues({
            positionStyle: 1,
            positionBase: new y(0,0,2600),
            positionSpread: new y(1500,1500,600),
            velocityStyle: 1,
            velocityBase: new y(0,0,3600),
            velocitySpread: new y(1800,1800,1100),
            accelerationBase: new y(0,0,2600),
            particleTexture: this.smokeParticle,
            sizeTween: new ME([0, 1],[32, 200]),
            opacityTween: new ME([.5, 1, 1.7],[0, .3, 0]),
            colorTween: new ME([.4, 1],[new y(0,0,0), new y(0,0,.2)]),
            blendStyle: 1,
            particlesPerSecond: 40,
            particleDeathAge: 2
        }),
        this.smoke.initialize(),
        this.add(this.fire.particleMesh),
        this.add(this.smoke.particleMesh)
    }
    ,
    FE.prototype._initializeSizetween = function(A) {
        this.fire.initializeSizetween(A),
        this.smoke.initializeSizetween(A)
    }
    ,
    FE.prototype.update = function() {
        this.fire.update(),
        this.smoke.update()
    }
    ,
    FE.prototype.getPosition = function() {
        return this.firePosition
    }
    ,
    FE.prototype.setPosition = function(A) {
        if (A)
            if ("number" == typeof A.x)
                if ("number" == typeof A.y)
                    if ("number" == typeof A.z) {
                        if (this.firePosition = A,
                        this.position.set(this.firePosition.x, this.firePosition.y, this.firePosition.z),
                        this.updateMatrixWorld(),
                        this.originBox) {
                            var e = this.originBox.clone();
                            this.box = e.applyMatrix4(this.matrix),
                            this.levelName = null
                        }
                    } else
                        Bh.error("缺少参数 position.z");
                else
                    Bh.error("缺少参数 position.y");
            else
                Bh.error("缺少参数 position.x");
        else
            Bh.error("缺少参数 position")
    }
    ,
    FE.prototype.getScale = function() {
        return this.fireScale
    }
    ,
    FE.prototype.setScale = function(A) {
        this.scale.set(A, A, A),
        this.updateMatrixWorld(),
        this.fire.setScale(A / this.fireScale),
        this.smoke.setScale(A / this.fireScale),
        this.fireScale = A
    }
    ,
    FE.prototype._loadTexture = function() {
        var A = new Aa;
        this.fireParticle = A.load("data:image/png;base64, "),
        this.smokeParticle = A.load("data:image/png;base64, ")
    }
    ;
    var KE = function() {
        JC.call(this),
        this.type = "LineGeometry"
    };
    KE.prototype = Object.assign(Object.create(JC.prototype), {
        constructor: KE,
        isLineGeometry: !0,
        setPositions: function(A) {
            for (var e = A.length - 3, t = new Float32Array(2 * e), i = 0; e > i; i += 3)
                t[2 * i] = A[i],
                t[2 * i + 1] = A[i + 1],
                t[2 * i + 2] = A[i + 2],
                t[2 * i + 3] = A[i + 3],
                t[2 * i + 4] = A[i + 4],
                t[2 * i + 5] = A[i + 5];
            return JC.prototype.setPositions.call(this, t),
            this
        },
        setColors: function(A) {
            for (var e = A.length - 3, t = new Float32Array(2 * e), i = 0; e > i; i += 3)
                t[2 * i] = A[i],
                t[2 * i + 1] = A[i + 1],
                t[2 * i + 2] = A[i + 2],
                t[2 * i + 3] = A[i + 3],
                t[2 * i + 4] = A[i + 4],
                t[2 * i + 5] = A[i + 5];
            return JC.prototype.setColors.call(this, t),
            this
        },
        fromLine: function(A) {
            var e = A.geometry;
            return e.isGeometry ? this.setPositions(e.vertices) : e.isBufferGeometry && this.setPositions(e.position.array),
            this
        },
        copy: function() {
            return this
        }
    });
    var QE = function(A, e) {
        XC.call(this),
        this.type = "Line2",
        this.geometry = void 0 !== A ? A : new KE,
        this.material = void 0 !== e ? e : new YC({
            color: 16777215 * Math.random()
        })
    };
    QE.prototype = Object.assign(Object.create(XC.prototype), {
        constructor: QE,
        isLine2: !0,
        copy: function() {
            return this
        }
    });
    function RE(A) {
        return "symbol" == typeof A || Zv(A) && "[object Symbol]" == Sv(A)
    }
    var TE = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/
      , kE = /^\w*$/;
    function DE(A, e) {
        if ("function" != typeof A || null != e && "function" != typeof e)
            throw new TypeError("Expected a function");
        var t = function() {
            var i = arguments
              , o = e ? e.apply(this, i) : i[0]
              , n = t.cache;
            if (n.has(o))
                return n.get(o);
            var r = A.apply(this, i);
            return t.cache = n.set(o, r) || n,
            r
        };
        return t.cache = new (DE.Cache || qv),
        t
    }
    DE.Cache = qv;
    var LE = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g
      , NE = /\\(\\)?/g
      , OE = function(A) {
        var e = DE(A, (function(A) {
            return 500 === t.size && t.clear(),
            A
        }
        ))
          , t = e.cache;
        return e
    }((function(A) {
        var e = [];
        return 46 === A.charCodeAt(0) && e.push(""),
        A.replace(LE, (function(A, t, i, o) {
            e.push(i ? o.replace(NE, "$1") : t || A)
        }
        )),
        e
    }
    ));
    var VE = Cv ? Cv.prototype : void 0
      , GE = VE ? VE.toString : void 0;
    function PE(A) {
        if ("string" == typeof A)
            return A;
        if (tI(A))
            return function(A, e) {
                for (var t = -1, i = null == A ? 0 : A.length, o = Array(i); ++t < i; )
                    o[t] = e(A[t], t, A);
                return o
            }(A, PE) + "";
        if (RE(A))
            return GE ? GE.call(A) : "";
        var e = A + "";
        return "0" == e && 1 / A == -1 / 0 ? "-0" : e
    }
    function qE(A, e) {
        return tI(A) ? A : function(A, e) {
            if (tI(A))
                return !1;
            var t = typeof A;
            return !("number" != t && "symbol" != t && "boolean" != t && null != A && !RE(A)) || (kE.test(A) || !TE.test(A) || null != e && A in Object(e))
        }(A, e) ? [A] : OE(function(A) {
            return null == A ? "" : PE(A)
        }(A))
    }
    function jE(A) {
        if ("string" == typeof A || RE(A))
            return A;
        var e = A + "";
        return "0" == e && 1 / A == -1 / 0 ? "-0" : e
    }
    function HE(A, e, t) {
        var i = null == A ? void 0 : function(A, e) {
            for (var t = 0, i = (e = qE(e, A)).length; null != A && i > t; )
                A = A[jE(e[t++])];
            return t && t == i ? A : void 0
        }(A, e);
        return void 0 === i ? t : i
    }
    var YE = {
        height: 0,
        speed: 1e3,
        frameTime: 14
    }
      , WE = new hp
      , JE = function() {
        function A(e) {
            cc(this, A),
            this.roadnet = {},
            this.shortestPathLineMap = {},
            this.roadNetLineMap = {},
            this.roadNetPointMap = {},
            this.roadNetInfoMap = {},
            this.roadNetEdgeMap = {},
            this.roadNetPointMap = {},
            this.mapRoadNetListByModelKey = {},
            this.mapModelKeyByRoadNetKey = {},
            this.modelInfo = {},
            this.viewer3D = e
        }
        return dc(A, [{
            key: "_getRoadNetListByModelKey",
            value: function(A) {
                var e = this
                  , t = this;
                return new Promise((function(i, o) {
                    (function(A) {
                        var e = A.viewer3D.getViewerImpl().getModel(A.modelKey)
                          , t = HE(e, ["loader", "url", "serverUrl"]) || HE(A, ["viewer3D", "host"], "")
                          , i = e.projectKey
                          , o = e.accessToken
                          , n = "";
                        e.share && (n = "&share=" + e.share);
                        var r = {
                            url: "".concat(t, "/").concat(A.apiVersion || "api", "/").concat(i, "/routes/list?modelKey=").concat(A.modelKey).concat(n)
                        };
                        return o && (r.headers = {
                            Authorization: o
                        }),
                        _d(r)
                    }
                    )({
                        viewer3D: e.viewer3D,
                        modelKey: A
                    }).then((function(e) {
                        var n, r = t.viewer3D.getViewerImpl().getModel(A);
                        if (!r)
                            return Bh.error(A + "模型不存在"),
                            void o(A + "模型不存在");
                        if (t.modelInfo[A] = r,
                        "SUCCESS" === (n = "string" == typeof e ? JSON.parse(e) : e).code) {
                            var a = t.mapRoadNetListByModelKey;
                            a[A] = {};
                            for (var s = 0, l = n.data.length; l > s; s += 1) {
                                var c = n.data[s]
                                  , h = c.key;
                                a[A][h] = c,
                                t.roadNetInfoMap[h] = c,
                                t.mapModelKeyByRoadNetKey[h] = A
                            }
                            i()
                        } else
                            o(n.message)
                    }
                    )).catch((function() {
                        Bh.error("获取模型路网列表失败"),
                        o("获取模型路网列表失败")
                    }
                    ))
                }
                ))
            }
        }, {
            key: "_getRoadNetDataByRouteKey",
            value: function(A, e, t) {
                var i = this
                  , o = this
                  , n = []
                  , r = this.mapModelKeyByRoadNetKey[A];
                if (r)
                    return n.push(new Promise((function(e, t) {
                        (function(A) {
                            var e = A.viewer3D.getViewerImpl().getModel(A.modelKey)
                              , t = HE(e, ["loader", "url", "serverUrl"]) || HE(A, ["viewer3D", "host"], "")
                              , i = e.projectKey
                              , o = e.accessToken
                              , n = "";
                            e.share && (n = "&share=" + e.share);
                            var r = {
                                url: "".concat(t, "/").concat(A.apiVersion || "api", "/").concat(i, "/routes/points?routeKey=").concat(A.routeKey).concat(n)
                            };
                            return o && (r.headers = {
                                Authorization: o
                            }),
                            _d(r)
                        }
                        )({
                            viewer3D: i.viewer3D,
                            routeKey: A,
                            modelKey: r
                        }).then((function(i) {
                            var n;
                            if ("SUCCESS" === (n = "string" == typeof i ? JSON.parse(i) : i).code) {
                                var r = o.roadNetPointMap;
                                r[A] = {};
                                for (var a = 0, s = n.data.length; s > a; a += 1) {
                                    var l = n.data[a];
                                    r[A][l.key] = l
                                }
                                e()
                            } else
                                t(n.message)
                        }
                        )).catch((function() {
                            Bh.error("获取模型路网列表失败"),
                            t("获取模型路网列表失败")
                        }
                        ))
                    }
                    ))),
                    n.push(new Promise((function(e, t) {
                        (function(A) {
                            var e = A.viewer3D.getViewerImpl().getModel(A.modelKey)
                              , t = HE(e, ["loader", "url", "serverUrl"]) || HE(A, ["viewer3D", "host"], "")
                              , i = e.projectKey
                              , o = e.accessToken
                              , n = "";
                            e.share && (n = "&share=" + e.share);
                            var r = {
                                url: "".concat(t, "/").concat(A.apiVersion || "api", "/").concat(i, "/routes/edges?routeKey=").concat(A.routeKey).concat(n)
                            };
                            return o && (r.headers = {
                                Authorization: o
                            }),
                            _d(r)
                        }
                        )({
                            viewer3D: i.viewer3D,
                            routeKey: A,
                            modelKey: r
                        }).then((function(i) {
                            var n;
                            "SUCCESS" === (n = "string" == typeof i ? JSON.parse(i) : i).code ? (o.roadNetEdgeMap[A] = n.data,
                            e()) : t(n.message)
                        }
                        )).catch((function() {
                            Bh.error("获取模型路网列表失败"),
                            t("获取模型路网列表失败")
                        }
                        ))
                    }
                    ))),
                    Promise.all(n);
                Bh.error("模型路网未初始化")
            }
        }, {
            key: "initRoadNetByModelKey",
            value: function(A) {
                var e = this;
                return new Promise((function(t, i) {
                    e._getRoadNetListByModelKey(A).then(t).catch(i)
                }
                ))
            }
        }, {
            key: "getRoadNetInfoListByModelKey",
            value: function(A) {
                return this.mapRoadNetListByModelKey[A]
            }
        }, {
            key: "addRoadNetByKey",
            value: function(A, e) {
                var t = this
                  , i = this
                  , o = e.color
                  , n = e.width
                  , r = void 0 === n ? 1 : n
                  , a = e.block
                  , s = void 0 === a || a;
                return new Promise((function(e, n) {
                    return o instanceof Xh ? "number" != typeof r ? (Bh.error("width 参数非法"),
                    void n("width 参数非法")) : void (i.roadNetLineMap[A] ? e() : t._getRoadNetDataByRouteKey(A).then((function() {
                        for (var t = i.roadNetEdgeMap[A], a = i.roadNetPointMap[A], l = [], c = 0, h = t.length; h > c; c += 1) {
                            var d = t[c]
                              , p = d._from.split("/")[1]
                              , g = d._to.split("/")[1]
                              , u = a[p].xyz;
                            u || (Bh.error("点", p, "不存在"),
                            n("点" + p + "不存在")),
                            l.push.apply(l, yc(u));
                            var f = a[g].xyz;
                            f || (Bh.error("点", g, "不存在"),
                            n("点" + g + "不存在")),
                            l.push.apply(l, yc(f))
                        }
                        var m = new JC;
                        m.setPositions(l);
                        var C = new YC({
                            color: o.getHex(),
                            linewidth: r / 1e3
                        });
                        s || (C.depthTest = !1,
                        C.transparent = !0);
                        var y = new XC(m,C);
                        y.matrixAutoUpdate = !1;
                        var v = i.mapModelKeyByRoadNetKey[A];
                        if (!v)
                            return Bh.error("模型路网未初始化"),
                            void n("模型路网未初始化");
                        var I = i.viewer3D.getModelMatrix(v);
                        y.matrix.copy(I),
                        i.viewer3D.getScene().add(y),
                        y.updateMatrixWorld(!0),
                        i.roadNetLineMap[A] = y,
                        i.viewer3D.render(),
                        e()
                    }
                    )).catch((function(A) {
                        n(A)
                    }
                    ))) : (Bh.error("color 参数非法"),
                    void n("color 参数非法"))
                }
                ))
            }
        }, {
            key: "removeRoadNetByKey",
            value: function(A) {
                this.roadNetLineMap[A] ? (this.viewer3D.getScene().remove(this.roadNetLineMap[A]),
                delete this.roadNetLineMap[A],
                this.viewer3D.render()) : Bh.warn("路网", A, "不存在")
            }
        }, {
            key: "showRoadNetByKey",
            value: function(A) {
                this.roadNetLineMap[A] ? (this.roadNetLineMap[A].visible = !0,
                this.viewer3D.render()) : Bh.warn("路网", A, "不存在")
            }
        }, {
            key: "hideRoadNetByKey",
            value: function(A) {
                this.roadNetLineMap[A] ? (this.roadNetLineMap[A].visible = !1,
                this.viewer3D.render()) : Bh.warn("路网", A, "不存在")
            }
        }, {
            key: "setRoadNetColorByKey",
            value: function(A, e) {
                if (this.roadNetLineMap[A]) {
                    if (!(e instanceof Xh))
                        return void Bh.warn("color 参数非法");
                    this.roadNetLineMap[A].material.color = e.getHex(),
                    this.viewer3D.render()
                } else
                    Bh.warn("路网", A, "不存在")
            }
        }, {
            key: "setRoadNetBlockByKey",
            value: function(A, e) {
                this.roadNetLineMap[A] ? (e ? (this.roadNetLineMap[A].material.depthTest = !0,
                this.roadNetLineMap[A].material.transparent = !1) : (this.roadNetLineMap[A].material.depthTest = !1,
                this.roadNetLineMap[A].material.transparent = !0),
                this.viewer3D.render()) : Bh.warn("路网", A, "不存在")
            }
        }, {
            key: "setRoadNetLineWidthByKey",
            value: function(A, e) {
                this.roadNetLineMap[A] ? (this.roadNetLineMap[A].material.linewidth = e / 1e3,
                this.viewer3D.render()) : Bh.warn("路网", A, "不存在")
            }
        }, {
            key: "update",
            value: function() {
                for (var A in this.roadNetLineMap)
                    if (this.roadNetLineMap.hasOwnProperty(A)) {
                        var e = this.roadNetLineMap[A]
                          , t = this.viewer3D.getModelMatrix(this.mapModelKeyByRoadNetKey[A]);
                        e.matrix.copy(t),
                        e.updateMatrixWorld(!0)
                    }
                for (var i in this.shortestPathLineMap)
                    if (this.shortestPathLineMap.hasOwnProperty(i)) {
                        var o = this.shortestPathLineMap[i]
                          , n = this.viewer3D.getModelMatrix(o.userData.modelKey);
                        o.matrix.copy(n),
                        o.updateMatrixWorld(!0)
                    }
                this.viewer3D.render()
            }
        }, {
            key: "getShortestPath",
            value: function(A, e, t, i) {
                var o = this
                  , n = this;
                return new Promise((function(i, r) {
                    o.roadNetInfoMap[A] || r({
                        code: "error",
                        detail: "路网".concat(A, "未初始化"),
                        start: e,
                        end: t
                    });
                    var a = o.mapModelKeyByRoadNetKey[A];
                    if (!a)
                        return Bh.error("模型路网未初始化"),
                        void r("模型路网未初始化");
                    (function(A) {
                        var e = A.viewer3D.getViewerImpl().getModel(A.modelKey)
                          , t = HE(e, ["loader", "url", "serverUrl"]) || HE(A, ["viewer3D", "host"], "")
                          , i = e.projectKey
                          , o = e.accessToken
                          , n = "";
                        e.share && (n = "&share=" + e.share);
                        var r = {
                            url: "".concat(t, "/").concat(A.apiVersion || "api", "/").concat(i, "/routes/shortestPath?routeKey=").concat(A.routeKey, "&start=").concat(A.start.toString(), "&end=").concat(A.end.toString()).concat(n)
                        };
                        return o && (r.headers = {
                            Authorization: o
                        }),
                        _d(r)
                    }
                    )({
                        modelKey: a,
                        viewer3D: n.viewer3D,
                        routeKey: A,
                        start: e,
                        end: t
                    }).then((function(o) {
                        var n;
                        "SUCCESS" === (n = "string" == typeof o ? JSON.parse(o) : o).code && i({
                            code: "success",
                            data: {
                                routeKey: A,
                                points: n.data
                            },
                            start: e,
                            end: t
                        })
                    }
                    )).catch((function(A) {
                        r({
                            code: "error",
                            detail: A,
                            start: e,
                            end: t
                        })
                    }
                    ))
                }
                ))
            }
        }, {
            key: "addShortestPathByPoints",
            value: function(A, e) {
                var t = this
                  , i = e.color
                  , o = e.width
                  , n = void 0 === o ? 1 : o
                  , r = e.block
                  , a = void 0 === r || r;
                return new Promise((function(e, o) {
                    if (!A.routeKey)
                        return Bh.error("缺少参数routeKey"),
                        void o("缺少参数routeKey");
                    if (!A.points)
                        return Bh.error("缺少参数points"),
                        void o("缺少参数points");
                    if (!(i instanceof Xh))
                        return Bh.error("color 参数非法"),
                        void o("color 参数非法");
                    if ("number" != typeof n)
                        return Bh.error("width 参数非法"),
                        void o("width 参数非法");
                    A.key || (A.key = uh.createUUID());
                    for (var r = [], s = 0, l = A.points.length; l > s; s += 1)
                        r.push.apply(r, yc(A.points[s]));
                    var c = new KE;
                    c.setPositions(r);
                    var h = new YC({
                        color: i.getHex(),
                        linewidth: n / 1e3
                    });
                    a || (h.depthTest = !1,
                    h.transparent = !0);
                    var d = new QE(c,h);
                    d.matrixAutoUpdate = !1;
                    var p = t.mapModelKeyByRoadNetKey[A.routeKey];
                    if (!p)
                        return Bh.error("模型路网未初始化"),
                        void o("模型路网未初始化");
                    var g = t.viewer3D.getModelMatrix(p);
                    d.matrix.copy(g),
                    d.userData.modelKey = p,
                    d.userData.routeKey = A.routeKey,
                    t.viewer3D.getScene().add(d),
                    d.updateMatrixWorld(!0),
                    t.shortestPathLineMap[A.key] = d,
                    t.viewer3D.render(),
                    e(A)
                }
                ))
            }
        }, {
            key: "showShortestPathByKey",
            value: function(A) {
                this.shortestPathLineMap[A] ? (this.shortestPathLineMap[A].visible = !0,
                this.viewer3D.render()) : Bh.warn("最短路径", A, "不存在")
            }
        }, {
            key: "hideShortestPathByKey",
            value: function(A) {
                this.shortestPathLineMap[A] ? (this.shortestPathLineMap[A].visible = !1,
                this.viewer3D.render()) : Bh.warn("最短路径", A, "不存在")
            }
        }, {
            key: "removeShortestPathByKey",
            value: function(A) {
                this.shortestPathLineMap[A] ? (this.viewer3D.getScene().remove(this.shortestPathLineMap[A]),
                delete this.shortestPathLineMap[A],
                this.viewer3D.render()) : Bh.warn("最短路径", A, "不存在")
            }
        }, {
            key: "setShortestPathColorByKey",
            value: function(A, e) {
                if (this.shortestPathLineMap[A]) {
                    if (!(e instanceof Xh))
                        return void Bh.warn("color 参数非法");
                    this.shortestPathLineMap[A].material.color = e.getHex(),
                    this.viewer3D.render()
                } else
                    Bh.warn("最短路径", A, "不存在")
            }
        }, {
            key: "setShortestPathBlockByKey",
            value: function(A, e) {
                this.shortestPathLineMap[A] ? (e ? (this.shortestPathLineMap[A].material.depthTest = !0,
                this.shortestPathLineMap[A].material.transparent = !1) : (this.shortestPathLineMap[A].material.depthTest = !1,
                this.shortestPathLineMap[A].material.transparent = !0),
                this.viewer3D.render()) : Bh.warn("最短路径", A, "不存在")
            }
        }, {
            key: "setShortestPathLineWidthByKey",
            value: function(A, e) {
                this.shortestPathLineMap[A] ? (this.shortestPathLineMap[A].material.linewidth = e / 1e3,
                this.viewer3D.render()) : Bh.warn("最短路径", A, "不存在")
            }
        }, {
            key: "roamByShortestPathData",
            value: function(A, e) {
                var t = this
                  , i = uh.extend({}, YE, e);
                if (A.routeKey)
                    if (A.points)
                        if (i.speed) {
                            var o = t.viewer3D.getModelMatrix(t.mapModelKeyByRoadNetKey[A.routeKey]);
                            if (o) {
                                var n = this.viewer3D.getViewerImpl().camera;
                                !function A(e, r) {
                                    if (e.length - 1 > r) {
                                        var a, s = new y(e[r][0],e[r][1],e[r][2] + i.height).applyMatrix4(o), l = new y(e[r + 1][0],e[r + 1][1],e[r + 1][2] + i.height).applyMatrix4(o), c = new y(e[r + 1][0],e[r + 1][1],e[r + 1][2] + i.height).applyMatrix4(o);
                                        if (r > e.length - 3 || (a = new y(e[r + 2][0],e[r + 2][1],e[r + 2][2] + i.height).applyMatrix4(o)),
                                        r === e.length - 2) {
                                            var h = new y(e[r + 1][0],e[r + 1][1],e[r + 1][2] + i.height).sub(new y(e[r][0],e[r][1],e[r][2] + i.height)).setLength(.1);
                                            a = new y(e[r + 1][0],e[r + 1][1],e[r + 1][2] + i.height).add(h).applyMatrix4(o)
                                        }
                                        var d = s.distanceTo(c) / i.speed * 1e3;
                                        t.viewer3D.getViewerImpl().getControlManager().setInteractiveState(!1),
                                        WE.from({
                                            animPosition: s,
                                            animTarget: l,
                                            animUp: n.up
                                        }).to({
                                            animPosition: c,
                                            animTarget: a,
                                            animUp: n.up
                                        }, d).onUpdate((function(A) {
                                            var e = A.animPosition;
                                            n.lookAtEXForTargetPositionUp(A.animTarget, e, n.up),
                                            t.viewer3D.getViewerImpl().cameraControl.update(!0, !0),
                                            i.callbackProcess && i.callbackProcess(e)
                                        }
                                        )).onComplete((function() {
                                            n.lookAtEXForTargetPositionUp(a, c, n.up),
                                            t.viewer3D.getViewerImpl().cameraControl.update(!0, !0),
                                            i.callbackProcess && i.callbackProcess(c),
                                            i.callbackFinish && i.callbackFinish(),
                                            t.viewer3D.getViewerImpl().getControlManager().setInteractiveState(!0),
                                            A(e, r += 1)
                                        }
                                        )).start(i.frameTime, !0)
                                    } else
                                        i.callbackAllFinish && i.callbackAllFinish()
                                }(A.points, 0)
                            } else
                                Bh.error("无法获取路径对应的模型矩阵")
                        } else
                            Bh.error("speed参数非法");
                    else
                        Bh.error("缺少参数points");
                else
                    Bh.error("缺少参数routeKey")
            }
        }]),
        A
    }()
      , zE = {
        fontSize: 100,
        color: "#ff0000",
        opacity: 1,
        side: 2,
        transparent: !0
    }
      , ZE = function() {
        function A() {
            cc(this, A)
        }
        return dc(A, [{
            key: "createMesh",
            value: function(A, e) {
                var t = Object.assign({}, zE, e)
                  , i = A.generateShapes(t.text, t.fontSize)
                  , o = new jA(t)
                  , n = new Ue(new ar(i),o);
                return t.position && this.setPos(n, t.position),
                t.rotation && this.setRotation(n, t.rotation),
                t.matrix && this.setMat(n, t.matrix),
                n
            }
        }, {
            key: "setPos",
            value: function(A, e) {
                var t;
                (t = A.position).set.apply(t, yc(e)),
                A.updateMatrixWorld(!0)
            }
        }, {
            key: "setMat",
            value: function(A, e) {
                A.applyMatrix4(e),
                A.updateMatrixWorld(!0)
            }
        }, {
            key: "setRotation",
            value: function(A, e) {
                var t;
                (t = A.rotation).set.apply(t, yc(e)),
                A.updateMatrixWorld(!0)
            }
        }]),
        A
    }()
      , XE = function() {
        function A(e) {
            cc(this, A),
            this.fonts = {},
            this.host = e.host
        }
        return dc(A, [{
            key: "loadFont",
            value: function(A, e) {
                var t = this;
                return new Promise((function(i, o) {
                    _d({
                        type: "POST",
                        url: "".concat(t.host, "/api/fonts"),
                        headers: {
                            "Content-type": "application/json;charset=UTF-8"
                        },
                        data: JSON.stringify({
                            font: A,
                            text: e
                        }),
                        responseType: "json",
                        success: function(e) {
                            "success" === e.code.toLowerCase() ? (t.fonts[A] ? Object.assign(t.fonts[A].data.glyphs, e.data.glyphs) : (t.fonts[A] = {},
                            t.fonts[A].data = e.data),
                            t.fonts[A].font = new za(t.fonts[A].data),
                            i(t.fonts[A].font)) : o(e)
                        },
                        error: function(A, e) {
                            o(e)
                        }
                    })
                }
                ))
            }
        }, {
            key: "getFont",
            value: function(A, e) {
                var t = this;
                return new Promise((function(i, o) {
                    if (t.fonts[A]) {
                        for (var n = e.length, r = "", a = 0; n > a; a += 1)
                            t.fonts[A].data.glyphs[e[a]] || (r += e[a]);
                        r ? t.loadFont(A, r).then(i).catch(o) : i(t.fonts[A].font)
                    } else
                        t.loadFont(A, e).then(i).catch(o)
                }
                ))
            }
        }]),
        A
    }()
      , _E = function() {
        function A(e) {
            cc(this, A),
            this.viewer = e.viewer.getViewerImpl(),
            this.meshes = {},
            this.fontLib = new XE({
                host: e.viewer.host
            }),
            this.text = new ZE,
            this.draggingId = ""
        }
        return dc(A, [{
            key: "addText",
            value: function(A) {
                var e = this;
                return this.fontLib.getFont(A.fontName, A.text).then((function(t) {
                    var i = e.text.createMesh(t, A)
                      , o = uh.createUUID();
                    return e.meshes[o] = i,
                    e.viewer.getScene().add(i),
                    e.viewer.render(),
                    {
                        code: "success",
                        id: o
                    }
                }
                )).catch((function(A) {
                    return {
                        code: "error",
                        err: A
                    }
                }
                ))
            }
        }, {
            key: "removeText",
            value: function(A) {
                if (this.draggingId !== A) {
                    var e = this.meshes[A];
                    e && (this.viewer.getScene().remove(e),
                    delete this.meshes[A],
                    this.viewer.render())
                }
            }
        }, {
            key: "setPosition",
            value: function(A, e) {
                if (this.draggingId !== A) {
                    var t = this.meshes[A];
                    t && (this.text.setPos(t, e),
                    this.viewer.render())
                }
            }
        }, {
            key: "setMatrix",
            value: function(A, e) {
                if (this.draggingId !== A) {
                    var t = this.meshes[A];
                    t && (this.text.setMat(t, e),
                    this.viewer.render())
                }
            }
        }, {
            key: "setRotation",
            value: function(A, e) {
                if (this.draggingId !== A) {
                    var t = this.meshes[A];
                    t && (this.text.setRotation(t, e),
                    this.viewer.render())
                }
            }
        }, {
            key: "getTextIDs",
            value: function() {
                return Object.keys(this.meshes)
            }
        }, {
            key: "dragText",
            value: function(A) {
                if ("" === this.draggingId) {
                    var e = this.meshes[A];
                    e && (this.viewer.translateComponentByKey(e),
                    this.draggingId = A)
                }
            }
        }, {
            key: "saveDragText",
            value: function() {
                "" !== this.draggingId && (this.viewer.cancelTransformComponent(!1),
                this.draggingId = "")
            }
        }]),
        A
    }()
      , $E = function() {
        function A(e) {
            cc(this, A),
            this.curves = {},
            this.viewer = e.viewer3D,
            this.modelKey = e.modelKey
        }
        return dc(A, [{
            key: "getId",
            value: function(A) {
                return Bd(JSON.stringify(A)).slice(0, 8)
            }
        }, {
            key: "getCurve",
            value: function(A) {
                return this.curves[A]
            }
        }, {
            key: "_setCurve",
            value: function(A, e) {
                this.curves[A] = e
            }
        }, {
            key: "_rmCurve",
            value: function(A) {
                delete this.curves[A]
            }
        }, {
            key: "genTHREELine",
            value: function(A) {
                var e = A.num
                  , t = void 0 === e ? 100 : e
                  , i = A.debug
                  , o = void 0 !== i && i
                  , n = new la(A.points,A.closed,A.curveType,A.tension)
                  , r = this.getId(A)
                  , a = new De;
                a.vertices = n.getSpacedPoints(t);
                var s = new Go(a,new ko({
                    color: A.color || 16777215 * Math.random(),
                    linewidth: 6.18,
                    depthTest: !0,
                    transparent: !1
                }));
                o && (this.viewer.getViewerImpl().modelManager.getModel(this.modelKey).group.add(s),
                s.updateMatrixWorld(),
                this.viewer.render());
                return this._setCurve(r, {
                    curve: n,
                    num: t,
                    line: s
                }),
                r
            }
        }, {
            key: "rmCurve",
            value: function(A) {
                var e = this.getCurve(A).line;
                this.viewer.getViewerImpl().modelManager.getModel(this.modelKey).group.remove(e),
                e.updateMatrixWorld(),
                this.viewer.render(),
                this._rmCurve(A)
            }
        }]),
        A
    }()
      , AB = function() {
        function A(e) {
            cc(this, A),
            this.trackSet = {},
            this.lineManager = new $E(e),
            this.viewer = e.viewer3D
        }
        return dc(A, [{
            key: "_genLine",
            value: function(A) {
                return this.lineManager.genTHREELine(A)
            }
        }, {
            key: "addTrack",
            value: function(A) {
                var e = ((new Date).getTime() * (Math.random() + 1)).toString(36).slice(0, 8)
                  , t = this._genLine(A);
                return this.trackSet[e] = {
                    componentKey: A.componentKey,
                    lineId: [t]
                },
                e
            }
        }, {
            key: "appendTrack",
            value: function(A) {
                var e = this.trackSet[A.trackId];
                if (e) {
                    var t = this._genLine(A);
                    e.lineId.push(t)
                }
            }
        }, {
            key: "removeTrack",
            value: function(A) {
                var e = this
                  , t = this.trackSet[A];
                t && (t.lineId.forEach((function(A) {
                    e.lineManager.rmCurve(A)
                }
                )),
                delete this.trackSet[A])
            }
        }, {
            key: "startMove",
            value: function(A) {
                var e = this
                  , t = A.trackId
                  , i = A.startDir
                  , o = A.pointFn;
                return new Promise((function(A, n) {
                    var r = e.trackSet[t];
                    if (r) {
                        var a = r.lineId
                          , s = r.componentKey
                          , l = new M
                          , c = a.length
                          , h = e.lineManager.getCurve(a[0]).curve.getPoint(0)
                          , d = e.viewer.getBoxByComponentsKey(s)
                          , p = d.min
                          , g = d.max
                          , u = (new y).addVectors(p, g).divideScalar(2);
                        l.elements[12] = h.x - u.x,
                        l.elements[13] = h.y - u.y,
                        l.elements[14] = h.z - u.z,
                        e.viewer.componentApplyMatrix(s, l);
                        var m = 0
                          , C = new M
                          , v = i.clone().normalize()
                          , I = function i(n) {
                            var r = e.lineManager.getCurve(a[Math.trunc(m)]).curve.getPoint(m - Math.trunc(m))
                              , h = c > n ? e.lineManager.getCurve(a[Math.trunc(n)]).curve.getPoint(n - Math.trunc(n)) : e.lineManager.getCurve(a[c - 1]).curve.getPoint(1)
                              , d = new M;
                            d.elements[12] = -r.x,
                            d.elements[13] = -r.y,
                            d.elements[14] = -r.z;
                            var p = new f
                              , g = new y(h.x - r.x,h.y - r.y,h.z - r.z).normalize();
                            p.setFromUnitVectors(v, g),
                            v.applyQuaternion(p);
                            var u = (new M).makeRotationFromQuaternion(p)
                              , I = new M;
                            I.elements[12] = h.x,
                            I.elements[13] = h.y,
                            I.elements[14] = h.z,
                            l.elements = C.elements,
                            e.viewer.componentApplyMatrix(s, I.multiply(u).multiply(d)),
                            m = n,
                            c > n ? "function" == typeof o ? requestAnimationFrame((function() {
                                i(o(t, n, h))
                            }
                            )) : requestAnimationFrame((function() {
                                return i(parseFloat((n + .01).toFixed(2)))
                            }
                            )) : A({
                                code: "success",
                                trackId: t
                            })
                        };
                        "function" == typeof o ? requestAnimationFrame((function() {
                            I(o(t, 0, h))
                        }
                        )) : requestAnimationFrame((function() {
                            return I(.01)
                        }
                        ))
                    } else
                        n({
                            code: "error",
                            message: "找不到指定轨迹"
                        })
                }
                ))
            }
        }]),
        A
    }()
      , eB = function(A, e) {
        Ue.call(this, A);
        var t = this
          , i = void 0 !== (e = e || {}).textureWidth ? e.textureWidth : 512
          , o = void 0 !== e.textureHeight ? e.textureHeight : 512
          , n = void 0 !== e.clipBias ? e.clipBias : 0
          , r = void 0 !== e.alpha ? e.alpha : 1
          , s = void 0 !== e.time ? e.time : 0
          , l = void 0 !== e.waterNormals ? e.waterNormals : null
          , c = void 0 !== e.sunDirection ? e.sunDirection : new y(.70707,.70707,0)
          , h = new LA(void 0 !== e.sunColor ? e.sunColor : 16777215)
          , d = new LA(void 0 !== e.waterColor ? e.waterColor : 8355711)
          , u = void 0 !== e.eye ? e.eye : new y(0,0,0)
          , f = void 0 !== e.distortionScale ? e.distortionScale : 20
          , m = void 0 !== e.side ? e.side : 0
          , C = void 0 !== e.fog && e.fog
          , v = new EA
          , I = new y
          , E = new y
          , B = new y
          , x = new M
          , S = new y(0,0,-1)
          , w = new p
          , b = new y
          , U = new y
          , F = new p
          , K = new M
          , Q = new je
          , R = new g(i,o,{
            minFilter: 1006,
            magFilter: 1006,
            format: 1022,
            stencilBuffer: !1
        });
        a.isPowerOfTwo(i) && a.isPowerOfTwo(o) || (R.texture.generateMipmaps = !1);
        var T = {
            uniforms: Ge.merge([Xe.fog, Xe.lights, {
                normalSampler: {
                    value: null
                },
                mirrorSampler: {
                    value: null
                },
                alpha: {
                    value: 1
                },
                time: {
                    value: 0
                },
                size: {
                    value: 1
                },
                distortionScale: {
                    value: 20
                },
                textureMatrix: {
                    value: new M
                },
                sunColor: {
                    value: new LA(8355711)
                },
                sunDirection: {
                    value: new y(.70707,.70707,0)
                },
                eye: {
                    value: new y
                },
                waterColor: {
                    value: new LA(5592405)
                }
            }]),
            vertexShader: ["uniform mat4 textureMatrix;", "uniform float time;", "varying vec4 mirrorCoord;", "varying vec4 worldPosition;", tt.fog_pars_vertex, tt.shadowmap_pars_vertex, "void main() {", "    mirrorCoord = modelMatrix * vec4( position, 1.0 );", "    worldPosition = mirrorCoord.xyzw;", "    mirrorCoord = textureMatrix * mirrorCoord;", "    vec4 mvPosition =  modelViewMatrix * vec4( position, 1.0 );", "    gl_Position = projectionMatrix * mvPosition;", tt.fog_vertex, tt.shadowmap_vertex, "}"].join("\n"),
            fragmentShader: ["uniform sampler2D mirrorSampler;", "uniform float alpha;", "uniform float time;", "uniform float size;", "uniform float distortionScale;", "uniform sampler2D normalSampler;", "uniform vec3 sunColor;", "uniform vec3 sunDirection;", "uniform vec3 eye;", "uniform vec3 waterColor;", "varying vec4 mirrorCoord;", "varying vec4 worldPosition;", "vec4 getNoise( vec2 uv ) {", "    vec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);", "    vec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );", "    vec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );", "    vec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );", "    vec4 noise = texture2D( normalSampler, uv0 ) +", "        texture2D( normalSampler, uv1 ) +", "        texture2D( normalSampler, uv2 ) +", "        texture2D( normalSampler, uv3 );", "    return noise * 0.5 - 1.0;", "}", "void sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) {", "    vec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) );", "    float direction = max( 0.0, dot( eyeDirection, reflection ) );", "    specularColor += pow( direction, shiny ) * sunColor * spec;", "    diffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse;", "}", tt.common, tt.packing, tt.bsdfs, tt.fog_pars_fragment, tt.lights_pars_begin, tt.shadowmap_pars_fragment, tt.shadowmask_pars_fragment, "void main() {", "    vec4 noise = getNoise( worldPosition.xz * size );", "    vec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );", "    vec3 diffuseLight = vec3(0.0);", "    vec3 specularLight = vec3(0.0);", "    vec3 worldToEye = eye-worldPosition.xyz;", "    vec3 eyeDirection = normalize( worldToEye );", "    sunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight );", "    float distance = length(worldToEye);", "    vec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;", "    vec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) );", "    float theta = max( dot( eyeDirection, surfaceNormal ), 0.0 );", "    float rf0 = 0.3;", "    float reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 );", "    vec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor;", "    vec3 albedo = mix( ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask(), ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance);", "    vec3 outgoingLight = albedo;", "    gl_FragColor = vec4( outgoingLight, alpha );", tt.tonemapping_fragment, tt.fog_fragment, "}"].join("\n")
        }
          , k = new Pe({
            fragmentShader: T.fragmentShader,
            vertexShader: T.vertexShader,
            uniforms: Ge.clone(T.uniforms),
            transparent: 1 > r,
            lights: !0,
            side: m,
            fog: C
        });
        k.uniforms.mirrorSampler.value = R.texture,
        k.uniforms.textureMatrix.value = K,
        k.uniforms.alpha.value = r,
        k.uniforms.time.value = s,
        k.uniforms.normalSampler.value = l,
        k.uniforms.sunColor.value = h,
        k.uniforms.waterColor.value = d,
        k.uniforms.sunDirection.value = c,
        k.uniforms.distortionScale.value = f,
        k.uniforms.eye.value = u,
        t.material = k,
        t.onBeforeRender = function(A, e, i) {
            if (E.setFromMatrixPosition(t.matrixWorld),
            B.setFromMatrixPosition(i.matrixWorld),
            x.extractRotation(t.matrixWorld),
            I.set(0, 0, 1),
            I.applyMatrix4(x),
            b.subVectors(E, B),
            0 >= b.dot(I)) {
                b.reflect(I).negate(),
                b.add(E),
                x.extractRotation(i.matrixWorld),
                S.set(0, 0, -1),
                S.applyMatrix4(x),
                S.add(B),
                U.subVectors(E, S),
                U.reflect(I).negate(),
                U.add(E),
                Q.position.copy(b),
                Q.up.set(0, 1, 0),
                Q.up.applyMatrix4(x),
                Q.up.reflect(I),
                Q.lookAt(U),
                Q.far = i.far,
                Q.updateMatrixWorld(),
                Q.projectionMatrix.copy(i.projectionMatrix),
                K.set(.5, 0, 0, .5, 0, .5, 0, .5, 0, 0, .5, .5, 0, 0, 0, 1),
                K.multiply(Q.projectionMatrix),
                K.multiply(Q.matrixWorldInverse),
                v.setFromNormalAndCoplanarPoint(I, E),
                v.applyMatrix4(Q.matrixWorldInverse),
                w.set(v.normal.x, v.normal.y, v.normal.z, v.constant);
                var o = Q.projectionMatrix;
                F.x = (Math.sign(w.x) + o.elements[8]) / o.elements[0],
                F.y = (Math.sign(w.y) + o.elements[9]) / o.elements[5],
                F.z = -1,
                F.w = (1 + o.elements[10]) / o.elements[14],
                w.multiplyScalar(2 / w.dot(F)),
                o.elements[2] = w.x,
                o.elements[6] = w.y,
                o.elements[10] = w.z + 1 - n,
                o.elements[14] = w.w,
                u.setFromMatrixPosition(i.matrixWorld);
                var r = A.getRenderTarget()
                  , a = A.xr.enabled
                  , s = A.shadowMap.autoUpdate;
                t.visible = !1,
                A.xr.enabled = !1,
                A.shadowMap.autoUpdate = !1,
                A.setRenderTarget(R),
                A.clear(),
                A.render(e, Q),
                t.visible = !0,
                A.xr.enabled = a,
                A.shadowMap.autoUpdate = s,
                A.setRenderTarget(r)
            }
        }
    };
    (eB.prototype = Object.create(Ue.prototype)).constructor = eB;
    var tB = function(A) {
        this.name = A.name || "",
        this.id = A.id || "",
        this.keyFrameList = [],
        this.roamTime = 5,
        this.interpolateType = 1,
        this.fps = 50,
        this.parts = 100,
        this.rotateSpeed = Math.PI / this.roamTime / this.fps / 4,
        this.parameters = {
            segments: this.roamTime * this.fps * this.parts,
            closed: !1,
            curveType: "centripetal",
            tension: .25
        },
        this.modificationId = 0,
        this.mapDeltaAngle = {},
        this.mapDeltaOffset = {},
        this.allocateSegmentList = null,
        this.positionCurve = void 0,
        this.init(A)
    };
    tB.prototype.init = function(A) {
        this.setKeyFrameList(A.keyFrameList),
        this.setParameters(A.parameters),
        this.setInterpolateType(A.type),
        this.setFps(A.fps),
        this.setRoamTime(A.roamTime)
    }
    ,
    tB.prototype.addKeyFrame = function(A) {
        var e = new y(A.position.x,A.position.y,A.position.z)
          , t = new y(A.target.x,A.target.y,A.target.z)
          , i = new y(A.up.x,A.up.y,A.up.z)
          , o = null;
        if (A.quaternion)
            o = new f(A.quaternion.x,A.quaternion.y,A.quaternion.z,A.quaternion.w);
        else {
            var n = new M;
            n.lookAt(e, t, i),
            o = (new f).setFromRotationMatrix(n)
        }
        this.keyFrameList.push({
            position: e,
            target: t,
            up: i,
            id: A.id,
            quaternion: o,
            curve: A.curve
        }),
        this.modificationId += 1
    }
    ,
    tB.prototype.setKeyFrameList = function(A) {
        this.keyFrameList = [];
        for (var e = 0, t = A.length; t > e; e += 1)
            this.addKeyFrame(A[e]);
        this.calRotateSpeed()
    }
    ,
    tB.prototype.removeKeyFrame = function(A) {
        A >= 0 && this.keyFrameList.length > A && (this.keyFrameList.splice(A, 1),
        this.modificationId += 1)
    }
    ,
    tB.prototype.getKeyFrames = function() {
        return this.keyFrameList
    }
    ,
    tB.prototype.getKeyFrameCount = function() {
        return this.keyFrameList.length
    }
    ,
    tB.prototype.clearFrames = function() {
        this.keyFrameList = []
    }
    ,
    tB.prototype.getJumpCounts = function(A) {
        var e = A / (1e3 / this.fps) * this.parts;
        return e = parseInt(e, 0)
    }
    ,
    tB.prototype.setRoamTime = function(A) {
        this.roamTime = A,
        this.setSegments(A * this.fps * this.parts),
        this.calRotateSpeed()
    }
    ,
    tB.prototype.calRotateSpeed = function() {
        var A = this.getKeyFrames().length;
        A > 1 && (this.rotateSpeed = Math.PI * (A - 1) / this.roamTime / this.fps / 4)
    }
    ,
    tB.prototype.setInterpolateType = function(A) {
        this.interpolateType = A || 1,
        1 === this.interpolateType && this.setSplineTension(0)
    }
    ,
    tB.prototype.getInterpolateType = function() {
        return this.interpolateType
    }
    ,
    tB.prototype.setName = function(A) {
        this.name = A
    }
    ,
    tB.prototype.getName = function() {
        return this.name
    }
    ,
    tB.prototype.getId = function() {
        return this.id
    }
    ,
    tB.prototype.getKeyFramePositions = function() {
        for (var A = [], e = 0, t = this.keyFrameList.length; t > e; e += 1) {
            A.push(this.keyFrameList[e].position)
        }
        return A
    }
    ,
    tB.prototype.getKeyFramePosition = function(A) {
        return this.keyFrameList[A].position
    }
    ,
    tB.prototype.getKeyFrameDirection = function(A) {
        var e = this.keyFrameList[A];
        return e.target.clone().sub(e.position)
    }
    ,
    tB.prototype.getKeyFrameTarget = function(A) {
        return this.keyFrameList[A].target
    }
    ,
    tB.prototype.getKeyFrameUp = function(A) {
        return this.keyFrameList[A].up
    }
    ,
    tB.prototype.allocateSegments = function() {
        for (var A = [], e = 0, t = this.keyFrameList.length; t - 1 > e; e += 1) {
            var i = this.keyFrameList[e].position;
            A.push(this.keyFrameList[e + 1].position.clone().sub(i).length())
        }
        for (var o = 0, n = 0, r = A.length; r > n; n += 1)
            o += A[n];
        for (var a = this.getSegments(), s = 0, l = A.length; 0 !== o && l > s; s += 1)
            A[s] /= o,
            A[s] *= this.getSegments(),
            A[s] = Math.floor(A[s]),
            a -= A[s];
        for (var c = 0; a > c; c += 1)
            A[c] > 0 && (A[c] += 1);
        this.allocateSegmentList = A
    }
    ,
    tB.prototype.getAllocateSegmentCount = function(A) {
        return null === this.allocateSegmentList && this.allocateSegments(),
        this.allocateSegmentList[A]
    }
    ,
    tB.prototype.getSplineParam = function(A, e) {
        return null === this.allocateSegmentList && this.allocateSegments(),
        (A + e / this.allocateSegmentList[A]) / this.allocateSegmentList.length
    }
    ,
    tB.prototype.getDeltaAngle = function(A) {
        return this.mapDeltaAngle[A]
    }
    ,
    tB.prototype.calculateDeltaAngle = function() {
        for (var A = this.allocateSegmentList, e = 0; A.length > e; e += 1) {
            var t = 0;
            if (this.keyFrameList[e].quaternion && this.keyFrameList[e + 1].quaternion) {
                var i = this.keyFrameList[e].quaternion
                  , o = this.keyFrameList[e + 1].quaternion
                  , n = (new f).multiplyQuaternions(o, i.clone().inverse());
                n.normalize(),
                t = 2 * Math.acos(n.w)
            } else {
                var r = this.getKeyFrameDirection(e)
                  , a = this.getKeyFrameDirection(e + 1);
                t = r.angleTo(a)
            }
            var s = A[e];
            if (0 === s) {
                var l = Math.floor(t / this.rotateSpeed) * this.parts;
                A[e] = l,
                this.mapDeltaAngle[e] = t / l
            } else
                this.mapDeltaAngle[e] = t / s
        }
    }
    ,
    tB.prototype.getRotateAxis = function(A) {
        var e = this.keyFrameList[A].quaternion
          , t = this.keyFrameList[A + 1].quaternion;
        if (e && t) {
            var i = (new f).multiplyQuaternions(t, e.clone().inverse());
            return i.normalize(),
            new y(i.x,i.y,i.z).normalize()
        }
        var o = this.getKeyFrameDirection(A)
          , n = this.getKeyFrameDirection(A + 1);
        return o.clone().cross(n.clone()).normalize()
    }
    ,
    tB.prototype.getDeltaOffset = function(A) {
        return this.mapDeltaOffset[A]
    }
    ,
    tB.prototype.getPositionAtCurve = function(A, e) {
        var t = this.keyFrameList[A + 1];
        if (t && t.curve)
            return t.curve.getPointAt(e)
    }
    ,
    tB.prototype.getPositionAtCurve = function(A, e) {
        var t = this.keyFrameList[A + 1];
        if (t && t.curve)
            return t.curve.getPointAt(e)
    }
    ,
    tB.prototype.getLatestPositionAtCurve = function(A) {
        var e = this.keyFrameList[A];
        if (e && e.curve)
            return e.position
    }
    ,
    tB.prototype.calculateDeltaOffset = function() {
        for (var A = this.allocateSegmentList, e = this.getKeyFramePositions(), t = 0; A.length > t; t += 1) {
            var i = e[t]
              , o = e[t + 1]
              , n = this.allocateSegmentList[t];
            this.mapDeltaOffset[t] = 0 === n ? new y : o.clone().sub(i).divideScalar(n)
        }
    }
    ,
    tB.prototype.setSplineTension = function(A) {
        0 > A || A > 1 || (this.parameters.tension = A,
        this.modificationId += 1)
    }
    ,
    tB.prototype.setSegments = function(A) {
        this.parameters.segments = A,
        this.modificationId += 1
    }
    ,
    tB.prototype.getSegments = function() {
        return this.parameters.segments
    }
    ,
    tB.prototype.setParameters = function(A) {
        A && (this.parameters = A,
        this.modificationId += 1)
    }
    ,
    tB.prototype.getParameters = function() {
        return this.parameters
    }
    ,
    tB.prototype.setFps = function(A) {
        this.fps = A || 50,
        this.calRotateSpeed(),
        this.modificationId += 1
    }
    ,
    tB.prototype.getFps = function() {
        return this.fps
    }
    ,
    tB.prototype.getModificationId = function() {
        return this.modificationId
    }
    ,
    tB.prototype.export = function() {
        return {
            name: this.name,
            id: this.id,
            fps: this.fps,
            roamTime: this.roamTime,
            type: this.interpolateType,
            keyFrameList: this.keyFrameList
        }
    }
    ;
    var iB = function(A) {
        this.viewer = A.viewer,
        this.roam = null,
        this.bPause = !1,
        this.bContinue = !1,
        this.spline = null,
        this.reqid = 0,
        this.playBinded = this._play.bind(this),
        this.recordId = -1,
        this.keyFrameIdx = 0,
        this.count = -1,
        this.camera = this.viewer.cameraControl.camera,
        this.pausePlayCallback = [],
        this.stopPlayCallback = [],
        this.keyFrameCallback = [],
        this.timeRecorder = {
            last: 0,
            pause: 0,
            deltaTime: 0
        },
        this.setRoam(A.roamData)
    };
    iB.prototype.setRoam = function(A) {
        this.roam = A,
        this.bPause = !1,
        this.recordId = -1,
        this.spline = null,
        this.keyFrameIdx = 0,
        this.count = -1
    }
    ,
    iB.prototype.updateCamera = function(A, e, t) {
        this.camera.position.add(A),
        this.camera.target.addVectors(this.camera.position, e),
        this.camera.up.copy(t)
    }
    ,
    iB.prototype.updateCameraToFrame = function(A) {
        var e = this.roam.getKeyFramePosition(A)
          , t = this.roam.getKeyFrameTarget(A)
          , i = this.roam.getKeyFrameUp(A);
        this.camera.position.copy(e),
        this.camera.target.copy(t),
        this.camera.up.copy(i)
    }
    ,
    iB.prototype.reAllocate = function() {
        this.recordId !== this.roam.getModificationId() && (this.roam.allocateSegments(),
        this.roam.calculateDeltaOffset(),
        this.roam.calculateDeltaAngle(),
        this.recordId = this.roam.getModificationId())
    }
    ,
    iB.prototype._play = function() {
        var A = new f
          , e = new f
          , t = new y
          , i = new y(0,1,0)
          , o = new y;
        return function() {
            this.reqid = setTimeout(this.playBinded, this.roam.getFps()),
            !1 === this.bContinue ? (this.bContinue = !0,
            this.timeRecorder.deltaTime = this.timeRecorder.pause - this.timeRecorder.last) : this.timeRecorder.deltaTime = performance.now() - this.timeRecorder.last,
            this.timeRecorder.last = performance.now();
            var n = this.roam.getJumpCounts(this.timeRecorder.deltaTime);
            if (this.reAllocate(),
            this.bPause)
                return this.timeRecorder.pause = performance.now(),
                clearTimeout(this.reqid),
                this.triggerPausePlayCallback(),
                this.bPause = !1,
                void (this.bContinue = !1);
            var r = this.roam.getKeyFrameCount()
              , a = this.roam.getAllocateSegmentCount(this.keyFrameIdx);
            if (0 === a)
                this.keyFrameIdx += 1,
                this.triggerKeyFrameCallback(this.keyFrameIdx),
                this.count = -1;
            else if (this.keyFrameIdx === r - 1)
                this.updateCameraToFrame(this.keyFrameIdx),
                this.stop();
            else if (-1 === this.count)
                this.timeStart = performance.now(),
                0 === this.keyFrameIdx && this.triggerKeyFrameCallback(0),
                this.updateCameraToFrame(this.keyFrameIdx),
                this.count = 0;
            else if (a > this.count) {
                this.count + n > a && (n = a - this.count);
                var s = this.count / a
                  , l = this.roam.keyFrameList[this.keyFrameIdx].quaternion
                  , c = this.roam.keyFrameList[this.keyFrameIdx + 1].quaternion;
                A.copy(c),
                l.equals(c) || f.slerp(l, c, A, s);
                var h = this.roam.keyFrameList[this.keyFrameIdx];
                t.subVectors(h.target, h.position),
                t.applyQuaternion(e.copy(l).inverse()),
                t.applyQuaternion(A),
                i.set(0, 1, 0),
                i.applyQuaternion(A);
                var d = this.roam.getPositionAtCurve(this.keyFrameIdx, s);
                if (d)
                    this.camera.position.copy(d);
                else {
                    var p = this.roam.getDeltaOffset(this.keyFrameIdx);
                    o.copy(p).multiplyScalar(n),
                    this.camera.position.add(o)
                }
                if (this.camera.target.addVectors(this.camera.position, t),
                this.camera.up.copy(i),
                a > this.count + n)
                    this.count += n;
                else {
                    this.keyFrameIdx += 1;
                    var g = this.roam.getLatestPositionAtCurve(this.keyFrameIdx);
                    g && this.camera.position.copy(g),
                    this.triggerKeyFrameCallback(this.keyFrameIdx),
                    this.count = 0
                }
            }
            this.viewer.render()
        }
    }(),
    iB.prototype.play = function() {
        this.bPause = !1,
        this._play()
    }
    ,
    iB.prototype.pause = function() {
        this.bPause = !0
    }
    ,
    iB.prototype.continue = function() {
        this.bContinue = !0,
        this.bPause = !1,
        this._play()
    }
    ,
    iB.prototype.stop = function() {
        this.bPause = !1,
        this.keyFrameIdx = 0,
        this.count = -1,
        clearTimeout(this.reqid),
        this.triggerStopPlayCallback()
    }
    ,
    iB.prototype.startFrom = function(A) {
        for (var e = this.roam, t = e.getKeyFrameCount(), i = e.getKeyFrames(), o = 0; t > o; o += 1)
            if (i[o].id === A)
                return this.keyFrameIdx = o,
                void (this.count = -1)
    }
    ,
    iB.prototype.addKeyFrameCallback = function(A) {
        this.keyFrameCallback.push(A)
    }
    ,
    iB.prototype.addPausePlayCallback = function(A) {
        this.pausePlayCallback.push(A)
    }
    ,
    iB.prototype.addStopPlayCallback = function(A) {
        this.stopPlayCallback.push(A)
    }
    ,
    iB.prototype.triggerKeyFrameCallback = function(A) {
        this.keyFrameCallback.forEach((function(e) {
            e(A)
        }
        ))
    }
    ,
    iB.prototype.triggerPausePlayCallback = function() {
        this.pausePlayCallback.forEach((function(A) {
            A()
        }
        ))
    }
    ,
    iB.prototype.triggerStopPlayCallback = function() {
        this.stopPlayCallback.forEach((function(A) {
            A()
        }
        ))
    }
    ,
    iB.prototype.updataSpline = function() {
        var A = this.roam.getKeyFramePositions()
          , e = this.roam.getParameters();
        this.spline = new la(A,e.closed,e.curveType,e.tension)
    }
    ;
    var oB = function() {
        this.roamList = []
    };
    oB.prototype.clear = function() {
        this.roamList = []
    }
    ,
    oB.prototype.add = function(A) {
        this.roamList.push(A)
    }
    ,
    oB.prototype.remove = function(A) {
        for (var e = 0, t = this.roamList.length; t > e; e += 1) {
            if (this.roamList[e].getName() === A)
                return void this.roamList.splice(e, 1)
        }
    }
    ,
    oB.prototype.save = function() {
        return JSON.stringify(this.roamList)
    }
    ,
    oB.prototype.load = function(A) {
        this.clear();
        for (var e = JSON.parse(A), t = 0, i = e.length; i > t; t += 1) {
            var o = new tB({
                name: e[t].name,
                keyFrameList: e[t].keyFrameList,
                parameters: e[t].parameters,
                roamTime: e[t].roamTime,
                type: e[t].type,
                fps: e[t].fps
            });
            this.add(o)
        }
        return this.roamList
    }
    ;
    var nB = function(A, e) {
        this.coordinateSystem = A,
        this.viewer = A.viewer,
        this.drawingImpl = e,
        this.viewportOffset = this.viewer.domElement.getBoundingClientRect(),
        this.cameraControl = this.viewer.cameraControl,
        this.fillClipPlane = this.viewer.getScene().getFillClipPlane(),
        this.initialize()
    };
    nB.prototype.initialize = function() {
        this.arrowMouseDown = !1,
        this.circleXMouseDown = !1,
        this.circleYMouseDown = !1,
        this.firstClickDown = !0,
        this.firstRotate = !0,
        this.lineOut = !0,
        this.arrowOut = !0,
        this.translateStartPt = new s,
        this.translateEndPt = new s,
        this.rotateAngleA = 0,
        this.rotateAngleB = 0,
        this.config = this.coordinateSystem.config
    }
    ,
    nB.prototype.registerArrowEvents = function() {
        var A = this.drawingImpl.getDrawable("axisZ")
          , e = this
          , t = this.config.colors;
        A.onmouseover = function() {
            !0 !== e.circleXMouseDown && !0 !== e.circleYMouseDown && (e.drawingImpl.setColor("axisZ", t.highLight),
            e.drawingImpl.fill("arrow", t.highLight),
            e.drawingImpl.setColor("tipArcX", t.default),
            e.drawingImpl.fill("cubeX", t.default),
            e.drawingImpl.setColor("tipArcY", t.default),
            e.drawingImpl.fill("cubeY", t.default),
            e.lineOut = !1)
        }
        ,
        A.onmouseout = function() {
            !0 !== e.circleXMouseDown && !0 !== e.circleYMouseDown && !1 === e.arrowMouseDown && !0 === e.arrowOut && (e.drawingImpl.setColor("axisZ", t.arrow),
            e.drawingImpl.fill("arrow", t.arrow),
            e.drawingImpl.setColor("tipArcX", t.tipArcX),
            e.drawingImpl.fill("cubeX", t.cubeX),
            e.drawingImpl.setColor("tipArcY", t.tipArcY),
            e.drawingImpl.fill("cubeY", t.cubeY),
            e.lineOut = !0)
        }
        ,
        A.onmousedown = function(A) {
            e.arrowMouseDown = !0,
            e.lineOut = !1;
            var t = e.config.colors;
            e.drawingImpl.setColor("axisZ", t.highLight),
            e.drawingImpl.fill("arrow", t.highLight),
            e.coordinateSystem.colorUpdate = !1,
            e.translateStartPt.set(A.clientX, A.clientY)
        }
        ;
        var i = this.drawingImpl.getDrawable("arrow");
        i.onmouseover = function() {
            if (!0 !== e.circleXMouseDown && !0 !== e.circleYMouseDown) {
                e.arrowOut = !1;
                var A = e.config.colors;
                e.drawingImpl.fill("arrow", A.highLight),
                e.drawingImpl.setColor("axisZ", A.highLight),
                e.drawingImpl.setColor("tipArcX", A.default),
                e.drawingImpl.fill("cubeX", A.default),
                e.drawingImpl.setColor("tipArcY", A.default),
                e.drawingImpl.fill("cubeY", A.default)
            }
        }
        ,
        i.onmouseout = function() {
            if (!0 !== e.circleXMouseDown && !0 !== e.circleYMouseDown && !1 === e.arrowMouseDown && !0 === e.lineOut) {
                e.arrowOut = !0;
                var A = e.config.colors;
                e.drawingImpl.setColor("axisZ", A.arrow),
                e.drawingImpl.fill("arrow", A.arrow),
                e.drawingImpl.setColor("tipArcX", A.tipArcX),
                e.drawingImpl.fill("cubeX", A.cubeX),
                e.drawingImpl.setColor("tipArcY", A.tipArcY),
                e.drawingImpl.fill("cubeY", A.cubeY)
            }
        }
        ,
        i.onmousedown = function(A) {
            e.arrowMouseDown = !0,
            e.arrowOut = !1;
            var t = e.config.colors;
            e.drawingImpl.setColor("axisZ", t.highLight),
            e.drawingImpl.fill("arrow", t.highLight),
            e.translateStartPt.set(A.clientX, A.clientY)
        }
        ,
        document.onmousemove = function(A) {
            if (!0 === e.arrowMouseDown) {
                if (!(A.clientX === e.translateStartPt.x && A.clientY === e.translateStartPt.y)) {
                    var t = e.fillClipPlane.renderClipPlane
                      , i = t.normal.clone();
                    i.w = t.constant;
                    var o = e.cameraControl.movePlane(i, A, e.translateStartPt, !1, e.fillClipPlane.position.clone());
                    null !== o && e.fillClipPlane.offset(o),
                    e.translateStartPt.set(A.clientX, A.clientY),
                    e.cameraControl.update(!0)
                }
                e.coordinateSystem.update();
                var n = e.config.colors;
                e.drawingImpl.setColor("axisZ", n.highLight),
                e.drawingImpl.fill("arrow", n.highLight),
                e.drawingImpl.setColor("tipArcX", n.default),
                e.drawingImpl.fill("cubeX", n.default),
                e.drawingImpl.setColor("tipArcY", n.default),
                e.drawingImpl.fill("cubeY", n.default),
                A.preventDefault(),
                A.stopPropagation()
            }
        }
        ,
        document.onmouseup = function() {
            if (!1 !== e.arrowMouseDown) {
                e.arrowMouseDown = !1,
                e.coordinateSystem.colorUpdate = !0;
                var A = e.config.colors;
                e.drawingImpl.setColor("axisZ", A.arrow),
                e.drawingImpl.fill("arrow", A.arrow),
                e.drawingImpl.setColor("tipArcX", A.tipArcX),
                e.drawingImpl.fill("cubeX", A.cubeX),
                e.drawingImpl.setColor("tipArcY", A.tipArcY),
                e.drawingImpl.fill("cubeY", A.cubeY),
                vc.ClippingCaps = !0,
                e.viewer.render()
            }
        }
    }
    ,
    nB.prototype.registerCircleXEvents = function() {
        var A = this
          , e = this.config.colors
          , t = this.drawingImpl.getDrawable("tipArcX");
        t.onmousedown = function() {
            A.circleXMouseDown = !0,
            A.drawingImpl.setColor("axisZ", e.default),
            A.drawingImpl.fill("arrow", e.default),
            A.enableCircleXMovement()
        }
        ,
        t.onmouseout = function() {
            !1 === A.circleXMouseDown && (A.drawingImpl.setColor("axisZ", e.arrow),
            A.drawingImpl.fill("arrow", e.arrow),
            A.drawingImpl.setColor("tipArcY", e.tipArcY),
            A.drawingImpl.fill("cubeY", e.cubeY),
            A.coordinateSystem.circleToArc("tipArcX"))
        }
        ,
        document.addEventListener("mouseup", (function() {
            !0 === A.circleXMouseDown && (vc.ClippingCaps = !0,
            A.viewer.render()),
            A.circleXMouseDown = !1,
            A.firstClickDown = !0,
            A.firstRotate = !1,
            A.lastRotateX = 0,
            A.lastRotateY = 0,
            A.drawingImpl.show("tipArcY", !0),
            A.drawingImpl.show("axisY", !0),
            A.drawingImpl.show("axisZ", !0),
            A.drawingImpl.show("cubeY", !0),
            A.coordinateSystem.update(),
            A.drawingImpl.show("dashLineX", !1),
            A.drawingImpl.setColor("axisZ", e.arrow),
            A.drawingImpl.fill("arrow", e.arrow)
        }
        ))
    }
    ,
    nB.prototype.registerCircleYEvents = function() {
        var A = this
          , e = this.config.colors
          , t = this.drawingImpl.getDrawable("tipArcY");
        t.onmousedown = function() {
            A.circleYMouseDown = !0,
            A.drawingImpl.setColor("axisZ", e.default),
            A.drawingImpl.fill("arrow", e.default),
            A.enableCircleYMovement()
        }
        ,
        t.onmouseout = function() {
            !1 === A.circleYMouseDown && (A.drawingImpl.setColor("axisZ", e.arrow),
            A.drawingImpl.fill("arrow", e.arrow),
            A.coordinateSystem.circleToArc("tipArcY"),
            A.drawingImpl.setColor("tipArcX", e.tipArcX),
            A.drawingImpl.fill("cubeX", e.cubeX))
        }
        ,
        document.addEventListener("mouseup", (function() {
            !0 === A.circleYMouseDown && (vc.ClippingCaps = !0,
            A.viewer.render()),
            A.circleYMouseDown = !1,
            A.drawingImpl.show("tipArcX", !0),
            A.drawingImpl.show("cubeX", !0),
            A.coordinateSystem.update(),
            A.drawingImpl.show("dashLineY", !1),
            A.drawingImpl.setColor("axisZ", e.arrow),
            A.drawingImpl.fill("arrow", e.arrow)
        }
        ))
    }
    ,
    nB.prototype.enableCircleXMovement = function() {
        var A = this
          , e = this.config.colors;
        document.addEventListener("mousemove", (function(t) {
            if (!0 === A.circleXMouseDown) {
                A.drawingImpl.show("dashLineX", !0),
                A.drawingImpl.setColor("axisZ", e.default),
                A.drawingImpl.fill("arrow", e.default),
                vc.ClippingCaps = !1;
                var i = A.fillClipPlane.normalIndex
                  , o = A.viewportOffset
                  , n = new s(t.clientX - o.left,t.clientY - o.top)
                  , r = A.calcRotateAngleIndex(n, A.coordinateSystem.discretePointsX);
                !0 === A.firstClickDown && (A.lastIndex = r);
                var a = 2 * (r - A.lastIndex);
                i > 3 && (a = -a),
                A.drawingImpl.show("tipArcY", !1),
                A.coordinateSystem.updateAxisZ();
                var l = A.fillClipPlane.renderClipPlane.normal.clone()
                  , c = A.coordinateSystem.getCoordinateAxis()
                  , h = A.config.styles;
                A.coordinateSystem.drawClipPlaneCircle("tipArcZ", c.start.clone(), h.auxCircleRadius, A.coordinateSystem.dirX, l);
                var d = A.coordinateSystem.drawingToCanvas(c.start.clone())
                  , p = A.coordinateSystem.drawingToCanvas(c.endY.clone());
                A.coordinateSystem.drawAxisY(d, p, e.highLight),
                A.coordinateSystem.drawCubeX("cubeX", p, h.cubeRadius),
                A.drawingImpl.show("cubeY", !1);
                var g = "x";
                2 > i && (g = "y"),
                A.fillClipPlane.rotateAngleOffset(a, g),
                A.coordinateSystem.backwardCoordinate(),
                !0 === A.firstClickDown ? A.firstClickDown = !1 : A.lastIndex = r,
                A.translateStartPt.set(t.clientX, t.clientY),
                A.viewer.render(),
                t.preventDefault(),
                t.stopPropagation()
            }
        }
        ))
    }
    ,
    nB.prototype.enableCircleYMovement = function() {
        var A = this
          , e = this.config.colors;
        document.addEventListener("mousemove", (function(t) {
            if (!0 === A.circleYMouseDown) {
                A.drawingImpl.show("dashLineY", !0),
                A.drawingImpl.setColor("axisZ", e.default),
                A.drawingImpl.fill("arrow", e.default),
                vc.ClippingCaps = !1;
                var i = A.fillClipPlane.normalIndex
                  , o = A.viewportOffset
                  , n = new s(t.clientX - o.left,t.clientY - o.top)
                  , r = A.calcRotateAngleIndex(n, A.coordinateSystem.discretePointsY);
                !0 === A.firstClickDown && (A.lastIndex = r);
                var a = 2 * (r - A.lastIndex);
                i > 3 && (a = -a),
                A.drawingImpl.show("tipArcX", !1),
                A.coordinateSystem.updateAxisZ();
                var l = A.fillClipPlane.renderClipPlane.normal.clone()
                  , c = A.coordinateSystem.getCoordinateAxis()
                  , h = A.config.styles;
                A.coordinateSystem.drawClipPlaneCircle("tipArcZ", c.start.clone(), h.auxCircleRadius, A.coordinateSystem.dirX.clone(), l.clone());
                var d = A.coordinateSystem.drawingToCanvas(c.start.clone())
                  , p = A.coordinateSystem.drawingToCanvas(c.endX.clone());
                A.coordinateSystem.drawAxisX(d, p, e.highLight),
                A.coordinateSystem.drawCubeY("cubeY", p, h.cubeRadius),
                A.drawingImpl.show("cubeX", !1);
                var g = "z";
                i > 3 && (g = "y"),
                A.fillClipPlane.rotateAngleOffset(a, g),
                A.coordinateSystem.backwardCoordinate(),
                !0 === A.firstClickDown ? A.firstClickDown = !1 : A.lastIndex = r,
                A.translateStartPt.set(t.clientX, t.clientY),
                A.viewer.render(),
                t.preventDefault(),
                t.stopPropagation()
            }
        }
        ))
    }
    ,
    nB.prototype.registerTipArcXEvents = function() {
        var A = this
          , e = this.config.colors
          , t = this.drawingImpl.getDrawable("tipArcX");
        t.onmouseover = function() {
            !1 === A.circleYMouseDown && (A.coordinateSystem.arcToCircle("tipArcX"),
            A.drawingImpl.setColor("tipArcY", e.default),
            A.drawingImpl.fill("cubeY", e.default),
            A.drawingImpl.setColor("axisZ", e.default),
            A.drawingImpl.fill("arrow", e.default),
            A.registerCircleXEvents())
        }
        ,
        t.onmouseout = function() {
            !1 === A.circleXMouseDown && A.coordinateSystem.circleToArc("tipArcX")
        }
    }
    ,
    nB.prototype.registerTipArcYEvents = function() {
        var A = this
          , e = this.config.colors
          , t = this.drawingImpl.getDrawable("tipArcY");
        t.onmouseover = function() {
            !1 === A.circleXMouseDown && (A.coordinateSystem.arcToCircle("tipArcY"),
            A.drawingImpl.setColor("tipArcX", e.default),
            A.drawingImpl.fill("cubeX", e.default),
            A.drawingImpl.setColor("axisZ", e.default),
            A.drawingImpl.fill("arrow", e.default),
            A.registerCircleYEvents())
        }
        ,
        t.onmouseout = function() {
            !1 === A.circleYMouseDown && A.coordinateSystem.circleToArc("tipArcY")
        }
    }
    ,
    nB.prototype.calcRotateAngleIndex = function(A, e) {
        for (var t = this.createLine(A, this.coordinateSystem.cOrigin), i = -1, o = Number.POSITIVE_INFINITY, n = 0; 90 > n; n += 1) {
            var r = e[n].clone()
              , a = this.disPointToLine(r, t);
            o > a && (o = a,
            i = n)
        }
        var s = 90 + i
          , l = e[i].clone().distanceTo(A);
        return e[s].clone().distanceTo(A) > l ? i : s
    }
    ,
    nB.prototype.createLine = function(A, e) {
        var t = {};
        if (A.x === e.x)
            t.A = 1,
            t.B = 0,
            t.C = -A.x;
        else {
            var i = (e.y - A.y) / (e.x - A.x)
              , o = e.y - i * e.x;
            t.A = i,
            t.B = -1,
            t.C = o
        }
        return t
    }
    ,
    nB.prototype.disPointToLine = function(A, e) {
        return Math.abs(e.A * A.x + e.B * A.y + e.C) / Math.sqrt(e.A * e.A + e.B * e.B)
    }
    ;
    var rB = function() {
        return {
            colors: {
                tipArcX: "#0000FF",
                cubeX: "#0000FF",
                tipArcY: "#FF0000",
                cubeY: "#FF0000",
                highLight: "#FFFF00",
                tipLine: "#4dc0ff",
                arrow: "#4dc0ff",
                default: "#A9A9A9"
            },
            styles: {
                dashArray: "10 8",
                originRadius: 5,
                auxCircleRadius: .1,
                tipLineLength: .1,
                cubeRadius: 5,
                axisXWidth: 2,
                axisYWidth: 2,
                axisZWidth: 3,
                axisXLength: .1,
                axisYLength: .1,
                axisZLength: .14,
                segments: 180,
                tipArcLeftCounts: 45,
                tipArcRightCounts: 45
            }
        }
    }
      , aB = function(A, e) {
        this.coordinateSystem = A,
        this.viewer = e,
        this.container = this.viewer.domElement.querySelector("div:first-child"),
        this.mapDrawables = {},
        this.initialize()
    };
    aB.prototype.initialize = function() {
        this.xmlns = "http://www.w3.org/2000/svg";
        var A = document.createElement("div");
        A.style.left = "0px",
        A.style.top = "0px",
        A.style.width = this.container.offsetWidth + "px",
        A.style.height = this.container.offsetHeight + "px",
        A.style.position = "absolute",
        this.group = document.createElementNS(this.xmlns, "svg"),
        this.group.setAttribute("width", String(this.container.offsetWidth)),
        this.group.setAttribute("height", String(this.container.offsetHeight)),
        A.appendChild(this.group),
        this.container.appendChild(A)
    }
    ,
    aB.prototype.makeCircle = function(A, e) {
        var t = this.mapDrawables;
        void 0 === t[A] && (t[A] = document.createElementNS(this.xmlns, "circle"),
        this.group.appendChild(t[A]));
        var i = t[A];
        i.style.fill = e.color || "#FF0000",
        i.setAttribute("r", String(e.radius)),
        i.setAttribute("transform", "translate(" + e.center.x + "," + e.center.y + ")")
    }
    ,
    aB.prototype.show = function(A, e) {
        var t = this.getDrawable(A);
        t && (t.style.display = e ? "block" : "none")
    }
    ,
    aB.prototype.fill = function(A, e) {
        this.getDrawable(A).style.fill = e ? "block" : "none"
    }
    ,
    aB.prototype.makeLine = function(A, e) {
        var t = this.mapDrawables;
        void 0 === t[A] && (t[A] = document.createElementNS(this.xmlns, "line"),
        this.group.appendChild(t[A]));
        var i = t[A];
        i.setAttribute("stroke", e.color || "#000000"),
        i.setAttribute("stroke-width", e.width || 3),
        i.setAttribute("x1", String(e.start.x)),
        i.setAttribute("y1", String(e.start.y)),
        i.setAttribute("x2", String(e.end.x)),
        i.setAttribute("y2", String(e.end.y))
    }
    ,
    aB.prototype.makeDashLine = function(A, e) {
        this.makeLine(A, e),
        this.mapDrawables[A].setAttribute("stroke-dasharray", e.dashArray)
    }
    ,
    aB.prototype.makePolyline = function(A, e) {
        var t = null
          , i = this.mapDrawables;
        void 0 === i[A] && (i[A] = document.createElementNS(this.xmlns, "polyline"),
        this.group.appendChild(i[A])),
        (t = i[A]).setAttribute("stroke", e.color || "#A9A9A9"),
        t.setAttribute("stroke-width", e.width || 3),
        t.style.fill = "none",
        t.setAttribute("points", e.points)
    }
    ,
    aB.prototype.makeDefs = function(A) {
        var e = this.mapDrawables;
        void 0 === e[A] && (e[A] = document.createElementNS(this.xmlns, "defs"),
        void 0 === e.marker && (e.marker = this.makeMarker(),
        e[A].appendChild(e.marker)),
        this.group.appendChild(e[A]))
    }
    ,
    aB.prototype.makeMarker = function() {
        var A = document.createElementNS(this.xmlns, "marker");
        A.setAttribute("id", "arrow"),
        A.setAttribute("viewBox", "0 0 10 10"),
        A.setAttribute("refX", "5"),
        A.setAttribute("refY", "5"),
        A.setAttribute("markerWidth", "6"),
        A.setAttribute("markerHeight", "6"),
        A.setAttribute("orient", "auto-start-reverse");
        var e = document.createElementNS(this.xmlns, "path");
        return e.setAttribute("d", "M 0 0 L 10 5 L 0 10 z"),
        e.style.fill = "#11DAB7",
        this.mapDrawables.arrow = e,
        A.appendChild(e),
        A
    }
    ,
    aB.prototype.getDrawable = function(A) {
        return this.mapDrawables[A]
    }
    ,
    aB.prototype.attach = function() {
        this.getDrawable("axisZ").setAttribute("marker-end", "url(#arrow)")
    }
    ,
    aB.prototype.setColor = function(A, e) {
        this.getDrawable(A).setAttribute("stroke", e)
    }
    ,
    aB.prototype.fill = function(A, e) {
        this.getDrawable(A).style.fill = e
    }
    ,
    aB.prototype.hideAll = function(A) {
        this.group.style.display = !0 === A ? "none" : "block"
    }
    ,
    aB.prototype.destroy = function() {
        for (var A = this.group.children, e = 0; A.length > e; e += 1)
            this.group.removeChild(A[e]);
        this.group.parentNode.removeChild(this.group)
    }
    ;
    var sB = function(A) {
        this.viewer = A,
        this.enable = !0,
        this.cameraControl = A.cameraControl,
        this.fillClipPlane = A.getScene().getFillClipPlane(),
        this.container = A.domElement.querySelector("div:first-child"),
        this.config = new rB,
        this.drawingImpl = new aB(this,A),
        this.coordinateAction = new nB(this,this.drawingImpl),
        this.initialize()
    };
    sB.prototype.initialize = function() {
        this.enable = !0,
        this.boundingBox = new Ps,
        this.bRegisterArrowEvent = !1,
        this.bRegisterAuxCircleEvent = !1,
        this.mapDrawableName = {
            ORIGIN: "origin",
            AXISX: "axisX",
            AXISY: "axisY",
            CUBEX: "cubeX",
            CUBEY: "cubeY",
            AXISZ: "axisZ",
            ARROW: "arrow",
            DASHLINE: "dashLine",
            TIPARC_X: "tipArcX",
            TIPARC_Y: "tipArcY",
            TIPARC_Z: "tipArcZ",
            DASHLINE_X: "dashLineX",
            DASHLINE_Y: "dashLineY"
        }
    }
    ,
    sB.prototype.saveTransform = function(A) {
        this.savedCamera = A.clone()
    }
    ,
    sB.prototype.drawingToCanvas = function(A) {
        var e = Rd.drawingToCanvas(this.cameraControl.camera, A, this.container.offsetWidth, this.container.offsetHeight);
        return new s(e.x,e.y)
    }
    ,
    sB.prototype.getCoordinateAxis = function() {
        var A = this.fillClipPlane.renderClipPlane.normal.clone()
          , e = this.fillClipPlane.getCoordinate()
          , t = e.axisY.clone()
          , i = A.clone().cross(t.clone());
        this.fillClipPlane.normalIndex > 3 && (t = (i = e.axisX.clone()).clone().cross(A.clone()));
        var o = this.config.styles
          , n = this.fillClipPlane.position.clone()
          , r = this.cameraControl.getCamera().position.clone().sub(n).length()
          , a = n.clone().add(i.clone().multiplyScalar(o.axisXLength * r))
          , s = n.clone().add(t.clone().multiplyScalar(o.axisYLength * r))
          , l = n.clone().add(A.clone().multiplyScalar(o.axisZLength * r));
        return this.dirX = i,
        this.dirY = t,
        {
            start: n,
            endX: a,
            endY: s,
            endZ: l
        }
    }
    ,
    sB.prototype.drawOrigin = function(A, e) {
        this.drawingImpl.makeCircle(this.mapDrawableName.ORIGIN, {
            center: A,
            radius: e,
            color: this.config.colors.default
        })
    }
    ,
    sB.prototype.drawAxisX = function(A, e, t) {
        this.drawingImpl.makeLine(this.mapDrawableName.AXISX, {
            start: A,
            end: e,
            width: this.config.styles.axisXWidth,
            color: t || this.config.colors.default
        })
    }
    ,
    sB.prototype.drawAxisY = function(A, e, t) {
        var i = this.config;
        this.drawingImpl.makeLine(this.mapDrawableName.AXISY, {
            start: A,
            end: e,
            width: i.styles.axisYWidth,
            color: t || i.colors.default
        })
    }
    ,
    sB.prototype.drawAxisZ = function(A, e) {
        var t = this.config;
        this.drawingImpl.makeLine(this.mapDrawableName.AXISZ, {
            start: A,
            end: e,
            width: t.styles.axisZWidth,
            color: t.colors.arrow
        }),
        this.drawingImpl.attach(),
        !1 === this.bRegisterArrowEvent && (this.coordinateAction.registerArrowEvents(),
        this.bRegisterArrowEvent = !0)
    }
    ,
    sB.prototype.updateAxisZ = function() {
        var A = this.getCoordinateAxis()
          , e = this.drawingToCanvas(A.start.clone())
          , t = this.drawingToCanvas(A.endZ.clone());
        this.drawingImpl.makeLine(this.mapDrawableName.AXISZ, {
            start: e,
            end: t,
            color: this.config.colors.default
        })
    }
    ,
    sB.prototype.drawArrow = function(A, e) {
        var t = this.mapDrawableName;
        this.drawingImpl.makeLine(t.AXISZ, {
            start: A,
            end: e
        }),
        this.drawingImpl.attach(),
        this.drawingImpl.setColor(t.AXISZ, this.config.colors.default),
        !1 === this.bRegisterArrowEvent && (this.coordinateAction.registerArrowEvents(),
        this.bRegisterArrowEvent = !0)
    }
    ,
    sB.prototype.drawClipPlaneCircle = function(A, e, t, i, o) {
        for (var n = {
            center: e.clone(),
            radius: t,
            normal: i.clone(),
            rotateAxis: o.clone()
        }, r = this.config.styles.segments, a = this.discreteCircle(n, r), s = "", l = 0; r > l; l += 1)
            s += a[l].x + "," + a[l].y,
            s += " ";
        s += a[0].x + "," + a[0].y,
        this.drawingImpl.makePolyline(A, {
            points: s += " ",
            color: this.config.colors.default,
            width: 2
        })
    }
    ,
    sB.prototype.drawTipArc = function(A, e, t, i, o) {
        var n = {
            center: e.clone(),
            radius: t,
            normal: i.clone(),
            rotateAxis: o.clone()
        }
          , r = this.config.styles
          , a = r.tipArcRightCounts
          , s = r.tipArcLeftCounts
          , l = r.segments
          , c = this.discreteCircle(n, l);
        A === this.mapDrawableName.TIPARC_X ? (this.discretePointsX = c,
        a = r.tipArcLeftCounts,
        s = r.tipArcRightCounts) : this.discretePointsY = c;
        for (var h = "", d = l - a - 1; l > d; d += 1)
            h += c[d].x + "," + c[d].y,
            h += " ";
        for (var p = 0; s >= p; p += 1)
            h += c[p].x + "," + c[p].y,
            h += " ";
        var g = {
            points: h,
            color: this.config.colors.tipArcX
        };
        A === this.mapDrawableName.TIPARC_X ? (this.drawingImpl.makePolyline(A, g),
        this.coordinateAction.registerTipArcXEvents()) : A === this.mapDrawableName.TIPARC_Y && (g.color = this.config.colors.tipArcY,
        this.drawingImpl.makePolyline(A, g),
        this.coordinateAction.registerTipArcYEvents())
    }
    ,
    sB.prototype.drawTipLine = function(A, e, t) {
        var i = this.drawingToCanvas(e.clone())
          , o = this.drawingToCanvas(t.clone())
          , n = this.config;
        this.drawingImpl.makeDashLine(A, {
            start: i,
            end: o,
            color: n.colors.tipLine,
            dashArray: n.styles.dashArray
        }),
        this.drawingImpl.show(A, !1)
    }
    ,
    sB.prototype.drawCubeX = function(A, e, t) {
        this.drawingImpl.makeCircle(A, {
            center: e,
            radius: t,
            color: this.config.colors.cubeX
        })
    }
    ,
    sB.prototype.drawCubeY = function(A, e, t, i) {
        this.drawingImpl.makeCircle(A, {
            center: e,
            radius: t,
            color: i || this.config.colors.cubeY
        })
    }
    ,
    sB.prototype.discreteCircle = function(A, e) {
        for (var t = A.center.clone(), i = A.radius, o = A.rotateAxis.clone(), n = A.normal.clone(), r = [], a = 0; e > a; a += 1) {
            n.applyAxisAngle(o, 2 * Math.PI / e);
            var s = t.clone().add(n.clone().multiplyScalar(i))
              , l = this.drawingToCanvas(s.clone());
            r.push(l)
        }
        return r
    }
    ,
    sB.prototype.arcToCircle = function(A) {
        var e = ""
          , t = this.discretePointsX;
        A === this.mapDrawableName.TIPARC_Y && (t = this.discretePointsY);
        for (var i = 0, o = t.length; o > i; i += 1)
            e += t[i].x + "," + t[i].y,
            e += " ";
        e += t[0].x + "," + t[0].y,
        this.drawingImpl.makePolyline(A, {
            points: e += " ",
            color: this.config.colors.highLight
        })
    }
    ,
    sB.prototype.circleToArc = function(A) {
        var e = this.config.styles
          , t = e.tipArcLeftCounts
          , i = e.tipArcRightCounts
          , o = e.segments
          , n = this.discretePointsX
          , r = {
            color: this.config.colors.tipArcX
        };
        A === this.mapDrawableName.TIPARC_Y && (n = this.discretePointsY,
        r.color = this.config.colors.tipArcY,
        t = e.tipArcRightCounts,
        i = e.tipArcLeftCounts);
        for (var a = "", s = o - t - 1; o > s; s += 1)
            a += n[s].x + "," + n[s].y,
            a += " ";
        for (var l = 0; i >= l; l += 1)
            a += n[l].x + "," + n[l].y,
            a += " ";
        r.points = a,
        this.drawingImpl.makePolyline(A, r)
    }
    ,
    sB.prototype.update = function() {
        if (this.enable) {
            var A = this.fillClipPlane.position.clone()
              , e = this.cameraControl.getCamera().position.clone().sub(A).length()
              , t = this.getCoordinateAxis()
              , i = this.drawingToCanvas(t.start.clone())
              , o = this.drawingToCanvas(t.endX.clone())
              , n = this.drawingToCanvas(t.endY.clone())
              , r = this.drawingToCanvas(t.endZ.clone());
            void 0 === this.createRefs && (this.drawingImpl.makeDefs("refs"),
            this.createRefs = !0),
            this.cOrigin = i.clone(),
            this.drawAxisZ(i, r),
            this.drawAxisX(i, o),
            this.drawAxisY(i, n);
            var a = this.config.styles
              , s = this.mapDrawableName
              , l = this.fillClipPlane.renderClipPlane.normal.clone();
            this.drawClipPlaneCircle(s.TIPARC_Z, t.start.clone(), a.auxCircleRadius * e, this.dirX, l),
            this.drawTipArc(s.TIPARC_X, t.start.clone(), a.auxCircleRadius * e, l, this.dirX),
            this.drawTipArc(s.TIPARC_Y, t.start.clone(), a.auxCircleRadius * e, l, this.dirY);
            var c = t.start.clone().add(this.dirX.clone().multiplyScalar(a.tipLineLength * e))
              , h = t.start.clone().sub(this.dirX.clone().multiplyScalar(a.tipLineLength * e));
            this.drawTipLine(s.DASHLINE_X, c, h);
            var d = t.start.clone().add(this.dirY.clone().multiplyScalar(a.tipLineLength * e))
              , p = t.start.clone().sub(this.dirY.clone().multiplyScalar(a.tipLineLength * e));
            this.drawTipLine(s.DASHLINE_Y, d, p),
            this.drawOrigin(i, a.originRadius);
            var g = this.discretePointsX[44].clone();
            this.drawCubeX(s.CUBEX, g, a.cubeRadius);
            var u = this.discretePointsY[134].clone();
            this.drawCubeY(s.CUBEY, u, a.cubeRadius),
            this.updateBbox()
        } else
            this.hide(!0)
    }
    ,
    sB.prototype.hide = function(A) {
        this.drawingImpl.hideAll(A)
    }
    ,
    sB.prototype.enabled = function(A) {
        this.enable = A
    }
    ,
    sB.prototype.destroy = function() {
        this.drawingImpl.destroy()
    }
    ,
    sB.prototype.updateBbox = function() {
        this.boundingBox.makeEmpty();
        for (var A = 0; this.discretePointsX.length > A; A += 1) {
            var e = this.discretePointsX[A].clone();
            this.boundingBox.expandByPoint(e)
        }
        for (A = 0; this.discretePointsY.length > A; A += 1) {
            e = this.discretePointsY[A].clone();
            this.boundingBox.expandByPoint(e)
        }
        var t = this.getCoordinateAxis()
          , i = this.drawingToCanvas(t.start.clone())
          , o = this.drawingToCanvas(t.endZ.clone());
        this.boundingBox.expandByPoint(i),
        this.boundingBox.expandByPoint(o),
        this.boundingBox.expandByScalar(5)
    }
    ,
    sB.prototype.insideBoundingBox = function(A) {
        return this.boundingBox.containsPoint(A.clone())
    }
    ,
    sB.prototype.backwardCoordinate = function() {
        var A = this.cameraControl.camera.position
          , e = this.cameraControl.camera.target.clone().sub(A.clone()).normalize()
          , t = this.fillClipPlane.renderClipPlane.normal.clone();
        e.angleTo(t);
        Math
    }
    ;
    var lB = {
        Forward: 0,
        Reverse: 1
    }
      , cB = {
        X: 0,
        Y: 4,
        Z: 2
    }
      , hB = function(A) {
        var e = A.viewer;
        if (e) {
            if (e._sectionBox && e._sectionBox.exit(),
            e._sectionPlane)
                return e._sectionPlane;
            e._sectionPlane = this,
            this.id = A.id,
            this._opt = A,
            this.mode = A.mode,
            this._plane = A.plane,
            this._direction = A.direction,
            this._progress = A.progress,
            this.init(),
            this.setPlane(A.plane)
        } else
            Bh.log("domElement must not be empty.")
    };
    hB.prototype = {
        init: function() {
            this.enableCoordinate = !0;
            var A = this._opt.viewer.getViewerImpl();
            this.coordinateSystem = new sB(A),
            A.controlManager.enableTool(A, Pc.CLIP_FILL),
            this._sectionTool = A.getScene().getFillClipPlane(),
            this._sectionTool.enable(!0, !0),
            this.hookEvens()
        },
        hookEvens: function() {
            var A = this
              , e = this.coordinateSystem
              , t = this._opt.viewer.getViewerImpl();
            t.getDomElement();
            t.registerEventListener(Rc.ON_CLIP_HOVER, (function(t) {
                if (!1 !== A.enableCoordinate)
                    if (t.onClipPlane)
                        e.enable && (e.update(),
                        e.hide(!1));
                    else {
                        var i = new s(t.event.clientX,t.event.clientY);
                        e.insideBoundingBox(i) ? e.hide(!1) : e.hide(!0)
                    }
            }
            )),
            t.registerEventListener(Rc.ON_CLIP_MOUSE_DOWN, (function(A) {}
            )),
            t.registerEventListener(Rc.ON_CLIP_MOUSE_MOVE, (function(A) {
                e.update()
            }
            )),
            t.registerDomEventListener(Rc.ON_CONTROL_ZOOM, (function(A) {
                e.update()
            }
            ))
        },
        exit: function() {
            var A = this._opt.viewer.getViewerImpl()
              , e = A.getScene().getFillClipPlane();
            A.controlManager.disableTool(Pc.CLIP_FILL),
            e.enable(!1, !1),
            this.coordinateSystem.destroy(),
            this._sectionTool = null,
            this._opt.viewer._sectionPlane = null
        },
        setProgress: function(A) {
            var e = 1 - A / 50;
            this._progress = A,
            this._sectionTool.setProcess(e)
        },
        getProgress: function() {
            return 50 * (1 - this._sectionTool.getProcess())
        },
        setPlane: function(A) {
            var e = lB[this._direction] + cB[A];
            this._plane = A,
            this._sectionTool.changeNormal(e),
            this.setProgress(this._opt.progress)
        },
        getPlane: function() {
            return this._plane
        },
        setDirection: function(A) {
            var e = lB[A] + cB[this._plane];
            this._direction = A,
            this._sectionTool.changeNormal(e),
            this.setProgress(this._opt.progress)
        },
        getDirection: function() {
            return this._direction
        },
        setRotateAngle: function(A, e) {
            this._sectionTool.setRotateAngle(A, e)
        },
        getRotateAngle: function() {
            return this._sectionTool.getRotateAngle()
        },
        hidePlane: function() {
            this._sectionTool.visible = !1,
            this.enableCoordinate = !1,
            this.coordinateSystem.hide(!0)
        },
        showPlane: function() {
            this._sectionTool.visible = !0,
            this.enableCoordinate = !0
        },
        reset: function() {
            this.setPlane(this._opt.plane),
            this.setDirection(this._opt.direction),
            this.setProgress(this._opt.progress)
        },
        getState: function() {
            return this._sectionTool.store()
        },
        setState: function(A) {
            this._sectionTool.restore(A)
        }
    };
    var dB = function(A) {
        var e = this
          , t = A;
        "function" == typeof A.getViewerImpl && (t = A.getViewerImpl()),
        this.marks = {},
        this.SelectedMark = {},
        this.components = {},
        this.allOids = [];
        var i = {
            id: "",
            name: "mark",
            scale: 20,
            alwaysVisible: !1,
            color: [99, 99, 99],
            wordColor: [0, 0, 0],
            position: [0, 0, 0]
        }
          , o = new s
          , n = 0
          , r = 0;
        function a(A) {
            var e = [0, 0];
            if (A) {
                for (var t = A.target, i = 0, o = 0; t.offsetParent; )
                    i += t.offsetLeft,
                    o += t.offsetTop,
                    t = t.offsetParent;
                e[0] = A.pageX - i,
                e[1] = A.pageY - o
            } else
                A = window.event,
                e.x = A.x,
                e.y = A.y;
            return e
        }
        function l(A) {
            var i = new Dd
              , n = new y(o.x / t.domElement.clientWidth * 2 - 1,-o.y / t.domElement.clientHeight * 2 + 1,.5);
            i.setFromCamera(n, t.camera),
            i.camera = t.camera,
            i._camera = t.camera;
            var r = Object.values(e.components)
              , a = i.intersectObjects(r);
            a && a.length > 0 && e.SelectedMark !== a[0].object ? (e.SelectedMark = a[0].object,
            e.dispatchEvent("updated", {
                added: {
                    objects: e.SelectedMark
                }
            })) : (e.SelectedMark = {},
            e.dispatchEvent("updated", {
                removed: {
                    objects: e.SelectedMark
                }
            }))
        }
        function c(A) {
            var e = a(A);
            o.x = n = e[0],
            o.y = r = e[1]
        }
        function h(A) {
            var e = a(A);
            (e[0] > n ? 5 > e[0] - n : 5 > n - e[0]) && (e[1] > r ? 5 > e[1] - r : 5 > r - e[1]) && (o.x = n = e[0],
            o.y = r = e[1],
            l())
        }
        function p(A) {
            o.x = n = A.changedTouches[0].clientX,
            o.y = r = A.changedTouches[0].clientY
        }
        function g(A) {
            (A.changedTouches[0].clientX > n ? 5 > A.changedTouches[0].clientX - n : 5 > n - A.changedTouches[0].clientX) && (A.changedTouches[0].clientY > r ? 5 > A.changedTouches[0].clientY - r : 5 > r - A.changedTouches[0].clientY) && (o.x = n = A.changedTouches[0].clientX,
            o.y = r = A.changedTouches[0].clientY,
            l())
        }
        this.active = !0,
        e.domElement = t.domElement,
        this.enabled = function() {
            this.mousedown = t.domElement.addEventListener("mousedown", c, !1),
            this.mouseup = t.domElement.addEventListener("mouseup", h, !1)
        }
        ,
        this.disabled = function() {
            this.mousedown = t.domElement.removeEventListener("mousedown", c, !1),
            this.mouseup = t.domElement.removeEventListener("mouseup", h, !1)
        }
        ,
        this.touchEnabled = function() {
            this.touchstart = t.domElement.addEventListener("touchstart", p, !1),
            this.touchend = t.domElement.addEventListener("touchend", g, !1)
        }
        ,
        this.touchDisabled = function() {
            this.touchstart = t.domElement.removeEventListener("touchstart", p, !1),
            this.touchend = t.domElement.removeEventListener("touchend", g, !1)
        }
        ,
        this.enabled(),
        this.add = function(A, t) {
            var o = Object.assign({}, i, A);
            if ("" !== o.id)
                for (var n = 0; e.allOids.length > n; n += 1)
                    if (o.id === e.allOids[n])
                        return {
                            data: "标签id重复"
                        };
            (o.position.isVector3 || (o.position = new y(o.position[0],o.position[1],o.position[2])),
            Array.isArray(o.color)) && (o.color = "rgb(" + o.color[0] + "," + o.color[1] + "," + o.color[2] + ")");
            Array.isArray(o.wordColor) && (o.wordColor = "rgb(" + o.wordColor[0] + "," + o.wordColor[1] + "," + o.wordColor[2] + ")");
            var r = document.createElement("canvas");
            r.width = 28 * o.name.length,
            r.height = 150;
            var a = r.getContext("2d");
            a.fillStyle = "rgba(255, 255, 255, 0)",
            a.lineWidth = 2,
            a.strokeStyle = o.color,
            a.strokeRect(5, 0, r.width - 5, 30),
            a.moveTo(5, 141),
            a.lineTo(5, 30),
            a.stroke(),
            a.fillStyle = o.color,
            a.beginPath(),
            a.arc(5, 145, 4, 0, 2 * Math.PI),
            a.fill(),
            a.fillRect(10, 5, r.width - 15, 20),
            a.font = "bold 18px Arial",
            a.fillStyle = o.wordColor,
            a.textAlign = "center",
            a.fillText(o.name, r.width / 2, 20);
            var s = new d(r);
            s.needsUpdate = !0;
            var l = new ro({
                map: s,
                color: 16777215,
                depthTest: o.alwaysVisible
            })
              , c = new vo(l);
            c.center.x = 0,
            c.center.y = 0,
            c.scale.set(o.scale * l.map.image.width, o.scale * l.map.image.height, 1),
            c.position.copy(o.position),
            c.updateMatrixWorld(),
            c.key = "" !== o.id ? o.id : c.uuid,
            e.addObjectToScene(o, c),
            "function" == typeof t && t(c.key)
        }
        ,
        this.addObjectToScene = function(A, e) {
            A && A.id && e && (this.components[A.id] = e,
            this.allOids.push(A.id),
            this.marks[A.id] = A,
            t.addExternalObject(A.id, e))
        }
        ,
        this.updateMark = function(A, i) {
            if (e.marks[A]) {
                var o = Object.assign({}, e.marks[A], i)
                  , n = this.components[A];
                if (n) {
                    if (o.position.isVector3 || (o.position = new y(o.position[0],o.position[1],o.position[2])),
                    Array.isArray(o.color))
                        o.color = "rgb(" + o.color[0] + "," + o.color[1] + "," + o.color[2] + ")";
                    if (Array.isArray(o.wordColor))
                        o.wordColor = "rgb(" + o.color[0] + "," + o.color[1] + "," + o.color[2] + ")";
                    var r = document.createElement("canvas");
                    r.width = 28 * o.name.length,
                    r.height = 150;
                    var a = r.getContext("2d");
                    a.fillStyle = "rgba(255, 255, 255, 0)",
                    a.lineWidth = 2,
                    a.strokeStyle = o.color,
                    a.strokeRect(5, 0, r.width - 5, 30),
                    a.moveTo(5, 141),
                    a.lineTo(5, 30),
                    a.stroke(),
                    a.fillStyle = o.color,
                    a.beginPath(),
                    a.arc(5, 145, 4, 0, 2 * Math.PI),
                    a.fill(),
                    a.fillRect(10, 5, r.width - 15, 20),
                    a.font = "bold 18px Arial",
                    a.fillStyle = o.wordColor,
                    a.textAlign = "center",
                    a.fillText(o.name, r.width / 2, 20);
                    var s = new d(r);
                    s.needsUpdate = !0;
                    var l = new ro({
                        map: s,
                        color: 16777215,
                        depthTest: o.alwaysVisible
                    });
                    n.material = l,
                    n.scale.set(o.scale * n.material.map.image.width, o.scale * n.material.map.image.height, 1),
                    n.position.copy(o.position),
                    n.updateMatrixWorld(),
                    t.render(),
                    e.marks[A] = o
                }
            }
        }
        ,
        this.remove = function(A) {
            if (null == A)
                return {
                    data: "未选中mark"
                };
            Array.isArray(A) || (A = [A]);
            for (var i = 0; A.length > i; i += 1) {
                var o = e.allOids.indexOf(A[i]);
                e.allOids.splice(o, 1),
                delete e.components[A[i]],
                t.removeExternalObjectByName(A[i])
            }
        }
        ,
        this.hide = function(A) {
            if (null == A)
                return {
                    data: "未选中mark"
                };
            Array.isArray(A) || (A = [A]);
            for (var e = null, t = 0; A.length > t; t += 1)
                (e = this.components[A[t]]) && (e.visible = !1)
        }
        ,
        this.show = function(A) {
            var t = null;
            if (A) {
                Array.isArray(A) || (A = [A]);
                for (var i = 0; A.length > i; i += 1)
                    (t = this.components[A[i]]) && (t.visible = !0)
            } else
                for (var o in e.components)
                    (t = e.components[o]) && (t.visible = !0)
        }
        ,
        this.isolation = function(A) {
            if (null == A)
                return {
                    data: "未选中mark"
                };
            if (e.show(),
            e.allOids.length > 0) {
                var t = e.allOids.concat();
                Array.isArray(A) || (A = [A]);
                for (var i = 0; A.length > i; i += 1) {
                    var o = A[i];
                    if (-1 === e.allOids.indexOf(o))
                        return {
                            data: "mark不存在"
                        };
                    for (var n = 0; t.length > n; n += 1)
                        if (o === t[n]) {
                            t.splice(n, 1);
                            break
                        }
                }
                var r = null;
                for (n = 0; t.length > n; n += 1)
                    (r = e.components[t[n]]) && (r.visible = !1)
            }
        }
        ,
        this.listentoSelectMarks = function(A) {
            e.addEventListener("updated", (function() {
                e.SelectedMark !== {} ? A(e.SelectedMark.key ? e.SelectedMark.key : e.SelectedMark.uuid, e.SelectedMark) : A(null, null)
            }
            ))
        }
    };
    Object.assign(dB.prototype, Ld.prototype);
    var pB = function(A) {
        var e = this;
        this.Marks = new H,
        A.modelManager.scene.add(e.Marks),
        this.SelectedMark = {},
        this.components = {},
        this.allOids = [];
        var t = {
            id: "",
            name: "mark",
            scale: 20,
            width: 1,
            height: 1,
            alwaysVisible: !1,
            useImageSize: !0,
            color: "#000000",
            position: [0, 0, 0]
        }
          , i = new s
          , o = 0
          , n = 0;
        function r(A) {
            var e = [0, 0];
            if (A) {
                for (var t = A.target, i = 0, o = 0; t.offsetParent; )
                    i += t.offsetLeft,
                    o += t.offsetTop,
                    t = t.offsetParent;
                e[0] = A.pageX - i,
                e[1] = A.pageY - o
            } else
                A = window.event,
                e.x = A.x,
                e.y = A.y;
            return e
        }
        function a(t) {
            var o = new Dd
              , n = new y(i.x / A.domElement.clientWidth * 2 - 1,-i.y / A.domElement.clientHeight * 2 + 1,.5);
            o.setFromCamera(n, A.camera);
            var r = o.intersectObjects(e.Marks.children);
            r && r.length > 0 && e.SelectedMark !== r[0].object ? (e.SelectedMark = r[0].object,
            e.dispatchEvent("updated", {
                added: {
                    objects: e.SelectedMark
                }
            })) : (e.SelectedMark = {},
            e.dispatchEvent("updated", {
                removed: {
                    objects: e.SelectedMark
                }
            }))
        }
        function l(A) {
            var e = r(A);
            i.x = o = e[0],
            i.y = n = e[1]
        }
        function c(A) {
            var e = r(A);
            (e[0] > o ? 5 > e[0] - o : 5 > o - e[0]) && (e[1] > n ? 5 > e[1] - n : 5 > n - e[1]) && (i.x = o = e[0],
            i.y = n = e[1],
            a())
        }
        function h(A) {
            i.x = o = A.changedTouches[0].clientX,
            i.y = n = A.changedTouches[0].clientY
        }
        function p(A) {
            (A.changedTouches[0].clientX > o ? 5 > A.changedTouches[0].clientX - o : 5 > o - A.changedTouches[0].clientX) && (A.changedTouches[0].clientY > n ? 5 > A.changedTouches[0].clientY - n : 5 > n - A.changedTouches[0].clientY) && (i.x = o = A.changedTouches[0].clientX,
            i.y = n = A.changedTouches[0].clientY,
            a())
        }
        this.active = !0,
        e.domElement = A.domElement,
        this.enabled = function() {
            this.mousedown = A.domElement.addEventListener("mousedown", l, !1),
            this.mouseup = A.domElement.addEventListener("mouseup", c, !1)
        }
        ,
        this.disabled = function() {
            this.mousedown = A.domElement.removeEventListener("mousedown", l, !1),
            this.mouseup = A.domElement.removeEventListener("mouseup", c, !1)
        }
        ,
        this.touchEnabled = function() {
            this.touchstart = A.domElement.addEventListener("touchstart", h, !1),
            this.touchend = A.domElement.addEventListener("touchend", p, !1)
        }
        ,
        this.touchDisabled = function() {
            this.touchstart = A.domElement.removeEventListener("touchstart", h, !1),
            this.touchend = A.domElement.removeEventListener("touchend", p, !1)
        }
        ,
        this.enabled(),
        this.add = function(i, o) {
            var n = Object.assign({}, t, i);
            if ("" !== n.id)
                for (var r = 0; e.allOids.length > r; r += 1)
                    if (n.id === e.allOids[r])
                        return {
                            data: "标签id重复"
                        };
            var a = document.createElement("canvas");
            a.width = 24 * n.name.length,
            a.height = 32;
            var s = a.getContext("2d");
            s.lineWidth = 3,
            s.strokeStyle = "#0000FF",
            s.strokeRect(0, 0, a.width, 32),
            s.fillStyle = "#FFFFFF",
            s.fillRect(3, 3, a.width - 6, 26),
            s.font = " bold 24px Arial",
            s.fillStyle = n.color,
            s.textAlign = "center",
            s.fillText(n.name, a.width / 2, 26),
            console.log(a.width);
            var l = new d(a);
            l.needsUpdate = !0;
            var c = new ro({
                map: l,
                color: 16777215,
                depthTest: n.alwaysVisible
            })
              , h = new vo(c);
            h.scale.set(n.scale * c.map.image.width, n.scale * c.map.image.height, 1),
            n.position.isVector3 ? h.position.copy(n.position) : h.position.set(n.position[0], n.position[1], n.position[2]),
            h.updateMatrixWorld(),
            e.Marks.add(h),
            A.render(),
            "" !== n.id ? (h.key = n.id,
            e.components[n.id] = h,
            e.allOids.push(n.id)) : (h.key = h.uuid,
            e.components[h.uuid] = h,
            e.allOids.push(h.uuid)),
            "function" == typeof o && o(h.key)
        }
        ,
        this.updateMark = function(i, o) {
            var n = Object.assign({}, t, o)
              , r = null;
            if (e.components[i]) {
                r = e.components[i];
                var a = document.createElement("canvas");
                a.width = 24 * n.name.length,
                a.height = 32;
                var s = a.getContext("2d");
                s.lineWidth = 3,
                s.strokeStyle = "#0000FF",
                s.strokeRect(0, 0, a.width, 32),
                s.fillStyle = "#FFFFFF",
                s.fillRect(3, 3, a.width - 6, 26),
                s.font = " bold 24px Arial",
                s.fillStyle = n.color,
                s.textAlign = "center",
                s.fillText(n.name, a.width / 2, 26);
                var l = new d(a);
                l.needsUpdate = !0;
                var c = new ro({
                    map: l,
                    color: 16777215,
                    depthTest: n.alwaysVisible
                });
                r.material = c,
                r.scale.set(n.scale * r.material.map.image.width, n.scale * r.material.map.image.height, 1),
                n.position.isVector3 ? r.position.copy(n.position) : r.position.set(n.position[0], n.position[1], n.position[2]),
                r.updateMatrixWorld(),
                A.render()
            }
        }
        ,
        this.remove = function(A) {
            if (null == A)
                return {
                    data: "未选中mark"
                };
            Array.isArray(A) || (A = [A]);
            for (var t = null, i = 0; A.length > i; i += 1) {
                t = e.components[A[i]];
                var o = e.allOids.indexOf(A[i]);
                e.allOids.splice(o, 1),
                e.Marks.remove(t)
            }
        }
        ,
        this.hide = function(A) {
            if (null == A)
                return {
                    data: "未选中mark"
                };
            Array.isArray(A) || (A = [A]);
            for (var t = null, i = 0; A.length > i; i += 1)
                (t = e.components[A[i]]) && (t.visible = !1)
        }
        ,
        this.show = function(A) {
            var t = null;
            if (A) {
                Array.isArray(A) || (A = [A]);
                for (var i = 0; A.length > i; i += 1)
                    (t = e.components[A[i]]) && (t.visible = !0)
            } else
                for (var o in e.components)
                    (t = e.components[o]) && (t.visible = !0)
        }
        ,
        this.isolation = function(A) {
            if (null == A)
                return {
                    data: "未选中mark"
                };
            if (e.show(),
            e.allOids.length > 0) {
                var t = e.allOids.concat();
                Array.isArray(A) || (A = [A]);
                for (var i = 0; A.length > i; i += 1) {
                    var o = A[i];
                    if (-1 === e.allOids.indexOf(o))
                        return {
                            data: "mark不存在"
                        };
                    for (var n = 0; t.length > n; n += 1)
                        if (o === t[n]) {
                            t.splice(n, 1);
                            break
                        }
                }
                var r = null;
                for (n = 0; t.length > n; n += 1)
                    (r = e.components[t[n]]) && (r.visible = !1)
            }
        }
        ,
        this.listentoSelectMarks = function(A) {
            e.addEventListener("updated", (function() {
                e.SelectedMark !== {} ? A(e.SelectedMark.key ? e.SelectedMark.key : e.SelectedMark.uuid, e.SelectedMark) : A(null, null)
            }
            ))
        }
    };
    Object.assign(pB.prototype, Ld.prototype);
    var gB = function A() {
        cc(this, A),
        this.type = "circle",
        this.lineHeight = 2,
        this.color = "#ff0000",
        this.titleColor = "#000000",
        this.titleBackgroundColor = "#ff0000",
        this.lineTitleBackgroundColor = "#ffffff"
    }
      , uB = function() {
        function A(e, t, i, o, n, r) {
            cc(this, A),
            this.lineTitle = t,
            this.icon = o,
            this.title = i,
            this.type = e.type,
            this.lineHeight = e.lineHeight,
            this.color = e.color,
            this.titleBackgroundColor = e.titleBackgroundColor,
            this.titleColor = e.titleColor,
            this.lineTitleBackgroundColor = e.lineTitleBackgroundColor,
            this.id = n,
            this.scenePoint = r,
            this.rootDiv = void 0,
            this.lineTitleDiv = void 0,
            this.contentDiv = void 0,
            this.lineStartPosition = {
                x: 0,
                y: 0
            },
            this.lineEndPosition = {
                x: 100,
                y: 100
            },
            this._iconSize = 30,
            this._marginLeft = 10,
            this._dragStart = this._dragStart.bind(this),
            this._dragMove = this._dragMove.bind(this),
            this._dragEnd = this._dragEnd.bind(this),
            this._lastDragPoint = void 0,
            this._init()
        }
        return dc(A, [{
            key: "_init",
            value: function() {
                this.rootDiv = document.createElement("div"),
                this.rootDiv.style.cssText = "position:absolute; left: 0px; top: 0px;-moz-user-select: none;  -webkit-user-select: none;  -ms-user-select: none;  -khtml-user-select: none;  user-select: none;";
                var A = document.createElementNS("http://www.w3.org/2000/svg", "svg");
                A.setAttribute("xmlns", "http://www.w3.org/2000/svg"),
                A.style.overflow = "visible",
                this.svg = A;
                var e = document.createElementNS("http://www.w3.org/2000/svg", "path");
                e.style.fill = this.color,
                this.arrow = e,
                this.svg.appendChild(e),
                this.rootDiv.appendChild(A);
                var t = document.createElement("div");
                t.style.position = "absolute",
                t.style.backgroundColor = "#ffffff",
                t.style.color = this.titleColor,
                t.innerText = this.lineTitle,
                this.lineTitleDiv = t,
                this.rootDiv.appendChild(t);
                var i = document.createElement("div");
                this.contentDiv = i,
                this.contentDiv.addEventListener("mousedown", this._dragStart);
                var o = document.createElement("div");
                if (this.titleDiv = o,
                o.style.display = "inline-block",
                o.style.color = this.titleColor,
                o.style.whiteSpace = "nowrap",
                o.style.overflow = "hidden",
                o.style.textOverflow = "ellipsis",
                o.style.maxWidth = "150px",
                o.style.position = "absolute",
                o.style.top = "50%",
                this.icon ? "circle" === this.type ? (o.style.left = "50%",
                o.style.transform = "translate(-50%, 5px)") : (o.style.left = "".concat(this._marginLeft + this._iconSize + 5, "px"),
                o.style.transform = "translate(0px, -50%)") : (o.style.left = "50%",
                o.style.transform = "translate(-50%, -50%)"),
                o.innerText = this.title,
                this.contentDiv.appendChild(o),
                this.icon) {
                    var n = document.createElement("img");
                    n.style.width = "".concat(this._iconSize, "px"),
                    n.style.height = "".concat(this._iconSize, "px"),
                    n.style.position = "absolute",
                    n.style.pointerEvents = "none",
                    "circle" === this.type ? (n.style.left = "50%",
                    n.style.top = "50%",
                    n.style.transform = "translate(-50%, -100%)") : (n.style.left = "".concat(this._marginLeft, "px"),
                    n.style.top = "50%",
                    n.style.transform = "translate(0px, -50%)"),
                    n.src = this.icon,
                    this.contentDiv.appendChild(n)
                }
                this.rootDiv.appendChild(i)
            }
        }, {
            key: "setLineStartPosition",
            value: function(A, e) {
                this.lineStartPosition.x = A,
                this.lineStartPosition.y = e,
                this.update()
            }
        }, {
            key: "setLineEndPosition",
            value: function(A, e) {
                this.lineEndPosition.x = A,
                this.lineEndPosition.y = e,
                this.update()
            }
        }, {
            key: "setLineStartAndEndPoint",
            value: function(A, e, t, i) {
                this.lineStartPosition.x = A,
                this.lineStartPosition.y = e,
                this.lineEndPosition.x = t,
                this.lineEndPosition.y = i,
                this.update()
            }
        }, {
            key: "update",
            value: function() {
                var A = this.titleDiv.getBoundingClientRect();
                A.width += 2 * this._marginLeft,
                "rectangle" === this.type && (this.icon && (A.width += this._iconSize,
                A.width += 5),
                A.height = 40);
                var e = this.lineEndPosition.x - this.lineStartPosition.x
                  , t = this.lineEndPosition.y - this.lineStartPosition.y
                  , i = Math.atan2(t, e);
                i > 0 || (i += 2 * Math.PI);
                var o = i / Math.PI * 180
                  , n = Math.sqrt(e * e + t * t);
                if ("circle" === this.type)
                    n -= A.width / 2;
                else {
                    var r = Math.tan(i);
                    Math.abs(r) > A.height / A.width ? n -= A.height / 2 / Math.abs(Math.sin(i)) : n -= A.width / 2 / Math.abs(Math.cos(i))
                }
                n = Math.max(15, n);
                var a = 0
                  , s = 0
                  , l = "M".concat(a, " ").concat(s);
                l += "L".concat(a, " ").concat(s - this.lineHeight / 2),
                l += "L".concat(a + n - 10, " ").concat(s - this.lineHeight / 2),
                l += "A".concat(20, " ").concat(20, " 0 0 0 ").concat(a + n - 15, " ").concat(s - this.lineHeight / 2 - 10),
                l += "L".concat(a + n, " ").concat(s),
                l += "L".concat(a + n - 15, " ").concat(s + this.lineHeight / 2 + 10),
                l += "A".concat(20, " ").concat(20, " 0 0 0 ").concat(a + n - 10, " ").concat(s + this.lineHeight / 2),
                l += "L".concat(a, " ").concat(s + this.lineHeight / 2, "Z"),
                this.arrow.setAttributeNS(null, "d", l);
                var c = "translate(".concat(this.lineStartPosition.x, ", ").concat(this.lineStartPosition.y, ") rotate(").concat(o, ")");
                this.arrow.setAttributeNS(null, "transform", c);
                var h = (this.lineStartPosition.y + this.lineEndPosition.y) / 2
                  , d = "\n            left:".concat((this.lineStartPosition.x + this.lineEndPosition.x) / 2, "px;top:").concat(h, "px;\n            white-space: nowrap;\n            overflow: hidden;\n            text-overflow: ellipsis;\n            max-width:150px;\n            position:absolute;\n            transform:translate(-50%, -50%);\n            background-color: ").concat(this.lineTitleBackgroundColor, ";\n            ");
                this.lineTitleDiv.style.cssText = d;
                var p = this.lineEndPosition.x
                  , g = this.lineEndPosition.y;
                d = "\n            background-color:".concat(this.titleBackgroundColor, ";\n            position: absolute;\n            left:").concat(p, "px;\n            top:").concat(g, "px;\n            transform:translate(-50%,-50%);\n            width:").concat(A.width, "px;\n            cursor: move;\n            "),
                d += "circle" === this.type ? "\n                height:".concat(A.width, "px;\n                border-radius:").concat(A.width, "px;\n                ") : "\n                height:".concat(A.height, "px;\n                border-radius:4px;\n                "),
                this.contentDiv.style.cssText = d
            }
        }, {
            key: "_dragStart",
            value: function(A) {
                0 === A.button && (document.addEventListener("mousemove", this._dragMove),
                document.addEventListener("mouseup", this._dragEnd),
                this._lastDragPoint = {
                    x: A.clientX,
                    y: A.clientY
                })
            }
        }, {
            key: "_dragMove",
            value: function(A) {
                if (this._lastDragPoint) {
                    var e = A.clientY - this._lastDragPoint.y;
                    this.lineEndPosition.x += A.clientX - this._lastDragPoint.x,
                    this.lineEndPosition.y += e,
                    this.update(),
                    this._lastDragPoint.x = A.clientX,
                    this._lastDragPoint.y = A.clientY
                } else
                    this._lastDragPoint = {
                        x: A.clientX,
                        y: A.clientY
                    }
            }
        }, {
            key: "_dragEnd",
            value: function(A) {
                this._lastDragPoint = void 0,
                document.removeEventListener("mousemove", this._dragMove),
                document.removeEventListener("mouseup", this._dragEnd)
            }
        }]),
        A
    }()
      , fB = function() {
        function A(e, t) {
            cc(this, A),
            this.viewer3D = e,
            this.EIMMODEL = t,
            this.THREE = t.THREE,
            this.marks = {},
            this.arrowConfig = new gB,
            this.flag = 1,
            this.update = this.update.bind(this),
            e.registerCameraEventListener(this.EIMMODEL.EVENTS.ON_CAMERA_CHANGE, this.update)
        }
        return dc(A, [{
            key: "testData",
            value: function() {
                return [{
                    lineTitle: "测试1",
                    title: "测试1胜利大街发",
                    icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAoCAYAAACIC2hQAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAKqADAAQAAAABAAAAKAAAAACu2vZrAAAFXElEQVRYCe1YX0ybVRQvMB1ghyImq7CMxITyH8nmNPAwfDFb4iRj7mU+7GFbgEIIYMiWaaIsDpSwPQCJMDCYAZkvgEENGSEwQdbZEalCZjeB8bBRDIaAyYCFUurvfLmnu7RfW5AWXnaSH+fcc8495/Te+91zg0bznPy7AkH+DOdwOFIRLxmIFnGt4PeCgoLGxHjnGIrTAp8BDwFPRDby0e5IpUh8HPgb2CiR7/FtLRYJLwJrUoWPIF8F3gfeFCCZdGRjojkXt6VYJMrlrOArwAVgt6fkZBM+5MuU68nfL3pkSQc44RPIh+XAGMcAOcARWU8ydFkAzSGiGOmuPn4bI3gvZRGUw4Ex3gN8A9DWUjHvsU3m0NOPYOqVbX6TEf0QZwDv5MCQo4BJyXaFbcxhC5HkTsn3EOu98WBvRhXbCUn3pSTXQn5DGj+WZBY/QnH7xOArVoLLMSX1FkQkMomVmAZXmgX4QaGT2S3XNDDeBK6RHjwIoBhEJlffLY8R1KqExjnlYBjTF69GN6DMAN4GWoSDRZrHZ32add74Lm9GFVuU0M1JNtZJKkU8hb8EmfQoOAQt1Q4lx3hNdvAkb/aM/iMCycXdF7qn4COAQ4zV2L+iSLJxDI6p5u/UbbZQs5iZhJXhB81vQvcuijgIudoZ3V1QjoyYmyTMHNPdW9JsttAfxVx6HSnXCor7A/L3wIvCxlwMnWwJ0qdiRHP5hfWD08NfAlaCLvV5gEi+R1/HeAqwAGpkh/Ic1wGZ71GKtYf1fuUIfBlgkjtTJJTfsUHi9yFncBGQ5c70Bev9zpGI3p+PASK1Xr8f+hPAKeAtgM8y3Z+HAe71FCOw71MkOAkw0ePi/7yeTvp9FdUCorjrXKng9Oa8Ari+R0knv0fJ/bpazIDokIyOwF+UdZNEcwK75a6/GAkTgYVNFEq+ia5xNjJ2HnRPzqWlpa8uLS3pyB4cHLzLbrdbGhsbbeyPxEch/wQ4n3Fsc+HUNo/h3r3J+qKiot2IRz+W5kYCj+rr6x+wXeZee31hYWFUZmbmjZSUlAMhIAR9OjAw0J2bm2vgYikxEhkQtFEOrCIb5CLJHh0d/W12dvZRrVZLV5vGZDJNRkREfFhVVUVNZOPU1NT0ydzcHGI8o87Ozj8LCgrctg8e5595uUnnXbMWFxfvbWtrM8qei4uLjtbW1mvl5eUb75jYln2Dg4O/UyCbzebo7+8f6+3t/aWysrLCNSmP4VohJxayR/+KioozKOxWe3v7rzhe1L0cIyMjD7GTeo7pkzc0NHw8Ozur5BoaGrqXl5cXhy33+STDBLlzXfaVqKys7CXE3d/T03N7bW3NMT8/72hubr7ka55ix9bq+vr67lKVVCwOuNvWeQuEaZcI3nxcbTU1NedmZmaUVcV3YM7Pz4+RfVTPQlJSUk5ycjK1P83o6OjdsbGxFnmSLxkfzecEX36yfWJiogu57lDOhISE9LS0tA9ku5tM24ttUA759PS0rba29oybU4AUdXV1Z61Wq52OQHd3988lJSWvcCq3FU1MTDyWmpr6Dq4ijdlsHrBYLPTW3BbCznUBdygZdjRDp9NlqSY2GAyR9EvoF01NTS1VV1c7n3GqEwKgpB3Eqq7STdPR0dGFqyqU0qy78OPi4o5gNTNpNY1G4wNcxDp8/fkBqMdjyOXlZe3w8PAkGoEetWThujoAZ+O6QuPj40/HxMS8gA9BA8f0lZWVrz1GDKAhLCxMiR4bG/uyXq+nf6atL3RhYWEvrSZRaGioAmWwA39WV1c1OIIaXFlKF1y3ouPj4xdaWlpOh4eH70Bp7ilxTp+ghV91tzzXbH0F/gPRY0VbSFn/swAAAABJRU5ErkJggg==",
                    type: "rectangle"
                }, {
                    lineTitle: "测试2",
                    title: "测试2胜利大街发",
                    icon: void 0,
                    type: "rectangle"
                }, {
                    lineTitle: "测试3",
                    title: "测试3胜利大街发",
                    icon: void 0,
                    type: "rectangle"
                }, {
                    lineTitle: "测试4",
                    title: "测试4胜利大街发",
                    icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAoCAYAAACIC2hQAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAKqADAAQAAAABAAAAKAAAAACu2vZrAAAFXElEQVRYCe1YX0ybVRQvMB1ghyImq7CMxITyH8nmNPAwfDFb4iRj7mU+7GFbgEIIYMiWaaIsDpSwPQCJMDCYAZkvgEENGSEwQdbZEalCZjeB8bBRDIaAyYCFUurvfLmnu7RfW5AWXnaSH+fcc8495/Te+91zg0bznPy7AkH+DOdwOFIRLxmIFnGt4PeCgoLGxHjnGIrTAp8BDwFPRDby0e5IpUh8HPgb2CiR7/FtLRYJLwJrUoWPIF8F3gfeFCCZdGRjojkXt6VYJMrlrOArwAVgt6fkZBM+5MuU68nfL3pkSQc44RPIh+XAGMcAOcARWU8ydFkAzSGiGOmuPn4bI3gvZRGUw4Ex3gN8A9DWUjHvsU3m0NOPYOqVbX6TEf0QZwDv5MCQo4BJyXaFbcxhC5HkTsn3EOu98WBvRhXbCUn3pSTXQn5DGj+WZBY/QnH7xOArVoLLMSX1FkQkMomVmAZXmgX4QaGT2S3XNDDeBK6RHjwIoBhEJlffLY8R1KqExjnlYBjTF69GN6DMAN4GWoSDRZrHZ32add74Lm9GFVuU0M1JNtZJKkU8hb8EmfQoOAQt1Q4lx3hNdvAkb/aM/iMCycXdF7qn4COAQ4zV2L+iSLJxDI6p5u/UbbZQs5iZhJXhB81vQvcuijgIudoZ3V1QjoyYmyTMHNPdW9JsttAfxVx6HSnXCor7A/L3wIvCxlwMnWwJ0qdiRHP5hfWD08NfAlaCLvV5gEi+R1/HeAqwAGpkh/Ic1wGZ71GKtYf1fuUIfBlgkjtTJJTfsUHi9yFncBGQ5c70Bev9zpGI3p+PASK1Xr8f+hPAKeAtgM8y3Z+HAe71FCOw71MkOAkw0ePi/7yeTvp9FdUCorjrXKng9Oa8Ari+R0knv0fJ/bpazIDokIyOwF+UdZNEcwK75a6/GAkTgYVNFEq+ia5xNjJ2HnRPzqWlpa8uLS3pyB4cHLzLbrdbGhsbbeyPxEch/wQ4n3Fsc+HUNo/h3r3J+qKiot2IRz+W5kYCj+rr6x+wXeZee31hYWFUZmbmjZSUlAMhIAR9OjAw0J2bm2vgYikxEhkQtFEOrCIb5CLJHh0d/W12dvZRrVZLV5vGZDJNRkREfFhVVUVNZOPU1NT0ydzcHGI8o87Ozj8LCgrctg8e5595uUnnXbMWFxfvbWtrM8qei4uLjtbW1mvl5eUb75jYln2Dg4O/UyCbzebo7+8f6+3t/aWysrLCNSmP4VohJxayR/+KioozKOxWe3v7rzhe1L0cIyMjD7GTeo7pkzc0NHw8Ozur5BoaGrqXl5cXhy33+STDBLlzXfaVqKys7CXE3d/T03N7bW3NMT8/72hubr7ka55ix9bq+vr67lKVVCwOuNvWeQuEaZcI3nxcbTU1NedmZmaUVcV3YM7Pz4+RfVTPQlJSUk5ycjK1P83o6OjdsbGxFnmSLxkfzecEX36yfWJiogu57lDOhISE9LS0tA9ku5tM24ttUA759PS0rba29oybU4AUdXV1Z61Wq52OQHd3988lJSWvcCq3FU1MTDyWmpr6Dq4ijdlsHrBYLPTW3BbCznUBdygZdjRDp9NlqSY2GAyR9EvoF01NTS1VV1c7n3GqEwKgpB3Eqq7STdPR0dGFqyqU0qy78OPi4o5gNTNpNY1G4wNcxDp8/fkBqMdjyOXlZe3w8PAkGoEetWThujoAZ+O6QuPj40/HxMS8gA9BA8f0lZWVrz1GDKAhLCxMiR4bG/uyXq+nf6atL3RhYWEvrSZRaGioAmWwA39WV1c1OIIaXFlKF1y3ouPj4xdaWlpOh4eH70Bp7ilxTp+ghV91tzzXbH0F/gPRY0VbSFn/swAAAABJRU5ErkJggg==",
                    type: "circle"
                }, {
                    lineTitle: "测试5",
                    title: "测试5胜利大街发",
                    icon: void 0,
                    type: "rectangle"
                }, {
                    lineTitle: "测试6",
                    title: "测试6胜利大街发",
                    icon: void 0,
                    type: "circle"
                }, {
                    lineTitle: "测试7",
                    title: "测试7胜利大街发",
                    icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACoAAAAoCAYAAACIC2hQAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAKqADAAQAAAABAAAAKAAAAACu2vZrAAAFXElEQVRYCe1YX0ybVRQvMB1ghyImq7CMxITyH8nmNPAwfDFb4iRj7mU+7GFbgEIIYMiWaaIsDpSwPQCJMDCYAZkvgEENGSEwQdbZEalCZjeB8bBRDIaAyYCFUurvfLmnu7RfW5AWXnaSH+fcc8495/Te+91zg0bznPy7AkH+DOdwOFIRLxmIFnGt4PeCgoLGxHjnGIrTAp8BDwFPRDby0e5IpUh8HPgb2CiR7/FtLRYJLwJrUoWPIF8F3gfeFCCZdGRjojkXt6VYJMrlrOArwAVgt6fkZBM+5MuU68nfL3pkSQc44RPIh+XAGMcAOcARWU8ydFkAzSGiGOmuPn4bI3gvZRGUw4Ex3gN8A9DWUjHvsU3m0NOPYOqVbX6TEf0QZwDv5MCQo4BJyXaFbcxhC5HkTsn3EOu98WBvRhXbCUn3pSTXQn5DGj+WZBY/QnH7xOArVoLLMSX1FkQkMomVmAZXmgX4QaGT2S3XNDDeBK6RHjwIoBhEJlffLY8R1KqExjnlYBjTF69GN6DMAN4GWoSDRZrHZ32add74Lm9GFVuU0M1JNtZJKkU8hb8EmfQoOAQt1Q4lx3hNdvAkb/aM/iMCycXdF7qn4COAQ4zV2L+iSLJxDI6p5u/UbbZQs5iZhJXhB81vQvcuijgIudoZ3V1QjoyYmyTMHNPdW9JsttAfxVx6HSnXCor7A/L3wIvCxlwMnWwJ0qdiRHP5hfWD08NfAlaCLvV5gEi+R1/HeAqwAGpkh/Ic1wGZ71GKtYf1fuUIfBlgkjtTJJTfsUHi9yFncBGQ5c70Bev9zpGI3p+PASK1Xr8f+hPAKeAtgM8y3Z+HAe71FCOw71MkOAkw0ePi/7yeTvp9FdUCorjrXKng9Oa8Ari+R0knv0fJ/bpazIDokIyOwF+UdZNEcwK75a6/GAkTgYVNFEq+ia5xNjJ2HnRPzqWlpa8uLS3pyB4cHLzLbrdbGhsbbeyPxEch/wQ4n3Fsc+HUNo/h3r3J+qKiot2IRz+W5kYCj+rr6x+wXeZee31hYWFUZmbmjZSUlAMhIAR9OjAw0J2bm2vgYikxEhkQtFEOrCIb5CLJHh0d/W12dvZRrVZLV5vGZDJNRkREfFhVVUVNZOPU1NT0ydzcHGI8o87Ozj8LCgrctg8e5595uUnnXbMWFxfvbWtrM8qei4uLjtbW1mvl5eUb75jYln2Dg4O/UyCbzebo7+8f6+3t/aWysrLCNSmP4VohJxayR/+KioozKOxWe3v7rzhe1L0cIyMjD7GTeo7pkzc0NHw8Ozur5BoaGrqXl5cXhy33+STDBLlzXfaVqKys7CXE3d/T03N7bW3NMT8/72hubr7ka55ix9bq+vr67lKVVCwOuNvWeQuEaZcI3nxcbTU1NedmZmaUVcV3YM7Pz4+RfVTPQlJSUk5ycjK1P83o6OjdsbGxFnmSLxkfzecEX36yfWJiogu57lDOhISE9LS0tA9ku5tM24ttUA759PS0rba29oybU4AUdXV1Z61Wq52OQHd3988lJSWvcCq3FU1MTDyWmpr6Dq4ijdlsHrBYLPTW3BbCznUBdygZdjRDp9NlqSY2GAyR9EvoF01NTS1VV1c7n3GqEwKgpB3Eqq7STdPR0dGFqyqU0qy78OPi4o5gNTNpNY1G4wNcxDp8/fkBqMdjyOXlZe3w8PAkGoEetWThujoAZ+O6QuPj40/HxMS8gA9BA8f0lZWVrz1GDKAhLCxMiR4bG/uyXq+nf6atL3RhYWEvrSZRaGioAmWwA39WV1c1OIIaXFlKF1y3ouPj4xdaWlpOh4eH70Bp7ilxTp+ghV91tzzXbH0F/gPRY0VbSFn/swAAAABJRU5ErkJggg==",
                    type: "rectangle"
                }]
            }
        }, {
            key: "addMarksAtComponent",
            value: function(A, e, t) {
                var i = this.viewer3D.getBoxByComponentsKey(A)
                  , o = new this.THREE.Vector3;
                i.getCenter(o);
                var n = o.toArray()
                  , r = this.viewer3D.getViewerImpl().domElement
                  , a = r.getBoundingClientRect()
                  , s = this.viewer3D.getScreenCoordFromSceneCoord(o)
                  , l = e || this.arrowConfig
                  , c = l.type
                  , h = 0
                  , d = [s[0] + 250, s[1]]
                  , p = 250
                  , g = 0
                  , u = 0;
                this.marks[A] || (this.marks[A] = []);
                for (var f = 0, m = t.length; m > f; f += 1) {
                    var C = t[f];
                    l.type = C.type || c;
                    var y = new uB(l,C.lineTitle,C.title,C.icon,this.flag,n);
                    r.appendChild(y.rootDiv),
                    y.setLineStartAndEndPoint(s[0], s[1], d[0], d[1]);
                    var v = y.contentDiv.getBoundingClientRect();
                    if (f > 0) {
                        u += 2 * Math.asin((v.height / 2 + h / 2) / 2 / 250),
                        u += .1;
                        var I = Math.cos(u)
                          , E = Math.sin(u)
                          , B = p * I + g * -E + s[0]
                          , x = p * E + g * I + s[1];
                        0 > B ? B = v.width / 2 : B > a.width && (B = a.width - v.width / 2),
                        0 > x ? x = v.height / 2 : x > a.height && (x = a.height - v.height / 2),
                        y.setLineEndPosition(B, x)
                    }
                    h = v.height,
                    this.flag += 1,
                    this.marks[A].push(y)
                }
            }
        }, {
            key: "addMarkAt",
            value: function(A, e, t, i, o) {
                var n = parseInt(A.x, 10).toString() + "_" + parseInt(A.y, 10).toString() + "_" + parseInt(A.z, 10).toString()
                  , r = new uB(o || this.arrowConfig,e,t,i,this.flag,A)
                  , a = this.viewer3D.getViewerImpl().domElement;
                a.appendChild(r.rootDiv);
                var s = a.getBoundingClientRect()
                  , l = this.viewer3D.getScreenCoordFromSceneCoord(A)
                  , c = [l[0], l[1]];
                return l.x > s.width / 2 ? c[0] -= 250 : c[0] += 250,
                r.setLineStartAndEndPoint(l[0], l[1], c[0], c[1]),
                this.flag += 1,
                this.marks[n] || (this.marks[n] = []),
                this.marks[n].push(r),
                r
            }
        }, {
            key: "update",
            value: function() {
                var A = this
                  , e = (new Date).getTime();
                this._lastTime && e - this._lastTime < 25 || (this._lastTime = e,
                Object.keys(this.marks).forEach((function(e) {
                    var t = A.marks[e]
                      , i = A.viewer3D.getScreenCoordFromSceneCoord(t[0].scenePoint);
                    t.forEach((function(A) {
                        A.setLineStartPosition(i[0], i[1])
                    }
                    ))
                }
                )))
            }
        }, {
            key: "destroy",
            value: function() {
                this.viewer3D.unregisterCameraEventListener(this.EIMMODEL.EVENTS.ON_CAMERA_CHANGE, this.update)
            }
        }]),
        A
    }()
      , mB = function(A) {
        this.Measurement = {
            pointMove: new y,
            pointPick: [],
            pointPickToScreen: [],
            pointAssist: [],
            pointAssistToScreen: [],
            needUpdatedObjects: [],
            pickLineP1: new y,
            pickLineP2: new y,
            planeSquare: {},
            planeVolume: {},
            measureWindow: {}
        },
        this.renderer = A.viewerImpl.modelManager.renderer,
        this.scene = A.viewerImpl.modelManager.scene,
        this.camera = A.viewerImpl.camera.cameraPerspective,
        this.cameraControl = A.viewerImpl.cameraControl,
        this.intersect = null,
        this.domElement = A.viewerImpl.domElement,
        this.viewer = A.viewerImpl,
        this.SVG = document.getElementById("svgid" + A.getViewerImpl().uuid),
        this.SVGRect = A.SVGRect;
        var e = this;
        function t() {
            e.updatePos()
        }
        function i() {
            var t = A.getScreenCoordFromSceneCoord(e.Measurement.pickLineP1)
              , i = A.getScreenCoordFromSceneCoord(e.Measurement.pickLineP2)
              , o = new s(t[0],t[1])
              , n = new s(i[0],i[1]);
            e.SVGRect.createMoveLine(o, n)
        }
        this.movePoint = function(t) {
            if (t.pickLine || t.pickPlane || t.pickPoint) {
                e.SVGRect.deleteCircle();
                var i = A.viewerImpl.cameraControl.screenToCanvas(t.event.clientX, t.event.clientY);
                e.SVGRect.creatMoveCircle(i);
                var o = e.cameraControl.getIntersectContext(new s(t.event.clientX,t.event.clientY));
                if (e.cameraControl.intersector.pick(o, (function(t) {
                    for (var o = t.object.geometry, n = o.attributes.position.array, r = o.attributes.position.count, a = 0; r > a; a += 1) {
                        var s = new y(n[3 * a],n[3 * a + 1],n[3 * a + 2]);
                        s.applyMatrix4(t.object.matrixWorld);
                        var l = A.getScreenCoordFromSceneCoord(s);
                        15 > Math.sqrt((l[0] - i.x) * (l[0] - i.x) + (l[1] - i.y) * (l[1] - i.y)) && (e.Measurement.pointMove = s,
                        e.SVGRect.changeMoveCircleStyle(l))
                    }
                }
                )),
                t.pickLine) {
                    e.Measurement.pickLineP1 = t.pickLine[0],
                    e.Measurement.pickLineP2 = t.pickLine[1];
                    var n = A.getScreenCoordFromSceneCoord(t.pickLine[0].clone())
                      , r = A.getScreenCoordFromSceneCoord(t.pickLine[1].clone())
                      , a = new s(n[0],n[1])
                      , l = new s(r[0],r[1]);
                    e.SVGRect.createMoveLine(a, l)
                }
            }
        }
        ,
        this.pickPoint = function(t) {
            if (t.pickLine || t.pickPlane || t.pickPoint) {
                1 > e.Measurement.needUpdatedObjects.length || (e.SVGRect.deleteCircle(),
                e.SVGRect.deleteMoveLine(),
                e.SVGRect.deleteLineAndCircle(),
                e.Measurement.pointPick = [],
                e.Measurement.pointPickToScreen = [],
                e.Measurement.pointAssist = [],
                e.Measurement.pointAssistToScreen = [],
                e.Measurement.needUpdatedObjects = [],
                e.updatePos());
                new y,
                new y,
                new y,
                new y;
                var i = null
                  , o = t.pickPoint
                  , n = (new s).fromArray(A.getScreenCoordFromSceneCoord(o));
                e.Measurement.pointPick.push(o),
                e.Measurement.pointPickToScreen.push(n);
                var r = e.Measurement.pointPickToScreen.length;
                if (e.SVGRect.creatPickCircle(n, r - 1),
                r % 2 == 0 && r > 0) {
                    var a = new y(e.Measurement.pointPick[r - 1].x,e.Measurement.pointPick[r - 2].y,e.Measurement.pointPick[r - 2].z)
                      , l = new y(e.Measurement.pointPick[r - 1].x,e.Measurement.pointPick[r - 2].y,e.Measurement.pointPick[r - 1].z);
                    e.Measurement.pointAssist.push(a),
                    e.Measurement.pointAssist.push(l);
                    var c = A.getScreenCoordFromSceneCoord(a)
                      , h = A.getScreenCoordFromSceneCoord(l)
                      , d = new s(c[0],c[1])
                      , p = new s(h[0],h[1]);
                    e.SVGRect.creatLine(e.Measurement.pointPickToScreen[r - 2], d, "red", "red" + (r - 1)),
                    e.SVGRect.creatLine(p, e.Measurement.pointPickToScreen[r - 1], "green", "green" + (r - 1)),
                    e.SVGRect.creatLine(d, p, "blue", "blue" + (r - 1)),
                    e.SVGRect.creatLine(e.Measurement.pointPickToScreen[r - 1], e.Measurement.pointPickToScreen[r - 2], "yellow", "yellow" + (r - 1)),
                    e.Measurement.needUpdatedObjects.push({
                        point1: e.Measurement.pointPick[r - 2],
                        point2: e.Measurement.pointPick[r - 1],
                        asPot1: e.Measurement.pointAssist[r - 2],
                        asPot2: e.Measurement.pointAssist[r - 1]
                    });
                    var g = Math.abs(e.Measurement.pointPick[r - 1].x - e.Measurement.pointPick[r - 2].x)
                      , u = Math.abs(e.Measurement.pointPick[r - 1].y - e.Measurement.pointPick[r - 2].y)
                      , f = Math.abs(e.Measurement.pointPick[r - 1].z - e.Measurement.pointPick[r - 2].z)
                      , m = e.Measurement.pointPick[r - 1].distanceTo(e.Measurement.pointPick[r - 2]);
                    i = {
                        dx: g.toFixed(3),
                        dy: u.toFixed(3),
                        dz: f.toFixed(3),
                        dis: m.toFixed(3)
                    }
                }
                return i
            }
        }
        ,
        this.clear = function() {
            e.SVGRect.deleteCircle(),
            e.SVGRect.deleteMoveLine(),
            e.SVGRect.deleteLineAndCircle(),
            e.Measurement.pointPick = [],
            e.Measurement.pointPickToScreen = [],
            e.Measurement.pointAssist = [],
            e.Measurement.pointAssistToScreen = [],
            e.Measurement.needUpdatedObjects = [],
            e.cameraControl.removeEventListener(Rc.ON_CAMERA_CHANGE, t),
            e.cameraControl.removeEventListener(Rc.ON_CAMERA_CHANGE, i)
        }
        ,
        this.updatePos = function() {
            var t = e.Measurement.pointPick.length
              , i = e.Measurement.pointAssist.length
              , o = e.Measurement.needUpdatedObjects;
            if (i)
                for (var n = 0; o.length > n; n += 1) {
                    var r = 2 * n
                      , a = A.getScreenCoordFromSceneCoord(o[n].point1)
                      , l = A.getScreenCoordFromSceneCoord(o[n].point2)
                      , c = new s(a[0],a[1])
                      , h = new s(l[0],l[1]);
                    e.Measurement.pointPickToScreen[r] = c,
                    e.Measurement.pointPickToScreen[r + 1] = h;
                    var d = A.getScreenCoordFromSceneCoord(o[n].asPot1)
                      , p = A.getScreenCoordFromSceneCoord(o[n].asPot2)
                      , g = new s(d[0],d[1])
                      , u = new s(p[0],p[1]);
                    e.Measurement.pointAssistToScreen[r] = g,
                    e.Measurement.pointAssistToScreen[r + 1] = u;
                    var f = e.Measurement.pointPickToScreen[r].x
                      , m = e.Measurement.pointPickToScreen[r].y
                      , C = e.Measurement.pointPickToScreen[r + 1].x
                      , y = e.Measurement.pointPickToScreen[r + 1].y
                      , v = e.Measurement.pointAssistToScreen[r].x
                      , I = e.Measurement.pointAssistToScreen[r].y
                      , E = e.Measurement.pointAssistToScreen[r + 1].x
                      , B = e.Measurement.pointAssistToScreen[r + 1].y
                      , x = document.getElementById("circlePick" + A.getViewerImpl().uuid + r)
                      , S = document.getElementById("circlePick" + A.getViewerImpl().uuid + (r + 1));
                    x.setAttribute("cx", f),
                    x.setAttribute("cy", m),
                    S.setAttribute("cx", C),
                    S.setAttribute("cy", y);
                    var w = document.getElementById("pickline" + A.getViewerImpl().uuid + "red" + (r + 1))
                      , M = document.getElementById("pickline" + A.getViewerImpl().uuid + "green" + (r + 1))
                      , b = document.getElementById("pickline" + A.getViewerImpl().uuid + "blue" + (r + 1))
                      , U = document.getElementById("pickline" + A.getViewerImpl().uuid + "yellow" + (r + 1));
                    w.setAttribute("x1", f),
                    w.setAttribute("y1", m),
                    w.setAttribute("x2", v),
                    w.setAttribute("y2", I),
                    M.setAttribute("x1", E),
                    M.setAttribute("y1", B),
                    M.setAttribute("x2", C),
                    M.setAttribute("y2", y),
                    b.setAttribute("x1", v),
                    b.setAttribute("y1", I),
                    b.setAttribute("x2", E),
                    b.setAttribute("y2", B),
                    U.setAttribute("x1", f),
                    U.setAttribute("y1", m),
                    U.setAttribute("x2", C),
                    U.setAttribute("y2", y)
                }
            if (t % 2 == 1 && t !== i) {
                var F = A.getScreenCoordFromSceneCoord(e.Measurement.pointPick[t - 1])
                  , K = new s(F[0],F[1]);
                e.Measurement.pointPickToScreen[t - 1] = K;
                f = K.x,
                m = K.y;
                (x = document.getElementById("circlePick" + A.getViewerImpl().uuid + (t - 1))).setAttribute("cx", f),
                x.setAttribute("cy", m)
            }
        }
        ,
        this.addEventListener = function() {
            e.cameraControl.addEventListener(Rc.ON_CAMERA_CHANGE, t),
            e.cameraControl.addEventListener(Rc.ON_CAMERA_CHANGE, i)
        }
    };
    Object.assign(mB.prototype, Ld.prototype);
    var CB = function() {
        function A(e) {
            cc(this, A),
            this.coef = e.coef || .5,
            this.controlPoints = e.controlPoints || [],
            this.pointCountRecord = e.pointCountRecord,
            this.formatConPoints = [],
            this.matrix = [],
            this.update = !0,
            this.points = [],
            this.controlPointsIndex = [],
            this.straightLineDistance = 0,
            this.curveLength = 0,
            this.updateCurveLength = !0,
            this.updateList = [],
            this.setCoef(this.coef),
            this._forMatConPoints()
        }
        return dc(A, [{
            key: "setControlPoints",
            value: function(A) {
                this.controlPoints = A,
                this._forMatConPoints(),
                this.update = !0,
                this.updateList.push("controlPoints"),
                this.updateStraightLineDistance = !0
            }
        }, {
            key: "getPoints",
            value: function() {
                return this.update && this._createPoints(this.pointCountRecord),
                this.points
            }
        }, {
            key: "setPointsCount",
            value: function(A) {
                this.updateList.push("count"),
                this.update = !0,
                this.pointCountRecord = A
            }
        }, {
            key: "getCurveLength",
            value: function() {
                return this.update ? {
                    info: "参数已修改，请先更新曲线",
                    code: -1,
                    updateList: this.updateList
                } : (this.updateCurveLength && function() {
                    var A = this.points
                      , e = A.length;
                    this.curveLength = A.reduce((function(A, t, i, o) {
                        return e > i + 1 && (A += o[i].distanceTo(o[i + 1])),
                        A
                    }
                    ), 0),
                    this.updateCurveLength = !1
                }
                .bind(this)(),
                this.curveLength)
            }
        }, {
            key: "getStraightLineDistance",
            value: function() {
                return this.updateStraightLineDistance && function() {
                    var A = this.controlPoints
                      , e = A.length;
                    this.straightLineDistance = A.reduce((function(A, t, i, o) {
                        return e > i + 1 && (A += o[i].distanceTo(o[i + 1])),
                        A
                    }
                    ), 0),
                    this.updateStraightLineDistance = !1
                }
                .bind(this)(),
                this.straightLineDistance
            }
        }, {
            key: "setCoef",
            value: function(A) {
                this.updateList.push("coef"),
                this.update = !0,
                this.matrix = [[-A, 2 - A, A - 2, A], [2 * A, A - 3, 3 - 2 * A, -A], [-A, 0, A, 0], [0, 1, 0, 0]]
            }
        }, {
            key: "updateCurve",
            value: function() {
                return this.getPoints()
            }
        }, {
            key: "getPointsInfo",
            value: function() {
                return this.update ? {
                    info: "参数已修改，请先更新曲线",
                    code: -1,
                    updateList: this.updateList
                } : {
                    points: this.getPoints(),
                    controlPointsIndex: this.controlPointsIndex,
                    curveLength: this.getCurveLength(),
                    straightLineDistance: this.getStraightLineDistance()
                }
            }
        }, {
            key: "_forMatConPoints",
            value: function() {
                var A = this.controlPoints;
                this.formatConPoints = [];
                for (var e = 0, t = A.length; t > e; e += 1)
                    0 === e ? this.formatConPoints.push(A[e].clone(), A[e].clone()) : t > e + 1 ? this.formatConPoints.push(A[e].clone()) : this.formatConPoints.push(A[e].clone(), A[e].clone())
            }
        }, {
            key: "_createPoints",
            value: function(A) {
                var e = []
                  , t = this.matrix;
                function i(A) {
                    e[0] = new y,
                    e[1] = new y,
                    e[2] = new y,
                    e[3] = new y;
                    var i = [];
                    i[0] = [],
                    i[1] = [],
                    i[2] = [],
                    i[3] = [],
                    i[0][0] = A[0].clone().multiplyScalar(t[0][0]),
                    i[0][1] = A[1].clone().multiplyScalar(t[0][1]),
                    i[0][2] = A[2].clone().multiplyScalar(t[0][2]),
                    i[0][3] = A[3].clone().multiplyScalar(t[0][3]),
                    i[1][0] = A[0].clone().multiplyScalar(t[1][0]),
                    i[1][1] = A[1].clone().multiplyScalar(t[1][1]),
                    i[1][2] = A[2].clone().multiplyScalar(t[1][2]),
                    i[1][3] = A[3].clone().multiplyScalar(t[1][3]),
                    i[2][0] = A[0].clone().multiplyScalar(t[2][0]),
                    i[2][1] = A[1].clone().multiplyScalar(t[2][1]),
                    i[2][2] = A[2].clone().multiplyScalar(t[2][2]),
                    i[2][3] = A[3].clone().multiplyScalar(t[2][3]),
                    i[3][0] = A[0].clone().multiplyScalar(t[3][0]),
                    i[3][1] = A[1].clone().multiplyScalar(t[3][1]),
                    i[3][2] = A[2].clone().multiplyScalar(t[3][2]),
                    i[3][3] = A[3].clone().multiplyScalar(t[3][3]);
                    for (var o = 0; 4 > o; o += 1)
                        for (var n = 0; 4 > n; n += 1)
                            e[o].add(i[o][n])
                }
                function o(A) {
                    var t = A * A
                      , i = t * A;
                    return e[0].clone().multiplyScalar(i).add(e[1].clone().multiplyScalar(t)).add(e[2].clone().multiplyScalar(A)).add(e[3].clone())
                }
                var n = this.formatConPoints
                  , r = this.points = []
                  , a = this.controlPointsIndex = []
                  , s = this.controlPoints;
                if (A) {
                    for (var l = this.getStraightLineDistance(), c = 1 / A, h = 0, d = 0, p = 0, g = s.length - 1; g > p; p += 1) {
                        h += s[p].distanceTo(s[p + 1]);
                        var u = Math.floor(h / l / c) - d;
                        i([n[p], n[p + 1], n[p + 2], n[p + 3]]);
                        for (var f = 1 / u, m = 0; u > m; m += 1) {
                            r.push(o(f * m))
                        }
                        d += u
                    }
                    r.push(s[s.length - 1])
                } else
                    for (var C = 0, v = n.length; v > C; C += 1) {
                        var I = 0 === C ? 0 : 1;
                        if (C + 3 >= v) {
                            r.push(n[C + 2]),
                            a.push({
                                j: n[C + 1],
                                order: -1
                            });
                            break
                        }
                        r.push(n[C + 1]),
                        a.push({
                            j: n[C + 1],
                            order: 100 * C + I
                        }),
                        i([n[C], n[C + 1], n[C + 2], n[C + 3]]);
                        for (var E = 1; 100 > E; E += 1)
                            r.push(o(E / 100))
                    }
                this.update = !1,
                this.updateCurveLength = !0,
                this.updateList = []
            }
        }]),
        A
    }()
      , yB = function() {
        function A(e) {
            cc(this, A),
            this.coef = e.coef || .5,
            this.points = e.controlPoints || [],
            this.pointCountRecord = e.pointCountRecord,
            this.formatConPoints = [],
            this.matrix = [],
            this._points = [],
            this.controlPointsIndex = [],
            this.straightLineDistance = 0,
            this.count = 0,
            this.setCoef(this.coef),
            this._forMatConPoints(),
            this._calCount(),
            this.update = !0
        }
        return dc(A, [{
            key: "setControlPoints",
            value: function(A) {
                this.points = A,
                this._forMatConPoints(),
                this._calCount(),
                this._createPoints(),
                this.update = !0
            }
        }, {
            key: "getPointAt",
            value: function(A) {
                this.update && this.getPoints();
                var e = Math.ceil(A * this.count);
                return this._points[e > this.count ? this.count : e]
            }
        }, {
            key: "getPoints",
            value: function() {
                return this.update && this._createPoints(this.pointCountRecord),
                this._points
            }
        }, {
            key: "setCoef",
            value: function(A) {
                this.update = !0,
                this.matrix = [[-A, 2 - A, A - 2, A], [2 * A, A - 3, 3 - 2 * A, -A], [-A, 0, A, 0], [0, 1, 0, 0]]
            }
        }, {
            key: "getPointsInfo",
            value: function() {
                return {
                    points: this.getPoints(),
                    controlPointsIndex: this.controlPointsIndex
                }
            }
        }, {
            key: "_forMatConPoints",
            value: function() {
                var A = this.points;
                this.formatConPoints = [];
                for (var e = 0, t = A.length; t > e; e += 1)
                    0 === e ? this.formatConPoints.push(A[e].clone(), A[e].clone()) : t > e + 1 ? this.formatConPoints.push(A[e].clone()) : this.formatConPoints.push(A[e].clone(), A[e].clone())
            }
        }, {
            key: "_calCount",
            value: function() {
                var A, e, t = this, i = 1 / 0;
                e = (A = t.points).length,
                t.straightLineDistance = A.reduce((function(A, t, o, n) {
                    if (e > o + 1) {
                        var r = n[o].distanceTo(n[o + 1]);
                        i = r > i ? i : r,
                        A += r
                    }
                    return A
                }
                ), 0),
                t.updateStraightLineDistance = !1;
                var o = Math.ceil(t.straightLineDistance / i);
                this.count = o > 100 ? o : 100
            }
        }, {
            key: "_createPoints",
            value: function() {
                var A = []
                  , e = this.matrix;
                function t(t) {
                    A[0] = new y,
                    A[1] = new y,
                    A[2] = new y,
                    A[3] = new y;
                    var i = [];
                    i[0] = [],
                    i[1] = [],
                    i[2] = [],
                    i[3] = [],
                    i[0][0] = t[0].clone().multiplyScalar(e[0][0]),
                    i[0][1] = t[1].clone().multiplyScalar(e[0][1]),
                    i[0][2] = t[2].clone().multiplyScalar(e[0][2]),
                    i[0][3] = t[3].clone().multiplyScalar(e[0][3]),
                    i[1][0] = t[0].clone().multiplyScalar(e[1][0]),
                    i[1][1] = t[1].clone().multiplyScalar(e[1][1]),
                    i[1][2] = t[2].clone().multiplyScalar(e[1][2]),
                    i[1][3] = t[3].clone().multiplyScalar(e[1][3]),
                    i[2][0] = t[0].clone().multiplyScalar(e[2][0]),
                    i[2][1] = t[1].clone().multiplyScalar(e[2][1]),
                    i[2][2] = t[2].clone().multiplyScalar(e[2][2]),
                    i[2][3] = t[3].clone().multiplyScalar(e[2][3]),
                    i[3][0] = t[0].clone().multiplyScalar(e[3][0]),
                    i[3][1] = t[1].clone().multiplyScalar(e[3][1]),
                    i[3][2] = t[2].clone().multiplyScalar(e[3][2]),
                    i[3][3] = t[3].clone().multiplyScalar(e[3][3]);
                    for (var o = 0; 4 > o; o += 1)
                        for (var n = 0; 4 > n; n += 1)
                            A[o].add(i[o][n])
                }
                for (var i, o, n, r = this.formatConPoints, a = this._points = [], s = this.controlPointsIndex = [], l = this.points, c = this.straightLineDistance, h = 0, d = 0, p = 0, g = l.length - 1; g > p; p += 1) {
                    var u = (h += l[p].distanceTo(l[p + 1])) / c * this.count - d;
                    t([r[p], r[p + 1], r[p + 2], r[p + 3]]),
                    a.push(r[p + 1]),
                    s.push({
                        j: r[p + 1],
                        order: d
                    }),
                    d += 1;
                    for (var f = 1; u > f; f += 1)
                        a.push((o = void 0,
                        n = void 0,
                        n = (o = (i = f / u) * i) * i,
                        A[0].clone().multiplyScalar(n).add(A[1].clone().multiplyScalar(o)).add(A[2].clone().multiplyScalar(i)).add(A[3].clone()))),
                        d += 1
                }
                a.push(l[l.length - 1]),
                s.push({
                    to: r[l.length - 1],
                    order: -1
                }),
                this.update = !1
            }
        }]),
        A
    }()
      , vB = function() {
        function A(e) {
            return cc(this, A),
            A.shareInstance || (A.shareInstance = this,
            this.maxRequestCount = e || 300,
            this.currentPendingCount = 0,
            this._requests = [],
            this._requestDidLoad = this._requestDidLoad.bind(this),
            this._requestDidError = this._requestDidError.bind(this),
            this._requestDidAbort = this._requestDidAbort.bind(this),
            this._requestDidTimeout = this._requestDidTimeout.bind(this)),
            A.shareInstance
        }
        return dc(A, [{
            key: "addRequest",
            value: function(A, e) {
                A.addEventListener("load", this._requestDidLoad),
                A.addEventListener("error", this._requestDidError),
                A.addEventListener("abort", this._requestDidAbort),
                A.addEventListener("timeout", this._requestDidTimeout),
                this.maxRequestCount > this.currentPendingCount ? (A.send(e),
                this.currentPendingCount += 1) : this._requests.push({
                    request: A,
                    dataToSend: e
                })
            }
        }, {
            key: "_sendNextRequest",
            value: function() {
                if (this._requests.length > 0) {
                    var A = this._requests.shift();
                    A.request.send(A.dataToSend),
                    this.currentPendingCount += 1
                }
            }
        }, {
            key: "_requestDidLoad",
            value: function() {
                this.currentPendingCount -= 1,
                this._sendNextRequest()
            }
        }, {
            key: "_requestDidError",
            value: function() {
                this.currentPendingCount -= 1,
                this._sendNextRequest()
            }
        }, {
            key: "_requestDidAbort",
            value: function() {
                this.currentPendingCount -= 1,
                this._sendNextRequest()
            }
        }, {
            key: "_requestDidTimeout",
            value: function() {
                this.currentPendingCount -= 1,
                this._sendNextRequest()
            }
        }]),
        A
    }()
      , IB = {
        group: "group",
        model: "model",
        component: "component",
        components: "components"
    }
      , EB = function A() {
        cc(this, A),
        this.type = void 0,
        this.nodeId = void 0,
        this.matrix = void 0,
        this.center = void 0,
        this.modelKey = void 0,
        this.componentKey = void 0,
        this.componentsKey = void 0,
        this.children = void 0
    }
      , BB = function() {
        function A(e, t, i, o) {
            cc(this, A),
            this.host = e,
            this.projectUrl = t,
            this.accessToken = i,
            this._cachedComponents = {},
            this._cachedMaterials = {},
            this._cachedGeometries = {},
            this._cachedFile = {},
            this._requestQueue = new vB(o)
        }
        return dc(A, [{
            key: "destroy",
            value: function() {
                delete this._cachedComponents,
                delete this._cachedMaterials,
                delete this._cachedGeometries,
                delete this._cachedFile
            }
        }, {
            key: "getExternalObjectByModelKey",
            value: function(A) {
                var e = this;
                return "string" != typeof A ? Promise.reject("参数不合法") : this._loadModelInfo(A).then((function() {
                    return e._loadComponentsListIn(A)
                }
                )).then((function(A) {
                    return e.getExternalObjectByComponentsKey(A)
                }
                ))
            }
        }, {
            key: "getExternalObjectByComponentKey",
            value: function(A) {
                var e = this;
                if ("string" != typeof A)
                    return Promise.reject("参数不合法");
                var t = this._cachedComponents[A];
                return t ? Promise.resolve(this._createMesh(t, !0)) : this._loadComponentsInfo([A]).then((function(A) {
                    return e._generateMeshByComponentInfo(A[0])
                }
                )).then((function(A) {
                    return A
                }
                ))
            }
        }, {
            key: "getExternalObjectByComponentsKeyBackup",
            value: function(A) {
                var e = this;
                if (A instanceof Array == !1)
                    return Promise.reject("参数不合法");
                for (var t = [], i = [], o = {}, n = function(n, r) {
                    var a = e.getExternalObjectByComponentKey(A[n]).then((function(A) {
                        i.push(A)
                    }
                    )).catch((function(e) {
                        o[A[n]] = e
                    }
                    ));
                    t.push(a)
                }, r = 0, a = A.length; a > r; r += 1)
                    n(r);
                return Promise.all(t).then((function() {
                    if (i.length > 0) {
                        i.length !== A.length && Bh.error(o);
                        for (var e = new Xi, t = 0, n = i.length; n > t; t += 1)
                            e.add(i[t]);
                        return e
                    }
                    return Promise.reject(o)
                }
                ))
            }
        }, {
            key: "getExternalObjectByComponentsKey",
            value: function(A) {
                var e = this;
                if (A instanceof Array == !1)
                    return Promise.reject("参数不合法");
                for (var t = [], i = {}, o = [], n = 0, r = A.length; r > n; n += 1) {
                    var a = A[n]
                      , s = this._cachedComponents[a];
                    s ? t.push(this._createMesh(s, !0)) : o.push(a)
                }
                if (o.length > 0)
                    return this._loadComponentsInfo(o).then((function(o) {
                        for (var n = [], r = 0, a = o.length; a > r; r += 1) {
                            var s = e._generateMeshByComponentInfo(o[r]).then((function(A) {
                                t.push(A)
                            }
                            )).catch((function(A) {
                                i[A.componentKey] = A.message
                            }
                            ));
                            n.push(s)
                        }
                        return Promise.all(n).then((function() {
                            if (t.length > 0) {
                                t.length !== A.length && Bh.error(i);
                                for (var e = new Xi, o = 0, n = t.length; n > o; o += 1)
                                    e.add(t[o]);
                                return e
                            }
                            return Promise.reject(i)
                        }
                        ))
                    }
                    ));
                for (var l = new Xi, c = 0, h = t.length; h > c; c += 1)
                    l.add(t[c]);
                return Promise.resolve(l)
            }
        }, {
            key: "testData",
            value: function() {
                var A = new EB;
                A.type = IB.group;
                var e = new EB;
                e.type = IB.component,
                e.componentKey = "M1577676674083_265272";
                var t = new EB;
                t.type = IB.component,
                t.componentKey = "M1577676674083_265916";
                var i = new EB;
                i.type = IB.component,
                i.componentKey = "M1577676674083_244449";
                var o = (new M).makeTranslation(0, 0, 5e3);
                i.matrix = o.toArray();
                var n = new EB;
                n.type = IB.group;
                var r = new EB;
                r.type = IB.component,
                r.componentKey = "M1577676674083_246705";
                var a = new EB;
                a.type = IB.component,
                a.componentKey = "M1577676674083_247372",
                a.matrix = o.makeTranslation(0, 0, 7e3).toArray();
                var s = new EB;
                return s.type = IB.component,
                s.componentKey = "M1577676674083_244910",
                A.children = [e, t, i, n],
                n.children = [r, a, s],
                A
            }
        }, {
            key: "getExternalObjectByNodeInfo",
            value: function(A) {
                var e = this
                  , t = void 0;
                return A.type === IB.component && A.componentKey ? t = this.getExternalObjectByComponentKey(A.componentKey) : A.type === IB.components && A.componentsKey && A.componentsKey instanceof Array && A.componentsKey.length > 0 ? t = this.getExternalObjectByComponentsKey(A.componentsKey) : A.type === IB.model && A.modelKey ? t = this.getExternalObjectByModelKey(A.modelKey) : A.type === IB.group && A.children && A.children.length > 0 ? function() {
                    for (var i = new Xi, o = [], n = function(t, n) {
                        var r = A.children[t]
                          , a = e.getExternalObjectByNodeInfo(r).then((function(A) {
                            i.add(A)
                        }
                        )).catch((function(A) {
                            return Bh.error(r, A),
                            A
                        }
                        ));
                        o.push(a)
                    }, r = 0, a = A.children.length; a > r; r += 1)
                        n(r);
                    t = Promise.all(o).then((function() {
                        return i
                    }
                    ))
                }() : t = Promise.reject("参数不合法"),
                t.then((function(e) {
                    if (A.matrix) {
                        var t = (new M).fromArray(A.matrix);
                        e.matrix.identity(),
                        e.applyMatrix4(t),
                        e.updateMatrixWorld(!0)
                    }
                    if (A.center) {
                        var i = (new aA).setFromObject(e)
                          , o = new y;
                        if (i.getCenter(o),
                        parseInt(A.center[0], 10) !== parseInt(o.x, 10) || parseInt(A.center[1], 10) !== parseInt(o.y, 10) || parseInt(A.center[2], 10) !== parseInt(o.z, 10)) {
                            var n = (new y).fromArray(A.center).sub(o)
                              , r = (new M).makeTranslation(n.x, n.y, n.z);
                            e.applyMatrix4(r),
                            e.updateMatrixWorld(!0)
                        }
                    }
                    return e
                }
                ))
            }
        }, {
            key: "exportNodeInfoByComponents",
            value: function(A, e) {
                if (e) {
                    var t = new EB;
                    return 1 === e.length ? (t.type = IB.component,
                    t.componentKey = e[0]) : (t.type = IB.components,
                    t.componentsKey = e),
                    t.nodeId = A,
                    t
                }
            }
        }, {
            key: "exportNodeInfoByModelKey",
            value: function(A, e) {
                if (e) {
                    var t = new EB;
                    return t.type = IB.model,
                    t.modelKey = e,
                    t.nodeId = A,
                    t
                }
            }
        }, {
            key: "_loadModelInfo",
            value: function(A) {
                return this._httpGet(this.host + "/api/" + this.projectUrl + "/models?modelKey=" + A)
            }
        }, {
            key: "_loadComponentsListIn",
            value: function(A) {
                return this._httpGet(this.host + "/api/" + this.projectUrl + "/components/keys?modelKey=" + A)
            }
        }, {
            key: "_loadComponentsInfo",
            value: function(A, e, t) {
                return this._httpPost(this.host + "/api/" + this.projectUrl + "/components/geometry", {
                    components: A
                })
            }
        }, {
            key: "_generateMeshByComponentInfo",
            value: function(A) {
                var e = this;
                if (!A.geometry)
                    return Promise.reject({
                        componentKey: A.component,
                        message: "几何为空"
                    });
                var t = {};
                if (t.componentKey = A.component,
                A.matrix) {
                    var i = (new M).fromArray(A.matrix);
                    t.matrix = i
                }
                var o = A.materials
                  , n = []
                  , r = [];
                if (A.materials.length > 0)
                    for (var a = function(t, i) {
                        n.push(e._loadMaterial(o[t]).then((function(A) {
                            r[t] = A
                        }
                        )).catch((function(i) {
                            Bh.error(i, "用默认材质代替"),
                            r[t] = e._loadMaterialByType(A.type)
                        }
                        )))
                    }, s = 0, l = o.length; l > s; s += 1)
                        a(s);
                else {
                    var c = this._loadMaterialByType(A.type);
                    r.push(c),
                    n.push(Promise.resolve(c))
                }
                return Promise.all(n).then((function() {
                    return t.materials = r,
                    e._loadGeometry(A.geometry)
                }
                )).then((function(A) {
                    t.geometry = A;
                    for (var i = 0, o = t.materials.length; o > i; i += 1) {
                        var n = t.materials[i];
                        if (n.aoMap || n.lightMap) {
                            t.geometry.setAttribute("uv2", new YA(t.geometry.attributes.uv.array,2));
                            break
                        }
                    }
                    return e._cachedComponents[t.componentKey] = t,
                    e._createMesh(t, !1)
                }
                ))
            }
        }, {
            key: "_loadMaterial",
            value: function(A) {
                var e = this
                  , t = this._cachedMaterials[A.key];
                if (t)
                    return Promise.resolve(t.clone());
                var i = A.data;
                return this._loadAllTextures(i).then((function(t) {
                    var o = e._createMaterial(i, t);
                    return e._cachedMaterials[A.key] = o,
                    o
                }
                ))
            }
        }, {
            key: "_loadMaterialByType",
            value: function(A) {
                var e = _u[A] ? _u[A].color : void 0;
                e || (e = _u.DEFAULT.color);
                var t = new LA(e[0],e[1],e[2])
                  , i = t.getHexString() + "_" + e[3]
                  , o = this._cachedMaterials[i];
                return o || ((o = Kd.createStandardMaterial({
                    color: t
                })).side = 2,
                this._cachedMaterials[i] = o),
                o
            }
        }, {
            key: "_loadGeometry",
            value: function(A) {
                var e = this
                  , t = this._cachedGeometries[A];
                return t ? Promise.resolve(t) : this._loadFile(A).then((function(t) {
                    try {
                        var i = new TextDecoder("utf-8").decode(t)
                          , o = JSON.parse(i)
                          , n = e._createGeometry(o);
                        return n ? (e._cachedGeometries[A] = n,
                        n) : Promise.reject("几何为空")
                    } catch (A) {
                        return Promise.reject(A.message)
                    }
                }
                ))
            }
        }, {
            key: "_loadAllTextures",
            value: function(A) {
                for (var e = this, t = [], i = this._getAllTextureFileKey(A), o = {}, n = function(A, n) {
                    var r = i[A];
                    t.push(e._loadFile(r).then((function(A) {
                        var t = e._createTexture(A);
                        o[r] = t
                    }
                    )).catch((function(A) {
                        Bh.error(A)
                    }
                    )))
                }, r = 0, a = i.length; a > r; r += 1)
                    n(r);
                return t.length > 0 ? new Promise((function(A, e) {
                    Promise.all(t).then((function() {
                        Object.keys(o).length > 0 ? A(o) : e("加载纹理失败")
                    }
                    ))
                }
                )) : Promise.resolve(o)
            }
        }, {
            key: "_getAllTextureFileKey",
            value: function(A) {
                var e = {};
                return A.map && (e[A.map] = !0),
                A.aoMap && (e[A.aoMap] = !0),
                A.alphaMap && (e[A.alphaMap] = !0),
                A.envMap && (e[A.envMap] = !0),
                A.lightMap && (e[A.lightMap] = !0),
                A.emissiveMap && (e[A.emissiveMap] = !0),
                A.specularMap && (e[A.specularMap] = !0),
                A.specularMap && (e[A.specularMap] = !0),
                Object.keys(e)
            }
        }, {
            key: "_createTexture",
            value: function(A) {
                var e = new d
                  , t = document.createElement("img");
                e.wrapS = e.wrapT = 1e3,
                t.onerror = function(A) {
                    Bh.error("加载纹理出错")
                }
                ,
                t.onload = function(i) {
                    "string" != typeof A && window.URL.revokeObjectURL(t.src),
                    e.image = t,
                    e.needsUpdate = !0
                }
                ;
                var i = new Blob([A]);
                return t.src = window.URL.createObjectURL(i),
                e
            }
        }, {
            key: "_createGeometry",
            value: function(A) {
                if (A.positions && 0 !== A.positions.length) {
                    var e = null;
                    e = new he;
                    var t = new Float32Array(A.positions);
                    e.setAttribute("position", new YA(t,3));
                    var i = new Uint32Array(A.indices);
                    if (e.setIndex(new YA(i,1)),
                    A.normals && A.normals.length > 0) {
                        var o = new Float32Array(A.normals);
                        e.setAttribute("normal", new YA(o,3))
                    } else
                        e.computeVertexNormals();
                    if (A.uv && A.uv.length > 0) {
                        var n = new Float32Array(A.uv);
                        e.setAttribute("uv", new YA(n,2))
                    }
                    if (void 0 !== A.materialIndices) {
                        for (var r = null, a = [], s = void 0, l = 0; A.materialIndices.length > l; l += 1) {
                            var c = A.materialIndices[l];
                            c !== s && (s = c,
                            null != r && (r.count = 3 * l - r.start,
                            a.push(r)),
                            r = {
                                start: 3 * l,
                                materialIndex: s
                            })
                        }
                        null != r && (r.count = 3 * A.materialIndices.length - r.start,
                        a.push(r)),
                        e.groups = a
                    }
                    return e
                }
            }
        }, {
            key: "_createMaterial",
            value: function(A, e) {
                return Kd.createMaterialByMaterialBufferAndTexture(A, e)
            }
        }, {
            key: "_createMesh",
            value: function(A, e) {
                var t = null;
                if (e) {
                    t = [];
                    for (var i = 0, o = A.materials.length; o > i; i += 1)
                        t.push(A.materials[i].clone())
                } else
                    t = A.materials;
                var n = new Kf(A.geometry,t);
                return n.visible = !0,
                n.key = A.componentKey,
                A.matrix && (n.applyMatrix4(A.matrix),
                n.updateMatrixWorld(!0)),
                n
            }
        }, {
            key: "_loadFile",
            value: function(A) {
                var e = this._cachedFile[A];
                return e ? Promise.resolve(e) : this._http("GET", this.host + "/api/" + this.projectUrl + "/files?fileKey=" + A, "arraybuffer").then((function(A) {
                    return A
                }
                ))
            }
        }, {
            key: "_httpGet",
            value: function(A) {
                return this._http("GET", A)
            }
        }, {
            key: "_httpPost",
            value: function(A, e) {
                return this._http("POST", A, void 0, e)
            }
        }, {
            key: "_http",
            value: function(A, e, t, i) {
                var o = this;
                return new Promise((function(n, r) {
                    var a = {};
                    "POST" === A && (a["Content-type"] = "application/json;charset=UTF-8"),
                    o.accessToken && (a.Authorization = o.accessToken),
                    _d({
                        type: A,
                        url: e,
                        headers: a,
                        data: JSON.stringify(i),
                        responseType: t || "json",
                        requestQueue: o._requestQueue,
                        success: function(A) {
                            if (A)
                                try {
                                    t && "json" !== t ? n(A) : A.data ? n(A.data) : "success" !== A.code.toLowerCase() && r(A.message ? A.message : "未知错误")
                                } catch (A) {
                                    r(A.message)
                                }
                            else
                                r("数据为空")
                        },
                        error: function(A, e) {
                            r(e)
                        }
                    })
                }
                ))
            }
        }]),
        A
    }()
      , xB = {};
    xB.ToolBar = Xd;
    var SB = {};
    SB.ModelCompares = $y,
    SB.DISPLAYMODEL = zy,
    SB.CompareGlobalData = Xy,
    SB.CompareComponentType = Zy,
    SB.COMPAREEVENTS = _y,
    SB.ViewerConnector = ev,
    SB.RoadNetManager = JE,
    SB.TextLoader = _E,
    SB.TrackSimulator = AB,
    SB.Heatmap = BE,
    SB.Fire = FE,
    SB.Water = eB,
    SB.WaterEffect = sv,
    SB.WaterEffectConfig = function() {
        this.boundary = [],
        this.color = new Xh("#80FDFF",.8),
        this.scale = 4,
        this.viewer = null,
        this.xDirection = 1,
        this.yDirection = 1,
        this.reflectivity = 1,
        this.reflectorTexturePosition = new y,
        this.refractorTexturePosition = new y,
        this.height = 0,
        this.geometry = null
    }
    ,
    SB.ArrowManager = cv;
    var wB = {};
    wB.Line2 = QE,
    wB.LineMaterial = YC,
    wB.LineGeometry = KE;
    for (var MB = {}, bB = Object.keys(sc), UB = 0; bB.length > UB; UB += 1) {
        var FB = bB[UB];
        Object.defineProperty(MB, FB, {
            value: sc[FB],
            enumerable: !0,
            configurable: !0,
            writable: !1
        })
    }
    A.Animation = hp,
    A.ArrowDomMark = uB,
    A.ArrowDomMarkManager = fB,
    A.BOSCatmullRomCurve3 = CB,
    A.BOSCatmullRomCurve3ForFrameEdit = yB,
    A.BaseControl = Fg,
    A.CAMERATYPE = Ec,
    A.Camera = cp,
    A.CameraAnimator = dp,
    A.CameraControl = mp,
    A.CameraInfo = Qd,
    A.CameraUtil = Rd,
    A.ClipPlaneService = Ap,
    A.ClipPlanes = HC,
    A.ClipPlanesTool = vp,
    A.CollisionDetection = function(A) {
        this.cameraControl = A,
        this.intersector = A.intersector;
        var e = new Dd
          , t = new Dd
          , i = new Dd
          , o = new Dd
          , n = new Dd
          , r = new Dd;
        this.run = function(a, s) {
            var l = {}
              , c = this.cameraControl.getIntersectContext(null);
            e.set(a, new y(0,0,1)),
            t.set(a, new y(0,0,-1)),
            n.set(a, s),
            r.set(a, new y(-s.x,-s.y,-s.z)),
            i.set(a, new y(-s.y,s.x,s.z)),
            o.set(a, new y(s.y,-s.x,s.z)),
            l.top = this.intersector.getIntersectByRay(c, e.ray),
            l.down = this.intersector.getIntersectByRay(c, t.ray),
            l.front = this.intersector.getIntersectByRay(c, n.ray),
            l.back = this.intersector.getIntersectByRay(c, r.ray),
            l.left = this.intersector.getIntersectByRay(c, i.ray),
            l.right = this.intersector.getIntersectByRay(c, o.ray);
            var h = new y(a.x,a.y,a.z - .8 * A.manHeight)
              , d = new Dd;
            d.set(h, s);
            var p = new Dd;
            p.set(h, new y(-s.x,-s.y,-s.z));
            var g = new Dd;
            g.set(h, new y(-s.y,s.x,s.z));
            var u = new Dd;
            return u.set(h, new y(s.y,-s.x,s.z)),
            l.frontMiddle = this.intersector.getIntersectByRay(c, d.ray),
            l.backMiddle = this.intersector.getIntersectByRay(c, p.ray),
            l.leftMiddle = this.intersector.getIntersectByRay(c, g.ray),
            l.rightMiddle = this.intersector.getIntersectByRay(c, u.ray),
            l
        }
    }
    ,
    A.Color = Xh,
    A.ColorPicker = Hh,
    A.ControlConfig = jh,
    A.ControlManager = Og,
    A.ControlMode = Gc,
    A.DOMMark = Od,
    A.DefaultInvisibleComponentType = bc,
    A.DefaultMaterial = _u,
    A.DeviceTest = mh,
    A.DomUtil = xh,
    A.DrawingStyle = jc,
    A.EIMMODELMaterial = ld,
    A.EVENTS = Rc,
    A.Edge = wp,
    A.EnumCesiumImageryLayerType = {
        AUTO: 0,
        BAIDU: 1,
        GAODE: 2,
        MAPBOX: 3,
        ARCGIS: 4,
        GOOGLE: 5
    },
    A.EnumConditionType = {
        HIDDEN_OTHERS: 0,
        TRANSLUCENT_OTHERS: 1,
        OVERRIDE: 2,
        BORDERLINE: 3
    },
    A.EnumDataProvider = Wc,
    A.EnumFilterState = zc,
    A.EnumIdBasedType = Dc,
    A.EnumInstanceState = Hc,
    A.EnumIsolateState = Nc,
    A.EnumObjectState = Lc,
    A.EnumRenderType = {
        RENDER: 0,
        RENDER_FINISHED: 1,
        RESIZE: 2
    },
    A.EnumRendererType = {
        AUTO: 0,
        FULL: 1,
        INCREMENT: 2
    },
    A.EnumSceneState = Vc,
    A.EnumShaderColorState = Yc,
    A.EnumTransparentState = Oc,
    A.EnumUserType = {
        HIDDEN_DATA: 0,
        OVERRIDE_DATA: 1,
        WITH_BOARDLINE: 2
    },
    A.EventDispatcher = Ld,
    A.ExternalObjectConverter = BB,
    A.ExternalObjectNodeInfo = EB,
    A.ExternalObjectNodeInfoType = IB,
    A.ExternalScene = ey,
    A.FillClipPlane = _C,
    A.FillClipPlaneTool = Sp,
    A.FilterResultMode = Jc,
    A.FullScreen = Wh,
    A.GLTFLoader = OC,
    A.GeomUtil = Tu,
    A.GlobalData = vc,
    A.Group = ep,
    A.IDENTITYMATRIX3 = xc,
    A.IDENTITYMATRIX4 = Bc,
    A.ImageResources = Pd,
    A.IntersectHelper = fp,
    A.KDNode = Zu,
    A.LOADERROREVENTS = Tc,
    A.LightType = Fc,
    A.LineSegmentsEx = cf,
    A.Lobibox = bh,
    A.LogLevels = Ch,
    A.MarkObject = Hd,
    A.MaterialEx = ay,
    A.MaterialUtil = Kd,
    A.MeasureTool = Eg,
    A.MeasurementManager = mB,
    A.MeshEx = Kf,
    A.ModelType = Zc,
    A.MoveDirection = qc,
    A.NodeItemType = {
        SYMBOL: 0,
        MESH: 1,
        TUBE: 2,
        PIPE: 3,
        BOX: 4,
        BOX_M: 5,
        PIPE_M: 6,
        MESH_REF: 7,
        LINE: 8
    },
    A.NoiseTextureType = xd,
    A.NormalControl = Qg,
    A.OPSELECTIONTYPE = Kc,
    A.OrbitControl = Rg,
    A.PICKABLETYPE = Qc,
    A.PhongLightingMaterial = jC,
    A.PickControl = kg,
    A.PickHelper = kp,
    A.PickUtil = wg,
    A.PlaneMark = Vd,
    A.Plugins = SB,
    A.PostilObject = Jd,
    A.PrimitiveCount = {
        vertexCount: 0,
        triangleCount: 0
    },
    A.Raycaster = Dd,
    A.RectOpTool = Mg,
    A.RectPickTool = bg,
    A.RectZoomTool = Ug,
    A.Roam = tB,
    A.RoamManager = oB,
    A.RoamPlayer = iB,
    A.RotatePivotMode = kc,
    A.RotationOrders = Ic,
    A.SVGRect = tp,
    A.Scene = oy,
    A.SceneStateHelper = ny,
    A.SectionPlane = hB,
    A.SelectPad = Dg,
    A.Snapshot = Zd,
    A.SpriteMark = Gd,
    A.StorageCache = AC,
    A.THREE = MB,
    A.THREEEX = wB,
    A.ThreeMark = dB,
    A.Tool = yp,
    A.ToolBar = Xd,
    A.ToolMode = Pc,
    A.UI = xB,
    A.Utils = uh,
    A.Version = "4.18.0",
    A.ViewController = lp,
    A.Viewer = Py,
    A.ViewerImpl = Gy,
    A.WalkControl = Lg,
    A.WordPlaneMark = pB,
    A.ajax = _d,
    A.buildEdge = Up,
    A.createNoiseTexture = Fd,
    A.getFaceIndex = Fp,
    A.getScript = function(A, e) {
        var t = {};
        if (t[A])
            e && e();
        else {
            var i = document.createElement("script");
            i.type = "text/javascript",
            i.src = A,
            document.head.appendChild(i),
            t[A] = !0,
            i.readyState ? i.onreadystatechange = function() {
                "loaded" !== i.readyState && "complete" !== i.readyState || (i.onreadystatechange = null,
                e && e())
            }
            : i.onload = function() {
                e && e()
            }
        }
    }
    ,
    A.i18nMessage = fh,
    A.logger = Bh,
    A.message = jd,
    A.removeDuplicateIndex = Mp,
    A.removeDuplicateVertex = bp,
    A.standardView = Uc,
    Object.defineProperty(A, "__esModule", {
        value: !0
    })
}
));
//# sourceMappingURL=EIMMODEL.min.js.map
