ice-render 0.0.41 → 0.0.44

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/dist/index.umd.js CHANGED
@@ -22,4 +22,4 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ICE={})}(this,function(e){"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){e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n}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 _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 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)}(this,i?(t=_getPrototypeOf(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function _get(){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,e,n){var i=function _superPropBase(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf(t)););return t}(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}function r(t){return S.call(t)}function t(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(B&&B in Object(t)?M:r)(t)}function v(t){return null!=t&&"object"==typeof t}function z(t){return"string"==typeof t||!T(t)&&j(t)&&"[object String]"==L(t)}function A(t){return void 0===t}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n="object"==typeof n&&n&&n.Object===Object&&n,i="object"==typeof self&&self&&self.Object===Object&&self,i=n||i||Function("return this")(),s=i.Symbol,o=Object.prototype,x=o.hasOwnProperty,w=o.toString,I=s?s.toStringTag:void 0,S=Object.prototype.toString,M=function getRawTag$1(t){var e=x.call(t,I),n=t[I];try{var i=!(t[I]=void 0)}catch(t){}var s=w.call(t);return i&&(e?t[I]=n:delete t[I]),s},B=s?s.toStringTag:void 0,o=Array.isArray,L=t,T=o,j=v,R="ICE_FRAME_EVENT",D="BEFORE_RENDER",H="AFTER_RENDER",N="BEFORE_ADD",V="AFTER_ADD",F="BEFORE_REMOVE",X="ROUND_FINISH",q="HOOK_MOUSEDOWN",$="HOOK_MOUSEMOVE",G="HOOK_MOUSEUP",K="BEFORE_RESIZE",h="AFTER_RESIZE",J="AFTER_ROTATE",a="AFTER_MOVE",Q={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}},Z=(_createClass(AnimationManager,[{key:"start",value:function start(){return this.ice.evtBus.on(R,this.frameEventHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off(R,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 o=i[e];if(o.finished){if(++s===Object.keys(i).length){this.remove(t);break}}else{var r=o.from,a=o.to,l=o.duration,r=(A(o.startTime)&&(o.startTime=Date.now()),A(o.easing)&&(o.easing="linear"),Q[o.easing](r,a,l,o.startTime));a<r&&(r=a,o.finished=!0),n[e]=Math.floor(r)}}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){z(t)?this.animationMap.delete(t):this.animationMap.delete(t.props.id)}}]),AnimationManager);function AnimationManager(t){_classCallCheck(this,AnimationManager),_defineProperty$1(this,"animationMap",new Map),this.ice=t}function U(t,e){return t===e||t!=t&&e!=e}function W(t,e){for(var n=t.length;n--;)if(Y(t[n][0],e))return n;return-1}function ba(t){var e=this.__data__;return!((t=tt(e,t))<0||(t==e.length-1?e.pop():et.call(e,t,1),--this.size,0))}function ca(t){var e=this.__data__;return(t=nt(e,t))<0?void 0:e[t][1]}function da(t){return-1<it(this.__data__,t)}function ea(t,e){var n=this.__data__,i=st(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}var Y=U,tt=W,et=Array.prototype.splice,nt=W,it=W,st=W;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=function listCacheClear$1(){this.__data__=[],this.size=0},ListCache$4.prototype.delete=ba,ListCache$4.prototype.get=ca,ListCache$4.prototype.has=da,ListCache$4.prototype.set=ea;function ha(){this.__data__=new ot,this.size=0}function ia(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t}function ja(t){return this.__data__.get(t)}function ka(t){return this.__data__.has(t)}function la(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function pa(t){return!!at(t)&&("[object Function]"==(t=rt(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function ua(t){if(null!=t){try{return ht.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Fa(t){return!(!dt(t)||ut(t))&&(ct(t)?yt:ft).test(pt(t))}function Ga(t,e){return null==t?void 0:t[e]}function Ha(t,e){return t=Ga(t,e),Fa(t)?t:void 0}function Ua(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t}function Va(t){var e,n=this.__data__;return gt?"__lodash_hash_undefined__"===(e=n[t])?void 0:e:Ct.call(n,t)?n[t]:void 0}function Wa(t){var e=this.__data__;return mt?void 0!==e[t]:bt.call(e,t)}function Xa(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=kt&&void 0===e?"__lodash_hash_undefined__":e,this}var l=ListCache$4,ot=l,rt=t,at=la,c=i["__core-js_shared__"],lt=(c=/[^.]+$/.exec(c&&c.keys&&c.keys.IE_PROTO||""))?"Symbol(src)_1."+c:"",ht=Function.prototype.toString,ct=pa,ut=function isMasked$1(t){return!!lt&&lt in t},dt=la,pt=ua,ft=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,c=c.toString,u=u.hasOwnProperty,yt=RegExp("^"+c.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),c=Ha(i,"Map"),u=Ha(Object,"create"),vt=u,gt=u,Ct=Object.prototype.hasOwnProperty,mt=u,bt=Object.prototype.hasOwnProperty,kt=u;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=function hashClear$1(){this.__data__=vt?vt(null):{},this.size=0},Hash$1.prototype.delete=Ua,Hash$1.prototype.get=Va,Hash$1.prototype.has=Wa,Hash$1.prototype.set=Xa;function _a(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function a0(t,e){return t=t.__data__,_a(e)?t["string"==typeof e?"string":"hash"]:t.map}function g0(t){return t=xt(this,t).delete(t),this.size-=t?1:0,t}function h0(t){return wt(this,t).get(t)}function i0(t){return It(this,t).has(t)}function j0(t,e){var n=St(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}var _t=Hash$1,Pt=l,Et=c,xt=a0,wt=a0,It=a0,St=a0;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=function mapCacheClear$1(){this.size=0,this.__data__={hash:new _t,map:new(Et||Pt),string:new _t}},MapCache$1.prototype.delete=g0,MapCache$1.prototype.get=h0,MapCache$1.prototype.has=i0,MapCache$1.prototype.set=j0;function s0(t,e){var n=this.__data__;if(n instanceof Mt){var i=n.__data__;if(!Ot||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new At(i)}return n.set(t,e),this.size=n.size,this}var Mt=l,Ot=c,At=MapCache$1,Bt=l,u=ia,l=ja,Lt=ka;function Stack$1(t){t=this.__data__=new Bt(t);this.size=t.size}Stack$1.prototype.clear=ha,Stack$1.prototype.delete=u,Stack$1.prototype.get=l,Stack$1.prototype.has=Lt,Stack$1.prototype.set=s0;function x0(t,e,n){"__proto__"==e&&Rt?Rt(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function A0(t,e,n){(void 0===n||Dt(t[e],n))&&(void 0!==n||e in t)||zt(t,e,n)}function E0(t){var e=new t.constructor(t.byteLength);return new Nt(e).set(new Nt(t)),e}function F0(t,e){return e=e?E0(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.length)}function G0(t,e){var n=-1,i=t.length;for(e=e||Array(i);++n<i;)e[n]=t[n];return e}var Tt,u=Stack$1,jt=Ha,l=function(){try{var t=jt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Rt=l,zt=x0,Dt=U,Lt=function createBaseFor$1(l){return function(t,e,n){for(var i=-1,s=Object(t),o=n(t),r=o.length;r--;){var a=o[l?r:++i];if(!1===e(s[a],a,s))break}return t}}(),Ht={exports:{}},Nt=(d=(d=(f=Ht).exports)&&!d.nodeType&&d,p=(p=d&&f&&!f.nodeType&&f)&&p.exports===d?i.Buffer:void 0,Tt=p?p.allocUnsafe:void 0,f.exports=function cloneBuffer(t,e){if(e)return t.slice();e=t.length,e=Tt?Tt(e):new t.constructor(e);return t.copy(e),e},i.Uint8Array),Vt=la,Ft=Object.create;function object(){}function K0(e,n){return function(t){return e(n(t))}}function N0(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Ut)}function R0(t){return"function"!=typeof t.constructor||Gt(t)?{}:$t(Wt(t))}function U0(t){return Jt(t)&&"[object Arguments]"==Kt(t)}function $0(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991}function bb(t){return null!=t&&ee(t.length)&&!te(t)}function eb(t){return ie(t)&&ne(t)}function pb(t){return!(!re(t)||"[object Object]"!=se(t))&&(null===(t=oe(t))||"function"==typeof(t=le.call(t,"constructor")&&t.constructor)&&t instanceof t&&ae.call(t)==he)}function ub(t){return de(t)&&ue(t.length)&&!!C[ce(t)]}function vb(e){return function(t){return e(t)}}function Cb(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function Gb(t,e,n){var i=t[e];ye.call(t,e)&&fe(i,n)&&(void 0!==n||e in t)||pe(t,e,n)}function Kb(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&ge.test(t))&&-1<t&&t%1==0&&t<e}function Lb(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}function Yb(t){if(!Ee(t))return we(t);var e,n=xe(t),i=[];for(e in t)("constructor"!=e||!n&&Ie.call(t,e))&&i.push(e);return i}function $b(t){return Me(t)?Se(t,!0):Yb(t)}function t1(t,e,n,i,s,o,r){var a,l,h,c=Ue(t,n),u=Ue(e,n),d=r.get(u);d?Be(t,n,d):((e=void 0===(d=o?o(c,u,n+"",t,e,r):void 0))&&(l=!(a=De(u))&&Ne(u),h=!a&&!l&&qe(u),d=u,a||l||h?d=De(c)?c:He(c)?je(c):l?Le(u,!(e=!1)):h?Te(u,!(e=!1)):[]:Xe(u)||ze(u)?ze(d=c)?d=$e(c):Fe(c)&&!Ve(c)||(d=Re(u)):e=!1),e&&(r.set(u,d),s(d,u,i,o,r),r.delete(u)),Be(t,n,d))}function y1(t){return t}function z1(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)}function C1(t){return function(){return t}}function O1(t,e){return rn(sn(t,e,nn),t+"")}function P1(t,e,n){if(!cn(n))return!1;var i=typeof e;return!!("number"==i?ln(n)&&hn(e,n.length):"string"==i&&e in n)&&an(n[e],t)}var Xt,qt,d=K0(Object.getPrototypeOf,Object),Ut=Object.prototype,$t=function(t){if(!Vt(t))return{};if(Ft)return Ft(t);object.prototype=t;t=new object;return object.prototype=void 0,t},Wt=d,Gt=N0,Kt=t,Jt=v,Qt=v,p=Object.prototype,Zt=p.hasOwnProperty,Yt=p.propertyIsEnumerable,f=U0(function(){return arguments}())?U0:function(t){return Qt(t)&&Zt.call(t,"callee")&&!Yt.call(t,"callee")},te=pa,ee=$0,ne=bb,ie=v,p={exports:{}},se=(m=(m=(g=p).exports)&&!m.nodeType&&m,y=(y=m&&g&&!g.nodeType&&g)&&y.exports===m?i.Buffer:void 0,m=(y?y.isBuffer:void 0)||function stubFalse(){return!1},g.exports=m,t),oe=d,re=v,y=Function.prototype,g=Object.prototype,ae=y.toString,le=g.hasOwnProperty,he=ae.call(Object),ce=t,ue=$0,de=v,C={},m=(C["[object Float32Array]"]=C["[object Float64Array]"]=C["[object Int8Array]"]=C["[object Int16Array]"]=C["[object Int32Array]"]=C["[object Uint8Array]"]=C["[object Uint8ClampedArray]"]=C["[object Uint16Array]"]=C["[object Uint32Array]"]=!0,C["[object Arguments]"]=C["[object Array]"]=C["[object ArrayBuffer]"]=C["[object Boolean]"]=C["[object DataView]"]=C["[object Date]"]=C["[object Error]"]=C["[object Function]"]=C["[object Map]"]=C["[object Number]"]=C["[object Object]"]=C["[object RegExp]"]=C["[object Set]"]=C["[object String]"]=C["[object WeakMap]"]=!1,{exports:{}}),g=(y=(y=(d=m).exports)&&!y.nodeType&&y,Xt=y&&d&&!d.nodeType&&d,qt=Xt&&Xt.exports===y&&n.process,y=function(){try{return Xt&&Xt.require&&Xt.require("util").types||qt&&qt.binding&&qt.binding("util")}catch(t){}}(),d.exports=y,ub),n=vb,d=m.exports,y=d&&d.isTypedArray,m=y?n(y):g,pe=x0,fe=U,ye=Object.prototype.hasOwnProperty,ve=x0,ge=/^(?:0|[1-9]\d*)$/,Ce=f,me=o,be=p.exports,ke=Kb,_e=m,Pe=Object.prototype.hasOwnProperty,Ee=la,xe=N0,we=function nativeKeysIn$1(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},Ie=Object.prototype.hasOwnProperty,Se=function arrayLikeKeys$1(t,e){var n,i=me(t),s=!i&&Ce(t),o=!i&&!s&&be(t),r=!i&&!s&&!o&&_e(t),a=i||s||o||r,l=a?Lb(t.length,String):[],h=l.length;for(n in t)!e&&!Pe.call(t,n)||a&&("length"==n||o&&("offset"==n||"parent"==n)||r&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||ke(n,h))||l.push(n);return l},Me=bb,Oe=function copyObject$1(t,e,n,i){var s=!n;n=n||{};for(var o=-1,r=e.length;++o<r;){var a=e[o],l=i?i(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),(s?ve:Gb)(n,a,l)}return n},Ae=$b,Be=A0,Le=Ht.exports,Te=F0,je=G0,Re=R0,ze=f,De=o,He=eb,Ne=p.exports,Ve=pa,Fe=la,Xe=pb,qe=m,Ue=Cb,$e=function toPlainObject$1(t){return Oe(t,Ae(t))},We=u,Ge=A0,Ke=Lt,Je=la,Qe=$b,Ze=Cb,Ye=Math.max,tn=l,en=Date.now,d=function shortOut$1(n){var i=0,s=0;return function(){var t=en(),e=16-(t-s);if(s=t,0<e){if(800<=++i)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(tn?function(t,e){return tn(t,"toString",{configurable:!0,enumerable:!1,value:C1(e),writable:!0})}:y1),nn=y1,sn=function overRest$1(o,r,a){return r=Ye(void 0===r?o.length-1:r,0),function(){for(var t=arguments,e=-1,n=Ye(t.length-r,0),i=Array(n);++e<n;)i[e]=t[r+e];for(var e=-1,s=Array(r+1);++e<r;)s[e]=t[e];return s[r]=a(i),z1(o,this,s)}},rn=d,an=U,ln=bb,hn=Kb,cn=la,un=function baseMerge$1(i,s,o,r,a){i!==s&&Ke(s,function(t,e){var n;a=a||new We,Je(t)?t1(i,s,e,o,baseMerge$1,r,a):(n=r?r(Ze(i,e),t,e+"",i,s,a):void 0,Ge(i,e,n=void 0===n?t:n))},Qe)},dn=function createAssigner$1(a){return O1(function(t,e){var n=-1,i=e.length,s=1<i?e[i-1]:void 0,o=2<i?e[2]:void 0,s=3<a.length&&"function"==typeof s?(i--,s):void 0;for(o&&P1(e[0],e[1],o)&&(s=i<3?void 0:s,i=1),t=Object(t);++n<i;){var r=e[n];r&&a(t,r,n,s)}return t})}(function(t,e,n){un(t,e,n)}),pn="undefined"!=typeof Float32Array?Float32Array:Array,fn=Math.PI/180;function toRadian(t){return t*fn}function invert(t,e){var n=e[0],i=e[1],s=e[2],o=e[3],r=e[4],e=e[5],a=n*o-i*s;return a?(t[0]=o*(a=1/a),t[1]=-i*a,t[2]=-s*a,t[3]=n*a,t[4]=(s*e-o*r)*a,t[5]=(i*r-n*e)*a,t):null}function multiply(t,e,n){var i=e[0],s=e[1],o=e[2],r=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+o*h,t[1]=s*l+r*h,t[2]=i*c+o*u,t[3]=s*c+r*u,t[4]=i*d+o*n+a,t[5]=s*d+r*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 pn(2);pn!=Float32Array&&(t[0]=0,t[1]=0)}();var n=null,b=((n=window||global||{}).requestFrame=n.requestAnimationFrame||n.webkitRequestAnimationFrame||n.mozRequestAnimationFrame||n.oRequestAnimationFrame||n.msRequestAnimationFrame,n),k=(_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),y=K0(Object.keys,Object),yn=N0,vn=y,gn=Object.prototype.hasOwnProperty;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]}function _1(t){if(!yn(t))return vn(t);var e,n=[];for(e in Object(t))gn.call(t,e)&&"constructor"!=e&&n.push(e);return n}function wc(t){if(null==t)return!0;if(Mn(t)&&(Sn(t)||"string"==typeof t||"function"==typeof t.splice||On(t)||Bn(t)||In(t)))return!t.length;var e,n=wn(t);if("[object Map]"==n||"[object Set]"==n)return!t.size;if(An(t))return!xn(t).length;for(e in t)if(Ln.call(t,e))return!1;return!0}var g=Ha(i,"DataView"),Ht=c,u=Ha(i,"Promise"),Lt=Ha(i,"Set"),l=Ha(i,"WeakMap"),Cn=t,mn=ua,bn=mn(g),kn=mn(Ht),_n=mn(u),Pn=mn(Lt),En=mn(l),d=Cn,xn=((g&&"[object DataView]"!=d(new g(new ArrayBuffer(1)))||Ht&&"[object Map]"!=d(new Ht)||u&&"[object Promise]"!=d(u.resolve())||Lt&&"[object Set]"!=d(new Lt)||l&&"[object WeakMap]"!=d(new l))&&(d=function(t){var e=Cn(t),t="[object Object]"==e?t.constructor:void 0,t=t?mn(t):"";if(t)switch(t){case bn:return"[object DataView]";case kn:return"[object Map]";case _n:return"[object Promise]";case Pn:return"[object Set]";case En:return"[object WeakMap]"}return e}),_1),wn=d,In=f,Sn=o,Mn=bb,On=p.exports,An=N0,Bn=m,Ln=Object.prototype.hasOwnProperty,n=(_createClass(ICEEventTarget,[{key:"on",value:function on(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:b;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]:b;if(i=this.listeners[t])for(var i=_toConsumableArray(i),s=0;s<i.length;s++){var o=i[s];if(o.callback===e&&o.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]:b,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(wc(this.listeners[t]))return!1;if(this.suspendedEventNames.includes(t))return!1;n?((e=new k(n)).originalEvent=n.originalEvent||n,e.param=_objectSpread2({},i)):e=new k({type:t,timeStamp:Date.now(),param:_objectSpread2({},i)});for(var s=this.listeners[t],o=0;o<s.length;o++){var r=s[o];r.callback.call(r.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]:b;if(!this.listeners[t])return!1;var i=this.listeners[t];if(!i)return!1;for(var s=0;s<i.length;s++){var o=i[s];if(o.callback===e&&o.scope===n)return!0}return!1}}]),ICEEventTarget);function ICEEventTarget(){_classCallCheck(this,ICEEventTarget),_defineProperty$1(this,"listeners",{}),_defineProperty$1(this,"suspendedEventNames",[])}n.prototype.addEventListener=n.prototype.on,n.prototype.removeEventListener=n.prototype.off,n.prototype.dispatchEvent=n.prototype.trigger;_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]}}]);var Tn=GeoUtil,jn=(_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 o=0,r=this.getBoundingLines(),a=0;a<r.length;a++){var l,h=r[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]&&o++}return 0!==o&&o%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],o=0;o<s.length;o++){var r=s[o];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{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],o=t.tl[0],r=t.br[0],a=t.tl[1],t=t.br[1];return!(r<e||t<i||n<o||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 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]]}function GeoUtil(){throw _classCallCheck(this,GeoUtil),new Error("GeoUtil is a static util class.")}function getVal(t,e){return e.split(".").reduce(function(t,e){return t[e]},t)}function flattenTree(t,e,n,i){for(var s=0<arguments.length&&void 0!==t?t:[],o=1<arguments.length&&void 0!==e?e:[],r=2<arguments.length&&void 0!==n?n:1,a=3<arguments.length&&void 0!==i?i:null,l=0;l<o.length;l++){var h=o[l];h._level=r,h._pid=a,s.push(h),flattenTree(s,h.childNodes||[],r+1,h.id)}return s}_inherits(ICEComponent,n),Rn=_createSuper(ICEComponent),_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(D),this.state.display&&(this.calcComponentParams(),this.applyStyleToCtx(),this.applyTransformToCtx(),this.doRender(),this.trigger(H),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 pn(6);return pn!=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],o=e[2],r=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]=o*n,t[3]=r*n,t[4]=a,t[5]=e,t}([],function rotate(t,e,n){var i=e[0],s=e[1],o=e[2],r=e[3],a=e[4],e=e[5],l=Math.sin(n),n=Math.cos(n);return t[0]=i*n+o*l,t[1]=s*n+r*l,t[2]=i*-l+o*n,t[3]=s*-l+r*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,e*fn,n*fn),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 jn([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 jn([n,i,s,i,n,e,s,e,t[0],t[1]])}},{key:"setState",value:function setState(t){dn(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 k;this.trigger("BEFORE_MOVE",_objectSpread2(_objectSpread2({},n),{},{left:t,top:e})),this.setState({left:t,top:e}),this.trigger(a,_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 k;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 k;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-=Tn.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 Tn.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(F,null,{component:this}),this.purgeEvents(),this.ice=null,this.ctx=null,this.root=null,this.evtBus=null,this.parentNode=null}}]);var Rn,y=ICEComponent;function ICEComponent(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEComponent),_defineProperty$1(_assertThisInitialized(t=Rn.call(this)),"__dirty",!0),_defineProperty$1(_assertThisInitialized(t),"props",{id:"ICE_"+function uuid(){if(b.crypto)return b.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)})}(),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=dn(t.props,e),t.state=dn({},t.props),t.root=b,t.initEvents(),t}_defineProperty$1(y,"instanceCounter",0);_inherits(ICEPath,y),Nn=_createSuper(ICEPath),_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)}}]);var zn,Dn,Hn,Nn,c=ICEPath,g=(_inherits(ICERect,c),Hn=_createSuper(ICERect),_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),Ht=(_inherits(ICEGroup,g),Dn=_createSuper(ICEGroup),_createClass(ICEGroup,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEGroup.prototype),"initEvents",this).call(this),this.once(V,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(N),t.ice=this.ice,t.ctx=this.ice.ctx,t.evtBus=this.ice.evtBus,t.trigger(V)}},{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){dn(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),u=(_inherits(ICEControlPanel,Ht),zn=_createSuper(ICEControlPanel),_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);function ICEControlPanel(t){return _classCallCheck(this,ICEControlPanel),_defineProperty$1(_assertThisInitialized(t=zn.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))),"isControlPanel",!0),t}function ICEGroup(t){return _classCallCheck(this,ICEGroup),_defineProperty$1(_assertThisInitialized(t=Dn.call(this,t)),"parentNode",null),_defineProperty$1(_assertThisInitialized(t),"childNodes",[]),t}function ICERect(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICERect),Hn.call(this,_objectSpread2({width:10,height:10},t))}function ICEPath(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEPath),_defineProperty$1(_assertThisInitialized(t=Nn.call(this,_objectSpread2({closePath:!0},t))),"path2D",new Path2D),t}function Fc(t){return null==t}_inherits(ICEEllipse,c),qn=_createSuper(ICEEllipse),_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){Fc(t.radiusX)?Fc(t.width)||(t.radiusX=t.width/2):t.width=2*t.radiusX,Fc(t.radiusY)?Fc(t.height)||(t.radiusY=t.height/2):t.height=2*t.radiusY,_get(_getPrototypeOf(ICEEllipse.prototype),"setState",this).call(this,t)}}]);var Vn,Fn,Xn,qn,Lt=ICEEllipse,l=(_inherits(ICECircle,Lt),Xn=_createSuper(ICECircle),_createClass(ICECircle)),Un=(_inherits(ICELinkHook,l),Fn=_createSuper(ICELinkHook),_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(a,this.resizeEvtHandler,this)}},{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){}},{key:"mosueDownHandler",value:function mosueDownHandler(t){this.evtBus.trigger(q,new k({target:this}))}},{key:"mosueMoveHandler",value:function mosueMoveHandler(t){this.evtBus.trigger($,new k({target:this}))}},{key:"mosueUpHandler",value:function mosueUpHandler(t){this.evtBus.trigger(G,new k({target:this}))}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){var e;this.parentNode&&(e=this.props.position,this.parentNode.trigger(K,new k(t,{position:e})),this.parentNode.trigger(h,new k(t,{position:e})))}}]),ICELinkHook),$n=(_inherits(LineControlPanel,u),Vn=_createSuper(LineControlPanel),_createClass(LineControlPanel,[{key:"initControls",value:function initControls(){var t=this.state.width,e=this.state.height,n=this.controlSize/2;this.startControl=new Un({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 Un({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(h,this.resizeEvtHandler,this)}},{key:"enable",value:function enable(){this.setState({display:!0}),this.resume(h),this.showHooks()}},{key:"disable",value:function disable(){this.setState({display:!1}),this.suspend(h),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,o=t.points[0][0],r=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":o+=n,r+=i;break;case"end":a+=n,l+=i}this.targetComponent.setState({startPoint:[o,r],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(a,this.updatePosition,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(a,this.updatePosition,this),this._targetComponent&&this._targetComponent.once(F,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),Wn=/\s/;function LineControlPanel(t){return _classCallCheck(this,LineControlPanel),_defineProperty$1(_assertThisInitialized(t=Vn.call(this,_objectSpread2(_objectSpread2({},t),{},{zIndex:10001e3,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"controlSize",16),t.initControls(),t}function ICELinkHook(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkHook),Fn.call(this,_objectSpread2({linkable:!1},t))}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,Xn.call(this,t)}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,qn.call(this,t)}function Pc(t){return"symbol"==typeof t||ui(t)&&"[object Symbol]"==ci(t)}function Qc(t){return t&&t.slice(0,li(t)+1).replace(hi,"")}function Xc(t){if("number"==typeof t)return t;if(pi(t))return NaN;if(di(t)&&(e="function"==typeof t.valueOf?t.valueOf():t,t=di(e)?e+"":e),"string"!=typeof t)return 0===t?t:+t;t=Qc(t);var e=yi.test(t);return e||vi.test(t)?gi(t.slice(2),e?2:8):fi.test(t)?NaN:+t}function Zc(t){return t?(t=Ci(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function e2(t){if("string"==typeof t)return t;if(bi(t))return mi(t,e2)+"";if(ki(t))return _i?_i.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function h2(t){return null==t?"":e2(t)}var Gn,Kn,Jn,Qn,Zn,Yn,ti,ei,ni,ii,si,oi,ri,ai,li=function trimmedEndIndex$1(t){for(var e=t.length;e--&&Wn.test(t.charAt(e)););return e},hi=/^\s+/,ci=t,ui=v,di=la,pi=Pc,fi=/^[-+]0x[0-9a-f]+$/i,yi=/^0b[01]+$/i,vi=/^0o[0-7]+$/i,gi=parseInt,Ci=Xc,mi=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},bi=o,ki=Pc,d=s?s.prototype:void 0,_i=d?d.toString:void 0,Pi=function toInteger$1(t){var t=Zc(t),e=t%1;return t==t?e?t-e:t:0},Ei=Xc,xi=i.isFinite,wi=Math.min,_=function createRound$1(t){var s=Math[t];return function(t,e){var n,i;return t=Ei(t),(e=null==e?0:wi(Pi(e),292))&&xi(t)?(n=(h2(t)+"e").split("e"),i=s(n[0]+"e"+(+n[1]+e)),+((n=(h2(i)+"e").split("e"))[0]+"e"+(+n[1]-e))):s(t)}}("round"),Ii=(_inherits(ResizeControl,g),ai=_createSuper(ResizeControl),_createClass(ResizeControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ResizeControl.prototype),"initEvents",this).call(this),this.on(a,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,o=s.left,r=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:o-=n,r+=i,a+=2*n,l-=2*i;break;case 2:o+=n,r+=i,a-=2*n,l-=2*i;break;case 3:o+=n,r-=i,a-=2*n,l+=2*i;break;case 4:o-=n,r-=i,a+=2*n,l+=2*i;break;case 5:r+=i,l-=2*i;break;case 6:r-=i,l+=2*i;break;case 7:o+=n,a-=2*n;break;case 8:o-=n,a+=2*n}s={top:r,left:o,width:Math.abs(a),height:Math.abs(l)};this.parentNode.trigger(K,new k(t,{quadrant:e})),this.parentNode.setState(s),this.parentNode.trigger(h,new k(t,{quadrant:e}))}}},{key:"moveGlobalPosition",value:function moveGlobalPosition(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new k,i=0<t?1:-1,s=0<e?1:-1,o=this.parentNode.state,r=o.localOrigin,a=o.width,l=o.height,o=transformMat2d([],[t,e],invert([],o.absoluteLinearMatrix)),o=(t=o[0],e=o[1],this.state),h=o.left,c=o.top,o=o.quadrant,u=this.state.width/2,d=0;"x"===this.state.direction?d=0<(h=0===_(h+=t)?.5*i:h)+u-r[0]?8:7:"y"===this.state.direction?d=0<(c=0===_(c+=e)?.5*s:c)+u-r[1]?6:5:"xy"===this.state.direction&&(s=-l/2/(s=0===_(s=-a/2)?.5*i:s),0===_(a=a/2)&&(a=.5*i),c+=e=2===o||4==o?s*(h+u-r[0]+t)-(c+u-r[1]):-l/2/a*(h+u-r[0]+t)-(c+u-r[1]),d=0<(h+=t)+u-r[0]?0<c+u-r[1]?4:1:0<c+u-r[1]?3:2),o!==d&&this.parentNode.toggleControlQuadrant(this,d),this.setPosition(h,c,new k(n,{left:h,top:c,tx:t,ty:e,quadrant:d}))}}]),ResizeControl),Si=(_inherits(RotateControl,l),ri=_createSuper(RotateControl),_createClass(RotateControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(RotateControl.prototype),"initEvents",this).call(this),this.on(a,this.rotateEvtHandler,this)}},{key:"rotateEvtHandler",value:function rotateEvtHandler(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteOrigin,t={transform:{rotate:Tn.calcRotateAngle(t.offsetX,t.offsetY,e[0],e[1])+90}},this.parentNode.trigger("BEFORE_ROTATE",new k(t)),this.parentNode.setState(t),this.parentNode.trigger(J,new k(t)))}}]),RotateControl),Mi=(_inherits(TransformControlPanel,u),oi=_createSuper(TransformControlPanel),_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,o=[{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 r=0;r<o.length;r++){var a=o[r],a=new Ii({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 Si({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(h,this.resizeEvtHandler,this),this.on(J,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(h),this.resume(J),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(h),this.suspend(J),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(J))}},{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,o=t.top,r=t.width,a=t.height,t=transformMat2d([],[n,i],invert([],t.absoluteLinearMatrix)),n=t[0],i=t[1];switch(e){case 1:s-=n,o+=i,r+=2*n,a-=2*i;break;case 2:s+=n,o+=i,r-=2*n,a-=2*i;break;case 3:s+=n,o-=i,r-=2*n,a+=2*i;break;case 4:s-=n,o-=i,r+=2*n,a+=2*i;break;case 5:o+=i,a-=2*i;break;case 6:o-=i,a+=2*i;break;case 7:s+=n,r-=2*n;break;case 8:s-=n,r+=2*n}this.targetComponent.setState({left:s,top:o,width:Math.abs(r),height:Math.abs(a)}),this.targetComponent.trigger(h)}}},{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,o=0;o<this.resizeControlInstanceCache.length;o++){var r=this.resizeControlInstanceCache[o],a=[0,0];switch(r.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]}r.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(a,this.updatePanel,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(a,this.updatePanel,this),this._targetComponent&&this._targetComponent.once(F,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),Oi=(_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),Ai=[["mousedown","ICE_MOUSEDOWN"],["mouseup","ICE_MOUSEUP"],["mousemove","ICE_MOUSEMOVE"],["click","ICE_CLICK"],["dbclick","ICE_DBCLICK"],["contextmenu","ICE_CONTEXTMENU"]],Bi=[["keydown","ICE_KEYDOWN"],["keyup","ICE_KEYUP"]],Li=(_createClass(DOMEventDispatcher,[{key:"start",value:function start(){for(var i=this,s=null,o=[].concat(_toConsumableArray(Ai),_toConsumableArray(Bi)),t=function _loop(t){var t=o[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))})},e=0;e<o.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.toolNodes),i=flattenTree([],this.ice.childNodes),s=[].concat(_toConsumableArray(t),_toConsumableArray(i));s.sort(function(t,e){return t.state.zIndex-e.state.zIndex});for(var o=0;o<s.length;o++){var r=s[o],a=r.state,l=a.interactive,a=a.display;r.containsPoint(e,n)&&l&&a&&this.selectionCandidates.push(r)}t=this.selectionCandidates.pop();return this.selectionCandidates=[],t}}]),DOMEventDispatcher),P={evtBuses:[],start:function start(){if(b&&b.addEventListener)for(var t=function _loop(t){for(var n=P.evtBuses[t],i=[].concat(_toConsumableArray(Ai),_toConsumableArray(Bi)),e=function _loop2(t){var e=i[t];b.addEventListener(e[0],function(t){n.trigger(e[1],t)})},s=0;s<i.length;s++)e(s)},e=0;e<P.evtBuses.length;e++)t(e)},regitserEvtBus:function regitserEvtBus(t){P.evtBuses.includes(t)||P.evtBuses.push(t)},delEvtBus:function delEvtBus(t){P.evtBuses.includes(t)&&P.evtBuses.splice(P.evtBuses.indexOf(t),1)}},Ti=(_inherits(EventBus,n),si=_createSuper(EventBus),_createClass(EventBus)),ji=(_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),O=(_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),f=(_inherits(ICEDotPath,c),ii=_createSuper(ICEDotPath),_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 o=this.state.dots[s];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[[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),p=(_inherits(ICEImage,y),ni=_createSuper(ICEImage),_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),m=_createClass(function ICEBezier(){_classCallCheck(this,ICEBezier)}),Ri=(_inherits(ICELinkSlot,l),ei=_createSuper(ICELinkSlot),_createClass(ICELinkSlot,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICELinkSlot.prototype),"initEvents",this).call(this),this.once(D,this.beforeRenderHandler,this),this.once(F,this.beforeRemoveHandler,this)}},{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){}},{key:"beforeRenderHandler",value:function beforeRenderHandler(t){this.evtBus.on(q,this.hookMouseDownHandler,this),this.evtBus.on($,this.hookMouseMoveHandler,this),this.evtBus.on(G,this.hookMouseUpHandler,this),this.evtBus.on("mouseup",this.globalMouseUpHandler,this)}},{key:"beforeRemoveHandler",value:function beforeRemoveHandler(t){this.evtBus.off(q,this.hookMouseDownHandler,this),this.evtBus.off($,this.hookMouseMoveHandler,this),this.evtBus.off(G,this.hookMouseUpHandler,this),this.evtBus.off("mouseup",this.globalMouseUpHandler,this),this.hostComponent=null}},{key:"globalMouseUpHandler",value:function globalMouseUpHandler(){this.setState({display:!1})}},{key:"hookMouseDownHandler",value:function hookMouseDownHandler(t){this._hostComponent&&this.setState({display:!0})}},{key:"hookMouseMoveHandler",value:function hookMouseMoveHandler(t){t=t.target;this.isIntersectWithHook(t)?(this.setState({style:{fillStyle:"#fffb00"}}),t._currentAboveSlot=this,t.setState({style:{fillStyle:"#fffb00"}})):(this.setState({style:{fillStyle:"#3ce92c"}}),t._currentAboveSlot===this&&t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"hookMouseUpHandler",value:function hookMouseUpHandler(t){var e,n;this._hostComponent&&(e=(t=t.target).parentNode.targetComponent,n=t.state.position,this.isIntersectWithHook(t)?e&&e.setLink(n,this._hostComponent,this.props.position):e&&e.removeLink(n,this._hostComponent,this.props.position),this.setState({display:!1,style:{fillStyle:"#3ce92c"}}),t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"isIntersectWithHook",value:function isIntersectWithHook(t){var e=this.getMaxBoundingBox(),t=t.getMaxBoundingBox();return!!e.isIntersect(t)}},{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(H,this.updatePosition,this),this._hostComponent=t,this._hostComponent&&this._hostComponent.on(H,this.updatePosition,this),this._hostComponent&&this._hostComponent.once(F,function(){e._hostComponent=null,e.setState({display:!1})},this),this._hostComponent&&this.setState({display:!0})}}]),ICELinkSlot),o=(_inherits(ICEPolyLine,f),ti=_createSuper(ICEPolyLine),_createClass(ICEPolyLine,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEPolyLine.prototype),"initEvents",this).call(this),this.once(V,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function afterAddHandler(t){this.evtBus.once(X,this.makeConnection,this)}},{key:"makeConnection",value:function makeConnection(){var t,e,n=this.state.links;n&&(n.start&&(t=n.start.id,e=n.start.position,t&&e&&(t=this.ice.findComponent(t),this.setLink("start",t,e))),n.end&&(t=n.end.id,e=n.end.position,t&&e&&(n=this.ice.findComponent(t),this.setLink("end",n,e)))),this.ice.dirty=!0}},{key:"setLink",value:function setLink(t,e,n){this.removeLink(t,e,n),this.links[t]={component:e,position:n},e.on(a,this.followComponent,this),e.on(h,this.followComponent,this),e.on(J,this.followComponent,this),e.once(H,this.followComponent,this),this.followComponent();var i,s={};for(i in this.links){var o=this.links[i];o.component&&o.position&&(s[i]={id:o.component.props.id,position:o.position})}this.setState({links:_objectSpread2({},s),draggable:!1})}},{key:"removeLink",value:function removeLink(t,e,n){var i=this.links[t].component,s=this.links[t].position;i===e&&s===n&&(i&&i.off(a,this.followComponent,this),i&&i.off(h,this.followComponent,this),i&&i.off(J,this.followComponent,this),this.links[t]={},this.state.links[t]={}),this.links.start.component||this.links.end.component||this.setState({draggable:!0})}},{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.links){var n=this.links[e].position,i=this.links[e].component;if(n&&i){var s=i.getMinBoundingBox(),o=[0,0];switch(n){case"T":o=s.tc;break;case"R":o=s.rc;break;case"B":o=s.bc;break;case"L":o=s.lc}switch(e){case"start":this.setState({startPoint:_toConsumableArray(o)});break;case"end":this.setState({endPoint:_toConsumableArray(o)})}}}}},{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),o=this.state.arrowLength*(n*i-t*s),r=this.state.arrowLength*(t*i+n*s),a=this.state.arrowLength*(n*i+t*s),t=this.state.arrowLength*(t*i-n*s);return[[o+=e[0],r+=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=_(this.state.points[0][0],2),i=_(this.state.points[0][1],2),s=0,o=[_(this.state.points[e-1][0],2)-n,_(this.state.points[e-1][1],2)-i],r=0;r<e;r++){var a=this.state.points[r],a=[a[0]-n,a[1]-i];0===(a=o[0]*a[1]-o[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=_(s,3)),0+(n=_(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 jn([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(Fc(t.width)||delete t.width,Fc(t.height)||delete t.height,Fc(t.transform)||delete t.transform,!Fc(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(!Fc(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 o;Fc(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]),Fc(t.endPoint)||(o=this.state.points.length,this.state.points[o-1]=_toConsumableArray(t.endPoint)),_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],Tn.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],o=s.o[0],r=s.o[1],a=s.d[0],s=s.d[1],l=Math.hypot(a-o,s-r),o=Math.hypot(o-t,r-e),r=Math.hypot(a-t,s-e);if(l-3<=o+r&&o+r<=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.links.start&&this.removeLink("start",this.links.start.component,this.links.start.position),this.links.end&&this.removeLink("end",this.links.end.component,this.links.end.position),_get(_getPrototypeOf(ICEPolyLine.prototype),"destory",this).call(this)}}],[{key:"arrangeParam",value:function arrangeParam(t){var e=dn({},{lineType:"solid",lineWidth:1,arrow:"none",arrowLength:15,arrowAngel:30*fn,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),s=(_inherits(ICEVisioLink,o),Yn=_createSuper(ICEVisioLink),_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 o=0;o<s.length;o++){var r=s[o];this.state.points.push([r.x,r.y]),this.state.dots.push([r.x-n,r.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 O(e,n),o=new O(i,t),r=[],a=null,l=null,h=[],c=new jn,u=new jn,e=this.links.start.component;if(e){c=e.getMinBoundingBox(),r[0]=new O(s.x,c.tl[1]-this.state.escapeDistance),r[1]=new O(c.tr[0]+this.state.escapeDistance,s.y),r[2]=new O(s.x,c.br[1]+this.state.escapeDistance),r[3]=new O(c.tl[0]-this.state.escapeDistance,s.y);for(var a=r[0],d=1;d<r.length;d++)this.distance(s,r[d])<this.distance(s,a)&&(a=r[d])}n=this.links.end.component;if(n){u=n.getMinBoundingBox(),r[0]=new O(o.x,u.tl[1]-this.state.escapeDistance),r[1]=new O(u.tr[0]+this.state.escapeDistance,o.y),r[2]=new O(o.x,u.br[1]+this.state.escapeDistance),r[3]=new O(u.tl[0]-this.state.escapeDistance,o.y);for(var l=r[0],p=1;p<r.length;p++)this.distance(o,r[p])<this.distance(o,l)&&(l=r[p])}var i=0,t=[s],e=(a&&(t.push(a),i=1),l&&t.push(l),t.push(o),O.cloneArray(t)),n=(h.push(["s0","s0",e]),O.cloneArray(t)),e=O.cloneArray(n),t=(e.splice(i+1,0,new O(e[i].x,e[i+1].y)),h.push(["s1","s1_1",e]),O.cloneArray(n)),e=(t.splice(i+1,0,new O(t[i+1].x,t[i].y)),h.push(["s1","s1_2",t]),O.cloneArray(n)),t=new O((e[i].x+e[i+1].x)/2,e[i].y),f=new O((e[i].x+e[i+1].x)/2,e[i+1].y),t=(e.splice(i+1,0,t,f),h.push(["s2","s2_1",e]),O.cloneArray(n)),f=new O(t[i].x,(t[i].y+t[i+1].y)/2),e=new O(t[i+1].x,(t[i].y+t[i+1].y)/2),f=(t.splice(i+1,0,f,e),h.push(["s2","s2_2",t]),O.cloneArray(n)),e=[f[i].x+20,f[i+1].x+20],t=(c&&e.push(c.br[0]+20),u&&e.push(u.br[0]+20),this.max(e)),e=new O(t,f[i].y),t=new O(t,f[i+1].y),e=(f.splice(i+1,0,e,t),h.push(["s2","s2_3",f]),O.cloneArray(n)),t=[e[i].y-20,e[i+1].y-20],f=(c&&t.push(c.tl[1]-20),u&&t.push(u.tl[1]-20),this.min(t)),t=new O(e[i].x,f),f=new O(e[i+1].x,f),t=(e.splice(i+1,0,t,f),h.push(["s2","s2_4",e]),O.cloneArray(n)),f=[t[i].x-20,t[i+1].x-20],e=(c&&f.push(c.tl[0]-20),u&&f.push(u.tl[0]-20),this.min(f)),f=new O(e,t[i].y),e=new O(e,t[i+1].y),f=(t.splice(i+1,0,f,e),h.push(["s2","s2_5",t]),O.cloneArray(n)),e=[f[i].y+20,f[i+1].y+20],t=(c&&e.push(c.tl[1]+c.height+20),u&&e.push(u.tl[1]+u.height+20),this.max(e)),n=new O(f[i].x,t),e=new O(f[i+1].x,t);f.splice(i+1,0,n,e),h.push(["s2","s2_6",f]);for(var y=[],v=0;v<h.length;v++){var g=h[v][2];this.orthogonalPath(g)&&y.push(h[v])}if(h=y,!s.equals(o)){for(var C=[],m=0;m<h.length;m++){var b=h[m][2];this.forwardPath(b)&&C.push(h[m])}(h=C).length}for(var k=[],_=0;_<h.length;_++){var P=!1,E=h[_][2].slice();(u||c)&&(E=E.slice(1,E.length-1)),c&&(P=P||this.polylineIntersectsRectangle(E,c)),(P=u?P||this.polylineIntersectsRectangle(E,u):P)||k.push(h[_])}(h=0!=k.length?k:h).length;for(var x=h[0][2].length,w=[],I=0;I<h.length;I++)h[I][2].length==x&&w.push(h[I]);for(var h=w,S=0,M=0;M<h.length;M++)this.scorePath(h[S][2])<this.scorePath(h[M][2])&&(S=M);return[h[S]]}},{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),o=e.startPoint.y-s*e.startPoint.x;if(n==s)return i==o&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y));o=(o-i)/(n-s),s=n*o+i;return t.contains(o,s)&&e.contains(o,s)}},{key:"polylineIntersectsRectangle",value:function polylineIntersectsRectangle(t,e){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=[];i.push(new ji(new O(e.x1,e.y1),new O(e.x2,e.y1))),i.push(new ji(new O(e.x2,e.y1),new O(e.x2,e.y2))),i.push(new ji(new O(e.x2,e.y2),new O(e.x1,e.y2))),i.push(new ji(new O(e.x1,e.y2),new O(e.x1,e.y1)));for(var s=0;s<t.length-1;s++)for(var o=new ji(t[s],t[s+1]),r=0;r<i.length;r++)if(this.lineIntersectsLine(o,i[r]))return!0;if(n)for(var a=new ji(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 Fc(t.startPoint)&&(t.startPoint=[0,0]),Fc(t.endPoint)&&(t.endPoint=[10,10]),t.points=[_toConsumableArray(t.startPoint),_toConsumableArray(t.endPoint)],_objectSpread2({escapeDistance:30},t)}}]),ICEVisioLink),d=(_inherits(ICEIsogon,f),Zn=_createSuper(ICEIsogon),_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){Fc(t.radius)?Fc(t.width)?Fc(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),i=(_inherits(ICERose,f),Qn=_createSuper(ICERose),_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,o=0;n=t+t*Math.sin(e*o)*Math.cos(o),i=t+t*Math.sin(e*o)*Math.sin(o),this.state.dots.push([n,i]),!((o+=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){Fc(t.radius)?Fc(t.width)?Fc(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),zi=(_inherits(ICEStar,f),Jn=_createSuper(ICEStar),_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,o=this.state.innerRadius,r=0;r<this.state.spikes;r++)t=Math.cos(n)*s+s,e=Math.sin(n)*s+s,this.state.dots.push([t,e]),n+=i,t=Math.cos(n)*o+s,e=Math.sin(n)*o+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){Fc(t.outerRadius)?Fc(t.width)?Fc(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),Di="__ICE_UTILS_TEXT_MEASURE_DIV__",Hi=(_inherits(ICEText,y),Kn=_createSuper(ICEText),_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(Di))){(e=this.root.document.createElement("div")).setAttribute("id",Di);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,o=s.paddingTop,r=s.paddingBottom,a=s.paddingLeft,l=s.paddingRight,h={width:e.offsetWidth+a+l,height:e.offsetHeight+o+r};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=dn({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),Ni={ICERect:g,ICECircle:l,ICEEllipse:Lt,ICEStar:zi,ICEIsogon:d,ICEText:Hi,ICEImage:p,ICEGroup:Ht,ICEVisioLink:s,ICEPolyLine:o},E={evtBuses:[],stopped:!1,frameCallback:function frameCallback(){for(var t=0;t<E.evtBuses.length;t++){if(E.stopped)return;E.evtBuses[t].trigger(R)}E.stopped||b.requestFrame(E.frameCallback)},start:function start(){E.stopped=!1,b.requestFrame(E.frameCallback)},stop:function stop(){E.stopped=!0},pause:function pause(){},resume:function resume(){},regitserEvtBus:function regitserEvtBus(t){E.evtBuses.includes(t)||E.evtBuses.push(t)},delEvtBus:function delEvtBus(t){E.evtBuses.includes(t)&&E.evtBuses.splice(E.evtBuses.indexOf(t),1)}},Vi=(_createClass(ICELinkSlotManager,[{key:"start",value:function start(){return this.createLinkSlots(),this.ice.evtBus.on($,this.hookMouseMoveHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off($,this.hookMouseMoveHandler,this),this}},{key:"hookMouseMoveHandler",value:function hookMouseMoveHandler(t){for(var e=t.target.getMaxBoundingBox(),n=null,i=_toConsumableArray(this.ice.childNodes),s=0;s<i.length;s++){var o=i[s];if(o&&o.state.linkable&&o.getMaxBoundingBox().isIntersect(e)){n=o;break}}for(var r=0;r<this.ice._linkSlots.length;r++){var a=this.ice._linkSlots[r];a.hostComponent!==n&&(a.hostComponent=n)}}},{key:"createLinkSlots",value:function createLinkSlots(){var t,e,n,i;this.ice._linkSlots&&this.ice._linkSlots.length||(t=new Ri({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 Ri({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 Ri({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 Ri({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),Fi=(_createClass(Deserializer,[{key:"fromJSON",value:function fromJSON(t){for(var e=JSON.parse(t).childNodes,n=0;n<e.length;n++)this.decodeRecursively(this.ice,e[n])}},{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),Xi=(_createClass(Serializer,[{key:"toJSON",value:function toJSON(){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 JSON.stringify(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),qi=(_inherits(CanvasRenderer,n),Gn=_createSuper(CanvasRenderer),_createClass(CanvasRenderer,[{key:"start",value:function start(){return this.stopped=!1,this.ice.evtBus.on(R,this.frameEvtHandler,this),this}},{key:"stop",value:function stop(){return this.stopped=!0,this.ice.evtBus.off(R,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(X)}}]),CanvasRenderer),Ui=(_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);function ImageCache(t){_classCallCheck(this,ImageCache),_defineProperty$1(this,"imageCache",new Map),this.ice=t}function CanvasRenderer(t){var e;return _classCallCheck(this,CanvasRenderer),_defineProperty$1(_assertThisInitialized(e=Gn.call(this)),"stopped",!1),_defineProperty$1(_assertThisInitialized(e),"componentQueue",[]),_defineProperty$1(_assertThisInitialized(e),"toolsQueue",[]),e.ice=t,e}function Serializer(t){_classCallCheck(this,Serializer),this.ice=t}function Deserializer(t){_classCallCheck(this,Deserializer),this.ice=t}function ICELinkSlotManager(t){_classCallCheck(this,ICELinkSlotManager),_defineProperty$1(this,"slotRadius",10),this.ice=t}function ICEText(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEText),ICEText.arrangeParam(t));return(t=Kn.call(this,t)).measureText(),t}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,Jn.call(this,t)}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,Qn.call(this,t)}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,Zn.call(this,t)}function ICEVisioLink(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEVisioLink),t=ICEVisioLink.arrangeParam(t),Yn.call(this,t)}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=ti.call(this,t)),"isLine",!0),_defineProperty$1(_assertThisInitialized(t),"links",{start:{},end:{}}),t}function ICELinkSlot(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkSlot),ei.call(this,_objectSpread2({linkable:!1,draggable:!1,position:"T"},t))}function ICEImage(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEImage),ni.call(this,_objectSpread2({width:100,height:100,src:"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"},t))}function ICEDotPath(t){return _classCallCheck(this,ICEDotPath),ii.call(this,_objectSpread2({dots:[],closePath:!0},t))}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}function GeoLine(t,e){_classCallCheck(this,GeoLine),this.startPoint=t,this.endPoint=e}function EventBus(){return _classCallCheck(this,EventBus),si.call(this)}function DOMEventDispatcher(t){_classCallCheck(this,DOMEventDispatcher),_defineProperty$1(this,"selectionCandidates",[]),_defineProperty$1(this,"_stopped",!1),this.ice=t}function ICEControlPanelManager(t){_classCallCheck(this,ICEControlPanelManager),this.ice=t,this.transformControlPanel=new Mi({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 $n({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()}function TransformControlPanel(t){return _classCallCheck(this,TransformControlPanel),_defineProperty$1(_assertThisInitialized(t=oi.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}function RotateControl(t){return _classCallCheck(this,RotateControl),ri.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))}function ResizeControl(t){return _classCallCheck(this,ResizeControl),ai.call(this,_objectSpread2(_objectSpread2({position:"l",direction:"x",quadrant:1},t),{},{linkable:!1}))}_defineProperty$1(Ui,"CACHE_SIZE",100);_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 Ni)this.typeMapping[e]=Ni[e];return this.root=b,z(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 Ti,E.regitserEvtBus(this.evtBus),E.start(),P.regitserEvtBus(this.evtBus),P.start(),this.eventDispatcher=new Li(this).start(),this.animationManager=new Z(this).start(),this.controlPanelManager=new Oi(this).start(),this.renderer=new qi(this).start(),this.linkSlotManager=new Vi(this).start(),this.serializer=new Xi(this),this.deserializer=new Fi(this),this.imageCache=new Ui(this),this}},{key:"addTool",value:function addTool(t){-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(N,null,{component:t}),t.trigger(N),t.ice=this,t.ctx=this.ctx,t.evtBus=this.evtBus,this.toolNodes.push(t),this.dirty=!0,this.evtBus.trigger(V,null,{component:t}),t.trigger(V))}},{key:"removeTool",value:function removeTool(t){this.evtBus.trigger(F,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(N,null,{component:t}),t.trigger(N),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(V,null,{component:t}),t.trigger(V))}},{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(F,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:"toJSON",value:function toJSON(){return this.serializer.toJSON()}},{key:"fromJSON",value:function fromJSON(t){var e=this;E.stop(),this.renderer.stop(),this.eventDispatcher.stopped=!0,this.animationManager.stop(),this.controlPanelManager.stop(),this.linkSlotManager.stop(),this.clearAll(),this.deserializer.fromJSON(t),E.start(),this.renderer.start(),this.animationManager.start(),this.controlPanelManager.start(),this.linkSlotManager.start(),setTimeout(function(){e.eventDispatcher.stopped=!1},300)}}]);var $i=ICE;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())}e.AnimationManager=Z,e.CanvasRenderer=qi,e.DOMEventDispatcher=Li,e.DOMEventInterceptor=P,e.EventBus=Ti,e.GeoLine=ji,e.GeoPoint=O,e.GeoUtil=Tn,e.ICE=$i,e.ICEBezier=m,e.ICEBoundingBox=jn,e.ICECircle=l,e.ICEComponent=y,e.ICEControlPanel=u,e.ICEControlPanelManager=Oi,e.ICEDotPath=f,e.ICEEllipse=Lt,e.ICEEventTarget=n,e.ICEGroup=Ht,e.ICEImage=p,e.ICEIsogon=d,e.ICELinkHook=Un,e.ICELinkSlot=Ri,e.ICEPath=c,e.ICEPolyLine=o,e.ICERect=g,e.ICERose=i,e.ICEStar=zi,e.ICEText=Hi,e.ICEVisioLink=s,e.LineControlPanel=$n,e.ResizeControl=Ii,e.RotateControl=Si,e.TransformControlPanel=Mi,Object.defineProperty(e,"__esModule",{value:!0})});
25
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ICE={})}(this,function(e){"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){e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n}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 _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 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)}(this,i?(t=_getPrototypeOf(this).constructor,Reflect.construct(e,arguments,t)):e.apply(this,arguments))}}function _get(){return(_get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function _get(t,e,n){var i=function _superPropBase(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=_getPrototypeOf(t)););return t}(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}function r(t){return I.call(t)}function t(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":(j&&j in Object(t)?O:r)(t)}function v(t){return null!=t&&"object"==typeof t}function z(t){return"string"==typeof t||!L(t)&&T(t)&&"[object String]"==B(t)}function A(t){return void 0===t}var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n="object"==typeof n&&n&&n.Object===Object&&n,i="object"==typeof self&&self&&self.Object===Object&&self,i=n||i||Function("return this")(),o=i.Symbol,s=Object.prototype,x=s.hasOwnProperty,w=s.toString,S=o?o.toStringTag:void 0,I=Object.prototype.toString,O=function getRawTag$1(t){var e=x.call(t,S),n=t[S];try{var i=!(t[S]=void 0)}catch(t){}var o=w.call(t);return i&&(e?t[S]=n:delete t[S]),o},j=o?o.toStringTag:void 0,s=Array.isArray,B=t,L=s,T=v,R="ICE_FRAME_EVENT",D="BEFORE_RENDER",N="AFTER_RENDER",H="BEFORE_ADD",V="AFTER_ADD",q="BEFORE_REMOVE",X="ROUND_FINISH",J="HOOK_MOUSEDOWN",$="HOOK_MOUSEMOVE",F="HOOK_MOUSEUP",G="BEFORE_RESIZE",h="AFTER_RESIZE",K="AFTER_ROTATE",a="AFTER_MOVE",Q={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}},Z=(_createClass(AnimationManager,[{key:"start",value:function start(){return this.ice.evtBus.on(R,this.frameEventHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off(R,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,o=1;for(e in i){var s=i[e];if(s.finished){if(++o===Object.keys(i).length){this.remove(t);break}}else{var r=s.from,a=s.to,l=s.duration,r=(A(s.startTime)&&(s.startTime=Date.now()),A(s.easing)&&(s.easing="linear"),Q[s.easing](r,a,l,s.startTime));a<r&&(r=a,s.finished=!0),n[e]=Math.floor(r)}}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){z(t)?this.animationMap.delete(t):this.animationMap.delete(t.props.id)}}]),AnimationManager);function AnimationManager(t){_classCallCheck(this,AnimationManager),_defineProperty$1(this,"animationMap",new Map),this.ice=t}function U(t,e){return t===e||t!=t&&e!=e}function W(t,e){for(var n=t.length;n--;)if(Y(t[n][0],e))return n;return-1}function ba(t){var e=this.__data__;return!((t=tt(e,t))<0||(t==e.length-1?e.pop():et.call(e,t,1),--this.size,0))}function ca(t){var e=this.__data__;return(t=nt(e,t))<0?void 0:e[t][1]}function da(t){return-1<it(this.__data__,t)}function ea(t,e){var n=this.__data__,i=ot(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}var Y=U,tt=W,et=Array.prototype.splice,nt=W,it=W,ot=W;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=function listCacheClear$1(){this.__data__=[],this.size=0},ListCache$4.prototype.delete=ba,ListCache$4.prototype.get=ca,ListCache$4.prototype.has=da,ListCache$4.prototype.set=ea;function ha(){this.__data__=new st,this.size=0}function ia(t){var e=this.__data__,t=e.delete(t);return this.size=e.size,t}function ja(t){return this.__data__.get(t)}function ka(t){return this.__data__.has(t)}function la(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function pa(t){return!!at(t)&&("[object Function]"==(t=rt(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function ua(t){if(null!=t){try{return ht.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Fa(t){return!(!dt(t)||ut(t))&&(ct(t)?yt:ft).test(pt(t))}function Ga(t,e){return null==t?void 0:t[e]}function Ha(t,e){return t=Ga(t,e),Fa(t)?t:void 0}function Ua(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t}function Va(t){var e,n=this.__data__;return gt?"__lodash_hash_undefined__"===(e=n[t])?void 0:e:Ct.call(n,t)?n[t]:void 0}function Wa(t){var e=this.__data__;return mt?void 0!==e[t]:bt.call(e,t)}function Xa(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=kt&&void 0===e?"__lodash_hash_undefined__":e,this}var l=ListCache$4,st=l,rt=t,at=la,c=i["__core-js_shared__"],lt=(c=/[^.]+$/.exec(c&&c.keys&&c.keys.IE_PROTO||""))?"Symbol(src)_1."+c:"",ht=Function.prototype.toString,ct=pa,ut=function isMasked$1(t){return!!lt&&lt in t},dt=la,pt=ua,ft=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,c=c.toString,u=u.hasOwnProperty,yt=RegExp("^"+c.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),c=Ha(i,"Map"),u=Ha(Object,"create"),vt=u,gt=u,Ct=Object.prototype.hasOwnProperty,mt=u,bt=Object.prototype.hasOwnProperty,kt=u;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=function hashClear$1(){this.__data__=vt?vt(null):{},this.size=0},Hash$1.prototype.delete=Ua,Hash$1.prototype.get=Va,Hash$1.prototype.has=Wa,Hash$1.prototype.set=Xa;function _a(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function a0(t,e){return t=t.__data__,_a(e)?t["string"==typeof e?"string":"hash"]:t.map}function g0(t){return t=xt(this,t).delete(t),this.size-=t?1:0,t}function h0(t){return wt(this,t).get(t)}function i0(t){return St(this,t).has(t)}function j0(t,e){var n=It(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}var _t=Hash$1,Et=l,Pt=c,xt=a0,wt=a0,St=a0,It=a0;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=function mapCacheClear$1(){this.size=0,this.__data__={hash:new _t,map:new(Pt||Et),string:new _t}},MapCache$1.prototype.delete=g0,MapCache$1.prototype.get=h0,MapCache$1.prototype.has=i0,MapCache$1.prototype.set=j0;function s0(t,e){var n=this.__data__;if(n instanceof Ot){var i=n.__data__;if(!Mt||i.length<199)return i.push([t,e]),this.size=++n.size,this;n=this.__data__=new jt(i)}return n.set(t,e),this.size=n.size,this}var Ot=l,Mt=c,jt=MapCache$1,At=l,u=ia,l=ja,d=ka;function Stack$2(t){t=this.__data__=new At(t);this.size=t.size}Stack$2.prototype.clear=ha,Stack$2.prototype.delete=u,Stack$2.prototype.get=l,Stack$2.prototype.has=d,Stack$2.prototype.set=s0;function x0(t,e,n){"__proto__"==e&&Tt?Tt(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function A0(t,e,n){(void 0===n||Dt(t[e],n))&&(void 0!==n||e in t)||Rt(t,e,n)}function E0(t){var e=new t.constructor(t.byteLength);return new zt(e).set(new zt(t)),e}function G0(t,e){return e=e?Ht(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.length)}function H0(t,e){var n=-1,i=t.length;for(e=e||Array(i);++n<i;)e[n]=t[n];return e}var Bt,u=Stack$2,Lt=Ha,l=function(){try{var t=Lt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),Tt=l,Rt=x0,Dt=U,d=function createBaseFor$1(l){return function(t,e,n){for(var i=-1,o=Object(t),s=n(t),r=s.length;r--;){var a=s[l?r:++i];if(!1===e(o[a],a,o))break}return t}}(),Nt={exports:{}},zt=(p=(p=(y=Nt).exports)&&!p.nodeType&&p,f=(f=p&&y&&!y.nodeType&&y)&&f.exports===p?i.Buffer:void 0,Bt=f?f.allocUnsafe:void 0,y.exports=function cloneBuffer(t,e){if(e)return t.slice();e=t.length,e=Bt?Bt(e):new t.constructor(e);return t.copy(e),e},i.Uint8Array),Ht=E0,Vt=la,Ut=Object.create;function object(){}function L0(e,n){return function(t){return e(n(t))}}function O0(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Jt)}function S0(t){return"function"!=typeof t.constructor||Ft(t)?{}:Wt($t(t))}function V0(t){return Kt(t)&&"[object Arguments]"==Gt(t)}function _0(t){return"number"==typeof t&&-1<t&&t%1==0&&t<=9007199254740991}function cb(t){return null!=t&&ee(t.length)&&!te(t)}function fb(t){return ie(t)&&ne(t)}function qb(t){return!(!re(t)||"[object Object]"!=oe(t))&&(null===(t=se(t))||"function"==typeof(t=le.call(t,"constructor")&&t.constructor)&&t instanceof t&&ae.call(t)==he)}function vb(t){return de(t)&&ue(t.length)&&!!m[ce(t)]}function wb(e){return function(t){return e(t)}}function Db(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}function Hb(t,e,n){var i=t[e];ye.call(t,e)&&fe(i,n)&&(void 0!==n||e in t)||pe(t,e,n)}function Kb(t,e,n,i){var o=!n;n=n||{};for(var s=-1,r=e.length;++s<r;){var a=e[s],l=i?i(n[a],t[a],a,n,t):void 0;void 0===l&&(l=t[a]),(o?ge:ve)(n,a,l)}return n}function Mb(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&Ce.test(t))&&-1<t&&t%1==0&&t<e}function Nb(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}function Ub(t,e){var n,i=be(t),o=!i&&me(t),s=!i&&!o&&ke(t),r=!i&&!o&&!s&&Ee(t),a=i||o||s||r,l=a?Nb(t.length,String):[],h=l.length;for(n in t)!e&&!Pe.call(t,n)||a&&("length"==n||s&&("offset"==n||"parent"==n)||r&&("buffer"==n||"byteLength"==n||"byteOffset"==n)||_e(n,h))||l.push(n);return l}function $b(t){if(!xe(t))return Se(t);var e,n=we(t),i=[];for(e in t)("constructor"!=e||!n&&Ie.call(t,e))&&i.push(e);return i}function a1(t){return Me(t)?Oe(t,!0):$b(t)}function v1(t,e,n,i,o,s,r){var a,l,h,c=We(t,n),u=We(e,n),d=r.get(u);d?Be(t,n,d):((e=void 0===(d=s?s(c,u,n+"",t,e,r):void 0))&&(l=!(a=ze(u))&&Ve(u),h=!a&&!l&&Je(u),d=u,a||l||h?d=ze(c)?c:He(c)?Re(c):l?Le(u,!(e=!1)):h?Te(u,!(e=!1)):[]:Xe(u)||Ne(u)?Ne(d=c)?d=$e(c):qe(c)&&!Ue(c)||(d=De(u)):e=!1),e&&(r.set(u,d),o(d,u,i,s,r),r.delete(u)),Be(t,n,d))}function A1(t){return t}function B1(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)}function E1(t){return function(){return t}}function Q1(t,e){return an(rn(t,e,sn),t+"")}function R1(t,e,n){if(!un(n))return!1;var i=typeof e;return!!("number"==i?hn(n)&&cn(e,n.length):"string"==i&&e in n)&&ln(n[e],t)}var qt,Xt,p=L0(Object.getPrototypeOf,Object),Jt=Object.prototype,Wt=function(t){if(!Vt(t))return{};if(Ut)return Ut(t);object.prototype=t;t=new object;return object.prototype=void 0,t},$t=p,Ft=O0,Gt=t,Kt=v,Qt=v,f=Object.prototype,Zt=f.hasOwnProperty,Yt=f.propertyIsEnumerable,y=V0(function(){return arguments}())?V0:function(t){return Qt(t)&&Zt.call(t,"callee")&&!Yt.call(t,"callee")},te=pa,ee=_0,ne=cb,ie=v,f={exports:{}},oe=(b=(b=(C=f).exports)&&!b.nodeType&&b,g=(g=b&&C&&!C.nodeType&&C)&&g.exports===b?i.Buffer:void 0,b=(g?g.isBuffer:void 0)||function stubFalse(){return!1},C.exports=b,t),se=p,re=v,g=Function.prototype,C=Object.prototype,ae=g.toString,le=C.hasOwnProperty,he=ae.call(Object),ce=t,ue=_0,de=v,m={},b=(m["[object Float32Array]"]=m["[object Float64Array]"]=m["[object Int8Array]"]=m["[object Int16Array]"]=m["[object Int32Array]"]=m["[object Uint8Array]"]=m["[object Uint8ClampedArray]"]=m["[object Uint16Array]"]=m["[object Uint32Array]"]=!0,m["[object Arguments]"]=m["[object Array]"]=m["[object ArrayBuffer]"]=m["[object Boolean]"]=m["[object DataView]"]=m["[object Date]"]=m["[object Error]"]=m["[object Function]"]=m["[object Map]"]=m["[object Number]"]=m["[object Object]"]=m["[object RegExp]"]=m["[object Set]"]=m["[object String]"]=m["[object WeakMap]"]=!1,{exports:{}}),n=(C=(C=(g=b).exports)&&!C.nodeType&&C,qt=C&&g&&!g.nodeType&&g,Xt=qt&&qt.exports===C&&n.process,C=function(){try{return qt&&qt.require&&qt.require("util").types||Xt&&Xt.binding&&Xt.binding("util")}catch(t){}}(),g.exports=C,vb),g=wb,C=b.exports,C=C&&C.isTypedArray,g=C?g(C):n,pe=x0,fe=U,ye=Object.prototype.hasOwnProperty,ve=Hb,ge=x0,Ce=/^(?:0|[1-9]\d*)$/,me=y,be=s,ke=f.exports,_e=Mb,Ee=g,Pe=Object.prototype.hasOwnProperty,xe=la,we=O0,Se=function nativeKeysIn$1(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e},Ie=Object.prototype.hasOwnProperty,Oe=Ub,Me=cb,je=Kb,Ae=a1,Be=A0,Le=Nt.exports,Te=G0,Re=H0,De=S0,Ne=y,ze=s,He=fb,Ve=f.exports,Ue=pa,qe=la,Xe=qb,Je=g,We=Db,$e=function toPlainObject$1(t){return je(t,Ae(t))},Fe=u,Ge=A0,Ke=d,Qe=la,Ze=a1,Ye=Db,tn=Math.max,en=l,nn=Date.now,C=function shortOut$1(n){var i=0,o=0;return function(){var t=nn(),e=16-(t-o);if(o=t,0<e){if(800<=++i)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(en?function(t,e){return en(t,"toString",{configurable:!0,enumerable:!1,value:E1(e),writable:!0})}:A1),sn=A1,rn=function overRest$1(s,r,a){return r=tn(void 0===r?s.length-1:r,0),function(){for(var t=arguments,e=-1,n=tn(t.length-r,0),i=Array(n);++e<n;)i[e]=t[r+e];for(var e=-1,o=Array(r+1);++e<r;)o[e]=t[e];return o[r]=a(i),B1(s,this,o)}},an=C,ln=U,hn=cb,cn=Mb,un=la,dn=function baseMerge$1(i,o,s,r,a){i!==o&&Ke(o,function(t,e){var n;a=a||new Fe,Qe(t)?v1(i,o,e,s,baseMerge$1,r,a):(n=r?r(Ye(i,e),t,e+"",i,o,a):void 0,Ge(i,e,n=void 0===n?t:n))},Ze)},pn=function createAssigner$1(a){return Q1(function(t,e){var n=-1,i=e.length,o=1<i?e[i-1]:void 0,s=2<i?e[2]:void 0,o=3<a.length&&"function"==typeof o?(i--,o):void 0;for(s&&R1(e[0],e[1],s)&&(o=i<3?void 0:o,i=1),t=Object(t);++n<i;){var r=e[n];r&&a(t,r,n,o)}return t})}(function(t,e,n){dn(t,e,n)}),fn="undefined"!=typeof Float32Array?Float32Array:Array,yn=Math.PI/180;function toRadian(t){return t*yn}function invert(t,e){var n=e[0],i=e[1],o=e[2],s=e[3],r=e[4],e=e[5],a=n*s-i*o;return a?(t[0]=s*(a=1/a),t[1]=-i*a,t[2]=-o*a,t[3]=n*a,t[4]=(o*e-s*r)*a,t[5]=(i*r-n*e)*a,t):null}function multiply(t,e,n){var i=e[0],o=e[1],s=e[2],r=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+s*h,t[1]=o*l+r*h,t[2]=i*c+s*u,t[3]=o*c+r*u,t[4]=i*d+s*n+a,t[5]=o*d+r*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 fn(2);fn!=Float32Array&&(t[0]=0,t[1]=0)}();function W1(t,e){for(var n=-1,i=null==t?0:t.length;++n<i&&!1!==e(t[n],n,t););return t}function _1(t){if(!vn(t))return gn(t);var e,n=[];for(e in Object(t))Cn.call(t,e)&&"constructor"!=e&&n.push(e);return n}function dc(t){return(kn(t)?mn:bn)(t)}function gc(t,e){return t&&_n(e,En(e),t)}function jc(t,e){return t&&Pn(e,xn(e),t)}function kc(){return[]}function lc(t,e){for(var n=-1,i=null==t?0:t.length,o=0,s=[];++n<i;){var r=t[n];e(r,n,t)&&(s[o++]=r)}return s}function sc(t,e){return In(t,On(t),e)}function tc(t,e){for(var n=-1,i=e.length,o=t.length;++n<i;)t[o+n]=e[n];return t}function Bc(t,e){return Bn(t,Ln(t),e)}function Ec(t,e,n){return e=e(t),Rn(t)?e:Tn(e,n(t))}function Ic(t){return Dn(t,zn,Nn)}function Mc(t){return Hn(t,Un,Vn)}function a2(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&Kn.call(t,"index")&&(n.index=t.index,n.input=t.input),n}function k2(t){return Yn?Object(Yn.call(t)):{}}function m2(t,e,n){var i=t.constructor;switch(e){case"[object ArrayBuffer]":return ti(t);case"[object Boolean]":case"[object Date]":return new i(+t);case"[object DataView]":return ei(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 ii(t,n);case"[object Map]":return new i;case"[object Number]":case"[object String]":return new i(t);case"[object RegExp]":return ni(t);case"[object Set]":return new i;case"[object Symbol]":return k2(t)}}function p2(t){return si(t)&&"[object Map]"==oi(t)}function w2(t){return ai(t)&&"[object Set]"==ri(t)}function Z2(t){return Mi(t,5)}var n=L0(Object.keys,Object),vn=O0,gn=n,Cn=Object.prototype.hasOwnProperty,mn=Ub,bn=_1,kn=cb,_n=Kb,En=dc,Pn=Kb,xn=a1,wn=Object.prototype.propertyIsEnumerable,Sn=Object.getOwnPropertySymbols,d=Sn?function(e){return null==e?[]:(e=Object(e),lc(Sn(e),function(t){return wn.call(e,t)}))}:kc,In=Kb,On=d,Mn=tc,jn=p,An=d,l=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)Mn(e,An(t)),t=jn(t);return e}:kc,Bn=Kb,Ln=l,Tn=tc,Rn=s,Dn=Ec,Nn=d,zn=dc,Hn=Ec,Vn=l,Un=a1,C=Ha(i,"DataView"),n=c,p=Ha(i,"Promise"),d=Ha(i,"Set"),l=Ha(i,"WeakMap"),qn=t,Xn=ua,Jn=Xn(C),Wn=Xn(n),$n=Xn(p),Fn=Xn(d),Gn=Xn(l),c=qn,C=c=C&&"[object DataView]"!=c(new C(new ArrayBuffer(1)))||n&&"[object Map]"!=c(new n)||p&&"[object Promise]"!=c(p.resolve())||d&&"[object Set]"!=c(new d)||l&&"[object WeakMap]"!=c(new l)?function(t){var e=qn(t),t="[object Object]"==e?t.constructor:void 0,t=t?Xn(t):"";if(t)switch(t){case Jn:return"[object DataView]";case Wn:return"[object Map]";case $n:return"[object Promise]";case Fn:return"[object Set]";case Gn:return"[object WeakMap]"}return e}:c,Kn=Object.prototype.hasOwnProperty,Qn=E0,Zn=/\w*$/,n=o?o.prototype:void 0,Yn=n?n.valueOf:void 0,ti=E0,ei=function cloneDataView$1(t,e){e=e?Qn(t.buffer):t.buffer;return new t.constructor(e,t.byteOffset,t.byteLength)},ni=function cloneRegExp$1(t){var e=new t.constructor(t.source,Zn.exec(t));return e.lastIndex=t.lastIndex,e},ii=G0,oi=C,si=v,p=wb,d=b.exports,l=d&&d.isMap,c=l?p(l):p2,ri=C,ai=v,n=wb,d=b.exports,p=d&&d.isSet,l=p?n(p):w2,li=u,hi=W1,ci=Hb,ui=gc,di=jc,pi=Nt.exports,fi=H0,yi=sc,vi=Bc,gi=Ic,Ci=Mc,mi=C,bi=a2,ki=m2,_i=S0,Ei=s,Pi=f.exports,xi=c,wi=la,Si=l,Ii=dc,Oi=a1,k={},Mi=(k["[object Arguments]"]=k["[object Array]"]=k["[object ArrayBuffer]"]=k["[object DataView]"]=k["[object Boolean]"]=k["[object Date]"]=k["[object Float32Array]"]=k["[object Float64Array]"]=k["[object Int8Array]"]=k["[object Int16Array]"]=k["[object Int32Array]"]=k["[object Map]"]=k["[object Number]"]=k["[object Object]"]=k["[object RegExp]"]=k["[object Set]"]=k["[object String]"]=k["[object Symbol]"]=k["[object Uint8Array]"]=k["[object Uint8ClampedArray]"]=k["[object Uint16Array]"]=k["[object Uint32Array]"]=!0,k["[object Error]"]=k["[object Function]"]=k["[object WeakMap]"]=!1,function baseClone$1(n,i,o,t,e,s){var r,a=1&i,l=2&i,h=4&i;if(void 0!==(r=o?e?o(n,t,e,s):o(n):r))return r;if(!wi(n))return n;t=Ei(n);if(t){if(r=bi(n),!a)return fi(n,r)}else{var c=mi(n),u="[object Function]"==c||"[object GeneratorFunction]"==c;if(Pi(n))return pi(n,a);if("[object Object]"==c||"[object Arguments]"==c||u&&!e){if(r=l||u?{}:_i(n),!a)return l?vi(n,di(r,n)):yi(n,ui(r,n))}else{if(!k[c])return e?n:{};r=ki(n,c,a)}}u=(s=s||new li).get(n);if(u)return u;s.set(n,r),Si(n)?n.forEach(function(t){r.add(baseClone$1(t,i,o,t,n,s))}):xi(n)&&n.forEach(function(t,e){r.set(e,baseClone$1(t,i,o,e,n,s))});var d=t?void 0:(h?l?Ci:gi:l?Oi:Ii)(n);return hi(d||n,function(t,e){d&&(t=n[e=t]),ci(r,e,baseClone$1(t,i,o,e,n,s))}),r}),b=null,_=((b=window||global||{}).requestFrame=b.requestAnimationFrame||b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame||b.oRequestAnimationFrame||b.msRequestAnimationFrame,b),E=(_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),ji=_1,Ai=C,Bi=y,Li=s,Ti=cb,Ri=f.exports,Di=O0,Ni=g,zi=Object.prototype.hasOwnProperty;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]}function kd(t){if(null==t)return!0;if(Ti(t)&&(Li(t)||"string"==typeof t||"function"==typeof t.splice||Ri(t)||Ni(t)||Bi(t)))return!t.length;var e,n=Ai(t);if("[object Map]"==n||"[object Set]"==n)return!t.size;if(Di(t))return!ji(t).length;for(e in t)if(zi.call(t,e))return!1;return!0}_createClass(ICEEventTarget,[{key:"on",value:function on(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:_;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]:_;if(i=this.listeners[t])for(var i=_toConsumableArray(i),o=0;o<i.length;o++){var s=i[o];if(s.callback===e&&s.scope===n)return void this.listeners[t].splice(o,1)}}},{key:"once",value:function once(e,n){var i=2<arguments.length&&void 0!==arguments[2]?arguments[2]:_,o=this;o.on(e,function callback(t){o.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(kd(this.listeners[t]))return!1;if(this.suspendedEventNames.includes(t))return!1;n?((e=new E(n)).originalEvent=n.originalEvent||n,e.param=_objectSpread2({},i)):e=new E({type:t,timeStamp:Date.now(),param:_objectSpread2({},i)});for(var o=this.listeners[t],s=0;s<o.length;s++){var r=o[s];r.callback.call(r.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]:_;if(!this.listeners[t])return!1;var i=this.listeners[t];if(!i)return!1;for(var o=0;o<i.length;o++){var s=i[o];if(s.callback===e&&s.scope===n)return!0}return!1}}]);d=ICEEventTarget;function ICEEventTarget(){_classCallCheck(this,ICEEventTarget),_defineProperty$1(this,"listeners",{}),_defineProperty$1(this,"suspendedEventNames",[])}d.prototype.addEventListener=d.prototype.on,d.prototype.removeEventListener=d.prototype.off,d.prototype.dispatchEvent=d.prototype.trigger;_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]}}]);var Hi=GeoUtil,Vi=(_createClass(ICEBoundingBox,[{key:"containsPoint",value:function containsPoint(t){var e=this.getMinAndMaxPoint(),n=e.minX,i=e.minY,o=e.maxX,e=e.maxY;if(t[0]<n||t[0]>o||t[1]<i||t[1]>e)return!1;for(var s=0,r=this.getBoundingLines(),a=0;a<r.length;a++){var l,h=r[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]&&s++}return 0!==s&&s%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],o=[this.tr,this.bl,this.br],s=0;s<o.length;s++){var r=o[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{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],o=this.br[1],s=t.tl[0],r=t.br[0],a=t.tl[1],t=t.br[1];return!(r<e||t<i||n<s||o<a)}},{key:"transform",value:function transform(t){var e=transformMat2d([],this.tl,t),n=transformMat2d([],this.tr,t),i=transformMat2d([],this.bl,t),o=transformMat2d([],this.br,t),t=transformMat2d([],this.center,t);return new ICEBoundingBox([].concat(_toConsumableArray(e),_toConsumableArray(n),_toConsumableArray(i),_toConsumableArray(o),_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 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]]}function GeoUtil(){throw _classCallCheck(this,GeoUtil),new Error("GeoUtil is a static util class.")}function getVal(t,e){return e.split(".").reduce(function(t,e){return t[e]},t)}function flattenTree(t,e,n,i){for(var o=0<arguments.length&&void 0!==t?t:[],s=1<arguments.length&&void 0!==e?e:[],r=2<arguments.length&&void 0!==n?n:1,a=3<arguments.length&&void 0!==i?i:null,l=0;l<s.length;l++){var h=s[l];h._level=r,h._pid=a,o.push(h),flattenTree(o,h.childNodes||[],r+1,h.id)}return o}_inherits(ICEComponent,d),Ui=_createSuper(ICEComponent),_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(D),this.state.display&&(this.calcComponentParams(),this.applyStyleToCtx(),this.applyTransformToCtx(),this.doRender(),this.trigger(N),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 fn(6);return fn!=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],o=e[1],s=e[2],r=e[3],a=e[4],e=e[5],l=n[0],n=n[1];return t[0]=i*l,t[1]=o*l,t[2]=s*n,t[3]=r*n,t[4]=a,t[5]=e,t}([],function rotate(t,e,n){var i=e[0],o=e[1],s=e[2],r=e[3],a=e[4],e=e[5],l=Math.sin(n),n=Math.cos(n);return t[0]=i*n+s*l,t[1]=o*n+r*l,t[2]=i*-l+s*n,t[3]=o*-l+r*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,e*yn,n*yn),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,o=this.state.height,e=new Vi([0-e,0-n,0-e+i,0-n,0-e,0-n+o,0-e+i,0-n+o,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,o=e.maxX,e=e.maxY,t=t.centerPoint;return new Vi([n,i,o,i,n,e,o,e,t[0],t[1]])}},{key:"setState",value:function setState(t){pn(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 E;this.trigger("BEFORE_MOVE",_objectSpread2(_objectSpread2({},n),{},{left:t,top:e})),this.setState({left:t,top:e}),this.trigger(a,_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 E;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 E;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-=Hi.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 Hi.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(q,null,{component:this}),this.purgeEvents(),this.ice=null,this.ctx=null,this.root=null,this.evtBus=null,this.parentNode=null}}]);var Ui,n=ICEComponent;function ICEComponent(){var t,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEComponent),_defineProperty$1(_assertThisInitialized(t=Ui.call(this)),"__dirty",!0),_defineProperty$1(_assertThisInitialized(t),"props",{id:"ICE_"+function uuid(){if(_.crypto)return _.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)})}(),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=pn(t.props,e),t.state=Z2(t.props),t.root=_,t.initEvents(),t}_defineProperty$1(n,"instanceCounter",0);_inherits(ICEPath,n),Wi=_createSuper(ICEPath),_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)}}]);var qi,Xi,Ji,Wi,p=ICEPath,u=(_inherits(ICERect,p),Ji=_createSuper(ICERect),_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),Nt=(_inherits(ICEGroup,u),Xi=_createSuper(ICEGroup),_createClass(ICEGroup,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEGroup.prototype),"initEvents",this).call(this),this.once(V,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(H),t.ice=this.ice,t.ctx=this.ice.ctx,t.evtBus=this.ice.evtBus,t.trigger(V)}},{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){pn(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),c=(_inherits(ICEControlPanel,Nt),qi=_createSuper(ICEControlPanel),_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);function ICEControlPanel(t){return _classCallCheck(this,ICEControlPanel),_defineProperty$1(_assertThisInitialized(t=qi.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))),"isControlPanel",!0),t}function ICEGroup(t){return _classCallCheck(this,ICEGroup),_defineProperty$1(_assertThisInitialized(t=Xi.call(this,t)),"parentNode",null),_defineProperty$1(_assertThisInitialized(t),"childNodes",[]),t}function ICERect(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICERect),Ji.call(this,_objectSpread2({width:10,height:10},t))}function ICEPath(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEPath),_defineProperty$1(_assertThisInitialized(t=Wi.call(this,_objectSpread2({closePath:!0},t))),"path2D",new Path2D),t}function td(t){return null==t}_inherits(ICEEllipse,p),Ki=_createSuper(ICEEllipse),_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){td(t.radiusX)?td(t.width)||(t.radiusX=t.width/2):t.width=2*t.radiusX,td(t.radiusY)?td(t.height)||(t.radiusY=t.height/2):t.height=2*t.radiusY,_get(_getPrototypeOf(ICEEllipse.prototype),"setState",this).call(this,t)}}]);var $i,Fi,Gi,Ki,l=ICEEllipse,b=(_inherits(ICECircle,l),Gi=_createSuper(ICECircle),_createClass(ICECircle)),Qi=(_inherits(ICELinkHook,b),Fi=_createSuper(ICELinkHook),_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(a,this.resizeEvtHandler,this)}},{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){}},{key:"mosueDownHandler",value:function mosueDownHandler(t){this.evtBus.trigger(J,new E({target:this}))}},{key:"mosueMoveHandler",value:function mosueMoveHandler(t){this.evtBus.trigger($,new E({target:this}))}},{key:"mosueUpHandler",value:function mosueUpHandler(t){this.evtBus.trigger(F,new E({target:this}))}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){var e;this.parentNode&&(e=this.props.position,this.parentNode.trigger(G,new E(t,{position:e})),this.parentNode.trigger(h,new E(t,{position:e})))}}]),ICELinkHook),Zi=(_inherits(LineControlPanel,c),$i=_createSuper(LineControlPanel),_createClass(LineControlPanel,[{key:"initControls",value:function initControls(){var t=this.state.width,e=this.state.height,n=this.controlSize/2;this.startControl=new Qi({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 Qi({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(h,this.resizeEvtHandler,this)}},{key:"enable",value:function enable(){this.setState({display:!0}),this.resume(h),this.showHooks()}},{key:"disable",value:function disable(){this.setState({display:!1}),this.suspend(h),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,o=t.points.length,s=t.points[0][0],r=t.points[0][1],a=t.points[o-1][0],l=t.points[o-1][1],o=transformMat2d([],[n,i],invert([],t.absoluteLinearMatrix)),n=o[0],i=o[1];switch(e){case"start":s+=n,r+=i;break;case"end":a+=n,l+=i}this.targetComponent.setState({startPoint:[s,r],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(a,this.updatePosition,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(a,this.updatePosition,this),this._targetComponent&&this._targetComponent.once(q,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),Yi=/\s/;function LineControlPanel(t){return _classCallCheck(this,LineControlPanel),_defineProperty$1(_assertThisInitialized(t=$i.call(this,_objectSpread2(_objectSpread2({},t),{},{zIndex:10001e3,linkable:!1,showMinBoundingBox:!1,showMaxBoundingBox:!1}))),"controlSize",16),t.initControls(),t}function ICELinkHook(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkHook),Fi.call(this,_objectSpread2({linkable:!1},t))}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,Gi.call(this,t)}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,Ki.call(this,t)}function Dd(t){return"symbol"==typeof t||Co(t)&&"[object Symbol]"==go(t)}function Ed(t){return t&&t.slice(0,yo(t)+1).replace(vo,"")}function Ld(t){if("number"==typeof t)return t;if(bo(t))return NaN;if(mo(t)&&(e="function"==typeof t.valueOf?t.valueOf():t,t=mo(e)?e+"":e),"string"!=typeof t)return 0===t?t:+t;t=Ed(t);var e=_o.test(t);return e||Eo.test(t)?Po(t.slice(2),e?2:8):ko.test(t)?NaN:+t}function Nd(t){return t?(t=xo(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function Ud(t){if("string"==typeof t)return t;if(So(t))return wo(t,Ud)+"";if(Io(t))return Oo?Oo.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Xd(t){return null==t?"":Ud(t)}var to,eo,no,io,oo,so,ro,ao,lo,ho,co,uo,po,fo,yo=function trimmedEndIndex$1(t){for(var e=t.length;e--&&Yi.test(t.charAt(e)););return e},vo=/^\s+/,go=t,Co=v,mo=la,bo=Dd,ko=/^[-+]0x[0-9a-f]+$/i,_o=/^0b[01]+$/i,Eo=/^0o[0-7]+$/i,Po=parseInt,xo=Ld,wo=function arrayMap$1(t,e){for(var n=-1,i=null==t?0:t.length,o=Array(i);++n<i;)o[n]=e(t[n],n,t);return o},So=s,Io=Dd,C=o?o.prototype:void 0,Oo=C?C.toString:void 0,Mo=function toInteger$1(t){var t=Nd(t),e=t%1;return t==t?e?t-e:t:0},jo=Ld,Ao=i.isFinite,Bo=Math.min,Lo=function createRound$1(t){var o=Math[t];return function(t,e){var n,i;return t=jo(t),(e=null==e?0:Bo(Mo(e),292))&&Ao(t)?(n=(Xd(t)+"e").split("e"),i=o(n[0]+"e"+(+n[1]+e)),+((n=(Xd(i)+"e").split("e"))[0]+"e"+(+n[1]-e))):o(t)}}("round"),To=(_inherits(ResizeControl,u),fo=_createSuper(ResizeControl),_createClass(ResizeControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ResizeControl.prototype),"initEvents",this).call(this),this.on(a,this.resizeEvtHandler,this)}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){if(this.parentNode){var e=t.quadrant,n=t.movementX,i=t.movementY,o=this.parentNode.state,s=o.left,r=o.top,a=o.width,l=o.height,o=transformMat2d([],[n,i],invert([],o.absoluteLinearMatrix)),n=o[0],i=o[1];switch(e){case 1:s-=n,r+=i,a+=2*n,l-=2*i;break;case 2:s+=n,r+=i,a-=2*n,l-=2*i;break;case 3:s+=n,r-=i,a-=2*n,l+=2*i;break;case 4:s-=n,r-=i,a+=2*n,l+=2*i;break;case 5:r+=i,l-=2*i;break;case 6:r-=i,l+=2*i;break;case 7:s+=n,a-=2*n;break;case 8:s-=n,a+=2*n}o={top:r,left:s,width:Math.abs(a),height:Math.abs(l)};this.parentNode.trigger(G,new E(t,{quadrant:e})),this.parentNode.setState(o),this.parentNode.trigger(h,new E(t,{quadrant:e}))}}},{key:"moveGlobalPosition",value:function moveGlobalPosition(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:new E,i=0<t?1:-1,o=0<e?1:-1,s=this.parentNode.state,r=s.localOrigin,a=s.width,l=s.height,s=transformMat2d([],[t,e],invert([],s.absoluteLinearMatrix)),s=(t=s[0],e=s[1],this.state),h=s.left,c=s.top,s=s.quadrant,u=this.state.width/2,d=0;"x"===this.state.direction?d=0<(h=0===Lo(h+=t)?.5*i:h)+u-r[0]?8:7:"y"===this.state.direction?d=0<(c=0===Lo(c+=e)?.5*o:c)+u-r[1]?6:5:"xy"===this.state.direction&&(o=-l/2/(o=0===Lo(o=-a/2)?.5*i:o),0===Lo(a=a/2)&&(a=.5*i),c+=e=2===s||4==s?o*(h+u-r[0]+t)-(c+u-r[1]):-l/2/a*(h+u-r[0]+t)-(c+u-r[1]),d=0<(h+=t)+u-r[0]?0<c+u-r[1]?4:1:0<c+u-r[1]?3:2),s!==d&&this.parentNode.toggleControlQuadrant(this,d),this.setPosition(h,c,new E(n,{left:h,top:c,tx:t,ty:e,quadrant:d}))}}]),ResizeControl),Ro=(_inherits(RotateControl,b),po=_createSuper(RotateControl),_createClass(RotateControl,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(RotateControl.prototype),"initEvents",this).call(this),this.on(a,this.rotateEvtHandler,this)}},{key:"rotateEvtHandler",value:function rotateEvtHandler(t){var e;this.parentNode&&(e=this.parentNode.state.absoluteOrigin,t={transform:{rotate:Hi.calcRotateAngle(t.offsetX,t.offsetY,e[0],e[1])+90}},this.parentNode.trigger("BEFORE_ROTATE",new E(t)),this.parentNode.setState(t),this.parentNode.trigger(K,new E(t)))}}]),RotateControl),Do=(_inherits(TransformControlPanel,c),uo=_createSuper(TransformControlPanel),_createClass(TransformControlPanel,[{key:"initControls",value:function initControls(){var t=this.state.width,e=this.state.height,n=t/2,i=e/2,o=this.resizeControlSize/2,s=[{direction:"xy",quadrant:2,position:[-o,-o]},{direction:"y",quadrant:5,position:[n-o,-o]},{direction:"xy",quadrant:1,position:[t-o,-o]},{direction:"x",quadrant:8,position:[t-o,i-o]},{direction:"xy",quadrant:4,position:[t-o,e-o]},{direction:"y",quadrant:6,position:[n-o,e-o]},{direction:"xy",quadrant:3,position:[-o,e-o]},{direction:"x",quadrant:7,position:[-o,i-o]}];this.resizeControlInstanceCache=[];for(var r=0;r<s.length;r++){var a=s[r],a=new To({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 Ro({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(h,this.resizeEvtHandler,this),this.on(K,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(h),this.resume(K),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(h),this.suspend(K),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(K))}},{key:"resizeEvtHandler",value:function resizeEvtHandler(t){if(this.targetComponent){var e=t.quadrant,n=t.movementX,i=t.movementY,t=this.targetComponent.state,o=t.left,s=t.top,r=t.width,a=t.height,t=transformMat2d([],[n,i],invert([],t.absoluteLinearMatrix)),n=t[0],i=t[1];switch(e){case 1:o-=n,s+=i,r+=2*n,a-=2*i;break;case 2:o+=n,s+=i,r-=2*n,a-=2*i;break;case 3:o+=n,s-=i,r-=2*n,a+=2*i;break;case 4:o-=n,s-=i,r+=2*n,a+=2*i;break;case 5:s+=i,a-=2*i;break;case 6:s-=i,a+=2*i;break;case 7:o+=n,r-=2*n;break;case 8:o-=n,r+=2*n}this.targetComponent.setState({left:o,top:s,width:Math.abs(r),height:Math.abs(a)}),this.targetComponent.trigger(h)}}},{key:"updateControlPositions",value:function updateControlPositions(){for(var t=this.state.width,e=this.state.height,n=t/2,i=e/2,o=this.resizeControlSize/2,s=0;s<this.resizeControlInstanceCache.length;s++){var r=this.resizeControlInstanceCache[s],a=[0,0];switch(r.state.quadrant){case 1:a=[t-o,-o];break;case 2:a=[-o,-o];break;case 3:a=[-o,e-o];break;case 4:a=[t-o,e-o];break;case 5:a=[n-o,-o];break;case 6:a=[n-o,e-o];break;case 7:a=[-o,i-o];break;case 8:a=[t-o,i-o]}r.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,o;this.targetComponent&&(t=this.targetComponent.getRotateAngle(),e=(o=this.targetComponent.getLocalLeftTop()).left,n=o.top,i=o.width,o=o.height,this.setState({left:e,top:n,width:i,height:o,transform:{rotate:t}}))}},{key:"targetComponent",get:function get(){return this._targetComponent},set:function set(t){var e=this;this._targetComponent&&this._targetComponent.off(a,this.updatePanel,this),this._targetComponent=t,this._targetComponent&&this._targetComponent.on(a,this.updatePanel,this),this._targetComponent&&this._targetComponent.once(q,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 o=0;switch(e){case 1:o=3;break;case 2:o=4;break;case 3:o=1;break;case 4:o=2;break;case 5:o=6;break;case 6:o=5;break;case 7:o=8;break;case 8:o=7}i.setState({quadrant:o})}}t.setState({quadrant:e})}}]),TransformControlPanel),No=(_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),zo=[["mousedown","ICE_MOUSEDOWN"],["mouseup","ICE_MOUSEUP"],["mousemove","ICE_MOUSEMOVE"],["click","ICE_CLICK"],["dbclick","ICE_DBCLICK"],["contextmenu","ICE_CONTEXTMENU"]],Ho=[["keydown","ICE_KEYDOWN"],["keyup","ICE_KEYUP"]],Vo=(_createClass(DOMEventDispatcher,[{key:"start",value:function start(){for(var i=this,o=null,s=[].concat(_toConsumableArray(zo),_toConsumableArray(Ho)),t=function _loop(t){var t=s[t],e=t[0],n=t[1];i.ice.evtBus.on(n,function(t){i._stopped||((o="ICE_MOUSEMOVE"!==n&&-1===n.indexOf("KEY")?i.findTargetComponent(t):o)&&(t.target=o).trigger(e,t),i.ice.evtBus.trigger(e,t,{component:o}))})},e=0;e<s.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.toolNodes),i=flattenTree([],this.ice.childNodes),o=[].concat(_toConsumableArray(t),_toConsumableArray(i));o.sort(function(t,e){return t.state.zIndex-e.state.zIndex});for(var s=0;s<o.length;s++){var r=o[s],a=r.state,l=a.interactive,a=a.display;r.containsPoint(e,n)&&l&&a&&this.selectionCandidates.push(r)}t=this.selectionCandidates.pop();return this.selectionCandidates=[],t}}]),DOMEventDispatcher),Uo={evtBuses:[],start:function start(){if(_&&_.addEventListener)for(var t=function _loop(t){for(var n=Uo.evtBuses[t],i=[].concat(_toConsumableArray(zo),_toConsumableArray(Ho)),e=function _loop2(t){var e=i[t];_.addEventListener(e[0],function(t){n.trigger(e[1],t)})},o=0;o<i.length;o++)e(o)},e=0;e<Uo.evtBuses.length;e++)t(e)},regitserEvtBus:function regitserEvtBus(t){Uo.evtBuses.includes(t)||Uo.evtBuses.push(t)},delEvtBus:function delEvtBus(t){Uo.evtBuses.includes(t)&&Uo.evtBuses.splice(Uo.evtBuses.indexOf(t),1)}},qo=(_inherits(EventBus,d),co=_createSuper(EventBus),_createClass(EventBus)),Xo=(_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),M=(_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),y=(_inherits(ICEDotPath,p),ho=_createSuper(ICEDotPath),_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],o=1;o<this.state.dots.length;o++){var s=this.state.dots[o];s[0]<t&&(t=s[0]),s[0]>n&&(n=s[0]),s[1]<e&&(e=s[1]),s[1]>i&&(i=s[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 o=transformMat2d([],e[i],t);n.push(o)}return n}}]),ICEDotPath),f=(_inherits(ICEImage,n),lo=_createSuper(ICEImage),_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),g=_createClass(function ICEBezier(){_classCallCheck(this,ICEBezier)}),Jo=(_inherits(ICELinkSlot,b),ao=_createSuper(ICELinkSlot),_createClass(ICELinkSlot,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICELinkSlot.prototype),"initEvents",this).call(this),this.once(D,this.beforeRenderHandler,this),this.once(q,this.beforeRemoveHandler,this)}},{key:"keyboardEvtHandler",value:function keyboardEvtHandler(t){}},{key:"beforeRenderHandler",value:function beforeRenderHandler(t){this.evtBus.on(J,this.hookMouseDownHandler,this),this.evtBus.on($,this.hookMouseMoveHandler,this),this.evtBus.on(F,this.hookMouseUpHandler,this),this.evtBus.on("mouseup",this.globalMouseUpHandler,this)}},{key:"beforeRemoveHandler",value:function beforeRemoveHandler(t){this.evtBus.off(J,this.hookMouseDownHandler,this),this.evtBus.off($,this.hookMouseMoveHandler,this),this.evtBus.off(F,this.hookMouseUpHandler,this),this.evtBus.off("mouseup",this.globalMouseUpHandler,this),this.hostComponent=null}},{key:"globalMouseUpHandler",value:function globalMouseUpHandler(){this.setState({display:!1})}},{key:"hookMouseDownHandler",value:function hookMouseDownHandler(t){this._hostComponent&&this.setState({display:!0})}},{key:"hookMouseMoveHandler",value:function hookMouseMoveHandler(t){t=t.target;this.isIntersectWithHook(t)?(this.setState({style:{fillStyle:"#fffb00"}}),t._currentAboveSlot=this,t.setState({style:{fillStyle:"#fffb00"}})):(this.setState({style:{fillStyle:"#3ce92c"}}),t._currentAboveSlot===this&&t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"hookMouseUpHandler",value:function hookMouseUpHandler(t){var e,n;this._hostComponent&&(e=(t=t.target).parentNode.targetComponent,n=t.state.position,this.isIntersectWithHook(t)?e&&e.setLink(n,this._hostComponent,this.props.position):e&&e.removeLink(n,this._hostComponent,this.props.position),this.setState({display:!1,style:{fillStyle:"#3ce92c"}}),t.setState({style:{fillStyle:"#3ce92c"}}))}},{key:"isIntersectWithHook",value:function isIntersectWithHook(t){var e=this.getMaxBoundingBox(),t=t.getMaxBoundingBox();return!!e.isIntersect(t)}},{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(N,this.updatePosition,this),this._hostComponent=t,this._hostComponent&&this._hostComponent.on(N,this.updatePosition,this),this._hostComponent&&this._hostComponent.once(q,function(){e._hostComponent=null,e.setState({display:!1})},this),this._hostComponent&&this.setState({display:!0})}}]),ICELinkSlot),s=(_inherits(ICEPolyLine,y),ro=_createSuper(ICEPolyLine),_createClass(ICEPolyLine,[{key:"initEvents",value:function initEvents(){_get(_getPrototypeOf(ICEPolyLine.prototype),"initEvents",this).call(this),this.once(V,this.afterAddHandler,this)}},{key:"afterAddHandler",value:function afterAddHandler(t){this.evtBus.once(X,this.makeConnection,this)}},{key:"makeConnection",value:function makeConnection(){var t,e,n=this.state.links;n&&(n.start&&(t=n.start.id,e=n.start.position,t&&e&&(t=this.ice.findComponent(t),this.setLink("start",t,e))),n.end&&(t=n.end.id,e=n.end.position,t&&e&&(n=this.ice.findComponent(t),this.setLink("end",n,e)))),this.ice.dirty=!0}},{key:"setLink",value:function setLink(t,e,n){this.removeLink(t,e,n),this.links[t]={component:e,position:n},e.on(a,this.followComponent,this),e.on(h,this.followComponent,this),e.on(K,this.followComponent,this),e.once(N,this.followComponent,this),this.followComponent();var i,o={};for(i in this.links){var s=this.links[i];s.component&&s.position&&(o[i]={id:s.component.props.id,position:s.position})}this.setState({links:_objectSpread2({},o),draggable:!1})}},{key:"removeLink",value:function removeLink(t,e,n){var i=this.links[t].component,o=this.links[t].position;i===e&&o===n&&(i&&i.off(a,this.followComponent,this),i&&i.off(h,this.followComponent,this),i&&i.off(K,this.followComponent,this),this.links[t]={},this.state.links[t]={}),this.links.start.component||this.links.end.component||this.setState({draggable:!0})}},{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.links){var n=this.links[e].position,i=this.links[e].component;if(n&&i){var o=i.getMinBoundingBox(),s=[0,0];switch(n){case"T":s=o.tc;break;case"R":s=o.rc;break;case"B":s=o.bc;break;case"L":s=o.lc}switch(e){case"start":this.setState({startPoint:_toConsumableArray(s)});break;case"end":this.setState({endPoint:_toConsumableArray(s)})}}}}},{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],o=i[0]-t,i=i[1]-e;this.state.dots.push([o,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),o=Math.sin(this.state.arrowAngel),s=this.state.arrowLength*(n*i-t*o),r=this.state.arrowLength*(t*i+n*o),a=this.state.arrowLength*(n*i+t*o),t=this.state.arrowLength*(t*i-n*o);return[[s+=e[0],r+=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=Lo(this.state.points[0][0],2),i=Lo(this.state.points[0][1],2),o=0,s=[Lo(this.state.points[e-1][0],2)-n,Lo(this.state.points[e-1][1],2)-i],r=0;r<e;r++){var a=this.state.points[r],a=[a[0]-n,a[1]-i];0===(a=s[0]*a[1]-s[1]*a[0],(t=[])[0]=t[1]=0,t[2]=a,t[2])&&o++}return o===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,o=Math.cos(n*Math.PI/180)*i/2,n=Math.sin(n*Math.PI/180)*i/2;return[[0+(o=Lo(o,3)),0+(n=Lo(n,3))],[0-o,0-n],[e+o,t+n],[e-o,t-n]]}},{key:"getMinBoundingBox",value:function getMinBoundingBox(){var t=this.state.localOrigin[0],e=this.state.localOrigin[1],n=this.calc4VertexPoints(),t=new Vi([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(td(t.width)||delete t.width,td(t.height)||delete t.height,td(t.transform)||delete t.transform,!td(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(!td(t.top))for(var i=t.top-this.state.points[0][1],o=0;o<this.state.points.length;o++)this.state.points[o][1]+=i;var s;td(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]),td(t.endPoint)||(s=this.state.points.length,this.state.points[s-1]=_toConsumableArray(t.endPoint)),_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],Hi.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 o=n[i],s=o.o[0],r=o.o[1],a=o.d[0],o=o.d[1],l=Math.hypot(a-s,o-r),s=Math.hypot(s-t,r-e),r=Math.hypot(a-t,o-e);if(l-3<=s+r&&s+r<=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.links.start&&this.removeLink("start",this.links.start.component,this.links.start.position),this.links.end&&this.removeLink("end",this.links.end.component,this.links.end.position),_get(_getPrototypeOf(ICEPolyLine.prototype),"destory",this).call(this)}}],[{key:"arrangeParam",value:function arrangeParam(t){var e=pn({},{lineType:"solid",lineWidth:1,arrow:"none",arrowLength:15,arrowAngel:30*yn,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),o=(_inherits(ICEVisioLink,s),so=_createSuper(ICEVisioLink),_createClass(ICEVisioLink,[{key:"calcDots",value:function calcDots(){var t=this.interpolate(),e=this.state,n=e.left,i=e.top,o=t[0][2];this.state.points=[],this.state.dots=[];for(var s=0;s<o.length;s++){var r=o[s];this.state.points.push([r.x,r.y]),this.state.dots.push([r.x-n,r.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],o=new M(e,n),s=new M(i,t),r=[],a=null,l=null,h=[],c=new Vi,u=new Vi,e=this.links.start.component;if(e){c=e.getMinBoundingBox(),r[0]=new M(o.x,c.tl[1]-this.state.escapeDistance),r[1]=new M(c.tr[0]+this.state.escapeDistance,o.y),r[2]=new M(o.x,c.br[1]+this.state.escapeDistance),r[3]=new M(c.tl[0]-this.state.escapeDistance,o.y);for(var a=r[0],d=1;d<r.length;d++)this.distance(o,r[d])<this.distance(o,a)&&(a=r[d])}n=this.links.end.component;if(n){u=n.getMinBoundingBox(),r[0]=new M(s.x,u.tl[1]-this.state.escapeDistance),r[1]=new M(u.tr[0]+this.state.escapeDistance,s.y),r[2]=new M(s.x,u.br[1]+this.state.escapeDistance),r[3]=new M(u.tl[0]-this.state.escapeDistance,s.y);for(var l=r[0],p=1;p<r.length;p++)this.distance(s,r[p])<this.distance(s,l)&&(l=r[p])}var i=0,t=[o],e=(a&&(t.push(a),i=1),l&&t.push(l),t.push(s),M.cloneArray(t)),n=(h.push(["s0","s0",e]),M.cloneArray(t)),e=M.cloneArray(n),t=(e.splice(i+1,0,new M(e[i].x,e[i+1].y)),h.push(["s1","s1_1",e]),M.cloneArray(n)),e=(t.splice(i+1,0,new M(t[i+1].x,t[i].y)),h.push(["s1","s1_2",t]),M.cloneArray(n)),t=new M((e[i].x+e[i+1].x)/2,e[i].y),f=new M((e[i].x+e[i+1].x)/2,e[i+1].y),t=(e.splice(i+1,0,t,f),h.push(["s2","s2_1",e]),M.cloneArray(n)),f=new M(t[i].x,(t[i].y+t[i+1].y)/2),e=new M(t[i+1].x,(t[i].y+t[i+1].y)/2),f=(t.splice(i+1,0,f,e),h.push(["s2","s2_2",t]),M.cloneArray(n)),e=[f[i].x+20,f[i+1].x+20],t=(c&&e.push(c.br[0]+20),u&&e.push(u.br[0]+20),this.max(e)),e=new M(t,f[i].y),t=new M(t,f[i+1].y),e=(f.splice(i+1,0,e,t),h.push(["s2","s2_3",f]),M.cloneArray(n)),t=[e[i].y-20,e[i+1].y-20],f=(c&&t.push(c.tl[1]-20),u&&t.push(u.tl[1]-20),this.min(t)),t=new M(e[i].x,f),f=new M(e[i+1].x,f),t=(e.splice(i+1,0,t,f),h.push(["s2","s2_4",e]),M.cloneArray(n)),f=[t[i].x-20,t[i+1].x-20],e=(c&&f.push(c.tl[0]-20),u&&f.push(u.tl[0]-20),this.min(f)),f=new M(e,t[i].y),e=new M(e,t[i+1].y),f=(t.splice(i+1,0,f,e),h.push(["s2","s2_5",t]),M.cloneArray(n)),e=[f[i].y+20,f[i+1].y+20],t=(c&&e.push(c.tl[1]+c.height+20),u&&e.push(u.tl[1]+u.height+20),this.max(e)),n=new M(f[i].x,t),e=new M(f[i+1].x,t);f.splice(i+1,0,n,e),h.push(["s2","s2_6",f]);for(var y=[],v=0;v<h.length;v++){var g=h[v][2];this.orthogonalPath(g)&&y.push(h[v])}if(h=y,!o.equals(s)){for(var C=[],m=0;m<h.length;m++){var b=h[m][2];this.forwardPath(b)&&C.push(h[m])}(h=C).length}for(var k=[],_=0;_<h.length;_++){var E=!1,P=h[_][2].slice();(u||c)&&(P=P.slice(1,P.length-1)),c&&(E=E||this.polylineIntersectsRectangle(P,c)),(E=u?E||this.polylineIntersectsRectangle(P,u):E)||k.push(h[_])}(h=0!=k.length?k:h).length;for(var x=h[0][2].length,w=[],S=0;S<h.length;S++)h[S][2].length==x&&w.push(h[S]);for(var h=w,I=0,O=0;O<h.length;O++)this.scorePath(h[I][2])<this.scorePath(h[O][2])&&(I=O);return[h[I]]}},{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&&(o=t,t=e,e=o),o=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),n=t.startPoint.y-o*t.startPoint.x,i=e.startPoint.x,t.contains(i,o=o*i+n)&&e.contains(i,o);var n=(t.endPoint.y-t.startPoint.y)/(t.endPoint.x-t.startPoint.x),i=t.startPoint.y-n*t.startPoint.x,o=(e.endPoint.y-e.startPoint.y)/(e.endPoint.x-e.startPoint.x),s=e.startPoint.y-o*e.startPoint.x;if(n==o)return i==s&&(t.contains(e.startPoint.x,e.startPoint.y)||t.contains(e.endPoint.x,e.endPoint.y));s=(s-i)/(n-o),o=n*s+i;return t.contains(s,o)&&e.contains(s,o)}},{key:"polylineIntersectsRectangle",value:function polylineIntersectsRectangle(t,e){var n=2<arguments.length&&void 0!==arguments[2]&&arguments[2],i=[];i.push(new Xo(new M(e.x1,e.y1),new M(e.x2,e.y1))),i.push(new Xo(new M(e.x2,e.y1),new M(e.x2,e.y2))),i.push(new Xo(new M(e.x2,e.y2),new M(e.x1,e.y2))),i.push(new Xo(new M(e.x1,e.y2),new M(e.x1,e.y1)));for(var o=0;o<t.length-1;o++)for(var s=new Xo(t[o],t[o+1]),r=0;r<i.length;r++)if(this.lineIntersectsLine(s,i[r]))return!0;if(n)for(var a=new Xo(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 td(t.startPoint)&&(t.startPoint=[0,0]),td(t.endPoint)&&(t.endPoint=[10,10]),t.points=[_toConsumableArray(t.startPoint),_toConsumableArray(t.endPoint)],_objectSpread2({escapeDistance:30},t)}}]),ICEVisioLink),C=(_inherits(ICEIsogon,y),oo=_createSuper(ICEIsogon),_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),o=Math.floor(e*Math.cos(i)+e),i=Math.floor(e*Math.sin(i)+e);this.state.dots.push([o,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){td(t.radius)?td(t.width)?td(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),i=(_inherits(ICERose,y),io=_createSuper(ICERose),_createClass(ICERose,[{key:"calcDots",value:function calcDots(){var t=this.state.radius,e=this.state.leafNum;this.state.dots=[];for(var n,i,o=Math.PI/this.state.pointNumber,s=0;n=t+t*Math.sin(e*s)*Math.cos(s),i=t+t*Math.sin(e*s)*Math.sin(s),this.state.dots.push([n,i]),!((s+=o)>=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){td(t.radius)?td(t.width)?td(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),Wo=(_inherits(ICEStar,y),no=_createSuper(ICEStar),_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,o=this.state.outerRadius,s=this.state.innerRadius,r=0;r<this.state.spikes;r++)t=Math.cos(n)*o+o,e=Math.sin(n)*o+o,this.state.dots.push([t,e]),n+=i,t=Math.cos(n)*s+o,e=Math.sin(n)*s+o,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){td(t.outerRadius)?td(t.width)?td(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),$o="__ICE_UTILS_TEXT_MEASURE_DIV__",Fo=(_inherits(ICEText,n),eo=_createSuper(ICEText),_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($o))){(e=this.root.document.createElement("div")).setAttribute("id",$o);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 o=this.state.style,s=o.paddingTop,r=o.paddingBottom,a=o.paddingLeft,l=o.paddingRight,h={width:e.offsetWidth+a+l,height:e.offsetHeight+s+r};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=pn({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),Go={ICERect:u,ICECircle:b,ICEEllipse:l,ICEStar:Wo,ICEIsogon:C,ICEText:Fo,ICEImage:f,ICEGroup:Nt,ICEVisioLink:o,ICEPolyLine:s},P={evtBuses:[],stopped:!1,frameCallback:function frameCallback(){for(var t=0;t<P.evtBuses.length;t++){if(P.stopped)return;P.evtBuses[t].trigger(R)}P.stopped||_.requestFrame(P.frameCallback)},start:function start(){P.stopped=!1,_.requestFrame(P.frameCallback)},stop:function stop(){P.stopped=!0},pause:function pause(){},resume:function resume(){},regitserEvtBus:function regitserEvtBus(t){P.evtBuses.includes(t)||P.evtBuses.push(t)},delEvtBus:function delEvtBus(t){P.evtBuses.includes(t)&&P.evtBuses.splice(P.evtBuses.indexOf(t),1)}},Ko=(_createClass(ICELinkSlotManager,[{key:"start",value:function start(){return this.createLinkSlots(),this.ice.evtBus.on($,this.hookMouseMoveHandler,this),this}},{key:"stop",value:function stop(){return this.ice.evtBus.off($,this.hookMouseMoveHandler,this),this}},{key:"hookMouseMoveHandler",value:function hookMouseMoveHandler(t){for(var e=t.target.getMaxBoundingBox(),n=null,i=_toConsumableArray(this.ice.childNodes),o=0;o<i.length;o++){var s=i[o];if(s&&s.state.linkable&&s.getMaxBoundingBox().isIntersect(e)){n=s;break}}for(var r=0;r<this.ice._linkSlots.length;r++){var a=this.ice._linkSlots[r];a.hostComponent!==n&&(a.hostComponent=n)}}},{key:"createLinkSlots",value:function createLinkSlots(){var t,e,n,i;this.ice._linkSlots&&this.ice._linkSlots.length||(t=new Jo({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 Jo({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 Jo({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 Jo({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),Qo=(_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 o=0;o<i.length;o++)this.decodeRecursively(n,i[o])}}]),Deserializer),Zo=(_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),Yo=(_inherits(CanvasRenderer,d),to=_createSuper(CanvasRenderer),_createClass(CanvasRenderer,[{key:"start",value:function start(){return this.stopped=!1,this.ice.evtBus.on(R,this.frameEvtHandler,this),this}},{key:"stop",value:function stop(){return this.stopped=!0,this.ice.evtBus.off(R,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(X)}}]),CanvasRenderer),ts=(_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);function ImageCache(t){_classCallCheck(this,ImageCache),_defineProperty$1(this,"imageCache",new Map),this.ice=t}function CanvasRenderer(t){var e;return _classCallCheck(this,CanvasRenderer),_defineProperty$1(_assertThisInitialized(e=to.call(this)),"stopped",!1),_defineProperty$1(_assertThisInitialized(e),"componentQueue",[]),_defineProperty$1(_assertThisInitialized(e),"toolsQueue",[]),e.ice=t,e}function Serializer(t){_classCallCheck(this,Serializer),this.ice=t}function Deserializer(t){_classCallCheck(this,Deserializer),this.ice=t}function ICELinkSlotManager(t){_classCallCheck(this,ICELinkSlotManager),_defineProperty$1(this,"slotRadius",10),this.ice=t}function ICEText(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(_classCallCheck(this,ICEText),ICEText.arrangeParam(t));return(t=eo.call(this,t)).measureText(),t}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,no.call(this,t)}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,io.call(this,t)}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,oo.call(this,t)}function ICEVisioLink(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEVisioLink),t=ICEVisioLink.arrangeParam(t),so.call(this,t)}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=ro.call(this,t)),"isLine",!0),_defineProperty$1(_assertThisInitialized(t),"links",{start:{},end:{}}),t}function ICELinkSlot(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICELinkSlot),ao.call(this,_objectSpread2({linkable:!1,draggable:!1,position:"T"},t))}function ICEImage(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return _classCallCheck(this,ICEImage),lo.call(this,_objectSpread2({width:100,height:100,src:"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"},t))}function ICEDotPath(t){return _classCallCheck(this,ICEDotPath),ho.call(this,_objectSpread2({dots:[],closePath:!0},t))}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}function GeoLine(t,e){_classCallCheck(this,GeoLine),this.startPoint=t,this.endPoint=e}function EventBus(){return _classCallCheck(this,EventBus),co.call(this)}function DOMEventDispatcher(t){_classCallCheck(this,DOMEventDispatcher),_defineProperty$1(this,"selectionCandidates",[]),_defineProperty$1(this,"_stopped",!1),this.ice=t}function ICEControlPanelManager(t){_classCallCheck(this,ICEControlPanelManager),this.ice=t,this.transformControlPanel=new Do({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 Zi({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()}function TransformControlPanel(t){return _classCallCheck(this,TransformControlPanel),_defineProperty$1(_assertThisInitialized(t=uo.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}function RotateControl(t){return _classCallCheck(this,RotateControl),po.call(this,_objectSpread2(_objectSpread2({},t),{},{linkable:!1}))}function ResizeControl(t){return _classCallCheck(this,ResizeControl),fo.call(this,_objectSpread2(_objectSpread2({position:"l",direction:"x",quadrant:1},t),{},{linkable:!1}))}_defineProperty$1(ts,"CACHE_SIZE",100);_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 Go)this.typeMapping[e]=Go[e];return this.root=_,z(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 qo,P.regitserEvtBus(this.evtBus),P.start(),Uo.regitserEvtBus(this.evtBus),Uo.start(),this.eventDispatcher=new Vo(this).start(),this.animationManager=new Z(this).start(),this.controlPanelManager=new No(this).start(),this.renderer=new Yo(this).start(),this.linkSlotManager=new Ko(this).start(),this.serializer=new Zo(this),this.deserializer=new Qo(this),this.imageCache=new ts(this),this}},{key:"addTool",value:function addTool(t){-1===this.childNodes.indexOf(t)&&(this.evtBus.trigger(H,null,{component:t}),t.trigger(H),t.ice=this,t.ctx=this.ctx,t.evtBus=this.evtBus,this.toolNodes.push(t),this.dirty=!0,this.evtBus.trigger(V,null,{component:t}),t.trigger(V))}},{key:"removeTool",value:function removeTool(t){this.evtBus.trigger(q,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(H,null,{component:t}),t.trigger(H),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(V,null,{component:t}),t.trigger(V))}},{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(q,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;P.stop(),this.renderer.stop(),this.eventDispatcher.stopped=!0,this.animationManager.stop(),this.controlPanelManager.stop(),this.linkSlotManager.stop(),this.clearAll(),this.deserializer.fromJSONObject(t),P.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)}}]);var es=ICE;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())}e.AnimationManager=Z,e.CanvasRenderer=Yo,e.DOMEventDispatcher=Vo,e.DOMEventInterceptor=Uo,e.EventBus=qo,e.GeoLine=Xo,e.GeoPoint=M,e.GeoUtil=Hi,e.ICE=es,e.ICEBezier=g,e.ICEBoundingBox=Vi,e.ICECircle=b,e.ICEComponent=n,e.ICEControlPanel=c,e.ICEControlPanelManager=No,e.ICEDotPath=y,e.ICEEllipse=l,e.ICEEventTarget=d,e.ICEGroup=Nt,e.ICEImage=f,e.ICEIsogon=C,e.ICELinkHook=Qi,e.ICELinkSlot=Jo,e.ICEPath=p,e.ICEPolyLine=s,e.ICERect=u,e.ICERose=i,e.ICEStar=Wo,e.ICEText=Fo,e.ICEVisioLink=o,e.LineControlPanel=Zi,e.ResizeControl=To,e.RotateControl=Ro,e.TransformControlPanel=Do,Object.defineProperty(e,"__esModule",{value:!0})});
@@ -95,7 +95,15 @@ declare class ICE {
95
95
  * - 如果组件不需要序列化,需要返回 null
96
96
  * @returns Object
97
97
  */
98
- toJSON(): string;
99
- fromJSON(jsonStr: string): void;
98
+ toJSONString(): string;
99
+ /**
100
+ * 把对象序列化成 JSON 对象:
101
+ * - 容器型组件需要负责子节点的序列化操作
102
+ * - 如果组件不需要序列化,需要返回 null
103
+ * @returns Object
104
+ */
105
+ toJSONObject(): object;
106
+ fromJSONObject(jsonObject: any): void;
107
+ fromJSONString(jsonStr: string): void;
100
108
  }
101
109
  export default ICE;
@@ -8,6 +8,7 @@
8
8
  export default class Deserializer {
9
9
  private ice;
10
10
  constructor(ice: any);
11
- fromJSON(jsonStr: string): void;
11
+ fromJSONObject(jsonObj: any): void;
12
+ fromJSONString(jsonStr: string): void;
12
13
  private decodeRecursively;
13
14
  }
@@ -14,6 +14,13 @@ export default class Serializer {
14
14
  * - 如果组件不需要序列化,需要返回 null
15
15
  * @returns Object
16
16
  */
17
- toJSON(): string;
17
+ toJSONString(): string;
18
+ /**
19
+ * 把对象序列化成 JSON 对象:
20
+ * - 容器型组件需要负责子节点的序列化操作
21
+ * - 如果组件不需要序列化,需要返回 null
22
+ * @returns Object
23
+ */
24
+ toJSONObject(): object;
18
25
  private encodeRecursively;
19
26
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "大漠穷秋",
3
3
  "name": "ice-render",
4
- "version": "0.0.41",
4
+ "version": "0.0.44",
5
5
  "description": "A canvas engine for interactive graphics.",
6
6
  "repository": "https://gitee.com/ice-render/ice-render",
7
7
  "module": "dist/index.js",