@antv/g-canvas 1.0.0-alpha.21 → 1.0.0-alpha.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{es → dist}/Canvas2DContextService.d.ts +16 -16
- package/{lib → dist}/ContextRegisterPlugin.d.ts +6 -6
- package/{es → dist}/index.d.ts +4 -4
- package/dist/index.esm.js +461 -0
- package/dist/index.js +465 -0
- package/dist/index.umd.js +25414 -0
- package/dist/index.umd.min.js +118 -0
- package/{es → dist}/utils/browser.d.ts +1 -1
- package/{es → dist}/utils/dom.d.ts +1 -1
- package/package.json +10 -14
- package/es/Canvas2DContextService.js +0 -83
- package/es/ContextRegisterPlugin.d.ts +0 -6
- package/es/ContextRegisterPlugin.js +0 -26
- package/es/index.js +0 -35
- package/es/utils/browser.js +0 -1
- package/es/utils/dom.js +0 -8
- package/lib/Canvas2DContextService.d.ts +0 -16
- package/lib/Canvas2DContextService.js +0 -93
- package/lib/ContextRegisterPlugin.js +0 -36
- package/lib/index.d.ts +0 -4
- package/lib/index.js +0 -48
- package/lib/utils/browser.d.ts +0 -1
- package/lib/utils/browser.js +0 -8
- package/lib/utils/dom.d.ts +0 -1
- package/lib/utils/dom.js +0 -17
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("util")):"function"==typeof define&&define.amd?define(["exports","util"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).gCanvas={},t.util)}(this,(function(t,e){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r=n(e);function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),t}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=u(t);if(e){var i=u(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return l(this,n)}}var f={}.toString,d=function(t,e){return f.call(t)==="[object "+e+"]"},p=function(t){return d(t,"Function")},v=function(t){return null==t},y=function(t){return Array.isArray?Array.isArray(t):d(t,"Array")},g=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function m(t,e){if(t)if(y(t))for(var n=0,r=t.length;r>n&&!1!==e(t[n],n);n++);else if(g(t))for(var i in t)if(t.hasOwnProperty(i)&&!1===e(t[i],i))break}var b=function(t){return d(t,"String")};var w=function(t,e,n){return e>t?e:t>n?n:t},x=function(t){return d(t,"Number")},k=function(t){return d(t,"Boolean")};var E,T=function(t){return void 0===t},M="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function P(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return function(){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (C) Microsoft. All rights reserved.
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
5
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
6
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
|
|
8
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
9
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
10
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
11
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
12
|
+
|
|
13
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
14
|
+
and limitations under the License.
|
|
15
|
+
***************************************************************************** */()}},n.exports),n.exports}!function(t){!function(e){var n="object"==typeof M?M:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),r=i(t);function i(t,e){return function(n,r){"function"!=typeof t[n]&&Object.defineProperty(t,n,{configurable:!0,writable:!0,value:r}),e&&e(n,r)}}void 0===n.Reflect?n.Reflect=t:r=i(n.Reflect,r),function(t){var e=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,r=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,a={__proto__:[]}instanceof Array,s=!o&&!a,u={create:o?function(){return rt(Object.create(null))}:a?function(){return rt({__proto__:null})}:function(){return rt({})},has:s?function(t,n){return e.call(t,n)}:function(t,e){return e in t},get:s?function(t,n){return e.call(t,n)?t[n]:void 0}:function(t,e){return t[e]}},c=Object.getPrototypeOf(Function),l="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,h=l||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?tt():Map,f=l||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?et():Set,d=new(l||"function"!=typeof WeakMap?nt():WeakMap);function p(t,e,n,r){if(j(n)){if(!H(t))throw new TypeError;if(!X(e))throw new TypeError;return T(t,e)}if(!H(t))throw new TypeError;if(!F(e))throw new TypeError;if(!F(r)&&!j(r)&&!D(r))throw new TypeError;return D(r)&&(r=void 0),M(t,e,n=$(n),r)}function v(t,e){function n(n,r){if(!F(n))throw new TypeError;if(!j(r)&&!Y(r))throw new TypeError;R(t,e,n,r)}return n}function y(t,e,n,r){if(!F(n))throw new TypeError;return j(r)||(r=$(r)),R(t,e,n,r)}function g(t,e,n){if(!F(e))throw new TypeError;return j(n)||(n=$(n)),_(t,e,n)}function m(t,e,n){if(!F(e))throw new TypeError;return j(n)||(n=$(n)),S(t,e,n)}function b(t,e,n){if(!F(e))throw new TypeError;return j(n)||(n=$(n)),A(t,e,n)}function w(t,e,n){if(!F(e))throw new TypeError;return j(n)||(n=$(n)),C(t,e,n)}function x(t,e){if(!F(t))throw new TypeError;return j(e)||(e=$(e)),N(t,e)}function k(t,e){if(!F(t))throw new TypeError;return j(e)||(e=$(e)),O(t,e)}function E(t,e,n){if(!F(e))throw new TypeError;j(n)||(n=$(n));var r=P(e,n,!1);if(j(r))return!1;if(!r.delete(t))return!1;if(r.size>0)return!0;var i=d.get(e);return i.delete(n),i.size>0||d.delete(e),!0}function T(t,e){for(var n=t.length-1;n>=0;--n){var r=(0,t[n])(e);if(!j(r)&&!D(r)){if(!X(r))throw new TypeError;e=r}}return e}function M(t,e,n,r){for(var i=t.length-1;i>=0;--i){var o=(0,t[i])(e,n,r);if(!j(o)&&!D(o)){if(!F(o))throw new TypeError;r=o}}return r}function P(t,e,n){var r=d.get(t);if(j(r)){if(!n)return;r=new h,d.set(t,r)}var i=r.get(e);if(j(i)){if(!n)return;i=new h,r.set(e,i)}return i}function _(t,e,n){if(S(t,e,n))return!0;var r=J(e);return!D(r)&&_(t,r,n)}function S(t,e,n){var r=P(e,n,!1);return!j(r)&&G(r.has(t))}function A(t,e,n){if(S(t,e,n))return C(t,e,n);var r=J(e);return D(r)?void 0:A(t,r,n)}function C(t,e,n){var r=P(e,n,!1);if(!j(r))return r.get(t)}function R(t,e,n,r){P(n,r,!0).set(t,e)}function N(t,e){var n=O(t,e),r=J(t);if(null===r)return n;var i=N(r,e);if(0>=i.length)return n;if(0>=n.length)return i;for(var o=new f,a=[],s=0,u=n;u.length>s;s++){o.has(h=u[s])||(o.add(h),a.push(h))}for(var c=0,l=i;l.length>c;c++){var h;o.has(h=l[c])||(o.add(h),a.push(h))}return a}function O(t,e){var n=[],r=P(t,e,!1);if(j(r))return n;for(var i=U(r.keys()),o=0;;){var a=Z(i);if(!a)return n.length=o,n;var s=K(a);try{n[o]=s}catch(t){try{Q(i)}finally{throw t}}o++}}function I(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}function j(t){return void 0===t}function D(t){return null===t}function B(t){return"symbol"==typeof t}function F(t){return"object"==typeof t?null!==t:"function"==typeof t}function L(t,e){switch(I(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}var n=3===e?"string":5===e?"number":"default",i=z(t,r);if(void 0!==i){var o=i.call(t,n);if(F(o))throw new TypeError;return o}return W(t,"default"===n?"number":n)}function W(t,e){if("string"===e){var n=t.toString;if(V(n))if(!F(i=n.call(t)))return i;if(V(r=t.valueOf))if(!F(i=r.call(t)))return i}else{var r;if(V(r=t.valueOf))if(!F(i=r.call(t)))return i;var i,o=t.toString;if(V(o))if(!F(i=o.call(t)))return i}throw new TypeError}function G(t){return!!t}function q(t){return""+t}function $(t){var e=L(t,3);return B(e)?e:q(e)}function H(t){return Array.isArray?Array.isArray(t):t instanceof Object?t instanceof Array:"[object Array]"===Object.prototype.toString.call(t)}function V(t){return"function"==typeof t}function X(t){return"function"==typeof t}function Y(t){switch(I(t)){case 3:case 4:return!0;default:return!1}}function z(t,e){var n=t[e];if(null!=n){if(!V(n))throw new TypeError;return n}}function U(t){var e=z(t,i);if(!V(e))throw new TypeError;var n=e.call(t);if(!F(n))throw new TypeError;return n}function K(t){return t.value}function Z(t){var e=t.next();return!e.done&&e}function Q(t){var e=t.return;e&&e.call(t)}function J(t){var e=Object.getPrototypeOf(t);if("function"!=typeof t||t===c)return e;if(e!==c)return e;var n=t.prototype,r=n&&Object.getPrototypeOf(n);if(null==r||r===Object.prototype)return e;var i=r.constructor;return"function"!=typeof i||i===t?e:i}function tt(){var t={},e=[],n=function(){function t(t,e,n){this._index=0,this._keys=t,this._values=e,this._selector=n}return t.prototype["@@iterator"]=function(){return this},t.prototype[i]=function(){return this},t.prototype.next=function(){var t=this._index;if(t>=0&&this._keys.length>t){var n=this._selector(this._keys[t],this._values[t]);return this._keys.length>t+1?this._index++:(this._index=-1,this._keys=e,this._values=e),{value:n,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw 0>this._index||(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return 0>this._index||(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){var e=this._find(t,!1);return 0>e?void 0:this._values[e]},e.prototype.set=function(t,e){var n=this._find(t,!0);return this._values[n]=e,this},e.prototype.delete=function(e){var n=this._find(e,!1);if(n>=0){for(var r=this._keys.length,i=n+1;r>i;i++)this._keys[i-1]=this._keys[i],this._values[i-1]=this._values[i];return this._keys.length--,this._values.length--,e===this._cacheKey&&(this._cacheKey=t,this._cacheIndex=-2),!0}return!1},e.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=t,this._cacheIndex=-2},e.prototype.keys=function(){return new n(this._keys,this._values,r)},e.prototype.values=function(){return new n(this._keys,this._values,o)},e.prototype.entries=function(){return new n(this._keys,this._values,a)},e.prototype["@@iterator"]=function(){return this.entries()},e.prototype[i]=function(){return this.entries()},e.prototype._find=function(t,e){return this._cacheKey!==t&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=t)),0>this._cacheIndex&&e&&(this._cacheIndex=this._keys.length,this._keys.push(t),this._values.push(void 0)),this._cacheIndex},e}();function r(t,e){return t}function o(t,e){return e}function a(t,e){return[t,e]}}function et(){return function(){function t(){this._map=new h}return Object.defineProperty(t.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),t.prototype.has=function(t){return this._map.has(t)},t.prototype.add=function(t){return this._map.set(t,t),this},t.prototype.delete=function(t){return this._map.delete(t)},t.prototype.clear=function(){this._map.clear()},t.prototype.keys=function(){return this._map.keys()},t.prototype.values=function(){return this._map.values()},t.prototype.entries=function(){return this._map.entries()},t.prototype["@@iterator"]=function(){return this.keys()},t.prototype[i]=function(){return this.keys()},t}()}function nt(){var t=16,n=u.create(),r=i();return function(){function t(){this._key=i()}return t.prototype.has=function(t){var e=o(t,!1);return void 0!==e&&u.has(e,this._key)},t.prototype.get=function(t){var e=o(t,!1);return void 0!==e?u.get(e,this._key):void 0},t.prototype.set=function(t,e){return o(t,!0)[this._key]=e,this},t.prototype.delete=function(t){var e=o(t,!1);return void 0!==e&&delete e[this._key]},t.prototype.clear=function(){this._key=i()},t}();function i(){var t;do{t="@@WeakMap@@"+c()}while(u.has(n,t));return n[t]=!0,t}function o(t,n){if(!e.call(t,r)){if(!n)return;Object.defineProperty(t,r,{value:u.create()})}return t[r]}function a(t,e){for(var n=0;e>n;++n)t[n]=255*Math.random()|0;return t}function s(t){return"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(t)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(t)):a(new Uint8Array(t),t):a(Array(t),t)}function c(){var e=s(t);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var n="",r=0;t>r;++r){var i=e[r];4!==r&&6!==r&&8!==r||(n+="-"),16>i&&(n+="0"),n+=i.toString(16).toLowerCase()}return n}}function rt(t){return t.__=void 0,delete t.__,t}t("decorate",p),t("metadata",v),t("defineMetadata",y),t("hasMetadata",g),t("hasOwnMetadata",m),t("getMetadata",b),t("getOwnMetadata",w),t("getMetadataKeys",x),t("getOwnMetadataKeys",k),t("deleteMetadata",E)}(r)}()}(E||(E={}));var _="named",S="name",A="unmanaged",C="optional",R="inject",N="multi_inject",O="inversify:tagged",I="inversify:tagged_props",j="inversify:paramtypes",D="post_construct";var B=[R,N,S,A,_,C],F="Request",L="Singleton",W="Transient",G="ConstantValue",q="Constructor",$="DynamicValue",H="Factory",V="Function",X="Instance",Y="Invalid",z="Provider",U="ClassProperty",K="ConstructorArgument",Z="Variable",Q=0;function J(){return Q++}var tt=function(){function t(t,e){this.id=J(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Y,this.constraint=function(t){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.dynamicValue=null}return t.prototype.clone=function(){var e=new t(this.serviceIdentifier,this.scope);return e.activated=e.scope===L&&this.activated,e.implementationType=this.implementationType,e.dynamicValue=this.dynamicValue,e.scope=this.scope,e.type=this.type,e.factory=this.factory,e.provider=this.provider,e.constraint=this.constraint,e.onActivation=this.onActivation,e.cache=this.cache,e},t}(),et="NULL argument",nt="Key Not Found",rt="Ambiguous match found for serviceIdentifier:",it="No matching bindings found for serviceIdentifier:",ot=function(){function t(){}return t.prototype.getConstructorMetadata=function(t){return{compilerGeneratedMetadata:Reflect.getMetadata(j,t),userGeneratedMetadata:Reflect.getMetadata(O,t)||{}}},t.prototype.getPropertiesMetadata=function(t){return Reflect.getMetadata(I,t)||[]},t}(),at=2,st=0,ut=1;function ct(t){return t instanceof RangeError||"Maximum call stack size exceeded"===t.message}function lt(t){return"function"==typeof t?t.name:"symbol"==typeof t?""+t:t}function ht(t,e,n){var r="",i=n(t,e);return 0!==i.length&&(r="\nRegistered bindings:",i.forEach((function(t){var e="Object";null!==t.implementationType&&(e=pt(t.implementationType)),r=r+"\n "+e,t.constraint.metaData&&(r=r+" - "+t.constraint.metaData)}))),r}function ft(t,e){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===e||ft(t.parentRequest,e))}function dt(t){t.childRequests.forEach((function(t){if(ft(t,t.serviceIdentifier)){var e=function(t){return function t(e,n){void 0===n&&(n=[]);var r=lt(e.serviceIdentifier);return n.push(r),null!==e.parentRequest?t(e.parentRequest,n):n}(t).reverse().join(" --\x3e ")}(t);throw Error("Circular dependency found: "+e)}dt(t)}))}function pt(t){if(t.name)return t.name;var e=""+t,n=e.match(/^function\s*([^\s(]+)/);return n?n[1]:"Anonymous function: "+e}var vt=function(){function t(t){this.id=J(),this.container=t}return t.prototype.addPlan=function(t){this.plan=t},t.prototype.setCurrentRequest=function(t){this.currentRequest=t},t}(),yt=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return this.key===_?"named: "+this.value+" ":"tagged: { key:"+this.key+", value: "+this.value+" }"},t}(),gt=function(t,e){this.parentContext=t,this.rootRequest=e};function mt(t,e,n,r){wt("inversify:tagged",t,e,r,n)}function bt(t,e,n){wt("inversify:tagged_props",t.constructor,e,n)}function wt(t,e,n,r,i){var o={},a="number"==typeof i,s=void 0!==i&&a?""+i:n;if(a&&void 0!==n)throw Error("The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.");Reflect.hasOwnMetadata(t,e)&&(o=Reflect.getMetadata(t,e));var u=o[s];if(Array.isArray(u))for(var c=0,l=u;l.length>c;c++){var h=l[c];if(h.key===r.key)throw Error("Metadata key was used more than once in a parameter: "+h.key)}else u=[];u.push(r),o[s]=u,Reflect.defineMetadata(t,o,e)}function xt(t,e){Reflect.decorate(t,e)}function kt(t,e){return function(n,r){e(n,r,t)}}var Et=function(){function t(t){this._cb=t}return t.prototype.unwrap=function(){return this._cb()},t}();function Tt(t){return function(e,n,r){if(void 0===t)throw Error("@inject called with undefined this could mean that the class "+e.name+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation.");var i=new yt(R,t);"number"==typeof r?mt(e,n,r,i):bt(e,n,i)}}var Mt=function(){function t(t){this.str=t}return t.prototype.startsWith=function(t){return 0===this.str.indexOf(t)},t.prototype.endsWith=function(t){var e,n=t.split("").reverse().join("");return e=this.str.split("").reverse().join(""),this.startsWith.call({str:e},n)},t.prototype.contains=function(t){return-1!==this.str.indexOf(t)},t.prototype.equals=function(t){return this.str===t},t.prototype.value=function(){return this.str},t}(),Pt=function(){function t(t,e,n,r){this.id=J(),this.type=t,this.serviceIdentifier=n,this.name=new Mt(e||""),this.metadata=[];var i=null;"string"==typeof r?i=new yt(_,r):r instanceof yt&&(i=r),null!==i&&this.metadata.push(i)}return t.prototype.hasTag=function(t){for(var e=0,n=this.metadata;n.length>e;e++){if(n[e].key===t)return!0}return!1},t.prototype.isArray=function(){return this.hasTag(N)},t.prototype.matchesArray=function(t){return this.matchesTag(N)(t)},t.prototype.isNamed=function(){return this.hasTag(_)},t.prototype.isTagged=function(){return this.metadata.some((function(t){return B.every((function(e){return t.key!==e}))}))},t.prototype.isOptional=function(){return this.matchesTag(C)(!0)},t.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter((function(t){return t.key===_}))[0]:null},t.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter((function(t){return B.every((function(e){return t.key!==e}))})):null},t.prototype.matchesNamedTag=function(t){return this.matchesTag(_)(t)},t.prototype.matchesTag=function(t){var e=this;return function(n){for(var r=0,i=e.metadata;i.length>r;r++){var o=i[r];if(o.key===t&&o.value===n)return!0}return!1}},t}(),_t=function(t,e){for(var n=0,r=e.length,i=t.length;r>n;n++,i++)t[i]=e[n];return t};function St(t,e,n,r){var i=t.getConstructorMetadata(n),o=i.compilerGeneratedMetadata;if(void 0===o)throw Error("Missing required @injectable annotation in: "+e+".");var a=i.userGeneratedMetadata,s=Object.keys(a),u=function(t,e,n,r,i){for(var o=[],a=0;i>a;a++){var s=At(a,t,e,n,r);null!==s&&o.push(s)}return o}(r,e,o,a,0===n.length&&s.length>0||s.length>n.length?s.length:n.length),c=Ct(t,n);return _t(_t([],u),c)}function At(t,e,n,r,i){var o=i[""+t]||[],a=Nt(o),s=!0!==a.unmanaged,u=r[t],c=a.inject||a.multiInject;if((u=c||u)instanceof Et&&(u=u.unwrap()),s){if(!e&&(u===Object||u===Function||void 0===u))throw Error("Missing required @inject or @multiInject annotation in: argument "+t+" in class "+n+".");var l=new Pt(K,a.targetName,u);return l.metadata=o,l}return null}function Ct(t,e){for(var n=t.getPropertiesMetadata(e),r=[],i=0,o=Object.keys(n);o.length>i;i++){var a=o[i],s=n[a],u=Nt(n[a]),c=new Pt(U,u.targetName||a,u.inject||u.multiInject);c.metadata=s,r.push(c)}var l=Object.getPrototypeOf(e.prototype).constructor;if(l!==Object){var h=Ct(t,l);r=_t(_t([],r),h)}return r}function Rt(t,e){var n=Object.getPrototypeOf(e.prototype).constructor;if(n!==Object){var r=St(t,pt(n),n,!0),i=r.map((function(t){return t.metadata.filter((function(t){return t.key===A}))})),o=[].concat.apply([],i).length,a=r.length-o;return a>0?a:Rt(t,n)}return 0}function Nt(t){var e={};return t.forEach((function(t){e[""+t.key]=t.value})),{inject:e.inject,multiInject:e.multi_inject,targetName:e.name,unmanaged:e.unmanaged}}var Ot=function(){function t(t,e,n,r,i){this.id=J(),this.serviceIdentifier=t,this.parentContext=e,this.parentRequest=n,this.target=i,this.childRequests=[],this.bindings=Array.isArray(r)?r:[r],this.requestScope=null===n?new Map:null}return t.prototype.addChildRequest=function(e,n,r){var i=new t(e,this.parentContext,this,n,r);return this.childRequests.push(i),i},t}();function It(t){return t._bindingDictionary}function jt(t,e,n,r,i){var o=Bt(n.container,i.serviceIdentifier),a=[];return o.length===st&&n.container.options.autoBindInjectable&&"function"==typeof i.serviceIdentifier&&t.getConstructorMetadata(i.serviceIdentifier).compilerGeneratedMetadata&&(n.container.bind(i.serviceIdentifier).toSelf(),o=Bt(n.container,i.serviceIdentifier)),a=e?o:o.filter((function(t){var e=new Ot(t.serviceIdentifier,n,r,t,i);return t.constraint(e)})),function(t,e,n,r){switch(e.length){case st:if(n.isOptional())return e;var i=lt(t),o=it;throw o+=function(t,e){if(e.isTagged()||e.isNamed()){var n="",r=e.getNamedTag(),i=e.getCustomTags();return null!==r&&(n+=r+"\n"),null!==i&&i.forEach((function(t){n+=t+"\n"}))," "+t+"\n "+t+" - "+n}return" "+t}(i,n),o+=ht(r,i,Bt),Error(o);case ut:if(!n.isArray())return e;case at:default:if(n.isArray())return e;i=lt(t),o=rt+" "+i;throw o+=ht(r,i,Bt),Error(o)}}(i.serviceIdentifier,a,i,n.container),a}function Dt(t,e,n,r,i,o){var a,s;if(null===i){a=jt(t,e,r,null,o),s=new Ot(n,r,null,a,o);var u=new gt(r,s);r.addPlan(u)}else a=jt(t,e,r,i,o),s=i.addChildRequest(o.serviceIdentifier,a,o);a.forEach((function(e){var n=null;if(o.isArray())n=s.addChildRequest(e.serviceIdentifier,e,o);else{if(e.cache)return;n=s}if(e.type===X&&null!==e.implementationType){var i=function(t,e){return St(t,pt(e),e,!1)}(t,e.implementationType);if(!r.container.options.skipBaseClassChecks)if(Rt(t,e.implementationType)>i.length){var a=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return"The number of constructor arguments in the derived class "+t[0]+" must be >= than the number of constructor arguments of its base class."}(pt(e.implementationType));throw Error(a)}i.forEach((function(e){Dt(t,!1,e.serviceIdentifier,r,n,e)}))}}))}function Bt(t,e){var n=[],r=It(t);return r.hasKey(e)?n=r.get(e):null!==t.parent&&(n=Bt(t.parent,e)),n}function Ft(t,e,n,r,i,o,a,s){void 0===s&&(s=!1);var u=new vt(e),c=function(t,e,n,r,i,o){var a=new yt(t?N:R,n),s=new Pt(e,r,n,a);if(void 0!==i){var u=new yt(i,o);s.metadata.push(u)}return s}(n,r,i,"",o,a);try{return Dt(t,s,i,u,null,c),u}catch(t){throw ct(t)&&u.plan&&dt(u.plan.rootRequest),t}}var Lt=function(t,e){for(var n=0,r=e.length,i=t.length;r>n;n++,i++)t[i]=e[n];return t};function Wt(t,e,n){var r,i=null;if(e.length>0){var o=e.filter((function(t){return null!==t.target&&t.target.type===K})).map(n);i=function(t,e,n){var r=e.filter((function(t){return null!==t.target&&t.target.type===U})),i=r.map(n);return r.forEach((function(e,n){var r;r=e.target.name.value(),t[r]=i[n]})),t}(i=new((r=t).bind.apply(r,Lt([void 0],o))),e,n)}else i=new t;return function(t,e){if(Reflect.hasMetadata(D,t)){var n=Reflect.getMetadata(D,t);try{e[n.value]()}catch(e){throw Error(function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return"@postConstruct error in class "+t[0]+": "+t[1]}(t.name,e.message))}}}(t,i),i}var Gt=function(t,e,n){try{return n()}catch(n){throw ct(n)?Error(function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return"It looks like there is a circular dependency in one of the '"+t[0]+"' bindings. Please investigate bindings withservice identifier '"+t[1]+"'."}(t,""+e)):n}},qt=function(t){return function(e){e.parentContext.setCurrentRequest(e);var n=e.bindings,r=e.childRequests,i=e.target&&e.target.isArray(),o=!(e.parentRequest&&e.parentRequest.target&&e.target&&e.parentRequest.target.matchesArray(e.target.serviceIdentifier));if(i&&o)return r.map((function(e){return qt(t)(e)}));var a=null;if(!e.target.isOptional()||0!==n.length){var s=n[0],u=s.scope===L,c=s.scope===F;if(u&&s.activated)return s.cache;if(c&&null!==t&&t.has(s.id))return t.get(s.id);if(s.type===G)a=s.cache,s.activated=!0;else if(s.type===V)a=s.cache,s.activated=!0;else if(s.type===q)a=s.implementationType;else if(s.type===$&&null!==s.dynamicValue)a=Gt("toDynamicValue",s.serviceIdentifier,(function(){return s.dynamicValue(e.parentContext)}));else if(s.type===H&&null!==s.factory)a=Gt("toFactory",s.serviceIdentifier,(function(){return s.factory(e.parentContext)}));else if(s.type===z&&null!==s.provider)a=Gt("toProvider",s.serviceIdentifier,(function(){return s.provider(e.parentContext)}));else{if(s.type!==X||null===s.implementationType){var l=lt(e.serviceIdentifier);throw Error("Invalid binding type: "+l)}a=Wt(s.implementationType,r,qt(t))}return"function"==typeof s.onActivation&&(a=s.onActivation(e.parentContext,a)),u&&(s.cache=a,s.activated=!0),c&&null!==t&&!t.has(s.id)&&t.set(s.id,a),a}}};var $t=function(t,e){var n=t.parentRequest;return null!==n&&(!!e(n)||$t(n,e))},Ht=function(t){return function(e){var n=function(n){return null!==n&&null!==n.target&&n.target.matchesTag(t)(e)};return n.metaData=new yt(t,e),n}},Vt=Ht(_),Xt=function(t){return function(e){return null!==e&&("string"==typeof t?e.bindings[0].serviceIdentifier===t:t===e.bindings[0].implementationType)}},Yt=function(){function t(t){this._binding=t}return t.prototype.when=function(t){return this._binding.constraint=t,new zt(this._binding)},t.prototype.whenTargetNamed=function(t){return this._binding.constraint=Vt(t),new zt(this._binding)},t.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(t){return null!==t.target&&!t.target.isNamed()&&!t.target.isTagged()},new zt(this._binding)},t.prototype.whenTargetTagged=function(t,e){return this._binding.constraint=Ht(t)(e),new zt(this._binding)},t.prototype.whenInjectedInto=function(t){return this._binding.constraint=function(e){return Xt(t)(e.parentRequest)},new zt(this._binding)},t.prototype.whenParentNamed=function(t){return this._binding.constraint=function(e){return Vt(t)(e.parentRequest)},new zt(this._binding)},t.prototype.whenParentTagged=function(t,e){return this._binding.constraint=function(n){return Ht(t)(e)(n.parentRequest)},new zt(this._binding)},t.prototype.whenAnyAncestorIs=function(t){return this._binding.constraint=function(e){return $t(e,Xt(t))},new zt(this._binding)},t.prototype.whenNoAncestorIs=function(t){return this._binding.constraint=function(e){return!$t(e,Xt(t))},new zt(this._binding)},t.prototype.whenAnyAncestorNamed=function(t){return this._binding.constraint=function(e){return $t(e,Vt(t))},new zt(this._binding)},t.prototype.whenNoAncestorNamed=function(t){return this._binding.constraint=function(e){return!$t(e,Vt(t))},new zt(this._binding)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._binding.constraint=function(n){return $t(n,Ht(t)(e))},new zt(this._binding)},t.prototype.whenNoAncestorTagged=function(t,e){return this._binding.constraint=function(n){return!$t(n,Ht(t)(e))},new zt(this._binding)},t.prototype.whenAnyAncestorMatches=function(t){return this._binding.constraint=function(e){return $t(e,t)},new zt(this._binding)},t.prototype.whenNoAncestorMatches=function(t){return this._binding.constraint=function(e){return!$t(e,t)},new zt(this._binding)},t}(),zt=function(){function t(t){this._binding=t}return t.prototype.onActivation=function(t){return this._binding.onActivation=t,new Yt(this._binding)},t}(),Ut=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new Yt(this._binding),this._bindingOnSyntax=new zt(this._binding)}return t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}(),Kt=function(){function t(t){this._binding=t}return t.prototype.inRequestScope=function(){return this._binding.scope=F,new Ut(this._binding)},t.prototype.inSingletonScope=function(){return this._binding.scope=L,new Ut(this._binding)},t.prototype.inTransientScope=function(){return this._binding.scope=W,new Ut(this._binding)},t}(),Zt=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new Yt(this._binding),this._bindingOnSyntax=new zt(this._binding),this._bindingInSyntax=new Kt(t)}return t.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},t.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},t.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},t.prototype.when=function(t){return this._bindingWhenSyntax.when(t)},t.prototype.whenTargetNamed=function(t){return this._bindingWhenSyntax.whenTargetNamed(t)},t.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},t.prototype.whenTargetTagged=function(t,e){return this._bindingWhenSyntax.whenTargetTagged(t,e)},t.prototype.whenInjectedInto=function(t){return this._bindingWhenSyntax.whenInjectedInto(t)},t.prototype.whenParentNamed=function(t){return this._bindingWhenSyntax.whenParentNamed(t)},t.prototype.whenParentTagged=function(t,e){return this._bindingWhenSyntax.whenParentTagged(t,e)},t.prototype.whenAnyAncestorIs=function(t){return this._bindingWhenSyntax.whenAnyAncestorIs(t)},t.prototype.whenNoAncestorIs=function(t){return this._bindingWhenSyntax.whenNoAncestorIs(t)},t.prototype.whenAnyAncestorNamed=function(t){return this._bindingWhenSyntax.whenAnyAncestorNamed(t)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenAnyAncestorTagged(t,e)},t.prototype.whenNoAncestorNamed=function(t){return this._bindingWhenSyntax.whenNoAncestorNamed(t)},t.prototype.whenNoAncestorTagged=function(t,e){return this._bindingWhenSyntax.whenNoAncestorTagged(t,e)},t.prototype.whenAnyAncestorMatches=function(t){return this._bindingWhenSyntax.whenAnyAncestorMatches(t)},t.prototype.whenNoAncestorMatches=function(t){return this._bindingWhenSyntax.whenNoAncestorMatches(t)},t.prototype.onActivation=function(t){return this._bindingOnSyntax.onActivation(t)},t}(),Qt=function(){function t(t){this._binding=t}return t.prototype.to=function(t){return this._binding.type=X,this._binding.implementationType=t,new Zt(this._binding)},t.prototype.toSelf=function(){if("function"!=typeof this._binding.serviceIdentifier)throw Error("The toSelf function can only be applied when a constructor is used as service identifier");return this.to(this._binding.serviceIdentifier)},t.prototype.toConstantValue=function(t){return this._binding.type=G,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=L,new Ut(this._binding)},t.prototype.toDynamicValue=function(t){return this._binding.type=$,this._binding.cache=null,this._binding.dynamicValue=t,this._binding.implementationType=null,new Zt(this._binding)},t.prototype.toConstructor=function(t){return this._binding.type=q,this._binding.implementationType=t,this._binding.scope=L,new Ut(this._binding)},t.prototype.toFactory=function(t){return this._binding.type=H,this._binding.factory=t,this._binding.scope=L,new Ut(this._binding)},t.prototype.toFunction=function(t){if("function"!=typeof t)throw Error("Value provided to function binding must be a function!");var e=this.toConstantValue(t);return this._binding.type=V,this._binding.scope=L,e},t.prototype.toAutoFactory=function(t){return this._binding.type=H,this._binding.factory=function(e){return function(){return e.container.get(t)}},this._binding.scope=L,new Ut(this._binding)},t.prototype.toProvider=function(t){return this._binding.type=z,this._binding.provider=t,this._binding.scope=L,new Ut(this._binding)},t.prototype.toService=function(t){this.toDynamicValue((function(e){return e.container.get(t)}))},t}(),Jt=function(){function t(){}return t.of=function(e,n){var r=new t;return r.bindings=e,r.middleware=n,r},t}(),te=function(){function t(){this._map=new Map}return t.prototype.getMap=function(){return this._map},t.prototype.add=function(t,e){if(null==t)throw Error(et);if(null==e)throw Error(et);var n=this._map.get(t);void 0!==n?(n.push(e),this._map.set(t,n)):this._map.set(t,[e])},t.prototype.get=function(t){if(null==t)throw Error(et);var e=this._map.get(t);if(void 0!==e)return e;throw Error(nt)},t.prototype.remove=function(t){if(null==t)throw Error(et);if(!this._map.delete(t))throw Error(nt)},t.prototype.removeByCondition=function(t){var e=this;this._map.forEach((function(n,r){var i=n.filter((function(e){return!t(e)}));i.length>0?e._map.set(r,i):e._map.delete(r)}))},t.prototype.hasKey=function(t){if(null==t)throw Error(et);return this._map.has(t)},t.prototype.clone=function(){var e=new t;return this._map.forEach((function(t,n){t.forEach((function(t){return e.add(n,t.clone())}))})),e},t.prototype.traverse=function(t){this._map.forEach((function(e,n){t(n,e)}))},t}(),ee=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))},ne=function(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&i[3]>o[1])){a.label=o[1];break}if(6===o[0]&&i[1]>a.label){a.label=i[1],i=o;break}if(i&&i[2]>a.label){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=e.call(t,a)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},re=function(t,e){for(var n=0,r=e.length,i=t.length;r>n;n++,i++)t[i]=e[n];return t},ie=function(){function t(t){this._appliedMiddleware=[];var e=t||{};if("object"!=typeof e)throw Error("Invalid Container constructor argument. Container options must be an object.");if(void 0===e.defaultScope)e.defaultScope=W;else if(e.defaultScope!==L&&e.defaultScope!==W&&e.defaultScope!==F)throw Error("Invalid Container option. Default scope must be a string ('singleton' or 'transient').");if(void 0===e.autoBindInjectable)e.autoBindInjectable=!1;else if("boolean"!=typeof e.autoBindInjectable)throw Error("Invalid Container option. Auto bind injectable must be a boolean");if(void 0===e.skipBaseClassChecks)e.skipBaseClassChecks=!1;else if("boolean"!=typeof e.skipBaseClassChecks)throw Error("Invalid Container option. Skip base check must be a boolean");this.options={autoBindInjectable:e.autoBindInjectable,defaultScope:e.defaultScope,skipBaseClassChecks:e.skipBaseClassChecks},this.id=J(),this._bindingDictionary=new te,this._snapshots=[],this._middleware=null,this.parent=null,this._metadataReader=new ot}return t.merge=function(e,n){for(var r=[],i=2;arguments.length>i;i++)r[i-2]=arguments[i];var o=new t,a=re([e,n],r).map((function(t){return It(t)})),s=It(o);function u(t,e){t.traverse((function(t,n){n.forEach((function(t){e.add(t.serviceIdentifier,t.clone())}))}))}return a.forEach((function(t){u(t,s)})),o},t.prototype.load=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];for(var n=this._getContainerModuleHelpersFactory(),r=0,i=t;i.length>r;r++){var o=i[r],a=n(o.id);o.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction)}},t.prototype.loadAsync=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];return ee(this,void 0,void 0,(function(){var e,n,r,i,o;return ne(this,(function(a){switch(a.label){case 0:e=this._getContainerModuleHelpersFactory(),n=0,r=t,a.label=1;case 1:return r.length>n?(o=e((i=r[n]).id),[4,i.registry(o.bindFunction,o.unbindFunction,o.isboundFunction,o.rebindFunction)]):[3,4];case 2:a.sent(),a.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))},t.prototype.unload=function(){for(var t=this,e=[],n=0;arguments.length>n;n++)e[n]=arguments[n];var r=function(t){return function(e){return e.moduleId===t}};e.forEach((function(e){var n=r(e.id);t._bindingDictionary.removeByCondition(n)}))},t.prototype.bind=function(t){var e=new tt(t,this.options.defaultScope||W);return this._bindingDictionary.add(t,e),new Qt(e)},t.prototype.rebind=function(t){return this.unbind(t),this.bind(t)},t.prototype.unbind=function(t){try{this._bindingDictionary.remove(t)}catch(e){throw Error("Could not unbind serviceIdentifier: "+lt(t))}},t.prototype.unbindAll=function(){this._bindingDictionary=new te},t.prototype.isBound=function(t){var e=this._bindingDictionary.hasKey(t);return!e&&this.parent&&(e=this.parent.isBound(t)),e},t.prototype.isBoundNamed=function(t,e){return this.isBoundTagged(t,_,e)},t.prototype.isBoundTagged=function(t,e,n){var r=!1;if(this._bindingDictionary.hasKey(t)){var i=this._bindingDictionary.get(t),o=function(t,e,n,r){var i=new Pt(Z,"",e,new yt(n,r)),o=new vt(t);return new Ot(e,o,null,[],i)}(this,t,e,n);r=i.some((function(t){return t.constraint(o)}))}return!r&&this.parent&&(r=this.parent.isBoundTagged(t,e,n)),r},t.prototype.snapshot=function(){this._snapshots.push(Jt.of(this._bindingDictionary.clone(),this._middleware))},t.prototype.restore=function(){var t=this._snapshots.pop();if(void 0===t)throw Error("No snapshot available to restore.");this._bindingDictionary=t.bindings,this._middleware=t.middleware},t.prototype.createChild=function(e){var n=new t(e||this.options);return n.parent=this,n},t.prototype.applyMiddleware=function(){for(var t=[],e=0;arguments.length>e;e++)t[e]=arguments[e];this._appliedMiddleware=this._appliedMiddleware.concat(t);var n=this._middleware?this._middleware:this._planAndResolve();this._middleware=t.reduce((function(t,e){return e(t)}),n)},t.prototype.applyCustomMetadataReader=function(t){this._metadataReader=t},t.prototype.get=function(t){return this._get(!1,!1,Z,t)},t.prototype.getTagged=function(t,e,n){return this._get(!1,!1,Z,t,e,n)},t.prototype.getNamed=function(t,e){return this.getTagged(t,_,e)},t.prototype.getAll=function(t){return this._get(!0,!0,Z,t)},t.prototype.getAllTagged=function(t,e,n){return this._get(!1,!0,Z,t,e,n)},t.prototype.getAllNamed=function(t,e){return this.getAllTagged(t,_,e)},t.prototype.resolve=function(t){var e=this.createChild();return e.bind(t).toSelf(),this._appliedMiddleware.forEach((function(t){e.applyMiddleware(t)})),e.get(t)},t.prototype._getContainerModuleHelpersFactory=function(){var t=this,e=function(t,e){t._binding.moduleId=e},n=function(n){return function(r){var i=t.rebind.bind(t)(r);return e(i,n),i}};return function(r){return{bindFunction:(i=r,function(n){var r=t.bind.bind(t)(n);return e(r,i),r}),isboundFunction:function(e){return t.isBound.bind(t)(e)},rebindFunction:n(r),unbindFunction:function(e){t.unbind.bind(t)(e)}};var i}},t.prototype._get=function(t,e,n,r,i,o){var a=null,s={avoidConstraints:t,contextInterceptor:function(t){return t},isMultiInject:e,key:i,serviceIdentifier:r,targetType:n,value:o};if(this._middleware){if(null==(a=this._middleware(s)))throw Error("Invalid return type in middleware. Middleware must return!")}else a=this._planAndResolve()(s);return a},t.prototype._planAndResolve=function(){var t=this;return function(e){var n=Ft(t._metadataReader,t,e.isMultiInject,e.targetType,e.serviceIdentifier,e.key,e.value,e.avoidConstraints);return function(t){return qt(t.plan.rootRequest.requestScope)(t.plan.rootRequest)}(n=e.contextInterceptor(n))}},t}(),oe=function(t){this.id=J(),this.registry=t};function ae(){return function(t){if(Reflect.hasOwnMetadata(j,t))throw Error("Cannot apply @injectable decorator multiple times.");var e=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(j,e,t),t}}function se(t){return function(e,n,r){var i=new yt(_,t);"number"==typeof r?mt(e,n,r,i):bt(e,n,i)}}var ue=P((function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||t,a),u=n?n+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],s]:t._events[u].push(s):(t._events[u]=s,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},s.prototype.listeners=function(t){var e=this._events[n?n+t:t];if(!e)return[];if(e.fn)return[e.fn];for(var r=0,i=e.length,o=Array(i);i>r;r++)o[r]=e[r].fn;return o},s.prototype.listenerCount=function(t){var e=this._events[n?n+t:t];return e?e.fn?1:e.length:0},s.prototype.emit=function(t,e,r,i,o,a){var s=n?n+t:t;if(!this._events[s])return!1;var u,c,l=this._events[s],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,i),!0;case 5:return l.fn.call(l.context,e,r,i,o),!0;case 6:return l.fn.call(l.context,e,r,i,o,a),!0}for(c=1,u=Array(h-1);h>c;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var f,d=l.length;for(c=0;d>c;c++)switch(l[c].once&&this.removeListener(t,l[c].fn,void 0,!0),h){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,e);break;case 3:l[c].fn.call(l[c].context,e,r);break;case 4:l[c].fn.call(l[c].context,e,r,i);break;default:if(!u)for(f=1,u=Array(h-1);h>f;f++)u[f-1]=arguments[f];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},s.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},s.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==e||i&&!s.once||r&&s.context!==r||a(this,o);else{for(var u=0,c=[],l=s.length;l>u;u++)(s[u].fn!==e||i&&!s[u].once||r&&s[u].context!==r)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(t){var e;return t?this._events[e=n?n+t:t]&&a(this,e):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,t.exports=s}));function ce(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function le(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function he(t,e,n){return e&&le(t.prototype,e),n&&le(t,n),t}function fe(t){return(fe=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function de(t,e){return(de=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function pe(t,e){if(e&&("object"===i(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function ve(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=fe(t);if(e){var i=fe(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return pe(this,n)}}function ye(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);e>n;n++)r[n]=t[n];return r}function ge(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return ye(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ye(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return t.length>r?{done:!1,value:t[r++]}:{done:!0}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}
|
|
16
|
+
/*! *****************************************************************************
|
|
17
|
+
Copyright (c) Microsoft Corporation.
|
|
18
|
+
|
|
19
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
20
|
+
purpose with or without fee is hereby granted.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
23
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
24
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
25
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
26
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
27
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
28
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
29
|
+
***************************************************************************** */function me(t,e,n,r){var o,a=arguments.length,s=3>a?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(s=(3>a?o(s):a>3?o(e,n,s):o(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s}function be(t,e){if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var we,xe=function(){function t(){ce(this,t),this.count=0,this.freeList=[],this.objectFactory=void 0}return he(t,[{key:"init",value:function(t,e){this.objectFactory=t,void 0!==e&&this.expand(e)}},{key:"acquire",value:function(){return this.freeList.length>0||this.expand(Math.round(.2*this.count)+1),this.freeList.pop()}},{key:"release",value:function(t){t.reset(),this.freeList.push(t)}},{key:"expand",value:function(t){for(var e=0;t>e;e++){var n=this.objectFactory();this.freeList.push(n)}this.count+=t}}]),t}();xe=me([ae()],xe);var ke=0,Ee=we=function(){function t(){ce(this,t),this.pid=ke++}return he(t,[{key:"getId",value:function(){return this.pid}},{key:"copy",value:function(t){return Object.assign(this,t),this}},{key:"clone",value:function(){return(new we).copy(this)}},{key:"reset",value:function(){}},{key:"destroy",value:function(){}}]),t}();Ee=we=me([ae()],Ee);var Te="EventEmitter",Me="ComponentRegistry",Pe="ComponentPoolFactory",_e="EntityPoolFactory",Se="SystemRegistry",Ae="Created",Ce="Added",Re="Remove",Ne=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&de(t,e)}(n,t);var e=ve(n);function n(){var t;ce(this,n);for(var r=arguments.length,i=Array(r),o=0;r>o;o++)i[o]=arguments[o];return(t=e.call.apply(e,[this].concat(i))).componentPoolFactory=void 0,t.entities=[],t.entitiesByNames={},t.matcherCache={},t}return he(n,[{key:"getEntityByName",value:function(t){return this.entitiesByNames[t]}},{key:"getAllEntities",value:function(){return this.entities}},{key:"queryByMatcher",value:function(t){var e=t.hash();return this.matcherCache[e]||(this.matcherCache[e]=this.entities.filter((function(e){return t.matches(e)}))),this.matcherCache[e]}},{key:"createEntity",value:function(t){var e=t.getName();if(e){if(this.entitiesByNames[e])throw Error("Entity name '".concat(e,"' already exist"));this.entitiesByNames[e]=t}return this.entities.push(t),this.emit(Ae,t),t}},{key:"destroyEntity",value:function(t){t.getName()&&delete this.entitiesByNames[t.getName()];var e=this.entities.indexOf(t);e>-1&&this.entities.splice(e,1),this.matcherCache={}}},{key:"addComponentToEntity",value:function(t,e,n){var r=e.tag,i=t.getComponents(),o=i[r];if(o){if(!t.cast(o,e))throw Error('There are multiple classes with the same tag or name "'.concat(r,'".\nAdd a different property "tag" to one of them.'));delete i[r]}return o=this.componentPoolFactory(e).acquire(),n&&o.copy(n),i[r]=o,this.emit(Ce,t,o),this.matcherCache={},o}},{key:"removeComponentFromEntity",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.hasComponent(e)&&(this.emit(Re,t,e),n&&this.removeComponentFromEntitySync(t,e),this.matcherCache={})}},{key:"destroy",value:function(){this.entities=[],this.entitiesByNames={}}},{key:"removeComponentFromEntitySync",value:function(t,e){var n=t.getComponent(e);delete t.getComponents()[e.tag],n.destroy()}}]),n}(ue.EventEmitter);me([Tt(Pe),be("design:type",Function)],Ne.prototype,"componentPoolFactory",void 0),Ne=me([ae()],Ne);var Oe=0,Ie=function(){function t(){ce(this,t),this.id=Oe++,this.name=void 0,this.components={},this.entityManager=void 0}return he(t,[{key:"getId",value:function(){return this.id}},{key:"getComponents",value:function(){return this.components}},{key:"setName",value:function(t){this.name=t}},{key:"getName",value:function(){return this.name||"".concat(this.id)}},{key:"getComponent",value:function(t){return this.components[t.tag]}},{key:"hasComponent",value:function(t){return!!~Object.keys(this.components).indexOf(t.tag)}},{key:"hasAllComponents",value:function(t){var e=this;return t.every((function(t){return e.hasComponent(t)}))}},{key:"hasAnyComponents",value:function(t){var e=this;return t.some((function(t){return e.hasComponent(t)}))}},{key:"addComponent",value:function(t,e){return this.entityManager.addComponentToEntity(this,t,e)}},{key:"removeComponent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.entityManager.removeComponentFromEntity(this,t,e),this}},{key:"reset",value:function(){}},{key:"destroy",value:function(){this.entityManager.destroyEntity(this)}},{key:"cast",value:function(t,e){return!!(t&&t instanceof e)}}]),t}();me([Tt(Ne),be("design:type",Ne)],Ie.prototype,"entityManager",void 0),Ie=me([ae()],Ie);var je=function(){function t(){ce(this,t),this.registry=void 0}return he(t,[{key:"registerComponent",value:function(t){this.registry(t)}}]),t}();me([Tt(Me),be("design:type",Function)],je.prototype,"registry",void 0),je=me([ae()],je);var De=function(){function t(){ce(this,t),this.registry=void 0,this.entityManager=void 0,this.systems=[]}return he(t,[{key:"registerSystem",value:function(t){if(!this.registry.has(t)){this.registry.register(t);var e=this.registry.get(t),n=e.constructor;e.initialize?e.initialize():e.initialized=!0,this.entityManager.on(Ce,(function(t){e.onEntityAdded&&n.trigger&&n.trigger.matches(t)&&e.onEntityAdded(t)})),this.entityManager.on(Re,(function(t){e.onEntityRemoved&&n.trigger&&n.trigger.matches(t)&&e.onEntityRemoved(t)})),this.systems.push(e),this.systems.sort((function(t,e){return(t.constructor.priority||0)-(e.constructor.priority||0)}))}}},{key:"execute",value:function(t,e){var n,r=ge(this.systems);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.initialized&&i.execute&&i.execute(this.getEntities(i),t,e)}}catch(t){r.e(t)}finally{r.f()}}},{key:"destroy",value:function(){var t=this;this.systems.forEach((function(e){e.initialized&&e.tearDown&&e.tearDown(t.getEntities(e))}))}},{key:"getEntities",value:function(t){var e=t.constructor;return e.trigger?this.entityManager.queryByMatcher(e.trigger):this.entityManager.getAllEntities()}}]),t}();me([Tt(Se),be("design:type",Object)],De.prototype,"registry",void 0),me([Tt(Ne),be("design:type",Ne)],De.prototype,"entityManager",void 0),De=me([ae()],De);var Be=function(){function t(){ce(this,t),this.entityPoolFactory=void 0,this.entityManager=void 0,this.componentManager=void 0,this.systemManager=void 0,this.lastMillis=(new Date).getTime(),this.enabled=!0}return he(t,[{key:"createEntity",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=this.entityPoolFactory().acquire();return e.setName(t),this.entityManager.createEntity(e)}},{key:"getEntityByName",value:function(t){return this.entityManager.getEntityByName(t)}},{key:"registerComponent",value:function(t){return this.componentManager.registerComponent(t),this}},{key:"registerSystem",value:function(t){return this.systemManager.registerSystem(t),this}},{key:"execute",value:function(t,e){t||(t=(e=(new Date).getTime())-this.lastMillis,this.lastMillis=e),this.enabled&&this.systemManager.execute(t,e)}},{key:"stop",value:function(){this.enabled=!1}},{key:"resume",value:function(){this.enabled=!0}},{key:"destroy",value:function(){this.systemManager.destroy(),this.entityManager.destroy()}}]),t}();me([Tt(_e),be("design:type",Function)],Be.prototype,"entityPoolFactory",void 0),me([Tt(Ne),be("design:type",Ne)],Be.prototype,"entityManager",void 0),me([Tt(je),be("design:type",je)],Be.prototype,"componentManager",void 0),me([Tt(De),be("design:type",De)],Be.prototype,"systemManager",void 0),Be=me([ae()],Be);var Fe="System",Le=!1,We=new oe((function(t){var e,n,r;Le||(e=ae(),n=ue.EventEmitter,"number"==typeof r?xt([kt(r,e)],n):"string"==typeof r?Reflect.decorate([e],n,r):xt([e],n),t(Te).to(ue.EventEmitter),Le=!0),t(Me).toFactory((function(t){return function(e){t.container.isBound(e)||t.container.bind(e).toSelf()}})),t(Se).toDynamicValue((function(t){return{register:function(e){t.container.isBoundTagged(Fe,e.tag,e)||t.container.bind(Fe).to(e).inSingletonScope().whenTargetNamed(e.tag)},get:function(e){return t.container.getNamed(Fe,e.tag)},has:function(e){return t.container.isBoundNamed(Fe,e.tag)}}})),t(Pe).toFactory((function(t){var e={};return function(n){var r=e[n.tag];return r||((r=t.container.get(xe)).init((function(){if(!t.container.isBound(n))throw Error('Component "'.concat(n.tag,'" is not registered, please call registerComponent() first.'));return t.container.get(n)}),10),e[n.tag]=r),r}})),t(_e).toFactory((function(t){var e;return function(){return e||(e=t.container.get(xe)).init((function(){return t.container.get(Ie)}),10),e}})),t(Ne).toSelf().inSingletonScope(),t(je).toSelf().inSingletonScope(),t(De).toSelf().inSingletonScope(),t(Ie).toSelf(),t(xe).toSelf(),t(Be).toSelf().inSingletonScope()})),Ge=1e-6,qe="undefined"!=typeof Float32Array?Float32Array:Array,$e=Math.random;function He(){var t=new qe(9);return qe!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function Ve(){var t=new qe(16);return qe!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function Xe(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Ye(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function ze(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],l=e[8],h=e[9],f=e[10],d=e[11],p=e[12],v=e[13],y=e[14],g=e[15],m=n*s-r*a,b=n*u-i*a,w=n*c-o*a,x=r*u-i*s,k=r*c-o*s,E=i*c-o*u,T=l*v-h*p,M=l*y-f*p,P=l*g-d*p,_=h*y-f*v,S=h*g-d*v,A=f*g-d*y,C=m*A-b*S+w*_+x*P-k*M+E*T;return C?(t[0]=(s*A-u*S+c*_)*(C=1/C),t[1]=(i*S-r*A-o*_)*C,t[2]=(v*E-y*k+g*x)*C,t[3]=(f*k-h*E-d*x)*C,t[4]=(u*P-a*A-c*M)*C,t[5]=(n*A-i*P+o*M)*C,t[6]=(y*w-p*E-g*b)*C,t[7]=(l*E-f*w+d*b)*C,t[8]=(a*S-s*P+c*T)*C,t[9]=(r*P-n*S-o*T)*C,t[10]=(p*k-v*w+g*m)*C,t[11]=(h*w-l*k-d*m)*C,t[12]=(s*M-a*_-u*T)*C,t[13]=(n*_-r*M+i*T)*C,t[14]=(v*b-p*x-y*m)*C,t[15]=(l*x-h*b+f*m)*C,t):null}function Ue(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],h=e[8],f=e[9],d=e[10],p=e[11],v=e[12],y=e[13],g=e[14],m=e[15],b=n[0],w=n[1],x=n[2],k=n[3];return t[0]=b*r+w*s+x*h+k*v,t[1]=b*i+w*u+x*f+k*y,t[2]=b*o+w*c+x*d+k*g,t[3]=b*a+w*l+x*p+k*m,t[4]=(b=n[4])*r+(w=n[5])*s+(x=n[6])*h+(k=n[7])*v,t[5]=b*i+w*u+x*f+k*y,t[6]=b*o+w*c+x*d+k*g,t[7]=b*a+w*l+x*p+k*m,t[8]=(b=n[8])*r+(w=n[9])*s+(x=n[10])*h+(k=n[11])*v,t[9]=b*i+w*u+x*f+k*y,t[10]=b*o+w*c+x*d+k*g,t[11]=b*a+w*l+x*p+k*m,t[12]=(b=n[12])*r+(w=n[13])*s+(x=n[14])*h+(k=n[15])*v,t[13]=b*i+w*u+x*f+k*y,t[14]=b*o+w*c+x*d+k*g,t[15]=b*a+w*l+x*p+k*m,t}function Ke(t,e,n){var r,i,o,a,s,u,c,l,h,f,d,p,v=n[0],y=n[1],g=n[2];return e===t?(t[12]=e[0]*v+e[4]*y+e[8]*g+e[12],t[13]=e[1]*v+e[5]*y+e[9]*g+e[13],t[14]=e[2]*v+e[6]*y+e[10]*g+e[14],t[15]=e[3]*v+e[7]*y+e[11]*g+e[15]):(i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],h=e[8],f=e[9],d=e[10],p=e[11],t[0]=r=e[0],t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=u,t[6]=c,t[7]=l,t[8]=h,t[9]=f,t[10]=d,t[11]=p,t[12]=r*v+s*y+h*g+e[12],t[13]=i*v+u*y+f*g+e[13],t[14]=o*v+c*y+d*g+e[14],t[15]=a*v+l*y+p*g+e[15]),t}function Ze(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function Qe(t,e){var n=e[4],r=e[5],i=e[6],o=e[8],a=e[9],s=e[10];return t[0]=Math.hypot(e[0],e[1],e[2]),t[1]=Math.hypot(n,r,i),t[2]=Math.hypot(o,a,s),t}function Je(t,e){var n=new qe(3);Qe(n,e);var r=1/n[0],i=1/n[1],o=1/n[2],a=e[0]*r,s=e[1]*i,u=e[2]*o,c=e[4]*r,l=e[5]*i,h=e[6]*o,f=e[8]*r,d=e[9]*i,p=e[10]*o,v=a+l+p,y=0;return v>0?(t[3]=.25*(y=2*Math.sqrt(v+1)),t[0]=(h-d)/y,t[1]=(f-u)/y,t[2]=(s-c)/y):a>l&&a>p?(t[3]=(h-d)/(y=2*Math.sqrt(1+a-l-p)),t[0]=.25*y,t[1]=(s+c)/y,t[2]=(f+u)/y):l>p?(t[3]=(f-u)/(y=2*Math.sqrt(1+l-a-p)),t[0]=(s+c)/y,t[1]=.25*y,t[2]=(h+d)/y):(t[3]=(s-c)/(y=2*Math.sqrt(1+p-a-l)),t[0]=(f+u)/y,t[1]=(h+d)/y,t[2]=.25*y),t}function tn(t,e,n,r,i){var o=e[0],a=e[1],s=e[2],u=e[3],c=o+o,l=a+a,h=s+s,f=o*c,d=o*l,p=o*h,v=a*l,y=a*h,g=s*h,m=u*c,b=u*l,w=u*h,x=r[0],k=r[1],E=r[2],T=i[0],M=i[1],P=i[2],_=(1-(v+g))*x,S=(d+w)*x,A=(p-b)*x,C=(d-w)*k,R=(1-(f+g))*k,N=(y+m)*k,O=(p+b)*E,I=(y-m)*E,j=(1-(f+v))*E;return t[0]=_,t[1]=S,t[2]=A,t[3]=0,t[4]=C,t[5]=R,t[6]=N,t[7]=0,t[8]=O,t[9]=I,t[10]=j,t[11]=0,t[12]=n[0]+T-(_*T+C*M+O*P),t[13]=n[1]+M-(S*T+R*M+I*P),t[14]=n[2]+P-(A*T+N*M+j*P),t[15]=1,t}function en(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n+n,s=r+r,u=i+i,c=n*a,l=r*a,h=r*s,f=i*a,d=i*s,p=i*u,v=o*a,y=o*s,g=o*u;return t[0]=1-h-p,t[1]=l+g,t[2]=f-y,t[3]=0,t[4]=l-g,t[5]=1-c-p,t[6]=d+v,t[7]=0,t[8]=f+y,t[9]=d-v,t[10]=1-c-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function nn(){var t=new qe(3);return qe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function rn(t){var e=new qe(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function on(t){return Math.hypot(t[0],t[1],t[2])}function an(t,e,n){var r=new qe(3);return r[0]=t,r[1]=e,r[2]=n,r}function sn(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function un(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function cn(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function ln(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function hn(t,e,n){return t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2],t}function fn(t,e,n){return t[0]=e[0]/n[0],t[1]=e[1]/n[1],t[2]=e[2]/n[2],t}function dn(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t}function pn(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t}function vn(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function yn(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2])}function gn(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i}function mn(t){var e=t[0],n=t[1],r=t[2];return e*e+n*n+r*r}function bn(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function wn(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function xn(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[0],s=n[1],u=n[2];return t[0]=i*u-o*s,t[1]=o*a-r*u,t[2]=r*s-i*a,t}function kn(t,e,n,r){var i=e[0],o=e[1],a=e[2];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=a+r*(n[2]-a),t}function En(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[3]*r+n[7]*i+n[11]*o+n[15];return t[0]=(n[0]*r+n[4]*i+n[8]*o+n[12])/(a=a||1),t[1]=(n[1]*r+n[5]*i+n[9]*o+n[13])/a,t[2]=(n[2]*r+n[6]*i+n[10]*o+n[14])/a,t}function Tn(t,e,n){var r=e[0],i=e[1],o=e[2];return t[0]=r*n[0]+i*n[3]+o*n[6],t[1]=r*n[1]+i*n[4]+o*n[7],t[2]=r*n[2]+i*n[5]+o*n[8],t}function Mn(t,e,n){var r=n[0],i=n[1],o=n[2],a=e[0],s=e[1],u=e[2],c=i*u-o*s,l=o*a-r*u,h=r*s-i*a,f=i*h-o*l,d=o*c-r*h,p=r*l-i*c,v=2*n[3];return l*=v,h*=v,d*=2,p*=2,t[0]=a+(c*=v)+(f*=2),t[1]=s+l+d,t[2]=u+h+p,t}function Pn(t,e){var n=t[0],r=t[1],i=t[2],o=e[0],a=e[1],s=e[2];return Ge*Math.max(1,Math.abs(n),Math.abs(o))>=Math.abs(n-o)&&Ge*Math.max(1,Math.abs(r),Math.abs(a))>=Math.abs(r-a)&&Ge*Math.max(1,Math.abs(i),Math.abs(s))>=Math.abs(i-s)}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var _n,Sn=ln,An=hn,Cn=fn,Rn=yn,Nn=gn,On=on,In=mn,jn=(_n=nn(),function(t,e,n,r,i,o){var a,s;for(e||(e=3),n||(n=0),s=r?Math.min(r*e+n,t.length):t.length,a=n;s>a;a+=e)_n[0]=t[a],_n[1]=t[a+1],_n[2]=t[a+2],i(_n,_n,o),t[a]=_n[0],t[a+1]=_n[1],t[a+2]=_n[2];return t}),Dn=Object.freeze({__proto__:null,create:nn,clone:rn,length:on,fromValues:an,copy:sn,set:un,add:cn,subtract:ln,multiply:hn,divide:fn,ceil:function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},floor:function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},min:dn,max:pn,round:function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},scale:vn,scaleAndAdd:function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t},distance:yn,squaredDistance:gn,squaredLength:mn,negate:function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},inverse:function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},normalize:bn,dot:wn,cross:xn,lerp:kn,hermite:function(t,e,n,r,i,o){var a=o*o,s=a*(2*o-3)+1,u=a*(o-2)+o,c=a*(o-1),l=a*(3-2*o);return t[0]=e[0]*s+n[0]*u+r[0]*c+i[0]*l,t[1]=e[1]*s+n[1]*u+r[1]*c+i[1]*l,t[2]=e[2]*s+n[2]*u+r[2]*c+i[2]*l,t},bezier:function(t,e,n,r,i,o){var a=1-o,s=a*a,u=o*o,c=s*a,l=3*o*s,h=3*u*a,f=u*o;return t[0]=e[0]*c+n[0]*l+r[0]*h+i[0]*f,t[1]=e[1]*c+n[1]*l+r[1]*h+i[1]*f,t[2]=e[2]*c+n[2]*l+r[2]*h+i[2]*f,t},random:function(t,e){e=e||1;var n=2*$e()*Math.PI,r=2*$e()-1,i=Math.sqrt(1-r*r)*e;return t[0]=Math.cos(n)*i,t[1]=Math.sin(n)*i,t[2]=r*e,t},transformMat4:En,transformMat3:Tn,transformQuat:Mn,rotateX:function(t,e,n,r){var i=[],o=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[0],o[1]=i[1]*Math.cos(r)-i[2]*Math.sin(r),o[2]=i[1]*Math.sin(r)+i[2]*Math.cos(r),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},rotateY:function(t,e,n,r){var i=[],o=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[2]*Math.sin(r)+i[0]*Math.cos(r),o[1]=i[1],o[2]=i[2]*Math.cos(r)-i[0]*Math.sin(r),t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},rotateZ:function(t,e,n,r){var i=[],o=[];return i[0]=e[0]-n[0],i[1]=e[1]-n[1],i[2]=e[2]-n[2],o[0]=i[0]*Math.cos(r)-i[1]*Math.sin(r),o[1]=i[0]*Math.sin(r)+i[1]*Math.cos(r),o[2]=i[2],t[0]=o[0]+n[0],t[1]=o[1]+n[1],t[2]=o[2]+n[2],t},angle:function(t,e){var n=t[0],r=t[1],i=t[2],o=e[0],a=e[1],s=e[2],u=Math.sqrt(n*n+r*r+i*i)*Math.sqrt(o*o+a*a+s*s),c=u&&wn(t,e)/u;return Math.acos(Math.min(Math.max(c,-1),1))},zero:function(t){return t[0]=0,t[1]=0,t[2]=0,t},str:function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},exactEquals:function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},equals:Pn,sub:Sn,mul:An,div:Cn,dist:Rn,sqrDist:Nn,len:On,sqrLen:In,forEach:jn});function Bn(){var t=new qe(4);return qe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Fn(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*a,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*a,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*a,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*a,t}!function(){var t=Bn()}();function Ln(){var t=new qe(4);return qe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Wn(t,e,n){var r=Math.sin(n*=.5);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function Gn(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=n[0],u=n[1],c=n[2],l=n[3];return t[0]=r*l+a*s+i*c-o*u,t[1]=i*l+a*u+o*s-r*c,t[2]=o*l+a*c+r*u-i*s,t[3]=a*l-r*s-i*u-o*c,t}function qn(t,e,n,r){var i,o,a,s,u,c=e[0],l=e[1],h=e[2],f=e[3],d=n[0],p=n[1],v=n[2],y=n[3];return 0>(o=c*d+l*p+h*v+f*y)&&(o=-o,d=-d,p=-p,v=-v,y=-y),1-o>Ge?(a=Math.sin(i=Math.acos(o)),s=Math.sin((1-r)*i)/a,u=Math.sin(r*i)/a):(s=1-r,u=r),t[0]=s*c+u*d,t[1]=s*l+u*p,t[2]=s*h+u*v,t[3]=s*f+u*y,t}function $n(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o,s=a?1/a:0;return t[0]=-n*s,t[1]=-r*s,t[2]=-i*s,t[3]=o*s,t}function Hn(t,e,n,r){var i=.5*Math.PI/180;n*=i,r*=i;var o=Math.sin(e*=i),a=Math.cos(e),s=Math.sin(n),u=Math.cos(n),c=Math.sin(r),l=Math.cos(r);return t[0]=o*u*l-a*s*c,t[1]=a*s*l+o*u*c,t[2]=a*u*c-o*s*l,t[3]=a*u*l+o*s*c,t}var Vn,Xn,Yn,zn,Un,Kn,Zn=function(t,e,n,r){var i=new qe(4);return i[0]=t,i[1]=e,i[2]=n,i[3]=r,i},Qn=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},Jn=Gn,tr=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=r*a,t[2]=i*a,t[3]=o*a,t};Vn=nn(),Xn=an(1,0,0),Yn=an(0,1,0),zn=Ln(),Un=Ln(),Kn=He();const er=r.default.deprecate((()=>{}),"Hook.context is deprecated and will be removed"),nr=function(...t){return this.call=this._createCall("sync"),this.call(...t)},rr=function(...t){return this.callAsync=this._createCall("async"),this.callAsync(...t)},ir=function(...t){return this.promise=this._createCall("promise"),this.promise(...t)};class or{constructor(t=[],e){this._args=t,this.name=e,this.taps=[],this.interceptors=[],this._call=nr,this.call=nr,this._callAsync=rr,this.callAsync=rr,this._promise=ir,this.promise=ir,this._x=void 0,this.compile=this.compile,this.tap=this.tap,this.tapAsync=this.tapAsync,this.tapPromise=this.tapPromise}compile(t){throw Error("Abstract: should be overridden")}_createCall(t){return this.compile({taps:this.taps,interceptors:this.interceptors,args:this._args,type:t})}_tap(t,e,n){if("string"==typeof e)e={name:e.trim()};else if("object"!=typeof e||null===e)throw Error("Invalid tap options");if("string"!=typeof e.name||""===e.name)throw Error("Missing name for tap");void 0!==e.context&&er(),e=Object.assign({type:t,fn:n},e),e=this._runRegisterInterceptors(e),this._insert(e)}tap(t,e){this._tap("sync",t,e)}tapAsync(t,e){this._tap("async",t,e)}tapPromise(t,e){this._tap("promise",t,e)}_runRegisterInterceptors(t){for(const e of this.interceptors)if(e.register){const n=e.register(t);void 0!==n&&(t=n)}return t}withOptions(t){const e=e=>Object.assign({},t,"string"==typeof e?{name:e}:e);return{name:this.name,tap:(t,n)=>this.tap(e(t),n),tapAsync:(t,n)=>this.tapAsync(e(t),n),tapPromise:(t,n)=>this.tapPromise(e(t),n),intercept:t=>this.intercept(t),isUsed:()=>this.isUsed(),withOptions:t=>this.withOptions(e(t))}}isUsed(){return this.taps.length>0||this.interceptors.length>0}intercept(t){if(this._resetCompilation(),this.interceptors.push(Object.assign({},t)),t.register)for(let e=0;this.taps.length>e;e++)this.taps[e]=t.register(this.taps[e])}_resetCompilation(){this.call=this._call,this.callAsync=this._callAsync,this.promise=this._promise}_insert(t){let e;this._resetCompilation(),"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let n=0;"number"==typeof t.stage&&(n=t.stage);let r=this.taps.length;for(;r>0;){r--;const t=this.taps[r];this.taps[r+1]=t;const i=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(n>=i){r++;break}}this.taps[r]=t}}Object.setPrototypeOf(or.prototype,null);var ar=or;var sr=class{constructor(t){this.config=t,this.options=void 0,this._args=void 0}create(t){let e;switch(this.init(t),this.options.type){case"sync":e=Function(this.args(),'"use strict";\n'+this.header()+this.contentWithInterceptors({onError:t=>`throw ${t};\n`,onResult:t=>`return ${t};\n`,resultReturns:!0,onDone:()=>"",rethrowIfPossible:!0}));break;case"async":e=Function(this.args({after:"_callback"}),'"use strict";\n'+this.header()+this.contentWithInterceptors({onError:t=>`_callback(${t});\n`,onResult:t=>`_callback(null, ${t});\n`,onDone:()=>"_callback();\n"}));break;case"promise":let t=!1;const n=this.contentWithInterceptors({onError:e=>(t=!0,`_error(${e});\n`),onResult:t=>`_resolve(${t});\n`,onDone:()=>"_resolve();\n"});let r="";r+='"use strict";\n',r+=this.header(),r+="return new Promise((function(_resolve, _reject) {\n",t&&(r+="var _sync = true;\n",r+="function _error(_err) {\n",r+="if(_sync)\n",r+="_resolve(Promise.resolve().then((function() { throw _err; })));\n",r+="else\n",r+="_reject(_err);\n",r+="};\n"),r+=n,t&&(r+="_sync = false;\n"),r+="}));\n",e=Function(this.args(),r)}return this.deinit(),e}setup(t,e){t._x=e.taps.map((t=>t.fn))}init(t){this.options=t,this._args=t.args.slice()}deinit(){this.options=void 0,this._args=void 0}contentWithInterceptors(t){if(this.options.interceptors.length>0){const e=t.onError,n=t.onResult,r=t.onDone;let i="";for(let t=0;this.options.interceptors.length>t;t++){const e=this.options.interceptors[t];e.call&&(i+=`${this.getInterceptor(t)}.call(${this.args({before:e.context?"_context":void 0})});\n`)}return i+=this.content(Object.assign(t,{onError:e&&(t=>{let n="";for(let e=0;this.options.interceptors.length>e;e++){this.options.interceptors[e].error&&(n+=`${this.getInterceptor(e)}.error(${t});\n`)}return n+=e(t),n}),onResult:n&&(t=>{let e="";for(let n=0;this.options.interceptors.length>n;n++){this.options.interceptors[n].result&&(e+=`${this.getInterceptor(n)}.result(${t});\n`)}return e+=n(t),e}),onDone:r&&(()=>{let t="";for(let e=0;this.options.interceptors.length>e;e++){this.options.interceptors[e].done&&(t+=this.getInterceptor(e)+".done();\n")}return t+=r(),t})})),i}return this.content(t)}header(){let t="";return this.needContext()?t+="var _context = {};\n":t+="var _context;\n",t+="var _x = this._x;\n",this.options.interceptors.length>0&&(t+="var _taps = this.taps;\n",t+="var _interceptors = this.interceptors;\n"),t}needContext(){for(const t of this.options.taps)if(t.context)return!0;return!1}callTap(t,{onError:e,onResult:n,onDone:r,rethrowIfPossible:i}){let o="",a=!1;for(let e=0;this.options.interceptors.length>e;e++){const n=this.options.interceptors[e];n.tap&&(a||(o+=`var _tap${t} = ${this.getTap(t)};\n`,a=!0),o+=`${this.getInterceptor(e)}.tap(${n.context?"_context, ":""}_tap${t});\n`)}o+=`var _fn${t} = ${this.getTapFn(t)};\n`;const s=this.options.taps[t];switch(s.type){case"sync":i||(o+=`var _hasError${t} = false;\n`,o+="try {\n"),o+=n?`var _result${t} = _fn${t}(${this.args({before:s.context?"_context":void 0})});\n`:`_fn${t}(${this.args({before:s.context?"_context":void 0})});\n`,i||(o+="} catch(_err) {\n",o+=`_hasError${t} = true;\n`,o+=e("_err"),o+="}\n",o+=`if(!_hasError${t}) {\n`),n&&(o+=n("_result"+t)),r&&(o+=r()),i||(o+="}\n");break;case"async":let a="";a+=n?`(function(_err${t}, _result${t}) {\n`:`(function(_err${t}) {\n`,a+=`if(_err${t}) {\n`,a+=e("_err"+t),a+="} else {\n",n&&(a+=n("_result"+t)),r&&(a+=r()),a+="}\n",a+="})",o+=`_fn${t}(${this.args({before:s.context?"_context":void 0,after:a})});\n`;break;case"promise":o+=`var _hasResult${t} = false;\n`,o+=`var _promise${t} = _fn${t}(${this.args({before:s.context?"_context":void 0})});\n`,o+=`if (!_promise${t} || !_promise${t}.then)\n`,o+=` throw new Error('Tap function (tapPromise) did not return promise (returned ' + _promise${t} + ')');\n`,o+=`_promise${t}.then((function(_result${t}) {\n`,o+=`_hasResult${t} = true;\n`,n&&(o+=n("_result"+t)),r&&(o+=r()),o+=`}), function(_err${t}) {\n`,o+=`if(_hasResult${t}) throw _err${t};\n`,o+=e("_err"+t),o+="});\n"}return o}callTapsSeries({onError:t,onResult:e,resultReturns:n,onDone:r,doneReturns:i,rethrowIfPossible:o}){if(0===this.options.taps.length)return r();const a=this.options.taps.findIndex((t=>"sync"!==t.type)),s=n||i;let u="",c=r,l=0;for(let n=this.options.taps.length-1;n>=0;n--){const i=n;c!==r&&("sync"!==this.options.taps[i].type||l++>20)&&(l=0,u+=`function _next${i}() {\n`,u+=c(),u+="}\n",c=()=>`${s?"return ":""}_next${i}();\n`);const h=c,f=t=>t?"":r(),d=this.callTap(i,{onError:e=>t(i,e,h,f),onResult:e&&(t=>e(i,t,h,f)),onDone:!e&&h,rethrowIfPossible:o&&(0>a||a>i)});c=()=>d}return u+=c(),u}callTapsLooping({onError:t,onDone:e,rethrowIfPossible:n}){if(0===this.options.taps.length)return e();const r=this.options.taps.every((t=>"sync"===t.type));let i="";r||(i+="var _looper = (function() {\n",i+="var _loopAsync = false;\n"),i+="var _loop;\n",i+="do {\n",i+="_loop = false;\n";for(let t=0;this.options.interceptors.length>t;t++){const e=this.options.interceptors[t];e.loop&&(i+=`${this.getInterceptor(t)}.loop(${this.args({before:e.context?"_context":void 0})});\n`)}return i+=this.callTapsSeries({onError:t,onResult:(t,e,n,i)=>{let o="";return o+=`if(${e} !== undefined) {\n`,o+="_loop = true;\n",r||(o+="if(_loopAsync) _looper();\n"),o+=i(!0),o+="} else {\n",o+=n(),o+="}\n",o},onDone:e&&(()=>{let t="";return t+="if(!_loop) {\n",t+=e(),t+="}\n",t}),rethrowIfPossible:n&&r}),i+="} while(_loop);\n",r||(i+="_loopAsync = true;\n",i+="});\n",i+="_looper();\n"),i}callTapsParallel({onError:t,onResult:e,onDone:n,rethrowIfPossible:r,onTap:i=((t,e)=>e())}){if(1>=this.options.taps.length)return this.callTapsSeries({onError:t,onResult:e,onDone:n,rethrowIfPossible:r});let o="";o+="do {\n",o+=`var _counter = ${this.options.taps.length};\n`,n&&(o+="var _done = (function() {\n",o+=n(),o+="});\n");for(let a=0;this.options.taps.length>a;a++){const s=()=>n?"if(--_counter === 0) _done();\n":"--_counter;",u=t=>t||!n?"_counter = 0;\n":"_counter = 0;\n_done();\n";o+="if(_counter <= 0) break;\n",o+=i(a,(()=>this.callTap(a,{onError:e=>{let n="";return n+="if(_counter > 0) {\n",n+=t(a,e,s,u),n+="}\n",n},onResult:e&&(t=>{let n="";return n+="if(_counter > 0) {\n",n+=e(a,t,s,u),n+="}\n",n}),onDone:!e&&(()=>s()),rethrowIfPossible:r})),s,u)}return o+="} while(false);\n",o}args({before:t,after:e}={}){let n=this._args;return t&&(n=[t].concat(n)),e&&(n=n.concat(e)),0===n.length?"":n.join(", ")}getTapFn(t){return`_x[${t}]`}getTap(t){return`_taps[${t}]`}getInterceptor(t){return`_interceptors[${t}]`}};const ur=new class extends sr{content({onError:t,onDone:e,rethrowIfPossible:n}){return this.callTapsSeries({onError:(e,n)=>t(n),onDone:e,rethrowIfPossible:n})}},cr=()=>{throw Error("tapAsync is not supported on a SyncHook")},lr=()=>{throw Error("tapPromise is not supported on a SyncHook")},hr=function(t){return ur.setup(this,t),ur.create(t)};function fr(t=[],e){const n=new ar(t,e);return n.constructor=fr,n.tapAsync=cr,n.tapPromise=lr,n.compile=hr,n}fr.prototype=null;var dr=fr;const pr=new class extends sr{content({onError:t,onResult:e,resultReturns:n,onDone:r,rethrowIfPossible:i}){return this.callTapsSeries({onError:(e,n)=>t(n),onResult:(t,n,r)=>`if(${n} !== undefined) {\n${e(n)};\n} else {\n${r()}}\n`,resultReturns:n,onDone:r,rethrowIfPossible:i})}},vr=()=>{throw Error("tapAsync is not supported on a SyncBailHook")},yr=()=>{throw Error("tapPromise is not supported on a SyncBailHook")},gr=function(t){return pr.setup(this,t),pr.create(t)};function mr(t=[],e){const n=new ar(t,e);return n.constructor=mr,n.tapAsync=vr,n.tapPromise=yr,n.compile=gr,n}mr.prototype=null;var br=mr;const wr=new class extends sr{content({onError:t,onResult:e,resultReturns:n,rethrowIfPossible:r}){return this.callTapsSeries({onError:(e,n)=>t(n),onResult:(t,e,n)=>{let r="";return r+=`if(${e} !== undefined) {\n`,r+=`${this._args[0]} = ${e};\n`,r+="}\n",r+=n(),r},onDone:()=>e(this._args[0]),doneReturns:n,rethrowIfPossible:r})}},xr=()=>{throw Error("tapAsync is not supported on a SyncWaterfallHook")},kr=()=>{throw Error("tapPromise is not supported on a SyncWaterfallHook")},Er=function(t){return wr.setup(this,t),wr.create(t)};function Tr(t=[],e){if(1>t.length)throw Error("Waterfall hooks must have at least one argument");const n=new ar(t,e);return n.constructor=Tr,n.tapAsync=xr,n.tapPromise=kr,n.compile=Er,n}Tr.prototype=null;var Mr=Tr;const Pr=new class extends sr{content({onError:t,onDone:e,rethrowIfPossible:n}){return this.callTapsLooping({onError:(e,n)=>t(n),onDone:e,rethrowIfPossible:n})}},_r=()=>{throw Error("tapAsync is not supported on a SyncLoopHook")},Sr=()=>{throw Error("tapPromise is not supported on a SyncLoopHook")},Ar=function(t){return Pr.setup(this,t),Pr.create(t)};function Cr(t=[],e){const n=new ar(t,e);return n.constructor=Cr,n.tapAsync=_r,n.tapPromise=Sr,n.compile=Ar,n}Cr.prototype=null;var Rr=Cr;const Nr=new class extends sr{content({onError:t,onDone:e}){return this.callTapsParallel({onError:(e,n,r,i)=>t(n)+i(!0),onDone:e})}},Or=function(t){return Nr.setup(this,t),Nr.create(t)};function Ir(t=[],e){const n=new ar(t,e);return n.constructor=Ir,n.compile=Or,n._call=void 0,n.call=void 0,n}Ir.prototype=null;var jr=Ir;const Dr=new class extends sr{content({onError:t,onResult:e,onDone:n}){let r="";return r+=`var _results = new Array(${this.options.taps.length});\n`,r+="var _checkDone = function() {\n",r+="for(var i = 0; i < _results.length; i++) {\n",r+="var item = _results[i];\n",r+="if(item === undefined) return false;\n",r+="if(item.result !== undefined) {\n",r+=e("item.result"),r+="return true;\n",r+="}\n",r+="if(item.error) {\n",r+=t("item.error"),r+="return true;\n",r+="}\n",r+="}\n",r+="return false;\n",r+="}\n",r+=this.callTapsParallel({onError:(t,e,n,r)=>{let i="";return i+=`if(${t} < _results.length && ((_results.length = ${t+1}), (_results[${t}] = { error: ${e} }), _checkDone())) {\n`,i+=r(!0),i+="} else {\n",i+=n(),i+="}\n",i},onResult:(t,e,n,r)=>{let i="";return i+=`if(${t} < _results.length && (${e} !== undefined && (_results.length = ${t+1}), (_results[${t}] = { result: ${e} }), _checkDone())) {\n`,i+=r(!0),i+="} else {\n",i+=n(),i+="}\n",i},onTap:(t,e,n,r)=>{let i="";return t>0&&(i+=`if(${t} >= _results.length) {\n`,i+=n(),i+="} else {\n"),i+=e(),t>0&&(i+="}\n"),i},onDone:n}),r}},Br=function(t){return Dr.setup(this,t),Dr.create(t)};function Fr(t=[],e){const n=new ar(t,e);return n.constructor=Fr,n.compile=Br,n._call=void 0,n.call=void 0,n}Fr.prototype=null;var Lr=Fr;const Wr=new class extends sr{content({onError:t,onDone:e}){return this.callTapsSeries({onError:(e,n,r,i)=>t(n)+i(!0),onDone:e})}},Gr=function(t){return Wr.setup(this,t),Wr.create(t)};function qr(t=[],e){const n=new ar(t,e);return n.constructor=qr,n.compile=Gr,n._call=void 0,n.call=void 0,n}qr.prototype=null;var $r=qr;const Hr=new class extends sr{content({onError:t,onResult:e,resultReturns:n,onDone:r}){return this.callTapsSeries({onError:(e,n,r,i)=>t(n)+i(!0),onResult:(t,n,r)=>`if(${n} !== undefined) {\n${e(n)}\n} else {\n${r()}}\n`,resultReturns:n,onDone:r})}},Vr=function(t){return Hr.setup(this,t),Hr.create(t)};function Xr(t=[],e){const n=new ar(t,e);return n.constructor=Xr,n.compile=Vr,n._call=void 0,n.call=void 0,n}Xr.prototype=null;var Yr=Xr;const zr=new class extends sr{content({onError:t,onDone:e}){return this.callTapsLooping({onError:(e,n,r,i)=>t(n)+i(!0),onDone:e})}},Ur=function(t){return zr.setup(this,t),zr.create(t)};function Kr(t=[],e){const n=new ar(t,e);return n.constructor=Kr,n.compile=Ur,n._call=void 0,n.call=void 0,n}Kr.prototype=null;var Zr=Kr;const Qr=new class extends sr{content({onError:t,onResult:e}){return this.callTapsSeries({onError:(e,n,r,i)=>t(n)+i(!0),onResult:(t,e,n)=>{let r="";return r+=`if(${e} !== undefined) {\n`,r+=`${this._args[0]} = ${e};\n`,r+="}\n",r+=n(),r},onDone:()=>e(this._args[0])})}},Jr=function(t){return Qr.setup(this,t),Qr.create(t)};function ti(t=[],e){if(1>t.length)throw Error("Waterfall hooks must have at least one argument");const n=new ar(t,e);return n.constructor=ti,n.compile=Jr,n._call=void 0,n.call=void 0,n}ti.prototype=null;var ei=ti;const ni=(t,e)=>e;class ri{constructor(t,e){this._map=new Map,this.name=e,this._factory=t,this._interceptors=[]}get(t){return this._map.get(t)}for(t){const e=this.get(t);if(void 0!==e)return e;let n=this._factory(t);const r=this._interceptors;for(let e=0;r.length>e;e++)n=r[e].factory(t,n);return this._map.set(t,n),n}intercept(t){this._interceptors.push(Object.assign({factory:ni},t))}}ri.prototype.tap=r.default.deprecate((function(t,e,n){return this.for(t).tap(e,n)}),"HookMap#tap(key,…) is deprecated. Use HookMap#for(key).tap(…) instead."),ri.prototype.tapAsync=r.default.deprecate((function(t,e,n){return this.for(t).tapAsync(e,n)}),"HookMap#tapAsync(key,…) is deprecated. Use HookMap#for(key).tapAsync(…) instead."),ri.prototype.tapPromise=r.default.deprecate((function(t,e,n){return this.for(t).tapPromise(e,n)}),"HookMap#tapPromise(key,…) is deprecated. Use HookMap#for(key).tapPromise(…) instead.");var ii=ri;class oi{constructor(t,e){this.hooks=t,this.name=e}tap(t,e){for(const n of this.hooks)n.tap(t,e)}tapAsync(t,e){for(const n of this.hooks)n.tapAsync(t,e)}tapPromise(t,e){for(const n of this.hooks)n.tapPromise(t,e)}isUsed(){for(const t of this.hooks)if(t.isUsed())return!0;return!1}intercept(t){for(const e of this.hooks)e.intercept(t)}withOptions(t){return new oi(this.hooks.map((e=>e.withOptions(t))),this.name)}}var ai=oi,si=P((function(t,e){e.__esModule=!0,e.SyncHook=dr,e.SyncBailHook=br,e.SyncWaterfallHook=Mr,e.SyncLoopHook=Rr,e.AsyncParallelHook=jr,e.AsyncParallelBailHook=Lr,e.AsyncSeriesHook=$r,e.AsyncSeriesBailHook=Yr,e.AsyncSeriesLoopHook=Zr,e.AsyncSeriesWaterfallHook=ei,e.HookMap=ii,e.MultiHook=ai})),ui={}.toString,ci=function(t){return Array.isArray?Array.isArray(t):function(t,e){return ui.call(t)==="[object "+e+"]"}(t,"Array")},li=function(t){if(ci(t))return t.reduce((function(t,e){return Math.max(t,e)}),t[0])},hi=function(t){if(ci(t))return t.reduce((function(t,e){return Math.min(t,e)}),t[0])};function fi(t,e,n,r){var i=t-n,o=e-r;return Math.sqrt(i*i+o*o)}function di(t,e){return.001>Math.abs(t-e)}function pi(t,e){var n=hi(t),r=hi(e);return{x:n,y:r,width:li(t)-n,height:li(e)-r}}var vi="undefined"!=typeof Float32Array?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});!function(){var t,e=(t=new vi(2),vi!=Float32Array&&(t[0]=0,t[1]=0),t)}();var yi={box:function(t,e,n,r){return pi([t,n],[e,r])},length:function(t,e,n,r){return fi(t,e,n,r)},pointAt:function(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}},pointDistance:function(t,e,n,r,i,o){var a=(n-t)*(i-t)+(r-e)*(o-e);return 0>a?fi(t,e,i,o):a>(n-t)*(n-t)+(r-e)*(r-e)?fi(n,r,i,o):this.pointToLine(t,e,n,r,i,o)},pointToLine:function(t,e,n,r,i,o){var a=[n-t,r-e];if(function(t,e){return t[0]===e[0]&&t[1]===e[1]}(a,[0,0]))return Math.sqrt((i-t)*(i-t)+(o-e)*(o-e));var s=[-a[1],a[0]];return function(t,e){var n=e[0],r=e[1],i=n*n+r*r;i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i}(s,s),Math.abs(function(t,e){return t[0]*e[0]+t[1]*e[1]}([i-t,o-e],s))},tangentAngle:function(t,e,n,r){return Math.atan2(r-e,n-t)}};function gi(t){return function(t){if(Array.isArray(t))return mi(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return mi(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mi(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mi(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);e>n;n++)r[n]=t[n];return r}function bi(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function wi(t,e,n,r,i){var o=1-i;return 3*(o*o*(e-t)+2*o*i*(n-e)+i*i*(r-n))}function xi(t,e,n,r){var i,o,a,s=-3*t+9*e-9*n+3*r,u=6*t-12*e+6*n,c=3*e-3*t,l=[];if(di(s,0))di(u,0)||0>(i=-c/u)||i>1||l.push(i);else{var h=u*u-4*s*c;di(h,0)?l.push(-u/(2*s)):h>0&&(o=(-u-(a=Math.sqrt(h)))/(2*s),0>(i=(-u+a)/(2*s))||i>1||l.push(i),0>o||o>1||l.push(o))}return l}function ki(t,e,n,r,i,o,a,s,u){var c=bi(t,n,i,a,u),l=bi(e,r,o,s,u),h=yi.pointAt(t,e,n,r,u),f=yi.pointAt(n,r,i,o,u),d=yi.pointAt(i,o,a,s,u),p=yi.pointAt(h.x,h.y,f.x,f.y,u),v=yi.pointAt(f.x,f.y,d.x,d.y,u);return[[t,e,h.x,h.y,p.x,p.y,c,l],[c,l,v.x,v.y,d.x,d.y,a,s]]}function Ei(t,e,n,r,i,o,a,s,u){if(0===u)return function(t,e){for(var n=0,r=t.length,i=0;r>i;i++)n+=fi(t[i],e[i],t[(i+1)%r],e[(i+1)%r]);return n/2}([t,n,i,a],[e,r,o,s]);var c=ki(t,e,n,r,i,o,a,s,.5),l=[].concat(gi(c[0]),[u-1]),h=[].concat(gi(c[1]),[u-1]);return Ei.apply(null,l)+Ei.apply(null,h)}var Ti={extrema:xi,box:function(t,e,n,r,i,o,a,s){for(var u=[t,a],c=[e,s],l=xi(t,n,i,a),h=xi(e,r,o,s),f=0;l.length>f;f++)u.push(bi(t,n,i,a,l[f]));for(var d=0;h.length>d;d++)c.push(bi(e,r,o,s,h[d]));return pi(u,c)},length:function(t,e,n,r,i,o,a,s){return Ei(t,e,n,r,i,o,a,s,3)},nearestPoint:function(t,e,n,r,i,o,a,s,u,c,l){return function(t,e,n,r,i,o){var a=-1,s=1/0,u=[n,r],c=20;o&&o>200&&(c=o/10);for(var l=1/c,h=l/10,f=0;c>=f;f++){var d=f*l,p=[i.apply(null,t.concat([d])),i.apply(null,e.concat([d]))],v=fi(u[0],u[1],p[0],p[1]);s>v&&(a=d,s=v)}if(0===a)return{x:t[0],y:e[0]};if(1===a){var y=t.length;return{x:t[y-1],y:e[y-1]}}s=1/0;for(var g=0;32>g&&h>=1e-4;g++){var m=a-h,b=a+h,w=[i.apply(null,t.concat([m])),i.apply(null,e.concat([m]))],x=fi(u[0],u[1],w[0],w[1]);if(m>=0&&s>x)a=m,s=x;else{var k=[i.apply(null,t.concat([b])),i.apply(null,e.concat([b]))],E=fi(u[0],u[1],k[0],k[1]);1>=b&&s>E?(a=b,s=E):h*=.5}}return{x:i.apply(null,t.concat([a])),y:i.apply(null,e.concat([a]))}}([t,n,i,a],[e,r,o,s],u,c,bi,l)},pointDistance:function(t,e,n,r,i,o,a,s,u,c,l){var h=this.nearestPoint(t,e,n,r,i,o,a,s,u,c,l);return fi(h.x,h.y,u,c)},interpolationAt:bi,pointAt:function(t,e,n,r,i,o,a,s,u){return{x:bi(t,n,i,a,u),y:bi(e,r,o,s,u)}},divide:function(t,e,n,r,i,o,a,s,u){return ki(t,e,n,r,i,o,a,s,u)},tangentAngle:function(t,e,n,r,i,o,a,s,u){var c=wi(t,n,i,a,u),l=wi(e,r,o,s,u);return function(t){return(t+2*Math.PI)%(2*Math.PI)}(Math.atan2(l,c))}};var Mi=function(t){return function(t){if(2>t.length)return 0;for(var e=0,n=0;t.length-1>n;n++){var r=t[n],i=t[n+1];e+=fi(r[0],r[1],i[0],i[1])}return e}(t)};function Pi(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function _i(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Si(){}var Ai=.7,Ci=1/Ai,Ri=/^#([0-9a-f]{3,8})$/,Ni=/^rgb\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*\)$/,Oi=/^rgb\(\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)%\s*,\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)%\s*,\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)%\s*\)$/,Ii=/^rgba\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)\s*\)$/,ji=/^rgba\(\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)%\s*,\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)%\s*,\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)%\s*,\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)\s*\)$/,Di=/^hsl\(\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)\s*,\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)%\s*,\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)%\s*\)$/,Bi=/^hsla\(\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)\s*,\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)%\s*,\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)%\s*,\s*([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)\s*\)$/,Fi={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 Li(){return this.rgb().formatHex()}function Wi(){return this.rgb().formatRgb()}function Gi(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Ri.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?qi(e):3===n?new Vi(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?$i(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?$i(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Ni.exec(t))?new Vi(e[1],e[2],e[3],1):(e=Oi.exec(t))?new Vi(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Ii.exec(t))?$i(e[1],e[2],e[3],e[4]):(e=ji.exec(t))?$i(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Di.exec(t))?Ui(e[1],e[2]/100,e[3]/100,1):(e=Bi.exec(t))?Ui(e[1],e[2]/100,e[3]/100,e[4]):Fi.hasOwnProperty(t)?qi(Fi[t]):"transparent"===t?new Vi(NaN,NaN,NaN,0):null}function qi(t){return new Vi(t>>16&255,t>>8&255,255&t,1)}function $i(t,e,n,r){return r>0||(t=e=n=NaN),new Vi(t,e,n,r)}function Hi(t){return t instanceof Si||(t=Gi(t)),t?new Vi((t=t.rgb()).r,t.g,t.b,t.opacity):new Vi}function Vi(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Xi(){return"#"+zi(this.r)+zi(this.g)+zi(this.b)}function Yi(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function zi(t){return(16>(t=Math.max(0,Math.min(255,Math.round(t)||0)))?"0":"")+t.toString(16)}function Ui(t,e,n,r){return r>0?n>0&&1>n?e>0||(t=NaN):t=e=NaN:t=e=n=NaN,new Zi(t,e,n,r)}function Ki(t){if(t instanceof Zi)return new Zi(t.h,t.s,t.l,t.opacity);if(t instanceof Si||(t=Gi(t)),!t)return new Zi;if(t instanceof Zi)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(r>n):n===o?(r-e)/s+2:(e-n)/s+4,s/=.5>u?o+i:2-o-i,a*=60):s=u>0&&1>u?0:a,new Zi(a,s,u,t.opacity)}function Zi(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Qi(t,e,n){return 255*(60>t?e+(n-e)*t/60:180>t?n:240>t?e+(n-e)*(240-t)/60:e)}Pi(Si,Gi,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:Li,formatHex:Li,formatHsl:function(){return Ki(this).formatHsl()},formatRgb:Wi,toString:Wi}),Pi(Vi,(function(t,e,n,r){return 1===arguments.length?Hi(t):new Vi(t,e,n,null==r?1:r)}),_i(Si,{brighter:function(t){return new Vi(this.r*(t=null==t?Ci:Math.pow(Ci,t)),this.g*t,this.b*t,this.opacity)},darker:function(t){return new Vi(this.r*(t=null==t?Ai:Math.pow(Ai,t)),this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return this.r>=-.5&&255.5>this.r&&this.g>=-.5&&255.5>this.g&&this.b>=-.5&&255.5>this.b&&this.opacity>=0&&1>=this.opacity},hex:Xi,formatHex:Xi,formatRgb:Yi,toString:Yi})),Pi(Zi,(function(t,e,n,r){return 1===arguments.length?Ki(t):new Zi(t,e,n,null==r?1:r)}),_i(Si,{brighter:function(t){return new Zi(this.h,this.s,this.l*(t=null==t?Ci:Math.pow(Ci,t)),this.opacity)},darker:function(t){return new Zi(this.h,this.s,this.l*(t=null==t?Ai:Math.pow(Ai,t)),this.opacity)},rgb:function(){var t=this.h%360+360*(0>this.h),e=this.l,n=e+(.5>e?e:1-e)*(isNaN(t)||isNaN(this.s)?0:this.s),r=2*e-n;return new Vi(Qi(240>t?t+120:t-240,r,n),Qi(t,r,n),Qi(120>t?t+240:t-120,r,n),this.opacity)},displayable:function(){return(this.s>=0&&1>=this.s||isNaN(this.s))&&this.l>=0&&1>=this.l&&this.opacity>=0&&1>=this.opacity},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var Ji=/[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/gi,to=/[^\s\,]+/gi;var eo=/[a-z]/;function no(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}function ro(t){var e=function(t){return t?y(t)?t:[]:null}(t);if(!e||!e.length)return[["M",0,0]];for(var n=!1,r=0;e.length>r;r++){if(eo.test(f=e[r][0])||["V","H","T","S"].indexOf(f)>=0){n=!0;break}}if(!n)return e;var i=[],o=0,a=0,s=0,u=0,c=0,l=e[0];"M"!==l[0]&&"m"!==l[0]||(s=o=+l[1],u=a=+l[2],c++,i[0]=["M",o,a]);r=c;for(var h=e.length;h>r;r++){var f,d=e[r],p=i[r-1],v=[],g=(f=d[0]).toUpperCase();if(f!==g)switch(v[0]=g,g){case"A":v[1]=d[1],v[2]=d[2],v[3]=d[3],v[4]=d[4],v[5]=d[5],v[6]=+d[6]+o,v[7]=+d[7]+a;break;case"V":v[1]=+d[1]+a;break;case"H":v[1]=+d[1]+o;break;case"M":u=+d[2]+a,v[1]=s=+d[1]+o,v[2]=u;break;default:for(var m=1,b=d.length;b>m;m++)v[m]=+d[m]+(m%2?o:a)}else v=e[r];switch(g){case"Z":o=+s,a=+u;break;case"H":v=["L",o=v[1],a];break;case"V":v=["L",o,a=v[1]];break;case"T":o=v[1],a=v[2];var w=no([p[1],p[2]],[p[3],p[4]]);v=["Q",w[0],w[1],o,a];break;case"S":o=v[v.length-2],a=v[v.length-1];var x=p.length,k=no([p[x-4],p[x-3]],[p[x-2],p[x-1]]);v=["C",k[0],k[1],v[1],v[2],o,a];break;case"M":s=v[v.length-2],u=v[v.length-1];break;default:o=v[v.length-2],a=v[v.length-1]}i.push(v)}return i}var io=2*Math.PI,oo=function(t,e,n,r,i,o,a){var s=t.x,u=t.y;return{x:r*(s*=e)-i*(u*=n)+o,y:i*s+r*u+a}},ao=function(t,e){var n=1.5707963267948966===e?.551915024494:-1.5707963267948966===e?-.551915024494:4/3*Math.tan(e/4),r=Math.cos(t),i=Math.sin(t),o=Math.cos(t+e),a=Math.sin(t+e);return[{x:r-i*n,y:i+r*n},{x:o+a*n,y:a-o*n},{x:o,y:a}]},so=function(t,e,n,r){var i=t*n+e*r;return i>1&&(i=1),-1>i&&(i=-1),(0>t*r-e*n?-1:1)*Math.acos(i)},uo=function(t){var e=t.px,n=t.py,r=t.cx,i=t.cy,o=t.rx,a=t.ry,s=t.xAxisRotation,u=void 0===s?0:s,c=t.largeArcFlag,l=void 0===c?0:c,h=t.sweepFlag,f=void 0===h?0:h,d=[];if(0===o||0===a)return[{x1:0,y1:0,x2:0,y2:0,x:r,y:i}];var p=Math.sin(u*io/360),v=Math.cos(u*io/360),y=v*(e-r)/2+p*(n-i)/2,g=-p*(e-r)/2+v*(n-i)/2;if(0===y&&0===g)return[{x1:0,y1:0,x2:0,y2:0,x:r,y:i}];o=Math.abs(o),a=Math.abs(a);var m=Math.pow(y,2)/Math.pow(o,2)+Math.pow(g,2)/Math.pow(a,2);m>1&&(o*=Math.sqrt(m),a*=Math.sqrt(m));var b=function(t,e,n,r,i,o,a,s,u,c,l,h){var f=Math.pow(i,2),d=Math.pow(o,2),p=Math.pow(l,2),v=Math.pow(h,2),y=f*d-f*v-d*p;0>y&&(y=0);var g=(y=Math.sqrt(y/=f*v+d*p)*(a===s?-1:1))*i/o*h,m=y*-o/i*l,b=c*g-u*m+(t+n)/2,w=u*g+c*m+(e+r)/2,x=(l-g)/i,k=(h-m)/o,E=(-l-g)/i,T=(-h-m)/o,M=so(1,0,x,k),P=so(x,k,E,T);return 0===s&&P>0&&(P-=io),1===s&&0>P&&(P+=io),[b,w,M,P]}(e,n,r,i,o,a,l,f,p,v,y,g),w=b[0],x=b[1],k=b[2],E=b[3],T=Math.abs(E)/(io/4);1e-7>Math.abs(1-T)&&(T=1);var M=Math.max(Math.ceil(T),1);E/=M;for(var P=0;M>P;P++)d.push(ao(k,E)),k+=E;return d.map((function(t){var e=oo(t[0],o,a,v,p,w,x),n=e.x,r=e.y,i=oo(t[1],o,a,v,p,w,x),s=i.x,u=i.y,c=oo(t[2],o,a,v,p,w,x);return{x1:n,y1:r,x2:s,y2:u,x:c.x,y:c.y}}))};function co(t,e,n,r,i,o,a,s,u){return uo({px:t,py:e,cx:s,cy:u,rx:n,ry:r,xAxisRotation:i,largeArcFlag:o,sweepFlag:a}).reduce((function(t,e){return t.push(e.x1,e.y1,e.x2,e.y2,e.x,e.y),t}),[])}function lo(t,e,n,r,i,o){var a=1/3,s=2/3;return[a*t+s*n,a*e+s*r,a*i+s*n,a*o+s*r,i,o]}function ho(t,e,n,r){return[t,e,n,r,n,r]}function fo(t,e){0>"TQ".indexOf(t[0])&&(e.qx=null,e.qy=null);var n=t.slice(1),r=n[0],i=n[1];switch(t[0]){case"M":return e.x=r,e.y=i,t;case"A":return["C"].concat(co.apply(0,[e.x1,e.y1].concat(t.slice(1))));case"Q":return e.qx=r,e.qy=i,["C"].concat(lo.apply(0,[e.x1,e.y1].concat(t.slice(1))));case"L":return["C"].concat(ho(e.x1,e.y1,t[1],t[2]));case"H":return["C"].concat(ho(e.x1,e.y1,t[1],e.y1));case"V":return["C"].concat(ho(e.x1,e.y1,e.x1,t[1]));case"Z":return["C"].concat(ho(e.x1,e.y1,e.x,e.y))}return t}function po(t,e,n){if(t[n].length>7){t[n].shift();for(var r=t[n],i=n;r.length;)e[n]="A",t.splice(i+=1,0,["C"].concat(r.splice(0,6)));t.splice(n,1)}}function vo(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function yo(t,e){return vo(t)*vo(e)?(t[0]*e[0]+t[1]*e[1])/(vo(t)*vo(e)):1}function go(t,e){return(t[1]*e[0]>t[0]*e[1]?-1:1)*Math.acos(yo(t,e))}function mo(t,e){return t[0]===e[0]&&t[1]===e[1]}function bo(t,e){var n,r=e[1],i=e[2],o=(.017453292519943295*e[3]%(n=2*Math.PI)+n)%n,a=e[4],s=e[5],u=t[0],c=t[1],l=e[6],h=e[7],f=Math.cos(o)*(u-l)/2+Math.sin(o)*(c-h)/2,d=-1*Math.sin(o)*(u-l)/2+Math.cos(o)*(c-h)/2,p=f*f/(r*r)+d*d/(i*i);p>1&&(r*=Math.sqrt(p),i*=Math.sqrt(p));var v=r*r*(d*d)+i*i*(f*f),y=v?Math.sqrt((r*r*(i*i)-v)/v):1;a===s&&(y*=-1),isNaN(y)&&(y=0);var g=i?y*r*d/i:0,m=r?y*-i*f/r:0,b=(u+l)/2+Math.cos(o)*g-Math.sin(o)*m,w=(c+h)/2+Math.sin(o)*g+Math.cos(o)*m,x=[(f-g)/r,(d-m)/i],k=[(-1*f-g)/r,(-1*d-m)/i],E=go([1,0],x),T=go(x,k);return yo(x,k)>-1||(T=Math.PI),1>yo(x,k)||(T=0),0===s&&T>0&&(T-=2*Math.PI),1===s&&0>T&&(T+=2*Math.PI),{cx:b,cy:w,rx:mo(t,[l,h])?0:r,ry:mo(t,[l,h])?0:i,startAngle:E,endAngle:E+T,xRotation:o,arcFlag:a,sweepFlag:s}}function wo(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}function xo(t){for(var e=[],n=null,r=null,i=null,o=0,a=(t=function(t){var e=t||[];return y(e)?e:b(e)?(m(e=e.match(Ji),(function(t,n){if((t=t.match(to))[0].length>1){var r=t[0].charAt(0);t.splice(1,0,t[0].substr(1)),t[0]=r}m(t,(function(e,n){isNaN(e)||(t[n]=+e)})),e[n]=t})),e):void 0}(t)).length,s=0;a>s;s++){var u=t[s];r=t[s+1];var c=u[0],l={command:c,prePoint:n,params:u,startTangent:null,endTangent:null};switch(c){case"M":i=[u[1],u[2]],o=s;break;case"A":var h=bo(n,u);l.arcParams=h}if("Z"===c)n=i,r=t[o+1];else{var f=u.length;n=[u[f-2],u[f-1]]}r&&"Z"===r[0]&&(r=t[o],e[o]&&(e[o].prePoint=n)),l.currentPoint=n,e[o]&&mo(n,e[o].currentPoint)&&(e[o].prePoint=l.prePoint),l.nextPoint=r?[r[r.length-2],r[r.length-1]]:null;var d=l.prePoint;if(["L","H","V"].includes(c))l.startTangent=[d[0]-n[0],d[1]-n[1]],l.endTangent=[n[0]-d[0],n[1]-d[1]];else if("Q"===c){l.startTangent=[d[0]-(p=[u[1],u[2]])[0],d[1]-p[1]],l.endTangent=[n[0]-p[0],n[1]-p[1]]}else if("T"===c){var p=wo((g=e[s-1]).currentPoint,d);"Q"===g.command?(l.command="Q",l.startTangent=[d[0]-p[0],d[1]-p[1]],l.endTangent=[n[0]-p[0],n[1]-p[1]]):(l.command="TL",l.startTangent=[d[0]-n[0],d[1]-n[1]],l.endTangent=[n[0]-d[0],n[1]-d[1]])}else if("C"===c){var v=[u[3],u[4]];l.startTangent=[d[0]-(w=[u[1],u[2]])[0],d[1]-w[1]],l.endTangent=[n[0]-v[0],n[1]-v[1]],0===l.startTangent[0]&&0===l.startTangent[1]&&(l.startTangent=[w[0]-v[0],w[1]-v[1]]),0===l.endTangent[0]&&0===l.endTangent[1]&&(l.endTangent=[v[0]-w[0],v[1]-w[1]])}else if("S"===c){var g,w=wo((g=e[s-1]).currentPoint,d);v=[u[1],u[2]];"C"===g.command?(l.command="C",l.startTangent=[d[0]-w[0],d[1]-w[1]],l.endTangent=[n[0]-v[0],n[1]-v[1]]):(l.command="SQ",l.startTangent=[d[0]-v[0],d[1]-v[1]],l.endTangent=[n[0]-v[0],n[1]-v[1]])}else if("A"===c){var x=.001,k=l.arcParams||{},E=k.cx,T=void 0===E?0:E,M=k.cy,P=void 0===M?0:M,_=k.rx,S=void 0===_?0:_,A=k.ry,C=void 0===A?0:A,R=k.sweepFlag,N=k.startAngle,O=void 0===N?0:N,I=k.endAngle,j=void 0===I?0:I;0===(void 0===R?0:R)&&(x*=-1),l.startTangent=[S*Math.cos(O-x)+T-i[0],C*Math.sin(O-x)+P-i[1]],l.endTangent=[d[0]-(S*Math.cos(O+j+x)+T),d[1]-(C*Math.sin(O+j-x)+P)]}e.push(l)}return e}function ko(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Eo(t){return(Eo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function To(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}function Mo(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){To(o,r,i,a,s,"next",t)}function s(t){To(o,r,i,a,s,"throw",t)}a(void 0)}))}}function Po(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _o(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function So(t,e,n){return e&&_o(t.prototype,e),n&&_o(t,n),t}function Ao(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Co(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&No(t,e)}function Ro(t){return(Ro=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function No(t,e){return(No=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Oo(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Io(t,e){if(e&&("object"===i(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Oo(t)}function jo(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Ro(t);if(e){var i=Ro(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Io(this,n)}}function Do(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,o=[],a=!0,s=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(o.push(r.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(t,e)||Fo(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Bo(t){return function(t){if(Array.isArray(t))return Lo(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Fo(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fo(t,e){if(t){if("string"==typeof t)return Lo(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lo(t,e):void 0}}function Lo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);e>n;n++)r[n]=t[n];return r}function Wo(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Fo(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return t.length>r?{done:!1,value:t[r++]}:{done:!0}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}var Go,qo,$o="ContributionProvider",Ho=function(){function t(e,n){Po(this,t),this.serviceIdentifier=void 0,this.container=void 0,this.services=void 0,this.serviceIdentifier=e,this.container=n,this.serviceIdentifier=e,this.container=n}return So(t,[{key:"getContributions",value:function(t){if(void 0===this.services){for(var e=[],n=this.container;!v(n);){if(n.isBound(this.serviceIdentifier))try{e.push.apply(e,Bo(n.getAll(this.serviceIdentifier)))}catch(t){console.error(t)}n=!0===t?n.parent:null}this.services=e}return this.services}}]),t}();function Vo(t,e){(Go.isContainer(t)?t.bind($o):t($o)).toDynamicValue((function(t){return new Ho(e,t.container)})).inSingletonScope().whenTargetNamed(e)}!function(t){t.isContainer=function(t){return"function"!=typeof t&&("guid"in t||"parent"in t)}}(Go||(Go={})),function(t){t.Group="group",t.Circle="circle",t.Ellipse="ellipse",t.Image="image",t.Rect="rect",t.Line="line",t.Polyline="polyline",t.Polygon="polygon",t.Text="text",t.Path="path",t.HTML="html"}(qo||(qo={}));var Xo="CanvasConfig",Yo=function(t){Co(n,t);var e=jo(n);function n(){var t;Po(this,n);for(var r=arguments.length,i=Array(r),o=0;r>o;o++)i[o]=arguments[o];return(t=e.call.apply(e,[this].concat(i))).contentBounds=void 0,t.renderBounds=void 0,t}return n}(Ee);Yo.tag="c-geometry";var zo=function(t){Co(n,t);var e=jo(n);function n(){var t;Po(this,n);for(var r=arguments.length,i=Array(r),o=0;r>o;o++)i[o]=arguments[o];return(t=e.call.apply(e,[this].concat(i))).bounds=void 0,t.boundsDirty=!0,t.renderBounds=void 0,t.renderBoundsDirty=!0,t.dirtyRenderBounds=void 0,t.dirty=!1,t}return n}(Ee);zo.tag="c-renderable";var Uo,Ko=function(t){Co(n,t);var e=jo(n);function n(){var t;Po(this,n);for(var r=arguments.length,i=Array(r),o=0;r>o;o++)i[o]=arguments[o];return(t=e.call.apply(e,[this].concat(i))).dirtyFlag=!1,t.localDirtyFlag=!1,t.localPosition=an(0,0,0),t.localRotation=Zn(0,0,0,1),t.localScale=an(1,1,1),t.localTransform=Ve(),t.position=an(0,0,0),t.rotation=Zn(0,0,0,1),t.scaling=an(1,1,1),t.worldTransform=Ve(),t.origin=an(0,0,0),t}return n}(Ee);Ko.tag="c-transform",function(t){t[t.Standard=0]="Standard"}(Uo||(Uo={}));var Zo=function(t){Co(n,t);var e=jo(n);function n(){var t;Po(this,n);for(var r=arguments.length,i=Array(r),o=0;r>o;o++)i[o]=arguments[o];return(t=e.call.apply(e,[this].concat(i))).strategy=Uo.Standard,t.visibilityPlaneMask=-1,t.visible=!0,t.enable=!0,t}return So(n,[{key:"isCulled",value:function(){return this.enable&&!this.visible}}]),n}(Ee);Zo.tag="c-cullable";var Qo=function(t){Co(n,t);var e=jo(n);function n(){var t;Po(this,n);for(var r=arguments.length,i=Array(r),o=0;r>o;o++)i[o]=arguments[o];return(t=e.call.apply(e,[this].concat(i))).dirty=!1,t.sorted=void 0,t.lastSortedIndex=void 0,t}return n}(Ee);
|
|
30
|
+
/*! *****************************************************************************
|
|
31
|
+
Copyright (c) Microsoft Corporation.
|
|
32
|
+
|
|
33
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
34
|
+
purpose with or without fee is hereby granted.
|
|
35
|
+
|
|
36
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
37
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
38
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
39
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
40
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
41
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
42
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
43
|
+
***************************************************************************** */
|
|
44
|
+
function Jo(t,e,n,r){var o,a=arguments.length,s=3>a?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(s=(3>a?o(s):a>3?o(e,n,s):o(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s}function ta(t,e){if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}Qo.tag="c-sortable";var ea=function(){function t(){Po(this,t),this.pool={}}return So(t,[{key:"getByName",value:function(t){return this.pool[t]}},{key:"add",value:function(t,e){this.pool[t]=e}},{key:"remove",value:function(t){delete this.pool[t]}}]),t}();ea=Jo([ae()],ea);var na,ra=function(){function t(e,n){Po(this,t),this.center=void 0,this.halfExtents=void 0,this.min=nn(),this.max=nn(),this.update(e,n)}return So(t,[{key:"update",value:function(t,e){this.center=sn(nn(),t||nn()),this.halfExtents=sn(nn(),e||an(0,0,0)),this.min=Sn(this.min,this.center,this.halfExtents),this.max=cn(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(t,e){cn(this.center,e,t),vn(this.center,this.center,.5),Sn(this.halfExtents,e,t),vn(this.halfExtents,this.halfExtents,.5),sn(this.min,t),sn(this.max,e)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(t){var e=this.center,n=e[0],r=e[1],i=e[2],o=this.halfExtents,a=o[0],s=o[1],u=o[2],c=n-a,l=n+a,h=r-s,f=r+s,d=i-u,p=i+u,v=t.center,y=v[0],g=v[1],m=v[2],b=t.halfExtents,w=b[0],x=b[1],k=b[2],E=y-w,T=y+w,M=g-x,P=g+x,_=m-k,S=m+k;c>E&&(c=E),T>l&&(l=T),h>M&&(h=M),P>f&&(f=P),d>_&&(d=_),S>p&&(p=S),e[0]=.5*(c+l),e[1]=.5*(h+f),e[2]=.5*(d+p),o[0]=.5*(l-c),o[1]=.5*(f-h),o[2]=.5*(p-d),this.min[0]=c,this.min[1]=h,this.min[2]=d,this.max[0]=l,this.max[1]=f,this.max[2]=p}},{key:"setFromTransformedAABB",value:function(t,e){var n=this.center,r=this.halfExtents,i=t.center,o=t.halfExtents,a=e[0],s=e[4],u=e[8],c=e[1],l=e[5],h=e[9],f=e[2],d=e[6],p=e[10],v=Math.abs(a),y=Math.abs(s),g=Math.abs(u),m=Math.abs(c),b=Math.abs(l),w=Math.abs(h),x=Math.abs(f),k=Math.abs(d),E=Math.abs(p);un(n,e[12]+a*i[0]+s*i[1]+u*i[2],e[13]+c*i[0]+l*i[1]+h*i[2],e[14]+f*i[0]+d*i[1]+p*i[2]),un(r,v*o[0]+y*o[1]+g*o[2],m*o[0]+b*o[1]+w*o[2],x*o[0]+k*o[1]+E*o[2]),this.min=Sn(this.min,n,r),this.max=cn(this.max,n,r)}},{key:"intersects",value:function(t){var e=this.getMax(),n=this.getMin(),r=t.getMax(),i=t.getMin();return!(n[0]>r[0]||i[0]>e[0]||n[1]>r[1]||i[1]>e[1]||n[2]>r[2]||i[2]>e[2])}},{key:"intersection",value:function(e){if(!this.intersects(e))return null;var n=new t,r=pn(nn(),this.getMin(),e.getMin()),i=dn(nn(),this.getMax(),e.getMax());return n.setMinMax(r,i),n}},{key:"containsPoint",value:function(t){var e=this.getMin(),n=this.getMax();return!(e[0]>t[0]||t[0]>n[0]||e[1]>t[1]||t[1]>n[1]||e[2]>t[2]||t[2]>n[2])}},{key:"getNegativeFarPoint",value:function(t){return 273===t.pnVertexFlag?sn(nn(),this.min):272===t.pnVertexFlag?an(this.min[0],this.min[1],this.max[2]):257===t.pnVertexFlag?an(this.min[0],this.max[1],this.min[2]):256===t.pnVertexFlag?an(this.min[0],this.max[1],this.max[2]):17===t.pnVertexFlag?an(this.max[0],this.min[1],this.min[2]):16===t.pnVertexFlag?an(this.max[0],this.min[1],this.max[2]):an(this.max[0],this.max[1],1===t.pnVertexFlag?this.min[2]:this.max[2])}},{key:"getPositiveFarPoint",value:function(t){return 273===t.pnVertexFlag?sn(nn(),this.max):272===t.pnVertexFlag?an(this.max[0],this.max[1],this.min[2]):257===t.pnVertexFlag?an(this.max[0],this.min[1],this.max[2]):256===t.pnVertexFlag?an(this.max[0],this.min[1],this.min[2]):17===t.pnVertexFlag?an(this.min[0],this.max[1],this.max[2]):16===t.pnVertexFlag?an(this.min[0],this.max[1],this.min[2]):an(this.min[0],this.min[1],1===t.pnVertexFlag?this.max[2]:this.min[2])}}]),t}(),ia=(nn(),function(){function t(e,n){Po(this,t),this.distance=void 0,this.normal=void 0,this.pnVertexFlag=void 0,this.distance=e||0,this.normal=n||an(0,1,0),this.updatePNVertexFlag()}return So(t,[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(Number(this.normal[0]>=0)<<8)+(Number(this.normal[1]>=0)<<4)+Number(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(t){return wn(t,this.normal)-this.distance}},{key:"normalize",value:function(){var t=1/On(this.normal);vn(this.normal,this.normal,t),this.distance*=t}},{key:"intersectsLine",value:function(t,e,n){var r=this.distanceToPoint(t),i=r/(r-this.distanceToPoint(e)),o=i>=0&&1>=i;return o&&n&&kn(n,t,e,i),o}}]),t}());!function(t){t[t.OUTSIDE=4294967295]="OUTSIDE",t[t.INSIDE=0]="INSIDE",t[t.INDETERMINATE=2147483647]="INDETERMINATE"}(na||(na={}));var oa=function(){function t(e){if(Po(this,t),this.planes=[],e)this.planes=e;else for(var n=0;6>n;n++)this.planes.push(new ia)}return So(t,[{key:"extractFromVPMatrix",value:function(t){var e=Do(t,16),n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],u=e[6],c=e[7],l=e[8],h=e[9],f=e[10],d=e[11],p=e[12],v=e[13],y=e[14],g=e[15];un(this.planes[0].normal,o-n,c-a,d-l),this.planes[0].distance=g-p,un(this.planes[1].normal,o+n,c+a,d+l),this.planes[1].distance=g+p,un(this.planes[2].normal,o+r,c+s,d+h),this.planes[2].distance=g+v,un(this.planes[3].normal,o-r,c-s,d-h),this.planes[3].distance=g-v,un(this.planes[4].normal,o-i,c-u,d-f),this.planes[4].distance=g-y,un(this.planes[5].normal,o+i,c+u,d+f),this.planes[5].distance=g+y,this.planes.forEach((function(t){t.normalize(),t.updatePNVertexFlag()}))}}]),t}(),aa=(nn(),nn(),nn(),nn(),nn(),function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;Po(this,t),this.x=0,this.y=0,this.x=e,this.y=n}return So(t,[{key:"clone",value:function(){return new t(this.x,this.y)}},{key:"copyFrom",value:function(t){this.x=t.x,this.y=t.y}}]),t}()),sa=function(){function t(e,n,r,i){Po(this,t),this.x=void 0,this.y=void 0,this.width=void 0,this.height=void 0,this.left=void 0,this.right=void 0,this.top=void 0,this.bottom=void 0,this.x=e,this.y=n,this.width=r,this.height=i,this.left=e,this.right=e+r,this.top=n,this.bottom=n+i}return So(t,[{key:"toJSON",value:function(){}}]),t}(),ua="SceneGraphSelectorFactory",ca="SceneGraphSelector",la=function(){function t(){Po(this,t)}return So(t,[{key:"selectOne",value:function(t,e){return t.startsWith("#")?e.find((function(e){return e.id===t.substring(1)})):null}},{key:"selectAll",value:function(t,e){return t.startsWith(".")?e.findAll((function(e){return e.className===t.substring(1)})):t.startsWith("#")?e.findAll((function(e){return e.id===t.substring(1)})):t.startsWith("[name=")?e.findAll((function(e){return e.name===t.substring(7,t.length-2)})):e.findAll((function(e){return e.nodeName===t}))}},{key:"is",value:function(t,e){return!0}}]),t}();function ha(t,e){var n=Number(t.style.zIndex),r=Number(e.style.zIndex);if(n===r){var i=t.parentNode;if(i){var o=i.childNodes||[];return o.indexOf(t)-o.indexOf(e)}}return n-r}function fa(t){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t;n;){var r=n.entity.getComponent(zo);r&&(r.renderBoundsDirty=!0,r.boundsDirty=!0,r.dirty=!0),n=n.parentElement}e||t.emit(Ba.BOUNDS_CHANGED,{})}la=Jo([ae()],la);var da="SceneGraphService",pa=function(){function t(){var e,n,r,i,o,a=this;Po(this,t),this.sceneGraphSelectorFactory=void 0,this.sort=function(t,e){if(!t.parentNode)return-1;if(!e.parentNode)return 1;var n=a.getDepth(t)-a.getDepth(e),r=t,i=e;if(0>n){if((i=e.getAncestor(-n))===r)return-1}else if(n>0&&i===(r=t.getAncestor(n)))return 1;for(;r&&i&&r.parentNode!==i.parentNode;)r=r.parentNode,i=i.parentNode;var o=r.parentNode;if(o){var s=o.getEntity().getComponent(Qo);return s.sorted||(s.sorted=Bo(o.childNodes)),s.dirty&&(s.sorted=Bo(o.childNodes).sort(ha),s.dirty=!1),s.sorted.indexOf(r)-s.sorted.indexOf(i)}return-1},this.rotate=(e=Ln(),function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;"number"==typeof n&&(n=an(n,r,i));var o=t.getEntity().getComponent(Ko);if(null===t.parentNode)a.rotateLocal(t,n);else{var s=Ln();Hn(s,n[0],n[1],n[2]);var u=a.getRotation(t),c=a.getRotation(t.parentNode);Qn(e,c),$n(e,e),Gn(e,e,s),Gn(o.localRotation,s,u),tr(o.localRotation,o.localRotation),o.localDirtyFlag||a.dirtifyLocal(t,o)}}),this.rotateLocal=(n=Ln(),function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;"number"==typeof e&&(e=an(e,r,i));var o=t.getEntity().getComponent(Ko);Hn(n,e[0],e[1],e[2]),Jn(o.localRotation,o.localRotation,n),o.localDirtyFlag||a.dirtifyLocal(t,o)}),this.setEulerAngles=(r=Ln(),function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;"number"==typeof e&&(e=an(e,n,i));var o=t.getEntity().getComponent(Ko);if(null===t.parentNode)a.setLocalEulerAngles(t,e);else{Hn(o.localRotation,e[0],e[1],e[2]);var s=a.getRotation(t.parentNode);Qn(r,$n(Ln(),s)),Jn(o.localRotation,o.localRotation,r),a.dirtifyLocal(t,o)}}),this.translateLocal=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;"number"==typeof e&&(e=an(e,n,r));var i=t.getEntity().getComponent(Ko);Pn(e,nn())||(Mn(e,e,i.localRotation),cn(i.localPosition,i.localPosition,e),a.dirtifyLocal(t,i))},this.setPosition=(i=Ve(),function(t,e){var n=t.getEntity().getComponent(Ko);if(e=an(e[0],e[1],e[2]||n.position[2]),!Pn(a.getPosition(t),e)){if(n.position=e,null===t.parentNode)sn(n.localPosition,e);else{var r=t.parentNode.getEntity().getComponent(Ko);Xe(i,r.worldTransform),ze(i,i),En(n.localPosition,e,i)}n.localDirtyFlag||a.dirtifyLocal(t,n)}}),this.translate=(o=nn(),function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;"number"==typeof e&&(e=an(e,n,r)),Pn(e,nn())||(cn(o,a.getPosition(t),e),a.setPosition(t,o))})}return So(t,[{key:"matches",value:function(t,e){return this.sceneGraphSelectorFactory().is(t,e)}},{key:"querySelector",value:function(t,e){return this.sceneGraphSelectorFactory().selectOne(t,e)}},{key:"querySelectorAll",value:function(t,e){return this.sceneGraphSelectorFactory().selectAll(t,e)}},{key:"attach",value:function(t,e,n){t.parentNode&&this.detach(t);var r=t.getEntity();t.parentNode=e,v(n)?t.parentNode.childNodes.push(t):t.parentNode.childNodes.splice(n,0,t);var i=e.getEntity().getComponent(Qo);i&&(i.dirty=!0);var o=r.getComponent(Ko);o&&this.dirtifyWorld(t,o)}},{key:"detach",value:function(t){if(t.parentNode){var e=t.getEntity().getComponent(Ko);if(e){var n=this.getWorldTransform(t,e);Qe(e.localScale,n),Ze(e.localPosition,n),Je(e.localRotation,n),e.localDirtyFlag=!0}var r=t.parentNode.getEntity().getComponent(Qo);r&&(r.dirty=!0);var i=t.parentNode.childNodes.indexOf(t);i>-1&&t.parentNode.childNodes.splice(i,1),e&&this.dirtifyWorld(t,e),t.parentNode=null}}},{key:"getDepth",value:function(t){for(var e=t,n=0;e;)e=e.parentNode,n++;return n}},{key:"getOrigin",value:function(t){return t.getEntity().getComponent(Ko).origin}},{key:"setOrigin",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;"number"==typeof e&&(e=an(e,n,r));var i=t.getEntity().getComponent(Ko);if(!Pn(e,i.origin)){var o=i.origin;o[0]=e[0],o[1]=e[1],o[2]=e[2]||0,this.dirtifyLocal(t,i)}}},{key:"setLocalEulerAngles",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;"number"==typeof e&&(e=an(e,n,r));var i=t.getEntity().getComponent(Ko);Hn(i.localRotation,e[0],e[1],e[2]),this.dirtifyLocal(t,i)}},{key:"setLocalPosition",value:function(t,e){var n=t.getEntity().getComponent(Ko);e=an(e[0],e[1],e[2]||n.localPosition[2]),Pn(n.localPosition,e)||(sn(n.localPosition,e),n.localDirtyFlag||this.dirtifyLocal(t,n))}},{key:"scaleLocal",value:function(t,e){var n=t.getEntity().getComponent(Ko);hn(n.localScale,n.localScale,an(e[0],e[1],e[2]||1)),this.dirtifyLocal(t,n)}},{key:"setLocalScale",value:function(t,e){var n=t.getEntity().getComponent(Ko),r=an(e[0],e[1],e[2]||n.localScale[2]);Pn(r,n.localScale)||(sn(n.localScale,r),this.dirtifyLocal(t,n))}},{key:"dirtifyLocal",value:function(t,e){e.localDirtyFlag||(e.localDirtyFlag=!0,e.dirtyFlag||this.dirtifyWorld(t,e))}},{key:"dirtifyWorld",value:function(t,e){this.dirtifyWorldInternal(t,e)}},{key:"getPosition",value:function(t){var e=t.getEntity().getComponent(Ko);return Ze(e.position,this.getWorldTransform(t,e))}},{key:"getRotation",value:function(t){var e=t.getEntity().getComponent(Ko);return Je(e.rotation,this.getWorldTransform(t,e))}},{key:"getScale",value:function(t){var e=t.getEntity().getComponent(Ko);return Qe(e.scaling,this.getWorldTransform(t,e))}},{key:"getWorldTransform",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.getEntity().getComponent(Ko);return e?e.localDirtyFlag||e.dirtyFlag?(t.parentNode&&this.getWorldTransform(t.parentNode),this.updateTransform(t,e),e.worldTransform):e.worldTransform:Ve()}},{key:"getLocalPosition",value:function(t){return t.getEntity().getComponent(Ko).localPosition}},{key:"getLocalRotation",value:function(t){return t.getEntity().getComponent(Ko).localRotation}},{key:"getLocalScale",value:function(t){return t.getEntity().getComponent(Ko).localScale}},{key:"getLocalTransform",value:function(t){var e=t.getEntity().getComponent(Ko);return e.localDirtyFlag&&(tn(e.localTransform,e.localRotation,e.localPosition,e.localScale,e.origin),e.localDirtyFlag=!1),e.localTransform}},{key:"resetLocalTransform",value:function(t){this.setLocalScale(t,[1,1,1]),this.setLocalPosition(t,[0,0,0]),this.setLocalEulerAngles(t,[0,0,0])}},{key:"getTransformedGeometryBounds",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.getGeometryBounds(t,e);if(n){var r=new ra;return r.setFromTransformedAABB(n,this.getWorldTransform(t)),r}return null}},{key:"getGeometryBounds",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.entity.getComponent(Yo),r=e?n.renderBounds:n.contentBounds||null;return r&&new ra(r.center,r.halfExtents)||null}},{key:"getBounds",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t.entity.getComponent(zo);if(!r.boundsDirty&&!n&&r.bounds)return r.bounds;if(!r.renderBoundsDirty&&n&&r.renderBounds)return r.renderBounds;var i=this.getTransformedGeometryBounds(t,n),o=t.childNodes;o.forEach((function(t){var r=e.getBounds(t,n);r&&(i?i.add(r):(i=new ra).update(r.center,r.halfExtents))}));var a=t.style.clipPath;if(a){var s,u=this.getTransformedGeometryBounds(a,!0);u&&(s=new ra).setFromTransformedAABB(u,this.getWorldTransform(t)),i?s&&(i=s.intersection(i)):i=s}return i&&(n?r.renderBounds=i:r.bounds=i),n?r.renderBoundsDirty=!1:r.boundsDirty=!1,i||null}},{key:"getLocalBounds",value:function(t){if(t.parentNode){var e=Ve();t.parentNode.entity.hasComponent(Ko)&&(e=ze(Ve(),this.getWorldTransform(t.parentNode)));var n=this.getBounds(t);if(n){var r=new ra;return r.setFromTransformedAABB(n,e),r}}return this.getBounds(t)}},{key:"getBoundingClientRect",value:function(t){var e,n,r,i=this.getGeometryBounds(t);i&&(r=new ra).setFromTransformedAABB(i,this.getWorldTransform(t));var o=null===(e=t.ownerDocument)||void 0===e||null===(n=e.defaultView)||void 0===n?void 0:n.getContextService().getBoundingClientRect();if(r){var a=Do(r.getMin(),2),s=a[0],u=a[1],c=Do(r.getMax(),2);return new sa(s+((null==o?void 0:o.left)||0),u+((null==o?void 0:o.top)||0),c[0]-s,c[1]-u)}return new sa((null==o?void 0:o.left)||0,(null==o?void 0:o.top)||0,0,0)}},{key:"dirtifyWorldInternal",value:function(t,e){var n=this;e.dirtyFlag||(e.dirtyFlag=!0,t.childNodes.forEach((function(t){var e=t.getEntity().getComponent(Ko);e.dirtyFlag||n.dirtifyWorldInternal(t,e),t.emit(Ba.ATTRIBUTE_CHANGED,{attributeName:"modelMatrix",oldValue:null,newValue:null})})),t.emit(Ba.ATTRIBUTE_CHANGED,{attributeName:"modelMatrix",oldValue:null,newValue:null}),0===t.childNodes.length&&fa(t))}},{key:"updateTransform",value:function(t,e){if(e.localDirtyFlag&&this.getLocalTransform(t),e.dirtyFlag){var n=t.parentNode,r=n&&n.getEntity().getComponent(Ko);null!==n&&r?Ue(e.worldTransform,r.worldTransform,e.localTransform):Xe(e.worldTransform,e.localTransform),e.dirtyFlag=!1}}}]),t}();Jo([Tt(ua),ta("design:type",Function)],pa.prototype,"sceneGraphSelectorFactory",void 0),pa=Jo([ae()],pa);var va="GeometryUpdaterFactory",ya="GeometryAABBGenerator",ga=function(){function t(){Po(this,t)}return So(t,[{key:"update",value:function(t){var e=t.r,n=void 0===e?0:e,r=t.x,i=t.y;return{width:2*n,height:2*n,x:void 0===r?0:r,y:void 0===i?0:i}}}]),t}();ga=Jo([ae()],ga);var ma=function(){function t(){Po(this,t)}return So(t,[{key:"update",value:function(t){var e=t.rx,n=t.ry,r=t.x,i=t.y;return{width:2*(void 0===e?0:e),height:2*(void 0===n?0:n),x:void 0===r?0:r,y:void 0===i?0:i}}}]),t}();ma=Jo([ae()],ma);var ba=function(){function t(){Po(this,t)}return So(t,[{key:"update",value:function(t){var e,n,r=t.img,i=t.x,o=void 0===i?0:i,a=t.y,s=void 0===a?0:a,u=t.width,c=void 0===u?0:u,l=t.height,h=void 0===l?0:l;return r&&!b(r)&&(t.width||(e=r.width),t.height||(n=r.height)),{width:e||c,height:n||h,x:o,y:s}}}]),t}();ba=Jo([ae()],ba);var wa=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];var xa=function(){function t(){Po(this,t),this.canvas=void 0,this.context=void 0}return So(t,[{key:"getOrCreateCanvas",value:function(){if(this.canvas)return this.canvas;try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d"),this.context&&this.context.measureText||(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch(t){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d")}return this.canvas.width=10,this.canvas.height=10,this.canvas}},{key:"getOrCreateContext",value:function(){return this.context||this.getOrCreateCanvas(),this.context}}]),t}();xa=Jo([ae()],xa);var ka={MetricsString:"|ÉqÅ",BaselineSymbol:"M",BaselineMultiplier:1.4,HeightMultiplier:2,Newlines:[10,13],BreakingSpaces:[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]},Ea=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,Ta=RegExp("".concat(/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/.source,"|").concat(/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/.source,"|").concat(/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/.source,"|").concat(/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/.source)),Ma=RegExp("".concat(/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/.source,"|").concat(/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/.source,"|").concat(/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/.source,"|").concat(/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/.source)),Pa=function(){function t(){var e=this;Po(this,t),this.cache={},this.offscreenCanvas=void 0,this.shouldBreakByKinsokuShorui=function(t,n){return!e.isBreakingSpace(n)&&!(!t||!Ma.exec(n)&&!Ta.exec(t))},this.trimByKinsokuShorui=function(t){var e=Bo(t),n=e[e.length-2];if(!n)return t;var r=n[n.length-1];return e[e.length-2]=n.slice(0,-1),e[e.length-1]=r+e[e.length-1],e}}return So(t,[{key:"measureFont",value:function(t){if(this.cache[t])return this.cache[t];var e={ascent:0,descent:0,fontSize:0},n=this.offscreenCanvas.getOrCreateCanvas(),r=this.offscreenCanvas.getOrCreateContext();r.font=t;var i=ka.MetricsString+ka.BaselineSymbol,o=Math.ceil(r.measureText(i).width),a=Math.ceil(r.measureText(ka.BaselineSymbol).width),s=ka.HeightMultiplier*a;a=a*ka.BaselineMultiplier|0,n.width=o,n.height=s,r.fillStyle="#f00",r.fillRect(0,0,o,s),r.font=t,r.textBaseline="alphabetic",r.fillStyle="#000",r.fillText(i,0,a);var u=r.getImageData(0,0,o,s).data,c=u.length,l=4*o,h=0,f=0,d=!1;for(h=0;a>h;++h){for(var p=0;l>p;p+=4)if(255!==u[f+p]){d=!0;break}if(d)break;f+=l}for(e.ascent=a-h,f=c-l,d=!1,h=s;h>a;--h){for(var v=0;l>v;v+=4)if(255!==u[f+v]){d=!0;break}if(d)break;f-=l}return e.descent=h-a,e.fontSize=e.ascent+e.descent,this.cache[t]=e,e}},{key:"measureText",value:function(t,e){var n=e.fontSize,r=void 0===n?0:n,i=e.wordWrap,o=e.lineHeight,a=void 0===o?0:o,s=e.lineWidth,u=void 0===s?0:s,c=e.textBaseline,l=e.textAlign,h=e.letterSpacing,f=void 0===h?0:h,d=e.dropShadow,p=e.dropShadowDistance,v=void 0===p?0:p,y=e.leading,g=void 0===y?0:y,m=function(t){var e=t.fontSize,n=t.fontFamily,r=t.fontStyle,i=t.fontVariant,o=t.fontWeight,a=x(e)?"".concat(e,"px"):e,s=n;Array.isArray(n)||(s=n.split(","));for(var u=s.length-1;u>=0;u--){var c=s[u].trim();!/([\"\'])[^\'\"]+\1/.test(c)&&0>wa.indexOf(c)&&(c='"'.concat(c,'"')),s[u]=c}return"".concat(r," ").concat(i," ").concat(o," ").concat(a," ").concat(s.join(","))}(e),b=this.measureFont(m);0===b.fontSize&&(b.fontSize=r,b.ascent=r);var w=this.offscreenCanvas.getOrCreateContext();w.font=m;for(var k=(i?this.wordWrap(t,e):t).split(/(?:\r\n|\r|\n)/),E=Array(k.length),T=0,M=0;k.length>M;M++){var P=w.measureText(k[M]).width+(k[M].length-1)*f;E[M]=P,T=Math.max(T,P)}var _=T+u;d&&(_+=v);var S=a||b.fontSize+u,A=Math.max(S,b.fontSize+u)+(k.length-1)*(S+g);d&&(A+=v);var C=0;return"middle"===c?C=-A/2:"bottom"===c||"alphabetic"===c||"ideographic"===c?C=-A:"top"!==c&&"hanging"!==c||(C=0),{font:m,width:_,height:A,lines:k,lineWidths:E,lineHeight:S+=g,maxLineWidth:T,fontProperties:b,lineMetrics:E.map((function(t,e){var n=0;return"center"===l?n-=t/2:"right"!==l&&"end"!==l||(n-=t),new sa(n-u/2,C+e*S,t+u,S)}))}}},{key:"wordWrap",value:function(t,e){var n=this,r=e.wordWrapWidth,i=void 0===r?0:r,o=e.letterSpacing,a=void 0===o?0:o,s=this.offscreenCanvas.getOrCreateContext(),u=i+a,c=[],l=0,h=0,f={},d=function(t){return n.getFromCache(t,a,f,s)};return Array.from(t).forEach((function(e,r){var i=t[r-1],o=t[r+1],a=d(e);if(n.isNewline(e))return l++,h=0,void(c[l]="");if(h>0&&h+a>u){if(l++,h=0,c[l]="",n.isBreakingSpace(e))return;n.canBreakInLastChar(e)||(c=n.trimToBreakable(c),h=n.sumTextWidthByCache(c[l]||"",f)),n.shouldBreakByKinsokuShorui(e,o)&&(c=n.trimByKinsokuShorui(c),h+=d(i||""))}h+=a,c[l]=(c[l]||"")+e})),c.join("\n")}},{key:"isBreakingSpace",value:function(t,e){return"string"==typeof t&&ka.BreakingSpaces.indexOf(t.charCodeAt(0))>=0}},{key:"isNewline",value:function(t){return"string"==typeof t&&ka.Newlines.indexOf(t.charCodeAt(0))>=0}},{key:"trimToBreakable",value:function(t){var e=Bo(t),n=e[e.length-2],r=this.findBreakableIndex(n);if(-1===r||!n)return e;var i=n.slice(r,r+1),o=r+(this.isBreakingSpace(i)?0:1);return e[e.length-1]+=n.slice(r+1,n.length),e[e.length-2]=n.slice(0,o),e}},{key:"canBreakInLastChar",value:function(t){return!t||!Ea.test(t)}},{key:"sumTextWidthByCache",value:function(t,e){return t.split("").reduce((function(t,n){if(!e[n])throw Error("cannot count the word without cache");return t+e[n]}),0)}},{key:"findBreakableIndex",value:function(t){for(var e=t.length-1;e>=0;e--)if(!Ea.test(t[e]))return e;return-1}},{key:"getFromCache",value:function(t,e,n,r){var i=n[t];if("number"!=typeof i){var o=t.length*e;i=r.measureText(t).width+o,n[t]=i}return i}}]),t}();Jo([Tt(xa),ta("design:type",xa)],Pa.prototype,"offscreenCanvas",void 0),Pa=Jo([ae()],Pa);var _a=function(){function t(){Po(this,t),this.textService=void 0}return So(t,[{key:"update",value:function(t){var e=t.text,n=t.textAlign,r=t.lineWidth,i=void 0===r?0:r,o=t.textBaseline,a=t.x,s=void 0===a?0:a,u=t.y,c=void 0===u?0:u,l=this.textService.measureText(void 0===e?"":e,t);t.metrics=l;var h=l.lineHeight,f=l.fontProperties,d=an(l.width/2,l.height/2,0),p=[0,1],v=0;"center"===n?(v=i/2,p=[.5,1]):"right"!==n&&"end"!==n||(v=i,p=[1,1]),t.anchor=p;var y=0;return"middle"===o?y=d[1]:"top"===o||"hanging"===o?y=2*d[1]:"alphabetic"===o?y=h-f.ascent:"bottom"!==o&&"ideographic"!==o||(y=0),{width:2*d[0],height:2*d[1],x:s,y:c,offsetX:v,offsetY:y}}}]),t}();Jo([Tt(Pa),ta("design:type",Pa)],_a.prototype,"textService",void 0),_a=Jo([ae()],_a);var Sa=function(){function t(){Po(this,t)}return So(t,[{key:"update",value:function(t){var e=t.x1,n=t.y1,r=t.x2,i=t.y2,o=Math.min(e,r),a=Math.max(e,r),s=Math.min(n,i);return{width:a-o,height:Math.max(n,i)-s,x:o,y:s}}}]),t}();Sa=Jo([ae()],Sa);var Aa=function(){function t(){Po(this,t)}return So(t,[{key:"update",value:function(t){var e=t.points.points,n=Math.min.apply(Math,Bo(e.map((function(t){return t[0]})))),r=Math.max.apply(Math,Bo(e.map((function(t){return t[0]})))),i=Math.min.apply(Math,Bo(e.map((function(t){return t[1]}))));return{width:r-n,height:Math.max.apply(Math,Bo(e.map((function(t){return t[1]}))))-i,x:n,y:i}}}]),t}();Aa=Jo([ae()],Aa);var Ca=function(){function t(){Po(this,t)}return So(t,[{key:"update",value:function(t,e){var n=t.path.rect;return{width:n.width,height:n.height,x:n.x,y:n.y}}}]),t}();Ca=Jo([ae()],Ca);var Ra,Na="ContextService";!function(t){t[t.CameraChanged=0]="CameraChanged",t[t.DisplayObjectChanged=1]="DisplayObjectChanged",t[t.DisplayObjectRemoved=2]="DisplayObjectRemoved",t[t.None=3]="None"}(Ra||(Ra={}));var Oa="RenderingContext",Ia="RenderingPluginContribution";function ja(t,e,n){var r=t.entity,i=e.prepare.call(t);i&&(n.dirty||(n.dirty=!0,e.beginFrame.call()),e.beforeRender.call(i),e.render.call(i),e.afterRender.call(i),r.getComponent(zo).dirty=!1);var o=r.getComponent(Qo);o.dirty&&(o.sorted=Bo(t.childNodes).sort(ha),o.dirty=!1),(o.sorted||t.childNodes).forEach((function(t){ja(t,e,n)}))}var Da=function(){function t(){Po(this,t),this.renderingPluginContribution=void 0,this.renderingContext=void 0,this.inited=!1,this.hooks={init:new si.AsyncSeriesHook,prepare:new si.SyncWaterfallHook(["object"]),beginFrame:new si.SyncHook([]),beforeRender:new si.SyncHook(["objectToRender"]),render:new si.SyncHook(["objectToRender"]),afterRender:new si.SyncHook(["objectToRender"]),endFrame:new si.SyncHook([]),destroy:new si.SyncHook,pick:new si.AsyncSeriesWaterfallHook(["result"]),pointerDown:new si.SyncHook(["event"]),pointerUp:new si.SyncHook(["event"]),pointerMove:new si.SyncHook(["event"]),pointerOut:new si.SyncHook(["event"]),pointerOver:new si.SyncHook(["event"]),pointerWheel:new si.SyncHook(["event"])}}var e;return So(t,[{key:"init",value:(e=Mo(regeneratorRuntime.mark((function t(){var e=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.renderingPluginContribution.getContributions(!0).forEach((function(t){t.apply(e)})),t.next=3,this.hooks.init.promise();case 3:this.inited=!0;case 4:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"render",value:function(){this.renderingContext.renderReasons.size&&this.inited&&(ja(this.renderingContext.root,this.hooks,this.renderingContext),this.renderingContext.dirty?(this.hooks.endFrame.call(),this.renderingContext.dirty=!1):this.renderingContext.renderReasons.has(Ra.DisplayObjectRemoved)&&(this.hooks.beginFrame.call(),this.hooks.endFrame.call()),this.renderingContext.renderReasons.clear())}},{key:"destroy",value:function(){this.hooks.destroy.call()}},{key:"dirtify",value:function(){this.renderingContext.renderReasons.add(Ra.DisplayObjectChanged)}}]),t}();Jo([Tt($o),se(Ia),ta("design:type",Object)],Da.prototype,"renderingPluginContribution",void 0),Jo([Tt(Oa),ta("design:type",Object)],Da.prototype,"renderingContext",void 0),Da=Jo([ae()],Da);var Ba,Fa=function(){function t(e){Po(this,t),this.type=void 0,this.eventPhase=t.prototype.NONE,this.target=void 0,this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.currentTarget=void 0,this.defaultPrevented=!1,this.timeStamp=void 0,this.nativeEvent=void 0,this._originalEvent=void 0,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.manager=void 0,this.detail=void 0,this.layer=new aa,this.page=new aa,this.canvas=new aa,this.viewport=new aa,this.path=void 0,this.view=void 0,this.which=void 0,this.returnValue=void 0,this.srcElement=void 0,this.composed=!1,this.isTrusted=void 0,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e}return So(t,[{key:"name",get:function(){return this.type}},{key:"originalEvent",get:function(){return this.nativeEvent}},{key:"layerX",get:function(){return this.layer.x}},{key:"layerY",get:function(){return this.layer.y}},{key:"pageX",get:function(){return this.page.x}},{key:"pageY",get:function(){return this.page.y}},{key:"x",get:function(){return this.canvas.x}},{key:"y",get:function(){return this.canvas.y}},{key:"canvasX",get:function(){return this.canvas.x}},{key:"canvasY",get:function(){return this.canvas.y}},{key:"viewportX",get:function(){return this.viewport.x}},{key:"viewportY",get:function(){return this.viewport.y}},{key:"composedPath",value:function(){return!this.manager||this.path&&this.path[0]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}},{key:"propagationPath",get:function(){return this.composedPath()}},{key:"preventDefault",value:function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}},{key:"stopImmediatePropagation",value:function(){this.propagationImmediatelyStopped=!0}},{key:"stopPropagation",value:function(){this.propagationStopped=!0}},{key:"initEvent",value:function(){}},{key:"initUIEvent",value:function(){}}]),t}(),La=function(t){Co(n,t);var e=jo(n);function n(t,r){var i;return Po(this,n),(i=e.call(this,null)).type=t,i.detail=r,Object.assign(Oo(i),r),i}return n}(Fa),Wa=function(t){Co(n,t);var e=jo(n);function n(){var t;Po(this,n);for(var r=arguments.length,i=Array(r),o=0;r>o;o++)i[o]=arguments[o];return(t=e.call.apply(e,[this].concat(i))).shadow=!1,t.ownerDocument=null,t.isConnected=!1,t.baseURI="",t.childNodes=[],t.nodeType=0,t.nodeName="",t.nodeValue=null,t.textContent=null,t.parentNode=null,t}return So(n,[{key:"getRootNode",value:function(t){for(var e=this;e.parentNode;)e=e.parentNode;return e}},{key:"hasChildNodes",value:function(){return this.childNodes.length>0}},{key:"isDefaultNamespace",value:function(t){throw Error("Method not implemented.")}},{key:"compareDocumentPosition",value:function(t){throw Error("Method not implemented.")}},{key:"lookupNamespaceURI",value:function(t){throw Error("Method not implemented.")}},{key:"lookupPrefix",value:function(t){throw Error("Method not implemented.")}},{key:"normalize",value:function(){throw Error("Method not implemented.")}},{key:"isEqualNode",value:function(t){return this===t}},{key:"isSameNode",value:function(t){return this.isEqualNode(t)}},{key:"parent",get:function(){return this.parentNode}},{key:"parentElement",get:function(){return null}},{key:"nextSibling",get:function(){return null}},{key:"previousSibling",get:function(){return null}},{key:"firstChild",get:function(){return this.childNodes.length>0?this.childNodes[0]:null}},{key:"lastChild",get:function(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null}},{key:"contain",value:function(t){return this.contains(t)}},{key:"contains",value:function(t){for(var e=t;e&&this!==e;)e=e.parentNode;return!!e}},{key:"getAncestor",value:function(t){for(var e=this;t>0&&e;)e=e.parentNode,t--;return e}},{key:"forEach",value:function(t){t(this)||this.childNodes.forEach((function(e){e.forEach(t)}))}}],[{key:"isNode",value:function(t){return!!t.childNodes}}]),n}(function(){function t(){Po(this,t),this.emitter=new ue.EventEmitter,this.entity=void 0;var e=xu.createEntity();this.entity=e}return So(t,[{key:"getEntity",value:function(){return this.entity}},{key:"on",value:function(t,e,n){return this.addEventListener(t,e,n),this}},{key:"addEventListener",value:function(t,e,n){var r=k(n)&&n||g(n)&&n.capture,i=g(n)&&n.once,o=p(e)?void 0:e,a=!1,s="";if(t.indexOf(":")>-1){var u=Do(t.split(":"),2);t=u[1],s=u[0],a=!0}if(t=r?"".concat(t,"capture"):t,e=p(e)?e:e.handleEvent,a){var c=e;e=function(){for(var t,e=arguments.length,n=Array(e),r=0;e>r;r++)n[r]=arguments[r];(null===(t=n[0].target)||void 0===t?void 0:t.name)===s&&c.apply(void 0,n)}}return i?this.emitter.once(t,e,o):this.emitter.on(t,e,o),this}},{key:"off",value:function(t,e,n){return t?this.removeEventListener(t,e,n):this.removeAllEventListeners(),this}},{key:"removeAllEventListeners",value:function(){this.emitter.removeAllListeners()}},{key:"removeEventListener",value:function(t,e,n){var r=k(n)&&n||g(n)&&n.capture,i=p(e)?void 0:e;return t=r?"".concat(t,"capture"):t,e=p(e)?e:e.handleEvent,this.emitter.off(t,e,i),this}},{key:"emit",value:function(t,e){this.dispatchEvent(new La(t,e))}},{key:"dispatchEvent",value:function(t){if(!(t instanceof Fa))throw Error("DisplayObject cannot propagate events outside of the Federated Events API");var e,n,r=this.ownerDocument||this.document;r&&(t.manager=(null===(e=r.defaultView)||void 0===e?void 0:e.getEventService())||null,t.defaultPrevented=!1,t.path=[],t.target=this,null===(n=t.manager)||void 0===n||n.dispatchEvent(t));return!t.defaultPrevented}}]),t}());!function(t){t.DESTROY="destroy",t.ATTRIBUTE_CHANGED="attribute-changed",t.INSERTED="inserted",t.CHILD_INSERTED="child-inserted",t.REMOVED="removed",t.CHILD_REMOVED="child-removed",t.MOUNTED="mounted",t.UNMOUNTED="unmounted",t.BOUNDS_CHANGED="bounds-changed"}(Ba||(Ba={}));var Ga=function(t){Co(n,t);var e=jo(n);function n(t){var r;Po(this,n),(r=e.call(this)).sceneGraphService=wu.get(da),r.id=void 0,r.className=void 0,r.name=void 0,r.interactive=void 0,r.scrollLeft=0,r.scrollTop=0,r.destroyed=!1,r.style={},r.parsedStyle={},r.attributes={};var i=r.entity;return i.addComponent(zo),i.addComponent(Zo),i.addComponent(Ko),i.addComponent(Qo),i.addComponent(Yo),r}return So(n,[{key:"classList",get:function(){return this.className.split(" ")}},{key:"tagName",get:function(){return this.nodeName}},{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"parentElement",get:function(){return this.parentNode}},{key:"nextSibling",get:function(){if(this.parentNode){var t=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[t+1]||null}return null}},{key:"previousSibling",get:function(){if(this.parentNode){var t=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[t-1]||null}return null}},{key:"cloneNode",value:function(t){throw Error("Method not implemented.")}},{key:"appendChild",value:function(t,e){return this.sceneGraphService.attach(t,this,e),this.emit(Ba.CHILD_INSERTED,{child:t}),t.emit(Ba.INSERTED,{parent:this}),t}},{key:"insertBefore",value:function(t,e){if(e){var n=this.childNodes.indexOf(e);this.appendChild(t,n-1)}else this.appendChild(t);return t}},{key:"replaceChild",value:function(t,e,n){var r=this.childNodes.indexOf(e);return this.removeChild(e,n),this.appendChild(t,r),e}},{key:"removeChild",value:function(t){var e=1>=arguments.length||void 0===arguments[1]||arguments[1];return t.emit(Ba.REMOVED,{parent:this}),e&&(t.emit(Ba.DESTROY,{}),t.destroyed=!0),this.emit(Ba.CHILD_REMOVED,{child:t}),this.sceneGraphService.detach(t),e&&(t.entity.destroy(),t.emitter.removeAllListeners()),t}},{key:"removeChildren",value:function(){var t=this,e=0>=arguments.length||void 0===arguments[0]||arguments[0];Bo(this.childNodes).forEach((function(n){t.removeChild(n,e)}))}},{key:"matches",value:function(t){return this.sceneGraphService.matches(t,this)}},{key:"getElementById",value:function(t){return this.sceneGraphService.querySelector("#".concat(t),this)}},{key:"getElementsByName",value:function(t){return this.sceneGraphService.querySelectorAll('[name="'.concat(t,'"]'),this)}},{key:"getElementsByClassName",value:function(t){return this.sceneGraphService.querySelectorAll(".".concat(t),this)}},{key:"getElementsByTagName",value:function(t){return this.sceneGraphService.querySelectorAll(t,this)}},{key:"querySelector",value:function(t){return this.sceneGraphService.querySelector(t,this)}},{key:"querySelectorAll",value:function(t){return this.sceneGraphService.querySelectorAll(t,this)}},{key:"find",value:function(t){var e=this,n=null;return this.forEach((function(r){return!(r===e||!t(r))&&(n=r,!0)})),n}},{key:"findAll",value:function(t){var e=this,n=[];return this.forEach((function(r){r!==e&&t(r)&&n.push(r)})),n}},{key:"after",value:function(){var t=this;if(this.parentNode){for(var e=this.parentNode.childNodes.indexOf(this),n=arguments.length,r=Array(n),i=0;n>i;i++)r[i]=arguments[i];r.forEach((function(n,r){var i;return null===(i=t.parentNode)||void 0===i?void 0:i.appendChild(n,e+r+1)}))}}},{key:"before",value:function(){if(this.parentNode){for(var t=this.parentNode.childNodes.indexOf(this),e=arguments.length,n=Array(e),r=0;e>r;r++)n[r]=arguments[r];var i=n[0],o=n.slice(1);this.parentNode.appendChild(i,t),i.after.apply(i,Bo(o))}}},{key:"replaceWith",value:function(){this.after.apply(this,arguments),this.remove()}},{key:"append",value:function(){for(var t=this,e=arguments.length,n=Array(e),r=0;e>r;r++)n[r]=arguments[r];n.forEach((function(e){return t.appendChild(e)}))}},{key:"prepend",value:function(){for(var t=this,e=arguments.length,n=Array(e),r=0;e>r;r++)n[r]=arguments[r];n.forEach((function(e,n){return t.appendChild(e,n)}))}},{key:"replaceChildren",value:function(){for(;this.childNodes.length&&this.firstChild;)this.removeChild(this.firstChild);this.append.apply(this,arguments)}},{key:"remove",value:function(){var t=0>=arguments.length||void 0===arguments[0]||arguments[0];return this.parentNode?this.parentNode.removeChild(this,t):this}},{key:"destroy",value:function(){this.emit(Ba.DESTROY,{}),this.remove(!1),this.entity.destroy(),this.emitter.removeAllListeners(),this.destroyed=!0}},{key:"getGeometryBounds",value:function(){return this.sceneGraphService.getGeometryBounds(this)}},{key:"getRenderBounds",value:function(){return this.sceneGraphService.getBounds(this,!0)}},{key:"getBounds",value:function(){return this.sceneGraphService.getBounds(this)}},{key:"getLocalBounds",value:function(){return this.sceneGraphService.getLocalBounds(this)}},{key:"getBoundingClientRect",value:function(){return this.sceneGraphService.getBoundingClientRect(this)}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"getAttribute",value:function(t){var e=this.attributes[t];return v(e)?void 0:e}},{key:"removeAttribute",value:function(t){delete this.attributes[t]}},{key:"setAttribute",value:function(t,e){this.attributes[t]=e}}],[{key:"isElement",value:function(t){return!!t.getAttribute}}]),n}(Wa),qa=function(t){Co(n,t);var e=jo(n);function n(){var t;Po(this,n);for(var r=arguments.length,i=Array(r),o=0;r>o;o++)i[o]=arguments[o];return(t=e.call.apply(e,[this].concat(i))).altKey=void 0,t.button=void 0,t.buttons=void 0,t.ctrlKey=void 0,t.metaKey=void 0,t.relatedTarget=void 0,t.shiftKey=void 0,t.client=new aa,t.movement=new aa,t.offset=new aa,t.global=new aa,t.screen=new aa,t}return So(n,[{key:"clientX",get:function(){return this.client.x}},{key:"clientY",get:function(){return this.client.y}},{key:"movementX",get:function(){return this.movement.x}},{key:"movementY",get:function(){return this.movement.y}},{key:"offsetX",get:function(){return this.offset.x}},{key:"offsetY",get:function(){return this.offset.y}},{key:"globalX",get:function(){return this.global.x}},{key:"globalY",get:function(){return this.global.y}},{key:"screenX",get:function(){return this.screen.x}},{key:"screenY",get:function(){return this.screen.y}},{key:"getModifierState",value:function(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}},{key:"initMouseEvent",value:function(){throw Error("Method not implemented.")}}]),n}(Fa),$a=function(t){Co(n,t);var e=jo(n);function n(){var t;Po(this,n);for(var r=arguments.length,i=Array(r),o=0;r>o;o++)i[o]=arguments[o];return(t=e.call.apply(e,[this].concat(i))).pointerId=void 0,t.width=0,t.height=0,t.isPrimary=!1,t.pointerType=void 0,t.pressure=void 0,t.tangentialPressure=void 0,t.tiltX=void 0,t.tiltY=void 0,t.twist=void 0,t}return So(n,[{key:"getCoalescedEvents",value:function(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}},{key:"getPredictedEvents",value:function(){throw Error("getPredictedEvents is not supported!")}}]),n}(qa),Ha=function(t){Co(n,t);var e=jo(n);function n(){var t;Po(this,n);for(var r=arguments.length,i=Array(r),o=0;r>o;o++)i[o]=arguments[o];return(t=e.call.apply(e,[this].concat(i))).deltaMode=void 0,t.deltaX=void 0,t.deltaY=void 0,t.deltaZ=void 0,t.DOM_DELTA_LINE=0,t.DOM_DELTA_PAGE=1,t.DOM_DELTA_PIXEL=2,t}return n}(qa),Va=function(t){Co(o,t);var e,n,r,i=jo(o);function o(){var t;Po(this,o);for(var e=arguments.length,n=Array(e),r=0;e>r;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n))).renderingContext=void 0,t.contextService=void 0,t.canvasConfig=void 0,t.rootTarget=void 0,t.cursor="default",t.mappingTable={},t.mappingState={trackingData:{}},t.eventPool=new Map,t.pickHandler=void 0,t.onPointerDown=function(){var e=Mo(regeneratorRuntime.mark((function e(n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n instanceof $a){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,t.createPointerEvent(n);case 4:t.dispatchEvent(r=e.sent,"pointerdown"),"touch"===r.pointerType?t.dispatchEvent(r,"touchstart"):"mouse"!==r.pointerType&&"pen"!==r.pointerType||t.dispatchEvent(r,2===r.button?"rightdown":"mousedown"),t.trackingData(n.pointerId).pressTargetsByButton[n.button]=r.composedPath(),t.freeEvent(r);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.onPointerUp=function(){var e=Mo(regeneratorRuntime.mark((function e(n){var r,i,o,a,s,u,c,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n instanceof $a){e.next=2;break}return e.abrupt("return");case 2:return r=performance.now(),e.next=5,t.createPointerEvent(n);case 5:if(t.dispatchEvent(i=e.sent,"pointerup"),"touch"===i.pointerType?t.dispatchEvent(i,"touchend"):"mouse"!==i.pointerType&&"pen"!==i.pointerType||t.dispatchEvent(i,2===i.button?"rightup":"mouseup"),o=t.trackingData(n.pointerId),a=t.findMountedTarget(o.pressTargetsByButton[n.button]),s=a,a&&!i.composedPath().includes(a)){for(u=a;u&&!i.composedPath().includes(u);)i.currentTarget=u,t.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType?t.notifyTarget(i,"touchendoutside"):"mouse"!==i.pointerType&&"pen"!==i.pointerType||t.notifyTarget(i,2===i.button?"rightupoutside":"mouseupoutside"),Wa.isNode(u)&&(u=u.parentNode);delete o.pressTargetsByButton[n.button],s=u}s&&((c=t.clonePointerEvent(i,"click")).target=s,c.path=[],o.clicksByButton[n.button]||(o.clicksByButton[n.button]={clickCount:0,target:c.target,timeStamp:r}),(l=o.clicksByButton[n.button]).target===c.target&&200>r-l.timeStamp?++l.clickCount:l.clickCount=1,l.target=c.target,l.timeStamp=r,c.detail=l.clickCount,t.dispatchEvent(c,"mouse"===c.pointerType?"click":"touch"===c.pointerType?"tap":"pointertap"),t.freeEvent(c)),t.freeEvent(i);case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.onPointerMove=function(){var e=Mo(regeneratorRuntime.mark((function e(n){var r,i,o,a,s,u,c,l,h,f;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n instanceof $a){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,t.createPointerEvent(n);case 4:if(i="mouse"===(r=e.sent).pointerType||"pen"===r.pointerType,o=t.trackingData(n.pointerId),a=t.findMountedTarget(o.overTargets),!o.overTargets||a===r.target){e.next=23;break}return s="mousemove"===n.type?"mouseout":"pointerout",e.next=12,t.createPointerEvent(n,s,a||void 0);case 12:if(t.dispatchEvent(u=e.sent,"pointerout"),i&&t.dispatchEvent(u,"mouseout"),r.composedPath().includes(a)){e.next=22;break}return e.next=18,t.createPointerEvent(n,"pointerleave",a||void 0);case 18:for((c=e.sent).eventPhase=c.AT_TARGET;c.target&&!r.composedPath().includes(c.target);)c.currentTarget=c.target,t.notifyTarget(c),i&&t.notifyTarget(c,"mouseleave"),Wa.isNode(c.target)&&(c.target=c.target.parentNode);t.freeEvent(c);case 22:t.freeEvent(u);case 23:if(a===r.target){e.next=38;break}l=t.clonePointerEvent(r,"mousemove"===n.type?"mouseover":"pointerover"),t.dispatchEvent(l,"pointerover"),i&&t.dispatchEvent(l,"mouseover"),h=a&&Wa.isNode(a)&&a.parentNode;case 29:if(!h||h===(Wa.isNode(t.rootTarget)&&t.rootTarget.parentNode)){e.next=35;break}if(h!==r.target){e.next=32;break}return e.abrupt("break",35);case 32:h=h.parentNode,e.next=29;break;case 35:if(!h||h===(Wa.isNode(t.rootTarget)&&t.rootTarget.parentNode)){for((f=t.clonePointerEvent(r,"pointerenter")).eventPhase=f.AT_TARGET;f.target&&f.target!==a&&f.target!==(Wa.isNode(t.rootTarget)&&t.rootTarget.parentNode);)f.currentTarget=f.target,t.notifyTarget(f),i&&t.notifyTarget(f,"mouseenter"),Wa.isNode(f.target)&&(f.target=f.target.parentNode);t.freeEvent(f)}t.freeEvent(l);case 38:t.dispatchEvent(r,"pointermove"),"touch"===r.pointerType&&t.dispatchEvent(r,"touchmove"),i&&(t.dispatchEvent(r,"mousemove"),t.cursor=t.getCursor(r.target)),o.overTargets=r.composedPath(),t.freeEvent(r);case 43:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.onPointerOut=function(){var e=Mo(regeneratorRuntime.mark((function e(n){var r,i,o,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n instanceof $a){e.next=2;break}return e.abrupt("return");case 2:if(!(r=t.trackingData(n.pointerId)).overTargets){e.next=19;break}return i="mouse"===n.pointerType||"pen"===n.pointerType,o=t.findMountedTarget(r.overTargets),e.next=8,t.createPointerEvent(n,"pointerout",o||void 0);case 8:return t.dispatchEvent(a=e.sent),i&&t.dispatchEvent(a,"mouseout"),e.next=13,t.createPointerEvent(n,"pointerleave",o||void 0);case 13:for((s=e.sent).eventPhase=s.AT_TARGET;s.target&&s.target!==(Wa.isNode(t.rootTarget)&&t.rootTarget.parentNode);)s.currentTarget=s.target,t.notifyTarget(s),i&&t.notifyTarget(s,"mouseleave"),Wa.isNode(s.target)&&(s.target=s.target.parentNode);r.overTargets=null,t.freeEvent(a),t.freeEvent(s);case 19:t.cursor=null;case 20:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.onPointerOver=function(){var e=Mo(regeneratorRuntime.mark((function e(n){var r,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n instanceof $a){e.next=2;break}return e.abrupt("return");case 2:return r=t.trackingData(n.pointerId),e.next=5,t.createPointerEvent(n);case 5:for(o="mouse"===(i=e.sent).pointerType||"pen"===i.pointerType,t.dispatchEvent(i,"pointerover"),o&&t.dispatchEvent(i,"mouseover"),"mouse"===i.pointerType&&(t.cursor=t.getCursor(i.target)),(a=t.clonePointerEvent(i,"pointerenter")).eventPhase=a.AT_TARGET;a.target&&a.target!==(Wa.isNode(t.rootTarget)&&t.rootTarget.parentNode);)a.currentTarget=a.target,t.notifyTarget(a),o&&t.notifyTarget(a,"mouseenter"),Wa.isNode(a.target)&&(a.target=a.target.parentNode);r.overTargets=i.composedPath(),t.freeEvent(i),t.freeEvent(a);case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.onPointerUpOutside=function(){var e=Mo(regeneratorRuntime.mark((function e(n){var r,i,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n instanceof $a){e.next=2;break}return e.abrupt("return");case 2:return r=t.trackingData(n.pointerId),i=t.findMountedTarget(r.pressTargetsByButton[n.button]),e.next=6,t.createPointerEvent(n);case 6:if(o=e.sent,i){for(a=i;a;)o.currentTarget=a,t.notifyTarget(o,"pointerupoutside"),"touch"===o.pointerType?t.notifyTarget(o,"touchendoutside"):"mouse"!==o.pointerType&&"pen"!==o.pointerType||t.notifyTarget(o,2===o.button?"rightupoutside":"mouseupoutside"),Wa.isNode(a)&&(a=a.parentNode);delete r.pressTargetsByButton[n.button]}t.freeEvent(o);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t.onWheel=function(){var e=Mo(regeneratorRuntime.mark((function e(n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n instanceof Ha){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,t.createWheelEvent(n);case 4:t.dispatchEvent(r=e.sent),t.freeEvent(r);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),t}return So(o,[{key:"init",value:function(){this.rootTarget=this.renderingContext.root.parentNode,this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel)}},{key:"client2Viewport",value:function(t){var e=this.contextService.getBoundingClientRect();return new aa(t.x-((null==e?void 0:e.left)||0),t.y-((null==e?void 0:e.top)||0))}},{key:"viewport2Client",value:function(t){var e=this.contextService.getBoundingClientRect();return new aa(t.x+((null==e?void 0:e.left)||0),t.y+((null==e?void 0:e.top)||0))}},{key:"viewport2Canvas",value:function(t){var e=t.x,n=t.y,r=this.rootTarget.defaultView.getCamera(),i=this.canvasConfig,o=i.width,a=i.height,s=r.getPerspectiveInverse(),u=r.getWorldTransform(),c=Ue(Ve(),u,s),l=an(e/o*2-1,2*(1-n/a)-1,0);return En(l,l,c),new aa(l[0],l[1])}},{key:"canvas2Viewport",value:function(t){var e=this.rootTarget.defaultView.getCamera(),n=e.getPerspective(),r=e.getViewTransform(),i=Ue(Ve(),n,r),o=an(t.x,t.y,0);En(o,o,i);var a=this.canvasConfig;return new aa((o[0]+1)/2*a.width,(1-(o[1]+1)/2)*a.height)}},{key:"setPickHandler",value:function(t){this.pickHandler=t}},{key:"addEventMapping",value:function(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort((function(t,e){return t.priority-e.priority}))}},{key:"mapEvent",value:function(t){if(this.rootTarget){var e=this.mappingTable[t.type];if(e)for(var n=0,r=e.length;r>n;n++)e[n].fn(t);else console.warn("[EventService]: Event mapping not defined for ".concat(t.type))}}},{key:"dispatchEvent",value:function(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.emit(e||t.type,t)}},{key:"propagate",value:function(t,e){if(t.target){var n=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(var r=n.length-1;r>=1;r--)if(t.currentTarget=n[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){t.eventPhase=t.BUBBLING_PHASE;for(var i=1;n.length>i;i++)if(t.currentTarget=n[i],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}}},{key:"propagationPath",value:function(t){var e=[t],n=this.rootTarget.defaultView||null;if(n&&n===t)return e.unshift(n.document),e;for(var r=0;2048>r&&t!==this.rootTarget;r++){if(Wa.isNode(t)&&!t.parentNode)throw Error("Cannot find propagation path to disconnected target");Wa.isNode(t)&&(e.push(t.parentNode),t=t.parentNode)}return n&&e.push(n),e}},{key:"hitTest",value:(r=Mo(regeneratorRuntime.mark((function t(e){var n,r,i,o,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.viewportY,o=(i=this.canvasConfig).width,a=i.height,!(0>(n=e.viewportX)||0>r||n>o||r>a)){t.next=4;break}return t.abrupt("return",null);case 4:return t.next=6,this.pickHandler(e);case 6:if(t.t1=t.sent,t.t1){t.next=9;break}t.t1=this.rootTarget;case 9:if(t.t0=t.t1,t.t0){t.next=12;break}t.t0=null;case 12:return t.abrupt("return",t.t0);case 13:case"end":return t.stop()}}),t,this)}))),function(t){return r.apply(this,arguments)})},{key:"createPointerEvent",value:(n=Mo(regeneratorRuntime.mark((function t(e,n,r){var i;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=this.allocateEvent($a),this.copyPointerData(e,i),this.copyMouseData(e,i),this.copyData(e,i),i.nativeEvent=e.nativeEvent,i._originalEvent=e,null==r){t.next=10;break}t.t0=r,t.next=13;break;case 10:return t.next=12,this.hitTest({clientX:i.clientX,clientY:i.clientY,viewportX:i.viewportX,viewportY:i.viewportY,x:i.global.x,y:i.global.y});case 12:t.t0=t.sent;case 13:return i.target=t.t0,"string"==typeof n&&(i.type=n),t.abrupt("return",i);case 16:case"end":return t.stop()}}),t,this)}))),function(t,e,r){return n.apply(this,arguments)})},{key:"createWheelEvent",value:(e=Mo(regeneratorRuntime.mark((function t(e){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.allocateEvent(Ha),this.copyWheelData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.nativeEvent=e.nativeEvent,n._originalEvent=e,t.next=8,this.hitTest({clientX:n.clientX,clientY:n.clientY,viewportX:n.viewportX,viewportY:n.viewportY,x:n.global.x,y:n.global.y});case 8:return n.target=t.sent,t.abrupt("return",n);case 10:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"trackingData",value:function(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}},{key:"clonePointerEvent",value:function(t,e){var n=this.allocateEvent($a);return n.nativeEvent=t.nativeEvent,n._originalEvent=t._originalEvent,this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.target=t.target,n.path=t.composedPath().slice(),n.type=null!=e?e:n.type,n}},{key:"copyPointerData",value:function(t,e){t instanceof $a&&e instanceof $a&&(e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist)}},{key:"copyMouseData",value:function(t,e){t instanceof qa&&e instanceof qa&&(e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.client.copyFrom(t.client),e.movement.copyFrom(t.movement),e.canvas.copyFrom(t.canvas),e.screen.copyFrom(t.screen),e.global.copyFrom(t.global),e.offset.copyFrom(t.offset))}},{key:"copyWheelData",value:function(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}},{key:"copyData",value:function(t,e){e.isTrusted=t.isTrusted,e.timeStamp=performance.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.page.copyFrom(t.page),e.viewport.copyFrom(t.viewport)}},{key:"allocateEvent",value:function(t){this.eventPool.has(t)||this.eventPool.set(t,[]);var e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=[],e.target=null,e}},{key:"freeEvent",value:function(t){if(t.manager!==this)throw Error("It is illegal to free an event not managed by this EventBoundary!");var e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}},{key:"notifyTarget",value:function(t,e){var n;e=null!==(n=e)&&void 0!==n?n:t.type,this.notifyListeners(t,t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?"".concat(e,"capture"):e),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}},{key:"notifyListeners",value:function(t,e){var n=t.currentTarget.emitter,r=n._events[e];if(r)if("fn"in r)r.once&&n.removeListener(e,r.fn,void 0,!0),r.fn.call(r.context,t);else for(var i=0;r.length>i&&!t.propagationImmediatelyStopped;i++)r[i].once&&n.removeListener(e,r[i].fn,void 0,!0),r[i].fn.call(r[i].context,t)}},{key:"findMountedTarget",value:function(t){if(!t)return null;for(var e=t[t.length-1],n=t.length-2;n>=0;n--){var r=t[n];if(!(r===this.rootTarget||Wa.isNode(r)&&r.parentNode===e))break;e=t[n]}return e}},{key:"getCursor",value:function(t){for(var e=t;e;){var n=Ga.isElement(e)&&e.getAttribute("cursor");if(n)return n;e=Wa.isNode(e)&&e.parentNode}}}]),o}(ue.EventEmitter);function Xa(t){return void 0===t?0:t>360||-360>t?t%360:t}function Ya(t,e,n){return x(t)?an(t,e,n):3===t.length?rn(t):an(t[0],t[1],t[2]||0)}function za(t,e){return 16===e.length?function(t,e){var n,r,i,o=.5*Math.PI,a=Do(Qe(nn(),e),3),s=a[0],u=a[1],c=a[2];return o>(r=Math.asin(-e[2]/s))?r>-o?(n=Math.atan2(e[6]/u,e[10]/c),i=Math.atan2(e[1]/s,e[0]/s)):(i=0,n=-Math.atan2(e[4]/u,e[5]/u)):(i=0,n=Math.atan2(e[4]/u,e[5]/u)),t[0]=n,t[1]=r,t[2]=i,t}(t,e):function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=r*r,s=i*i,u=o*o,c=n*n+a+s+u,l=n*o-r*i;return l>.499995*c?(t[0]=Math.PI/2,t[1]=2*Math.atan2(r,n),t[2]=0):-.499995*c>l?(t[0]=-Math.PI/2,t[1]=2*Math.atan2(r,n),t[2]=0):(t[0]=Math.asin(2*(n*i-o*r)),t[1]=Math.atan2(2*(n*o+r*i),1-2*(s+u)),t[2]=Math.atan2(2*(n*r+i*o),1-2*(a+s))),t}(t,e)}function Ua(t,e,n,r,i){var o,a,s,u,c,l,h,f,d,p,v=Math.cos(t),y=Math.sin(t);return o=r*v,a=i*y,s=0,u=-r*y,c=i*v,l=0,h=e,f=n,d=1,(p=new qe(9))[0]=o,p[1]=a,p[2]=s,p[3]=u,p[4]=c,p[5]=l,p[6]=h,p[7]=f,p[8]=d,p}Jo([Tt(Oa),ta("design:type",Object)],Va.prototype,"renderingContext",void 0),Jo([Tt(Na),ta("design:type",Object)],Va.prototype,"contextService",void 0),Jo([Tt(Xo),ta("design:type",Object)],Va.prototype,"canvasConfig",void 0),Jo([function(t,e,n){var r=new yt(D,e);if(Reflect.hasOwnMetadata(D,t.constructor))throw Error("Cannot apply @postConstruct decorator multiple times in the same class");Reflect.defineMetadata(D,r,t.constructor)},ta("design:type",Function),ta("design:paramtypes",[]),ta("design:returntype",void 0)],Va.prototype,"init",null),Va=Jo([ae()],Va);var Ka=function(t){Co(n,t);var e=jo(n);function n(t,r,i,o){var a;return Po(this,n),(a=e.call(this,t)).currentTime=void 0,a.timelineTime=void 0,a.currentTime=i,a.timelineTime=o,a.target=r,a.type="finish",a.bubbles=!1,a.currentTarget=r,a.defaultPrevented=!1,a.eventPhase=a.AT_TARGET,a.timeStamp=Date.now(),a.currentTime=i,a.timelineTime=o,a}return n}(Fa),Za=0,Qa=function(){function t(e,n){Po(this,t),this.effect=void 0,this.timeline=void 0,this.id=void 0,this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this.oldPlayState=void 0,this._holdTime=void 0,this.readyPromise=void 0,this.finishedPromise=void 0,this.resolveReadyPromise=void 0,this.rejectReadyPromise=void 0,this.resolveFinishedPromise=void 0,this.rejectFinishedPromise=void 0,this.onfinish=void 0,this.oncancel=void 0,this.onframe=void 0,this._currentTime=0,this._startTime=void 0,this._playbackRate=1,this._inEffect=void 0,this._inTimeline=!0,this.onremove=void 0,this.effect=e,e.animation=this,this.timeline=n,this.id="".concat(Za++),this._inEffect=!!this.effect.update(0),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()}return So(t,[{key:"pending",get:function(){return null===this._startTime&&!this._paused&&0!==this.playbackRate||this.currentTimePending}},{key:"playState",get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"}},{key:"ready",get:function(){var t=this;return this.readyPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise((function(e,n){t.resolveReadyPromise=function(){e(t)},t.rejectReadyPromise=function(){n(Error())}})),this.pending||this.resolveReadyPromise()),this.readyPromise}},{key:"finished",get:function(){var t=this;return this.finishedPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise((function(e,n){t.resolveFinishedPromise=function(){e(t)},t.rejectFinishedPromise=function(){n(Error())}})),"finished"===this.playState&&this.resolveFinishedPromise()),this.finishedPromise}},{key:"currentTime",get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(t){if(!isNaN(t=Number(t))){var e;if(this.timeline.restart(),!this._paused&&null!==this._startTime)this._startTime=Number(null===(e=this.timeline)||void 0===e?void 0:e.currentTime)-t/this.playbackRate;this.currentTimePending=!1,this._currentTime!==t&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(t,!0),this.timeline.applyDirtiedAnimation(this))}}},{key:"startTime",get:function(){return this._startTime},set:function(t){if(null!==t){if(this.updatePromises(),isNaN(t=Number(t)))return;if(this._paused||this._idle)return;this._startTime=t,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()}}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(t){if(t!==this._playbackRate){this.updatePromises();var e=this.currentTime;this._playbackRate=t,this.startTime=null,"paused"!==this.playState&&"idle"!==this.playState&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),null!==e&&(this.currentTime=e),this.updatePromises()}}},{key:"_isFinished",get:function(){return!this._idle&&(this._playbackRate>0&&Number(this._currentTime)>=this.totalDuration||0>this._playbackRate&&0>=Number(this._currentTime))}},{key:"totalDuration",get:function(){var t;return Number(null===(t=this.effect)||void 0===t?void 0:t.getComputedTiming().activeDuration)}},{key:"_needsTick",get:function(){return this.pending||"running"===this.playState||!this._finishedFlag}},{key:"updatePromises",value:function(){var t=this.oldPlayState,e=this.pending?"pending":this.playState;return this.readyPromise&&e!==t&&("idle"===e?(this.rejectReadyPromise(),this.readyPromise=void 0):"pending"===t?this.resolveReadyPromise():"pending"===e&&(this.readyPromise=void 0)),this.finishedPromise&&e!==t&&("idle"===e?(this.rejectFinishedPromise(),this.finishedPromise=void 0):"finished"===e?this.resolveFinishedPromise():"finished"===t&&(this.finishedPromise=void 0)),this.oldPlayState=e,this.readyPromise||this.finishedPromise}},{key:"play",value:function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),-1===this.timeline.animations.indexOf(this)&&this.timeline.animations.push(this),this.updatePromises()}},{key:"pause",value:function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),this._isFinished||this._paused||this._idle?this._idle&&(this.rewind(),this._idle=!1):this.currentTimePending=!0,this._startTime=null,this._paused=!0,this.updatePromises()}},{key:"finish",value:function(){this.updatePromises(),this._idle||(this.currentTime=this._playbackRate>0?this.totalDuration:0,this._startTime=this.totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())}},{key:"cancel",value:function(){this.updatePromises(),this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises())}},{key:"reverse",value:function(){this.updatePromises();var t=this.currentTime;this.playbackRate*=-1,this.play(),null!==t&&(this.currentTime=t),this.updatePromises()}},{key:"updatePlaybackRate",value:function(t){this.playbackRate=t}},{key:"targetAnimations",value:function(){var t;return(null===(t=this.effect)||void 0===t?void 0:t.target).getAnimations()}},{key:"markTarget",value:function(){var t=this.targetAnimations();-1===t.indexOf(this)&&t.push(this)}},{key:"unmarkTarget",value:function(){var t=this.targetAnimations(),e=t.indexOf(this);-1!==e&&t.splice(e,1)}},{key:"tick",value:function(t,e){this._idle||this._paused||(null===this._startTime?e&&(this.startTime=t-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((t-this._startTime)*this.playbackRate)),e&&(this.currentTimePending=!1,this.fireEvents(t))}},{key:"rewind",value:function(){if(this.playbackRate<0){if(this.totalDuration>=1/0)throw Error("Unable to rewind negative playback rate animation with infinite duration");this.currentTime=this.totalDuration}else this.currentTime=0}},{key:"persist",value:function(){throw Error("Method not implemented.")}},{key:"addEventListener",value:function(t,e,n){throw Error("Method not implemented.")}},{key:"removeEventListener",value:function(t,e,n){throw Error("Method not implemented.")}},{key:"dispatchEvent",value:function(t){throw Error("Method not implemented.")}},{key:"commitStyles",value:function(){throw Error("Method not implemented.")}},{key:"ensureAlive",value:function(){var t,e;0>this.playbackRate&&0===this.currentTime?this._inEffect=!!(null===(t=this.effect)||void 0===t?void 0:t.update(-1)):this._inEffect=!!(null===(e=this.effect)||void 0===e?void 0:e.update(this.currentTime));this._inTimeline||!this._inEffect&&this._finishedFlag||(this._inTimeline=!0,this.timeline.animations.push(this))}},{key:"tickCurrentTime",value:function(t,e){t!==this._currentTime&&(this._currentTime=t,this._isFinished&&!e&&(this._currentTime=this._playbackRate>0?this.totalDuration:0),this.ensureAlive())}},{key:"fireEvents",value:function(t){var e=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var n=new Ka(null,this,this.currentTime,t);setTimeout((function(){e.onfinish&&e.onfinish(n)}))}this._finishedFlag=!0}}else{if(this.onframe&&"running"===this.playState){var r=new Ka(null,this,this.currentTime,t);this.onframe(r)}this._finishedFlag=!1}}}]),t}();function Ja(t){return("object"===("undefined"==typeof window?"undefined":Eo(window))&&window.requestAnimationFrame?window.requestAnimationFrame:function(t){return setTimeout(t,16)})(t)}function ts(t){return("object"===("undefined"==typeof window?"undefined":Eo(window))&&window.cancelAnimationFrame?window.cancelAnimationFrame:clearTimeout)(t)}function es(t,e){return Number(t.id)-Number(e.id)}var ns=function(){function t(){var e=this;Po(this,t),this.animations=[],this.ticking=!1,this.timelineTicking=!1,this.hasRestartedThisFrame=!1,this.animationsWithPromises=[],this.inTick=!1,this.pendingEffects=[],this.currentTime=null,this.rafId=0,this.rafCallbacks=[],this.frameId=void 0,this.webAnimationsNextTick=function(t){e.currentTime=t,e.discardAnimations(),0===e.animations.length?e.timelineTicking=!1:e.requestAnimationFrame(e.webAnimationsNextTick)},this.processRafCallbacks=function(t){var n=e.rafCallbacks;e.rafCallbacks=[],Number(e.currentTime)>t&&(t=Number(e.currentTime)),e.animations.sort(es),e.animations=e.tick(t,!0,e.animations)[0],n.forEach((function(e){e[1](t)})),e.applyPendingEffects()}}return So(t,[{key:"getAnimations",value:function(){return this.discardAnimations(),this.animations.slice()}},{key:"isTicking",value:function(){return this.inTick}},{key:"play",value:function(t){var e=new Qa(t,this);return this.animations.push(e),this.restartWebAnimationsNextTick(),e.updatePromises(),e.play(),e.updatePromises(),e}},{key:"applyDirtiedAnimation",value:function(t){var e=this;if(!this.inTick){t.markTarget();var n=t.targetAnimations();n.sort(es),this.tick(Number(this.currentTime),!1,n.slice())[1].forEach((function(t){var n=e.animations.indexOf(t);-1!==n&&e.animations.splice(n,1)})),this.applyPendingEffects()}}},{key:"restart",value:function(){return this.ticking||(this.ticking=!0,this.requestAnimationFrame((function(){})),this.hasRestartedThisFrame=!0),this.hasRestartedThisFrame}},{key:"destroy",value:function(){ts(this.frameId)}},{key:"applyPendingEffects",value:function(){this.pendingEffects.forEach((function(t){null==t||t.applyInterpolations()})),this.pendingEffects=[]}},{key:"updateAnimationsPromises",value:function(){this.animationsWithPromises=this.animationsWithPromises.filter((function(t){return t.updatePromises()}))}},{key:"discardAnimations",value:function(){this.updateAnimationsPromises(),this.animations=this.animations.filter((function(t){return"finished"!==t.playState&&"idle"!==t.playState}))}},{key:"restartWebAnimationsNextTick",value:function(){this.timelineTicking||(this.timelineTicking=!0,this.requestAnimationFrame(this.webAnimationsNextTick))}},{key:"rAF",value:function(t){var e=this.rafId++;return 0===this.rafCallbacks.length&&(this.frameId=Ja(this.processRafCallbacks)),this.rafCallbacks.push([e,t]),e}},{key:"requestAnimationFrame",value:function(t){var e=this;return this.rAF((function(n){e.updateAnimationsPromises(),t(n),e.updateAnimationsPromises()}))}},{key:"tick",value:function(t,e,n){var r,i,o=this;this.inTick=!0,this.hasRestartedThisFrame=!1,this.currentTime=t,this.ticking=!1;var a=[],s=[],u=[],c=[];return n.forEach((function(n){n.tick(t,e),n._inEffect?(s.push(n.effect),n.markTarget()):(a.push(n.effect),n.unmarkTarget()),n._needsTick&&(o.ticking=!0);var r=n._inEffect||n._needsTick;n._inTimeline=r,r?u.push(n):c.push(n)})),(r=this.pendingEffects).push.apply(r,a),(i=this.pendingEffects).push.apply(i,s),this.ticking&&this.requestAnimationFrame((function(){})),this.inTick=!1,[u,c]}}]),t}();ns=Jo([ae()],ns);var rs,is=.1,os="function"==typeof Float32Array,as=function(t,e){return 1-3*e+3*t},ss=function(t,e){return 3*e-6*t},us=function(t){return 3*t},cs=function(t,e,n){return((as(e,n)*t+ss(e,n))*t+us(e))*t},ls=function(t,e,n){return 3*as(e,n)*t*t+2*ss(e,n)*t+us(e)};!function(t,e,n,r){if(0>t||t>1||0>n||n>1)throw Error("bezier x values must be in [0, 1] range");if(t===e&&n===r)return function(t){return t};for(var i=os?new Float32Array(11):[,,,,,,,,,,,],o=0;11>o;++o)i[o]=cs(o*is,t,n);var a=function(e){for(var r=0,o=1;10!==o&&e>=i[o];++o)r+=is;--o;var a=r+(e-i[o])/(i[o+1]-i[o])*is,s=ls(a,t,n);return.001>s?0===s?a:function(t,e,n,r,i){var o,a,s=0;do{(o=cs(a=e+(n-e)/2,r,i)-t)>0?n=a:e=a}while(Math.abs(o)>1e-7&&10>++s);return a}(e,r,r+is,t,n):function(t,e,n,r){for(var i=0;4>i;++i){var o=ls(e,n,r);if(0===o)return e;e-=(cs(e,n,r)-t)/o}return e}(e,a,t,n)}}(.42,0,1,1);function hs(t,e,n){var r=t[0],i=t[1];return[r+(e[0]-r)*n,i+(e[1]-i)*n]}function fs(t){return t.map((function(t,e,n){var r=e&&n[e-1].slice(-2).concat(t.slice(1)),i=e?Ti.length.apply(Ti,Bo(r)):0;return{s:t,ss:e?i?function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,n=t.slice(0,2),r=t.slice(2,4),i=t.slice(4,6),o=t.slice(6,8),a=hs(n,r,e),s=hs(r,i,e),u=hs(i,o,e),c=hs(a,s,e),l=hs(s,u,e),h=hs(c,l,e);return[["C"].concat(a,c,h),["C"].concat(l,u,o)]}(r):[t,t]:[t],l:i}}))}function ds(t,e,n){var r=fs(t),i=fs(e),o=r.length,a=i.length,s=r.filter((function(t){return t.l})).length,u=i.filter((function(t){return t.l})).length,c=r.filter((function(t){return t.l})).reduce((function(t,e){return t+e.l}),0)/s||0,l=i.filter((function(t){return t.l})).reduce((function(t,e){return t+e.l}),0)/u||0,h=n||Math.max(o,a),f=[c,l],d=[h-o,h-a],p=0,v=[r,i].map((function(t,e){return t.l===h?t.map((function(t){return t.s})):t.map((function(t,n){return d[e]-=(p=n&&d[e]&&t.l>=f[e])?1:0,p?t.ss:[t.s]})).flat()}));return v[0].length===v[1].length?v:ds(v[0],v[1],h)}function ps(t){return function(t){var e=0,n=0,r=0,i=0,o=0;return t.map((function(t){switch(t[0]){case"M":case"Z":return e=r="M"===t[0]?t[1]:r,n=i="M"===t[0]?t[2]:i,0;default:o=vs.apply(0,[e,n].concat(t.slice(1)));var a=Do(t.slice(-2),2);return e=a[0],n=a[1],o}})).reduce((function(t,e){return t+e}),0)}(t)>=0}function vs(t,e,n,r,i,o,a,s){return 3*((s-e)*(n+i)-(a-t)*(r+o)+r*(t-i)-n*(e-o)+s*(i+t/3)-a*(o+e/3))/20}function ys(t){return t.map((function(t){return Array.isArray(t)?ys(t):Number.isNaN(+t)?t:+t}))}function gs(t,e){var n=t.length-1,r=[],i=0,o=function(t){var e=t.length,n=e-1;return t.map((function(r,i){return t.map((function(r,o){var a=i+o;return 0===o||t[a]&&"M"===t[a][0]?["M"].concat(t[a].slice(-2)):(e>a||(a-=n),t[a])}))}))}(t);return o.forEach((function(o,a){t.slice(1).forEach((function(r,o){i+=function(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}(t[(a+o)%n].slice(-2),e[o%n].slice(-2))})),r[a]=i,i=0})),o[r.indexOf(Math.min.apply(null,r))]}function ms(t,e,n){var r=n.getGeometryBounds();if(r){var i=n.entity.getComponent(Yo);if(i&&i.contentBounds){var o=hn(nn(),an.apply(Dn,Bo(r.halfExtents.map((function(t){return 2*t})))),ln(nn(),Ya(e||nn()),Ya(t||nn())));i.contentBounds.update(ln(i.contentBounds.center,i.contentBounds.center,o),i.contentBounds.halfExtents),i.renderBounds.update(ln(i.renderBounds.center,i.renderBounds.center,o),i.renderBounds.halfExtents),fa(n)}}}!function(t){t[t.Constant=0]="Constant",t[t.LinearGradient=1]="LinearGradient",t[t.RadialGradient=2]="RadialGradient",t[t.Pattern=3]="Pattern"}(rs||(rs={}));var bs=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,ws=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,xs=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,ks=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function Es(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if("transparent"===t)return{type:rs.Constant,value:[0,0,0,0],formatted:"rgba(0,0,0,0)"};var e=t[0];if("("===t[1]||"("===t[2])if("l"===e){var n=Ps(t);if(n)return{type:rs.LinearGradient,value:n,formatted:""}}else if("r"===e){var r=_s(t);if(r){if(!b(r))return{type:rs.RadialGradient,value:r,formatted:""};t=r}}else if("p"===e){var i=Ms(t);if(i)return{type:rs.Pattern,value:i,formatted:""}}var o=Gi(t),a=[0,0,0,0];return null!==o&&(a[0]=o.r/255,a[1]=o.g/255,a[2]=o.b/255,a[3]=o.opacity),{type:rs.Constant,value:a,formatted:o&&"rgba(".concat(o.r,",").concat(o.g,",").concat(o.b,",").concat(o.opacity,")")||"rgba(0,0,0,0)"}}function Ts(t,e,n){if(t.type===rs.Constant&&e.type===rs.Constant)return[t.value,e.value,function(t){var e=Bo(t);if(e[3])for(var n=0;3>n;n++)e[n]=Math.round(w(255*e[n],0,255));return e[3]=w(e[3],0,1),"rgba(".concat(e.join(","),")")}]}function Ms(t){var e=xs.exec(t);if(e){var n=e[1],r=e[2];switch(n){case"a":n="repeat";break;case"x":n="repeat-x";break;case"y":n="repeat-y";break;case"n":n="no-repeat";break;default:n="no-repeat"}return{src:r,repetition:n}}return null}function Ps(t){var e=bs.exec(t);if(e){var n,r,i,o=parseFloat(e[1])%360*(Math.PI/180),a=(null===(n=e[2].match(ks))||void 0===n?void 0:n.map((function(t){return t.split(":")})))||[];o>=0&&.5*Math.PI>o?(r={x:0,y:0},i={x:1,y:1}):o>=.5*Math.PI&&Math.PI>o?(r={x:1,y:0},i={x:0,y:1}):o>=Math.PI&&1.5*Math.PI>o?(r={x:1,y:1},i={x:0,y:0}):(r={x:0,y:1},i={x:1,y:0});var s=Math.tan(o),u=s*s;return{x0:r.x,y0:r.y,x1:(i.x-r.x+s*(i.y-r.y))/(u+1)+r.x,y1:s*(i.x-r.x+s*(i.y-r.y))/(u+1)+r.y,steps:a}}return null}function _s(t){var e=ws.exec(t);if(e){var n,r=parseFloat(e[1]),i=parseFloat(e[2]),o=parseFloat(e[3]),a=(null===(n=e[4].match(ks))||void 0===n?void 0:n.map((function(t){return t.split(":")})))||[];if(0===o){var s=e[4].match(ks);return s[s.length-1].split(":")[1]}return{x0:r,y0:i,r0:0,x1:.5,y1:.5,r1:o,steps:a}}return null}function Ss(t,e,n){var r=wu.get(va)(n.nodeName);if(r){var i=n.entity.getComponent(Yo);i.contentBounds||(i.contentBounds=new ra),i.renderBounds||(i.renderBounds=new ra);var o=r.update(n.parsedStyle,n),a=o.width,s=o.height,u=o.depth,c=void 0===u?0:u,l=o.x,h=void 0===l?0:l,f=o.y,d=void 0===f?0:f,p=o.offsetX,v=void 0===p?0:p,y=o.offsetY,g=void 0===y?0:y,m=o.offsetZ,b=void 0===m?0:m;n.parsedStyle.width=a,n.parsedStyle.height=s,n.parsedStyle.depth=c,n.nodeName===qo.Line||n.nodeName===qo.Polyline||n.nodeName===qo.Polygon||n.nodeName===qo.Path?(n.parsedStyle.offsetX=h-(n.parsedStyle.defX||0),n.parsedStyle.offsetY=d-(n.parsedStyle.defY||0),n.parsedStyle.defX=h,n.parsedStyle.defY=d,n.translateLocal(n.parsedStyle.offsetX,n.parsedStyle.offsetY),n.parsedStyle.x=n.style.x,n.parsedStyle.y=n.style.y):(n.parsedStyle.x=h,n.parsedStyle.y=d);var w=an(a/2,s/2,c/2),x=n.parsedStyle,k=x.lineWidth,E=void 0===k?0:k,T=x.anchor,M=void 0===T?[0,0]:T,P=x.shadowColor,_=x.filter,S=void 0===_?[]:_;n.nodeName===qo.Text&&delete n.parsedStyle.anchor;var A=an((1-2*M[0])*w[0]+v,(1-2*M[1])*w[1]+g,(1-2*(M[2]||0))*w[2]+b);if(i.contentBounds.update(A,w),E&&cn(w,w,an(E/2,E/2,0)),i.renderBounds.update(A,w),P&&P.type===rs.Constant){var C=i.renderBounds,R=C.min,N=C.max,O=n.parsedStyle,I=O.shadowBlur,j=void 0===I?0:I,D=O.shadowOffsetX,B=void 0===D?0:D,F=O.shadowOffsetY,L=void 0===F?0:F,W=N[0]+j+B,G=R[1]-j+L,q=N[1]+j+L;R[0]=Math.min(R[0],R[0]-j+B),N[0]=Math.max(N[0],W),R[1]=Math.min(R[1],G),N[1]=Math.max(N[1],q),i.renderBounds.setMinMax(R,N)}S.forEach((function(t){var e=t.name,n=t.params;if("blur"===e){var r=n[0].value;i.renderBounds.update(i.renderBounds.center,cn(i.renderBounds.halfExtents,i.renderBounds.halfExtents,an(r,r,0)))}else if("drop-shadow"===e){var o=n[0].value,a=n[1].value,s=n[2].value,u=i.renderBounds,c=u.min,l=u.max,h=l[0]+s+o,f=c[1]-s+a,d=l[1]+s+a;c[0]=Math.min(c[0],c[0]-s+o),l[0]=Math.max(l[0],h),c[1]=Math.min(c[1],f),l[1]=Math.max(l[1],d),i.renderBounds.setMinMax(c,l)}})),fa(n)}}function As(t,e,n){var r=n.parsedStyle,i=r.x,o=r.y;n.setLocalPosition(void 0===i?0:i,void 0===o?0:o)}function Cs(t){return t.toFixed(3).replace(/0+$/,"").replace(/\.$/,"")}function Rs(t){return"number"==typeof t?t:/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?Number(t):0}function Ns(t,e){return[t,e,Cs]}function Os(t,e){return function(n,r){return[n,r,function(n){return Cs(w(n,t,e))}]}}function Is(t,e){if(t.length==e.length)return[t,e,function(t){return t}]}function js(t,e,n){if(t&&t!==e&&t.style.offsetPathTargets){var r=t.style.offsetPathTargets.indexOf(n);t.style.offsetPathTargets.splice(r,1)}e&&(e.style.offsetPathTargets||(e.style.offsetPathTargets=[]),e.style.offsetPathTargets.push(n))}function Ds(t,e,n){if(n.attributes.offsetPath){var r=n.attributes.offsetPath.nodeName;if(r===qo.Line||r===qo.Path||r===qo.Polyline){var i=n.attributes.offsetPath.getPoint(e);i&&n.setLocalPosition(i.x,i.y)}}}function Bs(t,e,n){if(t&&t!==e&&t.style.clipPathTargets){var r=t.style.clipPathTargets.indexOf(n);t.style.clipPathTargets.splice(r,1)}e&&(e.style.clipPathTargets||(e.style.clipPathTargets=[]),e.style.clipPathTargets.push(n)),fa(n)}function Fs(t,e,n){if(n.parentNode){var r=n.parentNode.getEntity(),i=r.getComponent(zo),o=r.getComponent(Qo);i&&(i.dirty=!0),o&&(o.dirty=!0)}}function Ls(t){return"px"===t||"%"===t}function Ws(t){return"deg"===t||"rad"===t||"turn"===t}function Gs(t,e){if("0"===(e=e.trim().toLowerCase())){if("px".search(t)>=0)return{unit:"px",value:0};if("%".search(t)>=0)return{unit:"%",value:0}}if(x(n=Number(e))&&isFinite(n))return{unit:"",value:Number(e)};var n,r=[];e=e.replace(t,(function(t){return r.push(t),"U"+t}));var i="U("+t.source+")";return r.map((function(t){return{unit:t,value:Number(e.replace(RegExp("U"+t,"g"),"").replace(RegExp(i,"g"),"*0"))}}))[0]}function qs(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=t.unit,a=t.value||0,s=e.value||0;return(Ls(t.unit)||Ls(e.unit))&&(a=Xs(t,i,r),s=Xs(e,i,r),o="px"),(Ws(t.unit)||Ws(e.unit))&&(a=Ys(t),s=Ys(e),o="deg"),[a,s,function(t){return n&&(t=Math.max(t,0)),Cs(t)+o}]}var $s=Gs.bind(null,/px/g),Hs=Gs.bind(null,/px|%/g),Vs=Gs.bind(null,/deg|rad|grad|turn/g);function Xs(t,e,n){if("px"===t.unit)return Number(t.value);if("%"===t.unit&&n){var r=n.getBounds(),i=0;return r&&(i=2*r.halfExtents[e]),Number(t.value)/100*i}return 0}function Ys(t){var e=0;return"deg"===t.unit?e=Number(t.value):"rad"===t.unit?e=Number(t.value)*(180/Math.PI):"turn"===t.unit&&(e=360*Number(t.value)),e}function zs(t,e,n){n.setOrigin(e[0],e[1],e[2])}function Us(t,e,n){var r,i,o=e.split(" ");if(1===o.length&&("top"===o[0]||"bottom"===o[0]?(o[1]=o[0],o[0]="center"):o[1]="center"),2===o.length){var a=Hs(Ks(o[0])),s=Hs(Ks(o[1]));a&&(r=Xs(a,0,n)),s&&(i=Xs(s,1,n))}v(r)||v(i)||n.setOrigin([r,i])}function Ks(t){return"center"===t?"50%":"left"===t||"top"===t?"0":"right"===t||"bottom"===t?"100%":t}var Zs=null,Qs={unit:"px",value:0},Js={unit:"deg",value:0};function tu(t){return function(e){var n=0;return t.map((function(t){return t===Zs?e[n++]:t}))}}function eu(t){return t}var nu={rotate:["A"],rotatex:["A"],rotatey:["A"],rotatez:["A"],rotate3d:["NNNA"],scale:["Nn",tu([Zs,Zs,1]),eu],scalex:["N",tu([Zs,1,1]),tu([Zs,1])],scaley:["N",tu([1,Zs,1]),tu([1,Zs])],scalez:["N",tu([1,1,Zs])],scale3d:["NNN",eu],translate:["Tt",tu([Zs,Zs,Qs]),eu],translatex:["T",tu([Zs,Qs,Qs]),tu([Zs,Qs])],translatey:["T",tu([Qs,Zs,Qs]),tu([Qs,Zs])],translatez:["L",tu([Qs,Qs,Zs])],translate3d:["TTL",eu]};function ru(t){if("none"===(t=t.toLowerCase().trim()))return[];for(var e,n=/\s*(\w+)\(([^)]*)\)/g,r=[],i=0;e=n.exec(t);){if(e.index!==i)return[];i=e.index+e[0].length;var o=e[1],a=nu[o];if(!a)return[];var s=e[2].split(","),u=a[0];if(s.length>u.length)return[];for(var c=[],l=0;u.length>l;l++){var h=s[l],f=u[l],d=void 0;if(void 0===(d=h?{A:function(t){return"0"===t.trim()?Js:Vs(t)},N:Rs,T:Hs,L:$s}[f.toUpperCase()](h):{a:Js,n:c[0],t:Qs}[f]))return[];c.push(d)}if(r.push({t:o,d:c}),n.lastIndex===t.length)return r}return[]}function iu(t){return t.replace(/[xy]/,"")}function ou(t){return t.replace(/(x|y|z|3d)?$/,"3d")}function au(t,e,n){var r=!1;if(!t.length||!e.length){t.length||(r=!0,t=e,e=[]);for(var i=function(n){var r=t[n],i=r.t,o=r.d,a="scale"===i.substr(0,5)?1:0;e.push({t:i,d:o.map((function(t){return"number"==typeof t?a:{unit:t.unit,value:a}}))})},o=0;t.length>o;o++)i(o)}var a,s,u=[],c=[],l=[];if(t.length!==e.length);else for(var h=0;t.length>h;h++){var f=t[h].t,d=e[h].t,p=t[h].d,v=e[h].d,y=nu[f],g=nu[d],m=void 0;if(s=d,("perspective"!==(a=f)||"perspective"!==s)&&("matrix"!==a&&"matrix3d"!==a||"matrix"!==s&&"matrix3d"!==s)){if(f===d)m=f;else if(y[2]&&g[2]&&iu(f)===iu(d))m=iu(f),p=y[2](p),v=g[2](v);else{if(!y[1]||!g[1]||ou(f)!==ou(d))break;m=ou(f),p=y[1](p),v=g[1](v)}for(var b=[],w=[],x=[],k=0;p.length>k;k++){var E=("number"==typeof p[k]?Ns:qs)(p[k],v[k],!1,n,k);b[k]=E[0],w[k]=E[1],x.push(E[2])}u.push(b),c.push(w),l.push([m,x])}}if(r){var T=u;u=c,c=T}return[u,c,function(t){return t.map((function(t,e){var n=t.map((function(t,n){return l[e][1][n](t)})).join(",");return"matrix"===l[e][0]&&16===n.split(",").length&&(l[e][0]="matrix3d"),l[e][0]+"("+n+")"})).join(" ")}]}function su(t,e,n){(function(t,e){void 0===e&&(e=new Map);var n=[];if(Array.isArray(t))for(var r=0,i=t.length;i>r;r++){var o=t[r];e.has(o)||(n.push(o),e.set(o,!0))}return n})([].concat(Bo((t||[]).map((function(t){return t.t}))),Bo((e||[]).map((function(t){return t.t}))))).forEach((function(r){var i=(e||[]).find((function(t){return t.t===r})),o=(t||[]).find((function(t){return t.t===r}));if("scale"===r){var a=i&&i.d||[1,1],s=o&&o.d||[1,1];n.scaleLocal(a[0]/s[0],a[1]/s[1],1)}else if("scalex"===r){n.scaleLocal((i&&i.d||[1])[0]/(o&&o.d||[1])[0],1,1)}else if("scaley"===r){n.scaleLocal(1,(i&&i.d||[1])[0]/(o&&o.d||[1])[0],1)}else if("scalez"===r){n.scaleLocal(1,1,(i&&i.d||[1])[0]/(o&&o.d||[1])[0])}else if("scale3d"===r){var u=i&&i.d||[1,1,1],c=o&&o.d||[1,1,1];n.scaleLocal(u[0]/c[0],u[1]/c[1],u[2]/c[2])}else if("translate"===r){var l=i&&i.d||[Qs,Qs],h=o&&o.d||[Qs,Qs];n.translateLocal(l[0].value-h[0].value,l[1].value-h[1].value,0)}else if("translatex"===r){n.translateLocal((i&&i.d||[Qs])[0].value-(o&&o.d||[Qs])[0].value,0,0)}else if("translatey"===r){n.translateLocal(0,(i&&i.d||[Qs])[0].value-(o&&o.d||[Qs])[0].value,0)}else if("translatez"===r){n.translateLocal(0,0,(i&&i.d||[Qs])[0].value-(o&&o.d||[Qs])[0].value)}else if("translate3d"===r){var f=i&&i.d||[Qs,Qs,Qs],d=o&&o.d||[Qs,Qs,Qs];n.translateLocal(f[0].value-d[0].value,f[1].value-d[1].value,f[2].value-d[2].value)}else if("rotate"===r){n.rotateLocal(0,0,(i&&i.d||[Js])[0].value-(o&&o.d||[Js])[0].value)}else if("rotatex"===r){n.rotateLocal((i&&i.d||[Js])[0].value-(o&&o.d||[Js])[0].value,0,0)}else if("rotatey"===r){n.rotateLocal(0,(i&&i.d||[Js])[0].value-(o&&o.d||[Js])[0].value,0)}else if("rotatez"===r){n.rotateLocal(0,0,(i&&i.d||[Js])[0].value-(o&&o.d||[Js])[0].value)}}))}var uu=function(){function t(e,n,r,i){Po(this,t),this.x=void 0,this.y=void 0,this.width=void 0,this.height=void 0,this.left=void 0,this.right=void 0,this.top=void 0,this.bottom=void 0,this.x=e,this.y=n,this.width=r,this.height=i,this.left=e,this.right=e+r,this.top=n,this.bottom=n+i,this.width=r,this.height=i,this.x=e,this.y=n}return So(t,[{key:"toJSON",value:function(){}}]),t}();function cu(t,e){var n=ro(t),r=function(t){for(var e=!1,n=t.length,r=0;n>r;r++){var i=t[r][0];if("C"===i||"A"===i||"Q"===i){e=!0;break}}return e}(n),i=Bo(n),o=function(t){for(var e=[],n=[],r=[],i=0;t.length>i;i++){var o=t[i],a=o[0];"M"===a?(r.length&&(n.push(r),r=[]),r.push([o[1],o[2]])):"Z"===a?r.length&&(e.push(r),r=[]):r.push([o[1],o[2]])}r.length>0&&n.push(r);return{polygons:e,polylines:n}}(i),a=o.polygons,s=o.polylines,u=Do(function(t,e){void 0===e&&(e=!1);for(var n,r,i=ro(t),o={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null},a=[],s="",u=i.length,c=[],l=0;u>l;l+=1)i[l]&&(s=i[l][0]),a[l]=s,i[l]=fo(i[l],o),po(i,a,l),u=i.length,"Z"===s&&c.push(l),o.x1=+(n=i[l])[(r=n.length)-2],o.y1=+n[r-1],o.x2=+n[r-4]||o.x1,o.y2=+n[r-3]||o.y1;return e?[i,c]:i}(i,!0),2),c=u[0],l=u[1],h=xo(i),f=function(t){var e,n,r,i,o=0,a=0,s=[];if(!t)return{curveSegments:[],totalLength:o};if(t.forEach((function(e,n){i=e.length,(r=t[n+1])&&(o+=Ti.length(e[i-2],e[i-1],r[1],r[2],r[3],r[4],r[5],r[6])||0)})),0===o)return{curveSegments:[],totalLength:o};return t.forEach((function(u,c){i=u.length,(r=t[c+1])&&((e=[])[0]=a/o,n=Ti.length(u[i-2],u[i-1],r[1],r[2],r[3],r[4],r[5],r[6]),e[1]=(a+=n||0)/o,s.push(e))})),{curveSegments:s,totalLength:o}}(c);return{absolutePath:n,hasArc:r,segments:h,polygons:a,polylines:s,curve:c,totalLength:f.totalLength,curveSegments:f.curveSegments,zCommandIndexes:l,rect:lu(c)}}function lu(t){var e=0,n=0,r=[],i=[];t.forEach((function(t){var o=Do(t.slice(-2),2),a=o[0],s=o[1];if("M"===t[0])e=a,n=s,r.push(a),i.push(s);else if("C"===t[0]){var u=Ti.box.apply(Ti,Bo([e,n].concat(t.slice(1))));r=r.concat(u.x,u.x+u.width),i=i.concat(u.y,u.y+u.height),e=a,n=s}}));var o=Math.min.apply(0,r),a=Math.min.apply(0,i),s=Math.max.apply(0,r),u=Math.max.apply(0,i);return new uu(o,a,s-o,u-a)}function hu(t,e,n){var r=t.curve,i=e.curve,o=[r,i];r.length!==i.length&&(o=ds(r,i));var a,s,u=ps(o[0])!==ps(o[1])?(s=(a=o[0]).slice(1).map((function(t,e,n){return e?n[e-1].slice(-2).concat(t.slice(1)):a[0].slice(1).concat(t.slice(1))})).map((function(t){return t.map((function(e,n){return t[t.length-n-2*(1-n%2)]}))})).reverse(),[["M"].concat(s[0].slice(0,2))].concat(s.map((function(t){return["C"].concat(t.slice(2))})))):ys(o[0]);return[u,gs(o[1],u),function(t){return t}]}function fu(t,e){var n,r,i=[],o=0,a=Mi(t);return t.forEach((function(e,s){t[s+1]&&((n=[0,0])[0]=o/a,r=yi.length(e[0],e[1],t[s+1][0],t[s+1][1]),n[1]=(o+=r)/a,i.push(n))})),{points:t,totalLength:a,segments:i}}var du=Gs.bind(null,/deg|rad|grad|turn|px|%/g),pu=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function vu(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if("none"===(t=t.toLowerCase().trim()))return[];for(var e,n=/\s*([\w-]+)\(([^)]*)\)/g,r=[],i=0;e=n.exec(t);){if(e.index!==i)return[];if(i=e.index+e[0].length,pu.indexOf(e[1])>-1&&r.push({name:e[1],params:e[2].split(" ").map((function(t){return du(t)||Es(t,null)}))}),n.lastIndex===t.length)return r}return[]}var yu="StylePropertyParser",gu="StylePropertyUpdater",mu="StylePropertyMerger",bu=new oe((function(t,e,n,r){function i(e,n,r,i){n&&t(yu).toConstantValue(n).whenTargetNamed(e),r&&t(mu).toConstantValue(r).whenTargetNamed(e),i&&t(gu).toConstantValue(i).whenTargetNamed(e)}function o(t,e,n,r){for(var o=0;t.length>o;o++)i(t[o],e,n,r)}t(ea).toSelf().inSingletonScope(),t(la).toSelf().inSingletonScope(),t(ca).toService(la),t(ua).toFactory((function(t){return function(){return t.container.get(ca)}})),t(pa).toSelf().inSingletonScope(),t(da).toService(pa),t(xa).toSelf().inSingletonScope(),t(Pa).toSelf().inSingletonScope(),t(ya).to(ga).inSingletonScope().whenTargetNamed(qo.Circle),t(ya).to(ma).inSingletonScope().whenTargetNamed(qo.Ellipse),t(ya).to(ba).inSingletonScope().whenTargetNamed(qo.Rect),t(ya).to(ba).inSingletonScope().whenTargetNamed(qo.Image),t(ya).to(_a).inSingletonScope().whenTargetNamed(qo.Text),t(ya).to(Sa).inSingletonScope().whenTargetNamed(qo.Line),t(ya).to(Aa).inSingletonScope().whenTargetNamed(qo.Polyline),t(ya).to(Aa).inSingletonScope().whenTargetNamed(qo.Polygon),t(ya).to(Ca).inSingletonScope().whenTargetNamed(qo.Path),t(va).toFactory((function(t){return function(e){return t.container.isBoundNamed(ya,e)?t.container.getNamed(ya,e):null}})),t("StylePropertyParserFactory").toFactory((function(t){return function(e){return t.container.isBoundNamed(yu,e)?t.container.getNamed(yu,e):null}})),t("StylePropertyUpdaterFactory").toFactory((function(t){return function(e){return t.container.isBoundNamed(gu,e)?t.container.getAllNamed(gu,e):null}})),t("StylePropertyMergerFactory").toFactory((function(t){return function(e){return t.container.isBoundNamed(mu,e)?t.container.getNamed(mu,e):null}})),o(["opacity","fillOpacity","strokeOpacity","offsetDistance"],Rs,Os(0,1),void 0),o(["r","rx","ry","lineWidth","width","height","shadowBlur"],Rs,Os(0,1/0),void 0),o(["lineDash"],void 0,Is,void 0),o(["x1","x2","y1","y2","lineDashOffset","shadowOffsetX","shadowOffsetY"],Rs,Ns,void 0),o(["x1","x2","y1","y2","r","rx","ry","width","height","path","points","text","shadowBlur","shadowOffsetX","shadowOffsetY","lineWidth","filter","font","fontSize","fontFamily","fontStyle","fontWeight","fontVariant","lineHeight","letterSpacing","padding","wordWrap","wordWrapWidth","leading","textBaseline","textAlign","whiteSpace"],void 0,void 0,Ss),o(["fill","stroke","shadowColor"],Es,Ts,void 0),i("clipPath",void 0,void 0,Bs),i("zIndex",void 0,void 0,Fs),i("offsetPath",void 0,void 0,js),i("offsetDistance",void 0,void 0,Ds),i("origin",void 0,void 0,zs),i("transformOrigin",void 0,void 0,Us),i("transform",ru,au,su),i("path",cu,hu,void 0),i("points",fu,void 0,void 0),o(["x","y","points","path","x1","x2","y1","y2"],void 0,void 0,As),i("filter",vu,void 0,void 0),i("anchor",void 0,void 0,ms)})),wu=new ie;wu.load(We),wu.load(bu);var xu=wu.get(Be);xu.registerComponent(Ko).registerComponent(Qo).registerComponent(Zo).registerComponent(Yo).registerComponent(zo);var ku,Eu,Tu,Mu=function(){function t(e){Po(this,t),this.plugins=[],this.config=void 0,this.config=function(t){for(var e=1;arguments.length>e;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ko(Object(n),!0).forEach((function(e){Ao(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ko(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableTAA:!1},e)}return So(t,[{key:"registerPlugin",value:function(t){this.plugins.push(t)}},{key:"getPlugins",value:function(){return this.plugins}},{key:"getConfig",value:function(){return this.config}},{key:"setConfig",value:function(t){Object.assign(this.config,t)}}]),t}(),Pu=function(){function t(e,n){var r,i;Po(this,t),this.name=void 0,this.matrix=void 0,this.right=void 0,this.up=void 0,this.forward=void 0,this.position=void 0,this.focalPoint=void 0,this.distanceVector=void 0,this.distance=void 0,this.dollyingStep=void 0,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.name=e,this.matrix=(r=n.matrix,(i=new qe(16))[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],i),this.right=rn(n.right),this.up=rn(n.up),this.forward=rn(n.forward),this.position=rn(n.position),this.focalPoint=rn(n.focalPoint),this.distanceVector=rn(n.distanceVector),this.azimuth=n.azimuth,this.elevation=n.elevation,this.roll=n.roll,this.relAzimuth=n.relAzimuth,this.relElevation=n.relElevation,this.relRoll=n.relRoll,this.dollyingStep=n.dollyingStep,this.distance=n.distance}return So(t,[{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getRoll",value:function(){return this.roll}},{key:"retrieve",value:function(t){t.matrix=Xe(t.matrix,this.matrix),t.right=sn(t.right,this.right),t.up=sn(t.up,this.up),t.forward=sn(t.forward,this.forward),t.position=sn(t.position,this.position),t.focalPoint=sn(t.focalPoint,this.focalPoint),t.distanceVector=sn(t.distanceVector,this.distanceVector),t.azimuth=this.azimuth,t.elevation=this.elevation,t.roll=this.roll,t.relAzimuth=this.relAzimuth,t.relElevation=this.relElevation,t.relRoll=this.relRoll,t.dollyingStep=this.dollyingStep,t.distance=this.distance}}]),t}(),_u="DefaultCamera";!function(t){t.ORBITING="ORBITING",t.EXPLORING="EXPLORING",t.TRACKING="TRACKING"}(ku||(ku={})),function(t){t.DEFAULT="DEFAULT",t.ROTATIONAL="ROTATIONAL",t.TRANSLATIONAL="TRANSLATIONAL",t.CINEMATIC="CINEMATIC"}(Eu||(Eu={})),function(t){t.ORTHOGRAPHIC="ORTHOGRAPHIC",t.PERSPECTIVE="PERSPECTIVE"}(Tu||(Tu={}));var Su,Au,Cu,Ru="updated",Nu=Math.PI/180,Ou=180/Math.PI,Iu=function(t){Co(n,t);var e=jo(n);function n(){var t;Po(this,n);for(var r=arguments.length,i=Array(r),o=0;r>o;o++)i[o]=arguments[o];return(t=e.call.apply(e,[this].concat(i))).matrix=Ve(),t.right=an(1,0,0),t.up=an(0,1,0),t.forward=an(0,0,1),t.position=an(0,0,1),t.focalPoint=an(0,0,0),t.distanceVector=an(0,0,0),t.distance=1,t.azimuth=0,t.elevation=0,t.roll=0,t.relAzimuth=0,t.relElevation=0,t.relRoll=0,t.dollyingStep=0,t.maxDistance=1/0,t.minDistance=-1/0,t.zoom=1,t.rotateWorld=!1,t.fov=30,t.near=.1,t.far=1e4,t.aspect=1,t.left=void 0,t.rright=void 0,t.top=void 0,t.bottom=void 0,t.projectionMatrix=Ve(),t.projectionMatrixInverse=Ve(),t.jitteredProjectionMatrix=void 0,t.view=void 0,t.following=void 0,t.type=ku.EXPLORING,t.trackingMode=Eu.DEFAULT,t.projectionMode=Tu.PERSPECTIVE,t.frustum=new oa,t.landmarks=[],t.landmarkAnimationID=void 0,t.orthoMatrix=Ve(),t}return So(n,[{key:"clone",value:function(){var t=new n;return t.setType(this.type,void 0),t}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.jitteredProjectionMatrix||this.projectionMatrix}},{key:"getPerspectiveInverse",value:function(){return this.projectionMatrixInverse}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getNear",value:function(){return this.near}},{key:"getFar",value:function(){return this.far}},{key:"getZoom",value:function(){return this.zoom}},{key:"getOrthoMatrix",value:function(){return this.orthoMatrix}},{key:"setType",value:function(t,e){return this.type=t,this.setWorldRotation(this.type===ku.EXPLORING),this._getAngles(),this.type===ku.TRACKING&&void 0!==e&&this.setTrackingMode(e),this}},{key:"setProjectionMode",value:function(t){return this.projectionMode=t,this}},{key:"setTrackingMode",value:function(t){if(this.type!==ku.TRACKING)throw Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=t,this}},{key:"setWorldRotation",value:function(t){this.rotateWorld=t,this._getAngles()}},{key:"getViewTransform",value:function(){return ze(Ve(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"jitterProjectionMatrix",value:function(t,e){var n,r,i=(n=Ve(),r=[t,e,0],n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=r[0],n[13]=r[1],n[14]=r[2],n[15]=1,n);this.jitteredProjectionMatrix=Ue(Ve(),i,this.projectionMatrix)}},{key:"clearJitterProjectionMatrix",value:function(){this.jitteredProjectionMatrix=void 0}},{key:"setMatrix",value:function(t){return this.matrix=t,this._update(),this}},{key:"setFov",value:function(t){this.setPerspective(this.near,this.far,t,this.aspect)}},{key:"setAspect",value:function(t){return this.setPerspective(this.near,this.far,this.fov,t),this}},{key:"setNear",value:function(t){return this.projectionMode===Tu.PERSPECTIVE?this.setPerspective(t,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,t,this.far),this}},{key:"setFar",value:function(t){return this.projectionMode===Tu.PERSPECTIVE?this.setPerspective(this.near,t,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,t),this}},{key:"setViewOffset",value:function(t,e,n,r,i,o){return this.aspect=t/e,void 0===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=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.projectionMode===Tu.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"clearViewOffset",value:function(){return void 0!==this.view&&(this.view.enabled=!1),this.projectionMode===Tu.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"setZoom",value:function(t){return this.zoom=t,this.projectionMode===Tu.ORTHOGRAPHIC&&this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"setPerspective",value:function(t,e,n,r){return this.projectionMode=Tu.PERSPECTIVE,this.fov=n,this.near=t,this.far=e,this.aspect=r,function(t,e,n,r,i){var o,a=1/Math.tan(e/2);t[0]=a/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(t[10]=(i+r)*(o=1/(r-i)),t[14]=2*i*r*o):(t[10]=-1,t[14]=-2*r)}(this.projectionMatrix,-this.fov*Nu,-this.aspect,this.near,this.far),ze(this.projectionMatrixInverse,this.projectionMatrix),this.emit(Ru),this}},{key:"setOrthographic",value:function(t,e,n,r,i,o){this.projectionMode=Tu.ORTHOGRAPHIC,this.rright=e,this.left=t,this.top=n,this.bottom=r,this.near=i,this.far=o;var a=(this.rright-this.left)/(2*this.zoom),s=(this.top-this.bottom)/(2*this.zoom),u=(this.rright+this.left)/2,c=(this.top+this.bottom)/2,l=u-a,h=u+a,f=c+s,d=c-s;if(void 0!==this.view&&this.view.enabled){var p=(this.rright-this.left)/this.view.fullWidth/this.zoom,v=(this.top-this.bottom)/this.view.fullHeight/this.zoom;h=(l+=p*this.view.offsetX)+p*this.view.width,d=(f-=v*this.view.offsetY)-v*this.view.height}return function(t,e,n,r,i,o,a){var s=1/(e-n),u=1/(r-i),c=1/(o-a);t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*u,t[14]=(a+o)*c,t[15]=1}(this.projectionMatrix,l,h,d,f,i,o),ze(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.emit(Ru),this}},{key:"setPosition",value:function(t,e,n){return this._setPosition(t,e,n),this.setFocalPoint(this.focalPoint),this}},{key:"setFocalPoint",value:function(t,e,n){var r,i,o,a,s,u,c,l,h,f,d,p,v,y=an(0,1,0);if(this.focalPoint=Ya(t,e,n),this.trackingMode===Eu.CINEMATIC){var g=ln(nn(),this.focalPoint,this.position);t=g[0],e=g[1],n=g[2];var m=on(g),b=Math.asin(e/m)*Ou,w=90+Math.atan2(n,t)*Ou,x=Ve();r=x,i=x,a=Math.sin(o=w*Nu),s=Math.cos(o),u=i[0],c=i[1],l=i[2],h=i[3],f=i[8],d=i[9],p=i[10],v=i[11],i!==r&&(r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15]),r[0]=u*s-f*a,r[1]=c*s-d*a,r[2]=l*s-p*a,r[3]=h*s-v*a,r[8]=u*a+f*s,r[9]=c*a+d*s,r[10]=l*a+p*s,r[11]=h*a+v*s,function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[4],a=e[5],s=e[6],u=e[7],c=e[8],l=e[9],h=e[10],f=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+c*r,t[5]=a*i+l*r,t[6]=s*i+h*r,t[7]=u*i+f*r,t[8]=c*i-o*r,t[9]=l*i-a*r,t[10]=h*i-s*r,t[11]=f*i-u*r}(x,x,b*Nu),y=En(nn(),[0,1,0],x)}return ze(this.matrix,function(t,e,n,r){var i,o,a,s,u,c,l,h,f,d,p=e[0],v=e[1],y=e[2],g=r[0],m=r[1],b=r[2],w=n[0],x=n[1],k=n[2];return Ge>Math.abs(p-w)&&Ge>Math.abs(v-x)&&Ge>Math.abs(y-k)?Ye(t):(d=1/Math.hypot(l=p-w,h=v-x,f=y-k),(d=Math.hypot(i=m*(f*=d)-b*(h*=d),o=b*(l*=d)-g*f,a=g*h-m*l))?(i*=d=1/d,o*=d,a*=d):(i=0,o=0,a=0),(d=Math.hypot(s=h*a-f*o,u=f*i-l*a,c=l*o-h*i))?(s*=d=1/d,u*=d,c*=d):(s=0,u=0,c=0),t[0]=i,t[1]=s,t[2]=l,t[3]=0,t[4]=o,t[5]=u,t[6]=h,t[7]=0,t[8]=a,t[9]=c,t[10]=f,t[11]=0,t[12]=-(i*p+o*v+a*y),t[13]=-(s*p+u*v+c*y),t[14]=-(l*p+h*v+f*y),t[15]=1,t)}(Ve(),this.position,this.focalPoint,y)),this._getAxes(),this._getDistance(),this._getAngles(),this}},{key:"setDistance",value:function(t){if(this.distance!==t&&t>=0){this.distance=t,2e-4>this.distance&&(this.distance=2e-4),this.dollyingStep=this.distance/100;var e=nn(),n=this.forward,r=this.focalPoint;return e[0]=(t=this.distance)*n[0]+r[0],e[1]=t*n[1]+r[1],e[2]=t*n[2]+r[2],this._setPosition(e),this}}},{key:"setMaxDistance",value:function(t){return this.maxDistance=t,this}},{key:"setMinDistance",value:function(t){return this.minDistance=t,this}},{key:"changeAzimuth",value:function(t){return this.setAzimuth(this.azimuth+t),this}},{key:"changeElevation",value:function(t){return this.setElevation(this.elevation+t),this}},{key:"changeRoll",value:function(t){return this.setRoll(this.roll+t),this}},{key:"setAzimuth",value:function(t){return this.azimuth=Xa(t),this.computeMatrix(),this._getAxes(),this.type===ku.ORBITING||this.type===ku.EXPLORING?this._getPosition():this.type===ku.TRACKING&&this._getFocalPoint(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(t){return this.elevation=Xa(t),this.computeMatrix(),this._getAxes(),this.type===ku.ORBITING||this.type===ku.EXPLORING?this._getPosition():this.type===ku.TRACKING&&this._getFocalPoint(),this}},{key:"setRoll",value:function(t){return this.roll=Xa(t),this.computeMatrix(),this._getAxes(),this.type===ku.ORBITING||this.type===ku.EXPLORING?this._getPosition():this.type===ku.TRACKING&&this._getFocalPoint(),this}},{key:"rotate",value:function(t,e,n){if(this.relElevation=Xa(e),this.relAzimuth=Xa(t),this.relRoll=Xa(n),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.type===ku.EXPLORING){var r=Wn(Ln(),[1,0,0],(this.rotateWorld?1:-1)*this.relElevation*Nu),i=Wn(Ln(),[0,1,0],(this.rotateWorld?1:-1)*this.relAzimuth*Nu),o=Wn(Ln(),[0,0,1],this.relRoll*Nu),a=Gn(Ln(),i,r);a=Gn(Ln(),a,o);var s=en(Ve(),a);Ke(this.matrix,this.matrix,[0,0,-this.distance]),Ue(this.matrix,this.matrix,s),Ke(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation)>90)return;this.computeMatrix()}return this._getAxes(),this.type===ku.ORBITING||this.type===ku.EXPLORING?this._getPosition():this.type===ku.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(t,e){var n=Ya(t,e,0),r=rn(this.position);return cn(r,r,vn(nn(),this.right,n[0])),cn(r,r,vn(nn(),this.up,n[1])),this._setPosition(r),this.emit(Ru),this}},{key:"dolly",value:function(t){var e,n=this.forward,r=rn(this.position);return r[0]+=(e=Math.max(Math.min(this.distance+t*this.dollyingStep,this.maxDistance),this.minDistance)-this.distance)*n[0],r[1]+=e*n[1],r[2]+=e*n[2],this._setPosition(r),this.type===ku.ORBITING||this.type===ku.EXPLORING?this._getDistance():this.type===ku.TRACKING&&cn(this.focalPoint,r,this.distanceVector),this.emit(Ru),this}},{key:"createLandmark",value:function(t,e){var n=this.clone();n.setPosition(e.position),n.setFocalPoint(e.focalPoint),void 0!==e.roll&&n.setRoll(e.roll);var r=new Pu(t,n);return this.landmarks.push(r),r}},{key:"setLandmark",value:function(t){var e=new Pu(t,this);return this.landmarks.push(e),this}},{key:"gotoLandmark",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,r=this.landmarks.find((function(e){return e.name===t}));if(r){if(0===n)return void r.retrieve(this);void 0!==this.landmarkAnimationID&&ts(this.landmarkAnimationID);var i,o=r.getPosition(),a=r.getFocalPoint(),s=r.getRoll(),u=function t(r){void 0===i&&(i=r);var u,c=r-i,l=(1-Math.cos(c/n*Math.PI))/2,h=nn(),f=nn();if(kn(h,e.focalPoint,a,l),kn(f,e.position,o,l),u=e.roll*(1-l)+s*l,e.setFocalPoint(h),e.setPosition(f),e.setRoll(u),e.computeMatrix(),e.emit(Ru),.01>=Rn(h,a)+Rn(f,o))return e.setFocalPoint(h),e.setPosition(f),e.setRoll(u),void e.computeMatrix();n>c&&(e.landmarkAnimationID=Ja(t))};Ja(u)}}},{key:"_update",value:function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles(),this._getOrthoMatrix(),this.emit(Ru)}},{key:"computeMatrix",value:function(){var t,e,n=Wn(Ln(),[0,0,1],this.roll*Nu);Ye(this.matrix),t=Wn(Ln(),[1,0,0],(this.rotateWorld&&this.type!==ku.TRACKING||this.type===ku.TRACKING?1:-1)*this.elevation*Nu),e=Wn(Ln(),[0,1,0],(this.rotateWorld&&this.type!==ku.TRACKING||this.type===ku.TRACKING?1:-1)*this.azimuth*Nu);var r=Gn(Ln(),e,t);r=Gn(Ln(),r,n);var i=en(Ve(),r);this.type===ku.ORBITING||this.type===ku.EXPLORING?(Ke(this.matrix,this.matrix,this.focalPoint),Ue(this.matrix,this.matrix,i),Ke(this.matrix,this.matrix,[0,0,this.distance])):this.type===ku.TRACKING&&(Ke(this.matrix,this.matrix,this.position),Ue(this.matrix,this.matrix,i))}},{key:"_setPosition",value:function(t,e,n){this.position=Ya(t,e,n);var r=this.matrix;r[12]=this.position[0],r[13]=this.position[1],r[14]=this.position[2],r[15]=1,this._getOrthoMatrix()}},{key:"_getAxes",value:function(){sn(this.right,Ya(Fn(Bn(),[1,0,0,0],this.matrix))),sn(this.up,Ya(Fn(Bn(),[0,1,0,0],this.matrix))),sn(this.forward,Ya(Fn(Bn(),[0,0,1,0],this.matrix))),bn(this.right,this.right),bn(this.up,this.up),bn(this.forward,this.forward)}},{key:"_getAngles",value:function(){var t=this.distanceVector[0],e=this.distanceVector[1],n=this.distanceVector[2],r=on(this.distanceVector);if(0===r)return this.elevation=0,void(this.azimuth=0);this.type===ku.TRACKING||this.rotateWorld?(this.elevation=Math.asin(e/r)*Ou,this.azimuth=Math.atan2(-t,-n)*Ou):(this.elevation=-Math.asin(e/r)*Ou,this.azimuth=-Math.atan2(-t,-n)*Ou)}},{key:"_getPosition",value:function(){sn(this.position,Ya(Fn(Bn(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){var t,e;Tn(this.distanceVector,[0,0,-this.distance],((t=He())[0]=(e=this.matrix)[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t)),cn(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=ln(nn(),this.focalPoint,this.position),this.distance=on(this.distanceVector),this.dollyingStep=this.distance/100}},{key:"_getOrthoMatrix",value:function(){if(this.projectionMode===Tu.ORTHOGRAPHIC){var t=this.position,e=Wn(Ln(),[0,0,1],-this.roll*Math.PI/180);tn(this.orthoMatrix,e,an((this.rright-this.left)/2-t[0],(this.bottom-this.top)/2-t[1],0),an(this.zoom,this.zoom,1),t)}}}]),n}(ue.EventEmitter);Iu.ProjectionMode={ORTHOGRAPHIC:"ORTHOGRAPHIC",PERSPECTIVE:"PERSPECTIVE"};var ju,Du,Bu,Fu=(Au=Su=function(){function t(){Po(this,t),this.canvasConfig=void 0,this.renderingContext=void 0}return So(t,[{key:"apply",value:function(t){var e=this;t.hooks.prepare.tap(Cu.tag,(function(t){if(t){var n=e.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering;return t.getEntity().getComponent(zo).dirty||e.renderingContext.renderReasons.has(Ra.CameraChanged)||!n?t:null}return t}))}}]),t}(),Su.tag="DirtyCheckPlugin",Cu=Au);Jo([Tt(Xo),ta("design:type",Object)],Fu.prototype,"canvasConfig",void 0),Jo([Tt(Oa),ta("design:type",Object)],Fu.prototype,"renderingContext",void 0),Fu=Cu=Jo([ae()],Fu);var Lu,Wu,Gu,qu="CullingStrategy",$u=(Du=ju=function(){function t(){Po(this,t),this.canvasConfig=void 0,this.strategies=void 0,this.renderingContext=void 0}return So(t,[{key:"apply",value:function(t){var e=this;t.hooks.prepare.tap(Bu.tag,(function(t){if(t){var n=t.entity.getComponent(Zo);if(n.visible=0===e.strategies.getContributions(!0).length||e.strategies.getContributions(!0).every((function(e){return e.isVisible(t)})),t.isVisible())return t;if(e.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering){var r=t.getRenderBounds();r&&(e.renderingContext.removedRenderBoundsList.push(r),e.renderingContext.renderReasons.add(Ra.DisplayObjectRemoved))}return null}return t})),t.hooks.afterRender.tap(Bu.tag,(function(t){t.entity.getComponent(Zo).visibilityPlaneMask=-1}))}}]),t}(),ju.tag="CullingPlugin",Bu=Du);Jo([Tt(Xo),ta("design:type",Object)],$u.prototype,"canvasConfig",void 0),Jo([Tt($o),se(qu),ta("design:type",Object)],$u.prototype,"strategies",void 0),Jo([Tt(Oa),ta("design:type",Object)],$u.prototype,"renderingContext",void 0),$u=Bu=Jo([ae()],$u);var Hu=(Wu=Lu=function(){function t(){Po(this,t),this.renderingContext=void 0}return So(t,[{key:"apply",value:function(t){var e=this,n=function(t){e.renderingContext.renderReasons.add(Ra.DisplayObjectChanged)},r=function(e){fa(e.target,!0),t.dirtify()},i=function(e){t.dirtify()},o=function(t){r(t)},a=function(t){r(t)};t.hooks.init.tap(Gu.tag,(function(){e.renderingContext.root.addEventListener(Ba.MOUNTED,o),e.renderingContext.root.addEventListener(Ba.UNMOUNTED,a),e.renderingContext.root.addEventListener(Ba.ATTRIBUTE_CHANGED,n),e.renderingContext.root.addEventListener(Ba.BOUNDS_CHANGED,i)})),t.hooks.destroy.tap(Gu.tag,(function(){e.renderingContext.root.removeEventListener(Ba.MOUNTED,o),e.renderingContext.root.removeEventListener(Ba.UNMOUNTED,a),e.renderingContext.root.removeEventListener(Ba.ATTRIBUTE_CHANGED,n),e.renderingContext.root.removeEventListener(Ba.BOUNDS_CHANGED,i)}))}}]),t}(),Lu.tag="PrepareRendererPlugin",Gu=Wu);Jo([Tt(Oa),ta("design:type",Object)],Hu.prototype,"renderingContext",void 0),Hu=Gu=Jo([ae()],Hu);var Vu=function(){function t(){Po(this,t),this.camera=void 0}return So(t,[{key:"isVisible",value:function(t){t.getEntity().getComponent(Zo);return!0}},{key:"computeVisibilityWithPlaneMask",value:function(t,e,n){if(e===na.OUTSIDE||e===na.INSIDE)return e;for(var r=na.INSIDE,i=0,o=n.length;o>i;++i){var a=31>i?1<<i:0;if(i>=31||0!=(e&a)){var s=n[i],u=s.normal,c=s.distance;if(0>wn(u,t.getPositiveFarPoint(n[i]))+c)return na.OUTSIDE;0>wn(u,t.getNegativeFarPoint(n[i]))+c&&(r|=a)}}return r}}]),t}();Jo([Tt(_u),ta("design:type",Iu)],Vu.prototype,"camera",void 0),Vu=Jo([ae()],Vu);var Xu,Yu,zu,Uu=!!self.TouchEvent,Ku=!!self.PointerEvent,Zu={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"};function Qu(t){var e=[];if(function(t){return Uu&&t instanceof TouchEvent}(t))for(var n=0;t.changedTouches.length>n;n++){var r=t.changedTouches[n];T(r.button)&&(r.button=t.touches.length?1:0),T(r.buttons)&&(r.buttons=t.touches.length?1:0),T(r.isPrimary)&&(r.isPrimary=1===t.touches.length&&"touchstart"===t.type),T(r.width)&&(r.width=r.radiusX||1),T(r.height)&&(r.height=r.radiusY||1),T(r.tiltX)&&(r.tiltX=0),T(r.tiltY)&&(r.tiltY=0),T(r.pointerType)&&(r.pointerType="touch"),T(r.pointerId)&&(r.pointerId=r.identifier||0),T(r.pressure)&&(r.pressure=r.force||.5),T(r.twist)&&(r.twist=0),T(r.tangentialPressure)&&(r.tangentialPressure=0),r.isNormalized=!0,r.type=t.type,e.push(r)}else if(function(t){return!self.MouseEvent||t instanceof MouseEvent&&(!Ku||!(t instanceof self.PointerEvent))}(t)){var i=t;T(i.isPrimary)&&(i.isPrimary=!0),T(i.width)&&(i.width=1),T(i.height)&&(i.height=1),T(i.tiltX)&&(i.tiltX=0),T(i.tiltY)&&(i.tiltY=0),T(i.pointerType)&&(i.pointerType="mouse"),T(i.pointerId)&&(i.pointerId=1),T(i.pressure)&&(i.pressure=.5),T(i.twist)&&(i.twist=0),T(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,e.push(i)}else e.push(t);return e}var Ju=(Yu=Xu=function(){function t(){var e=this;Po(this,t),this.canvasConfig=void 0,this.contextService=void 0,this.renderingService=void 0,this.eventService=void 0,this.autoPreventDefault=!0,this.rootPointerEvent=new $a(null),this.rootWheelEvent=new Ha(null),this.onPointerMove=function(t){if(!Uu||"touch"!==t.pointerType){var n,r=Wo(Qu(t));try{for(r.s();!(n=r.n()).done;){var i=e.bootstrapEvent(e.rootPointerEvent,n.value);e.eventService.mapEvent(i)}}catch(t){r.e(t)}finally{r.f()}e.setCursor(e.eventService.cursor)}}}return So(t,[{key:"apply",value:function(t){var e=this;this.eventService.setPickHandler(function(){var t=Mo(regeneratorRuntime.mark((function t(n){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.renderingService.hooks.pick.promise({position:n,picked:null});case 2:return t.abrupt("return",t.sent.picked);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),t.hooks.pointerWheel.tap(zu.tag,(function(t){var n=e.normalizeWheelEvent(t);e.eventService.mapEvent(n)})),t.hooks.pointerDown.tap(zu.tag,(function(t){if(!Uu||"touch"!==t.pointerType){var n=Qu(t);if(e.autoPreventDefault&&n[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();var r,i=Wo(n);try{for(i.s();!(r=i.n()).done;){var o=e.bootstrapEvent(e.rootPointerEvent,r.value);e.eventService.mapEvent(o)}}catch(t){i.e(t)}finally{i.f()}e.setCursor(e.eventService.cursor)}})),t.hooks.pointerUp.tap(zu.tag,(function(t){if(!Uu||"touch"!==t.pointerType){var n,r=e.contextService.getDomElement(),i=r&&t.target&&t.target!==r&&r.contains&&!r.contains(t.target)?"outside":"",o=Wo(Qu(t));try{for(o.s();!(n=o.n()).done;){var a=e.bootstrapEvent(e.rootPointerEvent,n.value);a.type+=i,e.eventService.mapEvent(a)}}catch(t){o.e(t)}finally{o.f()}e.setCursor(e.eventService.cursor)}})),t.hooks.pointerMove.tap(zu.tag,this.onPointerMove),t.hooks.pointerOver.tap(zu.tag,this.onPointerMove),t.hooks.pointerOut.tap(zu.tag,this.onPointerMove)}},{key:"bootstrapEvent",value:function(t,e){t._originalEvent=null,t.nativeEvent=e,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);var n=this.eventService.client2Viewport(new aa(e.clientX,e.clientY)),r=n.y;t.viewport.x=n.x,t.viewport.y=r;var i=this.eventService.viewport2Canvas(t.viewport),o=i.y;return t.canvas.x=i.x,t.canvas.y=o,t.global.copyFrom(t.canvas),t.offset.copyFrom(t.canvas),t.isTrusted=e.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=Zu[t.type]||t.type),t}},{key:"normalizeWheelEvent",value:function(t){var e=this.rootWheelEvent;this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ;var n=this.eventService.client2Viewport(new aa(t.clientX,t.clientY)),r=n.y;e.viewport.x=n.x,e.viewport.y=r;var i=this.eventService.viewport2Canvas(e.viewport),o=i.y;return e.canvas.x=i.x,e.canvas.y=o,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.nativeEvent=t,e.type=t.type,e}},{key:"transferMouseData",value:function(t,e){t.isTrusted=e.isTrusted,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.screen.x=e.screenX,t.screen.y=e.screenY,t.relatedTarget=null}},{key:"setCursor",value:function(t){this.contextService.applyCursorStyle(t||this.canvasConfig.cursor||"default")}}]),t}(),Xu.tag="EventPlugin",zu=Yu);Jo([Tt(Xo),ta("design:type",Object)],Ju.prototype,"canvasConfig",void 0),Jo([Tt(Na),ta("design:type",Object)],Ju.prototype,"contextService",void 0),Jo([Tt(Da),ta("design:type",Da)],Ju.prototype,"renderingService",void 0),Jo([Tt(Va),ta("design:type",Va)],Ju.prototype,"eventService",void 0),Ju=zu=Jo([ae()],Ju);var tc;new oe((function(t,e,n,r){t(Da).toSelf().inSingletonScope(),Vo(t,Ia),t(Va).toSelf().inSingletonScope(),t(Ju).toSelf().inSingletonScope(),t(Ia).toService(Ju),t(Hu).toSelf().inSingletonScope(),t(Ia).toService(Hu),t(Fu).toSelf().inSingletonScope(),t(Ia).toService(Fu),Vo(t,qu),t(Vu).toSelf().inSingletonScope(),t(qu).toService(Vu),t($u).toSelf().inSingletonScope(),t(Ia).toService($u)}));function ec(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nc(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function rc(t,e,n){return e&&nc(t.prototype,e),n&&nc(t,n),t}!function(t){t.READY="ready",t.BEFORE_RENDER="beforerender",t.AFTER_RENDER="afterrender",t.BEFORE_DESTROY="beforedestroy",t.AFTER_DESTROY="afterdestroy"}(tc||(tc={}));var ic="inversify:paramtypes",oc=0;var ac=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return"named"===this.key?"named: "+this.value+" ":"tagged: { key:"+this.key+", value: "+this.value+" }"},t}();function sc(t,e,n,r,i){var o={},a="number"==typeof i,s=void 0!==i&&a?""+i:n;if(a&&void 0!==n)throw Error("The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.");Reflect.hasOwnMetadata(t,e)&&(o=Reflect.getMetadata(t,e));var u=o[s];if(Array.isArray(u))for(var c=0,l=u;l.length>c;c++){var h=l[c];if(h.key===r.key)throw Error("Metadata key was used more than once in a parameter: "+h.key)}else u=[];u.push(r),o[s]=u,Reflect.defineMetadata(t,o,e)}var uc=function(t){this.id=oc++,this.registry=t};
|
|
45
|
+
/*! *****************************************************************************
|
|
46
|
+
Copyright (c) Microsoft Corporation.
|
|
47
|
+
|
|
48
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
49
|
+
purpose with or without fee is hereby granted.
|
|
50
|
+
|
|
51
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
52
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
53
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
54
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
55
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
56
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
57
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
58
|
+
***************************************************************************** */
|
|
59
|
+
function cc(t,e,n,r){var o,a=arguments.length,s=3>a?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(s=(3>a?o(s):a>3?o(e,n,s):o(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s}var lc,hc,fc,dc,pc="ontouchstart"in self,vc=!!self.PointerEvent,yc=(hc=lc=function(){function t(){ec(this,t),this.contextService=void 0}return rc(t,[{key:"apply",value:function(t){var e=this,n=function(e){t.hooks.pointerMove.call(e)},r=function(e){t.hooks.pointerUp.call(e)},i=function(e){t.hooks.pointerDown.call(e)},o=function(e){t.hooks.pointerOver.call(e)},a=function(e){t.hooks.pointerOut.call(e)},s=function(e){t.hooks.pointerWheel.call(e)};t.hooks.init.tap(fc.tag,(function(){var t=e.contextService.getDomElement();vc?(self.document.addEventListener("pointermove",n,!0),t.addEventListener("pointerdown",i,!0),t.addEventListener("pointerleave",a,!0),t.addEventListener("pointerover",o,!0),self.addEventListener("pointerup",r,!0)):(self.document.addEventListener("mousemove",n,!0),t.addEventListener("mousedown",i,!0),t.addEventListener("mouseout",a,!0),t.addEventListener("mouseover",o,!0),self.addEventListener("mouseup",r,!0)),pc&&(t.addEventListener("touchstart",i,!0),t.addEventListener("touchend",r,!0),t.addEventListener("touchmove",n,!0)),t.addEventListener("wheel",s,{passive:!0,capture:!0})})),t.hooks.destroy.tap(fc.tag,(function(){var t=e.contextService.getDomElement();vc?(self.document.removeEventListener("pointermove",n,!0),t.removeEventListener("pointerdown",i,!0),t.removeEventListener("pointerleave",a,!0),t.removeEventListener("pointerover",o,!0),self.removeEventListener("pointerup",r,!0)):(self.document.removeEventListener("mousemove",n,!0),t.removeEventListener("mousedown",i,!0),t.removeEventListener("mouseout",a,!0),t.removeEventListener("mouseover",o,!0),self.removeEventListener("mouseup",r,!0)),pc&&(t.removeEventListener("touchstart",i,!0),t.removeEventListener("touchend",r,!0),t.removeEventListener("touchmove",n,!0)),t.removeEventListener("wheel",s,!0)}))}}]),t}(),lc.tag="DOMInteractionPlugin",fc=hc);cc([(dc=Na,function(t,e,n){if(void 0===dc)throw Error("@inject called with undefined this could mean that the class "+t.name+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation.");var r=new ac("inject",dc);"number"==typeof n?function(t,e,n,r){sc("inversify:tagged",t,e,r,n)}(t,e,n,r):function(t,e,n){sc("inversify:tagged_props",t.constructor,e,n)}(t,e,r)}),function(t,e){if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:type",Object)],yc.prototype,"contextService",void 0),yc=fc=cc([function(t){if(Reflect.hasOwnMetadata(ic,t))throw Error("Cannot apply @injectable decorator multiple times.");var e=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(ic,e,t),t}],yc);var gc=new uc((function(t,e,n,r){t(yc).toSelf().inSingletonScope(),t(Ia).toService(yc)})),mc=function(){function t(){ec(this,t)}return rc(t,[{key:"init",value:function(t){t.load(gc)}},{key:"destroy",value:function(t){t.unload(gc)}}]),t}();function bc(t,e,n,r,i){wc(t,e,n||0,r||t.length-1,i||kc)}function wc(t,e,n,r,i){for(;r>n;){if(r-n>600){var o=r-n+1,a=e-n+1,s=Math.log(o),u=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*u*(o-u)/o)*(0>a-o/2?-1:1);wc(t,e,Math.max(n,Math.floor(e-a*u/o+c)),Math.min(r,Math.floor(e+(o-a)*u/o+c)),i)}var l=t[e],h=n,f=r;for(xc(t,n,e),i(t[r],l)>0&&xc(t,n,r);f>h;){for(xc(t,h,f),h++,f--;0>i(t[h],l);)h++;for(;i(t[f],l)>0;)f--}0===i(t[n],l)?xc(t,n,f):xc(t,++f,r),f>e||(n=f+1),e>f||(r=f-1)}}function xc(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function kc(t,e){return e>t?-1:t>e?1:0}class Ec{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const n=[];if(!Ic(t,e))return n;const r=this.toBBox,i=[];for(;e;){for(let o=0;e.children.length>o;o++){const a=e.children[o],s=e.leaf?r(a):a;Ic(t,s)&&(e.leaf?n.push(a):Oc(t,s)?this._all(a,n):i.push(a))}e=i.pop()}return n}collides(t){let e=this.data;if(!Ic(t,e))return!1;const n=[];for(;e;){for(let r=0;e.children.length>r;r++){const i=e.children[r],o=e.leaf?this.toBBox(i):i;if(Ic(t,o)){if(e.leaf||Oc(t,o))return!0;n.push(i)}}e=n.pop()}return!1}load(t){if(!t||!t.length)return this;if(this._minEntries>t.length){for(let e=0;t.length>e;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(e.height>this.data.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=jc([]),this}remove(t,e){if(!t)return this;let n=this.data;const r=this.toBBox(t),i=[],o=[];let a,s,u;for(;n||i.length;){if(n||(n=i.pop(),s=i[i.length-1],a=o.pop(),u=!0),n.leaf){const r=Tc(t,n.children,e);if(-1!==r)return n.children.splice(r,1),i.push(n),this._condense(i),this}u||n.leaf||!Oc(n,r)?s?(a++,n=s.children[a],u=!1):n=null:(i.push(n),o.push(a),a=0,s=n,n=n.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const n=[];for(;t;)t.leaf?e.push(...t.children):n.push(...t.children),t=n.pop();return e}_build(t,e,n,r){const i=n-e+1;let o,a=this._maxEntries;if(a>=i)return o=jc(t.slice(e,n+1)),Mc(o,this.toBBox),o;r||(a=Math.ceil(i/Math.pow(a,(r=Math.ceil(Math.log(i)/Math.log(a)))-1))),o=jc([]),o.leaf=!1,o.height=r;const s=Math.ceil(i/a),u=s*Math.ceil(Math.sqrt(a));Dc(t,e,n,u,this.compareMinX);for(let i=e;n>=i;i+=u){const e=Math.min(i+u-1,n);Dc(t,i,e,s,this.compareMinY);for(let n=i;e>=n;n+=s){o.children.push(this._build(t,n,Math.min(n+s-1,e),r-1))}}return Mc(o,this.toBBox),o}_chooseSubtree(t,e,n,r){for(;r.push(e),!e.leaf&&r.length-1!==n;){let n,r=1/0,a=1/0;for(let s=0;e.children.length>s;s++){const u=e.children[s],c=Cc(u),l=(Math.max((o=u).maxX,(i=t).maxX)-Math.min(o.minX,i.minX))*(Math.max(o.maxY,i.maxY)-Math.min(o.minY,i.minY))-c;a>l?(a=l,r=r>c?c:r,n=u):l===a&&r>c&&(r=c,n=u)}e=n||e.children[0]}var i,o;return e}_insert(t,e,n){const r=n?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,e,i);for(o.children.push(t),_c(o,r);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)}_split(t,e){const n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);const o=this._chooseSplitIndex(n,i,r),a=jc(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Mc(n,this.toBBox),Mc(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)}_splitRoot(t,e){this.data=jc([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Mc(this.data,this.toBBox)}_chooseSplitIndex(t,e,n){let r,i=1/0,o=1/0;for(let a=e;n-e>=a;a++){const e=Pc(t,0,a,this.toBBox),s=Pc(t,a,n,this.toBBox),u=Nc(e,s),c=Cc(e)+Cc(s);i>u?(i=u,r=a,o=o>c?c:o):u===i&&o>c&&(o=c,r=a)}return r||n-e}_chooseSplitAxis(t,e,n){const r=t.leaf?this.compareMinX:Sc,i=t.leaf?this.compareMinY:Ac,o=this._allDistMargin(t,e,n,r);this._allDistMargin(t,e,n,i)>o&&t.children.sort(r)}_allDistMargin(t,e,n,r){t.children.sort(r);const i=this.toBBox,o=Pc(t,0,e,i),a=Pc(t,n-e,n,i);let s=Rc(o)+Rc(a);for(let r=e;n-e>r;r++){const e=t.children[r];_c(o,t.leaf?i(e):e),s+=Rc(o)}for(let r=n-e-1;r>=e;r--){const e=t.children[r];_c(a,t.leaf?i(e):e),s+=Rc(a)}return s}_adjustParentBBoxes(t,e,n){for(let r=n;r>=0;r--)_c(e[r],t)}_condense(t){for(let e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children,e.splice(e.indexOf(t[n]),1)):this.clear():Mc(t[n],this.toBBox)}}function Tc(t,e,n){if(!n)return e.indexOf(t);for(let r=0;e.length>r;r++)if(n(t,e[r]))return r;return-1}function Mc(t,e){Pc(t,0,t.children.length,e,t)}function Pc(t,e,n,r,i){i||(i=jc(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let o=e;n>o;o++){const e=t.children[o];_c(i,t.leaf?r(e):e)}return i}function _c(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function Sc(t,e){return t.minX-e.minX}function Ac(t,e){return t.minY-e.minY}function Cc(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Rc(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Nc(t,e){const n=Math.max(t.minX,e.minX),r=Math.max(t.minY,e.minY),i=Math.min(t.maxX,e.maxX),o=Math.min(t.maxY,e.maxY);return Math.max(0,i-n)*Math.max(0,o-r)}function Oc(t,e){return!(t.minX>e.minX||t.minY>e.minY||e.maxX>t.maxX||e.maxY>t.maxY)}function Ic(t,e){return!(e.minX>t.maxX||e.minY>t.maxY||t.minX>e.maxX||t.minY>e.maxY)}function jc(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Dc(t,e,n,r,i){const o=[e,n];for(;o.length;){if(r>=(n=o.pop())-(e=o.pop()))continue;const a=e+Math.ceil((n-e)/r/2)*r;bc(t,a,e,n,i),o.push(e,a,a,n)}}function Bc(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function Fc(t){for(var e=1;arguments.length>e;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Bc(Object(n),!0).forEach((function(e){qc(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Bc(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function Lc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Wc(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Gc(t,e,n){return e&&Wc(t.prototype,e),n&&Wc(t,n),t}function qc(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $c(t){return($c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Hc(t,e){return(Hc=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Vc(t,e){if(e&&("object"===i(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Xc(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=$c(t);if(e){var i=$c(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Vc(this,n)}}function Yc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,o=[],a=!0,s=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(o.push(r.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(t,e)||Uc(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zc(t){return function(t){if(Array.isArray(t))return Kc(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Uc(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Uc(t,e){if(t){if("string"==typeof t)return Kc(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kc(t,e):void 0}}function Kc(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);e>n;n++)r[n]=t[n];return r}var Zc="inversify:paramtypes",Qc=0;var Jc=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return"named"===this.key?"named: "+this.value+" ":"tagged: { key:"+this.key+", value: "+this.value+" }"},t}();function tl(t,e,n,r,i){var o={},a="number"==typeof i,s=void 0!==i&&a?""+i:n;if(a&&void 0!==n)throw Error("The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.");Reflect.hasOwnMetadata(t,e)&&(o=Reflect.getMetadata(t,e));var u=o[s];if(Array.isArray(u))for(var c=0,l=u;l.length>c;c++){var h=l[c];if(h.key===r.key)throw Error("Metadata key was used more than once in a parameter: "+h.key)}else u=[];u.push(r),o[s]=u,Reflect.defineMetadata(t,o,e)}function el(t){return function(e,n,r){if(void 0===t)throw Error("@inject called with undefined this could mean that the class "+e.name+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation.");var i=new Jc("inject",t);"number"==typeof r?function(t,e,n,r){tl("inversify:tagged",t,e,r,n)}(e,n,r,i):function(t,e,n){tl("inversify:tagged_props",t.constructor,e,n)}(e,n,i)}}var nl=function(t){this.id=Qc++,this.registry=t};function rl(){return function(t){if(Reflect.hasOwnMetadata(Zc,t))throw Error("Cannot apply @injectable decorator multiple times.");var e=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(Zc,e,t),t}}
|
|
60
|
+
/*! *****************************************************************************
|
|
61
|
+
Copyright (c) Microsoft Corporation.
|
|
62
|
+
|
|
63
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
64
|
+
purpose with or without fee is hereby granted.
|
|
65
|
+
|
|
66
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
67
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
68
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
69
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
70
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
71
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
72
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
73
|
+
***************************************************************************** */function il(t,e,n,r){var o,a=arguments.length,s=3>a?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(s=(3>a?o(s):a>3?o(e,n,s):o(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s}function ol(t,e){if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var al={}.toString,sl=function(t,e){return al.call(t)==="[object "+e+"]"},ul=function(t){return null==t},cl=function(t){return Array.isArray?Array.isArray(t):sl(t,"Array")},ll=function(t){return sl(t,"String")},hl=function(){function t(){Lc(this,t)}return Gc(t,[{key:"render",value:function(t,e){var n=e.opacity,r=e.fillOpacity,i=e.stroke,o=e.strokeOpacity,a=e.lineWidth,s=e.lineCap,u=e.lineJoin;if(ul(e.fill)||(ul(r)||1===r?t.fill():(t.globalAlpha=r,t.fill(),t.globalAlpha=n)),!ul(i)&&a&&a>0){!ul(o)&&1!==o&&(t.globalAlpha=o),t.lineWidth=a,ul(s)||(t.lineCap=s),ul(u)||(t.lineJoin=u);var c=t.shadowBlur,l=t.shadowColor;ul(c)||(t.shadowColor="transparent",t.shadowBlur=0);var h=t.filter;!ul(h)&&h.indexOf("drop-shadow")>-1&&(t.filter=h.replace(/drop-shadow\([^)]*\)/,"").trim()||"none"),t.stroke(),ul(c)||(t.shadowColor=l,t.shadowBlur=c),ul(h)||(t.filter=h)}}}]),t}();hl=il([rl()],hl);var fl=function(){function t(){Lc(this,t),this.imageCache={},this.patternCache={}}return Gc(t,[{key:"getImageSync",value:function(t){return this.imageCache[t]}},{key:"getOrCreateImage",value:function(t){var e=this;return this.imageCache[t]?Promise.resolve(this.imageCache[t]):new Promise((function(n,r){var i=new Image;i.onload=function(){n(i)},i.onerror=function(t){r(t)},i.crossOrigin="Anonymous",i.src=t,e.imageCache[t]=i}))}},{key:"getPatternSync",value:function(t){var e=this.generatePatternKey(t);if(this.patternCache[e])return this.patternCache[e]}},{key:"createPattern",value:function(t,e){var n=this;return this.getOrCreateImage(t.src).then((function(r){var i=n.generatePatternKey(t),o=e.createPattern(r,t.repetition);return o&&(n.patternCache[i]=o),n.patternCache[i]}))}},{key:"generatePatternKey",value:function(t){var e=t.repetition;return"pattern-".concat(t.src,"-").concat(e)}}]),t}();fl=il([rl()],fl);var dl=function(){function t(){Lc(this,t),this.imagePool=void 0}return Gc(t,[{key:"render",value:function(t,e){var n,r=e.width,i=e.height,o=e.img,a=void 0===r?0:r,s=void 0===i?0:i;ll(o)?n=this.imagePool.getImageSync(o):(a||(a=o.width),s||(s=o.height),n=o),t.drawImage(n,0,0,a,s)}}]),t}();il([el(fl),ol("design:type",fl)],dl.prototype,"imagePool",void 0),dl=il([rl()],dl);var pl=function(){function t(){Lc(this,t),this.textService=void 0}return Gc(t,[{key:"render",value:function(t,e){var n=e.lineWidth,r=void 0===n?0:n,i=e.textBaseline,o=e.lineJoin,a=e.miterLimit,s=void 0===a?0:a,u=e.padding,c=void 0===u?0:u,l=e.letterSpacing,h=void 0===l?0:l,f=e.stroke,d=e.fill,p=e.fillOpacity,v=e.strokeOpacity,y=e.opacity,g=e.metrics,m=g.lines,b=g.height,w=g.lineHeight;t.font=g.font,t.lineWidth=r,t.textBaseline=i,t.lineJoin=o,t.miterLimit=s;var x=0;"middle"===i?x=-b/2-w/2:"bottom"===i||"alphabetic"===i||"ideographic"===i?x=-b:"top"!==i&&"hanging"!==i||(x=-w);for(var k=0;m.length>k;k++){var E=r/2;x+=w,!ul(f)&&r&&this.drawLetterSpacing(t,m[k],E+c,x+c,h,p,v,y,!0),ul(d)||this.drawLetterSpacing(t,m[k],E+c,x+c,h,p,v,y)}}},{key:"drawLetterSpacing",value:function(t,e,n,r,i,o,a,s){var u=arguments.length>8&&void 0!==arguments[8]&&arguments[8];if(0!==i)for(var c=n,l=Array.from(e),h=t.measureText(e).width,f=0,d=0;l.length>d;++d){var p=l[d];u?this.strokeText(t,p,c,r,a):this.fillText(t,p,c,r,o,s),c+=h-(f=t.measureText(e.substring(d+1)).width)+i,h=f}else u?this.strokeText(t,e,n,r,a):this.fillText(t,e,n,r,o,s)}},{key:"fillText",value:function(t,e,n,r,i,o){var a=!ul(i)&&1!==i;a&&(t.globalAlpha=i),t.fillText(e,n,r),a&&(t.globalAlpha=o)}},{key:"strokeText",value:function(t,e,n,r,i){!ul(i)&&1!==i&&(t.globalAlpha=i),t.strokeText(e,n,r)}}]),t}();il([el(Pa),ol("design:type",Pa)],pl.prototype,"textService",void 0),pl=il([rl()],pl);var vl="StyleRendererFactory",yl="StyleRenderer",gl=function(){function t(){Lc(this,t),this.gradientCache={}}return Gc(t,[{key:"getOrCreateGradient",value:function(t,e){var n=this.generateCacheKey(t),r=t.type,i=t.x0,o=t.y0,a=t.x1,s=t.y1,u=t.steps,c=t.width,l=t.height;if(this.gradientCache[n])return this.gradientCache[n];var h=null;if(r===rs.LinearGradient)h=e.createLinearGradient(i*c,o*l,a*c,s*l);else if(r===rs.RadialGradient){h=e.createRadialGradient(i*c,o*l,0,a*c,s*l,t.r1*(Math.sqrt(c*c+l*l)/2))}return h&&(u.forEach((function(t){var e,n=Yc(t,2),r=n[1];null===(e=h)||void 0===e||e.addColorStop(Number(n[0]),r)})),this.gradientCache[n]=h),this.gradientCache[n]}},{key:"generateCacheKey",value:function(t){var e=t.x0,n=t.y0,r=t.x1,i=t.y1,o=t.r1,a=t.steps,s=t.width,u=t.height;return"gradient-".concat(t.type,"-").concat(e,"-").concat(n,"-").concat(r,"-").concat(i,"-").concat(o||0,"-").concat(s,"-").concat(u,"-").concat(a.map((function(t){return t.join("")})).join("-"))}}]),t}();gl=il([rl()],gl);var ml="PathGeneratorFactory",bl="PathGenerator",wl="undefined"!=typeof Float32Array?Float32Array:Array;function xl(t,e){var n=e[4],r=e[5],i=e[6],o=e[8],a=e[9],s=e[10];return t[0]=Math.hypot(e[0],e[1],e[2]),t[1]=Math.hypot(n,r,i),t[2]=Math.hypot(o,a,s),t}function kl(){var t=new wl(3);return wl!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function El(t,e,n){var r=new wl(3);return r[0]=t,r[1]=e,r[2]=n,r}function Tl(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[0],s=n[1],u=n[2];return t[0]=i*u-o*s,t[1]=o*a-r*u,t[2]=r*s-i*a,t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Ml=function(t){return Math.hypot(t[0],t[1],t[2])};!function(){var t=kl()}();!function(){var t,e=(t=new wl(4),wl!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();function Pl(){var t=new wl(4);return wl!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function _l(t,e,n,r){var i,o,a,s,u,c=e[0],l=e[1],h=e[2],f=e[3],d=n[0],p=n[1],v=n[2],y=n[3];return 0>(o=c*d+l*p+h*v+f*y)&&(o=-o,d=-d,p=-p,v=-v,y=-y),1-o>1e-6?(a=Math.sin(i=Math.acos(o)),s=Math.sin((1-r)*i)/a,u=Math.sin(r*i)/a):(s=1-r,u=r),t[0]=s*c+u*d,t[1]=s*l+u*p,t[2]=s*h+u*v,t[3]=s*f+u*y,t}var Sl,Al,Cl,Rl,Nl=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],a=n*n+r*r+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),t[0]=n*a,t[1]=r*a,t[2]=i*a,t[3]=o*a,t},Ol=(function(){var t=kl(),e=El(1,0,0),n=El(0,1,0)}(),function(){var t=Pl(),e=Pl()}(),function(){var t,e=(t=new wl(9),wl!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t)}(),function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Hc(t,e)}(n,t);var e=Xc(n);function n(){var t;Lc(this,n);for(var r=arguments.length,i=Array(r),o=0;r>o;o++)i[o]=arguments[o];return(t=e.call.apply(e,[this].concat(i))).aabb=void 0,t}return n}(Ee));Ol.tag="c-canvas-rbush-node";var Il,jl,Dl,Bl="RBushRoot",Fl={fill:"fillStyle",stroke:"strokeStyle",opacity:"globalAlpha"},Ll=(Al=Sl=function(){function t(){Lc(this,t),this.canvasConfig=void 0,this.camera=void 0,this.contextService=void 0,this.sceneGraphService=void 0,this.renderingContext=void 0,this.imagePool=void 0,this.gradientPool=void 0,this.pathGeneratorFactory=void 0,this.styleRendererFactory=void 0,this.displayObjectPool=void 0,this.rBush=void 0,this.renderQueue=[],this.restoreStack=[],this.clearFullScreen=!1,this.lastDirtyRectangle=void 0}return Gc(t,[{key:"apply",value:function(t){var e=this,n=function(t){e.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering&&(t.target.entity.addComponent(Ol),i(t))},r=function(t){if(e.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering){var n=t.target,r=n.entity.getComponent(Ol);e.rBush.remove(r.aabb,(function(t,e){return t.name===e.name})),n.entity.removeComponent(Ol)}},i=function(t){var n;e.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering&&((null===(n=t.target.ownerDocument)||void 0===n?void 0:n.documentElement)===e.renderingContext.root&&t.composedPath().slice(0,-2).forEach((function(t){e.insertRBushNode(t)})))};t.hooks.init.tap(Cl.tag,(function(){var t=e.contextService.getContext(),o=e.contextService.getDPR();t&&t.scale(o,o),e.renderingContext.root.addEventListener(Ba.MOUNTED,n),e.renderingContext.root.addEventListener(Ba.UNMOUNTED,r),e.renderingContext.root.addEventListener(Ba.BOUNDS_CHANGED,i)})),t.hooks.destroy.tap(Cl.tag,(function(){e.renderingContext.root.removeEventListener(Ba.MOUNTED,n),e.renderingContext.root.removeEventListener(Ba.UNMOUNTED,r),e.renderingContext.root.removeEventListener(Ba.BOUNDS_CHANGED,i)})),t.hooks.beginFrame.tap(Cl.tag,(function(){var t=e.contextService.getContext(),n=e.canvasConfig.renderer.getConfig();e.clearFullScreen=!n.enableDirtyRectangleRendering||e.renderingContext.renderReasons.has(Ra.CameraChanged),t&&(t.save(),e.clearFullScreen&&t.clearRect(0,0,e.canvasConfig.width,e.canvasConfig.height),e.applyTransform(t,e.camera.getOrthoMatrix()))})),t.hooks.endFrame.tap(Cl.tag,(function(){var n=e.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering,r=e.contextService.getContext();if(n){var i=e.safeMergeAABB.apply(e,[e.mergeDirtyAABBs(e.renderQueue)].concat(zc(e.renderingContext.removedRenderBoundsList)));if(e.renderingContext.removedRenderBoundsList=[],!i)return;var o=e.convertAABB2Rect(i),a=o.x,s=o.y,u=o.width,c=o.height;r.clearRect(a,s,u,c),r.beginPath(),r.rect(a,s,u,c),r.clip(),e.searchDirtyObjects(i).sort(e.sceneGraphService.sort).forEach((function(n){n.isVisible()&&e.renderDisplayObject(n,t)})),e.renderQueue.forEach((function(t){e.saveDirtyAABB(t)})),e.restoreStack.forEach((function(t){r.restore()})),e.renderQueue=[],e.restoreStack=[]}r.restore()})),t.hooks.render.tap(Cl.tag,(function(n){e.canvasConfig.renderer.getConfig().enableDirtyRectangleRendering?e.renderQueue.push(n):e.renderDisplayObject(n,t)}))}},{key:"renderDisplayObject",value:function(t,e){for(var n=this,r=this.contextService.getContext(),i=this.restoreStack[this.restoreStack.length-1];i&&t.parent!==i;)r.restore(),this.restoreStack.pop(),i=this.restoreStack[this.restoreStack.length-1];var o=t.nodeName;r.save(),this.applyTransform(r,t.getLocalTransform());var a=t.style.clipPath;if(a){r.save(),this.applyTransform(r,a.getLocalTransform());var s=this.pathGeneratorFactory(a.nodeName);s&&this.useAnchor(r,a,(function(){s(r,a.parsedStyle)})),r.restore(),r.clip()}r.save(),this.applyAttributesToContext(r,t,e),this.useAnchor(r,t,(function(){var e=n.pathGeneratorFactory(t.nodeName);e&&e(r,t.parsedStyle);var i=n.styleRendererFactory(o);i&&i.render(r,t.parsedStyle,t)})),r.restore(),t.getEntity().getComponent(zo).dirty=!1,this.restoreStack.push(t)}},{key:"convertAABB2Rect",value:function(t){var e=t.getMin(),n=t.getMax(),r=Math.floor(e[0]),i=Math.floor(e[1]);return{x:r,y:i,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-i}}},{key:"insertRBushNode",value:function(t){var e=t.entity.getComponent(Ol);if(e){this.rBush.remove(e.aabb,(function(t,e){return t.name===e.name}));var n=t.getRenderBounds();if(n){var r=Yc(n.getMin(),2),i=r[0],o=r[1],a=Yc(n.getMax(),2),s=a[0],u=a[1];e.aabb={name:t.entity.getName(),minX:i,minY:o,maxX:s,maxY:u}}this.rBush.insert(e.aabb)}}},{key:"mergeDirtyAABBs",value:function(t){var e;return t.forEach((function(t){var n=t.getRenderBounds();n&&(e?e.add(n):e=new ra(n.center,n.halfExtents));var r=t.entity.getComponent(zo).dirtyRenderBounds;r&&(e?e.add(r):e=new ra(r.center,r.halfExtents))})),e}},{key:"searchDirtyObjects",value:function(t){var e=this,n=Yc(t.getMin(),2),r=n[0],i=n[1],o=Yc(t.getMax(),2);return this.rBush.search({minX:r,minY:i,maxX:o[0],maxY:o[1]}).map((function(t){return e.displayObjectPool.getByName(t.name)}))}},{key:"saveDirtyAABB",value:function(t){var e=t.entity.getComponent(zo);e.dirtyRenderBounds||(e.dirtyRenderBounds=new ra);var n=t.getRenderBounds();n&&e.dirtyRenderBounds.update(n.center,n.halfExtents)}},{key:"drawDirtyRectangle",value:function(t,e){var n=e.x,r=e.y,i=e.width,o=e.height;t.beginPath(),t.rect(n+1,r+1,i-1,o-1),t.closePath(),t.lineWidth=1,t.stroke()}},{key:"applyTransform",value:function(t,e){var n,r,i=Yc(((n=kl())[0]=(r=e)[12],n[1]=r[13],n[2]=r[14],n),2),o=i[0],a=i[1],s=Yc(xl(kl(),e),2),u=s[0],c=s[1],l=function(t,e){var n=new wl(3);xl(n,e);var r=1/n[0],i=1/n[1],o=1/n[2],a=e[0]*r,s=e[1]*i,u=e[2]*o,c=e[4]*r,l=e[5]*i,h=e[6]*o,f=e[8]*r,d=e[9]*i,p=e[10]*o,v=a+l+p,y=0;return v>0?(t[3]=.25*(y=2*Math.sqrt(v+1)),t[0]=(h-d)/y,t[1]=(f-u)/y,t[2]=(s-c)/y):a>l&&a>p?(t[3]=(h-d)/(y=2*Math.sqrt(1+a-l-p)),t[0]=.25*y,t[1]=(s+c)/y,t[2]=(f+u)/y):l>p?(t[3]=(f-u)/(y=2*Math.sqrt(1+l-a-p)),t[0]=(s+c)/y,t[1]=.25*y,t[2]=(h+d)/y):(t[3]=(s-c)/(y=2*Math.sqrt(1+p-a-l)),t[0]=(f+u)/y,t[1]=(h+d)/y,t[2]=.25*y),t}(Pl(),e),h=Yc(za(kl(),l),3),f=Ua(h[0]||h[2],o,a,u,c);t.transform(f[0],f[1],f[3],f[4],f[6],f[7])}},{key:"applyAttributesToContext",value:function(t,e,n){var r=e.attributes,i=e.parsedStyle;for(var o in r)if("transform"!==o){var a=r[o],s=Fl[o]?Fl[o]:o;if("lineDash"===s&&t.setLineDash)cl(a)&&t.setLineDash(a);else{if("strokeStyle"===s||"fillStyle"===s){var u=i[o];if(u.type===rs.LinearGradient||u.type===rs.RadialGradient){var c=e.getGeometryBounds(),l=c&&2*c.halfExtents[0]||0,h=c&&2*c.halfExtents[1]||0;a=this.gradientPool.getOrCreateGradient(Fc(Fc({type:u.type},u.value),{},{width:l,height:h}),t)}else if(u.type===rs.Pattern){var f=this.imagePool.getPatternSync(u.value);f?a=f:this.imagePool.createPattern(u.value,t).then((function(){e.getEntity().getComponent(zo).dirty=!0,n.dirtify()}))}else a=u.formatted}else"globalAlpha"===s&&(a*=t.globalAlpha);t[s]=a}}}},{key:"useAnchor",value:function(t,e,n){var r=e.getGeometryBounds();if(r){var i=r.halfExtents;t.save();var o=(e.parsedStyle||{}).anchor,a=void 0===o?[0,0]:o;t.translate(-a[0]*i[0]*2,-a[1]*i[1]*2),n(),t.restore()}else n()}},{key:"safeMergeAABB",value:function(){for(var t,e=arguments.length,n=Array(e),r=0;e>r;r++)n[r]=arguments[r];return n.forEach((function(e){e&&(t?t.add(e):t=e)})),t}}]),t}(),Sl.tag="CanvasRendererPlugin",Cl=Al);il([el(Xo),ol("design:type",Object)],Ll.prototype,"canvasConfig",void 0),il([el(_u),ol("design:type",Iu)],Ll.prototype,"camera",void 0),il([el(Na),ol("design:type",Object)],Ll.prototype,"contextService",void 0),il([el(da),ol("design:type",Object)],Ll.prototype,"sceneGraphService",void 0),il([el(Oa),ol("design:type",Object)],Ll.prototype,"renderingContext",void 0),il([el(fl),ol("design:type",fl)],Ll.prototype,"imagePool",void 0),il([el(gl),ol("design:type",gl)],Ll.prototype,"gradientPool",void 0),il([el(ml),ol("design:type",Function)],Ll.prototype,"pathGeneratorFactory",void 0),il([el(vl),ol("design:type",Function)],Ll.prototype,"styleRendererFactory",void 0),il([el(ea),ol("design:type",ea)],Ll.prototype,"displayObjectPool",void 0),il([el(Bl),ol("design:type","function"==typeof(Rl=void 0!==Ec&&Ec)?Rl:Object)],Ll.prototype,"rBush",void 0),Ll=Cl=il([rl()],Ll);var Wl=(jl=Il=function(){function t(){Lc(this,t),this.imagePool=void 0,this.renderingContext=void 0}return Gc(t,[{key:"apply",value:function(t){var e=this,n=function(n){var r=n.target;if(r.nodeName===qo.Image){var i=r.attributes.img;ll(i)&&e.imagePool.getOrCreateImage(i).then((function(){r.getEntity().getComponent(zo).dirty=!0,t.dirtify()}))}},r=function(n){var r=n.target,i=n.detail,o=i.newValue;r.nodeName===qo.Image&&"img"===i.attributeName&&ll(o)&&e.imagePool.getOrCreateImage(o).then((function(){r.entity.getComponent(zo).dirty=!0,t.dirtify()}))};t.hooks.init.tap(Dl.tag,(function(){e.renderingContext.root.addEventListener(Ba.MOUNTED,n),e.renderingContext.root.addEventListener(Ba.ATTRIBUTE_CHANGED,r)})),t.hooks.destroy.tap(Dl.tag,(function(){e.renderingContext.root.removeEventListener(Ba.MOUNTED,n),e.renderingContext.root.removeEventListener(Ba.ATTRIBUTE_CHANGED,r)}))}}]),t}(),Il.tag="LoadImagePlugin",Dl=jl);il([el(fl),ol("design:type",fl)],Wl.prototype,"imagePool",void 0),il([el(Oa),ol("design:type",Object)],Wl.prototype,"renderingContext",void 0),Wl=Dl=il([rl()],Wl),xu.registerComponent(Ol),wu.bind(bl).toConstantValue((function(t,e){t.beginPath();var n=e.r,r=void 0===n?0:n;t.arc(r,r,r,0,2*Math.PI,!1)})).whenTargetNamed(qo.Circle),wu.bind(bl).toConstantValue((function(t,e){var n=e.rx,r=e.ry;if(t.beginPath(),t.ellipse)t.ellipse(n,r,n,r,0,0,2*Math.PI,!1);else{var i=n>r?n:r,o=n>r?1:n/r,a=n>r?r/n:1;t.save(),t.scale(o,a),t.arc(0,0,i,0,2*Math.PI),t.closePath(),t.restore()}})).whenTargetNamed(qo.Ellipse),wu.bind(bl).toConstantValue((function(t,e){var n=e.radius,r=void 0===n?0:n,i=e.width,o=void 0===i?0:i,a=e.height,s=void 0===a?0:a;if(t.beginPath(),0===r)t.rect(0,0,o,s);else{var u=Yc(function(t){var e=0,n=0,r=0,i=0;return cl(t)?1===t.length?e=n=r=i=t[0]:2===t.length?(e=r=t[0],n=i=t[1]):3===t.length?(e=t[0],n=i=t[1],r=t[2]):(e=t[0],n=t[1],r=t[2],i=t[3]):e=n=r=i=t,[e,n,r,i]}(r),4),c=u[0],l=u[1],h=u[2],f=u[3];t.moveTo(c,0),t.lineTo(o-l,0),0!==l&&t.arc(o-l,l,l,-Math.PI/2,0),t.lineTo(o,s-h),0!==h&&t.arc(o-h,s-h,h,0,Math.PI/2),t.lineTo(f,s),0!==f&&t.arc(f,s-f,f,Math.PI/2,Math.PI),t.lineTo(0,c),0!==c&&t.arc(c,c,c,Math.PI,1.5*Math.PI),t.closePath()}})).whenTargetNamed(qo.Rect),wu.bind(bl).toConstantValue((function(t,e){var n=e.x1,r=e.y1,i=e.x2,o=e.y2,a=e.defX,s=void 0===a?0:a,u=e.defY,c=void 0===u?0:u;t.beginPath(),t.moveTo(n-s,r-c),t.lineTo(i-s,o-c)})).whenTargetNamed(qo.Line),wu.bind(bl).toConstantValue((function(t,e){var n=e.defX,r=void 0===n?0:n,i=e.defY,o=void 0===i?0:i,a=e.points.points,s=a.length,u=a[0][0]-r,c=a[0][1]-o,l=a[s-1][0]-r,h=a[s-1][1]-o;t.beginPath(),t.moveTo(u,c);for(var f=0;s-1>f;f++){var d=a[f];t.lineTo(d[0]-r,d[1]-o)}t.lineTo(l,h)})).whenTargetNamed(qo.Polyline),wu.bind(bl).toConstantValue((function(t,e){var n=e.defX,r=void 0===n?0:n,i=e.defY,o=void 0===i?0:i,a=e.points.points,s=a.length,u=a[0][0]-r,c=a[0][1]-o,l=a[s-1][0]-r,h=a[s-1][1]-o;t.beginPath(),t.moveTo(u,c);for(var f=0;s-1>f;f++){var d=a[f];t.lineTo(d[0]-r,d[1]-o)}t.lineTo(l,h),t.closePath()})).whenTargetNamed(qo.Polygon),wu.bind(bl).toConstantValue((function(t,e){var n=e.defX,r=void 0===n?0:n,i=e.defY,o=void 0===i?0:i,a=e.path,s=a.curve;a.zCommandIndexes.forEach((function(t,e){s.splice(t+e,0,["Z"])}));var u=[-r,-o];t.beginPath();for(var c=0;s.length>c;c++){var l=s[c],h=l[0];switch(h){case"M":t.moveTo(l[1]-r,l[2]-o),u=[l[1]-r,l[2]-o];break;case"C":t.bezierCurveTo(l[1]-r,l[2]-o,l[3]-r,l[4]-o,l[5]-r,l[6]-o);break;case"Z":t.closePath()}if("Z"===h)u;else{var f=l.length;[l[f-2]-r,l[f-1]-o]}}})).whenTargetNamed(qo.Path),wu.bind(ml).toFactory((function(t){return function(e){return t.container.isBoundNamed(bl,e)?t.container.getNamed(bl,e):null}}));var Gl=new nl((function(t,e,n,r){t(fl).toSelf().inSingletonScope(),t(Bl).toConstantValue(new Ec),t(hl).toSelf().inSingletonScope(),t(dl).toSelf().inSingletonScope(),t(pl).toSelf().inSingletonScope(),t(yl).to(hl).inSingletonScope().whenTargetNamed(qo.Circle),t(yl).to(hl).inSingletonScope().whenTargetNamed(qo.Ellipse),t(yl).to(hl).inSingletonScope().whenTargetNamed(qo.Rect),t(yl).to(hl).inSingletonScope().whenTargetNamed(qo.Line),t(yl).to(hl).inSingletonScope().whenTargetNamed(qo.Polyline),t(yl).to(hl).inSingletonScope().whenTargetNamed(qo.Polygon),t(yl).to(hl).inSingletonScope().whenTargetNamed(qo.Path),t(yl).to(dl).inSingletonScope().whenTargetNamed(qo.Image),t(yl).to(pl).inSingletonScope().whenTargetNamed(qo.Text),t(vl).toFactory((function(t){return function(e){return t.container.isBoundNamed(yl,e)?t.container.getNamed(yl,e):null}})),t(gl).toSelf().inSingletonScope(),t(Ll).toSelf().inSingletonScope(),t(Ia).toService(Ll),t(Wl).toSelf().inSingletonScope(),t(Ia).toService(Wl)})),ql=function(){function t(){Lc(this,t)}return Gc(t,[{key:"init",value:function(t){t.load(Gl)}},{key:"destroy",value:function(t){t.unload(Gl)}}]),t}();function $l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Hl(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Vl(t,e,n){return e&&Hl(t.prototype,e),n&&Hl(t,n),t}var Xl="inversify:paramtypes",Yl=0;var zl=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return"named"===this.key?"named: "+this.value+" ":"tagged: { key:"+this.key+", value: "+this.value+" }"},t}();function Ul(t,e,n,r,i){var o={},a="number"==typeof i,s=void 0!==i&&a?""+i:n;if(a&&void 0!==n)throw Error("The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.");Reflect.hasOwnMetadata(t,e)&&(o=Reflect.getMetadata(t,e));var u=o[s];if(Array.isArray(u))for(var c=0,l=u;l.length>c;c++){var h=l[c];if(h.key===r.key)throw Error("Metadata key was used more than once in a parameter: "+h.key)}else u=[];u.push(r),o[s]=u,Reflect.defineMetadata(t,o,e)}function Kl(t){return function(e,n,r){if(void 0===t)throw Error("@inject called with undefined this could mean that the class "+e.name+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation.");var i=new zl("inject",t);"number"==typeof r?function(t,e,n,r){Ul("inversify:tagged",t,e,r,n)}(e,n,r,i):function(t,e,n){Ul("inversify:tagged_props",t.constructor,e,n)}(e,n,i)}}var Zl=function(t){this.id=Yl++,this.registry=t};
|
|
74
|
+
/*! *****************************************************************************
|
|
75
|
+
Copyright (c) Microsoft Corporation.
|
|
76
|
+
|
|
77
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
78
|
+
purpose with or without fee is hereby granted.
|
|
79
|
+
|
|
80
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
81
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
82
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
83
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
84
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
85
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
86
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
87
|
+
***************************************************************************** */
|
|
88
|
+
function Ql(t,e,n,r){var o,a=arguments.length,s=3>a?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(s=(3>a?o(s):a>3?o(e,n,s):o(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s}function Jl(t,e){if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var th="undefined"!=typeof Float32Array?Float32Array:Array;function eh(){var t=new th(9);return th!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function nh(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],c=e[6],l=e[7],h=e[8],f=n[0],d=n[1],p=n[2],v=n[3],y=n[4],g=n[5],m=n[6],b=n[7],w=n[8];return t[0]=f*r+d*a+p*c,t[1]=f*i+d*s+p*l,t[2]=f*o+d*u+p*h,t[3]=v*r+y*a+g*c,t[4]=v*i+y*s+g*l,t[5]=v*o+y*u+g*h,t[6]=m*r+b*a+w*c,t[7]=m*i+b*s+w*l,t[8]=m*o+b*u+w*h,t}function rh(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=-n,t[4]=r,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function ih(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function oh(){var t=new th(16);return th!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function ah(){var t=new th(3);return th!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function sh(t,e,n){var r=new th(3);return r[0]=t,r[1]=e,r[2]=n,r}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});!function(){var t=ah()}();function uh(t,e){var n=new th(2);return n[0]=t,n[1]=e,n}function ch(t,e,n){var r=e[0],i=e[1];return t[0]=n[0]*r+n[3]*i+n[6],t[1]=n[1]*r+n[4]*i+n[7],t}!function(){var t,e=(t=new th(2),th!=Float32Array&&(t[0]=0,t[1]=0),t)}();var lh,hh,fh,dh="PointInPathPicker",ph=(hh=lh=function(){function t(){var e=this;$l(this,t),this.camera=void 0,this.sceneGraphService=void 0,this.renderingContext=void 0,this.displayObjectPool=void 0,this.offscreenCanvas=void 0,this.rBush=void 0,this.pathGeneratorFactory=void 0,this.pointInPathPickerFactory=void 0,this.isHit=function(t,n,r){var i,o,a,s,u,c,l,h,f,d,p,v,y,g,m,b,w,x,k,E,T,M,P,_,S,A,C,R,N,O,I,j=e.pointInPathPickerFactory(t.nodeName);if(j){var D=(i=oh(),(I=(k=(a=(o=r)[0])*(h=o[5])-(s=o[1])*(l=o[4]))*(O=(y=o[10])*(x=o[15])-(g=o[11])*(w=o[14]))-(E=a*(f=o[6])-(u=o[2])*l)*(N=(v=o[9])*x-g*(b=o[13]))+(T=a*(d=o[7])-(c=o[3])*l)*(R=v*w-y*b)+(M=s*f-u*h)*(C=(p=o[8])*x-g*(m=o[12]))-(P=s*d-c*h)*(A=p*w-y*m)+(_=u*d-c*f)*(S=p*b-v*m))?(i[0]=(h*O-f*N+d*R)*(I=1/I),i[1]=(u*N-s*O-c*R)*I,i[2]=(b*_-w*P+x*M)*I,i[3]=(y*P-v*_-g*M)*I,i[4]=(f*C-l*O-d*A)*I,i[5]=(a*O-u*C+c*A)*I,i[6]=(w*T-m*_-x*E)*I,i[7]=(p*_-y*T+g*E)*I,i[8]=(l*N-h*C+d*S)*I,i[9]=(s*C-a*N-c*S)*I,i[10]=(m*P-b*T+x*k)*I,i[11]=(v*T-p*P-g*k)*I,i[12]=(h*A-l*R-f*S)*I,i[13]=(a*R-s*A+u*S)*I,i[14]=(b*E-m*M-w*k)*I,i[15]=(p*M-v*E+y*k)*I,i):null),B=function(t,e,n){var r=e[0],i=e[1],o=e[2],a=n[3]*r+n[7]*i+n[11]*o+n[15];return t[0]=(n[0]*r+n[4]*i+n[8]*o+n[12])/(a=a||1),t[1]=(n[1]*r+n[5]*i+n[9]*o+n[13])/a,t[2]=(n[2]*r+n[6]*i+n[10]*o+n[14])/a,t}(ah(),sh(n[0],n[1],0),D),F=t.getGeometryBounds().halfExtents,L=t.parsedStyle.anchor,W=void 0===L?[0,0]:L;if(B[0]+=W[0]*F[0]*2,B[1]+=W[1]*F[1]*2,j(t,new aa(B[0],B[1]),e.isPointInPath))return!0}return!1},this.isPointInPath=function(t,n){var r=e.offscreenCanvas.getOrCreateContext(),i=e.pathGeneratorFactory(t.nodeName);return i&&i(r,t.parsedStyle),r.isPointInPath(n.x,n.y)}}return Vl(t,[{key:"apply",value:function(t){var e=this;t.hooks.pick.tap(fh.tag,(function(t){var n=t.position,r=sh(n.x,n.y,0),i=[],o=e.rBush.search({minX:r[0],minY:r[1],maxX:r[0],maxY:r[1]}),a=o.map((function(t){return t.name}));return o.forEach((function(t){var n,o,s,u,c,l,h,f,d,p,v,y,g,m,b,w,x,k,E,T,M,P,_,S=e.displayObjectPool.getByName(t.name);if(S.isVisible()&&S.interactive){if(S.parentNode&&-1===a.indexOf(S.parentNode.getEntity().getName()))return;var A=S.style.clipPath||S,C=S.getWorldTransform();S.style.clipPath&&(n=oh(),o=C,s=S.style.clipPath.getLocalTransform(),c=o[1],l=o[2],h=o[3],d=o[5],p=o[6],v=o[7],g=o[9],m=o[10],b=o[11],x=o[13],k=o[14],E=o[15],n[0]=(T=s[0])*(u=o[0])+(M=s[1])*(f=o[4])+(P=s[2])*(y=o[8])+(_=s[3])*(w=o[12]),n[1]=T*c+M*d+P*g+_*x,n[2]=T*l+M*p+P*m+_*k,n[3]=T*h+M*v+P*b+_*E,n[4]=(T=s[4])*u+(M=s[5])*f+(P=s[6])*y+(_=s[7])*w,n[5]=T*c+M*d+P*g+_*x,n[6]=T*l+M*p+P*m+_*k,n[7]=T*h+M*v+P*b+_*E,n[8]=(T=s[8])*u+(M=s[9])*f+(P=s[10])*y+(_=s[11])*w,n[9]=T*c+M*d+P*g+_*x,n[10]=T*l+M*p+P*m+_*k,n[11]=T*h+M*v+P*b+_*E,n[12]=(T=s[12])*u+(M=s[13])*f+(P=s[14])*y+(_=s[15])*w,n[13]=T*c+M*d+P*g+_*x,n[14]=T*l+M*p+P*m+_*k,n[15]=T*h+M*v+P*b+_*E,C=n),e.isHit(A,r,C)&&i.push(S)}})),i.sort(e.sceneGraphService.sort),t.picked=i[i.length-1]||null,t}))}}]),t}(),lh.tag="CanvasPickerPlugin",fh=hh);Ql([Kl(_u),Jl("design:type",Iu)],ph.prototype,"camera",void 0),Ql([Kl(da),Jl("design:type",Object)],ph.prototype,"sceneGraphService",void 0),Ql([Kl(Oa),Jl("design:type",Object)],ph.prototype,"renderingContext",void 0),Ql([Kl(ea),Jl("design:type",ea)],ph.prototype,"displayObjectPool",void 0),Ql([Kl(xa),Jl("design:type",xa)],ph.prototype,"offscreenCanvas",void 0),Ql([Kl(Bl),Jl("design:type",Object)],ph.prototype,"rBush",void 0),Ql([Kl(ml),Jl("design:type",Function)],ph.prototype,"pathGeneratorFactory",void 0),Ql([Kl(dh),Jl("design:type",Function)],ph.prototype,"pointInPathPickerFactory",void 0),ph=fh=Ql([function(t){if(Reflect.hasOwnMetadata(Xl,t))throw Error("Cannot apply @injectable decorator multiple times.");var e=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(Xl,e,t),t}],ph);var vh={}.toString,yh=function(t){return Array.isArray?Array.isArray(t):function(t,e){return vh.call(t)==="[object "+e+"]"}(t,"Array")},gh=function(t){if(yh(t))return t.reduce((function(t,e){return Math.max(t,e)}),t[0])},mh=function(t){if(yh(t))return t.reduce((function(t,e){return Math.min(t,e)}),t[0])};function bh(t,e,n,r){var i=t-n,o=e-r;return Math.sqrt(i*i+o*o)}function wh(t,e){return.001>Math.abs(t-e)}function xh(t,e){var n=mh(t),r=mh(e);return{x:n,y:r,width:gh(t)-n,height:gh(e)-r}}function kh(t){return(t+2*Math.PI)%(2*Math.PI)}var Eh="undefined"!=typeof Float32Array?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});!function(){var t,e=(t=new Eh(2),Eh!=Float32Array&&(t[0]=0,t[1]=0),t)}();var Th=function(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}},Mh=function(t,e,n,r,i,o){var a=[n-t,r-e];if(function(t,e){return t[0]===e[0]&&t[1]===e[1]}(a,[0,0]))return Math.sqrt((i-t)*(i-t)+(o-e)*(o-e));var s=[-a[1],a[0]];return function(t,e){var n=e[0],r=e[1],i=n*n+r*r;i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i}(s,s),Math.abs(function(t,e){return t[0]*e[0]+t[1]*e[1]}([i-t,o-e],s))};function Ph(t,e,n,r,i,o){var a=-1,s=1/0,u=[n,r],c=20;o&&o>200&&(c=o/10);for(var l=1/c,h=l/10,f=0;c>=f;f++){var d=f*l,p=[i.apply(null,t.concat([d])),i.apply(null,e.concat([d]))],v=bh(u[0],u[1],p[0],p[1]);s>v&&(a=d,s=v)}if(0===a)return{x:t[0],y:e[0]};if(1===a){var y=t.length;return{x:t[y-1],y:e[y-1]}}s=1/0;for(var g=0;32>g&&1e-4<=h;g++){var m=a-h,b=a+h,w=[i.apply(null,t.concat([m])),i.apply(null,e.concat([m]))],x=bh(u[0],u[1],w[0],w[1]);if(m>=0&&s>x)a=m,s=x;else{var k=[i.apply(null,t.concat([b])),i.apply(null,e.concat([b]))],E=bh(u[0],u[1],k[0],k[1]);1>=b&&s>E?(a=b,s=E):h*=.5}}return{x:i.apply(null,t.concat([a])),y:i.apply(null,e.concat([a]))}}function _h(t,e,n,r){var i=1-r;return i*i*t+2*r*i*e+r*r*n}function Sh(t,e,n){var r=t+n-2*e;if(wh(r,0))return[.5];var i=(t-e)/r;return i>1||0>i?[]:[i]}function Ah(t,e,n,r){return 2*(1-r)*(e-t)+2*r*(n-e)}function Ch(t,e,n,r,i,o,a){var s=_h(t,n,i,a),u=_h(e,r,o,a),c=Th(t,e,n,r,a),l=Th(n,r,i,o,a);return[[t,e,c.x,c.y,s,u],[s,u,l.x,l.y,i,o]]}function Rh(t,e,n,r,i,o,a){if(0===a)return(bh(t,e,n,r)+bh(n,r,i,o)+bh(t,e,i,o))/2;var s=Ch(t,e,n,r,i,o,.5),u=s[0],c=s[1];return u.push(a-1),c.push(a-1),Rh.apply(null,u)+Rh.apply(null,c)}var Nh={box:function(t,e,n,r,i,o){var a=Sh(t,n,i)[0],s=Sh(e,r,o)[0],u=[t,i],c=[e,o];return void 0!==a&&u.push(_h(t,n,i,a)),void 0!==s&&c.push(_h(e,r,o,s)),xh(u,c)},length:function(t,e,n,r,i,o){return Rh(t,e,n,r,i,o,3)},nearestPoint:function(t,e,n,r,i,o,a,s){return Ph([t,n,i],[e,r,o],a,s,_h)},pointDistance:function(t,e,n,r,i,o,a,s){var u=this.nearestPoint(t,e,n,r,i,o,a,s);return bh(u.x,u.y,a,s)},interpolationAt:_h,pointAt:function(t,e,n,r,i,o,a){return{x:_h(t,n,i,a),y:_h(e,r,o,a)}},divide:function(t,e,n,r,i,o,a){return Ch(t,e,n,r,i,o,a)},tangentAngle:function(t,e,n,r,i,o,a){var s=Ah(t,n,i,a),u=Ah(e,r,o,a);return kh(Math.atan2(u,s))}};function Oh(t){return function(t){if(Array.isArray(t))return Ih(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Ih(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ih(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ih(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);e>n;n++)r[n]=t[n];return r}function jh(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function Dh(t,e,n,r,i){var o=1-i;return 3*(o*o*(e-t)+2*o*i*(n-e)+i*i*(r-n))}function Bh(t,e,n,r){var i,o,a,s=-3*t+9*e-9*n+3*r,u=6*t-12*e+6*n,c=3*e-3*t,l=[];if(wh(s,0))wh(u,0)||0>(i=-c/u)||i>1||l.push(i);else{var h=u*u-4*s*c;wh(h,0)?l.push(-u/(2*s)):h>0&&(o=(-u-(a=Math.sqrt(h)))/(2*s),0>(i=(-u+a)/(2*s))||i>1||l.push(i),0>o||o>1||l.push(o))}return l}function Fh(t,e,n,r,i,o,a,s,u){var c=jh(t,n,i,a,u),l=jh(e,r,o,s,u),h=Th(t,e,n,r,u),f=Th(n,r,i,o,u),d=Th(i,o,a,s,u),p=Th(h.x,h.y,f.x,f.y,u),v=Th(f.x,f.y,d.x,d.y,u);return[[t,e,h.x,h.y,p.x,p.y,c,l],[c,l,v.x,v.y,d.x,d.y,a,s]]}function Lh(t,e,n,r,i,o,a,s,u){if(0===u)return function(t,e){for(var n=0,r=t.length,i=0;r>i;i++)n+=bh(t[i],e[i],t[(i+1)%r],e[(i+1)%r]);return n/2}([t,n,i,a],[e,r,o,s]);var c=Fh(t,e,n,r,i,o,a,s,.5),l=[].concat(Oh(c[0]),[u-1]),h=[].concat(Oh(c[1]),[u-1]);return Lh.apply(null,l)+Lh.apply(null,h)}var Wh={extrema:Bh,box:function(t,e,n,r,i,o,a,s){for(var u=[t,a],c=[e,s],l=Bh(t,n,i,a),h=Bh(e,r,o,s),f=0;l.length>f;f++)u.push(jh(t,n,i,a,l[f]));for(var d=0;h.length>d;d++)c.push(jh(e,r,o,s,h[d]));return xh(u,c)},length:function(t,e,n,r,i,o,a,s){return Lh(t,e,n,r,i,o,a,s,3)},nearestPoint:function(t,e,n,r,i,o,a,s,u,c,l){return Ph([t,n,i,a],[e,r,o,s],u,c,jh,l)},pointDistance:function(t,e,n,r,i,o,a,s,u,c,l){var h=this.nearestPoint(t,e,n,r,i,o,a,s,u,c,l);return bh(h.x,h.y,u,c)},interpolationAt:jh,pointAt:function(t,e,n,r,i,o,a,s,u){return{x:jh(t,n,i,a,u),y:jh(e,r,o,s,u)}},divide:function(t,e,n,r,i,o,a,s,u){return Fh(t,e,n,r,i,o,a,s,u)},tangentAngle:function(t,e,n,r,i,o,a,s,u){var c=Dh(t,n,i,a,u),l=Dh(e,r,o,s,u);return kh(Math.atan2(l,c))}};function Gh(t,e,n,r){var i=t-n,o=e-r;return Math.sqrt(i*i+o*o)}function qh(t,e,n,r,i,o){return!(t>i||i>t+n||e>o||o>e+r)}function $h(t,e,n,r,i,o,a,s){var u=(Math.atan2(s-e,a-t)+2*Math.PI)%(2*Math.PI);if(r>u||u>i)return!1;var c={x:t+n*Math.cos(u),y:e+n*Math.sin(u)};return Gh(c.x,c.y,a,s)<=o/2}function Hh(t,e,n,r,i,o,a){var s=i/2;return!(Math.min(t,n)-s>o||o>Math.max(t,n)+s||Math.min(e,r)-s>a||a>Math.max(e,r)+s)&&Mh(t,e,n,r,o,a)<=i/2}function Vh(t,e,n,r,i){var o=t.length;if(2>o)return!1;for(var a=0;o-1>a;a++){if(Hh(t[a][0],t[a][1],t[a+1][0],t[a+1][1],e,n,r))return!0}if(i){var s=t[0],u=t[o-1];if(Hh(s[0],s[1],u[0],u[1],e,n,r))return!0}return!1}function Xh(t){return 1e-6>Math.abs(t)?0:0>t?-1:1}function Yh(t,e,n){return!((n[0]-t[0])*(e[1]-t[1])!=(e[0]-t[0])*(n[1]-t[1])||Math.min(t[0],e[0])>n[0]||n[0]>Math.max(t[0],e[0])||Math.min(t[1],e[1])>n[1]||n[1]>Math.max(t[1],e[1]))}function zh(t,e,n){var r=!1,i=t.length;if(2>=i)return!1;for(var o=0;i>o;o++){var a=t[o],s=t[(o+1)%i];if(Yh(a,s,[e,n]))return!0;Xh(a[1]-n)>0!=Xh(s[1]-n)>0&&0>Xh(e-(n-a[1])*(a[0]-s[0])/(a[1]-s[1])-a[0])&&(r=!r)}return r}function Uh(t,e,n){for(var r=!1,i=0;t.length>i;i++){if(r=zh(t[i],e,n))break}return r}function Kh(t,e){var n=t.parsedStyle,r=n.r,i=void 0===r?0:r,o=n.fill,a=n.stroke,s=n.lineWidth,u=n.clipPathTargets,c=(void 0===s?0:s)/2,l=Gh(i,i,e.x,e.y);return o&&a||!!(null==u?void 0:u.length)?i+c>=l:o?i>=l:!!a&&(l>=i-c&&i+c>=l)}function Zh(t,e,n,r){return t/(n*n)+e/(r*r)}function Qh(t,e){var n=e.x,r=e.y,i=t.parsedStyle,o=i.rx,a=void 0===o?0:o,s=i.ry,u=void 0===s?0:s,c=i.fill,l=i.stroke,h=i.lineWidth,f=i.clipPathTargets,d=(void 0===h?0:h)/2,p=(n-a)*(n-a),v=(r-u)*(r-u);return c&&l||!!(null==f?void 0:f.length)?1>=Zh(p,v,a+d,u+d):c?1>=Zh(p,v,a,u):!!l&&(Zh(p,v,a-d,u-d)>=1&&1>=Zh(p,v,a+d,u+d))}function Jh(t,e){var n=t.parsedStyle,r=n.lineWidth,i=n.defX,o=n.defY;return Hh(n.x1,n.y1,n.x2,n.y2,void 0===r?0:r,e.x+(void 0===i?0:i),e.y+(void 0===o?0:o))}function tf(t,e){var n=t.parsedStyle,r=n.lineWidth,i=void 0===r?0:r,o=n.defX,a=n.defY,s=n.clipPathTargets;return!(!n.stroke&&!(null==s?void 0:s.length)||!i)&&Vh(n.points.points,i,e.x+(void 0===o?0:o),e.y+(void 0===a?0:a),!1)}function ef(t,e,n){var r=t.parsedStyle,i=r.lineWidth,o=r.fill,a=r.defX,s=void 0===a?0:a,u=r.defY,c=void 0===u?0:u,l=r.clipPathTargets,h=r.path,f=h.hasArc,d=h.polylines,p=h.polygons,v=!!(null==l?void 0:l.length),y=!1;return(r.stroke||v)&&(y=function(t,e,n,r,i,o,a){for(var s,u,c=!1,l=e/2,h=0;t.length>h;h++){var f=t[h],d=f.currentPoint,p=f.params,v=f.prePoint,y=f.box;if(!y||qh(y.x-l,y.y-l,y.width+e,y.height+e,n,r)){switch(f.command){case"L":case"Z":c=Hh(v[0],v[1],d[0],d[1],e,n,r);break;case"Q":c=e/2>=Nh.pointDistance(v[0],v[1],p[1],p[2],p[3],p[4],n,r);break;case"C":c=e/2>=Wh.pointDistance(v[0],v[1],p[1],p[2],p[3],p[4],p[5],p[6],n,r,i);break;case"A":var g=f.arcParams,m=g.rx,b=g.ry,w=g.startAngle,x=g.endAngle,k=g.xRotation,E=m>b?m:b,T=m>b?1:m/b,M=m>b?b/m:1,P=(u=[-g.cx,-g.cy],(s=eh())[0]=1,s[1]=0,s[2]=0,s[3]=0,s[4]=1,s[5]=0,s[6]=u[0],s[7]=u[1],s[8]=1,s);nh(P,rh(eh(),-k),P),nh(P,ih(eh(),[1/T,1/M]),P);var _=uh(n,r);c=$h(0,0,E,w,x,e,(_=ch(_,_,P))[0],_[1])}if(c)break}}return c}(h.segments,void 0===i?0:i,e.x+s,e.y+c,h.totalLength)),y||!o&&!v||(y=f?n(t,e):Uh(p,e.x+s,e.y+c)||Uh(d,e.x+s,e.y+c)),y}function nf(t,e,n){var r=t.parsedStyle,i=r.radius,o=r.fill,a=r.stroke,s=r.lineWidth,u=void 0===s?0:s,c=r.width,l=r.height,h=r.clipPathTargets,f=!!(null==h?void 0:h.length);if(i){var d=!1;return(a||f)&&(d=function(t,e,n,r,i,o,a,s){return Hh(t+i,e,t+n-i,e,o,a,s)||Hh(t+n,e+i,t+n,e+r-i,o,a,s)||Hh(t+n-i,e+r,t+i,e+r,o,a,s)||Hh(t,e+r-i,t,e+i,o,a,s)||$h(t+n-i,e+i,i,1.5*Math.PI,2*Math.PI,o,a,s)||$h(t+n-i,e+r-i,i,0,.5*Math.PI,o,a,s)||$h(t+i,e+r-i,i,.5*Math.PI,Math.PI,o,a,s)||$h(t+i,e+i,i,Math.PI,1.5*Math.PI,o,a,s)}(0,0,c,l,i,u,e.x,e.y)),d||!o&&!f||(d=n(t,e)),d}var p=u/2;return o&&a||f?qh(0-p,0-p,c+p,l+p,e.x,e.y):o?qh(0,0,c,l,e.x,e.y):!!a&&function(t,e,n,r,i,o,a){var s=i/2;return qh(t-s,e-s,n,i,o,a)||qh(t+n-s,e-s,i,r,o,a)||qh(t+s,e+r-s,n,i,o,a)||qh(t-s,e+s,i,r,o,a)}(0,0,c,l,u,e.x,e.y)}function rf(t,e){var n=t.parsedStyle,r=n.fill,i=n.lineWidth,o=n.points,a=n.defX,s=void 0===a?0:a,u=n.defY,c=void 0===u?0:u,l=n.clipPathTargets,h=!!(null==l?void 0:l.length),f=!1;return(n.stroke||h)&&(f=Vh(o.points,void 0===i?0:i,e.x+s,e.y+c,!0)),f||!r&&!h||(f=zh(o.points,e.x+s,e.y+c)),f}var of=new Zl((function(t,e,n,r){t(dh).toFactory((function(t){return function(t){return t===qo.Circle?Kh:t===qo.Ellipse?Qh:t===qo.Rect?nf:t===qo.Line?Jh:t===qo.Polyline?tf:t===qo.Polygon?rf:t===qo.Path?ef:t===qo.Image||t===qo.Text?function(){return!0}:null}})),t(ph).toSelf().inSingletonScope(),t(Ia).toService(ph)})),af=function(){function t(){$l(this,t)}return Vl(t,[{key:"init",value:function(t){t.load(of)}},{key:"destroy",value:function(t){t.unload(of)}}]),t}();function sf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function uf(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function cf(t,e,n){return e&&uf(t.prototype,e),n&&uf(t,n),t}var lf="inversify:paramtypes",hf=0;var ff=function(){function t(t,e){this.key=t,this.value=e}return t.prototype.toString=function(){return"named"===this.key?"named: "+this.value+" ":"tagged: { key:"+this.key+", value: "+this.value+" }"},t}();function df(t,e,n,r,i){var o={},a="number"==typeof i,s=void 0!==i&&a?""+i:n;if(a&&void 0!==n)throw Error("The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.");Reflect.hasOwnMetadata(t,e)&&(o=Reflect.getMetadata(t,e));var u=o[s];if(Array.isArray(u))for(var c=0,l=u;l.length>c;c++){var h=l[c];if(h.key===r.key)throw Error("Metadata key was used more than once in a parameter: "+h.key)}else u=[];u.push(r),o[s]=u,Reflect.defineMetadata(t,o,e)}function pf(t){return function(e,n,r){if(void 0===t)throw Error("@inject called with undefined this could mean that the class "+e.name+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation.");var i=new ff("inject",t);"number"==typeof r?function(t,e,n,r){df("inversify:tagged",t,e,r,n)}(e,n,r,i):function(t,e,n){df("inversify:tagged_props",t.constructor,e,n)}(e,n,i)}}var vf=function(t){this.id=hf++,this.registry=t};
|
|
89
|
+
/*! *****************************************************************************
|
|
90
|
+
Copyright (c) Microsoft Corporation.
|
|
91
|
+
|
|
92
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
93
|
+
purpose with or without fee is hereby granted.
|
|
94
|
+
|
|
95
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
96
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
97
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
98
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
99
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
100
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
101
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
102
|
+
***************************************************************************** */
|
|
103
|
+
function yf(t,e,n,r){var o,a=arguments.length,s=3>a?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var u=t.length-1;u>=0;u--)(o=t[u])&&(s=(3>a?o(s):a>3?o(e,n,s):o(e,n))||s);return a>3&&s&&Object.defineProperty(e,n,s),s}function gf(t,e){if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var mf,bf,wf,xf={}.toString,kf=function(t){return e="String",xf.call(t)==="[object "+e+"]";var e},Ef="g-html-",Tf=(bf=mf=function(){function t(){sf(this,t),this.contextService=void 0,this.renderingContext=void 0,this.$camera=void 0}return cf(t,[{key:"apply",value:function(t){var e=this,n=function(t){var n=t.target;if(n.nodeName===qo.HTML){var r=n.parsedStyle.innerHTML,i=Ef+n.getEntity().getName(),o=e.contextService.getDomElement().parentNode;if(!o.querySelector("#"+i)){var a=document.createElement("div");n.parsedStyle.$el=a,a.id=i,kf(r)?a.innerHTML=r:a.appendChild(r),o.appendChild(a)}}},r=function(t){var n=t.target;if(n.nodeName===qo.HTML){var r=Ef+n.getEntity().getName(),i=e.contextService.getDomElement().parentNode,o=i.querySelector("#"+r);o&&i.removeChild(o)}};t.hooks.init.tap(wf.tag,(function(){e.renderingContext.root.addEventListener(Ba.MOUNTED,n),e.renderingContext.root.addEventListener(Ba.UNMOUNTED,r)})),t.hooks.destroy.tap(wf.tag,(function(){e.renderingContext.root.removeEventListener(Ba.MOUNTED,n),e.renderingContext.root.removeEventListener(Ba.UNMOUNTED,r)})),t.hooks.render.tap(wf.tag,(function(t){if(t.nodeName===qo.HTML){var n=Ef+t.getEntity().getName(),r=e.contextService.getDomElement().parentNode.querySelector("#"+n);e.updateCSSStyle(r,t.parsedStyle,t)}}))}},{key:"updateCSSStyle",value:function(t,e,n){var r=e.zIndex,i=void 0===r?0:r,o=e.visibility,a=void 0===o?"visible":o,s=e.opacity,u=void 0===s?1:s,c=e.fill,l=e.lineWidth,h=void 0===l?0:l,f=e.lineDash,d=e.stroke,p=e.anchor,v=e.width,y=e.height,g=void 0===y?0:y,m=e.style,b=void 0===m?"":m,w=e.className,x=void 0===w?"":w,k={position:"absolute",top:0,left:0};if(k.width="".concat(void 0===v?0:v,"px"),k.height="".concat(g,"px"),k.transform="matrix3d(".concat(n.getWorldTransform().join(","),")"),p&&(k.transform+=" translate(".concat(100*p[0],"%, ").concat(100*p[0],"%)")),n.style.transformOrigin&&(k["transform-origin"]=n.style.transformOrigin),k["z-index"]=i,k.visibility=a,k.opacity=u,c){var E="";if(c.type===rs.Constant)E=c.formatted;else if(c.type===rs.LinearGradient){var T=c.value.steps.map((function(t){return"".concat(t[1]," ").concat(100*Number(t[0]),"%")})).join(",");E="linear-gradient(to right, ".concat(T,");")}k.background=E}k["border-width"]="".concat(h,"px"),d&&d.type===rs.Constant&&(k["border-color"]=d.formatted,k["border-style"]="solid"),f&&(k["border-style"]="dashed"),n.style.filter&&(k.filter=n.style.filter),x&&(Array.isArray(x)?x.forEach((function(e){t.classList.add(e)})):t.classList.add(x)),t.setAttribute("style",Object.keys(k).map((function(t){return"".concat(t,":").concat(k[t])})).join(";")+b)}}]),t}(),mf.tag="HTMLRenderingPlugin",wf=bf);yf([pf(Na),gf("design:type",Object)],Tf.prototype,"contextService",void 0),yf([pf(Oa),gf("design:type",Object)],Tf.prototype,"renderingContext",void 0),Tf=wf=yf([function(t){if(Reflect.hasOwnMetadata(lf,t))throw Error("Cannot apply @injectable decorator multiple times.");var e=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(lf,e,t),t}],Tf);var Mf=new vf((function(t,e,n,r){t(Tf).toSelf().inSingletonScope(),t(Ia).toService(Tf)})),Pf=function(){function t(){sf(this,t)}return cf(t,[{key:"init",value:function(t){t.load(Mf)}},{key:"destroy",value:function(t){t.unload(Mf)}}]),t}();
|
|
104
|
+
/*! *****************************************************************************
|
|
105
|
+
Copyright (c) Microsoft Corporation.
|
|
106
|
+
|
|
107
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
108
|
+
purpose with or without fee is hereby granted.
|
|
109
|
+
|
|
110
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
111
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
112
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
113
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
114
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
115
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
116
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
117
|
+
***************************************************************************** */
|
|
118
|
+
function _f(t,e,n,r){var i,o=arguments.length,a=3>o?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(3>o?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}var Sf="undefined"!=typeof window&&void 0!==window.document;var Af=function(){function t(){o(this,t),this.$container=void 0,this.$canvas=void 0,this.dpr=void 0,this.context=void 0,this.canvasConfig=void 0}return s(t,[{key:"init",value:function(){var t=this.canvasConfig,e=t.container,n=t.width,r=t.height;if(this.$container=b(e)?document.getElementById(e):e,this.$container){var i=document.createElement("canvas");this.context=i.getContext("2d"),this.$container.appendChild(i),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=i;var o=window.devicePixelRatio||1;this.dpr=o=1>o?1:Math.ceil(o),this.resize(n,r)}}},{key:"getContext",value:function(){return this.context}},{key:"getDomElement",value:function(){return this.$canvas}},{key:"getDPR",value:function(){return this.dpr}},{key:"getBoundingClientRect",value:function(){var t;return null===(t=this.$canvas)||void 0===t?void 0:t.getBoundingClientRect()}},{key:"destroy",value:function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)}},{key:"resize",value:function(t,e){this.$canvas&&(this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*e,function(t,e,n){Sf&&(t.style.width=e+"px",t.style.height=n+"px")}(this.$canvas,t,e))}},{key:"applyCursorStyle",value:function(t){this.$container&&(this.$container.style.cursor=t)}}]),t}();_f([Tt(Xo),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:type",Object)],Af.prototype,"canvasConfig",void 0),Af=_f([ae()],Af);var Cf=new oe((function(t,e,n,r){t(Af).toSelf().inSingletonScope(),t(Na).toService(Af)})),Rf=function(){function t(){o(this,t)}return s(t,[{key:"init",value:function(t){t.load(Cf)}},{key:"destroy",value:function(t){t.unload(Cf)}}]),t}();t.Renderer=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(n,t);var e=h(n);function n(t){var r;return o(this,n),(r=e.call(this,t)).registerPlugin(new Rf),r.registerPlugin(new ql),r.registerPlugin(new mc),r.registerPlugin(new af),r.registerPlugin(new Pf),r}return n}(Mu),Object.defineProperty(t,"__esModule",{value:!0})}));
|