@antv/g-svg 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.
@@ -0,0 +1,104 @@
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).gSvg={},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},k=function(t){return d(t,"Number")},x=function(t){return d(t,"Boolean")};var E,T=function(t){return void 0===t},_="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function S(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 _?_:"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(!z(e))throw new TypeError;return T(t,e)}if(!H(t))throw new TypeError;if(!B(e))throw new TypeError;if(!B(r)&&!j(r)&&!D(r))throw new TypeError;return D(r)&&(r=void 0),_(t,e,n=V(n),r)}function v(t,e){function n(n,r){if(!B(n))throw new TypeError;if(!j(r)&&!U(r))throw new TypeError;N(t,e,n,r)}return n}function y(t,e,n,r){if(!B(n))throw new TypeError;return j(r)||(r=V(r)),N(t,e,n,r)}function g(t,e,n){if(!B(e))throw new TypeError;return j(n)||(n=V(n)),A(t,e,n)}function m(t,e,n){if(!B(e))throw new TypeError;return j(n)||(n=V(n)),M(t,e,n)}function b(t,e,n){if(!B(e))throw new TypeError;return j(n)||(n=V(n)),P(t,e,n)}function w(t,e,n){if(!B(e))throw new TypeError;return j(n)||(n=V(n)),C(t,e,n)}function k(t,e){if(!B(t))throw new TypeError;return j(e)||(e=V(e)),R(t,e)}function x(t,e){if(!B(t))throw new TypeError;return j(e)||(e=V(e)),O(t,e)}function E(t,e,n){if(!B(e))throw new TypeError;j(n)||(n=V(n));var r=S(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(!z(r))throw new TypeError;e=r}}return e}function _(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(!B(o))throw new TypeError;r=o}}return r}function S(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 A(t,e,n){if(M(t,e,n))return!0;var r=J(e);return!D(r)&&A(t,r,n)}function M(t,e,n){var r=S(e,n,!1);return!j(r)&&$(r.has(t))}function P(t,e,n){if(M(t,e,n))return C(t,e,n);var r=J(e);return D(r)?void 0:P(t,r,n)}function C(t,e,n){var r=S(e,n,!1);if(!j(r))return r.get(t)}function N(t,e,n,r){S(n,r,!0).set(t,e)}function R(t,e){var n=O(t,e),r=J(t);if(null===r)return n;var i=R(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=S(t,e,!1);if(j(r))return n;for(var i=Y(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 F(t){return"symbol"==typeof t}function B(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=X(t,r);if(void 0!==i){var o=i.call(t,n);if(B(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(q(n))if(!B(i=n.call(t)))return i;if(q(r=t.valueOf))if(!B(i=r.call(t)))return i}else{var r;if(q(r=t.valueOf))if(!B(i=r.call(t)))return i;var i,o=t.toString;if(q(o))if(!B(i=o.call(t)))return i}throw new TypeError}function $(t){return!!t}function G(t){return""+t}function V(t){var e=L(t,3);return F(e)?e:G(e)}function H(t){return Array.isArray?Array.isArray(t):t instanceof Object?t instanceof Array:"[object Array]"===Object.prototype.toString.call(t)}function q(t){return"function"==typeof t}function z(t){return"function"==typeof t}function U(t){switch(I(t)){case 3:case 4:return!0;default:return!1}}function X(t,e){var n=t[e];if(null!=n){if(!q(n))throw new TypeError;return n}}function Y(t){var e=X(t,i);if(!q(e))throw new TypeError;var n=e.call(t);if(!B(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",k),t("getOwnMetadataKeys",x),t("deleteMetadata",E)}(r)}()}(E||(E={}));var A="named",M="name",P="unmanaged",C="optional",N="inject",R="multi_inject",O="inversify:tagged",I="inversify:tagged_props",j="inversify:paramtypes",D="post_construct";var F=[N,R,M,P,A,C],B="Request",L="Singleton",W="Transient",$="ConstantValue",G="Constructor",V="DynamicValue",H="Factory",q="Function",z="Instance",U="Invalid",X="Provider",Y="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=U,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===A?"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 kt(t,e){Reflect.decorate(t,e)}function xt(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(N,t);"number"==typeof r?mt(e,n,r,i):bt(e,n,i)}}var _t=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}(),St=function(){function t(t,e,n,r){this.id=J(),this.type=t,this.serviceIdentifier=n,this.name=new _t(e||""),this.metadata=[];var i=null;"string"==typeof r?i=new yt(A,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(R)},t.prototype.matchesArray=function(t){return this.matchesTag(R)(t)},t.prototype.isNamed=function(){return this.hasTag(A)},t.prototype.isTagged=function(){return this.metadata.some((function(t){return F.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===A}))[0]:null},t.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter((function(t){return F.every((function(e){return t.key!==e}))})):null},t.prototype.matchesNamedTag=function(t){return this.matchesTag(A)(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}(),At=function(t,e){for(var n=0,r=e.length,i=t.length;r>n;n++,i++)t[i]=e[n];return t};function Mt(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=Pt(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 At(At([],u),c)}function Pt(t,e,n,r,i){var o=i[""+t]||[],a=Rt(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 St(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=Rt(n[a]),c=new St(Y,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=At(At([],r),h)}return r}function Nt(t,e){var n=Object.getPrototypeOf(e.prototype).constructor;if(n!==Object){var r=Mt(t,pt(n),n,!0),i=r.map((function(t){return t.metadata.filter((function(t){return t.key===P}))})),o=[].concat.apply([],i).length,a=r.length-o;return a>0?a:Nt(t,n)}return 0}function Rt(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=Ft(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=Ft(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,Ft),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,Ft),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===z&&null!==e.implementationType){var i=function(t,e){return Mt(t,pt(e),e,!1)}(t,e.implementationType);if(!r.container.options.skipBaseClassChecks)if(Nt(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 Ft(t,e){var n=[],r=It(t);return r.hasKey(e)?n=r.get(e):null!==t.parent&&(n=Ft(t.parent,e)),n}function Bt(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?R:N,n),s=new St(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===Y})),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 $t=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}},Gt=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 Gt(t)(e)}));var a=null;if(!e.target.isOptional()||0!==n.length){var s=n[0],u=s.scope===L,c=s.scope===B;if(u&&s.activated)return s.cache;if(c&&null!==t&&t.has(s.id))return t.get(s.id);if(s.type===$)a=s.cache,s.activated=!0;else if(s.type===q)a=s.cache,s.activated=!0;else if(s.type===G)a=s.implementationType;else if(s.type===V&&null!==s.dynamicValue)a=$t("toDynamicValue",s.serviceIdentifier,(function(){return s.dynamicValue(e.parentContext)}));else if(s.type===H&&null!==s.factory)a=$t("toFactory",s.serviceIdentifier,(function(){return s.factory(e.parentContext)}));else if(s.type===X&&null!==s.provider)a=$t("toProvider",s.serviceIdentifier,(function(){return s.provider(e.parentContext)}));else{if(s.type!==z||null===s.implementationType){var l=lt(e.serviceIdentifier);throw Error("Invalid binding type: "+l)}a=Wt(s.implementationType,r,Gt(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 Vt=function(t,e){var n=t.parentRequest;return null!==n&&(!!e(n)||Vt(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}},qt=Ht(A),zt=function(t){return function(e){return null!==e&&("string"==typeof t?e.bindings[0].serviceIdentifier===t:t===e.bindings[0].implementationType)}},Ut=function(){function t(t){this._binding=t}return t.prototype.when=function(t){return this._binding.constraint=t,new Xt(this._binding)},t.prototype.whenTargetNamed=function(t){return this._binding.constraint=qt(t),new Xt(this._binding)},t.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(t){return null!==t.target&&!t.target.isNamed()&&!t.target.isTagged()},new Xt(this._binding)},t.prototype.whenTargetTagged=function(t,e){return this._binding.constraint=Ht(t)(e),new Xt(this._binding)},t.prototype.whenInjectedInto=function(t){return this._binding.constraint=function(e){return zt(t)(e.parentRequest)},new Xt(this._binding)},t.prototype.whenParentNamed=function(t){return this._binding.constraint=function(e){return qt(t)(e.parentRequest)},new Xt(this._binding)},t.prototype.whenParentTagged=function(t,e){return this._binding.constraint=function(n){return Ht(t)(e)(n.parentRequest)},new Xt(this._binding)},t.prototype.whenAnyAncestorIs=function(t){return this._binding.constraint=function(e){return Vt(e,zt(t))},new Xt(this._binding)},t.prototype.whenNoAncestorIs=function(t){return this._binding.constraint=function(e){return!Vt(e,zt(t))},new Xt(this._binding)},t.prototype.whenAnyAncestorNamed=function(t){return this._binding.constraint=function(e){return Vt(e,qt(t))},new Xt(this._binding)},t.prototype.whenNoAncestorNamed=function(t){return this._binding.constraint=function(e){return!Vt(e,qt(t))},new Xt(this._binding)},t.prototype.whenAnyAncestorTagged=function(t,e){return this._binding.constraint=function(n){return Vt(n,Ht(t)(e))},new Xt(this._binding)},t.prototype.whenNoAncestorTagged=function(t,e){return this._binding.constraint=function(n){return!Vt(n,Ht(t)(e))},new Xt(this._binding)},t.prototype.whenAnyAncestorMatches=function(t){return this._binding.constraint=function(e){return Vt(e,t)},new Xt(this._binding)},t.prototype.whenNoAncestorMatches=function(t){return this._binding.constraint=function(e){return!Vt(e,t)},new Xt(this._binding)},t}(),Xt=function(){function t(t){this._binding=t}return t.prototype.onActivation=function(t){return this._binding.onActivation=t,new Ut(this._binding)},t}(),Yt=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new Ut(this._binding),this._bindingOnSyntax=new Xt(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=B,new Yt(this._binding)},t.prototype.inSingletonScope=function(){return this._binding.scope=L,new Yt(this._binding)},t.prototype.inTransientScope=function(){return this._binding.scope=W,new Yt(this._binding)},t}(),Zt=function(){function t(t){this._binding=t,this._bindingWhenSyntax=new Ut(this._binding),this._bindingOnSyntax=new Xt(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=z,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=$,this._binding.cache=t,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=L,new Yt(this._binding)},t.prototype.toDynamicValue=function(t){return this._binding.type=V,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=G,this._binding.implementationType=t,this._binding.scope=L,new Yt(this._binding)},t.prototype.toFactory=function(t){return this._binding.type=H,this._binding.factory=t,this._binding.scope=L,new Yt(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=q,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 Yt(this._binding)},t.prototype.toProvider=function(t){return this._binding.type=X,this._binding.provider=t,this._binding.scope=L,new Yt(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!==B)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,A,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 St(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,A,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,A,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=Bt(t._metadataReader,t,e.isMultiInject,e.targetType,e.serviceIdentifier,e.key,e.value,e.avoidConstraints);return function(t){return Gt(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(A,t);"number"==typeof r?mt(e,n,r,i):bt(e,n,i)}}var ue=S((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,ke=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}();ke=me([ae()],ke);var xe=0,Ee=we=function(){function t(){ce(this,t),this.pid=xe++}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",_e="ComponentRegistry",Se="ComponentPoolFactory",Ae="EntityPoolFactory",Me="SystemRegistry",Pe="Created",Ce="Added",Ne="Remove",Re=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(Pe,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(Ne,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(Se),be("design:type",Function)],Re.prototype,"componentPoolFactory",void 0),Re=me([ae()],Re);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(Re),be("design:type",Re)],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(_e),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(Ne,(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(Me),be("design:type",Object)],De.prototype,"registry",void 0),me([Tt(Re),be("design:type",Re)],De.prototype,"entityManager",void 0),De=me([ae()],De);var Fe=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(Ae),be("design:type",Function)],Fe.prototype,"entityPoolFactory",void 0),me([Tt(Re),be("design:type",Re)],Fe.prototype,"entityManager",void 0),me([Tt(je),be("design:type",je)],Fe.prototype,"componentManager",void 0),me([Tt(De),be("design:type",De)],Fe.prototype,"systemManager",void 0),Fe=me([ae()],Fe);var Be="System",Le=!1,We=new oe((function(t){var e,n,r;Le||(e=ae(),n=ue.EventEmitter,"number"==typeof r?kt([xt(r,e)],n):"string"==typeof r?Reflect.decorate([e],n,r):kt([e],n),t(Te).to(ue.EventEmitter),Le=!0),t(_e).toFactory((function(t){return function(e){t.container.isBound(e)||t.container.bind(e).toSelf()}})),t(Me).toDynamicValue((function(t){return{register:function(e){t.container.isBoundTagged(Be,e.tag,e)||t.container.bind(Be).to(e).inSingletonScope().whenTargetNamed(e.tag)},get:function(e){return t.container.getNamed(Be,e.tag)},has:function(e){return t.container.isBoundNamed(Be,e.tag)}}})),t(Se).toFactory((function(t){var e={};return function(n){var r=e[n.tag];return r||((r=t.container.get(ke)).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(Ae).toFactory((function(t){var e;return function(){return e||(e=t.container.get(ke)).init((function(){return t.container.get(Ie)}),10),e}})),t(Re).toSelf().inSingletonScope(),t(je).toSelf().inSingletonScope(),t(De).toSelf().inSingletonScope(),t(Ie).toSelf(),t(ke).toSelf(),t(Fe).toSelf().inSingletonScope()})),$e=1e-6,Ge="undefined"!=typeof Float32Array?Float32Array:Array,Ve=Math.random;function He(){var t=new Ge(9);return Ge!=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 qe(){var t=new Ge(16);return Ge!=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 ze(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 Ue(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 Xe(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,k=r*u-i*s,x=r*c-o*s,E=i*c-o*u,T=l*v-h*p,_=l*y-f*p,S=l*g-d*p,A=h*y-f*v,M=h*g-d*v,P=f*g-d*y,C=m*P-b*M+w*A+k*S-x*_+E*T;return C?(t[0]=(s*P-u*M+c*A)*(C=1/C),t[1]=(i*M-r*P-o*A)*C,t[2]=(v*E-y*x+g*k)*C,t[3]=(f*x-h*E-d*k)*C,t[4]=(u*S-a*P-c*_)*C,t[5]=(n*P-i*S+o*_)*C,t[6]=(y*w-p*E-g*b)*C,t[7]=(l*E-f*w+d*b)*C,t[8]=(a*M-s*S+c*T)*C,t[9]=(r*S-n*M-o*T)*C,t[10]=(p*x-v*w+g*m)*C,t[11]=(h*w-l*x-d*m)*C,t[12]=(s*_-a*A-u*T)*C,t[13]=(n*A-r*_+i*T)*C,t[14]=(v*b-p*k-y*m)*C,t[15]=(l*k-h*b+f*m)*C,t):null}function Ye(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],k=n[2],x=n[3];return t[0]=b*r+w*s+k*h+x*v,t[1]=b*i+w*u+k*f+x*y,t[2]=b*o+w*c+k*d+x*g,t[3]=b*a+w*l+k*p+x*m,t[4]=(b=n[4])*r+(w=n[5])*s+(k=n[6])*h+(x=n[7])*v,t[5]=b*i+w*u+k*f+x*y,t[6]=b*o+w*c+k*d+x*g,t[7]=b*a+w*l+k*p+x*m,t[8]=(b=n[8])*r+(w=n[9])*s+(k=n[10])*h+(x=n[11])*v,t[9]=b*i+w*u+k*f+x*y,t[10]=b*o+w*c+k*d+x*g,t[11]=b*a+w*l+k*p+x*m,t[12]=(b=n[12])*r+(w=n[13])*s+(k=n[14])*h+(x=n[15])*v,t[13]=b*i+w*u+k*f+x*y,t[14]=b*o+w*c+k*d+x*g,t[15]=b*a+w*l+k*p+x*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 Ge(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,k=r[0],x=r[1],E=r[2],T=i[0],_=i[1],S=i[2],A=(1-(v+g))*k,M=(d+w)*k,P=(p-b)*k,C=(d-w)*x,N=(1-(f+g))*x,R=(y+m)*x,O=(p+b)*E,I=(y-m)*E,j=(1-(f+v))*E;return t[0]=A,t[1]=M,t[2]=P,t[3]=0,t[4]=C,t[5]=N,t[6]=R,t[7]=0,t[8]=O,t[9]=I,t[10]=j,t[11]=0,t[12]=n[0]+T-(A*T+C*_+O*S),t[13]=n[1]+_-(M*T+N*_+I*S),t[14]=n[2]+S-(P*T+R*_+j*S),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 Ge(3);return Ge!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function rn(t){var e=new Ge(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 Ge(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 kn(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 xn(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 _n(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 Sn(t,e){var n=t[0],r=t[1],i=t[2],o=e[0],a=e[1],s=e[2];return $e*Math.max(1,Math.abs(n),Math.abs(o))>=Math.abs(n-o)&&$e*Math.max(1,Math.abs(r),Math.abs(a))>=Math.abs(r-a)&&$e*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 An,Mn=ln,Pn=hn,Cn=fn,Nn=yn,Rn=gn,On=on,In=mn,jn=(An=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)An[0]=t[a],An[1]=t[a+1],An[2]=t[a+2],i(An,An,o),t[a]=An[0],t[a+1]=An[1],t[a+2]=An[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:kn,lerp:xn,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*Ve()*Math.PI,r=2*Ve()-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:_n,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:Sn,sub:Mn,mul:Pn,div:Cn,dist:Nn,sqrDist:Rn,len:On,sqrLen:In,forEach:jn});function Fn(){var t=new Ge(4);return Ge!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Bn(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=Fn()}();function Ln(){var t=new Ge(4);return Ge!=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 $n(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 Gn(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>$e?(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 Vn(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 qn,zn,Un,Xn,Yn,Kn,Zn=function(t,e,n,r){var i=new Ge(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=$n,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};qn=nn(),zn=an(1,0,0),Un=an(0,1,0),Xn=Ln(),Yn=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})}},kr=()=>{throw Error("tapAsync is not supported on a SyncWaterfallHook")},xr=()=>{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=kr,n.tapPromise=xr,n.compile=Er,n}Tr.prototype=null;var _r=Tr;const Sr=new class extends sr{content({onError:t,onDone:e,rethrowIfPossible:n}){return this.callTapsLooping({onError:(e,n)=>t(n),onDone:e,rethrowIfPossible:n})}},Ar=()=>{throw Error("tapAsync is not supported on a SyncLoopHook")},Mr=()=>{throw Error("tapPromise is not supported on a SyncLoopHook")},Pr=function(t){return Sr.setup(this,t),Sr.create(t)};function Cr(t=[],e){const n=new ar(t,e);return n.constructor=Cr,n.tapAsync=Ar,n.tapPromise=Mr,n.compile=Pr,n}Cr.prototype=null;var Nr=Cr;const Rr=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 Rr.setup(this,t),Rr.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}},Fr=function(t){return Dr.setup(this,t),Dr.create(t)};function Br(t=[],e){const n=new ar(t,e);return n.constructor=Br,n.compile=Fr,n._call=void 0,n.call=void 0,n}Br.prototype=null;var Lr=Br;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})}},$r=function(t){return Wr.setup(this,t),Wr.create(t)};function Gr(t=[],e){const n=new ar(t,e);return n.constructor=Gr,n.compile=$r,n._call=void 0,n.call=void 0,n}Gr.prototype=null;var Vr=Gr;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})}},qr=function(t){return Hr.setup(this,t),Hr.create(t)};function zr(t=[],e){const n=new ar(t,e);return n.constructor=zr,n.compile=qr,n._call=void 0,n.call=void 0,n}zr.prototype=null;var Ur=zr;const Xr=new class extends sr{content({onError:t,onDone:e}){return this.callTapsLooping({onError:(e,n,r,i)=>t(n)+i(!0),onDone:e})}},Yr=function(t){return Xr.setup(this,t),Xr.create(t)};function Kr(t=[],e){const n=new ar(t,e);return n.constructor=Kr,n.compile=Yr,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=S((function(t,e){e.__esModule=!0,e.SyncHook=dr,e.SyncBailHook=br,e.SyncWaterfallHook=_r,e.SyncLoopHook=Nr,e.AsyncParallelHook=jr,e.AsyncParallelBailHook=Lr,e.AsyncSeriesHook=Vr,e.AsyncSeriesBailHook=Ur,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 ki(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 xi(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=xi(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:ki,box:function(t,e,n,r,i,o,a,s){for(var u=[t,a],c=[e,s],l=ki(t,n,i,a),h=ki(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]))],k=fi(u[0],u[1],w[0],w[1]);if(m>=0&&s>k)a=m,s=k;else{var x=[i.apply(null,t.concat([b])),i.apply(null,e.concat([b]))],E=fi(u[0],u[1],x[0],x[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 xi(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 _i=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 Si(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Ai(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Mi(){}var Pi=.7,Ci=1/Pi,Ni=/^#([0-9a-f]{3,8})$/,Ri=/^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*\)$/,Fi=/^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*\)$/,Bi={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 $i(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Ni.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Gi(e):3===n?new qi(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Vi(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Vi(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=Ri.exec(t))?new qi(e[1],e[2],e[3],1):(e=Oi.exec(t))?new qi(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Ii.exec(t))?Vi(e[1],e[2],e[3],e[4]):(e=ji.exec(t))?Vi(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Di.exec(t))?Yi(e[1],e[2]/100,e[3]/100,1):(e=Fi.exec(t))?Yi(e[1],e[2]/100,e[3]/100,e[4]):Bi.hasOwnProperty(t)?Gi(Bi[t]):"transparent"===t?new qi(NaN,NaN,NaN,0):null}function Gi(t){return new qi(t>>16&255,t>>8&255,255&t,1)}function Vi(t,e,n,r){return r>0||(t=e=n=NaN),new qi(t,e,n,r)}function Hi(t){return t instanceof Mi||(t=$i(t)),t?new qi((t=t.rgb()).r,t.g,t.b,t.opacity):new qi}function qi(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function zi(){return"#"+Xi(this.r)+Xi(this.g)+Xi(this.b)}function Ui(){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 Xi(t){return(16>(t=Math.max(0,Math.min(255,Math.round(t)||0)))?"0":"")+t.toString(16)}function Yi(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 Mi||(t=$i(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)}Si(Mi,$i,{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}),Si(qi,(function(t,e,n,r){return 1===arguments.length?Hi(t):new qi(t,e,n,null==r?1:r)}),Ai(Mi,{brighter:function(t){return new qi(this.r*(t=null==t?Ci:Math.pow(Ci,t)),this.g*t,this.b*t,this.opacity)},darker:function(t){return new qi(this.r*(t=null==t?Pi:Math.pow(Pi,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:zi,formatHex:zi,formatRgb:Ui,toString:Ui})),Si(Zi,(function(t,e,n,r){return 1===arguments.length?Ki(t):new Zi(t,e,n,null==r?1:r)}),Ai(Mi,{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?Pi:Math.pow(Pi,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 qi(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 k=p.length,x=no([p[k-4],p[k-3]],[p[k-2],p[k-1]]);v=["C",x[0],x[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,k=(l-g)/i,x=(h-m)/o,E=(-l-g)/i,T=(-h-m)/o,_=so(1,0,k,x),S=so(k,x,E,T);return 0===s&&S>0&&(S-=io),1===s&&0>S&&(S+=io),[b,w,_,S]}(e,n,r,i,o,a,l,f,p,v,y,g),w=b[0],k=b[1],x=b[2],E=b[3],T=Math.abs(E)/(io/4);1e-7>Math.abs(1-T)&&(T=1);var _=Math.max(Math.ceil(T),1);E/=_;for(var S=0;_>S;S++)d.push(ao(x,E)),x+=E;return d.map((function(t){var e=oo(t[0],o,a,v,p,w,k),n=e.x,r=e.y,i=oo(t[1],o,a,v,p,w,k),s=i.x,u=i.y,c=oo(t[2],o,a,v,p,w,k);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,k=[(f-g)/r,(d-m)/i],x=[(-1*f-g)/r,(-1*d-m)/i],E=go([1,0],k),T=go(k,x);return yo(k,x)>-1||(T=Math.PI),1>yo(k,x)||(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 ko(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 k=.001,x=l.arcParams||{},E=x.cx,T=void 0===E?0:E,_=x.cy,S=void 0===_?0:_,A=x.rx,M=void 0===A?0:A,P=x.ry,C=void 0===P?0:P,N=x.sweepFlag,R=x.startAngle,O=void 0===R?0:R,I=x.endAngle,j=void 0===I?0:I;0===(void 0===N?0:N)&&(k*=-1),l.startTangent=[M*Math.cos(O-k)+T-i[0],C*Math.sin(O-k)+S-i[1]],l.endTangent=[d[0]-(M*Math.cos(O+j+k)+T),d[1]-(C*Math.sin(O+j-k)+S)]}e.push(l)}return e}function xo(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 _o(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 So(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ao(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 Mo(t,e,n){return e&&Ao(t.prototype,e),n&&Ao(t,n),t}function Po(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&&Ro(t,e)}function No(t){return(No=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ro(t,e){return(Ro=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=No(t);if(e){var i=No(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)||Bo(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 Fo(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)||Bo(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 Bo(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=Bo(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 $o,Go,Vo="ContributionProvider",Ho=function(){function t(e,n){So(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 Mo(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,Fo(n.getAll(this.serviceIdentifier)))}catch(t){console.error(t)}n=!0===t?n.parent:null}this.services=e}return this.services}}]),t}();function qo(t,e){($o.isContainer(t)?t.bind(Vo):t(Vo)).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)}}($o||($o={})),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"}(Go||(Go={}));var zo="CanvasConfig",Uo=function(t){Co(n,t);var e=jo(n);function n(){var t;So(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);Uo.tag="c-geometry";var Xo=function(t){Co(n,t);var e=jo(n);function n(){var t;So(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);Xo.tag="c-renderable";var Yo,Ko=function(t){Co(n,t);var e=jo(n);function n(){var t;So(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=qe(),t.position=an(0,0,0),t.rotation=Zn(0,0,0,1),t.scaling=an(1,1,1),t.worldTransform=qe(),t.origin=an(0,0,0),t}return n}(Ee);Ko.tag="c-transform",function(t){t[t.Standard=0]="Standard"}(Yo||(Yo={}));var Zo=function(t){Co(n,t);var e=jo(n);function n(){var t;So(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=Yo.Standard,t.visibilityPlaneMask=-1,t.visible=!0,t.enable=!0,t}return Mo(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;So(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(){So(this,t),this.pool={}}return Mo(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){So(this,t),this.center=void 0,this.halfExtents=void 0,this.min=nn(),this.max=nn(),this.update(e,n)}return Mo(t,[{key:"update",value:function(t,e){this.center=sn(nn(),t||nn()),this.halfExtents=sn(nn(),e||an(0,0,0)),this.min=Mn(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),Mn(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],k=b[1],x=b[2],E=y-w,T=y+w,_=g-k,S=g+k,A=m-x,M=m+x;c>E&&(c=E),T>l&&(l=T),h>_&&(h=_),S>f&&(f=S),d>A&&(d=A),M>p&&(p=M),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),k=Math.abs(f),x=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],k*o[0]+x*o[1]+E*o[2]),this.min=Mn(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){So(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 Mo(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&&xn(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(So(this,t),this.planes=[],e)this.planes=e;else for(var n=0;6>n;n++)this.planes.push(new ia)}return Mo(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;So(this,t),this.x=0,this.y=0,this.x=e,this.y=n}return Mo(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){So(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 Mo(t,[{key:"toJSON",value:function(){}}]),t}(),ua="SceneGraphSelectorFactory",ca="SceneGraphSelector",la=function(){function t(){So(this,t)}return Mo(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(Xo);r&&(r.renderBoundsDirty=!0,r.boundsDirty=!0,r.dirty=!0),n=n.parentElement}e||t.emit(Fa.BOUNDS_CHANGED,{})}la=Jo([ae()],la);var da="SceneGraphService",pa=function(){function t(){var e,n,r,i,o,a=this;So(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=Fo(o.childNodes)),s.dirty&&(s.sorted=Fo(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),Vn(e,e),$n(e,e,s),$n(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,Vn(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);Sn(e,nn())||(_n(e,e,i.localRotation),cn(i.localPosition,i.localPosition,e),a.dirtifyLocal(t,i))},this.setPosition=(i=qe(),function(t,e){var n=t.getEntity().getComponent(Ko);if(e=an(e[0],e[1],e[2]||n.position[2]),!Sn(a.getPosition(t),e)){if(n.position=e,null===t.parentNode)sn(n.localPosition,e);else{var r=t.parentNode.getEntity().getComponent(Ko);ze(i,r.worldTransform),Xe(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)),Sn(e,nn())||(cn(o,a.getPosition(t),e),a.setPosition(t,o))})}return Mo(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(!Sn(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]),Sn(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]);Sn(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:qe()}},{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(Uo),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(Xo);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=qe();t.parentNode.entity.hasComponent(Ko)&&(e=Xe(qe(),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(Fa.ATTRIBUTE_CHANGED,{attributeName:"modelMatrix",oldValue:null,newValue:null})})),t.emit(Fa.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?Ye(e.worldTransform,r.worldTransform,e.localTransform):ze(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(){So(this,t)}return Mo(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(){So(this,t)}return Mo(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(){So(this,t)}return Mo(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 ka=function(){function t(){So(this,t),this.canvas=void 0,this.context=void 0}return Mo(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}();ka=Jo([ae()],ka);var xa={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)),_a=RegExp("".concat(/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/.source,"|").concat(/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/.source,"|").concat(/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/.source,"|").concat(/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/.source)),Sa=function(){function t(){var e=this;So(this,t),this.cache={},this.offscreenCanvas=void 0,this.shouldBreakByKinsokuShorui=function(t,n){return!e.isBreakingSpace(n)&&!(!t||!_a.exec(n)&&!Ta.exec(t))},this.trimByKinsokuShorui=function(t){var e=Fo(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 Mo(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=xa.MetricsString+xa.BaselineSymbol,o=Math.ceil(r.measureText(i).width),a=Math.ceil(r.measureText(xa.BaselineSymbol).width),s=xa.HeightMultiplier*a;a=a*xa.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=k(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 x=(i?this.wordWrap(t,e):t).split(/(?:\r\n|\r|\n)/),E=Array(x.length),T=0,_=0;x.length>_;_++){var S=w.measureText(x[_]).width+(x[_].length-1)*f;E[_]=S,T=Math.max(T,S)}var A=T+u;d&&(A+=v);var M=a||b.fontSize+u,P=Math.max(M,b.fontSize+u)+(x.length-1)*(M+g);d&&(P+=v);var C=0;return"middle"===c?C=-P/2:"bottom"===c||"alphabetic"===c||"ideographic"===c?C=-P:"top"!==c&&"hanging"!==c||(C=0),{font:m,width:A,height:P,lines:x,lineWidths:E,lineHeight:M+=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*M,t+u,M)}))}}},{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&&xa.BreakingSpaces.indexOf(t.charCodeAt(0))>=0}},{key:"isNewline",value:function(t){return"string"==typeof t&&xa.Newlines.indexOf(t.charCodeAt(0))>=0}},{key:"trimToBreakable",value:function(t){var e=Fo(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(ka),ta("design:type",ka)],Sa.prototype,"offscreenCanvas",void 0),Sa=Jo([ae()],Sa);var Aa=function(){function t(){So(this,t),this.textService=void 0}return Mo(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(Sa),ta("design:type",Sa)],Aa.prototype,"textService",void 0),Aa=Jo([ae()],Aa);var Ma=function(){function t(){So(this,t)}return Mo(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}();Ma=Jo([ae()],Ma);var Pa=function(){function t(){So(this,t)}return Mo(t,[{key:"update",value:function(t){var e=t.points.points,n=Math.min.apply(Math,Fo(e.map((function(t){return t[0]})))),r=Math.max.apply(Math,Fo(e.map((function(t){return t[0]})))),i=Math.min.apply(Math,Fo(e.map((function(t){return t[1]}))));return{width:r-n,height:Math.max.apply(Math,Fo(e.map((function(t){return t[1]}))))-i,x:n,y:i}}}]),t}();Pa=Jo([ae()],Pa);var Ca=function(){function t(){So(this,t)}return Mo(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 Na,Ra="ContextService";!function(t){t[t.CameraChanged=0]="CameraChanged",t[t.DisplayObjectChanged=1]="DisplayObjectChanged",t[t.DisplayObjectRemoved=2]="DisplayObjectRemoved",t[t.None=3]="None"}(Na||(Na={}));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(Xo).dirty=!1);var o=r.getComponent(Qo);o.dirty&&(o.sorted=Fo(t.childNodes).sort(ha),o.dirty=!1),(o.sorted||t.childNodes).forEach((function(t){ja(t,e,n)}))}var Da=function(){function t(){So(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 Mo(t,[{key:"init",value:(e=_o(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(Na.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(Na.DisplayObjectChanged)}}]),t}();Jo([Tt(Vo),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 Fa,Ba=function(){function t(e){So(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 Mo(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 So(this,n),(i=e.call(this,null)).type=t,i.detail=r,Object.assign(Oo(i),r),i}return n}(Ba),Wa=function(t){Co(n,t);var e=jo(n);function n(){var t;So(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 Mo(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(){So(this,t),this.emitter=new ue.EventEmitter,this.entity=void 0;var e=ku.createEntity();this.entity=e}return Mo(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=x(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=x(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 Ba))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"}(Fa||(Fa={}));var $a=function(t){Co(n,t);var e=jo(n);function n(t){var r;So(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(Xo),i.addComponent(Zo),i.addComponent(Ko),i.addComponent(Qo),i.addComponent(Uo),r}return Mo(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(Fa.CHILD_INSERTED,{child:t}),t.emit(Fa.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(Fa.REMOVED,{parent:this}),e&&(t.emit(Fa.DESTROY,{}),t.destroyed=!0),this.emit(Fa.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];Fo(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,Fo(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(Fa.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),Ga=function(t){Co(n,t);var e=jo(n);function n(){var t;So(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 Mo(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}(Ba),Va=function(t){Co(n,t);var e=jo(n);function n(){var t;So(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 Mo(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}(Ga),Ha=function(t){Co(n,t);var e=jo(n);function n(){var t;So(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}(Ga),qa=function(t){Co(o,t);var e,n,r,i=jo(o);function o(){var t;So(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=_o(regeneratorRuntime.mark((function e(n){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n instanceof Va){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=_o(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 Va){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=_o(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 Va){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=_o(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 Va){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=_o(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 Va){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=_o(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 Va){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=_o(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 Mo(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=Ye(qe(),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=Ye(qe(),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=_o(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=_o(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(Va),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=_o(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(Va);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 Va&&e instanceof Va&&(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 Ga&&e instanceof Ga&&(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=$a.isElement(e)&&e.getAttribute("cursor");if(n)return n;e=Wa.isNode(e)&&e.parentNode}}}]),o}(ue.EventEmitter);function za(t){return void 0===t?0:t>360||-360>t?t%360:t}function Ua(t,e,n){return k(t)?an(t,e,n):3===t.length?rn(t):an(t[0],t[1],t[2]||0)}function Xa(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 Ya(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 Ge(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)],qa.prototype,"renderingContext",void 0),Jo([Tt(Ra),ta("design:type",Object)],qa.prototype,"contextService",void 0),Jo([Tt(zo),ta("design:type",Object)],qa.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)],qa.prototype,"init",null),qa=Jo([ae()],qa);var Ka=function(t){Co(n,t);var e=jo(n);function n(t,r,i,o){var a;return So(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}(Ba),Za=0,Qa=function(){function t(e,n){So(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 Mo(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;So(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 Mo(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,Fo(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(Uo);if(i&&i.contentBounds){var o=hn(nn(),an.apply(Dn,Fo(r.halfExtents.map((function(t){return 2*t})))),ln(nn(),Ua(e||nn()),Ua(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,ks=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,xs=/[\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=Ss(t);if(n)return{type:rs.LinearGradient,value:n,formatted:""}}else if("r"===e){var r=As(t);if(r){if(!b(r))return{type:rs.RadialGradient,value:r,formatted:""};t=r}}else if("p"===e){var i=_s(t);if(i)return{type:rs.Pattern,value:i,formatted:""}}var o=$i(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=Fo(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 _s(t){var e=ks.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 Ss(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(xs))||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 As(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(xs))||void 0===n?void 0:n.map((function(t){return t.split(":")})))||[];if(0===o){var s=e[4].match(xs);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 Ms(t,e,n){var r=wu.get(va)(n.nodeName);if(r){var i=n.entity.getComponent(Uo);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===Go.Line||n.nodeName===Go.Polyline||n.nodeName===Go.Polygon||n.nodeName===Go.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),k=n.parsedStyle,x=k.lineWidth,E=void 0===x?0:x,T=k.anchor,_=void 0===T?[0,0]:T,S=k.shadowColor,A=k.filter,M=void 0===A?[]:A;n.nodeName===Go.Text&&delete n.parsedStyle.anchor;var P=an((1-2*_[0])*w[0]+v,(1-2*_[1])*w[1]+g,(1-2*(_[2]||0))*w[2]+b);if(i.contentBounds.update(P,w),E&&cn(w,w,an(E/2,E/2,0)),i.renderBounds.update(P,w),S&&S.type===rs.Constant){var C=i.renderBounds,N=C.min,R=C.max,O=n.parsedStyle,I=O.shadowBlur,j=void 0===I?0:I,D=O.shadowOffsetX,F=void 0===D?0:D,B=O.shadowOffsetY,L=void 0===B?0:B,W=R[0]+j+F,$=N[1]-j+L,G=R[1]+j+L;N[0]=Math.min(N[0],N[0]-j+F),R[0]=Math.max(R[0],W),N[1]=Math.min(N[1],$),R[1]=Math.max(R[1],G),i.renderBounds.setMinMax(N,R)}M.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 Ps(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 Ns(t){return"number"==typeof t?t:/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?Number(t):0}function Rs(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===Go.Line||r===Go.Path||r===Go.Polyline){var i=n.attributes.offsetPath.getPoint(e);i&&n.setLocalPosition(i.x,i.y)}}}function Fs(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 Bs(t,e,n){if(n.parentNode){var r=n.parentNode.getEntity(),i=r.getComponent(Xo),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 $s(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(k(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 Gs(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=zs(t,i,r),s=zs(e,i,r),o="px"),(Ws(t.unit)||Ws(e.unit))&&(a=Us(t),s=Us(e),o="deg"),[a,s,function(t){return n&&(t=Math.max(t,0)),Cs(t)+o}]}var Vs=$s.bind(null,/px/g),Hs=$s.bind(null,/px|%/g),qs=$s.bind(null,/deg|rad|grad|turn/g);function zs(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 Us(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 Xs(t,e,n){n.setOrigin(e[0],e[1],e[2])}function Ys(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=zs(a,0,n)),s&&(i=zs(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:qs(t)},N:Ns,T:Hs,L:Vs}[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=[],k=[],x=0;p.length>x;x++){var E=("number"==typeof p[x]?Rs:Gs)(p[x],v[x],!1,n,x);b[x]=E[0],w[x]=E[1],k.push(E[2])}u.push(b),c.push(w),l.push([m,k])}}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(Fo((t||[]).map((function(t){return t.t}))),Fo((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){So(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 Mo(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=Fo(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=ko(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,Fo([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=_i(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=$s.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(ka).toSelf().inSingletonScope(),t(Sa).toSelf().inSingletonScope(),t(ya).to(ga).inSingletonScope().whenTargetNamed(Go.Circle),t(ya).to(ma).inSingletonScope().whenTargetNamed(Go.Ellipse),t(ya).to(ba).inSingletonScope().whenTargetNamed(Go.Rect),t(ya).to(ba).inSingletonScope().whenTargetNamed(Go.Image),t(ya).to(Aa).inSingletonScope().whenTargetNamed(Go.Text),t(ya).to(Ma).inSingletonScope().whenTargetNamed(Go.Line),t(ya).to(Pa).inSingletonScope().whenTargetNamed(Go.Polyline),t(ya).to(Pa).inSingletonScope().whenTargetNamed(Go.Polygon),t(ya).to(Ca).inSingletonScope().whenTargetNamed(Go.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"],Ns,Os(0,1),void 0),o(["r","rx","ry","lineWidth","width","height","shadowBlur"],Ns,Os(0,1/0),void 0),o(["lineDash"],void 0,Is,void 0),o(["x1","x2","y1","y2","lineDashOffset","shadowOffsetX","shadowOffsetY"],Ns,Rs,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,Ms),o(["fill","stroke","shadowColor"],Es,Ts,void 0),i("clipPath",void 0,void 0,Fs),i("zIndex",void 0,void 0,Bs),i("offsetPath",void 0,void 0,js),i("offsetDistance",void 0,void 0,Ds),i("origin",void 0,void 0,Xs),i("transformOrigin",void 0,void 0,Ys),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,Ps),i("filter",vu,void 0,void 0),i("anchor",void 0,void 0,ms)})),wu=new ie;wu.load(We),wu.load(bu);var ku=wu.get(Fe);ku.registerComponent(Ko).registerComponent(Qo).registerComponent(Zo).registerComponent(Uo).registerComponent(Xo);var xu,Eu,Tu,_u=function(){function t(e){So(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?xo(Object(n),!0).forEach((function(e){Po(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):xo(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 Mo(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}(),Su=function(){function t(e,n){var r,i;So(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 Ge(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 Mo(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=ze(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}(),Au="DefaultCamera";!function(t){t.ORBITING="ORBITING",t.EXPLORING="EXPLORING",t.TRACKING="TRACKING"}(xu||(xu={})),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 Mu,Pu,Cu,Nu="updated",Ru=Math.PI/180,Ou=180/Math.PI,Iu=function(t){Co(n,t);var e=jo(n);function n(){var t;So(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=qe(),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=qe(),t.projectionMatrixInverse=qe(),t.jitteredProjectionMatrix=void 0,t.view=void 0,t.following=void 0,t.type=xu.EXPLORING,t.trackingMode=Eu.DEFAULT,t.projectionMode=Tu.PERSPECTIVE,t.frustum=new oa,t.landmarks=[],t.landmarkAnimationID=void 0,t.orthoMatrix=qe(),t}return Mo(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===xu.EXPLORING),this._getAngles(),this.type===xu.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!==xu.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 Xe(qe(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"jitterProjectionMatrix",value:function(t,e){var n,r,i=(n=qe(),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=Ye(qe(),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*Ru,-this.aspect,this.near,this.far),Xe(this.projectionMatrixInverse,this.projectionMatrix),this.emit(Nu),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),Xe(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.emit(Nu),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=Ua(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,k=qe();r=k,i=k,a=Math.sin(o=w*Ru),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}(k,k,b*Ru),y=En(nn(),[0,1,0],k)}return Xe(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],k=n[1],x=n[2];return $e>Math.abs(p-w)&&$e>Math.abs(v-k)&&$e>Math.abs(y-x)?Ue(t):(d=1/Math.hypot(l=p-w,h=v-k,f=y-x),(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)}(qe(),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=za(t),this.computeMatrix(),this._getAxes(),this.type===xu.ORBITING||this.type===xu.EXPLORING?this._getPosition():this.type===xu.TRACKING&&this._getFocalPoint(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(t){return this.elevation=za(t),this.computeMatrix(),this._getAxes(),this.type===xu.ORBITING||this.type===xu.EXPLORING?this._getPosition():this.type===xu.TRACKING&&this._getFocalPoint(),this}},{key:"setRoll",value:function(t){return this.roll=za(t),this.computeMatrix(),this._getAxes(),this.type===xu.ORBITING||this.type===xu.EXPLORING?this._getPosition():this.type===xu.TRACKING&&this._getFocalPoint(),this}},{key:"rotate",value:function(t,e,n){if(this.relElevation=za(e),this.relAzimuth=za(t),this.relRoll=za(n),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.type===xu.EXPLORING){var r=Wn(Ln(),[1,0,0],(this.rotateWorld?1:-1)*this.relElevation*Ru),i=Wn(Ln(),[0,1,0],(this.rotateWorld?1:-1)*this.relAzimuth*Ru),o=Wn(Ln(),[0,0,1],this.relRoll*Ru),a=$n(Ln(),i,r);a=$n(Ln(),a,o);var s=en(qe(),a);Ke(this.matrix,this.matrix,[0,0,-this.distance]),Ye(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===xu.ORBITING||this.type===xu.EXPLORING?this._getPosition():this.type===xu.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(t,e){var n=Ua(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(Nu),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===xu.ORBITING||this.type===xu.EXPLORING?this._getDistance():this.type===xu.TRACKING&&cn(this.focalPoint,r,this.distanceVector),this.emit(Nu),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 Su(t,n);return this.landmarks.push(r),r}},{key:"setLandmark",value:function(t){var e=new Su(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(xn(h,e.focalPoint,a,l),xn(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(Nu),.01>=Nn(h,a)+Nn(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(Nu)}},{key:"computeMatrix",value:function(){var t,e,n=Wn(Ln(),[0,0,1],this.roll*Ru);Ue(this.matrix),t=Wn(Ln(),[1,0,0],(this.rotateWorld&&this.type!==xu.TRACKING||this.type===xu.TRACKING?1:-1)*this.elevation*Ru),e=Wn(Ln(),[0,1,0],(this.rotateWorld&&this.type!==xu.TRACKING||this.type===xu.TRACKING?1:-1)*this.azimuth*Ru);var r=$n(Ln(),e,t);r=$n(Ln(),r,n);var i=en(qe(),r);this.type===xu.ORBITING||this.type===xu.EXPLORING?(Ke(this.matrix,this.matrix,this.focalPoint),Ye(this.matrix,this.matrix,i),Ke(this.matrix,this.matrix,[0,0,this.distance])):this.type===xu.TRACKING&&(Ke(this.matrix,this.matrix,this.position),Ye(this.matrix,this.matrix,i))}},{key:"_setPosition",value:function(t,e,n){this.position=Ua(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,Ua(Bn(Fn(),[1,0,0,0],this.matrix))),sn(this.up,Ua(Bn(Fn(),[0,1,0,0],this.matrix))),sn(this.forward,Ua(Bn(Fn(),[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===xu.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,Ua(Bn(Fn(),[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,Fu,Bu=(Pu=Mu=function(){function t(){So(this,t),this.canvasConfig=void 0,this.renderingContext=void 0}return Mo(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(Xo).dirty||e.renderingContext.renderReasons.has(Na.CameraChanged)||!n?t:null}return t}))}}]),t}(),Mu.tag="DirtyCheckPlugin",Cu=Pu);Jo([Tt(zo),ta("design:type",Object)],Bu.prototype,"canvasConfig",void 0),Jo([Tt(Oa),ta("design:type",Object)],Bu.prototype,"renderingContext",void 0),Bu=Cu=Jo([ae()],Bu);var Lu,Wu,$u,Gu="CullingStrategy",Vu=(Du=ju=function(){function t(){So(this,t),this.canvasConfig=void 0,this.strategies=void 0,this.renderingContext=void 0}return Mo(t,[{key:"apply",value:function(t){var e=this;t.hooks.prepare.tap(Fu.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(Na.DisplayObjectRemoved))}return null}return t})),t.hooks.afterRender.tap(Fu.tag,(function(t){t.entity.getComponent(Zo).visibilityPlaneMask=-1}))}}]),t}(),ju.tag="CullingPlugin",Fu=Du);Jo([Tt(zo),ta("design:type",Object)],Vu.prototype,"canvasConfig",void 0),Jo([Tt(Vo),se(Gu),ta("design:type",Object)],Vu.prototype,"strategies",void 0),Jo([Tt(Oa),ta("design:type",Object)],Vu.prototype,"renderingContext",void 0),Vu=Fu=Jo([ae()],Vu);var Hu=(Wu=Lu=function(){function t(){So(this,t),this.renderingContext=void 0}return Mo(t,[{key:"apply",value:function(t){var e=this,n=function(t){e.renderingContext.renderReasons.add(Na.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($u.tag,(function(){e.renderingContext.root.addEventListener(Fa.MOUNTED,o),e.renderingContext.root.addEventListener(Fa.UNMOUNTED,a),e.renderingContext.root.addEventListener(Fa.ATTRIBUTE_CHANGED,n),e.renderingContext.root.addEventListener(Fa.BOUNDS_CHANGED,i)})),t.hooks.destroy.tap($u.tag,(function(){e.renderingContext.root.removeEventListener(Fa.MOUNTED,o),e.renderingContext.root.removeEventListener(Fa.UNMOUNTED,a),e.renderingContext.root.removeEventListener(Fa.ATTRIBUTE_CHANGED,n),e.renderingContext.root.removeEventListener(Fa.BOUNDS_CHANGED,i)}))}}]),t}(),Lu.tag="PrepareRendererPlugin",$u=Wu);Jo([Tt(Oa),ta("design:type",Object)],Hu.prototype,"renderingContext",void 0),Hu=$u=Jo([ae()],Hu);var qu=function(){function t(){So(this,t),this.camera=void 0}return Mo(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(Au),ta("design:type",Iu)],qu.prototype,"camera",void 0),qu=Jo([ae()],qu);var zu,Uu,Xu,Yu=!!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 Yu&&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=(Uu=zu=function(){function t(){var e=this;So(this,t),this.canvasConfig=void 0,this.contextService=void 0,this.renderingService=void 0,this.eventService=void 0,this.autoPreventDefault=!0,this.rootPointerEvent=new Va(null),this.rootWheelEvent=new Ha(null),this.onPointerMove=function(t){if(!Yu||"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 Mo(t,[{key:"apply",value:function(t){var e=this;this.eventService.setPickHandler(function(){var t=_o(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(Xu.tag,(function(t){var n=e.normalizeWheelEvent(t);e.eventService.mapEvent(n)})),t.hooks.pointerDown.tap(Xu.tag,(function(t){if(!Yu||"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(Xu.tag,(function(t){if(!Yu||"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(Xu.tag,this.onPointerMove),t.hooks.pointerOver.tap(Xu.tag,this.onPointerMove),t.hooks.pointerOut.tap(Xu.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}(),zu.tag="EventPlugin",Xu=Uu);Jo([Tt(zo),ta("design:type",Object)],Ju.prototype,"canvasConfig",void 0),Jo([Tt(Ra),ta("design:type",Object)],Ju.prototype,"contextService",void 0),Jo([Tt(Da),ta("design:type",Da)],Ju.prototype,"renderingService",void 0),Jo([Tt(qa),ta("design:type",qa)],Ju.prototype,"eventService",void 0),Ju=Xu=Jo([ae()],Ju);var tc;new oe((function(t,e,n,r){t(Da).toSelf().inSingletonScope(),qo(t,Ia),t(qa).toSelf().inSingletonScope(),t(Ju).toSelf().inSingletonScope(),t(Ia).toService(Ju),t(Hu).toSelf().inSingletonScope(),t(Ia).toService(Hu),t(Bu).toSelf().inSingletonScope(),t(Ia).toService(Bu),qo(t,Gu),t(qu).toSelf().inSingletonScope(),t(Gu).toService(qu),t(Vu).toSelf().inSingletonScope(),t(Ia).toService(Vu)}));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=Ra,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}(),bc=function(){for(var t=0,e=0,n=arguments.length;n>e;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;n>e;e++)for(var o=arguments[e],a=0,s=o.length;s>a;a++,i++)r[i]=o[a];return r},wc=function(t,e,n){this.name=t,this.version=e,this.os=n,this.type="browser"},kc=function(t){this.version=t,this.type="node",this.name="node",this.os=process.platform},xc=function(t,e,n,r){this.name=t,this.version=e,this.os=n,this.bot=r,this.type="bot-device"},Ec=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},Tc=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},_c=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Sc=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],Ac=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function Mc(t){return t?Pc(t):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new Tc:"undefined"!=typeof navigator?Pc(navigator.userAgent):"undefined"!=typeof process&&process.version?new kc(process.version.slice(1)):null}function Pc(t){var e=function(t){return""!==t&&Sc.reduce((function(e,n){var r=n[0];if(e)return e;var i=n[1].exec(t);return!!i&&[r,i]}),!1)}(t);if(!e)return null;var n=e[0],r=e[1];if("searchbot"===n)return new Ec;var i=r[1]&&r[1].split(/[._]/).slice(0,3);i?3>i.length&&(i=bc(i,function(t){for(var e=[],n=0;t>n;n++)e.push("0");return e}(3-i.length))):i=[];var o=i.join("."),a=function(t){for(var e=0,n=Ac.length;n>e;e++){var r=Ac[e],i=r[0];if(r[1].exec(t))return i}return null}(t),s=_c.exec(t);return s&&s[1]?new xc(n,o,a,s[1]):new wc(n,o,a)}function Cc(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 Oc(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ic(t){return(Ic=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function jc(t,e){return(jc=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Dc(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 Fc(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=Ic(t);if(e){var i=Ic(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Dc(this,n)}}function Bc(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)||Wc(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 Lc(t){return function(t){if(Array.isArray(t))return $c(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Wc(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 Wc(t,e){if(t){if("string"==typeof t)return $c(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)?$c(t,e):void 0}}function $c(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 Gc="inversify:paramtypes",Vc=0;var Hc=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 qc(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 zc(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 Hc("inject",t);"number"==typeof r?function(t,e,n,r){qc("inversify:tagged",t,e,r,n)}(e,n,r,i):function(t,e,n){qc("inversify:tagged_props",t.constructor,e,n)}(e,n,i)}}var Uc=function(t){this.id=Vc++,this.registry=t};function Xc(){return function(t){if(Reflect.hasOwnMetadata(Gc,t))throw Error("Cannot apply @injectable decorator multiple times.");var e=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(Gc,e,t),t}}var Yc=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&&jc(t,e)}(n,t);var e=Fc(n);function n(){var t;Cc(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))).$el=void 0,t.$groupEl=void 0,t}return n}(Ee);
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
+ ***************************************************************************** */
74
+ function Kc(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 Zc(t,e){if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}Yc.tag="c-svg-element";var Qc={}.toString,Jc=function(t,e){return Qc.call(t)==="[object "+e+"]"},tl=function(t){return Array.isArray?Array.isArray(t):Jc(t,"Array")},el=function(t){return Jc(t,"String")};function nl(t){return t.toFixed(6).replace(".000000","")}var rl=function(){function t(){Cc(this,t),this.dependencies=["radius","width","height"]}return Rc(t,[{key:"apply",value: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,u="";if(r){var c=function(t){var e=0,n=0,r=0,i=0;return tl(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,{r1:e,r2:n,r3:r,r4:i}}(r);tl(r)?1===r.length?c.r1=c.r2=c.r3=c.r4=r[0]:2===r.length?(c.r1=c.r3=r[0],c.r2=c.r4=r[1]):3===r.length?(c.r1=r[0],c.r2=c.r4=r[1],c.r3=r[2]):(c.r1=r[0],c.r2=r[1],c.r3=r[2],c.r4=r[3]):c.r1=c.r2=c.r3=c.r4=r,u=[["M ".concat(c.r1,",0")],["l ".concat(o-c.r1-c.r2,",0")],["a ".concat(c.r2,",").concat(c.r2,",0,0,1,").concat(c.r2,",").concat(c.r2)],["l 0,".concat(s-c.r2-c.r3)],["a ".concat(c.r3,",").concat(c.r3,",0,0,1,").concat(-c.r3,",").concat(c.r3)],["l ".concat(c.r3+c.r4-o,",0")],["a ".concat(c.r4,",").concat(c.r4,",0,0,1,").concat(-c.r4,",").concat(-c.r4)],["l 0,".concat(c.r4+c.r1-s)],["a ".concat(c.r1,",").concat(c.r1,",0,0,1,").concat(c.r1,",").concat(-c.r1)],["z"]].join(" ")}else u="M 0,0 l ".concat(o,",0 l 0,").concat(s," l").concat(-o," 0 z");t.setAttribute("d",u)}}]),t}();rl=Kc([Xc()],rl);var il=function(){function t(){Cc(this,t),this.dependencies=["img","width","height"]}return Rc(t,[{key:"apply",value:function(t,e){var n=e.img,r=void 0===n?"":n,i=e.width,o=void 0===i?0:i,a=e.height,s=void 0===a?0:a;if(t.setAttribute("x","0"),t.setAttribute("y","0"),el(r))t.setAttribute("href",r);else if(r instanceof Image)o||t.setAttribute("width","".concat(r.width)),s||t.setAttribute("height","".concat(r.height)),t.setAttribute("href",r.src);else if(r instanceof HTMLElement&&el(r.nodeName)&&"CANVAS"===r.nodeName.toUpperCase())t.setAttribute("href",r.toDataURL());else if(r instanceof ImageData){var u=document.createElement("canvas");u.setAttribute("width","".concat(r.width)),u.setAttribute("height","".concat(r.height));var c=u.getContext("2d");c&&(c.putImageData(r,0,0),o||t.setAttribute("width","".concat(r.width)),s||t.setAttribute("height","".concat(r.height)),t.setAttribute("href",u.toDataURL()))}}}]),t}();il=Kc([Xc()],il);var ol=function(){function t(){Cc(this,t),this.dependencies=["x1","y1","x2","y2"]}return Rc(t,[{key:"apply",value:function(t,e){var n=e.y1,r=e.x2,i=e.y2,o=e.defX,a=void 0===o?0:o,s=e.defY,u=void 0===s?0:s,c=e.stroke;t.setAttribute("x1","".concat(e.x1-a)),t.setAttribute("y1","".concat(n-u)),t.setAttribute("x2","".concat(r-a)),t.setAttribute("y2","".concat(n===i&&c&&c.type!==rs.Constant?i-u+1e-5:i-u))}}]),t}();ol=Kc([Xc()],ol);var al=function(){function t(){Cc(this,t),this.dependencies=["points"]}return Rc(t,[{key:"apply",value:function(t,e){var n=e.points,r=e.defX,i=void 0===r?0:r,o=e.defY,a=void 0===o?0:o;n&&n.points&&n.points.length>=2&&t.setAttribute("points",n.points.map((function(t){return"".concat(t[0]-i,",").concat(t[1]-a)})).join(" "))}}]),t}();al=Kc([Xc()],al);var sl={top:"before-edge",middle:"central",bottom:"after-edge",alphabetic:"alphabetic",ideographic:"ideographic",hanging:"hanging"},ul={top:"text-before-edge",middle:"central",bottom:"text-after-edge",alphabetic:"alphabetic",ideographic:"ideographic",hanging:"hanging"},cl={left:"left",start:"left",center:"middle",right:"end",end:"end"},ll=function(){function t(){Cc(this,t),this.dependencies=["text","font","fontSize","fontFamily","fontStyle","fontWeight","fontVariant","lineHeight","letterSpacing","padding","wordWrap","wordWrapWidth","leading","textBaseline","textAlign","whiteSpace"]}return Rc(t,[{key:"apply",value:function(t,e){var n=e.textAlign,r=e.textBaseline,i=e.lineCap,o=e.lineJoin,a=e.lineWidth,s=void 0===a?0:a,u=e.metrics,c=Mc();c&&"firefox"===c.name?t.setAttribute("dominant-baseline",ul[r]||"alphabetic"):(t.setAttribute("dominant-baseline",ul[r]),t.setAttribute("alignment-baseline",sl[r])),t.setAttribute("text-anchor",cl[n]),t.setAttribute("paint-order","stroke"),t.setAttribute("style","stroke-linecap:".concat(i,"; stroke-linejoin:").concat(o,";"));var l=u.lines,h=u.lineHeight,f=u.height,d=l.length;1===d?(t.innerHTML=l[0],t.setAttribute("dx","".concat(s/2))):t.innerHTML=l.map((function(t,e){var n=0;return 0===e?"middle"===r?n=h/2-f/2:"top"===r||"hanging"===r?n=0:"bottom"!==r&&"alphabetic"!==r&&"ideographic"!==r||(n=-h*(d-1)):n=h,'<tspan x="0" dx="'.concat(s/2,'" dy="').concat(n,'">').concat(t,"</tspan>")})).join("")}}]),t}();ll=Kc([Xc()],ll);var hl=function(){function t(){Cc(this,t),this.dependencies=["path"]}return Rc(t,[{key:"apply",value:function(t,e){var n=e.defX,r=e.defY;t.setAttribute("d",this.formatPath(e.path.absolutePath,void 0===n?0:n,void 0===r?0:r))}},{key:"formatPath",value:function(t,e,n){var r=t.map((function(t){switch(t[0]){case"M":return"M ".concat(t[1]-e,",").concat(t[2]-n);case"L":return"L ".concat(t[1]-e,",").concat(t[2]-n);case"Q":return"Q ".concat(t[1]-e," ").concat(t[2]-n,",").concat(t[3]-e," ").concat(t[4]-n);case"C":return"C ".concat(t[1]-e," ").concat(t[2]-n,",").concat(t[3]-e," ").concat(t[4]-n,",").concat(t[5]-e," ").concat(t[6]-n);case"A":return"A ".concat(t[1]," ").concat(t[2]," ").concat(t[3]," ").concat(t[4]," ").concat(t[5]," ").concat(t[6]-e," ").concat(t[7]-n);case"Z":return"Z"}})).join(" ");return~r.indexOf("NaN")?"":r}}]),t}();hl=Kc([Xc()],hl);var fl="ElementRendererFactory",dl="undefined"!=typeof Float32Array?Float32Array:Array;function pl(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 vl(){var t=new dl(3);return dl!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function yl(t,e,n){var r=new dl(3);return r[0]=t,r[1]=e,r[2]=n,r}function gl(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=vl()}();!function(){var t,e=(t=new dl(4),dl!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t)}();function bl(){var t=new dl(4);return dl!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function wl(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 kl=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};(function(){var t=vl(),e=yl(1,0,0),n=yl(0,1,0)})(),function(){var t=bl(),e=bl()}(),function(){var t,e=(t=new dl(9),dl!=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 xl(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function El(t,e,n,r){var i="g-filter-"+e.getEntity().getName(),o=t.querySelectorAll("[name=".concat(i,"]"));if(o.length&&o.forEach((function(e){t.removeChild(e)})),0===r.length)null==n||n.removeAttribute("filter");else{var a=r.map((function(e,n){var r=e.name,o=e.params,a=xl("filter");return"blur"===r?function(t,e){var n=xl("feGaussianBlur");n.setAttribute("in","SourceGraphic"),n.setAttribute("stdDeviation","".concat(e[0].value)),t.appendChild(n)}(a,o):"brightness"===r?function(t,e){var n=Tl(e[0]);_l(t,{type:"linear",slope:n,intercept:0})}(a,o):"drop-shadow"===r?function(t,e){var n=e[0].value,r=e[1].value,i=e[2].value,o=e[3].formatted,a=xl("feGaussianBlur");a.setAttribute("in","SourceAlpha"),a.setAttribute("stdDeviation","".concat(i)),t.appendChild(a);var s=xl("feOffset");s.setAttribute("dx","".concat(n)),s.setAttribute("dy","".concat(r)),s.setAttribute("result","offsetblur"),t.appendChild(s);var u=xl("feFlood");u.setAttribute("flood-color",o),t.appendChild(u);var c=xl("feComposite");c.setAttribute("in2","offsetblur"),c.setAttribute("operator","in"),t.appendChild(c);var l=xl("feMerge");t.appendChild(l);var h=xl("feMergeNode"),f=xl("feMergeNode");f.setAttribute("in","SourceGraphic"),l.appendChild(h),l.appendChild(f)}(a,o):"contrast"===r?function(t,e){var n=Tl(e[0]);_l(t,{type:"linear",slope:n,intercept:-.5*n+.5})}(a,o):"grayscale"===r?function(t,e){var n=Tl(e[0]);Sl(t,[.2126+.7874*(1-n),.7152-.7152*(1-n),.0722-.0722*(1-n),0,0,.2126-.2126*(1-n),.7152+.2848*(1-n),.0722-.0722*(1-n),0,0,.2126-.2126*(1-n),.7152-.7152*(1-n),.0722+.9278*(1-n),0,0,0,0,0,1,0])}(a,o):"sepia"===r?function(t,e){var n=Tl(e[0]);Sl(t,[.393+.607*(1-n),.769-.769*(1-n),.189-.189*(1-n),0,0,.349-.349*(1-n),.686+.314*(1-n),.168-.168*(1-n),0,0,.272-.272*(1-n),.534-.534*(1-n),.131+.869*(1-n),0,0,0,0,0,1,0])}(a,o):"saturate"===r?function(t,e){var n=Tl(e[0]),r=xl("feColorMatrix");r.setAttribute("type","saturate"),r.setAttribute("values","".concat(n)),t.appendChild(r)}(a,o):"hue-rotate"===r?function(t,e){var n=xl("feColorMatrix");n.setAttribute("type","hueRotate"),n.setAttribute("values","".concat(Us(e[0]))),t.appendChild(n)}(a,o):"invert"===r&&function(t,e){var n=Tl(e[0]);_l(t,{type:"table",tableValues:"".concat(n," ").concat(1-n)})}(a,o),a.id="".concat(i,"-").concat(n),a.setAttribute("name",i),t.appendChild(a),a.id}));null==n||n.setAttribute("filter",a.map((function(t){return"url(#".concat(t,")")})).join(" "))}}function Tl(t){return"%"===t.unit?t.value/100:t.value}function _l(t,e){var n=e.type,r=e.slope,i=e.intercept,o=e.tableValues,a=xl("feComponentTransfer");[xl("feFuncR"),xl("feFuncG"),xl("feFuncB")].forEach((function(t){t.setAttribute("type",n),"table"===n?t.setAttribute("tableValues","".concat(o)):(t.setAttribute("slope","".concat(r)),t.setAttribute("intercept","".concat(i))),a.appendChild(t)})),t.appendChild(a)}function Sl(t,e){var n=xl("feColorMatrix");n.setAttribute("type","matrix"),n.setAttribute("values",e.join(" ")),t.appendChild(n)}var Al={},Ml=0;function Pl(t,e,n,r,i){var o=function(t){var e="",n=t.type;if(n===rs.Pattern){e=t.value.src}else if(n===rs.LinearGradient||n===rs.RadialGradient){var r=t.value,i=r.x0,o=r.y0,a=r.x1,s=r.y1,u=r.r1,c=r.steps;e="".concat(n).concat(i).concat(o).concat(a).concat(s).concat(u||0).concat(c.map((function(t){return t.join("")})).join(""))}e&&(Al[e]||(Al[e]="_pattern_".concat(n,"_").concat(Ml++)));return Al[e]}(r),a=t.querySelector("#".concat(o));r.type===rs.LinearGradient||r.type===rs.RadialGradient?(a||function(t,e,n){var r=xl(e.type===rs.LinearGradient?"linearGradient":"radialGradient");if(e.type===rs.LinearGradient){var i=e.value,o=i.y0,a=i.x1,s=i.y1;r.setAttribute("x1","".concat(i.x0)),r.setAttribute("y1","".concat(o)),r.setAttribute("x2","".concat(a)),r.setAttribute("y2","".concat(s))}else{var u=e.value,c=u.y0,l=u.r1;r.setAttribute("cx","".concat(u.x0)),r.setAttribute("cy","".concat(c)),r.setAttribute("r","".concat(l/2))}var h="";e.value.steps.forEach((function(t){var e=Bc(t,2),n=e[1];h+='<stop offset="'.concat(e[0],'" stop-color="').concat(n,'"></stop>')})),r.innerHTML=h,r.id=n,t.appendChild(r)}(t,r,o),null==n||n.setAttribute(i,"url(#".concat(o,")"))):r.type===rs.Pattern?(a||function(t,e,n){var r=e.value.src,i=xl("pattern");i.setAttribute("patternUnits","userSpaceOnUse");var o=xl("image");i.appendChild(o),i.id=n,t.appendChild(i),o.setAttribute("href",r);var a=new Image;r.match(/^data:/i)||(a.crossOrigin="Anonymous");function s(){i.setAttribute("width","".concat(a.width)),i.setAttribute("height","".concat(a.height))}a.src=r,a.complete?s():(a.onload=s,a.src=a.src)}(t,r,o),null==n||n.setAttribute(i,"url(#".concat(o,")"))):null==n||n.setAttribute(i,"".concat(r.formatted))}var Cl,Nl,Rl,Ol;function Il(t,e,n,r){var i="filter-dropshadow-"+e.getEntity().getName(),o=t.querySelector("#".concat(i));if(!o){o=xl("filter");var a=xl("feDropShadow");a.setAttribute("dx","0"),a.setAttribute("dy","0"),o.appendChild(a),o.id=i,t.appendChild(o)}var s=o.children[0];"shadowColor"===r?s.setAttribute("flood-color",e.parsedStyle[r].formatted):"shadowBlur"===r?s.setAttribute("stdDeviation","".concat(Number(e.parsedStyle[r])/2)):"shadowOffsetX"===r?s.setAttribute("dx",e.parsedStyle[r]):"shadowOffsetY"===r&&s.setAttribute("dy",e.parsedStyle[r]);null==n||n.setAttribute("filter","url(#".concat(i,")"))}var jl=(Oc(Cl={},Go.Rect,"path"),Oc(Cl,Go.Circle,"circle"),Oc(Cl,Go.Ellipse,"ellipse"),Oc(Cl,Go.Image,"image"),Oc(Cl,Go.Group,"g"),Oc(Cl,Go.Line,"line"),Oc(Cl,Go.Polyline,"polyline"),Oc(Cl,Go.Polygon,"polygon"),Oc(Cl,Go.Text,"text"),Oc(Cl,Go.Path,"path"),Oc(Cl,Go.HTML,"foreignObject"),Cl),Dl={opacity:"opacity",fillStyle:"fill",fill:"fill",fillOpacity:"fill-opacity",strokeStyle:"stroke",strokeOpacity:"stroke-opacity",stroke:"stroke",clipPath:"clip-path",r:"r",rx:"rx",ry:"ry",width:"width",height:"height",lineCap:"stroke-linecap",lineJoin:"stroke-linejoin",lineWidth:"stroke-width",lineDash:"stroke-dasharray",lineDashOffset:"stroke-dashoffset",miterLimit:"stroke-miterlimit",font:"font",fontSize:"font-size",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",fontFamily:"font-family",letterSpacing:"letter-spacing",startArrow:"marker-start",endArrow:"marker-end",class:"class",id:"id",style:"style",preserveAspectRatio:"preserveAspectRatio",visibility:"visibility",anchor:"anchor",shadowColor:"flood-color",shadowBlur:"stdDeviation",shadowOffsetX:"dx",shadowOffsetY:"dy",filter:"filter",innerHTML:"innerHTML"},Fl="g_svg",Bl="clip-path-",Ll=(Rl=Nl=function(){function t(){Cc(this,t),this.camera=void 0,this.contextService=void 0,this.renderingContext=void 0,this.sceneGraphService=void 0,this.elementRendererFactory=void 0,this.$def=void 0,this.$camera=void 0}return Rc(t,[{key:"apply",value:function(t){var e=this,n=function(t){e.createSVGDom(t.target,e.$camera)},r=function(t){e.removeSVGDom(t.target)},i=function(t){var n=t.target,r=t.detail,i=r.attributeName;if("zIndex"===i){var o,a,s=n.parentNode,u=null===(o=n.parentNode)||void 0===o?void 0:o.getEntity(),c=null==u||null===(a=u.getComponent(Yc))||void 0===a?void 0:a.$groupEl,l=Lc((null==s?void 0:s.children)||[]);c&&e.reorderChildren(c,l)}e.updateAttribute(n,i,n.parsedStyle[i])};t.hooks.init.tap(Ol.tag,(function(){e.$def=xl("defs");var t=e.contextService.getContext();t.appendChild(e.$def),t.setAttribute("color-interpolation-filters","sRGB"),e.$camera=xl("g"),e.$camera.id="".concat(Fl,"_camera"),e.applyTransform(e.$camera,e.camera.getOrthoMatrix()),t.appendChild(e.$camera),e.renderingContext.root.addEventListener(Fa.MOUNTED,n),e.renderingContext.root.addEventListener(Fa.UNMOUNTED,r),e.renderingContext.root.addEventListener(Fa.ATTRIBUTE_CHANGED,i)})),t.hooks.destroy.tap(Ol.tag,(function(){e.renderingContext.root.removeEventListener(Fa.MOUNTED,n),e.renderingContext.root.removeEventListener(Fa.UNMOUNTED,r),e.renderingContext.root.removeEventListener(Fa.ATTRIBUTE_CHANGED,i)})),t.hooks.render.tap(Ol.tag,(function(t){var n,r;e.renderingContext.renderReasons.has(Na.CameraChanged)&&e.applyTransform(e.$camera,e.camera.getOrthoMatrix());var i=t.getEntity(),o=null===(n=i.getComponent(Yc))||void 0===n?void 0:n.$el,a=null===(r=i.getComponent(Yc))||void 0===r?void 0:r.$groupEl;o&&a&&(e.applyTransform(a,t.getLocalTransform()),e.reorderChildren(a,t.children||[]),i.getComponent(Xo).dirty=!1)}))}},{key:"reorderChildren",value:function(t,e){e.sort(this.sceneGraphService.sort);var n=document.createDocumentFragment();e.forEach((function(t){var e=t.getEntity().getComponent(Yc).$groupEl;e&&n.appendChild(e)})),t.appendChild(n)}},{key:"applyTransform",value:function(t,e){var n,r,i=((n=vl())[0]=(r=e)[12],n[1]=r[13],n[2]=r[14],n),o=pl(vl(),e),a=function(t,e){var n=new dl(3);pl(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}(bl(),e),s=Bc(i,2),u=s[0],c=s[1],l=Bc(o,2),h=l[0],f=l[1],d=Bc(Xa(vl(),a),3),p=Ya(d[0]||d[2],u,c,h,f);t.setAttribute("transform","matrix(".concat(nl(p[0]),",").concat(nl(p[1]),",").concat(nl(p[3]),",").concat(nl(p[4]),",").concat(nl(p[6]),",").concat(nl(p[7]),")"))}},{key:"applyAttributes",value:function(t){var e,n,r=t.getEntity(),i=null===(e=r.getComponent(Yc))||void 0===e?void 0:e.$el,o=null===(n=r.getComponent(Yc))||void 0===n?void 0:n.$groupEl;if(i&&o){var a=t.nodeName,s=t.attributes,u=t.parsedStyle;for(var c in i.setAttribute("fill","none"),a===Go.Image&&i.setAttribute("preserveAspectRatio","none"),s)this.updateAttribute(t,c,u[c],!0);var l=this.elementRendererFactory(a);l&&l.apply(i,u)}}},{key:"updateAttribute",value:function(t,e,n){var r,i,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=t.getEntity(),s=null===(r=a.getComponent(Yc))||void 0===r?void 0:r.$el,u=null===(i=a.getComponent(Yc))||void 0===i?void 0:i.$groupEl,c=t.parsedStyle;if(Dl[e])if("fill"===e||"stroke"===e)Pl(this.$def,0,s,c[e],Dl[e]);else if("visibility"===e)null==u||u.setAttribute(Dl[e],"".concat(n));else if("clipPath"===e){var l=n;if(l){var h,f=Bl+l.getEntity().getName(),d=this.$def.querySelector("#".concat(f));if(!d){var p=xl("clipPath");p.id=f,this.$def.appendChild(p),this.createSVGDom(l,p,!0),l.getEntity().getComponent(Yc).$groupEl=p}var v=null===(h=l.getEntity().getComponent(Yc))||void 0===h?void 0:h.$groupEl;v&&this.applyTransform(v,l.getLocalTransform()),this.applyAttributes(l),null==s||s.setAttribute("clip-path","url(#".concat(f,")"))}else null==s||s.removeAttribute("clip-path")}else if("shadowColor"===e||"shadowBlur"===e||"shadowOffsetX"===e||"shadowOffsetY"===e)Il(this.$def,t,s,e);else if("filter"===e)El(this.$def,t,s,c[e]);else if("innerHTML"===e){var y=document.createElement("div");"string"==typeof n?y.innerHTML=n:y.appendChild(n),s.innerHTML="",s.appendChild(y)}else t.nodeName!==Go.Text&&["anchor","width","height","r","rx","ry"].indexOf(e)>-1&&this.updateAnchorWithTransform(t),"anchor"!==e&&(null==s||s.setAttribute(Dl[e],"".concat(n)));if(!o&&s){var g=this.elementRendererFactory(t.nodeName);g&&g.dependencies.indexOf(e)>-1&&g.apply(s,t.parsedStyle)}}},{key:"createSVGDom",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.getEntity(),i=r.addComponent(Yc),o=jl[t.nodeName]||"g";if(o){var a,s,u=xl(o);t.nodeName===Go.HTML&&(t.parsedStyle.$el=u),u.id="".concat(Fl,"_").concat(t.nodeName,"_").concat(r.getName()),"g"===o||n?s=u:(s=xl("g")).appendChild(u),i.$el=u,i.$groupEl=s;var c=t.parentNode&&(null===(a=t.parentNode.getEntity().getComponent(Yc))||void 0===a?void 0:a.$groupEl)||e;c&&c.appendChild(s),this.applyAttributes(t)}}},{key:"removeSVGDom",value:function(t){var e,n=null===(e=t.getEntity().getComponent(Yc))||void 0===e?void 0:e.$groupEl;n&&n.parentNode&&(n.parentNode.removeChild(n),t.getEntity().removeComponent(Yc,!0))}},{key:"updateAnchorWithTransform",value:function(t){var e,n=t.getGeometryBounds(),r=n&&2*n.halfExtents[0]||0,i=n&&2*n.halfExtents[1]||0,o=(t.parsedStyle||{}).anchor,a=void 0===o?[0,0]:o,s=null===(e=t.getEntity().getComponent(Yc))||void 0===e?void 0:e.$el;null==s||s.setAttribute("transform","translate(-".concat(a[0]*r,",-").concat(a[1]*i,")")),t.nodeName!==Go.Circle&&t.nodeName!==Go.Ellipse||(null==s||s.setAttribute("cx","".concat(r/2)),null==s||s.setAttribute("cy","".concat(i/2)))}}]),t}(),Nl.tag="SVGRendererPlugin",Ol=Rl);Kc([zc(Au),Zc("design:type",Iu)],Ll.prototype,"camera",void 0),Kc([zc(Ra),Zc("design:type",Object)],Ll.prototype,"contextService",void 0),Kc([zc(Oa),Zc("design:type",Object)],Ll.prototype,"renderingContext",void 0),Kc([zc(da),Zc("design:type",Object)],Ll.prototype,"sceneGraphService",void 0),Kc([zc(fl),Zc("design:type",Function)],Ll.prototype,"elementRendererFactory",void 0),Ll=Ol=Kc([Xc()],Ll),ku.registerComponent(Yc);var Wl=new Uc((function(t,e,n,r){t(rl).toSelf().inSingletonScope(),t(il).toSelf().inSingletonScope(),t(ol).toSelf().inSingletonScope(),t(al).toSelf().inSingletonScope(),t(ll).toSelf().inSingletonScope(),t(hl).toSelf().inSingletonScope(),t(fl).toFactory((function(t){return function(e){return e===Go.Rect?t.container.get(rl):e===Go.Image?t.container.get(il):e===Go.Line?t.container.get(ol):e===Go.Polyline||e===Go.Polygon?t.container.get(al):e===Go.Text?t.container.get(ll):e===Go.Path?t.container.get(hl):null}})),t(Ll).toSelf().inSingletonScope(),t(Ia).toService(Ll)})),$l=function(){function t(){Cc(this,t)}return Rc(t,[{key:"init",value:function(t){t.load(Wl)}},{key:"destroy",value:function(t){t.unload(Wl)}}]),t}();function Gl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Vl(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 Hl(t,e,n){return e&&Vl(t.prototype,e),n&&Vl(t,n),t}var ql="inversify:paramtypes",zl=0;var Ul=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 Xl(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 Yl(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 Ul("inject",t);"number"==typeof r?function(t,e,n,r){Xl("inversify:tagged",t,e,r,n)}(e,n,r,i):function(t,e,n){Xl("inversify:tagged_props",t.constructor,e,n)}(e,n,i)}}var Kl,Zl,Ql,Jl=function(t){this.id=zl++,this.registry=t};
75
+ /*! *****************************************************************************
76
+ Copyright (c) Microsoft Corporation.
77
+
78
+ Permission to use, copy, modify, and/or distribute this software for any
79
+ purpose with or without fee is hereby granted.
80
+
81
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
82
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
83
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
84
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
85
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
86
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
87
+ PERFORMANCE OF THIS SOFTWARE.
88
+ ***************************************************************************** */
89
+ function th(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 eh(t,e){if("object"===("undefined"==typeof Reflect?"undefined":i(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var nh=(Zl=Kl=function(){function t(){Gl(this,t),this.sceneGraphService=void 0,this.displayObjectPool=void 0}return Hl(t,[{key:"apply",value:function(t){var e=this;t.hooks.pick.tap(Ql.tag,(function(t){var n=t.position,r=n.clientX,i=n.clientY;try{var o=document.elementFromPoint(r,i),a=null,s=o&&o.getAttribute("id");if(s){var u=s.lastIndexOf("_");(a=e.displayObjectPool.getByName(s.substring(u+1))).interactive||(a=null)}t.picked=a}catch(e){t.picked=null}return t}))}}]),t}(),Kl.tag="SVGPickerPlugin",Ql=Zl);th([Yl(da),eh("design:type",Object)],nh.prototype,"sceneGraphService",void 0),th([Yl(ea),eh("design:type",ea)],nh.prototype,"displayObjectPool",void 0),nh=Ql=th([function(t){if(Reflect.hasOwnMetadata(ql,t))throw Error("Cannot apply @injectable decorator multiple times.");var e=Reflect.getMetadata("design:paramtypes",t)||[];return Reflect.defineMetadata(ql,e,t),t}],nh);var rh=new Jl((function(t,e,n,r){t(nh).toSelf().inSingletonScope(),t(Ia).toService(nh)})),ih=function(){function t(){Gl(this,t)}return Hl(t,[{key:"init",value:function(t){t.load(rh)}},{key:"destroy",value:function(t){t.unload(rh)}}]),t}();
90
+ /*! *****************************************************************************
91
+ Copyright (c) Microsoft Corporation.
92
+
93
+ Permission to use, copy, modify, and/or distribute this software for any
94
+ purpose with or without fee is hereby granted.
95
+
96
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
97
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
98
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
99
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
100
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
101
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
102
+ PERFORMANCE OF THIS SOFTWARE.
103
+ ***************************************************************************** */
104
+ function oh(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 ah=function(){function t(){o(this,t),this.$container=void 0,this.$namespace=void 0,this.dpr=void 0,this.canvasConfig=void 0}return s(t,[{key:"init",value:function(){var t=this.canvasConfig.container;if(this.$container=b(t)?document.getElementById(t):t,this.$container){this.$container.style.position||(this.$container.style.position="relative");var e=xl("svg");e.setAttribute("width","".concat(this.canvasConfig.width)),e.setAttribute("height","".concat(this.canvasConfig.height)),this.$container.appendChild(e),this.$namespace=e}var n=window.devicePixelRatio||1;this.dpr=n=1>n?1:Math.ceil(n)}},{key:"getDomElement",value:function(){return this.$namespace}},{key:"getContext",value:function(){return this.$namespace}},{key:"getDPR",value:function(){return this.dpr}},{key:"getBoundingClientRect",value:function(){var t;return null===(t=this.$namespace)||void 0===t?void 0:t.getBoundingClientRect()}},{key:"destroy",value:function(){this.$container&&this.$namespace&&this.$namespace.parentNode&&this.$container.removeChild(this.$namespace)}},{key:"resize",value:function(t,e){this.$namespace&&(this.$namespace.setAttribute("width","".concat(t)),this.$namespace.setAttribute("height","".concat(e)))}},{key:"applyCursorStyle",value:function(t){this.$container&&(this.$container.style.cursor=t)}}]),t}();oh([Tt(zo),function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}("design:type",Object)],ah.prototype,"canvasConfig",void 0),ah=oh([ae()],ah);var sh=new oe((function(t,e,n,r){t(ah).toSelf().inSingletonScope(),t(Ra).toService(ah)})),uh=function(){function t(){o(this,t)}return s(t,[{key:"init",value:function(t){t.load(sh)}},{key:"destroy",value:function(t){t.unload(sh)}}]),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 uh),r.registerPlugin(new $l),r.registerPlugin(new mc),r.registerPlugin(new ih),r}return n}(_u),Object.defineProperty(t,"__esModule",{value:!0})}));