@geometryzen/two
Version:
Template TypeScript Library
1 lines • 109 kB
JavaScript
System.register([],(function(t){"use strict";return{execute:function(){var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},e(t,i)};function i(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}function s(t,e,i,s){return new(i||(i=Promise))((function(n,r){function h(t){try{a(s.next(t))}catch(t){r(t)}}function o(t){try{a(s.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(h,o)}a((s=s.apply(t,e||[])).next())}))}function n(t,e){var i,s,n,r,h={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return r={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function o(o){return function(a){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;r&&(r=0,o[0]&&(h=0)),h;)try{if(i=1,s&&(n=2&o[0]?s.return:o[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,o[1])).done)return n;switch(s=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return h.label++,{value:o[1],done:!1};case 5:h.label++,s=o[1],o=[0];continue;case 7:o=h.ops.pop(),h.trys.pop();continue;default:if(!(n=h.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){h=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){h.label=o[1];break}if(6===o[0]&&h.label<n[1]){h.label=n[1],n=o;break}if(n&&h.label<n[2]){h.label=n[2],h.ops.push(o);break}n[2]&&h.ops.pop(),h.trys.pop();continue}o=e.call(t,h)}catch(t){o=[6,t],s=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}function r(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],s=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var s,n,r=i.call(t),h=[];try{for(;(void 0===e||e-- >0)&&!(s=r.next()).done;)h.push(s.value)}catch(t){n={error:t}}finally{try{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return h}function o(t,e,i){if(i||2===arguments.length)for(var s,n=0,r=e.length;n<r;n++)!s&&n in e||(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return t.concat(s||Array.prototype.slice.call(e))}function a(t){return this instanceof a?(this.v=t,this):new a(t)}function l(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s,n=i.apply(t,e||[]),r=[];return s={},h("next"),h("throw"),h("return"),s[Symbol.asyncIterator]=function(){return this},s;function h(t){n[t]&&(s[t]=function(e){return new Promise((function(i,s){r.push([t,e,i,s])>1||o(t,e)}))})}function o(t,e){try{(i=n[t](e)).value instanceof a?Promise.resolve(i.value.v).then(l,c):u(r[0][2],i)}catch(t){u(r[0][3],t)}var i}function l(t){o("next",t)}function c(t){o("throw",t)}function u(t,e){t(e),r.shift(),r.length&&o(r[0][0],r[0][1])}}function c(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,i=t[Symbol.asyncIterator];return i?i.call(t):(t=r(t),e={},s("next"),s("throw"),s("return"),e[Symbol.asyncIterator]=function(){return this},e);function s(i){e[i]=t[i]&&function(e){return new Promise((function(s,n){(function(t,e,i,s){Promise.resolve(s).then((function(e){t({value:e,done:i})}),e)})(s,n,(e=t[i](e)).done,e.value)}))}}}function u(t){return"function"==typeof t}function f(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}"function"==typeof SuppressedError&&SuppressedError;var g=f((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}));function d(t,e){if(t){var i=t.indexOf(e);0<=i&&t.splice(i,1)}}var _=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,i,s,n;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var l=r(a),c=l.next();!c.done;c=l.next()){c.value.remove(this)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(e=l.return)&&e.call(l)}finally{if(t)throw t.error}}else a.remove(this);var f=this.initialTeardown;if(u(f))try{f()}catch(t){n=t instanceof g?t.errors:[t]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var _=r(d),p=_.next();!p.done;p=_.next()){var m=p.value;try{b(m)}catch(t){n=null!=n?n:[],t instanceof g?n=o(o([],h(n)),h(t.errors)):n.push(t)}}}catch(t){i={error:t}}finally{try{p&&!p.done&&(s=_.return)&&s.call(_)}finally{if(i)throw i.error}}}if(n)throw new g(n)}},t.prototype.add=function(e){var i;if(e&&e!==this)if(this.closed)b(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(i=this._finalizers)&&void 0!==i?i:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&d(e,t)},t.prototype.remove=function(e){var i=this._finalizers;i&&d(i,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}(),p=_.EMPTY;function m(t){return t instanceof _||t&&"closed"in t&&u(t.remove)&&u(t.add)&&u(t.unsubscribe)}function b(t){u(t)?t():t.unsubscribe()}var y={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},v={setTimeout:function(t,e){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];return setTimeout.apply(void 0,o([t,e],h(i)))},clearTimeout:function(t){var e=v.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function w(t){v.setTimeout((function(){throw t}))}function x(){}function k(t){t()}var I=function(t){function e(e){var i=t.call(this)||this;return i.isStopped=!1,e?(i.destination=e,m(e)&&e.add(i)):i.destination=C,i}return i(e,t),e.create=function(t,e,i){return new M(t,e,i)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(_),A=Function.prototype.bind;function S(t,e){return A.call(t,e)}var R=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){E(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){E(t)}else E(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){E(t)}},t}(),M=function(t){function e(e,i,s){var n,r,h=t.call(this)||this;u(e)||!e?n={next:null!=e?e:void 0,error:null!=i?i:void 0,complete:null!=s?s:void 0}:h&&y.useDeprecatedNextContext?((r=Object.create(e)).unsubscribe=function(){return h.unsubscribe()},n={next:e.next&&S(e.next,r),error:e.error&&S(e.error,r),complete:e.complete&&S(e.complete,r)}):n=e;return h.destination=new R(n),h}return i(e,t),e}(I);function E(t){w(t)}var C={closed:!0,next:x,error:function(t){throw t},complete:x},$="function"==typeof Symbol&&Symbol.observable||"@@observable";function O(t){return t}var L=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var i=new t;return i.source=this,i.operator=e,i},t.prototype.subscribe=function(t,e,i){var s,n=this,r=(s=t)&&s instanceof I||function(t){return t&&u(t.next)&&u(t.error)&&u(t.complete)}(s)&&m(s)?t:new M(t,e,i);return k((function(){var t=n,e=t.operator,i=t.source;r.add(e?e.call(r,i):i?n._subscribe(r):n._trySubscribe(r))})),r},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var i=this;return new(e=F(e))((function(e,s){var n=new M({next:function(e){try{t(e)}catch(t){s(t),n.unsubscribe()}},error:s,complete:e});i.subscribe(n)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[$]=function(){return this},t.prototype.pipe=function(){for(var t,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return(0===(t=e).length?O:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)})(this)},t.prototype.toPromise=function(t){var e=this;return new(t=F(t))((function(t,i){var s;e.subscribe((function(t){return s=t}),(function(t){return i(t)}),(function(){return t(s)}))}))},t.create=function(e){return new t(e)},t}();function F(t){var e;return null!==(e=null!=t?t:y.Promise)&&void 0!==e?e:Promise}function z(t){return function(e){if(function(t){return u(null==t?void 0:t.lift)}(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}function P(t,e,i,s,n){return new T(t,e,i,s,n)}var T=function(t){function e(e,i,s,n,r,h){var o=t.call(this,e)||this;return o.onFinalize=r,o.shouldUnsubscribe=h,o._next=i?function(t){try{i(t)}catch(t){e.error(t)}}:t.prototype._next,o._error=n?function(t){try{n(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,o._complete=s?function(){try{s()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,o}return i(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var i=this.closed;t.prototype.unsubscribe.call(this),!i&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(I),j=f((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),N=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return i(e,t),e.prototype.lift=function(t){var e=new V(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new j},e.prototype.next=function(t){var e=this;k((function(){var i,s;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var n=r(e.currentObservers),h=n.next();!h.done;h=n.next()){h.value.next(t)}}catch(t){i={error:t}}finally{try{h&&!h.done&&(s=n.return)&&s.call(n)}finally{if(i)throw i.error}}}}))},e.prototype.error=function(t){var e=this;k((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var i=e.observers;i.length;)i.shift().error(t)}}))},e.prototype.complete=function(){var t=this;k((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,i=this,s=i.hasError,n=i.isStopped,r=i.observers;return s||n?p:(this.currentObservers=null,r.push(t),new _((function(){e.currentObservers=null,d(r,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,i=e.hasError,s=e.thrownError,n=e.isStopped;i?t.error(s):n&&t.complete()},e.prototype.asObservable=function(){var t=new L;return t.source=this,t},e.create=function(t,e){return new V(t,e)},e}(L),V=function(t){function e(e,i){var s=t.call(this)||this;return s.destination=e,s.source=i,s}return i(e,t),e.prototype.next=function(t){var e,i;null===(i=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===i||i.call(e,t)},e.prototype.error=function(t){var e,i;null===(i=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===i||i.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,i;return null!==(i=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==i?i:p},e}(N),B=function(t){function e(e){var i=t.call(this)||this;return i._value=e,i}return i(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(e){var i=t.prototype._subscribe.call(this,e);return!i.closed&&e.next(this._value),i},e.prototype.getValue=function(){var t=this,e=t.hasError,i=t.thrownError,s=t._value;if(e)throw i;return this._throwIfClosed(),s},e.prototype.next=function(e){t.prototype.next.call(this,this._value=e)},e}(N),H=function(){return Date.now()},U=function(t){function e(e,i){return t.call(this)||this}return i(e,t),e.prototype.schedule=function(t,e){return this},e}(_),q={setInterval:function(t,e){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];return setInterval.apply(void 0,o([t,e],h(i)))},clearInterval:function(t){var e=q.delegate;return((null==e?void 0:e.clearInterval)||clearInterval)(t)},delegate:void 0},W=function(t){function e(e,i){var s=t.call(this,e,i)||this;return s.scheduler=e,s.work=i,s.pending=!1,s}return i(e,t),e.prototype.schedule=function(t,e){var i;if(void 0===e&&(e=0),this.closed)return this;this.state=t;var s=this.id,n=this.scheduler;return null!=s&&(this.id=this.recycleAsyncId(n,s,e)),this.pending=!0,this.delay=e,this.id=null!==(i=this.id)&&void 0!==i?i:this.requestAsyncId(n,this.id,e),this},e.prototype.requestAsyncId=function(t,e,i){return void 0===i&&(i=0),q.setInterval(t.flush.bind(t,this),i)},e.prototype.recycleAsyncId=function(t,e,i){if(void 0===i&&(i=0),null!=i&&this.delay===i&&!1===this.pending)return e;null!=e&&q.clearInterval(e)},e.prototype.execute=function(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(t,e);if(i)return i;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,e){var i,s=!1;try{this.work(t)}catch(t){s=!0,i=t||new Error("Scheduled action threw falsy error")}if(s)return this.unsubscribe(),i},e.prototype.unsubscribe=function(){if(!this.closed){var e=this.id,i=this.scheduler,s=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,d(s,this),null!=e&&(this.id=this.recycleAsyncId(i,e,null)),this.delay=null,t.prototype.unsubscribe.call(this)}},e}(U),Y=function(){function t(e,i){void 0===i&&(i=t.now),this.schedulerActionCtor=e,this.now=i}return t.prototype.schedule=function(t,e,i){return void 0===e&&(e=0),new this.schedulerActionCtor(this,t).schedule(i,e)},t.now=H,t}(),X=new(function(t){function e(e,i){void 0===i&&(i=Y.now);var s=t.call(this,e,i)||this;return s.actions=[],s._active=!1,s}return i(e,t),e.prototype.flush=function(t){var e=this.actions;if(this._active)e.push(t);else{var i;this._active=!0;do{if(i=t.execute(t.state,t.delay))break}while(t=e.shift());if(this._active=!1,i){for(;t=e.shift();)t.unsubscribe();throw i}}},e}(Y))(W),D=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};var G="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function J(t){if(t instanceof L)return t;if(null!=t){if(function(t){return u(t[$])}(t))return h=t,new L((function(t){var e=h[$]();if(u(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(D(t))return function(t){return new L((function(e){for(var i=0;i<t.length&&!e.closed;i++)e.next(t[i]);e.complete()}))}(t);if(u(null==(s=t)?void 0:s.then))return i=t,new L((function(t){i.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,w)}));if(function(t){return Symbol.asyncIterator&&u(null==t?void 0:t[Symbol.asyncIterator])}(t))return Z(t);if(function(t){return u(null==t?void 0:t[G])}(t))return e=t,new L((function(t){var i,s;try{for(var n=r(e),h=n.next();!h.done;h=n.next()){var o=h.value;if(t.next(o),t.closed)return}}catch(t){i={error:t}}finally{try{h&&!h.done&&(s=n.return)&&s.call(n)}finally{if(i)throw i.error}}t.complete()}));if(function(t){return u(null==t?void 0:t.getReader)}(t))return Z(function(t){return l(this,arguments,(function(){var e,i,s;return n(this,(function(n){switch(n.label){case 0:e=t.getReader(),n.label=1;case 1:n.trys.push([1,,9,10]),n.label=2;case 2:return[4,a(e.read())];case 3:return i=n.sent(),s=i.value,i.done?[4,a(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,a(s)];case 6:return[4,n.sent()];case 7:return n.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}}))}))}(t))}var e,i,s,h;throw function(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}(t)}function Z(t){return new L((function(e){(function(t,e){var i,r,h,o;return s(this,void 0,void 0,(function(){var s,a;return n(this,(function(n){switch(n.label){case 0:n.trys.push([0,5,6,11]),i=c(t),n.label=1;case 1:return[4,i.next()];case 2:if((r=n.sent()).done)return[3,4];if(s=r.value,e.next(s),e.closed)return[2];n.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=n.sent(),h={error:a},[3,11];case 6:return n.trys.push([6,,9,10]),r&&!r.done&&(o=i.return)?[4,o.call(i)]:[3,8];case 7:n.sent(),n.label=8;case 8:return[3,10];case 9:if(h)throw h.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))}))})(t,e).catch((function(t){return e.error(t)}))}))}function K(t,e){return z((function(i,s){var n=0;i.subscribe(P(s,(function(i){s.next(t.call(e,i,n++))})))}))}var Q=Array.isArray;function tt(t){return K((function(e){return function(t,e){return Q(e)?t.apply(void 0,o([],h(e))):t(e)}(t,e)}))}function et(t,e,i){return void 0===i&&(i=1/0),u(e)?et((function(i,s){return K((function(t,n){return e(i,t,s,n)}))(J(t(i,s)))}),i):("number"==typeof e&&(i=e),z((function(e,s){return function(t,e,i,s,n,r,h,o){var a=[],l=0,c=0,u=!1,f=function(){!u||a.length||l||e.complete()},g=function(t){return l<s?d(t):a.push(t)},d=function(t){r&&e.next(t),l++;var o=!1;J(i(t,c++)).subscribe(P(e,(function(t){null==n||n(t),r?g(t):e.next(t)}),(function(){o=!0}),void 0,(function(){if(o)try{l--;for(var t=function(){var t=a.shift();h?function(t,e,i,s,n){void 0===s&&(s=0),void 0===n&&(n=!1);var r=e.schedule((function(){i(),n?t.add(this.schedule(null,s)):this.unsubscribe()}),s);t.add(r)}(e,h,(function(){return d(t)})):d(t)};a.length&&l<s;)t();f()}catch(t){e.error(t)}})))};return t.subscribe(P(e,g,(function(){u=!0,f()}))),function(){null==o||o()}}(e,s,t,i)})))}var it=["addListener","removeListener"],st=["addEventListener","removeEventListener"],nt=["on","off"];function rt(t,e,i,s){if(u(i)&&(s=i,i=void 0),s)return rt(t,e,i).pipe(tt(s));var n=h(function(t){return u(t.addEventListener)&&u(t.removeEventListener)}(t)?st.map((function(s){return function(n){return t[s](e,n,i)}})):function(t){return u(t.addListener)&&u(t.removeListener)}(t)?it.map(ht(t,e)):function(t){return u(t.on)&&u(t.off)}(t)?nt.map(ht(t,e)):[],2),r=n[0],o=n[1];if(!r&&D(t))return et((function(t){return rt(t,e,i)}))(J(t));if(!r)throw new TypeError("Invalid event target");return new L((function(t){var e=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return t.next(1<e.length?e:e[0])};return r(e),function(){return o(e)}}))}function ht(t,e){return function(i){return function(s){return t[i](e,s)}}}const ot="M",at="L",lt="C",ct="A",ut="Z";class ft{#t;#e;#i;#s;#n;change$;constructor(t=0,e=0,i=0,s=0){this.#e=t,this.#i=e,this.#t=i,this.#s=s,this.#n=new B(this),this.change$=this.#n.asObservable()}get a(){return this.#t}set a(t){this.a!==t&&(this.#t=t,this.#n.next(this))}get x(){return this.#e}set x(t){this.x!==t&&(this.#e=t,this.#n.next(this))}get y(){return this.#i}set y(t){this.y!==t&&(this.#i=t,this.#n.next(this))}get b(){return this.#s}set b(t){this.b!==t&&(this.#s=t,this.#n.next(this))}static one=new ft(0,0,1,0);static zero=new ft(0,0);static left=new ft(-1,0);static right=new ft(1,0);static up=new ft(0,-1);static down=new ft(0,1);static I=new ft(0,0,0,1);static add(t,e){const i=t.x+e.x,s=t.y+e.y,n=t.a+e.a,r=t.b+e.b;return new ft(i,s,n,r)}static sub(t,e){const i=t.x-e.x,s=t.y-e.y,n=t.a-e.a,r=t.b-e.b;return new ft(i,s,n,r)}static subtract(t,e){return ft.sub(t,e)}static ratioBetween(t,e){return(t.x*e.x+t.y*e.y)/(t.length()*e.length())}static angleBetween(t,e){const i=t.x-e.x,s=t.y-e.y;return Math.atan2(s,i)}static distanceBetween(t,e){return Math.sqrt(ft.distanceBetweenSquared(t,e))}static distanceBetweenSquared(t,e){const i=t.x-e.x,s=t.y-e.y;return i*i+s*s}copy(t){return this.set(t.x,t.y,t.a,t.b)}clear(){return this.set(0,0,0,0)}clone(){return new ft(this.x,this.y,this.a,this.b)}add(t){const e=this.x+t.x,i=this.y+t.y,s=this.a+t.a,n=this.b+t.b;return this.set(e,i,s,n)}sub(t){const e=this.x-t.x,i=this.y-t.y,s=this.a-t.a,n=this.b-t.b;return this.set(e,i,s,n)}multiplyScalar(t){const e=this.x*t,i=this.y*t,s=this.a*t,n=this.b*t;return this.set(e,i,s,n)}divideScalar(t){const e=this.x/t,i=this.y/t,s=this.a/t,n=this.b/t;return this.set(e,i,s,n)}negate(){return this.multiplyScalar(-1)}dot(t){return this.x*t.x+this.y*t.y}exp(){const t=this.a,e=this.b,i=Math.exp(t),s=Math.sqrt(e*e),n=i*(0!==s?Math.sin(s)/s:1),r=i*Math.cos(s),h=e*n;return this.set(0,0,r,h)}length(){return Math.sqrt(this.lengthSquared())}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return this.divideScalar(this.length())}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}set(t,e,i=0,s=0){const n=this.x!==t||this.y!==e||this.a!==i||this.b!=s;return this.#e=t,this.#i=e,this.#t=i,this.#s=s,n&&this.#n.next(this),this}setLength(t){return this.normalize().multiplyScalar(t)}equals(t,e){return e=void 0===e?1e-4:e,this.distanceTo(t)<e}lerp(t,e){const i=(t.x-this.x)*e+this.x,s=(t.y-this.y)*e+this.y,n=(t.a-this.a)*e+this.a,r=(t.b-this.b)*e+this.b;return this.set(i,s,n,r)}isZero(t){return t=void 0===t?1e-4:t,this.length()<t}toString(){return this.x+", "+this.y}rotate(t){const e=this.x,i=this.y,s=Math.cos(t),n=Math.sin(t),r=e*s-i*n,h=e*n+i*s;return this.set(r,h,this.a,this.b)}}t("Vector",ft);class gt{origin=new ft;#r=null;controls={left:new ft,right:new ft};#h=null;#o=null;#a;#l;#c;#u;#f;#g;#d;#n;change$;#_;constructor(t=0,e=0,i=0,s=0,n=0,r=0,h=ot){this.origin.set(t,e),this.controls.left.set(i,s),this.controls.right.set(n,r),this.#a=h,this.#l=!0,this.#c=0,this.#u=0,this.#f=0,this.#g=0,this.#d=1,this.#_=0,this.#n=new B(this),this.change$=this.#n.asObservable(),this.#r=this.origin.change$.subscribe((()=>{this.#n.next(this)})),this.#h=this.controls.left.change$.subscribe((()=>{this.#n.next(this)})),this.#o=this.controls.right.change$.subscribe((()=>{this.#n.next(this)}))}dispose(){this.#r&&(this.#r.unsubscribe(),this.#r=null),this.#h&&(this.#h.unsubscribe(),this.#h=null),this.#o&&(this.#o.unsubscribe(),this.#o=null)}get x(){return this.origin.x}set x(t){this.origin.x=t}get y(){return this.origin.y}set y(t){this.origin.y=t}get t(){return this.#_}set t(t){this.t!==t&&(this.#_=t)}copy(t){return this.origin.copy(t.origin),this.command=t.command,this.controls.left.copy(t.controls.left),this.controls.right.copy(t.controls.right),this.relative=t.relative,this.rx=t.rx,this.ry=t.ry,this.xAxisRotation=t.xAxisRotation,this.largeArcFlag=t.largeArcFlag,this.sweepFlag=t.sweepFlag,this}ignore(){throw new Error("TODO: Anchor.ignore()")}listen(){}get command(){return this.#a}set command(t){this.command!==t&&(this.#a=t)}get relative(){return this.#l}set relative(t){this.relative!==!!t&&(this.#l=t)}get rx(){return this.#c}set rx(t){this.rx!==t&&(this.#c=t)}get ry(){return this.#u}set ry(t){this.ry!==t&&(this.#u=t)}get xAxisRotation(){return this.#f}set xAxisRotation(t){this.xAxisRotation!==t&&(this.#f=t)}get largeArcFlag(){return this.#g}set largeArcFlag(t){this.largeArcFlag!==t&&(this.#g=t)}get sweepFlag(){return this.#d}set sweepFlag(t){this.sweepFlag!==t&&(this.#d=t)}}t("Anchor",gt);class dt{#p;insert$;#m;remove$;#b;order$;#y;constructor(t){this.#y=t,this.#p=new N,this.insert$=this.#p.asObservable(),this.#m=new N,this.remove$=this.#m.asObservable(),this.#b=new N,this.order$=this.#b.asObservable()}forEach(t,e){this.#y.forEach(t,e)}get length(){return this.#y.length}getAt(t){return this.#y[t]}get(){return this.#y}ping(){this.#p.next(this.#y)}pop(){const t=this.#y.pop();return this.#m.next([t]),t}shift(){const t=this.#y.shift();return this.#m.next([t]),t}push(...t){const e=this.#y.push(...t);return this.#p.next(t),e}unshift(...t){const e=this.#y.unshift();return this.#p.next(t),e}splice(t,e,...i){if("number"==typeof e){const s=this.#y.splice(t,e,...i);return this.#m.next(s),s}{const e=this.#y.splice(t);return this.#m.next(e),e}}sort(t){return this.#y.sort(t),this.#b.next(),this}reverse(){return this.#y.reverse(),this.#b.next(),this}indexOf(t,e){return this.#y.indexOf(t,e)}map(t,e){return this.#y.map(t,e)}}class _t extends dt{ids={};#v={};#w;#x;constructor(t){super(t),this.#k(t),this.#w=this.insert$.subscribe((t=>{this.#k(t)})),this.#x=this.remove$.subscribe((t=>{this.#I(t)}))}dispose(){this.#w.unsubscribe(),this.#x.unsubscribe()}#k(t){for(let e=0;e<t.length;e++){const i=t[e];i&&i.id&&(this.ids[i.id]=i),this.#v[i.id]=i.id$.subscribe((({id:t,previous_id:e})=>{e&&(delete this.ids[e],this.#v[t]=this.#v[e],delete this.#v[e]),this.ids[t]=i}))}return this}#I(t){for(let e=0;e<t.length;e++){const i=t[e];this.#v[i.id].unsubscribe(),delete this.#v[i.id],delete this.ids[i.id]}return this}}let pt=0;const mt="two-",bt=12,yt=function(){return pt++};class vt{isShape;parent;_flagId=!1;_flagClassName=!1;viewInfo={};_id=null;#A;id$;_className="";classList=[];constructor(){this.#A=new N,this.id$=this.#A.asObservable()}flagReset(){this._flagId=this._flagClassName=!1}get renderer(){return this.viewInfo}set renderer(t){this.viewInfo=t}get id(){return this._id}set id(t){const e=this.id;t!==e&&(this._id=t,this._flagId=!0,this.#A.next({id:t,previous_id:e}))}get className(){return this._className}set className(t){this._className!==t&&(this._flagClassName=!0,this.classList=t.split(/\s+?/),this._className=t)}}t("Element",vt);class wt extends vt{_flagOffset=!0;_flagOpacity=!0;_flagColor=!0;_offset=0;_opacity=1;_color="#fff";#n;change$;constructor(t,e,i){super(),this.offset="number"==typeof t?t:wt.Index<=0?0:1,this.opacity="number"==typeof i?i:1,this.color="string"==typeof e?e:wt.Index<=0?"#fff":"#000",wt.Index=(wt.Index+1)%2,this.#n=new B(this),this.change$=this.#n.asObservable()}static Index=0;static Properties=["offset","opacity","color"];flagReset(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,super.flagReset.call(this),this}get color(){return this._color}set color(t){this._color=t,this._flagColor=!0,this.parent&&(this.parent._flagStops=!0),this.#n.next(this)}get offset(){return this._offset}set offset(t){this._offset=t,this._flagOffset=!0,this.parent&&(this.parent._flagStops=!0),this.#n.next(this)}get opacity(){return this._opacity}set opacity(t){this._opacity=t,this._flagOpacity=!0,this.parent&&(this.parent._flagStops=!0),this.#n.next(this)}}t("Stop",wt);class xt extends vt{_flagStops=!1;_flagSpread=!1;_flagUnits=!1;_spread=null;_units=null;_stops=null;_stops_insert=null;_stops_remove=null;_change;change$;_stop_subscriptions={};constructor(t){super(),this.id=mt+yt(),this.classList=[],this.spread="pad",this.units="objectBoundingBox",this.#S(t),this._change=new B(this),this.change$=this._change.asObservable()}dispose(){this.#R()}#S(t){this._stops=new _t((t||[]).slice(0)),this._stops_insert=this._stops.insert$.subscribe((t=>{let e=t.length;for(;e--;){const i=t[e];this._stop_subscriptions[i.id]=i.change$.subscribe((()=>{this._flagStops=!0})),i.parent=this}})),this._stops_remove=this._stops.remove$.subscribe((t=>{let e=t.length;for(;e--;){const i=t[e];this._stop_subscriptions[i.id].unsubscribe(),delete this._stop_subscriptions[i.id],delete t[e].parent}})),this._stops.ping()}#R(){this._stops_insert&&(this._stops_insert.unsubscribe(),this._stops_insert=null),this._stops_remove&&(this._stops_remove.unsubscribe(),this._stops_remove=null),this._stops&&(this._stops.dispose(),this._stops=null)}static Stop=wt;static Properties=["spread","stops","renderer","units"];_update(t=!1){return(this._flagSpread||this._flagStops)&&this._change.next(this),this}flagReset(){return this._flagSpread=this._flagUnits=this._flagStops=!1,super.flagReset.call(this),this}get spread(){return this._spread}set spread(t){this._spread=t,this._flagSpread=!0}get stops(){return this._stops.get()}set stops(t){this.#R(),this.#S(t)}get units(){return this._units}set units(t){this._units=t,this._flagUnits=!0}}t("Gradient",xt);class kt extends xt{_flagEndPoints=!1;#M=null;#E=null;#C=null;#$=null;constructor(t=0,e=0,i=0,s=0,n=[]){super(n),this.viewInfo.type="linear-gradient",this.left=new ft(t,e),this.right=new ft(i,s)}static Properties=["left","right"];static Stop=wt;_update(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this._change.next(this),this}flagReset(){return this._flagEndPoints=!1,super.flagReset.call(this),this}get left(){return this.#M}set left(t){this.#E&&(this.#E.unsubscribe(),this.#E=null),this.#M=t,this.#E=this.#M.change$.subscribe((()=>{this._flagEndPoints=!0})),this._flagEndPoints=!0}get right(){return this.#C}set right(t){this.#$&&(this.#$.unsubscribe(),this.#$=null),this.#C=t,this.#$=this.#C.change$.subscribe((()=>{this._flagEndPoints=!0})),this._flagEndPoints=!0}}t("LinearGradient",kt);class It extends xt{_flagRadius=!1;_flagCenter=!1;_flagFocal=!1;#O=0;#L=null;#F=null;#z=null;#P=null;constructor(t=0,e=0,i=1,s=[],n,r){super(s),this.viewInfo.type="radial-gradient",this.center=new ft(t,e),this.radius=i,this.focal=new ft(n,r),this.focal.copy(this.center),"number"==typeof n&&(this.focal.x=n),"number"==typeof r&&(this.focal.y=r)}static Stop=wt;static Properties=["center","radius","focal"];_update(){return(this._flagRadius||this._flagCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this._change.next(this),this}flagReset(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,super.flagReset.call(this),this}get center(){return this.#L}set center(t){this.#F&&(this.#F.unsubscribe(),this.#F=null),this.#L=t,this.#F=this.#L.change$.subscribe((()=>{this._flagCenter=!0})),this._flagCenter=!0}get focal(){return this.#z}set focal(t){this.#P&&(this.#P.unsubscribe(),this.#P=null),this.#z=t,this.#P=this.#z.change$.subscribe((()=>{this._flagFocal=!0})),this._flagFocal=!0}get radius(){return this.#O}set radius(t){this.#O=t,this._flagRadius=!0}}let At;t("RadialGradient",It),"undefined"!=typeof window?At=window:"undefined"!=typeof global?At=global:"undefined"!=typeof self&&(At=self);const St=2*Math.PI,Rt=.5*Math.PI;function Mt(t,e,i){return i*(e-t)+t}function Et(t,e){for(;t<0;)t+=e;return t%e}const Ct=At.Float32Array||Array,$t=Math.floor;function Ot(t){return $t(1e6*t)/1e6}const Lt=At.performance&&At.performance.now?At.performance:Date;class Ft{map={};constructor(){}add(t,e){return this.map[t]=e,this}remove(t){return delete this.map[t],this}get(t){return this.map[t]}contains(t){return t in this.map}}function zt(t){return"canvas"===(t&&t.nodeName&&t.nodeName.toLowerCase())}function Pt(t){return"img"===(t&&t.nodeName&&t.nodeName.toLowerCase())}function Tt(t){return"video"===(t&&t.nodeName&&t.nodeName.toLowerCase())}let jt=null;const Nt={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};At.document&&(jt=document.createElement("a"));class Vt extends vt{_flagSrc=!1;_flagImage=!1;_flagVideo=!1;_flagLoaded=!1;_flagRepeat=!1;_flagOffset=!1;_flagScale=!1;_src="";_image=null;_loaded=!1;_repeat="no-repeat";_scale=1;#T=null;_offset=null;#j=null;#n;change$;#N;loaded$;constructor(t,e){if(super(),this.viewInfo={},this.viewInfo.type="texture",this.id=mt+yt(),this.classList=[],this.loaded=!1,this.repeat="no-repeat",this.offset=new ft,this.#N=new B(this),this.loaded$=this.#n.asObservable(),"function"==typeof e){const t=()=>{i.unsubscribe(),e()},i=this.loaded$.subscribe(t)}if("string"==typeof t)this.src=t;else if("object"==typeof t){const e=Object.prototype.toString.call(t);"[object HTMLImageElement]"!==e&&"[object HTMLCanvasElement]"!==e&&"[object HTMLVideoElement]"!==e&&"[object Image]"!==e||(this.image=t)}this.#n=new B(this),this.change$=this.#n.asObservable(),this._update()}static Properties=["src","loaded","repeat","scale","offset","image"];static RegularExpressions=Nt;static ImageRegistry=new Ft;static getAbsoluteURL(t){return jt?(jt.href=t,jt.href):t}static getTag(t){return t&&t.nodeName&&t.nodeName.toLowerCase()||"img"}static getImage(t){const e=Vt.getAbsoluteURL(t);if(Vt.ImageRegistry.contains(e))return Vt.ImageRegistry.get(e);let i;return At.document?i=Nt.video.test(e)?document.createElement("video"):document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),i.crossOrigin="anonymous",i instanceof HTMLImageElement&&(i.referrerPolicy="no-referrer"),i}static Register={canvas:function(t,e){t._src="#"+t.id,Vt.ImageRegistry.add(t.src,t.image),"function"==typeof e&&e()},img:function(t,e){const i=t.image,s=function(){i.removeEventListener&&"function"==typeof i.removeEventListener&&(i.removeEventListener("load",s,!1),i.removeEventListener("error",n,!1)),"function"==typeof e&&e()},n=function(){throw"function"==typeof i.removeEventListener&&(i.removeEventListener("load",s,!1),i.removeEventListener("error",n,!1)),new Error("unable to load "+t.src)};"number"==typeof i.width&&i.width>0&&"number"==typeof i.height&&i.height>0?s():"function"==typeof i.addEventListener&&(i.addEventListener("load",s,!1),i.addEventListener("error",n,!1)),t._src=Vt.getAbsoluteURL(t._src),i&&i.getAttribute("two-src")||(i.setAttribute("two-src",t.src),Vt.ImageRegistry.add(t.src,i),zt(t.image)||(Pt(t.image)||Tt(t.image))&&(t.image.src=t.src))},video:function(t,e){const i=function(){const n=t.image;n.removeEventListener("canplaythrough",i,!1),n.removeEventListener("error",s,!1),n.width=n.videoWidth,n.height=n.videoHeight,"function"==typeof e&&e()},s=function(){throw t.image.removeEventListener("canplaythrough",i,!1),t.image.removeEventListener("error",s,!1),new Error("unable to load "+t.src)};t._src=Vt.getAbsoluteURL(t._src),t.image.getAttribute("two-src")||(t.image.setAttribute("two-src",t.src),Vt.ImageRegistry.add(t.src,t.image));const n=t.image;n.readyState>=4?i():(n.addEventListener("canplaythrough",i,!1),n.addEventListener("error",s,!1),n.src=t.src,n.load())}};static load(t,e){t._flagImage&&(zt(t.image)?Vt.Register.canvas(t,e):Pt(t.image)?Vt.Register.img(t,e):Tt(t.image)&&Vt.Register.video(t,e)),t._flagSrc&&(t.image||(t.image=Vt.getImage(t.src),zt(t.image)?Vt.Register.canvas(t,e):Pt(t.image)?Vt.Register.img(t,e):Tt(t.image)&&Vt.Register.video(t,e)))}_update(t=!1){return(this._flagSrc||this._flagImage)&&(this.#n.next(this),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Vt.load(this,(()=>{this.loaded=!0,this.#n.next(this),this.#N.next(this)})))),this._image&&this._image instanceof HTMLVideoElement&&this._image.readyState>=4&&(this._flagVideo=!0),this}flagReset(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagRepeat=this._flagVideo=this._flagScale=this._flagOffset=!1,super.flagReset.call(this),this}get image(){return this._image}set image(t){let e;zt(t)?e="#"+t.id:(Pt(t)||Tt(t))&&(e=t.src),Vt.ImageRegistry.contains(e)?this._image=Vt.ImageRegistry.get(e):this._image=t,this._flagImage=!0}get loaded(){return this._loaded}set loaded(t){this._loaded=t,this._flagLoaded=!0}get offset(){return this._offset}set offset(t){this.#j&&(this.#j.unsubscribe(),this.#j=null),this._offset=t,this.#j=this._offset.change$.subscribe((()=>{this._flagOffset=!0})),this._flagOffset=!0}get repeat(){return this._repeat}set repeat(t){this._repeat=t,this._flagRepeat=!0}get scale(){return this._scale}set scale(t){this.#T&&(this.#T.unsubscribe(),this.#T=null),this._scale=t,this._scale instanceof ft&&(this.#T=this._scale.change$.subscribe((()=>{this._flagScale=!0}))),this._flagScale=!0}get src(){return this._src}set src(t){this._src=t,this._flagSrc=!0}}t("Texture",Vt);const Bt=Math.cos,Ht=Math.sin,Ut=Math.tan,qt=[];class Wt{#n;change$;elements=new Ct(9);manual=!1;constructor(t=1,e=0,i=0,s=0,n=1,r=0,h=0,o=0,a=1){this.elements[0]=t,this.elements[1]=e,this.elements[2]=i,this.elements[3]=s,this.elements[4]=n,this.elements[5]=r,this.elements[6]=h,this.elements[7]=o,this.elements[8]=a,this.#n=new B(this),this.change$=this.#n.asObservable()}get a(){return this.elements[0]}get b(){return this.elements[1]}get c(){return this.elements[2]}get d(){return this.elements[3]}get e(){return this.elements[4]}get f(){return this.elements[5]}get g(){return this.elements[6]}get h(){return this.elements[7]}get i(){return this.elements[8]}static Identity=[1,0,0,0,1,0,0,0,1];set(t,e,i,s,n,r,h,o,a){return this.elements[0]=t,this.elements[1]=e,this.elements[2]=i,this.elements[3]=s,this.elements[4]=n,this.elements[5]=r,this.elements[6]=h,this.elements[7]=o,this.elements[8]=a,this.#n.next(this),this}set_from_matrix(t){return this.elements[0]=t.a,this.elements[1]=t.b,this.elements[2]=t.c,this.elements[3]=t.d,this.elements[4]=t.e,this.elements[5]=t.f,this.elements[6]=t.g,this.elements[7]=t.h,this.elements[8]=t.i,this.#n.next(this),this}copy(t){return this.elements[0]=t.elements[0],this.elements[1]=t.elements[1],this.elements[2]=t.elements[2],this.elements[3]=t.elements[3],this.elements[4]=t.elements[4],this.elements[5]=t.elements[5],this.elements[6]=t.elements[6],this.elements[7]=t.elements[7],this.elements[8]=t.elements[8],this.manual=t.manual,this.#n.next(this),this}identity(){return this.elements[0]=Wt.Identity[0],this.elements[1]=Wt.Identity[1],this.elements[2]=Wt.Identity[2],this.elements[3]=Wt.Identity[3],this.elements[4]=Wt.Identity[4],this.elements[5]=Wt.Identity[5],this.elements[6]=Wt.Identity[6],this.elements[7]=Wt.Identity[7],this.elements[8]=Wt.Identity[8],this.#n.next(this),this}multiply(t,e,i,s,n,r,h,o,a){const l=this.elements,c=[t,e,i,s,n,r,h,o,a],u=l[0],f=l[1],g=l[2],d=l[3],_=l[4],p=l[5],m=l[6],b=l[7],y=l[8],v=c[0],w=c[1],x=c[2],k=c[3],I=c[4],A=c[5],S=c[6],R=c[7],M=c[8];return this.elements[0]=u*v+f*k+g*S,this.elements[1]=u*w+f*I+g*R,this.elements[2]=u*x+f*A+g*M,this.elements[3]=d*v+_*k+p*S,this.elements[4]=d*w+_*I+p*R,this.elements[5]=d*x+_*A+p*M,this.elements[6]=m*v+b*k+y*S,this.elements[7]=m*w+b*I+y*R,this.elements[8]=m*x+b*A+y*M,this.#n.next(this),this}multiply_vector(t=0,e=0,i=1){return[this.a*t+this.b*e+this.c*i,this.d*t+this.e*e+this.f*i,this.g*t+this.h*e+this.i*i]}multiply_by_scalar(t){return this.elements[0]*=t,this.elements[1]*=t,this.elements[2]*=t,this.elements[3]*=t,this.elements[4]*=t,this.elements[5]*=t,this.elements[6]*=t,this.elements[7]*=t,this.elements[8]*=t,this.#n.next(this),this}inverse(t){const e=this.elements;t=t||new Wt;const i=e[0],s=e[1],n=e[2],r=e[3],h=e[4],o=e[5],a=e[6],l=e[7],c=e[8],u=c*h-o*l,f=-c*r+o*a,g=l*r-h*a;let d=i*u+s*f+n*g;return d?(d=1/d,t.elements[0]=u*d,t.elements[1]=(-c*s+n*l)*d,t.elements[2]=(o*s-n*h)*d,t.elements[3]=f*d,t.elements[4]=(c*i-n*a)*d,t.elements[5]=(-o*i+n*r)*d,t.elements[6]=g*d,t.elements[7]=(-l*i+s*a)*d,t.elements[8]=(h*i-s*r)*d,t):null}scale(t,e){return arguments.length<=1&&(e=t),this.multiply(t,0,0,0,e,0,0,0,1)}rotate(t){const e=Bt(t),i=Ht(t);return this.multiply(e,-i,0,i,e,0,0,0,1)}translate(t,e){return this.multiply(1,0,t,0,1,e,0,0,1)}skewX(t){const e=Ut(t);return this.multiply(1,e,0,0,1,0,0,0,1)}skewY(t){const e=Ut(t);return this.multiply(1,0,0,e,1,0,0,0,1)}toString(t=!1){return qt.length=0,this.toTransformArray(t,qt),qt.map(Ot).join(" ")}toTransformArray(t=!1,e){const i=this.elements,s=!!e,n=i[0],r=i[1],h=i[2],o=i[3],a=i[4],l=i[5];if(t){const t=i[6],c=i[7],u=i[8];return s?(e[0]=n,e[1]=o,e[2]=t,e[3]=r,e[4]=a,e[5]=c,e[6]=h,e[7]=l,e[8]=u,e):[n,o,t,r,a,c,h,l,u]}return s?(e[0]=n,e[1]=o,e[2]=r,e[3]=a,e[4]=h,e[5]=l,e):[n,o,r,a,h,l]}toArray(t=!1,e){const i=this.elements,s=Array.isArray(e),n=i[0],r=i[1],h=i[2],o=i[3],a=i[4],l=i[5];if(t){const t=i[6],c=i[7],u=i[8];return s?(e[0]=n,e[1]=r,e[2]=h,e[3]=o,e[4]=a,e[5]=l,e[6]=t,e[7]=c,e[8]=u,e):[n,r,h,o,a,l,t,c,u]}return s?(e[0]=n,e[1]=r,e[2]=h,e[3]=o,e[4]=a,e[5]=l,e):[n,r,h,o,a,l]}}t("Matrix",Wt);class Yt extends vt{_flagMatrix=!0;_flagScale=!1;_matrix=null;_worldMatrix=null;#V;#B;#H;#U;_rotation=0;_scale=new ft(1,1);#T=null;_skewX=0;_skewY=0;dataset;constructor(t={}){super(),this.isShape=!0,this.id=mt+yt(),this.matrix=new Wt,this.worldMatrix=new Wt,t.position?(this.#V=t.position,this.#B=this.#q()):(this.#V=new ft(0,0),this.#B=this.#q()),t.attitude?(this.#H=t.attitude,this.#U=this.#W()):(this.#H=new ft(0,0,1,0),this.#U=this.#W()),this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}dispose(){this.#Y(),this.#X()}get renderer(){return this.viewInfo}set renderer(t){this.viewInfo=t}_update(t){if(!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.position.x,this.position.y),this._scale instanceof ft?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale,this._scale),this._matrix.rotate(this.rotation),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),t){const t=this.parent;"function"==typeof t._update&&t._update()}return this}flagReset(t=!1){return this._flagMatrix=t,this._flagScale=t,super.flagReset(),this}useAttitude(t){this.#X(),this.#H=t,this.#U=this.#W()}#W(){return this.#H.change$.subscribe((()=>{this._flagMatrix=!0}))}#X(){this.#U&&(this.#U.unsubscribe(),this.#U=null)}usePosition(t){this.#Y(),this.#V=t,this.#B=this.#q()}#q(){return this.#V.change$.subscribe((()=>{this._flagMatrix=!0}))}#Y(){this.#B&&(this.#B.unsubscribe(),this.#B=null)}get position(){return this.#V}set position(t){this.#V.set(t.x,t.y,0,0)}get attitude(){return this.#H}set attitude(t){this.#H.set(0,0,t.a,t.b)}get rotation(){return this._rotation}set rotation(t){this._rotation=t,this._flagMatrix=!0}get scale(){if(this._scale.x===this._scale.y)return this._scale.x;throw new Error}set scale(t){this.#T&&(this.#T.unsubscribe(),this.#T=null),this._scale.x=t,this._scale.y=t,this._scale instanceof ft&&(this.#T=this._scale.change$.subscribe((()=>{this._flagMatrix=!0}))),this._flagMatrix=!0,this._flagScale=!0}get scaleXY(){return this._scale}set scaleXY(t){this.#T&&(this.#T.unsubscribe(),this.#T=null),this._scale.set(t.x,t.y,0,0),this._scale instanceof ft&&(this.#T=this._scale.change$.subscribe((()=>{this._flagMatrix=!0}))),this._flagMatrix=!0,this._flagScale=!0}get skewX(){return this._skewX}set skewX(t){this._skewX=t,this._flagMatrix=!0}get skewY(){return this._skewY}set skewY(t){this._skewY=t,this._flagMatrix=!0}get matrix(){return this._matrix}set matrix(t){this._matrix=t,this._flagMatrix=!0}get worldMatrix(){return function(t,e){e=e&&e.identity()||new Wt;let i=t;const s=[];for(;i&&i.matrix;)s.push(i.matrix),i=i.parent;s.reverse();for(let t=0;t<s.length;t++){const i=s[t];e.multiply(i.a,i.b,i.c,i.d,i.e,i.f,i.g,i.h,i.i)}}(this,this._worldMatrix),this._worldMatrix}set worldMatrix(t){this._worldMatrix=t}}t("Shape",Yt);const Xt={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896257],[0,.7745966692414834],[.33998104358485626,.8611363115940526],[0,.5384693101056831,.906179845938664],[.2386191860831969,.6612093864662645,.932469514203152],[0,.4058451513773972,.7415311855993945,.9491079123427585],[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]],weights:[[1],[.8888888888888888,.5555555555555556],[.6521451548625461,.34785484513745385],[.5688888888888889,.47862867049936647,.23692688505618908],[.46791393457269104,.3607615730481386,.17132449237917036],[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096]]};function Dt(t,e,i,s,n){const r=1-t;return r*r*r*e+3*r*r*t*i+3*r*t*t*s+t*t*t*n}function Gt(t,e,i,s,n,r,h,o,a){if(t===i&&e===s&&n===h&&r===o){const i=h-t,s=o-e;return Math.sqrt(i*i+s*s)}const l=9*(i-n)+3*(h-t),c=6*(t+n)-12*i,u=3*(i-t),f=9*(s-r)+3*(o-e),g=6*(e+r)-12*s,d=3*(s-e);return function(t,e,i,s){const n=Xt.abscissas[s-2],r=Xt.weights[s-2],h=.5*(i-e),o=h+e;let a=0;const l=s+1>>1;let c=1&s?r[a++]*t(o):0;for(;a<l;){const e=h*n[a];c+=r[a++]*(t(o+e)+t(o-e))}return h*c}((function(t){const e=(l*t+c)*t+u,i=(f*t+g)*t+d;return Math.sqrt(e*e+i*i)}),0,1,a||Xt.RecursionLimit)}function Jt(t,e,i,s,n,r,h,o){const a=[],l=[[],[]];let c,u,f,g,d,_,p,m;for(let l=0;l<2;++l)if(0==l?(u=6*t-12*i+6*n,c=-3*t+9*i-9*n+3*h,f=3*i-3*t):(u=6*e-12*s+6*r,c=-3*e+9*s-9*r+3*o,f=3*s-3*e),Math.abs(c)<1e-12){if(Math.abs(u)<1e-12)continue;g=-f/u,0<g&&g<1&&a.push(g)}else p=u*u-4*f*c,m=Math.sqrt(p),p<0||(d=(-u+m)/(2*c),0<d&&d<1&&a.push(d),_=(-u-m)/(2*c),0<_&&_<1&&a.push(_));const b=a.length;let y,v=b;for(;v--;)g=a[v],y=1-g,l[0][v]=y*y*y*t+3*y*y*g*i+3*y*g*g*n+g*g*g*h,l[1][v]=y*y*y*e+3*y*y*g*s+3*y*g*g*r+g*g*g*o;return l[0][b]=t,l[1][b]=e,l[0][b+1]=h,l[1][b+1]=o,l[0].length=l[1].length=b+2,{min:{x:Math.min.apply(0,l[0]),y:Math.min.apply(0,l[1])},max:{x:Math.max.apply(0,l[0]),y:Math.max.apply(0,l[1])}}}function Zt(t,e,i){const s=ft.angleBetween(t.origin,e.origin),n=ft.angleBetween(i.origin,e.origin);let r=ft.distanceBetween(t.origin,e.origin),h=ft.distanceBetween(i.origin,e.origin),o=(s+n)/2;return r<1e-4||h<1e-4?("boolean"!=typeof e.relative||e.relative||(e.controls.left.copy(e.origin),e.controls.right.copy(e.origin)),e):(r*=.33,h*=.33,n<s?o+=Rt:o-=Rt,e.controls.left.x=Math.cos(o)*r,e.controls.left.y=Math.sin(o)*r,o-=Math.PI,e.controls.right.x=Math.cos(o)*h,e.controls.right.y=Math.sin(o)*h,"boolean"!=typeof e.relative||e.relative||(e.controls.left.x+=e.x,e.controls.left.y+=e.y,e.controls.right.x+=e.x,e.controls.right.y+=e.y),e)}function Kt(t,e,i,s,n,r){return{translateX:n,translateY:r,scaleX:Math.sqrt(t*t+e*e),scaleY:Math.sqrt(i*i+s*s),rotation:180*Math.atan2(e,t)/Math.PI}}function Qt(t,e){if(0===e||1===e)return!0;const i=t._length*e;let s=0;for(let e=0;e<t._lengths.length;e++){const n=t._lengths[e];if(s>=i)return i-s>=0;s+=n}return!1}function te(t,e){const i=t._length;if(e<=0)return 0;if(e>=i)return t._lengths.length-1;for(let i=0,s=0;i<t._lengths.length;i++){if(s+t._lengths[i]>=e)return e-=s,Math.max(i-1,0)+e/t._lengths[i];s+=t._lengths[i]}return-1}function ee(t,e,i){let s,n,r,h;const o=e.controls&&e.controls.right,a=t.controls&&t.controls.left,l=e.x,c=e.y;s=(o||e).x,r=(o||e).y,n=(a||t).x,h=(a||t).y;const u=t.x,f=t.y;return o&&e.relative&&(s+=e.x,r+=e.y),a&&t.relative&&(n+=t.x,h+=t.y),Gt(l,c,s,r,n,h,u,f,i)}function ie(t,e,i){const s=e.controls.right,n=t.controls.left,r=e.x,h=e.y;let o=s.x,a=s.y,l=n.x,c=n.y;const u=t.x,f=t.y;e.relative&&(o+=e.x,a+=e.y),t.relative&&(l+=t.x,c+=t.y);return function(t,e,i,s,n,r,h,o,a,l=Xt.RecursionLimit){const c=l+1;if(Math.abs(e-o)<.001&&Math.abs(i-a)<.001)return[t(o,a)];const u=[];for(let l=0;l<c;l++){const f=l/c,g=Dt(f,e,s,r,o),d=Dt(f,i,n,h,a);u.push(t(g,d))}return u}(((t,e)=>new gt