ice-render 0.0.1 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/index.cjs.js +25 -1
- package/dist/index.esm.js +25 -1
- package/dist/index.umd.js +25 -1
- package/package.json +34 -15
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.esm.js.map +0 -1
- package/dist/index.umd.js.map +0 -1
- package/dist/types/core/FrameController.d.ts +0 -11
- package/dist/types/core/RenderList.d.ts +0 -0
- package/dist/types/core/Timeline.d.ts +0 -0
- package/dist/types/core/Tween.d.ts +0 -0
- package/dist/types/index.d.ts +0 -3
- package/dist/types/temp/test.d.ts +0 -1
package/README.md
CHANGED
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1,25 @@
|
|
|
1
|
-
"use strict";function t(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 e(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?t(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;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 i(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function a(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&&u(t,e)}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}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 c(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=s(t);if(e){var i=s(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return l(this,n)}}function f(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}function v(){return(v="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=f(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(this,arguments)}var d="BEFORE_RENDER",p="AFTER_RENDER",y="BEFORE_ADD",g="AFTER_ADD",b="BEFORE_REMOVE",x="AFTER_REMOVE",O=Array.isArray,m="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function w(t,e){return t(e={exports:{}},e.exports),e.exports}var M="object"==typeof m&&m&&m.Object===Object&&m,P="object"==typeof self&&self&&self.Object===Object&&self,k=M||P||Function("return this")(),_=k.Symbol,D=Object.prototype,j=D.hasOwnProperty,S=D.toString,E=_?_.toStringTag:void 0;var R=function(t){var e=j.call(t,E),n=t[E];try{t[E]=void 0;var r=!0}catch(t){}var i=S.call(t);return r&&(e?t[E]=n:delete t[E]),i},T=Object.prototype.toString;var B=function(t){return T.call(t)},A=_?_.toStringTag:void 0;var N=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":A&&A in Object(t)?R(t):B(t)};var C=function(t){return null!=t&&"object"==typeof t};var L=function(t){return"symbol"==typeof t||C(t)&&"[object Symbol]"==N(t)},z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,F=/^\w*$/;var I=function(t,e){if(O(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!L(t))||(F.test(t)||!z.test(t)||null!=e&&t in Object(e))};var X=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};var Y,H=function(t){if(!X(t))return!1;var e=N(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},U=k["__core-js_shared__"],$=(Y=/[^.]+$/.exec(U&&U.keys&&U.keys.IE_PROTO||""))?"Symbol(src)_1."+Y:"";var q=function(t){return!!$&&$ in t},W=Function.prototype.toString;var G=function(t){if(null!=t){try{return W.call(t)}catch(t){}try{return t+""}catch(t){}}return""},V=/^\[object .+?Constructor\]$/,J=Function.prototype,K=Object.prototype,Q=J.toString,Z=K.hasOwnProperty,tt=RegExp("^"+Q.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var et=function(t){return!(!X(t)||q(t))&&(H(t)?tt:V).test(G(t))};var nt=function(t,e){return null==t?void 0:t[e]};var rt=function(t,e){var n=nt(t,e);return et(n)?n:void 0},it=rt(Object,"create");var ot=function(){this.__data__=it?it(null):{},this.size=0};var at=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},st=Object.prototype.hasOwnProperty;var ut=function(t){var e=this.__data__;if(it){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return st.call(e,t)?e[t]:void 0},ct=Object.prototype.hasOwnProperty;var lt=function(t){var e=this.__data__;return it?void 0!==e[t]:ct.call(e,t)};var ht=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=it&&void 0===e?"__lodash_hash_undefined__":e,this};function ft(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}ft.prototype.clear=ot,ft.prototype.delete=at,ft.prototype.get=ut,ft.prototype.has=lt,ft.prototype.set=ht;var vt=ft;var dt=function(){this.__data__=[],this.size=0};var pt=function(t,e){return t===e||t!=t&&e!=e};var yt=function(t,e){for(var n=t.length;n--;)if(pt(t[n][0],e))return n;return-1},gt=Array.prototype.splice;var bt=function(t){var e=this.__data__,n=yt(e,t);return!(n<0)&&(n==e.length-1?e.pop():gt.call(e,n,1),--this.size,!0)};var xt=function(t){var e=this.__data__,n=yt(e,t);return n<0?void 0:e[n][1]};var Ot=function(t){return yt(this.__data__,t)>-1};var mt=function(t,e){var n=this.__data__,r=yt(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this};function wt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}wt.prototype.clear=dt,wt.prototype.delete=bt,wt.prototype.get=xt,wt.prototype.has=Ot,wt.prototype.set=mt;var Mt=wt,Pt=rt(k,"Map");var kt=function(){this.size=0,this.__data__={hash:new vt,map:new(Pt||Mt),string:new vt}};var _t=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Dt=function(t,e){var n=t.__data__;return _t(e)?n["string"==typeof e?"string":"hash"]:n.map};var jt=function(t){var e=Dt(this,t).delete(t);return this.size-=e?1:0,e};var St=function(t){return Dt(this,t).get(t)};var Et=function(t){return Dt(this,t).has(t)};var Rt=function(t,e){var n=Dt(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this};function Tt(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}Tt.prototype.clear=kt,Tt.prototype.delete=jt,Tt.prototype.get=St,Tt.prototype.has=Et,Tt.prototype.set=Rt;var Bt=Tt;function At(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(At.Cache||Bt),n}At.Cache=Bt;var Nt=At;var Ct=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lt=/\\(\\)?/g,zt=function(t){var e=Nt(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Ct,(function(t,n,r,i){e.push(r?i.replace(Lt,"$1"):n||t)})),e}));var Ft=function(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i},It=_?_.prototype:void 0,Xt=It?It.toString:void 0;var Yt=function t(e){if("string"==typeof e)return e;if(O(e))return Ft(e,t)+"";if(L(e))return Xt?Xt.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n};var Ht=function(t){return null==t?"":Yt(t)};var Ut=function(t,e){return O(t)?t:I(t,e)?[t]:zt(Ht(t))};var $t=function(t){if("string"==typeof t||L(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e};var qt=function(t,e){for(var n=0,r=(e=Ut(e,t)).length;null!=t&&n<r;)t=t[$t(e[n++])];return n&&n==r?t:void 0};var Wt=function(t,e,n){var r=null==t?void 0:qt(t,e);return void 0===r?n:r};var Gt=function(){this.__data__=new Mt,this.size=0};var Vt=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n};var Jt=function(t){return this.__data__.get(t)};var Kt=function(t){return this.__data__.has(t)};var Qt=function(t,e){var n=this.__data__;if(n instanceof Mt){var r=n.__data__;if(!Pt||r.length<199)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new Bt(r)}return n.set(t,e),this.size=n.size,this};function Zt(t){var e=this.__data__=new Mt(t);this.size=e.size}Zt.prototype.clear=Gt,Zt.prototype.delete=Vt,Zt.prototype.get=Jt,Zt.prototype.has=Kt,Zt.prototype.set=Qt;var te=Zt,ee=function(){try{var t=rt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();var ne=function(t,e,n){"__proto__"==e&&ee?ee(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n};var re=function(t,e,n){(void 0!==n&&!pt(t[e],n)||void 0===n&&!(e in t))&&ne(t,e,n)};var ie=function(t){return function(e,n,r){for(var i=-1,o=Object(e),a=r(e),s=a.length;s--;){var u=a[t?s:++i];if(!1===n(o[u],u,o))break}return e}}(),oe=w((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,i=r&&r.exports===n?k.Buffer:void 0,o=i?i.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=o?o(n):new t.constructor(n);return t.copy(r),r}})),ae=k.Uint8Array;var se=function(t){var e=new t.constructor(t.byteLength);return new ae(e).set(new ae(t)),e};var ue=function(t,e){var n=e?se(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)};var ce=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e},le=Object.create,he=function(){function t(){}return function(e){if(!X(e))return{};if(le)return le(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();var fe=function(t,e){return function(n){return t(e(n))}}(Object.getPrototypeOf,Object),ve=Object.prototype;var de=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||ve)};var pe=function(t){return"function"!=typeof t.constructor||de(t)?{}:he(fe(t))};var ye=function(t){return C(t)&&"[object Arguments]"==N(t)},ge=Object.prototype,be=ge.hasOwnProperty,xe=ge.propertyIsEnumerable,Oe=ye(function(){return arguments}())?ye:function(t){return C(t)&&be.call(t,"callee")&&!xe.call(t,"callee")};var me=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};var we=function(t){return null!=t&&me(t.length)&&!H(t)};var Me=function(t){return C(t)&&we(t)};var Pe=function(){return!1},ke=w((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,i=r&&r.exports===n?k.Buffer:void 0,o=(i?i.isBuffer:void 0)||Pe;t.exports=o})),_e=Function.prototype,De=Object.prototype,je=_e.toString,Se=De.hasOwnProperty,Ee=je.call(Object);var Re=function(t){if(!C(t)||"[object Object]"!=N(t))return!1;var e=fe(t);if(null===e)return!0;var n=Se.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&je.call(n)==Ee},Te={};Te["[object Float32Array]"]=Te["[object Float64Array]"]=Te["[object Int8Array]"]=Te["[object Int16Array]"]=Te["[object Int32Array]"]=Te["[object Uint8Array]"]=Te["[object Uint8ClampedArray]"]=Te["[object Uint16Array]"]=Te["[object Uint32Array]"]=!0,Te["[object Arguments]"]=Te["[object Array]"]=Te["[object ArrayBuffer]"]=Te["[object Boolean]"]=Te["[object DataView]"]=Te["[object Date]"]=Te["[object Error]"]=Te["[object Function]"]=Te["[object Map]"]=Te["[object Number]"]=Te["[object Object]"]=Te["[object RegExp]"]=Te["[object Set]"]=Te["[object String]"]=Te["[object WeakMap]"]=!1;var Be=function(t){return C(t)&&me(t.length)&&!!Te[N(t)]};var Ae=function(t){return function(e){return t(e)}},Ne=w((function(t,e){var n=e&&!e.nodeType&&e,r=n&&t&&!t.nodeType&&t,i=r&&r.exports===n&&M.process,o=function(){try{var t=r&&r.require&&r.require("util").types;return t||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=o})),Ce=Ne&&Ne.isTypedArray,Le=Ce?Ae(Ce):Be;var ze=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},Fe=Object.prototype.hasOwnProperty;var Ie=function(t,e,n){var r=t[e];Fe.call(t,e)&&pt(r,n)&&(void 0!==n||e in t)||ne(t,e,n)};var Xe=function(t,e,n,r){var i=!n;n||(n={});for(var o=-1,a=e.length;++o<a;){var s=e[o],u=r?r(n[s],t[s],s,n,t):void 0;void 0===u&&(u=t[s]),i?ne(n,s,u):Ie(n,s,u)}return n};var Ye=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r},He=/^(?:0|[1-9]\d*)$/;var Ue=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&He.test(t))&&t>-1&&t%1==0&&t<e},$e=Object.prototype.hasOwnProperty;var qe=function(t,e){var n=O(t),r=!n&&Oe(t),i=!n&&!r&&ke(t),o=!n&&!r&&!i&&Le(t),a=n||r||i||o,s=a?Ye(t.length,String):[],u=s.length;for(var c in t)!e&&!$e.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Ue(c,u))||s.push(c);return s};var We=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},Ge=Object.prototype.hasOwnProperty;var Ve=function(t){if(!X(t))return We(t);var e=de(t),n=[];for(var r in t)("constructor"!=r||!e&&Ge.call(t,r))&&n.push(r);return n};var Je=function(t){return we(t)?qe(t,!0):Ve(t)};var Ke=function(t){return Xe(t,Je(t))};var Qe=function(t,e,n,r,i,o,a){var s=ze(t,n),u=ze(e,n),c=a.get(u);if(c)re(t,n,c);else{var l=o?o(s,u,n+"",t,e,a):void 0,h=void 0===l;if(h){var f=O(u),v=!f&&ke(u),d=!f&&!v&&Le(u);l=u,f||v||d?O(s)?l=s:Me(s)?l=ce(s):v?(h=!1,l=oe(u,!0)):d?(h=!1,l=ue(u,!0)):l=[]:Re(u)||Oe(u)?(l=s,Oe(s)?l=Ke(s):X(s)&&!H(s)||(l=pe(u))):h=!1}h&&(a.set(u,l),i(l,u,r,o,a),a.delete(u)),re(t,n,l)}};var Ze=function t(e,n,r,i,o){e!==n&&ie(n,(function(a,s){if(o||(o=new te),X(a))Qe(e,n,s,r,t,i,o);else{var u=i?i(ze(e,s),a,s+"",e,n,o):void 0;void 0===u&&(u=a),re(e,s,u)}}),Je)};var tn=function(t){return t};var en=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)},nn=Math.max;var rn=function(t,e,n){return e=nn(void 0===e?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=nn(r.length-e,0),a=Array(o);++i<o;)a[i]=r[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=r[i];return s[e]=n(a),en(t,this,s)}};var on=function(t){return function(){return t}},an=ee?function(t,e){return ee(t,"toString",{configurable:!0,enumerable:!1,value:on(e),writable:!0})}:tn,sn=Date.now;var un=function(t){var e=0,n=0;return function(){var r=sn(),i=16-(r-n);if(n=r,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(an);var cn=function(t,e){return un(rn(t,e,tn),t+"")};var ln=function(t,e,n){if(!X(n))return!1;var r=typeof e;return!!("number"==r?we(n)&&Ue(e,n.length):"string"==r&&e in n)&&pt(n[e],t)};var hn=function(t){return cn((function(e,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=t.length>3&&"function"==typeof o?(i--,o):void 0,a&&ln(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++r<i;){var s=n[r];s&&t(e,s,r,o)}return e}))}((function(t,e,n){Ze(t,e,n)})),fn=window||global||{},vn=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var i in n(this,t),o(this,"originalEvent",void 0),o(this,"target",void 0),e)this[i]=e[i];for(var a in r)this[a]=r[a]},dn=function(){function t(){n(this,t),o(this,"listeners",{}),o(this,"suspendedEventNames",[])}return i(t,[{key:"on",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:fn;this.listeners[t]||(this.listeners[t]=[]),this.off(t,e,n),this.listeners[t].push({callback:e,scope:n})}},{key:"off",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:fn,r=this.listeners[t];if(r)for(var i=0;i<r.length;i++){var o=r[i];if(o.callback===e&&o.scope===n)return void this.listeners[t].splice(i,1)}}},{key:"once",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:fn;function r(i){this.off(t,r,n),e.call(n,i)}this.on(t,r,n)}},{key:"trigger",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return!!this.listeners[t]&&(!this.suspendedEventNames.includes(t)&&(n?(e=new vn(n)).originalEvent=n:e=new vn({type:t,timeStamp:(new Date).getTime()}),this.listeners[t].forEach((function(t){var n=t.callback,r=t.scope;n.call(r,e)})),!0))}},{key:"suspend",value:function(t,e){t&&!this.suspendedEventNames.includes(t)&&this.suspendedEventNames.push(t),e&&(e.prototype.suspended=!0)}},{key:"resume",value:function(t,e){t&&this.suspendedEventNames.includes(t)&&this.suspendedEventNames.splice(this.suspendedEventNames.findIndex(t),1),e&&(e.prototype.suspended=!1)}},{key:"purge",value:function(){this.listeners={}}}]),t}();dn.prototype.addEventListener=dn.prototype.on,dn.prototype.removeEventListener=dn.prototype.off,dn.prototype.dispatchEvent=dn.prototype.trigger;var pn=/\s/;var yn=function(t){for(var e=t.length;e--&&pn.test(t.charAt(e)););return e},gn=/^\s+/;var bn=function(t){return t?t.slice(0,yn(t)+1).replace(gn,""):t},xn=/^[-+]0x[0-9a-f]+$/i,On=/^0b[01]+$/i,mn=/^0o[0-7]+$/i,wn=parseInt;var Mn=function(t){if("number"==typeof t)return t;if(L(t))return NaN;if(X(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=X(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=bn(t);var n=On.test(t);return n||mn.test(t)?wn(t.slice(2),n?2:8):xn.test(t)?NaN:+t};var Pn=function(t){return t?(t=Mn(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0};var kn=function(t){var e=Pn(t),n=e%1;return e==e?n?e-n:e:0},_n=k.isFinite,Dn=Math.min;var jn=function(t){var e=Math[t];return function(t,n){if(t=Mn(t),(n=null==n?0:Dn(kn(n),292))&&_n(t)){var r=(Ht(t)+"e").split("e"),i=e(r[0]+"e"+(+r[1]+n));return+((r=(Ht(i)+"e").split("e"))[0]+"e"+(+r[1]-n))}return e(t)}}("round"),Sn=function(){function t(){throw n(this,t),new Error("GeoUtil is a static util class.")}return i(t,null,[{key:"containsPoint",value:function(t,e){return!1}},{key:"isIntersect",value:function(t,e){return!1}},{key:"getLength",value:function(t,e,n,r){return Math.sqrt((n-t)*(n-t)+(r-e)*(r-e))}},{key:"calcRotateAngle",value:function(t,e,n,r){var i=t-n,o=e-r,a=i/Math.sqrt(i*i+o*o),s=(o/Math.sqrt(i*i+o*o)<0?-1:1)*Math.acos(a)*180/Math.PI+360;return s%=360}},{key:"crossProduct",value:function(t,e,n,r){return jn(t*r-n*e,2)}},{key:"dotProduct",value:function(t,e,n,r){return jn(t*n+e*r,2)}}]),t}(),En=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0,0,0,0,0,0,0,0,0];n(this,t),o(this,"tl",new DOMPoint),o(this,"tr",new DOMPoint),o(this,"bl",new DOMPoint),o(this,"br",new DOMPoint),o(this,"center",new DOMPoint),this.tl=new DOMPoint(e[0],e[1]),this.tr=new DOMPoint(e[2],e[3]),this.bl=new DOMPoint(e[4],e[5]),this.br=new DOMPoint(e[6],e[7]),this.center=new DOMPoint(e[8],e[9])}return i(t,[{key:"clone",value:function(){var e=DOMPoint.fromPoint(this.tl),n=DOMPoint.fromPoint(this.tr),r=DOMPoint.fromPoint(this.bl),i=DOMPoint.fromPoint(this.br),o=DOMPoint.fromPoint(this.center);return new t([e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y,o.x,o.y])}},{key:"containsPoint",value:function(t){var e=this.getMinAndMaxPoint(),n=e.minX,r=e.minY,i=e.maxX,o=e.maxY;if(t.x<n||t.x>i||t.y<r||t.y>o)return!1;for(var a,s=0,u=this.getBoundingLines(),c=0;c<u.length;c++){var l=u[c];if(!(t.y>l.o.y&&t.y>l.d.y)&&!(t.y<l.o.y&&t.y<l.d.y)){if(l.o.x===l.d.x&&l.o.x>=t.x)a=l.o.x;else{var h=(l.d.y-l.o.y)/(l.d.x-l.o.x);a=l.o.x+(t.y-l.o.y)/h}a>t.x&&s++}}return 0!==s&&s%2==1}},{key:"getBoundingLines",value:function(){return[{o:DOMPoint.fromPoint(this.tl),d:DOMPoint.fromPoint(this.tr)},{o:DOMPoint.fromPoint(this.tr),d:DOMPoint.fromPoint(this.br)},{o:DOMPoint.fromPoint(this.br),d:DOMPoint.fromPoint(this.bl)},{o:DOMPoint.fromPoint(this.bl),d:DOMPoint.fromPoint(this.tl)}]}},{key:"getMinAndMaxPoint",value:function(){var t=this.tl.x,e=this.tl.y,n=this.tl.x,r=this.tl.y;return[this.tr,this.bl,this.br].forEach((function(i){i.x<t&&(t=i.x),i.x>n&&(n=i.x),i.y<e&&(e=i.y),i.y>r&&(r=i.y)})),{minX:t,minY:e,maxX:n,maxY:r}}},{key:"containsBox",value:function(t){return!1}},{key:"isIntersect",value:function(t){var e=this.tl.x,n=this.br.x,r=this.tl.y,i=this.br.y,o=t.tl.x,a=t.br.x,s=t.tl.y,u=t.br.y,c=!(e>a||r>u||n<o||i<s);return c}},{key:"transform",value:function(e){var n=DOMPoint.fromPoint(this.tl).matrixTransform(e),r=DOMPoint.fromPoint(this.tr).matrixTransform(e),i=DOMPoint.fromPoint(this.bl).matrixTransform(e),o=DOMPoint.fromPoint(this.br).matrixTransform(e),a=DOMPoint.fromPoint(this.center).matrixTransform(e);return new t([n.x,n.y,r.x,r.y,i.x,i.y,o.x,o.y,a.x,a.y])}},{key:"union",value:function(t){return null}},{key:"width",get:function(){return Sn.getLength(this.br.x,this.br.y,this.bl.x,this.bl.y)}},{key:"height",get:function(){return Sn.getLength(this.br.x,this.br.y,this.tr.x,this.tr.y)}},{key:"left",get:function(){return this.tl.x},set:function(t){throw new Error("Can not set left to ICEBoundingBox directly.")}},{key:"top",get:function(){return this.tl.y},set:function(t){throw new Error("Can not set top to ICEBoundingBox directly.")}},{key:"centerX",get:function(){return this.center.x}},{key:"centerY",get:function(){return this.center.y}},{key:"centerPoint",get:function(){return this.center}}],[{key:"fromDimension",value:function(e,n,r,i){return new t([].concat([e,n],[e+r,n],[e,n+i],[e+r,n+i],[e+r/2,n+i/2]))}}]),t}(),Rn=function(){function t(){n(this,t)}return i(t,null,[{key:"calcRotateAngleFromMatrix",value:function(t){var e=0,n=t.a,r=t.b,i=r/Math.sqrt(n*n+r*r),o=n/Math.sqrt(n*n+r*r);return e=Math.acos(o),i<0&&(e+=Math.PI/2),e*(180/Math.PI)}},{key:"calcScaleFromMatrix",value:function(t){return[Math.sqrt(t.a*t.a+t.b*t.b)/t.a,Math.sqrt(t.c*t.c+t.d*t.d)/t.d]}}]),t}(),Tn=function(t){a(s,dn);var r=h(s);function s(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(this,s),o(c(t=r.call(this)),"root",void 0),o(c(t),"ctx",void 0),o(c(t),"evtBus",void 0),o(c(t),"parentNode",void 0),o(c(t),"props",{id:"ICE_"+Math.floor(1e10*Math.random()),left:0,top:0,width:0,height:0,style:{fillStyle:"red",strokeStyle:"blue",lineWidth:1},animations:{},transform:{translate:[0,0],scale:[1,1],skew:[0,0],rotate:0},translationMatrix:new DOMMatrix,linearMatrix:new DOMMatrix,composedMatrix:new DOMMatrix,origin:"localCenter",localOrigin:new DOMPoint(0,0),absoluteOrigin:new DOMPoint(0,0),zIndex:s.instanceCounter++,isRendering:!1,display:!0,draggable:!0,transformable:!0,linkable:!0,interactive:!0,showMinBoundingBox:!0,showMaxBoundingBox:!0}),o(c(t),"state",e({},t.props)),t.props=hn(t.props,i),t.state=JSON.parse(JSON.stringify(t.props)),t.initEvents(),t}return i(s,[{key:"render",value:function(){this.state.isRendering=!0,this.calcOriginalDimension(),this.applyStyle(),this.applyTransformToCtx(),this.doRender(),this.ctx.setTransform(new DOMMatrix),this.state.isRendering=!1}},{key:"applyStyle",value:function(){Object.assign(this.ctx,e(e({},this.props.style),this.state.style))}},{key:"calcOriginalDimension",value:function(){return{width:this.state.width,height:this.state.height}}},{key:"calcLocalOrigin",value:function(){var t=new DOMPoint(0,0),e=this.state.origin;if(!e||"localCenter"===e){var n=this.state.width/2,r=this.state.height/2;t.x=n,t.y=r}return this.state.localOrigin=t,t}},{key:"calcAbsoluteOrigin",value:function(){var t=Wt(this,"state.transform.translate.0")+this.state.left,e=Wt(this,"state.transform.translate.1")+this.state.top,n=DOMPoint.fromPoint(this.calcLocalOrigin());if(n.x+=t,n.y+=e,this.parentNode){var r=this.parentNode.state.localOrigin.x,i=this.parentNode.state.localOrigin.y;n=n.matrixTransform(new DOMMatrix([1,0,0,1,-r,-i]));var o=this.parentNode.state.composedMatrix;n=n.matrixTransform(o)}return this.state.absoluteOrigin=n,n}},{key:"calcLinearMatrix",value:function(){var t=new DOMMatrix,e=Wt(this,"state.transform.skew.0"),n=Wt(this,"state.transform.skew.1");t.skewXSelf(e),t.skewYSelf(n);var r=Wt(this,"state.transform.rotate");t.rotateSelf(r);var i=Wt(this,"state.transform.scale.0"),o=Wt(this,"state.transform.scale.1");return t.scaleSelf(i,o),this.state.linearMatrix=t,t}},{key:"calcAbsoluteLinearMatrix",value:function(){for(var t=this,e=DOMMatrix.fromMatrix(t.calcLinearMatrix());t.parentNode;)e.multiplySelf(t.parentNode.state.linearMatrix),t=t.parentNode;return this.state.absoluteLinearMatrix=DOMMatrix.fromMatrix(e),e}},{key:"composeMatrix",value:function(){var t=this.calcAbsoluteOrigin(),e=new DOMMatrix([1,0,0,1,t.x,t.y]),n=this.calcAbsoluteLinearMatrix(),r=e.multiplySelf(n);return this.state.composedMatrix=DOMMatrix.fromMatrix(r),r}},{key:"applyTransformToCtx",value:function(){this.ctx.setTransform(this.composeMatrix())}},{key:"doRender",value:function(){if(this.state.showMinBoundingBox){var t=this.getMinBoundingBox();this.ctx.setTransform(new DOMMatrix),this.ctx.lineWidth=1,this.ctx.strokeStyle="#ff0000",this.ctx.fillStyle="rgba(0,0,0,0)",this.ctx.beginPath(),this.ctx.moveTo(t.tl.x,t.tl.y),this.ctx.lineTo(t.tr.x,t.tr.y),this.ctx.lineTo(t.br.x,t.br.y),this.ctx.lineTo(t.bl.x,t.bl.y),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fill()}if(this.state.showMaxBoundingBox){var e=this.getMaxBoundingBox();this.ctx.setTransform(new DOMMatrix),this.ctx.lineWidth=1,this.ctx.strokeStyle="#0000ff",this.ctx.fillStyle="rgba(0,0,0,0)",this.ctx.beginPath(),this.ctx.moveTo(e.tl.x,e.tl.y),this.ctx.lineTo(e.tr.x,e.tr.y),this.ctx.lineTo(e.br.x,e.br.y),this.ctx.lineTo(e.bl.x,e.bl.y),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fill()}}},{key:"getMinBoundingBox",value:function(){var t=this.state.localOrigin.x,e=this.state.localOrigin.y,n=this.state.width,r=this.state.height,i=new En([0-t,0-e,0-t+n,0-e,0-t,0-e+r,0-t+n,0-e+r,0,0]);return i=i.transform(this.composeMatrix())}},{key:"getMaxBoundingBox",value:function(){var t=this.getMinBoundingBox(),e=t.getMinAndMaxPoint(),n=e.minX,r=e.minY,i=e.maxX,o=e.maxY,a=t.centerPoint;return t=new En([n,r,i,r,n,o,i,o,a.x,a.y])}},{key:"setState",value:function(t){hn(this.state,t)}},{key:"setPosition",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new vn;this.trigger("before-move",e(e({},r),{},{left:t,top:n})),this.setState({left:t,top:n}),this.trigger("after-move",e(e({},r),{},{left:t,top:n}))}},{key:"moveGlobalPosition",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new vn;if(this.parentNode){var i=new DOMPoint(t,n),o=this.parentNode.state.absoluteLinearMatrix.inverse();t=(i=i.matrixTransform(o)).x,n=i.y}this.setPosition(this.state.left+t,this.state.top+n,e(e({},r),{},{tx:t,ty:n}))}},{key:"setGlobalPosition",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new vn;if(this.parentNode){var i=new DOMPoint(t,n),o=this.parentNode.state.absoluteLinearMatrix.inverse();t=(i=i.matrixTransform(o)).x,n=i.y}this.setPosition(t,n,e(e({},r),{},{left:t,top:n}))}},{key:"setGlobalRotate",value:function(t){if(this.parentNode){var e=this.parentNode.state.absoluteLinearMatrix;t-=Rn.calcRotateAngleFromMatrix(e)}this.setState({transform:{rotate:t}})}},{key:"localToGlobal",value:function(t,e){var n=new DOMPoint(t,e),r=this.state.composedMatrix;return n=n.matrixTransform(r)}},{key:"globalToLocal",value:function(t,e){var n=new DOMPoint(t,e),r=this.state.composedMatrix.inverse();return n=n.matrixTransform(r)}},{key:"getRotateAngle",value:function(){var t=this.state.composedMatrix;return Rn.calcRotateAngleFromMatrix(t)}},{key:"getLocalLeftTop",value:function(){var t=this.getMinBoundingBox(),e=t.width,n=t.height;return{left:t.centerX-t.width/2,top:t.centerY-t.height/2,width:e,height:n}}},{key:"toJSON",value:function(){return"{}"}},{key:"fromJSON",value:function(t){return{}}},{key:"destory",value:function(){}}]),s}();o(Tn,"instanceCounter",0);var Bn=function(t){a(u,Tn);var r=h(u);function u(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(this,u),o(c(t=r.call(this,e({closePath:!0},i))),"path2D",new Path2D),t}return i(u,[{key:"initEvents",value:function(){}},{key:"doRender",value:function(){this.createPathObject(),this.ctx.beginPath(),this.state.closePath&&this.ctx.fill(this.path2D),this.ctx.stroke(this.path2D),v(s(u.prototype),"doRender",this).call(this)}}]),u}(),An=function(t){a(o,Bn);var r=h(o);function o(t){return n(this,o),r.call(this,e({dots:[],closePath:!0},t))}return i(o,[{key:"calcOriginalDimension",value:function(){this.calcDots();var t=this.calc4VertexPoints(),e=Math.abs(t[1].x-t[0].x),n=Math.abs(t[2].y-t[0].y);return this.state.width=e,this.state.height=n,{width:this.state.width,height:this.state.height}}},{key:"calcLocalOrigin",value:function(){for(var t=v(s(o.prototype),"calcLocalOrigin",this).call(this),e=0;e<this.state.dots.length;e++){var n=this.state.dots[e];n=n.matrixTransform(new DOMMatrix([1,0,0,1,-t.x,-t.y])),this.state.dots[e]=n}return t}},{key:"createPathObject",value:function(){this.path2D=new Path2D;for(var t=0;t<this.state.dots.length;t++){var e=this.state.dots[t];0===t?this.path2D.moveTo(e.x,e.y):this.path2D.lineTo(e.x,e.y)}return this.state.closePath&&this.path2D.closePath(),this.path2D}},{key:"calcDots",value:function(){return this.state.dots=[],this.state.dots}},{key:"calc4VertexPoints",value:function(){for(var t=0,e=0,n=0,r=0,i=0;i<this.state.dots.length;i++){var o=this.state.dots[i];0===i?(t=o.x,n=o.x,e=o.y,r=o.y):(o.x<t&&(t=o.x),o.x>n&&(n=o.x),o.y<e&&(e=o.y),o.y>r&&(r=o.y))}var a=n,s=e,u=t,c=r,l=n,h=r;return[new DOMPoint(t,e),new DOMPoint(a,s),new DOMPoint(u,c),new DOMPoint(l,h)]}}]),o}(),Nn=function(t){a(o,An);var r=h(o);function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(this,o),r.call(this,e({width:10,height:10},t))}return i(o,[{key:"calcDots",value:function(){var t=new DOMPoint(0,0),e=new DOMPoint(this.state.width,0),n=new DOMPoint(this.state.width,this.state.height),r=new DOMPoint(0,this.state.height);return this.state.dots=[t,e,n,r],this.state.dots}}]),o}(),Cn=function(t){a(r,Nn);var e=h(r);function r(t){var i;return n(this,r),o(c(i=e.call(this,t)),"parentNode",null),o(c(i),"childNodes",[]),i}return i(r,[{key:"addChild",value:function(t){t.trigger(y),t.parentNode=this,this.childNodes.push(t),t.trigger(g)}},{key:"addChildren",value:function(t){var e=this;t.forEach((function(t){e.addChild(t)}))}},{key:"removeChild",value:function(t){t.trigger(b),t.parentNode=null,t.root=null,t.ctx=null,t.evtBus=null,this.childNodes.splice(this.childNodes.indexOf(t),1),t.trigger(x)}},{key:"removeChildren",value:function(t){var e=this;t.forEach((function(t){e.removeChild(t)}))}},{key:"renderChildren",value:function(){var t=this;this.childNodes.forEach((function(e){e.root=t.root,e.ctx=t.ctx,e.evtBus=t.evtBus,e.trigger(d),e.state.isRendering||e.state.display&&(e.render(),e.trigger(p))}))}},{key:"render",value:function(){v(s(r.prototype),"render",this).call(this),this.renderChildren()}}]),r}();var Ln=function(t){return null==t},zn=function(t){a(o,Bn);var r=h(o);function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(this,o);var i=e({radiusX:20,radiusY:10,rotation:0,startAngle:0,endAngle:2*Math.PI,counterclockwise:!0},t);return i.width=2*i.radiusX,i.height=2*i.radiusY,r.call(this,i)}return i(o,[{key:"createPathObject",value:function(){return this.path2D=new Path2D,this.path2D.ellipse(this.state.radiusX-this.state.localOrigin.x,this.state.radiusY-this.state.localOrigin.y,this.state.radiusX,this.state.radiusY,this.state.rotation,this.state.startAngle,this.state.endAngle,this.state.counterclockwise),this.path2D.closePath(),this.path2D}},{key:"setState",value:function(t){Ln(t.radiusX)?Ln(t.width)||(t.radiusX=t.width/2):t.width=2*t.radiusX,Ln(t.radiusY)?Ln(t.height)||(t.radiusY=t.height/2):t.height=2*t.radiusY,v(s(o.prototype),"setState",this).call(this,t)}}]),o}(),Fn=function(t){a(i,zn);var r=h(i);function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(this,i);var o=e({radius:10},t);return o.radiusX=o.radius,o.radiusY=o.radius,r.call(this,o)}return i}();var In,Xn=function(t){a(r,Cn);var e=h(r);function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(this,r),e.call(this,t)}return r}(),Yn=function(t){a(o,Fn);var r=h(o);function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(this,o),r.call(this,e({linkable:!1,position:"T"},t))}return i(o,[{key:"initEvents",value:function(){v(s(o.prototype),"initEvents",this).call(this),this.on("mouseover",this.mouseOverHandler,this),this.on("mouseup",this.mosueUpHandler,this),this.once(d,this.afterAddHandler,this),this.once(b,this.beforeRemoveHandler,this)}},{key:"afterAddHandler",value:function(t){this.evtBus.on("hook-mousedown",this.hookMouseDownHandler,this),this.evtBus.on("hook-mouseup",this.hookMouseUpHandler,this)}},{key:"beforeRemoveHandler",value:function(t){this.evtBus.off("hook-mousedown",this.hookMouseDownHandler,this),this.evtBus.off("hook-mouseup",this.hookMouseUpHandler,this)}},{key:"hookMouseDownHandler",value:function(t){this.setState({display:!0})}},{key:"hookMouseUpHandler",value:function(t){var e=t.target,n=this.getMaxBoundingBox(),r=e.getMaxBoundingBox();if(n.isIntersect(r)){var i=e.parentNode.targetComponent,o=e.state.position;"start"===o?i.setStartSlot(this):"end"===o&&i.setEndSlot(this)}this.setState({display:!1})}},{key:"mouseOverHandler",value:function(t){console.log("mouse over...")}},{key:"mosueUpHandler",value:function(t){console.log("mouse up...")}}]),o}(),Hn=function(){function t(){n(this,t),o(this,"linkSlots",[]),o(this,"slotRadius",10)}return i(t,[{key:"createLinkSlots",value:function(){var t=new Yn({display:!1,transformable:!1,radius:this.slotRadius,position:"T",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),e=new Yn({display:!1,transformable:!1,radius:this.slotRadius,position:"R",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),n=new Yn({display:!1,transformable:!1,radius:this.slotRadius,position:"B",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),r=new Yn({display:!1,transformable:!1,radius:this.slotRadius,position:"L",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}});this.linkSlots=[t,e,n,r],this.addChildren([t,e,n,r])}},{key:"setSlotPositions",value:function(){var t=this.state.width,e=this.state.height,n=t/2,r=e/2,i={T:{left:n-this.slotRadius,top:-this.slotRadius},R:{left:t-this.slotRadius,top:r-this.slotRadius},B:{left:n-this.slotRadius,top:e-this.slotRadius},L:{left:-this.slotRadius,top:r-this.slotRadius}};this.linkSlots.forEach((function(t){var e=i[t.state.position],n=e.left,r=e.top;t.setState({left:n,top:r})}))}}]),t}();In=function(t){a(r,Xn);var e=h(r);function r(){var t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(this,r);var a=hn({},i);a.style={strokeStyle:"#8b0000",fillStyle:"rgba(255, 255, 49, 0.2)",lineWidth:1},o(c(t=e.call(this,a)),"linkSlots",[]),o(c(t),"slotRadius",10);var s=i.width,u=i.height,l=i.style;return t.addChild(new Nn({width:s,height:u,style:l,interactive:!1})),t.createLinkSlots(),t}return i(r,[{key:"renderChildren",value:function(){this.setSlotPositions(),v(s(r.prototype),"renderChildren",this).call(this)}}]),r}(),[Hn].forEach((function(t){Object.getOwnPropertyNames(t.prototype).forEach((function(e){"constructor"!=e&&Object.defineProperty(In.prototype,e,Object.getOwnPropertyDescriptor(t.prototype,e)||Object.create(null))}))}));
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2022 大漠穷秋
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
"use strict";function t(e,t){var i,n=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)),n}function e(e){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?t(Object(n),!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function s(t,e,i){return e&&n(t.prototype,e),i&&n(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function r(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function o(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}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function h(t,e){return(h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(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 l(t)}function c(i){var n=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 t,e=a(i);return u(this,n?(t=a(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function f(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=a(t)););return t}function d(){return(d="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=f(t,e);if(n)return(n=Object.getOwnPropertyDescriptor(n,e)).get?n.get.call(arguments.length<3?t:i):n.value}).apply(this,arguments)}function v(t){return function(t){if(Array.isArray(t))return p(t)}(t)||function(){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}()||function(t){if(t){if("string"==typeof t)return p(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(e="Object"===e&&t.constructor?t.constructor.name:e)||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?p(t,void 0):void 0}}(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 p(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}Object.defineProperty(exports,"__esModule",{value:!0});var R,y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},g="object"==typeof y&&y&&y.Object===Object&&y,m=g,b="object"==typeof self&&self&&self.Object===Object&&self,k=m||b||Function("return this")(),x=k.Symbol,w=x,C=Object.prototype,P=C.hasOwnProperty,S=C.toString,M=w?w.toStringTag:void 0,O=function(t){var e=P.call(t,M),i=t[M];try{var n=!(t[M]=void 0)}catch(t){}var s=S.call(t);return n&&(e?t[M]=i:delete t[M]),s},E=Object.prototype.toString,B=O,_=function(t){return E.call(t)},A=x?x.toStringTag:void 0,I=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(A&&A in Object(t)?B:_)(t)},N=Array.isArray,j=function(t){return null!=t&&"object"==typeof t},D=I,z=N,T=j,L=function(t){return"string"==typeof t||!z(t)&&T(t)&&"[object String]"==D(t)},H=function(t){return void 0===t},V="ICE_FRAME_EVENT",q="BEFORE_RENDER",X="AFTER_RENDER",W="BEFORE_ADD",J="AFTER_ADD",U="BEFORE_REMOVE",F="ROUND_FINISH",K="HOOK_MOUSEDOWN",Z="HOOK_MOUSEMOVE",Q="HOOK_MOUSEUP",G="BEFORE_RESIZE",Y="AFTER_RESIZE",$="BEFORE_ROTATE",tt="AFTER_ROTATE",et="BEFORE_MOVE",it="AFTER_MOVE",nt={linear:function(t,e,i,n){return t+(e-t)/i*(Date.now()-n)},easeInQuad:function(t,e,i,n){n=Date.now()-n;return t+(e-t)/i*(n/i)*n},easeOutQuad:function(t,e,i,n){n=Date.now()-n;return-(e-t)*(n/=i)*(n-2)+t},easeInOutQuad:function(t,e,i,n){n=Date.now()-n,e-=t;return(n/=i/2)<1?e/2*n*n+t:-e/2*(--n*(n-2)-1)+t},easeInQuart:function(t,e,i,n){n=Date.now()-n;return(e-t)*(n/=i)*n*n*n+t},easeOutQuart:function(t,e,i,n){return-(e-t)*((e=(Date.now()-n)/i-1)*e*e*e-1)+t},easeInOutQuart:function(t,e,i,n){n=Date.now()-n,e-=t;return(n/=i/2)<1?e/2*n*n*n*n+t:-e/2*((n-=2)*n*n*n-2)+t},easeInCubic:function(t,e,i,n){n=Date.now()-n;return(e-t)*(n/=i)*n*n+t},easeOutCubic:function(t,e,i,n){return(e-t)*((e=(Date.now()-n)/i-1)*e*e+1)+t},easeInOutCubic:function(t,e,i,n){n=Date.now()-n,e-=t;return(n/=i/2)<1?e/2*n*n*n+t:e/2*((n-=2)*n*n+2)+t}},st=function(){function n(t){i(this,n),r(this,"animationMap",new Map),this.ice=t}return s(n,[{key:"start",value:function(){return this.ice.evtBus.on(V,this.frameEventHandler,this),this}},{key:"stop",value:function(){return this.ice.evtBus.off(V,this.frameEventHandler,this),this}},{key:"frameEventHandler",value:function(t){for(var e=v(this.animationMap.values()),i=0;i<e.length;i++){var n=e[i];n.state.interactive=!1,this.tween(n),n.state.interactive=!0}}},{key:"tween",value:function(t){var i,n={},s=t.props.animations,r=1;for(i in s){var o=s[i];if(o.finished){if(++r===Object.keys(s).length){this.remove(t);break}}else{var a=o.from,h=o.to,l=o.duration,a=(H(o.startTime)&&(o.startTime=Date.now()),H(o.easing)&&(o.easing="linear"),nt[o.easing](a,h,l,o.startTime));h<a&&(a=h,o.finished=!0),n[i]=Math.floor(a)}}return t.setState(e({},n)),t}},{key:"add",value:function(t){this.animationMap.set(t.props.id,t)}},{key:"remove",value:function(t){L(t)?this.animationMap.delete(t):this.animationMap.delete(t.props.id)}}]),n}(),rt="undefined"!=typeof Float32Array?Float32Array:Array,ot=Math.PI/180;function at(t){return t*ot}function ht(t,e){var i=e[0],n=e[1],s=e[2],r=e[3],o=e[4],e=e[5],a=i*r-n*s;return a?(t[0]=r*(a=1/a),t[1]=-n*a,t[2]=-s*a,t[3]=i*a,t[4]=(s*e-r*o)*a,t[5]=(n*o-i*e)*a,t):null}function lt(t,e,i){var n=e[0],s=e[1],r=e[2],o=e[3],a=e[4],e=e[5],h=i[0],l=i[1],u=i[2],c=i[3],d=i[4],i=i[5];return t[0]=n*h+r*l,t[1]=s*h+o*l,t[2]=n*u+r*c,t[3]=s*u+o*c,t[4]=n*d+r*i+a,t[5]=s*d+o*i+e,t}function ut(t,e,i){e=e[0]*i[1]-e[1]*i[0];return t[0]=t[1]=0,t[2]=e,t}function ct(t,e,i){var n=e[0],e=e[1];return t[0]=i[0]*n+i[2]*e+i[4],t[1]=i[1]*n+i[3]*e+i[5],t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),R=new rt(2),rt!=Float32Array&&(R[0]=0,R[1]=0);var ft=function(){this.__data__=[],this.size=0},dt=function(t,e){return t===e||t!=t&&e!=e},vt=dt,pt=function(t,e){for(var i=t.length;i--;)if(vt(t[i][0],e))return i;return-1},yt=pt,gt=Array.prototype.splice,mt=pt,bt=pt,kt=pt,xt=ft,wt=function(t){var e=this.__data__,t=yt(e,t);return!(t<0||(t==e.length-1?e.pop():gt.call(e,t,1),--this.size,0))},Ct=function(t){var e=this.__data__,t=mt(e,t);return t<0?void 0:e[t][1]},Pt=function(t){return-1<bt(this.__data__,t)},St=function(t,e){var i=this.__data__,n=kt(i,t);return n<0?(++this.size,i.push([t,e])):i[n][1]=e,this};function Mt(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}Mt.prototype.clear=xt,Mt.prototype.delete=wt,Mt.prototype.get=Ct,Mt.prototype.has=Pt,Mt.prototype.set=St;var zt,Ot=Mt,Et=Ot,Bt=function(){this.__data__=new Et,this.size=0},_t=function(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t},At=function(t){return this.__data__.get(t)},It=function(t){return this.__data__.has(t)},Nt=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},jt=I,Dt=Nt,Tt=function(t){if(!Dt(t))return!1;t=jt(t);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},Lt=k["__core-js_shared__"],Rt=(zt=/[^.]+$/.exec(Lt&&Lt.keys&&Lt.keys.IE_PROTO||""))?"Symbol(src)_1."+zt:"",Ht=function(t){return!!Rt&&Rt in t},Vt=Function.prototype.toString,qt=function(t){if(null!=t){try{return Vt.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Xt=Tt,Wt=Ht,Jt=Nt,Ut=qt,Ft=/^\[object .+?Constructor\]$/,Kt=Function.prototype,Zt=Object.prototype,Qt=Kt.toString,Gt=Zt.hasOwnProperty,Yt=RegExp("^"+Qt.call(Gt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$t=function(t){return!(!Jt(t)||Wt(t))&&(Xt(t)?Yt:Ft).test(Ut(t))},te=function(t,e){return null==t?void 0:t[e]},ee=function(t,e){t=te(t,e);return $t(t)?t:void 0},ie=ee(k,"Map"),ne=ee(Object,"create"),se=ne,re=function(){this.__data__=se?se(null):{},this.size=0},oe=function(t){t=this.has(t)&&delete this.__data__[t];return this.size-=t?1:0,t},ae=ne,he=Object.prototype.hasOwnProperty,le=function(t){var e,i=this.__data__;return ae?"__lodash_hash_undefined__"===(e=i[t])?void 0:e:he.call(i,t)?i[t]:void 0},ue=ne,ce=Object.prototype.hasOwnProperty,fe=ne,de=re,ve=oe,pe=le,ye=function(t){var e=this.__data__;return ue?void 0!==e[t]:ce.call(e,t)},ge=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=fe&&void 0===e?"__lodash_hash_undefined__":e,this};function me(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}me.prototype.clear=de,me.prototype.delete=ve,me.prototype.get=pe,me.prototype.has=ye,me.prototype.set=ge;var be=me,ke=Ot,xe=ie,we=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t},Ce=function(t,e){t=t.__data__;return we(e)?t["string"==typeof e?"string":"hash"]:t.map},Pe=Ce,Se=Ce,Me=Ce,Oe=Ce,Ee=function(){this.size=0,this.__data__={hash:new be,map:new(xe||ke),string:new be}},Be=function(t){t=Pe(this,t).delete(t);return this.size-=t?1:0,t},_e=function(t){return Se(this,t).get(t)},Ae=function(t){return Me(this,t).has(t)},Ie=function(t,e){var i=Oe(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this};function Ne(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}Ne.prototype.clear=Ee,Ne.prototype.delete=Be,Ne.prototype.get=_e,Ne.prototype.has=Ae,Ne.prototype.set=Ie;var je=Ot,De=ie,ze=Ne,Te=Ot,Le=Bt,Re=_t,He=At,Ve=It,qe=function(t,e){var i=this.__data__;if(i instanceof je){var n=i.__data__;if(!De||n.length<199)return n.push([t,e]),this.size=++i.size,this;i=this.__data__=new ze(n)}return i.set(t,e),this.size=i.size,this};function Xe(t){t=this.__data__=new Te(t);this.size=t.size}Xe.prototype.clear=Le,Xe.prototype.delete=Re,Xe.prototype.get=He,Xe.prototype.has=Ve,Xe.prototype.set=qe;var We=Xe,Je=ee,Ue=function(){try{var t=Je(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Fe=Ue,Ke=function(t,e,i){"__proto__"==e&&Fe?Fe(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0}):t[e]=i},Ze=Ke,Qe=dt,Ge=function(t,e,i){(void 0===i||Qe(t[e],i))&&(void 0!==i||e in t)||Ze(t,e,i)},Ye=function(t,e,i){for(var n=-1,s=Object(t),r=i(t),o=r.length;o--;){var a=r[++n];if(!1===e(s[a],a,s))break}return t},$e={exports:{}},ti=(!function(t,e){var e=e&&!e.nodeType&&e,i=e&&t&&!t.nodeType&&t,i=i&&i.exports===e?k.Buffer:void 0,n=i?i.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();e=t.length,e=n?n(e):new t.constructor(e);return t.copy(e),e}}($e,$e.exports),k.Uint8Array),ei=function(t){var e=new t.constructor(t.byteLength);return new ti(e).set(new ti(t)),e},ii=function(t,e){e=e?ei(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)},ni=function(t,e){var i=-1,n=t.length;for(e=e||Array(n);++i<n;)e[i]=t[i];return e},si=Nt,ri=Object.create,oi=function(){function e(){}return function(t){if(!si(t))return{};if(ri)return ri(t);e.prototype=t;t=new e;return e.prototype=void 0,t}}(),ai=function(e,i){return function(t){return e(i(t))}},hi=ai(Object.getPrototypeOf,Object),li=Object.prototype,ui=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||li)},ci=oi,fi=hi,di=ui,vi=function(t){return"function"!=typeof t.constructor||di(t)?{}:ci(fi(t))},pi=I,yi=j,gi=function(t){return yi(t)&&"[object Arguments]"==pi(t)},mi=j,bi=Object.prototype,ki=bi.hasOwnProperty,xi=bi.propertyIsEnumerable,wi=gi(function(){return arguments}())?gi:function(t){return mi(t)&&ki.call(t,"callee")&&!xi.call(t,"callee")},Ci=function(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991},Pi=Tt,Si=Ci,Mi=function(t){return null!=t&&Si(t.length)&&!Pi(t)},Oi=Mi,Ei=j,Bi=function(t){return Ei(t)&&Oi(t)},_i={exports:{}},Ai=function(){return!1},Ii=(!function(t,e){var e=e&&!e.nodeType&&e,i=e&&t&&!t.nodeType&&t,i=i&&i.exports===e?k.Buffer:void 0,e=(i?i.isBuffer:void 0)||Ai;t.exports=e}(_i,_i.exports),I),Ni=hi,ji=j,Di=Function.prototype,zi=Object.prototype,Ti=Di.toString,Li=zi.hasOwnProperty,Ri=Ti.call(Object),Hi=function(t){if(!ji(t)||"[object Object]"!=Ii(t))return!1;t=Ni(t);if(null===t)return!0;t=Li.call(t,"constructor")&&t.constructor;return"function"==typeof t&&t instanceof t&&Ti.call(t)==Ri},Vi=I,qi=Ci,Xi=j,Wi={},Ji=(Wi["[object Float32Array]"]=Wi["[object Float64Array]"]=Wi["[object Int8Array]"]=Wi["[object Int16Array]"]=Wi["[object Int32Array]"]=Wi["[object Uint8Array]"]=Wi["[object Uint8ClampedArray]"]=Wi["[object Uint16Array]"]=Wi["[object Uint32Array]"]=!0,Wi["[object Arguments]"]=Wi["[object Array]"]=Wi["[object ArrayBuffer]"]=Wi["[object Boolean]"]=Wi["[object DataView]"]=Wi["[object Date]"]=Wi["[object Error]"]=Wi["[object Function]"]=Wi["[object Map]"]=Wi["[object Number]"]=Wi["[object Object]"]=Wi["[object RegExp]"]=Wi["[object Set]"]=Wi["[object String]"]=Wi["[object WeakMap]"]=!1,function(t){return Xi(t)&&qi(t.length)&&!!Wi[Vi(t)]}),Ui=function(e){return function(t){return e(t)}},Fi={exports:{}},Ki=(!function(t,e){var e=e&&!e.nodeType&&e,i=e&&t&&!t.nodeType&&t,n=i&&i.exports===e&&g.process,e=function(){try{return i&&i.require&&i.require("util").types||n&&n.binding&&n.binding("util")}catch(t){}}();t.exports=e}(Fi,Fi.exports),Ji),Zi=Ui,Qi=Fi.exports,Gi=Qi&&Qi.isTypedArray,Yi=Gi?Zi(Gi):Ki,$i=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},tn=Ke,en=dt,nn=Object.prototype.hasOwnProperty,sn=function(t,e,i){var n=t[e];nn.call(t,e)&&en(n,i)&&(void 0!==i||e in t)||tn(t,e,i)},rn=Ke,on=function(t,e,i,n){var s=!i;i=i||{};for(var r=-1,o=e.length;++r<o;){var a=e[r],h=n?n(i[a],t[a],a,i,t):void 0;void 0===h&&(h=t[a]),(s?rn:sn)(i,a,h)}return i},an=/^(?:0|[1-9]\d*)$/,hn=function(t,e){var i=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==i||"symbol"!=i&&an.test(t))&&-1<t&&t%1==0&&t<e},ln=function(t,e){for(var i=-1,n=Array(t);++i<t;)n[i]=e(i);return n},un=wi,cn=N,fn=_i.exports,dn=hn,vn=Yi,pn=Object.prototype.hasOwnProperty,yn=function(t,e){var i,n=cn(t),s=!n&&un(t),r=!n&&!s&&fn(t),o=!n&&!s&&!r&&vn(t),a=n||s||r||o,h=a?ln(t.length,String):[],l=h.length;for(i in t)!e&&!pn.call(t,i)||a&&("length"==i||r&&("offset"==i||"parent"==i)||o&&("buffer"==i||"byteLength"==i||"byteOffset"==i)||dn(i,l))||h.push(i);return h},gn=Nt,mn=ui,bn=function(t){var e=[];if(null!=t)for(var i in Object(t))e.push(i);return e},kn=Object.prototype.hasOwnProperty,xn=yn,wn=function(t){if(!gn(t))return bn(t);var e,i=mn(t),n=[];for(e in t)("constructor"!=e||!i&&kn.call(t,e))&&n.push(e);return n},Cn=Mi,Pn=function(t){return Cn(t)?xn(t,!0):wn(t)},Sn=on,Mn=Pn,On=Ge,En=$e.exports,Bn=ii,_n=ni,An=vi,In=wi,Nn=N,jn=Bi,Dn=_i.exports,zn=Tt,Tn=Nt,Ln=Hi,Rn=Yi,Hn=$i,Vn=function(t){return Sn(t,Mn(t))},qn=We,Xn=Ge,Wn=Ye,Jn=function(t,e,i,n,s,r,o){var a,h,l,u=Hn(t,i),c=Hn(e,i),d=o.get(c);d?On(t,i,d):((e=void 0===(d=r?r(u,c,i+"",t,e,o):void 0))&&(h=!(a=Nn(c))&&Dn(c),l=!a&&!h&&Rn(c),d=c,a||h||l?d=Nn(u)?u:jn(u)?_n(u):h?En(c,!(e=!1)):l?Bn(c,!(e=!1)):[]:Ln(c)||In(c)?In(d=u)?d=Vn(u):Tn(u)&&!zn(u)||(d=An(c)):e=!1),e&&(o.set(c,d),s(d,c,n,r,o),o.delete(c)),On(t,i,d))},Un=Nt,Fn=Pn,Kn=$i,Zn=function n(s,r,o,a,h){s!==r&&Wn(r,function(t,e){var i;h=h||new qn,Un(t)?Jn(s,r,e,o,n,a,h):(i=a?a(Kn(s,e),t,e+"",s,r,h):void 0,Xn(s,e,i=void 0===i?t:i))},Fn)},Qn=function(t){return t},Gn=function(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)},Yn=Math.max,$n=function(r,o,a){return o=Yn(void 0===o?r.length-1:o,0),function(){for(var t=arguments,e=-1,i=Yn(t.length-o,0),n=Array(i);++e<i;)n[e]=t[o+e];for(var e=-1,s=Array(o+1);++e<o;)s[e]=t[e];return s[o]=a(n),Gn(r,this,s)}},ts=function(t){return function(){return t}},es=Ue,is=es?function(t,e){return es(t,"toString",{configurable:!0,enumerable:!1,value:ts(e),writable:!0})}:Qn,ns=Date.now,ss=function(i){var n=0,s=0;return function(){var t=ns(),e=16-(t-s);if(s=t,0<e){if(800<=++n)return arguments[0]}else n=0;return i.apply(void 0,arguments)}}(is),rs=Qn,os=$n,as=ss,hs=dt,ls=Mi,us=hn,cs=Nt,fs=function(t,e){return as(os(t,e,rs),t+"")},ds=function(t,e,i){if(!cs(i))return!1;var n=typeof e;return!!("number"==n?ls(i)&&us(e,i.length):"string"==n&&e in i)&&hs(i[e],t)},vs=Zn,ps=function(a){return fs(function(t,e){var i=-1,n=e.length,s=1<n?e[n-1]:void 0,r=2<n?e[2]:void 0,s=3<a.length&&"function"==typeof s?(n--,s):void 0;for(r&&ds(e[0],e[1],r)&&(s=n<3?void 0:s,n=1),t=Object(t);++i<n;){var o=e[i];o&&a(t,o,i)}return t})}(function(t,e,i){vs(t,e,i)}),ys=s(function t(){var e,n,s=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};for(e in i(this,t),s)this[e]=s[e];for(n in r)this[n]=r[n]}),gs=ai(Object.keys,Object),ms=ui,bs=gs,ks=Object.prototype.hasOwnProperty,xs=function(t){if(!ms(t))return bs(t);var e,i=[];for(e in Object(t))ks.call(t,e)&&"constructor"!=e&&i.push(e);return i},ws=ee(k,"DataView"),Cs=ie,Ps=ee(k,"Promise"),Ss=ee(k,"Set"),Ms=ee(k,"WeakMap"),Os=I,Es=qt,Bs=Es(ws),_s=Es(Cs),As=Es(Ps),Is=Es(Ss),Ns=Es(Ms),js=Os,Ds=((ws&&"[object DataView]"!=js(new ws(new ArrayBuffer(1)))||Cs&&"[object Map]"!=js(new Cs)||Ps&&"[object Promise]"!=js(Ps.resolve())||Ss&&"[object Set]"!=js(new Ss)||Ms&&"[object WeakMap]"!=js(new Ms))&&(js=function(t){var e=Os(t),t="[object Object]"==e?t.constructor:void 0,t=t?Es(t):"";if(t)switch(t){case Bs:return"[object DataView]";case _s:return"[object Map]";case As:return"[object Promise]";case Is:return"[object Set]";case Ns:return"[object WeakMap]"}return e}),xs),zs=js,Ts=wi,Ls=N,Rs=Mi,Hs=_i.exports,Vs=ui,qs=Yi,Xs=Object.prototype.hasOwnProperty,Ws=function(t){if(null==t)return!0;if(Rs(t)&&(Ls(t)||"string"==typeof t||"function"==typeof t.splice||Hs(t)||qs(t)||Ts(t)))return!t.length;var e,i=zs(t);if("[object Map]"==i||"[object Set]"==i)return!t.size;if(Vs(t))return!Ds(t).length;for(e in t)if(Xs.call(t,e))return!1;return!0},Js=null,Us=((Js=window||global||{}).requestFrame=Js.requestAnimationFrame||Js.webkitRequestAnimationFrame||Js.mozRequestAnimationFrame||Js.oRequestAnimationFrame||Js.msRequestAnimationFrame,Js),Fs=function(){function t(){i(this,t),r(this,"listeners",{}),r(this,"suspendedEventNames",[])}return s(t,[{key:"on",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Us;this.listeners[t]||(this.listeners[t]=[]),this.off(t,e,i),this.listeners[t].push({callback:e,scope:i})}},{key:"off",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Us;if(n=this.listeners[t])for(var n=v(n),s=0;s<n.length;s++){var r=n[s];if(r.callback===e&&r.scope===i)return void this.listeners[t].splice(s,1)}}},{key:"once",value:function(i,n){var s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Us,r=this;r.on(i,function t(e){r.off(i,t,s),n.call(s,e)},s)}},{key:"trigger",value:function(t){var i,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(Ws(this.listeners[t]))return!1;if(this.suspendedEventNames.includes(t))return!1;n?((i=new ys(n)).originalEvent=n.originalEvent||n,i.param=e({},s)):i=new ys({type:t,timeStamp:Date.now(),param:e({},s)});for(var r=this.listeners[t],o=0;o<r.length;o++){var a=r[o];a.callback.call(a.scope,i)}return!0}},{key:"suspend",value:function(t){t&&!this.suspendedEventNames.includes(t)&&this.suspendedEventNames.push(t)}},{key:"resume",value:function(e){this.suspendedEventNames.splice(this.suspendedEventNames.findIndex(function(t){return t===e}),1)}},{key:"purgeEvents",value:function(){this.listeners={},this.suspendedEventNames=[]}},{key:"hasListener",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Us;if(!this.listeners[t])return!1;var n=this.listeners[t];if(!n)return!1;for(var s=0;s<n.length;s++){var r=n[s];if(r.callback===e&&r.scope===i)return!0}return!1}}]),t}(),Ks=(Fs.prototype.addEventListener=Fs.prototype.on,Fs.prototype.removeEventListener=Fs.prototype.off,Fs.prototype.dispatchEvent=Fs.prototype.trigger,function(){function o(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[0,0,0,0,0,0,0,0,0,0];i(this,o),r(this,"tl",[0,0]),r(this,"tr",[0,0]),r(this,"bl",[0,0]),r(this,"br",[0,0]),r(this,"tc",[0,0]),r(this,"rc",[0,0]),r(this,"bc",[0,0]),r(this,"lc",[0,0]),r(this,"center",[0,0]),this.tl=[t[0],t[1]],this.tr=[t[2],t[3]],this.bl=[t[4],t[5]],this.br=[t[6],t[7]],this.tc=[(this.tr[0]+this.tl[0])/2,(this.tr[1]+this.tl[1])/2],this.bc=[(this.br[0]+this.bl[0])/2,(this.br[1]+this.bl[1])/2],this.lc=[(this.bl[0]+this.tl[0])/2,(this.bl[1]+this.tl[1])/2],this.rc=[(this.br[0]+this.tr[0])/2,(this.br[1]+this.tr[1])/2],this.center=[t[8],t[9]]}return s(o,[{key:"containsPoint",value:function(t){var e=this.getMinAndMaxPoint(),i=e.minX,n=e.minY,s=e.maxX,e=e.maxY;if(t[0]<i||t[0]>s||t[1]<n||t[1]>e)return!1;for(var r=0,o=this.getBoundingLines(),a=0;a<o.length;a++){var h,l=o[a];t[1]>l.o[1]&&t[1]>l.d[1]||t[1]<l.o[1]&&t[1]<l.d[1]||(l.o[0]===l.d[0]&&l.o[0]>=t[0]?l.o[0]:(h=(l.d[1]-l.o[1])/(l.d[0]-l.o[0]),l.o[0]+(t[1]-l.o[1])/h))>t[0]&&r++}return 0!==r&&r%2==1}},{key:"getBoundingLines",value:function(){return[{o:v(this.tl),d:v(this.tr)},{o:v(this.tr),d:v(this.br)},{o:v(this.br),d:v(this.bl)},{o:v(this.bl),d:v(this.tl)}]}},{key:"getMinAndMaxPoint",value:function(){for(var t=this.tl[0],e=this.tl[1],i=this.tl[0],n=this.tl[1],s=[this.tr,this.bl,this.br],r=0;r<s.length;r++){var o=s[r];o[0]<t&&(t=o[0]),o[0]>i&&(i=o[0]),o[1]<e&&(e=o[1]),o[1]>n&&(n=o[1])}return{minX:t,minY:e,maxX:i,maxY:n}}},{key:"containsBox",value:function(t){return!1}},{key:"isIntersect",value:function(t){var e=this.tl[0],i=this.br[0],n=this.tl[1],s=this.br[1],r=t.tl[0],o=t.br[0],a=t.tl[1],t=t.br[1];return!(o<e||t<n||i<r||s<a)}},{key:"transform",value:function(t){var e=ct([],this.tl,t),i=ct([],this.tr,t),n=ct([],this.bl,t),s=ct([],this.br,t),t=ct([],this.center,t);return new o([].concat(v(e),v(i),v(n),v(s),v(t)))}},{key:"union",value:function(t){return null}},{key:"width",get:function(){var t=this.br[0]-this.bl[0],e=this.br[1]-this.bl[1];return Math.hypot(t,e)}},{key:"height",get:function(){var t=this.br[0]-this.tr[0],e=this.br[1]-this.tr[1];return Math.hypot(t,e)}},{key:"left",get:function(){return this.tl[0]},set:function(t){throw new Error("Can not set left to ICEBoundingBox directly.")}},{key:"top",get:function(){return this.tl[1]},set:function(t){throw new Error("Can not set top to ICEBoundingBox directly.")}},{key:"centerX",get:function(){return this.center[0]}},{key:"centerY",get:function(){return this.center[1]}},{key:"centerPoint",get:function(){return this.center}}],[{key:"fromDimension",value:function(t,e,i,n){return new o([].concat([t,e],[t+i,e],[t,e+n],[t+i,e+n],[t+i/2,e+n/2]))}}]),o}()),Zs=function(){function t(){i(this,t)}return s(t,null,[{key:"calcRotateAngleFromMatrix",value:function(t){var e=0,i=t[0],t=t[1],n=Math.hypot(i,t),t=t/n,e=Math.acos(i/n);return t<0&&(e+=Math.PI/2),e*(180/Math.PI)}},{key:"calcScaleFromMatrix",value:function(t){var e=t[0],i=t[1],n=t[2],t=t[3];return[Math.hypot(e,i)/e,Math.hypot(n,t)/t]}}]),t}();function Qs(t,e){return e.split(".").reduce(function(t,e){return t[e]},t)}function Gs(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,s=0;s<e.length;s++){var r=e[s];r._level=i,r._pid=n,t.push(r),Gs(t,r.childNodes||[],i+1,r.id)}return t}function Ys(){if(Us.crypto)return Us.crypto.randomUUID();var i=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(i+16*Math.random())%16|0;return i=Math.floor(i/16),("x"==t?e:3&e|8).toString(16)})}var $s=function(){o(h,Fs);var a=c(h);function h(){var t,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return i(this,h),r(l(t=a.call(this)),"__dirty",!0),r(l(t),"props",{id:"ICE_"+Ys(),left:0,top:0,width:0,height:0,style:{fillStyle:"red",strokeStyle:"blue",lineWidth:1},fill:!0,stroke:!0,animations:{},transform:{translate:[0,0],scale:[1,1],skew:[0,0],rotate:0},linearMatrix:[],composedMatrix:[],origin:"localCenter",localOrigin:[0,0],absoluteOrigin:[0,0],zIndex:h.instanceCounter++,display:!0,draggable:!0,transformable:!0,interactive:!0,linkable:!0,showMinBoundingBox:!1,showMaxBoundingBox:!1}),r(l(t),"state",e({},t.props)),t.props=ps(t.props,n),t.state=JSON.parse(JSON.stringify(t.props)),t.initEvents(),t}return s(h,[{key:"initEvents",value:function(){}},{key:"render",value:function(){this.trigger(q),this.state.display&&(this.calcComponentParams(),this.applyStyleToCtx(),this.applyTransformToCtx(),this.doRender(),this.trigger(X),this.dirty=!1)}},{key:"applyStyleToCtx",value:function(){var t,i=e(e({},this.props.style),this.state.style);for(t in i)this.ctx[t]=i[t]}},{key:"calcComponentParams",value:function(){return{width:this.state.width,height:this.state.height}}},{key:"calcLocalOrigin",value:function(){var t=[0,0],e=this.state.origin;return e&&"localCenter"!==e||(t[0]=this.state.width/2,t[1]=this.state.height/2),this.state.localOrigin=t}},{key:"calcAbsoluteOrigin",value:function(){var t=Qs(this,"state.transform.translate.0")+this.state.left,e=Qs(this,"state.transform.translate.1")+this.state.top,i=v(this.calcLocalOrigin());return i[0]+=t,i[1]+=e,this.parentNode&&(i=ct([],i,[1,0,0,1,-this.parentNode.state.localOrigin[0],-this.parentNode.state.localOrigin[1]]),i=ct([],i,this.parentNode.state.composedMatrix)),this.state.absoluteOrigin=i}},{key:"calcLinearMatrix",value:function(){h=new rt(6),rt!=Float32Array&&(h[1]=0,h[2]=0,h[4]=0,h[5]=0),h[0]=1,h[3]=1;var t,e,i,n,s,r,o,a,h,l=Qs(this,"state.transform.skew.0"),u=Qs(this,"state.transform.skew.1");return t=[],e=[],l=h=function(t,e,i,n){i=Math.tan(i),n=Math.tan(n);return t[0]=e[0],t[1]=e[1]+i,t[2]=e[2]+n,t[3]=e[3],t[4]=e[4],t[5]=e[5],t}([],h,at(l),at(u)),u=at(Qs(this,"state.transform.rotate")),i=l[0],n=l[1],s=l[2],r=l[3],o=l[4],l=l[5],a=Math.sin(u),u=Math.cos(u),e[0]=i*u+s*a,e[1]=n*u+r*a,e[2]=i*-a+s*u,e[3]=n*-a+r*u,e[4]=o,e[5]=l,i=h=e,s=[Qs(this,"state.transform.scale.0"),Qs(this,"state.transform.scale.1")],n=i[0],a=i[1],r=i[2],u=i[3],o=i[4],i=i[5],l=s[0],s=s[1],t[0]=n*l,t[1]=a*l,t[2]=r*s,t[3]=u*s,t[4]=o,t[5]=i,h=t,this.state.linearMatrix=h}},{key:"calcAbsoluteLinearMatrix",value:function(){for(var t=this,e=t.calcLinearMatrix();t.parentNode;)e=lt([],t.parentNode.state.linearMatrix,e),t=t.parentNode;return this.state.absoluteLinearMatrix=e}},{key:"composeMatrix",value:function(){var t=this.calcAbsoluteOrigin(),t=lt([],[1,0,0,1,t[0],t[1]],this.calcAbsoluteLinearMatrix());return this.state.composedMatrix=t}},{key:"applyTransformToCtx",value:function(){var t,e=this.dirty?this.composeMatrix():this.state.composedMatrix;(t=this.ctx).setTransform.apply(t,v(e))}},{key:"doRender",value:function(){var t;this.ctx.setTransform(1,0,0,1,0,0),this.ctx.lineWidth=1,this.state.showMinBoundingBox&&(t=this.getMinBoundingBox(),this.ctx.strokeStyle="#ff0000",this.ctx.fillStyle="rgba(0,0,0,0)",this.ctx.beginPath(),this.ctx.moveTo(t.tl[0],t.tl[1]),this.ctx.lineTo(t.tr[0],t.tr[1]),this.ctx.lineTo(t.br[0],t.br[1]),this.ctx.lineTo(t.bl[0],t.bl[1]),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fill()),this.state.showMaxBoundingBox&&(t=this.getMaxBoundingBox(),this.ctx.strokeStyle="#0000ff",this.ctx.fillStyle="rgba(0,0,0,0)",this.ctx.beginPath(),this.ctx.moveTo(t.tl[0],t.tl[1]),this.ctx.lineTo(t.tr[0],t.tr[1]),this.ctx.lineTo(t.br[0],t.br[1]),this.ctx.lineTo(t.bl[0],t.bl[1]),this.ctx.closePath(),this.ctx.stroke(),this.ctx.fill())}},{key:"getMinBoundingBox",value:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],e=this.state.localOrigin[0],i=this.state.localOrigin[1],n=this.state.width,s=this.state.height,e=new Ks([0-e,0-i,0-e+n,0-i,0-e,0-i+s,0-e+n,0-i+s,0,0]),n=t?this.composeMatrix():this.state.composedMatrix;return e.transform(n)}},{key:"getMaxBoundingBox",value:function(){var t=this.getMinBoundingBox(0<arguments.length&&void 0!==arguments[0]&&arguments[0]),e=t.getMinAndMaxPoint(),i=e.minX,n=e.minY,s=e.maxX,e=e.maxY,t=t.centerPoint;return new Ks([i,n,s,n,i,e,s,e,t[0],t[1]])}},{key:"setState",value:function(t){ps(this.state,t),this.dirty=!0,this.ice&&(this.ice.dirty=!0)}},{key:"dirty",get:function(){return this.__dirty},set:function(t){this.__dirty=t}},{key:"setPosition",value:function(t,i){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new ys;this.trigger(et,e(e({},n),{},{left:t,top:i})),this.setState({left:t,top:i}),this.trigger(it,e(e({},n),{},{left:t,top:i}))}},{key:"moveGlobalPosition",value:function(t,i){var n,s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new ys;this.parentNode&&(t=(n=ct([],[t,i],ht([],this.parentNode.state.absoluteLinearMatrix)))[0],i=n[1]),this.setPosition(this.state.left+t,this.state.top+i,e(e({},s),{},{tx:t,ty:i}))}},{key:"setGlobalPosition",value:function(t,i){var n,s=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new ys;this.parentNode&&(t=(n=ct([],[t,i],ht([],this.parentNode.state.absoluteLinearMatrix)))[0],i=n[1]),this.setPosition(t,i,e(e({},s),{},{left:t,top:i}))}},{key:"setGlobalRotate",value:function(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteLinearMatrix,t-=Zs.calcRotateAngleFromMatrix(e)),this.setState({transform:{rotate:t}})}},{key:"localToGlobal",value:function(t,e){t=[t,e];return ct([],t,this.state.composedMatrix)}},{key:"globalToLocal",value:function(t,e){t=[t,e];return ct([],t,ht([],this.state.composedMatrix))}},{key:"getRotateAngle",value:function(){return this.state.transform.rotate}},{key:"getLocalLeftTop",value:function(){var t=this.getMinBoundingBox(!0),e=t.width,i=t.height;return{left:t.centerX-t.width/2,top:t.centerY-t.height/2,width:e,height:i}}},{key:"containsPoint",value:function(t,e){return this.getMinBoundingBox().containsPoint([t,e])}},{key:"destory",value:function(){this.trigger(U,null,{component:this}),this.purgeEvents(),this.ice=null,this.ctx=null,this.root=null,this.evtBus=null,this.parentNode=null}}]),h}(),tr=(r($s,"instanceCounter",0),function(){o(h,$s);var n=c(h);function h(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return i(this,h),r(l(t=n.call(this,e({closePath:!0},t))),"path2D",new Path2D),t}return s(h,[{key:"doRender",value:function(){this.dirty&&(this.ctx.beginPath(),this.createPathObject()),this.state.closePath&&this.path2D.closePath(),this.state.fill&&this.ctx.fill(this.path2D),this.state.stroke&&this.ctx.stroke(this.path2D),d(a(h.prototype),"doRender",this).call(this)}}]),h}()),er=function(){o(r,tr);var n=c(r);function r(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return i(this,r),n.call(this,e({width:10,height:10},t))}return s(r,[{key:"createPathObject",value:function(){return this.path2D=new Path2D,this.path2D.rect(0-this.state.localOrigin[0],0-this.state.localOrigin[1],this.state.width,this.state.height),this.path2D}}]),r}(),ir=function(){o(n,er);var e=c(n);function n(t){return i(this,n),r(l(t=e.call(this,t)),"parentNode",null),r(l(t),"childNodes",[]),t}return s(n,[{key:"addChild",value:function(t){t.trigger(W),(t.parentNode=this).childNodes.push(t),t.trigger(J)}},{key:"addChildren",value:function(t){for(var e=0;e<t.length;e++){var i=t[e];this.addChild(i)}}},{key:"removeChild",value:function(t){t.destory(),this.childNodes.splice(this.childNodes.indexOf(t),1)}},{key:"removeChildren",value:function(t){for(var e=0;e<t.length;e++){var i=t[e];this.removeChild(i)}}},{key:"destory",value:function(){this.removeChildren(this.childNodes),d(a(n.prototype),"destory",this).call(this)}}]),n}(),nr=function(){o(r,ir);var n=c(r);function r(t){return i(this,r),n.call(this,e(e({},t),{},{linkable:!1}))}return s(r,[{key:"doRender",value:function(){d(a(r.prototype),"doRender",this).call(this),this.setControlPositions()}},{key:"moveGlobalPosition",value:function(t,e,i){d(a(r.prototype),"moveGlobalPosition",this).call(this,t,e,i),this._targetComponent&&this._targetComponent.moveGlobalPosition(t,e,i)}}]),r}(),sr=function(t){return null==t},rr=/\s/,or=function(t){for(var e=t.length;e--&&rr.test(t.charAt(e)););return e},ar=/^\s+/,hr=I,lr=j,ur=function(t){return"symbol"==typeof t||lr(t)&&"[object Symbol]"==hr(t)},cr=function(t){return t&&t.slice(0,or(t)+1).replace(ar,"")},fr=Nt,dr=ur,vr=/^[-+]0x[0-9a-f]+$/i,pr=/^0b[01]+$/i,yr=/^0o[0-7]+$/i,gr=parseInt,mr=function(t){if("number"==typeof t)return t;if(dr(t))return NaN;if(fr(t)&&(e="function"==typeof t.valueOf?t.valueOf():t,t=fr(e)?e+"":e),"string"!=typeof t)return 0===t?t:+t;t=cr(t);var e=pr.test(t);return e||yr.test(t)?gr(t.slice(2),e?2:8):vr.test(t)?NaN:+t},br=mr,kr=function(t){return t?(t=br(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0},xr=function(t){var t=kr(t),e=t%1;return t==t?e?t-e:t:0},wr=function(t,e){for(var i=-1,n=null==t?0:t.length,s=Array(n);++i<n;)s[i]=e(t[i],i,t);return s},Cr=N,Pr=ur,Sr=x?x.prototype:void 0,Mr=Sr?Sr.toString:void 0,Or=function t(e){if("string"==typeof e)return e;if(Cr(e))return wr(e,t)+"";if(Pr(e))return Mr?Mr.call(e):"";var i=e+"";return"0"==i&&1/e==-1/0?"-0":i},Er=xr,Br=mr,_r=function(t){return null==t?"":Or(t)},Ar=k.isFinite,Ir=Math.min,Nr=function(){var s=Math.round;return function(t,e){var i,n;return t=Br(t),(e=null==e?0:Ir(Er(e),292))&&Ar(t)?(i=(_r(t)+"e").split("e"),n=s(i[0]+"e"+(+i[1]+e)),+((i=(_r(n)+"e").split("e"))[0]+"e"+(+i[1]-e))):s(t)}}(),jr=function(){function t(){throw i(this,t),new Error("GeoUtil is a static util class.")}return s(t,null,[{key:"calcRotateAngle",value:function(t,e,i,n){t-=i,i=e-n,e=Math.hypot(t,i);return((i/e<0?-1:1)*Math.acos(t/e)*180/Math.PI+360)%360}}]),t}(),Dr=function(){o(r,tr);var n=c(r);function r(t){return i(this,r),n.call(this,e({dots:[],transformedDots:[],closePath:!0},t))}return s(r,[{key:"calcComponentParams",value:function(){if(!this.dirty)return{width:this.state.width,height:this.state.height};this.calcDots();var t=this.calc4VertexPoints(),e=Math.abs(t[1][0]-t[0][0]),t=Math.abs(t[2][1]-t[0][1]);return this.state.width=e,this.state.height=t,{width:this.state.width,height:this.state.height}}},{key:"calcLocalOrigin",value:function(){for(var t=d(a(r.prototype),"calcLocalOrigin",this).call(this),e=0;e<this.state.dots.length;e++){var i=ct([],this.state.dots[e],[1,0,0,1,-t[0],-t[1]]);this.state.dots[e]=i}return t}},{key:"createPathObject",value:function(){this.path2D=new Path2D,this.path2D.moveTo(this.state.dots[0][0],this.state.dots[0][1]);for(var t=1;t<this.state.dots.length;t++){var e=this.state.dots[t];this.path2D.lineTo(e[0],e[1])}return this.path2D}},{key:"calcDots",value:function(){return this.state.dots=[],this.state.dots}},{key:"calc4VertexPoints",value:function(){for(var t=this.state.dots[0][0],e=this.state.dots[0][1],i=this.state.dots[0][0],n=this.state.dots[0][1],s=1;s<this.state.dots.length;s++){var r=this.state.dots[s];r[0]<t&&(t=r[0]),r[0]>i&&(i=r[0]),r[1]<e&&(e=r[1]),r[1]>n&&(n=r[1])}return[[t,e],[i,e],[t,n],[i,n]]}},{key:"applyTransformToCtx",value:function(){if(d(a(r.prototype),"applyTransformToCtx",this).call(this),this.dirty){var t=this.state.composedMatrix,e=this.state.dots;this.state.transformedDots=[];for(var i=0;i<e.length;i++){var n=ct([],e[i],t);this.state.transformedDots.push(n)}}}}]),r}(),zr=function(){o(h,Dr);var n=c(h);function h(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(i(this,h),h.arrangeParam(t));return console.log(t),r(l(t=n.call(this,t)),"links",{start:{},end:{}}),t}return s(h,[{key:"initEvents",value:function(){d(a(h.prototype),"initEvents",this).call(this),this.once(J,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function(t){this.evtBus.once(F,this.makeConnection,this)}},{key:"makeConnection",value:function(){var t,e,i=this.props.links;i&&(i.start&&(t=i.start.id,e=i.start.position,t&&e&&(t=this.ice.findComponent(t),this.setLink("start",t,e))),i.end&&(t=i.end.id,e=i.end.position,t&&e&&(i=this.ice.findComponent(t),this.setLink("end",i,e)))),this.ice.dirty=!0}},{key:"setLink",value:function(t,i,n){this.removeLink(t,i,n),this.links[t]={component:i,position:n},i.on(it,this.followComponent,this),i.on(Y,this.followComponent,this),i.on(tt,this.followComponent,this),i.once(X,this.followComponent,this),this.followComponent();var s,r={};for(s in this.links){var o=this.links[s];o.component&&o.position&&(r[s]={id:o.component.props.id,position:o.position})}this.setState({links:e({},r),draggable:!1})}},{key:"removeLink",value:function(t,e,i){var n=this.links[t].component,s=this.links[t].position;n===e&&s===i&&(n&&n.off(it,this.followComponent,this),n&&n.off(Y,this.followComponent,this),n&&n.off(tt,this.followComponent,this),this.links[t]={},this.state.links[t]={}),this.links.start.component||this.links.end.component||this.setState({draggable:!0})}},{key:"followComponent",value:function(t){for(var e in this.links){var i=this.links[e].position,n=this.links[e].component;if(i&&n){var s=n.getMinBoundingBox(),r=[0,0];switch(i){case"T":r=s.tc;break;case"R":r=s.rc;break;case"B":r=s.bc;break;case"L":r=s.lc}switch(e){case"start":this.setState({startPoint:v(r)});break;case"end":this.setState({endPoint:v(r)})}}}}},{key:"calcLocalOrigin",value:function(){var t=[0,0];return this.state.localOrigin=t}},{key:"calcDots",value:function(){var t=this.state.left,e=this.state.top;this.state.dots=[];for(var i=0;i<this.state.points.length;i++){var n=this.state.points[i],s=n[0]-t,n=n[1]-e;this.state.dots.push([s,n])}return this.calcArrowPoints(),this.state.dots}},{key:"calcArrowPoints",value:function(){var t,e,i;"start"!==this.state.arrowPosition&&"both"!==this.state.arrowPosition||(i=v(this.state.dots[0]),e=[v(this.state.dots[0]),v(this.state.dots[1])],e=this.doCalcArrowPoints(e),(t=this.state.dots).unshift.apply(t,v(e)),this.state.dots.unshift(v(i))),"end"!==this.state.arrowPosition&&"both"!==this.state.arrowPosition||(t=this.state.dots.length,e=v(this.state.dots[t-1]),i=[v(this.state.dots[t-1]),v(this.state.dots[t-2])],i=this.doCalcArrowPoints(i),(t=this.state.dots).push.apply(t,v(i)),this.state.dots.push(v(e)))}},{key:"doCalcArrowPoints",value:function(t){var e=t[0],t=t[1],i=(t[0]=t[0]-e[0],t[1]=t[1]-e[1],t[0]/Math.hypot.apply(Math,v(t))),t=t[1]/Math.hypot.apply(Math,v(t)),n=Math.cos(this.state.arrowAngel),s=Math.sin(this.state.arrowAngel),r=this.state.arrowLength*(i*n-t*s),o=this.state.arrowLength*(t*n+i*s),a=this.state.arrowLength*(i*n+t*s),t=this.state.arrowLength*(t*n-i*s);return[[r+=e[0],o+=e[1]],[a+=e[0],t+=e[1]]]}},{key:"addDot",value:function(t,e){this.state.points.splice(e,0,t),this.state.dots.splice(e,0,[t[0],t[1]])}},{key:"rmDot",value:function(t){return!(this.state.points.length<3||(this.state.points.splice(t,1),this.state.dots.splice(t,1),0))}},{key:"calcComponentParams",value:function(){if(!this.dirty)return{width:this.state.width,height:this.state.height};this.calcDots();var t=this.calc4VertexPoints(),e=Math.abs(t[1][0]-t[0][0]),i=this.state.style.lineWidth;return this.isDotsOnSameLine()||(i=Math.abs(t[2][1]-t[0][1])),this.state.width=e,this.state.height=i,{width:this.state.width,height:this.state.height}}},{key:"isDotsOnSameLine",value:function(){for(var t=this.state.points.length,e=Nr(this.state.points[0][0],2),i=Nr(this.state.points[0][1],2),n=0,s=[Nr(this.state.points[t-1][0],2)-e,Nr(this.state.points[t-1][1],2)-i],r=0;r<t;r++){var o=this.state.points[r];0===ut([],s,[o[0]-e,o[1]-i])[2]&&n++}return n===t}},{key:"calc4VertexPoints",value:function(){return this.isDotsOnSameLine()?this.splitEndpointsTo4Points():d(a(h.prototype),"calc4VertexPoints",this).call(this)}},{key:"splitEndpointsTo4Points",value:function(){var t=this.state.points.length,e=this.state.points[t-1][0]-this.state.points[0][0],t=this.state.points[t-1][1]-this.state.points[0][1],i=this.getRotateAngle(),n=this.state.height,s=Math.cos(i*Math.PI/180)*n/2,i=Math.sin(i*Math.PI/180)*n/2;return[[0+(s=Nr(s,3)),0+(i=Nr(i,3))],[0-s,0-i],[e+s,t+i],[e-s,t-i]]}},{key:"getMinBoundingBox",value:function(){var t=this.state.localOrigin[0],e=this.state.localOrigin[1],i=this.calc4VertexPoints(),t=new Ks([i[0][0]-t,i[0][1]-e,i[1][0]-t,i[1][1]-e,i[2][0]-t,i[2][1]-e,i[3][0]-t,i[3][1]-e,0,0]);return t.transform(this.state.composedMatrix)}},{key:"setState",value:function(t){if(sr(t.width)||delete t.width,sr(t.height)||delete t.height,sr(t.transform)||delete t.transform,!sr(t.left))for(var e=t.left-this.state.points[0][0],i=0;i<this.state.points.length;i++)this.state.points[i][0]+=e;if(!sr(t.top))for(var n=t.top-this.state.points[0][1],s=0;s<this.state.points.length;s++)this.state.points[s][1]+=n;var r;sr(t.startPoint)||(this.state.points[0]=v(t.startPoint),this.state.left=this.state.points[0][0],this.state.top=this.state.points[0][1]),sr(t.endPoint)||(r=this.state.points.length,this.state.points[r-1]=v(t.endPoint)),d(a(h.prototype),"setState",this).call(this,t)}},{key:"getRotateAngle",value:function(){var t,e;return this.isDotsOnSameLine()?(e=this.state.points.length,t=this.state.points[e-1][0]-this.state.points[0][0],e=this.state.points[e-1][1]-this.state.points[0][1],jr.calcRotateAngle(t,e,0,0)+90):d(a(h.prototype),"getRotateAngle",this).call(this)}},{key:"containsPoint",value:function(t,e){for(var i=this.getLines(),n=0;n<i.length;n++){var s=i[n],r=s.o[0],o=s.o[1],a=s.d[0],s=s.d[1],h=Math.hypot(a-r,s-o),r=Math.hypot(r-t,o-e),o=Math.hypot(a-t,s-e);if(h-3<=r+o&&r+o<=h+3)return!0}return!1}},{key:"getLines",value:function(){var t=[],e=this.state.transformedDots;if(!e||e.length<2)return t;for(var i=0;i<e.length-1;i++){var n={o:[e[i][0],e[i][1]],d:[e[i+1][0],e[i+1][1]]};t.push(n)}return t}}],[{key:"arrangeParam",value:function(t){var i=ps({},{lineType:"solid",lineWidth:1,arrowPosition:"both",arrowLength:15,arrowAngel:at(30),points:[],showMinBoundingBox:!1,showMaxBoundingBox:!1,links:{},style:{lineJoin:"round"}},t,{linkable:!1,closePath:!1,fill:!1}),n=i.points.length;return n<2&&(0===n?(i.points.push([0,0]),i.points.push([10,10])):1===n&&i.points.push([10,10])),(i=e(e({},i),{left:t.points[0][0],top:t.points[0][1],transform:{translate:[0,0],scale:[1,1],skew:[0,0],rotate:0}})).style.lineWidth<1&&(i.style.lineWidth=1),i}}]),h}(),Tr=function(){o(r,tr);var n=c(r);function r(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(i(this,r),e({radiusX:20,radiusY:10,rotation:0,startAngle:0,endAngle:2*Math.PI,counterclockwise:!0},t));return t.width=2*t.radiusX,t.height=2*t.radiusY,n.call(this,t)}return s(r,[{key:"createPathObject",value:function(){return this.path2D=new Path2D,this.path2D.ellipse(this.state.radiusX-this.state.localOrigin[0],this.state.radiusY-this.state.localOrigin[1],this.state.radiusX,this.state.radiusY,this.state.rotation,this.state.startAngle,this.state.endAngle,this.state.counterclockwise),this.path2D.closePath(),this.path2D}},{key:"setState",value:function(t){sr(t.radiusX)?sr(t.width)||(t.radiusX=t.width/2):t.width=2*t.radiusX,sr(t.radiusY)?sr(t.height)||(t.radiusY=t.height/2):t.height=2*t.radiusY,d(a(r.prototype),"setState",this).call(this,t)}}]),r}(),Lr=function(){o(r,Tr);var n=c(r);function r(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(i(this,r),e({radius:10},t));return t.radiusX=t.radius,t.radiusY=t.radius,n.call(this,t)}return s(r)}(),Rr=function(){o(r,Lr);var n=c(r);function r(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return i(this,r),n.call(this,e({linkable:!1},t))}return s(r,[{key:"initEvents",value:function(){d(a(r.prototype),"initEvents",this).call(this),this.on("mousedown",this.mosueDownHandler,this),this.on("mousemove",this.mosueMoveHandler,this),this.on("mouseup",this.mosueUpHandler,this),this.on(it,this.resizeEvtHandler,this)}},{key:"mosueDownHandler",value:function(t){this.evtBus.trigger(K,new ys({target:this}))}},{key:"mosueMoveHandler",value:function(t){this.evtBus.trigger(Z,new ys({target:this}))}},{key:"mosueUpHandler",value:function(t){this.evtBus.trigger(Q,new ys({target:this}))}},{key:"resizeEvtHandler",value:function(t){var e;this.parentNode&&(e=this.props.position,this.parentNode.trigger(G,new ys(t,{position:e})),this.parentNode.trigger(Y,new ys(t,{position:e})))}}]),r}(),Hr=function(){o(a,nr);var n=c(a);function a(t){return i(this,a),r(l(t=n.call(this,e(e({},t),{},{zIndex:10000010,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"controlSize",16),t.initControls(),t}return s(a,[{key:"initControls",value:function(){var t=this.state.width,e=this.state.height,i=this.controlSize/2;this.startControl=new Rr({zIndex:10000011,display:!1,left:-i,top:-i,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"start"}),this.addChild(this.startControl),this.endControl=new Rr({zIndex:10000012,display:!1,left:t-i,top:e-i,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"end"}),this.addChild(this.endControl)}},{key:"initEvents",value:function(){this.on(Y,this.resizeEvtHandler,this)}},{key:"enable",value:function(){this.setState({display:!0}),this.resume(Y),this.showHooks()}},{key:"disable",value:function(){this.setState({display:!1}),this.suspend(Y),this.hideHooks()}},{key:"setControlPositions",value:function(){}},{key:"resizeEvtHandler",value:function(t){if(this.targetComponent){var e=t.position,i=t.movementX,n=t.movementY,t=this.targetComponent.state,s=t.points.length,r=t.points[0][0],o=t.points[0][1],a=t.points[s-1][0],h=t.points[s-1][1],s=ct([],[i,n],ht([],t.absoluteLinearMatrix)),i=s[0],n=s[1];switch(e){case"start":r+=i,o+=n;break;case"end":a+=i,h+=n}this.targetComponent.setState({startPoint:[r,o],endPoint:[a,h]})}}},{key:"updatePosition",value:function(){var t,e,i;this.targetComponent&&(this.setState({left:0,top:-5,width:3,height:3,transform:{translate:[0,0],scale:[1,1],skew:[0,0],rotate:0}}),t=this.controlSize/2,i=this.targetComponent.state.points.length,e=this.targetComponent.state.points[0],i=this.targetComponent.state.points[i-1],e=[e[0],e[1]],i=[i[0],i[1]],this.startControl.setState({left:e[0]-t,top:e[1]-t}),this.endControl.setState({left:i[0]-t,top:i[1]-t}))}},{key:"targetComponent",get:function(){return this._targetComponent},set:function(t){var e=this;this._targetComponent&&this._targetComponent.off(it,this.updatePosition,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(it,this.updatePosition,this),this._targetComponent&&this._targetComponent.once(U,function(){e.targetComponent=null,e.disable()},this),this.updatePosition()}},{key:"showHooks",value:function(){this.startControl.setState({display:!0}),this.endControl.setState({display:!0})}},{key:"hideHooks",value:function(){this.startControl.setState({display:!1}),this.endControl.setState({display:!1})}}]),a}(),Vr=function(){o(r,er);var n=c(r);function r(t){return i(this,r),n.call(this,e(e({position:"l",direction:"x",quadrant:1},t),{},{linkable:!1}))}return s(r,[{key:"initEvents",value:function(){d(a(r.prototype),"initEvents",this).call(this),this.on(it,this.resizeEvtHandler,this)}},{key:"resizeEvtHandler",value:function(t){if(this.parentNode){var e=t.quadrant,i=t.movementX,n=t.movementY,s=this.parentNode.state,r=s.left,o=s.top,a=s.width,h=s.height,s=ct([],[i,n],ht([],s.absoluteLinearMatrix)),i=s[0],n=s[1];switch(e){case 1:r-=i,o+=n,a+=2*i,h-=2*n;break;case 2:r+=i,o+=n,a-=2*i,h-=2*n;break;case 3:r+=i,o-=n,a-=2*i,h+=2*n;break;case 4:r-=i,o-=n,a+=2*i,h+=2*n;break;case 5:o+=n,h-=2*n;break;case 6:o-=n,h+=2*n;break;case 7:r+=i,a-=2*i;break;case 8:r-=i,a+=2*i}s={top:o,left:r,width:Math.abs(a),height:Math.abs(h)};this.parentNode.trigger(G,new ys(t,{quadrant:e})),this.parentNode.setState(s),this.parentNode.trigger(Y,new ys(t,{quadrant:e}))}}},{key:"moveGlobalPosition",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new ys,n=0<t?1:-1,s=0<e?1:-1,r=this.parentNode.state,o=r.localOrigin,a=r.width,h=r.height,r=ct([],[t,e],ht([],r.absoluteLinearMatrix)),r=(t=r[0],e=r[1],this.state),l=r.left,u=r.top,r=r.quadrant,c=this.state.width/2,d=0;"x"===this.state.direction?d=0<(l=0===Nr(l+=t)?.5*n:l)+c-o[0]?8:7:"y"===this.state.direction?d=0<(u=0===Nr(u+=e)?.5*s:u)+c-o[1]?6:5:"xy"===this.state.direction&&(s=-h/2/(s=0===Nr(s=-a/2)?.5*n:s),0===Nr(a=a/2)&&(a=.5*n),u+=e=2===r||4==r?s*(l+c-o[0]+t)-(u+c-o[1]):-h/2/a*(l+c-o[0]+t)-(u+c-o[1]),d=0<(l+=t)+c-o[0]?0<u+c-o[1]?4:1:0<u+c-o[1]?3:2),r!==d&&this.parentNode.toggleControlQuadrant(this,d),this.setPosition(l,u,new ys(i,{left:l,top:u,tx:t,ty:e,quadrant:d}))}}]),r}(),qr=function(){o(r,Lr);var n=c(r);function r(t){return i(this,r),n.call(this,e(e({},t),{},{linkable:!1}))}return s(r,[{key:"initEvents",value:function(){d(a(r.prototype),"initEvents",this).call(this),this.on(it,this.rotateEvtHandler,this)}},{key:"rotateEvtHandler",value:function(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteOrigin,t={transform:{rotate:jr.calcRotateAngle(t.offsetX,t.offsetY,e[0],e[1])+90}},this.parentNode.trigger($,new ys(t)),this.parentNode.setState(t),this.parentNode.trigger(tt,new ys(t)))}}]),r}(),Xr=function(){o(h,nr);var n=c(h);function h(t){return i(this,h),r(l(t=n.call(this,e(e({},t),{},{zIndex:10000001,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"rotateControlSize",8),r(l(t),"rotateControlffsetY",60),r(l(t),"resizeControlInstanceCache",[]),r(l(t),"resizeControlSize",16),t.initControls(),t}return s(h,[{key:"initControls",value:function(){var t=this.state.width,e=this.state.height,i=t/2,n=e/2,s=this.resizeControlSize/2,r=[{direction:"xy",quadrant:2,position:[-s,-s]},{direction:"y",quadrant:5,position:[i-s,-s]},{direction:"xy",quadrant:1,position:[t-s,-s]},{direction:"x",quadrant:8,position:[t-s,n-s]},{direction:"xy",quadrant:4,position:[t-s,e-s]},{direction:"y",quadrant:6,position:[i-s,e-s]},{direction:"xy",quadrant:3,position:[-s,e-s]},{direction:"x",quadrant:7,position:[-s,n-s]}];this.resizeControlInstanceCache=[];for(var o=0;o<r.length;o++){var a=r[o],a=new Vr({zIndex:10000002,display:!1,left:a.position[0],top:a.position[1],width:this.resizeControlSize,height:this.resizeControlSize,style:{strokeStyle:"#8b0000",fillStyle:"#CC3300",lineWidth:1},direction:a.direction,quadrant:a.quadrant});this.addChild(a),this.resizeControlInstanceCache.push(a)}t=this.state.width/2-this.rotateControlSize,i=-this.rotateControlffsetY;this.rotateControlInstance=new qr({zIndex:10000003,display:!1,left:t,top:i,radius:this.rotateControlSize,style:{strokeStyle:"#8b0000",fillStyle:"#CC3300",lineWidth:1}}),this.addChild(this.rotateControlInstance)}},{key:"initEvents",value:function(){d(a(h.prototype),"initEvents",this).call(this),this.on(Y,this.resizeEvtHandler,this),this.on(tt,this.rotateEvtHandler,this)}},{key:"enable",value:function(){this.rotateControlInstance.setState({display:!0});for(var t=0;t<this.resizeControlInstanceCache.length;t++)this.resizeControlInstanceCache[t].setState({display:!0});this.setState({display:!0}),this.resume(Y),this.resume(tt)}},{key:"disable",value:function(){this.rotateControlInstance.setState({display:!1});for(var t=0;t<this.resizeControlInstanceCache.length;t++)this.resizeControlInstanceCache[t].setState({display:!1});this.setState({display:!1}),this.suspend(Y),this.suspend(tt)}},{key:"setControlPositions",value:function(){for(var t=this.state.width,e=this.state.height,i=t/2,n=e/2,s=this.resizeControlSize/2,r=0;r<this.resizeControlInstanceCache.length;r++){var o=this.resizeControlInstanceCache[r],a=[0,0];switch(o.state.quadrant){case 1:a=[t-s,-s];break;case 2:a=[-s,-s];break;case 3:a=[-s,e-s];break;case 4:a=[t-s,e-s];break;case 5:a=[i-s,-s];break;case 6:a=[i-s,e-s];break;case 7:a=[-s,n-s];break;case 8:a=[t-s,n-s]}o.setState({left:a[0],top:a[1]})}var h=this.state.width/2-this.rotateControlSize,l=-this.rotateControlffsetY;this.rotateControlInstance.setState({left:h,top:l})}},{key:"rotateEvtHandler",value:function(t){var e;this.targetComponent&&(e=this.state.transform.rotate,this.targetComponent.setGlobalRotate(e),this.targetComponent.trigger(tt))}},{key:"resizeEvtHandler",value:function(t){if(this.targetComponent){var e=t.quadrant,i=t.movementX,n=t.movementY,t=this.targetComponent.state,s=t.left,r=t.top,o=t.width,a=t.height,t=ct([],[i,n],ht([],t.absoluteLinearMatrix)),i=t[0],n=t[1];switch(e){case 1:s-=i,r+=n,o+=2*i,a-=2*n;break;case 2:s+=i,r+=n,o-=2*i,a-=2*n;break;case 3:s+=i,r-=n,o-=2*i,a+=2*n;break;case 4:s-=i,r-=n,o+=2*i,a+=2*n;break;case 5:r+=n,a-=2*n;break;case 6:r-=n,a+=2*n;break;case 7:s+=i,o-=2*i;break;case 8:s-=i,o+=2*i}this.targetComponent.setState({left:s,top:r,width:Math.abs(o),height:Math.abs(a)}),this.targetComponent.trigger(Y)}}},{key:"updatePanel",value:function(){var t,e,i,n,s;this.targetComponent&&(t=this.targetComponent.getRotateAngle(),e=(s=this.targetComponent.getLocalLeftTop()).left,i=s.top,n=s.width,s=s.height,this.setState({left:e,top:i,width:n,height:s,transform:{rotate:t}}))}},{key:"targetComponent",get:function(){return this._targetComponent},set:function(t){var e=this;this._targetComponent&&this._targetComponent.off(it,this.updatePanel,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(it,this.updatePanel,this),this._targetComponent&&this._targetComponent.once(U,function(){e.targetComponent=null,e.disable()},this),this.updatePanel()}},{key:"toggleControlQuadrant",value:function(t,e){for(var i=0;i<this.resizeControlInstanceCache.length;i++){var n=this.resizeControlInstanceCache[i];if(n.state.quadrant===e){var s=0;switch(e){case 1:s=3;break;case 2:s=4;break;case 3:s=1;break;case 4:s=2;break;case 5:s=6;break;case 6:s=5;break;case 7:s=8;break;case 8:s=7}n.setState({quadrant:s})}}t.setState({quadrant:e})}}]),h}(),Wr=function(){function e(t){i(this,e),this.ice=t,this.transformControlPanel=new Xr({left:500,top:100,width:100,height:100,style:{strokeStyle:"#8b0000",fillStyle:"rgba(255, 255, 49, 0.2)",lineWidth:1},transform:{rotate:45}}),this.ice.addTool(this.transformControlPanel),this.transformControlPanel.disable(),this.lineControlPanel=new Hr({left:700,top:50,width:100,height:100,style:{strokeStyle:"rgba(255, 255, 49, 0)",fillStyle:"rgba(255, 255, 49, 0)",lineWidth:1}}),this.ice.addTool(this.lineControlPanel),this.lineControlPanel.disable()}return s(e,[{key:"start",value:function(){return this.ice.evtBus.on("mousedown",this.mouseDownHandler,this),this}},{key:"stop",value:function(){return this.ice.evtBus.off("mousedown",this.mouseDownHandler,this),this}},{key:"mouseDownHandler",value:function(t){t=t.target;if(!(t instanceof $s&&t.state.interactive&&t.state.transformable))return this.lineControlPanel.disable(),void this.transformControlPanel.disable();t&&(t instanceof nr||t.parentNode instanceof nr)||(this.ice.selectionList=[t],this.lineControlPanel.disable(),this.transformControlPanel.disable(),t instanceof zr?(this.lineControlPanel.targetComponent=t,this.lineControlPanel.enable()):(this.transformControlPanel.targetComponent=t,this.transformControlPanel.enable()))}}]),e}(),Jr=[["mousedown","ICE_MOUSEDOWN"],["mouseup","ICE_MOUSEUP"],["mousemove","ICE_MOUSEMOVE"],["click","ICE_CLICK"],["dbclick","ICE_DBCLICK"],["contextmenu","ICE_CONTEXTMENU"]],Ur=function(){function e(t){i(this,e),r(this,"selectionCandidates",[]),r(this,"_stopped",!1),this.ice=t}return s(e,[{key:"start",value:function(){for(var n=this,s=null,t=0;t<Jr.length;t++)!function(t){var t=Jr[t],e=t[1],i=t[0];n.ice.evtBus.on(e,function(t){n._stopped||((s="ICE_MOUSEMOVE"!==e?n.findTargetComponent(t):s)&&(t.target=s).trigger(i,t),n.ice.evtBus.trigger(i,t))})}(t);return this}},{key:"stopped",get:function(){return this._stopped},set:function(t){this._stopped=t}},{key:"findTargetComponent",value:function(t){if(this._stopped)return null;var e=t.offsetX,i=t.offsetY,t=Gs([],this.ice.toolNodes),n=Gs([],this.ice.childNodes),s=[].concat(v(t),v(n));s.sort(function(t,e){return t.state.zIndex-e.state.zIndex});for(var r=0;r<s.length;r++){var o=s[r],a=o.state,h=a.interactive,a=a.display;o.containsPoint(e,i)&&h&&a&&this.selectionCandidates.push(o)}t=this.selectionCandidates.pop();return this.selectionCandidates=[],t}}]),e}(),Fr=function(){o(e,Fs);var t=c(e);function e(){return i(this,e),t.call(this)}return s(e)}(),Kr=function(){function n(t,e){i(this,n),this.startPoint=t,this.endPoint=e}return s(n,[{key:"contains",value:function(t,e){var i=Math.hypot(this.endPoint.x-this.startPoint.x,this.endPoint.y-this.startPoint.y),n=Math.hypot(t-this.startPoint.x,e-this.startPoint.y),t=Math.hypot(t-this.endPoint.x,e-this.endPoint.y);return i-3<=n+t&&n+t<=i+3}}]),n}(),Zr=function(){function n(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;i(this,n),this.x=t,this.y=e}return s(n,[{key:"equals",value:function(t){return this.x==t.x&&this.y==t.y}},{key:"clone",value:function(){return new n(this.x,this.y)}}],[{key:"load",value:function(t){return new n(Number(t.x),Number(t.y))}},{key:"cloneArray",value:function(t){for(var e=[],i=0;i<t.length;i++)e.push(t[i].clone());return e}}]),n}(),Qr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALkAAAC2CAYAAACF+yyJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAtoSURBVHhe7Z3tj15FHYb9VxUVo7zFUBWC8YXoF9++GENMRAWRKAkxGj8pihpjFBVF1CBlKaUU+wK0pYVqt12fn+6xs7PXnDPzO3O2Z+a5r+T6ss995nm2vXf3vM68570vXNuTsmdVctm9KrnsXpVcdq9KLrtXJZfdq5LL7lXJZfeq5LJ7VXLZvSq57F6VXHavSi67VyWX3auSy+5VyWX3quSye1Vy2b0quexelVx2r0ouu1cll92rksvuVcll96rksntVctm9KrnsXpVcdq9KLrtXJZfdq5LL7lXJZfeq5LJ7VfIjcIy7j/M2sp4q+YKWQNvLOqrkC+nhodO7OJacp0q+gHO4/2UVvbYqeWXH+O2lG3sf29nd++Eb1/e/wtC40q9KXtGfX+Dy3v4PzpspKCt9quQVJSgXS1BO+lTJK0pQLvab/zz8F+CjL3FWlquSV/KBE7v79bwJ5VISlJPlquSV/AXsj1MuJUE5Wa5KXsmfvKWSr1WVvJJ2BiWGciljLm/2figny1XJK0pQLvbS4d15zEmfKnlFicfPXsdsKEE56VMlr+hdx7mwqV2P75/ji0dvboahvPSpkle2BjSu9KuSL+AcaDw5T5V8IT3QOHK+KvmCni/oOm0v66iSO/zz5Rv71cwr56Nn+ADzmUs3MB8bQq/LcVVyhzHvg0wsQbnYmCfPTZ+SlAdVyQv92mm4crPhzokHkgnKhaagrEyrkjtM8eAr6UfXCMoNpqCsHFcld5rC7g3PzVPOTPHZkR8imbbpkqeg7BKm+NXFw0Un4swH4CavgTuOaH6Wd/gYGbOt2GTJc8k5IJxrileuHjxzQoSv37uTHutWfh8x9zU4m0BTJd959+apu1z+tdmExgoN+euVvNN6oSnCe1aI4bUvneKDWWPI5PrhFw++F2VC6dG7HGistdpMyc/9u7zgA/bfSGMOxlBmyhT2qVOv29efSNykZYTj5xrz2Jn0KcdvOQs+QGOu0SZKbn+u5/LAyJ/ZGO/uQSnPvp3+waXxc4x57nL6L9Ncnh0Ze002UfIUlDVTUNYkKJdjDWjcHD938vBuD+XMFJQ1U1B2ba6+5HZWgaBsKPFwhdN7Oc6BxsuVoJxJUC6UuJi4V35Nrr7kBOVIYk6uRA80TonEnBxJUG5NquQbbZLNGMqVWgJtX2rMcNA7lTMoR9JRBOXWZHMlt4d+KUc+VTBNRIydzaFcqTnQdqXeVjBbAEE5ki5YUW5NNlfy+CLLmN876y+5QTmPYyc/Ke+RoJxJUC5lDGXWpHZX9iUo55WgnFeCciZBOfL5K4d/ZCm3JlXyfR+BBxso55WgnFeCciZBOZKg3Jpcfcl/nJiwnrKhqWt5x3byLwr98kK9BxQIynmNscn+KWemoGxo6uIVZdfk6ktupqCseW1sJ3gf2o6gnEeCch4vwPCUy4G2M/8OuykGZddmEyW3ZUjG+PSJ3f9etr+eUe6Y8H2I8PU5EpTzSISv0370FF8+tbv38c1fA/oBCgnfZ602UXJzSexGJXsPe7A4Jv4cXgnKeSTs6zXu+Rkj/hxrtZmSm15yt6Xc11+vc/80QTmPMXb7Qg60bS7xZ1izTZXcLLmn/Orm/zrc1vubLRzDK0G5Un9zsXxXxB7GDsewSUlLCLdtweZKPjh2f/m7Ublj/zhyiytBY5RKUK7UEuy7pjEGfwZXiENomxZstuQ1zIW2LfE1ezwpAeVLzIW23Ra3uuSDOdB2U9rzkDn8yfnwQQ73ahU5/SYv4Y3NJjQO6eGDI4vahqYmOBpjm5dM3KqSp66elnL3yPQQNaBxB2twttIdlq3YfcmXJHyfF96ZPpgdzvb84HzeD1s4/pJ8pvNJi7or+e8Lz5wQdrXPxqIFaGNy/zbEn9PM4W8ZVyvte7bxPhRNR+Hh7YL79Vuxq5J7ic+nx6ZmlcqBxoudA403+LuJ2yHGoPFadWtL/qnNb2kaY8wShlsFch2bIo6gMcYsvRBmD5zQOC26NSWvdbD1/oky2k1itF2uT8Py5SHfrVS+qYNw2qZVuyq5FSDkngVPmxGU80pQrpYhdqsyZVq1uwPPo5KgnFeCcnJaldwpQTmvBOXktCq5U4JyXgnKyWlVcqcE5bwSlJPTquROCcp5JSgnp1XJnRKU80pQTk6rkjslKOeVoJycViV3SlDOK0E5Oa1K7pSgnFeCcnJaldwpQTmvBOXktF2VPL6sP/Zww1wJynklKFfLkKm7Mluzq5KPUesGram7Be3mVtou119PTDGhG7TK3ZqSx3xy4VttHx1ZWpC05ztLoDHG1K22nehl6mkYPTTRtt0deP6hwuNvX3z1f7/l7bf9FLmTjMaf08zBVoiewiZLsvFqPP4WriLdi92VPPQoJ7zMeZB5WAJdDzIfrV2XPLbWlBR3aUqKptyqkseWcqagHB40udAybnXJB3Og7ab8ROY0cXaASNtPmXM4oGni9Js8C9q2xFOa8POW2mzJbdchhZ3yo20GS8/A0BilEpQrtQT7rmmMQVsIbAzapgWbK/lLmoT/gJ5J+L/62sGzKY/B8o5jhNu2YFMl95K7LeVaXE7lG6/nlZa2zSX+DGu2mZIvyTDbFV0hjD+HV4JyHgn7+lFeJ1izTZQ8Z4lDuzqpJQ5vEr6ec9U05guv7u7d//Lu3lsTPyfh+6zVJkqegrLmyDHp/6HtCMp5JCjn8SgWq039oFB2ba6+5LWXHS9ZjrvlZceP7XDOTEHZ0NRZKcquydWXnKAcSVDOfATOMFDOK0E5rwTlTIJyJEG5NamS70tQzitBOa8E5UyCcuRzlw//Nqfcmmyu5Ceu5l8Ctxv/YyhnEpTzOHZCj/IeCcqZBOVSxlBmTTZX8pLlPmjxVcqZMbYYLuVKzYG2K5XmTaecSVCOLHmftajdlY12qiyGcqWWQNuXGmM7Fjk5g3IkHXpSbk2q5AW5Ej3QOCUSc3IkQbk1ufqS33Hc9w9LfDuxjg9BuVznQOPlSlDOJCgXStg5esquydWX3ExBWTMFZU2CcjnWgMbN8fMn83e7UlDWTEHZtdlEyUtXRiPGpqCIsXs+KDdlKc+PXG6n8XOMsVN+lDPnYldBady12UTJTVvX3kvqAGwwhjJTphjem7CvP3EufYIxHD/XmO+MzP9iN6bNgcZco82U3Bx7wibF1AMUZshfRn7zpUxxJXhvYnjtK6fSj8kNmVzvjI5hKBP6sLPoNNZabarkg7l4dztKTHEyumhFhK8f20kX/VZ+HzH23Cptv2abLPlgCsouYQqbzzAnG2duHzn2+MiLB7NLaWt4Ekfxg7aUTZf8VpoitQ9MUM5M4VkqXarkLlM8ODITFUG5wRSUleOq5IWmJvaxAz7KDxKUC01BWZlWJXcYcxtkYgnKxcY8ea7egxzbokruMLynml6PtbnKiWcyZ84KodfluCr5gp5P73EcgraXdVTJF9IDjSPnq5Iv4BxoPDlPlbyyNaBxpV+VvKK2pCJxaZeL+zg8g2q8uRmG8tKnSl5RImdJQoJy0qdKXlGCcrEX4foS5aRPlbySdHMV5VLGlMxKIMdVySv504LpL0iCcrJclbyStEoD5VISlJPlquSVpIVtKZeSoJwsVyWvKEG5WHrWcpuXJKytSl5RgnKxBOWkT5W8ok8nVk+zNe8pb6agrPSpkld2DLu11hYB+NHE8uc0rvSrki/gHO5r8Gn4tauSL6SHh06r4Euoki9oCbS9rKNKfgSOcY9OFS6uSi67VyWX3auSy+5VyWX3quSye1Vy2b0quexelVx2r0ouu1cll92rksvuVcll96rksntVctm9KrnsXpVcdq9KLrtXJZfdq5LL7lXJZfeq5LJ7VXLZvSq57F6VXHavSi67VyWX3auSy+5VyWX3quSye1Vy2b0quezca3v/AeMnvtkH1pHJAAAAAElFTkSuQmCC",Gr=function(){o(r,$s);var n=c(r);function r(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return i(this,r),n.call(this,e({width:100,height:100,src:Qr},t))}return s(r,[{key:"doRender",value:function(){var t,e;this.state.src&&(t=(e=this.ice.imageCache.setImage(this.state.src)).loaded,e=e.image,t&&this.ctx.drawImage(e,0-this.state.localOrigin[0],0-this.state.localOrigin[1],this.state.width,this.state.height)),d(a(r.prototype),"doRender",this).call(this)}}]),r}(),Yr=s(function t(){i(this,t)}),$r=function(){o(r,Lr);var n=c(r);function r(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return i(this,r),n.call(this,e({linkable:!1,draggable:!1,position:"T"},t))}return s(r,[{key:"initEvents",value:function(){d(a(r.prototype),"initEvents",this).call(this),this.once(q,this.beforeRenderHandler,this),this.once(U,this.beforeRemoveHandler,this)}},{key:"beforeRenderHandler",value:function(t){this.evtBus.on(K,this.hookMouseDownHandler,this),this.evtBus.on(Z,this.hookMouseMoveHandler,this),this.evtBus.on(Q,this.hookMouseUpHandler,this),this.evtBus.on("mouseup",this.globalMouseUpHandler,this)}},{key:"beforeRemoveHandler",value:function(t){this.evtBus.off(K,this.hookMouseDownHandler,this),this.evtBus.off(Z,this.hookMouseMoveHandler,this),this.evtBus.off(Q,this.hookMouseUpHandler,this),this.evtBus.off("mouseup",this.globalMouseUpHandler,this),this._hostComponent=null}},{key:"globalMouseUpHandler",value:function(){this.setState({display:!1})}},{key:"hookMouseDownHandler",value:function(t){console.log("linkslot, hook mousedown event..."),this._hostComponent&&this.setState({display:!0})}},{key:"hookMouseMoveHandler",value:function(t){t=t.target;this.isIntersectWithHook(t)?(this.setState({style:{fillStyle:"#fffb00"}}),t._currentAboveSlot=this,t.setState({style:{fillStyle:"#fffb00"}})):(this.setState({style:{fillStyle:"#3ce92c"}}),t._currentAboveSlot===this&&t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"hookMouseUpHandler",value:function(t){var e,i;this._hostComponent&&(e=(t=t.target).parentNode.targetComponent,i=t.state.position,this.isIntersectWithHook(t)?e&&e.setLink(i,this._hostComponent,this.props.position):e&&e.removeLink(i,this._hostComponent,this.props.position),this.setState({display:!1,style:{fillStyle:"#3ce92c"}}),t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"isIntersectWithHook",value:function(t){var e=this.getMaxBoundingBox(),t=t.getMaxBoundingBox();return!!e.isIntersect(t)}},{key:"updatePosition",value:function(){console.log("link slot update position ...");var t=this._hostComponent.getMinBoundingBox(),e=0,i=0;switch(this.state.position){case"T":e=t.tc[0]-this.state.radius,i=t.tc[1]-this.state.radius;break;case"R":e=t.rc[0]-this.state.radius,i=t.rc[1]-this.state.radius;break;case"B":e=t.bc[0]-this.state.radius,i=t.bc[1]-this.state.radius;break;case"L":e=t.lc[0]-this.state.radius,i=t.lc[1]-this.state.radius}this.setState({left:e,top:i})}},{key:"hostComponent",get:function(){return this._hostComponent},set:function(t){var e=this;this._hostComponent&&this._hostComponent.off(X,this.updatePosition,this),this._hostComponent=t,this._hostComponent&&this._hostComponent.on(X,this.updatePosition,this),this._hostComponent&&this._hostComponent.once(U,function(){e._hostComponent=null,e.setState({display:!1})},this),this._hostComponent&&this.setState({display:!0})}}]),r}(),to=function(){o(r,zr);var n=c(r);function r(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return i(this,r),t=r.arrangeParam(t),n.call(this,t)}return s(r,[{key:"calcDots",value:function(){var t=this.interpolate(),e=this.state,i=e.left,n=e.top,s=t[0][2];this.state.points=[],this.state.dots=[];for(var r=0;r<s.length;r++){var o=s[r];this.state.points.push([o.x,o.y]),this.state.dots.push([o.x-i,o.y-n])}return this.calcArrowPoints(),this.state.dots}},{key:"interpolate",value:function(){var t=this.state.points.length,e=this.state.points[0][0],i=this.state.points[0][1],n=this.state.points[t-1][0],t=this.state.points[t-1][1],s=new Zr(e,i),r=new Zr(n,t),o=[],a=null,h=null,l=[],u=new Ks,c=new Ks,e=this.links.start.component;if(e){u=e.getMinBoundingBox(),o[0]=new Zr(s.x,u.tl[1]-this.state.escapeDistance),o[1]=new Zr(u.tr[0]+this.state.escapeDistance,s.y),o[2]=new Zr(s.x,u.br[1]+this.state.escapeDistance),o[3]=new Zr(u.tl[0]-this.state.escapeDistance,s.y);for(var a=o[0],d=1;d<o.length;d++)this.distance(s,o[d])<this.distance(s,a)&&(a=o[d])}i=this.links.end.component;if(i){c=i.getMinBoundingBox(),o[0]=new Zr(r.x,c.tl[1]-this.state.escapeDistance),o[1]=new Zr(c.tr[0]+this.state.escapeDistance,r.y),o[2]=new Zr(r.x,c.br[1]+this.state.escapeDistance),o[3]=new Zr(c.tl[0]-this.state.escapeDistance,r.y);for(var h=o[0],f=1;f<o.length;f++)this.distance(r,o[f])<this.distance(r,h)&&(h=o[f])}var n=0,t=[s],e=(a&&(t.push(a),n=1),h&&t.push(h),t.push(r),Zr.cloneArray(t)),i=(l.push(["s0","s0",e]),Zr.cloneArray(t)),e=Zr.cloneArray(i),t=(e.splice(n+1,0,new Zr(e[n].x,e[n+1].y)),l.push(["s1","s1_1",e]),Zr.cloneArray(i)),e=(t.splice(n+1,0,new Zr(t[n+1].x,t[n].y)),l.push(["s1","s1_2",t]),Zr.cloneArray(i)),t=new Zr((e[n].x+e[n+1].x)/2,e[n].y),p=new Zr((e[n].x+e[n+1].x)/2,e[n+1].y),t=(e.splice(n+1,0,t,p),l.push(["s2","s2_1",e]),Zr.cloneArray(i)),p=new Zr(t[n].x,(t[n].y+t[n+1].y)/2),e=new Zr(t[n+1].x,(t[n].y+t[n+1].y)/2),p=(t.splice(n+1,0,p,e),l.push(["s2","s2_2",t]),Zr.cloneArray(i)),e=[p[n].x+20,p[n+1].x+20],t=(u&&e.push(u.br[0]+20),c&&e.push(c.br[0]+20),this.max(e)),e=new Zr(t,p[n].y),t=new Zr(t,p[n+1].y),e=(p.splice(n+1,0,e,t),l.push(["s2","s2_3",p]),Zr.cloneArray(i)),t=[e[n].y-20,e[n+1].y-20],p=(u&&t.push(u.tl[1]-20),c&&t.push(c.tl[1]-20),this.min(t)),t=new Zr(e[n].x,p),p=new Zr(e[n+1].x,p),t=(e.splice(n+1,0,t,p),l.push(["s2","s2_4",e]),Zr.cloneArray(i)),p=[t[n].x-20,t[n+1].x-20],e=(u&&p.push(u.tl[0]-20),c&&p.push(c.tl[0]-20),this.min(p)),p=new Zr(e,t[n].y),e=new Zr(e,t[n+1].y),p=(t.splice(n+1,0,p,e),l.push(["s2","s2_5",t]),Zr.cloneArray(i)),e=[p[n].y+20,p[n+1].y+20],t=(u&&e.push(u.tl[1]+u.height+20),c&&e.push(c.tl[1]+c.height+20),this.max(e)),i=new Zr(p[n].x,t),e=new Zr(p[n+1].x,t);p.splice(n+1,0,i,e),l.push(["s2","s2_6",p]);for(var v=[],y=0;y<l.length;y++){var g=l[y][2];this.orthogonalPath(g)&&v.push(l[y])}if(l=v,!s.equals(r)){for(var m=[],b=0;b<l.length;b++){var k=l[b][2];this.forwardPath(k)&&m.push(l[b])}(l=m).length}for(var x=[],w=0;w<l.length;w++){var C=!1,P=l[w][2].slice();(c||u)&&(P=P.slice(1,P.length-1)),u&&(C=C||this.polylineIntersectsRectangle(P,u)),(C=c?C||this.polylineIntersectsRectangle(P,c):C)||x.push(l[w])}(l=0!=x.length?x:l).length;for(var M=l[0][2].length,S=[],O=0;O<l.length;O++)l[O][2].length==M&&S.push(l[O]);for(var l=S,E=0,B=0;B<l.length;B++)this.scorePath(l[E][2])<this.scorePath(l[B][2])&&(E=B);return[l[E]]}},{key:"orthogonalPath",value:function(t){if(t.length<=1)return!0;for(var e=0;e<t.length-1;e++)if(t[e].x!=t[e+1].x&&t[e].y!=t[e+1].y)return!1;return!0}},{key:"lineIntersectsLine",value:function(t,e){if(t.startPoint.x==t.endPoint.x&&e.startPoint.x==e.endPoint.x)return t.startPoint.x==e.startPoint.x&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y));if(t.startPoint.x==t.endPoint.x||e.startPoint.x==e.endPoint.x)return t.startPoint.x==t.endPoint.x&&(s=t,t=e,e=s),s=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),i=t.startPoint.y-s*t.startPoint.x,n=e.startPoint.x,t.contains(n,s=s*n+i)&&e.contains(n,s);var i=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),n=t.startPoint.y-i*t.startPoint.x,s=(e.endPoint.y-e.startPoint.y)/(e.endPoint.x-e.startPoint.x),r=e.startPoint.y-s*e.startPoint.x;if(i==s)return n==r&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y));r=(r-n)/(i-s),s=i*r+n;return t.contains(r,s)&&e.contains(r,s)}},{key:"polylineIntersectsRectangle",value:function(t,e){var i=2<arguments.length&&void 0!==arguments[2]&&arguments[2],n=[];n.push(new Kr(new Zr(e.x1,e.y1),new Zr(e.x2,e.y1))),n.push(new Kr(new Zr(e.x2,e.y1),new Zr(e.x2,e.y2))),n.push(new Kr(new Zr(e.x2,e.y2),new Zr(e.x1,e.y2))),n.push(new Kr(new Zr(e.x1,e.y2),new Zr(e.x1,e.y1)));for(var s=0;s<t.length-1;s++)for(var r=new Kr(t[s],t[s+1]),o=0;o<n.length;o++)if(this.lineIntersectsLine(r,n[o]))return!0;if(i)for(var a=new Kr(t[t.length-1],t[0]),h=0;h<n.length;h++)if(this.lineIntersectsLine(a,n[h]))return!0;return!1}},{key:"scorePath",value:function(t){if(t.length<=2)return-1;for(var e=0,i=1;i<t.length-1;i++)if(t[i-1].x==t[i].x&&t[i].x==t[i+1].x){if(this.signum(t[i+1].y-t[i].y)!=this.signum(t[i].y-t[i-1].y))return-1;e++}else if(t[i-1].y==t[i].y&&t[i].y==t[i+1].y){if(this.signum(t[i+1].x-t[i].x)!=this.signum(t[i].x-t[i-1].x))return-1;e++}else e--;return e}},{key:"signum",value:function(t){return 0<t?1:t<0?-1:0}},{key:"forwardPath",value:function(t){if(t.length<=2)return!0;for(var e=0;e<t.length-2;e++)if(t[e].x==t[e+1].x&&t[e+1].x==t[e+2].x){if(0!=this.signum(t[e+1].y-t[e].y)&&this.signum(t[e+1].y-t[e].y)==-1*this.signum(t[e+2].y-t[e+1].y))return!1}else if(t[e].y==t[e+1].y&&t[e+1].y==t[e+2].y&&0!=this.signum(t[e+1].x-t[e].x)&&this.signum(t[e+1].x-t[e].x)==-1*this.signum(t[e+2].x-t[e+1].x))return!1;return!0}},{key:"distance",value:function(t,e){return Math.hypot(e.x-t.x,e.y-t.y)}},{key:"max",value:function(t){if(0==t.lenght)return NaN;for(var e=t[0],i=0;i<t.length;i++)e<t[i]&&(e=t[i]);return e}},{key:"min",value:function(t){if(0==t.lenght)return NaN;for(var e=t[0],i=0;i<t.length;i++)e>t[i]&&(e=t[i]);return e}},{key:"addDot",value:function(t,e){throw new Error("Can NOT add dot to ICEVisioLink mannually.")}},{key:"rmDot",value:function(t){throw new Error("Can NOT remove dot from ICEVisioLink mannually.")}}],[{key:"arrangeParam",value:function(t){return sr(t.startPoint)&&(t.startPoint=[0,0]),sr(t.endPoint)&&(t.endPoint=[10,10]),t.points=[v(t.startPoint),v(t.endPoint)],e({escapeDistance:30},t)}}]),r}(),eo=function(){o(r,Dr);var n=c(r);function r(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(i(this,r),e({radius:10,edges:3,startAngle:90},t));return t.edges=Math.floor(3<=t.edges?t.edges:3),t.width=2*t.radius,t.height=2*t.radius,n.call(this,t)}return s(r,[{key:"calcDots",value:function(){this.state.dots=[];for(var t=2*Math.PI/this.state.edges,e=this.state.radius,i=0;i<this.state.edges;i++){var n=t*i-at(this.state.startAngle),s=Math.floor(e*Math.cos(n)+e),n=Math.floor(e*Math.sin(n)+e);this.state.dots.push([s,n])}return this.state.dots}},{key:"calcComponentParams",value:function(){return this.dirty&&(this.calcDots(),this.state.width=2*this.state.radius,this.state.height=2*this.state.radius),{width:this.state.width,height:this.state.height}}},{key:"setState",value:function(t){sr(t.radius)?sr(t.width)?sr(t.height)||(t.radius=t.height/2):t.radius=t.width/2:(t.width=2*t.radius,t.height=2*t.radius),d(a(r.prototype),"setState",this).call(this,t)}}]),r}(),io=function(){o(r,Dr);var n=c(r);function r(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(i(this,r),e({radius:50,leafNum:2,pointNumber:100},t));return t.leafNum=Math.floor(2<=t.leafNum?t.leafNum:2),t.width=2*t.radius,t.height=2*t.radius,n.call(this,t)}return s(r,[{key:"calcDots",value:function(){var t=this.state.radius,e=this.state.leafNum;this.state.dots=[];for(var i,n,s=Math.PI/this.state.pointNumber,r=0;i=t+t*Math.sin(e*r)*Math.cos(r),n=t+t*Math.sin(e*r)*Math.sin(r),this.state.dots.push([i,n]),!((r+=s)>=2*Math.PI););return this.state.dots}},{key:"calcComponentParams",value:function(){return this.dirty&&(this.calcDots(),this.state.width=2*this.state.radius,this.state.height=2*this.state.radius),{width:this.state.width,height:this.state.height}}},{key:"setState",value:function(t){sr(t.radius)?sr(t.width)?sr(t.height)||(t.radius=t.height/2,t.width=t.height):(t.radius=t.width/2,t.height=t.width):(t.width=2*t.radius,t.height=2*t.radius),d(a(r.prototype),"setState",this).call(this,t)}}]),r}(),no=function(){o(r,Dr);var n=c(r);function r(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(i(this,r),e({outerRadius:50,innerRadius:20,startAngle:90,spikes:5},t));return t.spikes=Math.floor(1<=t.spikes?t.spikes:1),t.width=2*t.outerRadius,t.height=2*t.outerRadius,n.call(this,t)}return s(r,[{key:"calcDots",value:function(){this.state.dots=[];for(var t,e,i=at(this.state.startAngle),n=Math.PI/this.state.spikes,s=this.state.outerRadius,r=this.state.innerRadius,o=0;o<this.state.spikes;o++)t=Math.cos(i)*s+s,e=Math.sin(i)*s+s,this.state.dots.push([t,e]),i+=n,t=Math.cos(i)*r+s,e=Math.sin(i)*r+s,this.state.dots.push([t,e]),i+=n;return this.state.dots}},{key:"calcComponentParams",value:function(){return this.dirty&&(this.calcDots(),this.state.width=2*this.state.outerRadius,this.state.height=2*this.state.outerRadius),{width:this.state.width,height:this.state.height}}},{key:"setState",value:function(t){sr(t.outerRadius)?sr(t.width)?sr(t.height)||(t.outerRadius=t.height/2):t.outerRadius=t.width/2:(t.width=2*t.outerRadius,t.height=2*t.outerRadius),d(a(r.prototype),"setState",this).call(this,t)}}]),r}(),so=function(){o(r,$s);var n=c(r);function r(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(i(this,r),ps({text:"",left:0,top:0,width:10,height:10,style:{fontWeight:"bold",fontSize:32,fontFamily:"Arial",lineWidth:1}},t));return t.style=e(e({},t.style),{},{font:"".concat(t.style.fontWeight," ").concat(t.style.fontSize,"px ").concat(t.style.fontFamily),textBaseline:"bottom"}),n.call(this,t)}return s(r,[{key:"initEvents",value:function(){this.on(J,this.measureText,this)}},{key:"measureText",value:function(t){try{var e,i=this.root.document.createElement("div"),n={padding:"0",margin:"0",border:"none",position:"absolute",top:"0",left:"0",fontFamily:this.state.style.fontFamily,fontWeight:this.state.style.fontWeight,fontSize:this.state.style.fontSize+"px"};for(e in n)i.style[e]=n[e];i.contenteditable=!1,i.innerHTML=this.state.text,this.root.document.body.appendChild(i);var s={width:i.offsetWidth,height:i.offsetHeight};this.props.width=s.width,this.props.height=s.height,this.state.width=s.width,this.state.height=s.height}finally{this.root.document.body.removeChild(i)}}},{key:"doRender",value:function(){this.state.stroke&&this.ctx.strokeText(this.state.text,0-this.state.localOrigin[0],0-this.state.localOrigin[1]+this.state.height,this.state.width),this.state.fill&&this.ctx.fillText(this.state.text,0-this.state.localOrigin[0],0-this.state.localOrigin[1]+this.state.height,this.state.width),d(a(r.prototype),"doRender",this).call(this)}}]),r}(),ro=function(){function e(t){i(this,e),this.ice=t}return s(e,[{key:"start",value:function(){return this.ice.evtBus.on("mousedown",this.mouseDownHandler,this),this}},{key:"stop",value:function(){return this.ice.evtBus.off("mousedown",this.mouseDownHandler,this),this.ice.evtBus.off("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.off("mouseup",this.mouseUpHandler,this),this}},{key:"mouseDownHandler",value:function(t){t=t.target;t instanceof $s?t.state.interactive&&t.state.draggable&&(this.currentObj=t,this.ice.evtBus.on("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.on("mouseup",this.mouseUpHandler,this)):console.warn("DDManager: 点击在 canvas 画布上,没有点击任何图形。")}},{key:"mouseMoveHandler",value:function(t){var e=t.movementX,i=t.movementY;return this.currentObj.moveGlobalPosition(e,i,t),!0}},{key:"mouseUpHandler",value:function(t){this.ice.evtBus.off("mousemove",this.mouseMoveHandler,this),this.ice.evtBus.off("mouseup",this.mouseUpHandler,this)}}]),e}(),oo={evtBuses:[],start:function(){if(Us&&Us.addEventListener)for(var t=0;t<oo.evtBuses.length;t++)!function(t){for(var i=oo.evtBuses[t],e=0;e<Jr.length;e++)!function(t){var e=Jr[t];Us.addEventListener(e[0],function(t){i.trigger(e[1],t)})}(e)}(t)},regitserEvtBus:function(t){oo.evtBuses.includes(t)||oo.evtBuses.push(t)},delEvtBus:function(t){oo.evtBuses.includes(t)&&oo.evtBuses.splice(oo.evtBuses.indexOf(t),1)}},ao={evtBuses:[],stopped:!1,frameCallback:function(){for(var t=0;t<ao.evtBuses.length;t++){if(ao.stopped)return;ao.evtBuses[t].trigger(V)}ao.stopped||Us.requestFrame(ao.frameCallback)},start:function(){ao.stopped=!1,Us.requestFrame(ao.frameCallback)},stop:function(){ao.stopped=!0},pause:function(){},resume:function(){},regitserEvtBus:function(t){ao.evtBuses.includes(t)||ao.evtBuses.push(t)},delEvtBus:function(t){ao.evtBuses.includes(t)&&ao.evtBuses.splice(ao.evtBuses.indexOf(t),1)}},ho=function(){function e(t){i(this,e),r(this,"slotRadius",10),this.ice=t}return s(e,[{key:"start",value:function(){return this.createLinkSlots(),this.ice.evtBus.on(Z,this.hookMouseMoveHandler,this),this}},{key:"stop",value:function(){return this.ice.evtBus.off(Z,this.hookMouseMoveHandler,this),this}},{key:"hookMouseMoveHandler",value:function(t){for(var e=t.target.getMaxBoundingBox(),i=v(this.ice.childNodes),n=0;n<i.length;n++){var s=i[n];if(s&&s.state.linkable&&s.getMaxBoundingBox().isIntersect(e)){for(var r=0;r<this.ice._linkSlots.length;r++)this.ice._linkSlots[r].hostComponent=s;return}}}},{key:"createLinkSlots",value:function(){var t,e,i,n;this.ice._linkSlots&&this.ice._linkSlots.length||(t=new $r({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"T",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(t),e=new $r({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"R",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(e),i=new $r({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"B",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(i),n=new $r({zIndex:1e7,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"L",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(n),this.ice._linkSlots=[t,e,i,n])}}]),e}(),lo=Object.fromEntries(new Map([["ICERect",er],["ICECircle",Lr],["ICEEllipse",Tr],["ICEStar",no],["ICEIsogon",eo],["ICEText",so],["ICEImage",Gr],["ICEGroup",ir],["ICEVisioLink",to],["ICEPolyLine",zr]])),uo=function(){function e(t){i(this,e),this.ice=t}return s(e,[{key:"fromJSON",value:function(t){for(var e=JSON.parse(t).childNodes,i=0;i<e.length;i++)this.decodeRecursively(this.ice,e[i])}},{key:"decodeRecursively",value:function(t,e){var i=new lo[e.type](e.state),n=(t.addChild(i),e.childNodes);if(n&&n.length)for(var s=0;s<n.length;s++)this.decodeRecursively(i,n[s])}}]),e}(),co=function(){function e(t){i(this,e),this.ice=t}return s(e,[{key:"toJSON",value:function(){for(var t={createTime:(new Date).toLocaleString(),lastModifyTime:(new Date).toLocaleString(),childNodes:[]},e=0;e<this.ice.childNodes.length;e++){var i=this.ice.childNodes[e];this.encodeRecursively(i,t)}return console.log(t),JSON.stringify(t)}},{key:"encodeRecursively",value:function(t,e){var i={state:t.state,type:t.constructor.name,childNodes:[]};if(e.childNodes.push(i),t.childNodes&&t.childNodes.length)for(var n=0;n<t.childNodes.length;n++)this.encodeRecursively(t.childNodes[n],i)}}]),e}(),fo=function(){o(a,Fs);var n=c(a);function a(t){var e;return i(this,a),r(l(e=n.call(this)),"stopped",!1),r(l(e),"componentQueue",[]),r(l(e),"toolsQueue",[]),e.ice=t,e}return s(a,[{key:"start",value:function(){return this.stopped=!1,this.ice.evtBus.on(V,this.frameEvtHandler,this),this}},{key:"stop",value:function(){return this.stopped=!0,this.ice.evtBus.off(V,this.frameEvtHandler,this),this}},{key:"frameEvtHandler",value:function(t){this.ice.dirty?this.doRender():console.log("没有需要渲染的组件...")}},{key:"refreshQueue",value:function(){this.componentQueue=Gs([],this.ice.childNodes),this.componentQueue.sort(function(t,e){return t.state.zIndex-e.state.zIndex}),console.log("Component Queue length> ".concat(this.componentQueue.length)),this.toolsQueue=Gs([],this.ice.toolNodes),console.log("Tool Queue length> ".concat(this.ice.toolNodes.length))}},{key:"doRender",value:function(){var t=Date.now();this.refreshQueue(),this.ice.ctx.clearRect(0,0,this.ice.canvasWidth,this.ice.canvasHeight);for(var e=0;e<this.componentQueue.length;e++){var i=this.componentQueue[e];i.root=this.ice.root,i.ctx=this.ice.ctx,i.evtBus=this.ice.evtBus,i.ice=this.ice,i.render()}for(var n=0;n<this.toolsQueue.length;n++){var s=this.toolsQueue[n];s.root=this.ice.root,s.ctx=this.ice.ctx,s.evtBus=this.ice.evtBus,s.ice=this.ice,s.render()}console.log("Render time ".concat(Date.now()-t," ms.")),this.ice.dirty=!1,this.ice.evtBus.trigger(F)}}]),a}(),vo=function(){function n(t){i(this,n),r(this,"imageCache",new Map),this.ice=t}return s(n,[{key:"setImage",value:function(t){var e=this,i=this.imageCache.get(t);return i||((i=new Image).onload=function(){e.ice.dirty=!0},i.onerror=function(){console.error("ImageCache: 图片加载失败:",t)},i.src=t,this.imageCache.size>n.CACHE_SIZE&&this.imageCache.delete(this.imageCache.keys().next().value),this.imageCache.set(t,i)),{loaded:this.loaded(i),image:i}}},{key:"loaded",value:function(t){return t.complete&&0<t.naturalWidth}}]),n}(),po=(r(vo,"CACHE_SIZE",100),function(){function t(){i(this,t),r(this,"childNodes",[]),r(this,"toolNodes",[]),r(this,"canvasWidth",0),r(this,"canvasHeight",0),r(this,"selectionList",[]),r(this,"__dirty",!0),r(this,"_lastUpdateTime",Date.now())}return s(t,[{key:"init",value:function(t){if(!t)throw new Error("ICE.init() failed...");if(this.ctx===t)throw new Error("同一个 canvas 实例只能 init 一次...");return this.root=Us,L(t)?(this.canvasEl=this.root.document.getElementById(t),this.canvasEl.oncontextmenu=function(t){t.preventDefault(),t.stopPropagation()},this.canvasWidth=this.canvasEl.width,this.canvasHeight=this.canvasEl.height,this.canvasBoundingClientRect=this.canvasEl.getBoundingClientRect(),this.ctx=this.canvasEl.getContext("2d")):this.ctx=t,this.evtBus=new Fr,ao.regitserEvtBus(this.evtBus),ao.start(),oo.regitserEvtBus(this.evtBus),oo.start(),this.eventBridge=new Ur(this).start(),this.animationManager=new st(this).start(),this.ddManager=new ro(this).start(),this.controlPanelManager=new Wr(this).start(),this.renderer=new fo(this).start(),this.linkSlotManager=new ho(this).start(),this.serializer=new co(this),this.deserializer=new uo(this),this.imageCache=new vo(this),this}},{key:"addTool",value:function(t){-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(W,null,{component:t}),t.trigger(W),t.ice=this,t.root=this.root,t.ctx=this.ctx,t.evtBus=this.evtBus,this.toolNodes.push(t),this.dirty=!0,this.evtBus.trigger(J,null,{component:t}),t.trigger(J))}},{key:"removeTool",value:function(t){this.evtBus.trigger(U,null,{component:t}),t.destory(),this.toolNodes.splice(this.toolNodes.indexOf(t),1),this.dirty=!0}},{key:"addChild",value:function(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(W,null,{component:t}),t.trigger(W),t.ice=this,t.root=this.root,t.ctx=this.ctx,t.evtBus=this.evtBus,t.parentNode=null,this.childNodes.push(t),Object.keys(t.props.animations).length&&this.animationManager.add(t),this.dirty=e,this.evtBus.trigger(J,null,{component:t}),t.trigger(J))}},{key:"addChildren",value:function(t){for(var e=0;e<t.length;e++)this.addChild(t[e],!1);this.dirty=!0}},{key:"removeChild",value:function(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];this.evtBus.trigger(U,null,{component:t}),t.destory(),this.childNodes.splice(this.childNodes.indexOf(t),1),this.dirty=e}},{key:"removeChildren",value:function(t){for(var e=0;e<t.length;e++)this.removeChild(t[e],!1);this.dirty=!0}},{key:"clearAll",value:function(){this.removeChildren(v(this.childNodes))}},{key:"findComponent",value:function(e){return this.childNodes.filter(function(t){return t.props.id===e})[0]}},{key:"dirty",get:function(){return this.__dirty},set:function(t){this.__dirty=t}},{key:"toJSON",value:function(){return this.serializer.toJSON()}},{key:"fromJSON",value:function(t){var e=this,i=Date.now(),t=(ao.stop(),this.renderer.stop(),this.eventBridge.stopped=!0,this.animationManager.stop(),this.ddManager.stop(),this.controlPanelManager.stop(),this.linkSlotManager.stop(),this.clearAll(),this.deserializer.fromJSON(t),ao.start(),this.renderer.start(),this.animationManager.start(),this.ddManager.start(),this.controlPanelManager.start(),this.linkSlotManager.start(),setTimeout(function(){e.eventBridge.stopped=!1},300),Date.now());console.log("fromJSON> ".concat(t-i," ms"))}}]),t}());exports.AnimationManager=st,exports.CanvasRenderer=fo,exports.DOMEventBridge=Ur,exports.EventBus=Fr,exports.GeoLine=Kr,exports.GeoPoint=Zr,exports.GeoUtil=jr,exports.ICE=po,exports.ICEBezier=Yr,exports.ICEBoundingBox=Ks,exports.ICECircle=Lr,exports.ICEComponent=$s,exports.ICEControlPanel=nr,exports.ICEControlPanelManager=Wr,exports.ICEDotPath=Dr,exports.ICEEllipse=Tr,exports.ICEEventTarget=Fs,exports.ICEGroup=ir,exports.ICEImage=Gr,exports.ICEIsogon=eo,exports.ICELinkHook=Rr,exports.ICELinkSlot=$r,exports.ICEMatrix=Zs,exports.ICEPath=tr,exports.ICEPolyLine=zr,exports.ICERect=er,exports.ICERose=io,exports.ICEStar=no,exports.ICEText=so,exports.ICEVisioLink=to,exports.LineControlPanel=Hr,exports.ResizeControl=Vr,exports.RotateControl=qr,exports.TransformControlPanel=Xr;
|