ice-render 1.0.2 → 1.0.3

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 CHANGED
@@ -55,9 +55,7 @@ ice.addChild(rect);
55
55
  在你的项目中安装依赖:
56
56
 
57
57
  ```shell
58
-
59
- npm i ice-render --save
60
-
58
+ npm i ice-render --save
61
59
  ```
62
60
 
63
61
  基于 ice-render 提供的类和接口二次开发,示例:
@@ -111,6 +109,10 @@ ice-entity-designer 是一款基于 ice-render 开发的 ER 设计器,完整
111
109
 
112
110
  ice-entity-designer 已经用在了 craft-codeless-designer 低代码项目中, https://github.com/craft-codeless-designer 。
113
111
 
112
+ <img src="./tests/assets/11.png">
113
+
114
+ 如需更详细的架构文档,请联系我。
115
+
114
116
  ### 3.3 在 NodeJS 环境中使用
115
117
 
116
118
  【待测试】
package/dist/index.cjs.js CHANGED
@@ -22,4 +22,4 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- "use strict";function ownKeys(e,t){var n,i=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)),i}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach(function(t){_defineProperty$1(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function _defineProperty$1(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _inherits(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&&_setPrototypeOf(t,e)}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,e){return t.__proto__=e,t})(t,e)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _possibleConstructorReturn(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 _assertThisInitialized(t)}function _createSuper(n){var i=function _isNativeReflectConstruct(){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 _createSuperInternal(){var t,e=_getPrototypeOf(n);return _possibleConstructorReturn(this,i?(t=_getPrototypeOf(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function _superPropBase(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf(t)););return t}function _get(){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,e,n){var i=_superPropBase(t,e);if(i)return(i=Object.getOwnPropertyDescriptor(i,e)).get?i.get.call(arguments.length<3?t:n):i.value}).apply(this,arguments)}function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(n="Object"===n&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}(t)||function _nonIterableSpread(){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 _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}Object.defineProperty(exports,"__esModule",{value:!0});var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},e="object"==typeof t&&t&&t.Object===Object&&t,n=e,i="object"==typeof self&&self&&self.Object===Object&&self,r=n||i||Function("return this")(),s=r.Symbol,o=s,a=Object.prototype,l=a.hasOwnProperty,h=a.toString,c=o?o.toStringTag:void 0,u=function getRawTag$1(t){var e=l.call(t,c),n=t[c];try{var i=!(t[c]=void 0)}catch(t){}var s=h.call(t);return i&&(e?t[c]=n:delete t[c]),s},d=Object.prototype.toString,f=u,p=function objectToString$1(t){return d.call(t)},v=s?s.toStringTag:void 0,y=function baseGetTag$7(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(v&&v in Object(t)?f:p)(t)},g=Array.isArray,C=function isObjectLike$9(t){return null!=t&&"object"==typeof t},m=y,b=g,k=C,_=function isString(t){return"string"==typeof t||!b(t)&&k(t)&&"[object String]"==m(t)},P=function isUndefined(t){return void 0===t},x="ICE_FRAME_EVENT",E="BEFORE_RENDER",w="AFTER_RENDER",S="BEFORE_ADD",I="AFTER_ADD",O="BEFORE_REMOVE",M="ROUND_FINISH",A="HOOK_MOUSEDOWN",j="HOOK_MOUSEMOVE",B="HOOK_MOUSEUP",L="BEFORE_RESIZE",T="AFTER_RESIZE",R="BEFORE_ROTATE",D="AFTER_ROTATE",N="BEFORE_MOVE",z="AFTER_MOVE",$={linear:function linear(t,e,n,i){return t+(e-t)/n*(Date.now()-i)},easeInQuad:function easeInQuad(t,e,n,i){i=Date.now()-i;return t+(e-t)/n*(i/n)*i},easeOutQuad:function easeOutQuad(t,e,n,i){i=Date.now()-i;return-(e-t)*(i/=n)*(i-2)+t},easeInOutQuad:function easeInOutQuad(t,e,n,i){i=Date.now()-i,e-=t;return(i/=n/2)<1?e/2*i*i+t:-e/2*(--i*(i-2)-1)+t},easeInQuart:function easeInQuart(t,e,n,i){i=Date.now()-i;return(e-t)*(i/=n)*i*i*i+t},easeOutQuart:function easeOutQuart(t,e,n,i){return-(e-t)*((e=(Date.now()-i)/n-1)*e*e*e-1)+t},easeInOutQuart:function easeInOutQuart(t,e,n,i){i=Date.now()-i,e-=t;return(i/=n/2)<1?e/2*i*i*i*i+t:-e/2*((i-=2)*i*i*i-2)+t},easeInCubic:function easeInCubic(t,e,n,i){i=Date.now()-i;return(e-t)*(i/=n)*i*i+t},easeOutCubic:function easeOutCubic(t,e,n,i){return(e-t)*((e=(Date.now()-i)/n-1)*e*e+1)+t},easeInOutCubic:function easeInOutCubic(t,e,n,i){i=Date.now()-i,e-=t;return(i/=n/2)<1?e/2*i*i*i+t:e/2*((i-=2)*i*i+2)+t}},H=function(){function AnimationManager(t){_classCallCheck(this,AnimationManager),_defineProperty$1(this,"animationMap",new Map),this.ice=t}return _createClass(AnimationManager,[{key:"start",value:function start(){return this.ice.evtBus.on(x,this.frameEventHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off(x,this.frameEventHandler,this),this}},{key:"frameEventHandler",value:function frameEventHandler(t){for(var e=_toConsumableArray(this.animationMap.values()),n=0;n<e.length;n++){var i=e[n];i.state.interactive=!1,this.tween(i),i.state.interactive=!0}}},{key:"tween",value:function tween(t){var e,n={},i=t.props.animations,s=1;for(e in i){var r=i[e];if(r.finished){if(++s===Object.keys(i).length){this.remove(t);break}}else{var o=r.from,a=r.to,l=r.duration,o=(P(r.startTime)&&(r.startTime=Date.now()),P(r.easing)&&(r.easing="linear"),$[r.easing](o,a,l,r.startTime));a<o&&(o=a,r.finished=!0),n[e]=Math.floor(o)}}return t.setState(_objectSpread2({},n)),t}},{key:"add",value:function add(t){this.animationMap.set(t.props.id,t)}},{key:"remove",value:function remove(t){_(t)?this.animationMap.delete(t):this.animationMap.delete(t.props.id)}}]),AnimationManager}(),V=function listCacheClear$1(){this.__data__=[],this.size=0},q=function eq$4(t,e){return t===e||t!=t&&e!=e},U=q,J=function assocIndexOf$4(t,e){for(var n=t.length;n--;)if(U(t[n][0],e))return n;return-1},X=J,G=Array.prototype.splice,F=J,K=J,W=J,Q=V,Z=function listCacheDelete$1(t){var e=this.__data__,t=X(e,t);return!(t<0||(t==e.length-1?e.pop():G.call(e,t,1),--this.size,0))},Y=function listCacheGet$1(t){var e=this.__data__,t=F(e,t);return t<0?void 0:e[t][1]},tt=function listCacheHas$1(t){return-1<K(this.__data__,t)},et=function listCacheSet$1(t,e){var n=this.__data__,i=W(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this};function ListCache$4(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}ListCache$4.prototype.clear=Q,ListCache$4.prototype.delete=Z,ListCache$4.prototype.get=Y,ListCache$4.prototype.has=tt,ListCache$4.prototype.set=et;var ut,nt=ListCache$4,it=nt,rt=function stackClear$1(){this.__data__=new it,this.size=0},st=function stackDelete$1(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t},ot=function stackGet$1(t){return this.__data__.get(t)},at=function stackHas$1(t){return this.__data__.has(t)},lt=function isObject$9(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},ht=y,ct=lt,dt=function isFunction$3(t){if(!ct(t))return!1;t=ht(t);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},ft=r["__core-js_shared__"],pt=(ut=/[^.]+$/.exec(ft&&ft.keys&&ft.keys.IE_PROTO||""))?"Symbol(src)_1."+ut:"",vt=function isMasked$1(t){return!!pt&&pt in t},yt=Function.prototype.toString,gt=function toSource$2(t){if(null!=t){try{return yt.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Ct=dt,mt=vt,bt=lt,kt=gt,_t=/^\[object .+?Constructor\]$/,Pt=Function.prototype,xt=Object.prototype,Et=Pt.toString,wt=xt.hasOwnProperty,St=RegExp("^"+Et.call(wt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),It=function baseIsNative$1(t){return!(!bt(t)||mt(t))&&(Ct(t)?St:_t).test(kt(t))},Ot=function getValue$1(t,e){return null==t?void 0:t[e]},Mt=function getNative$7(t,e){t=Ot(t,e);return It(t)?t:void 0},At=Mt(r,"Map"),jt=Mt(Object,"create"),Bt=jt,Lt=function hashClear$1(){this.__data__=Bt?Bt(null):{},this.size=0},Tt=function hashDelete$1(t){t=this.has(t)&&delete this.__data__[t];return this.size-=t?1:0,t},Rt=jt,Dt=Object.prototype.hasOwnProperty,Nt=function hashGet$1(t){var e,n=this.__data__;return Rt?"__lodash_hash_undefined__"===(e=n[t])?void 0:e:Dt.call(n,t)?n[t]:void 0},zt=jt,$t=Object.prototype.hasOwnProperty,Ht=jt,Vt=Lt,qt=Tt,Ut=Nt,Jt=function hashHas$1(t){var e=this.__data__;return zt?void 0!==e[t]:$t.call(e,t)},Xt=function hashSet$1(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ht&&void 0===e?"__lodash_hash_undefined__":e,this};function Hash$1(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}Hash$1.prototype.clear=Vt,Hash$1.prototype.delete=qt,Hash$1.prototype.get=Ut,Hash$1.prototype.has=Jt,Hash$1.prototype.set=Xt;var Gt=Hash$1,Ft=nt,Kt=At,Wt=function isKeyable$1(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t},Qt=function getMapData$4(t,e){t=t.__data__;return Wt(e)?t["string"==typeof e?"string":"hash"]:t.map},Zt=Qt,Yt=Qt,te=Qt,ee=Qt,ne=function mapCacheClear$1(){this.size=0,this.__data__={hash:new Gt,map:new(Kt||Ft),string:new Gt}},ie=function mapCacheDelete$1(t){t=Zt(this,t).delete(t);return this.size-=t?1:0,t},re=function mapCacheGet$1(t){return Yt(this,t).get(t)},se=function mapCacheHas$1(t){return te(this,t).has(t)},oe=function mapCacheSet$1(t,e){var n=ee(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this};function MapCache$1(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}MapCache$1.prototype.clear=ne,MapCache$1.prototype.delete=ie,MapCache$1.prototype.get=re,MapCache$1.prototype.has=se,MapCache$1.prototype.set=oe;var ae=nt,le=At,he=MapCache$1,ce=nt,ue=rt,de=st,fe=ot,pe=at,ve=function stackSet$1(t,e){var n=this.__data__;if(n instanceof ae){var i=n.__data__;if(!le||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new he(i)}return n.set(t,e),this.size=n.size,this};function Stack$2(t){t=this.__data__=new ce(t);this.size=t.size}Stack$2.prototype.clear=ue,Stack$2.prototype.delete=de,Stack$2.prototype.get=fe,Stack$2.prototype.has=pe,Stack$2.prototype.set=ve;var ye=Stack$2,ge=Mt,Ce=function(){try{var t=ge(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),me=Ce,be=function baseAssignValue$3(t,e,n){"__proto__"==e&&me?me(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},ke=be,_e=q,Pe=function assignMergeValue$2(t,e,n){(void 0===n||_e(t[e],n))&&(void 0!==n||e in t)||ke(t,e,n)},xe=function createBaseFor$1(l){return function(t,e,n){for(var i=-1,s=Object(t),r=n(t),o=r.length;o--;){var a=r[l?o:++i];if(!1===e(s[a],a,s))break}return t}}(),Ee={exports:{}},we=(!function(t,e){var e=e&&!e.nodeType&&e,n=e&&t&&!t.nodeType&&t,n=n&&n.exports===e?r.Buffer:void 0,i=n?n.allocUnsafe:void 0;t.exports=function cloneBuffer(t,e){if(e)return t.slice();e=t.length,e=i?i(e):new t.constructor(e);return t.copy(e),e}}(Ee,Ee.exports),r.Uint8Array),Se=function cloneArrayBuffer$3(t){var e=new t.constructor(t.byteLength);return new we(e).set(new we(t)),e},Ie=Se,Oe=function cloneTypedArray$2(t,e){e=e?Ie(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)},Me=function copyArray$2(t,e){var n=-1,i=t.length;for(e=e||Array(i);++n<i;)e[n]=t[n];return e},Ae=lt,je=Object.create,Be=function(){function object(){}return function(t){if(!Ae(t))return{};if(je)return je(t);object.prototype=t;t=new object;return object.prototype=void 0,t}}(),Le=function overArg$2(e,n){return function(t){return e(n(t))}},Te=Le(Object.getPrototypeOf,Object),Re=Object.prototype,De=function isPrototype$4(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Re)},Ne=Be,ze=Te,$e=De,He=function initCloneObject$2(t){return"function"!=typeof t.constructor||$e(t)?{}:Ne(ze(t))},Ve=y,qe=C,Ue=function baseIsArguments$1(t){return qe(t)&&"[object Arguments]"==Ve(t)},Je=C,Xe=Object.prototype,Ge=Xe.hasOwnProperty,Fe=Xe.propertyIsEnumerable,Ke=Ue(function(){return arguments}())?Ue:function(t){return Je(t)&&Ge.call(t,"callee")&&!Fe.call(t,"callee")},We=function isLength$2(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991},Qe=dt,Ze=We,Ye=function isArrayLike$5(t){return null!=t&&Ze(t.length)&&!Qe(t)},tn=Ye,en=C,nn=function isArrayLikeObject$1(t){return en(t)&&tn(t)},rn={exports:{}},sn=function stubFalse(){return!1},an=(!function(t,e){var e=e&&!e.nodeType&&e,n=e&&t&&!t.nodeType&&t,n=n&&n.exports===e?r.Buffer:void 0,e=(n?n.isBuffer:void 0)||sn;t.exports=e}(rn,rn.exports),y),ln=Te,hn=C,cn=Function.prototype,un=Object.prototype,dn=cn.toString,fn=un.hasOwnProperty,pn=dn.call(Object),vn=function isPlainObject$1(t){if(!hn(t)||"[object Object]"!=an(t))return!1;t=ln(t);if(null===t)return!0;t=fn.call(t,"constructor")&&t.constructor;return"function"==typeof t&&t instanceof t&&dn.call(t)==pn},yn=y,gn=We,Cn=C,mn={},bn=(mn["[object Float32Array]"]=mn["[object Float64Array]"]=mn["[object Int8Array]"]=mn["[object Int16Array]"]=mn["[object Int32Array]"]=mn["[object Uint8Array]"]=mn["[object Uint8ClampedArray]"]=mn["[object Uint16Array]"]=mn["[object Uint32Array]"]=!0,mn["[object Arguments]"]=mn["[object Array]"]=mn["[object ArrayBuffer]"]=mn["[object Boolean]"]=mn["[object DataView]"]=mn["[object Date]"]=mn["[object Error]"]=mn["[object Function]"]=mn["[object Map]"]=mn["[object Number]"]=mn["[object Object]"]=mn["[object RegExp]"]=mn["[object Set]"]=mn["[object String]"]=mn["[object WeakMap]"]=!1,function baseIsTypedArray$1(t){return Cn(t)&&gn(t.length)&&!!mn[yn(t)]}),kn=function baseUnary$3(e){return function(t){return e(t)}},_n={exports:{}},Pn=(!function(t,n){var n=n&&!n.nodeType&&n,i=n&&t&&!t.nodeType&&t,s=i&&i.exports===n&&e.process,n=function(){try{return i&&i.require&&i.require("util").types||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=n}(_n,_n.exports),bn),xn=kn,En=_n.exports,wn=En&&En.isTypedArray,Sn=wn?xn(wn):Pn,In=function safeGet$2(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},On=be,Mn=q,An=Object.prototype.hasOwnProperty,jn=function assignValue$2(t,e,n){var i=t[e];An.call(t,e)&&Mn(i,n)&&(void 0!==n||e in t)||On(t,e,n)},Bn=jn,Ln=be,Tn=function copyObject$5(t,e,n,i){var s=!n;n=n||{};for(var r=-1,o=e.length;++r<o;){var a=e[r],l=i?i(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),(s?Ln:Bn)(n,a,l)}return n},Rn=/^(?:0|[1-9]\d*)$/,Dn=function isIndex$2(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Rn.test(t))&&-1<t&&t%1==0&&t<e},Nn=function baseTimes$1(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i},zn=Ke,$n=g,Hn=rn.exports,Vn=Dn,qn=Sn,Un=Object.prototype.hasOwnProperty,Jn=function arrayLikeKeys$2(t,e){var n,i=$n(t),s=!i&&zn(t),r=!i&&!s&&Hn(t),o=!i&&!s&&!r&&qn(t),a=i||s||r||o,l=a?Nn(t.length,String):[],h=l.length;for(n in t)!e&&!Un.call(t,n)||a&&("length"==n||r&&("offset"==n||"parent"==n)||o&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||Vn(n,h))||l.push(n);return l},Xn=lt,Gn=De,Fn=function nativeKeysIn$1(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},Kn=Object.prototype.hasOwnProperty,Wn=Jn,Qn=function baseKeysIn$1(t){if(!Xn(t))return Fn(t);var e,n=Gn(t),i=[];for(e in t)("constructor"!=e||!n&&Kn.call(t,e))&&i.push(e);return i},Zn=Ye,Yn=function keysIn$5(t){return Zn(t)?Wn(t,!0):Qn(t)},ti=Tn,ei=Yn,ni=Pe,ii=Ee.exports,ri=Oe,si=Me,oi=He,ai=Ke,li=g,hi=nn,ci=rn.exports,ui=dt,di=lt,fi=vn,pi=Sn,vi=In,yi=function toPlainObject$1(t){return ti(t,ei(t))},gi=ye,Ci=Pe,mi=xe,bi=function baseMergeDeep$1(t,e,n,i,s,r,o){var a,l,h,c=vi(t,n),u=vi(e,n),d=o.get(u);d?ni(t,n,d):((e=void 0===(d=r?r(c,u,n+"",t,e,o):void 0))&&(l=!(a=li(u))&&ci(u),h=!a&&!l&&pi(u),d=u,a||l||h?d=li(c)?c:hi(c)?si(c):l?ii(u,!(e=!1)):h?ri(u,!(e=!1)):[]:fi(u)||ai(u)?ai(d=c)?d=yi(c):di(c)&&!ui(c)||(d=oi(u)):e=!1),e&&(o.set(u,d),s(d,u,i,r,o),o.delete(u)),ni(t,n,d))},ki=lt,_i=Yn,Pi=In,xi=function baseMerge$1(i,s,r,o,a){i!==s&&mi(s,function(t,e){var n;a=a||new gi,ki(t)?bi(i,s,e,r,baseMerge$1,o,a):(n=o?o(Pi(i,e),t,e+"",i,s,a):void 0,Ci(i,e,n=void 0===n?t:n))},_i)},Ei=function identity$2(t){return t},wi=function apply$1(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)},Si=Math.max,Ii=function overRest$1(r,o,a){return o=Si(void 0===o?r.length-1:o,0),function(){for(var t=arguments,e=-1,n=Si(t.length-o,0),i=Array(n);++e<n;)i[e]=t[o+e];for(var e=-1,s=Array(o+1);++e<o;)s[e]=t[e];return s[o]=a(i),wi(r,this,s)}},Oi=function constant$1(t){return function(){return t}},Mi=Ce,Ai=Mi?function(t,e){return Mi(t,"toString",{configurable:!0,enumerable:!1,value:Oi(e),writable:!0})}:Ei,ji=Date.now,Bi=function shortOut$1(n){var i=0,s=0;return function(){var t=ji(),e=16-(t-s);if(s=t,0<e){if(800<=++i)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(Ai),Li=Ei,Ti=Ii,Ri=Bi,Di=q,Ni=Ye,zi=Dn,$i=lt,Hi=function baseRest$1(t,e){return Ri(Ti(t,e,Li),t+"")},Vi=function isIterateeCall$1(t,e,n){if(!$i(n))return!1;var i=typeof e;return!!("number"==i?Ni(n)&&zi(e,n.length):"string"==i&&e in n)&&Di(n[e],t)},qi=xi,Ui=function createAssigner$1(a){return Hi(function(t,e){var n=-1,i=e.length,s=1<i?e[i-1]:void 0,r=2<i?e[2]:void 0,s=3<a.length&&"function"==typeof s?(i--,s):void 0;for(r&&Vi(e[0],e[1],r)&&(s=i<3?void 0:s,i=1),t=Object(t);++n<i;){var o=e[n];o&&a(t,o,n,s)}return t})}(function(t,e,n){qi(t,e,n)}),Ji="undefined"!=typeof Float32Array?Float32Array:Array,Xi=Math.PI/180;function toRadian(t){return t*Xi}function invert(t,e){var n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],e=e[5],a=n*r-i*s;return a?(t[0]=r*(a=1/a),t[1]=-i*a,t[2]=-s*a,t[3]=n*a,t[4]=(s*e-r*o)*a,t[5]=(i*o-n*e)*a,t):null}function multiply(t,e,n){var i=e[0],s=e[1],r=e[2],o=e[3],a=e[4],e=e[5],l=n[0],h=n[1],c=n[2],u=n[3],d=n[4],n=n[5];return t[0]=i*l+r*h,t[1]=s*l+o*h,t[2]=i*c+r*u,t[3]=s*c+o*u,t[4]=i*d+r*n+a,t[5]=s*d+o*n+e,t}function transformMat2d(t,e,n){var i=e[0],e=e[1];return t[0]=n[0]*i+n[2]*e+n[4],t[1]=n[1]*i+n[3]*e+n[5],t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),function create(){var t=new Ji(2);Ji!=Float32Array&&(t[0]=0,t[1]=0)}();var Gi=function arrayEach$1(t,e){for(var n=-1,i=null==t?0:t.length;++n<i&&!1!==e(t[n],n,t););return t},Fi=Le(Object.keys,Object),Ki=De,Wi=Fi,Qi=Object.prototype.hasOwnProperty,Zi=function baseKeys$2(t){if(!Ki(t))return Wi(t);var e,n=[];for(e in Object(t))Qi.call(t,e)&&"constructor"!=e&&n.push(e);return n},Yi=Jn,tr=Zi,er=Ye,nr=function keys$3(t){return(er(t)?Yi:tr)(t)},ir=Tn,rr=nr,sr=function baseAssign$1(t,e){return t&&ir(e,rr(e),t)},or=Tn,ar=Yn,lr=function baseAssignIn$1(t,e){return t&&or(e,ar(e),t)},hr=function stubArray$2(){return[]},cr=function arrayFilter$1(t,e){for(var n=-1,i=null==t?0:t.length,s=0,r=[];++n<i;){var o=t[n];e(o,n,t)&&(r[s++]=o)}return r},ur=hr,dr=Object.prototype.propertyIsEnumerable,fr=Object.getOwnPropertySymbols,pr=fr?function(e){return null==e?[]:(e=Object(e),cr(fr(e),function(t){return dr.call(e,t)}))}:ur,vr=Tn,yr=pr,gr=function copySymbols$1(t,e){return vr(t,yr(t),e)},Cr=function arrayPush$2(t,e){for(var n=-1,i=e.length,s=t.length;++n<i;)t[s+n]=e[n];return t},mr=Cr,br=Te,kr=pr,_r=hr,Pr=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)mr(e,kr(t)),t=br(t);return e}:_r,xr=Tn,Er=Pr,wr=function copySymbolsIn$1(t,e){return xr(t,Er(t),e)},Sr=Cr,Ir=g,Or=function baseGetAllKeys$2(t,e,n){e=e(t);return Ir(t)?e:Sr(e,n(t))},Mr=Or,Ar=pr,jr=nr,Br=function getAllKeys$1(t){return Mr(t,jr,Ar)},Lr=Or,Tr=Pr,Rr=Yn,Dr=function getAllKeysIn$1(t){return Lr(t,Rr,Tr)},Nr=Mt(r,"DataView"),zr=At,$r=Mt(r,"Promise"),Hr=Mt(r,"Set"),Vr=Mt(r,"WeakMap"),qr=y,Ur=gt,Jr=Ur(Nr),Xr=Ur(zr),Gr=Ur($r),Fr=Ur(Hr),Kr=Ur(Vr),Wr=qr,Qr=Wr=Nr&&"[object DataView]"!=Wr(new Nr(new ArrayBuffer(1)))||zr&&"[object Map]"!=Wr(new zr)||$r&&"[object Promise]"!=Wr($r.resolve())||Hr&&"[object Set]"!=Wr(new Hr)||Vr&&"[object WeakMap]"!=Wr(new Vr)?function(t){var e=qr(t),t="[object Object]"==e?t.constructor:void 0,t=t?Ur(t):"";if(t)switch(t){case Jr:return"[object DataView]";case Xr:return"[object Map]";case Gr:return"[object Promise]";case Fr:return"[object Set]";case Kr:return"[object WeakMap]"}return e}:Wr,Zr=Object.prototype.hasOwnProperty,Yr=function initCloneArray$1(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Zr.call(t,"index")&&(n.index=t.index,n.input=t.input),n},ts=Se,es=function cloneDataView$1(t,e){e=e?ts(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)},ns=/\w*$/,is=function cloneRegExp$1(t){var e=new t.constructor(t.source,ns.exec(t));return e.lastIndex=t.lastIndex,e},rs=s?s.prototype:void 0,ss=rs?rs.valueOf:void 0,os=Se,as=es,ls=is,hs=function cloneSymbol$1(t){return ss?Object(ss.call(t)):{}},cs=Oe,us=function initCloneByTag$1(t,e,n){var i=t.constructor;switch(e){case"[object ArrayBuffer]":return os(t);case"[object Boolean]":case"[object Date]":return new i(+t);case"[object DataView]":return as(t,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return cs(t,n);case"[object Map]":return new i;case"[object Number]":case"[object String]":return new i(t);case"[object RegExp]":return ls(t);case"[object Set]":return new i;case"[object Symbol]":return hs(t)}},ds=Qr,fs=C,ps=function baseIsMap$1(t){return fs(t)&&"[object Map]"==ds(t)},vs=kn,ys=_n.exports,gs=ys&&ys.isMap,Cs=gs?vs(gs):ps,ms=Qr,bs=C,ks=function baseIsSet$1(t){return bs(t)&&"[object Set]"==ms(t)},_s=kn,Ps=_n.exports,xs=Ps&&Ps.isSet,Es=xs?_s(xs):ks,ws=ye,Ss=Gi,Is=jn,Os=sr,Ms=lr,As=Ee.exports,js=Me,Bs=gr,Ls=wr,Ts=Br,Rs=Dr,Ds=Qr,Ns=Yr,zs=us,$s=He,Hs=g,Vs=rn.exports,qs=Cs,Us=lt,Js=Es,Xs=nr,Gs=Yn,Fs={},Ks=(Fs["[object Arguments]"]=Fs["[object Array]"]=Fs["[object ArrayBuffer]"]=Fs["[object DataView]"]=Fs["[object Boolean]"]=Fs["[object Date]"]=Fs["[object Float32Array]"]=Fs["[object Float64Array]"]=Fs["[object Int8Array]"]=Fs["[object Int16Array]"]=Fs["[object Int32Array]"]=Fs["[object Map]"]=Fs["[object Number]"]=Fs["[object Object]"]=Fs["[object RegExp]"]=Fs["[object Set]"]=Fs["[object String]"]=Fs["[object Symbol]"]=Fs["[object Uint8Array]"]=Fs["[object Uint8ClampedArray]"]=Fs["[object Uint16Array]"]=Fs["[object Uint32Array]"]=!0,Fs["[object Error]"]=Fs["[object Function]"]=Fs["[object WeakMap]"]=!1,function baseClone$1(n,i,s,t,e,r){var o,a=1&i,l=2&i,h=4&i;if(void 0!==(o=s?e?s(n,t,e,r):s(n):o))return o;if(!Us(n))return n;t=Hs(n);if(t){if(o=Ns(n),!a)return js(n,o)}else{var c=Ds(n),u="[object Function]"==c||"[object GeneratorFunction]"==c;if(Vs(n))return As(n,a);if("[object Object]"==c||"[object Arguments]"==c||u&&!e){if(o=l||u?{}:$s(n),!a)return l?Ls(n,Ms(o,n)):Bs(n,Os(o,n))}else{if(!Fs[c])return e?n:{};o=zs(n,c,a)}}u=(r=r||new ws).get(n);if(u)return u;r.set(n,o),Js(n)?n.forEach(function(t){o.add(baseClone$1(t,i,s,t,n,r))}):qs(n)&&n.forEach(function(t,e){o.set(e,baseClone$1(t,i,s,e,n,r))});var d=t?void 0:(h?l?Rs:Ts:l?Gs:Xs)(n);return Ss(d||n,function(t,e){d&&(t=n[e=t]),Is(o,e,baseClone$1(t,i,s,e,n,r))}),o}),Ws=function cloneDeep(t){return Ks(t,5)},Qs=null,Zs=((Qs=window||global||{}).requestFrame=Qs.requestAnimationFrame||Qs.webkitRequestAnimationFrame||Qs.mozRequestAnimationFrame||Qs.oRequestAnimationFrame||Qs.msRequestAnimationFrame,Qs),Ys=function(){function ICEEvent(){var t,e,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};for(t in _classCallCheck(this,ICEEvent),n)this[t]=n[t];for(e in i)this[e]=i[e]}return _createClass(ICEEvent,[{key:"composedPath",value:function composedPath(){throw new Error("Method not implemented.")}},{key:"initEvent",value:function initEvent(t,e,n){throw new Error("Method not implemented.")}},{key:"preventDefault",value:function preventDefault(){throw new Error("Method not implemented.")}},{key:"stopImmediatePropagation",value:function stopImmediatePropagation(){throw new Error("Method not implemented.")}},{key:"stopPropagation",value:function stopPropagation(){throw new Error("Method not implemented.")}}]),ICEEvent}(),to=Zi,eo=Qr,no=Ke,io=g,ro=Ye,so=rn.exports,oo=De,ao=Sn,lo=Object.prototype.hasOwnProperty,ho=function isEmpty(t){if(null==t)return!0;if(ro(t)&&(io(t)||"string"==typeof t||"function"==typeof t.splice||so(t)||ao(t)||no(t)))return!t.length;var e,n=eo(t);if("[object Map]"==n||"[object Set]"==n)return!t.size;if(oo(t))return!to(t).length;for(e in t)if(lo.call(t,e))return!1;return!0},co=function(){function ICEEventTarget(){_classCallCheck(this,ICEEventTarget),_defineProperty$1(this,"listeners",{}),_defineProperty$1(this,"suspendedEventNames",[])}return _createClass(ICEEventTarget,[{key:"on",value:function on(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Zs;this.listeners[t]||(this.listeners[t]=[]),this.off(t,e,n),this.listeners[t].push({callback:e,scope:n})}},{key:"off",value:function off(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Zs;if(i=this.listeners[t])for(var i=_toConsumableArray(i),s=0;s<i.length;s++){var r=i[s];if(r.callback===e&&r.scope===n)return void this.listeners[t].splice(s,1)}}},{key:"once",value:function once(e,n){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Zs,s=this;s.on(e,function callback(t){s.off(e,callback,i),n.call(i,t)},i)}},{key:"trigger",value:function trigger(t){var e,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(ho(this.listeners[t]))return!1;if(this.suspendedEventNames.includes(t))return!1;n?((e=new Ys(n)).originalEvent=n.originalEvent||n,e.param=_objectSpread2({},i)):e=new Ys({type:t,timeStamp:Date.now(),param:_objectSpread2({},i)});for(var s=this.listeners[t],r=0;r<s.length;r++){var o=s[r];o.callback.call(o.scope,e)}return!0}},{key:"suspend",value:function suspend(t){t&&!this.suspendedEventNames.includes(t)&&this.suspendedEventNames.push(t)}},{key:"resume",value:function resume(e){this.suspendedEventNames.splice(this.suspendedEventNames.findIndex(function(t){return t===e}),1)}},{key:"purgeEvents",value:function purgeEvents(){this.listeners={},this.suspendedEventNames=[]}},{key:"hasListener",value:function hasListener(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Zs;if(!this.listeners[t])return!1;var i=this.listeners[t];if(!i)return!1;for(var s=0;s<i.length;s++){var r=i[s];if(r.callback===e&&r.scope===n)return!0}return!1}}]),ICEEventTarget}(),uo=(co.prototype.addEventListener=co.prototype.on,co.prototype.removeEventListener=co.prototype.off,co.prototype.dispatchEvent=co.prototype.trigger,function(){function GeoUtil(){throw _classCallCheck(this,GeoUtil),new Error("GeoUtil is a static util class.")}return _createClass(GeoUtil,null,[{key:"calcRotateAngle",value:function calcRotateAngle(t,e,n,i){t-=n,n=e-i,e=Math.hypot(t,n);return((n/e<0?-1:1)*Math.acos(t/e)*180/Math.PI+360)%360}},{key:"calcRotateAngleFromMatrix",value:function calcRotateAngleFromMatrix(t){var e=0,n=t[0],t=t[1],i=Math.hypot(n,t),t=t/i,e=Math.acos(n/i);return t<0&&(e+=Math.PI/2),e*(180/Math.PI)}},{key:"calcScaleFromMatrix",value:function calcScaleFromMatrix(t){var e=t[0],n=t[1],i=t[2],t=t[3];return[Math.hypot(e,n)/e,Math.hypot(i,t)/t]}}]),GeoUtil}()),fo=function(){function ICEBoundingBox(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[0,0,0,0,0,0,0,0,0,0];_classCallCheck(this,ICEBoundingBox),_defineProperty$1(this,"tl",[0,0]),_defineProperty$1(this,"tr",[0,0]),_defineProperty$1(this,"bl",[0,0]),_defineProperty$1(this,"br",[0,0]),_defineProperty$1(this,"tc",[0,0]),_defineProperty$1(this,"rc",[0,0]),_defineProperty$1(this,"bc",[0,0]),_defineProperty$1(this,"lc",[0,0]),_defineProperty$1(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 _createClass(ICEBoundingBox,[{key:"containsPoint",value:function containsPoint(t){var e=this.getMinAndMaxPoint(),n=e.minX,i=e.minY,s=e.maxX,e=e.maxY;if(t[0]<n||t[0]>s||t[1]<i||t[1]>e)return!1;for(var r=0,o=this.getBoundingLines(),a=0;a<o.length;a++){var l,h=o[a];t[1]>h.o[1]&&t[1]>h.d[1]||t[1]<h.o[1]&&t[1]<h.d[1]||(h.o[0]===h.d[0]&&h.o[0]>=t[0]?h.o[0]:(l=(h.d[1]-h.o[1])/(h.d[0]-h.o[0]),h.o[0]+(t[1]-h.o[1])/l))>t[0]&&r++}return 0!==r&&r%2==1}},{key:"getBoundingLines",value:function getBoundingLines(){return[{o:_toConsumableArray(this.tl),d:_toConsumableArray(this.tr)},{o:_toConsumableArray(this.tr),d:_toConsumableArray(this.br)},{o:_toConsumableArray(this.br),d:_toConsumableArray(this.bl)},{o:_toConsumableArray(this.bl),d:_toConsumableArray(this.tl)}]}},{key:"getMinAndMaxPoint",value:function getMinAndMaxPoint(){for(var t=this.tl[0],e=this.tl[1],n=this.tl[0],i=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]>n&&(n=o[0]),o[1]<e&&(e=o[1]),o[1]>i&&(i=o[1])}return{minX:t,minY:e,maxX:n,maxY:i}}},{key:"containsBox",value:function containsBox(t){return!1}},{key:"isIntersect",value:function isIntersect(t){var e=this.tl[0],n=this.br[0],i=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<i||n<r||s<a)}},{key:"transform",value:function transform(t){var e=transformMat2d([],this.tl,t),n=transformMat2d([],this.tr,t),i=transformMat2d([],this.bl,t),s=transformMat2d([],this.br,t),t=transformMat2d([],this.center,t);return new ICEBoundingBox([].concat(_toConsumableArray(e),_toConsumableArray(n),_toConsumableArray(i),_toConsumableArray(s),_toConsumableArray(t)))}},{key:"union",value:function union(t){return null}},{key:"width",get:function get(){var t=this.br[0]-this.bl[0],e=this.br[1]-this.bl[1];return Math.hypot(t,e)}},{key:"height",get:function get(){var t=this.br[0]-this.tr[0],e=this.br[1]-this.tr[1];return Math.hypot(t,e)}},{key:"left",get:function get(){return this.tl[0]},set:function set(t){throw new Error("Can not set left to ICEBoundingBox directly.")}},{key:"top",get:function get(){return this.tl[1]},set:function set(t){throw new Error("Can not set top to ICEBoundingBox directly.")}},{key:"centerX",get:function get(){return this.center[0]}},{key:"centerY",get:function get(){return this.center[1]}},{key:"centerPoint",get:function get(){return this.center}}],[{key:"fromDimension",value:function fromDimension(t,e,n,i){return new ICEBoundingBox([].concat([t,e],[t+n,e],[t,e+i],[t+n,e+i],[t+n/2,e+i/2]))}}]),ICEBoundingBox}();function getVal(t,e){return e.split(".").reduce(function(t,e){return t[e]},t)}function flattenTree(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,s=0;s<e.length;s++){var r=e[s];r._level=n,r._pid=i,t.push(r),flattenTree(t,r.childNodes||[],n+1,r.id)}return t}function uuid(){if(Zs.crypto)return Zs.crypto.randomUUID();var n=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"==t?e:3&e|8).toString(16)})}var po=function(){_inherits(ICEComponent,co);var n=_createSuper(ICEComponent);function ICEComponent(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEComponent),_defineProperty$1(_assertThisInitialized(t=n.call(this)),"__dirty",!0),_defineProperty$1(_assertThisInitialized(t),"props",{id:"ICE_"+uuid(),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:ICEComponent.instanceCounter++,display:!0,draggable:!0,transformable:!0,interactive:!0,linkable:!0,showMinBoundingBox:!1,showMaxBoundingBox:!1}),_defineProperty$1(_assertThisInitialized(t),"state",{}),t.props=Ui(t.props,e),t.state=Ws(t.props),t.root=Zs,t.initEvents(),t}return _createClass(ICEComponent,[{key:"initEvents",value:function initEvents(){this.on("mousedown",this.mouseDownEvtHandler,this),this.on("keydown",this.keyboardEvtHandler,this),this.on("keyup",this.keyboardEvtHandler,this)}},{key:"mouseDownEvtHandler",value:function mouseDownEvtHandler(t){this.state.interactive&&this.state.draggable&&(this.on("mousemove",this.mouseMoveEvtHandler,this),this.on("mouseup",this.mouseUpEvtHandler,this))}},{key:"mouseMoveEvtHandler",value:function mouseMoveEvtHandler(t){var e=t.movementX,n=t.movementY;return this.moveGlobalPosition(e,n,t),!0}},{key:"mouseUpEvtHandler",value:function mouseUpEvtHandler(t){this.off("mousemove",this.mouseMoveEvtHandler,this),this.off("mouseup",this.mouseUpEvtHandler,this)}},{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){switch(t.key){case"ArrowUp":this.moveGlobalPosition(0,-2,t);break;case"ArrowDown":this.moveGlobalPosition(0,2,t);break;case"ArrowLeft":this.moveGlobalPosition(-2,0,t);break;case"ArrowRight":this.moveGlobalPosition(2,0,t);break;case"Delete":(this.parentNode&&this.parentNode.removeChild?this.parentNode:this.ice).removeChild(this)}}},{key:"render",value:function render(){this.trigger(E),this.state.display&&(this.calcComponentParams(),this.applyStyleToCtx(),this.applyTransformToCtx(),this.doRender(),this.trigger(w),this.dirty=!1)}},{key:"applyStyleToCtx",value:function applyStyleToCtx(){var t,e=_objectSpread2(_objectSpread2({},this.props.style),this.state.style);for(t in e)this.ctx[t]=e[t]}},{key:"calcComponentParams",value:function calcComponentParams(){return{width:this.state.width,height:this.state.height}}},{key:"calcLocalOrigin",value:function calcLocalOrigin(){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 calcAbsoluteOrigin(){var t=getVal(this,"state.transform.translate.0")+this.state.left,e=getVal(this,"state.transform.translate.1")+this.state.top,n=_toConsumableArray(this.calcLocalOrigin());return n[0]+=t,n[1]+=e,this.parentNode&&(n=transformMat2d([],n,[1,0,0,1,-this.parentNode.state.localOrigin[0],-this.parentNode.state.localOrigin[1]]),n=transformMat2d([],n,this.parentNode.state.composedMatrix)),this.state.absoluteOrigin=n}},{key:"calcLinearMatrix",value:function calcLinearMatrix(){var t=function create$1(){var t=new Ji(6);return Ji!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}(),e=getVal(this,"state.transform.skew.0"),n=getVal(this,"state.transform.skew.1"),t=function scale(t,e,n){var i=e[0],s=e[1],r=e[2],o=e[3],a=e[4],e=e[5],l=n[0],n=n[1];return t[0]=i*l,t[1]=s*l,t[2]=r*n,t[3]=o*n,t[4]=a,t[5]=e,t}([],function rotate(t,e,n){var i=e[0],s=e[1],r=e[2],o=e[3],a=e[4],e=e[5],l=Math.sin(n),n=Math.cos(n);return t[0]=i*n+r*l,t[1]=s*n+o*l,t[2]=i*-l+r*n,t[3]=s*-l+o*n,t[4]=a,t[5]=e,t}([],function skew(t,e,n,i){n=Math.tan(n),i=Math.tan(i);return t[0]=e[0],t[1]=e[1]+n,t[2]=e[2]+i,t[3]=e[3],t[4]=e[4],t[5]=e[5],t}([],t,toRadian(e),toRadian(n)),toRadian(getVal(this,"state.transform.rotate"))),[getVal(this,"state.transform.scale.0"),getVal(this,"state.transform.scale.1")]);return this.state.linearMatrix=t}},{key:"calcAbsoluteLinearMatrix",value:function calcAbsoluteLinearMatrix(){for(var t=this,e=t.calcLinearMatrix();t.parentNode;)e=multiply([],t.parentNode.state.linearMatrix,e),t=t.parentNode;return this.state.absoluteLinearMatrix=e}},{key:"composeMatrix",value:function composeMatrix(){var t=this.calcAbsoluteOrigin(),t=multiply([],[1,0,0,1,t[0],t[1]],this.calcAbsoluteLinearMatrix());return this.state.composedMatrix=t}},{key:"applyTransformToCtx",value:function applyTransformToCtx(){var t,e=this.dirty?this.composeMatrix():this.state.composedMatrix;(t=this.ctx).setTransform.apply(t,_toConsumableArray(e))}},{key:"doRender",value:function doRender(){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 getMinBoundingBox(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],e=this.state.localOrigin[0],n=this.state.localOrigin[1],i=this.state.width,s=this.state.height,e=new fo([0-e,0-n,0-e+i,0-n,0-e,0-n+s,0-e+i,0-n+s,0,0]),i=t?this.composeMatrix():this.state.composedMatrix;return e.transform(i)}},{key:"getMaxBoundingBox",value:function getMaxBoundingBox(){var t=this.getMinBoundingBox(0<arguments.length&&void 0!==arguments[0]&&arguments[0]),e=t.getMinAndMaxPoint(),n=e.minX,i=e.minY,s=e.maxX,e=e.maxY,t=t.centerPoint;return new fo([n,i,s,i,n,e,s,e,t[0],t[1]])}},{key:"setState",value:function setState(t){Ui(this.state,t),this.dirty=!0,this.ice&&(this.ice.dirty=!0)}},{key:"dirty",get:function get(){return this.__dirty},set:function set(t){this.__dirty=t}},{key:"setPosition",value:function setPosition(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Ys;this.trigger(N,_objectSpread2(_objectSpread2({},n),{},{left:t,top:e})),this.setState({left:t,top:e}),this.trigger(z,_objectSpread2(_objectSpread2({},n),{},{left:t,top:e}))}},{key:"moveGlobalPosition",value:function moveGlobalPosition(t,e){var n,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Ys;this.parentNode&&(t=(n=transformMat2d([],[t,e],invert([],this.parentNode.state.absoluteLinearMatrix)))[0],e=n[1]),this.setPosition(this.state.left+t,this.state.top+e,_objectSpread2(_objectSpread2({},i),{},{tx:t,ty:e}))}},{key:"setGlobalPosition",value:function setGlobalPosition(t,e){var n,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Ys;this.parentNode&&(t=(n=transformMat2d([],[t,e],invert([],this.parentNode.state.absoluteLinearMatrix)))[0],e=n[1]),this.setPosition(t,e,_objectSpread2(_objectSpread2({},i),{},{left:t,top:e}))}},{key:"setGlobalRotate",value:function setGlobalRotate(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteLinearMatrix,t-=uo.calcRotateAngleFromMatrix(e)),this.setState({transform:{rotate:t}})}},{key:"localToGlobal",value:function localToGlobal(t,e){t=[t,e];return transformMat2d([],t,this.state.composedMatrix)}},{key:"globalToLocal",value:function globalToLocal(t,e){t=[t,e];return transformMat2d([],t,invert([],this.state.composedMatrix))}},{key:"getRotateAngle",value:function getRotateAngle(){var t=this.state.composedMatrix;return uo.calcRotateAngleFromMatrix(t)}},{key:"getLocalLeftTop",value:function getLocalLeftTop(){var t=this.getMinBoundingBox(!0),e=t.width,n=t.height;return{left:t.centerX-t.width/2,top:t.centerY-t.height/2,width:e,height:n}}},{key:"containsPoint",value:function containsPoint(t,e){return this.getMinBoundingBox().containsPoint([t,e])}},{key:"destory",value:function destory(){this.trigger(O,null,{component:this}),this.purgeEvents(),this.ice=null,this.ctx=null,this.root=null,this.evtBus=null,this.parentNode=null}}]),ICEComponent}(),vo=(_defineProperty$1(po,"instanceCounter",0),function(){_inherits(ICEPath,po);var e=_createSuper(ICEPath);function ICEPath(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEPath),_defineProperty$1(_assertThisInitialized(t=e.call(this,_objectSpread2({closePath:!0},t))),"path2D",new Path2D),t}return _createClass(ICEPath,[{key:"doRender",value:function doRender(){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),_get(_getPrototypeOf(ICEPath.prototype),"doRender",this).call(this)}}]),ICEPath}()),yo=function(){_inherits(ICERect,vo);var e=_createSuper(ICERect);function ICERect(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICERect),e.call(this,_objectSpread2({width:10,height:10},t))}return _createClass(ICERect,[{key:"createPathObject",value:function createPathObject(){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}}]),ICERect}(),go=function(){_inherits(ICEGroup,yo);var e=_createSuper(ICEGroup);function ICEGroup(t){return _classCallCheck(this,ICEGroup),_defineProperty$1(_assertThisInitialized(t=e.call(this,t)),"parentNode",null),_defineProperty$1(_assertThisInitialized(t),"childNodes",[]),t}return _createClass(ICEGroup,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEGroup.prototype),"initEvents",this).call(this),this.once(I,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function afterAddHandler(){for(var t=0;t<this.childNodes.length;t++){var e=this.childNodes[t];this.syncChildEvents(e)}}},{key:"syncChildEvents",value:function syncChildEvents(t){t.trigger(S),t.ice=this.ice,t.ctx=this.ice.ctx,t.evtBus=this.ice.evtBus,t.trigger(I)}},{key:"addChild",value:function addChild(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];-1===this.childNodes.indexOf(t)&&((t.parentNode=this).childNodes.push(t),this.dirty=e,this.ice&&(this.syncChildEvents(t),this.ice.dirty=e))}},{key:"addChildren",value:function addChildren(t){for(var e=0;e<t.length;e++){var n=t[e];this.addChild(n,!1)}this.dirty=!0,this.ice&&(this.ice.dirty=!0)}},{key:"removeChild",value:function removeChild(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];t.destory(),this.childNodes.splice(this.childNodes.indexOf(t),1),this.dirty=e,this.ice&&(this.ice.dirty=e)}},{key:"removeChildren",value:function removeChildren(t){for(var e=0;e<t.length;e++){var n=t[e];this.removeChild(n,!1)}this.dirty=!0,this.ice&&(this.ice.dirty=!0)}},{key:"setState",value:function setState(t){Ui(this.state,t),this.dirty=!0,function setRecursively(t){if(t.dirty=!0,t.childNodes&&t.childNodes.length)for(var e=0;e<t.childNodes.length;e++)setRecursively(t.childNodes[e])}(this),this.ice&&(this.ice.dirty=!0)}},{key:"destory",value:function destory(){this.removeChildren(this.childNodes),_get(_getPrototypeOf(ICEGroup.prototype),"destory",this).call(this)}}]),ICEGroup}(),Co=function(){_inherits(ICEControlPanel,go);var e=_createSuper(ICEControlPanel);function ICEControlPanel(t){return _classCallCheck(this,ICEControlPanel),_defineProperty$1(_assertThisInitialized(t=e.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))),"isControlPanel",!0),t}return _createClass(ICEControlPanel,[{key:"doRender",value:function doRender(){_get(_getPrototypeOf(ICEControlPanel.prototype),"doRender",this).call(this),this.updateControlPositions()}},{key:"moveGlobalPosition",value:function moveGlobalPosition(t,e,n){_get(_getPrototypeOf(ICEControlPanel.prototype),"moveGlobalPosition",this).call(this,t,e,n),this._targetComponent&&this._targetComponent.moveGlobalPosition(t,e,n)}}]),ICEControlPanel}(),mo=function isNil(t){return null==t},bo=function(){_inherits(ICEEllipse,vo);var e=_createSuper(ICEEllipse);function ICEEllipse(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEEllipse),_objectSpread2({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,e.call(this,t)}return _createClass(ICEEllipse,[{key:"createPathObject",value:function createPathObject(){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 setState(t){mo(t.radiusX)?mo(t.width)||(t.radiusX=t.width/2):t.width=2*t.radiusX,mo(t.radiusY)?mo(t.height)||(t.radiusY=t.height/2):t.height=2*t.radiusY,_get(_getPrototypeOf(ICEEllipse.prototype),"setState",this).call(this,t)}}]),ICEEllipse}(),ko=function(){_inherits(ICECircle,bo);var e=_createSuper(ICECircle);function ICECircle(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICECircle),_objectSpread2({radius:10},t));return t.radiusX=t.radius,t.radiusY=t.radius,e.call(this,t)}return _createClass(ICECircle)}(),_o=function(){_inherits(ICELinkHook,ko);var e=_createSuper(ICELinkHook);function ICELinkHook(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkHook),e.call(this,_objectSpread2({linkable:!1},t))}return _createClass(ICELinkHook,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICELinkHook.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(z,this.resizeEvtHandler,this)}},{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){}},{key:"mosueDownHandler",value:function mosueDownHandler(t){this.evtBus.trigger(A,new Ys({target:this}))}},{key:"mosueMoveHandler",value:function mosueMoveHandler(t){this.evtBus.trigger(j,new Ys({target:this}))}},{key:"mosueUpHandler",value:function mosueUpHandler(t){this.evtBus.trigger(B,new Ys({target:this}))}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){var e;this.parentNode&&(e=this.props.position,this.parentNode.trigger(L,new Ys(t,{position:e})),this.parentNode.trigger(T,new Ys(t,{position:e})))}}]),ICELinkHook}(),Po=function(){_inherits(LineControlPanel,Co);var e=_createSuper(LineControlPanel);function LineControlPanel(t){return _classCallCheck(this,LineControlPanel),_defineProperty$1(_assertThisInitialized(t=e.call(this,_objectSpread2(_objectSpread2({},t),{},{zIndex:10001e3,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"controlSize",16),t.initControls(),t}return _createClass(LineControlPanel,[{key:"initControls",value:function initControls(){var t=this.state.width,e=this.state.height,n=this.controlSize/2;this.startControl=new _o({zIndex:10001001,display:!1,left:-n,top:-n,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"start"}),this.addChild(this.startControl),this.endControl=new _o({zIndex:10001002,display:!1,left:t-n,top:e-n,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"end"}),this.addChild(this.endControl)}},{key:"initEvents",value:function initEvents(){this.on(T,this.resizeEvtHandler,this)}},{key:"enable",value:function enable(){this.setState({display:!0}),this.resume(T),this.showHooks()}},{key:"disable",value:function disable(){this.setState({display:!1}),this.suspend(T),this.hideHooks()}},{key:"updateControlPositions",value:function updateControlPositions(){}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){if(this.targetComponent){var e=t.position,n=t.movementX,i=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],l=t.points[s-1][1],s=transformMat2d([],[n,i],invert([],t.absoluteLinearMatrix)),n=s[0],i=s[1];switch(e){case"start":r+=n,o+=i;break;case"end":a+=n,l+=i}this.targetComponent.setState({startPoint:[r,o],endPoint:[a,l]})}}},{key:"updatePosition",value:function updatePosition(){var t,e,n;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,n=this.targetComponent.state.points.length,e=this.targetComponent.state.points[0],n=this.targetComponent.state.points[n-1],e=[e[0],e[1]],n=[n[0],n[1]],this.startControl.setState({left:e[0]-t,top:e[1]-t}),this.endControl.setState({left:n[0]-t,top:n[1]-t}))}},{key:"targetComponent",get:function get(){return this._targetComponent},set:function set(t){var e=this;this._targetComponent&&this._targetComponent.off(z,this.updatePosition,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(z,this.updatePosition,this),this._targetComponent&&this._targetComponent.once(O,function(){e.targetComponent=null,e.disable()},this),this.updatePosition()}},{key:"showHooks",value:function showHooks(){this.startControl.setState({display:!0}),this.endControl.setState({display:!0})}},{key:"hideHooks",value:function hideHooks(){this.startControl.setState({display:!1}),this.endControl.setState({display:!1})}}]),LineControlPanel}(),xo=/\s/,Eo=function trimmedEndIndex$1(t){for(var e=t.length;e--&&xo.test(t.charAt(e)););return e},wo=/^\s+/,So=y,Io=C,Oo=function isSymbol$2(t){return"symbol"==typeof t||Io(t)&&"[object Symbol]"==So(t)},Mo=function baseTrim$1(t){return t&&t.slice(0,Eo(t)+1).replace(wo,"")},Ao=lt,jo=Oo,Bo=/^[-+]0x[0-9a-f]+$/i,Lo=/^0b[01]+$/i,To=/^0o[0-7]+$/i,Ro=parseInt,Do=function toNumber$2(t){if("number"==typeof t)return t;if(jo(t))return NaN;if(Ao(t)&&(e="function"==typeof t.valueOf?t.valueOf():t,t=Ao(e)?e+"":e),"string"!=typeof t)return 0===t?t:+t;t=Mo(t);var e=Lo.test(t);return e||To.test(t)?Ro(t.slice(2),e?2:8):Bo.test(t)?NaN:+t},No=Do,zo=function toFinite$1(t){return t?(t=No(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0},$o=function toInteger$1(t){var t=zo(t),e=t%1;return t==t?e?t-e:t:0},Ho=function arrayMap$1(t,e){for(var n=-1,i=null==t?0:t.length,s=Array(i);++n<i;)s[n]=e(t[n],n,t);return s},Vo=g,qo=Oo,Uo=s?s.prototype:void 0,Jo=Uo?Uo.toString:void 0,Xo=function baseToString$1(t){if("string"==typeof t)return t;if(Vo(t))return Ho(t,baseToString$1)+"";if(qo(t))return Jo?Jo.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},Go=$o,Fo=Do,Ko=function toString$1(t){return null==t?"":Xo(t)},Wo=r.isFinite,Qo=Math.min,Zo=function createRound$1(t){var s=Math[t];return function(t,e){var n,i;return t=Fo(t),(e=null==e?0:Qo(Go(e),292))&&Wo(t)?(n=(Ko(t)+"e").split("e"),i=s(n[0]+"e"+(+n[1]+e)),+((n=(Ko(i)+"e").split("e"))[0]+"e"+(+n[1]-e))):s(t)}}("round"),Yo=function(){_inherits(ResizeControl,yo);var e=_createSuper(ResizeControl);function ResizeControl(t){return _classCallCheck(this,ResizeControl),e.call(this,_objectSpread2(_objectSpread2({position:"l",direction:"x",quadrant:1},t),{},{linkable:!1}))}return _createClass(ResizeControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ResizeControl.prototype),"initEvents",this).call(this),this.on(z,this.resizeEvtHandler,this)}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){if(this.parentNode){var e=t.quadrant,n=t.movementX,i=t.movementY,s=this.parentNode.state,r=s.left,o=s.top,a=s.width,l=s.height,s=transformMat2d([],[n,i],invert([],s.absoluteLinearMatrix)),n=s[0],i=s[1];switch(e){case 1:r-=n,o+=i,a+=2*n,l-=2*i;break;case 2:r+=n,o+=i,a-=2*n,l-=2*i;break;case 3:r+=n,o-=i,a-=2*n,l+=2*i;break;case 4:r-=n,o-=i,a+=2*n,l+=2*i;break;case 5:o+=i,l-=2*i;break;case 6:o-=i,l+=2*i;break;case 7:r+=n,a-=2*n;break;case 8:r-=n,a+=2*n}s={top:o,left:r,width:Math.abs(a),height:Math.abs(l)};this.parentNode.trigger(L,new Ys(t,{quadrant:e})),this.parentNode.setState(s),this.parentNode.trigger(T,new Ys(t,{quadrant:e}))}}},{key:"moveGlobalPosition",value:function moveGlobalPosition(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Ys,i=0<t?1:-1,s=0<e?1:-1,r=this.parentNode.state,o=r.localOrigin,a=r.width,l=r.height,r=transformMat2d([],[t,e],invert([],r.absoluteLinearMatrix)),r=(t=r[0],e=r[1],this.state),h=r.left,c=r.top,r=r.quadrant,u=this.state.width/2,d=0;"x"===this.state.direction?d=0<(h=0===Zo(h+=t)?.5*i:h)+u-o[0]?8:7:"y"===this.state.direction?d=0<(c=0===Zo(c+=e)?.5*s:c)+u-o[1]?6:5:"xy"===this.state.direction&&(s=-l/2/(s=0===Zo(s=-a/2)?.5*i:s),0===Zo(a=a/2)&&(a=.5*i),c+=e=2===r||4==r?s*(h+u-o[0]+t)-(c+u-o[1]):-l/2/a*(h+u-o[0]+t)-(c+u-o[1]),d=0<(h+=t)+u-o[0]?0<c+u-o[1]?4:1:0<c+u-o[1]?3:2),r!==d&&this.parentNode.toggleControlQuadrant(this,d),this.setPosition(h,c,new Ys(n,{left:h,top:c,tx:t,ty:e,quadrant:d}))}}]),ResizeControl}(),ta=function(){_inherits(RotateControl,ko);var e=_createSuper(RotateControl);function RotateControl(t){return _classCallCheck(this,RotateControl),e.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))}return _createClass(RotateControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(RotateControl.prototype),"initEvents",this).call(this),this.on(z,this.rotateEvtHandler,this)}},{key:"rotateEvtHandler",value:function rotateEvtHandler(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteOrigin,t={transform:{rotate:uo.calcRotateAngle(t.offsetX,t.offsetY,e[0],e[1])+90}},this.parentNode.trigger(R,new Ys(t)),this.parentNode.setState(t),this.parentNode.trigger(D,new Ys(t)))}}]),RotateControl}(),ea=function(){_inherits(TransformControlPanel,Co);var e=_createSuper(TransformControlPanel);function TransformControlPanel(t){return _classCallCheck(this,TransformControlPanel),_defineProperty$1(_assertThisInitialized(t=e.call(this,_objectSpread2(_objectSpread2({},t),{},{zIndex:10000001,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"rotateControlSize",8),_defineProperty$1(_assertThisInitialized(t),"rotateControlffsetY",60),_defineProperty$1(_assertThisInitialized(t),"resizeControlInstanceCache",[]),_defineProperty$1(_assertThisInitialized(t),"resizeControlSize",16),t.initControls(),t}return _createClass(TransformControlPanel,[{key:"initControls",value:function initControls(){var t=this.state.width,e=this.state.height,n=t/2,i=e/2,s=this.resizeControlSize/2,r=[{direction:"xy",quadrant:2,position:[-s,-s]},{direction:"y",quadrant:5,position:[n-s,-s]},{direction:"xy",quadrant:1,position:[t-s,-s]},{direction:"x",quadrant:8,position:[t-s,i-s]},{direction:"xy",quadrant:4,position:[t-s,e-s]},{direction:"y",quadrant:6,position:[n-s,e-s]},{direction:"xy",quadrant:3,position:[-s,e-s]},{direction:"x",quadrant:7,position:[-s,i-s]}];this.resizeControlInstanceCache=[];for(var o=0;o<r.length;o++){var a=r[o],a=new Yo({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,n=-this.rotateControlffsetY;this.rotateControlInstance=new ta({zIndex:10000003,display:!1,left:t,top:n,radius:this.rotateControlSize,style:{strokeStyle:"#8b0000",fillStyle:"#CC3300",lineWidth:1}}),this.addChild(this.rotateControlInstance)}},{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(TransformControlPanel.prototype),"initEvents",this).call(this),this.on(T,this.resizeEvtHandler,this),this.on(D,this.rotateEvtHandler,this),this.on("keydown",this.keyboardEvtHandler,this),this.on("keyup",this.keyboardEvtHandler,this)}},{key:"enable",value:function enable(){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(T),this.resume(D),this.resume("keydown"),this.resume("keyup")}},{key:"disable",value:function disable(){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(T),this.suspend(D),this.suspend("keydown"),this.suspend("keyup")}},{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){this.targetComponent&&this.targetComponent.trigger(t.type,t,{component:this.targetComponent})}},{key:"rotateEvtHandler",value:function rotateEvtHandler(t){var e;this.targetComponent&&(e=this.state.transform.rotate,this.targetComponent.setGlobalRotate(e),this.targetComponent.trigger(D))}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){if(this.targetComponent){var e=t.quadrant,n=t.movementX,i=t.movementY,t=this.targetComponent.state,s=t.left,r=t.top,o=t.width,a=t.height,t=transformMat2d([],[n,i],invert([],t.absoluteLinearMatrix)),n=t[0],i=t[1];switch(e){case 1:s-=n,r+=i,o+=2*n,a-=2*i;break;case 2:s+=n,r+=i,o-=2*n,a-=2*i;break;case 3:s+=n,r-=i,o-=2*n,a+=2*i;break;case 4:s-=n,r-=i,o+=2*n,a+=2*i;break;case 5:r+=i,a-=2*i;break;case 6:r-=i,a+=2*i;break;case 7:s+=n,o-=2*n;break;case 8:s-=n,o+=2*n}this.targetComponent.setState({left:s,top:r,width:Math.abs(o),height:Math.abs(a)}),this.targetComponent.trigger(T)}}},{key:"updateControlPositions",value:function updateControlPositions(){for(var t=this.state.width,e=this.state.height,n=t/2,i=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=[n-s,-s];break;case 6:a=[n-s,e-s];break;case 7:a=[-s,i-s];break;case 8:a=[t-s,i-s]}o.setState({left:a[0],top:a[1]})}var l=this.state.width/2-this.rotateControlSize,h=-this.rotateControlffsetY;this.rotateControlInstance.setState({left:l,top:h})}},{key:"updatePanel",value:function updatePanel(){var t,e,n,i,s;this.targetComponent&&(t=this.targetComponent.getRotateAngle(),e=(s=this.targetComponent.getLocalLeftTop()).left,n=s.top,i=s.width,s=s.height,this.setState({left:e,top:n,width:i,height:s,transform:{rotate:t}}))}},{key:"targetComponent",get:function get(){return this._targetComponent},set:function set(t){var e=this;this._targetComponent&&this._targetComponent.off(z,this.updatePanel,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(z,this.updatePanel,this),this._targetComponent&&this._targetComponent.once(O,function(){e.targetComponent=null,e.disable()},this),this.updatePanel()}},{key:"toggleControlQuadrant",value:function toggleControlQuadrant(t,e){for(var n=0;n<this.resizeControlInstanceCache.length;n++){var i=this.resizeControlInstanceCache[n];if(i.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}i.setState({quadrant:s})}}t.setState({quadrant:e})}}]),TransformControlPanel}(),na=function(){function ICEControlPanelManager(t){_classCallCheck(this,ICEControlPanelManager),this.ice=t,this.transformControlPanel=new ea({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 Po({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 _createClass(ICEControlPanelManager,[{key:"start",value:function start(){return this.ice.evtBus.on("mousedown",this.mouseDownHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off("mousedown",this.mouseDownHandler,this),this}},{key:"mouseDownHandler",value:function mouseDownHandler(t){t=t.target;if(!t.ice||!t.state.interactive||!t.state.transformable)return this.lineControlPanel.disable(),void this.transformControlPanel.disable();t&&(t.isControlPanel||t.parentNode&&t.parentNode.isControlPanel)||(this.ice.selectionList=[t],this.lineControlPanel.disable(),this.transformControlPanel.disable(),t.isLine?(this.lineControlPanel.targetComponent=t,this.lineControlPanel.enable()):(this.transformControlPanel.targetComponent=t,this.transformControlPanel.enable()))}}]),ICEControlPanelManager}(),ia=[["mousedown","ICE_MOUSEDOWN"],["mouseup","ICE_MOUSEUP"],["mousemove","ICE_MOUSEMOVE"],["click","ICE_CLICK"],["dblclick","ICE_DBCLICK"],["contextmenu","ICE_CONTEXTMENU"]],ra=[["keydown","ICE_KEYDOWN"],["keyup","ICE_KEYUP"]],sa=function(){function DOMEventDispatcher(t){_classCallCheck(this,DOMEventDispatcher),_defineProperty$1(this,"selectionCandidates",[]),_defineProperty$1(this,"_stopped",!1),this.ice=t}return _createClass(DOMEventDispatcher,[{key:"start",value:function start(){for(var i=this,s=null,r=[].concat(_toConsumableArray(ia),_toConsumableArray(ra)),t=function _loop(t){var t=r[t],e=t[0],n=t[1];i.ice.evtBus.on(n,function(t){i._stopped||((s="ICE_MOUSEMOVE"!==n&&-1===n.indexOf("KEY")?i.findTargetComponent(t):s)&&(t.target=s).trigger(e,t),i.ice.evtBus.trigger(e,t,{component:s}))})},e=0;e<r.length;e++)t(e);return this}},{key:"stopped",get:function get(){return this._stopped},set:function set(t){this._stopped=t}},{key:"findTargetComponent",value:function findTargetComponent(t){if(this._stopped)return null;var e=t.offsetX,n=t.offsetY,t=flattenTree([],this.ice.childNodes),i=flattenTree([],this.ice.toolNodes),s=[].concat(_toConsumableArray(t),_toConsumableArray(i));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,l=a.interactive,a=a.display;o.containsPoint(e,n)&&l&&a&&this.selectionCandidates.push(o)}t=this.selectionCandidates.pop();return this.selectionCandidates=[],t}}]),DOMEventDispatcher}(),oa={evtBuses:[],start:function start(){if(Zs&&Zs.addEventListener)for(var t=function _loop(t){for(var n=oa.evtBuses[t],i=[].concat(_toConsumableArray(ia),_toConsumableArray(ra)),e=function _loop2(t){var e=i[t];Zs.addEventListener(e[0],function(t){n.trigger(e[1],t)})},s=0;s<i.length;s++)e(s)},e=0;e<oa.evtBuses.length;e++)t(e)},regitserEvtBus:function regitserEvtBus(t){oa.evtBuses.includes(t)||oa.evtBuses.push(t)},delEvtBus:function delEvtBus(t){oa.evtBuses.includes(t)&&oa.evtBuses.splice(oa.evtBuses.indexOf(t),1)}},aa=function(){_inherits(EventBus,co);var t=_createSuper(EventBus);function EventBus(){return _classCallCheck(this,EventBus),t.call(this)}return _createClass(EventBus)}(),la=function(){function GeoLine(t,e){_classCallCheck(this,GeoLine),this.startPoint=t,this.endPoint=e}return _createClass(GeoLine,[{key:"contains",value:function contains(t,e){var n=Math.hypot(this.endPoint.x-this.startPoint.x,this.endPoint.y-this.startPoint.y),i=Math.hypot(t-this.startPoint.x,e-this.startPoint.y),t=Math.hypot(t-this.endPoint.x,e-this.endPoint.y);return n-3<=i+t&&i+t<=n+3}}]),GeoLine}(),ha=function(){function GeoPoint(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;_classCallCheck(this,GeoPoint),this.x=t,this.y=e}return _createClass(GeoPoint,[{key:"equals",value:function equals(t){return this.x==t.x&&this.y==t.y}},{key:"clone",value:function clone(){return new GeoPoint(this.x,this.y)}}],[{key:"load",value:function load(t){return new GeoPoint(Number(t.x),Number(t.y))}},{key:"cloneArray",value:function cloneArray(t){for(var e=[],n=0;n<t.length;n++)e.push(t[n].clone());return e}}]),GeoPoint}(),ca=function(){_inherits(ICEDotPath,vo);var e=_createSuper(ICEDotPath);function ICEDotPath(t){return _classCallCheck(this,ICEDotPath),e.call(this,_objectSpread2({dots:[],closePath:!0},t))}return _createClass(ICEDotPath,[{key:"calcComponentParams",value:function calcComponentParams(){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 calcLocalOrigin(){for(var t=_get(_getPrototypeOf(ICEDotPath.prototype),"calcLocalOrigin",this).call(this),e=0;e<this.state.dots.length;e++){var n=transformMat2d([],this.state.dots[e],[1,0,0,1,-t[0],-t[1]]);this.state.dots[e]=n}return t}},{key:"createPathObject",value:function createPathObject(){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 calcDots(){return this.state.dots=[],this.state.dots}},{key:"calc4VertexPoints",value:function calc4VertexPoints(){for(var t=this.state.dots[0][0],e=this.state.dots[0][1],n=this.state.dots[0][0],i=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]>n&&(n=r[0]),r[1]<e&&(e=r[1]),r[1]>i&&(i=r[1])}return[[t,e],[n,e],[t,i],[n,i]]}},{key:"getTransformedDots",value:function getTransformedDots(){for(var t=this.state.composedMatrix,e=this.state.dots,n=[],i=0;i<e.length;i++){var s=transformMat2d([],e[i],t);n.push(s)}return n}}]),ICEDotPath}(),ua="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",da=function(){_inherits(ICEImage,po);var e=_createSuper(ICEImage);function ICEImage(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEImage),e.call(this,_objectSpread2({width:100,height:100,src:ua},t))}return _createClass(ICEImage,[{key:"doRender",value:function doRender(){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)),_get(_getPrototypeOf(ICEImage.prototype),"doRender",this).call(this)}}]),ICEImage}(),fa=_createClass(function ICEBezier(){_classCallCheck(this,ICEBezier)}),pa=function(){_inherits(ICELinkSlot,ko);var e=_createSuper(ICELinkSlot);function ICELinkSlot(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkSlot),e.call(this,_objectSpread2({linkable:!1,draggable:!1,position:"T"},t))}return _createClass(ICELinkSlot,[{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){}},{key:"destory",value:function destory(){this.hostComponent=null,_get(_getPrototypeOf(ICELinkSlot.prototype),"destory",this).call(this)}},{key:"updatePosition",value:function updatePosition(){var t=this._hostComponent.getMinBoundingBox(),e=0,n=0;switch(this.state.position){case"T":e=t.tc[0]-this.state.radius,n=t.tc[1]-this.state.radius;break;case"R":e=t.rc[0]-this.state.radius,n=t.rc[1]-this.state.radius;break;case"B":e=t.bc[0]-this.state.radius,n=t.bc[1]-this.state.radius;break;case"L":e=t.lc[0]-this.state.radius,n=t.lc[1]-this.state.radius}this.setState({left:e,top:n})}},{key:"hostComponent",get:function get(){return this._hostComponent},set:function set(t){var e=this;this._hostComponent&&this._hostComponent.off(w,this.updatePosition,this),this._hostComponent=t,this._hostComponent&&this._hostComponent.on(w,this.updatePosition,this),this._hostComponent&&this._hostComponent.once(O,function(){e._hostComponent=null,e.setState({display:!1})},this),this._hostComponent&&this.setState({display:!0})}}]),ICELinkSlot}(),va=function(){_inherits(ICEPolyLine,ca);var e=_createSuper(ICEPolyLine);function ICEPolyLine(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEPolyLine),ICEPolyLine.arrangeParam(t));return _defineProperty$1(_assertThisInitialized(t=e.call(this,t)),"isLine",!0),t}return _createClass(ICEPolyLine,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEPolyLine.prototype),"initEvents",this).call(this),this.once(I,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function afterAddHandler(t){this.evtBus.once(M,this.syncConnections,this)}},{key:"syncConnections",value:function syncConnections(){this.removeLink("start"),this.removeLink("end");var t=this.state.links;t&&(t.start&&t.start.id&&t.start.position&&this.createLink(t.start.id,t.start.position),t.end&&t.end.id&&t.end.position&&this.createLink(t.end.id,t.end.position)),this.dirty=!0,this.ice.dirty=!0}},{key:"createLink",value:function createLink(t,e){t=this.ice.findComponent(t);t&&t.on(z,this.followComponent,this),t&&t.on(T,this.followComponent,this),t&&t.on(D,this.followComponent,this),t&&t.once(w,this.followComponent,this),t&&this.followComponent(),this.state.draggable=!1}},{key:"removeLink",value:function removeLink(t,e,n){var i;this.state.links&&this.state.links[t]&&(i=this.state.links[t].id,t=this.state.links[t].position,n=n||t,i===(e=e||i)&&t===n&&((e=this.ice.findComponent(i))&&e.off(z,this.followComponent,this),e&&e.off(T,this.followComponent,this),e&&e.off(D,this.followComponent,this)),t=!0,this.state.links.start&&this.state.links.start.id&&(t=!1),this.state.links.end&&this.state.links.end.id&&(t=!1),this.state.draggable=t)}},{key:"getLinkFromId",value:function getLinkFromId(){return this.state.links.start.id}},{key:"getLinkToId",value:function getLinkToId(){return this.state.links.end.id}},{key:"followComponent",value:function followComponent(t){for(var e in this.state.links)if(this.state.links[e]&&this.state.links[e].id&&this.state.links[e].position){var n=this.state.links[e].id,i=this.state.links[e].position,n=this.ice.findComponent(n);if(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:_toConsumableArray(r)});break;case"end":this.setState({endPoint:_toConsumableArray(r)})}}}}},{key:"calcLocalOrigin",value:function calcLocalOrigin(){var t=[0,0];return this.state.localOrigin=t}},{key:"calcDots",value:function calcDots(){var t=this.state.left,e=this.state.top;this.state.dots=[];for(var n=0;n<this.state.points.length;n++){var i=this.state.points[n],s=i[0]-t,i=i[1]-e;this.state.dots.push([s,i])}return this.calcArrowPoints(),this.state.dots}},{key:"calcArrowPoints",value:function calcArrowPoints(){var t,e,n;"start"!==this.state.arrow&&"both"!==this.state.arrow||(n=_toConsumableArray(this.state.dots[0]),e=[_toConsumableArray(this.state.dots[0]),_toConsumableArray(this.state.dots[1])],e=this.doCalcArrowPoints(e),(t=this.state.dots).unshift.apply(t,_toConsumableArray(e)),this.state.dots.unshift(_toConsumableArray(n))),"end"!==this.state.arrow&&"both"!==this.state.arrow||(t=this.state.dots.length,e=_toConsumableArray(this.state.dots[t-1]),n=[_toConsumableArray(this.state.dots[t-1]),_toConsumableArray(this.state.dots[t-2])],n=this.doCalcArrowPoints(n),(t=this.state.dots).push.apply(t,_toConsumableArray(n)),this.state.dots.push(_toConsumableArray(e)))}},{key:"doCalcArrowPoints",value:function doCalcArrowPoints(t){var e=t[0],t=t[1],n=(t[0]=t[0]-e[0],t[1]=t[1]-e[1],t[0]/Math.hypot.apply(Math,_toConsumableArray(t))),t=t[1]/Math.hypot.apply(Math,_toConsumableArray(t)),i=Math.cos(this.state.arrowAngel),s=Math.sin(this.state.arrowAngel),r=this.state.arrowLength*(n*i-t*s),o=this.state.arrowLength*(t*i+n*s),a=this.state.arrowLength*(n*i+t*s),t=this.state.arrowLength*(t*i-n*s);return[[r+=e[0],o+=e[1]],[a+=e[0],t+=e[1]]]}},{key:"addDot",value:function addDot(t,e){this.state.points.splice(e,0,t),this.state.dots.splice(e,0,[t[0],t[1]])}},{key:"rmDot",value:function rmDot(t){return!(this.state.points.length<3||(this.state.points.splice(t,1),this.state.dots.splice(t,1),0))}},{key:"calcComponentParams",value:function calcComponentParams(){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]),n=this.state.style.lineWidth;return this.isDotsOnSameLine()||(n=Math.abs(t[2][1]-t[0][1])),this.state.width=e,this.state.height=n,{width:this.state.width,height:this.state.height}}},{key:"isDotsOnSameLine",value:function isDotsOnSameLine(){for(var t,e=this.state.points.length,n=Zo(this.state.points[0][0],2),i=Zo(this.state.points[0][1],2),s=0,r=[Zo(this.state.points[e-1][0],2)-n,Zo(this.state.points[e-1][1],2)-i],o=0;o<e;o++){var a=this.state.points[o],a=[a[0]-n,a[1]-i];0===(a=r[0]*a[1]-r[1]*a[0],(t=[])[0]=t[1]=0,t[2]=a,t[2])&&s++}return s===e}},{key:"calc4VertexPoints",value:function calc4VertexPoints(){return this.isDotsOnSameLine()?this.splitEndpointsTo4Points():_get(_getPrototypeOf(ICEPolyLine.prototype),"calc4VertexPoints",this).call(this)}},{key:"splitEndpointsTo4Points",value:function splitEndpointsTo4Points(){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],n=this.getRotateAngle(),i=this.state.height,s=Math.cos(n*Math.PI/180)*i/2,n=Math.sin(n*Math.PI/180)*i/2;return[[0+(s=Zo(s,3)),0+(n=Zo(n,3))],[0-s,0-n],[e+s,t+n],[e-s,t-n]]}},{key:"getMinBoundingBox",value:function getMinBoundingBox(){var t=this.state.localOrigin[0],e=this.state.localOrigin[1],n=this.calc4VertexPoints(),t=new fo([n[0][0]-t,n[0][1]-e,n[1][0]-t,n[1][1]-e,n[2][0]-t,n[2][1]-e,n[3][0]-t,n[3][1]-e,0,0]);return t.transform(this.state.composedMatrix)}},{key:"setState",value:function setState(t){if(mo(t.width)||delete t.width,mo(t.height)||delete t.height,mo(t.transform)||delete t.transform,!mo(t.left))for(var e=t.left-this.state.points[0][0],n=0;n<this.state.points.length;n++)this.state.points[n][0]+=e;if(!mo(t.top))for(var i=t.top-this.state.points[0][1],s=0;s<this.state.points.length;s++)this.state.points[s][1]+=i;var r;mo(t.startPoint)||(this.state.points[0]=_toConsumableArray(t.startPoint),this.state.left=this.state.points[0][0],this.state.top=this.state.points[0][1]),mo(t.endPoint)||(r=this.state.points.length,this.state.points[r-1]=_toConsumableArray(t.endPoint)),mo(t.links)||(Ui(this.state.links,t.links),this.syncConnections()),_get(_getPrototypeOf(ICEPolyLine.prototype),"setState",this).call(this,t)}},{key:"getRotateAngle",value:function getRotateAngle(){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],uo.calcRotateAngle(t,e,0,0)+90):_get(_getPrototypeOf(ICEPolyLine.prototype),"getRotateAngle",this).call(this)}},{key:"containsPoint",value:function containsPoint(t,e){for(var n=this.getLines(),i=0;i<n.length;i++){var s=n[i],r=s.o[0],o=s.o[1],a=s.d[0],s=s.d[1],l=Math.hypot(a-r,s-o),r=Math.hypot(r-t,o-e),o=Math.hypot(a-t,s-e);if(l-3<=r+o&&r+o<=l+3)return!0}return!1}},{key:"getLines",value:function getLines(){var t=[],e=this.getTransformedDots();if(!e||e.length<2)return t;for(var n=0;n<e.length-1;n++){var i={o:[e[n][0],e[n][1]],d:[e[n+1][0],e[n+1][1]]};t.push(i)}return t}},{key:"destory",value:function destory(){this.removeLink("start"),this.removeLink("end"),_get(_getPrototypeOf(ICEPolyLine.prototype),"destory",this).call(this)}}],[{key:"arrangeParam",value:function arrangeParam(t){var e=Ui({},{lineType:"solid",lineWidth:1,arrow:"none",arrowLength:15,arrowAngel:toRadian(30),points:[],showMinBoundingBox:!1,showMaxBoundingBox:!1,links:{},style:{lineJoin:"round"}},t,{linkable:!1,closePath:!1,fill:!1}),n=e.points.length;return n<2&&(0===n?(e.points.push([0,0]),e.points.push([10,10])):1===n&&e.points.push([10,10])),(e=_objectSpread2(_objectSpread2({},e),{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&&(e.style.lineWidth=1),e}}]),ICEPolyLine}(),ya=function(){_inherits(ICEVisioLink,va);var e=_createSuper(ICEVisioLink);function ICEVisioLink(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEVisioLink),t=ICEVisioLink.arrangeParam(t),e.call(this,t)}return _createClass(ICEVisioLink,[{key:"calcDots",value:function calcDots(){var t=this.interpolate(),e=this.state,n=e.left,i=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-n,o.y-i])}return this.calcArrowPoints(),this.state.dots}},{key:"interpolate",value:function interpolate(){var t=this.state.points.length,e=this.state.points[0][0],n=this.state.points[0][1],i=this.state.points[t-1][0],t=this.state.points[t-1][1],s=new ha(e,n),r=new ha(i,t),o=[],a=null,l=null,h=[],c=new fo,u=new fo;if(f=this.ice&&this.state.links&&this.state.links.start&&this.state.links.start.id?this.ice.findComponent(this.state.links.start.id):f){c=f.getMinBoundingBox(),o[0]=new ha(s.x,c.tl[1]-this.state.escapeDistance),o[1]=new ha(c.tr[0]+this.state.escapeDistance,s.y),o[2]=new ha(s.x,c.br[1]+this.state.escapeDistance),o[3]=new ha(c.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])}if(y=this.ice&&this.state.links&&this.state.links.end&&this.state.links.end.id?this.ice.findComponent(this.state.links.end.id):y){u=y.getMinBoundingBox(),o[0]=new ha(r.x,u.tl[1]-this.state.escapeDistance),o[1]=new ha(u.tr[0]+this.state.escapeDistance,r.y),o[2]=new ha(r.x,u.br[1]+this.state.escapeDistance),o[3]=new ha(u.tl[0]-this.state.escapeDistance,r.y);for(var l=o[0],p=1;p<o.length;p++)this.distance(r,o[p])<this.distance(r,l)&&(l=o[p])}var e=0,n=[s],i=(a&&(n.push(a),e=1),l&&n.push(l),n.push(r),ha.cloneArray(n)),t=(h.push(["s0","s0",i]),ha.cloneArray(n)),f=ha.cloneArray(t),y=(f.splice(e+1,0,new ha(f[e].x,f[e+1].y)),h.push(["s1","s1_1",f]),ha.cloneArray(t)),i=(y.splice(e+1,0,new ha(y[e+1].x,y[e].y)),h.push(["s1","s1_2",y]),ha.cloneArray(t)),n=new ha((i[e].x+i[e+1].x)/2,i[e].y),f=new ha((i[e].x+i[e+1].x)/2,i[e+1].y),y=(i.splice(e+1,0,n,f),h.push(["s2","s2_1",i]),ha.cloneArray(t)),n=new ha(y[e].x,(y[e].y+y[e+1].y)/2),f=new ha(y[e+1].x,(y[e].y+y[e+1].y)/2),i=(y.splice(e+1,0,n,f),h.push(["s2","s2_2",y]),ha.cloneArray(t)),n=[i[e].x+20,i[e+1].x+20],f=(c&&n.push(c.br[0]+20),u&&n.push(u.br[0]+20),this.max(n)),y=new ha(f,i[e].y),n=new ha(f,i[e+1].y),f=(i.splice(e+1,0,y,n),h.push(["s2","s2_3",i]),ha.cloneArray(t)),y=[f[e].y-20,f[e+1].y-20],n=(c&&y.push(c.tl[1]-20),u&&y.push(u.tl[1]-20),this.min(y)),i=new ha(f[e].x,n),y=new ha(f[e+1].x,n),n=(f.splice(e+1,0,i,y),h.push(["s2","s2_4",f]),ha.cloneArray(t)),i=[n[e].x-20,n[e+1].x-20],y=(c&&i.push(c.tl[0]-20),u&&i.push(u.tl[0]-20),this.min(i)),f=new ha(y,n[e].y),i=new ha(y,n[e+1].y),y=(n.splice(e+1,0,f,i),h.push(["s2","s2_5",n]),ha.cloneArray(t)),f=[y[e].y+20,y[e+1].y+20],i=(c&&f.push(c.tl[1]+c.height+20),u&&f.push(u.tl[1]+u.height+20),this.max(f)),n=new ha(y[e].x,i),t=new ha(y[e+1].x,i);y.splice(e+1,0,n,t),h.push(["s2","s2_6",y]);for(var v=[],g=0;g<h.length;g++){var C=h[g][2];this.orthogonalPath(C)&&v.push(h[g])}if(h=v,!s.equals(r)){for(var m=[],b=0;b<h.length;b++){var k=h[b][2];this.forwardPath(k)&&m.push(h[b])}(h=m).length}for(var _=[],P=0;P<h.length;P++){var x=!1,E=h[P][2].slice();(u||c)&&(E=E.slice(1,E.length-1)),c&&(x=x||this.polylineIntersectsRectangle(E,c)),(x=u?x||this.polylineIntersectsRectangle(E,u):x)||_.push(h[P])}(h=0!=_.length?_:h).length;for(var w=h[0][2].length,S=[],I=0;I<h.length;I++)h[I][2].length==w&&S.push(h[I]);for(var h=S,O=0,M=0;M<h.length;M++)this.scorePath(h[O][2])<this.scorePath(h[M][2])&&(O=M);return[h[O]]}},{key:"orthogonalPath",value:function orthogonalPath(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 lineIntersectsLine(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),n=t.startPoint.y-s*t.startPoint.x,i=e.startPoint.x,t.contains(i,s=s*i+n)&&e.contains(i,s);var n=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),i=t.startPoint.y-n*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(n==s)return i==r&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y));r=(r-i)/(n-s),s=n*r+i;return t.contains(r,s)&&e.contains(r,s)}},{key:"polylineIntersectsRectangle",value:function polylineIntersectsRectangle(t,e){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=[];i.push(new la(new ha(e.x1,e.y1),new ha(e.x2,e.y1))),i.push(new la(new ha(e.x2,e.y1),new ha(e.x2,e.y2))),i.push(new la(new ha(e.x2,e.y2),new ha(e.x1,e.y2))),i.push(new la(new ha(e.x1,e.y2),new ha(e.x1,e.y1)));for(var s=0;s<t.length-1;s++)for(var r=new la(t[s],t[s+1]),o=0;o<i.length;o++)if(this.lineIntersectsLine(r,i[o]))return!0;if(n)for(var a=new la(t[t.length-1],t[0]),l=0;l<i.length;l++)if(this.lineIntersectsLine(a,i[l]))return!0;return!1}},{key:"scorePath",value:function scorePath(t){if(t.length<=2)return-1;for(var e=0,n=1;n<t.length-1;n++)if(t[n-1].x==t[n].x&&t[n].x==t[n+1].x){if(this.signum(t[n+1].y-t[n].y)!=this.signum(t[n].y-t[n-1].y))return-1;e++}else if(t[n-1].y==t[n].y&&t[n].y==t[n+1].y){if(this.signum(t[n+1].x-t[n].x)!=this.signum(t[n].x-t[n-1].x))return-1;e++}else e--;return e}},{key:"signum",value:function signum(t){return 0<t?1:t<0?-1:0}},{key:"forwardPath",value:function forwardPath(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 distance(t,e){return Math.hypot(e.x-t.x,e.y-t.y)}},{key:"max",value:function max(t){if(0==t.lenght)return NaN;for(var e=t[0],n=0;n<t.length;n++)e<t[n]&&(e=t[n]);return e}},{key:"min",value:function min(t){if(0==t.lenght)return NaN;for(var e=t[0],n=0;n<t.length;n++)e>t[n]&&(e=t[n]);return e}},{key:"addDot",value:function addDot(t,e){throw new Error("Can NOT add dot to ICEVisioLink mannually.")}},{key:"rmDot",value:function rmDot(t){throw new Error("Can NOT remove dot from ICEVisioLink mannually.")}}],[{key:"arrangeParam",value:function arrangeParam(t){return mo(t.startPoint)&&(t.startPoint=[0,0]),mo(t.endPoint)&&(t.endPoint=[10,10]),t.points=[_toConsumableArray(t.startPoint),_toConsumableArray(t.endPoint)],_objectSpread2({escapeDistance:30},t)}}]),ICEVisioLink}(),ga=function(){_inherits(ICEIsogon,ca);var e=_createSuper(ICEIsogon);function ICEIsogon(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEIsogon),_objectSpread2({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,e.call(this,t)}return _createClass(ICEIsogon,[{key:"calcDots",value:function calcDots(){this.state.dots=[];for(var t=2*Math.PI/this.state.edges,e=this.state.radius,n=0;n<this.state.edges;n++){var i=t*n-toRadian(this.state.startAngle),s=Math.floor(e*Math.cos(i)+e),i=Math.floor(e*Math.sin(i)+e);this.state.dots.push([s,i])}return this.state.dots}},{key:"calcComponentParams",value:function calcComponentParams(){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 setState(t){mo(t.radius)?mo(t.width)?mo(t.height)||(t.radius=t.height/2):t.radius=t.width/2:(t.width=2*t.radius,t.height=2*t.radius),_get(_getPrototypeOf(ICEIsogon.prototype),"setState",this).call(this,t)}}]),ICEIsogon}(),Ca=function(){_inherits(ICERose,ca);var e=_createSuper(ICERose);function ICERose(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICERose),_objectSpread2({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,e.call(this,t)}return _createClass(ICERose,[{key:"calcDots",value:function calcDots(){var t=this.state.radius,e=this.state.leafNum;this.state.dots=[];for(var n,i,s=Math.PI/this.state.pointNumber,r=0;n=t+t*Math.sin(e*r)*Math.cos(r),i=t+t*Math.sin(e*r)*Math.sin(r),this.state.dots.push([n,i]),!((r+=s)>=2*Math.PI););return this.state.dots}},{key:"calcComponentParams",value:function calcComponentParams(){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 setState(t){mo(t.radius)?mo(t.width)?mo(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),_get(_getPrototypeOf(ICERose.prototype),"setState",this).call(this,t)}}]),ICERose}(),ma=function(){_inherits(ICEStar,ca);var e=_createSuper(ICEStar);function ICEStar(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEStar),_objectSpread2({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,e.call(this,t)}return _createClass(ICEStar,[{key:"calcDots",value:function calcDots(){this.state.dots=[];for(var t,e,n=toRadian(this.state.startAngle),i=Math.PI/this.state.spikes,s=this.state.outerRadius,r=this.state.innerRadius,o=0;o<this.state.spikes;o++)t=Math.cos(n)*s+s,e=Math.sin(n)*s+s,this.state.dots.push([t,e]),n+=i,t=Math.cos(n)*r+s,e=Math.sin(n)*r+s,this.state.dots.push([t,e]),n+=i;return this.state.dots}},{key:"calcComponentParams",value:function calcComponentParams(){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 setState(t){mo(t.outerRadius)?mo(t.width)?mo(t.height)||(t.outerRadius=t.height/2):t.outerRadius=t.width/2:(t.width=2*t.outerRadius,t.height=2*t.outerRadius),_get(_getPrototypeOf(ICEStar.prototype),"setState",this).call(this,t)}}]),ICEStar}(),ba="__ICE_UTILS_TEXT_MEASURE_DIV__",ka=function(){_inherits(ICEText,po);var e=_createSuper(ICEText);function ICEText(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEText),ICEText.arrangeParam(t));return(t=e.call(this,t)).measureText(),t}return _createClass(ICEText,[{key:"calcComponentParams",value:function calcComponentParams(){return this.dirty?this.measureText():{width:this.state.width,height:this.state.height}}},{key:"measureText",value:function measureText(t){var e;try{if(!(e=this.root.document.getElementById(ba))){(e=this.root.document.createElement("div")).setAttribute("id",ba);var n,i={visibility:"hidden",position:"absolute",top:"0",left:"0",padding:"0",margin:"0",border:"none",fontFamily:this.state.style.fontFamily,fontWeight:this.state.style.fontWeight,fontSize:this.state.style.fontSize+"px"};for(n in i)e.style[n]=i[n];e.contenteditable=!1,this.root.document.body.appendChild(e)}e.innerHTML=this.state.text;var s=this.state.style,r=s.paddingTop,o=s.paddingBottom,a=s.paddingLeft,l=s.paddingRight,h={width:e.offsetWidth+a+l,height:e.offsetHeight+r+o};return this.props.width=h.width,this.props.height=h.height,this.state.width=h.width,this.state.height=h.height,{width:this.state.width,height:this.state.height}}catch(t){}}},{key:"doRender",value:function doRender(){this.dirty&&this.measureText();var t=this.state.style,e=(t.paddingTop,t.paddingBottom),n=t.paddingLeft;t.paddingRight,this.state.stroke&&this.ctx.strokeText(this.state.text,0-this.state.localOrigin[0]+n,0-this.state.localOrigin[1]+this.state.height-e,this.state.width),this.state.fill&&this.ctx.fillText(this.state.text,0-this.state.localOrigin[0]+n,0-this.state.localOrigin[1]+this.state.height-e,this.state.width),_get(_getPrototypeOf(ICEText.prototype),"doRender",this).call(this)}}],[{key:"arrangeParam",value:function arrangeParam(t){t=Ui({text:"",left:0,top:0,width:10,height:10,style:{fontWeight:"bold",fontSize:32,fontFamily:"Arial",lineWidth:1,textBaseline:"bottom",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}},t);return t.style=_objectSpread2(_objectSpread2({},t.style),{},{font:"".concat(t.style.fontWeight," ").concat(t.style.fontSize,"px ").concat(t.style.fontFamily)}),t}}]),ICEText}(),_a={ICERect:yo,ICECircle:ko,ICEEllipse:bo,ICEStar:ma,ICEIsogon:ga,ICEText:ka,ICEImage:da,ICEGroup:go,ICEVisioLink:ya,ICEPolyLine:va},Pa={evtBuses:[],stopped:!1,frameCallback:function frameCallback(){for(var t=0;t<Pa.evtBuses.length;t++){if(Pa.stopped)return;Pa.evtBuses[t].trigger(x)}Pa.stopped||Zs.requestFrame(Pa.frameCallback)},start:function start(){Pa.stopped=!1,Zs.requestFrame(Pa.frameCallback)},stop:function stop(){Pa.stopped=!0},pause:function pause(){},resume:function resume(){},regitserEvtBus:function regitserEvtBus(t){Pa.evtBuses.includes(t)||Pa.evtBuses.push(t)},delEvtBus:function delEvtBus(t){Pa.evtBuses.includes(t)&&Pa.evtBuses.splice(Pa.evtBuses.indexOf(t),1)}},xa=function(){function ICELinkSlotManager(t){_classCallCheck(this,ICELinkSlotManager),_defineProperty$1(this,"slotRadius",10),this.ice=t}return _createClass(ICELinkSlotManager,[{key:"start",value:function start(){return this.createLinkSlots(),this.ice.evtBus.on(j,this.hookMouseMoveHandler,this),this.ice.evtBus.on(B,this.hookMouseUpHandler,this),this.ice.evtBus.on("mouseup",this.globalMouseUpHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off(j,this.hookMouseMoveHandler,this),this.ice.evtBus.off(B,this.hookMouseUpHandler,this),this.ice.evtBus.off("mouseup",this.globalMouseUpHandler,this),this}},{key:"hookMouseMoveHandler",value:function hookMouseMoveHandler(t){for(var e=t.target,n=e.getMaxBoundingBox(),i=null,s=_toConsumableArray(this.ice.childNodes),r=0;r<s.length;r++){var o=s[r];if(o&&o.state.linkable&&o.getMaxBoundingBox().isIntersect(n)){i=o;break}}if(i){for(var a=!1,l=0;l<this.ice._linkSlots.length;l++){var h=this.ice._linkSlots[l];h.hostComponent!==i&&(h.hostComponent=i),h.setState({display:!0,style:{fillStyle:"#3ce92c"}}),e.setState({style:{fillStyle:"#3ce92c"}}),h.getMaxBoundingBox().isIntersect(n)&&(a=!0,h.setState({style:{fillStyle:"#fffb00"}}))}a&&e.setState({style:{fillStyle:"#fffb00"}})}else{for(var c=0;c<this.ice._linkSlots.length;c++)this.ice._linkSlots[c].setState({display:!1,style:{fillStyle:"#3ce92c"}});e.setState({style:{fillStyle:"#3ce92c"}})}}},{key:"hookMouseUpHandler",value:function hookMouseUpHandler(t){for(var t=t.target,e=t.state.position,n=t.parentNode.targetComponent,i=t.getMaxBoundingBox(),s=!1,r=0;r<this.ice._linkSlots.length;r++){var o,a=this.ice._linkSlots[r];a.getMaxBoundingBox().isIntersect(i)&&(s=!0,(o={})[e]={id:a.hostComponent.state.id,position:a.state.position},n&&n.setState({links:o})),a.setState({display:!1,style:{fillStyle:"#3ce92c"}})}s?t.setState({display:!1,style:{fillStyle:"#3ce92c"}}):((t={})[e]=null,n&&n.setState({links:t}))}},{key:"globalMouseUpHandler",value:function globalMouseUpHandler(t){for(var e=0;e<this.ice._linkSlots.length;e++)this.ice._linkSlots[e].setState({display:!1,style:{fillStyle:"#3ce92c"}})}},{key:"createLinkSlots",value:function createLinkSlots(){var t,e,n,i;this.ice._linkSlots&&this.ice._linkSlots.length||(t=new pa({zIndex:10000010,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"T",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(t),e=new pa({zIndex:10000011,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"R",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(e),n=new pa({zIndex:10000012,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"B",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(n),i=new pa({zIndex:10000013,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"L",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(i),this.ice._linkSlots=[t,e,n,i])}}]),ICELinkSlotManager}(),Ea=function(){function Deserializer(t){_classCallCheck(this,Deserializer),this.ice=t}return _createClass(Deserializer,[{key:"fromJSONObject",value:function fromJSONObject(t){for(var e=t.childNodes,n=0;n<e.length;n++)this.decodeRecursively(this.ice,e[n])}},{key:"fromJSONString",value:function fromJSONString(t){t=JSON.parse(t);this.fromJSONObject(t)}},{key:"decodeRecursively",value:function decodeRecursively(t,e){var n=new(this.ice.getType(e.type))(e.state),i=(t.addChild(n),e.childNodes);if(i&&i.length)for(var s=0;s<i.length;s++)this.decodeRecursively(n,i[s])}}]),Deserializer}(),wa=function(){function Serializer(t){_classCallCheck(this,Serializer),this.ice=t}return _createClass(Serializer,[{key:"toJSONString",value:function toJSONString(){return JSON.stringify(this.toJSONObject())}},{key:"toJSONObject",value:function toJSONObject(){for(var t={createTime:(new Date).toLocaleString(),lastModifyTime:(new Date).toLocaleString(),childNodes:[]},e=0;e<this.ice.childNodes.length;e++){var n=this.ice.childNodes[e];this.encodeRecursively(n,t)}return t}},{key:"encodeRecursively",value:function encodeRecursively(t,e){var n={state:t.state,type:t.constructor.name,childNodes:[]};if(e.childNodes.push(n),t.childNodes&&t.childNodes.length)for(var i=0;i<t.childNodes.length;i++)this.encodeRecursively(t.childNodes[i],n)}}]),Serializer}(),Sa=function(){_inherits(CanvasRenderer,co);var n=_createSuper(CanvasRenderer);function CanvasRenderer(t){var e;return _classCallCheck(this,CanvasRenderer),_defineProperty$1(_assertThisInitialized(e=n.call(this)),"stopped",!1),_defineProperty$1(_assertThisInitialized(e),"componentQueue",[]),_defineProperty$1(_assertThisInitialized(e),"toolsQueue",[]),e.ice=t,e}return _createClass(CanvasRenderer,[{key:"start",value:function start(){return this.stopped=!1,this.ice.evtBus.on(x,this.frameEvtHandler,this),this}},{key:"stop",value:function stop(){return this.stopped=!0,this.ice.evtBus.off(x,this.frameEvtHandler,this),this}},{key:"frameEvtHandler",value:function frameEvtHandler(t){this.ice.dirty&&this.doRender()}},{key:"refreshQueue",value:function refreshQueue(){this.componentQueue=flattenTree([],this.ice.childNodes),this.componentQueue.sort(function(t,e){return t.state.zIndex-e.state.zIndex}),this.toolsQueue=flattenTree([],this.ice.toolNodes),this.toolsQueue.sort(function(t,e){return t.state.zIndex-e.state.zIndex})}},{key:"doRender",value:function doRender(){this.refreshQueue(),this.ice.ctx.clearRect(0,0,this.ice.canvasWidth,this.ice.canvasHeight);for(var t=0;t<this.componentQueue.length;t++){var e=this.componentQueue[t];e.root=this.ice.root,e.ctx=this.ice.ctx,e.evtBus=this.ice.evtBus,e.ice=this.ice,e.render()}for(var n=0;n<this.toolsQueue.length;n++){var i=this.toolsQueue[n];i.root=this.ice.root,i.ctx=this.ice.ctx,i.evtBus=this.ice.evtBus,i.ice=this.ice,i.render()}this.ice.dirty=!1,this.ice.evtBus.trigger(M)}}]),CanvasRenderer}(),Ia=function(){function ImageCache(t){_classCallCheck(this,ImageCache),_defineProperty$1(this,"imageCache",new Map),this.ice=t}return _createClass(ImageCache,[{key:"setImage",value:function setImage(t){var e=this,n=this.imageCache.get(t);return n||((n=new Image).onload=function(){e.ice.dirty=!0},n.onerror=function(){},n.src=t,this.imageCache.size>ImageCache.CACHE_SIZE&&this.imageCache.delete(this.imageCache.keys().next().value),this.imageCache.set(t,n)),{loaded:this.loaded(n),image:n}}},{key:"loaded",value:function loaded(t){return t.complete&&0<t.naturalWidth}}]),ImageCache}(),Oa=(_defineProperty$1(Ia,"CACHE_SIZE",100),function(){function ICE(){_classCallCheck(this,ICE),_defineProperty$1(this,"childNodes",[]),_defineProperty$1(this,"toolNodes",[]),_defineProperty$1(this,"canvasWidth",0),_defineProperty$1(this,"canvasHeight",0),_defineProperty$1(this,"selectionList",[]),_defineProperty$1(this,"typeMapping",{}),_defineProperty$1(this,"__dirty",!0),_defineProperty$1(this,"_lastUpdateTime",Date.now())}return _createClass(ICE,[{key:"init",value:function init(t){if(!t)throw new Error("ICE.init() failed...");if(this.ctx===t)throw new Error("同一个 canvas 实例只能 init 一次...");for(var e in _a)this.typeMapping[e]=_a[e];return this.root=Zs,_(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 aa,Pa.regitserEvtBus(this.evtBus),Pa.start(),oa.regitserEvtBus(this.evtBus),oa.start(),this.eventDispatcher=new sa(this).start(),this.animationManager=new H(this).start(),this.controlPanelManager=new na(this).start(),this.renderer=new Sa(this).start(),this.linkSlotManager=new xa(this).start(),this.serializer=new wa(this),this.deserializer=new Ea(this),this.imageCache=new Ia(this),this}},{key:"addTool",value:function addTool(t){-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(S,null,{component:t}),t.trigger(S),t.ice=this,t.ctx=this.ctx,t.evtBus=this.evtBus,this.toolNodes.push(t),this.dirty=!0,this.evtBus.trigger(I,null,{component:t}),t.trigger(I))}},{key:"removeTool",value:function removeTool(t){this.evtBus.trigger(O,null,{component:t}),t.destory(),this.toolNodes.splice(this.toolNodes.indexOf(t),1),this.dirty=!0}},{key:"addChild",value:function addChild(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(S,null,{component:t}),t.trigger(S),t.ice=this,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(I,null,{component:t}),t.trigger(I))}},{key:"addChildren",value:function addChildren(t){for(var e=0;e<t.length;e++)this.addChild(t[e],!1);this.dirty=!0}},{key:"removeChild",value:function removeChild(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];this.evtBus.trigger(O,null,{component:t}),t.destory(),this.childNodes.splice(this.childNodes.indexOf(t),1),this.dirty=e}},{key:"removeChildren",value:function removeChildren(t){for(var e=0;e<t.length;e++)this.removeChild(t[e],!1);this.dirty=!0}},{key:"clearAll",value:function clearAll(){this.removeChildren(_toConsumableArray(this.childNodes))}},{key:"findComponent",value:function findComponent(e){return this.childNodes.filter(function(t){return t.props.id===e})[0]}},{key:"dirty",get:function get(){return this.__dirty},set:function set(t){this.__dirty=t}},{key:"registerType",value:function registerType(t,e){this.typeMapping[t]=e}},{key:"getType",value:function getType(t){return this.typeMapping[t]}},{key:"toJSONString",value:function toJSONString(){return this.serializer.toJSONString()}},{key:"toJSONObject",value:function toJSONObject(){return this.serializer.toJSONObject()}},{key:"fromJSONObject",value:function fromJSONObject(t){var e=this;Pa.stop(),this.renderer.stop(),this.eventDispatcher.stopped=!0,this.animationManager.stop(),this.controlPanelManager.stop(),this.linkSlotManager.stop(),this.clearAll(),this.deserializer.fromJSONObject(t),Pa.start(),this.renderer.start(),this.animationManager.start(),this.controlPanelManager.start(),this.linkSlotManager.start(),setTimeout(function(){e.eventDispatcher.stopped=!1},300)}},{key:"fromJSONString",value:function fromJSONString(t){t=JSON.parse(t);this.fromJSONObject(t)}}]),ICE}());exports.AnimationManager=H,exports.CanvasRenderer=Sa,exports.DOMEventDispatcher=sa,exports.DOMEventInterceptor=oa,exports.EventBus=aa,exports.GeoLine=la,exports.GeoPoint=ha,exports.GeoUtil=uo,exports.ICE=Oa,exports.ICEBezier=fa,exports.ICEBoundingBox=fo,exports.ICECircle=ko,exports.ICEComponent=po,exports.ICEControlPanel=Co,exports.ICEControlPanelManager=na,exports.ICEDotPath=ca,exports.ICEEllipse=bo,exports.ICEEventTarget=co,exports.ICEGroup=go,exports.ICEImage=da,exports.ICEIsogon=ga,exports.ICELinkHook=_o,exports.ICELinkSlot=pa,exports.ICEPath=vo,exports.ICEPolyLine=va,exports.ICERect=yo,exports.ICERose=Ca,exports.ICEStar=ma,exports.ICEText=ka,exports.ICEVisioLink=ya,exports.LineControlPanel=Po,exports.ResizeControl=Yo,exports.RotateControl=ta,exports.TransformControlPanel=ea;
25
+ "use strict";function ownKeys(e,t){var n,i=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)),i}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(n),!0).forEach(function(t){_defineProperty$1(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _defineProperties(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function _createClass(t,e,n){return e&&_defineProperties(t.prototype,e),n&&_defineProperties(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function _defineProperty$1(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _inherits(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&&_setPrototypeOf(t,e)}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(t,e){return t.__proto__=e,t})(t,e)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _possibleConstructorReturn(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 _assertThisInitialized(t)}function _createSuper(n){var i=function _isNativeReflectConstruct(){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 _createSuperInternal(){var t,e=_getPrototypeOf(n);return _possibleConstructorReturn(this,i?(t=_getPrototypeOf(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function _superPropBase(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf(t)););return t}function _get(){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,e,n){var i=_superPropBase(t,e);if(i)return(i=Object.getOwnPropertyDescriptor(i,e)).get?i.get.call(arguments.length<3?t:n):i.value}).apply(this,arguments)}function _toConsumableArray(t){return function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}(t)||function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(n="Object"===n&&t.constructor?t.constructor.name:n)||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(t,e):void 0}}(t)||function _nonIterableSpread(){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 _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}Object.defineProperty(exports,"__esModule",{value:!0});var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},e="object"==typeof t&&t&&t.Object===Object&&t,n=e,i="object"==typeof self&&self&&self.Object===Object&&self,r=n||i||Function("return this")(),s=r.Symbol,o=s,a=Object.prototype,l=a.hasOwnProperty,h=a.toString,c=o?o.toStringTag:void 0,u=function getRawTag$1(t){var e=l.call(t,c),n=t[c];try{var i=!(t[c]=void 0)}catch(t){}var s=h.call(t);return i&&(e?t[c]=n:delete t[c]),s},d=Object.prototype.toString,f=u,p=function objectToString$1(t){return d.call(t)},v=s?s.toStringTag:void 0,y=function baseGetTag$7(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(v&&v in Object(t)?f:p)(t)},g=Array.isArray,C=function isObjectLike$9(t){return null!=t&&"object"==typeof t},m=y,b=g,k=C,_=function isString(t){return"string"==typeof t||!b(t)&&k(t)&&"[object String]"==m(t)},P=function isUndefined(t){return void 0===t},x="ICE_FRAME_EVENT",E="BEFORE_RENDER",w="AFTER_RENDER",S="BEFORE_ADD",I="AFTER_ADD",O="BEFORE_REMOVE",M="ROUND_FINISH",A="HOOK_MOUSEDOWN",j="HOOK_MOUSEMOVE",B="HOOK_MOUSEUP",L="BEFORE_RESIZE",T="AFTER_RESIZE",R="BEFORE_ROTATE",D="AFTER_ROTATE",N="BEFORE_MOVE",z="AFTER_MOVE",$={linear:function linear(t,e,n,i){return t+(e-t)/n*(Date.now()-i)},easeInQuad:function easeInQuad(t,e,n,i){i=Date.now()-i;return t+(e-t)/n*(i/n)*i},easeOutQuad:function easeOutQuad(t,e,n,i){i=Date.now()-i;return-(e-t)*(i/=n)*(i-2)+t},easeInOutQuad:function easeInOutQuad(t,e,n,i){i=Date.now()-i,e-=t;return(i/=n/2)<1?e/2*i*i+t:-e/2*(--i*(i-2)-1)+t},easeInQuart:function easeInQuart(t,e,n,i){i=Date.now()-i;return(e-t)*(i/=n)*i*i*i+t},easeOutQuart:function easeOutQuart(t,e,n,i){return-(e-t)*((e=(Date.now()-i)/n-1)*e*e*e-1)+t},easeInOutQuart:function easeInOutQuart(t,e,n,i){i=Date.now()-i,e-=t;return(i/=n/2)<1?e/2*i*i*i*i+t:-e/2*((i-=2)*i*i*i-2)+t},easeInCubic:function easeInCubic(t,e,n,i){i=Date.now()-i;return(e-t)*(i/=n)*i*i+t},easeOutCubic:function easeOutCubic(t,e,n,i){return(e-t)*((e=(Date.now()-i)/n-1)*e*e+1)+t},easeInOutCubic:function easeInOutCubic(t,e,n,i){i=Date.now()-i,e-=t;return(i/=n/2)<1?e/2*i*i*i+t:e/2*((i-=2)*i*i+2)+t}},H=function(){function AnimationManager(t){_classCallCheck(this,AnimationManager),_defineProperty$1(this,"animationMap",new Map),this.ice=t}return _createClass(AnimationManager,[{key:"start",value:function start(){return this.ice.evtBus.on(x,this.frameEventHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off(x,this.frameEventHandler,this),this}},{key:"frameEventHandler",value:function frameEventHandler(t){for(var e=_toConsumableArray(this.animationMap.values()),n=0;n<e.length;n++){var i=e[n];i.state.interactive=!1,this.tween(i),i.state.interactive=!0}}},{key:"tween",value:function tween(t){var e,n={},i=t.props.animations,s=1;for(e in i){var r=i[e];if(r.finished){if(++s===Object.keys(i).length){this.remove(t);break}}else{var o=r.from,a=r.to,l=r.duration,o=(P(r.startTime)&&(r.startTime=Date.now()),P(r.easing)&&(r.easing="linear"),$[r.easing](o,a,l,r.startTime));a<o&&(o=a,r.finished=!0),n[e]=Math.floor(o)}}return t.setState(_objectSpread2({},n)),t}},{key:"add",value:function add(t){this.animationMap.set(t.props.id,t)}},{key:"remove",value:function remove(t){_(t)?this.animationMap.delete(t):this.animationMap.delete(t.props.id)}}]),AnimationManager}(),V=function listCacheClear$1(){this.__data__=[],this.size=0},q=function eq$4(t,e){return t===e||t!=t&&e!=e},U=q,J=function assocIndexOf$4(t,e){for(var n=t.length;n--;)if(U(t[n][0],e))return n;return-1},X=J,G=Array.prototype.splice,F=J,K=J,W=J,Q=V,Z=function listCacheDelete$1(t){var e=this.__data__,t=X(e,t);return!(t<0||(t==e.length-1?e.pop():G.call(e,t,1),--this.size,0))},Y=function listCacheGet$1(t){var e=this.__data__,t=F(e,t);return t<0?void 0:e[t][1]},tt=function listCacheHas$1(t){return-1<K(this.__data__,t)},et=function listCacheSet$1(t,e){var n=this.__data__,i=W(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this};function ListCache$4(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}ListCache$4.prototype.clear=Q,ListCache$4.prototype.delete=Z,ListCache$4.prototype.get=Y,ListCache$4.prototype.has=tt,ListCache$4.prototype.set=et;var ut,nt=ListCache$4,it=nt,rt=function stackClear$1(){this.__data__=new it,this.size=0},st=function stackDelete$1(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t},ot=function stackGet$1(t){return this.__data__.get(t)},at=function stackHas$1(t){return this.__data__.has(t)},lt=function isObject$9(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},ht=y,ct=lt,dt=function isFunction$3(t){if(!ct(t))return!1;t=ht(t);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t},ft=r["__core-js_shared__"],pt=(ut=/[^.]+$/.exec(ft&&ft.keys&&ft.keys.IE_PROTO||""))?"Symbol(src)_1."+ut:"",vt=function isMasked$1(t){return!!pt&&pt in t},yt=Function.prototype.toString,gt=function toSource$2(t){if(null!=t){try{return yt.call(t)}catch(t){}try{return t+""}catch(t){}}return""},Ct=dt,mt=vt,bt=lt,kt=gt,_t=/^\[object .+?Constructor\]$/,Pt=Function.prototype,xt=Object.prototype,Et=Pt.toString,wt=xt.hasOwnProperty,St=RegExp("^"+Et.call(wt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),It=function baseIsNative$1(t){return!(!bt(t)||mt(t))&&(Ct(t)?St:_t).test(kt(t))},Ot=function getValue$1(t,e){return null==t?void 0:t[e]},Mt=function getNative$7(t,e){t=Ot(t,e);return It(t)?t:void 0},At=Mt(r,"Map"),jt=Mt(Object,"create"),Bt=jt,Lt=function hashClear$1(){this.__data__=Bt?Bt(null):{},this.size=0},Tt=function hashDelete$1(t){t=this.has(t)&&delete this.__data__[t];return this.size-=t?1:0,t},Rt=jt,Dt=Object.prototype.hasOwnProperty,Nt=function hashGet$1(t){var e,n=this.__data__;return Rt?"__lodash_hash_undefined__"===(e=n[t])?void 0:e:Dt.call(n,t)?n[t]:void 0},zt=jt,$t=Object.prototype.hasOwnProperty,Ht=jt,Vt=Lt,qt=Tt,Ut=Nt,Jt=function hashHas$1(t){var e=this.__data__;return zt?void 0!==e[t]:$t.call(e,t)},Xt=function hashSet$1(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ht&&void 0===e?"__lodash_hash_undefined__":e,this};function Hash$1(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}Hash$1.prototype.clear=Vt,Hash$1.prototype.delete=qt,Hash$1.prototype.get=Ut,Hash$1.prototype.has=Jt,Hash$1.prototype.set=Xt;var Gt=Hash$1,Ft=nt,Kt=At,Wt=function isKeyable$1(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t},Qt=function getMapData$4(t,e){t=t.__data__;return Wt(e)?t["string"==typeof e?"string":"hash"]:t.map},Zt=Qt,Yt=Qt,te=Qt,ee=Qt,ne=function mapCacheClear$1(){this.size=0,this.__data__={hash:new Gt,map:new(Kt||Ft),string:new Gt}},ie=function mapCacheDelete$1(t){t=Zt(this,t).delete(t);return this.size-=t?1:0,t},re=function mapCacheGet$1(t){return Yt(this,t).get(t)},se=function mapCacheHas$1(t){return te(this,t).has(t)},oe=function mapCacheSet$1(t,e){var n=ee(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this};function MapCache$1(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}MapCache$1.prototype.clear=ne,MapCache$1.prototype.delete=ie,MapCache$1.prototype.get=re,MapCache$1.prototype.has=se,MapCache$1.prototype.set=oe;var ae=nt,le=At,he=MapCache$1,ce=nt,ue=rt,de=st,fe=ot,pe=at,ve=function stackSet$1(t,e){var n=this.__data__;if(n instanceof ae){var i=n.__data__;if(!le||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new he(i)}return n.set(t,e),this.size=n.size,this};function Stack$2(t){t=this.__data__=new ce(t);this.size=t.size}Stack$2.prototype.clear=ue,Stack$2.prototype.delete=de,Stack$2.prototype.get=fe,Stack$2.prototype.has=pe,Stack$2.prototype.set=ve;var ye=Stack$2,ge=Mt,Ce=function(){try{var t=ge(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),me=Ce,be=function baseAssignValue$3(t,e,n){"__proto__"==e&&me?me(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n},ke=be,_e=q,Pe=function assignMergeValue$2(t,e,n){(void 0===n||_e(t[e],n))&&(void 0!==n||e in t)||ke(t,e,n)},xe=function createBaseFor$1(l){return function(t,e,n){for(var i=-1,s=Object(t),r=n(t),o=r.length;o--;){var a=r[l?o:++i];if(!1===e(s[a],a,s))break}return t}}(),Ee={exports:{}},we=(!function(t,e){var e=e&&!e.nodeType&&e,n=e&&t&&!t.nodeType&&t,n=n&&n.exports===e?r.Buffer:void 0,i=n?n.allocUnsafe:void 0;t.exports=function cloneBuffer(t,e){if(e)return t.slice();e=t.length,e=i?i(e):new t.constructor(e);return t.copy(e),e}}(Ee,Ee.exports),r.Uint8Array),Se=function cloneArrayBuffer$3(t){var e=new t.constructor(t.byteLength);return new we(e).set(new we(t)),e},Ie=Se,Oe=function cloneTypedArray$2(t,e){e=e?Ie(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.length)},Me=function copyArray$2(t,e){var n=-1,i=t.length;for(e=e||Array(i);++n<i;)e[n]=t[n];return e},Ae=lt,je=Object.create,Be=function(){function object(){}return function(t){if(!Ae(t))return{};if(je)return je(t);object.prototype=t;t=new object;return object.prototype=void 0,t}}(),Le=function overArg$2(e,n){return function(t){return e(n(t))}},Te=Le(Object.getPrototypeOf,Object),Re=Object.prototype,De=function isPrototype$4(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Re)},Ne=Be,ze=Te,$e=De,He=function initCloneObject$2(t){return"function"!=typeof t.constructor||$e(t)?{}:Ne(ze(t))},Ve=y,qe=C,Ue=function baseIsArguments$1(t){return qe(t)&&"[object Arguments]"==Ve(t)},Je=C,Xe=Object.prototype,Ge=Xe.hasOwnProperty,Fe=Xe.propertyIsEnumerable,Ke=Ue(function(){return arguments}())?Ue:function(t){return Je(t)&&Ge.call(t,"callee")&&!Fe.call(t,"callee")},We=function isLength$2(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991},Qe=dt,Ze=We,Ye=function isArrayLike$5(t){return null!=t&&Ze(t.length)&&!Qe(t)},tn=Ye,en=C,nn=function isArrayLikeObject$1(t){return en(t)&&tn(t)},rn={exports:{}},sn=function stubFalse(){return!1},an=(!function(t,e){var e=e&&!e.nodeType&&e,n=e&&t&&!t.nodeType&&t,n=n&&n.exports===e?r.Buffer:void 0,e=(n?n.isBuffer:void 0)||sn;t.exports=e}(rn,rn.exports),y),ln=Te,hn=C,cn=Function.prototype,un=Object.prototype,dn=cn.toString,fn=un.hasOwnProperty,pn=dn.call(Object),vn=function isPlainObject$1(t){if(!hn(t)||"[object Object]"!=an(t))return!1;t=ln(t);if(null===t)return!0;t=fn.call(t,"constructor")&&t.constructor;return"function"==typeof t&&t instanceof t&&dn.call(t)==pn},yn=y,gn=We,Cn=C,mn={},bn=(mn["[object Float32Array]"]=mn["[object Float64Array]"]=mn["[object Int8Array]"]=mn["[object Int16Array]"]=mn["[object Int32Array]"]=mn["[object Uint8Array]"]=mn["[object Uint8ClampedArray]"]=mn["[object Uint16Array]"]=mn["[object Uint32Array]"]=!0,mn["[object Arguments]"]=mn["[object Array]"]=mn["[object ArrayBuffer]"]=mn["[object Boolean]"]=mn["[object DataView]"]=mn["[object Date]"]=mn["[object Error]"]=mn["[object Function]"]=mn["[object Map]"]=mn["[object Number]"]=mn["[object Object]"]=mn["[object RegExp]"]=mn["[object Set]"]=mn["[object String]"]=mn["[object WeakMap]"]=!1,function baseIsTypedArray$1(t){return Cn(t)&&gn(t.length)&&!!mn[yn(t)]}),kn=function baseUnary$3(e){return function(t){return e(t)}},_n={exports:{}},Pn=(!function(t,n){var n=n&&!n.nodeType&&n,i=n&&t&&!t.nodeType&&t,s=i&&i.exports===n&&e.process,n=function(){try{return i&&i.require&&i.require("util").types||s&&s.binding&&s.binding("util")}catch(t){}}();t.exports=n}(_n,_n.exports),bn),xn=kn,En=_n.exports,wn=En&&En.isTypedArray,Sn=wn?xn(wn):Pn,In=function safeGet$2(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]},On=be,Mn=q,An=Object.prototype.hasOwnProperty,jn=function assignValue$2(t,e,n){var i=t[e];An.call(t,e)&&Mn(i,n)&&(void 0!==n||e in t)||On(t,e,n)},Bn=jn,Ln=be,Tn=function copyObject$5(t,e,n,i){var s=!n;n=n||{};for(var r=-1,o=e.length;++r<o;){var a=e[r],l=i?i(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),(s?Ln:Bn)(n,a,l)}return n},Rn=/^(?:0|[1-9]\d*)$/,Dn=function isIndex$2(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Rn.test(t))&&-1<t&&t%1==0&&t<e},Nn=function baseTimes$1(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i},zn=Ke,$n=g,Hn=rn.exports,Vn=Dn,qn=Sn,Un=Object.prototype.hasOwnProperty,Jn=function arrayLikeKeys$2(t,e){var n,i=$n(t),s=!i&&zn(t),r=!i&&!s&&Hn(t),o=!i&&!s&&!r&&qn(t),a=i||s||r||o,l=a?Nn(t.length,String):[],h=l.length;for(n in t)!e&&!Un.call(t,n)||a&&("length"==n||r&&("offset"==n||"parent"==n)||o&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||Vn(n,h))||l.push(n);return l},Xn=lt,Gn=De,Fn=function nativeKeysIn$1(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},Kn=Object.prototype.hasOwnProperty,Wn=Jn,Qn=function baseKeysIn$1(t){if(!Xn(t))return Fn(t);var e,n=Gn(t),i=[];for(e in t)("constructor"!=e||!n&&Kn.call(t,e))&&i.push(e);return i},Zn=Ye,Yn=function keysIn$5(t){return Zn(t)?Wn(t,!0):Qn(t)},ti=Tn,ei=Yn,ni=Pe,ii=Ee.exports,ri=Oe,si=Me,oi=He,ai=Ke,li=g,hi=nn,ci=rn.exports,ui=dt,di=lt,fi=vn,pi=Sn,vi=In,yi=function toPlainObject$1(t){return ti(t,ei(t))},gi=ye,Ci=Pe,mi=xe,bi=function baseMergeDeep$1(t,e,n,i,s,r,o){var a,l,h,c=vi(t,n),u=vi(e,n),d=o.get(u);d?ni(t,n,d):((e=void 0===(d=r?r(c,u,n+"",t,e,o):void 0))&&(l=!(a=li(u))&&ci(u),h=!a&&!l&&pi(u),d=u,a||l||h?d=li(c)?c:hi(c)?si(c):l?ii(u,!(e=!1)):h?ri(u,!(e=!1)):[]:fi(u)||ai(u)?ai(d=c)?d=yi(c):di(c)&&!ui(c)||(d=oi(u)):e=!1),e&&(o.set(u,d),s(d,u,i,r,o),o.delete(u)),ni(t,n,d))},ki=lt,_i=Yn,Pi=In,xi=function baseMerge$1(i,s,r,o,a){i!==s&&mi(s,function(t,e){var n;a=a||new gi,ki(t)?bi(i,s,e,r,baseMerge$1,o,a):(n=o?o(Pi(i,e),t,e+"",i,s,a):void 0,Ci(i,e,n=void 0===n?t:n))},_i)},Ei=function identity$2(t){return t},wi=function apply$1(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)},Si=Math.max,Ii=function overRest$1(r,o,a){return o=Si(void 0===o?r.length-1:o,0),function(){for(var t=arguments,e=-1,n=Si(t.length-o,0),i=Array(n);++e<n;)i[e]=t[o+e];for(var e=-1,s=Array(o+1);++e<o;)s[e]=t[e];return s[o]=a(i),wi(r,this,s)}},Oi=function constant$1(t){return function(){return t}},Mi=Ce,Ai=Mi?function(t,e){return Mi(t,"toString",{configurable:!0,enumerable:!1,value:Oi(e),writable:!0})}:Ei,ji=Date.now,Bi=function shortOut$1(n){var i=0,s=0;return function(){var t=ji(),e=16-(t-s);if(s=t,0<e){if(800<=++i)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(Ai),Li=Ei,Ti=Ii,Ri=Bi,Di=q,Ni=Ye,zi=Dn,$i=lt,Hi=function baseRest$1(t,e){return Ri(Ti(t,e,Li),t+"")},Vi=function isIterateeCall$1(t,e,n){if(!$i(n))return!1;var i=typeof e;return!!("number"==i?Ni(n)&&zi(e,n.length):"string"==i&&e in n)&&Di(n[e],t)},qi=xi,Ui=function createAssigner$1(a){return Hi(function(t,e){var n=-1,i=e.length,s=1<i?e[i-1]:void 0,r=2<i?e[2]:void 0,s=3<a.length&&"function"==typeof s?(i--,s):void 0;for(r&&Vi(e[0],e[1],r)&&(s=i<3?void 0:s,i=1),t=Object(t);++n<i;){var o=e[n];o&&a(t,o,n,s)}return t})}(function(t,e,n){qi(t,e,n)}),Ji="undefined"!=typeof Float32Array?Float32Array:Array,Xi=Math.PI/180;function toRadian(t){return t*Xi}function invert(t,e){var n=e[0],i=e[1],s=e[2],r=e[3],o=e[4],e=e[5],a=n*r-i*s;return a?(t[0]=r*(a=1/a),t[1]=-i*a,t[2]=-s*a,t[3]=n*a,t[4]=(s*e-r*o)*a,t[5]=(i*o-n*e)*a,t):null}function multiply(t,e,n){var i=e[0],s=e[1],r=e[2],o=e[3],a=e[4],e=e[5],l=n[0],h=n[1],c=n[2],u=n[3],d=n[4],n=n[5];return t[0]=i*l+r*h,t[1]=s*l+o*h,t[2]=i*c+r*u,t[3]=s*c+o*u,t[4]=i*d+r*n+a,t[5]=s*d+o*n+e,t}function transformMat2d(t,e,n){var i=e[0],e=e[1];return t[0]=n[0]*i+n[2]*e+n[4],t[1]=n[1]*i+n[3]*e+n[5],t}Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)}),function create(){var t=new Ji(2);Ji!=Float32Array&&(t[0]=0,t[1]=0)}();var Gi=function arrayEach$1(t,e){for(var n=-1,i=null==t?0:t.length;++n<i&&!1!==e(t[n],n,t););return t},Fi=Le(Object.keys,Object),Ki=De,Wi=Fi,Qi=Object.prototype.hasOwnProperty,Zi=function baseKeys$2(t){if(!Ki(t))return Wi(t);var e,n=[];for(e in Object(t))Qi.call(t,e)&&"constructor"!=e&&n.push(e);return n},Yi=Jn,tr=Zi,er=Ye,nr=function keys$3(t){return(er(t)?Yi:tr)(t)},ir=Tn,rr=nr,sr=function baseAssign$1(t,e){return t&&ir(e,rr(e),t)},or=Tn,ar=Yn,lr=function baseAssignIn$1(t,e){return t&&or(e,ar(e),t)},hr=function stubArray$2(){return[]},cr=function arrayFilter$1(t,e){for(var n=-1,i=null==t?0:t.length,s=0,r=[];++n<i;){var o=t[n];e(o,n,t)&&(r[s++]=o)}return r},ur=hr,dr=Object.prototype.propertyIsEnumerable,fr=Object.getOwnPropertySymbols,pr=fr?function(e){return null==e?[]:(e=Object(e),cr(fr(e),function(t){return dr.call(e,t)}))}:ur,vr=Tn,yr=pr,gr=function copySymbols$1(t,e){return vr(t,yr(t),e)},Cr=function arrayPush$2(t,e){for(var n=-1,i=e.length,s=t.length;++n<i;)t[s+n]=e[n];return t},mr=Cr,br=Te,kr=pr,_r=hr,Pr=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)mr(e,kr(t)),t=br(t);return e}:_r,xr=Tn,Er=Pr,wr=function copySymbolsIn$1(t,e){return xr(t,Er(t),e)},Sr=Cr,Ir=g,Or=function baseGetAllKeys$2(t,e,n){e=e(t);return Ir(t)?e:Sr(e,n(t))},Mr=Or,Ar=pr,jr=nr,Br=function getAllKeys$1(t){return Mr(t,jr,Ar)},Lr=Or,Tr=Pr,Rr=Yn,Dr=function getAllKeysIn$1(t){return Lr(t,Rr,Tr)},Nr=Mt(r,"DataView"),zr=At,$r=Mt(r,"Promise"),Hr=Mt(r,"Set"),Vr=Mt(r,"WeakMap"),qr=y,Ur=gt,Jr=Ur(Nr),Xr=Ur(zr),Gr=Ur($r),Fr=Ur(Hr),Kr=Ur(Vr),Wr=qr,Qr=Wr=Nr&&"[object DataView]"!=Wr(new Nr(new ArrayBuffer(1)))||zr&&"[object Map]"!=Wr(new zr)||$r&&"[object Promise]"!=Wr($r.resolve())||Hr&&"[object Set]"!=Wr(new Hr)||Vr&&"[object WeakMap]"!=Wr(new Vr)?function(t){var e=qr(t),t="[object Object]"==e?t.constructor:void 0,t=t?Ur(t):"";if(t)switch(t){case Jr:return"[object DataView]";case Xr:return"[object Map]";case Gr:return"[object Promise]";case Fr:return"[object Set]";case Kr:return"[object WeakMap]"}return e}:Wr,Zr=Object.prototype.hasOwnProperty,Yr=function initCloneArray$1(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Zr.call(t,"index")&&(n.index=t.index,n.input=t.input),n},ts=Se,es=function cloneDataView$1(t,e){e=e?ts(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)},ns=/\w*$/,is=function cloneRegExp$1(t){var e=new t.constructor(t.source,ns.exec(t));return e.lastIndex=t.lastIndex,e},rs=s?s.prototype:void 0,ss=rs?rs.valueOf:void 0,os=Se,as=es,ls=is,hs=function cloneSymbol$1(t){return ss?Object(ss.call(t)):{}},cs=Oe,us=function initCloneByTag$1(t,e,n){var i=t.constructor;switch(e){case"[object ArrayBuffer]":return os(t);case"[object Boolean]":case"[object Date]":return new i(+t);case"[object DataView]":return as(t,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return cs(t,n);case"[object Map]":return new i;case"[object Number]":case"[object String]":return new i(t);case"[object RegExp]":return ls(t);case"[object Set]":return new i;case"[object Symbol]":return hs(t)}},ds=Qr,fs=C,ps=function baseIsMap$1(t){return fs(t)&&"[object Map]"==ds(t)},vs=kn,ys=_n.exports,gs=ys&&ys.isMap,Cs=gs?vs(gs):ps,ms=Qr,bs=C,ks=function baseIsSet$1(t){return bs(t)&&"[object Set]"==ms(t)},_s=kn,Ps=_n.exports,xs=Ps&&Ps.isSet,Es=xs?_s(xs):ks,ws=ye,Ss=Gi,Is=jn,Os=sr,Ms=lr,As=Ee.exports,js=Me,Bs=gr,Ls=wr,Ts=Br,Rs=Dr,Ds=Qr,Ns=Yr,zs=us,$s=He,Hs=g,Vs=rn.exports,qs=Cs,Us=lt,Js=Es,Xs=nr,Gs=Yn,Fs={},Ks=(Fs["[object Arguments]"]=Fs["[object Array]"]=Fs["[object ArrayBuffer]"]=Fs["[object DataView]"]=Fs["[object Boolean]"]=Fs["[object Date]"]=Fs["[object Float32Array]"]=Fs["[object Float64Array]"]=Fs["[object Int8Array]"]=Fs["[object Int16Array]"]=Fs["[object Int32Array]"]=Fs["[object Map]"]=Fs["[object Number]"]=Fs["[object Object]"]=Fs["[object RegExp]"]=Fs["[object Set]"]=Fs["[object String]"]=Fs["[object Symbol]"]=Fs["[object Uint8Array]"]=Fs["[object Uint8ClampedArray]"]=Fs["[object Uint16Array]"]=Fs["[object Uint32Array]"]=!0,Fs["[object Error]"]=Fs["[object Function]"]=Fs["[object WeakMap]"]=!1,function baseClone$1(n,i,s,t,e,r){var o,a=1&i,l=2&i,h=4&i;if(void 0!==(o=s?e?s(n,t,e,r):s(n):o))return o;if(!Us(n))return n;t=Hs(n);if(t){if(o=Ns(n),!a)return js(n,o)}else{var c=Ds(n),u="[object Function]"==c||"[object GeneratorFunction]"==c;if(Vs(n))return As(n,a);if("[object Object]"==c||"[object Arguments]"==c||u&&!e){if(o=l||u?{}:$s(n),!a)return l?Ls(n,Ms(o,n)):Bs(n,Os(o,n))}else{if(!Fs[c])return e?n:{};o=zs(n,c,a)}}u=(r=r||new ws).get(n);if(u)return u;r.set(n,o),Js(n)?n.forEach(function(t){o.add(baseClone$1(t,i,s,t,n,r))}):qs(n)&&n.forEach(function(t,e){o.set(e,baseClone$1(t,i,s,e,n,r))});var d=t?void 0:(h?l?Rs:Ts:l?Gs:Xs)(n);return Ss(d||n,function(t,e){d&&(t=n[e=t]),Is(o,e,baseClone$1(t,i,s,e,n,r))}),o}),Ws=function cloneDeep(t){return Ks(t,5)},Qs=null,Zs=((Qs=window||global||{}).requestFrame=Qs.requestAnimationFrame||Qs.webkitRequestAnimationFrame||Qs.mozRequestAnimationFrame||Qs.oRequestAnimationFrame||Qs.msRequestAnimationFrame,Qs),Ys=function(){function ICEEvent(){var t,e,n=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};for(t in _classCallCheck(this,ICEEvent),n)this[t]=n[t];for(e in i)this[e]=i[e]}return _createClass(ICEEvent,[{key:"composedPath",value:function composedPath(){throw new Error("Method not implemented.")}},{key:"initEvent",value:function initEvent(t,e,n){throw new Error("Method not implemented.")}},{key:"preventDefault",value:function preventDefault(){throw new Error("Method not implemented.")}},{key:"stopImmediatePropagation",value:function stopImmediatePropagation(){throw new Error("Method not implemented.")}},{key:"stopPropagation",value:function stopPropagation(){throw new Error("Method not implemented.")}}]),ICEEvent}(),to=Zi,eo=Qr,no=Ke,io=g,ro=Ye,so=rn.exports,oo=De,ao=Sn,lo=Object.prototype.hasOwnProperty,ho=function isEmpty(t){if(null==t)return!0;if(ro(t)&&(io(t)||"string"==typeof t||"function"==typeof t.splice||so(t)||ao(t)||no(t)))return!t.length;var e,n=eo(t);if("[object Map]"==n||"[object Set]"==n)return!t.size;if(oo(t))return!to(t).length;for(e in t)if(lo.call(t,e))return!1;return!0},co=function(){function ICEEventTarget(){_classCallCheck(this,ICEEventTarget),_defineProperty$1(this,"listeners",{}),_defineProperty$1(this,"suspendedEventNames",[])}return _createClass(ICEEventTarget,[{key:"on",value:function on(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Zs;this.listeners[t]||(this.listeners[t]=[]),this.off(t,e,n),this.listeners[t].push({callback:e,scope:n})}},{key:"off",value:function off(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Zs;if(i=this.listeners[t])for(var i=_toConsumableArray(i),s=0;s<i.length;s++){var r=i[s];if(r.callback===e&&r.scope===n)return void this.listeners[t].splice(s,1)}}},{key:"once",value:function once(e,n){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Zs,s=this;s.on(e,function callback(t){s.off(e,callback,i),n.call(i,t)},i)}},{key:"trigger",value:function trigger(t){var e,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(ho(this.listeners[t]))return!1;if(this.suspendedEventNames.includes(t))return!1;n?((e=new Ys(n)).originalEvent=n.originalEvent||n,e.param=_objectSpread2({},i)):e=new Ys({type:t,timeStamp:Date.now(),param:_objectSpread2({},i)});for(var s=this.listeners[t],r=0;r<s.length;r++){var o=s[r];o.callback.call(o.scope,e)}return!0}},{key:"suspend",value:function suspend(t){t&&!this.suspendedEventNames.includes(t)&&this.suspendedEventNames.push(t)}},{key:"resume",value:function resume(e){this.suspendedEventNames.splice(this.suspendedEventNames.findIndex(function(t){return t===e}),1)}},{key:"purgeEvents",value:function purgeEvents(){this.listeners={},this.suspendedEventNames=[]}},{key:"hasListener",value:function hasListener(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:Zs;if(!this.listeners[t])return!1;var i=this.listeners[t];if(!i)return!1;for(var s=0;s<i.length;s++){var r=i[s];if(r.callback===e&&r.scope===n)return!0}return!1}}]),ICEEventTarget}(),uo=(co.prototype.addEventListener=co.prototype.on,co.prototype.removeEventListener=co.prototype.off,co.prototype.dispatchEvent=co.prototype.trigger,function(){function GeoUtil(){throw _classCallCheck(this,GeoUtil),new Error("GeoUtil is a static util class.")}return _createClass(GeoUtil,null,[{key:"calcRotateAngle",value:function calcRotateAngle(t,e,n,i){t-=n,n=e-i,e=Math.hypot(t,n);return((n/e<0?-1:1)*Math.acos(t/e)*180/Math.PI+360)%360}},{key:"calcRotateAngleFromMatrix",value:function calcRotateAngleFromMatrix(t){var e=t[0],t=t[1];return Math.atan2(t,e)*(180/Math.PI)}},{key:"calcScaleFromMatrix",value:function calcScaleFromMatrix(t){var e=t[0],n=t[1],i=t[2],t=t[3];return[Math.hypot(e,n)/e,Math.hypot(i,t)/t]}}]),GeoUtil}()),fo=function(){function ICEBoundingBox(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[0,0,0,0,0,0,0,0,0,0];_classCallCheck(this,ICEBoundingBox),_defineProperty$1(this,"tl",[0,0]),_defineProperty$1(this,"tr",[0,0]),_defineProperty$1(this,"bl",[0,0]),_defineProperty$1(this,"br",[0,0]),_defineProperty$1(this,"tc",[0,0]),_defineProperty$1(this,"rc",[0,0]),_defineProperty$1(this,"bc",[0,0]),_defineProperty$1(this,"lc",[0,0]),_defineProperty$1(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 _createClass(ICEBoundingBox,[{key:"containsPoint",value:function containsPoint(t){var e=this.getMinAndMaxPoint(),n=e.minX,i=e.minY,s=e.maxX,e=e.maxY;if(t[0]<n||t[0]>s||t[1]<i||t[1]>e)return!1;for(var r=0,o=this.getBoundingLines(),a=0;a<o.length;a++){var l,h=o[a];t[1]>h.o[1]&&t[1]>h.d[1]||t[1]<h.o[1]&&t[1]<h.d[1]||(h.o[0]===h.d[0]&&h.o[0]>=t[0]?h.o[0]:(l=(h.d[1]-h.o[1])/(h.d[0]-h.o[0]),h.o[0]+(t[1]-h.o[1])/l))>t[0]&&r++}return 0!==r&&r%2==1}},{key:"getBoundingLines",value:function getBoundingLines(){return[{o:_toConsumableArray(this.tl),d:_toConsumableArray(this.tr)},{o:_toConsumableArray(this.tr),d:_toConsumableArray(this.br)},{o:_toConsumableArray(this.br),d:_toConsumableArray(this.bl)},{o:_toConsumableArray(this.bl),d:_toConsumableArray(this.tl)}]}},{key:"getMinAndMaxPoint",value:function getMinAndMaxPoint(){for(var t=this.tl[0],e=this.tl[1],n=this.tl[0],i=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]>n&&(n=o[0]),o[1]<e&&(e=o[1]),o[1]>i&&(i=o[1])}return{minX:t,minY:e,maxX:n,maxY:i}}},{key:"containsBox",value:function containsBox(t){return!1}},{key:"isIntersect",value:function isIntersect(t){var e=this.tl[0],n=this.br[0],i=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<i||n<r||s<a)}},{key:"transform",value:function transform(t){var e=transformMat2d([],this.tl,t),n=transformMat2d([],this.tr,t),i=transformMat2d([],this.bl,t),s=transformMat2d([],this.br,t),t=transformMat2d([],this.center,t);return new ICEBoundingBox([].concat(_toConsumableArray(e),_toConsumableArray(n),_toConsumableArray(i),_toConsumableArray(s),_toConsumableArray(t)))}},{key:"union",value:function union(t){return null}},{key:"width",get:function get(){var t=this.br[0]-this.bl[0],e=this.br[1]-this.bl[1];return Math.hypot(t,e)}},{key:"height",get:function get(){var t=this.br[0]-this.tr[0],e=this.br[1]-this.tr[1];return Math.hypot(t,e)}},{key:"left",get:function get(){return this.tl[0]},set:function set(t){throw new Error("Can not set left to ICEBoundingBox directly.")}},{key:"top",get:function get(){return this.tl[1]},set:function set(t){throw new Error("Can not set top to ICEBoundingBox directly.")}},{key:"centerX",get:function get(){return this.center[0]}},{key:"centerY",get:function get(){return this.center[1]}},{key:"centerPoint",get:function get(){return this.center}}],[{key:"fromDimension",value:function fromDimension(t,e,n,i){return new ICEBoundingBox([].concat([t,e],[t+n,e],[t,e+i],[t+n,e+i],[t+n/2,e+i/2]))}}]),ICEBoundingBox}();function getVal(t,e){return e.split(".").reduce(function(t,e){return t[e]},t)}function flattenTree(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,i=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null,s=0;s<e.length;s++){var r=e[s];r._level=n,r._pid=i,t.push(r),flattenTree(t,r.childNodes||[],n+1,r.id)}return t}function uuid(){if(Zs.crypto)return Zs.crypto.randomUUID();var n=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"==t?e:3&e|8).toString(16)})}var po=function(){_inherits(ICEComponent,co);var n=_createSuper(ICEComponent);function ICEComponent(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEComponent),_defineProperty$1(_assertThisInitialized(t=n.call(this)),"__dirty",!0),_defineProperty$1(_assertThisInitialized(t),"props",{id:"ICE_"+uuid(),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:ICEComponent.instanceCounter++,display:!0,draggable:!0,transformable:!0,interactive:!0,linkable:!0,showMinBoundingBox:!1,showMaxBoundingBox:!1}),_defineProperty$1(_assertThisInitialized(t),"state",{}),t.props=Ui(t.props,e),t.state=Ws(t.props),t.root=Zs,t.initEvents(),t}return _createClass(ICEComponent,[{key:"initEvents",value:function initEvents(){this.on("mousedown",this.mouseDownEvtHandler,this),this.on("keydown",this.keyboardEvtHandler,this),this.on("keyup",this.keyboardEvtHandler,this)}},{key:"mouseDownEvtHandler",value:function mouseDownEvtHandler(t){this.state.interactive&&this.state.draggable&&(this.on("mousemove",this.mouseMoveEvtHandler,this),this.on("mouseup",this.mouseUpEvtHandler,this))}},{key:"mouseMoveEvtHandler",value:function mouseMoveEvtHandler(t){var e=t.movementX,n=t.movementY;return this.moveGlobalPosition(e,n,t),!0}},{key:"mouseUpEvtHandler",value:function mouseUpEvtHandler(t){this.off("mousemove",this.mouseMoveEvtHandler,this),this.off("mouseup",this.mouseUpEvtHandler,this)}},{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){switch(t.key){case"ArrowUp":this.moveGlobalPosition(0,-2,t);break;case"ArrowDown":this.moveGlobalPosition(0,2,t);break;case"ArrowLeft":this.moveGlobalPosition(-2,0,t);break;case"ArrowRight":this.moveGlobalPosition(2,0,t);break;case"Delete":(this.parentNode&&this.parentNode.removeChild?this.parentNode:this.ice).removeChild(this)}}},{key:"render",value:function render(){this.trigger(E),this.state.display&&(this.calcComponentParams(),this.applyStyleToCtx(),this.applyTransformToCtx(),this.doRender(),this.trigger(w),this.dirty=!1)}},{key:"applyStyleToCtx",value:function applyStyleToCtx(){var t,e=_objectSpread2(_objectSpread2({},this.props.style),this.state.style);for(t in e)this.ctx[t]=e[t]}},{key:"calcComponentParams",value:function calcComponentParams(){return{width:this.state.width,height:this.state.height}}},{key:"calcLocalOrigin",value:function calcLocalOrigin(){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 calcAbsoluteOrigin(){var t=getVal(this,"state.transform.translate.0")+this.state.left,e=getVal(this,"state.transform.translate.1")+this.state.top,n=_toConsumableArray(this.calcLocalOrigin());return n[0]+=t,n[1]+=e,this.parentNode&&(n=transformMat2d([],n,[1,0,0,1,-this.parentNode.state.localOrigin[0],-this.parentNode.state.localOrigin[1]]),n=transformMat2d([],n,this.parentNode.state.composedMatrix)),this.state.absoluteOrigin=n}},{key:"calcLinearMatrix",value:function calcLinearMatrix(){var t=function create$1(){var t=new Ji(6);return Ji!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t}(),e=getVal(this,"state.transform.skew.0"),n=getVal(this,"state.transform.skew.1"),t=function scale(t,e,n){var i=e[0],s=e[1],r=e[2],o=e[3],a=e[4],e=e[5],l=n[0],n=n[1];return t[0]=i*l,t[1]=s*l,t[2]=r*n,t[3]=o*n,t[4]=a,t[5]=e,t}([],function rotate(t,e,n){var i=e[0],s=e[1],r=e[2],o=e[3],a=e[4],e=e[5],l=Math.sin(n),n=Math.cos(n);return t[0]=i*n+r*l,t[1]=s*n+o*l,t[2]=i*-l+r*n,t[3]=s*-l+o*n,t[4]=a,t[5]=e,t}([],function skew(t,e,n,i){n=Math.tan(n),i=Math.tan(i);return t[0]=e[0],t[1]=e[1]+n,t[2]=e[2]+i,t[3]=e[3],t[4]=e[4],t[5]=e[5],t}([],t,toRadian(e),toRadian(n)),toRadian(getVal(this,"state.transform.rotate"))),[getVal(this,"state.transform.scale.0"),getVal(this,"state.transform.scale.1")]);return this.state.linearMatrix=t}},{key:"calcAbsoluteLinearMatrix",value:function calcAbsoluteLinearMatrix(){for(var t=this,e=t.calcLinearMatrix();t.parentNode;)e=multiply([],t.parentNode.state.linearMatrix,e),t=t.parentNode;return this.state.absoluteLinearMatrix=e}},{key:"composeMatrix",value:function composeMatrix(){var t=this.calcAbsoluteOrigin(),t=multiply([],[1,0,0,1,t[0],t[1]],this.calcAbsoluteLinearMatrix());return this.state.composedMatrix=t}},{key:"applyTransformToCtx",value:function applyTransformToCtx(){var t,e=this.dirty?this.composeMatrix():this.state.composedMatrix;(t=this.ctx).setTransform.apply(t,_toConsumableArray(e))}},{key:"doRender",value:function doRender(){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 getMinBoundingBox(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],e=this.state.localOrigin[0],n=this.state.localOrigin[1],i=this.state.width,s=this.state.height,e=new fo([0-e,0-n,0-e+i,0-n,0-e,0-n+s,0-e+i,0-n+s,0,0]),i=t?this.composeMatrix():this.state.composedMatrix;return e.transform(i)}},{key:"getMaxBoundingBox",value:function getMaxBoundingBox(){var t=this.getMinBoundingBox(0<arguments.length&&void 0!==arguments[0]&&arguments[0]),e=t.getMinAndMaxPoint(),n=e.minX,i=e.minY,s=e.maxX,e=e.maxY,t=t.centerPoint;return new fo([n,i,s,i,n,e,s,e,t[0],t[1]])}},{key:"setState",value:function setState(t){Ui(this.state,t),this.dirty=!0,this.ice&&(this.ice.dirty=!0)}},{key:"dirty",get:function get(){return this.__dirty},set:function set(t){this.__dirty=t}},{key:"setPosition",value:function setPosition(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Ys;this.trigger(N,_objectSpread2(_objectSpread2({},n),{},{left:t,top:e})),this.setState({left:t,top:e}),this.trigger(z,_objectSpread2(_objectSpread2({},n),{},{left:t,top:e}))}},{key:"moveGlobalPosition",value:function moveGlobalPosition(t,e){var n,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Ys;this.parentNode&&(t=(n=transformMat2d([],[t,e],invert([],this.parentNode.state.absoluteLinearMatrix)))[0],e=n[1]),this.setPosition(this.state.left+t,this.state.top+e,_objectSpread2(_objectSpread2({},i),{},{tx:t,ty:e}))}},{key:"setGlobalPosition",value:function setGlobalPosition(t,e){var n,i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Ys;this.parentNode&&(t=(n=transformMat2d([],[t,e],invert([],this.parentNode.state.absoluteLinearMatrix)))[0],e=n[1]),this.setPosition(t,e,_objectSpread2(_objectSpread2({},i),{},{left:t,top:e}))}},{key:"setGlobalRotate",value:function setGlobalRotate(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteLinearMatrix,t-=uo.calcRotateAngleFromMatrix(e)),this.setState({transform:{rotate:t}})}},{key:"localToGlobal",value:function localToGlobal(t,e){t=[t,e];return transformMat2d([],t,this.state.composedMatrix)}},{key:"globalToLocal",value:function globalToLocal(t,e){t=[t,e];return transformMat2d([],t,invert([],this.state.composedMatrix))}},{key:"getRotateAngle",value:function getRotateAngle(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0]?this.composeMatrix():this.state.composedMatrix;return uo.calcRotateAngleFromMatrix(t)}},{key:"getLocalLeftTop",value:function getLocalLeftTop(){var t=this.getMinBoundingBox(0<arguments.length&&void 0!==arguments[0]&&arguments[0]),e=t.width,n=t.height;return{left:t.centerX-t.width/2,top:t.centerY-t.height/2,width:e,height:n}}},{key:"containsPoint",value:function containsPoint(t,e){return this.getMinBoundingBox().containsPoint([t,e])}},{key:"destory",value:function destory(){this.trigger(O,null,{component:this}),this.purgeEvents(),this.ice=null,this.ctx=null,this.root=null,this.evtBus=null,this.parentNode=null}}]),ICEComponent}(),vo=(_defineProperty$1(po,"instanceCounter",0),function(){_inherits(ICEPath,po);var e=_createSuper(ICEPath);function ICEPath(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEPath),_defineProperty$1(_assertThisInitialized(t=e.call(this,_objectSpread2({closePath:!0},t))),"path2D",new Path2D),t}return _createClass(ICEPath,[{key:"doRender",value:function doRender(){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),_get(_getPrototypeOf(ICEPath.prototype),"doRender",this).call(this)}}]),ICEPath}()),yo=function(){_inherits(ICERect,vo);var e=_createSuper(ICERect);function ICERect(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICERect),e.call(this,_objectSpread2({width:10,height:10},t))}return _createClass(ICERect,[{key:"createPathObject",value:function createPathObject(){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}}]),ICERect}(),go=function(){_inherits(ICEGroup,yo);var e=_createSuper(ICEGroup);function ICEGroup(t){return _classCallCheck(this,ICEGroup),_defineProperty$1(_assertThisInitialized(t=e.call(this,t)),"parentNode",null),_defineProperty$1(_assertThisInitialized(t),"childNodes",[]),t}return _createClass(ICEGroup,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEGroup.prototype),"initEvents",this).call(this),this.once(I,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function afterAddHandler(){for(var t=0;t<this.childNodes.length;t++){var e=this.childNodes[t];this.syncChildEvents(e)}}},{key:"syncChildEvents",value:function syncChildEvents(t){t.trigger(S),t.ice=this.ice,t.ctx=this.ice.ctx,t.evtBus=this.ice.evtBus,t.trigger(I)}},{key:"addChild",value:function addChild(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];-1===this.childNodes.indexOf(t)&&((t.parentNode=this).childNodes.push(t),this.dirty=e,this.ice&&(this.syncChildEvents(t),this.ice.dirty=e))}},{key:"addChildren",value:function addChildren(t){for(var e=0;e<t.length;e++){var n=t[e];this.addChild(n,!1)}this.dirty=!0,this.ice&&(this.ice.dirty=!0)}},{key:"removeChild",value:function removeChild(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];t.destory(),this.childNodes.splice(this.childNodes.indexOf(t),1),this.dirty=e,this.ice&&(this.ice.dirty=e)}},{key:"removeChildren",value:function removeChildren(t){for(var e=0;e<t.length;e++){var n=t[e];this.removeChild(n,!1)}this.dirty=!0,this.ice&&(this.ice.dirty=!0)}},{key:"setState",value:function setState(t){Ui(this.state,t),this.dirty=!0,function setRecursively(t){if(t.dirty=!0,t.childNodes&&t.childNodes.length)for(var e=0;e<t.childNodes.length;e++)setRecursively(t.childNodes[e])}(this),this.ice&&(this.ice.dirty=!0)}},{key:"destory",value:function destory(){this.removeChildren(this.childNodes),_get(_getPrototypeOf(ICEGroup.prototype),"destory",this).call(this)}}]),ICEGroup}(),Co=function(){_inherits(ICEControlPanel,go);var e=_createSuper(ICEControlPanel);function ICEControlPanel(t){return _classCallCheck(this,ICEControlPanel),_defineProperty$1(_assertThisInitialized(t=e.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))),"isControlPanel",!0),t}return _createClass(ICEControlPanel,[{key:"doRender",value:function doRender(){_get(_getPrototypeOf(ICEControlPanel.prototype),"doRender",this).call(this),this.updateControlPositions()}},{key:"moveGlobalPosition",value:function moveGlobalPosition(t,e,n){_get(_getPrototypeOf(ICEControlPanel.prototype),"moveGlobalPosition",this).call(this,t,e,n),this._targetComponent&&this._targetComponent.moveGlobalPosition(t,e,n)}}]),ICEControlPanel}(),mo=function isNil(t){return null==t},bo=function(){_inherits(ICEEllipse,vo);var e=_createSuper(ICEEllipse);function ICEEllipse(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEEllipse),_objectSpread2({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,e.call(this,t)}return _createClass(ICEEllipse,[{key:"createPathObject",value:function createPathObject(){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 setState(t){mo(t.radiusX)?mo(t.width)||(t.radiusX=t.width/2):t.width=2*t.radiusX,mo(t.radiusY)?mo(t.height)||(t.radiusY=t.height/2):t.height=2*t.radiusY,_get(_getPrototypeOf(ICEEllipse.prototype),"setState",this).call(this,t)}}]),ICEEllipse}(),ko=function(){_inherits(ICECircle,bo);var e=_createSuper(ICECircle);function ICECircle(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICECircle),_objectSpread2({radius:10},t));return t.radiusX=t.radius,t.radiusY=t.radius,e.call(this,t)}return _createClass(ICECircle)}(),_o=function(){_inherits(ICELinkHook,ko);var e=_createSuper(ICELinkHook);function ICELinkHook(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkHook),e.call(this,_objectSpread2({linkable:!1},t))}return _createClass(ICELinkHook,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICELinkHook.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(z,this.resizeEvtHandler,this)}},{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){}},{key:"mosueDownHandler",value:function mosueDownHandler(t){this.evtBus.trigger(A,new Ys({target:this}))}},{key:"mosueMoveHandler",value:function mosueMoveHandler(t){this.evtBus.trigger(j,new Ys({target:this}))}},{key:"mosueUpHandler",value:function mosueUpHandler(t){this.evtBus.trigger(B,new Ys({target:this}))}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){var e;this.parentNode&&(e=this.props.position,this.parentNode.trigger(L,new Ys(t,{position:e})),this.parentNode.trigger(T,new Ys(t,{position:e})))}}]),ICELinkHook}(),Po=function(){_inherits(LineControlPanel,Co);var e=_createSuper(LineControlPanel);function LineControlPanel(t){return _classCallCheck(this,LineControlPanel),_defineProperty$1(_assertThisInitialized(t=e.call(this,_objectSpread2(_objectSpread2({},t),{},{zIndex:10001e3,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"controlSize",16),t.initControls(),t}return _createClass(LineControlPanel,[{key:"initControls",value:function initControls(){var t=this.state.width,e=this.state.height,n=this.controlSize/2;this.startControl=new _o({zIndex:10001001,display:!1,left:-n,top:-n,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"start"}),this.addChild(this.startControl),this.endControl=new _o({zIndex:10001002,display:!1,left:t-n,top:e-n,width:this.controlSize,height:this.controlSize,style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1},position:"end"}),this.addChild(this.endControl)}},{key:"initEvents",value:function initEvents(){this.on(T,this.resizeEvtHandler,this)}},{key:"enable",value:function enable(){this.setState({display:!0}),this.resume(T),this.showHooks()}},{key:"disable",value:function disable(){this.setState({display:!1}),this.suspend(T),this.hideHooks()}},{key:"updateControlPositions",value:function updateControlPositions(){}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){if(this.targetComponent){var e=t.position,n=t.movementX,i=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],l=t.points[s-1][1],s=transformMat2d([],[n,i],invert([],t.absoluteLinearMatrix)),n=s[0],i=s[1];switch(e){case"start":r+=n,o+=i;break;case"end":a+=n,l+=i}this.targetComponent.setState({startPoint:[r,o],endPoint:[a,l]})}}},{key:"updatePosition",value:function updatePosition(){var t,e,n;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,n=this.targetComponent.state.points.length,e=this.targetComponent.state.points[0],n=this.targetComponent.state.points[n-1],e=[e[0],e[1]],n=[n[0],n[1]],this.startControl.setState({left:e[0]-t,top:e[1]-t}),this.endControl.setState({left:n[0]-t,top:n[1]-t}))}},{key:"targetComponent",get:function get(){return this._targetComponent},set:function set(t){var e=this;this._targetComponent&&this._targetComponent.off(z,this.updatePosition,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(z,this.updatePosition,this),this._targetComponent&&this._targetComponent.once(O,function(){e.targetComponent=null,e.disable()},this),this.updatePosition()}},{key:"showHooks",value:function showHooks(){this.startControl.setState({display:!0}),this.endControl.setState({display:!0})}},{key:"hideHooks",value:function hideHooks(){this.startControl.setState({display:!1}),this.endControl.setState({display:!1})}}]),LineControlPanel}(),xo=/\s/,Eo=function trimmedEndIndex$1(t){for(var e=t.length;e--&&xo.test(t.charAt(e)););return e},wo=/^\s+/,So=y,Io=C,Oo=function isSymbol$2(t){return"symbol"==typeof t||Io(t)&&"[object Symbol]"==So(t)},Mo=function baseTrim$1(t){return t&&t.slice(0,Eo(t)+1).replace(wo,"")},Ao=lt,jo=Oo,Bo=/^[-+]0x[0-9a-f]+$/i,Lo=/^0b[01]+$/i,To=/^0o[0-7]+$/i,Ro=parseInt,Do=function toNumber$2(t){if("number"==typeof t)return t;if(jo(t))return NaN;if(Ao(t)&&(e="function"==typeof t.valueOf?t.valueOf():t,t=Ao(e)?e+"":e),"string"!=typeof t)return 0===t?t:+t;t=Mo(t);var e=Lo.test(t);return e||To.test(t)?Ro(t.slice(2),e?2:8):Bo.test(t)?NaN:+t},No=Do,zo=function toFinite$1(t){return t?(t=No(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0},$o=function toInteger$1(t){var t=zo(t),e=t%1;return t==t?e?t-e:t:0},Ho=function arrayMap$1(t,e){for(var n=-1,i=null==t?0:t.length,s=Array(i);++n<i;)s[n]=e(t[n],n,t);return s},Vo=g,qo=Oo,Uo=s?s.prototype:void 0,Jo=Uo?Uo.toString:void 0,Xo=function baseToString$1(t){if("string"==typeof t)return t;if(Vo(t))return Ho(t,baseToString$1)+"";if(qo(t))return Jo?Jo.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},Go=$o,Fo=Do,Ko=function toString$1(t){return null==t?"":Xo(t)},Wo=r.isFinite,Qo=Math.min,Zo=function createRound$1(t){var s=Math[t];return function(t,e){var n,i;return t=Fo(t),(e=null==e?0:Qo(Go(e),292))&&Wo(t)?(n=(Ko(t)+"e").split("e"),i=s(n[0]+"e"+(+n[1]+e)),+((n=(Ko(i)+"e").split("e"))[0]+"e"+(+n[1]-e))):s(t)}}("round"),Yo=function(){_inherits(ResizeControl,yo);var e=_createSuper(ResizeControl);function ResizeControl(t){return _classCallCheck(this,ResizeControl),e.call(this,_objectSpread2(_objectSpread2({position:"l",direction:"x",quadrant:1},t),{},{linkable:!1}))}return _createClass(ResizeControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ResizeControl.prototype),"initEvents",this).call(this),this.on(z,this.resizeEvtHandler,this)}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){if(this.parentNode){var e=t.quadrant,n=t.movementX,i=t.movementY,s=this.parentNode.state,r=s.left,o=s.top,a=s.width,l=s.height,s=transformMat2d([],[n,i],invert([],s.absoluteLinearMatrix)),n=s[0],i=s[1];switch(e){case 1:r-=n,o+=i,a+=2*n,l-=2*i;break;case 2:r+=n,o+=i,a-=2*n,l-=2*i;break;case 3:r+=n,o-=i,a-=2*n,l+=2*i;break;case 4:r-=n,o-=i,a+=2*n,l+=2*i;break;case 5:o+=i,l-=2*i;break;case 6:o-=i,l+=2*i;break;case 7:r+=n,a-=2*n;break;case 8:r-=n,a+=2*n}s={top:o,left:r,width:Math.abs(a),height:Math.abs(l)};this.parentNode.trigger(L,new Ys(t,{quadrant:e})),this.parentNode.setState(s),this.parentNode.trigger(T,new Ys(t,{quadrant:e}))}}},{key:"moveGlobalPosition",value:function moveGlobalPosition(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new Ys,i=0<t?1:-1,s=0<e?1:-1,r=this.parentNode.state,o=r.localOrigin,a=r.width,l=r.height,r=transformMat2d([],[t,e],invert([],r.absoluteLinearMatrix)),r=(t=r[0],e=r[1],this.state),h=r.left,c=r.top,r=r.quadrant,u=this.state.width/2,d=0;"x"===this.state.direction?d=0<(h=0===Zo(h+=t)?.5*i:h)+u-o[0]?8:7:"y"===this.state.direction?d=0<(c=0===Zo(c+=e)?.5*s:c)+u-o[1]?6:5:"xy"===this.state.direction&&(s=-l/2/(s=0===Zo(s=-a/2)?.5*i:s),0===Zo(a=a/2)&&(a=.5*i),c+=e=2===r||4==r?s*(h+u-o[0]+t)-(c+u-o[1]):-l/2/a*(h+u-o[0]+t)-(c+u-o[1]),d=0<(h+=t)+u-o[0]?0<c+u-o[1]?4:1:0<c+u-o[1]?3:2),r!==d&&this.parentNode.toggleControlQuadrant(this,d),this.setPosition(h,c,new Ys(n,{left:h,top:c,tx:t,ty:e,quadrant:d}))}}]),ResizeControl}(),ta=function(){_inherits(RotateControl,ko);var e=_createSuper(RotateControl);function RotateControl(t){return _classCallCheck(this,RotateControl),e.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))}return _createClass(RotateControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(RotateControl.prototype),"initEvents",this).call(this),this.on(z,this.rotateEvtHandler,this)}},{key:"rotateEvtHandler",value:function rotateEvtHandler(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteOrigin,t={transform:{rotate:uo.calcRotateAngle(t.offsetX,t.offsetY,e[0],e[1])+90}},this.parentNode.trigger(R,new Ys(t)),this.parentNode.setState(t),this.parentNode.trigger(D,new Ys(t)))}}]),RotateControl}(),ea=function(){_inherits(TransformControlPanel,Co);var e=_createSuper(TransformControlPanel);function TransformControlPanel(t){return _classCallCheck(this,TransformControlPanel),_defineProperty$1(_assertThisInitialized(t=e.call(this,_objectSpread2(_objectSpread2({},t),{},{zIndex:10000001,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"rotateControlSize",8),_defineProperty$1(_assertThisInitialized(t),"rotateControlffsetY",60),_defineProperty$1(_assertThisInitialized(t),"resizeControlInstanceCache",[]),_defineProperty$1(_assertThisInitialized(t),"resizeControlSize",16),t.initControls(),t}return _createClass(TransformControlPanel,[{key:"initControls",value:function initControls(){var t=this.state.width,e=this.state.height,n=t/2,i=e/2,s=this.resizeControlSize/2,r=[{direction:"xy",quadrant:2,position:[-s,-s]},{direction:"y",quadrant:5,position:[n-s,-s]},{direction:"xy",quadrant:1,position:[t-s,-s]},{direction:"x",quadrant:8,position:[t-s,i-s]},{direction:"xy",quadrant:4,position:[t-s,e-s]},{direction:"y",quadrant:6,position:[n-s,e-s]},{direction:"xy",quadrant:3,position:[-s,e-s]},{direction:"x",quadrant:7,position:[-s,i-s]}];this.resizeControlInstanceCache=[];for(var o=0;o<r.length;o++){var a=r[o],a=new Yo({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,n=-this.rotateControlffsetY;this.rotateControlInstance=new ta({zIndex:10000003,display:!1,left:t,top:n,radius:this.rotateControlSize,style:{strokeStyle:"#8b0000",fillStyle:"#CC3300",lineWidth:1}}),this.addChild(this.rotateControlInstance)}},{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(TransformControlPanel.prototype),"initEvents",this).call(this),this.on(T,this.resizeEvtHandler,this),this.on(D,this.rotateEvtHandler,this),this.on("keydown",this.keyboardEvtHandler,this),this.on("keyup",this.keyboardEvtHandler,this)}},{key:"enable",value:function enable(){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(T),this.resume(D),this.resume("keydown"),this.resume("keyup")}},{key:"disable",value:function disable(){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(T),this.suspend(D),this.suspend("keydown"),this.suspend("keyup")}},{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){this.targetComponent&&this.targetComponent.trigger(t.type,t,{component:this.targetComponent})}},{key:"rotateEvtHandler",value:function rotateEvtHandler(t){var e;this.targetComponent&&(e=this.state.transform.rotate,this.targetComponent.setGlobalRotate(e),this.targetComponent.trigger(D))}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){if(this.targetComponent){var e=t.quadrant,n=t.movementX,i=t.movementY,t=this.targetComponent.state,s=t.left,r=t.top,o=t.width,a=t.height,t=transformMat2d([],[n,i],invert([],t.absoluteLinearMatrix)),n=t[0],i=t[1];switch(e){case 1:s-=n,r+=i,o+=2*n,a-=2*i;break;case 2:s+=n,r+=i,o-=2*n,a-=2*i;break;case 3:s+=n,r-=i,o-=2*n,a+=2*i;break;case 4:s-=n,r-=i,o+=2*n,a+=2*i;break;case 5:r+=i,a-=2*i;break;case 6:r-=i,a+=2*i;break;case 7:s+=n,o-=2*n;break;case 8:s-=n,o+=2*n}this.targetComponent.setState({left:s,top:r,width:Math.abs(o),height:Math.abs(a)}),this.targetComponent.trigger(T)}}},{key:"updateControlPositions",value:function updateControlPositions(){for(var t=this.state.width,e=this.state.height,n=t/2,i=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=[n-s,-s];break;case 6:a=[n-s,e-s];break;case 7:a=[-s,i-s];break;case 8:a=[t-s,i-s]}o.setState({left:a[0],top:a[1]})}var l=this.state.width/2-this.rotateControlSize,h=-this.rotateControlffsetY;this.rotateControlInstance.setState({left:l,top:h})}},{key:"updatePanel",value:function updatePanel(){var t,e,n,i,s;this.targetComponent&&(t=this.targetComponent.getRotateAngle(!0),e=(s=this.targetComponent.getLocalLeftTop(!0)).left,n=s.top,i=s.width,s=s.height,this.setState({left:e,top:n,width:i,height:s,transform:{rotate:t}}))}},{key:"targetComponent",get:function get(){return this._targetComponent},set:function set(t){var e=this;this._targetComponent&&this._targetComponent.off(z,this.updatePanel,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(z,this.updatePanel,this),this._targetComponent&&this._targetComponent.once(O,function(){e.targetComponent=null,e.disable()},this),this.updatePanel()}},{key:"toggleControlQuadrant",value:function toggleControlQuadrant(t,e){for(var n=0;n<this.resizeControlInstanceCache.length;n++){var i=this.resizeControlInstanceCache[n];if(i.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}i.setState({quadrant:s})}}t.setState({quadrant:e})}}]),TransformControlPanel}(),na=function(){function ICEControlPanelManager(t){_classCallCheck(this,ICEControlPanelManager),this.ice=t,this.transformControlPanel=new ea({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 Po({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 _createClass(ICEControlPanelManager,[{key:"start",value:function start(){return this.ice.evtBus.on("mousedown",this.mouseDownHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off("mousedown",this.mouseDownHandler,this),this}},{key:"mouseDownHandler",value:function mouseDownHandler(t){t=t.target;if(!t.ice||!t.state.interactive||!t.state.transformable)return this.lineControlPanel.disable(),void this.transformControlPanel.disable();t&&(t.isControlPanel||t.parentNode&&t.parentNode.isControlPanel)||(this.ice.selectionList=[t],this.lineControlPanel.disable(),this.transformControlPanel.disable(),t.isLine?(this.lineControlPanel.targetComponent=t,this.lineControlPanel.enable()):(this.transformControlPanel.targetComponent=t,this.transformControlPanel.enable()))}}]),ICEControlPanelManager}(),ia=[["mousedown","ICE_MOUSEDOWN"],["mouseup","ICE_MOUSEUP"],["mousemove","ICE_MOUSEMOVE"],["click","ICE_CLICK"],["dblclick","ICE_DBCLICK"],["contextmenu","ICE_CONTEXTMENU"]],ra=[["keydown","ICE_KEYDOWN"],["keyup","ICE_KEYUP"]],sa=function(){function DOMEventDispatcher(t){_classCallCheck(this,DOMEventDispatcher),_defineProperty$1(this,"selectionCandidates",[]),_defineProperty$1(this,"_stopped",!1),this.ice=t}return _createClass(DOMEventDispatcher,[{key:"start",value:function start(){for(var i=this,s=null,r=[].concat(_toConsumableArray(ia),_toConsumableArray(ra)),t=function _loop(t){var t=r[t],e=t[0],n=t[1];i.ice.evtBus.on(n,function(t){i._stopped||((s="ICE_MOUSEMOVE"!==n&&-1===n.indexOf("KEY")?i.findTargetComponent(t):s)&&(t.target=s).trigger(e,t),i.ice.evtBus.trigger(e,t,{component:s}))})},e=0;e<r.length;e++)t(e);return this}},{key:"stopped",get:function get(){return this._stopped},set:function set(t){this._stopped=t}},{key:"findTargetComponent",value:function findTargetComponent(t){if(this._stopped)return null;var e=t.offsetX,n=t.offsetY,t=flattenTree([],this.ice.childNodes),i=flattenTree([],this.ice.toolNodes),s=[].concat(_toConsumableArray(t),_toConsumableArray(i));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,l=a.interactive,a=a.display;o.containsPoint(e,n)&&l&&a&&this.selectionCandidates.push(o)}t=this.selectionCandidates.pop();return this.selectionCandidates=[],t}}]),DOMEventDispatcher}(),oa={evtBuses:[],start:function start(){if(Zs&&Zs.addEventListener)for(var t=function _loop(t){for(var n=oa.evtBuses[t],i=[].concat(_toConsumableArray(ia),_toConsumableArray(ra)),e=function _loop2(t){var e=i[t];Zs.addEventListener(e[0],function(t){n.trigger(e[1],t)})},s=0;s<i.length;s++)e(s)},e=0;e<oa.evtBuses.length;e++)t(e)},regitserEvtBus:function regitserEvtBus(t){oa.evtBuses.includes(t)||oa.evtBuses.push(t)},delEvtBus:function delEvtBus(t){oa.evtBuses.includes(t)&&oa.evtBuses.splice(oa.evtBuses.indexOf(t),1)}},aa=function(){_inherits(EventBus,co);var t=_createSuper(EventBus);function EventBus(){return _classCallCheck(this,EventBus),t.call(this)}return _createClass(EventBus)}(),la=function(){function GeoLine(t,e){_classCallCheck(this,GeoLine),this.startPoint=t,this.endPoint=e}return _createClass(GeoLine,[{key:"contains",value:function contains(t,e){var n=Math.hypot(this.endPoint.x-this.startPoint.x,this.endPoint.y-this.startPoint.y),i=Math.hypot(t-this.startPoint.x,e-this.startPoint.y),t=Math.hypot(t-this.endPoint.x,e-this.endPoint.y);return n-3<=i+t&&i+t<=n+3}}]),GeoLine}(),ha=function(){function GeoPoint(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;_classCallCheck(this,GeoPoint),this.x=t,this.y=e}return _createClass(GeoPoint,[{key:"equals",value:function equals(t){return this.x==t.x&&this.y==t.y}},{key:"clone",value:function clone(){return new GeoPoint(this.x,this.y)}}],[{key:"load",value:function load(t){return new GeoPoint(Number(t.x),Number(t.y))}},{key:"cloneArray",value:function cloneArray(t){for(var e=[],n=0;n<t.length;n++)e.push(t[n].clone());return e}}]),GeoPoint}(),ca=function(){_inherits(ICEDotPath,vo);var e=_createSuper(ICEDotPath);function ICEDotPath(t){return _classCallCheck(this,ICEDotPath),e.call(this,_objectSpread2({dots:[],closePath:!0},t))}return _createClass(ICEDotPath,[{key:"calcComponentParams",value:function calcComponentParams(){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 calcLocalOrigin(){for(var t=_get(_getPrototypeOf(ICEDotPath.prototype),"calcLocalOrigin",this).call(this),e=0;e<this.state.dots.length;e++){var n=transformMat2d([],this.state.dots[e],[1,0,0,1,-t[0],-t[1]]);this.state.dots[e]=n}return t}},{key:"createPathObject",value:function createPathObject(){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 calcDots(){return this.state.dots=[],this.state.dots}},{key:"calc4VertexPoints",value:function calc4VertexPoints(){for(var t=this.state.dots[0][0],e=this.state.dots[0][1],n=this.state.dots[0][0],i=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]>n&&(n=r[0]),r[1]<e&&(e=r[1]),r[1]>i&&(i=r[1])}return[[t,e],[n,e],[t,i],[n,i]]}},{key:"getTransformedDots",value:function getTransformedDots(){for(var t=this.state.composedMatrix,e=this.state.dots,n=[],i=0;i<e.length;i++){var s=transformMat2d([],e[i],t);n.push(s)}return n}}]),ICEDotPath}(),ua="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",da=function(){_inherits(ICEImage,po);var e=_createSuper(ICEImage);function ICEImage(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEImage),e.call(this,_objectSpread2({width:100,height:100,src:ua},t))}return _createClass(ICEImage,[{key:"doRender",value:function doRender(){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)),_get(_getPrototypeOf(ICEImage.prototype),"doRender",this).call(this)}}]),ICEImage}(),fa=_createClass(function ICEBezier(){_classCallCheck(this,ICEBezier)}),pa=function(){_inherits(ICELinkSlot,ko);var e=_createSuper(ICELinkSlot);function ICELinkSlot(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkSlot),e.call(this,_objectSpread2({linkable:!1,draggable:!1,position:"T"},t))}return _createClass(ICELinkSlot,[{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){}},{key:"destory",value:function destory(){this.hostComponent=null,_get(_getPrototypeOf(ICELinkSlot.prototype),"destory",this).call(this)}},{key:"updatePosition",value:function updatePosition(){var t=this._hostComponent.getMinBoundingBox(),e=0,n=0;switch(this.state.position){case"T":e=t.tc[0]-this.state.radius,n=t.tc[1]-this.state.radius;break;case"R":e=t.rc[0]-this.state.radius,n=t.rc[1]-this.state.radius;break;case"B":e=t.bc[0]-this.state.radius,n=t.bc[1]-this.state.radius;break;case"L":e=t.lc[0]-this.state.radius,n=t.lc[1]-this.state.radius;break;case"C":e=t.center[0]-this.state.radius,n=t.center[1]-this.state.radius}this.setState({left:e,top:n})}},{key:"hostComponent",get:function get(){return this._hostComponent},set:function set(t){var e=this;this._hostComponent&&this._hostComponent.off(w,this.updatePosition,this),this._hostComponent=t,this._hostComponent&&this._hostComponent.on(w,this.updatePosition,this),this._hostComponent&&this._hostComponent.once(O,function(){e._hostComponent=null,e.setState({display:!1})},this),this._hostComponent&&this.setState({display:!0})}}]),ICELinkSlot}(),va=function(){_inherits(ICEPolyLine,ca);var e=_createSuper(ICEPolyLine);function ICEPolyLine(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEPolyLine),ICEPolyLine.arrangeParam(t));return _defineProperty$1(_assertThisInitialized(t=e.call(this,t)),"isLine",!0),t}return _createClass(ICEPolyLine,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEPolyLine.prototype),"initEvents",this).call(this),this.once(I,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function afterAddHandler(t){this.evtBus.once(M,this.syncConnections,this)}},{key:"syncConnections",value:function syncConnections(){this.removeLink("start"),this.removeLink("end");var t=this.state.links;t&&(t.start&&t.start.id&&t.start.position&&this.createLink(t.start.id,t.start.position),t.end&&t.end.id&&t.end.position&&this.createLink(t.end.id,t.end.position)),this.dirty=!0,this.ice.dirty=!0}},{key:"createLink",value:function createLink(t,e){t=this.ice.findComponent(t);t&&t.on(z,this.followComponent,this),t&&t.on(T,this.followComponent,this),t&&t.on(D,this.followComponent,this),t&&t.once(w,this.followComponent,this),t&&this.followComponent(),this.state.draggable=!1}},{key:"removeLink",value:function removeLink(t,e,n){var i;this.state.links&&this.state.links[t]&&(i=this.state.links[t].id,t=this.state.links[t].position,n=n||t,i===(e=e||i)&&t===n&&((e=this.ice.findComponent(i))&&e.off(z,this.followComponent,this),e&&e.off(T,this.followComponent,this),e&&e.off(D,this.followComponent,this)),t=!0,this.state.links.start&&this.state.links.start.id&&(t=!1),this.state.links.end&&this.state.links.end.id&&(t=!1),this.state.draggable=t)}},{key:"getLinkFromId",value:function getLinkFromId(){return this.state.links.start.id}},{key:"getLinkToId",value:function getLinkToId(){return this.state.links.end.id}},{key:"followComponent",value:function followComponent(t){for(var e in this.state.links)if(this.state.links[e]&&this.state.links[e].id&&this.state.links[e].position){var n=this.state.links[e].id,i=this.state.links[e].position,n=this.ice.findComponent(n);if(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;break;case"C":r=s.center}switch(e){case"start":this.setState({startPoint:_toConsumableArray(r)});break;case"end":this.setState({endPoint:_toConsumableArray(r)})}}}}},{key:"calcLocalOrigin",value:function calcLocalOrigin(){var t=[0,0];return this.state.localOrigin=t}},{key:"calcDots",value:function calcDots(){var t=this.state.left,e=this.state.top;this.state.dots=[];for(var n=0;n<this.state.points.length;n++){var i=this.state.points[n],s=i[0]-t,i=i[1]-e;this.state.dots.push([s,i])}return this.calcArrowPoints(),this.state.dots}},{key:"calcArrowPoints",value:function calcArrowPoints(){var t,e,n;"start"!==this.state.arrow&&"both"!==this.state.arrow||(n=_toConsumableArray(this.state.dots[0]),e=[_toConsumableArray(this.state.dots[0]),_toConsumableArray(this.state.dots[1])],e=this.doCalcArrowPoints(e),(t=this.state.dots).unshift.apply(t,_toConsumableArray(e)),this.state.dots.unshift(_toConsumableArray(n))),"end"!==this.state.arrow&&"both"!==this.state.arrow||(t=this.state.dots.length,e=_toConsumableArray(this.state.dots[t-1]),n=[_toConsumableArray(this.state.dots[t-1]),_toConsumableArray(this.state.dots[t-2])],n=this.doCalcArrowPoints(n),(t=this.state.dots).push.apply(t,_toConsumableArray(n)),this.state.dots.push(_toConsumableArray(e)))}},{key:"doCalcArrowPoints",value:function doCalcArrowPoints(t){var e=t[0],t=t[1],n=(t[0]=t[0]-e[0],t[1]=t[1]-e[1],t[0]/Math.hypot.apply(Math,_toConsumableArray(t))),t=t[1]/Math.hypot.apply(Math,_toConsumableArray(t)),i=Math.cos(this.state.arrowAngel),s=Math.sin(this.state.arrowAngel),r=this.state.arrowLength*(n*i-t*s),o=this.state.arrowLength*(t*i+n*s),a=this.state.arrowLength*(n*i+t*s),t=this.state.arrowLength*(t*i-n*s);return[[r+=e[0],o+=e[1]],[a+=e[0],t+=e[1]]]}},{key:"addDot",value:function addDot(t,e){this.state.points.splice(e,0,t),this.state.dots.splice(e,0,[t[0],t[1]])}},{key:"rmDot",value:function rmDot(t){return!(this.state.points.length<3||(this.state.points.splice(t,1),this.state.dots.splice(t,1),0))}},{key:"calcComponentParams",value:function calcComponentParams(){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]),n=this.state.style.lineWidth;return this.isDotsOnSameLine()||(n=Math.abs(t[2][1]-t[0][1])),this.state.width=e,this.state.height=n,{width:this.state.width,height:this.state.height}}},{key:"isDotsOnSameLine",value:function isDotsOnSameLine(){for(var t,e=this.state.points.length,n=Zo(this.state.points[0][0],2),i=Zo(this.state.points[0][1],2),s=0,r=[Zo(this.state.points[e-1][0],2)-n,Zo(this.state.points[e-1][1],2)-i],o=0;o<e;o++){var a=this.state.points[o],a=[a[0]-n,a[1]-i];0===(a=r[0]*a[1]-r[1]*a[0],(t=[])[0]=t[1]=0,t[2]=a,t[2])&&s++}return s===e}},{key:"calc4VertexPoints",value:function calc4VertexPoints(){return this.isDotsOnSameLine()?this.splitEndpointsTo4Points():_get(_getPrototypeOf(ICEPolyLine.prototype),"calc4VertexPoints",this).call(this)}},{key:"splitEndpointsTo4Points",value:function splitEndpointsTo4Points(){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],n=this.getRotateAngle(),i=this.state.height,s=Math.cos(n*Math.PI/180)*i/2,n=Math.sin(n*Math.PI/180)*i/2;return[[0+(s=Zo(s,3)),0+(n=Zo(n,3))],[0-s,0-n],[e+s,t+n],[e-s,t-n]]}},{key:"getMinBoundingBox",value:function getMinBoundingBox(){var t=this.state.localOrigin[0],e=this.state.localOrigin[1],n=this.calc4VertexPoints(),t=new fo([n[0][0]-t,n[0][1]-e,n[1][0]-t,n[1][1]-e,n[2][0]-t,n[2][1]-e,n[3][0]-t,n[3][1]-e,0,0]);return t.transform(this.state.composedMatrix)}},{key:"setState",value:function setState(t){if(mo(t.width)||delete t.width,mo(t.height)||delete t.height,mo(t.transform)||delete t.transform,!mo(t.left))for(var e=t.left-this.state.points[0][0],n=0;n<this.state.points.length;n++)this.state.points[n][0]+=e;if(!mo(t.top))for(var i=t.top-this.state.points[0][1],s=0;s<this.state.points.length;s++)this.state.points[s][1]+=i;var r;mo(t.startPoint)||(this.state.points[0]=_toConsumableArray(t.startPoint),this.state.left=this.state.points[0][0],this.state.top=this.state.points[0][1]),mo(t.endPoint)||(r=this.state.points.length,this.state.points[r-1]=_toConsumableArray(t.endPoint)),mo(t.links)||(Ui(this.state.links,t.links),this.syncConnections()),_get(_getPrototypeOf(ICEPolyLine.prototype),"setState",this).call(this,t)}},{key:"getRotateAngle",value:function getRotateAngle(){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],uo.calcRotateAngle(t,e,0,0)+90):_get(_getPrototypeOf(ICEPolyLine.prototype),"getRotateAngle",this).call(this)}},{key:"containsPoint",value:function containsPoint(t,e){for(var n=this.getLines(),i=0;i<n.length;i++){var s=n[i],r=s.o[0],o=s.o[1],a=s.d[0],s=s.d[1],l=Math.hypot(a-r,s-o),r=Math.hypot(r-t,o-e),o=Math.hypot(a-t,s-e);if(l-3<=r+o&&r+o<=l+3)return!0}return!1}},{key:"getLines",value:function getLines(){var t=[],e=this.getTransformedDots();if(!e||e.length<2)return t;for(var n=0;n<e.length-1;n++){var i={o:[e[n][0],e[n][1]],d:[e[n+1][0],e[n+1][1]]};t.push(i)}return t}},{key:"destory",value:function destory(){this.removeLink("start"),this.removeLink("end"),_get(_getPrototypeOf(ICEPolyLine.prototype),"destory",this).call(this)}}],[{key:"arrangeParam",value:function arrangeParam(t){var e=Ui({},{lineType:"solid",lineWidth:1,arrow:"none",arrowLength:15,arrowAngel:toRadian(30),points:[],showMinBoundingBox:!1,showMaxBoundingBox:!1,links:{},style:{lineJoin:"round"}},t,{linkable:!1,closePath:!1,fill:!1}),n=e.points.length;return n<2&&(0===n?(e.points.push([0,0]),e.points.push([10,10])):1===n&&e.points.push([10,10])),(e=_objectSpread2(_objectSpread2({},e),{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&&(e.style.lineWidth=1),e}}]),ICEPolyLine}(),ya=function(){_inherits(ICEVisioLink,va);var e=_createSuper(ICEVisioLink);function ICEVisioLink(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEVisioLink),t=ICEVisioLink.arrangeParam(t),e.call(this,t)}return _createClass(ICEVisioLink,[{key:"calcDots",value:function calcDots(){var t=this.interpolate(),e=this.state,n=e.left,i=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-n,o.y-i])}return this.calcArrowPoints(),this.state.dots}},{key:"interpolate",value:function interpolate(){var t=this.state.points.length,e=this.state.points[0][0],n=this.state.points[0][1],i=this.state.points[t-1][0],t=this.state.points[t-1][1],s=new ha(e,n),r=new ha(i,t),o=[],a=null,l=null,h=[],c=new fo,u=new fo;if(f=this.ice&&this.state.links&&this.state.links.start&&this.state.links.start.id?this.ice.findComponent(this.state.links.start.id):f){c=f.getMinBoundingBox(),o[0]=new ha(s.x,c.tl[1]-this.state.escapeDistance),o[1]=new ha(c.tr[0]+this.state.escapeDistance,s.y),o[2]=new ha(s.x,c.br[1]+this.state.escapeDistance),o[3]=new ha(c.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])}if(y=this.ice&&this.state.links&&this.state.links.end&&this.state.links.end.id?this.ice.findComponent(this.state.links.end.id):y){u=y.getMinBoundingBox(),o[0]=new ha(r.x,u.tl[1]-this.state.escapeDistance),o[1]=new ha(u.tr[0]+this.state.escapeDistance,r.y),o[2]=new ha(r.x,u.br[1]+this.state.escapeDistance),o[3]=new ha(u.tl[0]-this.state.escapeDistance,r.y);for(var l=o[0],p=1;p<o.length;p++)this.distance(r,o[p])<this.distance(r,l)&&(l=o[p])}var e=0,n=[s],i=(a&&(n.push(a),e=1),l&&n.push(l),n.push(r),ha.cloneArray(n)),t=(h.push(["s0","s0",i]),ha.cloneArray(n)),f=ha.cloneArray(t),y=(f.splice(e+1,0,new ha(f[e].x,f[e+1].y)),h.push(["s1","s1_1",f]),ha.cloneArray(t)),i=(y.splice(e+1,0,new ha(y[e+1].x,y[e].y)),h.push(["s1","s1_2",y]),ha.cloneArray(t)),n=new ha((i[e].x+i[e+1].x)/2,i[e].y),f=new ha((i[e].x+i[e+1].x)/2,i[e+1].y),y=(i.splice(e+1,0,n,f),h.push(["s2","s2_1",i]),ha.cloneArray(t)),n=new ha(y[e].x,(y[e].y+y[e+1].y)/2),f=new ha(y[e+1].x,(y[e].y+y[e+1].y)/2),i=(y.splice(e+1,0,n,f),h.push(["s2","s2_2",y]),ha.cloneArray(t)),n=[i[e].x+20,i[e+1].x+20],f=(c&&n.push(c.br[0]+20),u&&n.push(u.br[0]+20),this.max(n)),y=new ha(f,i[e].y),n=new ha(f,i[e+1].y),f=(i.splice(e+1,0,y,n),h.push(["s2","s2_3",i]),ha.cloneArray(t)),y=[f[e].y-20,f[e+1].y-20],n=(c&&y.push(c.tl[1]-20),u&&y.push(u.tl[1]-20),this.min(y)),i=new ha(f[e].x,n),y=new ha(f[e+1].x,n),n=(f.splice(e+1,0,i,y),h.push(["s2","s2_4",f]),ha.cloneArray(t)),i=[n[e].x-20,n[e+1].x-20],y=(c&&i.push(c.tl[0]-20),u&&i.push(u.tl[0]-20),this.min(i)),f=new ha(y,n[e].y),i=new ha(y,n[e+1].y),y=(n.splice(e+1,0,f,i),h.push(["s2","s2_5",n]),ha.cloneArray(t)),f=[y[e].y+20,y[e+1].y+20],i=(c&&f.push(c.tl[1]+c.height+20),u&&f.push(u.tl[1]+u.height+20),this.max(f)),n=new ha(y[e].x,i),t=new ha(y[e+1].x,i);y.splice(e+1,0,n,t),h.push(["s2","s2_6",y]);for(var v=[],g=0;g<h.length;g++){var C=h[g][2];this.orthogonalPath(C)&&v.push(h[g])}if(h=v,!s.equals(r)){for(var m=[],b=0;b<h.length;b++){var k=h[b][2];this.forwardPath(k)&&m.push(h[b])}(h=m).length}for(var _=[],P=0;P<h.length;P++){var x=!1,E=h[P][2].slice();(u||c)&&(E=E.slice(1,E.length-1)),c&&(x=x||this.polylineIntersectsRectangle(E,c)),(x=u?x||this.polylineIntersectsRectangle(E,u):x)||_.push(h[P])}(h=0!=_.length?_:h).length;for(var w=h[0][2].length,S=[],I=0;I<h.length;I++)h[I][2].length==w&&S.push(h[I]);for(var h=S,O=0,M=0;M<h.length;M++)this.scorePath(h[O][2])<this.scorePath(h[M][2])&&(O=M);return[h[O]]}},{key:"orthogonalPath",value:function orthogonalPath(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 lineIntersectsLine(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),n=t.startPoint.y-s*t.startPoint.x,i=e.startPoint.x,t.contains(i,s=s*i+n)&&e.contains(i,s);var n=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),i=t.startPoint.y-n*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(n==s)return i==r&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y));r=(r-i)/(n-s),s=n*r+i;return t.contains(r,s)&&e.contains(r,s)}},{key:"polylineIntersectsRectangle",value:function polylineIntersectsRectangle(t,e){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=[];i.push(new la(new ha(e.x1,e.y1),new ha(e.x2,e.y1))),i.push(new la(new ha(e.x2,e.y1),new ha(e.x2,e.y2))),i.push(new la(new ha(e.x2,e.y2),new ha(e.x1,e.y2))),i.push(new la(new ha(e.x1,e.y2),new ha(e.x1,e.y1)));for(var s=0;s<t.length-1;s++)for(var r=new la(t[s],t[s+1]),o=0;o<i.length;o++)if(this.lineIntersectsLine(r,i[o]))return!0;if(n)for(var a=new la(t[t.length-1],t[0]),l=0;l<i.length;l++)if(this.lineIntersectsLine(a,i[l]))return!0;return!1}},{key:"scorePath",value:function scorePath(t){if(t.length<=2)return-1;for(var e=0,n=1;n<t.length-1;n++)if(t[n-1].x==t[n].x&&t[n].x==t[n+1].x){if(this.signum(t[n+1].y-t[n].y)!=this.signum(t[n].y-t[n-1].y))return-1;e++}else if(t[n-1].y==t[n].y&&t[n].y==t[n+1].y){if(this.signum(t[n+1].x-t[n].x)!=this.signum(t[n].x-t[n-1].x))return-1;e++}else e--;return e}},{key:"signum",value:function signum(t){return 0<t?1:t<0?-1:0}},{key:"forwardPath",value:function forwardPath(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 distance(t,e){return Math.hypot(e.x-t.x,e.y-t.y)}},{key:"max",value:function max(t){if(0==t.lenght)return NaN;for(var e=t[0],n=0;n<t.length;n++)e<t[n]&&(e=t[n]);return e}},{key:"min",value:function min(t){if(0==t.lenght)return NaN;for(var e=t[0],n=0;n<t.length;n++)e>t[n]&&(e=t[n]);return e}},{key:"addDot",value:function addDot(t,e){throw new Error("Can NOT add dot to ICEVisioLink mannually.")}},{key:"rmDot",value:function rmDot(t){throw new Error("Can NOT remove dot from ICEVisioLink mannually.")}}],[{key:"arrangeParam",value:function arrangeParam(t){return mo(t.startPoint)&&(t.startPoint=[0,0]),mo(t.endPoint)&&(t.endPoint=[10,10]),t.points=[_toConsumableArray(t.startPoint),_toConsumableArray(t.endPoint)],_objectSpread2({escapeDistance:30},t)}}]),ICEVisioLink}(),ga=function(){_inherits(ICEIsogon,ca);var e=_createSuper(ICEIsogon);function ICEIsogon(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEIsogon),_objectSpread2({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,e.call(this,t)}return _createClass(ICEIsogon,[{key:"calcDots",value:function calcDots(){this.state.dots=[];for(var t=2*Math.PI/this.state.edges,e=this.state.radius,n=0;n<this.state.edges;n++){var i=t*n-toRadian(this.state.startAngle),s=Math.floor(e*Math.cos(i)+e),i=Math.floor(e*Math.sin(i)+e);this.state.dots.push([s,i])}return this.state.dots}},{key:"calcComponentParams",value:function calcComponentParams(){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 setState(t){mo(t.radius)?mo(t.width)?mo(t.height)||(t.radius=t.height/2):t.radius=t.width/2:(t.width=2*t.radius,t.height=2*t.radius),_get(_getPrototypeOf(ICEIsogon.prototype),"setState",this).call(this,t)}}]),ICEIsogon}(),Ca=function(){_inherits(ICERose,ca);var e=_createSuper(ICERose);function ICERose(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICERose),_objectSpread2({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,e.call(this,t)}return _createClass(ICERose,[{key:"calcDots",value:function calcDots(){var t=this.state.radius,e=this.state.leafNum;this.state.dots=[];for(var n,i,s=Math.PI/this.state.pointNumber,r=0;n=t+t*Math.sin(e*r)*Math.cos(r),i=t+t*Math.sin(e*r)*Math.sin(r),this.state.dots.push([n,i]),!((r+=s)>=2*Math.PI););return this.state.dots}},{key:"calcComponentParams",value:function calcComponentParams(){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 setState(t){mo(t.radius)?mo(t.width)?mo(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),_get(_getPrototypeOf(ICERose.prototype),"setState",this).call(this,t)}}]),ICERose}(),ma=function(){_inherits(ICEStar,ca);var e=_createSuper(ICEStar);function ICEStar(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEStar),_objectSpread2({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,e.call(this,t)}return _createClass(ICEStar,[{key:"calcDots",value:function calcDots(){this.state.dots=[];for(var t,e,n=toRadian(this.state.startAngle),i=Math.PI/this.state.spikes,s=this.state.outerRadius,r=this.state.innerRadius,o=0;o<this.state.spikes;o++)t=Math.cos(n)*s+s,e=Math.sin(n)*s+s,this.state.dots.push([t,e]),n+=i,t=Math.cos(n)*r+s,e=Math.sin(n)*r+s,this.state.dots.push([t,e]),n+=i;return this.state.dots}},{key:"calcComponentParams",value:function calcComponentParams(){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 setState(t){mo(t.outerRadius)?mo(t.width)?mo(t.height)||(t.outerRadius=t.height/2):t.outerRadius=t.width/2:(t.width=2*t.outerRadius,t.height=2*t.outerRadius),_get(_getPrototypeOf(ICEStar.prototype),"setState",this).call(this,t)}}]),ICEStar}(),ba="__ICE_UTILS_TEXT_MEASURE_DIV__",ka=function(){_inherits(ICEText,po);var e=_createSuper(ICEText);function ICEText(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEText),ICEText.arrangeParam(t));return(t=e.call(this,t)).measureText(),t}return _createClass(ICEText,[{key:"calcComponentParams",value:function calcComponentParams(){return this.dirty?this.measureText():{width:this.state.width,height:this.state.height}}},{key:"measureText",value:function measureText(t){var e;try{if(!(e=this.root.document.getElementById(ba))){(e=this.root.document.createElement("div")).setAttribute("id",ba);var n,i={visibility:"hidden",position:"absolute",top:"0",left:"0",padding:"0",margin:"0",border:"none",fontFamily:this.state.style.fontFamily,fontWeight:this.state.style.fontWeight,fontSize:this.state.style.fontSize+"px"};for(n in i)e.style[n]=i[n];e.contenteditable=!1,this.root.document.body.appendChild(e)}e.innerHTML=this.state.text;var s=this.state.style,r=s.paddingTop,o=s.paddingBottom,a=s.paddingLeft,l=s.paddingRight,h={width:e.offsetWidth+a+l,height:e.offsetHeight+r+o};return this.props.width=h.width,this.props.height=h.height,this.state.width=h.width,this.state.height=h.height,{width:this.state.width,height:this.state.height}}catch(t){}}},{key:"doRender",value:function doRender(){this.dirty&&this.measureText();var t=this.state.style,e=(t.paddingTop,t.paddingBottom),n=t.paddingLeft;t.paddingRight,this.state.stroke&&this.ctx.strokeText(this.state.text,0-this.state.localOrigin[0]+n,0-this.state.localOrigin[1]+this.state.height-e,this.state.width),this.state.fill&&this.ctx.fillText(this.state.text,0-this.state.localOrigin[0]+n,0-this.state.localOrigin[1]+this.state.height-e,this.state.width),_get(_getPrototypeOf(ICEText.prototype),"doRender",this).call(this)}}],[{key:"arrangeParam",value:function arrangeParam(t){t=Ui({text:"",left:0,top:0,width:10,height:10,style:{fontWeight:"bold",fontSize:32,fontFamily:"Arial",lineWidth:1,textBaseline:"bottom",paddingTop:0,paddingBottom:0,paddingLeft:0,paddingRight:0}},t);return t.style=_objectSpread2(_objectSpread2({},t.style),{},{font:"".concat(t.style.fontWeight," ").concat(t.style.fontSize,"px ").concat(t.style.fontFamily)}),t}}]),ICEText}(),_a={ICERect:yo,ICECircle:ko,ICEEllipse:bo,ICEStar:ma,ICEIsogon:ga,ICEText:ka,ICEImage:da,ICEGroup:go,ICEVisioLink:ya,ICEPolyLine:va},Pa={evtBuses:[],stopped:!1,frameCallback:function frameCallback(){for(var t=0;t<Pa.evtBuses.length;t++){if(Pa.stopped)return;Pa.evtBuses[t].trigger(x)}Pa.stopped||Zs.requestFrame(Pa.frameCallback)},start:function start(){Pa.stopped=!1,Zs.requestFrame(Pa.frameCallback)},stop:function stop(){Pa.stopped=!0},pause:function pause(){},resume:function resume(){},regitserEvtBus:function regitserEvtBus(t){Pa.evtBuses.includes(t)||Pa.evtBuses.push(t)},delEvtBus:function delEvtBus(t){Pa.evtBuses.includes(t)&&Pa.evtBuses.splice(Pa.evtBuses.indexOf(t),1)}},xa=function(){function ICELinkSlotManager(t){_classCallCheck(this,ICELinkSlotManager),_defineProperty$1(this,"slotRadius",10),this.ice=t}return _createClass(ICELinkSlotManager,[{key:"start",value:function start(){return this.createLinkSlots(),this.ice.evtBus.on(j,this.hookMouseMoveHandler,this),this.ice.evtBus.on(B,this.hookMouseUpHandler,this),this.ice.evtBus.on("mouseup",this.globalMouseUpHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off(j,this.hookMouseMoveHandler,this),this.ice.evtBus.off(B,this.hookMouseUpHandler,this),this.ice.evtBus.off("mouseup",this.globalMouseUpHandler,this),this}},{key:"hookMouseMoveHandler",value:function hookMouseMoveHandler(t){for(var e=t.target,n=e.getMaxBoundingBox(),i=_toConsumableArray(this.ice.childNodes),s=0;s<i.length;s++){var r=i[s];if(r&&r.state.linkable&&r.getMaxBoundingBox().isIntersect(n)){this.collision=r;break}}if(this.collision){for(var o=!1,a=0;a<this.ice._linkSlots.length;a++){var l=this.ice._linkSlots[a];l.hostComponent!==this.collision&&(l.hostComponent=this.collision),l.setState({display:!0,style:{fillStyle:"#3ce92c"}}),e.setState({style:{fillStyle:"#3ce92c"}}),l.getMaxBoundingBox().isIntersect(n)&&(o=!0,l.setState({style:{fillStyle:"#fffb00"}}))}o&&e.setState({style:{fillStyle:"#fffb00"}})}else{for(var h=0;h<this.ice._linkSlots.length;h++)this.ice._linkSlots[h].setState({display:!1,style:{fillStyle:"#3ce92c"}});e.setState({style:{fillStyle:"#3ce92c"}})}}},{key:"hookMouseUpHandler",value:function hookMouseUpHandler(t){var t=t.target,e=t.state.position,n=t.parentNode.targetComponent,i=t.getMaxBoundingBox(),s=!1;if(this.collision)for(var r=0;r<this.ice._linkSlots.length;r++){var o=this.ice._linkSlots[r];if(o.setState({display:!1,style:{fillStyle:"#3ce92c"}}),o.getMaxBoundingBox().isIntersect(i)){var s=!0,a={};a[e]={id:o.hostComponent.state.id,position:o.state.position},n&&n.setState({links:a});break}}s?t.setState({display:!1,style:{fillStyle:"#3ce92c"}}):((t={})[e]=null,n&&n.setState({links:t})),this.collision=null}},{key:"globalMouseUpHandler",value:function globalMouseUpHandler(t){for(var e=0;e<this.ice._linkSlots.length;e++)this.ice._linkSlots[e].setState({display:!1,style:{fillStyle:"#3ce92c"}})}},{key:"createLinkSlots",value:function createLinkSlots(){var t,e,n,i,s;this.ice._linkSlots&&this.ice._linkSlots.length||(t=new pa({zIndex:10000010,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"T",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(t),e=new pa({zIndex:10000011,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"R",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(e),n=new pa({zIndex:10000012,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"B",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(n),i=new pa({zIndex:10000013,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"L",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(i),s=new pa({zIndex:10000014,display:!1,transformable:!1,draggable:!1,radius:this.slotRadius,position:"C",style:{strokeStyle:"#0c09d4",fillStyle:"#3ce92c",lineWidth:1}}),this.ice.addTool(s),this.ice._linkSlots=[t,e,n,i,s])}}]),ICELinkSlotManager}(),Ea=function(){function Deserializer(t){_classCallCheck(this,Deserializer),this.ice=t}return _createClass(Deserializer,[{key:"fromJSONObject",value:function fromJSONObject(t){for(var e=t.childNodes,n=0;n<e.length;n++)this.decodeRecursively(this.ice,e[n])}},{key:"fromJSONString",value:function fromJSONString(t){t=JSON.parse(t);this.fromJSONObject(t)}},{key:"decodeRecursively",value:function decodeRecursively(t,e){var n=new(this.ice.getType(e.type))(e.state),i=(t.addChild(n),e.childNodes);if(i&&i.length)for(var s=0;s<i.length;s++)this.decodeRecursively(n,i[s])}}]),Deserializer}(),wa=function(){function Serializer(t){_classCallCheck(this,Serializer),this.ice=t}return _createClass(Serializer,[{key:"toJSONString",value:function toJSONString(){return JSON.stringify(this.toJSONObject())}},{key:"toJSONObject",value:function toJSONObject(){for(var t={createTime:(new Date).toLocaleString(),lastModifyTime:(new Date).toLocaleString(),childNodes:[]},e=0;e<this.ice.childNodes.length;e++){var n=this.ice.childNodes[e];this.encodeRecursively(n,t)}return t}},{key:"encodeRecursively",value:function encodeRecursively(t,e){var n={state:t.state,type:t.constructor.name,childNodes:[]};if(e.childNodes.push(n),t.childNodes&&t.childNodes.length)for(var i=0;i<t.childNodes.length;i++)this.encodeRecursively(t.childNodes[i],n)}}]),Serializer}(),Sa=function(){_inherits(CanvasRenderer,co);var n=_createSuper(CanvasRenderer);function CanvasRenderer(t){var e;return _classCallCheck(this,CanvasRenderer),_defineProperty$1(_assertThisInitialized(e=n.call(this)),"stopped",!1),_defineProperty$1(_assertThisInitialized(e),"componentQueue",[]),_defineProperty$1(_assertThisInitialized(e),"toolsQueue",[]),e.ice=t,e}return _createClass(CanvasRenderer,[{key:"start",value:function start(){return this.stopped=!1,this.ice.evtBus.on(x,this.frameEvtHandler,this),this}},{key:"stop",value:function stop(){return this.stopped=!0,this.ice.evtBus.off(x,this.frameEvtHandler,this),this}},{key:"frameEvtHandler",value:function frameEvtHandler(t){this.ice.dirty&&this.doRender()}},{key:"refreshQueue",value:function refreshQueue(){this.componentQueue=flattenTree([],this.ice.childNodes),this.componentQueue.sort(function(t,e){return t.state.zIndex-e.state.zIndex}),this.toolsQueue=flattenTree([],this.ice.toolNodes),this.toolsQueue.sort(function(t,e){return t.state.zIndex-e.state.zIndex})}},{key:"doRender",value:function doRender(){this.refreshQueue(),this.ice.ctx.clearRect(0,0,this.ice.canvasWidth,this.ice.canvasHeight);for(var t=0;t<this.componentQueue.length;t++){var e=this.componentQueue[t];e.root=this.ice.root,e.ctx=this.ice.ctx,e.evtBus=this.ice.evtBus,e.ice=this.ice,e.render()}for(var n=0;n<this.toolsQueue.length;n++){var i=this.toolsQueue[n];i.root=this.ice.root,i.ctx=this.ice.ctx,i.evtBus=this.ice.evtBus,i.ice=this.ice,i.render()}this.ice.dirty=!1,this.ice.evtBus.trigger(M)}}]),CanvasRenderer}(),Ia=function(){function ImageCache(t){_classCallCheck(this,ImageCache),_defineProperty$1(this,"imageCache",new Map),this.ice=t}return _createClass(ImageCache,[{key:"setImage",value:function setImage(t){var e=this,n=this.imageCache.get(t);return n||((n=new Image).onload=function(){e.ice.dirty=!0},n.onerror=function(){},n.src=t,this.imageCache.size>ImageCache.CACHE_SIZE&&this.imageCache.delete(this.imageCache.keys().next().value),this.imageCache.set(t,n)),{loaded:this.loaded(n),image:n}}},{key:"loaded",value:function loaded(t){return t.complete&&0<t.naturalWidth}}]),ImageCache}(),Oa=(_defineProperty$1(Ia,"CACHE_SIZE",100),function(){function ICE(){_classCallCheck(this,ICE),_defineProperty$1(this,"childNodes",[]),_defineProperty$1(this,"toolNodes",[]),_defineProperty$1(this,"canvasWidth",0),_defineProperty$1(this,"canvasHeight",0),_defineProperty$1(this,"selectionList",[]),_defineProperty$1(this,"typeMapping",{}),_defineProperty$1(this,"__dirty",!0),_defineProperty$1(this,"_lastUpdateTime",Date.now())}return _createClass(ICE,[{key:"init",value:function init(t){if(!t)throw new Error("ICE.init() failed...");if(this.ctx===t)throw new Error("同一个 canvas 实例只能 init 一次...");for(var e in _a)this.typeMapping[e]=_a[e];return this.root=Zs,_(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 aa,Pa.regitserEvtBus(this.evtBus),Pa.start(),oa.regitserEvtBus(this.evtBus),oa.start(),this.eventDispatcher=new sa(this).start(),this.animationManager=new H(this).start(),this.controlPanelManager=new na(this).start(),this.renderer=new Sa(this).start(),this.linkSlotManager=new xa(this).start(),this.serializer=new wa(this),this.deserializer=new Ea(this),this.imageCache=new Ia(this),this}},{key:"addTool",value:function addTool(t){-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(S,null,{component:t}),t.trigger(S),t.ice=this,t.ctx=this.ctx,t.evtBus=this.evtBus,this.toolNodes.push(t),this.dirty=!0,this.evtBus.trigger(I,null,{component:t}),t.trigger(I))}},{key:"removeTool",value:function removeTool(t){this.evtBus.trigger(O,null,{component:t}),t.destory(),this.toolNodes.splice(this.toolNodes.indexOf(t),1),this.dirty=!0}},{key:"addChild",value:function addChild(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(S,null,{component:t}),t.trigger(S),t.ice=this,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(I,null,{component:t}),t.trigger(I))}},{key:"addChildren",value:function addChildren(t){for(var e=0;e<t.length;e++)this.addChild(t[e],!1);this.dirty=!0}},{key:"removeChild",value:function removeChild(t){var e=!(1<arguments.length&&void 0!==arguments[1])||arguments[1];this.evtBus.trigger(O,null,{component:t}),t.destory(),this.childNodes.splice(this.childNodes.indexOf(t),1),this.dirty=e}},{key:"removeChildren",value:function removeChildren(t){for(var e=0;e<t.length;e++)this.removeChild(t[e],!1);this.dirty=!0}},{key:"clearAll",value:function clearAll(){this.removeChildren(_toConsumableArray(this.childNodes))}},{key:"findComponent",value:function findComponent(e){return this.childNodes.filter(function(t){return t.props.id===e})[0]}},{key:"dirty",get:function get(){return this.__dirty},set:function set(t){this.__dirty=t}},{key:"registerType",value:function registerType(t,e){this.typeMapping[t]=e}},{key:"getType",value:function getType(t){return this.typeMapping[t]}},{key:"toJSONString",value:function toJSONString(){return this.serializer.toJSONString()}},{key:"toJSONObject",value:function toJSONObject(){return this.serializer.toJSONObject()}},{key:"fromJSONObject",value:function fromJSONObject(t){var e=this;Pa.stop(),this.renderer.stop(),this.eventDispatcher.stopped=!0,this.animationManager.stop(),this.controlPanelManager.stop(),this.linkSlotManager.stop(),this.clearAll(),this.deserializer.fromJSONObject(t),Pa.start(),this.renderer.start(),this.animationManager.start(),this.controlPanelManager.start(),this.linkSlotManager.start(),setTimeout(function(){e.eventDispatcher.stopped=!1},300)}},{key:"fromJSONString",value:function fromJSONString(t){t=JSON.parse(t);this.fromJSONObject(t)}}]),ICE}());exports.AnimationManager=H,exports.CanvasRenderer=Sa,exports.DOMEventDispatcher=sa,exports.DOMEventInterceptor=oa,exports.EventBus=aa,exports.GeoLine=la,exports.GeoPoint=ha,exports.GeoUtil=uo,exports.ICE=Oa,exports.ICEBezier=fa,exports.ICEBoundingBox=fo,exports.ICECircle=ko,exports.ICEComponent=po,exports.ICEControlPanel=Co,exports.ICEControlPanelManager=na,exports.ICEDotPath=ca,exports.ICEEllipse=bo,exports.ICEEventTarget=co,exports.ICEGroup=go,exports.ICEImage=da,exports.ICEIsogon=ga,exports.ICELinkHook=_o,exports.ICELinkSlot=pa,exports.ICEPath=vo,exports.ICEPolyLine=va,exports.ICERect=yo,exports.ICERose=Ca,exports.ICEStar=ma,exports.ICEText=ka,exports.ICEVisioLink=ya,exports.LineControlPanel=Po,exports.ResizeControl=Yo,exports.RotateControl=ta,exports.TransformControlPanel=ea;